org.apache.ignite.internal.sql

## Class SqlParserUtils

- java.lang.Object
- - org.apache.ignite.internal.sql.SqlParserUtils

    public class SqlParserUtils
    extends Object

Parser utility methods.

### Method Summary

All Methods Static Methods Concrete Methods
`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 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 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.

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

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

### Method Detail

#### parseIfExists

    public static boolean parseIfExists(SqlLexer lex)

Parse IF EXISTS statement.

Parameters:
  `lex` - Lexer.
Returns:
  `True` if statement is found.

#### parseIfNotExists

    public static boolean parseIfNotExists(SqlLexer lex)

Parse IF NOT EXISTS statement.

Parameters:
  `lex` - Lexer.
Returns:
  `True` if statement is found.

#### skipCommaOrRightParenthesis

    public static boolean skipCommaOrRightParenthesis(SqlLexer lex)

Skip comma or right parenthesis.

Parameters:
  `lex` - Lexer.
Returns:
  `True` if right parenthesis is found.

#### parseInt

    public static int parseInt(SqlLexer lex)

Parse integer value (positive or negative).

Parameters:
  `lex` - Lexer.
Returns:
  Integer value.

#### parseIdentifier

    public static String parseIdentifier(SqlLexer lex,
                                         String... additionalExpTokens)

Process name.

Parameters:
  `lex` - Lexer.
  `additionalExpTokens` - Additional expected tokens in case of error.
Returns:
  Name.

#### parseQualifiedIdentifier

    public static SqlQualifiedName parseQualifiedIdentifier(SqlLexer lex,
                                                            String... additionalExpTokens)

Process qualified name.

Parameters:
  `lex` - Lexer.
  `additionalExpTokens` - Additional expected tokens in case of error.
Returns:
  Qualified name.

#### isValidIdentifier

    public static boolean isValidIdentifier(SqlLexerToken token)

Check if token is identifier.

Parameters:
  `token` - Token.
Returns:
  `True` if we are standing on possible identifier.

#### matchesKeyword

    public static boolean matchesKeyword(SqlLexerToken token,
                                         String expKeyword)

Check if current lexer token matches expected.

Parameters:
  `token` - Token..
  `expKeyword` - Expected keyword.
Returns:
  `True` if matches.

#### skipIfMatchesKeyword

    public static void skipIfMatchesKeyword(SqlLexer lex,
                                            String expKeyword)

Skip token if it matches expected keyword.

Parameters:
  `lex` - Lexer.
  `expKeyword` - Expected keyword.

#### skipIfMatches

    public static void skipIfMatches(SqlLexer lex,
                                     SqlLexerTokenType tokenTyp)

Skip next token if it matches expected type.

Parameters:
  `lex` - Lexer.
  `tokenTyp` - Expected token type.

#### error

    public static SqlParseException error(SqlLexerToken token,
                                          String msg)

Create parse exception referring to current lexer position.

Parameters:
  `token` - Token.
  `msg` - Message.
Returns:
  Exception.

#### errorUnexpectedToken

    public static SqlParseException errorUnexpectedToken(SqlLexerToken token)

Create generic parse exception due to unexpected token.

Parameters:
  `token` - Token.
Returns:
  Exception.

#### errorUnsupportedIfMatchesKeyword

    public static void errorUnsupportedIfMatchesKeyword(SqlLexerToken token,
                                                        String keyword)

Throw unsupported token exception if passed keyword is found.

Parameters:
  `token` - Token.
  `keyword` - Keyword.

#### errorUnsupportedIfMatchesKeyword

    public static void errorUnsupportedIfMatchesKeyword(SqlLexerToken token,
                                                        String... keywords)

Throw unsupported token exception if one of passed keywords is found.

Parameters:
  `token` - Token.
  `keywords` - Keywords.

#### errorUnsupported

    public static SqlParseException errorUnsupported(SqlLexerToken token)

Error on unsupported keyword.

Parameters:
  `token` - Token.
Returns:
  Error.

#### errorUnexpectedToken

    public static SqlParseException errorUnexpectedToken(SqlLexer lex,
                                                         String expToken)

Create generic parse exception due to unexpected token.

Parameters:
  `lex` - Lexer.
  `expToken` - Expected token.
Returns:
  Exception.

#### errorUnexpectedToken

    public static SqlParseException errorUnexpectedToken(SqlLexerToken token,
                                                         String firstExpToken,
                                                         String... expTokens)

Create generic parse exception due to unexpected token.

Parameters:
  `token` - Token.
  `firstExpToken` - First expected token.
  `expTokens` - Additional expected tokens (if any).
Returns:
  Exception.

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.4.0
Release Date | : March 5 2018