commit | 4b0f65ebf92af4df85c523f8387359c71e7284ac | [log] [tgz] |
---|---|---|
author | Ariya Hidayat <ariya.hidayat@gmail.com> | Tue Jan 10 07:34:49 2017 -0800 |
committer | Ariya Hidayat <ariya.hidayat@gmail.com> | Wed Jan 11 08:09:23 2017 -0800 |
tree | 7e418e5c839e774733f3202d1e2930603a22faf8 | |
parent | 60203142f702285ea6931732d4699642629c572a [diff] |
Simplify handling the marker for node location Marker, MetaNode, JSXMetaNode are all merged into just one structure Fix #1717 Closes gh-1726
Esprima (esprima.org, BSD license) is a high performance, standard-compliant ECMAScript parser written in ECMAScript (also popularly known as JavaScript). Esprima is created and maintained by Ariya Hidayat, with the help of many contributors.
Esprima can be used to perform lexical analysis (tokenization) or syntactic analysis (parsing) of a JavaScript program.
A simple example on Node.js REPL:
> var esprima = require('esprima'); > var program = 'const answer = 42'; > esprima.tokenize(program); [ { type: 'Keyword', value: 'const' }, { type: 'Identifier', value: 'answer' }, { type: 'Punctuator', value: '=' }, { type: 'Numeric', value: '42' } ] > esprima.parse(program); { type: 'Program', body: [ { type: 'VariableDeclaration', declarations: [Object], kind: 'const' } ], sourceType: 'script' }
For more information, please read the complete documentation.