diff --git a/Tag.cpp b/Tag.cpp index 296ed1f..4ebf4f6 100644 --- a/Tag.cpp +++ b/Tag.cpp @@ -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; diff --git a/__include.cpp b/__include.cpp new file mode 100644 index 0000000..be3b249 --- /dev/null +++ b/__include.cpp @@ -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); + } + +} diff --git a/__include.h b/__include.h new file mode 100644 index 0000000..63363b8 --- /dev/null +++ b/__include.h @@ -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 diff --git a/jet-2.0 b/jet-2.0 index 50831b3..1700e06 100755 Binary files a/jet-2.0 and b/jet-2.0 differ diff --git a/test1.jet b/test1.jet new file mode 100755 index 0000000..bddbd46 --- /dev/null +++ b/test1.jet @@ -0,0 +1,4 @@ +#!./jet-2.0 + +This is output + diff --git a/testinclude.jet b/testinclude.jet new file mode 100644 index 0000000..c1a12cc --- /dev/null +++ b/testinclude.jet @@ -0,0 +1,2 @@ +This is from an include tag. + diff --git a/testjet.jet b/testjet.jet index 78fbacd..d06ead7 100755 --- a/testjet.jet +++ b/testjet.jet @@ -39,6 +39,8 @@ this is the value store in #[name]. this is the value store in #[name]. another container value + + include: $[include] >>>$[noeval]<<< >>>$[thename]<<<