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.
  • Constructor Details

    • 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 elements)
      Create a stream, but feed off an existing list
  • Method Details

    • nextNode

      public Object nextNode()
    • toTree

      protected Object toTree(Object el)
      Description copied from class: RewriteRuleElementStream
      Ensure stream emits trees; tokens must be converted to AST nodes. AST nodes can be passed through unmolested.
      Overrides:
      toTree in class RewriteRuleElementStream
    • dup

      protected Object dup(Object el)
      Description copied from class: RewriteRuleElementStream
      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.
      Specified by:
      dup in class RewriteRuleElementStream