improved syntax checking on expr. Laid foundation for expr function.

This commit is contained in:
Brad Arant committed 2024-11-18 10:19:39 -08:00
1 parent 839f7e2eb8
commit c39220d39c
3 files changed
+20 -5

No files matched your search

+12 -3
View File
@@ -53,7 +53,16 @@ namespace jet {
} else
throw coreutils::Exception("Expecting ) at end of LEFT expression.");
} else if(in.ifNextIgnoreCase("EXPR")) {
if(!in.ifNext("("))
throw coreutils::Exception("Expecting ( for LEFT parameters.");
Operand parm1(in, global, lvariables);
if(in.ifNext(")")) {
Operand op(in, global, lvariables);
string = op.string;
isNumber = op.isNumber;
boolean = op.boolean;
} else
throw coreutils::Exception("Expecting ) at end of EXPR expression.");
} else if(in.ifNextIgnoreCase("RIGHT")) {
} else if(in.ifNextIgnoreCase("TRIM")) {
@@ -90,7 +99,8 @@ namespace jet {
string = in.getTokenExclude("'");
in.ifNext("'");
isNumber = false;
}
} else
throw coreutils::Exception("operand is not valid.");
in.skipWhitespace();
@@ -284,7 +294,6 @@ namespace jet {
throw coreutils::Exception("operand is not a number.");
} else
return;
}
}