diff --git a/spec/compiler/build_tables/symbols_by_first_symbol_spec.cc b/spec/compiler/build_tables/symbols_by_first_symbol_spec.cc index 19508063..b0059212 100644 --- a/spec/compiler/build_tables/symbols_by_first_symbol_spec.cc +++ b/spec/compiler/build_tables/symbols_by_first_symbol_spec.cc @@ -61,6 +61,11 @@ describe("symbols_by_first_symbol", [&]() { Symbol(2), } }, + { + Symbol(12, true), { + Symbol(12, true), + } + }, { Symbol(13, true), { Symbol(13, true), @@ -69,6 +74,11 @@ describe("symbols_by_first_symbol", [&]() { Symbol(2), } }, + { + Symbol(14, true), { + Symbol(14, true), + } + }, { Symbol(15, true), { Symbol(15, true), diff --git a/src/compiler/build_tables/symbols_by_first_symbol.cc b/src/compiler/build_tables/symbols_by_first_symbol.cc index f1da78b4..3c2a7c56 100644 --- a/src/compiler/build_tables/symbols_by_first_symbol.cc +++ b/src/compiler/build_tables/symbols_by_first_symbol.cc @@ -21,7 +21,10 @@ map> symbols_by_first_symbol(const SyntaxGrammar &grammar) { if (!production.empty()) { Symbol first_symbol = production[0].symbol; result[first_symbol].insert(symbol); - result[first_symbol].insert(first_symbol); + + for (const ProductionStep &step : production) { + result[step.symbol].insert(step.symbol); + } } }