- Trim bias from description. OBS-URL: https://build.opensuse.org/request/show/690284 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pyjsparser?expand=0&rev=2 |
||
---|---|---|
.gitattributes | ||
.gitignore | ||
fix_version.patch | ||
LICENSE | ||
pyjsparser-2.5.2.tar.gz | ||
python-pyjsparser.changes | ||
python-pyjsparser.spec | ||
README.md |
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"
}
]
}