Package org.antlr.runtime.tree
Class RewriteRuleNodeStream
- java.lang.Object
-
- org.antlr.runtime.tree.RewriteRuleElementStream
-
- org.antlr.runtime.tree.RewriteRuleNodeStream
-
public class RewriteRuleNodeStream extends RewriteRuleElementStream
Queues up nodes matched on left side of -> in a tree parser. This is the analog of RewriteRuleTokenStream for normal parsers.
-
-
Field Summary
-
Fields inherited from class org.antlr.runtime.tree.RewriteRuleElementStream
adaptor, cursor, dirty, elementDescription, elements, singleElement
-
-
Constructor Summary
Constructors Constructor Description RewriteRuleNodeStream(TreeAdaptor adaptor, String elementDescription)RewriteRuleNodeStream(TreeAdaptor adaptor, String elementDescription, Object oneElement)Create a stream with one elementRewriteRuleNodeStream(TreeAdaptor adaptor, String elementDescription, List<Object> elements)Create a stream, but feed off an existing list
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Objectdup(Object el)When constructing trees, sometimes we need to dup a token or AST subtree.ObjectnextNode()protected ObjecttoTree(Object el)Ensure stream emits trees; tokens must be converted to AST nodes.-
Methods inherited from class org.antlr.runtime.tree.RewriteRuleElementStream
_next, add, getDescription, hasNext, nextTree, reset, size
-
-
-
-
Constructor Detail
-
RewriteRuleNodeStream
public RewriteRuleNodeStream(TreeAdaptor adaptor, String elementDescription)
-
RewriteRuleNodeStream
public RewriteRuleNodeStream(TreeAdaptor adaptor, String elementDescription, Object oneElement)
Create a stream with one element
-
RewriteRuleNodeStream
public RewriteRuleNodeStream(TreeAdaptor adaptor, String elementDescription, List<Object> elements)
Create a stream, but feed off an existing list
-
-
Method Detail
-
nextNode
public Object nextNode()
-
toTree
protected Object toTree(Object el)
Description copied from class:RewriteRuleElementStreamEnsure stream emits trees; tokens must be converted to AST nodes. AST nodes can be passed through unmolested.- Overrides:
toTreein classRewriteRuleElementStream
-
dup
protected Object dup(Object el)
Description copied from class:RewriteRuleElementStreamWhen 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.- Specified by:
dupin classRewriteRuleElementStream
-
-