Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[parser] Disallow numeric separator in unicode scape sequences (#10468)
* [parser] Disallow numeric separator in unicode scape sequences (#10460) * raise error only when numeric separator plugin is set * Adds argument for checking numeric separator * Fix condition for readability * Add test for hex escape sequence and rephrase error message * Remove exposure for allowNumSeparator in readHexChar method
- Loading branch information
1 parent
3069747
commit f339d2d
Showing
8 changed files
with
19 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"\x1_0"; |
1 change: 1 addition & 0 deletions
1
packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "throws": "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences (1:4)" } |
1 change: 1 addition & 0 deletions
1
...ages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"\u12_34" |
1 change: 1 addition & 0 deletions
1
.../babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "throws": "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences (1:5)" } |
1 change: 1 addition & 0 deletions
1
packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"\u{1F_639}" |
1 change: 1 addition & 0 deletions
1
...es/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "throws": "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences (1:6)" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters