|
|
Author: pmichaud
Date: Thu Jun 26 20:03:21 2008
New Revision: 28737
Modified:
trunk/languages/perl6/src/parser/actions.pm
trunk/languages/perl6/src/parser/grammar.pg
Log:
[rakudo]:
* Add sigil listop contextualizers.
Modified: trunk/languages/perl6/src/parser/actions.pm
==============================================================================
--- trunk/languages/perl6/src/parser/actions.pm (original)
+++ trunk/languages/perl6/src/parser/actions.pm Thu Jun 26 20:03:21 2008
@@ -1827,25 +1827,18 @@
elsif $key eq '$( )' {
## Context - is just calling .item, .list etc on whatever we
## got made by the expression in the brackets.
- my $expr := $( $<semilist> );
my $method;
- if $<sigil> eq '$' {
- $method := 'item';
- }
- elsif $<sigil> eq '@' {
- $method := 'list';
- }
- elsif $<sigil> eq '%' {
- $method := 'hash';
- }
+ if $<sigil> eq '$' { $method := 'item'; }
+ elsif $<sigil> eq '@' { $method := 'list'; }
+ elsif $<sigil> eq '%' { $method := 'hash'; }
else {
- $/.panic("Use of " ~ $<sigil> ~ " as contextualizer not yet
implemented.");
+ $/.panic("Use of contextualizer " ~ $<sigil> ~ " not
implemented.");
}
$past := PAST::Op.new(
:pasttype('callmethod'),
:name($method),
:node($/),
- $expr
+ $( $<semilist> )
);
}
make $past;
@@ -2039,6 +2032,21 @@
$( $<variable> )
);
}
+ elsif $key eq 'sigil' {
+ my $method;
+ if $<sigil> eq '$' { $method := 'item'; }
+ elsif $<sigil> eq '@' { $method := 'list'; }
+ elsif $<sigil> eq '%' { $method := 'hash'; }
+ else {
+ $/.panic("Use of contextualizer " ~ $<sigil> ~ " not
implemented.");
+ }
+ $past := PAST::Op.new(
+ :pasttype('callmethod'),
+ :name($method),
+ :node($/),
+ $( $<arglist> )
+ );
+ }
else { $past := $( $/{$key} ); }
$past.node($/);
make $past;
Modified: trunk/languages/perl6/src/parser/grammar.pg
==============================================================================
--- trunk/languages/perl6/src/parser/grammar.pg (original)
+++ trunk/languages/perl6/src/parser/grammar.pg Thu Jun 26 20:03:21 2008
@@ -527,6 +527,7 @@
| <.unsp>? '.'? '(' <semilist> ')' {*} #= func args
| :: {*} #= listop noarg
]
+ | <sigil> \s <arglist> {*} #= sigil
]
}
|
|