mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:17:44 +00:00
LibRegex: Avoid rewriting a+
as a*
as part of atomic rewriting
The initial `ForkStay` is only needed if the looping block has a following block, if there's no following block or the following block does not attempt to match anything, we should not insert the ForkStay, otherwise we would be rewriting `a+` as `a*` by allowing the 'end' to be executed. Fixes #10952.
This commit is contained in:
parent
f10036b7c5
commit
387df06385
2 changed files with 34 additions and 17 deletions
|
@ -895,6 +895,7 @@ TEST_CASE(optimizer_atomic_groups)
|
|||
// Fork -> ForkReplace
|
||||
Tuple { "a*b"sv, "aaaaa"sv, false },
|
||||
Tuple { "a+b"sv, "aaaaa"sv, false },
|
||||
Tuple { "\\\\(\\d+)"sv, "\\\\"sv, false }, // Rewrite bug turning a+ to a*, see #10952.
|
||||
// Alternative fuse
|
||||
Tuple { "(abcfoo|abcbar|abcbaz).*x"sv, "abcbarx"sv, true },
|
||||
Tuple { "(a|a)"sv, "a"sv, true },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue