Look for non existing terminals in precedence rules

This commit is contained in:
kwullaer 2017-01-29 02:28:03 +01:00
parent bb528821ad
commit aecc191937
1 changed files with 7 additions and 0 deletions

View File

@ -72,6 +72,13 @@ namespace pds {
else rule->precedence = {false,{0, PrecedenceType::RIGHT}};
}
// Check if all terminals in precedence rules, are terminals
for(auto& prec : cnf.grammar.precedence)
if (cnf.grammar.terminals.find(prec.first) == cnf.grammar.terminals.end())
throw InputParserException("Found \"" + prec.first + "\" in precedence, which is no terminal.");
return cnf;
}
}