1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibSQL: Add Parser::consume_if helper

The following is a common (and soon to be *very* common) expression:

    if (match(token_type))
        consume();

Using consume_if() makes this a bit simpler and makes it less likely to
forget to invoke consume() after the match().
This commit is contained in:
Timothy Flynn 2021-04-21 09:38:07 -04:00 committed by Andreas Kling
parent 912c9c93e9
commit a11f49f627
2 changed files with 20 additions and 21 deletions

View file

@ -75,6 +75,7 @@ private:
Token consume();
Token consume(TokenType type);
bool consume_if(TokenType type);
bool match(TokenType type) const;
void expected(StringView what);