Skip to content

Commit b924e93

Browse files
committed
Fix over-eager regex concat optimization
1 parent 614f229 commit b924e93

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/QRegex/P6Regex/Actions.nqp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ class QRegex::P6Regex::Actions is HLL::Actions {
5959
my $ast := $_.ast;
6060
if $ast {
6161
if $lastlit && $ast.rxtype eq 'literal'
62-
&& !QAST::Node.ACCEPTS($ast[0]) {
62+
&& !QAST::Node.ACCEPTS($ast[0])
63+
&& $lastlit.subtype eq $ast.subtype {
6364
$lastlit[0] := $lastlit[0] ~ $ast[0];
6465
}
6566
else {

t/qregex/rx_modifiers

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
# todo :pugs<feature>
2626
:1i bcd aBCDef y ignorecase, repetition (:1i)
2727
:1i bcd aBxDef n ignorecase, repetition (:1i)
28+
A :i B Ab y ignorecase in the middle, literals on both sides
2829
ab [:i cd ] ef abcdef y ignorecase, lexical (:i)
2930
ab [:i cd ] ef abCdef y ignorecase, lexical (:i)
3031
ab [:i cd ] ef abcDef y ignorecase, lexical (:i)

0 commit comments

Comments
 (0)