mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
ParseStatus: replace NoDevice with EmptyExpression
This commit is contained in:
parent
754efd75c5
commit
85301e2bae
@ -347,11 +347,12 @@ void ControlDialog::UpdateGUI()
|
||||
case ParseStatus::SyntaxError:
|
||||
m_error_label->SetLabel(_("Syntax error"));
|
||||
break;
|
||||
case ParseStatus::NoDevice:
|
||||
m_error_label->SetLabel(_("Device not found"));
|
||||
case ParseStatus::Successful:
|
||||
m_error_label->SetLabel(control_reference->BoundCount() > 0 ? "" : _("Device not found"));
|
||||
break;
|
||||
default:
|
||||
case ParseStatus::EmptyExpression:
|
||||
m_error_label->SetLabel("");
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
@ -408,7 +409,7 @@ bool ControlDialog::Validate()
|
||||
UpdateGUI();
|
||||
|
||||
const auto parse_status = control_reference->GetParseStatus();
|
||||
return parse_status == ParseStatus::Successful || parse_status == ParseStatus::NoDevice;
|
||||
return parse_status == ParseStatus::Successful || parse_status == ParseStatus::EmptyExpression;
|
||||
}
|
||||
|
||||
void InputConfigDialog::SetDevice(wxCommandEvent&)
|
||||
|
@ -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;
|
||||
|
@ -63,7 +63,7 @@ enum class ParseStatus
|
||||
{
|
||||
Successful,
|
||||
SyntaxError,
|
||||
NoDevice,
|
||||
EmptyExpression,
|
||||
};
|
||||
|
||||
std::pair<ParseStatus, std::unique_ptr<Expression>> ParseExpression(const std::string& expr,
|
||||
|
Loading…
x
Reference in New Issue
Block a user