Use winnow
to parse proc_macro::TokenStream or proc_macro2::TokenStream
#631
Replies: 2 comments 1 reply
-
It looks like I don't know if we'd want to add direct support for proc macros but a |
Beta Was this translation helpful? Give feedback.
-
FWIW this is a relatively recent change. For more than 5 years the parser used a tree representation. https://github.com/dtolnay/syn/blob/1.0.101/src/buffer.rs At least in the way Syn's parsing internals are designed, flattening tokens into an array is not the relevant thing that makes efficient parsing possible. Having a cheaply copyable cursor is. |
Beta Was this translation helpful? Give feedback.
-
When writing procedural macro, when the input token stream is not Rust code, using
winnow
to parse is much easier.Is there any elegant way to use
winnow
to parseproc_macro::TokenStream
orproc_macro2::TokenStream
?Beta Was this translation helpful? Give feedback.
All reactions