#include "__set.h"
#include "Exception.h"
#include <iostream>

namespace jet {
   
   __set::__set(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, Tag *local) : Tag(in, parentOut, global, parent, local) {
      output = false;
      if(!keywordDefined("name"))
	throw coreutils::Exception("set tag must have name defined.");
      if(!keywordDefined("expr") && keywordDefined("value") && hasContainer)
	throw coreutils::Exception("set tag cannot have both value and a container.");
      if(keywordDefined("expr") && !keywordDefined("value") && hasContainer)
	throw coreutils::Exception("set tag cannot have both expr and a container.");
      if(keywordDefined("expr") && keywordDefined("value") && !hasContainer)
	throw coreutils::Exception("set tag cannot have both expr and value.");
      if(!keywordDefined("expr") && !keywordDefined("value") && !hasContainer)
	throw coreutils::Exception("set tag must have a value, expr or a container.");
      if(keywordDefined("expr") && keywordDefined("eval"))
	throw coreutils::Exception("Cannot use eval with expr.");

      storeVariable(resolveKeyword("name"));
           
   }
   
}
