package Grammar::Perl6; *{'perl5_regex'} = sub { my $rule = Runtime::Perl5::RuleOps::greedy_star( Runtime::Perl5::RuleOps::alternation( [ Runtime::Perl5::RuleOps::constant( "\." ) , Runtime::Perl5::RuleOps::constant( "\|" ) , Runtime::Perl5::RuleOps::constant( "\*" ) , Runtime::Perl5::RuleOps::constant( "\+" ) , Runtime::Perl5::RuleOps::constant( "\(" ) , Runtime::Perl5::RuleOps::constant( "\)" ) , Runtime::Perl5::RuleOps::constant( "\[" ) , Runtime::Perl5::RuleOps::constant( "\]" ) , Runtime::Perl5::RuleOps::constant( "\?" ) , Runtime::Perl5::RuleOps::constant( "\:" ) , Runtime::Perl5::RuleOps::constant( "s" ) , Runtime::Perl5::RuleOps::constant( "w" ) , Runtime::Perl5::RuleOps::constant( "_" ) , Runtime::Perl5::RuleOps::constant( "\\" ) , Runtime::Perl5::RuleOps::constant( "\^" ) , Runtime::Perl5::RuleOps::constant( "\$" ) , Runtime::Perl5::RuleOps::constant( "n" ) , Runtime::Perl5::RuleOps::constant( "\#" ) , Runtime::Perl5::RuleOps::constant( "\-" ) , Runtime::Perl5::RuleOps::constant( "\<" ) , Runtime::Perl5::RuleOps::constant( "\>" ) , Runtime::Perl5::RuleOps::constant( "\!" ) , Runtime::Perl5::RuleOps::constant( "alnum" ) , ] ) , ) , ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { perl5_regex => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; *{'perl5_rule_decl'} = sub { my $rule = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::constant( "rule" ) , Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , Runtime::Perl5::RuleOps::capture( 'ident', \&{'Grammar::Perl6::ident'} ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::constant( "\:" ) , Runtime::Perl5::RuleOps::constant( "P5" ) , Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , Runtime::Perl5::RuleOps::constant( "\{" ) , Runtime::Perl5::RuleOps::capture( 'perl5_regex', \&{'Grammar::Perl6::perl5_regex'} ) , Runtime::Perl5::RuleOps::constant( "\}" ) , ) ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { perl5_rule_decl => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; push @statements, \&perl5_rule_decl; *{'word'} = sub { my $bool = $_[0] =~ /^([_[:alnum:]]+)(.*)$/sx; return { bool => $bool, match => { 'word'=> $1 }, tail => $2, ( $_[2]->{capture} ? ( capture => [ $1 ] ) : () ), } }; *{'any'} = sub { my $bool = $_[0] =~ /^(.)(.*)$/sx; return { bool => $bool, match => { 'any'=> $1 }, tail => $2, ( $_[2]->{capture} ? ( capture => [ $1 ] ) : () ), } }; *{'escaped_char'} = sub { my $bool = $_[0] =~ /^\\(.)(.*)$/sx; return { bool => $bool, match => { 'escaped_char'=> $1 }, tail => $2, ( $_[2]->{capture} ? ( capture => [ $1 ] ) : () ), } }; *{'newline'} = sub { my $bool = $_[0] =~ /^(\n)(.*)$/sx; return { bool => $bool, match => { 'newline'=> $1 }, tail => $2, ( $_[2]->{capture} ? ( capture => [ $1 ] ) : () ), } }; *{'ws'} = sub { my $bool = $_[0] =~ /^(\s+)(.*)$/sx; return { bool => $bool, match => { 'ws'=> $1 }, tail => $2, ( $_[2]->{capture} ? ( capture => [ $1 ] ) : () ), } }; *{'p6ws'} = sub { my $bool = $_[0] =~ /^((?:\s|\#(?-s:.)*)+)(.*)$/sx; return { bool => $bool, match => { 'p6ws'=> $1 }, tail => $2, ( $_[2]->{capture} ? ( capture => [ $1 ] ) : () ), } }; *{'non_capturing_subrule'} = sub { my $bool = $_[0] =~ /^\<\?(.*?)\>(.*)$/sx; return { bool => $bool, match => { 'non_capturing_subrule'=> $1 }, tail => $2, ( $_[2]->{capture} ? ( capture => [ $1 ] ) : () ), } }; push @rule_terms, \&non_capturing_subrule; *{'negated_subrule'} = sub { my $bool = $_[0] =~ /^\<\!(.*?)\>(.*)$/sx; return { bool => $bool, match => { 'negated_subrule'=> $1 }, tail => $2, ( $_[2]->{capture} ? ( capture => [ $1 ] ) : () ), } }; push @rule_terms, \&negated_subrule; *{'subrule'} = sub { my $bool = $_[0] =~ /^\<(.*?)\>(.*)$/sx; return { bool => $bool, match => { 'subrule'=> $1 }, tail => $2, ( $_[2]->{capture} ? ( capture => [ $1 ] ) : () ), } }; push @rule_terms, \&subrule; *{'const_word'} = sub { my $rule = Runtime::Perl5::RuleOps::capture( 'word', \&{'Grammar::Perl6::word'} ) , ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { constant => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; unshift @rule_terms, \&const_word; *{'const_escaped_char'} = sub { my $rule = Runtime::Perl5::RuleOps::capture( 'escaped_char', \&{'Grammar::Perl6::escaped_char'} ) , ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { constant => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; unshift @rule_terms, \&const_escaped_char; *{'dot'} = sub { my $rule = Runtime::Perl5::RuleOps::capture( 'capturing_group', Runtime::Perl5::RuleOps::constant( "\." ) , ) , ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { dot => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; unshift @rule_terms, \˙ *{'rule'} = Runtime::Perl5::RuleOps::greedy_star( Runtime::Perl5::RuleOps::alternation( [ \&{'Grammar::Perl6::alt'} , \&{'Grammar::Perl6::quantifier'} , ] ) , ) , ; *{'non_capturing_group'} = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::constant( "\[" ) , \&{'Grammar::Perl6::rule'} , Runtime::Perl5::RuleOps::constant( "\]" ) , ) ; push @rule_terms, \&non_capturing_group; *{'closure_rule'} = sub { my $rule = Runtime::Perl5::RuleOps::capture( 'code', \&{'Grammar::Perl6::code'} ) , ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { closure => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; unshift @rule_terms, \&closure_rule; *{'variable_rule'} = sub { my $rule = Runtime::Perl5::RuleOps::capture( 'variable', \&{'Grammar::Perl6::variable'} ) , ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { variable => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; unshift @rule_terms, \&variable_rule; *{'runtime_alternation'} = sub { my $rule = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::constant( "\<" ) , Runtime::Perl5::RuleOps::capture( 'variable', \&{'Grammar::Perl6::variable'} ) , Runtime::Perl5::RuleOps::constant( "\>" ) , ) ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { runtime_alternation => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; unshift @rule_terms, \&runtime_alternation; *{'named_capture'} = sub { my $rule = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::constant( "\$" ) , Runtime::Perl5::RuleOps::capture( 'ident', \&{'Grammar::Perl6::ident'} ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::constant( "\:" ) , Runtime::Perl5::RuleOps::constant( "\=" ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::constant( "\(" ) , Runtime::Perl5::RuleOps::capture( 'rule', \&{'Grammar::Perl6::rule'} ) , Runtime::Perl5::RuleOps::constant( "\)" ) , ) ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { named_capture => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; unshift @rule_terms, \&named_capture; *{'immediate_statement_rule'} = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::alternation( \@statements ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , ) ; *{'grammar'} = Runtime::Perl5::RuleOps::greedy_star( Runtime::Perl5::RuleOps::capture( 'immediate_statement_rule', \&{'Grammar::Perl6::immediate_statement_rule'} ) , ) , ; *{'rule_decl'} = sub { my $rule = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::constant( "rule" ) , Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , Runtime::Perl5::RuleOps::capture( 'ident', \&{'Grammar::Perl6::ident'} ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::constant( "\{" ) , Runtime::Perl5::RuleOps::capture( 'rule', \&{'Grammar::Perl6::rule'} ) , Runtime::Perl5::RuleOps::constant( "\}" ) , ) ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { rule_decl => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; push @statements, \&rule_decl; *{'grammar_name'} = sub { my $rule = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::constant( "grammar" ) , Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , Runtime::Perl5::RuleOps::capture( 'ident', \&{'Grammar::Perl6::ident'} ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::constant( "\;" ) , ) ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { grammar_name => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; push @statements, \&grammar_name; *{'_push'} = sub { my $rule = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::capture( 'op', Runtime::Perl5::RuleOps::alternation( [ Runtime::Perl5::RuleOps::constant( "push" ) , Runtime::Perl5::RuleOps::constant( "unshift" ) , ] ) , ) , Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , Runtime::Perl5::RuleOps::capture( 'variable', \&{'Grammar::Perl6::variable'} ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::constant( "\," ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::capture( 'code', Runtime::Perl5::RuleOps::non_greedy_star( \&{'Grammar::Perl6::any'} , ) , ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::constant( "\;" ) , ) ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { _push => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; push @statements, \&_push; *{'pod'} = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::constant( "\=" ) , Runtime::Perl5::RuleOps::alternation( [ Runtime::Perl5::RuleOps::constant( "pod" ) , Runtime::Perl5::RuleOps::constant( "head1" ) , Runtime::Perl5::RuleOps::constant( "kwid" ) , Runtime::Perl5::RuleOps::constant( "for" ) , ] ) , Runtime::Perl5::RuleOps::non_greedy_star( \&{'Grammar::Perl6::any'} , ) , Runtime::Perl5::RuleOps::constant( "\=" ) , Runtime::Perl5::RuleOps::constant( "cut" ) , ) ; push @statements, \&pod; *{'use_v6'} = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::constant( "use" ) , \&{'Grammar::Perl6::p6ws'} , Runtime::Perl5::RuleOps::constant( "v6" ) , Runtime::Perl5::RuleOps::constant( "\-" ) , Runtime::Perl5::RuleOps::constant( "pugs" ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::constant( "\;" ) , ) ; push @statements, \&use_v6; *{'require'} = sub { my $rule = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::constant( "require" ) , \&{'Grammar::Perl6::p6ws'} , Runtime::Perl5::RuleOps::capture( 'ident', \&{'Grammar::Perl6::ident'} ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::constant( "\;" ) , ) ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { require_bareword => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; push @statements, \&require; *{'term1'} = Runtime::Perl5::RuleOps::alternation( \@terms ) , ; *{'list'} = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::greedy_star( Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::capture( 'term1', \&{'Grammar::Perl6::term1'} ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::constant( "\," ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , ) ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'term1', \&{'Grammar::Perl6::term1'} ) , ) , ) ; *{'block'} = sub { my $rule = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::constant( "\{" ) , Runtime::Perl5::RuleOps::capture( 'list', Runtime::Perl5::RuleOps::greedy_star( Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::alternation( \@statements ) , ) ) , ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::constant( "\}" ) , ) ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { block => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; push @statements, \█ *{'macro_decl'} = sub { my $rule = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::constant( "macro" ) , \&{'Grammar::Perl6::p6ws'} , Runtime::Perl5::RuleOps::capture( 'prefix', Runtime::Perl5::RuleOps::capture( 'word', \&{'Grammar::Perl6::word'} ) , ) , Runtime::Perl5::RuleOps::constant( "\:" ) , Runtime::Perl5::RuleOps::constant( "\<" ) , Runtime::Perl5::RuleOps::capture( 'id', Runtime::Perl5::RuleOps::non_greedy_star( \&{'Grammar::Perl6::any'} , ) , ) , Runtime::Perl5::RuleOps::constant( "\>" ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::constant( "\(" ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::capture( 'list', \&{'Grammar::Perl6::list'} ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::constant( "\)" ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::constant( "is" ) , \&{'Grammar::Perl6::p6ws'} , Runtime::Perl5::RuleOps::constant( "parsed" ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::constant( "\(" ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::constant( "\/" ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::capture( 'rule', \&{'Grammar::Perl6::rule'} ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::constant( "\/" ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::constant( "\)" ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::capture( 'code', \&{'Grammar::Perl6::code'} ) , ) ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { macro => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; push @statements, \¯o_decl; push @terms, \&variable; push @terms, \&literal; *{'_print'} = sub { my $rule = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::capture( 'op', Runtime::Perl5::RuleOps::alternation( [ Runtime::Perl5::RuleOps::constant( "print" ) , Runtime::Perl5::RuleOps::constant( "say" ) , Runtime::Perl5::RuleOps::constant( "warn" ) , Runtime::Perl5::RuleOps::constant( "die" ) , ] ) , ) , Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , Runtime::Perl5::RuleOps::capture( 'list', \&{'Grammar::Perl6::list'} ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::constant( "\;" ) , ) ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { _print => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; push @statements, \&_print; *{'_my'} = sub { my $rule = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::capture( 'op', Runtime::Perl5::RuleOps::alternation( [ Runtime::Perl5::RuleOps::constant( "my" ) , Runtime::Perl5::RuleOps::constant( "our" ) , Runtime::Perl5::RuleOps::constant( "local" ) , ] ) , ) , Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , Runtime::Perl5::RuleOps::capture( 'variable', \&{'Grammar::Perl6::variable'} ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::constant( "\;" ) , ) ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { _my => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; push @statements, \&_my; *{'_simple_statement'} = sub { my $rule = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::capture( 'op', Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::alternation( [ Runtime::Perl5::RuleOps::constant( "die" ) , Runtime::Perl5::RuleOps::constant( "\." ) , ] ) , Runtime::Perl5::RuleOps::constant( "\." ) , Runtime::Perl5::RuleOps::constant( "\." ) , ) ) , Runtime::Perl5::RuleOps::constant( "\;" ) , ) ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { _simple_statement => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; push @statements, \&_simple_statement; *{'sub_decl'} = sub { my $rule = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::constant( "sub" ) , \&{'Grammar::Perl6::p6ws'} , Runtime::Perl5::RuleOps::capture( 'fix', Runtime::Perl5::RuleOps::alternation( [ Runtime::Perl5::RuleOps::constant( "infix" ) , Runtime::Perl5::RuleOps::constant( "prefix" ) , Runtime::Perl5::RuleOps::constant( "postfix" ) , ] ) , ) , Runtime::Perl5::RuleOps::constant( "\:" ) , Runtime::Perl5::RuleOps::constant( "\<" ) , Runtime::Perl5::RuleOps::capture( 'id', Runtime::Perl5::RuleOps::non_greedy_star( \&{'Grammar::Perl6::any'} , ) , ) , Runtime::Perl5::RuleOps::constant( "\>" ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::capture( 'block', \&{'Grammar::Perl6::block'} ) , ) ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { sub_decl => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; push @statements, \&sub_decl; *{'term2'} = sub { my $rule = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::capture( 'term1', Runtime::Perl5::RuleOps::capture( 'term1', \&{'Grammar::Perl6::term1'} ) , ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::capture( 'op', Runtime::Perl5::RuleOps::alternation( \@ops ) , ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::capture( 'term2', Runtime::Perl5::RuleOps::capture( 'term1', \&{'Grammar::Perl6::term1'} ) , ) , ) ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { sub_application_term => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; *{'sub_application'} = sub { my $rule = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::capture( 'term1', Runtime::Perl5::RuleOps::alternation( [ Runtime::Perl5::RuleOps::capture( 'term1', \&{'Grammar::Perl6::term1'} ) , Runtime::Perl5::RuleOps::capture( 'term2', \&{'Grammar::Perl6::term2'} ) , ] ) , ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::capture( 'op', Runtime::Perl5::RuleOps::alternation( \@ops ) , ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::capture( 'term2', Runtime::Perl5::RuleOps::alternation( [ Runtime::Perl5::RuleOps::capture( 'term1', \&{'Grammar::Perl6::term1'} ) , Runtime::Perl5::RuleOps::capture( 'term2', \&{'Grammar::Perl6::term2'} ) , ] ) , ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::constant( "\;" ) , ) ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { sub_application => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; push @statements, \&sub_application; *{'eval_perl5'} = sub { my $rule = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::constant( "eval" ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::constant( "\(" ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::capture( 'literal', \&{'Grammar::Perl6::literal'} ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::constant( "\," ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::constant( "\:" ) , Runtime::Perl5::RuleOps::constant( "lang" ) , Runtime::Perl5::RuleOps::constant( "\<" ) , Runtime::Perl5::RuleOps::constant( "perl5" ) , Runtime::Perl5::RuleOps::constant( "\>" ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::constant( "\)" ) , Runtime::Perl5::RuleOps::optional( Runtime::Perl5::RuleOps::capture( 'p6ws', \&{'Grammar::Perl6::p6ws'} ) , ) , Runtime::Perl5::RuleOps::constant( "\;" ) , ) ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { eval_perl5 => match::get( $_[0], '$' ) } } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; push @statements, \&eval_perl5; *{'_return'} = sub { my $rule = Runtime::Perl5::RuleOps::concat( Runtime::Perl5::RuleOps::constant( "return" ) , \&{'Grammar::Perl6::p6ws'} , Runtime::Perl5::RuleOps::capture( 'val', Runtime::Perl5::RuleOps::alternation( [ Runtime::Perl5::RuleOps::capture( 'term1', \&{'Grammar::Perl6::term1'} ) , Runtime::Perl5::RuleOps::capture( 'term2', \&{'Grammar::Perl6::term2'} ) , ] ) , ) , Runtime::Perl5::RuleOps::optional( \&{'Grammar::Perl6::p6ws'} , ) , Runtime::Perl5::RuleOps::constant( "\;" ) , ) ; my $match = $rule->( @_ ); return unless $match; my $capture_block = sub { return { _return => match::get( $_[0], '$()' ) ,} } , ; #use Data::Dumper; #print "capture was: ", Dumper( $match->{capture} ); return { %$match, capture => [ $capture_block->( $match ) ], }; } ; push @statements, \&_return;