PiotrDabkowski / pyjsparser

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

Comments? #14

Closed xmo-odoo closed 7 years ago

xmo-odoo commented 7 years ago

The parser seems to ignore/lose comments, I expect the reason is the same as #11 (wasn't necessary) but just in case, any plans to add them?

PiotrDabkowski commented 7 years ago

Sorry, I don't add new features to the parser. Pull requests are welcome.

Alternatively, you can use my Js2Py translated esprima.js. It supports everything, including JavaScript 6 and comments, but unfortunately, it's about 10 times slower than pyjsparser.

xmo-odoo commented 7 years ago

Alternatively, you can use my Js2Py translated esprima.js. It supports everything, including JavaScript 6 and comments, but unfortunately, it's about 10 times slower than pyjsparser.

Yeah sadly it also blows up the stack on the source files I'm feeding it.

Let's say I add some basic comments support to pyjsparser, how much do you care about matching esprima's structure & semantics?

PiotrDabkowski commented 7 years ago

Hmm, as long as the current functionality is kept intact, you can add the comments to the current structure any way you like.

Also, recursion limit is the common problem with Js2Py, a single JS call = like 5 recursive python calls. You can fix it with:

import sys
sys.setrecursionlimit(10000)