tag | 33209878ef2f3470becf0fa6ff26867086827d5c | |
---|---|---|
tagger | Ariya Hidayat <ariya.hidayat@gmail.com> | Thu Dec 22 19:18:10 2016 -0800 |
object | cd5909280f363d503142cb79077ec532132d9749 |
Version 3.1.3
commit | cd5909280f363d503142cb79077ec532132d9749 | [log] [tgz] |
---|---|---|
author | Ariya Hidayat <ariya.hidayat@gmail.com> | Wed Dec 21 19:51:24 2016 -0800 |
committer | Ariya Hidayat <ariya.hidayat@gmail.com> | Thu Dec 22 19:15:19 2016 -0800 |
tree | 71375dd02c9ef35ee1602885770b11a1403a39d1 | |
parent | 5f26447c7fd32a24bcf3d69152e305a89818a25a [diff] |
Stable version 3.1.3 Refs #1584 Closes gh-1683
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' }