JetCore/Operand.cpp

78 lines
1.6 KiB
C++

#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;
}
/*
if(in.ifNext("+")) {
}
if(in.ifNext("-")) {
}
if(in.getTokenInclude("0123456789")) {
}
if(in.ifNext(".")) {
}
if(in.getTokenInclude("0123456789")) {
}
if(in.ifNext("\"")) {
}
*/
}
}