Skip to content

Commit

Permalink
switch around a few anchor types inside <after>
Browse files Browse the repository at this point in the history
since <after> is implemented as "flipping" the AST of
the regex and matching it against a flipped version of
the target string, a "right word boundary" has to become
a "left word boundary", same for ^^/$$ and ^/$
  • Loading branch information
timo committed Apr 20, 2018
1 parent c84f2fa commit e60f1d8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/QRegex/P6Regex/Actions.nqp
Expand Up @@ -996,6 +996,26 @@ class QRegex::P6Regex::Actions is HLL::Actions {
while nqp::elems(@($qast)) { @tmp.push(@($qast).shift) }
while @tmp { @($qast).push(self.flip_ast(@tmp.pop)) }
}
elsif $qast.rxtype eq 'anchor' {
if $qast.subtype eq 'rwb' {
$qast.subtype("lwb");
}
elsif $qast.subtype eq 'lwb' {
$qast.subtype("rwb");
}
elsif $qast.subtype eq 'bol' {
$qast.subtype("eol");
}
elsif $qast.subtype eq 'eol' {
$qast.subtype("bol");
}
elsif $qast.subtype eq 'bos' {
$qast.subtype("eos");
}
elsif $qast.subtype eq 'eos' {
$qast.subtype("bos");
}
}
else {
for @($qast) { self.flip_ast($_) }
}
Expand Down

0 comments on commit e60f1d8

Please sign in to comment.