virtual void Visit( IqParseNode& node) { IqParseNode* child = static_cast<IqParseNode*>( node.GetInterface(ParseNode_Base))->pChild(); while(child != NULL) { child->Accept(*this); child = child->pNextSibling(); } }
void CqParseTreeViz::visitChildren(T& node) { IqParseNode* child = static_cast<IqParseNode*>( node.GetInterface(ParseNode_Base))->pChild(); while(child != NULL) { makeEdge(node, *child); child->Accept(*this); child = child->pNextSibling(); } }
void CqParseTreeViz::Visit(IqParseNodeTypeCast& node) { setNodeProperty(node, "fillcolor", typeCastColor); setNodeProperty(node, "shape", "box"); IqParseNode* operand = static_cast<IqParseNode*>( node.GetInterface(ParseNode_Base))->pChild(); const char* pstrToType = gVariableTypeNames[node.CastTo() & Type_Mask]; const char* pstrFromType = gVariableTypeNames[operand->ResType() & Type_Mask]; setNodeProperty(node, "label", boost::format("%s<-\\n<-%s") % pstrToType % pstrFromType); visitChildren(node); }
void CqParseTreeViz::Visit(IqParseNodeShader& node) { setNodeProperty(node, "label", boost::format( "{%s shader \\\"%s\\\" | {<args> args | <code> code } }") % node.strShaderType() % node.strName()); setNodeProperty(node, "fillcolor", functionColor); setNodeProperty(node, "shape", "record"); IqParseNode* code = static_cast<IqParseNode*>( node.GetInterface(ParseNode_Base))->pChild(); if(code) { IqParseNode* args = code->pNextSibling(); if(args) { makeEdge(node, *args, "args"); args->Accept(*this); } makeEdge(node, *code, "code"); code->Accept(*this); } }