当前位置: 首页>>代码示例>>C++>>正文


C++ pANTLR3_BASE_TREE::createChildrenList方法代码示例

本文整理汇总了C++中pANTLR3_BASE_TREE::createChildrenList方法的典型用法代码示例。如果您正苦于以下问题:C++ pANTLR3_BASE_TREE::createChildrenList方法的具体用法?C++ pANTLR3_BASE_TREE::createChildrenList怎么用?C++ pANTLR3_BASE_TREE::createChildrenList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pANTLR3_BASE_TREE的用法示例。


在下文中一共展示了pANTLR3_BASE_TREE::createChildrenList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

static    void
setChild	(pANTLR3_BASE_TREE tree, ANTLR3_UINT32 i, void * child)
{
	if	(tree->children == NULL)
	{
		tree->createChildrenList(tree);
	}
	tree->children->set(tree->children, i, child, NULL, ANTLR3_FALSE);
}
开发者ID:10114395,项目名称:android-5.0.0_r5,代码行数:9,代码来源:antlr3basetree.c

示例2: freshenPACIndexesAll

void	    
addChild (pANTLR3_BASE_TREE tree, pANTLR3_BASE_TREE child)
{
	ANTLR3_UINT32   n;
	ANTLR3_UINT32   i;

	if	(child == NULL)
	{
		return;
	}

	if	(child->isNilNode(child) == ANTLR3_TRUE)
	{
		if  (child->children != NULL && child->children == tree->children)
		{
			// TODO: Change to exception rather than ANTLR3_FPRINTF?
			//
			ANTLR3_FPRINTF(stderr, "ANTLR3: An attempt was made to add a child list to itself!\n");
			return;
		}

        // Add all of the children's children to this list
        //
        if (child->children != NULL)
        {
            if (tree->children == NULL)
            {
                // We are build ing the tree structure here, so we need not
                // worry about duplication of pointers as the tree node
                // factory will only clean up each node once. So we just
                // copy in the child's children pointer as the child is
                // a nil node (has not root itself).
                //
                tree->children = child->children;
                child->children = NULL;
                freshenPACIndexesAll(tree);
                
            }
            else
            {
                // Need to copy the children
                //
                n = child->children->size(child->children);

                for (i = 0; i < n; i++)
                {
                    pANTLR3_BASE_TREE entry;
                    entry = child->children->get(child->children, i);

                    // ANTLR3 lists can be sparse, unlike Array Lists
                    //
                    if (entry != NULL)
                    {
                        tree->children->add(tree->children, entry, (void (ANTLR3_CDECL *) (void *))child->free);
                    }
                }
            }
		}
	}
	else
	{
		// Tree we are adding is not a Nil and might have children to copy
		//
		if  (tree->children == NULL)
		{
			// No children in the tree we are adding to, so create a new list on
			// the fly to hold them.
			//
			tree->createChildrenList(tree);
		}

		tree->children->add(tree->children, child, (void (ANTLR3_CDECL *)(void *))child->free);
		
	}
}
开发者ID:10114395,项目名称:android-5.0.0_r5,代码行数:75,代码来源:antlr3basetree.c


注:本文中的pANTLR3_BASE_TREE::createChildrenList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。