- Notifications
You must be signed in to change notification settings - Fork775
ECMAScript parsing infrastructure for multipurpose analysis
License
NotificationsYou must be signed in to change notification settings
jquery/esprima
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Esprima (esprima.org, BSD license) is a high performance,standard-compliantECMAScriptparser written in ECMAScript (also popularly known asJavaScript).Esprima is created and maintained byAriya Hidayat,with the help ofmany contributors.
- Full support for ECMAScript 2019 (ECMA-262 10th Edition)
- Sensiblesyntax tree format as standardized byESTree project
- Experimental support forJSX, a syntax extension forReact
- Optional tracking of syntax node location (index-based and line-column)
- Heavily tested (~1600unit tests withfull code coverage)
Esprima can be used to performlexical analysis (tokenization) orsyntactic analysis (parsing) of a JavaScript program.
A simple example on Node.js REPL:
>varesprima=require('esprima');>varprogram='const answer = 42';>esprima.tokenize(program);[{type:'Keyword',value:'const'},{type:'Identifier',value:'answer'},{type:'Punctuator',value:'='},{type:'Numeric',value:'42'}]>esprima.parseScript(program);{type:'Program',body:[{type:'VariableDeclaration',declarations:[Object],kind:'const'}],sourceType:'script'}
For more information, please read thecomplete documentation.
About
ECMAScript parsing infrastructure for multipurpose analysis
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.