Package org.antlr.v4.runtime.tree
Interface Tree
- All Known Subinterfaces:
ErrorNode,ParseTree,RuleNode,SyntaxTree,TerminalNode
- All Known Implementing Classes:
ErrorNodeImpl,GrammarInterpreterRuleContext,graphemesParser.Emoji_sequenceContext,graphemesParser.Grapheme_clusterContext,graphemesParser.GraphemesContext,GroovyLikeParser.ArgsContext,GroovyLikeParser.BlockContext,GroovyLikeParser.ClassBodyContext,GroovyLikeParser.ClosureContext,GroovyLikeParser.CompilationUnitContext,GroovyLikeParser.ExpressionContext,GroovyLikeParser.FieldDeclContext,GroovyLikeParser.MemberContext,GroovyLikeParser.MethodDeclContext,GroovyLikeParser.NlsContext,GroovyLikeParser.PackageDeclContext,GroovyLikeParser.ParamsContext,GroovyLikeParser.PostfixContext,GroovyLikeParser.PrimaryContext,GroovyLikeParser.QualifiedNameContext,GroovyLikeParser.SepContext,GroovyLikeParser.StatementContext,GroovyLikeParser.TypeDeclContext,InterpreterRuleContext,JavaParser.AnnotationConstantRestContext,JavaParser.AnnotationContext,JavaParser.AnnotationMethodOrConstantRestContext,JavaParser.AnnotationMethodRestContext,JavaParser.AnnotationNameContext,JavaParser.AnnotationTypeBodyContext,JavaParser.AnnotationTypeDeclarationContext,JavaParser.AnnotationTypeElementDeclarationContext,JavaParser.AnnotationTypeElementRestContext,JavaParser.ArgumentsContext,JavaParser.ArrayCreatorRestContext,JavaParser.ArrayInitializerContext,JavaParser.BlockContext,JavaParser.BlockStatementContext,JavaParser.CatchClauseContext,JavaParser.CatchTypeContext,JavaParser.ClassBodyContext,JavaParser.ClassBodyDeclarationContext,JavaParser.ClassCreatorRestContext,JavaParser.ClassDeclarationContext,JavaParser.ClassOrInterfaceModifierContext,JavaParser.ClassOrInterfaceTypeContext,JavaParser.CompilationUnitContext,JavaParser.ConstantDeclaratorContext,JavaParser.ConstantExpressionContext,JavaParser.ConstDeclarationContext,JavaParser.ConstructorBodyContext,JavaParser.ConstructorDeclarationContext,JavaParser.CreatedNameContext,JavaParser.CreatorContext,JavaParser.DefaultValueContext,JavaParser.ElementValueArrayInitializerContext,JavaParser.ElementValueContext,JavaParser.ElementValuePairContext,JavaParser.ElementValuePairsContext,JavaParser.EnhancedForControlContext,JavaParser.EnumBodyDeclarationsContext,JavaParser.EnumConstantContext,JavaParser.EnumConstantNameContext,JavaParser.EnumConstantsContext,JavaParser.EnumDeclarationContext,JavaParser.ExplicitGenericInvocationContext,JavaParser.ExplicitGenericInvocationSuffixContext,JavaParser.ExpressionContext,JavaParser.ExpressionListContext,JavaParser.FieldDeclarationContext,JavaParser.FinallyBlockContext,JavaParser.ForControlContext,JavaParser.ForInitContext,JavaParser.FormalParameterContext,JavaParser.FormalParameterListContext,JavaParser.FormalParametersContext,JavaParser.ForUpdateContext,JavaParser.GenericConstructorDeclarationContext,JavaParser.GenericInterfaceMethodDeclarationContext,JavaParser.GenericMethodDeclarationContext,JavaParser.ImportDeclarationContext,JavaParser.InnerCreatorContext,JavaParser.InterfaceBodyContext,JavaParser.InterfaceBodyDeclarationContext,JavaParser.InterfaceDeclarationContext,JavaParser.InterfaceMemberDeclarationContext,JavaParser.InterfaceMethodDeclarationContext,JavaParser.LastFormalParameterContext,JavaParser.LiteralContext,JavaParser.LocalVariableDeclarationContext,JavaParser.LocalVariableDeclarationStatementContext,JavaParser.MemberDeclarationContext,JavaParser.MethodBodyContext,JavaParser.MethodDeclarationContext,JavaParser.ModifierContext,JavaParser.NonWildcardTypeArgumentsContext,JavaParser.NonWildcardTypeArgumentsOrDiamondContext,JavaParser.PackageDeclarationContext,JavaParser.ParExpressionContext,JavaParser.PrimaryContext,JavaParser.PrimitiveTypeContext,JavaParser.QualifiedNameContext,JavaParser.QualifiedNameListContext,JavaParser.ResourceContext,JavaParser.ResourcesContext,JavaParser.ResourceSpecificationContext,JavaParser.StatementContext,JavaParser.StatementExpressionContext,JavaParser.SuperSuffixContext,JavaParser.SwitchBlockStatementGroupContext,JavaParser.SwitchLabelContext,JavaParser.TypeArgumentContext,JavaParser.TypeArgumentsContext,JavaParser.TypeArgumentsOrDiamondContext,JavaParser.TypeBoundContext,JavaParser.TypeContext,JavaParser.TypeDeclarationContext,JavaParser.TypeListContext,JavaParser.TypeParameterContext,JavaParser.TypeParametersContext,JavaParser.VariableDeclaratorContext,JavaParser.VariableDeclaratorIdContext,JavaParser.VariableDeclaratorsContext,JavaParser.VariableInitializerContext,JavaParser.VariableModifierContext,ParserRuleContext,RuleContext,RuleContextWithAltNum,TerminalNodeImpl
public interface Tree
The basic notion of a tree has a parent, a payload, and a list of children.
It is the most abstract interface for all the trees used by ANTLR.
-
Method Summary
Modifier and TypeMethodDescriptiongetChild(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.Print out a whole tree, not just a node, in LISP format(root child1 .. childN).
-
Method Details
-
getParent
Tree getParent()The parent of this node. If the return value is null, then this node is the root of the tree. -
getPayload
Object getPayload()This 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. -
getChild
If there are children, get theith value indexed from 0. -
getChildCount
int getChildCount()How many children are there? If there is none, then this node represents a leaf node. -
toStringTree
String 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.
-