Closed simondel closed 6 years ago
You can't. Comments aren't usually included in an AST; the parser discards them.
We'd like to think about how best to represent concrete syntax too, at some point, but I don't think we have a good model for that right now. It's pretty tricky to do well.
Comments will never be attached to the AST because there's no good way to choose which node to associate a comment with. But I can imagine the parse-with-location function also producing a list of comments with their positions.
Fixed by #365.
When I parse the following code on the online parser I don't get any comments in the output:
How can I add the comments to the AST?