Finished up the keyword resolution issue and fixed for, while and until. Other tags still need work.
This commit is contained in:
1 parent
93a520f152
commit
6da620971e
8 files changed
+61
-47
No files matched your search
+28
-19
@@ -9,24 +9,18 @@ namespace jet {
|
||||
|
||||
coreutils::MString result;
|
||||
bool booleanResult = false;
|
||||
bool exprMethod = false;
|
||||
coreutils::MString exprSaved;
|
||||
|
||||
if(variableDefined("value1")) {
|
||||
|
||||
|
||||
if(variableDefined("expr"))
|
||||
throw coreutils::Exception("Either value1 or expr can be specified but not both.");
|
||||
if(variableDefined("value2")) {
|
||||
|
||||
if(variableDefined("type")) {
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
throw coreutils::Exception("type expected if value1 and value2 specified.");
|
||||
}
|
||||
else
|
||||
throw coreutils::Exception("either value1 or expr can be specified but not both.");
|
||||
if(!variableDefined("value2"))
|
||||
throw coreutils::Exception("value2 required if value1 specified.");
|
||||
if(!variableDefined("type"))
|
||||
throw coreutils::Exception("type required for a value1 and value2 comparison.");
|
||||
if(!variableDefined("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)) ||
|
||||
@@ -39,19 +33,34 @@ namespace jet {
|
||||
throw coreutils::Exception("type value must be 'eq','ne','lt','le','gt','ge'.");
|
||||
}
|
||||
else if(variableDefined("expr")) {
|
||||
|
||||
if(variableDefined("value2"))
|
||||
throw coreutils::Exception("value2 should not be specified with expr.");
|
||||
if(variableDefined("type"))
|
||||
throw coreutils::Exception("type should not be specified with expr.");
|
||||
booleanResult = Operand(variables["expr"]).boolean;
|
||||
exprMethod = true;
|
||||
exprSaved = variables["expr"];
|
||||
}
|
||||
|
||||
do {
|
||||
do {
|
||||
processContainer(container);
|
||||
container.reset();
|
||||
if(exprMethod) {
|
||||
variables["expr"].reset();
|
||||
variables["expr"] = exprSaved;
|
||||
resolveKeyword("expr");
|
||||
booleanResult = Operand(variables["expr"]).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)))
|
||||
booleanResult = true;
|
||||
}
|
||||
} while(booleanResult);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user