@@ -125,6 +125,16 @@ impl Parser {
125
125
fields. push ( Expr :: field ( Field :: Modified ) ) ;
126
126
fields. push ( Expr :: field ( Field :: Path ) ) ;
127
127
} else {
128
+ if s. to_lowercase ( ) == "group" {
129
+ if let Some ( Lexem :: By ) = self . next_lexem ( ) {
130
+ self . drop_lexem ( ) ;
131
+ self . drop_lexem ( ) ;
132
+ break ;
133
+ } else {
134
+ self . drop_lexem ( ) ;
135
+ }
136
+ }
137
+
128
138
self . drop_lexem ( ) ;
129
139
130
140
if Self :: is_root_option_keyword ( s) {
@@ -204,7 +214,10 @@ impl Parser {
204
214
self . drop_lexem ( ) ;
205
215
match self . parse_root_options ( ) {
206
216
Some ( options) => root_options = options,
207
- None => break
217
+ None => {
218
+ roots. push ( Root :: new ( path, RootOptions :: new ( ) ) ) ;
219
+ break
220
+ }
208
221
}
209
222
}
210
223
_ => { }
@@ -779,25 +792,29 @@ impl Parser {
779
792
fn parse_group_by ( & mut self ) -> Result < Vec < Expr > , String > {
780
793
let mut group_by_fields: Vec < Expr > = vec ! [ ] ;
781
794
782
- if let Some ( Lexem :: Group ) = self . next_lexem ( ) {
783
- if let Some ( Lexem :: By ) = self . next_lexem ( ) {
784
- loop {
785
- match self . next_lexem ( ) {
786
- Some ( Lexem :: Comma ) => { }
787
- Some ( Lexem :: RawString ( _) ) => {
788
- self . drop_lexem ( ) ;
789
- let group_field = self . parse_expr ( ) . unwrap ( ) . unwrap ( ) ;
790
- group_by_fields. push ( group_field) ;
791
- }
792
- _ => {
793
- self . drop_lexem ( ) ;
794
- break ;
795
+ if let Some ( Lexem :: RawString ( s) ) = self . next_lexem ( ) {
796
+ if s. to_lowercase ( ) == "group" {
797
+ if let Some ( Lexem :: By ) = self . next_lexem ( ) {
798
+ loop {
799
+ match self . next_lexem ( ) {
800
+ Some ( Lexem :: Comma ) => { }
801
+ Some ( Lexem :: RawString ( _) ) => {
802
+ self . drop_lexem ( ) ;
803
+ let group_field = self . parse_expr ( ) . unwrap ( ) . unwrap ( ) ;
804
+ group_by_fields. push ( group_field) ;
805
+ }
806
+ _ => {
807
+ self . drop_lexem ( ) ;
808
+ break ;
809
+ }
795
810
}
796
811
}
812
+ } else {
813
+ self . drop_lexem ( ) ;
797
814
}
798
815
} else {
799
816
self . drop_lexem ( ) ;
800
- }
817
+ }
801
818
} else {
802
819
self . drop_lexem ( ) ;
803
820
}
0 commit comments