Skip to content

Commit

Permalink
Implement ignorecase subtype in literal. Well, try to - for some reas…
Browse files Browse the repository at this point in the history
…on it seems to need ICU, which I don't have to hand. :-( Testing and Rakudo version bump welcome from anyone who does.
  • Loading branch information
jnthn committed Dec 7, 2011
1 parent 73e0060 commit 2695eea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/QAST/Compiler.nqp
Expand Up @@ -248,12 +248,16 @@ class QAST::Compiler is HLL::Compiler {
method literal($node) {
my $ops := self.post_new('Ops');
my $litconst := $node[0];
$litconst := nqp::lc($litconst)
if $node.subtype eq 'ignorecase';
my $litlen := nqp::chars($litconst);
my $litpost := self.escape($litconst);
my $cmpop := $node.negate ?? 'eq' !! 'ne';
$ops.push_pirop('add', '$I11', %*REG<pos>, $litlen);
$ops.push_pirop('gt', '$I11', %*REG<eos>, %*REG<fail>);
$ops.push_pirop('substr', '$S10', %*REG<tgt>, %*REG<pos>, $litlen);
$ops.push_pirop('downcase', '$S10', '$S10')
if $node.subtype eq 'ignorecase';
$ops.push_pirop($cmpop, '$S10', $litpost, %*REG<fail>);
$ops.push_pirop('add', %*REG<pos>, $litlen);
$ops;
Expand Down

0 comments on commit 2695eea

Please sign in to comment.