Finished up the keyword resolution issue and fixed for, while and until. Other tags still need work.

This commit is contained in:
brad Arant committed 2024-11-10 18:45:12 -08:00
1 parent 93a520f152
commit 6da620971e
8 files changed
+61 -47

No files matched your search

+15 -11
View File
@@ -5,20 +5,24 @@
namespace jet {
__for::__for(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent) : Tag(in, parentOut, global, parent) {
double counter = 0.0f;
double end = 0.0f;
double step = 0.0f;
double counter = 0.0f;
bool nameDefined = variableDefined("name");
if(variableDefined(coreutils::ZString("start"))) {
if(variableDefined("start")) {
resolveKeyword("start");
counter = variables["start"].asDouble();
variables["start"].reset();
}
if(variableDefined(coreutils::ZString("end"))) {
end = variables["end"].asDouble();
}
if(variableDefined(coreutils::ZString("step"))) {
step = variables["step"].asDouble();
}
for(double ix = counter; ix <= end; ix += step) {
if(variableDefined("end"))
resolveKeyword("end");
else
throw coreutils::Exception("for tag requires end keyword.");
if(variableDefined("step"))
resolveKeyword("step");
else
throw coreutils::Exception("for tag requires step keyword.");
for(double ix = counter; ix <= variables["end"].asDouble(); ix += variables["step"].asDouble()) {
variables["end"].reset();
variables["step"].reset();
if(nameDefined)
variables[variables["name"]] = ix;
processContainer(container);