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(); Global();
virtual ~Global(); virtual ~Global();
void dump();
std::map<coreutils::MString, coreutils::MString> variables; std::map<coreutils::MString, coreutils::MString> variables;
}; };

View File

@ -61,12 +61,13 @@ namespace jet {
} }
Tag::~Tag() { Tag::~Tag() {
if(evaluate) { if(evaluate)
if(output)
copyContainer(out, parent); copyContainer(out, parent);
} else { else
if(output)
copyContainer(container, parent); copyContainer(container, parent);
} }
}
void Tag::parseContainer(coreutils::ZString &in) { void Tag::parseContainer(coreutils::ZString &in) {
char *start = in.getCursor(); char *start = in.getCursor();

3
Tag.h
View File

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

View File

@ -5,20 +5,14 @@
namespace jet { namespace jet {
__set::__set(coreutils::ZString &in, coreutils::MString &out, Global &global) : Tag(in, out, global) { __set::__set(coreutils::ZString &in, coreutils::MString &out, Global &global) : Tag(in, out, global) {
std::cout << "name: [" << variables["name"] << "]" << std::endl; output = false;
std::cout << "value: [" << variables["value"] << "]" << std::endl;
std::cout << "container: [" << container << "]" << std::endl;
std::cout << "scope: [" << variables["scope"] << "]" << std::endl;
if(variables["scope"] == "local") if(variables["scope"] == "local")
variables[variables["name"]] = variables["value"]; variables[variables["name"]] = variables["value"];
if(variables["scope"] == "global") if(variables["scope"] == "global")
global.variables[variables["name"]] = container; global.variables[variables["name"]] = container;
std::cout << "localvar: [" << variables.size() << "]" << std::endl; global.dump();
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.