mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02: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:
committed by
Andreas Kling
parent
3200ff5f4f
commit
dbef2b1ee9
Notes:
sideshowbarker
2024-07-19 01:14:40 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/dbef2b1ee9d Pull-request: https://github.com/SerenityOS/serenity/pull/4103 Reviewed-by: https://github.com/linusg ✅
@@ -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>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user