mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 16:16:43 +00:00
AK: Add GenericLexer::retreat()
This allows going back one character at a time, and then re-consume previously consumed chars. The code I need this for looks something like this: ASSERT(lexer.consume_specific('\\')); if (lexer.next_is("foo")) ... lexer.retreat(); lexer.consume_escaped_character(); // This expects lexer.peek() == '\\'
This commit is contained in:
parent
ffd1e4831e
commit
1daa5158eb
Notes:
sideshowbarker
2024-07-19 01:40:34 +09:00
Author: https://github.com/linusg
Commit: 1daa5158eb
Pull-request: https://github.com/SerenityOS/serenity/pull/3865
Reviewed-by: https://github.com/nico
2 changed files with 9 additions and 0 deletions
|
@ -48,6 +48,8 @@ public:
|
|||
bool next_is(StringView) const;
|
||||
bool next_is(const char*) const;
|
||||
|
||||
void retreat();
|
||||
|
||||
char consume();
|
||||
bool consume_specific(char);
|
||||
bool consume_specific(StringView);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue