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
@@ -8,53 +8,53 @@ namespace jet {
|
||||
|
||||
__set::__set(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, Tag *local) : Tag(in, parentOut, global, parent, local) {
|
||||
output = false;
|
||||
if(!variableDefined("name"))
|
||||
if(!keywordDefined("name"))
|
||||
throw coreutils::Exception("set tag must have name defined.");
|
||||
if(!variableDefined("expr") && variableDefined("value") && hasContainer)
|
||||
if(!keywordDefined("expr") && keywordDefined("value") && hasContainer)
|
||||
throw coreutils::Exception("set tag cannot have both value and a container.");
|
||||
if(variableDefined("expr") && !variableDefined("value") && hasContainer)
|
||||
if(keywordDefined("expr") && !keywordDefined("value") && hasContainer)
|
||||
throw coreutils::Exception("set tag cannot have both expr and a container.");
|
||||
if(variableDefined("expr") && variableDefined("value") && !hasContainer)
|
||||
if(keywordDefined("expr") && keywordDefined("value") && !hasContainer)
|
||||
throw coreutils::Exception("set tag cannot have both expr and value.");
|
||||
if(!variableDefined("expr") && !variableDefined("value") && !hasContainer)
|
||||
if(!keywordDefined("expr") && !keywordDefined("value") && !hasContainer)
|
||||
throw coreutils::Exception("set tag must have a value, expr or a container.");
|
||||
if(variableDefined("expr") && variableDefined("eval"))
|
||||
if(keywordDefined("expr") && keywordDefined("eval"))
|
||||
throw coreutils::Exception("Cannot use eval with expr.");
|
||||
|
||||
resolveKeyword("name");
|
||||
|
||||
if(variableDefined("expr")) {
|
||||
if(!variableDefined("scope") || (variables["scope"] == "global"))
|
||||
global.variables[variables["name"]] = Operand(variables["expr"], global, parent->variables).string;
|
||||
else if(variables["scope"] == "local")
|
||||
local->variables[variables["name"]] = Operand(variables["expr"], global, parent->variables).string;
|
||||
else if(variables["scope"] == "parent")
|
||||
local->parent->variables[variables["name"]] = Operand(variables["expr"], global, parent->variables).string;
|
||||
if(keywordDefined("expr")) {
|
||||
if(!keywordDefined("scope") || (keywords["scope"] == "global"))
|
||||
global.variables[keywords["name"]] = Operand(keywords["expr"], global, parent->variables).string;
|
||||
else if(keywords["scope"] == "local")
|
||||
local->variables[keywords["name"]] = Operand(keywords["expr"], global, parent->variables).string;
|
||||
else if(keywords["scope"] == "parent")
|
||||
local->parent->variables[keywords["name"]] = Operand(keywords["expr"], global, parent->variables).string;
|
||||
} else if(hasContainer) {
|
||||
processContainer(container);
|
||||
if(evaluate) {
|
||||
if(!variableDefined("scope") || (variables["scope"] == "global"))
|
||||
global.variables[variables["name"]] = out;
|
||||
else if(variables["scope"] == "local")
|
||||
local->variables[variables["name"]] = out;
|
||||
else if(variables["scope"] == "parent")
|
||||
local->parent->variables[variables["name"]] = out;
|
||||
if(!keywordDefined("scope") || (keywords["scope"] == "global"))
|
||||
global.variables[keywords["name"]] = out;
|
||||
else if(keywords["scope"] == "local")
|
||||
local->variables[keywords["name"]] = out;
|
||||
else if(keywords["scope"] == "parent")
|
||||
local->parent->variables[keywords["name"]] = out;
|
||||
} else {
|
||||
if(!variableDefined("scope") || (variables["scope"] == "global"))
|
||||
global.variables[variables["name"]] = container;
|
||||
else if(variables["scope"] == "local")
|
||||
local->variables[variables["name"]] = container;
|
||||
else if(variables["scope"] == "parent")
|
||||
local->parent->variables[variables["name"]] = container;
|
||||
if(!keywordDefined("scope") || (keywords["scope"] == "global"))
|
||||
global.variables[keywords["name"]] = container;
|
||||
else if(keywords["scope"] == "local")
|
||||
local->variables[keywords["name"]] = container;
|
||||
else if(keywords["scope"] == "parent")
|
||||
local->parent->variables[keywords["name"]] = container;
|
||||
}
|
||||
} else {
|
||||
resolveKeyword("value");
|
||||
if(!variableDefined("scope") || (variables["scope"] == "global"))
|
||||
global.variables[variables["name"]] = variables["value"];
|
||||
else if(variables["scope"] == "local")
|
||||
local->variables[variables["name"]] = variables["value"];
|
||||
else if(variables["scope"] == "parent")
|
||||
local->parent->variables[variables["name"]] = variables["value"];
|
||||
if(!keywordDefined("scope") || (keywords["scope"] == "global"))
|
||||
global.variables[keywords["name"]] = keywords["value"];
|
||||
else if(keywords["scope"] == "local")
|
||||
local->variables[keywords["name"]] = keywords["value"];
|
||||
else if(keywords["scope"] == "parent")
|
||||
local->parent->variables[keywords["name"]] = keywords["value"];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user