Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
look up block when rule is <:InSomething>
  • Loading branch information
FROGGS committed Jan 11, 2014
1 parent 204c5ce commit fdc0be3
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions src/vm/moar/QAST/QASTRegexCompilerMAST.nqp
Expand Up @@ -954,18 +954,44 @@ class QAST::MASTRegexCompiler {
my $pname := fresh_s();
my $pcode := fresh_i();
my $pvcode := fresh_i();
my $pprop := fresh_s();
my $i0 := fresh_i();
my $testop := $node.negate ?? 'if_i' !! 'unless_i';
[
my $prefix := $*QASTCOMPILER.unique($*RXPREFIX ~ '_uniprop');
my $hasvalcode := label($prefix ~ '_haselems');
my $endblock := label($prefix ~ '_endblock');
my $succeed := label($prefix ~ '_succeed');
my @ins := [
op('ge_i', $i0, %*REG<pos>, %*REG<eos>),
op('if_i', $i0, %*REG<fail>),
];
if ~$node[0] ~~ /^ [ In<[A..Z]> | in<[a..z]> ]/ { # "InArabic" is a lookup of Block Arabic
merge_ins(@ins, [
op('const_s', $pname, sval(nqp::substr($node[0],2))),
op('uniisblock', $i0, %*REG<tgt>, %*REG<pos>, $pname),
op('if_i', $i0, $succeed),

op('const_s', $pprop, sval('Block')),
op('const_s', $pname, sval(nqp::substr($node[0],2))),
op('unipropcode', $pcode, $pprop),
op('unless_i', $pcode, $endblock),
op('unipvalcode', $pvcode, $pcode, $pname),
op('if_i', $pvcode, $hasvalcode),
$endblock,
]);
}
merge_ins(@ins, [
op('const_s', $pname, sval($node[0])),
op('unipropcode', $pcode, $pname),
op('unipvalcode', $pvcode, $pcode, $pname),
#~ op($testop, $pvcode, %*REG<fail>), # XXX I am sure we should fail here
$hasvalcode,
op('hasuniprop', $i0, %*REG<tgt>, %*REG<pos>, $pcode, $pvcode),
$succeed,
op($testop, $i0, %*REG<fail>),
op('inc_i', %*REG<pos>)
];
]);
@ins
}

method ws($node) { self.subrule($node) }
Expand Down

0 comments on commit fdc0be3

Please sign in to comment.