diff --git a/Expression.h b/Expression.h index a7363ce..7a1c788 100644 --- a/Expression.h +++ b/Expression.h @@ -15,7 +15,7 @@ namespace jet { double getNumericResult(); coreutils::ZString getStringResult(); bool boolean; - coreutils::ZString string; + coreutils::MString string; char *operation; }; diff --git a/Global.cpp b/Global.cpp index 1316345..98b2351 100644 --- a/Global.cpp +++ b/Global.cpp @@ -90,7 +90,7 @@ namespace jet { void Global::outputHeaders() { if(headers.size() > 0) { - for(std::map::iterator header = headers.begin(); + for(auto header = headers.begin(); header != headers.end(); ++header) { std::cout << header->first << ": " << header->second << std::endl; diff --git a/Global.h b/Global.h index c183589..baa78b5 100644 --- a/Global.h +++ b/Global.h @@ -3,7 +3,6 @@ #include "MString.h" #include -//#include namespace jet { diff --git a/Operand.cpp b/Operand.cpp index 561520d..3561917 100644 --- a/Operand.cpp +++ b/Operand.cpp @@ -7,7 +7,7 @@ namespace jet { Operand::Operand(coreutils::ZString &in) { in.skipWhitespace(); - + std::cout << "op: [" << in.unparsed() << "]" << std::endl; if(in.ifNext("SUBSTRING")) { if(!in.ifNext("(")) throw coreutils::Exception("Expecting ( for SUBSTRING parameters."); @@ -48,10 +48,9 @@ namespace jet { boolean = false; string = "false"; return; - } else if(in.startsWithDouble()) { - char *temp = in.getCursor(); + } else if(in.startsWithNumber()) { doubleValue = in.asDouble(); - string = coreutils::ZString(temp, in.getCursor() - temp); + string = std::to_string(doubleValue); return; } else if(in.ifNext("'")) { string = in.getTokenExclude("'"); diff --git a/Operand.h b/Operand.h index 2f58c86..073af77 100644 --- a/Operand.h +++ b/Operand.h @@ -1,7 +1,7 @@ #ifndef __Operand_h__ #define __Operand_h__ -#include "ZString.h" +#include "MString.h" namespace jet { @@ -19,7 +19,7 @@ namespace jet { /// bool boolean; - coreutils::ZString string; + coreutils::MString string; private: // dataType enum ={}; diff --git a/__set.cpp b/__set.cpp index 102f02a..5b8c43b 100644 --- a/__set.cpp +++ b/__set.cpp @@ -7,7 +7,6 @@ namespace jet { __set::__set(coreutils::ZString &in, coreutils::MString &parent, Global &global) : Tag(in, parent, global) { output = false; - processContainer(container); if(!variableDefined("name")) throw coreutils::Exception("set tag must have name defined."); if(!variableDefined("expr") && variableDefined("value") && hasContainer) @@ -24,6 +23,7 @@ namespace jet { throw coreutils::Exception("Cannot use eval with expr."); global.variables[variables["name"]] = Expression(variables["expr"]).string; } else if(hasContainer) { + processContainer(container); if(evaluate) { global.variables[variables["name"]] = out; } else { diff --git a/jet-2.0 b/jet-2.0 index af3ad69..2bd3c6a 100755 Binary files a/jet-2.0 and b/jet-2.0 differ diff --git a/jet-2.0.cpp b/jet-2.0.cpp index 802efca..8704ff3 100644 --- a/jet-2.0.cpp +++ b/jet-2.0.cpp @@ -16,7 +16,8 @@ int main(int argc, char **argv) { jet::Global global; coreutils::MString out; jet::__jet *jet = new jet::__jet(data, out, global); - delete jet; + delete jet; + global.dump(); std::cout << "----------------------" << std::endl; global.outputHeaders(); std::cout << out;