mirror of
https://github.com/OpenMW/openmw.git
synced 2026-05-06 07:56:40 -04:00
Fix parser confusion after button-less formatted messages (#8990)
Re-reset expect name and tolerant name settings in this situation: - the newline was read - the newline was handled by a parser that decided to put it back - the parent parser re-enabled them, expecting a newline character to reset them - the newline is about to be handled by that parser This is to prevent the messagebox hacks from wrecking the next line's parsing
This commit is contained in:
@@ -518,6 +518,16 @@ MessageBox "use strings that start with numbers, - and ." 1 -2 3.14pi .todd "A"
|
||||
MessageBox "use keywords" messagebox set "messagebox2" "set2"
|
||||
MessageBox "don't use more than 10 buttons" "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11"
|
||||
|
||||
End)mwscript";
|
||||
|
||||
const std::string sIssue8990 = R"mwscript(Begin issue8990
|
||||
|
||||
short a
|
||||
|
||||
set a to 1
|
||||
MessageBox "%g" a
|
||||
player->setacrobatics 5000
|
||||
|
||||
End)mwscript";
|
||||
|
||||
TEST_F(MWScriptTest, mwscript_test_invalid)
|
||||
@@ -1037,4 +1047,10 @@ End)mwscript";
|
||||
FAIL();
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(MWScriptTest, mwscript_test_8990)
|
||||
{
|
||||
registerExtensions();
|
||||
EXPECT_FALSE(!compile(sIssue8990));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +77,12 @@ namespace Compiler
|
||||
mTolerantNames = tolerant;
|
||||
return cont;
|
||||
}
|
||||
// These are reset when the newline is read, but they could have been re-enabled
|
||||
if (mPutbackCode == S_newline)
|
||||
{
|
||||
mTolerantNames = false;
|
||||
mExpectName = false;
|
||||
}
|
||||
return parser.parseSpecial(mPutbackCode, mPutbackLoc, *this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user