parser.y in lrama-0.6.0 vs parser.y in lrama-0.6.1
- old
+ new
@@ -203,12 +203,12 @@
token_declaration: id int_opt alias { result = val }
rule_declaration: "%rule" IDENTIFIER "(" rule_args ")" ":" rule_rhs_list
{
- builder = Grammar::ParameterizingRuleBuilder.new(val[1].s_value, val[3], val[6])
- @grammar.add_parameterizing_rule_builder(builder)
+ rule = Grammar::ParameterizingRule::Rule.new(val[1].s_value, val[3], val[6])
+ @grammar.add_parameterizing_rule(rule)
}
rule_args: IDENTIFIER { result = [val[0]] }
| rule_args "," IDENTIFIER { result = val[0].append(val[2]) }
@@ -224,16 +224,16 @@
}
rule_rhs: /* empty */
{
reset_precs
- result = Grammar::ParameterizingRuleRhsBuilder.new
+ result = Grammar::ParameterizingRule::Rhs.new
}
| "%empty"
{
reset_precs
- result = Grammar::ParameterizingRuleRhsBuilder.new
+ result = Grammar::ParameterizingRule::Rhs.new
}
| rule_rhs symbol named_ref_opt
{
token = val[1]
token.alias_name = val[2]
@@ -406,23 +406,21 @@
builder.add_rhs(token)
result = builder
}
| rhs symbol parameterizing_suffix tag_opt
{
- token = Lrama::Lexer::Token::InstantiateRule.new(s_value: val[2], location: @lexer.location, args: [val[1]])
+ token = Lrama::Lexer::Token::InstantiateRule.new(s_value: val[2], location: @lexer.location, args: [val[1]], lhs_tag: val[3])
builder = val[0]
builder.add_rhs(token)
- builder.lhs_tag = val[3]
builder.line = val[1].first_line
result = builder
}
| rhs IDENTIFIER "(" parameterizing_args ")" tag_opt
{
- token = Lrama::Lexer::Token::InstantiateRule.new(s_value: val[1].s_value, location: @lexer.location, args: val[3])
+ token = Lrama::Lexer::Token::InstantiateRule.new(s_value: val[1].s_value, location: @lexer.location, args: val[3], lhs_tag: val[5])
builder = val[0]
builder.add_rhs(token)
- builder.lhs_tag = val[5]
builder.line = val[1].first_line
result = builder
}
| rhs "{"
{
@@ -457,9 +455,11 @@
| "+"
| "*"
parameterizing_args: symbol { result = [val[0]] }
| parameterizing_args ',' symbol { result = val[0].append(val[2]) }
+ | symbol parameterizing_suffix { result = [Lrama::Lexer::Token::InstantiateRule.new(s_value: val[1].s_value, location: @lexer.location, args: val[0])] }
+ | IDENTIFIER "(" parameterizing_args ")" { result = [Lrama::Lexer::Token::InstantiateRule.new(s_value: val[0].s_value, location: @lexer.location, args: val[2])] }
named_ref_opt: # empty
| '[' IDENTIFIER ']' { result = val[1].s_value }
id_colon: IDENT_COLON