Author: jonathan
Date: Fri Mar 28 12:07:21 2008
New Revision: 26598

Modified:
   trunk/languages/perl6/src/parser/actions.pm
   trunk/languages/perl6/src/parser/grammar.pg

Log:
[rakudo] Bring * (whatever) inline with STD.pm by making it a term. Also make 
it an l-value so we can do * = 42; style things (will be useful once we get 
list assignment, I guess).

Modified: trunk/languages/perl6/src/parser/actions.pm
==============================================================================
--- trunk/languages/perl6/src/parser/actions.pm (original)
+++ trunk/languages/perl6/src/parser/actions.pm Fri Mar 28 12:07:21 2008
@@ -428,7 +428,25 @@
 
 
 method term($/, $key) {
-    my $past := $( $/{$key} );
+    my $past;
+    if $key eq '*' {
+        # Whatever.
+        $past := PAST::Op.new(
+            :pasttype('callmethod'),
+            :name('new'),
+            :node($/),
+            :lvalue(1),
+            PAST::Var.new(
+                :name('Whatever'),
+                :scope('package'),
+                :node($/)
+            )
+        );
+    }
+    else {
+        $past := $( $/{$key} );
+    }
+
     if $<postfix> {
         for $<postfix> {
             my $term := $past;
@@ -1373,21 +1391,6 @@
 }
 
 
-method whatever($/) {
-    my $past := PAST::Op.new(
-        :pasttype('callmethod'),
-        :name('new'),
-        :node($/),
-        PAST::Var.new(
-            :name('Whatever'),
-            :scope('package'),
-            :node($/)
-        )
-    );
-    make $past;
-}
-
-
 # Used by all calling code to process arguments into the correct form.
 sub process_arguments($call_past, $args) {
     for @($args) {

Modified: trunk/languages/perl6/src/parser/grammar.pg
==============================================================================
--- trunk/languages/perl6/src/parser/grammar.pg (original)
+++ trunk/languages/perl6/src/parser/grammar.pg Fri Mar 28 12:07:21 2008
@@ -392,6 +392,7 @@
     | <noun> <postfix>* {*}                      #= noun
     | <listop> {*}                               #= listop
     | <compiler_directive> {*}                   #= compiler_directive
+    | '*' {*}                                    #= *
 }
 
 
@@ -451,7 +452,6 @@
     | <type_declarator> {*}                      #= type_declarator
     | <colonpair> {*}                            #= colonpair
     | <fatarrow> {*}                             #= fatarrow
-    | <whatever> {*}                             #= whatever
     | 'self' {*}                                 #= self
     | 'undef' {*}                                #= undef
 }
@@ -682,8 +682,6 @@
     {*}
 }
 
-token whatever { '*' {*} }
-
 #### expressions and operators ####
 
 ##  The EXPR rule is our entry point into the operator

Reply via email to