summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2013-06-27 10:51:19 -0400
committerJasper St. Pierre <jstpierre@mecheye.net>2013-06-27 10:51:19 -0400
commit11fdd5a4ec25984c5c484cf1dd29fdec004028b3 (patch)
tree1c6c46e659e7b655cd98cc6ad309f6d18c88c0ca /Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp
parent72257d5f699d7d234c035547c02c5d9781bb2e11 (diff)
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.
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp')
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp11
1 files changed, 1 insertions, 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);
}
}