mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:18:12 +00:00
LibRegex: Make the optimizer understand references and capture groups
Otherwise the fork in patterns like `(1+)\1` would be (incorrectly) optimized away.
This commit is contained in:
parent
7de23aede2
commit
741886a4c4
2 changed files with 23 additions and 2 deletions
|
@ -898,6 +898,10 @@ TEST_CASE(optimizer_atomic_groups)
|
|||
// Alternative fuse
|
||||
Tuple { "(abcfoo|abcbar|abcbaz).*x"sv, "abcbarx"sv, true },
|
||||
Tuple { "(a|a)"sv, "a"sv, true },
|
||||
// ForkReplace shouldn't be applied where it would change the semantics
|
||||
Tuple { "(1+)\\1"sv, "11"sv, true },
|
||||
Tuple { "(1+)1"sv, "11"sv, true },
|
||||
Tuple { "(1+)0"sv, "10"sv, true },
|
||||
};
|
||||
|
||||
for (auto& test : tests) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue