From 11fdd5a4ec25984c5c484cf1dd29fdec004028b3 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 27 Jun 2013 10:51:19 -0400 Subject: [PATCH] ExpressionParser: Search for control names first Otherwise, valid control names like "Cursor X+" would be incorrectly tokenized as "`Cursor` `X` +", causing the parser to first abort trying to find a control named `Cursor` rather than aborting with invalid syntax on the bad binop. We could also do this by resolving devices lazily, but since simple control name bindings are going to be 90% of usecases, just look for these first. --- .../Src/ControllerInterface/ExpressionParser.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp b/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp index 0e9ebda1c1..c68df48e25 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp @@ -573,15 +573,6 @@ ExpressionParseStatus ParseExpressionInner(std::string str, ControlFinder &finde ExpressionParseStatus ParseExpression(std::string str, ControlFinder &finder, Expression **expr_out) { - ExpressionParseStatus status; - - status = ParseExpressionInner(str, finder, expr_out); - if (status == EXPRESSION_PARSE_SUCCESS) - return status; - - if (status != EXPRESSION_PARSE_SYNTAX_ERROR) - return status; - // Add compatibility with old simple expressions, which are simple // barewords control names. @@ -595,7 +586,7 @@ ExpressionParseStatus ParseExpression(std::string str, ControlFinder &finder, Ex return EXPRESSION_PARSE_SUCCESS; } - return EXPRESSION_PARSE_SYNTAX_ERROR; + return ParseExpressionInner(str, finder, expr_out); } }