More work on the operand.

This commit is contained in:
Brad Arant 2024-08-01 16:17:57 -07:00
parent bd25efc461
commit 03fe14d075
3 changed files with 17 additions and 29 deletions

View File

@ -13,6 +13,7 @@ namespace jet {
string = op1.string; string = op1.string;
std::cout << "Leaving expression string: " << string << std::endl; std::cout << "Leaving expression string: " << string << std::endl;
std::cout << "Unparsed: [" << in.unparsed() << "]" << std::endl;
} }
Expression::~Expression() {} Expression::~Expression() {}

View File

@ -1,5 +1,6 @@
#include "Operand.h" #include "Operand.h"
#include "Exception.h" #include "Exception.h"
#include <iostream>
namespace jet { namespace jet {
@ -25,9 +26,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.ifNext("LEFT")) {
} else if(in.ifNext("RIGHT")) { } else if(in.ifNext("RIGHT")) {
@ -41,37 +40,25 @@ namespace jet {
} else if(in.ifNext("CONCAT")) { } else if(in.ifNext("CONCAT")) {
} } else if(in.ifNext("true")) {
if(in.ifNext("true")) {
boolean = true; boolean = true;
string = "true"; string = "true";
return; return;
} } else if(in.ifNext("false")) {
if(in.ifNext("false")) {
boolean = false; boolean = false;
string = "false"; string = "false";
return; 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("\"")) {
}
*/
} }
} }

View File

@ -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" " <comment>This is a comment and should not show up in the output.</comment>\n"
" <html>\n" " <html>\n"
" <set name=\"ix\" value=\"1\" />\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" " <set name=\"theexpr2\" expr=\"5+3\" />\n"
" theexpr=($[theexpr])\n" " theexpr=($[theexpr])\n"
" theexpr2($[theexpr2])\n" " theexpr2($[theexpr2])\n"
@ -20,7 +20,7 @@ int main(int argc, char **argv) {
" <set name=\"newname\" scope=\"global\">another container value</set>\n" " <set name=\"newname\" scope=\"global\">another container value</set>\n"
" >>>$[noeval]<<<\n" " >>>$[noeval]<<<\n"
" >>>$[thename]<<<\n" " >>>$[thename]<<<\n"
" local: >>>#[namex]<<<\n" " local: >>>#[name]<<<\n"
" <mysql key=\"uu\">\n" " <mysql key=\"uu\">\n"
" <if value1=\"X\" value2=\"Y\" type=\"ne\">\n" " <if value1=\"X\" value2=\"Y\" type=\"ne\">\n"
" 789\n" " 789\n"