PiotrDabkowski / pyjsparser

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

Add support for classes #11

Open rammy22 opened 7 years ago

rammy22 commented 7 years ago

Would you have any time soon to add support for parsing classes: https://github.com/PiotrDabkowski/pyjsparser/blob/master/pyjsparser/parser.py#L2798

Unfortunately I hit this issue as soon as i gave it a try :(

Thanks!

PiotrDabkowski commented 7 years ago

I did not really need to implement ECMA 6 for my purposes so pyjsparser only fully supports ECMA 5.1, sorry. You can try using my automated translation of esprima.js which supports everything. It is slower than pyjsparser but it works. You have an example at the end of the file.

Kronuz commented 7 years ago

I worked in a port of the latest esprima to Python; it's quite fast too and it supports classes and everything esprima does: https://github.com/Kronuz/esprima-python

PiotrDabkowski commented 7 years ago

@Kronuz Great job! It's great you also included the tests :) I tested my parser mostly as a part of my Js2Py Js interpreter on the ECMA 5.1 test suite. I will link your parser from the readme so that it's easier to find for people that need ECMA 6 parsing support.