Trees class
A set of utility routines useful for all kinds of ANTLR trees. */
Constructors
- Trees()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
descendants(
ParseTree t) → List< ParseTree> - @deprecated */
-
findAllNodes(
ParseTree t, int index, bool findTokens) → List< ParseTree> -
findAllRuleNodes(
ParseTree t, int ruleIndex) → List< ParseTree> -
findAllTokenNodes(
ParseTree t, int ttype) → List< ParseTree> -
findNodeSuchThat(
Tree? t, bool pred(Tree?)) → Tree? - Return first node satisfying the pred
-
getAncestors(
Tree t) → List< Tree> - Return a list of all ancestors of this node. The first node of list is the root and the last is the parent of this node.
-
getChildren(
Tree t) → List< Tree> - Return ordered list of all children of this node */
-
getDescendants(
ParseTree t) → List< ParseTree> - Get all descendents; includes t itself.
-
getNodeText(
Tree t, {Parser? recog, List< String> ? ruleNames}) → String -
getRootOfSubtreeEnclosingRegion(
ParseTree t, int startTokenIndex, int stopTokenIndex) → ParserRuleContext? - Find smallest subtree of t enclosing range startTokenIndex..stopTokenIndex inclusively using postorder traversal. Recursive depth-first-search.
-
isAncestorOf(
Tree? t, Tree? u) → bool - Return true if t is u's parent or a node on path to root from u. Use == not equals().
-
stripChildrenOutOfRange(
ParserRuleContext? t, ParserRuleContext root, int startIndex, int stopIndex) → void - Replace any subtree siblings of root that are completely to left or right of lookahead range with a CommonToken(Token.INVALID_TYPE,"...") node. The source interval for t is not altered to suit smaller range!
-
toStringTree(
Tree? t, {Parser? recog, List< String> ? ruleNames}) → String - Print out a whole tree in LISP form. {@link #getNodeText} is used on the node payloads to get the text for the nodes. Detect parse trees and extract data appropriately.