# WARNING: This file was mechanically generated by generate_grammar.pl # -- Arguments ------------------------------------------------------------- rule argument_list { } term apply_sub_notFolded compete(rx{}) { } # # missing_magic # Completely kludge arity, which has become critical. :/ # # optional_argument_list = ques(:argument_list) # optional_expr_above_comma = ques(:expr_above_comma) # acx = optional_argument_list # ac1 = seq(:expr_above_comma) # acq = optional_expr_above_comma # ac0 = seq() # # ac = {:ref=>1,:pi=>0,:shift=>1,:pop=>1,:try=>1}[n] # case ac # when nil; rest.push(*acx) # when :s; rest.push(*acx) # when 1; rest.push(*ac1) # when :q; rest.push(*acq) # when 0; rest.push(*ac0) # else fail("assert") end # args # }]] term sub_name_term { } rule method_args { [\:|\(optional_argument_list\)]? } rule implicit_invocant { } term apply_method_term { \. } # -- Declarations ------------------------------------------------ rule scope { ||||| } rule type { [\w|\:\:]<[\w:&|?]>* } # related to sr('type_var') and/or sr('type_literal')? rule trait { |[\:\:]?[\(<-[\)]>*\)]? } rule block { \{\} } term code_block compete(rx{\{}) { []? } # rule sub_declaration { [[]?]?[]?[>]?[]?[>]?[]* } rule sub_head { []?||||| } rule sub_parameters__ParensMandatory { [>]? } rule sub_parameters__ParensOptional { [>]? } rule param_name { \&|<[\$\@\%]>|\:\:\w+ } rule formal_param { []?[\\]?[]?[]?[]*[]?[>|]? } rule param_default { } rule param_foretaste { \:|\* } rule param_optness { \?|\! } # rule trusts_declaration { } rule trait_declaration { $|> } rule member_declaration { []?[]*[]?[]? } # rule rule_declaration { } # rule var_declaration { []?|\(|>\)[]*[||||]? } # rule package_block_declaration { } rule package_declaration { } rule package_head { []?||||[[]?]?[]* } # rule no_declaration { | } rule use_declaration { | } rule perl_version { [v|Perl\-]<[\d\.]>+[]? } rule use_version { } rule no_version { } rule use_package { jsan\:|jsperl5\:|[\:]? } rule use_perl_package { [\(\)|]? } rule use_JSAN_module { |\(\)|[]? } rule use_JSPerl5_module { |\(\)|[]? } rule package_full_name { []?[]? } rule version_part { \-<[\d\.\(\)]>+ } rule author_part { \-<[\w\(\)]>+ } # rule inline_declaration { } rule require_declaration { } # -- Expressions / Terms ------------------------------------------------ term fakestring compete(rx{\'}) { [\'[<-['\\]>|\\.]*\'] } # ' term fakierstring compete(rx{\"}) { [\"[<-[\"\\]>|\\.]*\"] } term fakeEND compete(rx{\<\<\'_END\'}) { [\<\<\'_END\'\ *\n(.+?)\n_END\ *\n] } # rule dereference { <[\$\@\%\&]>||> } # rule angle_bracket_literal { [\<\<[<-[>\\]>|\\.|\>>]*\>\>|\<[<-[>\\]>|\\.]*\>|\xab[<-[\xbb\\]>|\\.]*\xbb] } term angle_bracket_literal compete(rx{\<\\\]>|\\.|\>>]*\>\>|\<[<-[>\\]>|\\.]*\>|\xab[<-[\xbb\\]>|\\.]*\xbb] } rule hash_subscript_qw { } rule hash_subscript_braces { \{[]?\} } rule hash_subscript { | } rule fixity { [prefix\:|postfix\:|infix\:|circumfix\:|coerce\:|self\:|term\:|postcircumfix\:|rule_modifier\:|trait_verb\:|trait_auxiliary\:|scope_declarator\:|statement_control\:|infix_postfix_meta_operator\:|postfix_prefix_meta_operator\:|prefix_postfix_meta_operator\:|infix_circumfix_meta_operator\:] } rule operator_name { | } rule sub_name_bare { >| } rule sub_name_no_amp { | } rule sub_name_full { \& } rule identifier { <[a..zA..Z_]>\w* } rule qualified_identifier { [:i <[a..z_]>\w*[\:\:<[a..z_]>\w*]*] } rule twigil_opt { <[\^*?\.!+;]>? } term var_symbolic_deref compete(rx{<[\$\@\%\&]>}) { <[\$\@\%\&]>[\:\:\!|\/|\w+]+ } rule var_sub { \& } term var_sub { \& } # (nil) else prefix:& wins :/ rule var_simple { <[\$\@\%]> } term var_simple { <[\$\@\%]> } term var_error compete(rx{\$\!}) { \$\! } term var_match_numbered compete(rx{\$\d+}) { \$\d+ } term var_match_named compete(rx{\$\<}) { \$\<<-[>]>*\> } term var_match compete(rx{\$\/}) { \$\/ } rule var_name { | } # # term do_block compete(rx{do\b}) { | } # rule block_formal_pointy { \-\>[]* } term block_formal_pointy compete(rx{\-\>}) { \-\>[]* } rule block_formal_standard { >[]?[]* } term block_formal_standard compete(rx{[sub|coro|macro]\b}) { >[]?[]* } # # # fraction = /\.[\d_]+/ # expo = /[eE][-+]?\d+/ # number_re = /0(?:b[0-1]+|o[0-7]+|d[0-9]+|x[0-9a-fA-F]+) # |[0-9][0-9_]*#{fraction}?#{expo}? # |[-+]?(?:Inf|NaN)\b /x term number compete(rx{number_re}) { number_re } # term empty_list_literal { > } # # was r5('('), but that lost to postcircumfix_paren_empty(len 2), # which needs to be 2 to compete with postcircumfix:( )sr('0')(len 1). # rule array_literal { ]?> } term array_literal compete(rx{\[}) { ]?> } # rule pair_adverb { \:| } term pair_adverb { \:| } rule shortcut_pair { } rule regular_pair_name { \w+ } rule regular_pair { [||]? } rule valueDot { []? } rule noValue { } rule valueExp { >|| } # rule undef_literal { undef\b } # term yada_literal compete(rx{\.\.\.|\?\?\?|\!\!\!}) { || } # # rule adverb_hash { []* } rule rx_pattern { [\/[<-[\/\\]>|\\.]*\/]|[\{[<-[\}\\]>|\\.]*\}] } # the \b_dot_ is to win against apply sub. term rx_literal compete(rx{[[rx|m|rule]\b.]}) { } term rx_literal_bare compete(rx{\/}) { } term subst_literal compete(rx{s\b}) { } # # rule closure_trait { } term closure_trait compete(rx{[BEGIN|CHECK|INIT|FIRST|END]\b}) { } # also stmt?!? # term code_quotation compete(rx{q\:code}) { q\:code[]? } # term type_var compete(rx{\:\:}) { [\:\:\(\)|\w+]+ } # term type_literal { <[A..Z]>\w*[\:\:\w+]* } # -- Constructs ------------------------------------------------ rule for_construct { >[]? } rule loop_construct { | } rule semi_loop_construct { ]? []? []?> } rule post_loop_construct { } # rule cond_construct { } rule elsif_construct { } rule else_construct { } rule cond_body { [|]? } rule cond_part { ||> } # rule while_until_construct { } rule given_construct { } rule when_construct { } rule default_construct { } # -- expr_statement ---------------------------------------- rule expr_statement { [||]? } rule post_conditional { } rule post_loop { } rule post_iterate { } # -- Statements ---------------------------------------- rule prog { } rule statement_list { [[]*]* } # is a composite: # block_declaration statement { } statement { } statement { } statement { } # declaration statement { } statement { } statement { } statement { } statement { } statement { } statement { } statement { } statement { } # construct statement { } statement { } statement { } statement { } statement { } statement { } statement { } # expr statement { }