JetCore/__if.cpp
2024-02-14 10:58:57 -08:00

38 lines
1.1 KiB
C++

#include "__if.h"
#include "Exception.h"
#include <iostream>
#include "Expression.h"
namespace jet {
__if::__if(coreutils::ZString &in, coreutils::MString &out) : Tag(in, out) {
coreutils::MString result;
if(keywordExists("value1")) {
if(keywordExists("expr"))
throw coreutils::Exception("Either value1 or expr can be specified but not both.");
if(keywordExists("value2")) {
if(keywordExists("type")) {
} else
throw coreutils::Exception("type expected if value1 and value2 specified.");
} else
throw coreutils::Exception("value2 required if value1 specified.");
} else if(keywordExists("expr")) {
if(keywordExists("value2"))
throw coreutils::Exception("value2 should not be specified with expr.");
if(keywordExists("type"))
throw coreutils::Exception("type should not be specified with expr.");
result = Expression(keywords["expr"]);
std::cout << "result1: " << result << std::endl;
}
std::cout << "result2: " << result << std::endl;
if(result.boolValue()) {
parseContainer(container);
}
}
}