# generated file - do not edit! package grammar1; *{'statement_control:'} = sub { my $rule = ruleop::concat( ruleop::constant( 'statement_control:' ), \&grammar1::ws_star, ruleop::concat( ruleop::optional( \&{'grammar1::ws'} , ) , ruleop::constant( "\(" ) , ruleop::capture( 'expr', ruleop::non_greedy_star( \&{'grammar1::any'} , ) , ) , ruleop::constant( "\)" ) , ruleop::optional( \&{'grammar1::ws'} , ) , ruleop::capture( 'block', ruleop::capture( 'code', \&{'grammar1::code'} ) , ) , ) ); my $match = $rule->( @_ ); return unless $match; my $code = sub { my $src = <<'!EOT!'; { return ' sub prefix:<_if_expr> { return $expr ; } sub prefix:<_if_block> { $block } eval( \' if ( &{\\\'prefix:<_if_expr>\\\'}() ) { &{\\\'prefix:<_if_block>\\\'}() } \', :lang ); '; } !EOT! my $block = match::str( match::get( $_[0], '$' ) ); $block =~ s/([\'\\])/\\$1/g; my $expr = match::str( match::get( $_[0], '$' ) ); $expr =~ s/([\'\\])/\\$1/g; $src =~ s/([\'"\\])/\\$1/g; my $ret = eval( '"' . $src . '"' ); die $@ if $@; my $ast = grammar1::immediate_statement_rule( $ret ); die "compile: syntax error in macro at '" . $ast->{tail} . "'\n" if $ast->{tail}; my $perl5 = Perl6Grammar::emit( $ast->{capture} ); my $expanded = eval $perl5; die $@ if $@; my $final_ast = ::compile_rule( q( [ ? <@grammar1::statements> ]* ? ) ) ->( $expanded ); die "compile: syntax error in macro at '" . $final_ast->{tail} . "'\n" if $final_ast->{tail}; return $final_ast; }; my $ast = $code->( $match ); return { %$match, capture => [ $ast->{capture} ] }; }; push @grammar1::statements, \&{'statement_control:'}; *{'infix:<*>'} = sub { $_[0] * $_[1] } ; push @grammar1::ops, ::compile_rule( 'infix\:\<\*\>' ); *{'infix:<+>'} = sub { $_[0] + $_[1] } ; push @grammar1::ops, ::compile_rule( 'infix\:\<\+\>' ); *{'infix:<~>'} = sub { $_[0] . $_[1] } ; push @grammar1::ops, ::compile_rule( 'infix\:\<\~\>' );