reflect.js
reflect.js copied to clipboard
Parity with Esprima
Esprima has some extra goodies on top of Mozilla's AST, such as a token list, ranges, and comments. There are also bugs with the current location information collected in reflect.js that need to be corrected.
If you do this piecemeal... Comments would be my #1 vote.
@ozten Comments are now supported as of 0.1.1 :)
The ast will have a comments array with the character position of the comment (as per this example).
Ah, you might want to document the options
argument to parse
. I see now, using {comment: true} I get the comments and can use range to see if they should be before or after the element. Nice work!
What would it take (downstream perhaps) to have the parser keep the comments in-place in its internal representation such that Stringify would output them right as they were?