Made Operand ignore case for function names.

This commit is contained in:
Brad Arant 2024-11-05 15:50:06 -08:00
parent ed00a330a4
commit b46694f71b
2 changed files with 14 additions and 14 deletions

View File

@ -20,7 +20,7 @@ namespace jet {
throw coreutils::Exception("expected ) in expression."); throw coreutils::Exception("expected ) in expression.");
} }
if(in.ifNext("SUBSTRING")) { if(in.ifNextIgnoreCase("SUBSTRING")) {
if(!in.ifNext("(")) if(!in.ifNext("("))
throw coreutils::Exception("Expecting ( for SUBSTRING parameters."); throw coreutils::Exception("Expecting ( for SUBSTRING parameters.");
Operand parm1(in); Operand parm1(in);
@ -38,7 +38,7 @@ namespace jet {
} }
else else
throw coreutils::Exception("Expecting ) at end of substring expression."); throw coreutils::Exception("Expecting ) at end of substring expression.");
} else if(in.ifNext("LEFT")) { } else if(in.ifNextIgnoreCase("LEFT")) {
if(!in.ifNext("(")) if(!in.ifNext("("))
throw coreutils::Exception("Expecting ( for LEFT parameters."); throw coreutils::Exception("Expecting ( for LEFT parameters.");
Operand parm1(in); Operand parm1(in);
@ -50,32 +50,32 @@ namespace jet {
} }
else else
throw coreutils::Exception("Expecting ) at end of LEFT expression."); throw coreutils::Exception("Expecting ) at end of LEFT expression.");
} else if(in.ifNext("RIGHT")) { } else if(in.ifNextIgnoreCase("RIGHT")) {
} else if(in.ifNext("TRIM")) { } else if(in.ifNextIgnoreCase("TRIM")) {
} else if(in.ifNext("TOUPPER")) { } else if(in.ifNextIgnoreCase("TOUPPER")) {
} else if(in.ifNext("TOLOWER")) { } else if(in.ifNextIgnoreCase("TOLOWER")) {
} else if(in.ifNext("REVERSE")) { } else if(in.ifNextIgnoreCase("REVERSE")) {
} else if(in.ifNext("CONCAT")) { } else if(in.ifNextIgnoreCase("CONCAT")) {
} else if(in.ifNext("INTEGER")) { } else if(in.ifNextIgnoreCase("INTEGER")) {
} else if(in.ifNext("ROUND")) { } else if(in.ifNextIgnoreCase("ROUND")) {
} else if(in.ifNext("RANDOM")) { } else if(in.ifNextIgnoreCase("RANDOM")) {
unsigned int seed = (unsigned int)clock(); unsigned int seed = (unsigned int)clock();
doubleValue = (double) rand_r(&seed) / (RAND_MAX + 1.0); doubleValue = (double) rand_r(&seed) / (RAND_MAX + 1.0);
isNumber = true; isNumber = true;
string = std::format("{:.12f}", doubleValue); string = std::format("{:.12f}", doubleValue);
string.removeTrailingZeros(); string.removeTrailingZeros();
} else if(in.ifNext("true")) { } else if(in.ifNextIgnoreCase("true")) {
boolean = true; boolean = true;
string = "true"; string = "true";
} else if(in.ifNext("false")) { } else if(in.ifNextIgnoreCase("false")) {
boolean = false; boolean = false;
string = "false"; string = "false";
} else if(in.startsWithNumber()) { } else if(in.startsWithNumber()) {

View File

@ -1,7 +1,7 @@
#!../jet-2.0 #!../jet-2.0
<jet cgi="true" name1="localname" filterblanklines="true" trimlines="true"> <jet cgi="true" name1="localname" filterblanklines="true" trimlines="true">
<for name="ix" start="1" end="20" step="1"> <for name="ix" start="1" end="20" step="1">
<set name="random" expr="RANDOM()" /> <set name="random" expr="random()" />
$[random] $[random]
</for> </for>
</jet> </jet>