diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2022-01-24 23:47:22 +0200 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2022-01-25 13:41:09 +0330 |
commit | 67ce9e28a5f8d800176dd2749f884be8f7f64de2 (patch) | |
tree | 0a753b34c2d7a3dad11097fac81fc4c522fee5e3 /Meta/Lagom | |
parent | d49d2c7ec4cbe2c0792cf112055a6f5eca79dd63 (diff) | |
download | serenity-67ce9e28a5f8d800176dd2749f884be8f7f64de2.zip |
AK: Standardize the behaviour of GenericLexer::consume_until overloads
Before this commit all consume_until overloads aside from the Predicate
one would consume (and ignore) the stop char/string, while the
Predicate overload would not, in order to keep behaviour consistent,
the other overloads no longer consume the stop char/string as well.
Diffstat (limited to 'Meta/Lagom')
-rw-r--r-- | Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp | 5 | ||||
-rw-r--r-- | Meta/Lagom/Tools/CodeGenerators/StateMachineGenerator/main.cpp | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp index 6c4b86c941..b77794afcd 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp @@ -230,6 +230,7 @@ static NonnullOwnPtr<Interface> parse_interface(StringView filename, StringView if (lexer.consume_specific("//")) { lexer.consume_until('\n'); + lexer.ignore(); consumed = true; } } @@ -276,7 +277,9 @@ static NonnullOwnPtr<Interface> parse_interface(StringView filename, StringView while (lexer.consume_specific("#import")) { consume_whitespace(); assert_specific('<'); - imports.append(resolve_import(lexer.consume_until('>'))); + auto path = lexer.consume_until('>'); + lexer.ignore(); + imports.append(resolve_import(path)); consume_whitespace(); } diff --git a/Meta/Lagom/Tools/CodeGenerators/StateMachineGenerator/main.cpp b/Meta/Lagom/Tools/CodeGenerators/StateMachineGenerator/main.cpp index 4e3a903990..2c506fbb36 100644 --- a/Meta/Lagom/Tools/CodeGenerators/StateMachineGenerator/main.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/StateMachineGenerator/main.cpp @@ -88,10 +88,12 @@ parse_state_machine(StringView input) num = 16 * num + get_hex_value(c); } else { lexer.consume_specific('\''); - if (lexer.next_is('\\')) + if (lexer.next_is('\\')) { num = (int)lexer.consume_escaped_character('\\'); - else + } else { num = lexer.consume_until('\'').to_int().value(); + lexer.ignore(); + } lexer.consume_specific('\''); } return num; |