Fix error recovery

This commit is contained in:
Robin Jadoul 2017-01-28 15:52:57 +01:00
parent 541f3c0c19
commit 95db330460
1 changed files with 2 additions and 2 deletions

View File

@ -163,11 +163,11 @@ Value {{name}}<Value>::parse() {
Token report = Token{tok.symbol, std::move(tok.value)};
Value errorVal = error(std::move(report), expected);
while (!valueStack.empty() && (TABLE[stateStack.top()][verr] & 0x3) == ERROR) {
while (!valueStack.empty() && !TABLE[stateStack.top()][verr]) {
valueStack.pop();
stateStack.pop();
}
if ((TABLE[stateStack.top()][verr] & 0x3) == ERROR) {
if (!TABLE[stateStack.top()][verr]) {
throw SyntaxError("Syntax error: could not recover");
}