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

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.