work towards a clean compile on migrating set and get variables from Tag.

This commit is contained in:
barant committed 2025-01-08 10:27:30 -08:00
1 parent 2549220914
commit 5c27df59da
25 files changed
+178 -306

No files matched your search

+20 -23
View File
@@ -6,24 +6,21 @@
namespace jet {
Operand::Operand(coreutils::ZString &in,
Global &global,
std::map<coreutils::MString, coreutils::MString> &lvariables,
std::map<coreutils::MString, coreutils::MString> &keywords) {
Operand::Operand(coreutils::ZString &in, Tag &tag) {
doubleValue = 0;
in.skipWhitespace();
if(in.startsWith("$[") || in.startsWith("#[")) {
string = global.getVariable(in, lvariables, keywords);
string = tag.getVariable(in);
doubleValue = string.asDouble();
isNumber = string.eod();
string.reset();
if((string == "false") || (string == "true"))
boolean = true;
} else if(in.ifNext("(")) {
Operand op(in, global, lvariables, keywords);
Operand op(in, tag);
string = op.string;
doubleValue = op.doubleValue;
if(!in.ifNext(")"))
@@ -31,15 +28,15 @@ namespace jet {
} else if(in.ifNextIgnoreCase("SUBSTRING")) {
if(!in.ifNext("("))
throw coreutils::Exception("Expecting ( for SUBSTRING parameters.");
Operand parm1(in, global, lvariables, keywords);
Operand parm1(in, tag);
if(!in.ifNext(","))
throw coreutils::Exception("Expecting , in SUBSTRING expression.");
Operand parm2(in, global, lvariables, keywords);
Operand parm2(in, tag);
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, keywords);
Operand parm3(in, tag);
if(in.ifNext(")")) {
string = parm1.string.substring(parm2.string.asInteger(), parm3.string.asInteger());
} else
@@ -47,10 +44,10 @@ namespace jet {
} else if(in.ifNextIgnoreCase("LEFT")) {
if(!in.ifNext("("))
throw coreutils::Exception("Expecting ( for LEFT parameters.");
Operand parm1(in, global, lvariables, keywords);
Operand parm1(in, tag);
if(!in.ifNext(","))
throw coreutils::Exception("Expecting , in LEFT expression.");
Operand parm2(in, global, lvariables, keywords);
Operand parm2(in, tag);
if(in.ifNext(")")) {
string = parm1.string.substring(0, parm2.string.asInteger());
} else
@@ -58,9 +55,9 @@ namespace jet {
} else if(in.ifNextIgnoreCase("EXPR")) {
if(!in.ifNext("("))
throw coreutils::Exception("Expecting ( for EXPR parameters.");
Operand parm1(in, global, lvariables, keywords);
Operand parm1(in, tag);
if(in.ifNext(")")) {
Operand op(parm1.string, global, lvariables, keywords);
Operand op(parm1.string, tag);
string = op.string;
isNumber = op.isNumber;
boolean = op.boolean;
@@ -108,7 +105,7 @@ namespace jet {
in.skipWhitespace();
if(in.ifNext("!=") || in.ifNext("<>")) {
Operand op(in, global, lvariables, keywords);
Operand op(in, tag);
if(isNumber && op.isNumber) {
if(doubleValue != op.doubleValue) {
boolean = true;
@@ -132,7 +129,7 @@ namespace jet {
}
}
if(in.ifNext("<=")) {
Operand op(in, global, lvariables, keywords);
Operand op(in, tag);
if(isNumber && op.isNumber) {
if(doubleValue <= op.doubleValue) {
boolean = true;
@@ -156,7 +153,7 @@ namespace jet {
}
}
if(in.ifNext(">=")) {
Operand op(in, global, lvariables, keywords);
Operand op(in, tag);
if(isNumber && op.isNumber) {
if(doubleValue >= op.doubleValue) {
boolean = true;
@@ -180,7 +177,7 @@ namespace jet {
}
}
if(in.ifNext("=")) {
Operand op(in, global, lvariables, keywords);
Operand op(in, tag);
if(isNumber && op.isNumber) {
if(doubleValue == op.doubleValue) {
boolean = true;
@@ -204,7 +201,7 @@ namespace jet {
}
}
if(in.ifNext("<")) {
Operand op(in, global, lvariables, keywords);
Operand op(in, tag);
if(isNumber && op.isNumber) {
if(doubleValue < op.doubleValue) {
boolean = true;
@@ -228,7 +225,7 @@ namespace jet {
}
}
if(in.ifNext(">")) {
Operand op(in, global, lvariables, keywords);
Operand op(in, tag);
if(isNumber && op.isNumber) {
if(doubleValue > op.doubleValue) {
boolean = true;
@@ -253,7 +250,7 @@ namespace jet {
}
if(in.ifNext("+")) {
if(isNumber) {
Operand op(in, global, lvariables, keywords);
Operand op(in, tag);
if(op.isNumber) {
doubleValue += op.doubleValue;
string = std::format("{:.12f}", doubleValue);
@@ -264,7 +261,7 @@ namespace jet {
throw coreutils::Exception("operand is not a number.");
} else if(in.ifNext("-")) {
if(isNumber) {
Operand op(in, global, lvariables, keywords);
Operand op(in, tag);
if(op.isNumber) {
doubleValue -= op.doubleValue;
string = std::format("{:.12f}", doubleValue);
@@ -275,7 +272,7 @@ namespace jet {
throw coreutils::Exception("operand is not a number.");
} else if(in.ifNext("*")) {
if(isNumber) {
Operand op(in, global, lvariables, keywords);
Operand op(in, tag);
if(op.isNumber) {
doubleValue *= op.doubleValue;
string = std::format("{:.12f}", doubleValue);
@@ -286,7 +283,7 @@ namespace jet {
throw coreutils::Exception("operand is not a number.");
} else if(in.ifNext("/")) {
if(isNumber) {
Operand op(in, global, lvariables, keywords);
Operand op(in, tag);
if(op.isNumber) {
doubleValue /= op.doubleValue;
string = std::format("{:.12f}", doubleValue);