|
1 | 1 | # Acorn |
2 | 2 |
|
3 | | -[](https://travis-ci.org/ternjs/acorn) |
| 3 | +[](https://travis-ci.org/acornjs/acorn) |
4 | 4 | [](https://www.npmjs.com/package/acorn) |
5 | 5 | [](https://cdnjs.com/libraries/acorn) |
6 | 6 | [Author funding status: ](https://marijnhaverbeke.nl/fund/) |
@@ -10,11 +10,11 @@ A tiny, fast JavaScript parser, written completely in JavaScript. |
10 | 10 | ## Community |
11 | 11 |
|
12 | 12 | Acorn is open source software released under an |
13 | | -[MIT license](https://github.com/ternjs/acorn/blob/master/LICENSE). |
| 13 | +[MIT license](https://github.com/acornjs/acorn/blob/master/LICENSE). |
14 | 14 |
|
15 | 15 | You are welcome to |
16 | | -[report bugs](https://github.com/ternjs/acorn/issues) or create pull |
17 | | -requests on [github](https://github.com/ternjs/acorn). For questions |
| 16 | +[report bugs](https://github.com/acornjs/acorn/issues) or create pull |
| 17 | +requests on [github](https://github.com/acornjs/acorn). For questions |
18 | 18 | and discussion, please use the |
19 | 19 | [Tern discussion forum](https://discuss.ternjs.net). |
20 | 20 |
|
@@ -28,10 +28,13 @@ The easiest way to install acorn is with [`npm`][npm]. |
28 | 28 | npm install acorn |
29 | 29 | ``` |
30 | 30 |
|
31 | | -Alternately, download the source. |
| 31 | +Alternately, you can download the source and build acorn yourself: |
32 | 32 |
|
33 | 33 | ```sh |
34 | | -git clone https://github.com/ternjs/acorn.git |
| 34 | +git clone https://github.com/acornjs/acorn.git |
| 35 | +cd acorn |
| 36 | +npm install |
| 37 | +npm run build |
35 | 38 | ``` |
36 | 39 |
|
37 | 40 | ## Components |
@@ -63,7 +66,7 @@ object referring to that same position. |
63 | 66 | [estree]: https://github.com/estree/estree |
64 | 67 |
|
65 | 68 | - **ecmaVersion**: Indicates the ECMAScript version to parse. Must be |
66 | | - either 3, 5, 6 (2015), 7 (2016), 8 (2017), or 9 (2018, partial |
| 69 | + either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018) or 10 (2019, partial |
67 | 70 | support). This influences support for strict mode, the set of |
68 | 71 | reserved words, and support for new syntax features. Default is 7. |
69 | 72 |
|
@@ -97,6 +100,8 @@ object referring to that same position. |
97 | 100 | declarations can only appear at a program's top level. Setting this |
98 | 101 | option to `true` allows them anywhere where a statement is allowed. |
99 | 102 |
|
| 103 | +- **allowAwaitOutsideFunction**: By default, `await` expressions can only appear inside `async` functions. Setting this option to `true` allows to have top-level `await` expressions. They are still not allowed in non-`async` functions, though. |
| 104 | + |
100 | 105 | - **allowHashBang**: When this is enabled (off by default), if the |
101 | 106 | code starts with the characters `#!` (as in a shellscript), the |
102 | 107 | first line will be treated as a comment. |
@@ -351,7 +356,7 @@ The `bin/acorn` utility can be used to parse a file from the command |
351 | 356 | line. It accepts as arguments its input file and the following |
352 | 357 | options: |
353 | 358 |
|
354 | | -- `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9`: Sets the ECMAScript version |
| 359 | +- `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|--ecma10`: Sets the ECMAScript version |
355 | 360 | to parse. Default is version 7. |
356 | 361 |
|
357 | 362 | - `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise. |
@@ -443,10 +448,20 @@ looseParser.extend("readToken", function(nextMethod) { |
443 | 448 | ### Existing plugins |
444 | 449 |
|
445 | 450 | - [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx) |
446 | | - - [`acorn-es7-plugin`](https://github.com/MatAtBread/acorn-es7-plugin/): Parse [async/await syntax proposal](https://github.com/tc39/ecmascript-asyncawait) |
447 | | - - [`acorn-object-spread`](https://github.com/UXtemple/acorn-object-spread): Parse [object spread syntax proposal](https://github.com/sebmarkbage/ecmascript-rest-spread) |
448 | | - - [`acorn-es7`](https://www.npmjs.com/package/acorn-es7): Parse [decorator syntax proposal](https://github.com/wycats/javascript-decorators) |
449 | | - - [`acorn-objj`](https://www.npmjs.com/package/acorn-objj): [Objective-J](http://www.cappuccino-project.org/learn/objective-j.html) language parser built as Acorn plugin |
450 | | - - [`acorn-object-rest-spread`](https://github.com/victor-homyakov/acorn-object-rest-spread) Parse [Object Rest/Spread Properties proposal](https://github.com/tc39/proposal-object-rest-spread), works with latest Acorn version (5.0.3) |
451 | | - - [`acorn-static-class-property-initializer`](https://github.com/victor-homyakov/acorn-static-class-property-initializer) Partial support for static class properties from [ES Class Fields & Static Properties Proposal](https://github.com/tc39/proposal-class-public-fields) to support static property initializers in [React components written as ES6+ classes](https://babeljs.io/blog/2015/06/07/react-on-es6-plus) |
| 451 | + - [`acorn-objj`](https://github.com/cappuccino/acorn-objj): [Objective-J](http://www.cappuccino-project.org/learn/objective-j.html) language parser built as Acorn plugin |
452 | 452 |
|
| 453 | + Plugins for ECMAScript proposals: |
| 454 | + |
| 455 | + - [`acorn-stage3`](https://github.com/acornjs/acorn-stage3): Parse most stage 3 proposals, bundling: |
| 456 | + - [`acorn-async-iteration`](https://github.com/acornjs/acorn-async-iteration): Parse [async iteration proposal](https://github.com/tc39/proposal-async-iteration) |
| 457 | + - [`acorn-bigint`](https://github.com/acornjs/acorn-bigint): Parse [BigInt proposal](https://github.com/tc39/proposal-bigint) |
| 458 | + - [`acorn-class-fields`](https://github.com/acornjs/acorn-class-fields): Parse [class fields proposal](https://github.com/tc39/proposal-class-fields) |
| 459 | + - [`acorn-dynamic-import`](https://github.com/kesne/acorn-dynamic-import): Parse [import() proposal](https://github.com/tc39/proposal-dynamic-import) |
| 460 | + - [`acorn-import-meta`](https://github.com/acornjs/acorn-import-meta): Parse [import.meta proposal](https://github.com/tc39/proposal-import-meta) |
| 461 | + - [`acorn-numeric-separator`](https://github.com/acornjs/acorn-numeric-separator): Parse [numeric separator proposal](https://github.com/tc39/proposal-numeric-separator) |
| 462 | + - [`acorn-optional-catch-binding`](https://github.com/acornjs/acorn-optional-catch-binding): Parse [optional catch binding proposal](https://github.com/tc39/proposal-optional-catch-binding) |
| 463 | + - [`acorn-private-methods`](https://github.com/acornjs/acorn-private-methods): parse [private methods, getters and setters proposal](https://github.com/tc39/proposal-private-methods) |
| 464 | + - [`acorn5-object-spread`](https://github.com/adrianheine/acorn5-object-spread): Parse [Object Rest/Spread Properties proposal](https://github.com/tc39/proposal-object-rest-spread) |
| 465 | + - [`acorn-object-rest-spread`](https://github.com/victor-homyakov/acorn-object-rest-spread): Parse [Object Rest/Spread Properties proposal](https://github.com/tc39/proposal-object-rest-spread) |
| 466 | + - [`acorn-es7`](https://github.com/angelozerr/acorn-es7): Parse [decorator syntax proposal](https://github.com/wycats/javascript-decorators) |
| 467 | + - [`acorn-static-class-property-initializer`](https://github.com/victor-homyakov/acorn-static-class-property-initializer): Partial support for static class properties from [ES Class Fields & Static Properties Proposal](https://github.com/tc39/proposal-class-public-fields) to support static property initializers in [React components written as ES6+ classes](https://babeljs.io/blog/2015/06/07/react-on-es6-plus) |