From d57654ce46fe1ef66a50c4333c1d1249b59d3cc6 Mon Sep 17 00:00:00 2001 From: Krzysztof Rybka Date: Thu, 14 Sep 2023 21:14:08 +0100 Subject: [PATCH] Iterate over symbols to get the number to avoid array creation --- lib/lrama/grammar.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/lrama/grammar.rb b/lib/lrama/grammar.rb index 6b53d5b3..81fa3ffc 100644 --- a/lib/lrama/grammar.rb +++ b/lib/lrama/grammar.rb @@ -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|