forked from pool/python-pyjsparser
8975f560fc104bb0bff2b4b03215ec03876ce389f7a9e2e7c795000a3912f3d2
fix OBS-URL: https://build.opensuse.org/request/show/685011 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pyjsparser?expand=0&rev=1
pyjsparser
Fast JavaScript parser - manual translation of esprima.js to python. Takes 1 second to parse whole angular.js library so parsing speed is about 100k characters per second which makes it the fastest and most comprehensible JavaScript parser for python out there.
Supports whole ECMAScript 5.1 and parts of ECMAScript 6. If you need full ECMA 6 support I recomment trying out this parser by Kronuz.
Installation
pip install pyjsparser
Example
>>> from pyjsparser import PyJsParser
>>> p = PyJsParser()
>>> p.parse('var $ = "Hello!"')
{
"type": "Program",
"body": [
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "$"
},
"init": {
"type": "Literal",
"value": "Hello!",
"raw": '"Hello!"'
}
}
],
"kind": "var"
}
]
}
Languages
Diff
100%