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

Name

Description

str

The constant text to match against the start of sp.

sp

The input span; on a match it is advanced past the constant when skip is true.

skip

Whether to advance sp past the matched constant.

Created with MrDocs