What tree adaptor was used to build these trees
Stack of indexes used for push/pop calls
Track the last mark() call result value for use in rewind().
The complete mapping from stream index to tree node. This buffer includes pointers to DOWN, UP, and EOF nodes. It is built upon ctor invocation. The elements are type Object as we don't what the trees look like.
Load upon first need of the buffer so we can set token types of interest for reverseIndexing. Slows us down a wee bit to do all of the if p==-1 testing everywhere though.
The index into the nodes list of the current node (next node to consume). If -1, nodes array not filled yet.
Pull nodes from which tree?
IF this tree (root) was created from a token stream, track it.
Reuse same DOWN, UP navigation nodes unless this is true
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.
Walk tree with depth-first-search and fill nodes buffer. Don't do DOWN, UP nodes if its a list (t is isNil).
What is the stream index for node? 0..n-1 Return -1 if node not found.
Look backwards k nodes
Seek back to previous index saved during last push() call. Return top of stack (return index).
Make stream jump to a new location, saving old location. Switch back with pop().
Used for testing, just return the token type stream
Generated using TypeDoc
A buffered stream of tree nodes. Nodes can be from a tree of ANY kind.
This node stream sucks all nodes out of the tree specified in the constructor during construction and makes pointers into the tree using an array of Object pointers. The stream necessarily includes pointers to DOWN and UP and EOF nodes.
This stream knows how to mark/release for backtracking.
This stream is most suitable for tree interpreters that need to jump around a lot or for tree parsers requiring speed (at cost of memory). There is some duplicated functionality here with UnBufferedTreeNodeStream but just in bookkeeping, not tree walking etc...
TARGET DEVELOPERS:
This is the old CommonTreeNodeStream that buffered up entire node stream. No need to implement really as new CommonTreeNodeStream is much better and covers what we need.
CommonTreeNodeStream