Package adql.parser

## Class ADQLParser

- java.lang.Object
- - adql.parser.ADQLParser

- All Implemented Interfaces:
    `ADQLParserConstants`

      public class ADQLParser
      extends java.lang.Object
      implements ADQLParserConstants

  Parses an ADQL query thanks to the `Query()` function.

  This parser is able, thanks to a `QueryChecker` object, to check each `ADQLQuery` just after its generation. It could be used to check the consistency between the ADQL query to parse and the "database" on which the query must be executed. By default, there is no `QueryChecker`. Thus you must extend `QueryChecker` to check semantically all generated ADQLQuery objects.

  To create an object representation of the given ADQL query, this parser uses a `ADQLQueryFactory` object. So if you want customize some object (ie. CONTAINS) of this representation you just have to extend the corresponding default object (ie. ContainsFunction) and to extend the corresponding function of `ADQLQueryFactory` (ie. createContains(...)).

  Here are the key functions to use:

  - `parseQuery(java.lang.String)` (or any of its alternatives) to parse an input ADQL query String and get its corresponding ADQL tree
  - `tryQuickFix(java.lang.String)` to try fixing the most common issues with ADQL queries (e.g. Unicode confusable characters, unescaped ADQL identifiers, SQL reserved keywords, ...)

  WARNING: To modify this class it's strongly encouraged to modify the .jj file in the section between PARSER_BEGIN and PARSER_END and to re-compile it with JavaCC.

  Version:
    1.5 (03/2019)
  Author:
    Grégory Mantelet (CDS;ARI)
  See Also:
    `QueryChecker`, `ADQLQueryFactory`

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `Token` | `jj_nt` | Next token.
    `protected static java.lang.String` | `REGEX_DASH` | Regular expression matching all Unicode alternatives for `-`.
    `protected static java.lang.String` | `REGEX_DOUBLE_QUOTE` | Regular expression matching all Unicode alternatives for `"`.
    `protected static java.lang.String` | `REGEX_EQUAL` | Regular expression matching all Unicode alternatives for `=`.
    `protected static java.lang.String` | `REGEX_GREATER_THAN` | Regular expression matching all Unicode alternatives for `>`.
    `protected static java.lang.String` | `REGEX_LESS_THAN` | Regular expression matching all Unicode alternatives for `<`.
    `protected static java.lang.String` | `REGEX_PLUS` | Regular expression matching all Unicode alternatives for `+`.
    `protected static java.lang.String` | `REGEX_QUOTE` | Regular expression matching all Unicode alternatives for `'`.
    `protected static java.lang.String` | `REGEX_SPACE` | Regular expression matching all Unicode alternatives for `` .
    `protected static java.lang.String` | `REGEX_STOP` | Regular expression matching all Unicode alternatives for `.`.
    `protected static java.lang.String` | `REGEX_UNDERSCORE` | Regular expression matching all Unicode alternatives for `_`.
    `protected static java.util.Map<java.lang.String,​java.lang.String>` | `REGEX_UNICODE_CONFUSABLES` | All of the most common Unicode confusable characters and their ASCII/UTF-8 alternative.
    `Token` | `token` | Current token.
    `ADQLParserTokenManager` | `token_source` | Generated Token Manager.

    - ### Fields inherited from interface adql.parser.ADQLParserConstants

      `ABS, ACOS, AND, AREA, AS, ASC, ASIN, ASTERISK, ATAN, ATAN2, AVG, BETWEEN, BOX, BY, CEILING, CENTROID, CIRCLE, COMMA, CONCAT, CONTAINS, COORD1, COORD2, COORDSYS, COS, COT, COUNT, DEFAULT, DEGREES, DELIMITED_IDENTIFIER, DESC, DIGIT, DISTANCE, DIVIDE, DOT, EOF, EOQ, EQUAL, EXISTS, EXP, FLOOR, FROM, FULL, GREATER_EQUAL_THAN, GREATER_THAN, GROUP, HAVING, IN, INNER, INTERSECTS, IS, JOIN, LEFT, LEFT_PAR, LESS_EQUAL_THAN, LESS_THAN, Letter, LIKE, LOG, LOG10, MAX, MIN, MINUS, MOD, NATURAL, NOT, NOT_EQUAL, NULL, ON, OR, ORDER, OUTER, PI, PLUS, POINT, POLYGON, POWER, QUANTIFIER, RADIANS, RAND, REGION, REGULAR_IDENTIFIER_CANDIDATE, RIGHT, RIGHT_PAR, ROUND, SCIENTIFIC_NUMBER, SELECT, SIN, SQL_RESERVED_WORD, SQRT, STRING_LITERAL, SUM, TAN, tokenImage, TOP, TRUNCATE, UNSIGNED_FLOAT, UNSIGNED_INTEGER, USING, WHERE, WithinDelimitedId, WithinString`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ADQLParser()` | Builds an ADQL parser without a query to parse.
    `ADQLParser​(ADQLParserTokenManager tm)` | Constructor with generated Token Manager.
    `ADQLParser​(ADQLParserTokenManager tm, ADQLQueryFactory factory)` | Builds a parser with another token manager.
    `ADQLParser​(ADQLParserTokenManager tm, QueryChecker checker)` | Builds a parser with another token manager.
    `ADQLParser​(ADQLParserTokenManager tm, QueryChecker checker, ADQLQueryFactory factory)` | Builds a parser with another token manager.
    `ADQLParser​(ADQLQueryFactory factory)` | Builds an ADQL parser without a query to parse but with a `ADQLQueryFactory`.
    `ADQLParser​(QueryChecker checker)` | Builds an ADQL parser without a query to parse but with a `QueryChecker`.
    `ADQLParser​(QueryChecker checker, ADQLQueryFactory factory)` | Builds an ADQL parser without a query to parse but with a `QueryChecker` and a `ADQLQueryFactory`.
    `ADQLParser​(java.io.InputStream stream)` | Constructor with InputStream.
    `ADQLParser​(java.io.InputStream stream, ADQLQueryFactory factory)` | Builds a parser with a stream containing the query to parse.
    `ADQLParser​(java.io.InputStream stream, QueryChecker checker)` | Builds a parser with a stream containing the query to parse.
    `ADQLParser​(java.io.InputStream stream, QueryChecker checker, ADQLQueryFactory factory)` | Builds a parser with a stream containing the query to parse.
    `ADQLParser​(java.io.InputStream stream, java.lang.String encoding)` | Constructor with InputStream and supplied encoding
    `ADQLParser​(java.io.InputStream stream, java.lang.String encoding, ADQLQueryFactory factory)` | Builds a parser with a stream containing the query to parse.
    `ADQLParser​(java.io.InputStream stream, java.lang.String encoding, QueryChecker checker)` | Builds a parser with a stream containing the query to parse.
    `ADQLParser​(java.io.InputStream stream, java.lang.String encoding, QueryChecker checker, ADQLQueryFactory factory)` | Builds a parser with a stream containing the query to parse.
    `ADQLParser​(java.io.Reader stream)` | Constructor.
    `ADQLParser​(java.io.Reader reader, ADQLQueryFactory factory)` | Builds a parser with a reader containing the query to parse.
    `ADQLParser​(java.io.Reader reader, QueryChecker checker)` | Builds a parser with a reader containing the query to parse.
    `ADQLParser​(java.io.Reader reader, QueryChecker checker, ADQLQueryFactory factory)` | Builds a parser with a reader containing the query to parse.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Between` | `BetweenEnd​(ADQLOperand leftOp)` |
    `ADQLColumn` | `Column()` |
    `IdentifierItems` | `ColumnName()` | Extracts the name of a column with its possible catalog, schema and table prefixes.
    `Comparison` | `ComparisonEnd​(ADQLOperand leftOp)` |
    `ClauseConstraints` | `ConditionsList​(ClauseConstraints clause)` |
    `ADQLConstraint` | `Constraint()` |
    `ADQLOperand[]` | `Coordinates()` |
    `ADQLOperand` | `CoordinateSystem()` |
    `void` | `disable_tracing()` | Disable tracing.
    `void` | `enable_tracing()` | Enable tracing.
    `GeometryFunction` | `ExtractCoordSys()` |
    `ADQLOperand` | `Factor()` |
    `void` | `From()` |
    `ParseException` | `generateParseException()` | Generate ParseException.
    `GeometryFunction.GeometryValue<GeometryFunction>` | `GeometryExpression()` |
    `GeometryFunction` | `GeometryFunction()` |
    `GeometryFunction` | `GeometryValueFunction()` |
    `Token` | `getNextToken()` | Get the next Token.
    `QueryChecker` | `getQueryChecker()` |
    `ADQLQueryFactory` | `getQueryFactory()` |
    `Token` | `getToken​(int index)` | Get the specific Token.
    `void` | `GroupBy()` |
    `void` | `Having()` |
    `IdentifierItems.IdentifierItem` | `Identifier()` |
    `In` | `InEnd​(ADQLOperand leftOp)` |
    `protected boolean` | `isEnd​(Token token)` | Tell whether the given token represents the end of an ADQL query.
    `protected boolean` | `isFunctionName​(Token token)` | Tell whether the given token matches to an ADQL function name.
    `boolean` | `isRegularIdentifier​(java.lang.String idCandidate)` | Tell whether the given string is a valid ADQL regular identifier.
    `FromContent` | `JoinedTable()` |
    `ADQLJoin` | `JoinSpecification​(FromContent leftTable)` |
    `static void` | `main​(java.lang.String[] args)` | Gets the specified ADQL query and parses the given ADQL query.
    `MathFunction` | `MathFunction()` |
    `protected boolean` | `mustEscape​(Token token, Token nextToken)` | Tell whether the given token must be double quoted.
    `ADQLOperand` | `NumericExpression()` |
    `ADQLFunction` | `NumericFunction()` |
    `ADQLOperand` | `NumericTerm()` |
    `ADQLOperand` | `NumericValueExpressionPrimary()` |
    `void` | `OrderBy()` |
    `ADQLOrder` | `OrderItem()` |
    `ADQLQuery` | `parseQuery()` | Parses the query given at the creation of this parser or in the ReInit functions.
    `ADQLQuery` | `parseQuery​(java.io.InputStream stream)` | Parses the query contained in the stream given in parameter.
    `ADQLQuery` | `parseQuery​(java.lang.String q)` | Parses the query given in parameter.
    `PointFunction` | `Point()` |
    `ADQLConstraint` | `Predicate()` |
    `ADQLQuery` | `Query()` | Parses the ADQL query given at the parser creation or in the `ReInit(java.io.InputStream)` or in the parseQuery functions.
    `ADQLQuery` | `QueryExpression()` |
    `void` | `ReInit​(ADQLParserTokenManager tm)` | Reinitialise.
    `void` | `ReInit​(java.io.InputStream stream)` | Reinitialise.
    `void` | `ReInit​(java.io.InputStream stream, java.lang.String encoding)` | Reinitialise.
    `void` | `ReInit​(java.io.Reader stream)` | Reinitialise.
    `protected java.lang.String` | `replaceUnicodeConfusables​(java.lang.String adqlQuery)` | Replace all Unicode characters that can be confused with other ASCI/UTF-8 characters (e.g.
    `void` | `Select()` |
    `SelectItem` | `SelectItem()` |
    `void` | `setDebug​(boolean debug)` |
    `void` | `setQueryChecker​(QueryChecker checker)` |
    `void` | `setQueryFactory​(ADQLQueryFactory factory)` |
    `NumericConstant` | `SignedInteger()` |
    `FromContent` | `SimpleTableRef()` |
    `SQLFunction` | `SqlFunction()` |
    `StringConstant` | `String()` |
    `ADQLOperand` | `StringExpression()` |
    `ADQLOperand` | `StringFactor()` |
    `ADQLOperand` | `StringValueExpressionPrimary()` |
    `ADQLQuery` | `SubQueryExpression()` |
    `IdentifierItems` | `TableName()` | Extracts the name of a table with its possible catalog and schema prefixes.
    `FromContent` | `TableRef()` |
    `void` | `testRegularIdentifier​(Token token)` | Test the given token as an ADQL's regular identifier.
    `protected void` | `trace_call​(java.lang.String s)` |
    `boolean` | `trace_enabled()` | Trace enabled.
    `protected void` | `trace_return​(java.lang.String s)` |
    `protected void` | `trace_scan​(Token t1, int t2)` |
    `protected void` | `trace_token​(Token t, java.lang.String where)` |
    `MathFunction` | `TrigFunction()` |
    `java.lang.String` | `tryQuickFix​(java.io.InputStream input)` | Try fixing tokens/terms of the input ADQL query.
    `java.lang.String` | `tryQuickFix​(java.lang.String adqlQuery)` | Try fixing tokens/terms of the given ADQL query.
    `NumericConstant` | `UnsignedFloat()` |
    `NumericConstant` | `UnsignedNumeric()` |
    `UserDefinedFunction` | `UserDefinedFunction()` |
    `ADQLOperand` | `ValueExpression()` |
    `void` | `Where()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### REGEX_UNICODE_CONFUSABLES

          protected static final java.util.Map<java.lang.String,​java.lang.String> REGEX_UNICODE_CONFUSABLES

      All of the most common Unicode confusable characters and their ASCII/UTF-8 alternative.

      Keys of this map represent the ASCII character while the values are the regular expression for all possible Unicode alternatives.

      Note: All of them have been listed using Unicode Utilities: Confusables.

      Since:
        1.5

    - #### REGEX_DASH

          protected static final java.lang.String REGEX_DASH

      Regular expression matching all Unicode alternatives for `-`.
      Since:
        1.5
      See Also:
        Constant Field Values

    - #### REGEX_UNDERSCORE

          protected static final java.lang.String REGEX_UNDERSCORE

      Regular expression matching all Unicode alternatives for `_`.
      Since:
        1.5
      See Also:
        Constant Field Values

    - #### REGEX_QUOTE

          protected static final java.lang.String REGEX_QUOTE

      Regular expression matching all Unicode alternatives for `'`.
      Since:
        1.5
      See Also:
        Constant Field Values

    - #### REGEX_DOUBLE_QUOTE

          protected static final java.lang.String REGEX_DOUBLE_QUOTE

      Regular expression matching all Unicode alternatives for `"`.
      Since:
        1.5
      See Also:
        Constant Field Values

    - #### REGEX_STOP

          protected static final java.lang.String REGEX_STOP

      Regular expression matching all Unicode alternatives for `.`.
      Since:
        1.5
      See Also:
        Constant Field Values

    - #### REGEX_PLUS

          protected static final java.lang.String REGEX_PLUS

      Regular expression matching all Unicode alternatives for `+`.
      Since:
        1.5
      See Also:
        Constant Field Values

    - #### REGEX_SPACE

          protected static final java.lang.String REGEX_SPACE

      Regular expression matching all Unicode alternatives for `` .
      Since:
        1.5
      See Also:
        Constant Field Values

    - #### REGEX_LESS_THAN

          protected static final java.lang.String REGEX_LESS_THAN

      Regular expression matching all Unicode alternatives for `<`.
      Since:
        1.5
      See Also:
        Constant Field Values

    - #### REGEX_GREATER_THAN

          protected static final java.lang.String REGEX_GREATER_THAN

      Regular expression matching all Unicode alternatives for `>`.
      Since:
        1.5
      See Also:
        Constant Field Values

    - #### REGEX_EQUAL

          protected static final java.lang.String REGEX_EQUAL

      Regular expression matching all Unicode alternatives for `=`.
      Since:
        1.5
      See Also:
        Constant Field Values

    - #### token_source

          public ADQLParserTokenManager token_source

      Generated Token Manager.

    - #### token

          public Token token

      Current token.

    - #### jj_nt

          public Token jj_nt

      Next token.

  - ### Constructor Detail

    - #### ADQLParser

          public ADQLParser()

      Builds an ADQL parser without a query to parse.

    - #### ADQLParser

          public ADQLParser​(QueryChecker checker,
                            ADQLQueryFactory factory)

      Builds an ADQL parser without a query to parse but with a `QueryChecker` and a `ADQLQueryFactory`.
      Parameters:
        `checker` - The object to use to check each `ADQLQuery`.
        `factory` - The object to use to build an object representation of the given ADQL query.

    - #### ADQLParser

          public ADQLParser​(QueryChecker checker)

      Builds an ADQL parser without a query to parse but with a `QueryChecker`.
      Parameters:
        `checker` - The object to use to check each `ADQLQuery`.

    - #### ADQLParser

          public ADQLParser​(ADQLQueryFactory factory)

      Builds an ADQL parser without a query to parse but with a `ADQLQueryFactory`.
      Parameters:
        `factory` - The object to use to build an object representation of the given ADQL query.

    - #### ADQLParser

          public ADQLParser​(java.io.InputStream stream,
                            QueryChecker checker,
                            ADQLQueryFactory factory)

      Builds a parser with a stream containing the query to parse.
      Parameters:
        `stream` - The stream in which the ADQL query to parse is given.
        `checker` - The object to use to check each `ADQLQuery`.
        `factory` - The object to use to build an object representation of the given ADQL query.

    - #### ADQLParser

          public ADQLParser​(java.io.InputStream stream,
                            QueryChecker checker)

      Builds a parser with a stream containing the query to parse.
      Parameters:
        `stream` - The stream in which the ADQL query to parse is given.
        `checker` - The object to use to check each `ADQLQuery`.

    - #### ADQLParser

          public ADQLParser​(java.io.InputStream stream,
                            ADQLQueryFactory factory)

      Builds a parser with a stream containing the query to parse.
      Parameters:
        `stream` - The stream in which the ADQL query to parse is given.
        `factory` - The object to use to build an object representation of the given ADQL query.

    - #### ADQLParser

          public ADQLParser​(java.io.InputStream stream,
                            java.lang.String encoding,
                            QueryChecker checker,
                            ADQLQueryFactory factory)

      Builds a parser with a stream containing the query to parse.
      Parameters:
        `stream` - The stream in which the ADQL query to parse is given.
        `encoding` - The supplied encoding.
        `checker` - The object to use to check each `ADQLQuery`.
        `factory` - The object to use to build an object representation of the given ADQL query.

    - #### ADQLParser

          public ADQLParser​(java.io.InputStream stream,
                            java.lang.String encoding,
                            QueryChecker checker)

      Builds a parser with a stream containing the query to parse.
      Parameters:
        `stream` - The stream in which the ADQL query to parse is given.
        `encoding` - The supplied encoding.
        `checker` - The object to use to check each `ADQLQuery`.

    - #### ADQLParser

          public ADQLParser​(java.io.InputStream stream,
                            java.lang.String encoding,
                            ADQLQueryFactory factory)

      Builds a parser with a stream containing the query to parse.
      Parameters:
        `stream` - The stream in which the ADQL query to parse is given.
        `encoding` - The supplied encoding.
        `factory` - The object to use to build an object representation of the given ADQL query.

    - #### ADQLParser

          public ADQLParser​(java.io.Reader reader,
                            QueryChecker checker,
                            ADQLQueryFactory factory)

      Builds a parser with a reader containing the query to parse.
      Parameters:
        `reader` - The reader in which the ADQL query to parse is given.
        `checker` - The object to use to check each `ADQLQuery`.
        `factory` - The object to use to build an object representation of the given ADQL query.

    - #### ADQLParser

          public ADQLParser​(java.io.Reader reader,
                            QueryChecker checker)

      Builds a parser with a reader containing the query to parse.
      Parameters:
        `reader` - The reader in which the ADQL query to parse is given.
        `checker` - The object to use to check each `ADQLQuery`.

    - #### ADQLParser

          public ADQLParser​(java.io.Reader reader,
                            ADQLQueryFactory factory)

      Builds a parser with a reader containing the query to parse.
      Parameters:
        `reader` - The reader in which the ADQL query to parse is given.
        `factory` - The object to use to build an object representation of the given ADQL query.

    - #### ADQLParser

          public ADQLParser​(ADQLParserTokenManager tm,
                            QueryChecker checker,
                            ADQLQueryFactory factory)

      Builds a parser with another token manager.
      Parameters:
        `tm` - The manager which associates a token to a numeric code.
        `checker` - The object to use to check each `ADQLQuery`.
        `factory` - The object to use to build an object representation of the given ADQL query.

    - #### ADQLParser

          public ADQLParser​(ADQLParserTokenManager tm,
                            QueryChecker checker)

      Builds a parser with another token manager.
      Parameters:
        `tm` - The manager which associates a token to a numeric code.
        `checker` - The object to use to check each `ADQLQuery`.

    - #### ADQLParser

          public ADQLParser​(ADQLParserTokenManager tm,
                            ADQLQueryFactory factory)

      Builds a parser with another token manager.
      Parameters:
        `tm` - The manager which associates a token to a numeric code.
        `factory` - The object to use to build an object representation of the given ADQL query.

    - #### ADQLParser

          public ADQLParser​(java.io.InputStream stream)

      Constructor with InputStream.

    - #### ADQLParser

          public ADQLParser​(java.io.InputStream stream,
                            java.lang.String encoding)

      Constructor with InputStream and supplied encoding

    - #### ADQLParser

          public ADQLParser​(java.io.Reader stream)

      Constructor.

    - #### ADQLParser

          public ADQLParser​(ADQLParserTokenManager tm)

      Constructor with generated Token Manager.

  - ### Method Detail

    - #### setDebug

          public final void setDebug​(boolean debug)

    - #### getQueryChecker

          public final QueryChecker getQueryChecker()

    - #### setQueryChecker

          public final void setQueryChecker​(QueryChecker checker)

    - #### getQueryFactory

          public final ADQLQueryFactory getQueryFactory()

    - #### setQueryFactory

          public final void setQueryFactory​(ADQLQueryFactory factory)

    - #### isRegularIdentifier

          public final boolean isRegularIdentifier​(java.lang.String idCandidate)

      Tell whether the given string is a valid ADQL regular identifier.

      According to the ADQL-2.0's BNF, a regular identifier (i.e. not delimited ; not between double quotes) must be a letter followed by a letter, digit or underscore. So, the following regular expression:

          [a-zA-Z]+[a-zA-Z0-9_]*

      This is what this function tests on the given string.

      Parameters:
        `idCandidate` - The string to test.
      Returns:
        `true` if the given string is a valid regular identifier, `false` otherwise.
      Since:
        1.5
      See Also:
        `testRegularIdentifier(adql.parser.Token)`

    - #### testRegularIdentifier

          public final void testRegularIdentifier​(Token token)
                                           throws ParseException

      Test the given token as an ADQL's regular identifier.

      This function uses `isRegularIdentifier(java.lang.String)` to test the given token's image. If the test fails, a `ParseException` is thrown.

      Parameters:
        `token` - The token to test.
      Throws:
        `ParseException` - If the given token is not a valid ADQL regular identifier.
      Since:
        1.5
      See Also:
        `isRegularIdentifier(java.lang.String)`

    - #### parseQuery

          public final ADQLQuery parseQuery()
                                     throws ParseException

      Parses the query given at the creation of this parser or in the ReInit functions.
      Returns:
        The object representation of the given ADQL query.
      Throws:
        `ParseException` - If there is at least one syntactic error.
      See Also:
        `Query()`

    - #### parseQuery

          public final ADQLQuery parseQuery​(java.lang.String q)
                                     throws ParseException

      Parses the query given in parameter.
      Parameters:
        `q` - The ADQL query to parse.
      Returns:
        The object representation of the given ADQL query.
      Throws:
        `ParseException` - If there is at least one syntactic error.
      See Also:
        `ReInit(java.io.InputStream)`, `setDebug(boolean)`, `Query()`

    - #### parseQuery

          public final ADQLQuery parseQuery​(java.io.InputStream stream)
                                     throws ParseException

      Parses the query contained in the stream given in parameter.
      Parameters:
        `stream` - The stream which contains the ADQL query to parse.
      Returns:
        The object representation of the given ADQL query.
      Throws:
        `ParseException` - If there is at least one syntactic error.
      See Also:
        `ReInit(java.io.InputStream)`, `setDebug(boolean)`, `Query()`

    - #### tryQuickFix

          public final java.lang.String tryQuickFix​(java.io.InputStream input)
                                             throws java.io.IOException,
                                                    ParseException

      Try fixing tokens/terms of the input ADQL query.

      This function does not try to fix syntactical or semantical errors. It just try to fix the most common issues in ADQL queries, such as:

      - some Unicode characters confusable with ASCII characters (like a space, a dash, ...) ; this function replace them by their ASCII alternative,
      - any of the following are double quoted:
        - non regular ADQL identifiers (e.g. `_RAJ2000`),
        - ADQL function names used as identifiers (e.g. `distance`)
        - and SQL reserved keywords (e.g. `public`).

      Note 1: The given stream is NOT closed by this function even if the EOF is reached. It is the responsibility of the caller to close it.

      Note 2: This function does not use any instance variable of this parser (especially the InputStream or Reader provided at initialisation or ReInit).

      Parameters:
        `input` - Stream containing the input ADQL query to fix.
      Returns:
        The suggested correction of the input ADQL query.
      Throws:
        `java.io.IOException` - If there is any error while reading from the given input stream.
        `ParseException` - If any unrecognised character is encountered, or if anything else prevented the tokenization of some characters/words/terms.
      Since:
        1.5
      See Also:
        `tryQuickFix(java.lang.String)`

    - #### tryQuickFix

          public java.lang.String tryQuickFix​(java.lang.String adqlQuery)
                                       throws ParseException

      Try fixing tokens/terms of the given ADQL query.

      This function does not try to fix syntactical or semantical errors. It just try to fix the most common issues in ADQL queries, such as:

      - some Unicode characters confusable with ASCII characters (like a space, a dash, ...) ; this function replace them by their ASCII alternative,
      - any of the following are double quoted:
        - non regular ADQL identifiers (e.g. `_RAJ2000`),
        - ADQL function names used as identifiers (e.g. `distance`)
        - and SQL reserved keywords (e.g. `public`).

      Note: This function does not use any instance variable of this parser (especially the InputStream or Reader provided at initialisation or ReInit).

      Parameters:
        `adqlQuery` - The input ADQL query to fix.
      Returns:
        The suggested correction of the given ADQL query.
      Throws:
        `ParseException` - If any unrecognised character is encountered, or if anything else prevented the tokenization of some characters/words/terms.
      Since:
        1.5

    - #### replaceUnicodeConfusables

          protected java.lang.String replaceUnicodeConfusables​(java.lang.String adqlQuery)

      Replace all Unicode characters that can be confused with other ASCI/UTF-8 characters (e.g. different spaces, dashes, ...) in their ASCII version.
      Parameters:
        `adqlQuery` - The ADQL query string in which Unicode confusable characters must be replaced.
      Returns:
        The same query without the most common Unicode confusable characters.
      Since:
        1.5

    - #### isEnd

          protected boolean isEnd​(Token token)

      Tell whether the given token represents the end of an ADQL query.
      Parameters:
        `token` - Token to analyze.
      Returns:
        `true` if the given token represents a query end, `false` otherwise.
      Since:
        1.5

    - #### mustEscape

          protected boolean mustEscape​(Token token,
                                       Token nextToken)

      Tell whether the given token must be double quoted.

      This function considers all the following as terms to double quote:

      - SQL reserved keywords
      ,
      - unrecognised regular identifiers (e.g. neither a delimited nor a valid ADQL regular identifier)
      - and ADQL function name without a parameters list.
      Parameters:
        `token` - The token to analyze.
        `nextToken` - The following token. (useful to detect the start of a function's parameters list)
      Returns:
        `true` if the given token must be double quoted, `false` to keep it as provided.
      Since:
        1.5

    - #### isFunctionName

          protected boolean isFunctionName​(Token token)

      Tell whether the given token matches to an ADQL function name.
      Parameters:
        `token` - The token to analyze.
      Returns:
        `true` if the given token is an ADQL function name, `false` otherwise.
      Since:
        1.5

    - #### main

          public static final void main​(java.lang.String[] args)
                                 throws java.lang.Exception

      Gets the specified ADQL query and parses the given ADQL query. The SQL translation is then printed if the syntax is correct.

      ONLY the syntax is checked: the query is NOT EXECUTED !

      Parameters:
        `args` -
      Throws:
        `java.lang.Exception`

    - #### Query

          public final ADQLQuery Query()
                                throws ParseException

      Parses the ADQL query given at the parser creation or in the `ReInit(java.io.InputStream)` or in the parseQuery functions.
      Returns:
        The object representation of the query.
      Throws:
        `ParseException` - If the query syntax is incorrect.

    - #### QueryExpression

          public final ADQLQuery QueryExpression()
                                          throws ParseException

      Throws:
        `ParseException`

    - #### SubQueryExpression

          public final ADQLQuery SubQueryExpression()
                                             throws ParseException

      Throws:
        `ParseException`

    - #### Select

          public final void Select()
                            throws ParseException

      Throws:
        `ParseException`

    - #### SelectItem

          public final SelectItem SelectItem()
                                      throws ParseException

      Throws:
        `ParseException`

    - #### From

          public final void From()
                          throws ParseException

      Throws:
        `ParseException`

    - #### Where

          public final void Where()
                           throws ParseException

      Throws:
        `ParseException`

    - #### GroupBy

          public final void GroupBy()
                             throws ParseException

      Throws:
        `ParseException`

    - #### Having

          public final void Having()
                            throws ParseException

      Throws:
        `ParseException`

    - #### OrderBy

          public final void OrderBy()
                             throws ParseException

      Throws:
        `ParseException`

    - #### Identifier

          public final IdentifierItems.IdentifierItem Identifier()
                                                          throws ParseException

      Throws:
        `ParseException`

    - #### TableName

          public final IdentifierItems TableName()
                                          throws ParseException

      Extracts the name of a table with its possible catalog and schema prefixes.
      Returns:
        A `IdentifierItems` which contains at most three items: catalogName, schemaName and tableName.
      Throws:
        `ParseException`

    - #### ColumnName

          public final IdentifierItems ColumnName()
                                           throws ParseException

      Extracts the name of a column with its possible catalog, schema and table prefixes.
      Returns:
        A `IdentifierItems` which contains at most four items: catalogName, schemaName, tableName and columnName.
      Throws:
        `ParseException`

    - #### Column

          public final ADQLColumn Column()
                                  throws ParseException

      Throws:
        `ParseException`

    - #### OrderItem

          public final ADQLOrder OrderItem()
                                    throws ParseException

      Throws:
        `ParseException`

    - #### SimpleTableRef

          public final FromContent SimpleTableRef()
                                           throws ParseException

      Throws:
        `ParseException`

    - #### TableRef

          public final FromContent TableRef()
                                     throws ParseException

      Throws:
        `ParseException`

    - #### JoinedTable

          public final FromContent JoinedTable()
                                        throws ParseException

      Throws:
        `ParseException`

    - #### JoinSpecification

          public final ADQLJoin JoinSpecification​(FromContent leftTable)
                                           throws ParseException

      Throws:
        `ParseException`

    - #### String

          public final StringConstant String()
                                      throws ParseException

      Throws:
        `ParseException`

    - #### UnsignedNumeric

          public final NumericConstant UnsignedNumeric()
                                                throws ParseException

      Throws:
        `ParseException`

    - #### UnsignedFloat

          public final NumericConstant UnsignedFloat()
                                              throws ParseException

      Throws:
        `ParseException`

    - #### SignedInteger

          public final NumericConstant SignedInteger()
                                              throws ParseException

      Throws:
        `ParseException`

    - #### NumericValueExpressionPrimary

          public final ADQLOperand NumericValueExpressionPrimary()
                                                          throws ParseException

      Throws:
        `ParseException`

    - #### StringValueExpressionPrimary

          public final ADQLOperand StringValueExpressionPrimary()
                                                         throws ParseException

      Throws:
        `ParseException`

    - #### ValueExpression

          public final ADQLOperand ValueExpression()
                                            throws ParseException

      Throws:
        `ParseException`

    - #### NumericExpression

          public final ADQLOperand NumericExpression()
                                              throws ParseException

      Throws:
        `ParseException`

    - #### NumericTerm

          public final ADQLOperand NumericTerm()
                                        throws ParseException

      Throws:
        `ParseException`

    - #### Factor

          public final ADQLOperand Factor()
                                   throws ParseException

      Throws:
        `ParseException`

    - #### StringExpression

          public final ADQLOperand StringExpression()
                                             throws ParseException

      Throws:
        `ParseException`

    - #### StringFactor

          public final ADQLOperand StringFactor()
                                         throws ParseException

      Throws:
        `ParseException`

    - #### GeometryExpression

          public final GeometryFunction.GeometryValue<GeometryFunction> GeometryExpression()
                                                                                    throws ParseException

      Throws:
        `ParseException`

    - #### ConditionsList

          public final ClauseConstraints ConditionsList​(ClauseConstraints clause)
                                                 throws ParseException

      Throws:
        `ParseException`

    - #### Constraint

          public final ADQLConstraint Constraint()
                                          throws ParseException

      Throws:
        `ParseException`

    - #### Predicate

          public final ADQLConstraint Predicate()
                                         throws ParseException

      Throws:
        `ParseException`

    - #### ComparisonEnd

          public final Comparison ComparisonEnd​(ADQLOperand leftOp)
                                         throws ParseException

      Throws:
        `ParseException`

    - #### BetweenEnd

          public final Between BetweenEnd​(ADQLOperand leftOp)
                                   throws ParseException

      Throws:
        `ParseException`

    - #### InEnd

          public final In InEnd​(ADQLOperand leftOp)
                         throws ParseException

      Throws:
        `ParseException`

    - #### SqlFunction

          public final SQLFunction SqlFunction()
                                        throws ParseException

      Throws:
        `ParseException`

    - #### Coordinates

          public final ADQLOperand[] Coordinates()
                                          throws ParseException

      Throws:
        `ParseException`

    - #### GeometryFunction

          public final GeometryFunction GeometryFunction()
                                                  throws ParseException

      Throws:
        `ParseException`

    - #### CoordinateSystem

          public final ADQLOperand CoordinateSystem()
                                             throws ParseException

      Throws:
        `ParseException`

    - #### GeometryValueFunction

          public final GeometryFunction GeometryValueFunction()
                                                       throws ParseException

      Throws:
        `ParseException`

    - #### Point

          public final PointFunction Point()
                                    throws ParseException

      Throws:
        `ParseException`

    - #### ExtractCoordSys

          public final GeometryFunction ExtractCoordSys()
                                                 throws ParseException

      Throws:
        `ParseException`

    - #### NumericFunction

          public final ADQLFunction NumericFunction()
                                             throws ParseException

      Throws:
        `ParseException`

    - #### MathFunction

          public final MathFunction MathFunction()
                                          throws ParseException

      Throws:
        `ParseException`

    - #### TrigFunction

          public final MathFunction TrigFunction()
                                          throws ParseException

      Throws:
        `ParseException`

    - #### UserDefinedFunction

          public final UserDefinedFunction UserDefinedFunction()
                                                        throws ParseException

      Throws:
        `ParseException`

    - #### ReInit

          public void ReInit​(java.io.InputStream stream)

      Reinitialise.

    - #### ReInit

          public void ReInit​(java.io.InputStream stream,
                             java.lang.String encoding)

      Reinitialise.

    - #### ReInit

          public void ReInit​(java.io.Reader stream)

      Reinitialise.

    - #### ReInit

          public void ReInit​(ADQLParserTokenManager tm)

      Reinitialise.

    - #### getNextToken

          public final Token getNextToken()

      Get the next Token.

    - #### getToken

          public final Token getToken​(int index)

      Get the specific Token.

    - #### generateParseException

          public ParseException generateParseException()

      Generate ParseException.

    - #### trace_enabled

          public final boolean trace_enabled()

      Trace enabled.

    - #### enable_tracing

          public final void enable_tracing()

      Enable tracing.

    - #### disable_tracing

          public final void disable_tracing()

      Disable tracing.

    - #### trace_call

          protected void trace_call​(java.lang.String s)

    - #### trace_return

          protected void trace_return​(java.lang.String s)

    - #### trace_token

          protected void trace_token​(Token t,
                                     java.lang.String where)

    - #### trace_scan

          protected void trace_scan​(Token t1,
                                    int t2)