From 9c05b835400d954d550a3a2e93b62401f8a36bc7 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Fri, 16 Jun 2023 17:23:59 +0100 Subject: [PATCH] AK: Use `consume_until` in SourceGenerator This got fixed a while ago to not consume the stop character, so we can remove the workaround. --- AK/SourceGenerator.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/AK/SourceGenerator.h b/AK/SourceGenerator.h index 16dd46f901..9b36eff937 100644 --- a/AK/SourceGenerator.h +++ b/AK/SourceGenerator.h @@ -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();