From 2695eeadfad3c880c163825c31e239a36c9ebf11 Mon Sep 17 00:00:00 2001 From: Jonathan Worthington Date: Wed, 7 Dec 2011 22:58:44 +0100 Subject: [PATCH] Implement ignorecase subtype in literal. Well, try to - for some reason it seems to need ICU, which I don't have to hand. :-( Testing and Rakudo version bump welcome from anyone who does. --- src/QAST/Compiler.nqp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/QAST/Compiler.nqp b/src/QAST/Compiler.nqp index 42346e0a79..9560ad10dd 100755 --- a/src/QAST/Compiler.nqp +++ b/src/QAST/Compiler.nqp @@ -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, $litlen); $ops.push_pirop('gt', '$I11', %*REG, %*REG); $ops.push_pirop('substr', '$S10', %*REG, %*REG, $litlen); + $ops.push_pirop('downcase', '$S10', '$S10') + if $node.subtype eq 'ignorecase'; $ops.push_pirop($cmpop, '$S10', $litpost, %*REG); $ops.push_pirop('add', %*REG, $litlen); $ops;