feat(flinksql): add some lexer

This commit is contained in:
Erindcl
2020-10-23 17:52:43 +08:00
parent b7df08f012
commit 6082c2b151
11 changed files with 2281 additions and 1690 deletions

View File

@ -5,13 +5,21 @@ options { tokenVocab=FlinkSqlLexer; }
program: statement EOF;
statement
: sqlStatement EOF
: sqlStatements EOF
;
sqlStatements
: (sqlStatement SEMICOLON | emptyStatement)*
;
sqlStatement
: ddlStatement | dmlStatement
;
emptyStatement
: SEMICOLON
;
ddlStatement
: createTable | createDatabase | createView | createFunction
| alterTable | alterDatabase | alterFunction
@ -24,13 +32,13 @@ dmlStatement
createTable
: CREATE TABLE tableName
(
columnOptionDefinition (',' columnOptionDefinition)*
)
LR_BRACKET
columnOptionDefinition (COMMA columnOptionDefinition)*
RR_BRACKET
partitionDefinition?
WITH (
withOptionDefinition (',' withOptionDefinition)*
)
WITH LR_BRACKET
withOptionDefinition (COMMA withOptionDefinition)*
RR_BRACKET
;
@ -67,7 +75,7 @@ partitionColumnName
;
withOptionDefinition
: REVERSE_QUOTE_ID EQUAL REVERSE_QUOTE_ID
: REVERSE_QUOTE_ID EQUAL_SYMBOL REVERSE_QUOTE_ID
;
createDatabase