File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed
Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -4211,7 +4211,7 @@ fn opt_as_col_label(p: &mut Parser<'_>) -> bool {
42114211}
42124212
42134213fn opt_target_list ( p : & mut Parser ) -> Option < CompletedMarker > {
4214- if !p. at_ts ( TARGET_LIST_START ) {
4214+ if !p. at_ts ( TARGET_LIST_START ) || p . at ( SELECT_KW ) {
42154215 return None ;
42164216 }
42174217 let m = p. start ( ) ;
Original file line number Diff line number Diff line change @@ -25,5 +25,9 @@ select 1 in c;
2525-- type cast must use a string literal
2626select numeric 1234 ;
2727
28+ -- regression test: this would cause the parser to get stuck & panic, now it
29+ -- warns about a missing semicolon
30+ select select ;
31+
2832-- trailing comma at EOF
2933select 1 ,
Original file line number Diff line number Diff line change 11-- -
22source : crates / squawk_parser / tests / tests .rs
33input_file : crates / squawk_parser / tests / data / err / select .sql
4- snapshot_kind : text
54-- -
65SOURCE_FILE
76 COMMENT " --- via https://duckdb.org/docs/stable/sql/dialect/friendly_sql.html#trailing-commas"
@@ -209,6 +208,19 @@ SOURCE_FILE
209208 INT_NUMBER " 1234"
210209 SEMICOLON " ;"
211210 WHITESPACE " \n\n "
211+ COMMENT " -- regression test: this would cause the parser to get stuck & panic, now it"
212+ WHITESPACE " \n "
213+ COMMENT " -- warns about a missing semicolon"
214+ WHITESPACE " \n "
215+ SELECT
216+ SELECT_CLAUSE
217+ SELECT_KW " select"
218+ WHITESPACE " "
219+ SELECT
220+ SELECT_CLAUSE
221+ SELECT_KW " select"
222+ SEMICOLON " ;"
223+ WHITESPACE " \n\n "
212224 COMMENT " -- trailing comma at EOF"
213225 WHITESPACE " \n "
214226 SELECT
@@ -233,4 +245,5 @@ ERROR@395: expected expression
233245ERROR @396 : expected expression
234246ERROR @397 : expected expression
235247ERROR @520 : missing comma
236- ERROR @561 : unexpected trailing comma
248+ ERROR @646 : expected SEMICOLON
249+ ERROR @689 : unexpected trailing comma
You can’t perform that action at this time.
0 commit comments