| 1 |
Metadata-Version: 1.1 |
| 2 |
Name: esprima |
| 3 |
Version: 4.0.1 |
| 4 |
Summary: ECMAScript parsing infrastructure for multipurpose analysis in Python |
| 5 |
Home-page: https://github.com/Kronuz/esprima-python |
| 6 |
Author: German M. Bravo (Kronuz) |
| 7 |
Author-email: [email protected] |
| 8 |
License: BSD License |
| 9 |
Description: |Donate| |PyPI Version| |PyPI License| |PyPI Format| |PyPI Status| |
| 10 |
|
| 11 |
**Esprima** (`esprima.org <http://esprima.org>`__, BSD license) is a |
| 12 |
high performance, standard-compliant |
| 13 |
`ECMAScript <http://www.ecma-international.org/publications/standards/Ecma-262.htm>`__ |
| 14 |
parser officially written in ECMAScript (also popularly known as |
| 15 |
`JavaScript <https://en.wikipedia.org/wiki/JavaScript>`__) and ported to |
| 16 |
Python. Esprima is created and maintained by `Ariya |
| 17 |
Hidayat <https://twitter.com/ariyahidayat>`__, with the help of `many |
| 18 |
contributors <https://github.com/jquery/esprima/contributors>`__. |
| 19 |
|
| 20 |
Python port is a line-by-line manual translation and was created and is |
| 21 |
maintained by `German Mendez Bravo |
| 22 |
(Kronuz) <https://twitter.com/germbravo>`__. |
| 23 |
|
| 24 |
Features |
| 25 |
~~~~~~~~ |
| 26 |
|
| 27 |
- Full support for ECMAScript 2017 (`ECMA-262 8th |
| 28 |
Edition <http://www.ecma-international.org/publications/standards/Ecma-262.htm>`__) |
| 29 |
- Sensible `syntax tree |
| 30 |
format <https://github.com/estree/estree/blob/master/es5.md>`__ as |
| 31 |
standardized by `ESTree project <https://github.com/estree/estree>`__ |
| 32 |
- Experimental support for `JSX <https://facebook.github.io/jsx/>`__, a |
| 33 |
syntax extension for `React <https://facebook.github.io/react/>`__ |
| 34 |
- Optional tracking of syntax node location (index-based and |
| 35 |
line-column) |
| 36 |
- `Heavily tested <http://esprima.org/test/ci.html>`__ (~1500 `unit |
| 37 |
tests <https://github.com/jquery/esprima/tree/master/test/fixtures>`__ |
| 38 |
with `full code |
| 39 |
coverage <https://codecov.io/github/jquery/esprima>`__) |
| 40 |
|
| 41 |
Installation |
| 42 |
~~~~~~~~~~~~ |
| 43 |
|
| 44 |
.. code:: shell |
| 45 |
|
| 46 |
pip install esprima |
| 47 |
|
| 48 |
API |
| 49 |
~~~ |
| 50 |
|
| 51 |
Esprima can be used to perform `lexical |
| 52 |
analysis <https://en.wikipedia.org/wiki/Lexical_analysis>`__ |
| 53 |
(tokenization) or `syntactic |
| 54 |
analysis <https://en.wikipedia.org/wiki/Parsing>`__ (parsing) of a |
| 55 |
JavaScript program. |
| 56 |
|
| 57 |
A simple example: |
| 58 |
|
| 59 |
.. code:: javascript |
| 60 |
|
| 61 |
>>> import esprima |
| 62 |
>>> program = 'const answer = 42' |
| 63 |
|
| 64 |
>>> esprima.tokenize(program) |
| 65 |
[{ |
| 66 |
type: "Keyword", |
| 67 |
value: "const" |
| 68 |
}, { |
| 69 |
type: "Identifier", |
| 70 |
value: "answer" |
| 71 |
}, { |
| 72 |
type: "Punctuator", |
| 73 |
value: "=" |
| 74 |
}, { |
| 75 |
type: "Numeric", |
| 76 |
value: "42" |
| 77 |
}] |
| 78 |
|
| 79 |
>>> esprima.parseScript(program) |
| 80 |
{ |
| 81 |
body: [ |
| 82 |
{ |
| 83 |
kind: "const", |
| 84 |
declarations: [ |
| 85 |
{ |
| 86 |
init: { |
| 87 |
raw: "42", |
| 88 |
type: "Literal", |
| 89 |
value: 42 |
| 90 |
}, |
| 91 |
type: "VariableDeclarator", |
| 92 |
id: { |
| 93 |
type: "Identifier", |
| 94 |
name: "answer" |
| 95 |
} |
| 96 |
} |
| 97 |
], |
| 98 |
type: "VariableDeclaration" |
| 99 |
} |
| 100 |
], |
| 101 |
type: "Program", |
| 102 |
sourceType: "script" |
| 103 |
} |
| 104 |
|
| 105 |
For more information, please read the `complete |
| 106 |
documentation <http://esprima.org/doc>`__. |
| 107 |
|
| 108 |
.. |Donate| image:: https://img.shields.io/badge/Donate-PayPal-green.svg |
| 109 |
:target: https://www.paypal.me/Kronuz/25 |
| 110 |
.. |PyPI Version| image:: https://img.shields.io/pypi/v/esprima.svg |
| 111 |
:target: https://pypi.python.org/pypi/esprima |
| 112 |
.. |PyPI License| image:: https://img.shields.io/pypi/l/esprima.svg |
| 113 |
:target: https://pypi.python.org/pypi/esprima |
| 114 |
.. |PyPI Wheel| image:: https://img.shields.io/pypi/wheel/esprima.svg |
| 115 |
:target: https://pypi.python.org/pypi/esprima |
| 116 |
.. |PyPI Format| image:: https://img.shields.io/pypi/format/esprima.svg |
| 117 |
:target: https://pypi.python.org/pypi/esprima |
| 118 |
.. |PyPI Python Version| image:: https://img.shields.io/pypi/pyversions/esprima.svg |
| 119 |
:target: https://pypi.python.org/pypi/esprima |
| 120 |
.. |PyPI Implementation| image:: https://img.shields.io/pypi/implementation/esprima.svg |
| 121 |
:target: https://pypi.python.org/pypi/esprima |
| 122 |
.. |PyPI Status| image:: https://img.shields.io/pypi/status/esprima.svg |
| 123 |
:target: https://pypi.python.org/pypi/esprima |
| 124 |
.. |PyPI Downloads| image:: https://img.shields.io/pypi/dm/esprima.svg |
| 125 |
:target: https://pypi.python.org/pypi/esprima |
| 126 |
Keywords: esprima ecmascript javascript parser ast |
| 127 |
Platform: UNKNOWN |
| 128 |
Classifier: Development Status :: 5 - Production/Stable |
| 129 |
Classifier: Intended Audience :: Developers |
| 130 |
Classifier: License :: OSI Approved :: BSD License |
| 131 |
Classifier: Operating System :: OS Independent |
| 132 |
Classifier: Topic :: Software Development :: Code Generators |
| 133 |
Classifier: Topic :: Software Development :: Compilers |
| 134 |
Classifier: Topic :: Software Development :: Libraries :: Python Modules |
| 135 |
Classifier: Topic :: Text Processing :: General |
| 136 |
Classifier: Programming Language :: Python |
| 137 |
Classifier: Programming Language :: Python :: 2 |
| 138 |
Classifier: Programming Language :: Python :: 2.7 |
| 139 |
Classifier: Programming Language :: Python :: 3 |
| 140 |
Classifier: Programming Language :: Python :: 3.3 |
| 141 |
Classifier: Programming Language :: Python :: 3.4 |
| 142 |
Classifier: Programming Language :: Python :: 3.5 |
| 143 |
Classifier: Programming Language :: Python :: 3.6 |