parser.y in lrama-0.6.1 vs parser.y in lrama-0.6.2
- old
+ new
@@ -67,10 +67,11 @@
}
"}"
{
@grammar.initial_action = Grammar::Code::InitialActionCode.new(type: :initial_action, token_code: val[3])
}
+ | "%no-stdlib" { @grammar.no_stdlib = true }
| ";"
grammar_declaration: "%union" "{"
{
begin_c_declaration("}")
@@ -449,13 +450,13 @@
builder = val[0]
builder.precedence_sym = sym
result = builder
}
- parameterizing_suffix: "?"
- | "+"
- | "*"
+ parameterizing_suffix: "?" { result = "option" }
+ | "+" { result = "nonempty_list" }
+ | "*" { result = "list" }
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])] }
@@ -512,11 +513,9 @@
@lexer = Lrama::Lexer.new(@grammar_file)
@grammar = Lrama::Grammar.new(@rule_counter)
@precedence_number = 0
reset_precs
do_parse
- @grammar.prepare
- @grammar.validate!
@grammar
end
end
def next_token