From 7d6a029e53c35b160d44a1ca810c36b83a530400 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Wed, 12 Oct 2016 16:38:26 +0200 Subject: [PATCH] Slightly better error messages (#150) * Slightly better errors Instead of "Unexpected token" we now print "Unexpected token, expected " --- src/parser/util.js | 2 +- .../core/uncategorised/378/options.json | 2 +- .../core/uncategorised/392/options.json | 4 +- .../core/uncategorised/393/options.json | 4 +- .../core/uncategorised/394/options.json | 4 +- .../core/uncategorised/396/options.json | 4 +- .../core/uncategorised/406/options.json | 4 +- .../core/uncategorised/415/options.json | 4 +- .../core/uncategorised/416/options.json | 4 +- .../core/uncategorised/458/options.json | 4 +- .../es2015/uncategorised/109/expected.json | 196 ------------------ .../es2015/uncategorised/109/options.json | 2 +- .../es2015/uncategorised/235/options.json | 4 +- .../es2015/uncategorised/236/options.json | 4 +- .../es2015/uncategorised/255/options.json | 4 +- .../es2015/uncategorised/261/options.json | 4 +- .../es2015/uncategorised/262/options.json | 4 +- .../es2015/uncategorised/265/options.json | 4 +- .../es2015/uncategorised/266/options.json | 4 +- .../es2015/uncategorised/267/options.json | 4 +- .../es2015/uncategorised/268/options.json | 4 +- .../es2015/uncategorised/277/options.json | 4 +- .../es2015/uncategorised/278/options.json | 4 +- .../es2015/uncategorised/283/options.json | 4 +- .../es2015/uncategorised/340/options.json | 4 +- .../es2015/uncategorised/341/options.json | 4 +- .../es2015/uncategorised/342/options.json | 4 +- .../es2015/uncategorised/96/options.json | 4 +- .../es2017/async-functions/4/options.json | 2 +- .../es2017/async-functions/5/options.json | 2 +- .../options.json | 4 +- .../arrow-rest-forgetting-comma/options.json | 4 +- .../arrow-with-multiple-rest/options.json | 4 +- .../invalid-const-init/options.json | 4 +- .../invalid-let-init/options.json | 4 +- .../invalid-var-init/expected.json | 146 ------------- .../invalid-var-init/options.json | 2 +- .../options.json | 4 +- .../invalid-import-default/options.json | 4 +- .../invalid-import-specifiers/options.json | 4 +- .../invalid_const_forin/options.json | 4 +- .../invalid_let_forin/options.json | 4 +- .../after-switch/options.json | 4 +- .../unclosed-interpolation/options.json | 4 +- .../unclosed-nested/options.json | 4 +- .../options.json | 4 +- .../invalid-syntax/migrated_0060/options.json | 4 +- .../invalid-syntax/migrated_0076/options.json | 4 +- .../invalid-syntax/migrated_0077/options.json | 4 +- .../invalid-syntax/migrated_0078/options.json | 4 +- .../invalid-syntax/migrated_0080/options.json | 4 +- .../invalid-syntax/migrated_0081/options.json | 4 +- .../invalid-syntax/migrated_0102/options.json | 4 +- .../invalid-syntax/migrated_0113/options.json | 4 +- .../invalid-syntax/migrated_0123/options.json | 4 +- .../invalid-syntax/migrated_0124/options.json | 4 +- .../invalid-syntax/migrated_0135/options.json | 4 +- .../invalid-syntax/migrated_0175/options.json | 4 +- .../invalid-syntax/migrated_0258/options.json | 4 +- .../invalid-syntax/migrated_0260/options.json | 4 +- .../invalid-syntax/migrated_0264/options.json | 4 +- .../invalid-syntax/migrated_0265/options.json | 4 +- .../invalid-syntax/migrated_0267/options.json | 4 +- .../invalid-syntax/migrated_0268/options.json | 4 +- .../invalid-syntax/migrated_0275/options.json | 4 +- .../invalid-syntax/migrated_0276/options.json | 4 +- .../for-await-async-context/options.json | 2 +- .../illegal-generator/options.json | 2 +- .../illegal-key/options.json | 2 +- .../inside-function/options.json | 2 +- .../flow/optional-type/5/options.json | 2 +- 71 files changed, 127 insertions(+), 469 deletions(-) delete mode 100644 test/fixtures/es2015/uncategorised/109/expected.json delete mode 100644 test/fixtures/esprima/es2015-for-of/invalid-var-init/expected.json diff --git a/src/parser/util.js b/src/parser/util.js index e02483ced5..e5e0a7543b 100644 --- a/src/parser/util.js +++ b/src/parser/util.js @@ -74,7 +74,7 @@ pp.semicolon = function () { // raise an unexpected token error at given pos. pp.expect = function (type, pos) { - return this.eat(type) || this.unexpected(pos); + return this.eat(type) || this.unexpected(pos, `Unexpected token, expected ${type.label}`); }; // Raise an unexpected token error. diff --git a/test/fixtures/core/uncategorised/378/options.json b/test/fixtures/core/uncategorised/378/options.json index 2a28555f76..7108735927 100644 --- a/test/fixtures/core/uncategorised/378/options.json +++ b/test/fixtures/core/uncategorised/378/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:9)" + "throws": "Unexpected token, expected , (1:9)" } diff --git a/test/fixtures/core/uncategorised/392/options.json b/test/fixtures/core/uncategorised/392/options.json index 358068a16a..dc6c506c56 100644 --- a/test/fixtures/core/uncategorised/392/options.json +++ b/test/fixtures/core/uncategorised/392/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:12)" -} \ No newline at end of file + "throws": "Unexpected token, expected , (1:12)" +} diff --git a/test/fixtures/core/uncategorised/393/options.json b/test/fixtures/core/uncategorised/393/options.json index 89e36d9013..45be50db28 100644 --- a/test/fixtures/core/uncategorised/393/options.json +++ b/test/fixtures/core/uncategorised/393/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:16)" -} \ No newline at end of file + "throws": "Unexpected token, expected , (1:16)" +} diff --git a/test/fixtures/core/uncategorised/394/options.json b/test/fixtures/core/uncategorised/394/options.json index 27f6e27de8..b4fa97e066 100644 --- a/test/fixtures/core/uncategorised/394/options.json +++ b/test/fixtures/core/uncategorised/394/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:13)" -} \ No newline at end of file + "throws": "Unexpected token, expected , (1:13)" +} diff --git a/test/fixtures/core/uncategorised/396/options.json b/test/fixtures/core/uncategorised/396/options.json index 2a73699bc2..250152cb4a 100644 --- a/test/fixtures/core/uncategorised/396/options.json +++ b/test/fixtures/core/uncategorised/396/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:18)" -} \ No newline at end of file + "throws": "Unexpected token, expected ) (1:18)" +} diff --git a/test/fixtures/core/uncategorised/406/options.json b/test/fixtures/core/uncategorised/406/options.json index e68fbb6aec..2dba4c2a3f 100644 --- a/test/fixtures/core/uncategorised/406/options.json +++ b/test/fixtures/core/uncategorised/406/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:2)" -} \ No newline at end of file + "throws": "Unexpected token, expected ( (1:2)" +} diff --git a/test/fixtures/core/uncategorised/415/options.json b/test/fixtures/core/uncategorised/415/options.json index 7ca1e1ffbb..8d1350f444 100644 --- a/test/fixtures/core/uncategorised/415/options.json +++ b/test/fixtures/core/uncategorised/415/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:15)" -} \ No newline at end of file + "throws": "Unexpected token, expected ; (1:15)" +} diff --git a/test/fixtures/core/uncategorised/416/options.json b/test/fixtures/core/uncategorised/416/options.json index 51c483f3d3..111afcd69d 100644 --- a/test/fixtures/core/uncategorised/416/options.json +++ b/test/fixtures/core/uncategorised/416/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:14)" -} \ No newline at end of file + "throws": "Unexpected token, expected ; (1:14)" +} diff --git a/test/fixtures/core/uncategorised/458/options.json b/test/fixtures/core/uncategorised/458/options.json index 93db7641c7..6537cfcefe 100644 --- a/test/fixtures/core/uncategorised/458/options.json +++ b/test/fixtures/core/uncategorised/458/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:9)" -} \ No newline at end of file + "throws": "Unexpected token, expected while (1:9)" +} diff --git a/test/fixtures/es2015/uncategorised/109/expected.json b/test/fixtures/es2015/uncategorised/109/expected.json deleted file mode 100644 index 5d28065a98..0000000000 --- a/test/fixtures/es2015/uncategorised/109/expected.json +++ /dev/null @@ -1,196 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ForOfStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "left": { - "type": "VariableDeclaration", - "start": 5, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "id": { - "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "x" - }, - "init": { - "type": "Literal", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "value": 42, - "rawValue": 42, - "raw": "42" - } - } - ], - "kind": "var" - }, - "right": { - "type": "Identifier", - "start": 19, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "name": "list" - }, - "body": { - "type": "ExpressionStatement", - "start": 25, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "expression": { - "type": "CallExpression", - "start": 25, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "callee": { - "type": "Identifier", - "start": 25, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "name": "process" - }, - "arguments": [ - { - "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "name": "x" - } - ] - } - } - } - ] - }, - "comments": [] -} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/109/options.json b/test/fixtures/es2015/uncategorised/109/options.json index 4c07f39d17..78b5260e46 100644 --- a/test/fixtures/es2015/uncategorised/109/options.json +++ b/test/fixtures/es2015/uncategorised/109/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:16)" + "throws": "Unexpected token, expected ; (1:16)" } diff --git a/test/fixtures/es2015/uncategorised/235/options.json b/test/fixtures/es2015/uncategorised/235/options.json index 89e36d9013..78b5260e46 100644 --- a/test/fixtures/es2015/uncategorised/235/options.json +++ b/test/fixtures/es2015/uncategorised/235/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:16)" -} \ No newline at end of file + "throws": "Unexpected token, expected ; (1:16)" +} diff --git a/test/fixtures/es2015/uncategorised/236/options.json b/test/fixtures/es2015/uncategorised/236/options.json index 89e36d9013..78b5260e46 100644 --- a/test/fixtures/es2015/uncategorised/236/options.json +++ b/test/fixtures/es2015/uncategorised/236/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:16)" -} \ No newline at end of file + "throws": "Unexpected token, expected ; (1:16)" +} diff --git a/test/fixtures/es2015/uncategorised/255/options.json b/test/fixtures/es2015/uncategorised/255/options.json index 93db7641c7..54ccd45c8e 100644 --- a/test/fixtures/es2015/uncategorised/255/options.json +++ b/test/fixtures/es2015/uncategorised/255/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:9)" -} \ No newline at end of file + "throws": "Unexpected token, expected ] (1:9)" +} diff --git a/test/fixtures/es2015/uncategorised/261/options.json b/test/fixtures/es2015/uncategorised/261/options.json index 8bb9a5f99b..8cdb36e2c9 100644 --- a/test/fixtures/es2015/uncategorised/261/options.json +++ b/test/fixtures/es2015/uncategorised/261/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:17)" -} \ No newline at end of file + "throws": "Unexpected token, expected ( (1:17)" +} diff --git a/test/fixtures/es2015/uncategorised/262/options.json b/test/fixtures/es2015/uncategorised/262/options.json index b23f881870..a511d2a1e5 100644 --- a/test/fixtures/es2015/uncategorised/262/options.json +++ b/test/fixtures/es2015/uncategorised/262/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:22)" -} \ No newline at end of file + "throws": "Unexpected token, expected { (1:22)" +} diff --git a/test/fixtures/es2015/uncategorised/265/options.json b/test/fixtures/es2015/uncategorised/265/options.json index 167116741e..9eb092a66e 100644 --- a/test/fixtures/es2015/uncategorised/265/options.json +++ b/test/fixtures/es2015/uncategorised/265/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:7)" -} \ No newline at end of file + "throws": "Unexpected token, expected ( (1:7)" +} diff --git a/test/fixtures/es2015/uncategorised/266/options.json b/test/fixtures/es2015/uncategorised/266/options.json index 2a73699bc2..c73cd9d2d3 100644 --- a/test/fixtures/es2015/uncategorised/266/options.json +++ b/test/fixtures/es2015/uncategorised/266/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:18)" -} \ No newline at end of file + "throws": "Unexpected token, expected } (1:18)" +} diff --git a/test/fixtures/es2015/uncategorised/267/options.json b/test/fixtures/es2015/uncategorised/267/options.json index 3e33f7730f..bc0f5f279a 100644 --- a/test/fixtures/es2015/uncategorised/267/options.json +++ b/test/fixtures/es2015/uncategorised/267/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:11)" -} \ No newline at end of file + "throws": "Unexpected token, expected } (1:11)" +} diff --git a/test/fixtures/es2015/uncategorised/268/options.json b/test/fixtures/es2015/uncategorised/268/options.json index 27f6e27de8..ad9ebae1d3 100644 --- a/test/fixtures/es2015/uncategorised/268/options.json +++ b/test/fixtures/es2015/uncategorised/268/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:13)" -} \ No newline at end of file + "throws": "Unexpected token, expected { (1:13)" +} diff --git a/test/fixtures/es2015/uncategorised/277/options.json b/test/fixtures/es2015/uncategorised/277/options.json index 2a73699bc2..250152cb4a 100644 --- a/test/fixtures/es2015/uncategorised/277/options.json +++ b/test/fixtures/es2015/uncategorised/277/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:18)" -} \ No newline at end of file + "throws": "Unexpected token, expected ) (1:18)" +} diff --git a/test/fixtures/es2015/uncategorised/278/options.json b/test/fixtures/es2015/uncategorised/278/options.json index 1e730e1707..c6f6873705 100644 --- a/test/fixtures/es2015/uncategorised/278/options.json +++ b/test/fixtures/es2015/uncategorised/278/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:19)" -} \ No newline at end of file + "throws": "Unexpected token, expected ) (1:19)" +} diff --git a/test/fixtures/es2015/uncategorised/283/options.json b/test/fixtures/es2015/uncategorised/283/options.json index 0ab445fe47..acb6f5594c 100644 --- a/test/fixtures/es2015/uncategorised/283/options.json +++ b/test/fixtures/es2015/uncategorised/283/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:5)" -} \ No newline at end of file + "throws": "Unexpected token, expected ) (1:5)" +} diff --git a/test/fixtures/es2015/uncategorised/340/options.json b/test/fixtures/es2015/uncategorised/340/options.json index 7ca1e1ffbb..d38440a945 100644 --- a/test/fixtures/es2015/uncategorised/340/options.json +++ b/test/fixtures/es2015/uncategorised/340/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:15)" -} \ No newline at end of file + "throws": "Unexpected token, expected { (1:15)" +} diff --git a/test/fixtures/es2015/uncategorised/341/options.json b/test/fixtures/es2015/uncategorised/341/options.json index 1e730e1707..62c2636574 100644 --- a/test/fixtures/es2015/uncategorised/341/options.json +++ b/test/fixtures/es2015/uncategorised/341/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:19)" -} \ No newline at end of file + "throws": "Unexpected token, expected { (1:19)" +} diff --git a/test/fixtures/es2015/uncategorised/342/options.json b/test/fixtures/es2015/uncategorised/342/options.json index b23f881870..a511d2a1e5 100644 --- a/test/fixtures/es2015/uncategorised/342/options.json +++ b/test/fixtures/es2015/uncategorised/342/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:22)" -} \ No newline at end of file + "throws": "Unexpected token, expected { (1:22)" +} diff --git a/test/fixtures/es2015/uncategorised/96/options.json b/test/fixtures/es2015/uncategorised/96/options.json index 273b17c8d8..c09368b80c 100644 --- a/test/fixtures/es2015/uncategorised/96/options.json +++ b/test/fixtures/es2015/uncategorised/96/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "Unexpected token (1:7)" -} \ No newline at end of file + "throws": "Unexpected token, expected { (1:7)" +} diff --git a/test/fixtures/es2017/async-functions/4/options.json b/test/fixtures/es2017/async-functions/4/options.json index cb6c66081e..609492567c 100644 --- a/test/fixtures/es2017/async-functions/4/options.json +++ b/test/fixtures/es2017/async-functions/4/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:11)" + "throws": "Unexpected token, expected ( (1:11)" } diff --git a/test/fixtures/es2017/async-functions/5/options.json b/test/fixtures/es2017/async-functions/5/options.json index 89bfc2d73f..021ac49e5f 100644 --- a/test/fixtures/es2017/async-functions/5/options.json +++ b/test/fixtures/es2017/async-functions/5/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:10)" + "throws": "Unexpected token, expected ( (1:10)" } diff --git a/test/fixtures/esprima/es2015-array-pattern/with-default-catch-param-fail/options.json b/test/fixtures/esprima/es2015-array-pattern/with-default-catch-param-fail/options.json index 1e730e1707..c6f6873705 100644 --- a/test/fixtures/esprima/es2015-array-pattern/with-default-catch-param-fail/options.json +++ b/test/fixtures/esprima/es2015-array-pattern/with-default-catch-param-fail/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:19)" -} \ No newline at end of file + "throws": "Unexpected token, expected ) (1:19)" +} diff --git a/test/fixtures/esprima/es2015-arrow-function/arrow-rest-forgetting-comma/options.json b/test/fixtures/esprima/es2015-arrow-function/arrow-rest-forgetting-comma/options.json index 3b5e811628..dcb6ad70e7 100644 --- a/test/fixtures/esprima/es2015-arrow-function/arrow-rest-forgetting-comma/options.json +++ b/test/fixtures/esprima/es2015-arrow-function/arrow-rest-forgetting-comma/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:3)" -} \ No newline at end of file + "throws": "Unexpected token, expected , (1:3)" +} diff --git a/test/fixtures/esprima/es2015-arrow-function/arrow-with-multiple-rest/options.json b/test/fixtures/esprima/es2015-arrow-function/arrow-with-multiple-rest/options.json index 0ab445fe47..acb6f5594c 100644 --- a/test/fixtures/esprima/es2015-arrow-function/arrow-with-multiple-rest/options.json +++ b/test/fixtures/esprima/es2015-arrow-function/arrow-with-multiple-rest/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:5)" -} \ No newline at end of file + "throws": "Unexpected token, expected ) (1:5)" +} diff --git a/test/fixtures/esprima/es2015-for-of/invalid-const-init/options.json b/test/fixtures/esprima/es2015-for-of/invalid-const-init/options.json index 8bb9a5f99b..e20a42a75d 100644 --- a/test/fixtures/esprima/es2015-for-of/invalid-const-init/options.json +++ b/test/fixtures/esprima/es2015-for-of/invalid-const-init/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:17)" -} \ No newline at end of file + "throws": "Unexpected token, expected ; (1:17)" +} diff --git a/test/fixtures/esprima/es2015-for-of/invalid-let-init/options.json b/test/fixtures/esprima/es2015-for-of/invalid-let-init/options.json index 7ca1e1ffbb..8d1350f444 100644 --- a/test/fixtures/esprima/es2015-for-of/invalid-let-init/options.json +++ b/test/fixtures/esprima/es2015-for-of/invalid-let-init/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:15)" -} \ No newline at end of file + "throws": "Unexpected token, expected ; (1:15)" +} diff --git a/test/fixtures/esprima/es2015-for-of/invalid-var-init/expected.json b/test/fixtures/esprima/es2015-for-of/invalid-var-init/expected.json deleted file mode 100644 index eec137e3bc..0000000000 --- a/test/fixtures/esprima/es2015-for-of/invalid-var-init/expected.json +++ /dev/null @@ -1,146 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ForOfStatement", - "start": 0, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "left": { - "type": "VariableDeclaration", - "start": 5, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "id": { - "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "x" - }, - "init": { - "type": "Literal", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "value": 1, - "rawValue": 1, - "raw": "1" - } - } - ], - "kind": "var" - }, - "right": { - "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "name": "y" - }, - "body": { - "type": "EmptyStatement", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - } - ] - } -} \ No newline at end of file diff --git a/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json b/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json index 98d7123790..8d1350f444 100644 --- a/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json +++ b/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:15)" + "throws": "Unexpected token, expected ; (1:15)" } diff --git a/test/fixtures/esprima/es2015-generator/generator-method-with-invalid-computed-name/options.json b/test/fixtures/esprima/es2015-generator/generator-method-with-invalid-computed-name/options.json index 3e33f7730f..8930d32c83 100644 --- a/test/fixtures/esprima/es2015-generator/generator-method-with-invalid-computed-name/options.json +++ b/test/fixtures/esprima/es2015-generator/generator-method-with-invalid-computed-name/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:11)" -} \ No newline at end of file + "throws": "Unexpected token, expected ] (1:11)" +} diff --git a/test/fixtures/esprima/es2015-import-declaration/invalid-import-default/options.json b/test/fixtures/esprima/es2015-import-declaration/invalid-import-default/options.json index 167116741e..0f60871dea 100644 --- a/test/fixtures/esprima/es2015-import-declaration/invalid-import-default/options.json +++ b/test/fixtures/esprima/es2015-import-declaration/invalid-import-default/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:7)" -} \ No newline at end of file + "throws": "Unexpected token, expected { (1:7)" +} diff --git a/test/fixtures/esprima/es2015-import-declaration/invalid-import-specifiers/options.json b/test/fixtures/esprima/es2015-import-declaration/invalid-import-specifiers/options.json index 358068a16a..36098f8d76 100644 --- a/test/fixtures/esprima/es2015-import-declaration/invalid-import-specifiers/options.json +++ b/test/fixtures/esprima/es2015-import-declaration/invalid-import-specifiers/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:12)" -} \ No newline at end of file + "throws": "Unexpected token, expected { (1:12)" +} diff --git a/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/options.json b/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/options.json index 8bb9a5f99b..e20a42a75d 100644 --- a/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/options.json +++ b/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:17)" -} \ No newline at end of file + "throws": "Unexpected token, expected ; (1:17)" +} diff --git a/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/options.json b/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/options.json index 7ca1e1ffbb..8d1350f444 100644 --- a/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/options.json +++ b/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:15)" -} \ No newline at end of file + "throws": "Unexpected token, expected ; (1:15)" +} diff --git a/test/fixtures/esprima/es2015-template-literals/after-switch/options.json b/test/fixtures/esprima/es2015-template-literals/after-switch/options.json index 167116741e..9eb092a66e 100644 --- a/test/fixtures/esprima/es2015-template-literals/after-switch/options.json +++ b/test/fixtures/esprima/es2015-template-literals/after-switch/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:7)" -} \ No newline at end of file + "throws": "Unexpected token, expected ( (1:7)" +} diff --git a/test/fixtures/esprima/es2015-template-literals/unclosed-interpolation/options.json b/test/fixtures/esprima/es2015-template-literals/unclosed-interpolation/options.json index 3e33f7730f..bc0f5f279a 100644 --- a/test/fixtures/esprima/es2015-template-literals/unclosed-interpolation/options.json +++ b/test/fixtures/esprima/es2015-template-literals/unclosed-interpolation/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:11)" -} \ No newline at end of file + "throws": "Unexpected token, expected } (1:11)" +} diff --git a/test/fixtures/esprima/es2015-template-literals/unclosed-nested/options.json b/test/fixtures/esprima/es2015-template-literals/unclosed-nested/options.json index 2a73699bc2..c73cd9d2d3 100644 --- a/test/fixtures/esprima/es2015-template-literals/unclosed-nested/options.json +++ b/test/fixtures/esprima/es2015-template-literals/unclosed-nested/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:18)" -} \ No newline at end of file + "throws": "Unexpected token, expected } (1:18)" +} diff --git a/test/fixtures/esprima/es2015-yield/invalid-yield-binding-property/options.json b/test/fixtures/esprima/es2015-yield/invalid-yield-binding-property/options.json index 2a73699bc2..83778687af 100644 --- a/test/fixtures/esprima/es2015-yield/invalid-yield-binding-property/options.json +++ b/test/fixtures/esprima/es2015-yield/invalid-yield-binding-property/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:18)" -} \ No newline at end of file + "throws": "Unexpected token, expected , (1:18)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0060/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0060/options.json index 93db7641c7..7108735927 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0060/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0060/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:9)" -} \ No newline at end of file + "throws": "Unexpected token, expected , (1:9)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0076/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0076/options.json index 358068a16a..dc6c506c56 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0076/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0076/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:12)" -} \ No newline at end of file + "throws": "Unexpected token, expected , (1:12)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0077/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0077/options.json index 89e36d9013..45be50db28 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0077/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0077/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:16)" -} \ No newline at end of file + "throws": "Unexpected token, expected , (1:16)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0078/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0078/options.json index 27f6e27de8..b4fa97e066 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0078/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0078/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:13)" -} \ No newline at end of file + "throws": "Unexpected token, expected , (1:13)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0080/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0080/options.json index 9f7910a413..7a950670cf 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0080/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0080/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:4)" -} \ No newline at end of file + "throws": "Unexpected token, expected ] (1:4)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0081/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0081/options.json index 167116741e..1232a70433 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0081/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0081/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:7)" -} \ No newline at end of file + "throws": "Unexpected token, expected ] (1:7)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0102/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0102/options.json index 167116741e..c267d0d030 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0102/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0102/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:7)" -} \ No newline at end of file + "throws": "Unexpected token, expected , (1:7)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0113/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0113/options.json index e68fbb6aec..2dba4c2a3f 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0113/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0113/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:2)" -} \ No newline at end of file + "throws": "Unexpected token, expected ( (1:2)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0123/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0123/options.json index 7ca1e1ffbb..8d1350f444 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0123/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0123/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:15)" -} \ No newline at end of file + "throws": "Unexpected token, expected ; (1:15)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0124/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0124/options.json index 51c483f3d3..111afcd69d 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0124/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0124/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:14)" -} \ No newline at end of file + "throws": "Unexpected token, expected ; (1:14)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0135/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0135/options.json index aca079ee39..22648899c2 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0135/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0135/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:20)" -} \ No newline at end of file + "throws": "Unexpected token, expected ) (1:20)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0175/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0175/options.json index 93db7641c7..6537cfcefe 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0175/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0175/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:9)" -} \ No newline at end of file + "throws": "Unexpected token, expected while (1:9)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0258/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0258/options.json index 2a73699bc2..250152cb4a 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0258/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0258/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:18)" -} \ No newline at end of file + "throws": "Unexpected token, expected ) (1:18)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0260/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0260/options.json index 89e36d9013..a7e78a5f32 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0260/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0260/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:16)" -} \ No newline at end of file + "throws": "Unexpected token, expected ) (1:16)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0264/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0264/options.json index 2a73699bc2..86a28b44d5 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0264/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0264/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:18)" -} \ No newline at end of file + "throws": "Unexpected token, expected { (1:18)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0265/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0265/options.json index 167116741e..0f60871dea 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0265/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0265/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:7)" -} \ No newline at end of file + "throws": "Unexpected token, expected { (1:7)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0267/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0267/options.json index 167116741e..0f60871dea 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0267/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0267/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:7)" -} \ No newline at end of file + "throws": "Unexpected token, expected { (1:7)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0268/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0268/options.json index 328b1ddde8..021ac49e5f 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0268/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0268/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:10)" -} \ No newline at end of file + "throws": "Unexpected token, expected ( (1:10)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0275/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0275/options.json index 3e33f7730f..609492567c 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0275/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0275/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:11)" -} \ No newline at end of file + "throws": "Unexpected token, expected ( (1:11)" +} diff --git a/test/fixtures/esprima/invalid-syntax/migrated_0276/options.json b/test/fixtures/esprima/invalid-syntax/migrated_0276/options.json index 2ddc9e708f..cd71808039 100644 --- a/test/fixtures/esprima/invalid-syntax/migrated_0276/options.json +++ b/test/fixtures/esprima/invalid-syntax/migrated_0276/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:23)" -} \ No newline at end of file + "throws": "Unexpected token, expected ( (1:23)" +} diff --git a/test/fixtures/experimental/async-generators/for-await-async-context/options.json b/test/fixtures/experimental/async-generators/for-await-async-context/options.json index 9660494a29..be297ea04d 100644 --- a/test/fixtures/experimental/async-generators/for-await-async-context/options.json +++ b/test/fixtures/experimental/async-generators/for-await-async-context/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (2:6)" + "throws": "Unexpected token, expected ( (2:6)" } diff --git a/test/fixtures/experimental/class-constructor-call/illegal-generator/options.json b/test/fixtures/experimental/class-constructor-call/illegal-generator/options.json index ef2b7c682f..db35c194d3 100644 --- a/test/fixtures/experimental/class-constructor-call/illegal-generator/options.json +++ b/test/fixtures/experimental/class-constructor-call/illegal-generator/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (2:8)" + "throws": "Unexpected token, expected ( (2:8)" } diff --git a/test/fixtures/experimental/class-constructor-call/illegal-key/options.json b/test/fixtures/experimental/class-constructor-call/illegal-key/options.json index 4e84114247..606cbed9d9 100644 --- a/test/fixtures/experimental/class-constructor-call/illegal-key/options.json +++ b/test/fixtures/experimental/class-constructor-call/illegal-key/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (2:7)" + "throws": "Unexpected token, expected ( (2:7)" } diff --git a/test/fixtures/experimental/function-sent/inside-function/options.json b/test/fixtures/experimental/function-sent/inside-function/options.json index 43a82ec8a1..6127ef0bfb 100644 --- a/test/fixtures/experimental/function-sent/inside-function/options.json +++ b/test/fixtures/experimental/function-sent/inside-function/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (2:17)" + "throws": "Unexpected token, expected ( (2:17)" } diff --git a/test/fixtures/flow/optional-type/5/options.json b/test/fixtures/flow/optional-type/5/options.json index 157ebff900..4ec7dabecb 100644 --- a/test/fixtures/flow/optional-type/5/options.json +++ b/test/fixtures/flow/optional-type/5/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:65)" + "throws": "Unexpected token, expected , (1:65)" }