Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions cql/CqlLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,25 @@ K_TIMEUUID : 'TIMEUUID';
K_TIME : 'TIME';
K_TINYINT : 'TINYINT';
K_TUPLE : 'TUPLE';
K_VECTOR : 'VECTOR';
K_DURATION : 'DURATION';
K_DEFAULT : 'DEFAULT';
K_UNSET : 'UNSET';
K_SAI : 'SAI';
K_STORAGEATTACHEDINDEX : 'STORAGEATTACHEDINDEX';
K_ANN : 'ANN';
K_VARCHAR : 'VARCHAR';
K_VARINT : 'VARINT';
K_NOW : 'NOW';
K_FROMJSON : 'FROMJSON';
K_TOJSON : 'TOJSON';
K_MINTIMEUUID : 'MINTIMEUUID';
K_MAXTIMEUUID : 'MAXTIMEUUID';
K_DATETIMENOW : 'DATETIMENOW';
K_CURRENTTIMESTAMP : 'CURRENTTIMESTAMP';
K_CURRENTDATE : 'CURRENTDATE';
K_CURRENTTIME : 'CURRENTTIME';
K_CURRENTTIMEUUID : 'CURRENTTIMEUUID';

// Literals

Expand Down
70 changes: 56 additions & 14 deletions cql/CqlParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ priviledge
: (kwAll | kwAllPermissions)
| kwAlter
| kwAuthorize
| kwDescibe
| kwDescribe
| kwExecute
| kwCreate
| kwDrop
Expand Down Expand Up @@ -528,7 +528,17 @@ truncate
;

createIndex
: kwCreate kwIndex ifNotExist? indexName? kwOn (keyspace DOT)? table syntaxBracketLr indexColumnSpec syntaxBracketRr
: kwCreate kwCustom? kwIndex ifNotExist? indexName? kwOn (keyspace DOT)? table syntaxBracketLr indexColumnSpec syntaxBracketRr (kwUsing indexClass)? (kwWith indexOptions)?
;

indexClass
: stringLiteral
| K_SAI
| K_STORAGEATTACHEDINDEX
;

indexOptions
: optionHash // Use optionHash for index options
;

indexName
Expand All @@ -538,19 +548,9 @@ indexName

indexColumnSpec
: column
| indexKeysSpec
| indexEntriesSSpec
| indexFullSpec
;

indexKeysSpec
: kwKeys syntaxBracketLr OBJECT_NAME syntaxBracketRr
;

indexEntriesSSpec
: kwEntries syntaxBracketLr OBJECT_NAME syntaxBracketRr
;

indexFullSpec
: kwFull syntaxBracketLr OBJECT_NAME syntaxBracketRr
;
Expand Down Expand Up @@ -655,7 +655,11 @@ ifExist

insertValuesSpec
: kwValues '(' expressionList ')'
| kwJson constant
| kwJson constant jsonDefaultUnset?
;

jsonDefaultUnset
: kwDefault kwUnset
;

insertColumnSpec
Expand Down Expand Up @@ -706,6 +710,15 @@ orderSpec

orderSpecElement
: OBJECT_NAME (kwAsc | kwDesc)?
| OBJECT_NAME kwAnn kwOf vectorLiteral (kwLimit DECIMAL_LITERAL)?
;

vectorLiteral
: '[' constantList ']'
;

constantList
: constant (syntaxComma constant)*
;

whereSpec
Expand Down Expand Up @@ -768,6 +781,16 @@ functionCall
: OBJECT_NAME '(' STAR ')'
| OBJECT_NAME '(' functionArgs? ')'
| K_UUID '(' ')'
| K_NOW '(' ')'
| K_FROMJSON '(' functionArgs ')'
| K_TOJSON '(' functionArgs ')'
| K_MINTIMEUUID '(' functionArgs ')'
| K_MAXTIMEUUID '(' functionArgs ')'
| K_DATETIMENOW '(' ')'
| K_CURRENTTIMESTAMP '(' ')'
| K_CURRENTDATE '(' ')'
| K_CURRENTTIME '(' ')'
| K_CURRENTTIMEUUID '(' ')'
;

functionArgs
Expand Down Expand Up @@ -854,10 +877,13 @@ dataTypeName
| K_VARINT
| K_TIMESTAMP
| K_UUID
| K_VECTOR
| K_DURATION
;

dataTypeDefinition
: syntaxBracketLa dataTypeName (syntaxComma dataTypeName)* syntaxBracketRa
| syntaxBracketLa dataTypeName syntaxComma DECIMAL_LITERAL syntaxBracketRa // For VECTOR<type, dimension>
;

orderDirection
Expand Down Expand Up @@ -994,6 +1020,22 @@ kwCreate
: K_CREATE
;

kwCustom
: K_CUSTOM
;

kwDefault
: K_DEFAULT
;

kwUnset
: K_UNSET
;

kwAnn
: K_ANN
;

kwDelete
: K_DELETE
;
Expand All @@ -1002,7 +1044,7 @@ kwDesc
: K_DESC
;

kwDescibe
kwDescribe
: K_DESCRIBE
;

Expand Down
1,846 changes: 984 additions & 862 deletions cql/cql_lexer.go

Large diffs are not rendered by default.

7,843 changes: 4,705 additions & 3,138 deletions cql/cql_parser.go

Large diffs are not rendered by default.

74 changes: 58 additions & 16 deletions cql/cqlparser_base_listener.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 33 additions & 5 deletions cql/cqlparser_base_visitor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading