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

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

From:
pmichaud
Date:
January 10, 2009 08:22
Subject:
[svn:parrot] r35341 - trunk/languages/perl6/src/parser
Message ID:
20090110162239.CDF98CB9F9@x12.develooper.com
Author: pmichaud
Date: Sat Jan 10 08:22:38 2009
New Revision: 35341

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

Log:
[rakudo]:  Module declarator statements carp if not first in compunit.


Modified: trunk/languages/perl6/src/parser/grammar.pg
==============================================================================
--- trunk/languages/perl6/src/parser/grammar.pg	(original)
+++ trunk/languages/perl6/src/parser/grammar.pg	Sat Jan 10 08:22:38 2009
@@ -45,6 +45,8 @@
 grammar Perl6::Grammar is PCT::Grammar;
 
 token TOP {
+    {{ $P0 = get_hll_global ['Bool'], 'True'
+       set_global '$begin_compunit', $P0 }}
     <.MARK_STATEMENT_END>
     <statement_block>
     [ $ || <panic: Syntax error> ]
@@ -215,6 +217,7 @@
 ##  or an expression.  Any statement termination is handled by
 ##  the calling rule.
 rule statement {
+    [
     | <statement_control> {*}                    #= control
     | <expr=EXPR>
         [
@@ -225,6 +228,9 @@
         || {*}                                   #= expr
         ]
     | <?before ';'> {*}                          #= null
+    ]
+    {{ $P0 = get_hll_global ['Bool'], 'False'
+       set_global '$begin_compunit', $P0 }}
 }
 
 rule statement_control {
@@ -629,7 +635,9 @@
     ]? 
     <trait>*
     [
-    | ';' <statement_block> {*}                          #= statement_block
+    | <?{{ $P0 = get_global '$begin_compunit'
+           .return ($P0) }}>
+      ';' <statement_block> {*}                          #= statement_block
     | <block> {*}                                        #= block
     | {*}                                                #= panic
     ]



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