-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid printing comments from AST. #282
Comments
cc @yunxing |
The intermediate solution should be filter out all the attributes with "ocaml.text" until we can store comments into attributes. @dxu |
cool, I can look into it. if my understanding is correct, I should be stripping out all the current comment code (including the interleaving), and just checking the actual structure item? |
on second thought, i'll probably need to reuse some of the logic to handle inline comments. i'll have to look into it more |
The OCaml |
Ah, thanks for that, I probably should've noticed that. I feel like there might be some issues if we try to convert over the reason parser to storing all comments in our AST, since there'd be inconsistencies between upgrading ocaml -> reason and just compiling reason, if the ocaml compiler doesn't store all comments in the AST. |
Perhaps it only stores comments that it can associate with a particular AST node? If so, it's not really intuitive or clear what's currently happening. It's a good thing we have the current fallback. |
@cristianoc I pushed a fix last night to |
@jordwalke looks like this fixes |
I'll get a fix. I just missed one AST node type. |
4.03 is supposed to parse all There is a warning (50) that identifies |
We will definitely want to parse comments into the AST just as 4.03 does so that we get codoc support. We currently do a pretty good job of printing comments without storing them in the AST, however. We want to maintain full support for printing comments that couldn't be parsed into the AST (if someone choses not to enable warning 50), so we might need to always support that anyways. We can still also parse them into the AST solely for the purpose of doc generation. |
Yes, agreed. For the comments that do get parsed as attributes by 4.03, does reason maintain those attributes through printing and parsing? I don't know if there is enough information in those attributes to preserve things like keeping the comments before or after the expression through print/parse cycles? My motivation is that if so, it would be much easier to be confident that a ocaml to reason conversion is not lossy wrt doc comments if I first make the project warning 50 clean.
|
Sorry, I did not answer the question you asked. I answered it in depth here, but in short, the AST attributes will mostly be good for documentation generation, and warning 50 will be great for ensuring that your project is Reason clean, although we need to do more work to make that true. |
this is pretty stale. feed free to reopen if more discussion is needed |
Cristiano upgraded his compiler to
4.02.3
, so this began storing comments in the AST. We print some of these, so we need to strip these attributes out and not print them (we already print comments so this is redundant).The text was updated successfully, but these errors were encountered: