Package org.firebirdsql.jaybird.parser

## Class SqlParser

- java.lang.Object
- - org.firebirdsql.jaybird.parser.SqlParser

- All Implemented Interfaces:
    `VisitorRegistrar`

      @InternalApi
      public final class SqlParser
      extends java.lang.Object
      implements VisitorRegistrar

  Simple visiting SQL parser.

  This parser is not thread-safe.

  Since:
    5

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `SqlParser.Builder` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `SqlParser` | `add​(TokenVisitor tokenVisitor)` | Fluent variant of `addVisitor(TokenVisitor)`.
    `void` | `addVisitor​(TokenVisitor tokenVisitor)` | Adds a visitor.
    `boolean` | `isCompleted()` |
    `boolean` | `isParsing()` |
    `boolean` | `isStarted()` |
    `void` | `parse()` | Starts parsing of the statement text.
    `void` | `removeVisitor​(TokenVisitor tokenVisitor)` | Removes a visitor - if already registered.
    `void` | `resumeParsing()` | Start or resume parsing of the statement text.
    `static SqlParser.Builder` | `withReservedWords​(ReservedWords reservedWords)` | Creates a builder for a SQL parser with a supplier of reserved words.

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

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

- - ### Method Detail

    - #### withReservedWords

          public static SqlParser.Builder withReservedWords​(ReservedWords reservedWords)

      Creates a builder for a SQL parser with a supplier of reserved words.
      Parameters:
        `reservedWords` - Reserved words
      Returns:
        builder to complete initialization of a SQL parser

    - #### parse

          public void parse()

      Starts parsing of the statement text.
      Throws:
        `java.lang.IllegalStateException` - When `parse()` has already been parsed, or there are no registered visitors.
      See Also:
        `resumeParsing()`

    - #### resumeParsing

          public void resumeParsing()

      Start or resume parsing of the statement text.

      If the parsing process previously stalled because there were no more visitors, this continues parsing at the point the parser previously stopped. If parsing was not yet started (e.g. using `parse()`), it will start.

      Throws:
        `java.lang.IllegalStateException` - When parsing was already completed, parsing is already in progress, or there are no registered visitors
      See Also:
        `parse()`

    - #### isStarted

          public boolean isStarted()

    - #### isParsing

          public boolean isParsing()

    - #### isCompleted

          public boolean isCompleted()

    - #### add

          public SqlParser add​(TokenVisitor tokenVisitor)

      Fluent variant of `addVisitor(TokenVisitor)`.
      Parameters:
        `tokenVisitor` - token visitor to add
      Returns:
        this SQL parser

    - #### addVisitor

          public void addVisitor​(TokenVisitor tokenVisitor)

      Description copied from interface: `VisitorRegistrar`
      Adds a visitor.
      Specified by:
        `addVisitor` in interface `VisitorRegistrar`
      Parameters:
        `tokenVisitor` - Token visitor

    - #### removeVisitor

          public void removeVisitor​(TokenVisitor tokenVisitor)

      Description copied from interface: `VisitorRegistrar`
      Removes a visitor - if already registered.
      Specified by:
        `removeVisitor` in interface `VisitorRegistrar`
      Parameters:
        `tokenVisitor` - Token visitor