script::Const

Parse a constant.

Synopsis

Declared in <script/parsing.h>

bool
Const(
    std::string const& str,
    std::span<char const>& sp,
    bool skip = true);

Description

If sp's initial part matches str, sp is optionally updated to skip that part, and true is returned. Otherwise sp is unmodified and false is returned.

Return Value

true if sp begins with str, false otherwise.

Parameters

NameDescription
strThe constant text to match against the start of sp.
spThe input span; on a match it is advanced past the constant when skip is true.
skipWhether to advance sp past the matched constant.