Made $[%name] to retrieve keyword values in a tag. Has bugs.
This commit is contained in:
1 parent
9622b5cf8c
commit
f6dda8496c
17 files changed
+85
-64
No files matched your search
+23
-20
@@ -6,21 +6,24 @@
|
||||
|
||||
namespace jet {
|
||||
|
||||
Operand::Operand(coreutils::ZString &in, Global &global, std::map<coreutils::MString, coreutils::MString> &lvariables) {
|
||||
Operand::Operand(coreutils::ZString &in,
|
||||
Global &global,
|
||||
std::map<coreutils::MString, coreutils::MString> &lvariables,
|
||||
std::map<coreutils::MString, coreutils::MString> &keywords) {
|
||||
|
||||
doubleValue = 0;
|
||||
|
||||
in.skipWhitespace();
|
||||
|
||||
if(in.startsWith("$[") || in.startsWith("#[")) {
|
||||
string = global.getVariable(in, lvariables);
|
||||
string = global.getVariable(in, lvariables, keywords);
|
||||
doubleValue = string.asDouble();
|
||||
isNumber = string.eod();
|
||||
string.reset();
|
||||
if((string == "false") || (string == "true"))
|
||||
boolean = true;
|
||||
} else if(in.ifNext("(")) {
|
||||
Operand op(in, global, lvariables);
|
||||
Operand op(in, global, lvariables, keywords);
|
||||
string = op.string;
|
||||
doubleValue = op.doubleValue;
|
||||
if(!in.ifNext(")"))
|
||||
@@ -28,15 +31,15 @@ namespace jet {
|
||||
} else if(in.ifNextIgnoreCase("SUBSTRING")) {
|
||||
if(!in.ifNext("("))
|
||||
throw coreutils::Exception("Expecting ( for SUBSTRING parameters.");
|
||||
Operand parm1(in, global, lvariables);
|
||||
Operand parm1(in, global, lvariables, keywords);
|
||||
if(!in.ifNext(","))
|
||||
throw coreutils::Exception("Expecting , in SUBSTRING expression.");
|
||||
Operand parm2(in, global, lvariables);
|
||||
Operand parm2(in, global, lvariables, keywords);
|
||||
if(in.ifNext(")")) {
|
||||
string = parm1.string.substring(parm2.string.asInteger());
|
||||
} else if(!in.ifNext(","))
|
||||
throw coreutils::Exception("Expecting , in SUBSTRING expression.");
|
||||
Operand parm3(in, global, lvariables);
|
||||
Operand parm3(in, global, lvariables, keywords);
|
||||
if(in.ifNext(")")) {
|
||||
string = parm1.string.substring(parm2.string.asInteger(), parm3.string.asInteger());
|
||||
} else
|
||||
@@ -44,10 +47,10 @@ namespace jet {
|
||||
} else if(in.ifNextIgnoreCase("LEFT")) {
|
||||
if(!in.ifNext("("))
|
||||
throw coreutils::Exception("Expecting ( for LEFT parameters.");
|
||||
Operand parm1(in, global, lvariables);
|
||||
Operand parm1(in, global, lvariables, keywords);
|
||||
if(!in.ifNext(","))
|
||||
throw coreutils::Exception("Expecting , in LEFT expression.");
|
||||
Operand parm2(in, global, lvariables);
|
||||
Operand parm2(in, global, lvariables, keywords);
|
||||
if(in.ifNext(")")) {
|
||||
string = parm1.string.substring(0, parm2.string.asInteger());
|
||||
} else
|
||||
@@ -55,9 +58,9 @@ namespace jet {
|
||||
} else if(in.ifNextIgnoreCase("EXPR")) {
|
||||
if(!in.ifNext("("))
|
||||
throw coreutils::Exception("Expecting ( for EXPR parameters.");
|
||||
Operand parm1(in, global, lvariables);
|
||||
Operand parm1(in, global, lvariables, keywords);
|
||||
if(in.ifNext(")")) {
|
||||
Operand op(parm1.string, global, lvariables);
|
||||
Operand op(parm1.string, global, lvariables, keywords);
|
||||
string = op.string;
|
||||
isNumber = op.isNumber;
|
||||
boolean = op.boolean;
|
||||
@@ -105,7 +108,7 @@ namespace jet {
|
||||
in.skipWhitespace();
|
||||
|
||||
if(in.ifNext("!=") || in.ifNext("<>")) {
|
||||
Operand op(in, global, lvariables);
|
||||
Operand op(in, global, lvariables, keywords);
|
||||
if(isNumber && op.isNumber) {
|
||||
if(doubleValue != op.doubleValue) {
|
||||
boolean = true;
|
||||
@@ -129,7 +132,7 @@ namespace jet {
|
||||
}
|
||||
}
|
||||
if(in.ifNext("<=")) {
|
||||
Operand op(in, global, lvariables);
|
||||
Operand op(in, global, lvariables, keywords);
|
||||
if(isNumber && op.isNumber) {
|
||||
if(doubleValue <= op.doubleValue) {
|
||||
boolean = true;
|
||||
@@ -153,7 +156,7 @@ namespace jet {
|
||||
}
|
||||
}
|
||||
if(in.ifNext(">=")) {
|
||||
Operand op(in, global, lvariables);
|
||||
Operand op(in, global, lvariables, keywords);
|
||||
if(isNumber && op.isNumber) {
|
||||
if(doubleValue >= op.doubleValue) {
|
||||
boolean = true;
|
||||
@@ -177,7 +180,7 @@ namespace jet {
|
||||
}
|
||||
}
|
||||
if(in.ifNext("=")) {
|
||||
Operand op(in, global, lvariables);
|
||||
Operand op(in, global, lvariables, keywords);
|
||||
if(isNumber && op.isNumber) {
|
||||
if(doubleValue == op.doubleValue) {
|
||||
boolean = true;
|
||||
@@ -201,7 +204,7 @@ namespace jet {
|
||||
}
|
||||
}
|
||||
if(in.ifNext("<")) {
|
||||
Operand op(in, global, lvariables);
|
||||
Operand op(in, global, lvariables, keywords);
|
||||
if(isNumber && op.isNumber) {
|
||||
if(doubleValue < op.doubleValue) {
|
||||
boolean = true;
|
||||
@@ -225,7 +228,7 @@ namespace jet {
|
||||
}
|
||||
}
|
||||
if(in.ifNext(">")) {
|
||||
Operand op(in, global, lvariables);
|
||||
Operand op(in, global, lvariables, keywords);
|
||||
if(isNumber && op.isNumber) {
|
||||
if(doubleValue > op.doubleValue) {
|
||||
boolean = true;
|
||||
@@ -250,7 +253,7 @@ namespace jet {
|
||||
}
|
||||
if(in.ifNext("+")) {
|
||||
if(isNumber) {
|
||||
Operand op(in, global, lvariables);
|
||||
Operand op(in, global, lvariables, keywords);
|
||||
if(op.isNumber) {
|
||||
doubleValue += op.doubleValue;
|
||||
string = std::format("{:.12f}", doubleValue);
|
||||
@@ -261,7 +264,7 @@ namespace jet {
|
||||
throw coreutils::Exception("operand is not a number.");
|
||||
} else if(in.ifNext("-")) {
|
||||
if(isNumber) {
|
||||
Operand op(in, global, lvariables);
|
||||
Operand op(in, global, lvariables, keywords);
|
||||
if(op.isNumber) {
|
||||
doubleValue -= op.doubleValue;
|
||||
string = std::format("{:.12f}", doubleValue);
|
||||
@@ -272,7 +275,7 @@ namespace jet {
|
||||
throw coreutils::Exception("operand is not a number.");
|
||||
} else if(in.ifNext("*")) {
|
||||
if(isNumber) {
|
||||
Operand op(in, global, lvariables);
|
||||
Operand op(in, global, lvariables, keywords);
|
||||
if(op.isNumber) {
|
||||
doubleValue *= op.doubleValue;
|
||||
string = std::format("{:.12f}", doubleValue);
|
||||
@@ -283,7 +286,7 @@ namespace jet {
|
||||
throw coreutils::Exception("operand is not a number.");
|
||||
} else if(in.ifNext("/")) {
|
||||
if(isNumber) {
|
||||
Operand op(in, global, lvariables);
|
||||
Operand op(in, global, lvariables, keywords);
|
||||
if(op.isNumber) {
|
||||
doubleValue /= op.doubleValue;
|
||||
string = std::format("{:.12f}", doubleValue);
|
||||
|
||||
Reference in new issue
Block a user