JetCore/__while.cpp
2024-02-16 15:44:03 -08:00

34 lines
1.1 KiB
C++

#include "__while.h"
#include "Exception.h"
#include <iostream>
namespace jet {
__while::__while(coreutils::ZString &in, coreutils::MString &out, Global &global) : Tag(in, out, global) {
if(variableDefined(coreutils::ZString("value1"))) {
if(variableDefined(coreutils::ZString("expr")))
throw coreutils::Exception("Either value1 or expr can be specified but not both.");
if(variableDefined(coreutils::ZString("value2"))) {
if(variableDefined(coreutils::ZString("type"))) {
// process here
} else
throw coreutils::Exception("type expected if value1 and value2 specified.");
} else
throw coreutils::Exception("value2 required if value1 specified.");
} else if(variableDefined(coreutils::ZString("expr"))) {
if(variableDefined(coreutils::ZString("value2")))
throw coreutils::Exception("value2 should not be specified with expr.");
if(variableDefined(coreutils::ZString("type")))
throw coreutils::Exception("type should not be specified with expr.");
// process here
}
while(true) {
parseContainer(container);
}
}
}