JetCore/__set.cpp
2024-06-13 07:05:36 -07:00

25 lines
836 B
C++

#include "__set.h"
#include "Exception.h"
#include <iostream>
namespace jet {
__set::__set(coreutils::ZString &in, coreutils::MString &out, Global &global) : Tag(in, out, global) {
output = false;
if(!variableDefined("name"))
throw coreutils::Exception("set tag must have name defined.");
if(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("scope") || (variables["scope"] == "global")) {
if(hasContainer) {
global.variables[variables["name"]] = container.parsed();
} else
global.variables[variables["name"]] = variables["value"];
} else {
}
}
}