Package org.antlr.v4.runtime.tree
Interface ParseTree
-
- All Superinterfaces:
SyntaxTree
,Tree
- All Known Subinterfaces:
ErrorNode
,RuleNode
,TerminalNode
- All Known Implementing Classes:
ErrorNodeImpl
,GrammarInterpreterRuleContext
,InterpreterRuleContext
,ParserRuleContext
,RuleContext
,RuleContextWithAltNum
,TerminalNodeImpl
public interface ParseTree extends SyntaxTree
An interface to access the tree ofRuleContext
objects created during a parse that makes the data structure look like a simple parse tree. This node represents both internal nodes, rule invocations, and leaf nodes, token matches.The payload is either a
Token
or aRuleContext
object.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> T
accept(ParseTreeVisitor<? extends T> visitor)
TheParseTreeVisitor
needs a double dispatch method.ParseTree
getChild(int i)
If there are children, get thei
th value indexed from 0.ParseTree
getParent()
The parent of this node.String
getText()
Return the combined text of all leaf nodes.String
toStringTree(Parser parser)
Specialize toStringTree so that it can print out more information based upon the parser.-
Methods inherited from interface org.antlr.v4.runtime.tree.SyntaxTree
getSourceInterval
-
Methods inherited from interface org.antlr.v4.runtime.tree.Tree
getChildCount, getPayload, toStringTree
-
-
-
-
Method Detail
-
getParent
ParseTree getParent()
Description copied from interface:Tree
The parent of this node. If the return value is null, then this node is the root of the tree.
-
getChild
ParseTree getChild(int i)
Description copied from interface:Tree
If there are children, get thei
th value indexed from 0.
-
accept
<T> T accept(ParseTreeVisitor<? extends T> visitor)
TheParseTreeVisitor
needs a double dispatch method.
-
getText
String getText()
Return the combined text of all leaf nodes. Does not get any off-channel tokens (if any) so won't return whitespace and comments if they are sent to parser on hidden channel.
-
-