Don't skip tokens that are not the start of any non-terminal
This commit is contained in:
parent
b4f2407a49
commit
8c01b70ce7
2 changed files with 14 additions and 1 deletions
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -21,7 +21,10 @@ map<Symbol, set<Symbol>> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue