diff --git a/Tag.cpp b/Tag.cpp index dcc2100..00a0ce3 100644 --- a/Tag.cpp +++ b/Tag.cpp @@ -51,7 +51,7 @@ namespace jet { if(!finished) { coreutils::ZString keywordName = in.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"); if(in.ifNext("=\"")) { - variables[keywordName] = KeywordValue(in.getTokenExclude("\""), global, parent->variables); + variables[keywordName] = in.getTokenExclude("\""); } if(!in.ifNext("\"")) {} } @@ -91,7 +91,7 @@ namespace jet { } else if(variables["eval"] == "no") { evaluate = false; } else - throw coreutils::Exception("Keyword 'eval' must be 'yes' or 'no'."); + throw coreutils::Exception("keyword 'eval' must be 'yes' or 'no'."); } } } else @@ -106,6 +106,10 @@ namespace jet { copyContainer(container, parentOut); } + void Tag::resolveKeyword(coreutils::ZString keyword) { + variables[keyword] = KeywordValue(variables[keyword], global, variables); + } + void Tag::processContainer(coreutils::ZString &container, coreutils::ZString container2) { if(hasContainer && evaluate) parseContainer(container, container2); diff --git a/Tag.h b/Tag.h index b95bf2e..4b96f78 100644 --- a/Tag.h +++ b/Tag.h @@ -14,6 +14,7 @@ namespace jet { Tag(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, coreutils::ZString splitTagName = ""); virtual ~Tag(); + void resolveKeyword(coreutils::ZString keyword); std::map variables; coreutils::ZString name; coreutils::ZString container; diff --git a/__jet.cpp b/__jet.cpp index 79c7947..276ca36 100644 --- a/__jet.cpp +++ b/__jet.cpp @@ -10,6 +10,11 @@ namespace jet { if(requestMethod == "POST") { coreutils::ZString contentLength(getenv("CONTENT_LENGTH")); coreutils::ZString contentType(getenv("CONTENT_TYPE")); + + + + + if(contentType == "multipart/form-data") std::cout << "output multipart variables to global" << std::endl; else if(contentType == "application/x-www-form-urlencoded") diff --git a/__set.cpp b/__set.cpp index 1292738..d67f5da 100644 --- a/__set.cpp +++ b/__set.cpp @@ -1,6 +1,7 @@ #include "__set.h" #include "Exception.h" #include "Operand.h" +#include "KeywordValue.h" #include namespace jet { @@ -20,7 +21,10 @@ namespace jet { if(variableDefined("expr") && variableDefined("eval")) throw coreutils::Exception("Cannot use eval with expr."); - if(variableDefined("expr")) { + resolveKeyword("name"); + + if(variableDefined("expr")) { + resolveKeyword("eval"); if(!variableDefined("scope") || (variables["scope"] == "global")) global.variables[variables["name"]] = Operand(variables["expr"]).string; else if(variables["scope"] == "local") @@ -44,7 +48,8 @@ namespace jet { else if(variables["scope"] == "parent") parent->parent->variables[variables["name"]] = container; } - } else { + } else { + resolveKeyword("value"); if(!variableDefined("scope") || (variables["scope"] == "global")) global.variables[variables["name"]] = variables["value"]; else if(variables["scope"] == "local") diff --git a/tests/testvar.jet b/tests/testvar.jet index 39d4ecc..7fecba4 100755 --- a/tests/testvar.jet +++ b/tests/testvar.jet @@ -1,12 +1,10 @@ #!../jet-2.0 - - + - + -$[$test] $[$[ix]var$[ix]] $[var$[ix]] $[var$[ix]var] @@ -14,4 +12,4 @@ $[var$[i$[letterx]]var] $[letterx;TOHEX] $[var$[i$[letterx]]$[ix]] $[var$[i$[letterx]]$[i$[letterx]]] - +