Skip to content
Permalink
Browse files

ExpressionParser: Add less-than and greater-than operators.

  • Loading branch information...
jordan-woyak committed Dec 30, 2018
1 parent 35e51eb commit 718efce1dce86e18fb42c319627b5490cd1f8d94
Showing with 20 additions and 0 deletions.
  1. +20 −0 Source/Core/InputCommon/ControlReference/ExpressionParser.cpp
@@ -36,6 +36,8 @@ enum TokenType
TOK_DIV,
TOK_MOD,
TOK_ASSIGN,
TOK_LTHAN,
TOK_GTHAN,
TOK_CONTROL,
TOK_LITERAL,
TOK_VARIABLE,
@@ -61,6 +63,10 @@ inline std::string OpName(TokenType op)
return "Mod";
case TOK_ASSIGN:
return "Assign";
case TOK_LTHAN:
return "LThan";
case TOK_GTHAN:
return "GThan";
case TOK_VARIABLE:
return "Var";
default:
@@ -105,6 +111,10 @@ class Token
return "%";
case TOK_ASSIGN:
return "=";
case TOK_LTHAN:
return "<";
case TOK_GTHAN:
return ">";
case TOK_CONTROL:
return "Device(" + data + ")";
case TOK_LITERAL:
@@ -226,6 +236,10 @@ class Lexer
return Token(TOK_MOD);
case '=':
return Token(TOK_ASSIGN);
case '<':
return Token(TOK_LTHAN);
case '>':
return Token(TOK_GTHAN);
case '\'':
return GetLiteral();
case '$':
@@ -348,6 +362,10 @@ class BinaryExpression : public Expression
// TODO: Should this instead GetValue(lhs) ?
return rhsValue;
}
case TOK_LTHAN:
return lhsValue < rhsValue;
case TOK_GTHAN:
return lhsValue > rhsValue;
default:
assert(false);
return 0;
@@ -733,6 +751,8 @@ class Parser
case TOK_DIV:
case TOK_MOD:
case TOK_ASSIGN:
case TOK_LTHAN:
case TOK_GTHAN:
return true;
default:
return false;

0 comments on commit 718efce

Please sign in to comment.
You can’t perform that action at this time.