Some operand work for right. Needs work.

This commit is contained in:
barant committed 2025-01-09 17:11:15 -08:00
1 parent 3f4ca13f3f
commit 6516aee6cc
6 files changed
+29 -3

No files matched your search

+14 -1
View File
@@ -64,7 +64,20 @@ namespace jet {
} else
throw coreutils::Exception("Expecting ) at end of EXPR expression.");
} else if(in.ifNextIgnoreCase("RIGHT")) {
if(!in.ifNext("("))
throw coreutils::Exception("Expecting ( for RIGHT parameters.");
Operand parm1(in, tag);
if(!in.ifNext(","))
throw coreutils::Exception("Expecting , in RIGHT expression.");
Operand parm2(in, tag);
if(in.ifNext(")")) {
int len = parm1.string.getLength();
int start = len - parm2.string.asInteger();
std::cout << "len: " << len << "; start: " << start << ";" << std::endl;
string = parm1.string.substring(0, parm2.string.asInteger());
std::cout << "string: " << string << std::endl;
} else
throw coreutils::Exception("Expecting ) at end of RIGHT expression.");
} else if(in.ifNextIgnoreCase("TRIM")) {
} else if(in.ifNextIgnoreCase("TOUPPER")) {