Defined in header <cparse/Parser.hh>

protected:
bool skipCommentsBlock();

Repeatedly alternates skipWhiteSpaces() and skipComments() until neither consumes anything. Handles arbitrary interleaving of whitespace and comments — trailing whitespace after a // line, blank lines between block comments, and so on.

Not marked virtual — the loop structure is fixed. To change what counts as whitespace or a comment, override the individual skipWhiteSpaces() / skipComments() methods.

Parameters

None.

Return value

true if any whitespace or comment was consumed during the loop. false if the cursor position was neither whitespace nor a comment opener at entry (nothing consumed).

Exceptions

Depends on the overrides of the two component methods. The base skipWhiteSpaces() and skipComments() do not throw.

Notes

Call this at the start of every top-level construct in your grammar so the grammar does not have to know how comments are interleaved with whitespace:

bool start() override
{
    while (getCursor().isValid())
    {
        skipCommentsBlock();
        if (!parseTopLevelDeclaration())
            return false;
    }
    return true;
}

See also