- Notifications
You must be signed in to change notification settings - Fork47
ECMAScript parsing infrastructure for multipurpose analysis
License
Unknown, BSD-2-Clause licenses found
Licenses found
Kronuz/esprima-python
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Esprima (esprima.org, BSD license) is ahigh performance, standard-compliantECMAScriptparser officially written in ECMAScript (also popularly known asJavaScript) and ported toPython. Esprima is created and maintained byAriyaHidayat, with the help ofmanycontributors.
Python port is a line-by-line manual translation and was created and ismaintained byGerman Mendez Bravo(Kronuz).
- Full support for ECMAScript 2017 (ECMA-262 8thEdition)
- Sensiblesyntax treeformat asstandardized byESTree project
- Experimental support forJSX, asyntax extension forReact
- Optional tracking of syntax node location (index-based andline-column)
- Heavily tested (~1500unittestswithfull codecoverage)
pip install esprima
Esprima can be used to performlexicalanalysis(tokenization) orsyntacticanalysis (parsing) of aJavaScript program.
A simple example:
>>>importesprima>>>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 thecompletedocumentation.
About
ECMAScript parsing infrastructure for multipurpose analysis
Topics
Resources
License
Unknown, BSD-2-Clause licenses found
Licenses found
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Contributors7
Uh oh!
There was an error while loading.Please reload this page.