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
19 changes: 19 additions & 0 deletions ast/alter_table_drop_table_element_statement.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package ast

// AlterTableDropTableElementStatement represents an ALTER TABLE ... DROP statement.
type AlterTableDropTableElementStatement struct {
SchemaObjectName *SchemaObjectName
AlterTableDropTableElements []*AlterTableDropTableElement
}

func (*AlterTableDropTableElementStatement) node() {}
func (*AlterTableDropTableElementStatement) statement() {}

// AlterTableDropTableElement represents an element being dropped from a table.
type AlterTableDropTableElement struct {
TableElementType string
Name *Identifier
IsIfExists bool
}

func (*AlterTableDropTableElement) node() {}
11 changes: 11 additions & 0 deletions ast/binary_expression.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package ast

// BinaryExpression represents a binary scalar expression (Add, Subtract, etc.).
type BinaryExpression struct {
BinaryExpressionType string `json:"BinaryExpressionType,omitempty"`
FirstExpression ScalarExpression `json:"FirstExpression,omitempty"`
SecondExpression ScalarExpression `json:"SecondExpression,omitempty"`
}

func (*BinaryExpression) node() {}
func (*BinaryExpression) scalarExpression() {}
11 changes: 11 additions & 0 deletions ast/drop_credential_statement.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package ast

// DropCredentialStatement represents a DROP CREDENTIAL statement.
type DropCredentialStatement struct {
IsDatabaseScoped bool
Name *Identifier
IsIfExists bool
}

func (*DropCredentialStatement) node() {}
func (*DropCredentialStatement) statement() {}
9 changes: 9 additions & 0 deletions ast/print_statement.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package ast

// PrintStatement represents a PRINT statement.
type PrintStatement struct {
Expression ScalarExpression
}

func (*PrintStatement) node() {}
func (*PrintStatement) statement() {}
9 changes: 9 additions & 0 deletions ast/revert_statement.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package ast

// RevertStatement represents a REVERT statement.
type RevertStatement struct {
Cookie ScalarExpression
}

func (*RevertStatement) node() {}
func (*RevertStatement) statement() {}
11 changes: 11 additions & 0 deletions ast/throw_statement.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package ast

// ThrowStatement represents a THROW statement.
type ThrowStatement struct {
ErrorNumber ScalarExpression
Message ScalarExpression
State ScalarExpression
}

func (*ThrowStatement) node() {}
func (*ThrowStatement) statement() {}
9 changes: 9 additions & 0 deletions ast/variable_reference.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package ast

// VariableReference represents a reference to a variable (e.g., @var).
type VariableReference struct {
Name string `json:"Name,omitempty"`
}

func (*VariableReference) node() {}
func (*VariableReference) scalarExpression() {}
24 changes: 24 additions & 0 deletions parser/lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ const (
TokenOption
TokenAll
TokenDistinct
TokenPrint
TokenThrow
TokenAlter
TokenTable
TokenDrop
TokenIndex
TokenRevert
TokenWith
TokenCookie
TokenDatabase
TokenScoped
TokenCredential
)

// Token represents a lexical token.
Expand Down Expand Up @@ -281,6 +293,18 @@ var keywords = map[string]TokenType{
"OPTION": TokenOption,
"ALL": TokenAll,
"DISTINCT": TokenDistinct,
"PRINT": TokenPrint,
"THROW": TokenThrow,
"ALTER": TokenAlter,
"TABLE": TokenTable,
"DROP": TokenDrop,
"INDEX": TokenIndex,
"REVERT": TokenRevert,
"WITH": TokenWith,
"COOKIE": TokenCookie,
"DATABASE": TokenDatabase,
"SCOPED": TokenScoped,
"CREDENTIAL": TokenCredential,
}

func lookupKeyword(ident string) TokenType {
Expand Down
Loading
Loading