Always consume a "peeked" token before raising the syntax error.
Johnny C. Lam [07-15-14 - 12:10]
Always consume a "peeked" token before raising the syntax error.
diff --git a/OvaleAST.lua b/OvaleAST.lua
index 10e341d..4d9f0e4 100644
--- a/OvaleAST.lua
+++ b/OvaleAST.lua
@@ -1753,8 +1753,8 @@ ParseSimpleExpression = function(tokenStream, nodeList, annotation)
elseif tokenType == "(" or tokenType == "{" then
ok, node = ParseParentheses(tokenStream, nodeList, annotation)
else
- SyntaxError(tokenStream, "Syntax error: unexpected token '%s' when parsing SIMPLE EXPRESSION", token)
tokenStream:Consume()
+ SyntaxError(tokenStream, "Syntax error: unexpected token '%s' when parsing SIMPLE EXPRESSION", token)
ok = false
end
return ok, node
@@ -1950,8 +1950,8 @@ ParseString = function(tokenStream, nodeList, annotation)
tokenStream:Consume()
end
else
- SyntaxError(tokenStream, "Syntax error: unexpected token '%s' when parsing STRING; string, variable, or function expected.", token)
tokenStream:Consume()
+ SyntaxError(tokenStream, "Syntax error: unexpected token '%s' when parsing STRING; string, variable, or function expected.", token)
ok = false
end
end