mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +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
Notes:
sideshowbarker
2024-07-18 19:17:23 +09:00
Author: https://github.com/trflynn89
Commit: a11f49f627
Pull-request: https://github.com/SerenityOS/serenity/pull/6538
Reviewed-by: https://github.com/awesomekling
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