Package: org.apache.groovy.parser.antlr4

## [Java] Class AstBuilder

- org.apache.groovy.parser.antlr4.AstBuilder

-     public class AstBuilder
      extends GroovyParserBaseVisitor

  Builds the AST from the parse tree generated by Antlr4.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `AstBuilder(SourceUnit sourceUnit, boolean groovydocEnabled, boolean runtimeGroovydocEnabled)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public BlockStatement` | `appendStatementsToBlockStatement(BlockStatement bs, Statement statements)`
    `` | `public ModuleNode` | `buildAST()`
    `` | `public Object` | `visit(ParseTree tree)` Visit tree safely, no NPE occurred when the tree is null.
    `` | `public BinaryExpression` | `visitAdditiveExprAlt(GroovyParser.AdditiveExprAltContext ctx)`
    `` | `public BinaryExpression` | `visitAndExprAlt(GroovyParser.AndExprAltContext ctx)`
    `` | `public ClassNode` | `visitAnnotatedQualifiedClassName(GroovyParser.AnnotatedQualifiedClassNameContext ctx)`
    `` | `public AnnotationNode` | `visitAnnotation(GroovyParser.AnnotationContext ctx)`
    `` | `public String` | `visitAnnotationName(GroovyParser.AnnotationNameContext ctx)`
    `` | `public List<AnnotationNode>` | `visitAnnotationsOpt(GroovyParser.AnnotationsOptContext ctx)`
    `` | `public InnerClassNode` | `visitAnonymousInnerClassDeclaration(GroovyParser.AnonymousInnerClassDeclarationContext ctx)`
    `` | `public Expression` | `visitArguments(GroovyParser.ArgumentsContext ctx)`
    `` | `public List<Expression>` | `visitArrayInitializer(GroovyParser.ArrayInitializerContext ctx)`
    `` | `public AssertStatement` | `visitAssertStatement(GroovyParser.AssertStatementContext ctx)`
    `` | `public BinaryExpression` | `visitAssignmentExprAlt(GroovyParser.AssignmentExprAltContext ctx)`
    `` | `public Expression` | `visitAsyncClosureExprAlt(GroovyParser.AsyncClosureExprAltContext ctx)`
    `` | `public Expression` | `visitAwaitExprAlt(GroovyParser.AwaitExprAltContext ctx)`
    `` | `public Statement` | `visitBlock(GroovyParser.BlockContext ctx)`
    `` | `public Statement` | `visitBlockStatement(GroovyParser.BlockStatementContext ctx)`
    `` | `public BlockStatement` | `visitBlockStatements(GroovyParser.BlockStatementsContext ctx)`
    `` | `public BlockStatement` | `visitBlockStatementsOpt(GroovyParser.BlockStatementsOptContext ctx)`
    `` | `public ConstantExpression` | `visitBooleanLiteralAlt(GroovyParser.BooleanLiteralAltContext ctx)`
    `` | `public BreakStatement` | `visitBreakStatement(GroovyParser.BreakStatementContext ctx)`
    `` | `public VariableExpression` | `visitBuiltInType(GroovyParser.BuiltInTypeContext ctx)`
    `` | `public CastExpression` | `visitCastExprAlt(GroovyParser.CastExprAltContext ctx)`
    `` | `public ClassNode` | `visitCastParExpression(GroovyParser.CastParExpressionContext ctx)`
    `` | `public List<CatchStatement>` | `visitCatchClause(GroovyParser.CatchClauseContext ctx)` Multi-catch(1..*) clause will be unpacked to several normal catch clauses, so the return type is List
    `` | `public List<ClassNode>` | `visitCatchType(GroovyParser.CatchTypeContext ctx)`
    `` | `public Void` | `visitClassBody(GroovyParser.ClassBodyContext ctx)`
    `` | `public Void` | `visitClassBodyDeclaration(GroovyParser.ClassBodyDeclarationContext ctx)`
    `` | `public ClassNode` | `visitClassDeclaration(GroovyParser.ClassDeclarationContext ctx)`
    `` | `public String` | `visitClassName(GroovyParser.ClassNameContext ctx)`
    `` | `public ModifierNode` | `visitClassOrInterfaceModifier(GroovyParser.ClassOrInterfaceModifierContext ctx)`
    `` | `public List<ModifierNode>` | `visitClassOrInterfaceModifiers(GroovyParser.ClassOrInterfaceModifiersContext ctx)`
    `` | `public List<ModifierNode>` | `visitClassOrInterfaceModifiersOpt(GroovyParser.ClassOrInterfaceModifiersOptContext ctx)`
    `` | `public ClosureExpression` | `visitClosure(GroovyParser.ClosureContext ctx)`
    `` | `public ClosureExpression` | `visitClosureOrLambdaExpression(GroovyParser.ClosureOrLambdaExpressionContext ctx)`
    `` | `public ClassNode` | `visitCoercionType(GroovyParser.CoercionTypeContext ctx)`
    `` | `public Expression` | `visitCommandArgument(GroovyParser.CommandArgumentContext ctx)`
    `` | `public ExpressionStatement` | `visitCommandExprAlt(GroovyParser.CommandExprAltContext ctx)`
    `` | `public Expression` | `visitCommandExpression(GroovyParser.CommandExpressionContext ctx)`
    `` | `public MethodNode` | `visitCompactConstructorDeclaration(GroovyParser.CompactConstructorDeclarationContext ctx)`
    `` | `public ModuleNode` | `visitCompilationUnit(GroovyParser.CompilationUnitContext ctx)`
    `` | `public Expression` | `visitConditionalExprAlt(GroovyParser.ConditionalExprAltContext ctx)`
    `` | `public Statement` | `visitConditionalStatement(GroovyParser.ConditionalStatementContext ctx)`
    `` | `public ContinueStatement` | `visitContinueStatement(GroovyParser.ContinueStatementContext ctx)`
    `` | `public ClassNode` | `visitCreatedName(GroovyParser.CreatedNameContext ctx)`
    `` | `public Expression` | `visitCreator(GroovyParser.CreatorContext ctx)`
    `` | `public ExpressionStatement` | `visitDeferStmtAlt(GroovyParser.DeferStmtAltContext ctx)`
    `` | `public DoWhileStatement` | `visitDoWhileStmtAlt(GroovyParser.DoWhileStmtAltContext ctx)`
    `` | `public Expression` | `visitDynamicMemberName(GroovyParser.DynamicMemberNameContext ctx)`
    `` | `public Expression` | `visitElementValue(GroovyParser.ElementValueContext ctx)`
    `` | `public ListExpression` | `visitElementValueArrayInitializer(GroovyParser.ElementValueArrayInitializerContext ctx)`
    `` | `public Tuple2<String, Expression>` | `visitElementValuePair(GroovyParser.ElementValuePairContext ctx)`
    `` | `public Map<String, Expression>` | `visitElementValuePairs(GroovyParser.ElementValuePairsContext ctx)`
    `` | `public List<Tuple2<String, Expression>>` | `visitElementValues(GroovyParser.ElementValuesContext ctx)`
    `` | `public Expression` | `visitEnhancedArgumentListElement(GroovyParser.EnhancedArgumentListElementContext ctx)`
    `` | `public Expression` | `visitEnhancedArgumentListInPar(GroovyParser.EnhancedArgumentListInParContext ctx)`
    `` | `public Expression` | `visitEnhancedExpression(GroovyParser.EnhancedExpressionContext ctx)`
    `` | `public Function<Statement, ForStatement>` | `visitEnhancedForControl(GroovyParser.EnhancedForControlContext ctx)`
    `` | `public Expression` | `visitEnhancedStatementExpression(GroovyParser.EnhancedStatementExpressionContext ctx)`
    `` | `public FieldNode` | `visitEnumConstant(GroovyParser.EnumConstantContext ctx)`
    `` | `public List<FieldNode>` | `visitEnumConstants(GroovyParser.EnumConstantsContext ctx)`
    `` | `public BinaryExpression` | `visitEqualityExprAlt(GroovyParser.EqualityExprAltContext ctx)`
    `` | `public BinaryExpression` | `visitExclusiveOrExprAlt(GroovyParser.ExclusiveOrExprAltContext ctx)`
    `` | `public Expression` | `visitExpressionInPar(GroovyParser.ExpressionInParContext ctx)`
    `` | `public List<Expression>` | `visitExpressionList(GroovyParser.ExpressionListContext ctx)`
    `` | `public Expression` | `visitExpressionListElement(GroovyParser.ExpressionListElementContext ctx)`
    `` | `public Void` | `visitFieldDeclaration(GroovyParser.FieldDeclarationContext ctx)`
    `` | `public Statement` | `visitFinallyBlock(GroovyParser.FinallyBlockContext ctx)`
    `` | `public ConstantExpression` | `visitFloatingPointLiteralAlt(GroovyParser.FloatingPointLiteralAltContext ctx)`
    `` | `public Function<Statement, ForStatement>` | `visitForControl(GroovyParser.ForControlContext ctx)`
    `` | `public Expression` | `visitForInit(GroovyParser.ForInitContext ctx)`
    `` | `public Statement` | `visitForStmtAlt(GroovyParser.ForStmtAltContext ctx)`
    `` | `public Expression` | `visitForUpdate(GroovyParser.ForUpdateContext ctx)`
    `` | `public Parameter` | `visitFormalParameter(GroovyParser.FormalParameterContext ctx)`
    `` | `public Parameter[]` | `visitFormalParameterList(GroovyParser.FormalParameterListContext ctx)`
    `` | `public Parameter[]` | `visitFormalParameters(GroovyParser.FormalParametersContext ctx)`
    `` | `public GStringExpression` | `visitGstring(GroovyParser.GstringContext ctx)`
    `` | `public Expression` | `visitGstringPath(GroovyParser.GstringPathContext ctx)`
    `` | `public Expression` | `visitGstringValue(GroovyParser.GstringValueContext ctx)`
    `` | `public String` | `visitIdentifier(GroovyParser.IdentifierContext ctx)`
    `` | `public Expression` | `visitIdentifierPrmrAlt(GroovyParser.IdentifierPrmrAltContext ctx)`
    `` | `public IfStatement` | `visitIfElseStatement(GroovyParser.IfElseStatementContext ctx)`
    `` | `public BinaryExpression` | `visitImplicationExprAlt(GroovyParser.ImplicationExprAltContext ctx)`
    `` | `public ImportNode` | `visitImportDeclaration(GroovyParser.ImportDeclarationContext ctx)`
    `` | `public BinaryExpression` | `visitInclusiveOrExprAlt(GroovyParser.InclusiveOrExprAltContext ctx)`
    `` | `public Tuple2<Token, Expression>` | `visitIndexPropertyArgs(GroovyParser.IndexPropertyArgsContext ctx)`
    `` | `public Parameter` | `visitIndexVariable(GroovyParser.IndexVariableContext ctx)`
    `` | `public ConstantExpression` | `visitIntegerLiteralAlt(GroovyParser.IntegerLiteralAltContext ctx)`
    `` | `public ClassNode` | `visitIntersectionType(GroovyParser.IntersectionTypeContext ctx)`
    `` | `public VariableExpression` | `visitKeyedPair(GroovyParser.KeyedPairContext ctx)`
    `` | `public ConstantExpression` | `visitKeywords(GroovyParser.KeywordsContext ctx)`
    `` | `public Statement` | `visitLabeledStmtAlt(GroovyParser.LabeledStmtAltContext ctx)`
    `` | `public Statement` | `visitLambdaBody(GroovyParser.LambdaBodyContext ctx)`
    `` | `public ListExpression` | `visitList(GroovyParser.ListContext ctx)`
    `` | `public AstBuilder.DeclarationListStatement` | `visitLocalVariableDeclaration(GroovyParser.LocalVariableDeclarationContext ctx)`
    `` | `public BinaryExpression` | `visitLogicalAndExprAlt(GroovyParser.LogicalAndExprAltContext ctx)`
    `` | `public BinaryExpression` | `visitLogicalOrExprAlt(GroovyParser.LogicalOrExprAltContext ctx)`
    `` | `public Statement` | `visitLoopStmtAlt(GroovyParser.LoopStmtAltContext ctx)`
    `` | `public MapExpression` | `visitMap(GroovyParser.MapContext ctx)`
    `` | `public MapEntryExpression` | `visitMapEntry(GroovyParser.MapEntryContext ctx)`
    `` | `public Expression` | `visitMapEntryLabel(GroovyParser.MapEntryLabelContext ctx)`
    `` | `public List<MapEntryExpression>` | `visitMapEntryList(GroovyParser.MapEntryListContext ctx)`
    `` | `public Expression` | `visitMatchingType(GroovyParser.MatchingTypeContext ctx)`
    `` | `public Void` | `visitMemberDeclaration(GroovyParser.MemberDeclarationContext ctx)`
    `` | `public Statement` | `visitMethodBody(GroovyParser.MethodBodyContext ctx)`
    `` | `public MethodNode` | `visitMethodDeclaration(GroovyParser.MethodDeclarationContext ctx)`
    `` | `public String` | `visitMethodName(GroovyParser.MethodNameContext ctx)`
    `` | `public ModifierNode` | `visitModifier(GroovyParser.ModifierContext ctx)`
    `` | `public List<ModifierNode>` | `visitModifiers(GroovyParser.ModifiersContext ctx)`
    `` | `public List<ModifierNode>` | `visitModifiersOpt(GroovyParser.ModifiersOptContext ctx)`
    `` | `public BinaryExpression` | `visitMultipleAssignmentExprAlt(GroovyParser.MultipleAssignmentExprAltContext ctx)`
    `` | `public BinaryExpression` | `visitMultiplicativeExprAlt(GroovyParser.MultiplicativeExprAltContext ctx)`
    `` | `public Expression` | `visitNamePart(GroovyParser.NamePartContext ctx)`
    `` | `public List<MapEntryExpression>` | `visitNamedPropertyArgs(GroovyParser.NamedPropertyArgsContext ctx)`
    `` | `public Expression` | `visitNewPrmrAlt(GroovyParser.NewPrmrAltContext ctx)`
    `` | `public GenericsType[]` | `visitNonWildcardTypeArguments(GroovyParser.NonWildcardTypeArgumentsContext ctx)`
    `` | `public ConstantExpression` | `visitNullLiteralAlt(GroovyParser.NullLiteralAltContext ctx)`
    `` | `public Function<Statement, ForStatement>` | `visitOriginalForControl(GroovyParser.OriginalForControlContext ctx)`
    `` | `public PackageNode` | `visitPackageDeclaration(GroovyParser.PackageDeclarationContext ctx)`
    `` | `public Expression` | `visitParExpression(GroovyParser.ParExpressionContext ctx)`
    `` | `public Expression` | `visitPathElement(GroovyParser.PathElementContext ctx)`
    `` | `public Expression` | `visitPathExpression(GroovyParser.PathExpressionContext ctx)`
    `` | `public Expression` | `visitPostfixExpression(GroovyParser.PostfixExpressionContext ctx)`
    `` | `public BinaryExpression` | `visitPowerExprAlt(GroovyParser.PowerExprAltContext ctx)`
    `` | `public ClassNode` | `visitPrimitiveType(GroovyParser.PrimitiveTypeContext ctx)`
    `` | `public ClassNode` | `visitQualifiedClassName(GroovyParser.QualifiedClassNameContext ctx)`
    `` | `public ClassNode[]` | `visitQualifiedClassNameList(GroovyParser.QualifiedClassNameListContext ctx)`
    `` | `public String` | `visitQualifiedName(GroovyParser.QualifiedNameContext ctx)`
    `` | `public ClassNode` | `visitQualifiedStandardClassName(GroovyParser.QualifiedStandardClassNameContext ctx)`
    `` | `public ClassNode` | `visitReferenceType(GroovyParser.ReferenceTypeContext ctx)`
    `` | `public BinaryExpression` | `visitRegexExprAlt(GroovyParser.RegexExprAltContext ctx)`
    `` | `public Expression` | `visitRelationalExprAlt(GroovyParser.RelationalExprAltContext ctx)`
    `` | `public ExpressionStatement` | `visitResource(GroovyParser.ResourceContext ctx)`
    `` | `public List<ExpressionStatement>` | `visitResourceList(GroovyParser.ResourceListContext ctx)`
    `` | `public List<ExpressionStatement>` | `visitResources(GroovyParser.ResourcesContext ctx)`
    `` | `public ReturnStatement` | `visitReturnStmtAlt(GroovyParser.ReturnStmtAltContext ctx)`
    `` | `public ClassNode` | `visitReturnType(GroovyParser.ReturnTypeContext ctx)`
    `` | `public List<ASTNode>` | `visitScriptStatements(GroovyParser.ScriptStatementsContext ctx)`
    `` | `public Expression` | `visitShiftExprAlt(GroovyParser.ShiftExprAltContext ctx)`
    `` | `public LambdaExpression` | `visitStandardLambdaExpression(GroovyParser.StandardLambdaExpressionContext ctx)`
    `` | `public Parameter[]` | `visitStandardLambdaParameters(GroovyParser.StandardLambdaParametersContext ctx)`
    `` | `public ConstantExpression` | `visitStringLiteral(GroovyParser.StringLiteralContext ctx)`
    `` | `public VariableExpression` | `visitSuperPrmrAlt(GroovyParser.SuperPrmrAltContext ctx)`
    `` | `public Tuple3<List<Statement>, Boolean, Boolean>` | `visitSwitchBlockStatementExpressionGroup(GroovyParser.SwitchBlockStatementExpressionGroupContext ctx)`
    `` | `public List<Statement>` | `visitSwitchBlockStatementGroup(GroovyParser.SwitchBlockStatementGroupContext ctx)`
    `` | `public Expression` | `visitSwitchExprAlt(GroovyParser.SwitchExprAltContext ctx)`
    `` | `public MethodCallExpression` | `visitSwitchExpression(GroovyParser.SwitchExpressionContext ctx)`
         switch(x) {
           case 0, 1 -> 'a'
           case 2    -> 'b'
           default   -> 'z'
         }
    will be transformed to:
         { ->
             switch(x) {
               case 0:
               case 1:  return 'a'
               case 2:  return 'b'
               default: return 'z'
             }
         }.call()
    `` | `public Tuple3<Token, List<Expression>, Integer>` | `visitSwitchExpressionLabel(GroovyParser.SwitchExpressionLabelContext ctx)`
    `` | `public Tuple2<Token, Expression>` | `visitSwitchLabel(GroovyParser.SwitchLabelContext ctx)`
    `` | `public SwitchStatement` | `visitSwitchStatement(GroovyParser.SwitchStatementContext ctx)`
    `` | `public SynchronizedStatement` | `visitSynchronizedStmtAlt(GroovyParser.SynchronizedStmtAltContext ctx)`
    `` | `public Parameter` | `visitThisFormalParameter(GroovyParser.ThisFormalParameterContext ctx)`
    `` | `public VariableExpression` | `visitThisPrmrAlt(GroovyParser.ThisPrmrAltContext ctx)`
    `` | `public ThrowStatement` | `visitThrowStmtAlt(GroovyParser.ThrowStmtAltContext ctx)`
    `` | `public Statement` | `visitTryCatchStatement(GroovyParser.TryCatchStatementContext ctx)`
    `` | `public ClassNode` | `visitType(GroovyParser.TypeContext ctx)`
    `` | `public GenericsType` | `visitTypeArgument(GroovyParser.TypeArgumentContext ctx)`
    `` | `public GenericsType[]` | `visitTypeArguments(GroovyParser.TypeArgumentsContext ctx)`
    `` | `public GenericsType[]` | `visitTypeArgumentsOrDiamond(GroovyParser.TypeArgumentsOrDiamondContext ctx)`
    `` | `public ClassNode[]` | `visitTypeBound(GroovyParser.TypeBoundContext ctx)`
    `` | `public ClassNode` | `visitTypeDeclaration(GroovyParser.TypeDeclarationContext ctx)`
    `` | `public ClassNode[]` | `visitTypeList(GroovyParser.TypeListContext ctx)`
    `` | `public VariableExpression` | `visitTypeNamePair(GroovyParser.TypeNamePairContext ctx)`
    `` | `public List<Expression>` | `visitTypeNamePairs(GroovyParser.TypeNamePairsContext ctx)`
    `` | `public GenericsType` | `visitTypeParameter(GroovyParser.TypeParameterContext ctx)`
    `` | `public GenericsType[]` | `visitTypeParameters(GroovyParser.TypeParametersContext ctx)`
    `` | `public Expression` | `visitUnaryAddExprAlt(GroovyParser.UnaryAddExprAltContext ctx)`
    `` | `public Expression` | `visitUnaryNotExprAlt(GroovyParser.UnaryNotExprAltContext ctx)`
    `` | `public AstBuilder.DeclarationListStatement` | `visitVariableDeclaration(GroovyParser.VariableDeclarationContext ctx)`
    `` | `public DeclarationExpression` | `visitVariableDeclarator(GroovyParser.VariableDeclaratorContext ctx)`
    `` | `public VariableExpression` | `visitVariableDeclaratorId(GroovyParser.VariableDeclaratorIdContext ctx)`
    `` | `public List<DeclarationExpression>` | `visitVariableDeclarators(GroovyParser.VariableDeclaratorsContext ctx)`
    `` | `public Expression` | `visitVariableInitializer(GroovyParser.VariableInitializerContext ctx)`
    `` | `public ModifierNode` | `visitVariableModifier(GroovyParser.VariableModifierContext ctx)`
    `` | `public List<ModifierNode>` | `visitVariableModifiers(GroovyParser.VariableModifiersContext ctx)`
    `` | `public List<ModifierNode>` | `visitVariableModifiersOpt(GroovyParser.VariableModifiersOptContext ctx)`
    `` | `public TupleExpression` | `visitVariableNames(GroovyParser.VariableNamesContext ctx)`
    `` | `public WhileStatement` | `visitWhileStmtAlt(GroovyParser.WhileStmtAltContext ctx)`
    `` | `public ExpressionStatement` | `visitYieldReturnStmtAlt(GroovyParser.YieldReturnStmtAltContext ctx)`
    `` | `public ReturnStatement` | `visitYieldStatement(GroovyParser.YieldStatementContext ctx)`
    `` | `public ReturnStatement` | `visitYieldStmtAlt(GroovyParser.YieldStmtAltContext ctx)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class GroovyParserBaseVisitor` | `visitAdditiveExprAlt, visitAndExprAlt, visitAnnotatedQualifiedClassName, visitAnnotation, visitAnnotationName, visitAnnotationsOpt, visitAnonymousInnerClassDeclaration, visitArguments, visitArrayInitializer, visitAssertStatement, visitAssertStmtAlt, visitAssignmentExprAlt, visitAsyncClosureExprAlt, visitAwaitExprAlt, visitBlock, visitBlockStatement, visitBlockStatements, visitBlockStatementsOpt, visitBlockStmtAlt, visitBooleanLiteralAlt, visitBreakStatement, visitBreakStmtAlt, visitBuiltInType, visitBuiltInTypePrmrAlt, visitCastExprAlt, visitCastParExpression, visitCatchClause, visitCatchType, visitClassBody, visitClassBodyDeclaration, visitClassDeclaration, visitClassName, visitClassOrInterfaceModifier, visitClassOrInterfaceModifiers, visitClassOrInterfaceModifiersOpt, visitClosure, visitClosureOrLambdaExpression, visitClosureOrLambdaExpressionPrmrAlt, visitCoercionType, visitCommandArgument, visitCommandExprAlt, visitCommandExpression, visitCompactConstructorDeclaration, visitCompilationUnit, visitConditionalExprAlt, visitConditionalStatement, visitConditionalStmtAlt, visitContinueStatement, visitContinueStmtAlt, visitCreatedName, visitCreator, visitDeferStmtAlt, visitDim0, visitDim1, visitDoWhileStmtAlt, visitDynamicMemberName, visitElementValue, visitElementValueArrayInitializer, visitElementValuePair, visitElementValuePairName, visitElementValuePairs, visitElementValues, visitEmptyStmtAlt, visitEnhancedArgumentListElement, visitEnhancedArgumentListInPar, visitEnhancedExpression, visitEnhancedForControl, visitEnhancedStatementExpression, visitEnumConstant, visitEnumConstants, visitEqualityExprAlt, visitExclusiveOrExprAlt, visitExpression, visitExpressionInPar, visitExpressionList, visitExpressionListElement, visitExpressionStmtAlt, visitFieldDeclaration, visitFinallyBlock, visitFloatingPointLiteralAlt, visitForControl, visitForInit, visitForStmtAlt, visitForUpdate, visitFormalParameter, visitFormalParameterList, visitFormalParameters, visitGstring, visitGstringPath, visitGstringPrmrAlt, visitGstringValue, visitIdentifier, visitIdentifierPrmrAlt, visitIfElseStatement, visitImplicationExprAlt, visitImportDeclaration, visitInclusiveOrExprAlt, visitIndexPropertyArgs, visitIndexVariable, visitIntegerLiteralAlt, visitIntersectionType, visitKeyedPair, visitKeywords, visitLabeledStmtAlt, visitLambdaBody, visitList, visitListPrmrAlt, visitLiteral, visitLiteralPrmrAlt, visitLocalVariableDeclaration, visitLocalVariableDeclarationStmtAlt, visitLogicalAndExprAlt, visitLogicalOrExprAlt, visitLoopStatement, visitLoopStmtAlt, visitMap, visitMapEntry, visitMapEntryLabel, visitMapEntryList, visitMapPrmrAlt, visitMatchingType, visitMemberDeclaration, visitMethodBody, visitMethodDeclaration, visitMethodName, visitModifier, visitModifiers, visitModifiersOpt, visitMultipleAssignmentExprAlt, visitMultiplicativeExprAlt, visitNamePart, visitNamedPropertyArgs, visitNewPrmrAlt, visitNls, visitNonWildcardTypeArguments, visitNullLiteralAlt, visitOriginalForControl, visitPackageDeclaration, visitParExpression, visitParenPrmrAlt, visitPathElement, visitPathExpression, visitPostfixExprAlt, visitPostfixExpression, visitPowerExprAlt, visitPrimary, visitPrimitiveType, visitQualifiedClassName, visitQualifiedClassNameList, visitQualifiedName, visitQualifiedNameElement, visitQualifiedNameElements, visitQualifiedStandardClassName, visitReferenceType, visitRegexExprAlt, visitRelationalExprAlt, visitResource, visitResourceList, visitResources, visitReturnStmtAlt, visitReturnType, visitScriptStatement, visitScriptStatements, visitSep, visitShiftExprAlt, visitStandardLambdaExpression, visitStandardLambdaParameters, visitStatement, visitStatementExpression, visitStringLiteral, visitStringLiteralAlt, visitSuperPrmrAlt, visitSwitchBlockStatementExpressionGroup, visitSwitchBlockStatementGroup, visitSwitchExprAlt, visitSwitchExpression, visitSwitchExpressionLabel, visitSwitchLabel, visitSwitchStatement, visitSynchronizedStmtAlt, visitThisFormalParameter, visitThisPrmrAlt, visitThrowStmtAlt, visitTryCatchStatement, visitTryCatchStmtAlt, visitType, visitTypeArgument, visitTypeArguments, visitTypeArgumentsOrDiamond, visitTypeBound, visitTypeDeclaration, visitTypeList, visitTypeNamePair, visitTypeNamePairs, visitTypeParameter, visitTypeParameters, visitUnaryAddExprAlt, visitUnaryNotExprAlt, visitVariableDeclaration, visitVariableDeclarator, visitVariableDeclaratorId, visitVariableDeclarators, visitVariableInitializer, visitVariableModifier, visitVariableModifiers, visitVariableModifiersOpt, visitVariableNames, visitWhileStmtAlt, visitYieldReturnStmtAlt, visitYieldStatement, visitYieldStmtAlt`

- - ### Constructor Detail

    - #### public AstBuilder(SourceUnit sourceUnit, boolean groovydocEnabled, boolean runtimeGroovydocEnabled)

  - ### Method Detail

    - #### public BlockStatement appendStatementsToBlockStatement(BlockStatement bs, Statement statements)

    - #### public ModuleNode buildAST()

    - #### public Object visit(ParseTree tree)

      Visit tree safely, no NPE occurred when the tree is null.

      Parameters:
        `tree` - an AST node
      Returns:
        the visiting result

    - #### public BinaryExpression visitAdditiveExprAlt(GroovyParser.AdditiveExprAltContext ctx)

    - #### public BinaryExpression visitAndExprAlt(GroovyParser.AndExprAltContext ctx)

    - #### public ClassNode visitAnnotatedQualifiedClassName(GroovyParser.AnnotatedQualifiedClassNameContext ctx)

    - #### public AnnotationNode visitAnnotation(GroovyParser.AnnotationContext ctx)

    - #### public String visitAnnotationName(GroovyParser.AnnotationNameContext ctx)

    - #### public List<AnnotationNode> visitAnnotationsOpt(GroovyParser.AnnotationsOptContext ctx)

    - #### public InnerClassNode visitAnonymousInnerClassDeclaration(GroovyParser.AnonymousInnerClassDeclarationContext ctx)

    - #### public Expression visitArguments(GroovyParser.ArgumentsContext ctx)

    - #### public List<Expression> visitArrayInitializer(GroovyParser.ArrayInitializerContext ctx)

    - #### public AssertStatement visitAssertStatement(GroovyParser.AssertStatementContext ctx)

    - #### public BinaryExpression visitAssignmentExprAlt(GroovyParser.AssignmentExprAltContext ctx)

    - #### public Expression visitAsyncClosureExprAlt(GroovyParser.AsyncClosureExprAltContext ctx)

    - #### public Expression visitAwaitExprAlt(GroovyParser.AwaitExprAltContext ctx)

    - #### public Statement visitBlock(GroovyParser.BlockContext ctx)

    - #### public Statement visitBlockStatement(GroovyParser.BlockStatementContext ctx)

    - #### public BlockStatement visitBlockStatements(GroovyParser.BlockStatementsContext ctx)

    - #### public BlockStatement visitBlockStatementsOpt(GroovyParser.BlockStatementsOptContext ctx)

    - #### public ConstantExpression visitBooleanLiteralAlt(GroovyParser.BooleanLiteralAltContext ctx)

    - #### public BreakStatement visitBreakStatement(GroovyParser.BreakStatementContext ctx)

    - #### public VariableExpression visitBuiltInType(GroovyParser.BuiltInTypeContext ctx)

    - #### public CastExpression visitCastExprAlt(GroovyParser.CastExprAltContext ctx)

    - #### public ClassNode visitCastParExpression(GroovyParser.CastParExpressionContext ctx)

    - #### public List<CatchStatement> visitCatchClause(GroovyParser.CatchClauseContext ctx)

      Multi-catch(1..*) clause will be unpacked to several normal catch clauses, so the return type is List

      Parameters:
        `ctx` - the parse tree
      Returns:
        a list of CatchStatement instances

    - #### public List<ClassNode> visitCatchType(GroovyParser.CatchTypeContext ctx)

    - #### public Void visitClassBody(GroovyParser.ClassBodyContext ctx)

    - #### public Void visitClassBodyDeclaration(GroovyParser.ClassBodyDeclarationContext ctx)

    - #### public ClassNode visitClassDeclaration(GroovyParser.ClassDeclarationContext ctx)

    - #### public String visitClassName(GroovyParser.ClassNameContext ctx)

    - #### public ModifierNode visitClassOrInterfaceModifier(GroovyParser.ClassOrInterfaceModifierContext ctx)

    - #### public List<ModifierNode> visitClassOrInterfaceModifiers(GroovyParser.ClassOrInterfaceModifiersContext ctx)

    - #### public List<ModifierNode> visitClassOrInterfaceModifiersOpt(GroovyParser.ClassOrInterfaceModifiersOptContext ctx)

    - #### public ClosureExpression visitClosure(GroovyParser.ClosureContext ctx)

    - #### public ClosureExpression visitClosureOrLambdaExpression(GroovyParser.ClosureOrLambdaExpressionContext ctx)

    - #### public ClassNode visitCoercionType(GroovyParser.CoercionTypeContext ctx)

    - #### public Expression visitCommandArgument(GroovyParser.CommandArgumentContext ctx)

    - #### public ExpressionStatement visitCommandExprAlt(GroovyParser.CommandExprAltContext ctx)

    - #### public Expression visitCommandExpression(GroovyParser.CommandExpressionContext ctx)

    - #### public MethodNode visitCompactConstructorDeclaration(GroovyParser.CompactConstructorDeclarationContext ctx)

    - #### public ModuleNode visitCompilationUnit(GroovyParser.CompilationUnitContext ctx)

    - #### public Expression visitConditionalExprAlt(GroovyParser.ConditionalExprAltContext ctx)

    - #### public Statement visitConditionalStatement(GroovyParser.ConditionalStatementContext ctx)

    - #### public ContinueStatement visitContinueStatement(GroovyParser.ContinueStatementContext ctx)

    - #### public ClassNode visitCreatedName(GroovyParser.CreatedNameContext ctx)

    - #### public Expression visitCreator(GroovyParser.CreatorContext ctx)

    - #### public ExpressionStatement visitDeferStmtAlt(GroovyParser.DeferStmtAltContext ctx)

    - #### public DoWhileStatement visitDoWhileStmtAlt(GroovyParser.DoWhileStmtAltContext ctx)

    - #### public Expression visitDynamicMemberName(GroovyParser.DynamicMemberNameContext ctx)

    - #### public Expression visitElementValue(GroovyParser.ElementValueContext ctx)

    - #### public ListExpression visitElementValueArrayInitializer(GroovyParser.ElementValueArrayInitializerContext ctx)

    - #### public Tuple2<String, Expression> visitElementValuePair(GroovyParser.ElementValuePairContext ctx)

    - #### public Map<String, Expression> visitElementValuePairs(GroovyParser.ElementValuePairsContext ctx)

    - #### public List<Tuple2<String, Expression>> visitElementValues(GroovyParser.ElementValuesContext ctx)

    - #### public Expression visitEnhancedArgumentListElement(GroovyParser.EnhancedArgumentListElementContext ctx)

    - #### public Expression visitEnhancedArgumentListInPar(GroovyParser.EnhancedArgumentListInParContext ctx)

    - #### public Expression visitEnhancedExpression(GroovyParser.EnhancedExpressionContext ctx)

    - #### public Function<Statement, ForStatement> visitEnhancedForControl(GroovyParser.EnhancedForControlContext ctx)

    - #### public Expression visitEnhancedStatementExpression(GroovyParser.EnhancedStatementExpressionContext ctx)

    - #### public FieldNode visitEnumConstant(GroovyParser.EnumConstantContext ctx)

    - #### public List<FieldNode> visitEnumConstants(GroovyParser.EnumConstantsContext ctx)

    - #### public BinaryExpression visitEqualityExprAlt(GroovyParser.EqualityExprAltContext ctx)

    - #### public BinaryExpression visitExclusiveOrExprAlt(GroovyParser.ExclusiveOrExprAltContext ctx)

    - #### public Expression visitExpressionInPar(GroovyParser.ExpressionInParContext ctx)

    - #### public List<Expression> visitExpressionList(GroovyParser.ExpressionListContext ctx)

    - #### public Expression visitExpressionListElement(GroovyParser.ExpressionListElementContext ctx)

    - #### public Void visitFieldDeclaration(GroovyParser.FieldDeclarationContext ctx)

    - #### public Statement visitFinallyBlock(GroovyParser.FinallyBlockContext ctx)

    - #### public ConstantExpression visitFloatingPointLiteralAlt(GroovyParser.FloatingPointLiteralAltContext ctx)

    - #### public Function<Statement, ForStatement> visitForControl(GroovyParser.ForControlContext ctx)

    - #### public Expression visitForInit(GroovyParser.ForInitContext ctx)

    - #### public Statement visitForStmtAlt(GroovyParser.ForStmtAltContext ctx)

    - #### public Expression visitForUpdate(GroovyParser.ForUpdateContext ctx)

    - #### public Parameter visitFormalParameter(GroovyParser.FormalParameterContext ctx)

    - #### public Parameter[] visitFormalParameterList(GroovyParser.FormalParameterListContext ctx)

    - #### public Parameter[] visitFormalParameters(GroovyParser.FormalParametersContext ctx)

    - #### public GStringExpression visitGstring(GroovyParser.GstringContext ctx)

    - #### public Expression visitGstringPath(GroovyParser.GstringPathContext ctx)

    - #### public Expression visitGstringValue(GroovyParser.GstringValueContext ctx)

    - #### public String visitIdentifier(GroovyParser.IdentifierContext ctx)

    - #### public Expression visitIdentifierPrmrAlt(GroovyParser.IdentifierPrmrAltContext ctx)

    - #### public IfStatement visitIfElseStatement(GroovyParser.IfElseStatementContext ctx)

    - #### public BinaryExpression visitImplicationExprAlt(GroovyParser.ImplicationExprAltContext ctx)

    - #### public ImportNode visitImportDeclaration(GroovyParser.ImportDeclarationContext ctx)

    - #### public BinaryExpression visitInclusiveOrExprAlt(GroovyParser.InclusiveOrExprAltContext ctx)

    - #### public Tuple2<Token, Expression> visitIndexPropertyArgs(GroovyParser.IndexPropertyArgsContext ctx)

    - #### public Parameter visitIndexVariable(GroovyParser.IndexVariableContext ctx)

    - #### public ConstantExpression visitIntegerLiteralAlt(GroovyParser.IntegerLiteralAltContext ctx)

    - #### public ClassNode visitIntersectionType(GroovyParser.IntersectionTypeContext ctx)

    - #### public VariableExpression visitKeyedPair(GroovyParser.KeyedPairContext ctx)

    - #### public ConstantExpression visitKeywords(GroovyParser.KeywordsContext ctx)

    - #### public Statement visitLabeledStmtAlt(GroovyParser.LabeledStmtAltContext ctx)

    - #### public Statement visitLambdaBody(GroovyParser.LambdaBodyContext ctx)

    - #### public ListExpression visitList(GroovyParser.ListContext ctx)

    - #### public AstBuilder.DeclarationListStatement visitLocalVariableDeclaration(GroovyParser.LocalVariableDeclarationContext ctx)

    - #### public BinaryExpression visitLogicalAndExprAlt(GroovyParser.LogicalAndExprAltContext ctx)

    - #### public BinaryExpression visitLogicalOrExprAlt(GroovyParser.LogicalOrExprAltContext ctx)

    - #### public Statement visitLoopStmtAlt(GroovyParser.LoopStmtAltContext ctx)

    - #### public MapExpression visitMap(GroovyParser.MapContext ctx)

    - #### public MapEntryExpression visitMapEntry(GroovyParser.MapEntryContext ctx)

    - #### public Expression visitMapEntryLabel(GroovyParser.MapEntryLabelContext ctx)

    - #### public List<MapEntryExpression> visitMapEntryList(GroovyParser.MapEntryListContext ctx)

    - #### public Expression visitMatchingType(GroovyParser.MatchingTypeContext ctx)

    - #### public Void visitMemberDeclaration(GroovyParser.MemberDeclarationContext ctx)

    - #### public Statement visitMethodBody(GroovyParser.MethodBodyContext ctx)

    - #### public MethodNode visitMethodDeclaration(GroovyParser.MethodDeclarationContext ctx)

    - #### public String visitMethodName(GroovyParser.MethodNameContext ctx)

    - #### public ModifierNode visitModifier(GroovyParser.ModifierContext ctx)

    - #### public List<ModifierNode> visitModifiers(GroovyParser.ModifiersContext ctx)

    - #### public List<ModifierNode> visitModifiersOpt(GroovyParser.ModifiersOptContext ctx)

    - #### public BinaryExpression visitMultipleAssignmentExprAlt(GroovyParser.MultipleAssignmentExprAltContext ctx)

    - #### public BinaryExpression visitMultiplicativeExprAlt(GroovyParser.MultiplicativeExprAltContext ctx)

    - #### public Expression visitNamePart(GroovyParser.NamePartContext ctx)

    - #### public List<MapEntryExpression> visitNamedPropertyArgs(GroovyParser.NamedPropertyArgsContext ctx)

    - #### public Expression visitNewPrmrAlt(GroovyParser.NewPrmrAltContext ctx)

    - #### public GenericsType[] visitNonWildcardTypeArguments(GroovyParser.NonWildcardTypeArgumentsContext ctx)

    - #### public ConstantExpression visitNullLiteralAlt(GroovyParser.NullLiteralAltContext ctx)

    - #### public Function<Statement, ForStatement> visitOriginalForControl(GroovyParser.OriginalForControlContext ctx)

    - #### public PackageNode visitPackageDeclaration(GroovyParser.PackageDeclarationContext ctx)

    - #### public Expression visitParExpression(GroovyParser.ParExpressionContext ctx)

    - #### public Expression visitPathElement(GroovyParser.PathElementContext ctx)

    - #### public Expression visitPathExpression(GroovyParser.PathExpressionContext ctx)

    - #### public Expression visitPostfixExpression(GroovyParser.PostfixExpressionContext ctx)

    - #### public BinaryExpression visitPowerExprAlt(GroovyParser.PowerExprAltContext ctx)

    - #### public ClassNode visitPrimitiveType(GroovyParser.PrimitiveTypeContext ctx)

    - #### public ClassNode visitQualifiedClassName(GroovyParser.QualifiedClassNameContext ctx)

    - #### public ClassNode[] visitQualifiedClassNameList(GroovyParser.QualifiedClassNameListContext ctx)

    - #### public String visitQualifiedName(GroovyParser.QualifiedNameContext ctx)

    - #### public ClassNode visitQualifiedStandardClassName(GroovyParser.QualifiedStandardClassNameContext ctx)

    - #### public ClassNode visitReferenceType(GroovyParser.ReferenceTypeContext ctx)

    - #### public BinaryExpression visitRegexExprAlt(GroovyParser.RegexExprAltContext ctx)

    - #### public Expression visitRelationalExprAlt(GroovyParser.RelationalExprAltContext ctx)

    - #### public ExpressionStatement visitResource(GroovyParser.ResourceContext ctx)

    - #### public List<ExpressionStatement> visitResourceList(GroovyParser.ResourceListContext ctx)

    - #### public List<ExpressionStatement> visitResources(GroovyParser.ResourcesContext ctx)

    - #### public ReturnStatement visitReturnStmtAlt(GroovyParser.ReturnStmtAltContext ctx)

    - #### public ClassNode visitReturnType(GroovyParser.ReturnTypeContext ctx)

    - #### public List<ASTNode> visitScriptStatements(GroovyParser.ScriptStatementsContext ctx)

    - #### public Expression visitShiftExprAlt(GroovyParser.ShiftExprAltContext ctx)

    - #### public LambdaExpression visitStandardLambdaExpression(GroovyParser.StandardLambdaExpressionContext ctx)

    - #### public Parameter[] visitStandardLambdaParameters(GroovyParser.StandardLambdaParametersContext ctx)

    - #### public ConstantExpression visitStringLiteral(GroovyParser.StringLiteralContext ctx)

    - #### public VariableExpression visitSuperPrmrAlt(GroovyParser.SuperPrmrAltContext ctx)

    - #### public Tuple3<List<Statement>, Boolean, Boolean> visitSwitchBlockStatementExpressionGroup(GroovyParser.SwitchBlockStatementExpressionGroupContext ctx)

    - #### public List<Statement> visitSwitchBlockStatementGroup(GroovyParser.SwitchBlockStatementGroupContext ctx)

    - #### public Expression visitSwitchExprAlt(GroovyParser.SwitchExprAltContext ctx)

    - #### public MethodCallExpression visitSwitchExpression(GroovyParser.SwitchExpressionContext ctx)

           switch(x) {
             case 0, 1 -> 'a'
             case 2    -> 'b'
             default   -> 'z'
           }

      will be transformed to:

           { ->
               switch(x) {
                 case 0:
                 case 1:  return 'a'
                 case 2:  return 'b'
                 default: return 'z'
               }
           }.call()

    - #### public Tuple3<Token, List<Expression>, Integer> visitSwitchExpressionLabel(GroovyParser.SwitchExpressionLabelContext ctx)

    - #### public Tuple2<Token, Expression> visitSwitchLabel(GroovyParser.SwitchLabelContext ctx)

    - #### public SwitchStatement visitSwitchStatement(GroovyParser.SwitchStatementContext ctx)

    - #### public SynchronizedStatement visitSynchronizedStmtAlt(GroovyParser.SynchronizedStmtAltContext ctx)

    - #### public Parameter visitThisFormalParameter(GroovyParser.ThisFormalParameterContext ctx)

    - #### public VariableExpression visitThisPrmrAlt(GroovyParser.ThisPrmrAltContext ctx)

    - #### public ThrowStatement visitThrowStmtAlt(GroovyParser.ThrowStmtAltContext ctx)

    - #### public Statement visitTryCatchStatement(GroovyParser.TryCatchStatementContext ctx)

    - #### public ClassNode visitType(GroovyParser.TypeContext ctx)

    - #### public GenericsType visitTypeArgument(GroovyParser.TypeArgumentContext ctx)

    - #### public GenericsType[] visitTypeArguments(GroovyParser.TypeArgumentsContext ctx)

    - #### public GenericsType[] visitTypeArgumentsOrDiamond(GroovyParser.TypeArgumentsOrDiamondContext ctx)

    - #### public ClassNode[] visitTypeBound(GroovyParser.TypeBoundContext ctx)

    - #### public ClassNode visitTypeDeclaration(GroovyParser.TypeDeclarationContext ctx)

    - #### public ClassNode[] visitTypeList(GroovyParser.TypeListContext ctx)

    - #### public VariableExpression visitTypeNamePair(GroovyParser.TypeNamePairContext ctx)

    - #### public List<Expression> visitTypeNamePairs(GroovyParser.TypeNamePairsContext ctx)

    - #### public GenericsType visitTypeParameter(GroovyParser.TypeParameterContext ctx)

    - #### public GenericsType[] visitTypeParameters(GroovyParser.TypeParametersContext ctx)

    - #### public Expression visitUnaryAddExprAlt(GroovyParser.UnaryAddExprAltContext ctx)

    - #### public Expression visitUnaryNotExprAlt(GroovyParser.UnaryNotExprAltContext ctx)

    - #### public AstBuilder.DeclarationListStatement visitVariableDeclaration(GroovyParser.VariableDeclarationContext ctx)

    - #### public DeclarationExpression visitVariableDeclarator(GroovyParser.VariableDeclaratorContext ctx)

    - #### public VariableExpression visitVariableDeclaratorId(GroovyParser.VariableDeclaratorIdContext ctx)

    - #### public List<DeclarationExpression> visitVariableDeclarators(GroovyParser.VariableDeclaratorsContext ctx)

    - #### public Expression visitVariableInitializer(GroovyParser.VariableInitializerContext ctx)

    - #### public ModifierNode visitVariableModifier(GroovyParser.VariableModifierContext ctx)

    - #### public List<ModifierNode> visitVariableModifiers(GroovyParser.VariableModifiersContext ctx)

    - #### public List<ModifierNode> visitVariableModifiersOpt(GroovyParser.VariableModifiersOptContext ctx)

    - #### public TupleExpression visitVariableNames(GroovyParser.VariableNamesContext ctx)

    - #### public WhileStatement visitWhileStmtAlt(GroovyParser.WhileStmtAltContext ctx)

    - #### public ExpressionStatement visitYieldReturnStmtAlt(GroovyParser.YieldReturnStmtAltContext ctx)

    - #### public ReturnStatement visitYieldStatement(GroovyParser.YieldStatementContext ctx)

    - #### public ReturnStatement visitYieldStmtAlt(GroovyParser.YieldStmtAltContext ctx)