Class DescendantCollector

java.lang.Object
org.ek9lang.compiler.support.trees.DescendantCollector

public final class DescendantCollector extends Object
THE parse-tree DESCENDANT collector for the compiler - use this, do not hand-write a recursive for (i < getChildCount()) collector. The compiler-services mcp.oracle.support.ParseTrees delegates here (stop-at-match). The siblings for walking UP are in this package. Hold one.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends org.antlr.v4.runtime.tree.ParseTree>
    void
    collect(org.antlr.v4.runtime.tree.ParseTree node, Class<T> type, boolean descendIntoMatch, List<? super T> out)
    Collect, in document (pre-order) order, node itself and every descendant that is an instance of type.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DescendantCollector

      public DescendantCollector()
  • Method Details

    • collect

      public <T extends org.antlr.v4.runtime.tree.ParseTree> void collect(org.antlr.v4.runtime.tree.ParseTree node, Class<T> type, boolean descendIntoMatch, List<? super T> out)
      Collect, in document (pre-order) order, node itself and every descendant that is an instance of type.
      Parameters:
      descendIntoMatch - true to keep descending below a match (a nested match is collected too); false to stop at a match (a nested match inside a matched node is not collected).