public class CommonTreeNodeStream extends LookaheadStream<Object> implements TreeNodeStream
Modifier and Type | Field and Description |
---|---|
protected IntArray |
calls
Stack of indexes used for push/pop calls
|
static int |
DEFAULT_INITIAL_BUFFER_SIZE |
protected boolean |
hasNilRoot
Tree (nil A B C) trees like flat A B C streams
|
static int |
INITIAL_CALL_STACK_SIZE |
protected TreeIterator |
it
The tree iterator we using
|
protected int |
level
Tracks tree depth.
|
protected Object |
root
Pull nodes from which tree?
|
protected TokenStream |
tokens
If this tree (root) was created from a token stream, track it.
|
eof, eofElementIndex, lastMarker, markDepth, UNINITIALIZED_EOF_ELEMENT_INDEX
Constructor and Description |
---|
CommonTreeNodeStream(Object tree) |
CommonTreeNodeStream(TreeAdaptor adaptor,
Object tree) |
Modifier and Type | Method and Description |
---|---|
String |
getSourceName()
Where are you getting symbols from? Normally, implementations will
pass the buck all the way to the lexer who can ask its input stream
for the file name or whatever.
|
TokenStream |
getTokenStream()
If the tree associated with this stream was created from a TokenStream,
you can specify it here.
|
TreeAdaptor |
getTreeAdaptor()
What adaptor can tell me how to interpret/navigate nodes and
trees.
|
Object |
getTreeSource()
Where is this stream pulling nodes from? This is not the name, but
the object that provides node objects.
|
int |
LA(int i)
Get int at current input pointer + i ahead where i=1 is next int.
|
Object |
nextElement()
Pull elements from tree iterator.
|
int |
pop()
Seek back to previous index saved during last push() call.
|
void |
push(int index)
Make stream jump to a new location, saving old location.
|
void |
replaceChildren(Object parent,
int startChildIndex,
int stopChildIndex,
Object t)
Replace from start to stop child index of parent with t, which might
be a list.
|
void |
reset()
Reset the tree node stream in such a way that it acts like
a freshly constructed stream.
|
void |
setTokenStream(TokenStream tokens) |
void |
setTreeAdaptor(TreeAdaptor adaptor) |
void |
setUniqueNavigationNodes(boolean uniqueNavigationNodes)
As we flatten the tree, we use UP, DOWN nodes to represent
the tree structure.
|
String |
toString(Object start,
Object stop)
Return the text of all nodes from start to stop, inclusive.
|
String |
toTokenTypeString()
For debugging; destructive: moves tree iterator to end.
|
consume, fill, getCurrentSymbol, index, LB, LT, mark, release, remove, rewind, rewind, seek, size, sync
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
get, LT
public static final int DEFAULT_INITIAL_BUFFER_SIZE
public static final int INITIAL_CALL_STACK_SIZE
protected Object root
protected TokenStream tokens
protected TreeIterator it
protected IntArray calls
protected boolean hasNilRoot
protected int level
public CommonTreeNodeStream(Object tree)
public CommonTreeNodeStream(TreeAdaptor adaptor, Object tree)
public void reset()
TreeNodeStream
reset
in interface TreeNodeStream
reset
in class LookaheadStream<Object>
public Object nextElement()
nextElement
in class LookaheadStream<Object>
public void setUniqueNavigationNodes(boolean uniqueNavigationNodes)
TreeNodeStream
setUniqueNavigationNodes
in interface TreeNodeStream
public Object getTreeSource()
TreeNodeStream
getTreeSource
in interface TreeNodeStream
public String getSourceName()
IntStream
getSourceName
in interface IntStream
public TokenStream getTokenStream()
TreeNodeStream
getTokenStream
in interface TreeNodeStream
public void setTokenStream(TokenStream tokens)
public TreeAdaptor getTreeAdaptor()
TreeNodeStream
getTreeAdaptor
in interface TreeNodeStream
public void setTreeAdaptor(TreeAdaptor adaptor)
public int LA(int i)
IntStream
public void push(int index)
public int pop()
public void replaceChildren(Object parent, int startChildIndex, int stopChildIndex, Object t)
TreeNodeStream
replaceChildren
in interface TreeNodeStream
public String toString(Object start, Object stop)
TreeNodeStream
toString
in interface TreeNodeStream
public String toTokenTypeString()
Copyright © 2020. All rights reserved.