Packageorg.antlr.runtime.tree
Interfacepublic interface TreeNodeStream extends IntStream
ImplementorsCommonTreeNodeStream

A stream of tree nodes, accessing nodes from a tree of some kind



Public Properties
 PropertyDefined by
  hasUniqueNavigationNodes : Boolean
[write-only] As we flatten the tree, we use UP, DOWN nodes to represent the tree structure.
TreeNodeStream
 Inheritedindex : int
Return the current input symbol index 0..n where n indicates the last symbol has been read.
IntStream
 Inheritedsize : int
Only makes sense for streams that buffer everything up probably, but might be useful to display the entire stream or for testing.
IntStream
 InheritedsourceName : String
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.
IntStream
  tokenStream : TokenStream
[read-only] If the tree associated with this stream was created from a TokenStream, you can specify it here.
TreeNodeStream
  treeAdaptor : TreeAdaptor
[read-only] What adaptor can tell me how to interpret/navigate nodes and trees.
TreeNodeStream
  treeSource : Object
[read-only] Where is this stream pulling nodes from? This is not the name, but the object that provides node objects.
TreeNodeStream
Public Methods
 MethodDefined by
 Inherited
consume():void
IntStream
  
getNode(i:int):Object
Get a tree node at an absolute index i; 0..n-1.
TreeNodeStream
 Inherited
LA(i:int):int
Get int at current input pointer + i ahead where i=1 is next int.
IntStream
  
LT(k:int):Object
Get tree node at current input pointer + i ahead where i=1 is next node.
TreeNodeStream
 Inherited
mark():int
Tell the stream to start buffering if it hasn't already.
IntStream
 Inherited
release(marker:int):void
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.
IntStream
  
replaceChildren(parent:Object, startChildIndex:int, stopChildIndex:int, t:Object):void
Replace from start to stop child index of parent with t, which might be a list.
TreeNodeStream
 Inherited
rewind():void
Rewind to the input position of the last marker.
IntStream
 Inherited
rewindTo(marker:int):void
Reset the stream so that next call to index would return marker.
IntStream
 Inherited
seek(index:int):void
Set the input cursor to the position indicated by index.
IntStream
  
toStringWithRange(start:Object, stop:Object):String
Return the text of all nodes from start to stop, inclusive.
TreeNodeStream
Property detail
hasUniqueNavigationNodesproperty
hasUniqueNavigationNodes:Boolean  [write-only]

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;

Implementation
    public function set hasUniqueNavigationNodes(value:Boolean):void
tokenStreamproperty 
tokenStream:TokenStream  [read-only]

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.

Implementation
    public function get tokenStream():TokenStream
treeAdaptorproperty 
treeAdaptor:TreeAdaptor  [read-only]

What adaptor can tell me how to interpret/navigate nodes and trees. E.g., get text of a node.

Implementation
    public function get treeAdaptor():TreeAdaptor
treeSourceproperty 
treeSource:Object  [read-only]

Where is this stream pulling nodes from? This is not the name, but the object that provides node objects.

Implementation
    public function get treeSource():Object
Method detail
getNode()method
public function getNode(i:int):Object

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.

Parameters
i:int

Returns
Object
LT()method 
public function LT(k:int):Object

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. :)

Parameters
k:int

Returns
Object
replaceChildren()method 
public function replaceChildren(parent:Object, startChildIndex:int, stopChildIndex:int, t:Object):void

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. The stream is notified because it is walking the tree and might need to know you are monkeying with the underlying tree. Also, it might be able to modify the node stream to avoid restreaming 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.

Parameters
parent:Object
 
startChildIndex:int
 
stopChildIndex:int
 
t:Object
toStringWithRange()method 
public function toStringWithRange(start:Object, stop:Object):String

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.

Parameters
start:Object
 
stop:Object

Returns
String