continued development

This commit is contained in:
Brad Arant 2024-02-16 20:16:14 -08:00
parent 50270bbc91
commit 3d98448ec4
6 changed files with 20 additions and 17 deletions

View File

@ -11,4 +11,9 @@ namespace jet {
}
void Global::dump() {
for (auto i = variables.begin(); i != variables.end(); i++)
std::cout << i->first << "=[" << i->second << "]" << std::endl;
}
}

View File

@ -12,6 +12,8 @@ namespace jet {
Global();
virtual ~Global();
void dump();
std::map<coreutils::MString, coreutils::MString> variables;
};

11
Tag.cpp
View File

@ -61,11 +61,12 @@ namespace jet {
}
Tag::~Tag() {
if(evaluate) {
copyContainer(out, parent);
} else {
copyContainer(container, parent);
}
if(evaluate)
if(output)
copyContainer(out, parent);
else
if(output)
copyContainer(container, parent);
}
void Tag::parseContainer(coreutils::ZString &in) {

3
Tag.h
View File

@ -18,11 +18,12 @@ namespace jet {
protected:
bool hasContainer;
std::map<coreutils::ZString, coreutils::ZString> variables;
std::map<coreutils::ZString, coreutils::MString> variables;
bool variableDefined(coreutils::ZString variable);
void parseContainer(coreutils::ZString &in);
void copyContainer(coreutils::ZString &in, coreutils::MString &out);
bool output = true;
bool evaluate = true;
bool filterBlankLines = false;
bool trim = false;

View File

@ -4,21 +4,15 @@
namespace jet {
__set::__set(coreutils::ZString &in, coreutils::MString &out, Global &global) : Tag(in, out, global) {
std::cout << "name: [" << variables["name"] << "]" << std::endl;
std::cout << "value: [" << variables["value"] << "]" << std::endl;
std::cout << "container: [" << container << "]" << std::endl;
std::cout << "scope: [" << variables["scope"] << "]" << std::endl;
__set::__set(coreutils::ZString &in, coreutils::MString &out, Global &global) : Tag(in, out, global) {
output = false;
if(variables["scope"] == "local")
variables[variables["name"]] = variables["value"];
if(variables["scope"] == "global")
if(variables["scope"] == "global")
global.variables[variables["name"]] = container;
global.dump();
std::cout << "localvar: [" << variables.size() << "]" << std::endl;
std::cout << "localvarx: [" << variables[variables["name"]] << "]" << std::endl;
std::cout << "globalvar: [" << global.variables.size() << "]" << std::endl;
std::cout << "globalvarx: [" << global.variables[variables["name"]] << "]" << std::endl;
}
}

BIN
testjet

Binary file not shown.