PiotrDabkowski / pyjsparser

Fast JavaScript parser for Python.
MIT License
246 stars 37 forks source link

Does not parse single line or multiline comments #8

Closed ajinabraham closed 7 years ago

ajinabraham commented 7 years ago

Is there any way I can parse JavaScript Comments, like below ?


//alert(0);
/*
prompt("do you?");
Some comments
*/
PiotrDabkowski commented 7 years ago

This is unfortunately not implemented in pyjsparser.

You can use my automatic translation of esprima which supports the whole JS6 together with comments and much more. To parse comments just use:

esprima.parse('//test', {'comment': True})

It is just like normal esprima but in python :) One downside - quite slow.