public class TerminalNodeImpl extends java.lang.Object implements TerminalNode
| Constructor and Description |
|---|
TerminalNodeImpl(Token symbol) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
accept(ParseTreeVisitor<? extends T> visitor)
The
ParseTreeVisitor needs a double dispatch method. |
ParseTree |
getChild(int i)
If there are children, get the
ith value indexed from 0. |
int |
getChildCount()
How many children are there? If there is none, then this
node represents a leaf node.
|
ParseTree |
getParent()
The parent of this node.
|
Token |
getPayload()
This method returns whatever object represents the data at this note.
|
Interval |
getSourceInterval()
Return an
Interval indicating the index in the
TokenStream of the first and last token associated with this
subtree. |
Token |
getSymbol() |
java.lang.String |
getText()
Return the combined text of all leaf nodes.
|
java.lang.String |
toString() |
java.lang.String |
toStringTree()
Print out a whole tree, not just a node, in LISP format
{@code (root child1 ..
|
java.lang.String |
toStringTree(Parser parser)
Specialize toStringTree so that it can print out more information
based upon the parser.
|
public TerminalNodeImpl(Token symbol)
public ParseTree getChild(int i)
Treeith value indexed from 0.public Token getSymbol()
getSymbol in interface TerminalNodepublic ParseTree getParent()
Treepublic Token getPayload()
TreeToken representing
a leaf node or a RuleContext object representing a rule
invocation. For abstract syntax trees (ASTs), this is a Token
object.getPayload in interface Treepublic Interval getSourceInterval()
SyntaxTreeInterval indicating the index in the
TokenStream of the first and last token associated with this
subtree. If this node is a leaf, then the interval represents a single
token.
If source interval is unknown, this returns Interval.INVALID.
getSourceInterval in interface SyntaxTreepublic int getChildCount()
TreegetChildCount in interface Treepublic <T> T accept(ParseTreeVisitor<? extends T> visitor)
ParseTreeParseTreeVisitor needs a double dispatch method.public java.lang.String getText()
ParseTreepublic java.lang.String toStringTree(Parser parser)
ParseTreetoStringTree in interface ParseTreepublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toStringTree()
Tree(root child1 .. childN). Print just a node if this is a leaf.toStringTree in interface Tree