Skip to content

Commit

Permalink
double bug in script name handling workaround (Fixes OpenMW#1730)
Browse files Browse the repository at this point in the history
  • Loading branch information
zinnschlag committed Jan 3, 2015
1 parent 9f6a2d0 commit bbbf431
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions components/compiler/fileparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ namespace Compiler
scanner.scan (mScriptParser);

mState = EndNameState;
scanner.allowNameStartingwithDigit();
return true;
}

Expand Down
6 changes: 6 additions & 0 deletions components/compiler/quickfileparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
if (keyword==Scanner::K_begin)
{
scanner.allowNameStartingwithDigit();
return true;
}

if (keyword==Scanner::K_end)
return false;

Expand Down
8 changes: 1 addition & 7 deletions components/compiler/scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,10 @@ namespace Compiler

bool Scanner::scanName (char c, std::string& name)
{
bool first = true;
bool error = false;

name.clear();

putback (c);
name += c;

while (get (c))
{
Expand Down Expand Up @@ -352,13 +350,9 @@ namespace Compiler
putback (c);
break;
}

if (first && (std::isdigit (c) || c=='`' || c=='-'))
error = true;
}

name += c;
first = false;
}

return !error;
Expand Down

0 comments on commit bbbf431

Please sign in to comment.