Mirror for Apache CouchDB

Clone this repo:
  1. a971d87 Fix Unexpected "Invalid left-hand side in for-in" error by Joseph Pecoraro · 4 months ago master
  2. 9eadf3f Update test262 for ES2018+ features by Joseph Pecoraro · 4 months ago
  3. fe13460 Fix link from Chapter 2 to Chapter 3 by Eugene Otto · 6 months ago
  4. 3f9dc14 Fix Unexpected ILLEGAL token with function literal in template strings by Joseph Pecoraro · 4 months ago
  5. 5e55171 Update identifier parsing per Unicode v12.1.0 by Mathias Bynens · 7 months ago

NPM version npm download Build Status Coverage Status

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.

Features

API

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.parseScript(program);
{ type: 'Program',
  body:
   [ { type: 'VariableDeclaration',
       declarations: [Object],
       kind: 'const' } ],
  sourceType: 'script' }

For more information, please read the complete documentation.