mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
LibRegex: Merge alternations based on blocks and not instructions
The instructions can have dependencies (e.g. Repeat), so only unify equal blocks instead of consecutive instructions. Fixes #11247. Also adds the minimal test case(s) from that issue.
This commit is contained in:
parent
92233660b8
commit
d2e51fafa9
3 changed files with 23 additions and 17 deletions
|
@ -899,7 +899,9 @@ TEST_CASE(optimizer_atomic_groups)
|
|||
// Alternative fuse
|
||||
Tuple { "(abcfoo|abcbar|abcbaz).*x"sv, "abcbarx"sv, true },
|
||||
Tuple { "(a|a)"sv, "a"sv, true },
|
||||
Tuple { "(a|)"sv, ""sv, true }, // Ensure that empty alternatives are not outright removed
|
||||
Tuple { "(a|)"sv, ""sv, true }, // Ensure that empty alternatives are not outright removed
|
||||
Tuple { "a{2,3}|a{5,8}"sv, "abc"sv, false }, // Optimiser should not mess up the instruction stream by ignoring inter-insn dependencies, see #11247.
|
||||
Tuple { "^(a{2,3}|a{5,8})$"sv, "aaaa"sv, false }, // Optimiser should not mess up the instruction stream by ignoring inter-insn dependencies, see #11247.
|
||||
// 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 },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue