25 lines
836 B
C++
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 {
|
|
|
|
}
|
|
}
|
|
}
|