Class TerminalNodeImpl
java.lang.Object
org.graalvm.shadowed.org.antlr.v4.runtime.tree.TerminalNodeImpl
- All Implemented Interfaces:
ParseTree,SyntaxTree,TerminalNode,Tree
- Direct Known Subclasses:
ErrorNodeImpl
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Taccept(ParseTreeVisitor<? extends T> visitor) TheParseTreeVisitorneeds a double dispatch method.getChild(int i) If there are children, get theith value indexed from 0.intHow many children are there? If there is none, then this node represents a leaf node.The parent of this node.This method returns whatever object represents the data at this node.Return anIntervalindicating the index in theTokenStreamof the first and last token associated with this subtree.getText()Return the combined text of all leaf nodes.voidsetParent(RuleContext parent) Set the parent for this node.toString()Print out a whole tree, not just a node, in LISP format(root child1 .. childN).toStringTree(Parser parser) Specialize toStringTree so that it can print out more information based upon the parser.
-
Field Details
-
symbol
-
parent
-
-
Constructor Details
-
TerminalNodeImpl
-
-
Method Details
-
getChild
-
getSymbol
- Specified by:
getSymbolin interfaceTerminalNode
-
getParent
-
setParent
Description copied from interface:ParseTreeSet 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. -
getPayload
Description copied from interface:TreeThis method returns whatever object represents the data at this node. For example, for parse trees, the payload can be aTokenrepresenting a leaf node or aRuleContextobject representing a rule invocation. For abstract syntax trees (ASTs), this is aTokenobject.- Specified by:
getPayloadin interfaceTree
-
getSourceInterval
Description copied from interface:SyntaxTreeReturn anIntervalindicating the index in theTokenStreamof 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.
- Specified by:
getSourceIntervalin interfaceSyntaxTree
-
getChildCount
public int getChildCount()Description copied from interface:TreeHow many children are there? If there is none, then this node represents a leaf node.- Specified by:
getChildCountin interfaceTree
-
accept
Description copied from interface:ParseTreeTheParseTreeVisitorneeds a double dispatch method. -
getText
-
toStringTree
Description copied from interface:ParseTreeSpecialize toStringTree so that it can print out more information based upon the parser.- Specified by:
toStringTreein interfaceParseTree
-
toString
-
toStringTree
Description copied from interface:TreePrint out a whole tree, not just a node, in LISP format(root child1 .. childN). Print just a node if this is a leaf.- Specified by:
toStringTreein interfaceTree
-