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 Sep 14, 2023
1 parent 08fa2b5 commit 56a16e2
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 @@ -482,8 +482,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 56a16e2

Please sign in to comment.