Пример #1
0
void SE_ElementManager::handleXmlChild(SE_Element* parent, TiXmlNode* currNode, unsigned int indent)
{
    if(!currNode)
        return;
    TiXmlNode* pChild;
    TiXmlText* pText;
    int t = currNode->Type();
    int num = 0;
    switch(t)
    {
    case TiXmlNode::TINYXML_DOCUMENT:
        LOGI("...Document\n");
        for(pChild = currNode->FirstChild() ; pChild != NULL ; pChild = pChild->NextSibling())
        {
            handleXmlChild(parent, pChild, indent + 1);
        }
        break;
    case TiXmlNode::TINYXML_ELEMENT:
        LOGI("...Element[%s]\n", currNode->Value());
        handleElement(parent, currNode->Value(), currNode->ToElement(), indent + 1);
        break;
    case TiXmlNode::TINYXML_COMMENT:
        LOGI("...Comment:[%s]\n", currNode->Value());
        break;
    case TiXmlNode::TINYXML_TEXT:
        pText = currNode->ToText();
        LOGI("...Text: [%s]\n", pText->Value());
        handleText(parent, pText);
        break;
    case TiXmlNode::TINYXML_DECLARATION:
        LOGI("...Declaration\n");
        handleDeclaration(currNode->ToDeclaration());
        break;
    }
}
Пример #2
0
Node* handleDeclarationAssign(const std::string& name, TypeNode* type, ExpressionNode* expr)
{
    SequenceNode* seq = new SequenceNode;
    seq->pushNode(handleDeclaration(name, type));
    seq->pushNode(handleAssignment(name, expr));
    seq->setLocation(FileLocation(yylineno));
    return seq;
}
Пример #3
0
BaseExpression* Parser::handleType(string type_name)
{
	DragonType type = toDragonType(type_name);
	
	LexerToken identifier = mLexer->getToken();
	BaseExpression* expr = 0;
	
	switch (identifier.type) {
		case IDENTIFIER:
			expr = handleDeclaration(type, identifier.value);
			break;
		default:
			printf("Expected identifier after type %s", type_name.c_str());exit(0);
			break;
	}

	return expr;
}