should be it
This commit is contained in:
46
external/duckdb/extension/autocomplete/grammar/statements/alter.gram
vendored
Normal file
46
external/duckdb/extension/autocomplete/grammar/statements/alter.gram
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
AlterStatement <- 'ALTER' AlterOptions
|
||||
|
||||
|
||||
AlterOptions <- AlterTableStmt / AlterViewStmt / AlterSequenceStmt / AlterDatabaseStmt / AlterSchemaStmt
|
||||
|
||||
AlterTableStmt <- 'TABLE' IfExists? BaseTableName AlterTableOptions
|
||||
AlterSchemaStmt <- 'SCHEMA' IfExists? QualifiedName RenameAlter
|
||||
|
||||
AlterTableOptions <- AddColumn / DropColumn / AlterColumn / AddConstraint / ChangeNullability / RenameColumn / RenameAlter / SetPartitionedBy / ResetPartitionedBy / SetSortedBy / ResetSortedBy
|
||||
|
||||
AddConstraint <- 'ADD' TopLevelConstraint
|
||||
AddColumn <- 'ADD' 'COLUMN'? IfNotExists? ColumnDefinition
|
||||
DropColumn <- 'DROP' 'COLUMN'? IfExists? NestedColumnName DropBehavior?
|
||||
AlterColumn <- 'ALTER' 'COLUMN'? NestedColumnName AlterColumnEntry
|
||||
RenameColumn <- 'RENAME' 'COLUMN'? NestedColumnName 'TO' Identifier
|
||||
NestedColumnName <- (Identifier '.')* ColumnName
|
||||
RenameAlter <- 'RENAME' 'TO' Identifier
|
||||
SetPartitionedBy <- 'SET' 'PARTITIONED' 'BY' Parens(List(Expression))
|
||||
ResetPartitionedBy <- 'RESET' 'PARTITIONED' 'BY'
|
||||
SetSortedBy <- 'SET' 'SORTED' 'BY' Parens(OrderByExpressions)
|
||||
ResetSortedBy <- 'RESET' 'SORTED' 'BY'
|
||||
|
||||
AlterColumnEntry <- AddOrDropDefault / ChangeNullability / AlterType
|
||||
|
||||
AddOrDropDefault <- AddDefault / DropDefault
|
||||
AddDefault <- 'SET' 'DEFAULT' Expression
|
||||
DropDefault <- 'DROP' 'DEFAULT'
|
||||
|
||||
ChangeNullability <- ('DROP' / 'SET') 'NOT' 'NULL'
|
||||
|
||||
AlterType <- SetData? 'TYPE' Type? UsingExpression?
|
||||
SetData <- 'SET' 'DATA'?
|
||||
UsingExpression <- 'USING' Expression
|
||||
|
||||
AlterViewStmt <- 'VIEW' IfExists? BaseTableName RenameAlter
|
||||
|
||||
AlterSequenceStmt <- 'SEQUENCE' IfExists? QualifiedSequenceName AlterSequenceOptions
|
||||
|
||||
QualifiedSequenceName <- CatalogQualification? SchemaQualification? SequenceName
|
||||
|
||||
AlterSequenceOptions <- RenameAlter / SetSequenceOption
|
||||
SetSequenceOption <- List(SequenceOption)
|
||||
|
||||
AlterDatabaseStmt <- 'DATABASE' IfExists? Identifier RenameDatabaseAlter
|
||||
|
||||
RenameDatabaseAlter <- 'RENAME' 'TO' Identifier
|
||||
3
external/duckdb/extension/autocomplete/grammar/statements/analyze.gram
vendored
Normal file
3
external/duckdb/extension/autocomplete/grammar/statements/analyze.gram
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
AnalyzeStatement <- 'ANALYZE' 'VERBOSE'? AnalyzeTarget?
|
||||
AnalyzeTarget <- QualifiedName Parens(List(Name))?
|
||||
Name <- ColId ('.' ColLabel)*
|
||||
6
external/duckdb/extension/autocomplete/grammar/statements/attach.gram
vendored
Normal file
6
external/duckdb/extension/autocomplete/grammar/statements/attach.gram
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
AttachStatement <- 'ATTACH' OrReplace? IfNotExists? Database? DatabasePath AttachAlias? AttachOptions?
|
||||
|
||||
Database <- 'DATABASE'
|
||||
DatabasePath <- StringLiteral
|
||||
AttachAlias <- 'AS' ColId
|
||||
AttachOptions <- Parens(GenericCopyOptionList)
|
||||
1
external/duckdb/extension/autocomplete/grammar/statements/call.gram
vendored
Normal file
1
external/duckdb/extension/autocomplete/grammar/statements/call.gram
vendored
Normal file
@@ -0,0 +1 @@
|
||||
CallStatement <- 'CALL' TableFunctionName TableFunctionArguments
|
||||
1
external/duckdb/extension/autocomplete/grammar/statements/checkpoint.gram
vendored
Normal file
1
external/duckdb/extension/autocomplete/grammar/statements/checkpoint.gram
vendored
Normal file
@@ -0,0 +1 @@
|
||||
CheckpointStatement <- 'FORCE'? 'CHECKPOINT' CatalogName?
|
||||
5
external/duckdb/extension/autocomplete/grammar/statements/comment.gram
vendored
Normal file
5
external/duckdb/extension/autocomplete/grammar/statements/comment.gram
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
CommentStatement <- 'COMMENT' 'ON' CommentOnType ColumnReference 'IS' CommentValue
|
||||
|
||||
|
||||
CommentOnType <- 'TABLE' / 'SEQUENCE' / 'FUNCTION' / ('MACRO' 'TABLE'?) / 'VIEW' / 'DATABASE' / 'INDEX' / 'SCHEMA' / 'TYPE' / 'COLUMN'
|
||||
CommentValue <- 'NULL' / StringLiteral
|
||||
133
external/duckdb/extension/autocomplete/grammar/statements/common.gram
vendored
Normal file
133
external/duckdb/extension/autocomplete/grammar/statements/common.gram
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
Statement <-
|
||||
CreateStatement /
|
||||
SelectStatement /
|
||||
SetStatement /
|
||||
PragmaStatement /
|
||||
CallStatement /
|
||||
InsertStatement /
|
||||
DropStatement /
|
||||
CopyStatement /
|
||||
ExplainStatement /
|
||||
UpdateStatement /
|
||||
PrepareStatement /
|
||||
ExecuteStatement /
|
||||
AlterStatement /
|
||||
TransactionStatement /
|
||||
DeleteStatement /
|
||||
AttachStatement /
|
||||
UseStatement /
|
||||
DetachStatement /
|
||||
CheckpointStatement /
|
||||
VacuumStatement /
|
||||
ResetStatement /
|
||||
ExportStatement /
|
||||
ImportStatement /
|
||||
CommentStatement /
|
||||
DeallocateStatement /
|
||||
TruncateStatement /
|
||||
LoadStatement /
|
||||
InstallStatement /
|
||||
AnalyzeStatement /
|
||||
MergeIntoStatement
|
||||
|
||||
CatalogName <- Identifier
|
||||
SchemaName <- Identifier
|
||||
ReservedSchemaName <- Identifier
|
||||
TableName <- Identifier
|
||||
ReservedTableName <- Identifier
|
||||
ReservedIdentifier <- Identifier
|
||||
ColumnName <- Identifier
|
||||
ReservedColumnName <- Identifier
|
||||
IndexName <- Identifier
|
||||
SettingName <- Identifier
|
||||
PragmaName <- Identifier
|
||||
FunctionName <- Identifier
|
||||
ReservedFunctionName <- Identifier
|
||||
TableFunctionName <- Identifier
|
||||
ConstraintName <- ColIdOrString
|
||||
SequenceName <- Identifier
|
||||
CollationName <- Identifier
|
||||
CopyOptionName <- ColLabel
|
||||
SecretName <- ColId
|
||||
|
||||
NumberLiteral <- < [+-]?[0-9]*([.][0-9]*)? >
|
||||
StringLiteral <- '\'' [^\']* '\''
|
||||
|
||||
Type <- (TimeType / IntervalType / BitType / RowType / MapType / UnionType / NumericType / SetofType / SimpleType) ArrayBounds*
|
||||
SimpleType <- (QualifiedTypeName / CharacterType) TypeModifiers?
|
||||
CharacterType <- ('CHARACTER' 'VARYING'?) /
|
||||
('CHAR' 'VARYING'?) /
|
||||
('NATIONAL' 'CHARACTER' 'VARYING'?) /
|
||||
('NATIONAL' 'CHAR' 'VARYING'?) /
|
||||
('NCHAR' 'VARYING'?) /
|
||||
'VARCHAR'
|
||||
IntervalType <- ('INTERVAL' Interval?) / ('INTERVAL' Parens(NumberLiteral))
|
||||
|
||||
YearKeyword <- 'YEAR' / 'YEARS'
|
||||
MonthKeyword <- 'MONTH' / 'MONTHS'
|
||||
DayKeyword <- 'DAY' / 'DAYS'
|
||||
HourKeyword <- 'HOUR' / 'HOURS'
|
||||
MinuteKeyword <- 'MINUTE' / 'MINUTES'
|
||||
SecondKeyword <- 'SECOND' / 'SECONDS'
|
||||
MillisecondKeyword <- 'MILLISECOND' / 'MILLISECONDS'
|
||||
MicrosecondKeyword <- 'MICROSECOND' / 'MICROSECONDS'
|
||||
WeekKeyword <- 'WEEK' / 'WEEKS'
|
||||
QuarterKeyword <- 'QUARTER' / 'QUARTERS'
|
||||
DecadeKeyword <- 'DECADE' / 'DECADES'
|
||||
CenturyKeyword <- 'CENTURY' / 'CENTURIES'
|
||||
MillenniumKeyword <- 'MILLENNIUM' / 'MILLENNIA'
|
||||
|
||||
Interval <- YearKeyword /
|
||||
MonthKeyword /
|
||||
DayKeyword /
|
||||
HourKeyword /
|
||||
MinuteKeyword /
|
||||
SecondKeyword /
|
||||
MillisecondKeyword /
|
||||
MicrosecondKeyword /
|
||||
WeekKeyword /
|
||||
QuarterKeyword /
|
||||
DecadeKeyword /
|
||||
CenturyKeyword /
|
||||
MillenniumKeyword /
|
||||
(YearKeyword 'TO' MonthKeyword) /
|
||||
(DayKeyword 'TO' HourKeyword) /
|
||||
(DayKeyword 'TO' MinuteKeyword) /
|
||||
(DayKeyword 'TO' SecondKeyword) /
|
||||
(HourKeyword 'TO' MinuteKeyword) /
|
||||
(HourKeyword 'TO' SecondKeyword) /
|
||||
(MinuteKeyword 'TO' SecondKeyword)
|
||||
|
||||
BitType <- 'BIT' 'VARYING'? Parens(List(Expression))?
|
||||
|
||||
NumericType <- 'INT' /
|
||||
'INTEGER' /
|
||||
'SMALLINT' /
|
||||
'BIGINT' /
|
||||
'REAL' /
|
||||
'BOOLEAN' /
|
||||
('FLOAT' Parens(NumberLiteral)?) /
|
||||
('DOUBLE' 'PRECISION') /
|
||||
('DECIMAL' TypeModifiers?) /
|
||||
('DEC' TypeModifiers?) /
|
||||
('NUMERIC' TypeModifiers?)
|
||||
|
||||
QualifiedTypeName <- CatalogQualification? SchemaQualification? TypeName
|
||||
TypeModifiers <- Parens(List(Expression)?)
|
||||
RowType <- RowOrStruct Parens(List(ColIdType))
|
||||
UnionType <- 'UNION' Parens(List(ColIdType))
|
||||
SetofType <- 'SETOF' Type
|
||||
MapType <- 'MAP' Parens(List(Type))
|
||||
ColIdType <- ColId Type
|
||||
ArrayBounds <- ('[' NumberLiteral? ']') / 'ARRAY'
|
||||
TimeType <- TimeOrTimestamp TypeModifiers? TimeZone?
|
||||
TimeOrTimestamp <- 'TIME' / 'TIMESTAMP'
|
||||
TimeZone <- WithOrWithout 'TIME' 'ZONE'
|
||||
WithOrWithout <- 'WITH' / 'WITHOUT'
|
||||
|
||||
RowOrStruct <- 'ROW' / 'STRUCT'
|
||||
|
||||
# internal definitions
|
||||
%whitespace <- [ \t\n\r]*
|
||||
List(D) <- D (',' D)* ','?
|
||||
Parens(D) <- '(' D ')'
|
||||
30
external/duckdb/extension/autocomplete/grammar/statements/copy.gram
vendored
Normal file
30
external/duckdb/extension/autocomplete/grammar/statements/copy.gram
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
CopyStatement <- 'COPY' (CopyTable / CopySelect / CopyFromDatabase)
|
||||
|
||||
CopyTable <- BaseTableName InsertColumnList? FromOrTo CopyFileName CopyOptions?
|
||||
FromOrTo <- 'FROM' / 'TO'
|
||||
|
||||
CopySelect <- Parens(SelectStatement) 'TO' CopyFileName CopyOptions?
|
||||
|
||||
CopyFileName <- Expression / StringLiteral / Identifier / (Identifier '.' ColId)
|
||||
CopyOptions <- 'WITH'? (Parens(GenericCopyOptionList) / (SpecializedOptions*))
|
||||
SpecializedOptions <-
|
||||
'BINARY' / 'FREEZE' / 'OIDS' / 'CSV' / 'HEADER' /
|
||||
SpecializedStringOption /
|
||||
('ENCODING' StringLiteral) /
|
||||
('FORCE' 'QUOTE' StarOrColumnList) /
|
||||
('PARTITION' 'BY' StarOrColumnList) /
|
||||
('FORCE' 'NOT'? 'NULL' ColumnList)
|
||||
|
||||
SpecializedStringOption <- ('DELIMITER' / 'NULL' / 'QUOTE' / 'ESCAPE') 'AS'? StringLiteral
|
||||
|
||||
StarOrColumnList <- '*' / ColumnList
|
||||
|
||||
GenericCopyOptionList <- List(GenericCopyOption)
|
||||
GenericCopyOption <- GenericCopyOptionName Expression?
|
||||
# FIXME: should not need to hard-code options here
|
||||
GenericCopyOptionName <- 'ARRAY' / 'NULL' / 'ANALYZE' / CopyOptionName
|
||||
|
||||
CopyFromDatabase <- 'FROM' 'DATABASE' ColId 'TO' ColId CopyDatabaseFlag?
|
||||
|
||||
CopyDatabaseFlag <- Parens(SchemaOrData)
|
||||
SchemaOrData <- 'SCHEMA' / 'DATA'
|
||||
10
external/duckdb/extension/autocomplete/grammar/statements/create_index.gram
vendored
Normal file
10
external/duckdb/extension/autocomplete/grammar/statements/create_index.gram
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
CreateIndexStmt <- Unique? 'INDEX' IfNotExists? IndexName? 'ON' BaseTableName IndexType? Parens(List(IndexElement)) WithList? WhereClause?
|
||||
|
||||
WithList <- 'WITH' Parens(List(RelOption)) / Oids
|
||||
Oids <- ('WITH' / 'WITHOUT') 'OIDS'
|
||||
IndexElement <- Expression DescOrAsc? NullsFirstOrLast?
|
||||
Unique <- 'UNIQUE'
|
||||
IndexType <- 'USING' Identifier
|
||||
RelOption <- ColLabel ('.' ColLabel)* ('=' DefArg)?
|
||||
DefArg <- FuncType / ReservedKeyword / StringLiteral / NumberLiteral / 'NONE'
|
||||
FuncType <- Type / ('SETOF'? TypeFuncName '%' 'TYPE')
|
||||
11
external/duckdb/extension/autocomplete/grammar/statements/create_macro.gram
vendored
Normal file
11
external/duckdb/extension/autocomplete/grammar/statements/create_macro.gram
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
CreateMacroStmt <- MacroOrFunction IfNotExists? QualifiedName List(MacroDefinition)
|
||||
|
||||
MacroOrFunction <- 'MACRO' / 'FUNCTION'
|
||||
|
||||
MacroDefinition <- Parens(MacroParameters?) 'AS' (TableMacroDefinition / ScalarMacroDefinition)
|
||||
|
||||
MacroParameters <- List(MacroParameter)
|
||||
MacroParameter <- NamedParameter / (TypeFuncName Type?)
|
||||
|
||||
ScalarMacroDefinition <- Expression
|
||||
TableMacroDefinition <- 'TABLE' SelectStatement
|
||||
1
external/duckdb/extension/autocomplete/grammar/statements/create_schema.gram
vendored
Normal file
1
external/duckdb/extension/autocomplete/grammar/statements/create_schema.gram
vendored
Normal file
@@ -0,0 +1 @@
|
||||
CreateSchemaStmt <- 'SCHEMA' IfNotExists? QualifiedName
|
||||
3
external/duckdb/extension/autocomplete/grammar/statements/create_secret.gram
vendored
Normal file
3
external/duckdb/extension/autocomplete/grammar/statements/create_secret.gram
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
CreateSecretStmt <- 'SECRET' IfNotExists? SecretName? SecretStorageSpecifier? Parens(GenericCopyOptionList)
|
||||
|
||||
SecretStorageSpecifier <- 'IN' Identifier
|
||||
20
external/duckdb/extension/autocomplete/grammar/statements/create_sequence.gram
vendored
Normal file
20
external/duckdb/extension/autocomplete/grammar/statements/create_sequence.gram
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
CreateSequenceStmt <- 'SEQUENCE' IfNotExists? QualifiedName SequenceOption*
|
||||
|
||||
SequenceOption <-
|
||||
SeqSetCycle /
|
||||
SeqSetIncrement /
|
||||
SeqSetMinMax /
|
||||
SeqNoMinMax /
|
||||
SeqStartWith /
|
||||
SeqOwnedBy
|
||||
|
||||
SeqSetCycle <- 'NO'? 'CYCLE'
|
||||
SeqSetIncrement <- 'INCREMENT' 'BY'? Expression
|
||||
SeqSetMinMax <- SeqMinOrMax Expression
|
||||
SeqNoMinMax <- 'NO' SeqMinOrMax
|
||||
SeqStartWith <- 'START' 'WITH'? Expression
|
||||
SeqOwnedBy <- 'OWNED' 'BY' QualifiedName
|
||||
|
||||
|
||||
SeqMinOrMax <- 'MINVALUE' / 'MAXVALUE'
|
||||
|
||||
69
external/duckdb/extension/autocomplete/grammar/statements/create_table.gram
vendored
Normal file
69
external/duckdb/extension/autocomplete/grammar/statements/create_table.gram
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
CreateStatement <- 'CREATE' OrReplace? Temporary? (CreateTableStmt / CreateMacroStmt / CreateSequenceStmt / CreateTypeStmt / CreateSchemaStmt / CreateViewStmt / CreateIndexStmt / CreateSecretStmt)
|
||||
OrReplace <- 'OR' 'REPLACE'
|
||||
Temporary <- 'TEMP' / 'TEMPORARY' / 'PERSISTENT'
|
||||
|
||||
CreateTableStmt <- 'TABLE' IfNotExists? QualifiedName (CreateTableAs / CreateColumnList) CommitAction?
|
||||
|
||||
CreateTableAs <- IdentifierList? 'AS' SelectStatement WithData?
|
||||
WithData <- 'WITH' 'NO'? 'DATA'
|
||||
IdentifierList <- Parens(List(Identifier))
|
||||
CreateColumnList <- Parens(CreateTableColumnList)
|
||||
IfNotExists <- 'IF' 'NOT' 'EXISTS'
|
||||
QualifiedName <- CatalogReservedSchemaIdentifier / SchemaReservedIdentifierOrStringLiteral / IdentifierOrStringLiteral
|
||||
SchemaReservedIdentifierOrStringLiteral <- SchemaQualification ReservedIdentifierOrStringLiteral
|
||||
CatalogReservedSchemaIdentifier <- CatalogQualification ReservedSchemaQualification ReservedIdentifierOrStringLiteral
|
||||
IdentifierOrStringLiteral <- Identifier / StringLiteral
|
||||
ReservedIdentifierOrStringLiteral <- ReservedIdentifier / StringLiteral
|
||||
CatalogQualification <- CatalogName '.'
|
||||
SchemaQualification <- SchemaName '.'
|
||||
ReservedSchemaQualification <- ReservedSchemaName '.'
|
||||
TableQualification <- TableName '.'
|
||||
ReservedTableQualification <- ReservedTableName '.'
|
||||
|
||||
CreateTableColumnList <- List(CreateTableColumnElement)
|
||||
CreateTableColumnElement <- ColumnDefinition / TopLevelConstraint
|
||||
ColumnDefinition <- DottedIdentifier TypeOrGenerated ColumnConstraint*
|
||||
TypeOrGenerated <- Type? GeneratedColumn?
|
||||
ColumnConstraint <- NotNullConstraint / UniqueConstraint / PrimaryKeyConstraint / DefaultValue / CheckConstraint / ForeignKeyConstraint / ColumnCollation / ColumnCompression
|
||||
NotNullConstraint <- 'NOT'? 'NULL'
|
||||
UniqueConstraint <- 'UNIQUE'
|
||||
PrimaryKeyConstraint <- 'PRIMARY' 'KEY'
|
||||
DefaultValue <- 'DEFAULT' Expression
|
||||
CheckConstraint <- 'CHECK' Parens(Expression)
|
||||
ForeignKeyConstraint <- 'REFERENCES' BaseTableName Parens(ColumnList)? KeyActions?
|
||||
ColumnCollation <- 'COLLATE' Expression
|
||||
ColumnCompression <- 'USING' 'COMPRESSION' ColIdOrString
|
||||
|
||||
KeyActions <- UpdateAction? DeleteAction?
|
||||
UpdateAction <- 'ON' 'UPDATE' KeyAction
|
||||
DeleteAction <- 'ON' 'DELETE' KeyAction
|
||||
KeyAction <- ('NO' 'ACTION') / 'RESTRICT' / 'CASCADE' / ('SET' 'NULL') / ('SET' 'DEFAULT')
|
||||
|
||||
TopLevelConstraint <- ConstraintNameClause? TopLevelConstraintList
|
||||
TopLevelConstraintList <- TopPrimaryKeyConstraint / CheckConstraint / TopUniqueConstraint / TopForeignKeyConstraint
|
||||
ConstraintNameClause <- 'CONSTRAINT' Identifier
|
||||
TopPrimaryKeyConstraint <- 'PRIMARY' 'KEY' ColumnIdList
|
||||
TopUniqueConstraint <- 'UNIQUE' ColumnIdList
|
||||
TopForeignKeyConstraint <- 'FOREIGN' 'KEY' ColumnIdList ForeignKeyConstraint
|
||||
ColumnIdList <- Parens(List(ColId))
|
||||
|
||||
PlainIdentifier <- !ReservedKeyword <[a-z_]i[a-z0-9_]i*>
|
||||
QuotedIdentifier <- '"' [^"]* '"'
|
||||
DottedIdentifier <- Identifier ('.' Identifier)*
|
||||
Identifier <- QuotedIdentifier / PlainIdentifier
|
||||
|
||||
ColId <- UnreservedKeyword / ColumnNameKeyword / Identifier
|
||||
ColIdOrString <- ColId / StringLiteral
|
||||
FuncName <- UnreservedKeyword / FuncNameKeyword / Identifier
|
||||
TypeFuncName <- UnreservedKeyword / TypeNameKeyword / FuncNameKeyword / Identifier
|
||||
TypeName <- UnreservedKeyword / TypeNameKeyword / Identifier
|
||||
ColLabel <- ReservedKeyword / UnreservedKeyword / ColumnNameKeyword / FuncNameKeyword / TypeNameKeyword / Identifier
|
||||
ColLabelOrString <- ColLabel / StringLiteral
|
||||
GeneratedColumn <- Generated? 'AS' Parens(Expression) GeneratedColumnType?
|
||||
|
||||
Generated <- 'GENERATED' AlwaysOrByDefault?
|
||||
AlwaysOrByDefault <- 'ALWAYS' / ('BY' 'DEFAULT')
|
||||
GeneratedColumnType <- 'VIRTUAL' / 'STORED'
|
||||
|
||||
CommitAction <- 'ON' 'COMMIT' PreserveOrDelete
|
||||
PreserveOrDelete <- ('PRESERVE' / 'DELETE') 'ROWS'
|
||||
4
external/duckdb/extension/autocomplete/grammar/statements/create_type.gram
vendored
Normal file
4
external/duckdb/extension/autocomplete/grammar/statements/create_type.gram
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
CreateTypeStmt <- 'TYPE' IfNotExists? QualifiedName 'AS' CreateType
|
||||
CreateType <- ('ENUM' Parens(SelectStatement)) /
|
||||
('ENUM' Parens(List(StringLiteral))) /
|
||||
Type
|
||||
1
external/duckdb/extension/autocomplete/grammar/statements/create_view.gram
vendored
Normal file
1
external/duckdb/extension/autocomplete/grammar/statements/create_view.gram
vendored
Normal file
@@ -0,0 +1 @@
|
||||
CreateViewStmt <- 'RECURSIVE'? 'VIEW' IfNotExists? QualifiedName InsertColumnList? 'AS' SelectStatement
|
||||
1
external/duckdb/extension/autocomplete/grammar/statements/deallocate.gram
vendored
Normal file
1
external/duckdb/extension/autocomplete/grammar/statements/deallocate.gram
vendored
Normal file
@@ -0,0 +1 @@
|
||||
DeallocateStatement <- 'DEALLOCATE' 'PREPARE'? Identifier
|
||||
4
external/duckdb/extension/autocomplete/grammar/statements/delete.gram
vendored
Normal file
4
external/duckdb/extension/autocomplete/grammar/statements/delete.gram
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
DeleteStatement <- WithClause? 'DELETE' 'FROM' TargetOptAlias DeleteUsingClause? WhereClause? ReturningClause?
|
||||
TruncateStatement <- 'TRUNCATE' 'TABLE'? BaseTableName
|
||||
TargetOptAlias <- BaseTableName 'AS'? ColId?
|
||||
DeleteUsingClause <- 'USING' List(TableRef)
|
||||
9
external/duckdb/extension/autocomplete/grammar/statements/describe.gram
vendored
Normal file
9
external/duckdb/extension/autocomplete/grammar/statements/describe.gram
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
DescribeStatement <- ShowTables / ShowSelect / ShowAllTables / ShowQualifiedName
|
||||
|
||||
ShowSelect <- ShowOrDescribeOrSummarize SelectStatement
|
||||
ShowAllTables <- ShowOrDescribe 'ALL' 'TABLES'
|
||||
ShowQualifiedName <- ShowOrDescribeOrSummarize (BaseTableName / StringLiteral)?
|
||||
ShowTables <- ShowOrDescribe 'TABLES' 'FROM' QualifiedName
|
||||
|
||||
ShowOrDescribeOrSummarize <- ShowOrDescribe / 'SUMMARIZE'
|
||||
ShowOrDescribe <- 'SHOW' / 'DESCRIBE' / 'DESC'
|
||||
1
external/duckdb/extension/autocomplete/grammar/statements/detach.gram
vendored
Normal file
1
external/duckdb/extension/autocomplete/grammar/statements/detach.gram
vendored
Normal file
@@ -0,0 +1 @@
|
||||
DetachStatement <- 'DETACH' Database? IfExists? CatalogName
|
||||
33
external/duckdb/extension/autocomplete/grammar/statements/drop.gram
vendored
Normal file
33
external/duckdb/extension/autocomplete/grammar/statements/drop.gram
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
DropStatement <- 'DROP' DropEntries DropBehavior?
|
||||
|
||||
DropEntries <-
|
||||
DropTable /
|
||||
DropTableFunction /
|
||||
DropFunction /
|
||||
DropSchema /
|
||||
DropIndex /
|
||||
DropSequence /
|
||||
DropCollation /
|
||||
DropType /
|
||||
DropSecret
|
||||
|
||||
DropTable <- TableOrView IfExists? List(BaseTableName)
|
||||
DropTableFunction <- 'MACRO' 'TABLE' IfExists? List(TableFunctionName)
|
||||
DropFunction <- FunctionType IfExists? List(FunctionIdentifier)
|
||||
DropSchema <- 'SCHEMA' IfExists? List(QualifiedSchemaName)
|
||||
DropIndex <- 'INDEX' IfExists? List(QualifiedIndexName)
|
||||
QualifiedIndexName <- CatalogQualification? SchemaQualification? IndexName
|
||||
DropSequence <- 'SEQUENCE' IfExists? List(QualifiedSequenceName)
|
||||
DropCollation <- 'COLLATION' IfExists? List(CollationName)
|
||||
DropType <- 'TYPE' IfExists? List(QualifiedTypeName)
|
||||
DropSecret <- Temporary? 'SECRET' IfExists? SecretName DropSecretStorage?
|
||||
|
||||
TableOrView <- 'TABLE' / 'VIEW' / ('MATERIALIZED' 'VIEW')
|
||||
FunctionType <- 'MACRO' / 'FUNCTION'
|
||||
|
||||
DropBehavior <- 'CASCADE' / 'RESTRICT'
|
||||
|
||||
IfExists <- 'IF' 'EXISTS'
|
||||
QualifiedSchemaName <- CatalogQualification? SchemaName
|
||||
|
||||
DropSecretStorage <- 'FROM' Identifier
|
||||
1
external/duckdb/extension/autocomplete/grammar/statements/execute.gram
vendored
Normal file
1
external/duckdb/extension/autocomplete/grammar/statements/execute.gram
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ExecuteStatement <- 'EXECUTE' Identifier TableFunctionArguments?
|
||||
3
external/duckdb/extension/autocomplete/grammar/statements/explain.gram
vendored
Normal file
3
external/duckdb/extension/autocomplete/grammar/statements/explain.gram
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
ExplainStatement <- 'EXPLAIN' 'ANALYZE'? ExplainOptions? Statement
|
||||
|
||||
ExplainOptions <- Parens(GenericCopyOptionList)
|
||||
5
external/duckdb/extension/autocomplete/grammar/statements/export.gram
vendored
Normal file
5
external/duckdb/extension/autocomplete/grammar/statements/export.gram
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
ExportStatement <- 'EXPORT' 'DATABASE' ExportSource? StringLiteral Parens(GenericCopyOptionList)?
|
||||
|
||||
ExportSource <- CatalogName 'TO'
|
||||
|
||||
ImportStatement <- 'IMPORT' 'DATABASE' StringLiteral
|
||||
150
external/duckdb/extension/autocomplete/grammar/statements/expression.gram
vendored
Normal file
150
external/duckdb/extension/autocomplete/grammar/statements/expression.gram
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
ColumnReference <- CatalogReservedSchemaTableColumnName / SchemaReservedTableColumnName / TableReservedColumnName / ColumnName
|
||||
CatalogReservedSchemaTableColumnName <- CatalogQualification ReservedSchemaQualification ReservedTableQualification ReservedColumnName
|
||||
SchemaReservedTableColumnName <- SchemaQualification ReservedTableQualification ReservedColumnName
|
||||
TableReservedColumnName <- TableQualification ReservedColumnName
|
||||
FunctionExpression <- FunctionIdentifier Parens(DistinctOrAll? List(FunctionArgument)? OrderByClause? IgnoreNulls?) WithinGroupClause? FilterClause? ExportClause? OverClause?
|
||||
|
||||
FunctionIdentifier <- CatalogReservedSchemaFunctionName / SchemaReservedFunctionName / FunctionName
|
||||
CatalogReservedSchemaFunctionName <- CatalogQualification ReservedSchemaQualification? ReservedFunctionName
|
||||
SchemaReservedFunctionName <- SchemaQualification ReservedFunctionName
|
||||
|
||||
DistinctOrAll <- 'DISTINCT' / 'ALL'
|
||||
ExportClause <- 'EXPORT_STATE'
|
||||
WithinGroupClause <- 'WITHIN' 'GROUP' Parens(OrderByClause)
|
||||
FilterClause <- 'FILTER' Parens('WHERE'? Expression)
|
||||
IgnoreNulls <- ('IGNORE' 'NULLS') / ('RESPECT' 'NULLS')
|
||||
|
||||
ParenthesisExpression <- Parens(List(Expression))
|
||||
LiteralExpression <- StringLiteral / NumberLiteral / ConstantLiteral
|
||||
ConstantLiteral <- NullLiteral / TrueLiteral / FalseLiteral
|
||||
NullLiteral <- 'NULL'
|
||||
TrueLiteral <- 'TRUE'
|
||||
FalseLiteral <- 'FALSE'
|
||||
CastExpression <- CastOrTryCast Parens(Expression 'AS' Type)
|
||||
CastOrTryCast <- 'CAST' / 'TRY_CAST'
|
||||
|
||||
StarExpression <- (ColId '.')* '*' ExcludeList? ReplaceList? RenameList?
|
||||
ExcludeList <- 'EXCLUDE' (Parens(List(ExcludeName)) / ExcludeName)
|
||||
ExcludeName <- DottedIdentifier / ColIdOrString
|
||||
ReplaceList <- 'REPLACE' (Parens(List(ReplaceEntry)) / ReplaceEntry)
|
||||
ReplaceEntry <- Expression 'AS' ColumnReference
|
||||
RenameList <- 'RENAME' (Parens(List(RenameEntry)) / RenameEntry)
|
||||
RenameEntry <- ColumnReference 'AS' Identifier
|
||||
SubqueryExpression <- 'NOT'? 'EXISTS'? SubqueryReference
|
||||
CaseExpression <- 'CASE' Expression? CaseWhenThen CaseWhenThen* CaseElse? 'END'
|
||||
CaseWhenThen <- 'WHEN' Expression 'THEN' Expression
|
||||
CaseElse <- 'ELSE' Expression
|
||||
TypeLiteral <- ColId StringLiteral
|
||||
IntervalLiteral <- 'INTERVAL' IntervalParameter IntervalUnit?
|
||||
IntervalParameter <- StringLiteral / NumberLiteral / Parens(Expression)
|
||||
IntervalUnit <- ColId
|
||||
FrameClause <- Framing FrameExtent WindowExcludeClause?
|
||||
Framing <- 'ROWS' / 'RANGE' / 'GROUPS'
|
||||
FrameExtent <- ('BETWEEN' FrameBound 'AND' FrameBound) / FrameBound
|
||||
FrameBound <- ('UNBOUNDED' 'PRECEDING') / ('UNBOUNDED' 'FOLLOWING') / ('CURRENT' 'ROW') / (Expression 'PRECEDING') / (Expression 'FOLLOWING')
|
||||
WindowExcludeClause <- 'EXCLUDE' WindowExcludeElement
|
||||
WindowExcludeElement <- ('CURRENT' 'ROW') / 'GROUP' / 'TIES' / ('NO' 'OTHERS')
|
||||
OverClause <- 'OVER' WindowFrame
|
||||
WindowFrame <- WindowFrameDefinition / Identifier / Parens(Identifier)
|
||||
WindowFrameDefinition <- Parens(BaseWindowName? WindowFrameContents) / Parens(WindowFrameContents)
|
||||
WindowFrameContents <- WindowPartition? OrderByClause? FrameClause?
|
||||
BaseWindowName <- Identifier
|
||||
WindowPartition <- 'PARTITION' 'BY' List(Expression)
|
||||
PrefixExpression <- PrefixOperator Expression
|
||||
PrefixOperator <- 'NOT' / '-' / '+' / '~'
|
||||
ListExpression <- 'ARRAY'? (BoundedListExpression / SelectStatement)
|
||||
BoundedListExpression <- '[' List(Expression)? ']'
|
||||
StructExpression <- '{' List(StructField)? '}'
|
||||
StructField <- Expression ':' Expression
|
||||
MapExpression <- 'MAP' StructExpression
|
||||
GroupingExpression <- GroupingOrGroupingId Parens(List(Expression))
|
||||
GroupingOrGroupingId <- 'GROUPING' / 'GROUPING_ID'
|
||||
Parameter <- '?' / NumberedParameter / ColLabelParameter
|
||||
NumberedParameter <- '$' NumberLiteral
|
||||
ColLabelParameter <- '$' ColLabel
|
||||
PositionalExpression <- '#' NumberLiteral
|
||||
DefaultExpression <- 'DEFAULT'
|
||||
|
||||
ListComprehensionExpression <- '[' Expression 'FOR' List(Expression) ListComprehensionFilter? ']'
|
||||
ListComprehensionFilter <- 'IF' Expression
|
||||
|
||||
SingleExpression <-
|
||||
LiteralExpression /
|
||||
Parameter /
|
||||
SubqueryExpression /
|
||||
SpecialFunctionExpression /
|
||||
ParenthesisExpression /
|
||||
IntervalLiteral /
|
||||
TypeLiteral /
|
||||
CaseExpression /
|
||||
StarExpression /
|
||||
CastExpression /
|
||||
GroupingExpression /
|
||||
MapExpression /
|
||||
FunctionExpression /
|
||||
ColumnReference /
|
||||
PrefixExpression /
|
||||
ListComprehensionExpression /
|
||||
ListExpression /
|
||||
StructExpression /
|
||||
PositionalExpression /
|
||||
DefaultExpression
|
||||
|
||||
|
||||
|
||||
OperatorLiteral <- <[\+\-\*\/\%\^\<\>\=\~\!\@\&\|\`]+>
|
||||
LikeOperator <- 'NOT'? LikeOrSimilarTo
|
||||
LikeOrSimilarTo <- 'LIKE' / 'ILIKE' / 'GLOB' / ('SIMILAR' 'TO')
|
||||
InOperator <- 'NOT'? 'IN'
|
||||
IsOperator <- 'IS' 'NOT'? DistinctFrom?
|
||||
DistinctFrom <- 'DISTINCT' 'FROM'
|
||||
ConjunctionOperator <- 'OR' / 'AND'
|
||||
ComparisonOperator <- '=' / '<=' / '>=' / '<' / '>' / '<>' / '!=' / '=='
|
||||
BetweenOperator <- 'NOT'? 'BETWEEN'
|
||||
CollateOperator <- 'COLLATE'
|
||||
LambdaOperator <- '->'
|
||||
EscapeOperator <- 'ESCAPE'
|
||||
AtTimeZoneOperator <- 'AT' 'TIME' 'ZONE'
|
||||
PostfixOperator <- '!'
|
||||
AnyAllOperator <- ComparisonOperator AnyOrAll
|
||||
AnyOrAll <- 'ANY' / 'ALL'
|
||||
|
||||
Operator <-
|
||||
AnyAllOperator /
|
||||
ConjunctionOperator /
|
||||
LikeOperator /
|
||||
InOperator /
|
||||
IsOperator /
|
||||
BetweenOperator /
|
||||
CollateOperator /
|
||||
LambdaOperator /
|
||||
EscapeOperator /
|
||||
AtTimeZoneOperator /
|
||||
OperatorLiteral
|
||||
|
||||
CastOperator <- '::' Type
|
||||
DotOperator <- '.' (FunctionExpression / ColLabel)
|
||||
NotNull <- 'NOT' 'NULL'
|
||||
Indirection <- CastOperator / DotOperator / SliceExpression / NotNull / PostfixOperator
|
||||
|
||||
BaseExpression <- SingleExpression Indirection*
|
||||
Expression <- BaseExpression RecursiveExpression*
|
||||
RecursiveExpression <- (Operator Expression)
|
||||
SliceExpression <- '[' SliceBound ']'
|
||||
SliceBound <- Expression? (':' (Expression / '-')?)? (':' Expression?)?
|
||||
|
||||
SpecialFunctionExpression <- CoalesceExpression / UnpackExpression / ColumnsExpression / ExtractExpression / LambdaExpression / NullIfExpression / PositionExpression / RowExpression / SubstringExpression / TrimExpression
|
||||
CoalesceExpression <- 'COALESCE' Parens(List(Expression))
|
||||
UnpackExpression <- 'UNPACK' Parens(Expression)
|
||||
ColumnsExpression <- '*'? 'COLUMNS' Parens(Expression)
|
||||
ExtractExpression <- 'EXTRACT' Parens(Expression 'FROM' Expression)
|
||||
LambdaExpression <- 'LAMBDA' List(ColIdOrString) ':' Expression
|
||||
NullIfExpression <- 'NULLIF' Parens(Expression ',' Expression)
|
||||
PositionExpression <- 'POSITION' Parens(Expression)
|
||||
RowExpression <- 'ROW' Parens(List(Expression))
|
||||
SubstringExpression <- 'SUBSTRING' Parens(SubstringParameters / List(Expression))
|
||||
SubstringParameters <- Expression 'FROM' NumberLiteral 'FOR' NumberLiteral
|
||||
TrimExpression <- 'TRIM' Parens(TrimDirection? TrimSource? List(Expression))
|
||||
|
||||
TrimDirection <- 'BOTH' / 'LEADING' / 'TRAILING'
|
||||
TrimSource <- Expression? 'FROM'
|
||||
27
external/duckdb/extension/autocomplete/grammar/statements/insert.gram
vendored
Normal file
27
external/duckdb/extension/autocomplete/grammar/statements/insert.gram
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
InsertStatement <- WithClause? 'INSERT' OrAction? 'INTO' InsertTarget ByNameOrPosition? InsertColumnList? InsertValues OnConflictClause? ReturningClause?
|
||||
|
||||
OrAction <- 'OR' 'REPLACE' / 'IGNORE'
|
||||
ByNameOrPosition <- 'BY' 'NAME' / 'POSITION'
|
||||
|
||||
InsertTarget <- BaseTableName InsertAlias?
|
||||
InsertAlias <- 'AS' Identifier
|
||||
|
||||
ColumnList <- List(ColId)
|
||||
InsertColumnList <- Parens(ColumnList)
|
||||
|
||||
InsertValues <- SelectStatement / DefaultValues
|
||||
DefaultValues <- 'DEFAULT' 'VALUES'
|
||||
|
||||
OnConflictClause <- 'ON' 'CONFLICT' OnConflictTarget? OnConflictAction
|
||||
|
||||
OnConflictTarget <- OnConflictExpressionTarget / OnConflictIndexTarget
|
||||
OnConflictExpressionTarget <- Parens(List(ColId)) WhereClause?
|
||||
OnConflictIndexTarget <- 'ON' 'CONSTRAINT' ConstraintName
|
||||
|
||||
|
||||
OnConflictAction <- OnConflictUpdate / OnConflictNothing
|
||||
|
||||
OnConflictUpdate <- 'DO' 'UPDATE' 'SET' UpdateSetClause WhereClause?
|
||||
OnConflictNothing <- 'DO' 'NOTHING'
|
||||
|
||||
ReturningClause <- 'RETURNING' TargetList
|
||||
4
external/duckdb/extension/autocomplete/grammar/statements/load.gram
vendored
Normal file
4
external/duckdb/extension/autocomplete/grammar/statements/load.gram
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
LoadStatement <- 'LOAD' ColIdOrString
|
||||
InstallStatement <- 'FORCE'? 'INSTALL' Identifier FromSource? VersionNumber?
|
||||
FromSource <- 'FROM' (Identifier / StringLiteral)
|
||||
VersionNumber <- Identifier
|
||||
21
external/duckdb/extension/autocomplete/grammar/statements/merge_into.gram
vendored
Normal file
21
external/duckdb/extension/autocomplete/grammar/statements/merge_into.gram
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MergeIntoStatement <- WithClause? 'MERGE' 'INTO' TargetOptAlias MergeIntoUsingClause MergeMatch* ReturningClause?
|
||||
MergeIntoUsingClause <- 'USING' TableRef JoinQualifier
|
||||
MergeMatch <- MatchedClause / NotMatchedClause
|
||||
MatchedClause <- 'WHEN' 'MATCHED' AndExpression? 'THEN' MatchedClauseAction
|
||||
MatchedClauseAction <- UpdateMatchClause / DeleteMatchClause / InsertMatchClause / DoNothingMatchClause / ErrorMatchClause
|
||||
UpdateMatchClause <- 'UPDATE' (UpdateMatchSetClause / ByNameOrPosition?)
|
||||
DeleteMatchClause <- 'DELETE'
|
||||
InsertMatchClause <- 'INSERT' (InsertValuesList / DefaultValues / InsertByNameOrPosition)?
|
||||
InsertByNameOrPosition <- ByNameOrPosition? '*'?
|
||||
InsertValuesList <- InsertColumnList? 'VALUES' Parens(List(Expression))
|
||||
DoNothingMatchClause <- 'DO' 'NOTHING'
|
||||
ErrorMatchClause <- 'ERROR' Expression?
|
||||
UpdateMatchSetClause <- 'SET' (UpdateSetClause / '*')
|
||||
AndExpression <- 'AND' Expression
|
||||
NotMatchedClause <- 'WHEN' 'NOT' 'MATCHED' BySourceOrTarget? AndExpression? 'THEN' MatchedClauseAction
|
||||
BySourceOrTarget <- 'BY' ('SOURCE' / 'TARGET')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
18
external/duckdb/extension/autocomplete/grammar/statements/pivot.gram
vendored
Normal file
18
external/duckdb/extension/autocomplete/grammar/statements/pivot.gram
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
PivotStatement <- PivotKeyword TableRef PivotOn? PivotUsing? GroupByClause?
|
||||
|
||||
PivotOn <- 'ON' PivotColumnList
|
||||
PivotUsing <- 'USING' TargetList
|
||||
|
||||
PivotColumnList <- List(Expression)
|
||||
|
||||
PivotKeyword <- 'PIVOT' / 'PIVOT_WIDER'
|
||||
UnpivotKeyword <- 'UNPIVOT' / 'PIVOT_LONGER'
|
||||
|
||||
UnpivotStatement <- UnpivotKeyword TableRef 'ON' TargetList IntoNameValues?
|
||||
|
||||
IntoNameValues <- 'INTO' 'NAME' ColIdOrString ValueOrValues List(Identifier)
|
||||
|
||||
ValueOrValues <- 'VALUE' / 'VALUES'
|
||||
|
||||
IncludeExcludeNulls <- ('INCLUDE' / 'EXCLUDE') 'NULLS'
|
||||
UnpivotHeader <- ColIdOrString / Parens(List(ColIdOrString))
|
||||
5
external/duckdb/extension/autocomplete/grammar/statements/pragma.gram
vendored
Normal file
5
external/duckdb/extension/autocomplete/grammar/statements/pragma.gram
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
PragmaStatement <- 'PRAGMA' (PragmaAssign / PragmaFunction)
|
||||
|
||||
PragmaAssign <- SettingName '=' VariableList
|
||||
PragmaFunction <- PragmaName PragmaParameters?
|
||||
PragmaParameters <- List(Expression)
|
||||
3
external/duckdb/extension/autocomplete/grammar/statements/prepare.gram
vendored
Normal file
3
external/duckdb/extension/autocomplete/grammar/statements/prepare.gram
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
PrepareStatement <- 'PREPARE' Identifier TypeList? 'AS' Statement
|
||||
|
||||
TypeList <- Parens(List(Type))
|
||||
126
external/duckdb/extension/autocomplete/grammar/statements/select.gram
vendored
Normal file
126
external/duckdb/extension/autocomplete/grammar/statements/select.gram
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
SelectStatement <- SelectOrParens (SetopClause SelectStatement)* ResultModifiers
|
||||
|
||||
SetopClause <- ('UNION' / 'EXCEPT' / 'INTERSECT') DistinctOrAll? ByName?
|
||||
ByName <- 'BY' 'NAME'
|
||||
SelectOrParens <- BaseSelect / Parens(SelectStatement)
|
||||
|
||||
BaseSelect <- WithClause? (OptionalParensSimpleSelect / ValuesClause / DescribeStatement / TableStatement / PivotStatement / UnpivotStatement) ResultModifiers
|
||||
ResultModifiers <- OrderByClause? LimitClause? OffsetClause?
|
||||
TableStatement <- 'TABLE' BaseTableName
|
||||
OptionalParensSimpleSelect <- Parens(SimpleSelect) / SimpleSelect
|
||||
SimpleSelect <- SelectFrom WhereClause? GroupByClause? HavingClause? WindowClause? QualifyClause? SampleClause?
|
||||
|
||||
SelectFrom <- (SelectClause FromClause?) / (FromClause SelectClause?)
|
||||
WithStatement <- ColIdOrString InsertColumnList? UsingKey? 'AS' Materialized? SubqueryReference
|
||||
UsingKey <- 'USING' 'KEY' Parens(List(ColId))
|
||||
Materialized <- 'NOT'? 'MATERIALIZED'
|
||||
WithClause <- 'WITH' Recursive? List(WithStatement)
|
||||
Recursive <- 'RECURSIVE'
|
||||
SelectClause <- 'SELECT' DistinctClause? TargetList
|
||||
TargetList <- List(AliasedExpression)
|
||||
ColumnAliases <- Parens(List(ColIdOrString))
|
||||
|
||||
DistinctClause <- ('DISTINCT' DistinctOn?) / 'ALL'
|
||||
DistinctOn <- 'ON' Parens(List(Expression))
|
||||
|
||||
InnerTableRef <- ValuesRef / TableFunction / TableSubquery / BaseTableRef / ParensTableRef
|
||||
|
||||
TableRef <- InnerTableRef JoinOrPivot* TableAlias?
|
||||
TableSubquery <- Lateral? SubqueryReference TableAlias?
|
||||
BaseTableRef <- TableAliasColon? BaseTableName TableAlias? AtClause?
|
||||
TableAliasColon <- ColIdOrString ':'
|
||||
ValuesRef <- ValuesClause TableAlias?
|
||||
ParensTableRef <- TableAliasColon? Parens(TableRef)
|
||||
|
||||
JoinOrPivot <- JoinClause / TablePivotClause / TableUnpivotClause
|
||||
|
||||
TablePivotClause <- 'PIVOT' Parens(TargetList 'FOR' PivotValueLists GroupByClause?) TableAlias?
|
||||
TableUnpivotClause <- 'UNPIVOT' IncludeExcludeNulls? Parens(UnpivotHeader 'FOR' PivotValueLists) TableAlias?
|
||||
|
||||
PivotHeader <- BaseExpression
|
||||
PivotValueLists <- PivotValueList PivotValueList*
|
||||
PivotValueList <- PivotHeader 'IN' PivotTargetList
|
||||
PivotTargetList <- Identifier / Parens(TargetList)
|
||||
|
||||
Lateral <- 'LATERAL'
|
||||
|
||||
BaseTableName <- CatalogReservedSchemaTable / SchemaReservedTable / TableName
|
||||
SchemaReservedTable <- SchemaQualification ReservedTableName
|
||||
CatalogReservedSchemaTable <- CatalogQualification ReservedSchemaQualification ReservedTableName
|
||||
|
||||
TableFunction <- TableFunctionLateralOpt / TableFunctionAliasColon
|
||||
TableFunctionLateralOpt <- Lateral? QualifiedTableFunction TableFunctionArguments WithOrdinality? TableAlias?
|
||||
TableFunctionAliasColon <- TableAliasColon QualifiedTableFunction TableFunctionArguments WithOrdinality?
|
||||
WithOrdinality <- 'WITH' 'ORDINALITY'
|
||||
QualifiedTableFunction <- CatalogQualification? SchemaQualification? TableFunctionName
|
||||
TableFunctionArguments <- Parens(List(FunctionArgument)?)
|
||||
FunctionArgument <- NamedParameter / Expression
|
||||
NamedParameter <- TypeName Type? NamedParameterAssignment Expression
|
||||
NamedParameterAssignment <- ':=' / '=>'
|
||||
|
||||
TableAlias <- 'AS'? (Identifier / StringLiteral) ColumnAliases?
|
||||
|
||||
AtClause <- 'AT' Parens(AtSpecifier)
|
||||
AtSpecifier <- AtUnit '=>' Expression
|
||||
AtUnit <- 'VERSION' / 'TIMESTAMP'
|
||||
|
||||
JoinClause <- RegularJoinClause / JoinWithoutOnClause
|
||||
RegularJoinClause <- 'ASOF'? JoinType? 'JOIN' TableRef JoinQualifier
|
||||
JoinWithoutOnClause <- JoinPrefix 'JOIN' TableRef
|
||||
JoinQualifier <- OnClause / UsingClause
|
||||
OnClause <- 'ON' Expression
|
||||
UsingClause <- 'USING' Parens(List(ColumnName))
|
||||
|
||||
OuterJoinType <- 'FULL' / 'LEFT' / 'RIGHT'
|
||||
JoinType <- (OuterJoinType 'OUTER'?) / 'SEMI' / 'ANTI' / 'INNER'
|
||||
JoinPrefix <- 'CROSS' / ('NATURAL' JoinType?) / 'POSITIONAL'
|
||||
|
||||
FromClause <- 'FROM' List(TableRef)
|
||||
WhereClause <- 'WHERE' Expression
|
||||
GroupByClause <- 'GROUP' 'BY' GroupByExpressions
|
||||
HavingClause <- 'HAVING' Expression
|
||||
QualifyClause <- 'QUALIFY' Expression
|
||||
SampleClause <- (TableSample / UsingSample) SampleEntry
|
||||
UsingSample <- 'USING' 'SAMPLE'
|
||||
TableSample <- 'TABLESAMPLE'
|
||||
WindowClause <- 'WINDOW' List(WindowDefinition)
|
||||
WindowDefinition <- Identifier 'AS' WindowFrameDefinition
|
||||
|
||||
SampleEntry <- SampleEntryFunction / SampleEntryCount
|
||||
SampleEntryCount <- SampleCount Parens(SampleProperties)?
|
||||
SampleEntryFunction <- SampleFunction? Parens(SampleCount) RepeatableSample?
|
||||
SampleFunction <- ColId
|
||||
SampleProperties <- ColId (',' NumberLiteral)?
|
||||
RepeatableSample <- 'REPEATABLE' Parens(NumberLiteral)
|
||||
|
||||
SampleCount <- Expression SampleUnit?
|
||||
SampleUnit <- '%' / 'PERCENT' / 'ROWS'
|
||||
|
||||
GroupByExpressions <- GroupByList / 'ALL'
|
||||
GroupByList <- List(GroupByExpression)
|
||||
GroupByExpression <- EmptyGroupingItem / CubeOrRollupClause / GroupingSetsClause / Expression
|
||||
EmptyGroupingItem <- '(' ')'
|
||||
CubeOrRollupClause <- CubeOrRollup Parens(List(Expression))
|
||||
CubeOrRollup <- 'CUBE' / 'ROLLUP'
|
||||
GroupingSetsClause <- 'GROUPING' 'SETS' Parens(GroupByList)
|
||||
|
||||
SubqueryReference <- Parens(SelectStatement)
|
||||
|
||||
OrderByExpression <- Expression DescOrAsc? NullsFirstOrLast?
|
||||
DescOrAsc <- 'DESC' / 'DESCENDING' / 'ASC' / 'ASCENDING'
|
||||
NullsFirstOrLast <- 'NULLS' 'FIRST' / 'LAST'
|
||||
OrderByClause <- 'ORDER' 'BY' OrderByExpressions
|
||||
OrderByExpressions <- List(OrderByExpression) / OrderByAll
|
||||
OrderByAll <- 'ALL' DescOrAsc? NullsFirstOrLast?
|
||||
|
||||
LimitClause <- 'LIMIT' LimitValue
|
||||
OffsetClause <- 'OFFSET' OffsetValue
|
||||
LimitValue <- 'ALL' / (NumberLiteral 'PERCENT') / (Expression '%'?)
|
||||
OffsetValue <- Expression RowOrRows?
|
||||
RowOrRows <- 'ROW' / 'ROWS'
|
||||
|
||||
|
||||
AliasedExpression <- (ColId ':' Expression) / (Expression 'AS' ColLabelOrString) / (Expression Identifier?)
|
||||
|
||||
ValuesClause <- 'VALUES' List(ValuesExpressions)
|
||||
ValuesExpressions <- Parens(List(Expression))
|
||||
19
external/duckdb/extension/autocomplete/grammar/statements/set.gram
vendored
Normal file
19
external/duckdb/extension/autocomplete/grammar/statements/set.gram
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
SetStatement <- 'SET' (StandardAssignment / SetTimeZone)
|
||||
|
||||
StandardAssignment <- (SetVariable / SetSetting) SetAssignment
|
||||
SetTimeZone <- 'TIME' 'ZONE' Expression
|
||||
SetSetting <- SettingScope? SettingName
|
||||
SetVariable <- VariableScope Identifier
|
||||
VariableScope <- 'VARIABLE'
|
||||
|
||||
SettingScope <- LocalScope / SessionScope / GlobalScope
|
||||
LocalScope <- 'LOCAL'
|
||||
SessionScope <- 'SESSION'
|
||||
GlobalScope <- 'GLOBAL'
|
||||
|
||||
SetAssignment <- VariableAssign VariableList
|
||||
|
||||
VariableAssign <- '=' / 'TO'
|
||||
VariableList <- List(Expression)
|
||||
|
||||
ResetStatement <- 'RESET' (SetVariable / SetSetting)
|
||||
11
external/duckdb/extension/autocomplete/grammar/statements/transaction.gram
vendored
Normal file
11
external/duckdb/extension/autocomplete/grammar/statements/transaction.gram
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
TransactionStatement <- BeginTransaction / RollbackTransaction / CommitTransaction
|
||||
|
||||
BeginTransaction <- StartOrBegin Transaction? ReadOrWrite?
|
||||
RollbackTransaction <- AbortOrRollback Transaction?
|
||||
CommitTransaction <- CommitOrEnd Transaction?
|
||||
|
||||
StartOrBegin <- 'START' / 'BEGIN'
|
||||
Transaction <- 'WORK' / 'TRANSACTION'
|
||||
ReadOrWrite <- 'READ' ('ONLY' / 'WRITE')
|
||||
AbortOrRollback <- 'ABORT' / 'ROLLBACK'
|
||||
CommitOrEnd <- 'COMMIT' / 'END'
|
||||
6
external/duckdb/extension/autocomplete/grammar/statements/update.gram
vendored
Normal file
6
external/duckdb/extension/autocomplete/grammar/statements/update.gram
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
UpdateStatement <- WithClause? 'UPDATE' UpdateTarget UpdateSetClause FromClause? WhereClause? ReturningClause?
|
||||
|
||||
UpdateTarget <- (BaseTableName 'SET') / (BaseTableName UpdateAlias? 'SET')
|
||||
UpdateAlias <- 'AS'? ColId
|
||||
UpdateSetClause <- List(UpdateSetElement) / (Parens(List(ColumnName)) '=' Expression)
|
||||
UpdateSetElement <- ColumnName '=' Expression
|
||||
3
external/duckdb/extension/autocomplete/grammar/statements/use.gram
vendored
Normal file
3
external/duckdb/extension/autocomplete/grammar/statements/use.gram
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
UseStatement <- 'USE' UseTarget
|
||||
|
||||
UseTarget <- (CatalogName '.' ReservedSchemaName) / SchemaName / CatalogName
|
||||
12
external/duckdb/extension/autocomplete/grammar/statements/vacuum.gram
vendored
Normal file
12
external/duckdb/extension/autocomplete/grammar/statements/vacuum.gram
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
VacuumStatement <- 'VACUUM' (VacuumLegacyOptions AnalyzeStatement / VacuumLegacyOptions QualifiedTarget / VacuumLegacyOptions / VacuumParensOptions QualifiedTarget?)?
|
||||
|
||||
VacuumLegacyOptions <- OptFull OptFreeze OptVerbose
|
||||
VacuumParensOptions <- Parens(List(VacuumOption))
|
||||
VacuumOption <- 'ANALYZE' / 'VERBOSE' / 'FREEZE' / 'FULL' / Identifier
|
||||
|
||||
OptFull <- 'FULL'?
|
||||
OptFreeze <- 'FREEZE'?
|
||||
OptVerbose <- 'VERBOSE'?
|
||||
|
||||
QualifiedTarget <- QualifiedName OptNameList
|
||||
OptNameList <- Parens(List(Name))?
|
||||
Reference in New Issue
Block a user