You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 25, 2021. It is now read-only.
I would like to use this package to pars and then pretty print JSON with comments. How can I do that? Using AST.JsonDocument.toJSON(ast) and similar methods does not sustain comments
The text was updated successfully, but these errors were encountered:
toJSON will return the actual JSON object that can be passed to JSON.stringify. If you want to print comments, you need to implement a Visitor that will output them, e.g.:
classMyVisitorextendsVisitor{constructor(){super();};// pretty printer for all nodes and then for comments:comment(commentNode){console.log('[COMMENT]',commentNode.value);};};
I would like to maintain comment locations as much as possible. I will try using the visitor to print. Do you have an example of printer written with the visitor?
I would like to use this package to pars and then pretty print JSON with comments. How can I do that? Using
AST.JsonDocument.toJSON(ast)
and similar methods does not sustain commentsThe text was updated successfully, but these errors were encountered: