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
commit a11f49f627
Notes: sideshowbarker 2024-07-18 19:17:23 +09:00
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);