mirror of
https://github.com/RGBCube/serenity
synced 2025-05-29 09:25:07 +00:00
LibRegex: Use proper CharRange constructor instead of bit_casting
Otherwise the range order would be inverted.
This commit is contained in:
parent
c774790975
commit
7d01ee63d6
2 changed files with 3 additions and 2 deletions
|
@ -922,6 +922,7 @@ TEST_CASE(optimizer_atomic_groups)
|
||||||
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.
|
Tuple { "\\\\(\\d+)"sv, "\\\\"sv, false }, // Rewrite bug turning a+ to a*, see #10952.
|
||||||
Tuple { "[a-z.]+\\."sv, "..."sv, true }, // Rewrite bug, incorrect interpretation of Compare.
|
Tuple { "[a-z.]+\\."sv, "..."sv, true }, // Rewrite bug, incorrect interpretation of Compare.
|
||||||
|
Tuple { "[.-]+\\."sv, ".-."sv, true },
|
||||||
// Alternative fuse
|
// Alternative fuse
|
||||||
Tuple { "(abcfoo|abcbar|abcbaz).*x"sv, "abcbarx"sv, true },
|
Tuple { "(abcfoo|abcbar|abcbaz).*x"sv, "abcbarx"sv, true },
|
||||||
Tuple { "(a|a)"sv, "a"sv, true },
|
Tuple { "(a|a)"sv, "a"sv, true },
|
||||||
|
|
|
@ -187,7 +187,7 @@ static bool has_overlap(Vector<CompareTypeAndValuePair> const& lhs, Vector<Compa
|
||||||
lhs_negated_char_classes.set(static_cast<CharClass>(pair.value));
|
lhs_negated_char_classes.set(static_cast<CharClass>(pair.value));
|
||||||
break;
|
break;
|
||||||
case CharacterCompareType::CharRange: {
|
case CharacterCompareType::CharRange: {
|
||||||
auto range = bit_cast<CharRange>(pair.value);
|
auto range = CharRange(pair.value);
|
||||||
if (!current_lhs_inversion_state())
|
if (!current_lhs_inversion_state())
|
||||||
lhs_ranges.insert(range.from, range.to);
|
lhs_ranges.insert(range.from, range.to);
|
||||||
else
|
else
|
||||||
|
@ -257,7 +257,7 @@ static bool has_overlap(Vector<CompareTypeAndValuePair> const& lhs, Vector<Compa
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
case CharacterCompareType::CharRange: {
|
case CharacterCompareType::CharRange: {
|
||||||
auto range = bit_cast<CharRange>(pair.value);
|
auto range = CharRange(pair.value);
|
||||||
if (!current_lhs_inversion_state() && range_contains(range))
|
if (!current_lhs_inversion_state() && range_contains(range))
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue