Improve: parse code in comments#934
Improve: parse code in comments#934gpetiot merged 14 commits intoocaml-ppx:masterfrom gpetiot:parse-code-comments
Conversation
|
Thanks for working on this! cinaps comments are actually structure items, and yh they should be allowed everywhere. |
|
Turns out it is toplevel phrases instead, this PR should be ready to be reviewed and tested now. |
|
Ah yes. Although toplevel phrases were for the old way of using cinaps, i.e. when using it as a toplevel. When used via dune, these have to be structure items. Though I guess parsing them as toplevel phrases should be harmless. I will test that today. Just one thought: I grepped the dune-universe for |
I think testing whether there is a blank character after |
|
I'm testing this, it seems to be working well except that a |
|
BTW, it's fine to restrict the parsing to structure items only. I expect that toplevel phrases support will eventually disappear given that the new method of using cinaps via dune is much more convenient. |
|
I reverted to using structures instead, so toplevel directives such as |
|
Thanks, I just gave it another try and the comments are being well formatted :) Just one last issue I found: the trailing |
This is fixed now. |
|
Just tested again, all good👌. Cinaps comments are all nicely formatted :) |
|
@Julow I guess I can submit another PR where I move |
This should not be necessary. |
Fix #924
@diml I assumed every cinaps comment was an ocaml expression but it seems it's not always the case, I didn't see the specification on the github repo, is there more info somewhere?
Should it be allowed in .mli and .mlt files as well?