From e02b66cdf4b0ea50fd50203d153c5c88ef92c319 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Sat, 6 Jun 2020 20:04:09 +0300 Subject: [PATCH] Ignore bogus string arguments for Disable/Enable again --- components/compiler/extensions0.cpp | 4 ++-- components/compiler/lineparser.cpp | 10 +--------- components/compiler/lineparser.hpp | 3 +-- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/components/compiler/extensions0.cpp b/components/compiler/extensions0.cpp index 60b4a7451..3989ef0f4 100644 --- a/components/compiler/extensions0.cpp +++ b/components/compiler/extensions0.cpp @@ -247,8 +247,8 @@ namespace Compiler extensions.registerInstruction ("startscript", "c", opcodeStartScript, opcodeStartScriptExplicit); extensions.registerInstruction ("stopscript", "c", opcodeStopScript); extensions.registerFunction ("getsecondspassed", 'f', "", opcodeGetSecondsPassed); - extensions.registerInstruction ("enable", "", opcodeEnable, opcodeEnableExplicit); - extensions.registerInstruction ("disable", "", opcodeDisable, opcodeDisableExplicit); + extensions.registerInstruction ("enable", "x", opcodeEnable, opcodeEnableExplicit); + extensions.registerInstruction ("disable", "x", opcodeDisable, opcodeDisableExplicit); extensions.registerFunction ("getdisabled", 'l', "x", opcodeGetDisabled, opcodeGetDisabledExplicit); extensions.registerFunction ("xbox", 'l', "", opcodeXBox); extensions.registerFunction ("onactivate", 'l', "", opcodeOnActivate, opcodeOnActivateExplicit); diff --git a/components/compiler/lineparser.cpp b/components/compiler/lineparser.cpp index 326b5f9f6..829ad6f08 100644 --- a/components/compiler/lineparser.cpp +++ b/components/compiler/lineparser.cpp @@ -86,13 +86,6 @@ namespace Compiler bool LineParser::parseName (const std::string& name, const TokenLoc& loc, Scanner& scanner) { - if (mState==PotentialEndState) - { - getErrorHandler().warning ("Stray string argument", loc); - mState = EndState; - return true; - } - if (mState==SetState) { std::string name2 = Misc::StringUtils::lowerCase (name); @@ -445,8 +438,7 @@ namespace Compiler return true; } - if (code==Scanner::S_newline && - (mState==EndState || mState==BeginState || mState==PotentialEndState)) + if (code==Scanner::S_newline && (mState==EndState || mState==BeginState)) return false; if (code==Scanner::S_comma && mState==MessageState) diff --git a/components/compiler/lineparser.hpp b/components/compiler/lineparser.hpp index 8f7f64bf2..cc32b9592 100644 --- a/components/compiler/lineparser.hpp +++ b/components/compiler/lineparser.hpp @@ -25,8 +25,7 @@ namespace Compiler SetState, SetLocalVarState, SetGlobalVarState, SetPotentialMemberVarState, SetMemberVarState, SetMemberVarState2, MessageState, MessageCommaState, MessageButtonState, MessageButtonCommaState, - EndState, PotentialEndState /* may have a stray string argument */, - PotentialExplicitState, ExplicitState, MemberState + EndState, PotentialExplicitState, ExplicitState, MemberState }; Locals& mLocals;