Skip to content

Commit

Permalink
Use symbol parameterizing_suffix? instead of `symbol | symbol param…
Browse files Browse the repository at this point in the history
…eterizing_suffix`
  • Loading branch information
ydah committed Dec 18, 2024
1 parent 77d6bd4 commit c47158c
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 86 deletions.
172 changes: 88 additions & 84 deletions lib/lrama/parser.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,15 @@ rule
| "+" { result = "nonempty_list" }
| "*" { result = "list" }

parameterizing_args: symbol { result = [val[0]] }
parameterizing_args: symbol parameterizing_suffix?
{
result = if val[1]
[Lrama::Lexer::Token::InstantiateRule.new(s_value: val[1].s_value, location: @lexer.location, args: val[0])]
else
[val[0]]
end
}
| 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])] }

midrule_action: "{"
Expand Down

0 comments on commit c47158c

Please sign in to comment.