Skip to content

Fast JavaScript parser for Python. Fork to build and publish a wheel on pypi

License

Notifications You must be signed in to change notification settings

RepoLab/pyjsparser-wheel

 
 

Repository files navigation

pyjsparser

Build Status

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. The documentation for the generated AST can be found here.

Installation

pip install pyjsparser

Example

>>> from pyjsparser import parse
>>> parse('var $ = "Hello!"')
{
"type": "Program",
"body": [
    {
        "type": "VariableDeclaration",
        "declarations": [
            {
                "type": "VariableDeclarator",
                "id": {
                    "type": "Identifier",
                    "name": "$"
                },
                "init": {
                    "type": "Literal",
                    "value": "Hello!",
                    "raw": '"Hello!"'
                }
            }
        ],
        "kind": "var"
    }
  ]
}

About

Fast JavaScript parser for Python. Fork to build and publish a wheel on pypi

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 82.5%
  • Python 17.5%