Skip to content

Commit

Permalink
Add compute_ielr
Browse files Browse the repository at this point in the history
  • Loading branch information
junk0612 committed Apr 23, 2024
1 parent bf22558 commit e4a27f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/lrama/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def run(argv)
end
states = Lrama::States.new(grammar, warning, trace_state: (options.trace_opts[:automaton] || options.trace_opts[:closure]))
states.compute
states.compute_ielr if grammar.ielr_defined?
context = Lrama::Context.new(states)

if options.report_file
Expand Down
4 changes: 4 additions & 0 deletions lib/lrama/grammar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ def find_rules_by_symbol(sym)
@sym_to_rules[sym.number]
end

def ielr_defined?
@define.key?('lr.type') && @define['lr.type'] == 'ielr'
end

private

def compute_nullable
Expand Down

0 comments on commit e4a27f0

Please sign in to comment.