top | item 47118997

(no title)

galaxyLogic | 6 days ago

Does oxc-parser make it easy to remove comments from JavaScript?

In other words does it treat comments as syntactic units, or as something that can be ignored wince they are not needed by the "next stage"?

The reason to find out what the comments are is of course to make it easy to remove them.

discuss

order

xixixao|6 days ago

Should be easy with any standard parser. See astexplorer.net

galaxyLogic|4 days ago

I've been using Esprima and it's not trivial to get rid of, or collect all comments with it. The reason is that while it finds the ranges of all syntactic JavaScript elements, it does not consider comment to be a syntactic element, but just something between them.