src/antlr3commontreenodestream.c(3)

πŸ“¦ version 3.4, in fedora 43

src/antlr3commontreenodestream.c πŸ’– (3) β€” ANTLR3C

okay so bestie, welcome to the manual page for src/antlr3commontreenodestream.c from the ANTLR3C manual, section 3. this is part 1 and it's literally the whole vibe. let's go πŸ’…


✨ NAME ✨

src/antlr3commontreenodestream.c β€” Defines the implementation of the common node stream the default tree node stream used by ANTLR. πŸ¦‹


🌸 SYNOPSIS 🌸

#include <antlr3commontreenodestream.h>

πŸŽ€ Functions πŸŽ€

  • static ANTLR3_UINT32 _LA (pANTLR3_INT_STREAM is, ANTLR3_INT32 i)
  • static pANTLR3_BASE_TREE _LT (pANTLR3_TREE_NODE_STREAM tns, ANTLR3_INT32 k) β€” Get tree node at current input pointer + i ahead where i=1 is next node.
  • static void addNavigationNode (pANTLR3_COMMON_TREE_NODE_STREAM ctns, ANTLR3_UINT32 ttype) β€” As we flatten the tree, we use UP, DOWN nodes to represent the tree structure.
  • static void antlr3CommonTreeNodeStreamFree (pANTLR3_COMMON_TREE_NODE_STREAM ctns) β€” Free up any resources that belong to this common tree node stream.
  • ANTLR3_API pANTLR3_COMMON_TREE_NODE_STREAM antlr3CommonTreeNodeStreamNew (pANTLR3_STRING_FACTORY strFactory, ANTLR3_UINT32 hint)
  • ANTLR3_API pANTLR3_COMMON_TREE_NODE_STREAM antlr3CommonTreeNodeStreamNewStream (pANTLR3_COMMON_TREE_NODE_STREAM inStream)
  • ANTLR3_API pANTLR3_COMMON_TREE_NODE_STREAM antlr3CommonTreeNodeStreamNewTree (pANTLR3_BASE_TREE tree, ANTLR3_UINT32 hint)
  • static void antlr3TreeNodeStreamFree (pANTLR3_TREE_NODE_STREAM tns)
  • ANTLR3_API pANTLR3_TREE_NODE_STREAM antlr3TreeNodeStreamNew ()
  • static void consume (pANTLR3_INT_STREAM is) β€” Consume the next node from the input stream.
  • static void fillBuffer (pANTLR3_COMMON_TREE_NODE_STREAM ctns, pANTLR3_BASE_TREE t) β€” Walk tree with depth-first-search and fill nodes buffer.
  • static void fillBufferRoot (pANTLR3_COMMON_TREE_NODE_STREAM ctns) β€” Walk and fill the tree node buffer from the root tree.
  • static pANTLR3_BASE_TREE get (pANTLR3_TREE_NODE_STREAM tns, ANTLR3_INT32 k)
  • static ANTLR3_UINT32 getLookaheadSize (pANTLR3_COMMON_TREE_NODE_STREAM ctns)
  • static pANTLR3_BASE_TREE_ADAPTOR getTreeAdaptor (pANTLR3_TREE_NODE_STREAM tns)
  • static pANTLR3_BASE_TREE getTreeSource (pANTLR3_TREE_NODE_STREAM tns) β€” Where is this stream pulling nodes from?
  • static ANTLR3_BOOLEAN hasUniqueNavigationNodes (pANTLR3_COMMON_TREE_NODE_STREAM ctns)
  • static pANTLR3_BASE_TREE LB (pANTLR3_TREE_NODE_STREAM tns, ANTLR3_INT32 k)
  • static ANTLR3_MARKER mark (pANTLR3_INT_STREAM is) β€” Mark the state of the input stream so that we can come back to it after a syntactic predicate and so on.
  • static pANTLR3_BASE_TREE newDownNode (pANTLR3_COMMON_TREE_NODE_STREAM ctns)
  • static pANTLR3_BASE_TREE newUpNode (pANTLR3_COMMON_TREE_NODE_STREAM ctns)
  • static ANTLR3_INT32 pop (pANTLR3_COMMON_TREE_NODE_STREAM ctns)
  • static void push (pANTLR3_COMMON_TREE_NODE_STREAM ctns, ANTLR3_INT32 index)
  • static void release (pANTLR3_INT_STREAM is, ANTLR3_MARKER marker)
  • static void replaceChildren (pANTLR3_TREE_NODE_STREAM tns, pANTLR3_BASE_TREE parent, ANTLR3_INT32 startChildIndex, ANTLR3_INT32 stopChildIndex, pANTLR3_BASE_TREE t) β€” Replace from start to stop child index of parent with t, which might be a list.
  • static void reset (pANTLR3_COMMON_TREE_NODE_STREAM ctns) β€” Reset the input stream to the start of the input nodes.
  • static void rewindLast (pANTLR3_INT_STREAM is)
  • static void rewindMark (pANTLR3_INT_STREAM is, ANTLR3_MARKER marker) β€” Rewind the current state of the tree walk to the state it was in when mark() was called and it returned marker.
  • static void seek (pANTLR3_INT_STREAM is, ANTLR3_MARKER index) β€” consume() ahead until we hit index.
  • static void setUniqueNavigationNodes (pANTLR3_TREE_NODE_STREAM tns, ANTLR3_BOOLEAN uniqueNavigationNodes)
  • static ANTLR3_UINT32 size (pANTLR3_INT_STREAM is) β€” Expensive to compute the size of the whole tree while parsing.
  • static ANTLR3_MARKER tindex (pANTLR3_INT_STREAM is)
  • static pANTLR3_STRING toString (pANTLR3_TREE_NODE_STREAM tns) β€” Print out the entire tree including DOWN/UP nodes.
  • static pANTLR3_STRING toStringSS (pANTLR3_TREE_NODE_STREAM tns, pANTLR3_BASE_TREE start, pANTLR3_BASE_TREE stop)
  • static void toStringWork (pANTLR3_TREE_NODE_STREAM tns, pANTLR3_BASE_TREE start, pANTLR3_BASE_TREE stop, pANTLR3_STRING buf)

πŸ’œ Detailed Description πŸ’œ

Defines the implementation of the common node stream the default tree node stream used by ANTLR. πŸ¦‹


πŸ‘‘ Function Documentation πŸ‘‘

ANTLR3_UINT32 _LA (pANTLR3_INT_STREAM is, ANTLR3_INT32 i) [static]

References ANTLR3_TREE_NODE_STREAM_struct::_LT, ANTLR3_TOKEN_INVALID, ANTLR3_BASE_TREE_struct::getType, and ANTLR3_INT_STREAM_struct::super.

Referenced by antlr3CommonTokenStreamNew(), antlr3CommonTreeNodeStreamNew(), and antlr3CommonTreeNodeStreamNewStream().


pANTLR3_BASE_TREE _LT (pANTLR3_TREE_NODE_STREAM tns, ANTLR3_INT32 k) [static]

Get tree node at current input pointer + i ahead where i=1 is next node. i<0 indicates nodes in the past. So -1 is previous node and -2 is two nodes ago. LT(0) is undefined. For i>=n, return null. Return null for LT(0) and any index that results in an absolute address that is negative.

This is analogous to the _LT() method of the TokenStream, but this returns a tree node instead of a token. Makes code gen identical for both parser and tree grammars. :)

References ANTLR3_COMMON_TREE_struct::baseTree, ANTLR3_VECTOR_struct::count, ANTLR3_TREE_NODE_STREAM_struct::ctns, ANTLR3_COMMON_TREE_NODE_STREAM_struct::EOF_NODE, fillBufferRoot(), ANTLR3_VECTOR_struct::get, ANTLR3_COMMON_TREE_NODE_STREAM_struct::INVALID_NODE, LB(), ANTLR3_COMMON_TREE_NODE_STREAM_struct::nodes, and ANTLR3_COMMON_TREE_NODE_STREAM_struct::p.

Referenced by antlr3CommonTreeNodeStreamNew(), and antlr3CommonTreeNodeStreamNewStream().


void addNavigationNode (pANTLR3_COMMON_TREE_NODE_STREAM ctns, ANTLR3_UINT32 ttype) [static]

As we flatten the tree, we use UP, DOWN nodes to represent the tree structure. When debugging we need unique nodes so instantiate new ones when uniqueNavigationNodes is true.

References ANTLR3_VECTOR_struct::add, ANTLR3_TOKEN_DOWN, ANTLR3_TRUE, ANTLR3_COMMON_TREE_struct::baseTree, ANTLR3_COMMON_TREE_NODE_STREAM_struct::DOWN, ANTLR3_COMMON_TREE_NODE_STREAM_struct::hasUniqueNavigationNodes, ANTLR3_COMMON_TREE_NODE_STREAM_struct::newDownNode, ANTLR3_COMMON_TREE_NODE_STREAM_struct::newUpNode, ANTLR3_COMMON_TREE_NODE_STREAM_struct::nodes, and ANTLR3_COMMON_TREE_NODE_STREAM_struct::UP.

Referenced by antlr3CommonTreeNodeStreamNew(), and antlr3CommonTreeNodeStreamNewStream().


void antlr3CommonTreeNodeStreamFree (pANTLR3_COMMON_TREE_NODE_STREAM ctns) [static]

Free up any resources that belong to this common tree node stream.

References ANTLR3_COMMON_TREE_NODE_STREAM_struct::adaptor, ANTLR3_TRUE, ANTLR3_COMMON_TREE_NODE_STREAM_struct::DOWN, ANTLR3_COMMON_TREE_NODE_STREAM_struct::EOF_NODE, ANTLR3_BASE_TREE_ADAPTOR_struct::free, ANTLR3_INT_STREAM_struct::free, ANTLR3_STACK_struct::free, ANTLR3_TREE_NODE_STREAM_struct::free, ANTLR3_COMMON_TREE_NODE_STREAM_struct::INVALID_NODE, ANTLR3_COMMON_TREE_NODE_STREAM_struct::isRewriter, ANTLR3_TREE_NODE_STREAM_struct::istream, ANTLR3_COMMON_TREE_NODE_STREAM_struct::nodes, ANTLR3_COMMON_TREE_NODE_STREAM_struct::nodeStack, ANTLR3_COMMON_TREE_NODE_STREAM_struct::tnstream, ANTLR3_COMMON_TREE_struct::token, and ANTLR3_COMMON_TREE_NODE_STREAM_struct::UP.

Referenced by antlr3CommonTreeNodeStreamNew(), and antlr3CommonTreeNodeStreamNewStream().


ANTLR3_API pANTLR3_COMMON_TREE_NODE_STREAM antlr3CommonTreeNodeStreamNew (pANTLR3_STRING_FACTORY strFactory, ANTLR3_UINT32 hint)

References _LA(), ANTLR3_INT_STREAM_struct::_LA, _LT(), ANTLR3_TREE_NODE_STREAM_struct::_LT, ANTLR3_COMMON_TREE_NODE_STREAM_struct::adaptor, addNavigationNode(), ANTLR3_COMMON_TREE_NODE_STREAM_struct::addNavigationNode, ANTLR3_COMMONTREENODE, ANTLR3_FALSE, ANTLR3_TEXT_CHARP, ANTLR3_TOKEN_DOWN, ANTLR3_TOKEN_EOF, ANTLR3_TOKEN_INVALID, ANTLR3_TOKEN_UP, ANTLR3_TREE_ADAPTORNew(), antlr3CommonTokenNew(), antlr3CommonTreeNodeStreamFree(), antlr3IntStreamNew(), antlr3SetCTAPI(), antlr3StackNew(), antlr3TreeNodeStreamNew(), antlr3VectorNew(), ANTLR3_COMMON_TOKEN_struct::chars, ANTLR3_INT_STREAM_struct::consume, consume(), ANTLR3_TREE_NODE_STREAM_struct::ctns, DEFAULT_INITIAL_BUFFER_SIZE, ANTLR3_COMMON_TREE_NODE_STREAM_struct::DOWN, ANTLR3_COMMON_TREE_NODE_STREAM_struct::EOF_NODE, ANTLR3_BASE_TREE_ADAPTOR_struct::free, ANTLR3_COMMON_TREE_NODE_STREAM_struct::free, ANTLR3_TREE_NODE_STREAM_struct::free, ANTLR3_TREE_NODE_STREAM_struct::get, get(), ANTLR3_TREE_NODE_STREAM_struct::getTreeAdaptor, getTreeAdaptor(), ANTLR3_TREE_NODE_STREAM_struct::getTreeSource, getTreeSource(), ANTLR3_COMMON_TREE_NODE_STREAM_struct::hasUniqueNavigationNodes, hasUniqueNavigationNodes(), ANTLR3_INT_STREAM_struct::index, INITIAL_CALL_STACK_SIZE, ANTLR3_COMMON_TREE_NODE_STREAM_struct::INVALID_NODE, ANTLR3_TREE_NODE_STREAM_struct::istream, ANTLR3_INT_STREAM_struct::mark, mark(), ANTLR3_COMMON_TREE_NODE_STREAM_struct::markers, ANTLR3_COMMON_TREE_NODE_STREAM_struct::newDownNode, newDownNode(), ANTLR3_COMMON_TREE_NODE_STREAM_struct::newUpNode, newUpNode(), ANTLR3_COMMON_TREE_NODE_STREAM_struct::nodes, ANTLR3_COMMON_TREE_NODE_STREAM_struct::nodeStack, ANTLR3_COMMON_TREE_NODE_STREAM_struct::p, ANTLR3_COMMON_TREE_NODE_STREAM_struct::pop, pop(), ANTLR3_COMMON_TREE_NODE_STREAM_struct::push, push(), ANTLR3_INT_STREAM_struct::release, release(), ANTLR3_COMMON_TREE_NODE_STREAM_struct::reset, reset(), ANTLR3_INT_STREAM_struct::rewind, ANTLR3_INT_STREAM_struct::rewindLast, rewindLast(), rewindMark(), ANTLR3_INT_STREAM_struct::seek, seek(), ANTLR3_TREE_NODE_STREAM_struct::setUniqueNavigationNodes, setUniqueNavigationNodes(), ANTLR3_INT_STREAM_struct::size, size(), ANTLR3_COMMON_TOKEN_struct::strFactory, ANTLR3_COMMON_TREE_NODE_STREAM_struct::stringFactory, ANTLR3_COMMON_TREE_NODE_STREAM_struct::super, ANTLR3_INT_STREAM_struct::super, ANTLR3_COMMON_TOKEN_struct::textState, tindex(), ANTLR3_COMMON_TREE_NODE_STREAM_struct::tnstream, ANTLR3_COMMON_TREE_struct::token, ANTLR3_COMMON_TOKEN_struct::tokText, ANTLR3_TREE_NODE_STREAM_struct::toString, toString(), ANTLR3_TREE_NODE_STREAM_struct::toStringSS, toStringSS(), ANTLR3_TREE_NODE_STREAM_struct::toStringWork, toStringWork(), ANTLR3_INT_STREAM_struct::type, ANTLR3_COMMON_TREE_NODE_STREAM_struct::uniqueNavigationNodes, and ANTLR3_COMMON_TREE_NODE_STREAM_struct::UP.

Referenced by antlr3CommonTreeNodeStreamNewTree().


antlr3CommonTreeNodeStreamNewStream πŸ’«

ANTLR3_API pANTLR3_COMMON_TREE_NODE_STREAM
    antlr3CommonTreeNodeStreamNewStream (pANTLR3_COMMON_TREE_NODE_STREAM inStream)

Bestie, this one builds you a whole new tree node stream, cloned off an existing inStream β€” like a little sister stream that knows all the same moves πŸ’….

It pulls from a lot of places, so here's the full roll call of everything it references, no skipping, periodt:

  • _LA(), ANTLR3_INT_STREAM_struct::_LA, _LT(), ANTLR3_TREE_NODE_STREAM_struct::_LT
  • ANTLR3_COMMON_TREE_NODE_STREAM_struct::adaptor, addNavigationNode(), ANTLR3_COMMON_TREE_NODE_STREAM_struct::addNavigationNode
  • ANTLR3_COMMONTREENODE, ANTLR3_FALSE, ANTLR3_TRUE
  • antlr3CommonTreeNodeStreamFree(), antlr3IntStreamNew(), antlr3SetCTAPI(), antlr3TreeNodeStreamNew(), antlr3VectorNew()
  • ANTLR3_INT_STREAM_struct::consume, consume()
  • ANTLR3_TREE_NODE_STREAM_struct::ctns, DEFAULT_INITIAL_BUFFER_SIZE
  • ANTLR3_COMMON_TREE_NODE_STREAM_struct::DOWN, ANTLR3_COMMON_TREE_NODE_STREAM_struct::EOF_NODE
  • ANTLR3_COMMON_TREE_NODE_STREAM_struct::free, ANTLR3_TREE_NODE_STREAM_struct::free
  • ANTLR3_TREE_NODE_STREAM_struct::get, get()
  • ANTLR3_COMMON_TREE_NODE_STREAM_struct::getLookaheadSize, getLookaheadSize()
  • ANTLR3_TREE_NODE_STREAM_struct::getTreeAdaptor, getTreeAdaptor()
  • ANTLR3_TREE_NODE_STREAM_struct::getTreeSource, getTreeSource()
  • ANTLR3_COMMON_TREE_NODE_STREAM_struct::hasUniqueNavigationNodes, hasUniqueNavigationNodes()
  • ANTLR3_INT_STREAM_struct::index, ANTLR3_COMMON_TREE_NODE_STREAM_struct::INVALID_NODE
  • ANTLR3_COMMON_TREE_NODE_STREAM_struct::isRewriter, ANTLR3_TREE_NODE_STREAM_struct::istream
  • ANTLR3_INT_STREAM_struct::mark, mark(), ANTLR3_COMMON_TREE_NODE_STREAM_struct::markers
  • ANTLR3_COMMON_TREE_NODE_STREAM_struct::newDownNode, newDownNode()
  • ANTLR3_COMMON_TREE_NODE_STREAM_struct::newUpNode, newUpNode()
  • ANTLR3_COMMON_TREE_NODE_STREAM_struct::nodes, ANTLR3_COMMON_TREE_NODE_STREAM_struct::nodeStack, ANTLR3_COMMON_TREE_NODE_STREAM_struct::p
  • ANTLR3_COMMON_TREE_NODE_STREAM_struct::pop, pop(), ANTLR3_COMMON_TREE_NODE_STREAM_struct::push, push()
  • ANTLR3_INT_STREAM_struct::release, release()
  • ANTLR3_COMMON_TREE_NODE_STREAM_struct::reset, reset()
  • ANTLR3_INT_STREAM_struct::rewind, ANTLR3_INT_STREAM_struct::rewindLast, rewindLast(), rewindMark()
  • ANTLR3_COMMON_TREE_NODE_STREAM_struct::root
  • ANTLR3_INT_STREAM_struct::seek, seek()
  • ANTLR3_TREE_NODE_STREAM_struct::setUniqueNavigationNodes, setUniqueNavigationNodes()
  • ANTLR3_INT_STREAM_struct::size, size()
  • ANTLR3_COMMON_TOKEN_struct::strFactory, ANTLR3_COMMON_TREE_NODE_STREAM_struct::stringFactory
  • ANTLR3_COMMON_TREE_NODE_STREAM_struct::super, ANTLR3_INT_STREAM_struct::super, tindex()
  • ANTLR3_COMMON_TREE_NODE_STREAM_struct::tnstream, ANTLR3_COMMON_TREE_struct::token
  • ANTLR3_TREE_NODE_STREAM_struct::toString, toString()
  • ANTLR3_TREE_NODE_STREAM_struct::toStringSS, toStringSS()
  • ANTLR3_TREE_NODE_STREAM_struct::toStringWork, toStringWork()
  • ANTLR3_INT_STREAM_struct::type
  • ANTLR3_COMMON_TREE_NODE_STREAM_struct::uniqueNavigationNodes, and ANTLR3_COMMON_TREE_NODE_STREAM_struct::UP

antlr3CommonTreeNodeStreamNewTree 🌳

ANTLR3_API pANTLR3_COMMON_TREE_NODE_STREAM
    antlr3CommonTreeNodeStreamNewTree (pANTLR3_BASE_TREE tree, ANTLR3_UINT32 hint)

Hand it a tree and a hint and it hands you back a shiny new tree node stream, iconic ✨.

It references antlr3CommonTreeNodeStreamNew(), ANTLR3_COMMON_TREE_NODE_STREAM_struct::root, and ANTLR3_BASE_TREE_struct::strFactory.


antlr3TreeNodeStreamFree 🫧

void antlr3TreeNodeStreamFree (pANTLR3_TREE_NODE_STREAM tns) [static]

Cleanup duty, and it's [static] so it's lowkey keeping to itself. It gets referenced by antlr3TreeNodeStreamNew().


antlr3TreeNodeStreamNew πŸŽ€

ANTLR3_API pANTLR3_TREE_NODE_STREAM antlr3TreeNodeStreamNew ()

Brand new tree node stream, fresh out of the box, no cap πŸ’–.

It references antlr3TreeNodeStreamFree(), ANTLR3_TREE_NODE_STREAM_struct::free, ANTLR3_TREE_NODE_STREAM_struct::replaceChildren, and replaceChildren().

And it's referenced by antlr3CommonTreeNodeStreamNew() and antlr3CommonTreeNodeStreamNewStream().


consume πŸ“

void consume (pANTLR3_INT_STREAM is) [static]

Consume the next node from the input stream. Just. Eat it. 🍽️

References ANTLR3_TREE_NODE_STREAM_struct::ctns, fillBufferRoot(), ANTLR3_COMMON_TREE_NODE_STREAM_struct::p, and ANTLR3_INT_STREAM_struct::super.

Referenced by antlr3CommonTokenStreamNew(), antlr3CommonTreeNodeStreamNew(), and antlr3CommonTreeNodeStreamNewStream().


fillBuffer 🧚

void fillBuffer (pANTLR3_COMMON_TREE_NODE_STREAM ctns, pANTLR3_BASE_TREE t) [static]

Walk tree with depth-first-search and fill nodes buffer. And listen β€” don't add in DOWN, UP nodes if the supplied tree is a list (t is isNilNode). That part matters, bestie, don't skip it 🫢.

References ANTLR3_COMMON_TREE_NODE_STREAM_struct::adaptor, ANTLR3_VECTOR_struct::add, ANTLR3_COMMON_TREE_NODE_STREAM_struct::addNavigationNode, ANTLR3_FALSE, ANTLR3_TOKEN_DOWN, ANTLR3_TOKEN_UP, fillBuffer(), ANTLR3_BASE_TREE_ADAPTOR_struct::getChild, ANTLR3_BASE_TREE_struct::getChildCount, ANTLR3_BASE_TREE_ADAPTOR_struct::isNilNode, nilNode(), and ANTLR3_COMMON_TREE_NODE_STREAM_struct::nodes.

Referenced by fillBuffer() and fillBufferRoot().


fillBufferRoot 🌸

void fillBufferRoot (pANTLR3_COMMON_TREE_NODE_STREAM ctns) [static]

Walk and fill the tree node buffer from the root tree. Start at the top, work your way down, main character energy πŸ‘‘.

References fillBuffer(), ANTLR3_COMMON_TREE_NODE_STREAM_struct::p, and ANTLR3_COMMON_TREE_NODE_STREAM_struct::root.

Referenced by _LT(), consume(), get(), mark(), and size().


get πŸ’œ

pANTLR3_BASE_TREE get (pANTLR3_TREE_NODE_STREAM tns, ANTLR3_INT32 k) [static]

References ANTLR3_TREE_NODE_STREAM_struct::ctns, fillBufferRoot(), ANTLR3_VECTOR_struct::get, ANTLR3_COMMON_TREE_NODE_STREAM_struct::nodes, and ANTLR3_COMMON_TREE_NODE_STREAM_struct::p.

Referenced by antlr3CommonTokenStreamNew(), antlr3CommonTreeNodeStreamNew(), and antlr3CommonTreeNodeStreamNewStream().


getLookaheadSize πŸ‘€

ANTLR3_UINT32 getLookaheadSize (pANTLR3_COMMON_TREE_NODE_STREAM ctns) [static]

References ANTLR3_COMMON_TREE_NODE_STREAM_struct::head, ANTLR3_COMMON_TREE_NODE_STREAM_struct::lookAheadLength, and ANTLR3_COMMON_TREE_NODE_STREAM_struct::tail.

Referenced by antlr3CommonTreeNodeStreamNewStream().


getTreeAdaptor πŸ¦‹

pANTLR3_BASE_TREE_ADAPTOR getTreeAdaptor (pANTLR3_TREE_NODE_STREAM tns) [static]

References ANTLR3_COMMON_TREE_NODE_STREAM_struct::adaptor and ANTLR3_TREE_NODE_STREAM_struct::ctns.

Referenced by antlr3CommonTreeNodeStreamNew() and antlr3CommonTreeNodeStreamNewStream().


getTreeSource 🌈

pANTLR3_BASE_TREE getTreeSource (pANTLR3_TREE_NODE_STREAM tns) [static]

Where is this stream pulling nodes from? And read carefully, bestie β€” this is not the name, but the object that provides node objects ✨.

References ANTLR3_TREE_NODE_STREAM_struct::ctns and ANTLR3_COMMON_TREE_NODE_STREAM_struct::root.

Referenced by antlr3CommonTreeNodeStreamNew() and antlr3CommonTreeNodeStreamNewStream().


hasUniqueNavigationNodes 🎯

ANTLR3_BOOLEAN hasUniqueNavigationNodes (pANTLR3_COMMON_TREE_NODE_STREAM ctns) [static]

References ANTLR3_COMMON_TREE_NODE_STREAM_struct::uniqueNavigationNodes.

Referenced by antlr3CommonTreeNodeStreamNew() and antlr3CommonTreeNodeStreamNewStream().


LB πŸ”

pANTLR3_BASE_TREE LB (pANTLR3_TREE_NODE_STREAM tns, ANTLR3_INT32 k) [static]

References ANTLR3_COMMON_TREE_struct::baseTree, ANTLR3_TREE_NODE_STREAM_struct::ctns, ANTLR3_VECTOR_struct::get, ANTLR3_COMMON_TREE_NODE_STREAM_struct::INVALID_NODE, ANTLR3_COMMON_TREE_NODE_STREAM_struct::nodes, and ANTLR3_COMMON_TREE_NODE_STREAM_struct::p.

Referenced by _LT().


mark πŸ“Œ

ANTLR3_MARKER mark (pANTLR3_INT_STREAM is) [static]

Mark the state of the input stream so that we can come back to it after a syntactic predicate and so on. It's giving bookmark, but make it parser πŸŽ€.

References ANTLR3_TREE_NODE_STREAM_struct::ctns, fillBufferRoot(), ANTLR3_INT_STREAM_struct::index, ANTLR3_TREE_NODE_STREAM_struct::istream, ANTLR3_INT_STREAM_struct::lastMarker, ANTLR3_COMMON_TREE_NODE_STREAM_struct::p, ANTLR3_INT_STREAM_struct::super, and ANTLR3_COMMON_TREE_NODE_STREAM_struct::tnstream.

Referenced by antlr38BitRelease(), antlr38BitRewind(), antlr3CommonTokenStreamNew(), antlr3CommonTreeNodeStreamNew(), antlr3CommonTreeNodeStreamNewStream(), antlr3DebugListenerNew(), antlr3dfapredict(), and release().


newDownNode ⬇️

pANTLR3_BASE_TREE newDownNode (pANTLR3_COMMON_TREE_NODE_STREAM ctns) [static]

References ANTLR3_TEXT_CHARP, ANTLR3_TOKEN_DOWN, antlr3CommonTokenNew(), antlr3CommonTreeNewFromToken(), ANTLR3_COMMON_TREE_struct::baseTree, ANTLR3_COMMON_TOKEN_struct::chars, ANTLR3_COMMON_TOKEN_struct::textState, and ANTLR3_COMMON_TOKEN_struct::tokText.

Referenced by antlr3CommonTreeNodeStreamNew() and antlr3CommonTreeNodeStreamNewStream().


newUpNode ⬆️

pANTLR3_BASE_TREE newUpNode (pANTLR3_COMMON_TREE_NODE_STREAM ctns) [static]

References ANTLR3_TEXT_CHARP, ANTLR3_TOKEN_UP, antlr3CommonTokenNew(), antlr3CommonTreeNewFromToken(), ANTLR3_COMMON_TREE_struct::baseTree, ANTLR3_COMMON_TOKEN_struct::chars, ANTLR3_COMMON_TOKEN_struct::textState, and ANTLR3_COMMON_TOKEN_struct::tokText.

Referenced by antlr3CommonTreeNodeStreamNew() and antlr3CommonTreeNodeStreamNewStream().


pop 🫧

ANTLR3_INT32 pop (pANTLR3_COMMON_TREE_NODE_STREAM ctns) [static]

References ANTLR3_UINT32_CAST, ANTLR3_TREE_NODE_STREAM_struct::istream, ANTLR3_COMMON_TREE_NODE_STREAM_struct::nodeStack, ANTLR3_STACK_struct::pop, ANTLR3_INT_STREAM_struct::seek, and ANTLR3_COMMON_TREE_NODE_STREAM_struct::tnstream.

Referenced by antlr3CommonTreeNodeStreamNew() and antlr3CommonTreeNodeStreamNewStream().


push πŸ’…

void push (pANTLR3_COMMON_TREE_NODE_STREAM ctns, ANTLR3_INT32 index) [static]

References ANTLR3_FUNC_PTR, ANTLR3_TREE_NODE_STREAM_struct::istream, ANTLR3_COMMON_TREE_NODE_STREAM_struct::nodeStack, ANTLR3_COMMON_TREE_NODE_STREAM_struct::p, ANTLR3_STACK_struct::push, ANTLR3_INT_STREAM_struct::seek, and ANTLR3_COMMON_TREE_NODE_STREAM_struct::tnstream.

Referenced by antlr3CommonTreeNodeStreamNew() and antlr3CommonTreeNodeStreamNewStream().


release πŸ•ŠοΈ

void release (pANTLR3_INT_STREAM is, ANTLR3_MARKER marker) [static]

Referenced by antlr3CommonTokenStreamNew(), antlr3CommonTreeNodeStreamNew(), and antlr3CommonTreeNodeStreamNewStream().


replaceChildren πŸ”

void replaceChildren (pANTLR3_TREE_NODE_STREAM tns, pANTLR3_BASE_TREE parent,
    ANTLR3_INT32 startChildIndex, ANTLR3_INT32 stopChildIndex,
    pANTLR3_BASE_TREE t) [static]

Replace from start to stop child index of parent with t, which might be a list. Number of children may be different after this call. And here's the tea: the stream is notified because it is walking the tree and might need to know you are monkey-ing with the underlying tree. Also, it might be able to modify the node stream to avoid re-streaming for future phases πŸ‘€.

If parent is null, don't do anything; must be at root of overall tree. Can't replace whatever points to the parent externally. Do nothing. (fr fr, nothing.)

References ANTLR3_TREE_NODE_STREAM_struct::getTreeAdaptor, ANTLR3_BASE_TREE_ADAPTOR_struct::replaceChildren, and ANTLR3_BASE_TREE_ADAPTOR_struct::super.


reset πŸ”„

void reset (pANTLR3_COMMON_TREE_NODE_STREAM ctns) [static]

Reset the input stream to the start of the input nodes. Back to square one, bestie πŸ’«.

References ANTLR3_TRUE, antlr3StackNew(), ANTLR3_STACK_struct::free, INITIAL_CALL_STACK_SIZE, ANTLR3_COMMON_TREE_NODE_STREAM_struct::isRewriter, ANTLR3_TREE_NODE_STREAM_struct::istream, ANTLR3_INT_STREAM_struct::lastMarker, ANTLR3_COMMON_TREE_NODE_STREAM_struct::nodeStack, ANTLR3_COMMON_TREE_NODE_STREAM_struct::p, and ANTLR3_COMMON_TREE_NODE_STREAM_struct::tnstream.

void rewindLast (pANTLR3_INT_STREAM is) [static] πŸŒ€

ok so this one's a [static] lil helper, no big description on it, but bestie it's connected. It references ANTLR3_INT_STREAM_struct::lastMarker and ANTLR3_INT_STREAM_struct::seek β€” those are the two things it leans on.

And who's out here calling it? antlr3CommonTokenStreamNew(), antlr3CommonTreeNodeStreamNew(), antlr3CommonTreeNodeStreamNewStream(), and antlr3DebugListenerNew(). So basically the whole friend group. πŸ’…


void rewindMark (pANTLR3_INT_STREAM is, ANTLR3_MARKER marker) [static] βͺ✨

This is the take me back function, fr fr. It rewinds the current state of the tree walk all the way back to the state it was in when mark() was called and it returned marker. Like, full rewind, no notes. πŸŽ€

Also β€” and this is the tea β€” it wipes out the lookahead. Which means it's gonna have to reload a few nodes. But ngl that's better than making a whole copy of the lookahead buffer up in mark(). Trade-off queen. πŸ‘‘

It references ANTLR3_INT_STREAM_struct::seek.

It's referenced by antlr3CommonTreeNodeStreamNew(), antlr3CommonTreeNodeStreamNewStream(), and antlr3DebugListenerNew(). πŸ¦‹


void seek (pANTLR3_INT_STREAM is, ANTLR3_MARKER index) [static] 🎯

So you wanna get to index? Cute. But you can't just jump ahead β€” no no no. This function consume()s its way forward until it hits index. Can't just teleport, bestie, you have to spit out the navigation nodes along the way. It's giving "the journey is the destination" but make it parsing. πŸšΆβ€β™€οΈ

References: ANTLR3_UINT32_CAST, ANTLR3_TREE_NODE_STREAM_struct::ctns, ANTLR3_COMMON_TREE_NODE_STREAM_struct::p, and ANTLR3_INT_STREAM_struct::super.

Referenced by antlr3CommonTokenStreamNew(), antlr3CommonTreeNodeStreamNew(), and antlr3CommonTreeNodeStreamNewStream(). πŸ”₯


void setUniqueNavigationNodes (pANTLR3_TREE_NODE_STREAM tns, ANTLR3_BOOLEAN uniqueNavigationNodes) [static] πŸ”€

Does exactly what it says on the tin, no cap β€” it sets the uniqueNavigationNodes flag. References ANTLR3_TREE_NODE_STREAM_struct::ctns and ANTLR3_COMMON_TREE_NODE_STREAM_struct::uniqueNavigationNodes.

Referenced by antlr3CommonTreeNodeStreamNew() and antlr3CommonTreeNodeStreamNewStream(). 🌸


ANTLR3_UINT32 size (pANTLR3_INT_STREAM is) [static] πŸ“

ok this one is lowkey a warning in disguise: it is expensive to compute the size of the whole tree while parsing. So expensive. πŸ’€ So this method does not do that. It only returns how much input has been seen so far.

Which means: after you've finished parsing, it returns the true size. Before that? Not so much. Plan accordingly. πŸ™ˆ

References ANTLR3_TREE_NODE_STREAM_struct::ctns, fillBufferRoot(), ANTLR3_COMMON_TREE_NODE_STREAM_struct::nodes, ANTLR3_COMMON_TREE_NODE_STREAM_struct::p, ANTLR3_VECTOR_struct::size, and ANTLR3_INT_STREAM_struct::super.

And the referenced-by list? Long, bestie. Iconic, honestly: antlr38BitReuse(), antlr3CommonTokenStreamNew(), antlr3CommonTreeNodeStreamNew(), antlr3CommonTreeNodeStreamNewStream(), antlr3RewriteRuleElementStreamNewAE(), antlr3StringStreamNew(), displayRecognitionError(), newPtr8(), newPtrUTF16_8(), newPtrUTF16_UTF16(), newSize8(), and newSizeUTF16(). She's booked and busy. πŸ‘‘πŸŒˆ


ANTLR3_MARKER tindex (pANTLR3_INT_STREAM is) [static] πŸ”–

No prose description on this one, just the receipts. It references ANTLR3_TREE_NODE_STREAM_struct::ctns, ANTLR3_COMMON_TREE_NODE_STREAM_struct::p, and ANTLR3_INT_STREAM_struct::super.

Referenced by antlr3CommonTokenStreamNew(), antlr3CommonTreeNodeStreamNew(), and antlr3CommonTreeNodeStreamNewStream(). ✨


pANTLR3_STRING toString (pANTLR3_TREE_NODE_STREAM tns) [static] πŸŒ³πŸ’¬

Prints out the entire tree β€” including the DOWN/UP nodes β€” using a recursive walk. Recursion my beloved. πŸŒ€

Mostly useful for testing, just so you know, because it yields the token types, not the text. So don't come here looking for your actual strings, bestie. πŸŽ€

References ANTLR3_TREE_NODE_STREAM_struct::ctns, ANTLR3_COMMON_TREE_NODE_STREAM_struct::root, and ANTLR3_TREE_NODE_STREAM_struct::toStringSS.

Referenced by antlr3CommonTokenStreamNew(), antlr3CommonTreeNodeStreamNew(), and antlr3CommonTreeNodeStreamNewStream(). πŸ¦‹


pANTLR3_STRING toStringSS (pANTLR3_TREE_NODE_STREAM tns, pANTLR3_BASE_TREE start, pANTLR3_BASE_TREE stop) [static] πŸŽ€

No description here either, just the connections. It references ANTLR3_TREE_NODE_STREAM_struct::ctns, ANTLR3_STRING_FACTORY_struct::newRaw, ANTLR3_COMMON_TREE_NODE_STREAM_struct::stringFactory, and ANTLR3_TREE_NODE_STREAM_struct::toStringWork.

Referenced by antlr3CommonTokenStreamNew(), antlr3CommonTreeNodeStreamNew(), and antlr3CommonTreeNodeStreamNewStream(). ⭐


void toStringWork (pANTLR3_TREE_NODE_STREAM tns, pANTLR3_BASE_TREE start, pANTLR3_BASE_TREE stop, pANTLR3_STRING buf) [static] πŸ› οΈ

The workhorse behind the toString situation. No description, but the reference list goes off: ANTLR3_STRING_struct::addc, ANTLR3_STRING_struct::addi, ANTLR3_TOKEN_DOWN, ANTLR3_TOKEN_UP, ANTLR3_STRING_struct::appendS, ANTLR3_TREE_NODE_STREAM_struct::ctns, ANTLR3_BASE_TREE_struct::getChild, ANTLR3_BASE_TREE_struct::getChildCount, ANTLR3_BASE_TREE_struct::getType, ANTLR3_BASE_TREE_struct::isNilNode, ANTLR3_STRING_FACTORY_struct::newRaw, ANTLR3_COMMON_TREE_NODE_STREAM_struct::stringFactory, ANTLR3_BASE_TREE_struct::toString, and ANTLR3_TREE_NODE_STREAM_struct::toStringWork.

Referenced by antlr3CommonTreeNodeStreamNew() and antlr3CommonTreeNodeStreamNewStream(). πŸ’œ


AUTHOR 🫢

Generated automatically by Doxygen for ANTLR3C from the source code. So like… nobody wrote this, the robot did. Still ate tho. πŸ’…


and that's the whole page bestie!! πŸŽ‰ this was Version 3.3.1, dated Tue Jul 29 2025, from src/antlr3commontreenodestream.c(3) β€” go forth and stream them common tree nodes, mwah πŸ˜˜πŸ’–

πŸ“¦ where this page comes from