Permalink
Browse files

added 'loop'

  • Loading branch information...
1 parent 7c12fff commit dd346a7c37970883b44f0246dbb67c21e3cb0b63 @fglock committed Mar 30, 2010
Showing with 33 additions and 4 deletions.
  1. +2 −1 ChangeLog
  2. +13 −0 lib/MiniPerl6/Grammar/Control.pm
  3. +2 −1 lib5/MiniPerl6/Grammar/Control.pm
  4. +8 −1 libjs/MiniPerl6/Grammar/Control.js
  5. +8 −1 perlito.js
View
3 ChangeLog
@@ -1,7 +1,8 @@
(5.0)
- use variable assignment instead of binding - that is, use '=' instead of ':='
-- 'use' - all backends can use Test.pm
+- 'use' - all backends can now use Test.pm
- 'elsif'
+- 'loop'
- regex quantifiers
- Lisp backend now bootstraps with the 'util/mp6.pl' compiler
View
13 lib/MiniPerl6/Grammar/Control.pm
@@ -11,6 +11,7 @@ token control {
| <when> { make $$<when> } # when 3 { ... }
| <for> { make $$<for> } # $x.map(-> $i {...})
| <while> { make $$<while> } # while ... { ... }
+ | <loop> { make $$<loop> } # loop { ... }
| <apply> { make $$<apply> } # $obj($arg1, $arg2)
# | <call> { make $$<call> } # $obj.method($arg1, $arg2)
};
@@ -65,6 +66,18 @@ token while {
{ make While.new( cond => $$<exp>, body => $$<exp_stmts> ) }
};
+token loop {
+ loop <.ws>
+ [
+ \{ <.opt_ws> <exp_stmts> <.opt_ws> \}
+ { make While.new( cond => Val::Bit.new( bit => 1 ), body => $$<exp_stmts> ) }
+ |
+ { die 'loop(;;){} not implemented' }
+ # \( <exp> <.opt_ws> ';' <.opt_ws> <exp> <.opt_ws> ';' <.opt_ws> <exp> <.opt_ws> \)
+ # \{ <.opt_ws> <exp_stmts> <.opt_ws> \}
+ ]
+}
+
token ctrl_leave {
leave
{ make Leave.new() }
View
3 lib5/MiniPerl6/Grammar/Control.pm
@@ -6,11 +6,12 @@ our $MATCH = MiniPerl6::Match->new();
{
package MiniPerl6::Grammar;
sub new { shift; bless { @_ }, "MiniPerl6::Grammar" }
-sub control { my $grammar = $_[0]; my $str = $_[1]; my $pos = $_[2]; my $MATCH; ($MATCH = MiniPerl6::Match->new( 'str' => $str,'from' => $pos,'to' => $pos,'bool' => 1, )); (($MATCH)->{bool} = do { (my $pos1 = $MATCH->to()); (do { (do { (my $m2 = $grammar->ctrl_return($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'ctrl_return'} = $m2);1 } else { 0 } } && (do { ($MATCH->{capture} = (${$MATCH->{'ctrl_return'}})) } || 1)) } || (do { (($MATCH)->{to} = $pos1); (do { (my $m2 = $grammar->ctrl_leave($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'ctrl_leave'} = $m2);1 } else { 0 } } && (do { ($MATCH->{capture} = (${$MATCH->{'ctrl_leave'}})) } || 1)) } || (do { (($MATCH)->{to} = $pos1); (do { (my $m2 = $grammar->if($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'if'} = $m2);1 } else { 0 } } && (do { ($MATCH->{capture} = (${$MATCH->{'if'}})) } || 1)) } || (do { (($MATCH)->{to} = $pos1); (do { (my $m2 = $grammar->when($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'when'} = $m2);1 } else { 0 } } && (do { ($MATCH->{capture} = (${$MATCH->{'when'}})) } || 1)) } || (do { (($MATCH)->{to} = $pos1); (do { (my $m2 = $grammar->for($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'for'} = $m2);1 } else { 0 } } && (do { ($MATCH->{capture} = (${$MATCH->{'for'}})) } || 1)) } || (do { (($MATCH)->{to} = $pos1); (do { (my $m2 = $grammar->while($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'while'} = $m2);1 } else { 0 } } && (do { ($MATCH->{capture} = (${$MATCH->{'while'}})) } || 1)) } || do { (($MATCH)->{to} = $pos1); (do { (my $m2 = $grammar->apply($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'apply'} = $m2);1 } else { 0 } } && (do { ($MATCH->{capture} = (${$MATCH->{'apply'}})) } || 1)) })))))) }); $MATCH };
+sub control { my $grammar = $_[0]; my $str = $_[1]; my $pos = $_[2]; my $MATCH; ($MATCH = MiniPerl6::Match->new( 'str' => $str,'from' => $pos,'to' => $pos,'bool' => 1, )); (($MATCH)->{bool} = do { (my $pos1 = $MATCH->to()); (do { (do { (my $m2 = $grammar->ctrl_return($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'ctrl_return'} = $m2);1 } else { 0 } } && (do { ($MATCH->{capture} = (${$MATCH->{'ctrl_return'}})) } || 1)) } || (do { (($MATCH)->{to} = $pos1); (do { (my $m2 = $grammar->ctrl_leave($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'ctrl_leave'} = $m2);1 } else { 0 } } && (do { ($MATCH->{capture} = (${$MATCH->{'ctrl_leave'}})) } || 1)) } || (do { (($MATCH)->{to} = $pos1); (do { (my $m2 = $grammar->if($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'if'} = $m2);1 } else { 0 } } && (do { ($MATCH->{capture} = (${$MATCH->{'if'}})) } || 1)) } || (do { (($MATCH)->{to} = $pos1); (do { (my $m2 = $grammar->when($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'when'} = $m2);1 } else { 0 } } && (do { ($MATCH->{capture} = (${$MATCH->{'when'}})) } || 1)) } || (do { (($MATCH)->{to} = $pos1); (do { (my $m2 = $grammar->for($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'for'} = $m2);1 } else { 0 } } && (do { ($MATCH->{capture} = (${$MATCH->{'for'}})) } || 1)) } || (do { (($MATCH)->{to} = $pos1); (do { (my $m2 = $grammar->while($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'while'} = $m2);1 } else { 0 } } && (do { ($MATCH->{capture} = (${$MATCH->{'while'}})) } || 1)) } || (do { (($MATCH)->{to} = $pos1); (do { (my $m2 = $grammar->loop($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'loop'} = $m2);1 } else { 0 } } && (do { ($MATCH->{capture} = (${$MATCH->{'loop'}})) } || 1)) } || do { (($MATCH)->{to} = $pos1); (do { (my $m2 = $grammar->apply($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'apply'} = $m2);1 } else { 0 } } && (do { ($MATCH->{capture} = (${$MATCH->{'apply'}})) } || 1)) }))))))) }); $MATCH };
sub if { my $grammar = $_[0]; my $str = $_[1]; my $pos = $_[2]; my $MATCH; ($MATCH = MiniPerl6::Match->new( 'str' => $str,'from' => $pos,'to' => $pos,'bool' => 1, )); (($MATCH)->{bool} = do { (my $pos1 = $MATCH->to()); do { ((('i' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('f' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { (my $m2 = $grammar->ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && (do { (my $m2 = $grammar->exp($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'exp'} = $m2);1 } else { 0 } } && (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && ((('{' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && (do { (my $m2 = $grammar->exp_stmts($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'exp_stmts'} = $m2);1 } else { 0 } } && (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && ((('}' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && do { (my $pos1 = $MATCH->to()); (do { (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && ((('e' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('l' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('s' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('e' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && ((('{' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && (do { (my $m2 = $grammar->exp_stmts2($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'exp_stmts2'} = $m2);1 } else { 0 } } && (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && ((('}' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { ($MATCH->{capture} = (If->new( 'cond' => ${$MATCH->{'exp'}},'body' => ${$MATCH->{'exp_stmts'}},'otherwise' => ${$MATCH->{'exp_stmts2'}}, ))) } || 1)))))))))))) } || (do { (($MATCH)->{to} = $pos1); (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && ((('e' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('l' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('s' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { (my $m2 = $grammar->if($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'if'} = $m2);1 } else { 0 } } && (do { ($MATCH->{capture} = (If->new( 'cond' => ${$MATCH->{'exp'}},'body' => ${$MATCH->{'exp_stmts'}},'otherwise' => [${$MATCH->{'if'}}], ))) } || 1)))))) } || do { (($MATCH)->{to} = $pos1); (do { ($MATCH->{capture} = (If->new( 'cond' => ${$MATCH->{'exp'}},'body' => ${$MATCH->{'exp_stmts'}},'otherwise' => [], ))) } || 1) })) })))))))))) } }); $MATCH };
sub when { my $grammar = $_[0]; my $str = $_[1]; my $pos = $_[2]; my $MATCH; ($MATCH = MiniPerl6::Match->new( 'str' => $str,'from' => $pos,'to' => $pos,'bool' => 1, )); (($MATCH)->{bool} = do { (my $pos1 = $MATCH->to()); do { ((('w' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('h' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('e' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('n' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { (my $m2 = $grammar->ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && (do { (my $m2 = $grammar->exp_seq($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'exp_seq'} = $m2);1 } else { 0 } } && (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && ((('{' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && (do { (my $m2 = $grammar->exp_stmts($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'exp_stmts'} = $m2);1 } else { 0 } } && (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && ((('}' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { ($MATCH->{capture} = (When->new( 'parameters' => ${$MATCH->{'exp_seq'}},'body' => ${$MATCH->{'exp_stmts'}}, ))) } || 1))))))))))))) } }); $MATCH };
sub for { my $grammar = $_[0]; my $str = $_[1]; my $pos = $_[2]; my $MATCH; ($MATCH = MiniPerl6::Match->new( 'str' => $str,'from' => $pos,'to' => $pos,'bool' => 1, )); (($MATCH)->{bool} = do { (my $pos1 = $MATCH->to()); do { ((('f' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('o' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('r' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { (my $m2 = $grammar->ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && (do { (my $m2 = $grammar->exp($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'exp'} = $m2);1 } else { 0 } } && (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && ((('->' eq substr($str, $MATCH->to(), 2)) ? (1 + (($MATCH)->{to} = (2 + $MATCH->to()))) : 0) && (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && (do { (my $m2 = $grammar->var_ident($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'var_ident'} = $m2);1 } else { 0 } } && (do { (my $m2 = $grammar->ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && ((('{' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && (do { (my $m2 = $grammar->exp_stmts($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'exp_stmts'} = $m2);1 } else { 0 } } && (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && ((('}' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { ($MATCH->{capture} = (For->new( 'cond' => ${$MATCH->{'exp'}},'topic' => ${$MATCH->{'var_ident'}},'body' => ${$MATCH->{'exp_stmts'}}, ))) } || 1)))))))))))))))) } }); $MATCH };
sub while { my $grammar = $_[0]; my $str = $_[1]; my $pos = $_[2]; my $MATCH; ($MATCH = MiniPerl6::Match->new( 'str' => $str,'from' => $pos,'to' => $pos,'bool' => 1, )); (($MATCH)->{bool} = do { (my $pos1 = $MATCH->to()); do { ((('w' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('h' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('i' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('l' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('e' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { (my $m2 = $grammar->ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && (do { (my $m2 = $grammar->exp($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'exp'} = $m2);1 } else { 0 } } && (do { (my $m2 = $grammar->ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && ((('{' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && (do { (my $m2 = $grammar->exp_stmts($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'exp_stmts'} = $m2);1 } else { 0 } } && (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && ((('}' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { ($MATCH->{capture} = (While->new( 'cond' => ${$MATCH->{'exp'}},'body' => ${$MATCH->{'exp_stmts'}}, ))) } || 1)))))))))))))) } }); $MATCH };
+sub loop { my $grammar = $_[0]; my $str = $_[1]; my $pos = $_[2]; my $MATCH; ($MATCH = MiniPerl6::Match->new( 'str' => $str,'from' => $pos,'to' => $pos,'bool' => 1, )); (($MATCH)->{bool} = do { (my $pos1 = $MATCH->to()); do { ((('l' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('o' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('o' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('p' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { (my $m2 = $grammar->ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && do { (my $pos1 = $MATCH->to()); (do { ((('{' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && (do { (my $m2 = $grammar->exp_stmts($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'exp_stmts'} = $m2);1 } else { 0 } } && (do { (my $m2 = $grammar->opt_ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } && ((('}' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { ($MATCH->{capture} = (While->new( 'cond' => Val::Bit->new( 'bit' => 1, ),'body' => ${$MATCH->{'exp_stmts'}}, ))) } || 1)))))) } || do { (($MATCH)->{to} = $pos1); (do { die('loop(;;){} not implemented') } || 1) }) }))))) } }); $MATCH };
sub ctrl_leave { my $grammar = $_[0]; my $str = $_[1]; my $pos = $_[2]; my $MATCH; ($MATCH = MiniPerl6::Match->new( 'str' => $str,'from' => $pos,'to' => $pos,'bool' => 1, )); (($MATCH)->{bool} = do { (my $pos1 = $MATCH->to()); do { ((('l' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('e' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('a' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('v' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('e' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { ($MATCH->{capture} = (Leave->new( ))) } || 1)))))) } }); $MATCH };
sub ctrl_return { my $grammar = $_[0]; my $str = $_[1]; my $pos = $_[2]; my $MATCH; ($MATCH = MiniPerl6::Match->new( 'str' => $str,'from' => $pos,'to' => $pos,'bool' => 1, )); (($MATCH)->{bool} = do { (my $pos1 = $MATCH->to()); (do { ((('r' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('e' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('t' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('u' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('r' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('n' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { (my $pos1 = $MATCH->to()); (do { do { (my $tmp = $MATCH); ($MATCH = MiniPerl6::Match->new( 'str' => $str,'from' => $tmp->to(),'to' => $tmp->to(),'bool' => 1, )); (($MATCH)->{bool} = do { (my $pos1 = $MATCH->to()); do { (('(' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) } }); (($tmp)->{bool} = ($MATCH ? 1 : 0)); ($MATCH = $tmp); ($MATCH ? 1 : 0) } } || do { (($MATCH)->{to} = $pos1); do { (my $m2 = $grammar->ws($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());1 } else { 0 } } }) } && (do { (my $m2 = $grammar->exp($str, $MATCH->to())); if ($m2) { (($MATCH)->{to} = $m2->to());($MATCH->{'exp'} = $m2);1 } else { 0 } } && (do { ($MATCH->{capture} = (Return->new( 'result' => ${$MATCH->{'exp'}}, ))) } || 1))))))))) } || do { (($MATCH)->{to} = $pos1); ((('r' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('e' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('t' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('u' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('r' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && ((('n' eq substr($str, $MATCH->to(), 1)) ? (1 + (($MATCH)->{to} = (1 + $MATCH->to()))) : 0) && (do { ($MATCH->{capture} = (Return->new( 'result' => Val::Undef->new( ), ))) } || 1))))))) }) }); $MATCH }
}
View
9 libjs/MiniPerl6/Grammar/Control.js
@@ -12,7 +12,7 @@ if (typeof MiniPerl6$Grammar != 'object') {
MiniPerl6$Grammar.f_control = function (v_str, v_pos) {
var v_grammar = this;
try { var v_MATCH = null;
-(v_MATCH = function () { var tmp = {v_str: v_str,v_from: v_pos,v_to: v_pos,v_bool: 1,}; tmp.__proto__ = MiniPerl6$Match; return tmp }());(v_MATCH.v_bool = (function () { var v_pos1;(v_pos1 = v_MATCH.f_to());return(( f_bool((function () { return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_ctrl_return(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["ctrl_return"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["ctrl_return"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_ctrl_leave(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["ctrl_leave"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["ctrl_leave"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_if(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["if"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["if"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_when(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["when"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["when"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_for(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["for"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["for"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_while(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["while"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["while"]))) })()) || f_bool(1) )) )) })()) || f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_apply(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["apply"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["apply"]))) })()) || f_bool(1) )) )) })()) )) )) )) )) )) )) })());return(v_MATCH) } catch(err) { if ( err instanceof Error ) { throw(err) } else { return(err) } }
+(v_MATCH = function () { var tmp = {v_str: v_str,v_from: v_pos,v_to: v_pos,v_bool: 1,}; tmp.__proto__ = MiniPerl6$Match; return tmp }());(v_MATCH.v_bool = (function () { var v_pos1;(v_pos1 = v_MATCH.f_to());return(( f_bool((function () { return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_ctrl_return(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["ctrl_return"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["ctrl_return"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_ctrl_leave(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["ctrl_leave"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["ctrl_leave"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_if(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["if"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["if"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_when(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["when"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["when"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_for(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["for"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["for"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_while(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["while"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["while"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_loop(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["loop"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["loop"]))) })()) || f_bool(1) )) )) })()) || f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_apply(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["apply"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["apply"]))) })()) || f_bool(1) )) )) })()) )) )) )) )) )) )) )) })());return(v_MATCH) } catch(err) { if ( err instanceof Error ) { throw(err) } else { return(err) } }
}
MiniPerl6$Grammar.f_control; // v8 bug workaround
// method if
@@ -43,6 +43,13 @@ if (typeof MiniPerl6$Grammar != 'object') {
(v_MATCH = function () { var tmp = {v_str: v_str,v_from: v_pos,v_to: v_pos,v_bool: 1,}; tmp.__proto__ = MiniPerl6$Match; return tmp }());(v_MATCH.v_bool = (function () { var v_pos1;(v_pos1 = v_MATCH.f_to());return((function () { return(( f_bool(( f_bool(("w" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool(( f_bool(("h" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool(( f_bool(("i" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool(( f_bool(("l" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool(( f_bool(("e" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_ws(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_exp(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["exp"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_ws(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());return(1) } else { return(0) } })()) && f_bool(( f_bool(( f_bool(("{" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_opt_ws(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_exp_stmts(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["exp_stmts"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_opt_ws(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());return(1) } else { return(0) } })()) && f_bool(( f_bool(( f_bool(("}" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = function () { var tmp = {v_cond: f_scalar(v_MATCH["exp"]),v_body: f_scalar(v_MATCH["exp_stmts"]),}; tmp.__proto__ = While; return tmp }())) })()) || f_bool(1) )) )) )) )) )) )) )) )) )) )) )) )) )) )) })()) })());return(v_MATCH) } catch(err) { if ( err instanceof Error ) { throw(err) } else { return(err) } }
}
MiniPerl6$Grammar.f_while; // v8 bug workaround
+ // method loop
+ MiniPerl6$Grammar.f_loop = function (v_str, v_pos) {
+ var v_grammar = this;
+ try { var v_MATCH = null;
+(v_MATCH = function () { var tmp = {v_str: v_str,v_from: v_pos,v_to: v_pos,v_bool: 1,}; tmp.__proto__ = MiniPerl6$Match; return tmp }());(v_MATCH.v_bool = (function () { var v_pos1;(v_pos1 = v_MATCH.f_to());return((function () { return(( f_bool(( f_bool(("l" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool(( f_bool(("o" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool(( f_bool(("o" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool(( f_bool(("p" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_ws(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());return(1) } else { return(0) } })()) && f_bool((function () { var v_pos1;(v_pos1 = v_MATCH.f_to());return(( f_bool((function () { return(( f_bool(( f_bool(("{" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_opt_ws(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_exp_stmts(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["exp_stmts"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_opt_ws(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());return(1) } else { return(0) } })()) && f_bool(( f_bool(( f_bool(("}" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = function () { var tmp = {v_cond: function () { var tmp = {v_bit: 1,}; tmp.__proto__ = Val$Bit; return tmp }(),v_body: f_scalar(v_MATCH["exp_stmts"]),}; tmp.__proto__ = While; return tmp }())) })()) || f_bool(1) )) )) )) )) )) )) })()) || f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { return(f_die("loop(;;){} not implemented")) })()) || f_bool(1) )) })()) )) })()) )) )) )) )) )) })()) })());return(v_MATCH) } catch(err) { if ( err instanceof Error ) { throw(err) } else { return(err) } }
+ }
+ MiniPerl6$Grammar.f_loop; // v8 bug workaround
// method ctrl_leave
MiniPerl6$Grammar.f_ctrl_leave = function (v_str, v_pos) {
var v_grammar = this;
View
9 perlito.js
@@ -1526,7 +1526,7 @@ if (typeof MiniPerl6$Grammar != 'object') {
MiniPerl6$Grammar.f_control = function (v_str, v_pos) {
var v_grammar = this;
try { var v_MATCH = null;
-(v_MATCH = function () { var tmp = {v_str: v_str,v_from: v_pos,v_to: v_pos,v_bool: 1,}; tmp.__proto__ = MiniPerl6$Match; return tmp }());(v_MATCH.v_bool = (function () { var v_pos1;(v_pos1 = v_MATCH.f_to());return(( f_bool((function () { return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_ctrl_return(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["ctrl_return"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["ctrl_return"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_ctrl_leave(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["ctrl_leave"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["ctrl_leave"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_if(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["if"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["if"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_when(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["when"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["when"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_for(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["for"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["for"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_while(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["while"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["while"]))) })()) || f_bool(1) )) )) })()) || f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_apply(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["apply"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["apply"]))) })()) || f_bool(1) )) )) })()) )) )) )) )) )) )) })());return(v_MATCH) } catch(err) { if ( err instanceof Error ) { throw(err) } else { return(err) } }
+(v_MATCH = function () { var tmp = {v_str: v_str,v_from: v_pos,v_to: v_pos,v_bool: 1,}; tmp.__proto__ = MiniPerl6$Match; return tmp }());(v_MATCH.v_bool = (function () { var v_pos1;(v_pos1 = v_MATCH.f_to());return(( f_bool((function () { return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_ctrl_return(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["ctrl_return"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["ctrl_return"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_ctrl_leave(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["ctrl_leave"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["ctrl_leave"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_if(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["if"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["if"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_when(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["when"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["when"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_for(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["for"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["for"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_while(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["while"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["while"]))) })()) || f_bool(1) )) )) })()) || f_bool(( f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_loop(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["loop"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["loop"]))) })()) || f_bool(1) )) )) })()) || f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_apply(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["apply"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = f_scalar(v_MATCH["apply"]))) })()) || f_bool(1) )) )) })()) )) )) )) )) )) )) )) })());return(v_MATCH) } catch(err) { if ( err instanceof Error ) { throw(err) } else { return(err) } }
}
MiniPerl6$Grammar.f_control; // v8 bug workaround
// method if
@@ -1557,6 +1557,13 @@ if (typeof MiniPerl6$Grammar != 'object') {
(v_MATCH = function () { var tmp = {v_str: v_str,v_from: v_pos,v_to: v_pos,v_bool: 1,}; tmp.__proto__ = MiniPerl6$Match; return tmp }());(v_MATCH.v_bool = (function () { var v_pos1;(v_pos1 = v_MATCH.f_to());return((function () { return(( f_bool(( f_bool(("w" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool(( f_bool(("h" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool(( f_bool(("i" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool(( f_bool(("l" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool(( f_bool(("e" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_ws(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_exp(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["exp"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_ws(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());return(1) } else { return(0) } })()) && f_bool(( f_bool(( f_bool(("{" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_opt_ws(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_exp_stmts(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["exp_stmts"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_opt_ws(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());return(1) } else { return(0) } })()) && f_bool(( f_bool(( f_bool(("}" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = function () { var tmp = {v_cond: f_scalar(v_MATCH["exp"]),v_body: f_scalar(v_MATCH["exp_stmts"]),}; tmp.__proto__ = While; return tmp }())) })()) || f_bool(1) )) )) )) )) )) )) )) )) )) )) )) )) )) )) })()) })());return(v_MATCH) } catch(err) { if ( err instanceof Error ) { throw(err) } else { return(err) } }
}
MiniPerl6$Grammar.f_while; // v8 bug workaround
+ // method loop
+ MiniPerl6$Grammar.f_loop = function (v_str, v_pos) {
+ var v_grammar = this;
+ try { var v_MATCH = null;
+(v_MATCH = function () { var tmp = {v_str: v_str,v_from: v_pos,v_to: v_pos,v_bool: 1,}; tmp.__proto__ = MiniPerl6$Match; return tmp }());(v_MATCH.v_bool = (function () { var v_pos1;(v_pos1 = v_MATCH.f_to());return((function () { return(( f_bool(( f_bool(("l" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool(( f_bool(("o" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool(( f_bool(("o" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool(( f_bool(("p" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_ws(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());return(1) } else { return(0) } })()) && f_bool((function () { var v_pos1;(v_pos1 = v_MATCH.f_to());return(( f_bool((function () { return(( f_bool(( f_bool(("{" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_opt_ws(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_exp_stmts(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());(v_MATCH["exp_stmts"] = v_m2);return(1) } else { return(0) } })()) && f_bool(( f_bool((function () { var v_m2;(v_m2 = v_grammar.f_opt_ws(v_str, v_MATCH.f_to()));if ( f_bool(v_m2) ) { (v_MATCH.v_to = v_m2.f_to());return(1) } else { return(0) } })()) && f_bool(( f_bool(( f_bool(("}" == (v_str || "").substr(v_MATCH.f_to(), 1))) ? f_add(1, (v_MATCH.v_to = f_add(1, v_MATCH.f_to()))) : 0)) && f_bool(( f_bool((function () { return((v_MATCH.v_capture = function () { var tmp = {v_cond: function () { var tmp = {v_bit: 1,}; tmp.__proto__ = Val$Bit; return tmp }(),v_body: f_scalar(v_MATCH["exp_stmts"]),}; tmp.__proto__ = While; return tmp }())) })()) || f_bool(1) )) )) )) )) )) )) })()) || f_bool((function () { (v_MATCH.v_to = v_pos1);return(( f_bool((function () { return(f_die("loop(;;){} not implemented")) })()) || f_bool(1) )) })()) )) })()) )) )) )) )) )) })()) })());return(v_MATCH) } catch(err) { if ( err instanceof Error ) { throw(err) } else { return(err) } }
+ }
+ MiniPerl6$Grammar.f_loop; // v8 bug workaround
// method ctrl_leave
MiniPerl6$Grammar.f_ctrl_leave = function (v_str, v_pos) {
var v_grammar = this;

0 comments on commit dd346a7

Please sign in to comment.