From e7d59a15c6aaa7f05fb17a90eb890434573989c4 Mon Sep 17 00:00:00 2001 From: Stefan O'Rear Date: Mon, 12 Jul 2010 19:28:20 -0700 Subject: [PATCH] Allow intermingling Perl6 terms in NIL --- Niecza/Actions.pm | 4 ++++ Niecza/Grammar.pm6 | 1 + Op.pm | 8 ++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Niecza/Actions.pm b/Niecza/Actions.pm index d7f01f4d..58f22d12 100644 --- a/Niecza/Actions.pm +++ b/Niecza/Actions.pm @@ -528,6 +528,10 @@ sub insn__S_push_null { my ($cl, $M) = @_; $M->{_ast} = [[ push_null => $M->{clrid}->Str ]]; } +sub insn__S_hll { my ($cl, $M) = @_; + $M->{_ast} = [ $M->{EXPR}{_ast} ]; +} + sub clrid {} sub clrqual {} sub clrgeneric {} diff --git a/Niecza/Grammar.pm6 b/Niecza/Grammar.pm6 index 6196fe29..db78c261 100644 --- a/Niecza/Grammar.pm6 +++ b/Niecza/Grammar.pm6 @@ -109,6 +109,7 @@ grammar NIL is STD { token insn:clr_sfield_set { 'F!' {} } token insn:return { '/' (<[ 0 1 ]>) } token insn:push_null { 'null:' {} } + token insn:hll { '{' ~ '}' [ :lang(%*LANG
) ] } } } diff --git a/Op.pm b/Op.pm index 03be326d..7afd7281 100644 --- a/Op.pm +++ b/Op.pm @@ -20,8 +20,12 @@ use 5.010; sub item_cg { my ($self, $cg, $body) = @_; for my $insn (@{ $self->code }) { - my ($op, @args) = @$insn; - $cg->$op(@args); + if (blessed $insn) { + $insn->item_cg($cg, $body); + } else { + my ($op, @args) = @$insn; + $cg->$op(@args); + } } }