diff --git a/Expression.cpp b/Expression.cpp index b0d03eb..7277cb9 100644 --- a/Expression.cpp +++ b/Expression.cpp @@ -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() {} diff --git a/Operand.cpp b/Operand.cpp index 6b87f10..561520d 100644 --- a/Operand.cpp +++ b/Operand.cpp @@ -1,5 +1,6 @@ #include "Operand.h" #include "Exception.h" +#include 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("\"")) { - } - */ - } } diff --git a/testjet.cpp b/testjet.cpp index 47e639c..368c36e 100644 --- a/testjet.cpp +++ b/testjet.cpp @@ -10,7 +10,7 @@ int main(int argc, char **argv) { " This is a comment and should not show up in the output.\n" " \n" " \n" - " \n" + " \n" " \n" " theexpr=($[theexpr])\n" " theexpr2($[theexpr2])\n" @@ -20,7 +20,7 @@ int main(int argc, char **argv) { " another container value\n" " >>>$[noeval]<<<\n" " >>>$[thename]<<<\n" - " local: >>>#[namex]<<<\n" + " local: >>>#[name]<<<\n" " \n" " \n" " 789\n"