Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iterate over symbols to get the number to avoid array creation #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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