aboutsummaryrefslogtreecommitdiff
path: root/node_modules/esprima/README.md
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-05-27 17:36:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-05-27 17:36:13 +0200
commit5f466137ad6ac596600e3ff53c9b786815398445 (patch)
treef914c221874f0b16bf3def7ac01d59d1a99a3b0b /node_modules/esprima/README.md
parentc9f5ac8e763eda19aa0564179300cfff76785435 (diff)
node_modules, clean up package.json
Diffstat (limited to 'node_modules/esprima/README.md')
-rw-r--r--node_modules/esprima/README.md35
1 files changed, 26 insertions, 9 deletions
diff --git a/node_modules/esprima/README.md b/node_modules/esprima/README.md
index 749454f44..e59d08333 100644
--- a/node_modules/esprima/README.md
+++ b/node_modules/esprima/README.md
@@ -12,16 +12,33 @@ with the help of [many contributors](https://github.com/jquery/esprima/contribut
### Features
-- Full support for ECMAScript 6 ([ECMA-262](http://www.ecma-international.org/publications/standards/Ecma-262.htm))
-- Sensible [syntax tree format](https://github.com/estree/estree/blob/master/spec.md) as standardized by [ESTree project](https://github.com/estree/estree)
+- Full support for ECMAScript 2016 ([ECMA-262 7th Edition](http://www.ecma-international.org/publications/standards/Ecma-262.htm))
+- Sensible [syntax tree format](https://github.com/estree/estree/blob/master/es5.md) as standardized by [ESTree project](https://github.com/estree/estree)
+- Experimental support for [JSX](https://facebook.github.io/jsx/), a syntax extension for [React](https://facebook.github.io/react/)
- Optional tracking of syntax node location (index-based and line-column)
-- [Heavily tested](http://esprima.org/test/ci.html) (~1250 [unit tests](https://github.com/jquery/esprima/tree/master/test/fixtures) with [full code coverage](https://codecov.io/github/jquery/esprima))
+- [Heavily tested](http://esprima.org/test/ci.html) (~1300 [unit tests](https://github.com/jquery/esprima/tree/master/test/fixtures) with [full code coverage](https://codecov.io/github/jquery/esprima))
-Esprima serves as a **building block** for some JavaScript
-language tools, from [code instrumentation](http://esprima.org/demo/functiontrace.html)
-to [editor autocompletion](http://esprima.org/demo/autocomplete.html).
+### API
-Esprima runs on many popular web browsers, as well as other ECMAScript platforms such as
-[Rhino](http://www.mozilla.org/rhino), [Nashorn](http://openjdk.java.net/projects/nashorn/), and [Node.js](https://npmjs.org/package/esprima).
+Esprima can be used to perform [lexical analysis](https://en.wikipedia.org/wiki/Lexical_analysis) (tokenization) or [syntactic analysis](https://en.wikipedia.org/wiki/Parsing) (parsing) of a JavaScript program.
-For more information, check the web site [esprima.org](http://esprima.org).
+A simple example on Node.js REPL:
+
+```javascript
+> 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' }
+```