Almost done with tag tag.

This commit is contained in:
brad Arant 2024-10-27 19:22:40 -07:00
parent 8499199592
commit c1e003e552
7 changed files with 45 additions and 4 deletions

1
.#JetCore.txt Symbolic link
View File

@ -0,0 +1 @@
barant@barant01.5084

View File

@ -28,6 +28,7 @@ namespace jet {
std::map<coreutils::MString, coreutils::MString> cgiVariables; std::map<coreutils::MString, coreutils::MString> cgiVariables;
std::map<coreutils::MString, __mysql *> sessions; std::map<coreutils::MString, __mysql *> sessions;
std::map<coreutils::MString, coreutils::MString> headers; std::map<coreutils::MString, coreutils::MString> headers;
std::map<coreutils::MString, coreutils::MString> tags;
}; };

View File

@ -1,6 +1,7 @@
#include "Tag.h" #include "Tag.h"
#include "Exception.h" #include "Exception.h"
#include "KeywordValue.h" #include "KeywordValue.h"
#include "Global.h"
#include "Log.h" #include "Log.h"
#include "__mysql.h" #include "__mysql.h"
#include "__sql.h" #include "__sql.h"
@ -19,6 +20,7 @@
#include "__while.h" #include "__while.h"
#include "__header.h" #include "__header.h"
#include "__whiledir.h" #include "__whiledir.h"
#include "__tag.h"
#include <iostream> #include <iostream>
namespace jet { namespace jet {
@ -163,6 +165,12 @@ namespace jet {
} else if(ifTagName(in, "whiledir")) { } else if(ifTagName(in, "whiledir")) {
__whiledir _whiledir(in, out, global); __whiledir _whiledir(in, out, global);
continue; continue;
} else if(ifTagName(in, "tag")) {
__tag _tag(in, out, global);
continue;
} else if(tags.contains(in)) {
__tag _tag(in, out, global);
continue;
} else { } else {
out.write(in.charAt(0)); out.write(in.charAt(0));
in.nextChar(); in.nextChar();

14
__tag.cpp Normal file
View File

@ -0,0 +1,14 @@
#include "__tag.h"
#include "Exception.h"
namespace jet {
__tag::__tag(coreutils::ZString &in, coreutils::MString &parent, Global &global) : Tag(in, parent, global) {
if(!variableDefined("name"))
throw coreutils::Exception("tag must have a name.");
if(!hasContainer)
throw coreutils::Exception("tag requires a container to process.");
global.tags[variables["name"]] = container;
}
}

18
__tag.h Normal file
View File

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

BIN
jet-2.0

Binary file not shown.

View File

@ -11,13 +11,12 @@
--- ---
$[nonexistant] $[nonexistant]
$[%HOME] $[%HOME]
<comment> <mysql host="localhost" database="barant" user="barant" password="uversa" sessionid="1">
<mysql host="barant.com" database="barant" user="barant" password="uversa1960" sessionid="1">
<sql sessionid="1">select * from testdata</sql> <sql sessionid="1">select * from testdata</sql>
<whilerow name="index" count="10" sessionid="1"> <whilerow name="index" count="10" sessionid="1">
$[1.id] $[1.text] $[1.value] $[1.id] $[1.text] $[1.value]
</whilerow> </whilerow>
</comment> </mysql>
<set name="ix" value="1" /> <set name="ix" value="1" />
<set name="theexpr" expr="SUBSTRING('abcdefg', 5 - 4, 20 - 17)" /> <set name="theexpr" expr="SUBSTRING('abcdefg', 5 - 4, 20 - 17)" />
<set name="addition" expr="5+3" /> <set name="addition" expr="5+3" />