Permalink
Browse files

[rakudo] conditional modifier + loop modifier

git-svn-id: https://svn.parrot.org/parrot/trunk@27000 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent bed527b commit 25cbcfc4bfb06a0740efeaa88f1104bb383505ef @perlpilot perlpilot committed Apr 16, 2008
Showing with 11 additions and 2 deletions.
  1. +6 −1 languages/perl6/src/parser/actions.pm
  2. +5 −1 languages/perl6/src/parser/grammar.pg
View
7 languages/perl6/src/parser/actions.pm
@@ -99,8 +99,13 @@ method statement($/, $key) {
if $key eq 'statement_mod_cond' {
$past := $( $<statement_mod_cond> );
$past.push( $expr );
+ if $<sml> {
+ $expr := $past;
+ $key := 'statement_mod_loop';
+ $<statement_mod_loop> := $<sml>[0];
+ }
}
- elsif $key eq 'statement_mod_loop' {
+ if $key eq 'statement_mod_loop' {
my $mod := $( $<statement_mod_loop> );
if $<statement_mod_loop><sym> eq 'for' {
my $loop := PAST::Block.new(
View
6 languages/perl6/src/parser/grammar.pg
@@ -197,7 +197,11 @@ rule statement {
| $<expr>=<EXPR>
[
|| <statement_mod_loop> {*} #= statement_mod_loop
- || <statement_mod_cond> {*} #= statement_mod_cond
+ || <statement_mod_cond>
+ [
+ $<sml>=<statement_mod_loop>
+ ]?
+ {*} #= statement_mod_cond
|| {*} #= expr
]
}

0 comments on commit 25cbcfc

Please sign in to comment.