mirror of
https://github.com/OpenMW/openmw.git
synced 2025-07-07 02:11:35 +00:00
Allow integer variable names
This commit is contained in:
parent
f70a154195
commit
dfb6bdf77e
3 changed files with 19 additions and 0 deletions
|
@ -90,6 +90,16 @@ bool Compiler::DeclarationParser::parseSpecial (int code, const TokenLoc& loc, S
|
||||||
return Parser::parseSpecial (code, loc, scanner);
|
return Parser::parseSpecial (code, loc, scanner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Compiler::DeclarationParser::parseInt(int value, const TokenLoc& loc, Scanner& scanner)
|
||||||
|
{
|
||||||
|
if(mState == State_Name)
|
||||||
|
{
|
||||||
|
// Allow integers to be used as variable names
|
||||||
|
return parseName(loc.mLiteral, loc, scanner);
|
||||||
|
}
|
||||||
|
return Parser::parseInt(value, loc, scanner);
|
||||||
|
}
|
||||||
|
|
||||||
void Compiler::DeclarationParser::reset()
|
void Compiler::DeclarationParser::reset()
|
||||||
{
|
{
|
||||||
mState = State_Begin;
|
mState = State_Begin;
|
||||||
|
|
|
@ -35,6 +35,10 @@ namespace Compiler
|
||||||
///< Handle a special character token.
|
///< Handle a special character token.
|
||||||
/// \return fetch another token?
|
/// \return fetch another token?
|
||||||
|
|
||||||
|
bool parseInt (int value, const TokenLoc& loc, Scanner& scanner) override;
|
||||||
|
///< Handle an int token.
|
||||||
|
/// \return fetch another token?
|
||||||
|
|
||||||
void reset() override;
|
void reset() override;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -67,6 +67,11 @@ namespace Compiler
|
||||||
parseExpression (scanner, loc);
|
parseExpression (scanner, loc);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (mState == SetState)
|
||||||
|
{
|
||||||
|
// Allow ints to be used as variable names
|
||||||
|
return parseName(loc.mLiteral, loc, scanner);
|
||||||
|
}
|
||||||
|
|
||||||
return Parser::parseInt (value, loc, scanner);
|
return Parser::parseInt (value, loc, scanner);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue