public class SqlParserUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static SqlParseException |
error(SqlLexerToken token,
String msg)
Create parse exception referring to current lexer position.
|
static SqlParseException |
errorUnexpectedToken(SqlLexer lex,
String expToken)
Create generic parse exception due to unexpected token.
|
static SqlParseException |
errorUnexpectedToken(SqlLexerToken token)
Create generic parse exception due to unexpected token.
|
static SqlParseException |
errorUnexpectedToken(SqlLexerToken token,
String firstExpToken,
String... expTokens)
Create generic parse exception due to unexpected token.
|
static SqlParseException |
errorUnsupported(SqlLexerToken token)
Error on unsupported keyword.
|
static void |
errorUnsupportedIfMatchesKeyword(SqlLexerToken token,
String... keywords)
Throw unsupported token exception if one of passed keywords is found.
|
static void |
errorUnsupportedIfMatchesKeyword(SqlLexerToken token,
String keyword)
Throw unsupported token exception if passed keyword is found.
|
static boolean |
isValidIdentifier(SqlLexerToken token)
Check if token is identifier.
|
static boolean |
matchesKeyword(SqlLexerToken token,
String expKeyword)
Check if current lexer token matches expected.
|
static boolean |
parseBoolean(SqlLexer lex)
Parse boolean parameter value based on presence of tokens 1, 0, ON, OFF.
|
static String |
parseIdentifier(SqlLexer lex,
String... additionalExpTokens)
Process name.
|
static boolean |
parseIfExists(SqlLexer lex)
Parse IF EXISTS statement.
|
static boolean |
parseIfNotExists(SqlLexer lex)
Parse IF NOT EXISTS statement.
|
static int |
parseInt(SqlLexer lex)
Parse integer value (positive or negative).
|
static SqlQualifiedName |
parseQualifiedIdentifier(SqlLexer lex,
String... additionalExpTokens)
Process qualified name.
|
static String |
parseString(SqlLexer lex,
String... additionalExpTokens)
Process name.
|
static String |
parseUsername(SqlLexer lex,
String... additionalExpTokens)
Process name.
|
static boolean |
skipCommaOrRightParenthesis(SqlLexer lex)
Skip comma or right parenthesis.
|
static void |
skipIfMatches(SqlLexer lex,
SqlLexerTokenType tokenTyp)
Skip next token if it matches expected type.
|
static void |
skipIfMatchesKeyword(SqlLexer lex,
String expKeyword)
Skip token if it matches expected keyword.
|
static boolean |
skipIfMatchesOptionalKeyword(SqlLexer lex,
String expKeyword)
Skip token if it matches expected keyword by using lookahead.
|
public static boolean parseIfExists(SqlLexer lex)
lex - Lexer.True if statement is found.public static boolean parseIfNotExists(SqlLexer lex)
lex - Lexer.True if statement is found.public static boolean skipCommaOrRightParenthesis(SqlLexer lex)
lex - Lexer.True if right parenthesis is found.public static int parseInt(SqlLexer lex)
lex - Lexer.public static boolean parseBoolean(SqlLexer lex)
lex - Lexer.public static String parseIdentifier(SqlLexer lex, String... additionalExpTokens)
lex - Lexer.additionalExpTokens - Additional expected tokens in case of error.public static String parseUsername(SqlLexer lex, String... additionalExpTokens)
lex - Lexer.additionalExpTokens - Additional expected tokens in case of error.public static String parseString(SqlLexer lex, String... additionalExpTokens)
lex - Lexer.additionalExpTokens - Additional expected tokens in case of error.public static SqlQualifiedName parseQualifiedIdentifier(SqlLexer lex, String... additionalExpTokens)
lex - Lexer.additionalExpTokens - Additional expected tokens in case of error.public static boolean isValidIdentifier(SqlLexerToken token)
token - Token.True if we are standing on possible identifier.public static boolean matchesKeyword(SqlLexerToken token, String expKeyword)
token - Token..expKeyword - Expected keyword.True if matches.public static void skipIfMatchesKeyword(SqlLexer lex, String expKeyword)
lex - Lexer.expKeyword - Expected keyword.public static boolean skipIfMatchesOptionalKeyword(SqlLexer lex, String expKeyword)
lex - Lexer.expKeyword - Expected keyword.true In case token mathes, false otherwise.public static void skipIfMatches(SqlLexer lex, SqlLexerTokenType tokenTyp)
lex - Lexer.tokenTyp - Expected token type.public static SqlParseException error(SqlLexerToken token, String msg)
token - Token.msg - Message.public static SqlParseException errorUnexpectedToken(SqlLexerToken token)
token - Token.public static void errorUnsupportedIfMatchesKeyword(SqlLexerToken token, String keyword)
token - Token.keyword - Keyword.public static void errorUnsupportedIfMatchesKeyword(SqlLexerToken token, String... keywords)
token - Token.keywords - Keywords.public static SqlParseException errorUnsupported(SqlLexerToken token)
token - Token.public static SqlParseException errorUnexpectedToken(SqlLexer lex, String expToken)
lex - Lexer.expToken - Expected token.public static SqlParseException errorUnexpectedToken(SqlLexerToken token, String firstExpToken, String... expTokens)
token - Token.firstExpToken - First expected token.expTokens - Additional expected tokens (if any).
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.10.0 Release Date : March 10 2021