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 classSqlParser.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SqlParseradd(TokenVisitor tokenVisitor)Fluent variant ofaddVisitor(TokenVisitor).voidaddVisitor(TokenVisitor tokenVisitor)Adds a visitor.booleanisCompleted()booleanisParsing()booleanisStarted()voidparse()Starts parsing of the statement text.voidremoveVisitor(TokenVisitor tokenVisitor)Removes a visitor - if already registered.voidresumeParsing()Start or resume parsing of the statement text.static SqlParser.BuilderwithReservedWords(ReservedWords reservedWords)Creates a builder for a SQL parser with a supplier of reserved words.
-
-
-
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- Whenparse()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 ofaddVisitor(TokenVisitor).- Parameters:
tokenVisitor- token visitor to add- Returns:
- this SQL parser
-
addVisitor
public void addVisitor(TokenVisitor tokenVisitor)
Description copied from interface:VisitorRegistrarAdds a visitor.- Specified by:
addVisitorin interfaceVisitorRegistrar- Parameters:
tokenVisitor- Token visitor
-
removeVisitor
public void removeVisitor(TokenVisitor tokenVisitor)
Description copied from interface:VisitorRegistrarRemoves a visitor - if already registered.- Specified by:
removeVisitorin interfaceVisitorRegistrar- Parameters:
tokenVisitor- Token visitor
-
-