Skip to content

Commit

Permalink
Drop SQL language syntax from Zed language
Browse files Browse the repository at this point in the history
  • Loading branch information
mattnibs committed Apr 18, 2024
1 parent 97542ff commit 93f5ec6
Show file tree
Hide file tree
Showing 20 changed files with 5,767 additions and 8,536 deletions.
43 changes: 0 additions & 43 deletions compiler/ast/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ func (*ArrayExpr) ExprAST() {}
func (*SetExpr) ExprAST() {}
func (*MapExpr) ExprAST() {}
func (*OverExpr) ExprAST() {}
func (*SQLExpr) ExprAST() {}

func (x *UnaryExpr) Pos() int { return x.OpPos }
func (x *BinaryExpr) Pos() int { return x.LHS.Pos() }
Expand All @@ -289,7 +288,6 @@ func (x *ArrayExpr) Pos() int { return x.Lbrack }
func (x *SetExpr) Pos() int { return x.Lpipe }
func (x *MapExpr) Pos() int { return x.Lpipe }
func (x *OverExpr) Pos() int { return x.Left }
func (x *SQLExpr) Pos() int { return -1 }

func (x *BinaryExpr) End() int { return x.RHS.End() }
func (x *UnaryExpr) End() int { return x.Operand.End() }
Expand Down Expand Up @@ -321,7 +319,6 @@ func (x *ArrayExpr) End() int { return x.Rbrack + 1 }
func (x *SetExpr) End() int { return x.Rpipe + 1 }
func (x *MapExpr) End() int { return x.Rpipe + 1 }
func (x *OverExpr) End() int { panic("fix once we can get pos of seq") }
func (x *SQLExpr) End() int { return -1 }

type ConstDecl struct {
Kind string `json:"kind" unpack:""`
Expand Down Expand Up @@ -537,25 +534,6 @@ type (
Expr Expr `json:"expr"`
TokenPos int `json:"token_pos"`
}
// A SQLExpr can be an operator, an expression inside of a SQL FROM clause,
// or an expression used as a Zed value generator. Currenly, the "select"
// keyword collides with the select() generator function (it can be parsed
// unambiguosly because of the parens but this is not user friendly
// so we need a new name for select()... see issue #2133).
// TBD: from alias, "in" over tuples, WITH sub-queries, multi-table FROM
// implying a JOIN, aliases for tables in FROM and JOIN.
SQLExpr struct {
Kind string `json:"kind" unpack:""`
Left int `json:"left"`
Select []Assignment `json:"select"`
From *SQLFrom `json:"from"`
Joins []SQLJoin `json:"joins"`
Where Expr `json:"where"`
GroupBy []Expr `json:"group_by"`
Having Expr `json:"having"`
OrderBy *SQLOrderBy `json:"order_by"`
Limit int `json:"limit"`
}
Shape struct {
Kind string `json:"kind" unpack:""`
TokenPos int `json:"token_pos"`
Expand Down Expand Up @@ -667,25 +645,6 @@ type Case struct {
Path Seq `json:"path"`
}

type SQLFrom struct {
Table Expr `json:"table"`
Alias Expr `json:"alias"`
}

type SQLOrderBy struct {
Kind string `json:"kind" unpack:""`
Keys []Expr `json:"keys"`
Order order.Which `json:"order"`
}

type SQLJoin struct {
Table Expr `json:"table"`
Style string `json:"style"`
LeftKey Expr `json:"left_key"`
RightKey Expr `json:"right_key"`
Alias Expr `json:"alias"`
}

type Assignment struct {
Kind string `json:"kind" unpack:""`
LHS Expr `json:"lhs"`
Expand Down Expand Up @@ -742,8 +701,6 @@ func (*Sample) OpAST() {}
func (*Load) OpAST() {}
func (*Assert) OpAST() {}

func (*SQLExpr) OpAST() {}

func (x *Scope) Pos() int {
if x.Decls != nil {
return x.Decls[0].End()
Expand Down
2 changes: 0 additions & 2 deletions compiler/ast/unpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ var unpacker = unpack.New(
astzed.Set{},
SetExpr{},
Spread{},
SQLExpr{},
SQLOrderBy{},
SliceExpr{},
Sort{},
String{},
Expand Down
Loading

0 comments on commit 93f5ec6

Please sign in to comment.