commure / sourcegen

🐠Like procedural macro, but generates sources! 🐡
Apache License 2.0
30 stars 4 forks source link

🎤Figure out how to deal with comments #3

Closed idubrov closed 4 years ago

idubrov commented 5 years ago

proc_macro2/quote toolkit does not allow to generate regular comments (since they are not part of the token tree for procedural macros). However, since we are generating regular source code, it could be useful to generate just a plain comment.

Need to figure out a way to do that.

One option would be to use some fake token sequence (like: "\<long identifier> \<string literal>" and replace it with the comment. Library would then provide a struct Comment that will render into these two tokens.