parser.y in lrama-0.5.10 vs parser.y in lrama-0.5.11

- old
+ new

@@ -1,7 +1,7 @@ class Lrama::Parser - expect 1 + expect 0 token C_DECLARATION CHARACTER IDENT_COLON IDENTIFIER INTEGER STRING TAG rule @@ -29,11 +29,10 @@ | bison_declarations bison_declaration bison_declaration: grammar_declaration | "%expect" INTEGER { @grammar.expect = val[1] } | "%define" variable value - | "%require" STRING | "%param" params | "%lex-param" params { val[1].each {|token| @grammar.lex_param = Grammar::Code::NoReferenceCode.new(type: :lex_param, token_code: token).token_code.s_value @@ -325,31 +324,28 @@ token.alias_name = val[2] builder = val[0] builder.add_rhs(token) result = builder } - | rhs IDENTIFIER parameterizing_suffix + | rhs IDENTIFIER parameterizing_suffix tag_opt { token = Lrama::Lexer::Token::Parameterizing.new(s_value: val[2], location: @lexer.location, args: [val[1]]) builder = val[0] builder.add_rhs(token) + builder.lhs_tag = val[3] + builder.line = val[1].first_line result = builder } - | rhs IDENTIFIER "(" symbol ")" + | rhs IDENTIFIER "(" parameterizing_args ")" tag_opt { - token = Lrama::Lexer::Token::Parameterizing.new(s_value: val[1].s_value, location: @lexer.location, args: [val[3]]) + token = Lrama::Lexer::Token::Parameterizing.new(s_value: val[1].s_value, location: @lexer.location, args: val[3]) builder = val[0] builder.add_rhs(token) + builder.lhs_tag = val[5] + builder.line = val[1].first_line result = builder } - | rhs IDENTIFIER "(" symbol "," symbol ")" - { - token = Lrama::Lexer::Token::Parameterizing.new(s_value: val[1].s_value, location: @lexer.location, args: [val[3], val[5]]) - builder = val[0] - builder.add_rhs(token) - result = builder - } | rhs "{" { if @prec_seen on_action_error("multiple User_code after %prec", val[0]) if @code_after_prec @code_after_prec = true @@ -360,14 +356,14 @@ { end_c_declaration } "}" named_ref_opt { - token = val[3] - token.alias_name = val[6] + user_code = val[3] + user_code.alias_name = val[6] builder = val[0] - builder.user_code = token + builder.user_code = user_code result = builder } | rhs "%prec" symbol { sym = @grammar.find_symbol_by_id!(val[2]) @@ -379,10 +375,13 @@ parameterizing_suffix: "?" | "+" | "*" + parameterizing_args: symbol { result = [val[0]] } + | parameterizing_args ',' symbol { result = val[0].append(val[2]) } + named_ref_opt: # empty | '[' IDENTIFIER ']' { result = val[1].s_value } id_colon: IDENT_COLON @@ -410,9 +409,12 @@ generic_symlist_item: symbol | TAG string_as_id: STRING { result = Lrama::Lexer::Token::Ident.new(s_value: val[0]) } + + tag_opt: # empty + | TAG end ---- inner include Lrama::Report::Duration