mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:58:12 +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:
parent
dd44a5e948
commit
5ff9596678
3 changed files with 28 additions and 62 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue