Class SqlParser

java.lang.Object
org.firebirdsql.jaybird.parser.SqlParser
All Implemented Interfaces:
VisitorRegistrar

@InternalApi public final class SqlParser extends Object implements VisitorRegistrar
Simple visiting SQL parser.

This parser is not thread-safe.

Since:
5
  • Method Details

    • 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:
      IllegalStateException - When parse() has already been parsed, or there are no registered visitors.
      See Also:
    • 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:
      IllegalStateException - When parsing was already completed, parsing is already in progress, or there are no registered visitors
      See Also:
    • 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