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 void` | `syntaxError(Recognizer recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e)`
    `` | `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 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 ClassNode` | `visitClassOrInterfaceType(GroovyParser.ClassOrInterfaceTypeContext ctx)`
    `` | `public Tuple2<Parameter, Expression>` | `visitClassicalForControl(GroovyParser.ClassicalForControlContext ctx)`
    `` | `public ClosureExpression` | `visitClosure(GroovyParser.ClosureContext ctx)`
    `` | `public ClosureExpression` | `visitClosureOrLambdaExpression(GroovyParser.ClosureOrLambdaExpressionContext 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 Tuple3<Expression, List<AnnotationNode>, TerminalNode>` | `visitDim(GroovyParser.DimContext 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 List<List<AnnotationNode>>` | `visitEmptyDims(GroovyParser.EmptyDimsContext ctx)`
    `` | `public List<List<AnnotationNode>>` | `visitEmptyDimsOpt(GroovyParser.EmptyDimsOptContext ctx)`
    `` | `public Expression` | `visitEnhancedArgumentListElement(GroovyParser.EnhancedArgumentListElementContext ctx)`
    `` | `public Expression` | `visitEnhancedArgumentListInPar(GroovyParser.EnhancedArgumentListInParContext ctx)`
    `` | `public Tuple2<Parameter, Expression>` | `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 Tuple2<Parameter, Expression>` | `visitForControl(GroovyParser.ForControlContext ctx)`
    `` | `public Expression` | `visitForInit(GroovyParser.ForInitContext ctx)`
    `` | `public ForStatement` | `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 ConstantExpression` | `visitIntegerLiteralAlt(GroovyParser.IntegerLiteralAltContext 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 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 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 void` | `visitPropertyExpression(PropertyExpression expression)`
    `` | `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 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 void` | `visitReturnStatement(ReturnStatement statement)`
    `` | `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(a) {
             case 0, 1  ->   'a';
             case 2     ->   'b';
             default    ->   'z';
         }
    the above code will be transformed to:
         {->
             switch(a) {
                 case 0:
                 case 1:  return 'a';
                 case 2:  return 'b';
                 default: return 'z';
             }
         }()
    `` | `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 void` | `visitThrowStatement(ThrowStatement statement)`
    `` | `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 List<Expression>` | `visitVariableInitializers(GroovyParser.VariableInitializersContext 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 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, visitBlock, visitBlockStatement, visitBlockStatements, visitBlockStatementsOpt, visitBlockStmtAlt, visitBooleanLiteralAlt, visitBreakStatement, visitBreakStmtAlt, visitBuiltInType, visitBuiltInTypePrmrAlt, visitCastExprAlt, visitCastParExpression, visitCatchClause, visitCatchType, visitClassBody, visitClassBodyDeclaration, visitClassDeclaration, visitClassName, visitClassOrInterfaceModifier, visitClassOrInterfaceModifiers, visitClassOrInterfaceModifiersOpt, visitClassOrInterfaceType, visitClassicalForControl, visitClosure, visitClosureOrLambdaExpression, visitClosureOrLambdaExpressionPrmrAlt, visitCommandArgument, visitCommandExprAlt, visitCommandExpression, visitCompactConstructorDeclaration, visitCompilationUnit, visitConditionalExprAlt, visitConditionalStatement, visitConditionalStmtAlt, visitContinueStatement, visitContinueStmtAlt, visitCreatedName, visitCreator, visitDim, visitDoWhileStmtAlt, visitDynamicMemberName, visitElementValue, visitElementValueArrayInitializer, visitElementValuePair, visitElementValuePairName, visitElementValuePairs, visitElementValues, visitEmptyDims, visitEmptyDimsOpt, visitEmptyStmtAlt, visitEnhancedArgumentListElement, visitEnhancedArgumentListInPar, 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, visitIntegerLiteralAlt, visitKeywords, visitLabeledStmtAlt, visitLambdaBody, visitList, visitListPrmrAlt, visitLiteral, visitLiteralPrmrAlt, visitLocalVariableDeclaration, visitLocalVariableDeclarationStmtAlt, visitLogicalAndExprAlt, visitLogicalOrExprAlt, visitLoopStatement, visitLoopStmtAlt, visitMap, visitMapEntry, visitMapEntryLabel, visitMapEntryList, visitMapPrmrAlt, visitMemberDeclaration, visitMethodBody, visitMethodDeclaration, visitMethodName, visitModifier, visitModifiers, visitModifiersOpt, visitMultipleAssignmentExprAlt, visitMultiplicativeExprAlt, visitNamePart, visitNamedPropertyArgs, visitNewPrmrAlt, visitNls, visitNonWildcardTypeArguments, visitNullLiteralAlt, visitPackageDeclaration, visitParExpression, visitParenPrmrAlt, visitPathElement, visitPathExpression, visitPostfixExprAlt, visitPostfixExpression, visitPowerExprAlt, visitPrimary, visitPrimitiveType, visitQualifiedClassName, visitQualifiedClassNameList, visitQualifiedName, visitQualifiedNameElement, visitQualifiedNameElements, visitQualifiedStandardClassName, visitRegexExprAlt, visitRelationalExprAlt, visitResource, visitResourceList, visitResources, visitReturnStmtAlt, visitReturnType, visitRparen, 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, visitVariableInitializers, visitVariableModifier, visitVariableModifiers, visitVariableModifiersOpt, visitVariableNames, visitWhileStmtAlt, visitYieldStatement, visitYieldStmtAlt`

- - ### Constructor Detail

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

  - ### Method Detail

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

    - #### public ModuleNode buildAST()

    - #### @Override
      public void syntaxError(Recognizer recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e)

    - #### @Override
      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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    - #### @Override
      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

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

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

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

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

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

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

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

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

    - #### @Override
      public ClassNode visitClassOrInterfaceType(GroovyParser.ClassOrInterfaceTypeContext ctx)

    - #### @Override
      public Tuple2<Parameter, Expression> visitClassicalForControl(GroovyParser.ClassicalForControlContext ctx)

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

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

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

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

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

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

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

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

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

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

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

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

    - #### @Override
      public Tuple3<Expression, List<AnnotationNode>, TerminalNode> visitDim(GroovyParser.DimContext ctx)

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

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

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

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

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

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

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

    - #### @Override
      public List<List<AnnotationNode>> visitEmptyDims(GroovyParser.EmptyDimsContext ctx)

    - #### @Override
      public List<List<AnnotationNode>> visitEmptyDimsOpt(GroovyParser.EmptyDimsOptContext ctx)

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

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

    - #### @Override
      public Tuple2<Parameter, Expression> visitEnhancedForControl(GroovyParser.EnhancedForControlContext ctx)

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

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

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

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

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

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

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

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

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

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

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

    - #### @Override
      public Tuple2<Parameter, Expression> visitForControl(GroovyParser.ForControlContext ctx)

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

    - #### @Override
      public ForStatement visitForStmtAlt(GroovyParser.ForStmtAltContext ctx)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    - #### @Override
      public void visitPropertyExpression(PropertyExpression expression)

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

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

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

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

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

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

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

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

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

    - #### @Override
      public void visitReturnStatement(ReturnStatement statement)

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

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

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

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

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

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

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

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

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

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

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

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

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

      the above code will be transformed to:

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

      Parameters:
        `ctx` - the parse tree
      Returns:
        MethodCallExpression instance

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

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

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

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

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

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

    - #### @Override
      public void visitThrowStatement(ThrowStatement statement)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    - #### @Override
      public List<Expression> visitVariableInitializers(GroovyParser.VariableInitializersContext ctx)

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

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

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

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

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

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

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