public class DebugTreeNodeStream extends Object implements TreeNodeStream
Modifier and Type | Field and Description |
---|---|
protected TreeAdaptor |
adaptor |
protected DebugEventListener |
dbg |
protected boolean |
initialStreamState |
protected TreeNodeStream |
input |
protected int |
lastMarker
Track the last mark() call result value for use in rewind().
|
Constructor and Description |
---|
DebugTreeNodeStream(TreeNodeStream input,
DebugEventListener dbg) |
Modifier and Type | Method and Description |
---|---|
void |
consume() |
Object |
get(int i)
Get a tree node at an absolute index i; 0..n-1.
|
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 |
index()
Return the current input symbol index 0..n where n indicates the
last symbol has been read.
|
int |
LA(int i)
Get int at current input pointer + i ahead where i=1 is next int.
|
Object |
LT(int i)
Get tree node at current input pointer + i ahead where i=1 is next node.
|
int |
mark()
Tell the stream to start buffering if it hasn't already.
|
void |
release(int marker)
You may want to commit to a backtrack but don't want to force the
stream to keep bookkeeping objects around for a marker that is
no longer necessary.
|
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 |
rewind()
Rewind to the input position of the last marker.
|
void |
rewind(int marker)
Reset the stream so that next call to index would return marker.
|
void |
seek(int index)
Set the input cursor to the position indicated by index.
|
void |
setDebugListener(DebugEventListener dbg) |
void |
setUniqueNavigationNodes(boolean uniqueNavigationNodes)
It is normally this object that instructs the node stream to
create unique nav nodes, but to satisfy interface, we have to
define it.
|
int |
size()
Only makes sense for streams that buffer everything up probably, but
might be useful to display the entire stream or for testing.
|
String |
toString(Object start,
Object stop)
Return the text of all nodes from start to stop, inclusive.
|
protected DebugEventListener dbg
protected TreeAdaptor adaptor
protected TreeNodeStream input
protected boolean initialStreamState
protected int lastMarker
public DebugTreeNodeStream(TreeNodeStream input, DebugEventListener dbg)
public void setDebugListener(DebugEventListener dbg)
public TreeAdaptor getTreeAdaptor()
TreeNodeStream
getTreeAdaptor
in interface TreeNodeStream
public Object get(int i)
TreeNodeStream
get
in interface TreeNodeStream
public Object LT(int i)
TreeNodeStream
LT
in interface TreeNodeStream
public int LA(int i)
IntStream
public int mark()
IntStream
public int index()
IntStream
public void rewind(int marker)
IntStream
public void rewind()
IntStream
public void release(int marker)
IntStream
public void seek(int index)
IntStream
public int size()
IntStream
public void reset()
TreeNodeStream
reset
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 setUniqueNavigationNodes(boolean uniqueNavigationNodes)
setUniqueNavigationNodes
in interface TreeNodeStream
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
Copyright © 2020. All rights reserved.