Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
need to factor in both negations.
  • Loading branch information
timo committed Nov 20, 2013
1 parent 12d5660 commit 387e382
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/NQP/Optimizer.nqp
Expand Up @@ -57,21 +57,21 @@ class NQP::RegexOptimizer {
my $result := 0;
if $simple.rxtype eq 'literal' && $simple.rxtype ne 'ignorecase' {
$result := QAST::Regex.new(:rxtype<literal>, :subtype<zerowidth>, :node($simple.node),
:negate($qast.negate),
:negate(nqp::bitxor_i($qast.negate, $simple.negate)),
$simple[0]);
} elsif $simple.rxtype eq 'enumcharlist' && $simple.rxtype ne 'ignorecase' {
$result := QAST::Regex.new(:rxtype<enumcharlist>, :subtype<zerowidth>, :node($simple.node),
:negate($qast.negate),
:negate(nqp::bitxor_i($qast.negate, $simple.negate)),
$simple[0]);
} elsif $simple.rxtype eq 'charrange' && $simple.rxtype ne 'ignorecase' {
$result := QAST::Regex.new(:rxtype<charrange>, :subtype<zerowidth>, :node($simple.node),
:negate($qast.negate),
:negate(nqp::bitxor_i($qast.negate, $simple.negate)),
$simple[0],
$simple[1],
$simple[2]);
} elsif $simple.rxtype eq 'cclass' && $simple.rxtype ne 'ignorecase' {
$result := QAST::Regex.new(:rxtype<cclass>, :subtype<zerowidth>, :node($simple.node),
:negate($qast.negate), :name($simple.name));
:negate(nqp::bitxor_i($qast.negate, $simple.negate)), :name($simple.name));
}
if $result {
self.stub_out_block($qast[0][1]);
Expand Down

0 comments on commit 387e382

Please sign in to comment.