File tree Expand file tree Collapse file tree 3 files changed +31
-2
lines changed
Expand file tree Collapse file tree 3 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -4510,6 +4510,8 @@ const TARGET_FOLLOW: TokenSet = TokenSet::new(&[
45104510 R_PAREN ,
45114511 R_BRACK ,
45124512 RETURNING_KW ,
4513+ SEMICOLON ,
4514+ EOF ,
45134515] )
45144516. union ( COMPOUND_SELECT_FIRST ) ;
45154517
@@ -4567,7 +4569,7 @@ fn opt_target_list(p: &mut Parser) -> Option<CompletedMarker> {
45674569 let m = p. start ( ) ;
45684570 while !p. at ( EOF ) && !p. at ( SEMICOLON ) {
45694571 if opt_target_el ( p) . is_some ( ) {
4570- if p. at ( COMMA ) && matches ! ( p . nth ( 1 ) , SEMICOLON | EOF ) {
4572+ if p. at ( COMMA ) && p . nth_at_ts ( 1 , TARGET_FOLLOW ) {
45714573 p. err_and_bump ( "unexpected trailing comma" ) ;
45724574 break ;
45734575 }
@@ -4584,6 +4586,8 @@ fn opt_target_list(p: &mut Parser) -> Option<CompletedMarker> {
45844586 break ;
45854587 }
45864588 }
4589+ } else {
4590+ break ;
45874591 }
45884592 }
45894593 Some ( m. complete ( p, TARGET_LIST ) )
Original file line number Diff line number Diff line change @@ -29,5 +29,8 @@ select numeric 1234;
2929-- warns about a missing semicolon
3030select select ;
3131
32+ -- extra comma
33+ select a, from t;
34+
3235-- trailing comma at EOF
3336select 1 ,
Original file line number Diff line number Diff line change @@ -223,6 +223,27 @@ SOURCE_FILE
223223 SELECT_KW " select"
224224 SEMICOLON " ;"
225225 WHITESPACE " \n\n "
226+ COMMENT " -- extra comma"
227+ WHITESPACE " \n "
228+ SELECT
229+ SELECT_CLAUSE
230+ SELECT_KW " select"
231+ WHITESPACE " "
232+ TARGET_LIST
233+ TARGET
234+ NAME_REF
235+ IDENT " a"
236+ ERROR
237+ COMMA " ,"
238+ WHITESPACE " "
239+ FROM_CLAUSE
240+ FROM_KW " from"
241+ WHITESPACE " "
242+ FROM_ITEM
243+ NAME_REF
244+ IDENT " t"
245+ SEMICOLON " ;"
246+ WHITESPACE " \n\n "
226247 COMMENT " -- trailing comma at EOF"
227248 WHITESPACE " \n "
228249 SELECT
@@ -248,4 +269,5 @@ ERROR@396: expected expression
248269ERROR @397 : expected expression
249270ERROR @520 : missing comma
250271ERROR @646 : expected SEMICOLON
251- ERROR @689 : unexpected trailing comma
272+ ERROR @679 : unexpected trailing comma
273+ ERROR @723 : unexpected trailing comma
You can’t perform that action at this time.
0 commit comments