think i fixed if tag.
This commit is contained in:
parent
b3693e8017
commit
ebb6dc4ca9
22
__if.cpp
22
__if.cpp
@ -16,16 +16,24 @@ namespace jet {
|
||||
throw coreutils::Exception("type expected if value1 and value2 specified.");
|
||||
} else
|
||||
throw coreutils::Exception("value2 required if value1 specified.");
|
||||
coreutils::MString type = resolveKeyword("type");
|
||||
if((type != "eq") &&
|
||||
(type != "ne") &&
|
||||
(type != "lt") &&
|
||||
(type != "le") &&
|
||||
(type != "gt") &&
|
||||
(type != "ge"))
|
||||
throw coreutils::Exception("type value must be 'eq','ne','lt','le','gt','ge'.");
|
||||
int rc = keywords[resolveKeyword("value1")].compare(keywords[resolveKeyword("value2")]);
|
||||
if(((keywords[resolveKeyword("type")] == "eq") && (rc == 0)) ||
|
||||
((keywords[resolveKeyword("type")] == "ne") && (rc != 0)) ||
|
||||
((keywords[resolveKeyword("type")] == "lt") && (rc == -1)) ||
|
||||
((keywords[resolveKeyword("type")] == "le") && (rc != 1)) ||
|
||||
((keywords[resolveKeyword("type")] == "gt") && (rc == 1)) ||
|
||||
((keywords[resolveKeyword("type")] == "ge") && (rc != -1)))
|
||||
if(((type == "eq") && (rc == 0)) ||
|
||||
((type == "ne") && (rc != 0)) ||
|
||||
((type == "lt") && (rc == -1)) ||
|
||||
((type == "le") && (rc != 1)) ||
|
||||
((type == "gt") && (rc == 1)) ||
|
||||
((type == "ge") && (rc != -1)))
|
||||
booleanResult = true;
|
||||
else
|
||||
throw coreutils::Exception("type value must be 'eq','ne','lt','le','gt','ge'.");
|
||||
booleanResult = false;
|
||||
} else if(keywordDefined("expr")) {
|
||||
if(keywordDefined("value2"))
|
||||
throw coreutils::Exception("value2 should not be specified with expr.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user