CEvaluationNode* CEvaluationNodeNormalizer::normalizeCEvaluationNodeDelay(const CEvaluationNodeDelay* pNode) { CEvaluationNodeDelay* pResult = NULL; if (pNode != NULL) { CEvaluationNode* pTmpResult = NULL; switch ((CEvaluationNodeDelay::SubType)CEvaluationNode::subType(pNode->getType())) { case CEvaluationNodeDelay::INVALID: break; case CEvaluationNodeDelay::DELAY: pResult = new CEvaluationNodeDelay((CEvaluationNodeDelay::SubType)CEvaluationNode::subType(pNode->getType()), pNode->getData()); pTmpResult = CEvaluationNodeNormalizer::normalize(dynamic_cast<const CEvaluationNode*>(pNode->getChild())); if (pTmpResult != NULL) { pResult->addChild(pTmpResult); pTmpResult = CEvaluationNodeNormalizer::normalize(dynamic_cast<const CEvaluationNode*>(pNode->getChild()->getSibling())); if (pTmpResult != NULL) { pResult->addChild(pTmpResult); } else { delete pResult; pResult = NULL; } } else { delete pResult; pResult = NULL; } break; } if (pResult == NULL) { pResult = static_cast<CEvaluationNodeDelay*>(pNode->copyBranch()); } } return pResult; }
CEvaluationNode* CEvaluationNodeDelay::createNodeFromASTTree(const ASTNode& node) { SubType subType = CEvaluationNodeDelay::DELAY; std::string data = "delay"; CEvaluationNodeDelay* pConvertedNode = new CEvaluationNodeDelay(subType, data); unsigned int i, iMax = node.getNumChildren(); for (i = 0; i < iMax; ++i) { pConvertedNode->addChild(CEvaluationTree::convertASTNode(*node.getChild(i))); } pConvertedNode->compile(NULL); return pConvertedNode; }