Moved keywords from local variables to keywords map.

This commit is contained in:
brad Arant committed 2025-01-02 16:43:53 -08:00
1 parent 907f449ecc
commit 9622b5cf8c
23 files changed
+221 -220

No files matched your search

+11 -11
View File
@@ -8,31 +8,31 @@ namespace jet {
__cookie::__cookie(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, Tag *local) : Tag(in, parentOut, global, parent, local) {
output = false;
if(!variableDefined("name"))
if(!keywordDefined("name"))
throw coreutils::Exception("header tag must have name defined.");
if(!variableDefined("expr") && variableDefined("value") && hasContainer)
if(!keywordDefined("expr") && keywordDefined("value") && hasContainer)
throw coreutils::Exception("header tag cannot have both value and a container.");
if(variableDefined("expr") && !variableDefined("value") && hasContainer)
if(keywordDefined("expr") && !keywordDefined("value") && hasContainer)
throw coreutils::Exception("header tag cannot have both expr and a container.");
if(variableDefined("expr") && variableDefined("value") && !hasContainer)
if(keywordDefined("expr") && keywordDefined("value") && !hasContainer)
throw coreutils::Exception("header tag cannot have both expr and value.");
if(!variableDefined("expr") && !variableDefined("value") && !hasContainer)
if(!keywordDefined("expr") && !keywordDefined("value") && !hasContainer)
throw coreutils::Exception("header tag must have a value, expr or a container.");
resolveKeyword("name");
if(variableDefined("expr")) {
if(variableDefined("eval"))
if(keywordDefined("expr")) {
if(keywordDefined("eval"))
throw coreutils::Exception("Cannot use eval with expr.");
global.headers[variables["name"]] = Operand(variables["expr"], global, parent->variables).string;
global.headers[keywords["name"]] = Operand(keywords["expr"], global, parent->variables).string;
} else if(hasContainer) {
processContainer(container);
if(evaluate) {
global.headers[variables["name"]] = out;
global.headers[keywords["name"]] = out;
} else {
global.headers[variables["name"]] = container;
global.headers[keywords["name"]] = container;
}
} else {
resolveKeyword("value");
global.headers[variables["Set-Cookie"]] = variables["value"];
global.headers[keywords["Set-Cookie"]] = keywords["value"];
}
}
}