More work on the operand.
This commit is contained in:
parent
bd25efc461
commit
03fe14d075
@ -13,6 +13,7 @@ namespace jet {
|
||||
string = op1.string;
|
||||
|
||||
std::cout << "Leaving expression string: " << string << std::endl;
|
||||
std::cout << "Unparsed: [" << in.unparsed() << "]" << std::endl;
|
||||
}
|
||||
|
||||
Expression::~Expression() {}
|
||||
|
41
Operand.cpp
41
Operand.cpp
@ -1,5 +1,6 @@
|
||||
#include "Operand.h"
|
||||
#include "Exception.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace jet {
|
||||
|
||||
@ -14,7 +15,7 @@ namespace jet {
|
||||
if(!in.ifNext(","))
|
||||
throw coreutils::Exception("Expecting , in SUBSTRING expression.");
|
||||
Operand parm2(in);
|
||||
if(in.ifNext(")")) {
|
||||
if(in.ifNext(")")) {
|
||||
string = parm1.string.substring(parm2.string.asInteger());
|
||||
}
|
||||
else if(!in.ifNext(","))
|
||||
@ -25,9 +26,7 @@ namespace jet {
|
||||
}
|
||||
else
|
||||
throw coreutils::Exception("Expecting ) at end of substring expression.");
|
||||
}
|
||||
|
||||
else if(in.ifNext("LEFT")) {
|
||||
} else if(in.ifNext("LEFT")) {
|
||||
|
||||
} else if(in.ifNext("RIGHT")) {
|
||||
|
||||
@ -41,37 +40,25 @@ namespace jet {
|
||||
|
||||
} else if(in.ifNext("CONCAT")) {
|
||||
|
||||
}
|
||||
|
||||
if(in.ifNext("true")) {
|
||||
} else if(in.ifNext("true")) {
|
||||
boolean = true;
|
||||
string = "true";
|
||||
return;
|
||||
}
|
||||
if(in.ifNext("false")) {
|
||||
} else if(in.ifNext("false")) {
|
||||
boolean = false;
|
||||
string = "false";
|
||||
return;
|
||||
} else if(in.startsWithDouble()) {
|
||||
char *temp = in.getCursor();
|
||||
doubleValue = in.asDouble();
|
||||
string = coreutils::ZString(temp, in.getCursor() - temp);
|
||||
return;
|
||||
} else if(in.ifNext("'")) {
|
||||
string = in.getTokenExclude("'");
|
||||
in.ifNext("'");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if(in.ifNext("+")) {
|
||||
}
|
||||
if(in.ifNext("-")) {
|
||||
}
|
||||
if(in.getTokenInclude("0123456789")) {
|
||||
}
|
||||
if(in.ifNext(".")) {
|
||||
}
|
||||
if(in.getTokenInclude("0123456789")) {
|
||||
}
|
||||
|
||||
if(in.ifNext("\"")) {
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ int main(int argc, char **argv) {
|
||||
" <comment>This is a comment and should not show up in the output.</comment>\n"
|
||||
" <html>\n"
|
||||
" <set name=\"ix\" value=\"1\" />\n"
|
||||
" <set name=\"theexpr\" expr=\"SUBSTRING(\"abcdefg\",1,3)\" />\n"
|
||||
" <set name=\"theexpr\" expr=\"SUBSTRING('abcdefg', 1, 3)\" />\n"
|
||||
" <set name=\"theexpr2\" expr=\"5+3\" />\n"
|
||||
" theexpr=($[theexpr])\n"
|
||||
" theexpr2($[theexpr2])\n"
|
||||
@ -20,7 +20,7 @@ int main(int argc, char **argv) {
|
||||
" <set name=\"newname\" scope=\"global\">another container value</set>\n"
|
||||
" >>>$[noeval]<<<\n"
|
||||
" >>>$[thename]<<<\n"
|
||||
" local: >>>#[namex]<<<\n"
|
||||
" local: >>>#[name]<<<\n"
|
||||
" <mysql key=\"uu\">\n"
|
||||
" <if value1=\"X\" value2=\"Y\" type=\"ne\">\n"
|
||||
" 789\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user