@@ -217,29 +217,40 @@ pub struct Expr {
217
217
}
218
218
219
219
/// Represents an AST Node of type T with BytePosition Location
220
- type AstBytePos < T > = AstNode < T , BytePosition > ;
221
-
222
- type LitAst = AstBytePos < Lit > ;
223
- type VarRefAst = AstBytePos < VarRef > ;
224
- type ParamAst = AstBytePos < VarRef > ;
225
- type StructAst = AstBytePos < Struct > ;
226
- type BagAst = AstBytePos < Bag > ;
227
- type ListAst = AstBytePos < List > ;
228
- type SexpAst = AstBytePos < Sexp > ;
229
- type BinOpAst = AstBytePos < BinOp > ;
230
- type UniOpAst = AstBytePos < UniOp > ;
231
- type LikeAst = AstBytePos < Like > ;
232
- type BetweenAst = AstBytePos < Between > ;
233
- type InAst = AstBytePos < In > ;
234
- type SimpleCaseAst = AstBytePos < SimpleCase > ;
235
- type SearchCaseAst = AstBytePos < SearchCase > ;
236
- type UnionAst = AstBytePos < Union > ;
237
- type ExceptAst = AstBytePos < Except > ;
238
- type IntersectAst = AstBytePos < Intersect > ;
239
- type PathAst = AstBytePos < Path > ;
240
- type CallAst = AstBytePos < Call > ;
241
- type CallAggAst = AstBytePos < CallAgg > ;
242
- type SelectAst = AstBytePos < Select > ;
220
+ pub type AstBytePos < T > = AstNode < T , BytePosition > ;
221
+
222
+ pub type LitAst = AstBytePos < Lit > ;
223
+ pub type VarRefAst = AstBytePos < VarRef > ;
224
+ pub type ParamAst = AstBytePos < VarRef > ;
225
+ pub type StructAst = AstBytePos < Struct > ;
226
+ pub type BagAst = AstBytePos < Bag > ;
227
+ pub type ListAst = AstBytePos < List > ;
228
+ pub type SexpAst = AstBytePos < Sexp > ;
229
+ pub type BinOpAst = AstBytePos < BinOp > ;
230
+ pub type UniOpAst = AstBytePos < UniOp > ;
231
+ pub type LikeAst = AstBytePos < Like > ;
232
+ pub type BetweenAst = AstBytePos < Between > ;
233
+ pub type InAst = AstBytePos < In > ;
234
+ pub type SimpleCaseAst = AstBytePos < SimpleCase > ;
235
+ pub type SearchCaseAst = AstBytePos < SearchCase > ;
236
+ pub type UnionAst = AstBytePos < Union > ;
237
+ pub type ExceptAst = AstBytePos < Except > ;
238
+ pub type IntersectAst = AstBytePos < Intersect > ;
239
+ pub type PathAst = AstBytePos < Path > ;
240
+ pub type CallAst = AstBytePos < Call > ;
241
+ pub type CallAggAst = AstBytePos < CallAgg > ;
242
+ pub type SelectAst = AstBytePos < Select > ;
243
+ pub type ProjectionAst = AstBytePos < Projection > ;
244
+ pub type ProjectItemAst = AstBytePos < ProjectItem > ;
245
+ pub type FromClauseAst = AstBytePos < FromClause > ;
246
+ pub type FromLetAst = AstBytePos < FromLet > ;
247
+ pub type JoinAst = AstBytePos < Join > ;
248
+ pub type JoinSpecAst = AstBytePos < JoinSpec > ;
249
+ pub type LetAst = AstBytePos < Let > ;
250
+ pub type GroupByExprAst = AstBytePos < GroupByExpr > ;
251
+ pub type GroupKeyAst = AstBytePos < GroupKey > ;
252
+ pub type OrderByExprAst = AstBytePos < OrderByExpr > ;
253
+ pub type SortSpecAst = AstBytePos < SortSpec > ;
243
254
244
255
/// The expressions that can result in values.
245
256
#[ derive( Clone , Debug , PartialEq ) ]
@@ -511,13 +522,13 @@ pub struct Coalesce {
511
522
#[ derive( Clone , Debug , PartialEq ) ]
512
523
pub struct Select {
513
524
pub setq : Option < SetQuantifier > ,
514
- pub project : Projection ,
515
- pub from : Option < FromClause > ,
516
- pub from_let : Option < Let > ,
525
+ pub project : ProjectionAst ,
526
+ pub from : Option < FromClauseAst > ,
527
+ pub from_let : Option < LetAst > ,
517
528
pub where_clause : Option < Box < Expr > > ,
518
- pub group_by : Option < Box < GroupByExpr > > ,
529
+ pub group_by : Option < Box < GroupByExprAst > > ,
519
530
pub having : Option < Box < Expr > > ,
520
- pub order_by : Option < Box < OrderByExpr > > ,
531
+ pub order_by : Option < Box < OrderByExprAst > > ,
521
532
pub limit : Option < Box < Expr > > ,
522
533
pub offset : Option < Box < Expr > > ,
523
534
}
@@ -558,16 +569,11 @@ pub enum CaseSensitivity {
558
569
#[ derive( Clone , Debug , PartialEq ) ]
559
570
pub enum Projection {
560
571
ProjectStar ,
561
- ProjectList ( Vec < ProjectItem > ) ,
572
+ ProjectList ( Vec < ProjectItemAst > ) ,
562
573
ProjectPivot { key : Box < Expr > , value : Box < Expr > } ,
563
574
ProjectValue ( Box < Expr > ) ,
564
575
}
565
576
566
- #[ derive( Clone , Debug , PartialEq ) ]
567
- pub struct ProjectValue {
568
- pub value : Box < Expr > ,
569
- }
570
-
571
577
/// An item to be projected in a `SELECT`-list.
572
578
#[ derive( Clone , Debug , PartialEq ) ]
573
579
pub enum ProjectItem {
@@ -603,9 +609,9 @@ pub struct LetBinding {
603
609
/// FROM clause of an SFW query
604
610
#[ derive( Clone , Debug , PartialEq ) ]
605
611
pub enum FromClause {
606
- FromLet ( FromLet ) ,
612
+ FromLet ( FromLetAst ) ,
607
613
/// <from_source> JOIN \[INNER | LEFT | RIGHT | FULL\] <from_source> ON <expr>
608
- Join ( Join ) ,
614
+ Join ( JoinAst ) ,
609
615
}
610
616
611
617
#[ derive( Clone , Debug , PartialEq ) ]
@@ -620,9 +626,9 @@ pub struct FromLet {
620
626
#[ derive( Clone , Debug , PartialEq ) ]
621
627
pub struct Join {
622
628
pub kind : JoinKind ,
623
- pub left : Box < FromClause > ,
624
- pub right : Box < FromClause > ,
625
- pub predicate : Option < JoinSpec > ,
629
+ pub left : Box < FromClauseAst > ,
630
+ pub right : Box < FromClauseAst > ,
631
+ pub predicate : Option < JoinSpecAst > ,
626
632
}
627
633
628
634
#[ derive( Clone , Debug , PartialEq ) ]
@@ -677,7 +683,7 @@ pub enum GroupingStrategy {
677
683
/// <group_key>[, <group_key>]...
678
684
#[ derive( Clone , Debug , PartialEq ) ]
679
685
pub struct GroupKeyList {
680
- pub keys : Vec < GroupKey > ,
686
+ pub keys : Vec < GroupKeyAst > ,
681
687
}
682
688
683
689
/// <expr> [AS <symbol>]
@@ -690,7 +696,7 @@ pub struct GroupKey {
690
696
/// ORDER BY <sort_spec>...
691
697
#[ derive( Clone , Debug , PartialEq ) ]
692
698
pub struct OrderByExpr {
693
- pub sort_specs : Vec < SortSpec > ,
699
+ pub sort_specs : Vec < SortSpecAst > ,
694
700
}
695
701
696
702
/// <expr> [ASC | DESC] ?
0 commit comments