Defined in header <cparse/Parser.hh>
protected:
virtual bool skipWhiteSpaces();
Advances the cursor past any run of characters for which std::isspace returns true (space, tab, newline, vertical tab, form feed, carriage return). Returns whether any whitespace was consumed.
Internally uses Cursor::safePeek to check the next character and Cursor::get to consume it in a loop. Any exception from the cursor (EOF during the run) is caught silently — this method never throws out.
Parameters
None.
Return value
true if at least one whitespace character was consumed. false if the cursor position was not a whitespace at entry (no consumption happened).
Exceptions
Not marked noexcept in the declaration (it is virtual and callers may override with a throwing version), but the base implementation catches all cursor exceptions internally. In practice: base implementation does not throw; overrides may.
Notes
Override this if your grammar has a different notion of whitespace — for example, a Python-like grammar where the newline character carries semantic meaning:
bool skipWhiteSpaces() override
{
// consume space and tab but not newline
bool consumed = false;
while (getCursor().safePeek() == ' ' || getCursor().safePeek() == '\t')
{
getCursor().get();
consumed = true;
}
return consumed;
}
Whitespace and comment skipping are separate concerns; see skipComments and skipCommentsBlock.
See also
- Parser::skipComments — comment skipping (no-op by default).
- Parser::skipCommentsBlock — alternates the two.
- Cursor::safePeek — the underlying peek used in the loop.

