commit | 4f08020cc3f2678ca21b00931eef365d49defed9 | [log] [tgz] |
---|---|---|
author | Ariya Hidayat <ariya.hidayat@gmail.com> | Sun Apr 02 17:49:58 2017 -0700 |
committer | Ariya Hidayat <ariya.hidayat@gmail.com> | Mon Apr 03 07:12:21 2017 -0700 |
tree | d60f9e1dec471193915598e7aabfc394e55182bf | |
parent | 492eeef2c92c866dd2f812a64039a593d5d3a8b7 [diff] |
Improve error message upon an invalid JSX element Instead of trying to handle it by itself, the special lexer for JSX should simply defer to the vanilla lexer if it can't understand the upcoming token. Fix #1815 Closes gh-1820
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.