Parse integer format arguments as variable names

pull/3198/head
Evil Eye 3 years ago
parent 31aa19574b
commit fef902617a

@ -58,6 +58,7 @@
Bug #6323: Wyrmhaven: Alboin doesn't follower the player character out of his house
Bug #6326: Detect Enchantment/Key should detect items in unresolved containers
Bug #6347: PlaceItem/PlaceItemCell/PlaceAt should work with levelled creatures
Bug #6363: Some scripts in Morrowland fail to work
Feature #890: OpenMW-CS: Column filtering
Feature #2554: Modifying an object triggers the instances table to scroll to the corresponding record
Feature #2780: A way to see current OpenMW version in the console

@ -632,7 +632,7 @@ namespace Compiler
}
int ExprParser::parseArguments (const std::string& arguments, Scanner& scanner,
std::vector<Interpreter::Type_Code>& code, int ignoreKeyword)
std::vector<Interpreter::Type_Code>& code, int ignoreKeyword, bool expectNames)
{
bool optional = false;
int optionalCount = 0;
@ -717,6 +717,8 @@ namespace Compiler
if (optional)
parser.setOptional (true);
if(expectNames)
scanner.enableExpectName();
scanner.scan (parser);

@ -96,7 +96,7 @@ namespace Compiler
/// \return Type ('l': integer, 'f': float)
int parseArguments (const std::string& arguments, Scanner& scanner,
std::vector<Interpreter::Type_Code>& code, int ignoreKeyword = -1);
std::vector<Interpreter::Type_Code>& code, int ignoreKeyword = -1, bool expectNames = false);
///< Parse sequence of arguments specified by \a arguments.
/// \param arguments Uses ScriptArgs typedef
/// \see Compiler::ScriptArgs

@ -145,7 +145,7 @@ namespace Compiler
if (!arguments.empty())
{
mExprParser.reset();
mExprParser.parseArguments (arguments, scanner, mCode);
mExprParser.parseArguments (arguments, scanner, mCode, -1, true);
}
mName = name;

@ -130,7 +130,8 @@ namespace Compiler
{
bool cont = false;
if (scanInt (c, parser, cont))
bool scanned = mExpectName ? scanName(c, parser, cont) : scanInt(c, parser, cont);
if (scanned)
{
mLoc.mLiteral.clear();
return cont;
@ -387,6 +388,8 @@ namespace Compiler
bool Scanner::scanSpecial (MultiChar& c, Parser& parser, bool& cont)
{
bool expectName = mExpectName;
mExpectName = false;
int special = -1;
if (c=='\n')
@ -541,15 +544,16 @@ namespace Compiler
if (special==S_newline)
mLoc.mLiteral = "<newline>";
else if (mExpectName && (special == S_member || special == S_minus))
else if (expectName && (special == S_member || special == S_minus))
{
mExpectName = false;
bool tolerant = mTolerantNames;
mTolerantNames = true;
bool out = scanName(c, parser, cont);
mTolerantNames = tolerant;
return out;
}
else if (expectName && special == S_comma)
mExpectName = true;
TokenLoc loc (mLoc);
mLoc.mLiteral.clear();

Loading…
Cancel
Save