Skip to content

Commit

Permalink
Iterate over symbols to get the number to avoid array creation
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysiek1507 committed Oct 7, 2023
1 parent 4df9bc8 commit d57654c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/lrama/grammar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,8 @@ def fill_symbol_number
nterm_token_id = 0
used_numbers = {}

@symbols.map(&:number).each do |n|
used_numbers[n] = true
@symbols.each do |symbol|
used_numbers[symbol.number] = true
end

(@symbols.select(&:term?) + @symbols.select(&:nterm?)).each do |sym|
Expand Down

0 comments on commit d57654c

Please sign in to comment.