mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +00:00
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:
parent
3200ff5f4f
commit
dbef2b1ee9
11 changed files with 1321 additions and 25 deletions
|
@ -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>;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue