Initial coding of <include> tag. Hass issues.

This commit is contained in:
Brad Arant 2024-10-22 09:16:59 -07:00
parent 12b3542231
commit b837c38c2a
7 changed files with 46 additions and 0 deletions

View File

@ -9,6 +9,7 @@
#include "__for.h"
#include "__if.h"
#include "__ifrow.h"
#include "__include.h"
#include "__read.h"
#include "__write.h"
#include "__set.h"
@ -132,6 +133,9 @@ namespace jet {
} else if(ifTagName(in, "ifrow")) {
__ifrow _ifrow(in, out, global);
continue;
} else if(ifTagName(in, "include")) {
__include _include(in, out, global);
continue;
} else if(ifTagName(in, "jet")) {
__jet _jet(in, out, global);
continue;

17
__include.cpp Normal file
View File

@ -0,0 +1,17 @@
#include "__include.h"
#include "Exception.h"
#include "File.h"
namespace jet {
__include::__include(coreutils::ZString &in, coreutils::MString &out, Global &global) : Tag(in, out, global) {
if(!variableDefined("file"))
throw coreutils::Exception("file keyword must be specified.");
if(hasContainer)
throw coreutils::Exception("include tag should not have a container.");
coreutils::File file(file);
container = file.asZString();
processContainer(container);
}
}

17
__include.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef ____include_h__
#define ____include_h__
#include "Tag.h"
namespace jet {
class __include : public Tag {
public:
__include(coreutils::ZString &in, coreutils::MString &out, Global &global);
};
}
#endif

BIN
jet-2.0

Binary file not shown.

4
test1.jet Executable file
View File

@ -0,0 +1,4 @@
#!./jet-2.0
<jet>
This is output
</jet>

2
testinclude.jet Normal file
View File

@ -0,0 +1,2 @@
This is from an include tag.
<set name="include" value="yes" />

View File

@ -39,6 +39,8 @@
<set name="noeval" eval="no">this is the value store in #[name].</set>
<set name="thename" eval="yes">this is the value store in #[name].</set>
<set name="newname" scope="global">another container value</set>
<xinclude file="./testinclude.jet" />
include: $[include]
>>>$[noeval]<<<
>>>$[thename]<<<
<set name="iz" value="data" />