C/parser/Parser.cpp
bool Parser::match(SyntaxKind expectedTkK, LexedTokens::IndexType* tkIdx)
{
    auto curTkK = peek().kind();
    if (curTkK == expectedTkK)
    {
        *tkIdx = consume();
        return true;
    }

    diagnosticsReporter_.ExpectedToken(SyntaxKind(expectedTkK));

    if (curTkK != EndOfFile)
        consume();
    *tkIdx = LexedTokens::invalidIndex();
    return false;
}
/**
 * Match a token of the given kind.
 */
Match a token of the given kind.
Match a token of the given kind .
bool Parser::match(SyntaxKind expectedTkK, LexedTokens::IndexType* tkIdx)
{
    auto curTkK = peek().kind();
    if (curTkK == expectedTkK)
    {
        *tkIdx = consume();
        return true;
    }
    diagnosticsReporter_.ExpectedToken(SyntaxKind(expectedTkK));
    if (curTkK != EndOfFile)
        consume();
    *tkIdx = LexedTokens::invalidIndex();
    return false;
}
bool Parser :: match ( SyntaxKind expectedTkK , LexedTokens :: IndexType * tkIdx ) { auto curTkK = peek ( ) . kind ( ) ; if ( curTkK == expectedTkK ) { * tkIdx = consume ( ) ; return true ; } diagnosticsReporter_ . ExpectedToken ( SyntaxKind ( expectedTkK ) ) ; if ( curTkK != EndOfFile ) consume ( ) ; * tkIdx = LexedTokens :: invalidIndex ( ) ; return false ; }
Match a token of the given kind.
Match a token of the given kind .