From f55d11070bc7ec325d34e01887d3918f1576a5e0 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Tue, 15 Jul 2014 08:10:37 -0400 Subject: [PATCH] Always consume a "peeked" token before raising the syntax error. --- OvaleAST.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 1.7.9.5