Skip to content
ECMAScript parsing infrastructure for multipurpose analysis
TypeScript JavaScript HTML
Branch: master
Clone or download

Latest commit

Latest commit 45c9ab1 Jan 8, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Update CI node versions and increase minimum Node version to 8. Jan 4, 2020
.github Add a template for issue reporting Mar 1, 2017
bin esvalidate: Ensure the consistency of error message Dec 23, 2016
dist Use webpack to create the bundle. Oct 28, 2015
docs Fix link from Chapter 2 to Chapter 3 Sep 14, 2019
src Migrate from TSLint to ESLint Jan 8, 2020
test Update CI node versions and increase minimum Node version to 8. Jan 4, 2020
tools Update identifier data to Unicode v10 Apr 14, 2018
.editorconfig Add .editorconfig Mar 11, 2015
.eslintrc.json Migrate from TSLint to ESLint Jan 8, 2020
.gitignore make tests rely on package.json "main" field Nov 17, 2015
.gitlab-ci.yml Update CI node versions and increase minimum Node version to 8. Jan 4, 2020
.npmignore Add test to .npmignore, allow tests to pass without test Jun 23, 2015
.travis.yml Update CI node versions and increase minimum Node version to 8. Jan 4, 2020
CONTRIBUTING.md Link directly to Github issue tracker. May 7, 2015
ChangeLog Update ChangeLog for 4.0.0 Jun 12, 2017
LICENSE.BSD Update copyright notice Nov 8, 2016
README.md Update README.md to prepare for version 4.0 Jun 12, 2017
appveyor.yml AppVeyor CI: minor tweaks to improve dashboard clarity Dec 15, 2018
package-lock.json Migrate from TSLint to ESLint Jan 8, 2020
package.json Migrate from TSLint to ESLint Jan 8, 2020
webpack.config.js Use webpack to create the bundle. Oct 28, 2015

README.md

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.

You can’t perform that action at this time.