1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:17:34 +00:00

LibRegex: Avoid using GenericLexer::consume() when at eof

Fixes #10027.
This commit is contained in:
Ali Mohammad Pur 2021-09-14 19:44:38 +04:30 committed by Andreas Kling
parent 047c013be0
commit 8e3fe80c06

View file

@ -2229,6 +2229,7 @@ size_t ECMA262Parser::ensure_total_number_of_capturing_parenthesis()
} }
break; break;
case '(': case '(':
lexer.consume();
if (lexer.consume_specific('?')) { if (lexer.consume_specific('?')) {
// non-capturing group '(?:', lookaround '(?<='/'(?<!', or named capture '(?<' // non-capturing group '(?:', lookaround '(?<='/'(?<!', or named capture '(?<'
if (!lexer.consume_specific('<')) if (!lexer.consume_specific('<'))
@ -2242,8 +2243,10 @@ size_t ECMA262Parser::ensure_total_number_of_capturing_parenthesis()
++count; ++count;
} }
break; break;
default:
lexer.consume();
break;
} }
lexer.consume();
} }
m_total_number_of_capturing_parenthesis = count; m_total_number_of_capturing_parenthesis = count;