Public Member Functions | Public Attributes | Private Member Functions | Static Private Attributes
rve_interface_gen.antlr3.tree.RewriteRuleElementStream Class Reference
Inheritance diagram for rve_interface_gen.antlr3.tree.RewriteRuleElementStream:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def add
def dup
def getDescription
def hasNext
def nextTree
def reset
def size
def toTree

Public Attributes

 adaptor
 cursor
 dirty
 elementDescription
 elements
 singleElement

Private Member Functions

def _next

Static Private Attributes

 __len__ = size

Detailed Description

@brief Internal helper class.

A generic list of elements tracked in an alternative to be used in
a -> rewrite rule.  We need to subclass to fill in the next() method,
which returns either an AST node wrapped around a token payload or
an existing subtree.

Once you start next()ing, do not try to add more elements.  It will
break the cursor tracking I believe.

@see org.antlr.runtime.tree.RewriteRuleSubtreeStream
@see org.antlr.runtime.tree.RewriteRuleTokenStream

TODO: add mechanism to detect/puke on modification after reading from
stream

Definition at line 2424 of file tree.py.


Constructor & Destructor Documentation

def rve_interface_gen.antlr3.tree.RewriteRuleElementStream.__init__ (   self,
  adaptor,
  elementDescription,
  elements = None 
)

Definition at line 2442 of file tree.py.


Member Function Documentation

do the work of getting the next element, making sure that it's
a tree node or subtree.  Deal with the optimization of single-
element list versus list of size > 1.  Throw an exception
if the stream is empty or we're out of elements and size>1.
protected so you can override in a subclass if necessary.

Definition at line 2528 of file tree.py.

Definition at line 2488 of file tree.py.

When constructing trees, sometimes we need to dup a token or AST
subtree.  Dup'ing a token means just creating another AST node
around it.  For trees, you must call the adaptor.dupTree() unless
the element is for a tree root; then it must be a node dup.

Reimplemented in rve_interface_gen.antlr3.tree.RewriteRuleNodeStream, rve_interface_gen.antlr3.tree.RewriteRuleSubtreeStream, and rve_interface_gen.antlr3.tree.RewriteRuleTokenStream.

Definition at line 2558 of file tree.py.

Deprecated. Directly access elementDescription attribute

Definition at line 2598 of file tree.py.

Definition at line 2578 of file tree.py.

Return the next element in the stream.  If out of elements, throw
an exception unless size()==1.  If size is 1, then return elements[0].

Return a duplicate node/subtree if stream is out of elements and
size==1. If we've already used the element, dup (dirty bit set).

Definition at line 2507 of file tree.py.

Reset the condition of this stream so that it appears we have
not consumed any of its elements.  Elements themselves are untouched.
Once we reset the stream, any future use will need duplicates.  Set
the dirty bit.

Definition at line 2476 of file tree.py.

Definition at line 2586 of file tree.py.

Ensure stream emits trees; tokens must be converted to AST nodes.
AST nodes can be passed through unmolested.

Reimplemented in rve_interface_gen.antlr3.tree.RewriteRuleNodeStream, and rve_interface_gen.antlr3.tree.RewriteRuleTokenStream.

Definition at line 2569 of file tree.py.


Member Data Documentation

Definition at line 2595 of file tree.py.

Definition at line 2442 of file tree.py.

Definition at line 2442 of file tree.py.

Definition at line 2442 of file tree.py.

Definition at line 2442 of file tree.py.

Definition at line 2442 of file tree.py.

Definition at line 2442 of file tree.py.


The documentation for this class was generated from the following file:


rve_interface_gen
Author(s): Josh Faust
autogenerated on Wed Dec 11 2013 14:31:00