| org.antlr.runtime.tree.TreeNodeStream
All known Subclasses: org.antlr.runtime.tree.CommonTreeNodeStream, org.antlr.runtime.tree.UnBufferedTreeNodeStream, org.antlr.runtime.debug.DebugTreeNodeStream,
TreeNodeStream | public interface TreeNodeStream extends IntStream(Code) | | A stream of tree nodes, accessing nodes from a tree of some kind
|
Method Summary | |
public Object | LT(int k) Get tree node at current input pointer + i ahead where i=1 is next node.
i<0 indicates nodes in the past. | public Object | get(int i) Get a tree node at an absolute index i; 0..n-1. | public TokenStream | getTokenStream() If the tree associated with this stream was created from a TokenStream,
you can specify it here. | public TreeAdaptor | getTreeAdaptor() What adaptor can tell me how to interpret/navigate nodes and
trees. | public Object | getTreeSource() Where is this stream pulling nodes from? This is not the name, but
the object that provides node objects. | public void | setUniqueNavigationNodes(boolean uniqueNavigationNodes) As we flatten the tree, we use UP, DOWN nodes to represent
the tree structure. | public String | toString(Object start, Object stop) Return the text of all nodes from start to stop, inclusive.
If the stream does not buffer all the nodes then it can still
walk recursively from start until stop. |
LT | public Object LT(int k)(Code) | | Get tree node at current input pointer + i ahead where i=1 is next node.
i<0 indicates nodes in the past. So LT(-1) is previous node, but
implementations are not required to provide results for k < -1.
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 analogus 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. :)
|
get | public Object get(int i)(Code) | | Get a tree node at an absolute index i; 0..n-1.
If you don't want to buffer up nodes, then this method makes no
sense for you.
|
getTokenStream | public TokenStream getTokenStream()(Code) | | If the tree associated with this stream was created from a TokenStream,
you can specify it here. Used to do rule $text attribute in tree
parser. Optional unless you use tree parser rule text attribute
or output=template and rewrite=true options.
|
getTreeAdaptor | public TreeAdaptor getTreeAdaptor()(Code) | | What adaptor can tell me how to interpret/navigate nodes and
trees. E.g., get text of a node.
|
getTreeSource | public Object getTreeSource()(Code) | | Where is this stream pulling nodes from? This is not the name, but
the object that provides node objects.
|
setUniqueNavigationNodes | public void setUniqueNavigationNodes(boolean uniqueNavigationNodes)(Code) | | As we flatten the tree, we use UP, DOWN nodes to represent
the tree structure. When debugging we need unique nodes
so we have to instantiate new ones. When doing normal tree
parsing, it's slow and a waste of memory to create unique
navigation nodes. Default should be false;
|
toString | public String toString(Object start, Object stop)(Code) | | Return the text of all nodes from start to stop, inclusive.
If the stream does not buffer all the nodes then it can still
walk recursively from start until stop. You can always return
null or "" too, but users should not access $ruleLabel.text in
an action of course in that case.
|
|
|