Top Fields Constructors Methods
org.antlr.v4.runtime.tree

public Class TerminalNodeImpl

extends Object
implements TerminalNode
Class Inheritance
All Implemented Interfaces
org.antlr.v4.runtime.tree.TerminalNode, org.antlr.v4.runtime.tree.ParseTree, org.antlr.v4.runtime.tree.SyntaxTree, org.antlr.v4.runtime.tree.Tree
Known Direct Subclasses
org.antlr.v4.runtime.tree.ErrorNodeImpl
Imports
org.antlr.v4.runtime.Parser, .RuleContext, .Token, org.antlr.v4.runtime.misc.Interval

Field Summary

Modifier and TypeField and Description
public ParseTree
public Token

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public <T> T
accept(ParseTreeVisitor<? extends T> visitor)

Implements org.antlr.v4.runtime.tree.ParseTree.accept.

The ParseTreeVisitor needs a double dispatch method.
public ParseTree
getChild(int i)

Implements org.antlr.v4.runtime.tree.ParseTree.getChild.

If there are children, get the ith value indexed from 0.
public int
getChildCount()

Implements org.antlr.v4.runtime.tree.Tree.getChildCount.

How many children are there?
public ParseTree
getParent()

Implements org.antlr.v4.runtime.tree.ParseTree.getParent.

The parent of this node.
public Token
getPayload()

Implements org.antlr.v4.runtime.tree.Tree.getPayload.

This method returns whatever object represents the data at this node.
public Interval
getSourceInterval()

Implements org.antlr.v4.runtime.tree.SyntaxTree.getSourceInterval.

Return an Interval indicating the index in the TokenStream of the first and last token associated with this subtree.
public Token
public String
getText()

Implements org.antlr.v4.runtime.tree.ParseTree.getText.

Return the combined text of all leaf nodes.
public void
setParent(RuleContext parent)

Implements org.antlr.v4.runtime.tree.ParseTree.setParent.

Set the parent for this node.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public String
toStringTree(Parser parser)

Implements org.antlr.v4.runtime.tree.ParseTree.toStringTree.

Specialize toStringTree so that it can print out more information based upon the parser.
public String
toStringTree()

Implements org.antlr.v4.runtime.tree.Tree.toStringTree.

Print out a whole tree, not just a node, in LISP format (root child1 ..
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

parentback to summary
public ParseTree parent
symbolback to summary
public Token symbol

Constructor Detail

TerminalNodeImplback to summary
public TerminalNodeImpl(Token symbol)

Method Detail

acceptback to summary
public <T> T accept(ParseTreeVisitor<? extends T> visitor)

Implements org.antlr.v4.runtime.tree.ParseTree.accept.

Doc from org.antlr.v4.runtime.tree.ParseTree.accept.

The ParseTreeVisitor needs a double dispatch method.

Annotations
@Override
getChildback to summary
public ParseTree getChild(int i)

Implements org.antlr.v4.runtime.tree.ParseTree.getChild.

Doc from org.antlr.v4.runtime.tree.Tree.getChild.

If there are children, get the ith value indexed from 0.

Annotations
@Override
getChildCountback to summary
public int getChildCount()

Implements org.antlr.v4.runtime.tree.Tree.getChildCount.

Doc from org.antlr.v4.runtime.tree.Tree.getChildCount.

How many children are there? If there is none, then this node represents a leaf node.

Annotations
@Override
getParentback to summary
public ParseTree getParent()

Implements org.antlr.v4.runtime.tree.ParseTree.getParent.

Doc from org.antlr.v4.runtime.tree.Tree.getParent.

The parent of this node. If the return value is null, then this node is the root of the tree.

Annotations
@Override
getPayloadback to summary
public Token getPayload()

Implements org.antlr.v4.runtime.tree.Tree.getPayload.

Doc from org.antlr.v4.runtime.tree.Tree.getPayload.

This method returns whatever object represents the data at this node. For example, for parse trees, the payload can be a Token representing a leaf node or a RuleContext object representing a rule invocation. For abstract syntax trees (ASTs), this is a Token object.

Annotations
@Override
getSourceIntervalback to summary
public Interval getSourceInterval()

Implements org.antlr.v4.runtime.tree.SyntaxTree.getSourceInterval.

Doc from org.antlr.v4.runtime.tree.SyntaxTree.getSourceInterval.

Return an Interval 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 and has interval i..i for token index i.

An interval of i..i-1 indicates an empty interval at position i in the input stream, where 0 <= i <= the size of the input token stream. Currently, the code base can only have i=0..n-1 but in concept one could have an empty interval after EOF.

If source interval is unknown, this returns Interval#INVALID.

As a weird special case, the source interval for rules matched after EOF is unspecified.

Annotations
@Override
getSymbolback to summary
public Token getSymbol()

Implements org.antlr.v4.runtime.tree.TerminalNode.getSymbol.

Annotations
@Override
getTextback to summary
public String getText()

Implements org.antlr.v4.runtime.tree.ParseTree.getText.

Doc from org.antlr.v4.runtime.tree.ParseTree.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.

Annotations
@Override
setParentback to summary
public void setParent(RuleContext parent)

Implements org.antlr.v4.runtime.tree.ParseTree.setParent.

Doc from org.antlr.v4.runtime.tree.ParseTree.setParent.

Set the parent for this node. This is not backward compatible as it changes the interface but no one was able to create custom nodes anyway so I'm adding as it improves internal code quality. One could argue for a restructuring of the class/interface hierarchy so that setParent, addChild are moved up to Tree but that's a major change. So I'll do the minimal change, which is to add this method.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
toStringTreeback to summary
public String toStringTree(Parser parser)

Implements org.antlr.v4.runtime.tree.ParseTree.toStringTree.

Doc from org.antlr.v4.runtime.tree.ParseTree.toStringTree.

Specialize toStringTree so that it can print out more information based upon the parser.

Annotations
@Override
toStringTreeback to summary
public String toStringTree()

Implements org.antlr.v4.runtime.tree.Tree.toStringTree.

Doc from org.antlr.v4.runtime.tree.Tree.toStringTree.

Print out a whole tree, not just a node, in LISP format (root child1 .. childN). Print just a node if this is a leaf.

Annotations
@Override