mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
AK: Use consume_until
in SourceGenerator
This got fixed a while ago to not consume the stop character, so we can remove the workaround.
This commit is contained in:
parent
c8eafd3700
commit
9c05b83540
Notes:
sideshowbarker
2024-07-16 20:12:13 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/9c05b83540 Pull-request: https://github.com/SerenityOS/serenity/pull/19440
1 changed files with 2 additions and 8 deletions
|
@ -63,16 +63,10 @@ public:
|
|||
GenericLexer lexer { pattern };
|
||||
|
||||
while (!lexer.is_eof()) {
|
||||
// FIXME: It is a bit inconvenient, that 'consume_until' also consumes the 'stop' character, this makes
|
||||
// the method less generic because there is no way to check if the 'stop' character ever appeared.
|
||||
auto const consume_until_without_consuming_stop_character = [&](char stop) {
|
||||
return lexer.consume_while([&](char ch) { return ch != stop; });
|
||||
};
|
||||
|
||||
m_builder.append(consume_until_without_consuming_stop_character(m_opening));
|
||||
m_builder.append(lexer.consume_until(m_opening));
|
||||
|
||||
if (lexer.consume_specific(m_opening)) {
|
||||
auto const placeholder = consume_until_without_consuming_stop_character(m_closing);
|
||||
auto const placeholder = lexer.consume_until(m_closing);
|
||||
|
||||
if (!lexer.consume_specific(m_closing))
|
||||
VERIFY_NOT_REACHED();
|
||||
|
|
Loading…
Add table
Reference in a new issue