esprima


Nameesprima JSON
Version 4.0.1 PyPI version JSON
download
home_pagehttps://github.com/Kronuz/esprima-python
SummaryECMAScript parsing infrastructure for multipurpose analysis in Python
upload_time2018-08-24 13:59:11
maintainer
docs_urlNone
authorGerman M. Bravo (Kronuz)
requires_python
licenseBSD License
keywords esprima ecmascript javascript parser ast
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            |Donate| |PyPI Version| |PyPI License| |PyPI Format| |PyPI Status|

**Esprima** (`esprima.org <http://esprima.org>`__, BSD license) is a
high performance, standard-compliant
`ECMAScript <http://www.ecma-international.org/publications/standards/Ecma-262.htm>`__
parser officially written in ECMAScript (also popularly known as
`JavaScript <https://en.wikipedia.org/wiki/JavaScript>`__) and ported to
Python. Esprima is created and maintained by `Ariya
Hidayat <https://twitter.com/ariyahidayat>`__, with the help of `many
contributors <https://github.com/jquery/esprima/contributors>`__.

Python port is a line-by-line manual translation and was created and is
maintained by `German Mendez Bravo
(Kronuz) <https://twitter.com/germbravo>`__.

Features
~~~~~~~~

-  Full support for ECMAScript 2017 (`ECMA-262 8th
   Edition <http://www.ecma-international.org/publications/standards/Ecma-262.htm>`__)
-  Sensible `syntax tree
   format <https://github.com/estree/estree/blob/master/es5.md>`__ as
   standardized by `ESTree project <https://github.com/estree/estree>`__
-  Experimental support for `JSX <https://facebook.github.io/jsx/>`__, a
   syntax extension for `React <https://facebook.github.io/react/>`__
-  Optional tracking of syntax node location (index-based and
   line-column)
-  `Heavily tested <http://esprima.org/test/ci.html>`__ (~1500 `unit
   tests <https://github.com/jquery/esprima/tree/master/test/fixtures>`__
   with `full code
   coverage <https://codecov.io/github/jquery/esprima>`__)

Installation
~~~~~~~~~~~~

.. code:: shell

    pip install esprima

API
~~~

Esprima can be used to perform `lexical
analysis <https://en.wikipedia.org/wiki/Lexical_analysis>`__
(tokenization) or `syntactic
analysis <https://en.wikipedia.org/wiki/Parsing>`__ (parsing) of a
JavaScript program.

A simple example:

.. code:: javascript

    >>> import esprima
    >>> program = 'const answer = 42'

    >>> esprima.tokenize(program)
    [{
        type: "Keyword",
        value: "const"
    }, {
        type: "Identifier",
        value: "answer"
    }, {
        type: "Punctuator",
        value: "="
    }, {
        type: "Numeric",
        value: "42"
    }]

    >>> esprima.parseScript(program)
    {
        body: [
            {
                kind: "const",
                declarations: [
                    {
                        init: {
                            raw: "42",
                            type: "Literal",
                            value: 42
                        },
                        type: "VariableDeclarator",
                        id: {
                            type: "Identifier",
                            name: "answer"
                        }
                    }
                ],
                type: "VariableDeclaration"
            }
        ],
        type: "Program",
        sourceType: "script"
    }

For more information, please read the `complete
documentation <http://esprima.org/doc>`__.

.. |Donate| image:: https://img.shields.io/badge/Donate-PayPal-green.svg
   :target: https://www.paypal.me/Kronuz/25
.. |PyPI Version| image:: https://img.shields.io/pypi/v/esprima.svg
   :target: https://pypi.python.org/pypi/esprima
.. |PyPI License| image:: https://img.shields.io/pypi/l/esprima.svg
   :target: https://pypi.python.org/pypi/esprima
.. |PyPI Wheel| image:: https://img.shields.io/pypi/wheel/esprima.svg
   :target: https://pypi.python.org/pypi/esprima
.. |PyPI Format| image:: https://img.shields.io/pypi/format/esprima.svg
   :target: https://pypi.python.org/pypi/esprima
.. |PyPI Python Version| image:: https://img.shields.io/pypi/pyversions/esprima.svg
   :target: https://pypi.python.org/pypi/esprima
.. |PyPI Implementation| image:: https://img.shields.io/pypi/implementation/esprima.svg
   :target: https://pypi.python.org/pypi/esprima
.. |PyPI Status| image:: https://img.shields.io/pypi/status/esprima.svg
   :target: https://pypi.python.org/pypi/esprima
.. |PyPI Downloads| image:: https://img.shields.io/pypi/dm/esprima.svg
   :target: https://pypi.python.org/pypi/esprima
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Kronuz/esprima-python",
    "name": "esprima",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "esprima ecmascript javascript parser ast",
    "author": "German M. Bravo (Kronuz)",
    "author_email": "german.mb@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/cc/a1/50fccd68a12bcfc27adfc9969c090286670a9109a0259f3f70943390b721/esprima-4.0.1.tar.gz",
    "platform": "",
    "description": "|Donate| |PyPI Version| |PyPI License| |PyPI Format| |PyPI Status|\n\n**Esprima** (`esprima.org <http://esprima.org>`__, BSD license) is a\nhigh performance, standard-compliant\n`ECMAScript <http://www.ecma-international.org/publications/standards/Ecma-262.htm>`__\nparser officially written in ECMAScript (also popularly known as\n`JavaScript <https://en.wikipedia.org/wiki/JavaScript>`__) and ported to\nPython. Esprima is created and maintained by `Ariya\nHidayat <https://twitter.com/ariyahidayat>`__, with the help of `many\ncontributors <https://github.com/jquery/esprima/contributors>`__.\n\nPython port is a line-by-line manual translation and was created and is\nmaintained by `German Mendez Bravo\n(Kronuz) <https://twitter.com/germbravo>`__.\n\nFeatures\n~~~~~~~~\n\n-  Full support for ECMAScript 2017 (`ECMA-262 8th\n   Edition <http://www.ecma-international.org/publications/standards/Ecma-262.htm>`__)\n-  Sensible `syntax tree\n   format <https://github.com/estree/estree/blob/master/es5.md>`__ as\n   standardized by `ESTree project <https://github.com/estree/estree>`__\n-  Experimental support for `JSX <https://facebook.github.io/jsx/>`__, a\n   syntax extension for `React <https://facebook.github.io/react/>`__\n-  Optional tracking of syntax node location (index-based and\n   line-column)\n-  `Heavily tested <http://esprima.org/test/ci.html>`__ (~1500 `unit\n   tests <https://github.com/jquery/esprima/tree/master/test/fixtures>`__\n   with `full code\n   coverage <https://codecov.io/github/jquery/esprima>`__)\n\nInstallation\n~~~~~~~~~~~~\n\n.. code:: shell\n\n    pip install esprima\n\nAPI\n~~~\n\nEsprima can be used to perform `lexical\nanalysis <https://en.wikipedia.org/wiki/Lexical_analysis>`__\n(tokenization) or `syntactic\nanalysis <https://en.wikipedia.org/wiki/Parsing>`__ (parsing) of a\nJavaScript program.\n\nA simple example:\n\n.. code:: javascript\n\n    >>> import esprima\n    >>> program = 'const answer = 42'\n\n    >>> esprima.tokenize(program)\n    [{\n        type: \"Keyword\",\n        value: \"const\"\n    }, {\n        type: \"Identifier\",\n        value: \"answer\"\n    }, {\n        type: \"Punctuator\",\n        value: \"=\"\n    }, {\n        type: \"Numeric\",\n        value: \"42\"\n    }]\n\n    >>> esprima.parseScript(program)\n    {\n        body: [\n            {\n                kind: \"const\",\n                declarations: [\n                    {\n                        init: {\n                            raw: \"42\",\n                            type: \"Literal\",\n                            value: 42\n                        },\n                        type: \"VariableDeclarator\",\n                        id: {\n                            type: \"Identifier\",\n                            name: \"answer\"\n                        }\n                    }\n                ],\n                type: \"VariableDeclaration\"\n            }\n        ],\n        type: \"Program\",\n        sourceType: \"script\"\n    }\n\nFor more information, please read the `complete\ndocumentation <http://esprima.org/doc>`__.\n\n.. |Donate| image:: https://img.shields.io/badge/Donate-PayPal-green.svg\n   :target: https://www.paypal.me/Kronuz/25\n.. |PyPI Version| image:: https://img.shields.io/pypi/v/esprima.svg\n   :target: https://pypi.python.org/pypi/esprima\n.. |PyPI License| image:: https://img.shields.io/pypi/l/esprima.svg\n   :target: https://pypi.python.org/pypi/esprima\n.. |PyPI Wheel| image:: https://img.shields.io/pypi/wheel/esprima.svg\n   :target: https://pypi.python.org/pypi/esprima\n.. |PyPI Format| image:: https://img.shields.io/pypi/format/esprima.svg\n   :target: https://pypi.python.org/pypi/esprima\n.. |PyPI Python Version| image:: https://img.shields.io/pypi/pyversions/esprima.svg\n   :target: https://pypi.python.org/pypi/esprima\n.. |PyPI Implementation| image:: https://img.shields.io/pypi/implementation/esprima.svg\n   :target: https://pypi.python.org/pypi/esprima\n.. |PyPI Status| image:: https://img.shields.io/pypi/status/esprima.svg\n   :target: https://pypi.python.org/pypi/esprima\n.. |PyPI Downloads| image:: https://img.shields.io/pypi/dm/esprima.svg\n   :target: https://pypi.python.org/pypi/esprima",
    "bugtrack_url": null,
    "license": "BSD License",
    "summary": "ECMAScript parsing infrastructure for multipurpose analysis in Python",
    "version": "4.0.1",
    "split_keywords": [
        "esprima",
        "ecmascript",
        "javascript",
        "parser",
        "ast"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "47b70d12b8af1cc631842f4a947a6e48",
                "sha256": "08db1a876d3c2910db9cfaeb83108193af5411fc3a3a66ebefacd390d21323ee"
            },
            "downloads": -1,
            "filename": "esprima-4.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "47b70d12b8af1cc631842f4a947a6e48",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 47021,
            "upload_time": "2018-08-24T13:59:11",
            "upload_time_iso_8601": "2018-08-24T13:59:11.374013Z",
            "url": "https://files.pythonhosted.org/packages/cc/a1/50fccd68a12bcfc27adfc9969c090286670a9109a0259f3f70943390b721/esprima-4.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2018-08-24 13:59:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "Kronuz",
    "github_project": "esprima-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "esprima"
}
        
Elapsed time: 0.01676s