double bug in script name handling workaround (Fixes #1730)

moveref
Marc Zinnschlag 10 years ago
parent 9f6a2d00e8
commit bbbf431ae3

@ -112,6 +112,7 @@ namespace Compiler
scanner.scan (mScriptParser); scanner.scan (mScriptParser);
mState = EndNameState; mState = EndNameState;
scanner.allowNameStartingwithDigit();
return true; return true;
} }

@ -19,6 +19,12 @@ bool Compiler::QuickFileParser::parseName (const std::string& name, const TokenL
bool Compiler::QuickFileParser::parseKeyword (int keyword, const TokenLoc& loc, Scanner& scanner) bool Compiler::QuickFileParser::parseKeyword (int keyword, const TokenLoc& loc, Scanner& scanner)
{ {
if (keyword==Scanner::K_begin)
{
scanner.allowNameStartingwithDigit();
return true;
}
if (keyword==Scanner::K_end) if (keyword==Scanner::K_end)
return false; return false;

@ -314,12 +314,10 @@ namespace Compiler
bool Scanner::scanName (char c, std::string& name) bool Scanner::scanName (char c, std::string& name)
{ {
bool first = true;
bool error = false; bool error = false;
name.clear(); name.clear();
name += c;
putback (c);
while (get (c)) while (get (c))
{ {
@ -352,13 +350,9 @@ namespace Compiler
putback (c); putback (c);
break; break;
} }
if (first && (std::isdigit (c) || c=='`' || c=='-'))
error = true;
} }
name += c; name += c;
first = false;
} }
return !error; return !error;

Loading…
Cancel
Save