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:
parent
912c9c93e9
commit
a11f49f627
2 changed files with 20 additions and 21 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue