Skip to content

Commit

Permalink
[rakudo]: Module declarator statements carp if not first in compunit.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.parrot.org/parrot/trunk@35341 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
pmichaud committed Jan 10, 2009
1 parent 635d25b commit 8b436ac
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion languages/perl6/src/parser/grammar.pg
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Rules with only one action need no #= comment.
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> ]
Expand Down Expand Up @@ -215,6 +217,7 @@ token MARK_STATEMENT_END {
## or an expression. Any statement termination is handled by
## the calling rule.
rule statement {
[
| <statement_control> {*} #= control
| <expr=EXPR>
[
Expand All @@ -225,6 +228,9 @@ rule statement {
|| {*} #= expr
]
| <?before ';'> {*} #= null
]
{{ $P0 = get_hll_global ['Bool'], 'False'
set_global '$begin_compunit', $P0 }}
}

rule statement_control {
Expand Down Expand Up @@ -629,7 +635,9 @@ rule package_def {
]?
<trait>*
[
| ';' <statement_block> {*} #= statement_block
| <?{{ $P0 = get_global '$begin_compunit'
.return ($P0) }}>
';' <statement_block> {*} #= statement_block
| <block> {*} #= block
| {*} #= panic
]
Expand Down

0 comments on commit 8b436ac

Please sign in to comment.