LibRegex: Implement an ECMA262-compatible parser

This also adds support for lookarounds and individually-negated
comparisons.
The only unimplemented part of the parser spec is the unicode stuff.
This commit is contained in:
AnotherTest
2020-11-27 19:33:53 +03:30
committed by Andreas Kling
parent 3200ff5f4f
commit dbef2b1ee9
Notes: sideshowbarker 2024-07-19 01:14:40 +09:00
11 changed files with 1321 additions and 25 deletions

View File

@@ -264,7 +264,13 @@ Optional<bool> Matcher<Parser>::execute(const MatchInput& input, MatchState& sta
s_regex_dbg.print_opcode("VM", *opcode, state, recursion_level, false);
#endif
auto result = opcode->execute(input, state, output);
ExecutionResult result;
if (input.fail_counter > 0) {
--input.fail_counter;
result = ExecutionResult::Failed_ExecuteLowPrioForks;
} else {
result = opcode->execute(input, state, output);
}
#ifdef REGEX_DEBUG
s_regex_dbg.print_result(*opcode, bytecode, input, state, result);
@@ -330,4 +336,7 @@ ALWAYS_INLINE Optional<bool> Matcher<Parser>::execute_low_prio_forks(const Match
template class Matcher<PosixExtendedParser>;
template class Regex<PosixExtendedParser>;
template class Matcher<ECMA262Parser>;
template class Regex<ECMA262Parser>;
}