mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-29 05:17:58 +03:00
implemented enable, disable and getdisabled with explicit references
This commit is contained in:
parent
ce74ee8618
commit
d4ac3b506e
14 changed files with 250 additions and 62 deletions
|
@ -203,6 +203,9 @@ namespace Compiler
|
|||
|
||||
bool ExprParser::parseInt (int value, const TokenLoc& loc, Scanner& scanner)
|
||||
{
|
||||
if (!mExplicit.empty())
|
||||
return Parser::parseInt (value, loc, scanner);
|
||||
|
||||
mFirst = false;
|
||||
|
||||
if (mNextOperand)
|
||||
|
@ -221,6 +224,9 @@ namespace Compiler
|
|||
|
||||
bool ExprParser::parseFloat (float value, const TokenLoc& loc, Scanner& scanner)
|
||||
{
|
||||
if (!mExplicit.empty())
|
||||
return Parser::parseFloat (value, loc, scanner);
|
||||
|
||||
mFirst = false;
|
||||
|
||||
if (mNextOperand)
|
||||
|
@ -240,6 +246,9 @@ namespace Compiler
|
|||
bool ExprParser::parseName (const std::string& name, const TokenLoc& loc,
|
||||
Scanner& scanner)
|
||||
{
|
||||
if (!mExplicit.empty())
|
||||
return Parser::parseName (name, loc, scanner);
|
||||
|
||||
mFirst = false;
|
||||
|
||||
if (mNextOperand)
|
||||
|
@ -255,7 +264,6 @@ namespace Compiler
|
|||
mOperands.push_back (type=='f' ? 'f' : 'l');
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
type = getContext().getGlobalType (name2);
|
||||
|
||||
|
@ -266,6 +274,12 @@ namespace Compiler
|
|||
mOperands.push_back (type=='f' ? 'f' : 'l');
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mOperands.empty() && mOperators.empty() && mExplicit.empty())
|
||||
{
|
||||
mExplicit = name;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -280,7 +294,28 @@ namespace Compiler
|
|||
bool ExprParser::parseKeyword (int keyword, const TokenLoc& loc, Scanner& scanner)
|
||||
{
|
||||
mFirst = false;
|
||||
|
||||
if (!mExplicit.empty())
|
||||
{
|
||||
if (mRefOp && mNextOperand)
|
||||
{
|
||||
if (keyword==Scanner::K_getdisabled)
|
||||
{
|
||||
mTokenLoc = loc;
|
||||
|
||||
Generator::getDisabled (mCode, mLiterals, mExplicit);
|
||||
mOperands.push_back ('l');
|
||||
mExplicit.clear();
|
||||
mRefOp = false;
|
||||
|
||||
mNextOperand = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return Parser::parseKeyword (keyword, loc, scanner);
|
||||
}
|
||||
|
||||
if (mNextOperand)
|
||||
{
|
||||
if (keyword==Scanner::K_getsquareroot)
|
||||
|
@ -351,7 +386,7 @@ namespace Compiler
|
|||
{
|
||||
mTokenLoc = loc;
|
||||
|
||||
Generator::getDisabled (mCode);
|
||||
Generator::getDisabled (mCode, mLiterals, "");
|
||||
mOperands.push_back ('l');
|
||||
|
||||
mNextOperand = false;
|
||||
|
@ -391,6 +426,17 @@ namespace Compiler
|
|||
|
||||
bool ExprParser::parseSpecial (int code, const TokenLoc& loc, Scanner& scanner)
|
||||
{
|
||||
if (!mExplicit.empty())
|
||||
{
|
||||
if (!mRefOp && code==Scanner::S_ref)
|
||||
{
|
||||
mRefOp = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return Parser::parseSpecial (code, loc, scanner);
|
||||
}
|
||||
|
||||
if (code==Scanner::S_comma)
|
||||
{
|
||||
mTokenLoc = loc;
|
||||
|
@ -498,6 +544,8 @@ namespace Compiler
|
|||
mNextOperand = true;
|
||||
mCode.clear();
|
||||
mFirst = true;
|
||||
mExplicit.clear();
|
||||
mRefOp = false;
|
||||
}
|
||||
|
||||
char ExprParser::append (std::vector<Interpreter::Type_Code>& code)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue