From 56a16e2fbc8ad77ed29f83b100e256f5828137a7 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 81df3996..a915c32f 100644 --- a/lib/lrama/grammar.rb +++ b/lib/lrama/grammar.rb @@ -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|