Lines Matching refs:ctns
43 static void addNavigationNode (pANTLR3_COMMON_TREE_NODE_STREAM ctns, ANTLR3_UINT32 ttype);
44 static ANTLR3_BOOLEAN hasUniqueNavigationNodes (pANTLR3_COMMON_TREE_NODE_STREAM ctns);
45 static pANTLR3_BASE_TREE newDownNode (pANTLR3_COMMON_TREE_NODE_STREAM ctns);
46 static pANTLR3_BASE_TREE newUpNode (pANTLR3_COMMON_TREE_NODE_STREAM ctns);
47 static void reset (pANTLR3_COMMON_TREE_NODE_STREAM ctns);
48 static void push (pANTLR3_COMMON_TREE_NODE_STREAM ctns, ANTLR3_INT32 index);
49 static ANTLR3_INT32 pop (pANTLR3_COMMON_TREE_NODE_STREAM ctns);
51 static ANTLR3_UINT32 getLookaheadSize (pANTLR3_COMMON_TREE_NODE_STREAM ctns);
79 static void fillBuffer (pANTLR3_COMMON_TREE_NODE_STREAM ctns, pANTLR3_BASE_TREE t);
80 static void fillBufferRoot (pANTLR3_COMMON_TREE_NODE_STREAM ctns);
85 static void antlr3CommonTreeNodeStreamFree (pANTLR3_COMMON_TREE_NODE_STREAM ctns);
223 stream->tnstream->ctns = stream; in antlr3CommonTreeNodeStreamNewStream()
365 stream->tnstream->ctns = stream; in antlr3CommonTreeNodeStreamNew()
420 static void antlr3CommonTreeNodeStreamFree (pANTLR3_COMMON_TREE_NODE_STREAM ctns) in antlr3CommonTreeNodeStreamFree() argument
427 if (ctns->isRewriter != ANTLR3_TRUE) in antlr3CommonTreeNodeStreamFree()
429 ctns->adaptor ->free (ctns->adaptor); in antlr3CommonTreeNodeStreamFree()
431 if (ctns->nodeStack != NULL) in antlr3CommonTreeNodeStreamFree()
433 ctns->nodeStack->free(ctns->nodeStack); in antlr3CommonTreeNodeStreamFree()
436 ANTLR3_FREE(ctns->INVALID_NODE.token); in antlr3CommonTreeNodeStreamFree()
437 ANTLR3_FREE(ctns->EOF_NODE.token); in antlr3CommonTreeNodeStreamFree()
438 ANTLR3_FREE(ctns->DOWN.token); in antlr3CommonTreeNodeStreamFree()
439 ANTLR3_FREE(ctns->UP.token); in antlr3CommonTreeNodeStreamFree()
442 if (ctns->nodes != NULL) in antlr3CommonTreeNodeStreamFree()
444 ctns->nodes ->free (ctns->nodes); in antlr3CommonTreeNodeStreamFree()
446 ctns->tnstream->istream ->free (ctns->tnstream->istream); in antlr3CommonTreeNodeStreamFree()
447 ctns->tnstream ->free (ctns->tnstream); in antlr3CommonTreeNodeStreamFree()
450 ANTLR3_FREE(ctns); in antlr3CommonTreeNodeStreamFree()
460 fillBufferRoot(pANTLR3_COMMON_TREE_NODE_STREAM ctns) in fillBufferRoot() argument
465 fillBuffer(ctns, ctns->root); in fillBufferRoot()
466 ctns->p = 0; // Indicate we are at buffer start in fillBufferRoot()
474 fillBuffer(pANTLR3_COMMON_TREE_NODE_STREAM ctns, pANTLR3_BASE_TREE t) in fillBuffer() argument
480 nilNode = ctns->adaptor->isNilNode(ctns->adaptor, t); in fillBuffer()
487 ctns->nodes->add(ctns->nodes, t, NULL); in fillBuffer()
497 ctns->addNavigationNode(ctns, ANTLR3_TOKEN_DOWN); in fillBuffer()
506 fillBuffer(ctns, ctns->adaptor->getChild(ctns->adaptor, t, c)); in fillBuffer()
514 ctns->addNavigationNode(ctns, ANTLR3_TOKEN_UP); in fillBuffer()
526 reset (pANTLR3_COMMON_TREE_NODE_STREAM ctns) in reset() argument
528 if (ctns->p != -1) in reset()
530 ctns->p = 0; in reset()
532 ctns->tnstream->istream->lastMarker = 0; in reset()
539 if (ctns->isRewriter != ANTLR3_TRUE) in reset()
541 if (ctns->nodeStack != NULL) in reset()
543 ctns->nodeStack->free(ctns->nodeStack); in reset()
544 ctns->nodeStack = antlr3StackNew(INITIAL_CALL_STACK_SIZE); in reset()
555 return &(tns->ctns->INVALID_NODE.baseTree); in LB()
558 if ( (tns->ctns->p - k) < 0) in LB()
560 return &(tns->ctns->INVALID_NODE.baseTree); in LB()
563 return tns->ctns->nodes->get(tns->ctns->nodes, tns->ctns->p - k); in LB()
579 if (tns->ctns->p == -1) in _LT()
581 fillBufferRoot(tns->ctns); in _LT()
590 return &(tns->ctns->INVALID_NODE.baseTree); in _LT()
595 if (( tns->ctns->p + k - 1) >= (ANTLR3_INT32)(tns->ctns->nodes->count)) in _LT()
597 return &(tns->ctns->EOF_NODE.baseTree); in _LT()
600 return tns->ctns->nodes->get(tns->ctns->nodes, tns->ctns->p + k - 1); in _LT()
609 return tns->ctns->root; in getTreeSource()
618 pANTLR3_COMMON_TREE_NODE_STREAM ctns; in consume() local
621 ctns = tns->ctns; in consume()
623 if (ctns->p == -1) in consume()
625 fillBufferRoot(ctns); in consume()
627 ctns->p++; in consume()
659 pANTLR3_COMMON_TREE_NODE_STREAM ctns; in mark() local
662 ctns = tns->ctns; in mark()
664 if (tns->ctns->p == -1) in mark()
666 fillBufferRoot(tns->ctns); in mark()
671 ctns->tnstream->istream->lastMarker = ctns->tnstream->istream->index(ctns->tnstream->istream); in mark()
673 return ctns->tnstream->istream->lastMarker; in mark()
706 pANTLR3_COMMON_TREE_NODE_STREAM ctns; in seek() local
709 ctns = tns->ctns; in seek()
711 ctns->p = ANTLR3_UINT32_CAST(index); in seek()
718 pANTLR3_COMMON_TREE_NODE_STREAM ctns; in tindex() local
721 ctns = tns->ctns; in tindex()
723 return (ANTLR3_MARKER)(ctns->p); in tindex()
734 pANTLR3_COMMON_TREE_NODE_STREAM ctns; in size() local
737 ctns = tns->ctns; in size()
739 if (ctns->p == -1) in size()
741 fillBufferRoot(ctns); in size()
744 return ctns->nodes->size(ctns->nodes); in size()
752 addNavigationNode (pANTLR3_COMMON_TREE_NODE_STREAM ctns, ANTLR3_UINT32 ttype) in addNavigationNode() argument
760 if (ctns->hasUniqueNavigationNodes(ctns) == ANTLR3_TRUE) in addNavigationNode()
762 node = ctns->newDownNode(ctns); in addNavigationNode()
766 node = &(ctns->DOWN.baseTree); in addNavigationNode()
771 if (ctns->hasUniqueNavigationNodes(ctns) == ANTLR3_TRUE) in addNavigationNode()
773 node = ctns->newUpNode(ctns); in addNavigationNode()
777 node = &(ctns->UP.baseTree); in addNavigationNode()
783 ctns->nodes->add(ctns->nodes, node, NULL); in addNavigationNode()
790 return tns->ctns->adaptor; in getTreeAdaptor()
794 hasUniqueNavigationNodes (pANTLR3_COMMON_TREE_NODE_STREAM ctns) in hasUniqueNavigationNodes() argument
796 return ctns->uniqueNavigationNodes; in hasUniqueNavigationNodes()
802 tns->ctns->uniqueNavigationNodes = uniqueNavigationNodes; in setUniqueNavigationNodes()
814 return tns->toStringSS(tns, tns->ctns->root, NULL); in toString()
822 buf = tns->ctns->stringFactory->newRaw(tns->ctns->stringFactory); in toStringSS()
844 text = tns->ctns->stringFactory->newRaw(tns->ctns->stringFactory); in toStringWork()
882 getLookaheadSize (pANTLR3_COMMON_TREE_NODE_STREAM ctns) in getLookaheadSize() argument
884 return ctns->tail < ctns->head in getLookaheadSize()
885 ? (ctns->lookAheadLength - ctns->head + ctns->tail) in getLookaheadSize()
886 : (ctns->tail - ctns->head); in getLookaheadSize()
890 newDownNode (pANTLR3_COMMON_TREE_NODE_STREAM ctns) in newDownNode() argument
904 newUpNode (pANTLR3_COMMON_TREE_NODE_STREAM ctns) in newUpNode() argument
945 if (tns->ctns->p == -1) in get()
947 fillBufferRoot(tns->ctns); in get()
950 return tns->ctns->nodes->get(tns->ctns->nodes, k); in get()
954 push (pANTLR3_COMMON_TREE_NODE_STREAM ctns, ANTLR3_INT32 index) in push() argument
956 ctns->nodeStack->push(ctns->nodeStack, ANTLR3_FUNC_PTR(ctns->p), NULL); // Save current index in push()
957 ctns->tnstream->istream->seek(ctns->tnstream->istream, index); in push()
961 pop (pANTLR3_COMMON_TREE_NODE_STREAM ctns) in pop() argument
965 retVal = ANTLR3_UINT32_CAST(ctns->nodeStack->pop(ctns->nodeStack)); in pop()
966 ctns->tnstream->istream->seek(ctns->tnstream->istream, retVal); in pop()