mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
LibRegex: Convert regex::Lexer to inherit from GenericLexer
This will allow regex::Lexer users to invoke GenericLexer consumption methods, such as GenericLexer::consume_escaped_codepoint(). This also allows for de-duplicating common methods between the lexers.
This commit is contained in:
committed by
Andreas Kling
parent
dd44a5e948
commit
5ff9596678
@@ -101,7 +101,7 @@ ALWAYS_INLINE bool Parser::try_skip(StringView str)
|
||||
|
||||
size_t potentially_go_back { 0 };
|
||||
for (auto ch : str) {
|
||||
if (!m_parser_state.lexer.try_skip(ch)) {
|
||||
if (!m_parser_state.lexer.consume_specific(ch)) {
|
||||
m_parser_state.lexer.back(potentially_go_back);
|
||||
return false;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ ALWAYS_INLINE char Parser::skip()
|
||||
ch = m_parser_state.current_token.value()[0];
|
||||
} else {
|
||||
m_parser_state.lexer.back(m_parser_state.current_token.value().length());
|
||||
ch = m_parser_state.lexer.skip();
|
||||
ch = m_parser_state.lexer.consume();
|
||||
}
|
||||
|
||||
m_parser_state.current_token = m_parser_state.lexer.next();
|
||||
|
||||
Reference in New Issue
Block a user