diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2022-01-21 20:10:51 +0330 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-22 00:35:49 +0000 |
commit | 704e0654b3e0c914d7b3c74b7a4b29a33223e767 (patch) | |
tree | 2d7b37bfdc4e4ee8bbd8e03b331f9f14759f9c45 /Userland/Libraries/LibRegex | |
parent | e0d3a8f6ce5c2c60db212fbad0a73c45fc7b9981 (diff) | |
download | serenity-704e0654b3e0c914d7b3c74b7a4b29a33223e767.zip |
Revert "LibRegex: Implement an ECMA262 Regex quirk with negative loo..."
This partially reverts commit c11be92e23d899e28d45f67be24e47b2e5114d3a.
That commit fixes one thing and breaks many more, a next commit will
implement this quirk in a more sane way.
Diffstat (limited to 'Userland/Libraries/LibRegex')
-rw-r--r-- | Userland/Libraries/LibRegex/RegexMatcher.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/Userland/Libraries/LibRegex/RegexMatcher.cpp b/Userland/Libraries/LibRegex/RegexMatcher.cpp index 18da4dd370..d6d9db077b 100644 --- a/Userland/Libraries/LibRegex/RegexMatcher.cpp +++ b/Userland/Libraries/LibRegex/RegexMatcher.cpp @@ -489,14 +489,7 @@ Optional<bool> Matcher<Parser>::execute(MatchInput const& input, MatchState& sta return true; case ExecutionResult::Failed: if (!states_to_try_next.is_empty()) { - auto next_state = states_to_try_next.take_last(); - // Note: ECMA262 quirk: Note 3, https://tc39.es/ecma262/#sec-runtime-semantics-canonicalize-ch - // capture groups defined in lookarounds "leak" outside the regex, - // but their contents are empty if the lookaround fails. - // This is done by manually clearing the groups where needed, and leaking their contents here. - if constexpr (IsSame<Parser, ECMA262>) - swap(next_state.capture_group_matches, state.capture_group_matches); - state = move(next_state); + state = states_to_try_next.take_last(); continue; } return false; @@ -506,11 +499,7 @@ Optional<bool> Matcher<Parser>::execute(MatchInput const& input, MatchState& sta return {}; return false; } - auto next_state = states_to_try_next.take_last(); - // See note above about an ECMA262 quirk. - if constexpr (IsSame<Parser, ECMA262>) - swap(next_state.capture_group_matches, state.capture_group_matches); - state = move(next_state); + state = states_to_try_next.take_last(); ++recursion_level; continue; } |