Lines Matching refs:tree
41 static pANTLR3_COMMON_TOKEN getToken (pANTLR3_BASE_TREE tree);
42 static pANTLR3_BASE_TREE dupNode (pANTLR3_BASE_TREE tree);
43 static ANTLR3_BOOLEAN isNilNode (pANTLR3_BASE_TREE tree);
44 static ANTLR3_UINT32 getType (pANTLR3_BASE_TREE tree);
45 static pANTLR3_STRING getText (pANTLR3_BASE_TREE tree);
46 static ANTLR3_UINT32 getLine (pANTLR3_BASE_TREE tree);
47 static ANTLR3_UINT32 getCharPositionInLine (pANTLR3_BASE_TREE tree);
48 static pANTLR3_STRING toString (pANTLR3_BASE_TREE tree);
49 static pANTLR3_BASE_TREE getParent (pANTLR3_BASE_TREE tree);
50 static void setParent (pANTLR3_BASE_TREE tree, pANTLR3_BASE_TREE parent);
51 static void setChildIndex (pANTLR3_BASE_TREE tree, ANTLR3_INT32 i);
52 static ANTLR3_INT32 getChildIndex (pANTLR3_BASE_TREE tree);
53 static void createChildrenList (pANTLR3_BASE_TREE tree);
54 static void reuse (pANTLR3_BASE_TREE tree);
60 static pANTLR3_BASE_TREE newFromTree (pANTLR3_ARBORETUM factory, pANTLR3_COMMON_TREE tree);
156 pANTLR3_COMMON_TREE tree; in newPoolTree() local
160 tree = factory->nilStack->peek(factory->nilStack); in newPoolTree()
162 if (tree != NULL) in newPoolTree()
170 return (pANTLR3_BASE_TREE)tree; in newPoolTree()
185 tree = factory->pools[factory->thisPool] + factory->nextTree; in newPoolTree()
190 antlr3SetCTAPI(tree); in newPoolTree()
195 tree->factory = factory; in newPoolTree()
196 tree->baseTree.strFactory = factory->unTruc.baseTree.strFactory; in newPoolTree()
203 tree->baseTree.super = tree; in newPoolTree()
208 return &(tree->baseTree); in newPoolTree()
213 newFromTree(pANTLR3_ARBORETUM factory, pANTLR3_COMMON_TREE tree) in newFromTree() argument
226 ((pANTLR3_COMMON_TREE)(newTree->super))->token = tree->token; in newFromTree()
227 newTree->u = tree->baseTree.u; // Copy any user pointer in newFromTree()
289 antlr3SetCTAPI(pANTLR3_COMMON_TREE tree) in antlr3SetCTAPI() argument
293 antlr3BaseTreeNew(&(tree->baseTree)); in antlr3SetCTAPI()
299 tree->baseTree.super = tree; in antlr3SetCTAPI()
303 tree->baseTree.isNilNode = isNilNode; in antlr3SetCTAPI()
304 tree->baseTree.toString = toString; in antlr3SetCTAPI()
305 tree->baseTree.dupNode = (void *(*)(pANTLR3_BASE_TREE))(dupNode); in antlr3SetCTAPI()
306 tree->baseTree.getLine = getLine; in antlr3SetCTAPI()
307 tree->baseTree.getCharPositionInLine = getCharPositionInLine; in antlr3SetCTAPI()
308 tree->baseTree.toString = toString; in antlr3SetCTAPI()
309 tree->baseTree.getType = getType; in antlr3SetCTAPI()
310 tree->baseTree.getText = getText; in antlr3SetCTAPI()
311 tree->baseTree.getToken = getToken; in antlr3SetCTAPI()
312 tree->baseTree.getParent = getParent; in antlr3SetCTAPI()
313 tree->baseTree.setParent = setParent; in antlr3SetCTAPI()
314 tree->baseTree.setChildIndex = setChildIndex; in antlr3SetCTAPI()
315 tree->baseTree.getChildIndex = getChildIndex; in antlr3SetCTAPI()
316 tree->baseTree.createChildrenList = createChildrenList; in antlr3SetCTAPI()
317 tree->baseTree.reuse = reuse; in antlr3SetCTAPI()
318 tree->baseTree.free = NULL; // Factory trees have no free function in antlr3SetCTAPI()
319 tree->baseTree.u = NULL; // Initialize user pointer in antlr3SetCTAPI()
321 tree->baseTree.children = NULL; in antlr3SetCTAPI()
323 tree->token = NULL; // No token as yet in antlr3SetCTAPI()
324 tree->startIndex = 0; in antlr3SetCTAPI()
325 tree->stopIndex = 0; in antlr3SetCTAPI()
326 tree->parent = NULL; // No parent yet in antlr3SetCTAPI()
327 tree->childIndex = -1; in antlr3SetCTAPI()
339 pANTLR3_COMMON_TREE tree; in antlr3CommonTreeNew() local
340 tree = ANTLR3_CALLOC(1, sizeof(ANTLR3_COMMON_TREE)); in antlr3CommonTreeNew()
342 if (tree == NULL) in antlr3CommonTreeNew()
347 antlr3SetCTAPI(tree); in antlr3CommonTreeNew()
349 return tree; in antlr3CommonTreeNew()
374 createChildrenList (pANTLR3_BASE_TREE tree) in createChildrenList() argument
376 …tree->children = ((pANTLR3_COMMON_TREE)(tree->super))->factory->vFactory->newVector(((pANTLR3_COMM… in createChildrenList()
381 getToken (pANTLR3_BASE_TREE tree) in getToken() argument
389 return ((pANTLR3_COMMON_TREE)(tree->super))->token; in getToken()
393 dupNode (pANTLR3_BASE_TREE tree) in dupNode() argument
400 theOld = (pANTLR3_COMMON_TREE)(tree->super); in dupNode()
408 isNilNode (pANTLR3_BASE_TREE tree) in isNilNode() argument
412 if (((pANTLR3_COMMON_TREE)(tree->super))->token == NULL) in isNilNode()
423 getType (pANTLR3_BASE_TREE tree) in getType() argument
427 theTree = (pANTLR3_COMMON_TREE)(tree->super); in getType()
440 getText (pANTLR3_BASE_TREE tree) in getText() argument
442 return tree->toString(tree); in getText()
445 static ANTLR3_UINT32 getLine (pANTLR3_BASE_TREE tree) in getLine() argument
450 cTree = (pANTLR3_COMMON_TREE)(tree->super); in getLine()
456 if (tree->getChildCount(tree) > 0) in getLine()
460 child = (pANTLR3_BASE_TREE)tree->getChild(tree, 0); in getLine()
468 static ANTLR3_UINT32 getCharPositionInLine (pANTLR3_BASE_TREE tree) in getCharPositionInLine() argument
472 token = ((pANTLR3_COMMON_TREE)(tree->super))->token; in getCharPositionInLine()
476 if (tree->getChildCount(tree) > 0) in getCharPositionInLine()
480 child = (pANTLR3_BASE_TREE)tree->getChild(tree, 0); in getCharPositionInLine()
489 static pANTLR3_STRING toString (pANTLR3_BASE_TREE tree) in toString() argument
491 if (tree->isNilNode(tree) == ANTLR3_TRUE) in toString()
495 nilNode = tree->strFactory->newPtr(tree->strFactory, (pANTLR3_UINT8)"nil", 3); in toString()
500 …return ((pANTLR3_COMMON_TREE)(tree->super))->token->getText(((pANTLR3_COMMON_TREE)(tree->super))->… in toString()
504 getParent (pANTLR3_BASE_TREE tree) in getParent() argument
506 return & (((pANTLR3_COMMON_TREE)(tree->super))->parent->baseTree); in getParent()
510 setParent (pANTLR3_BASE_TREE tree, pANTLR3_BASE_TREE parent) in setParent() argument
512 …((pANTLR3_COMMON_TREE)(tree->super))->parent = parent == NULL ? NULL : ((pANTLR3_COMMON_TREE)(pare… in setParent()
516 setChildIndex (pANTLR3_BASE_TREE tree, ANTLR3_INT32 i) in setChildIndex() argument
518 ((pANTLR3_COMMON_TREE)(tree->super))->childIndex = i; in setChildIndex()
521 getChildIndex (pANTLR3_BASE_TREE tree ) in getChildIndex() argument
523 return ((pANTLR3_COMMON_TREE)(tree->super))->childIndex; in getChildIndex()
530 reuse (pANTLR3_BASE_TREE tree) in reuse() argument
534 cTree = (pANTLR3_COMMON_TREE)(tree->super); in reuse()
544 cTree->factory->nilStack->push(cTree->factory->nilStack, tree, NULL); in reuse()