mirror of
https://github.com/autc04/Retro68.git
synced 2024-09-10 03:54:48 +00:00
Rez: IdentifierExpr: strings and subscripts
This commit is contained in:
parent
50eb0f5373
commit
340db62480
@ -130,12 +130,26 @@ int IdentifierExpr::evaluateInt(ResourceCompiler *ctx)
|
||||
}
|
||||
else
|
||||
{
|
||||
ExprPtr val = ctx->lookupIdentifier(id);
|
||||
Subscripts sub;
|
||||
for(auto arg : arguments)
|
||||
sub.addSubscript(arg->evaluateInt(ctx));
|
||||
ExprPtr val = ctx->lookupIdentifier(id, sub);
|
||||
assert(val);
|
||||
return val->evaluateInt(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
std::string IdentifierExpr::evaluateString(ResourceCompiler *ctx)
|
||||
{
|
||||
assert(!isFunction);
|
||||
Subscripts sub;
|
||||
for(auto arg : arguments)
|
||||
sub.addSubscript(arg->evaluateInt(ctx));
|
||||
ExprPtr val = ctx->lookupIdentifier(id, sub);
|
||||
assert(val);
|
||||
return val->evaluateString(ctx);
|
||||
}
|
||||
|
||||
|
||||
CaseExpr::CaseExpr(const std::string &tag, CompoundExprPtr expr)
|
||||
: tag(tag), expr(expr)
|
||||
|
@ -111,6 +111,7 @@ public:
|
||||
|
||||
void addArgument(ExprPtr e);
|
||||
virtual int evaluateInt(ResourceCompiler *ctx);
|
||||
virtual std::string evaluateString(ResourceCompiler *ctx);
|
||||
};
|
||||
|
||||
#endif // EXPRESSION_H
|
||||
|
Loading…
Reference in New Issue
Block a user