diff options
| author | Michael M <mchtly@gmail.com> | 2017-06-07 16:03:36 -0700 |
|---|---|---|
| committer | Michael M <mchtly@gmail.com> | 2017-09-14 12:53:35 -0700 |
| commit | 85301e2baeda9a97c4c5ebbf07807566831e22d1 (patch) | |
| tree | 52613f7f1a00d110e3c5f9194a5b71715cc8ccbe /Source/Core/InputCommon/ControlReference | |
| parent | 754efd75c5f8b843e25f2ff8510bfc2a25fd1de1 (diff) | |
ParseStatus: replace NoDevice with EmptyExpression
Diffstat (limited to 'Source/Core/InputCommon/ControlReference')
| -rw-r--r-- | Source/Core/InputCommon/ControlReference/ExpressionParser.cpp | 8 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControlReference/ExpressionParser.h | 2 |
2 files changed, 4 insertions, 6 deletions
diff --git a/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp b/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp index 4bd4901cdd..d2cef8c917 100644 --- a/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp +++ b/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp @@ -10,6 +10,7 @@ #include <string> #include <vector> +#include "Common/StringUtil.h" #include "InputCommon/ControlReference/ExpressionParser.h" using namespace ciface::Core; @@ -393,9 +394,6 @@ private: { std::shared_ptr<Device> device = finder.FindDevice(tok.qualifier); Device::Control* control = finder.FindControl(tok.qualifier); - if (control == nullptr) - return {ParseStatus::NoDevice, std::make_unique<ControlExpression>(tok.qualifier, control)}; - return {ParseStatus::Successful, std::make_unique<ControlExpression>(tok.qualifier, std::move(device), control)}; } @@ -510,8 +508,8 @@ Expression::~Expression() static std::pair<ParseStatus, std::unique_ptr<Expression>> ParseExpressionInner(const std::string& str, ControlFinder& finder) { - if (str == "") - return std::make_pair(ParseStatus::Successful, nullptr); + if (StripSpaces(str).empty()) + return std::make_pair(ParseStatus::EmptyExpression, nullptr); Lexer l(str); std::vector<Token> tokens; diff --git a/Source/Core/InputCommon/ControlReference/ExpressionParser.h b/Source/Core/InputCommon/ControlReference/ExpressionParser.h index d05ac6f546..55bf86b951 100644 --- a/Source/Core/InputCommon/ControlReference/ExpressionParser.h +++ b/Source/Core/InputCommon/ControlReference/ExpressionParser.h @@ -63,7 +63,7 @@ enum class ParseStatus { Successful, SyntaxError, - NoDevice, + EmptyExpression, }; std::pair<ParseStatus, std::unique_ptr<Expression>> ParseExpression(const std::string& expr, |
