Started into the Expression and Operand obejcts.
This commit is contained in:
1 parent
071151d8a1
commit
bd25efc461
11 files changed
+76
-21
No files matched your search
+41
@@ -1,15 +1,56 @@
|
||||
#include "Operand.h"
|
||||
#include "Exception.h"
|
||||
|
||||
namespace jet {
|
||||
|
||||
Operand::Operand(coreutils::ZString &in) {
|
||||
|
||||
in.skipWhitespace();
|
||||
|
||||
if(in.ifNext("SUBSTRING")) {
|
||||
if(!in.ifNext("("))
|
||||
throw coreutils::Exception("Expecting ( for SUBSTRING parameters.");
|
||||
Operand parm1(in);
|
||||
if(!in.ifNext(","))
|
||||
throw coreutils::Exception("Expecting , in SUBSTRING expression.");
|
||||
Operand parm2(in);
|
||||
if(in.ifNext(")")) {
|
||||
string = parm1.string.substring(parm2.string.asInteger());
|
||||
}
|
||||
else if(!in.ifNext(","))
|
||||
throw coreutils::Exception("Expecting , in SUBSTRING expression.");
|
||||
Operand parm3(in);
|
||||
if(in.ifNext(")")) {
|
||||
string = parm1.string.substring(parm2.string.asInteger(), parm3.string.asInteger());
|
||||
}
|
||||
else
|
||||
throw coreutils::Exception("Expecting ) at end of substring expression.");
|
||||
}
|
||||
|
||||
else if(in.ifNext("LEFT")) {
|
||||
|
||||
} else if(in.ifNext("RIGHT")) {
|
||||
|
||||
} else if(in.ifNext("TRIM")) {
|
||||
|
||||
} else if(in.ifNext("TOUPPER")) {
|
||||
|
||||
} else if(in.ifNext("TOLOWER")) {
|
||||
|
||||
} else if(in.ifNext("REVERSE")) {
|
||||
|
||||
} else if(in.ifNext("CONCAT")) {
|
||||
|
||||
}
|
||||
|
||||
if(in.ifNext("true")) {
|
||||
boolean = true;
|
||||
string = "true";
|
||||
return;
|
||||
}
|
||||
if(in.ifNext("false")) {
|
||||
boolean = false;
|
||||
string = "false";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user