Cleaner collection of expected terminals
This commit is contained in:
parent
98c83e435b
commit
c9da57dec2
|
@ -154,11 +154,11 @@ Value {{name}}<Value>::parse() {
|
|||
{
|
||||
constexpr std::uint64_t verr = static_cast<std::uint64_t>({{name}}_Symbol::V_error);
|
||||
std::vector<{{name}}_Symbol> expected;
|
||||
{{#symbols}}
|
||||
if ({{name}}_Symbol::{{symbol}} <= {{name}}_Symbol::{{last_terminal}} && (TABLE[stateStack.top()][static_cast<std::uint64_t>({{name}}_Symbol::{{symbol}})] & 0x3) != ERROR) {
|
||||
expected.emplace_back({{name}}_Symbol::{{symbol}});
|
||||
std::uint64_t top = stateStack.top();
|
||||
for (std::uint64_t i = 0; i <= static_cast<std::uint64_t>({{name}}_Symbol::{{last_terminal}}); i++) {
|
||||
if ((TABLE[top][i] & 0x3) != ERROR)
|
||||
expected.emplace_back(static_cast<{{name}}_Symbol>(i));
|
||||
}
|
||||
{{/symbols}}
|
||||
Value errorVal = error(tok, expected);
|
||||
|
||||
while (!valueStack.empty() && (TABLE[stateStack.top()][verr] & 0x3) == ERROR) {
|
||||
|
|
Loading…
Reference in New Issue