mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
improved handling of extra arguments in StringParser
This commit is contained in:
parent
210c77968a
commit
f9607a47b3
3 changed files with 36 additions and 6 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)
|
||||
: Parser (errorHandler, context), mLiterals (literals), mState (StartState), mSmashCase (false), mDiscard (false)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -24,10 +24,15 @@ namespace Compiler
|
|||
if (mState==StartState || mState==CommaState)
|
||||
{
|
||||
start();
|
||||
if (mSmashCase)
|
||||
Generator::pushString (mCode, mLiterals, Misc::StringUtils::lowerCase (name));
|
||||
else
|
||||
Generator::pushString (mCode, mLiterals, name);
|
||||
mTokenLoc = loc;
|
||||
|
||||
if (!mDiscard)
|
||||
{
|
||||
if (mSmashCase)
|
||||
Generator::pushString (mCode, mLiterals, Misc::StringUtils::lowerCase (name));
|
||||
else
|
||||
Generator::pushString (mCode, mLiterals, name);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -75,6 +80,8 @@ namespace Compiler
|
|||
mState = StartState;
|
||||
mCode.clear();
|
||||
mSmashCase = false;
|
||||
mTokenLoc = TokenLoc();
|
||||
mDiscard = false;
|
||||
Parser::reset();
|
||||
}
|
||||
|
||||
|
@ -82,4 +89,14 @@ namespace Compiler
|
|||
{
|
||||
mSmashCase = true;
|
||||
}
|
||||
|
||||
const TokenLoc& StringParser::getTokenLoc() const
|
||||
{
|
||||
return mTokenLoc;
|
||||
}
|
||||
|
||||
void StringParser::discard()
|
||||
{
|
||||
mDiscard = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue