Allow integer variable names

This commit is contained in:
Evil Eye 2021-10-13 22:44:18 +02:00
parent f70a154195
commit dfb6bdf77e
3 changed files with 19 additions and 0 deletions

View file

@ -90,6 +90,16 @@ bool Compiler::DeclarationParser::parseSpecial (int code, const TokenLoc& loc, S
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()
{
mState = State_Begin;