I was trying to parse some code and reformat them, but it seems that quote will just ignore the comments.
Is there any way to achieve this? I guess I have to dive into the erlang side?
Remarks. A Comment may be up to 1000 characters in length. However, by default, only the first line of the comment is displayed in the macro design window. To see the entire comment text, click or tab into the Comment statement in the Macro design window.
No, you cannot get code comments inside macros. They never become part of the AST and are discarded still in Elixir's tokenizer.
It seems that comments are handled at the tokenizer level, so the parser will not even see them. The relevant parts from the elixir tokenizer indicate that comments are discarded pretty early in the pipeline. This test case from elixir core tells us the same thing:
comments_test() ->
[{number, {1,1,2}, 1},{eol, {1,3,4}},{number,{2,1,2},2}] = tokenize("1 # Comment\n2").
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With