|
|
|
@ -306,10 +306,22 @@ namespace Compiler
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
|
|
std::string lowerCase = Misc::StringUtils::lowerCase(name);
|
|
|
|
|
|
|
|
|
|
bool isKeyword = false;
|
|
|
|
|
for (; sKeywords[i]; ++i)
|
|
|
|
|
if (lowerCase==sKeywords[i])
|
|
|
|
|
{
|
|
|
|
|
isKeyword = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Russian localization and some mods use a quirk - add newline character directly
|
|
|
|
|
// to compiled bytecode via HEX-editor to implement multiline messageboxes.
|
|
|
|
|
// Of course, original editor will not compile such script.
|
|
|
|
|
// Allow messageboxes to bybass the "incomplete string or name" error.
|
|
|
|
|
if (lowerCase == "messagebox")
|
|
|
|
|
enableIgnoreNewlines();
|
|
|
|
|
else if (isKeyword)
|
|
|
|
|
mIgnoreNewline = false;
|
|
|
|
|
|
|
|
|
|
if (sKeywords[i])
|
|
|
|
|
{
|
|
|
|
@ -356,12 +368,17 @@ namespace Compiler
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
else if (c=='\n')
|
|
|
|
|
{
|
|
|
|
|
if (mIgnoreNewline)
|
|
|
|
|
mErrorHandler.warning ("string contains newline character, make sure that it is intended", mLoc);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
error = true;
|
|
|
|
|
mErrorHandler.error ("incomplete string or name", mLoc);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (!(c=='"' && name.empty()))
|
|
|
|
|
{
|
|
|
|
|
if (!isStringCharacter (c) && !(mTolerantNames && (c=='.' || c=='-')))
|
|
|
|
@ -578,7 +595,7 @@ namespace Compiler
|
|
|
|
|
const Extensions *extensions)
|
|
|
|
|
: mErrorHandler (errorHandler), mStream (inputStream), mExtensions (extensions),
|
|
|
|
|
mPutback (Putback_None), mPutbackCode(0), mPutbackInteger(0), mPutbackFloat(0),
|
|
|
|
|
mStrictKeywords (false), mTolerantNames (false)
|
|
|
|
|
mStrictKeywords (false), mTolerantNames (false), mIgnoreNewline(false)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -631,6 +648,11 @@ namespace Compiler
|
|
|
|
|
mExtensions->listKeywords (keywords);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scanner::enableIgnoreNewlines()
|
|
|
|
|
{
|
|
|
|
|
mIgnoreNewline = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scanner::enableStrictKeywords()
|
|
|
|
|
{
|
|
|
|
|
mStrictKeywords = true;
|
|
|
|
|