Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: upgrade acorn to support two ES2019 syntax #380

Merged
merged 3 commits into from
Jun 4, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ var ast = espree.parse(code, {
// create a top-level tokens array containing all tokens
tokens: false,

// Set to 3, 5 (default), 6, 7, 8, or 9 to specify the version of ECMAScript syntax you want to use.
// You can also set to 2015 (same as 6), 2016 (same as 7), 2017 (same as 8), or 2018 (same as 9) to use the year-based naming.
// Set to 3, 5 (default), 6, 7, 8, 9, or 10 to specify the version of ECMAScript syntax you want to use.
// You can also set to 2015 (same as 6), 2016 (same as 7), 2017 (same as 8), 2018 (same as 9), or 2019 (same as 10) to use the year-based naming.
ecmaVersion: 5,

// specify which type of script you're parsing ("script" or "module")
Expand Down Expand Up @@ -143,11 +143,24 @@ There are two ECMAScript 2017 syntax changes: `async` functions, and trailing co

### What ECMAScript 2018 features do you support?

Because ECMAScript 2018 is still under development, we are implementing features as they are finalized. Currently, Espree supports:
There are seven ECMAScript 2017 syntax changes:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This says 2017 but the header above says 2018. Typo?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ops, yes, it's typo. Thank you.


* Invalid escape sequences in tagged template literals
* Rest/spread properties
* Async Iteration
* Async iteration
* RegExp `s` flag
* RegExp named capture groups
* RegExp lookhehind assersions
* RegExp unicode property escapes

Espree supports all of them.

### What ECMAScript 2019 features do you support?

Because ECMAScript 2019 is still under development, we are implementing features as they are finalized. Currently, Espree supports:

* Optional `catch` binding
* JSON superset (`\u2028` and `\u2029` in string literals)

### How do you determine which experimental features to support?

Expand Down
1 change: 1 addition & 0 deletions espree.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ function normalizeEcmaVersion(ecmaVersion) {
case 7:
case 8:
case 9:
case 10:
return version;

default:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"license": "BSD-2-Clause",
"dependencies": {
"acorn": "^5.5.1",
"acorn": "^5.6.0",
"acorn-jsx": "^4.1.1"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
"index": 8,
"lineNumber": 1,
"column": 9,
"message": "Unterminated string constant"
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var s = "
"
168 changes: 168 additions & 0 deletions tests/fixtures/ecma-version/10/json-superset/valid-2028.result.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
module.exports = {
"type": "Program",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 11
}
},
"range": [
0,
11
],
"body": [
{
"type": "VariableDeclaration",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 11
}
},
"range": [
0,
11
],
"declarations": [
{
"type": "VariableDeclarator",
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 11
}
},
"range": [
4,
11
],
"id": {
"type": "Identifier",
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 5
}
},
"range": [
4,
5
],
"name": "s"
},
"init": {
"type": "Literal",
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 11
}
},
"range": [
8,
11
],
"value": "\u2028",
"raw": "\"\u2028\""
}
}
],
"kind": "var"
}
],
"sourceType": "script",
"tokens": [
{
"type": "Keyword",
"value": "var",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 3
}
},
"range": [
0,
3
]
},
{
"type": "Identifier",
"value": "s",
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 5
}
},
"range": [
4,
5
]
},
{
"type": "Punctuator",
"value": "=",
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 7
}
},
"range": [
6,
7
]
},
{
"type": "String",
"value": "\"\u2028\"",
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 11
}
},
"range": [
8,
11
]
}
]
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var s = "
"