Package: org.apache.groovy.ginq.dsl

## [Java] Class GinqAstBuilder

- org.apache.groovy.ginq.dsl.GinqAstBuilder

- All Implemented Interfaces and Traits:
    SyntaxErrorReportable

      public class GinqAstBuilder
      extends CodeVisitorSupport
      implements SyntaxErrorReportable

  Build the AST for GINQ

  Since:
    4.0.0

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static String` | `GINQ_SELECT_DISTINCT` | Metadata key marking `select distinct`.
    `static String` | `ROOT_GINQ_EXPRESSION` | Metadata key storing the root GINQ expression.

  - ### Constructor Summary

    Constructors
    Constructor and description
    `GinqAstBuilder(SourceUnit sourceUnit)` Creates a builder for the supplied source unit.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public AbstractGinqExpression` | `buildAST(ASTNode astNode)` Builds a GINQ AST from the supplied AST node.
    `` | `public SourceUnit` | `getSourceUnit()` Returns the source unit used for syntax reporting.
    `` | `public void` | `visitArgumentlistExpression(ArgumentListExpression expression)` Visits argument lists and replaces nested `select` expressions with built GINQ AST nodes.
    `` | `public void` | `visitBinaryExpression(BinaryExpression expression)` Visits binary expressions to wire nested GINQ expressions into filters.
    `` | `public void` | `visitCastExpression(CastExpression expression)` Visits cast expressions and substitutes nested GINQ expressions when needed.
    `` | `public void` | `visitDeclarationExpression(DeclarationExpression expression)` Visits declaration expressions and rejects assignments inside clause keywords.
    `` | `public void` | `visitMethodCallExpression(MethodCallExpression call)` Visits method-call expressions while assembling GINQ clauses.
    `` | `public void` | `visitPropertyExpression(PropertyExpression expression)` Visits property expressions and reports malformed aliases in `select`.
    `` | `public void` | `visitVariableExpression(VariableExpression expression)` Visits variable expressions and validates GINQ keywords.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class CodeVisitorSupport` | `afterSwitchCaseStatementsVisited, afterSwitchConditionExpressionVisited, visitArgumentlistExpression, visitArrayExpression, visitAssertStatement, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBlockStatement, visitBooleanExpression, visitBreakStatement, visitBytecodeExpression, visitCaseStatement, visitCastExpression, visitCatchStatement, visitClassExpression, visitClosureExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitContinueStatement, visitDeclarationExpression, visitDoWhileLoop, visitEmptyStatement, visitExpressionStatement, visitFieldExpression, visitForLoop, visitGStringExpression, visitIfElse, visitLambdaExpression, visitListExpression, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitMethodReferenceExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitReturnStatement, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitSwitch, visitSynchronizedStatement, visitTernaryExpression, visitThrowStatement, visitTryCatchFinally, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitVariableExpression, visitWhileLoop`

- - ### Field Detail

    - #### public static final String GINQ_SELECT_DISTINCT

      Metadata key marking `select distinct`.

    - #### public static final String ROOT_GINQ_EXPRESSION

      Metadata key storing the root GINQ expression.

  - ### Constructor Detail

    - #### public GinqAstBuilder(SourceUnit sourceUnit)

      Creates a builder for the supplied source unit.

      Parameters:
        `sourceUnit` - the source unit being processed

  - ### Method Detail

    - #### public AbstractGinqExpression buildAST(ASTNode astNode)

      Builds a GINQ AST from the supplied AST node.

      Parameters:
        `astNode` - the node containing GINQ code
      Returns:
        the built GINQ expression

    - #### public SourceUnit getSourceUnit()

      Returns the source unit used for syntax reporting.

      Returns:
        the current source unit

    - #### public void visitArgumentlistExpression(ArgumentListExpression expression)

      Visits argument lists and replaces nested `select` expressions with built GINQ AST nodes.

      Parameters:
        `expression` - the expression to visit

    - #### public void visitBinaryExpression(BinaryExpression expression)

      Visits binary expressions to wire nested GINQ expressions into filters.

      Parameters:
        `expression` - the expression to visit

    - #### public void visitCastExpression(CastExpression expression)

      Visits cast expressions and substitutes nested GINQ expressions when needed.

      Parameters:
        `expression` - the expression to visit

    - #### public void visitDeclarationExpression(DeclarationExpression expression)

      Visits declaration expressions and rejects assignments inside clause keywords.

      Parameters:
        `expression` - the expression to visit

    - #### public void visitMethodCallExpression(MethodCallExpression call)

      Visits method-call expressions while assembling GINQ clauses.

      Parameters:
        `call` - the method call to visit

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

      Visits property expressions and reports malformed aliases in `select`.

      Parameters:
        `expression` - the expression to visit

    - #### public void visitVariableExpression(VariableExpression expression)

      Visits variable expressions and validates GINQ keywords.

      Parameters:
        `expression` - the expression to visit