@@ -1000,6 +1000,26 @@ impl<'a> Parser<'a> {
1000
1000
Ok ( ( result, trailing) )
1001
1001
}
1002
1002
1003
+ fn parse_delim_comma_seq < T > (
1004
+ & mut self ,
1005
+ delim : DelimToken ,
1006
+ f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
1007
+ ) -> PResult < ' a , ( Vec < T > , bool ) > {
1008
+ self . parse_unspanned_seq (
1009
+ & token:: OpenDelim ( delim) ,
1010
+ & token:: CloseDelim ( delim) ,
1011
+ SeqSep :: trailing_allowed ( token:: Comma ) ,
1012
+ f,
1013
+ )
1014
+ }
1015
+
1016
+ fn parse_paren_comma_seq < T > (
1017
+ & mut self ,
1018
+ f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
1019
+ ) -> PResult < ' a , ( Vec < T > , bool ) > {
1020
+ self . parse_delim_comma_seq ( token:: Paren , f)
1021
+ }
1022
+
1003
1023
/// Advance the parser by one token
1004
1024
pub fn bump ( & mut self ) {
1005
1025
if self . prev_token_kind == PrevTokenKind :: Eof {
@@ -2623,6 +2643,10 @@ impl<'a> Parser<'a> {
2623
2643
return Ok ( e) ;
2624
2644
}
2625
2645
2646
+ fn parse_paren_expr_seq ( & mut self ) -> PResult < ' a , Vec < P < Expr > > > {
2647
+ self . parse_paren_comma_seq ( |p| p. parse_expr ( ) ) . map ( |( r, _) | r)
2648
+ }
2649
+
2626
2650
crate fn process_potential_macro_variable ( & mut self ) {
2627
2651
self . token = match self . token . kind {
2628
2652
token:: Dollar if self . token . span . ctxt ( ) != SyntaxContext :: empty ( ) &&
0 commit comments