forked from mirror/openmw-tes3mp
fixed parsing explicit references in the body of control structures
This commit is contained in:
parent
147dd57162
commit
044bf0ab48
3 changed files with 35 additions and 17 deletions
|
@ -172,6 +172,20 @@ namespace Compiler
|
|||
std::copy (mCode.begin(), mCode.end(), std::back_inserter (code));
|
||||
}
|
||||
|
||||
bool ControlParser::parseName (const std::string& name, const TokenLoc& loc, Scanner& scanner)
|
||||
{
|
||||
if (mState==IfBodyState || mState==IfElseifBodyState || mState==IfElseBodyState ||
|
||||
mState==WhileBodyState)
|
||||
{
|
||||
scanner.putbackName (name, loc);
|
||||
mLineParser.reset();
|
||||
scanner.scan (mLineParser);
|
||||
return true;
|
||||
}
|
||||
|
||||
return Parser::parseName (name, loc, scanner);
|
||||
}
|
||||
|
||||
bool ControlParser::parseKeyword (int keyword, const TokenLoc& loc, Scanner& scanner)
|
||||
{
|
||||
if (mState==StartState)
|
||||
|
|
|
@ -53,6 +53,11 @@ namespace Compiler
|
|||
void appendCode (std::vector<Interpreter::Type_Code>& code) const;
|
||||
///< store generated code in \æ code.
|
||||
|
||||
virtual bool parseName (const std::string& name, const TokenLoc& loc,
|
||||
Scanner& scanner);
|
||||
///< Handle a name token.
|
||||
/// \return fetch another token?
|
||||
|
||||
virtual bool parseKeyword (int keyword, const TokenLoc& loc, Scanner& scanner);
|
||||
///< Handle a keyword token.
|
||||
/// \return fetch another token?
|
||||
|
@ -67,4 +72,3 @@ namespace Compiler
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -183,6 +183,13 @@ namespace Compiler
|
|||
return true;
|
||||
}
|
||||
|
||||
if (mState==BeginState && getContext().isId (name))
|
||||
{
|
||||
mState = PotentialExplicitState;
|
||||
mExplicit = toLower (name);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mState==BeginState && mAllowExpression)
|
||||
{
|
||||
std::string name2 = toLower (name);
|
||||
|
@ -206,13 +213,6 @@ namespace Compiler
|
|||
}
|
||||
}
|
||||
|
||||
if (mState==BeginState && getContext().isId (name))
|
||||
{
|
||||
mState = PotentialExplicitState;
|
||||
mExplicit = toLower (name);
|
||||
return true;
|
||||
}
|
||||
|
||||
return Parser::parseName (name, loc, scanner);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue