How to parse a nested `Punctuated` in a proc macro

syn::punctuated::Punctuated does not implement Parse, but I want to parse a type like Punctuated<Punctuated<Expr, Token![,]>, Token![;]>. What is the recommended method of achieving this?

Use parse_terminated_with, e.g. (|input| Punctuated::parse_terminated_with(input, Punctuated::parse_terminated)).parse2(some_token_stream).

1 Like