From 2f349012ebd94c114572225a1b01f05a52f56168 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Thu, 28 Sep 2017 11:08:03 -0400 Subject: [PATCH] Fix NumericLiteralSeparator SyntaxError message to match V8 --- src/tokenizer/index.js | 2 +- .../experimental/numeric-separator/invalid-0/options.json | 2 +- .../experimental/numeric-separator/invalid-1/options.json | 2 +- .../experimental/numeric-separator/invalid-10/options.json | 2 +- .../experimental/numeric-separator/invalid-11/options.json | 2 +- .../experimental/numeric-separator/invalid-12/options.json | 2 +- .../experimental/numeric-separator/invalid-13/options.json | 2 +- .../experimental/numeric-separator/invalid-14/options.json | 2 +- .../experimental/numeric-separator/invalid-15/options.json | 2 +- .../experimental/numeric-separator/invalid-16/options.json | 2 +- .../experimental/numeric-separator/invalid-17/options.json | 2 +- .../experimental/numeric-separator/invalid-18/options.json | 2 +- .../experimental/numeric-separator/invalid-19/options.json | 2 +- .../experimental/numeric-separator/invalid-2/options.json | 2 +- .../experimental/numeric-separator/invalid-20/options.json | 2 +- .../experimental/numeric-separator/invalid-21/options.json | 2 +- .../experimental/numeric-separator/invalid-22/options.json | 2 +- .../experimental/numeric-separator/invalid-23/options.json | 2 +- .../experimental/numeric-separator/invalid-3/options.json | 2 +- .../experimental/numeric-separator/invalid-4/options.json | 2 +- .../experimental/numeric-separator/invalid-5/options.json | 2 +- .../experimental/numeric-separator/invalid-6/options.json | 2 +- .../experimental/numeric-separator/invalid-7/options.json | 2 +- .../experimental/numeric-separator/invalid-8/options.json | 2 +- .../experimental/numeric-separator/invalid-9/options.json | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/tokenizer/index.js b/src/tokenizer/index.js index aa0058e2f3..ff8ce58e15 100644 --- a/src/tokenizer/index.js +++ b/src/tokenizer/index.js @@ -733,7 +733,7 @@ export default class Tokenizer extends LocationParser { forbiddenSiblings.indexOf(next) > -1 || Number.isNaN(next) ) { - this.raise(this.state.pos, "Invalid NumericLiteralSeparator"); + this.raise(this.state.pos, "Invalid or unexpected token"); } // Ignore this _ character diff --git a/test/fixtures/experimental/numeric-separator/invalid-0/options.json b/test/fixtures/experimental/numeric-separator/invalid-0/options.json index 98f3821203..27e4acfa8f 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-0/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-0/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:1)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-1/options.json b/test/fixtures/experimental/numeric-separator/invalid-1/options.json index 38a0b25968..477511a878 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-1/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-1/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:3)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-10/options.json b/test/fixtures/experimental/numeric-separator/invalid-10/options.json index c338d94e7c..a65e1ff322 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-10/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-10/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:5)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-11/options.json b/test/fixtures/experimental/numeric-separator/invalid-11/options.json index c338d94e7c..a65e1ff322 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-11/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-11/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:5)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-12/options.json b/test/fixtures/experimental/numeric-separator/invalid-12/options.json index 3a8821e671..8cb6bf4866 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-12/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-12/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:2)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-13/options.json b/test/fixtures/experimental/numeric-separator/invalid-13/options.json index 3a8821e671..8cb6bf4866 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-13/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-13/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:2)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-14/options.json b/test/fixtures/experimental/numeric-separator/invalid-14/options.json index 3a8821e671..8cb6bf4866 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-14/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-14/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:2)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-15/options.json b/test/fixtures/experimental/numeric-separator/invalid-15/options.json index 3a8821e671..8cb6bf4866 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-15/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-15/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:2)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-16/options.json b/test/fixtures/experimental/numeric-separator/invalid-16/options.json index 3a8821e671..8cb6bf4866 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-16/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-16/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:2)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-17/options.json b/test/fixtures/experimental/numeric-separator/invalid-17/options.json index 3a8821e671..8cb6bf4866 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-17/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-17/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:2)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-18/options.json b/test/fixtures/experimental/numeric-separator/invalid-18/options.json index 3a8821e671..8cb6bf4866 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-18/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-18/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:2)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-19/options.json b/test/fixtures/experimental/numeric-separator/invalid-19/options.json index 3a8821e671..8cb6bf4866 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-19/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-19/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:2)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-2/options.json b/test/fixtures/experimental/numeric-separator/invalid-2/options.json index 38a0b25968..477511a878 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-2/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-2/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:3)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-20/options.json b/test/fixtures/experimental/numeric-separator/invalid-20/options.json index 3a8821e671..8cb6bf4866 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-20/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-20/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:2)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-21/options.json b/test/fixtures/experimental/numeric-separator/invalid-21/options.json index 02c2fdc2bb..9c49308645 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-21/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-21/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:6)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-22/options.json b/test/fixtures/experimental/numeric-separator/invalid-22/options.json index c338d94e7c..a65e1ff322 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-22/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-22/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:5)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-23/options.json b/test/fixtures/experimental/numeric-separator/invalid-23/options.json index 3a8821e671..8cb6bf4866 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-23/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-23/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:2)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-3/options.json b/test/fixtures/experimental/numeric-separator/invalid-3/options.json index 98f3821203..27e4acfa8f 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-3/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-3/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:1)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-4/options.json b/test/fixtures/experimental/numeric-separator/invalid-4/options.json index 38a0b25968..477511a878 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-4/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-4/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:3)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-5/options.json b/test/fixtures/experimental/numeric-separator/invalid-5/options.json index 9af0551149..91c5decd9c 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-5/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-5/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:4)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-6/options.json b/test/fixtures/experimental/numeric-separator/invalid-6/options.json index c338d94e7c..a65e1ff322 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-6/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-6/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:5)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-7/options.json b/test/fixtures/experimental/numeric-separator/invalid-7/options.json index c338d94e7c..a65e1ff322 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-7/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-7/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:5)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-8/options.json b/test/fixtures/experimental/numeric-separator/invalid-8/options.json index 02c2fdc2bb..9c49308645 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-8/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-8/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:6)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/test/fixtures/experimental/numeric-separator/invalid-9/options.json b/test/fixtures/experimental/numeric-separator/invalid-9/options.json index 02c2fdc2bb..9c49308645 100644 --- a/test/fixtures/experimental/numeric-separator/invalid-9/options.json +++ b/test/fixtures/experimental/numeric-separator/invalid-9/options.json @@ -1 +1 @@ -{ "throws": "Invalid NumericLiteralSeparator (1:6)" } \ No newline at end of file +{ "throws": "Invalid or unexpected token (1:6)" }