diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2022-07-10 11:40:17 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-10 14:26:03 +0200 |
commit | fe46b2c1411e7efde2bcffb4de6cf4a1b1aaecd7 (patch) | |
tree | 8f6e0bdf5f1b6bb53c0274d5ac4321d79c798457 /Userland/Libraries/LibRegex/RegexOptimizer.cpp | |
parent | 9c5febe8009ed905828b583adbdfd8fc67789015 (diff) | |
download | serenity-fe46b2c1411e7efde2bcffb4de6cf4a1b1aaecd7.zip |
LibRegex: Correctly track current inversion state in the optimizer
This is currently not important as we do not nest TemporaryInverse.
Diffstat (limited to 'Userland/Libraries/LibRegex/RegexOptimizer.cpp')
-rw-r--r-- | Userland/Libraries/LibRegex/RegexOptimizer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Libraries/LibRegex/RegexOptimizer.cpp b/Userland/Libraries/LibRegex/RegexOptimizer.cpp index fdb806f954..5fa27a242e 100644 --- a/Userland/Libraries/LibRegex/RegexOptimizer.cpp +++ b/Userland/Libraries/LibRegex/RegexOptimizer.cpp @@ -163,7 +163,8 @@ static bool has_overlap(Vector<CompareTypeAndValuePair> const& lhs, Vector<Compa inverse = !inverse; break; case CharacterCompareType::TemporaryInverse: - temporary_inverse = !temporary_inverse; + temporary_inverse = true; + reset_temporary_inverse = true; break; case CharacterCompareType::AnyChar: // Special case: if not inverted, AnyChar is always in the range. @@ -237,7 +238,8 @@ static bool has_overlap(Vector<CompareTypeAndValuePair> const& lhs, Vector<Compa inverse = !inverse; break; case CharacterCompareType::TemporaryInverse: - temporary_inverse = !temporary_inverse; + temporary_inverse = true; + reset_temporary_inverse = true; break; case CharacterCompareType::AnyChar: // Special case: if not inverted, AnyChar is always in the range. |