Fixed for tag.
This commit is contained in:
1 parent
d10ed783fa
commit
dd5768ea66
20 files changed
+199
-78
No files matched your search
@@ -1,20 +1,34 @@
|
||||
#include "__set.h"
|
||||
#include "Exception.h"
|
||||
#include "Expression.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace jet {
|
||||
|
||||
__set::__set(coreutils::ZString &in, coreutils::MString &out, Global &global) : Tag(in, out, global) {
|
||||
__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("value") && hasContainer)
|
||||
if(!variableDefined("expr") && variableDefined("value") && hasContainer)
|
||||
throw coreutils::Exception("set tag cannot have both value and a container.");
|
||||
if(!variableDefined("value") && !hasContainer)
|
||||
throw coreutils::Exception("set tag must have a value or a container.");
|
||||
if(variableDefined("expr") && !variableDefined("value") && hasContainer)
|
||||
throw coreutils::Exception("set tag cannot have both expr and a container.");
|
||||
if(variableDefined("expr") && variableDefined("value") && !hasContainer)
|
||||
throw coreutils::Exception("set tag cannot have both expr and value.");
|
||||
if(!variableDefined("expr") && !variableDefined("value") && !hasContainer)
|
||||
throw coreutils::Exception("set tag must have a value, expr or a container.");
|
||||
if(!variableDefined("scope") || (variables["scope"] == "global")) {
|
||||
if(hasContainer) {
|
||||
global.variables[variables["name"]] = container.parsed();
|
||||
if(variableDefined("expr")) {
|
||||
if(variableDefined("eval"))
|
||||
throw coreutils::Exception("Cannot use eval with expr.");
|
||||
global.variables[variables["name"]] = Expression(variables["expr"]);
|
||||
} else if(hasContainer) {
|
||||
if(evaluate) {
|
||||
global.variables[variables["name"]] = out;
|
||||
} else {
|
||||
global.variables[variables["name"]] = container;
|
||||
}
|
||||
} else
|
||||
global.variables[variables["name"]] = variables["value"];
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user