summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2013-06-14 02:52:07 -0400
committerJasper St. Pierre <jstpierre@mecheye.net>2013-06-25 00:58:30 -0400
commitd2753cce6617ea053c233289ec4213419913ed6b (patch)
treeb29583e610cc77b2be2f8b7a2920263d95d33f7e /Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp
parent6246f6e81581339eb176cae044960e1f8437b488 (diff)
ExpressionParser: Add support for the add operator
Use "+" instead of "^" this time.
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp')
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp b/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp
index 81ceab5913..2cd7a59bf2 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp
+++ b/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp
@@ -24,6 +24,7 @@ enum TokenType
TOK_AND,
TOK_OR,
TOK_NOT,
+ TOK_ADD,
TOK_CONTROL,
};
@@ -37,6 +38,8 @@ inline std::string OpName(TokenType op)
return "Or";
case TOK_NOT:
return "Not";
+ case TOK_ADD:
+ return "Add";
default:
assert(false);
return "";
@@ -72,6 +75,8 @@ public:
return "|";
case TOK_NOT:
return "!";
+ case TOK_ADD:
+ return "+";
case TOK_CONTROL:
return "Device(" + (std::string)qualifier + ")";
}
@@ -144,6 +149,8 @@ public:
return Token(TOK_OR);
case '!':
return Token(TOK_NOT);
+ case '+':
+ return Token(TOK_ADD);
case '`':
return GetControlQualifier();
default:
@@ -232,6 +239,8 @@ public:
return std::min(lhsValue, rhsValue);
case TOK_OR:
return std::max(lhsValue, rhsValue);
+ case TOK_ADD:
+ return std::min(lhsValue + rhsValue, 1.0f);
default:
assert(false);
return 0;
@@ -412,6 +421,7 @@ private:
{
case TOK_AND:
case TOK_OR:
+ case TOK_ADD:
return true;
default:
return false;