fixed lexer grammar

This commit is contained in:
Pawan Kumar 2024-04-25 13:11:24 +05:30
parent 07ae3b8636
commit 86080232bf
2 changed files with 18 additions and 14 deletions

View File

@ -123,6 +123,7 @@ K_ROLE: 'ROLE';
K_ROLES: 'ROLES';
K_SCHEMA: 'SCHEMA';
K_SELECT: 'SELECT';
K_SET_WITH_OPERATOR_LT: K_SET SPACE? OPERATOR_LT -> pushMode(IDENTIFIER_MODE);
K_SET: 'SET' -> pushMode(IDENTIFIER_MODE);
K_SFUNC: 'SFUNC';
K_STATIC: 'STATIC';
@ -131,6 +132,7 @@ K_STYPE: 'STYPE';
K_SUPERUSER: 'SUPERUSER';
K_TABLE: 'TABLE' -> pushMode(IDENTIFIER_MODE);
K_THREE: 'THREE';
K_TIMESTAMP_WITH_DECIMAL_LITERAL: K_TIMESTAMP SPACE DECIMAL_LITERAL;
K_TIMESTAMP: 'TIMESTAMP';
K_TO: 'TO' -> pushMode(IDENTIFIER_MODE);
K_TOKEN: 'TOKEN';
@ -160,10 +162,13 @@ K_DATE: 'DATE';
K_DECIMAL: 'DECIMAL';
K_DOUBLE: 'DOUBLE';
K_FLOAT: 'FLOAT';
K_FROZEN_WITH_OPERATOR_LT: K_FROZEN SPACE? OPERATOR_LT -> pushMode(IDENTIFIER_MODE);
K_FROZEN: 'FROZEN';
K_INET: 'INET';
K_INT: 'INT';
K_LIST_WITH_OPERATOR_LT: K_LIST SPACE? OPERATOR_LT -> pushMode(IDENTIFIER_MODE);
K_LIST: 'LIST';
K_MAP_WITH_OPERATOR_LT: K_MAP SPACE? OPERATOR_LT -> pushMode(IDENTIFIER_MODE);
K_MAP: 'MAP';
K_SMALLINT: 'SMALLINT';
K_TEXT: 'TEXT';
@ -297,6 +302,13 @@ K_USING_: K_USING -> type(K_USING), popMode;
K_WHERE_: K_WHERE -> type(K_WHERE), popMode;
K_WITH_: K_WITH -> type(K_WITH), popMode;
// handeling cases like 'frozen<','map<','list<','set<' and 'TIMETAMP WITH 1234'
K_MAP_WITH_OPERATOR_LT_: K_MAP_WITH_OPERATOR_LT -> type(K_MAP_WITH_OPERATOR_LT);
K_TIMESTAMP_WITH_DECIMAL_LITERAL_: K_TIMESTAMP_WITH_DECIMAL_LITERAL -> type(K_TIMESTAMP_WITH_DECIMAL_LITERAL);
K_FROZEN_WITH_OPERATOR_LT_: K_FROZEN_WITH_OPERATOR_LT -> type(K_FROZEN_WITH_OPERATOR_LT);
K_SET_WITH_OPERATOR_LT_: K_SET_WITH_OPERATOR_LT -> type(K_SET_WITH_OPERATOR_LT);
K_LIST_WITH_OPERATOR_LT_: K_LIST_WITH_OPERATOR_LT -> type(K_LIST_WITH_OPERATOR_LT);
OBJECT_NAME_ : OBJECT_NAME -> type(OBJECT_NAME), popMode;
SPACE_: [ \t\r\n]+ -> channel (HIDDEN);

View File

@ -615,7 +615,7 @@ usingTtlTimestamp
;
timestamp
: kwTimestamp decimalLiteral
: K_TIMESTAMP_WITH_DECIMAL_LITERAL
;
ttl
@ -767,7 +767,6 @@ stringLiteral
booleanLiteral
: K_TRUE
| K_FALSE
| OBJECT_NAME
;
hexadecimalLiteral
@ -791,10 +790,10 @@ column
dataType
: dataTypeName
| kwFrozen syntaxBracketLa dataType syntaxBracketRa
| K_SET syntaxBracketLa dataType syntaxBracketRa
| K_LIST syntaxBracketLa dataType syntaxBracketRa
| K_MAP syntaxBracketLa dataType syntaxComma dataType syntaxBracketRa
| K_FROZEN_WITH_OPERATOR_LT dataType syntaxBracketRa
| K_SET_WITH_OPERATOR_LT dataType syntaxBracketRa
| K_LIST_WITH_OPERATOR_LT dataType syntaxBracketRa
| K_MAP_WITH_OPERATOR_LT dataType syntaxComma dataType syntaxBracketRa
;
dataTypeName
@ -814,7 +813,7 @@ dataTypeName
| K_INET
| K_INT
| K_LIST
| K_MAP
// | K_MAP
| K_SMALLINT
| K_TEXT
| K_TIME
@ -917,11 +916,6 @@ kwAlter
: K_ALTER
;
kwFrozen
: K_FROZEN
| OBJECT_NAME
;
kwAnd
: K_AND
;
@ -1108,7 +1102,6 @@ kwLogged
kwLogin
: K_LOGIN
| OBJECT_NAME
;
kwMaterialized
@ -1217,7 +1210,6 @@ kwTable
kwTimestamp
: K_TIMESTAMP
| OBJECT_NAME
;
kwTo