develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35866 - trunk/languages/perl6/src/parser

From:
jonathan
Date:
January 21, 2009 07:57
Subject:
[svn:parrot] r35866 - trunk/languages/perl6/src/parser
Message ID:
20090121155741.E0917CB9AE@x12.develooper.com
Author: jonathan
Date: Wed Jan 21 07:57:40 2009
New Revision: 35866

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

Log:
[rakudo] Parse and implement 'of' keywrod, and switch s/typename/fulltypename/ in a place where STD.pm has it.

Modified: trunk/languages/perl6/src/parser/actions.pm
==============================================================================
--- trunk/languages/perl6/src/parser/actions.pm	(original)
+++ trunk/languages/perl6/src/parser/actions.pm	Wed Jan 21 07:57:40 2009
@@ -2093,6 +2093,14 @@
         $past.isdecl(1);
         $past.scope('lexical');
     }
+    if $<fulltypename> {
+        $past := PAST::Op.new(
+            :pasttype('call'),
+            :name('postcircumfix:[ ]'),
+            $past,
+            PAST::Block.new( $( $<fulltypename>[0] ), :blocktype('declaration') )
+        );
+    }
     make $past;
 }
 
@@ -2550,8 +2558,8 @@
         PAST::Op.new(
             :pasttype('call'),
             :name('!CREATE_SUBSET_TYPE'),
-            $<typename> ??
-                $( $<typename>[0] )
+            $<fulltypename> ??
+                $( $<fulltypename>[0] )
                 !!
                 PAST::Var.new(
                     :name('Any'),

Modified: trunk/languages/perl6/src/parser/grammar.pg
==============================================================================
--- trunk/languages/perl6/src/parser/grammar.pg	(original)
+++ trunk/languages/perl6/src/parser/grammar.pg	Wed Jan 21 07:57:40 2009
@@ -461,14 +461,12 @@
         $S0 = $P0.'text'()
         match.'add_type'($S0)
     }}
-    [ of <typename> ]? # XXX should be <fulltypename>
+    [ of <fulltypename> ]?
     where <EXPR>
     {*}
 }
 
-# XXX STD.pm uses <value> instead of <typename>, which seems odd, especially
-# as at the time of implementing parameter types <value>'s type parts were
-# commented out.
+# XXX STD.pm also has value in here?
 rule type_constraint {
     [
     | <fulltypename>
@@ -779,7 +777,7 @@
 
 rule fulltypename {
     <typename>
-#   [ of <fulltypename> ]?
+    [ of <fulltypename> ]?
     {*}
 }
 



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About