Moved keywords from local variables to keywords map.
This commit is contained in:
1 parent
907f449ecc
commit
9622b5cf8c
23 files changed
+221
-220
No files matched your search
@@ -6,30 +6,30 @@ namespace jet {
|
||||
|
||||
__for::__for(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, Tag *local) : Tag(in, parentOut, global, parent, this) {
|
||||
double counter = 0.0f;
|
||||
bool nameDefined = variableDefined("name");
|
||||
if(variableDefined("start")) {
|
||||
bool nameDefined = keywordDefined("name");
|
||||
if(keywordDefined("start")) {
|
||||
resolveKeyword("start");
|
||||
counter = variables["start"].asDouble();
|
||||
variables["start"].reset();
|
||||
counter = keywords["start"].asDouble();
|
||||
keywords["start"].reset();
|
||||
}
|
||||
if(variableDefined("end"))
|
||||
if(keywordDefined("end"))
|
||||
resolveKeyword("end");
|
||||
else
|
||||
throw coreutils::Exception("for tag requires end keyword.");
|
||||
if(variableDefined("step"))
|
||||
if(keywordDefined("step"))
|
||||
resolveKeyword("step");
|
||||
else
|
||||
throw coreutils::Exception("for tag requires step keyword.");
|
||||
for(double ix = counter; ix <= variables["end"].asDouble(); ix += variables["step"].asDouble()) {
|
||||
variables["end"].reset();
|
||||
variables["step"].reset();
|
||||
keywords["end"].reset();
|
||||
keywords["step"].reset();
|
||||
if(nameDefined) {
|
||||
if(!variableDefined("scope") || (variables["scope"] == "global"))
|
||||
global.variables[variables["name"]] = ix;
|
||||
else if(variables["scope"] == "local")
|
||||
this->local->variables[variables["name"]] = ix;
|
||||
else if(variables["scope"] == "parent")
|
||||
parent->local->variables[variables["name"]] = ix;
|
||||
if(!keywordDefined("scope") || (keywords["scope"] == "global"))
|
||||
global.variables[keywords["name"]] = ix;
|
||||
else if(keywords["scope"] == "local")
|
||||
this->local->variables[keywords["name"]] = ix;
|
||||
else if(keywords["scope"] == "parent")
|
||||
parent->local->variables[keywords["name"]] = ix;
|
||||
else
|
||||
throw coreutils::Exception("scope value is not valid.");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user