Author: tene
Date: Wed May 7 01:56:27 2008
New Revision: 27376
Modified:
trunk/languages/perl6/src/parser/actions.pm
trunk/languages/perl6/src/parser/grammar.pg
Log:
Basic support for placeholder vars in rakudo.
Modified: trunk/languages/perl6/src/parser/actions.pm
==============================================================================
--- trunk/languages/perl6/src/parser/actions.pm (original)
+++ trunk/languages/perl6/src/parser/actions.pm Wed May 7 01:56:27 2008
@@ -1434,6 +1434,15 @@
PIR q< $P1 = pop $P0 >;
PIR q< store_lex '$name', $P1 >;
+ if $<twigil>[0] eq '^' { our $?BLOCK;
+ $?BLOCK.symbol( ~$<sigil> ~ ~$name, :scope('lexical') );
+ $?BLOCK[0].push( PAST::Var.new( :name(~$<sigil> ~ ~$name),
:scope('parameter') ) );
+ }
+ elsif $<twigil>[0] eq ':' { our $?BLOCK;
+ $?BLOCK.symbol( ~$<sigil> ~ ~$name, :scope('lexical') );
+ $?BLOCK[0].push( PAST::Var.new( :name(~$<sigil> ~ ~$name),
:scope('parameter'), :named(~$name) ) );
+ }
+
# If it's $.x, it's a method call, not a variable.
if $<twigil>[0] eq '.' {
$past := PAST::Op.new(
Modified: trunk/languages/perl6/src/parser/grammar.pg
==============================================================================
--- trunk/languages/perl6/src/parser/grammar.pg (original)
+++ trunk/languages/perl6/src/parser/grammar.pg Wed May 7 01:56:27 2008
@@ -566,7 +566,7 @@
token sigil { '$' | '@' | '%' | '&' }
-token twigil { <[.!^*+?=]> }
+token twigil { <[.!^:*+?=]> }
token name {
| <ident> [ '::' <ident> ]*