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
+25
-25
@@ -12,51 +12,51 @@ namespace jet {
|
||||
bool exprMethod = false;
|
||||
coreutils::MString exprSaved;
|
||||
|
||||
if(variableDefined("value1")) {
|
||||
if(keywordDefined("value1")) {
|
||||
|
||||
if(variableDefined("expr"))
|
||||
if(keywordDefined("expr"))
|
||||
throw coreutils::Exception("either value1 or expr can be specified but not both.");
|
||||
if(!variableDefined("value2"))
|
||||
if(!keywordDefined("value2"))
|
||||
throw coreutils::Exception("value2 required if value1 specified.");
|
||||
if(!variableDefined("type"))
|
||||
if(!keywordDefined("type"))
|
||||
throw coreutils::Exception("type expected if value1 and value2 specified.");
|
||||
|
||||
int rc = variables["value1"].compare(variables["value2"]);
|
||||
if(((variables["type"] == "eq") && (rc == 0)) ||
|
||||
((variables["type"] == "ne") && (rc != 0)) ||
|
||||
((variables["type"] == "lt") && (rc == -1)) ||
|
||||
((variables["type"] == "le") && (rc != 1)) ||
|
||||
((variables["type"] == "gt") && (rc == 1)) ||
|
||||
((variables["type"] == "ge") && (rc != -1)))
|
||||
int rc = keywords["value1"].compare(keywords["value2"]);
|
||||
if(((keywords["type"] == "eq") && (rc == 0)) ||
|
||||
((keywords["type"] == "ne") && (rc != 0)) ||
|
||||
((keywords["type"] == "lt") && (rc == -1)) ||
|
||||
((keywords["type"] == "le") && (rc != 1)) ||
|
||||
((keywords["type"] == "gt") && (rc == 1)) ||
|
||||
((keywords["type"] == "ge") && (rc != -1)))
|
||||
booleanResult = true;
|
||||
else
|
||||
throw coreutils::Exception("type value must be 'eq','ne','lt','le','gt','ge'.");
|
||||
}
|
||||
else if(variableDefined("expr")) {
|
||||
if(variableDefined("value2"))
|
||||
else if(keywordDefined("expr")) {
|
||||
if(keywordDefined("value2"))
|
||||
throw coreutils::Exception("value2 should not be specified with expr.");
|
||||
if(variableDefined("type"))
|
||||
if(keywordDefined("type"))
|
||||
throw coreutils::Exception("type should not be specified with expr.");
|
||||
exprMethod = true;
|
||||
exprSaved = variables["expr"];
|
||||
exprSaved = keywords["expr"];
|
||||
}
|
||||
do {
|
||||
processContainer(container);
|
||||
container.reset();
|
||||
if(exprMethod) {
|
||||
variables["expr"].reset();
|
||||
variables["expr"] = exprSaved;
|
||||
keywords["expr"].reset();
|
||||
keywords["expr"] = exprSaved;
|
||||
resolveKeyword("expr");
|
||||
booleanResult = Operand(variables["expr"], global, parent->variables).boolean;
|
||||
booleanResult = Operand(keywords["expr"], global, parent->variables).boolean;
|
||||
} else {
|
||||
booleanResult = false;
|
||||
int rc = variables["value1"].compare(variables["value2"]);
|
||||
if(((variables["type"] == "eq") && (rc == 0)) ||
|
||||
((variables["type"] == "ne") && (rc != 0)) ||
|
||||
((variables["type"] == "lt") && (rc == -1)) ||
|
||||
((variables["type"] == "le") && (rc != 1)) ||
|
||||
((variables["type"] == "gt") && (rc == 1)) ||
|
||||
((variables["type"] == "ge") && (rc != -1)))
|
||||
int rc = keywords["value1"].compare(keywords["value2"]);
|
||||
if(((keywords["type"] == "eq") && (rc == 0)) ||
|
||||
((keywords["type"] == "ne") && (rc != 0)) ||
|
||||
((keywords["type"] == "lt") && (rc == -1)) ||
|
||||
((keywords["type"] == "le") && (rc != 1)) ||
|
||||
((keywords["type"] == "gt") && (rc == 1)) ||
|
||||
((keywords["type"] == "ge") && (rc != -1)))
|
||||
booleanResult = true;
|
||||
}
|
||||
} while(booleanResult);
|
||||
|
||||
Reference in new issue
Block a user