mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Treat commas in scripts as whitespace
This commit is contained in:
parent
9a00984561
commit
bee94e2afc
12 changed files with 36 additions and 101 deletions
|
@ -13,7 +13,7 @@
|
|||
namespace Compiler
|
||||
{
|
||||
StringParser::StringParser (ErrorHandler& errorHandler, const Context& context, Literals& literals)
|
||||
: Parser (errorHandler, context), mLiterals (literals), mState (StartState), mSmashCase (false), mDiscard (false)
|
||||
: Parser (errorHandler, context), mLiterals (literals), mSmashCase (false), mDiscard (false)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -21,23 +21,18 @@ namespace Compiler
|
|||
bool StringParser::parseName (const std::string& name, const TokenLoc& loc,
|
||||
Scanner& scanner)
|
||||
{
|
||||
if (mState==StartState || mState==CommaState)
|
||||
start();
|
||||
mTokenLoc = loc;
|
||||
|
||||
if (!mDiscard)
|
||||
{
|
||||
start();
|
||||
mTokenLoc = loc;
|
||||
|
||||
if (!mDiscard)
|
||||
{
|
||||
if (mSmashCase)
|
||||
Generator::pushString (mCode, mLiterals, Misc::StringUtils::lowerCase (name));
|
||||
else
|
||||
Generator::pushString (mCode, mLiterals, name);
|
||||
}
|
||||
|
||||
return false;
|
||||
if (mSmashCase)
|
||||
Generator::pushString (mCode, mLiterals, Misc::StringUtils::lowerCase (name));
|
||||
else
|
||||
Generator::pushString (mCode, mLiterals, name);
|
||||
}
|
||||
|
||||
return Parser::parseName (name, loc, scanner);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StringParser::parseKeyword (int keyword, const TokenLoc& loc, Scanner& scanner)
|
||||
|
@ -75,17 +70,6 @@ namespace Compiler
|
|||
return Parser::parseKeyword (keyword, loc, scanner);
|
||||
}
|
||||
|
||||
bool StringParser::parseSpecial (int code, const TokenLoc& loc, Scanner& scanner)
|
||||
{
|
||||
if (code==Scanner::S_comma && mState==StartState)
|
||||
{
|
||||
mState = CommaState;
|
||||
return true;
|
||||
}
|
||||
|
||||
return Parser::parseSpecial (code, loc, scanner);
|
||||
}
|
||||
|
||||
bool StringParser::parseInt (int value, const TokenLoc& loc, Scanner& scanner)
|
||||
{
|
||||
reportWarning("Treating integer argument as a string", loc);
|
||||
|
@ -99,7 +83,6 @@ namespace Compiler
|
|||
|
||||
void StringParser::reset()
|
||||
{
|
||||
mState = StartState;
|
||||
mCode.clear();
|
||||
mSmashCase = false;
|
||||
mTokenLoc = TokenLoc();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue