public class Trees extends Object
Modifier and Type | Method and Description |
---|---|
static void |
_findAllNodes(ParseTree t,
int index,
boolean findTokens,
List<? super ParseTree> nodes) |
static List<ParseTree> |
descendants(ParseTree t) |
static List<ParseTree> |
findAllNodes(ParseTree t,
int index,
boolean findTokens) |
static Collection<ParseTree> |
findAllRuleNodes(ParseTree t,
int ruleIndex) |
static Collection<ParseTree> |
findAllTokenNodes(ParseTree t,
int ttype) |
static List<? extends Tree> |
getAncestors(Tree t)
Return a list of all ancestors of this node.
|
static List<Tree> |
getChildren(Tree t)
Return ordered list of all children of this node
|
static String |
getNodeText(Tree t,
List<String> ruleNames) |
static String |
getNodeText(Tree t,
Parser recog) |
static String |
getPS(Tree t,
List<String> ruleNames) |
static String |
getPS(Tree t,
List<String> ruleNames,
String fontName,
int fontSize) |
static String |
toStringTree(Tree t)
Print out a whole tree in LISP form.
|
static String |
toStringTree(Tree t,
List<String> ruleNames)
Print out a whole tree in LISP form.
|
static String |
toStringTree(Tree t,
Parser recog)
Print out a whole tree in LISP form.
|
static void |
writePS(Tree t,
List<String> ruleNames,
String fileName) |
static void |
writePS(Tree t,
List<String> ruleNames,
String fileName,
String fontName,
int fontSize) |
public static void writePS(Tree t, List<String> ruleNames, String fileName, String fontName, int fontSize) throws IOException
IOException
public static void writePS(Tree t, List<String> ruleNames, String fileName) throws IOException
IOException
public static String toStringTree(Tree t)
getNodeText(org.antlr.v4.runtime.tree.Tree, org.antlr.v4.runtime.Parser)
is used on the
node payloads to get the text for the nodes. Detect
parse trees and extract data appropriately.public static String toStringTree(Tree t, Parser recog)
getNodeText(org.antlr.v4.runtime.tree.Tree, org.antlr.v4.runtime.Parser)
is used on the
node payloads to get the text for the nodes. Detect
parse trees and extract data appropriately.public static String toStringTree(Tree t, List<String> ruleNames)
getNodeText(org.antlr.v4.runtime.tree.Tree, org.antlr.v4.runtime.Parser)
is used on the
node payloads to get the text for the nodes. Detect
parse trees and extract data appropriately.public static List<Tree> getChildren(Tree t)
public static List<? extends Tree> getAncestors(Tree t)
public static Collection<ParseTree> findAllTokenNodes(ParseTree t, int ttype)
public static Collection<ParseTree> findAllRuleNodes(ParseTree t, int ruleIndex)
public static void _findAllNodes(ParseTree t, int index, boolean findTokens, List<? super ParseTree> nodes)
Copyright © 2015. All rights reserved.