diff --git a/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp b/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp index 30a261d13d..b76c170a2f 100644 --- a/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp +++ b/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp @@ -830,6 +830,12 @@ private: // Interpret it as a unary minus function. return ParseFunctionArguments("minus", MakeFunctionExpression("minus"), tok); } + case TOK_ADD: + { + // An atom was expected but we got an addition symbol. + // Interpret it as a unary plus. + return ParseFunctionArguments("plus", MakeFunctionExpression("plus"), tok); + } default: { return ParseResult::MakeErrorResult(tok, _trans("Expected start of expression.")); diff --git a/Source/Core/InputCommon/ControlReference/FunctionExpression.cpp b/Source/Core/InputCommon/ControlReference/FunctionExpression.cpp index 46cfc37beb..15d8c72c0c 100644 --- a/Source/Core/InputCommon/ControlReference/FunctionExpression.cpp +++ b/Source/Core/InputCommon/ControlReference/FunctionExpression.cpp @@ -375,6 +375,22 @@ private: } }; +// usage: plus(expression) +class UnaryPlusExpression : public FunctionExpression +{ +private: + ArgumentValidation + ValidateArguments(const std::vector>& args) override + { + if (args.size() == 1) + return ArgumentsAreValid{}; + else + return ExpectedArguments{"expression"}; + } + + ControlState GetValue() const override { return GetArg(0).GetValue(); } +}; + // usage: deadzone(input, amount) class DeadzoneExpression : public FunctionExpression { @@ -689,6 +705,8 @@ std::unique_ptr MakeFunctionExpression(std::string_view name return std::make_unique(); if (name == "minus") return std::make_unique(); + if (name == "plus") + return std::make_unique(); if (name == "deadzone") return std::make_unique(); if (name == "smooth")