diff --git a/Global.cpp b/Global.cpp index 46f4a98..c580ae2 100644 --- a/Global.cpp +++ b/Global.cpp @@ -37,6 +37,13 @@ namespace jet { sessions.erase(sessionId); } + coreutils::MString& Global::processModifier(coreutils::MString &value, coreutils::MString &modifier) { + if(modifier.getLength() == 0) + return value; + lastConverted = modifier; + return lastConverted; + } + coreutils::ZString Global::getVariable(coreutils::ZString &variable, std::map &lvariables) { if(variable.ifNext("$[")) { coreutils::MString name; @@ -54,8 +61,9 @@ namespace jet { } else { renderVariableName(variable, name, modifier, lvariables); name.split("."); - if(name.getList().size() == 1) - return variables[name[0]]; + if(name.getList().size() == 1) { + return processModifier(variables[name[0]], modifier); + } return getSessionVariable(name); } throw coreutils::Exception("expected variable name or type designator."); diff --git a/Global.h b/Global.h index dcb147f..9a055e3 100644 --- a/Global.h +++ b/Global.h @@ -18,6 +18,7 @@ namespace jet { bool sessionExists(coreutils::MString sessionId); void addSession(coreutils::MString sessionId, __mysql *mysql); void removeSession(coreutils::MString sessionId); + coreutils::MString& processModifier(coreutils::MString &value, coreutils::MString &modifier); coreutils::ZString getVariable(coreutils::ZString &variable, std::map &lvariables); void renderVariableName(coreutils::ZString &variable, coreutils::MString &name, coreutils::MString &modifier, std::map &lvariables); __mysql * getSession(coreutils::MString sessionId); @@ -29,6 +30,7 @@ namespace jet { std::map sessions; std::map headers; std::map tags; + coreutils::MString lastConverted; }; diff --git a/tests/testvar.jet b/tests/testvar.jet index 93445ab..568cc11 100755 --- a/tests/testvar.jet +++ b/tests/testvar.jet @@ -8,7 +8,7 @@ -$[$[ix]var$[ix]] +$[$[ix]var$[ix];binary] $[var$[ix]] $[var$[ix]var] $[var$[i$[letterx]]var]