Skip to content

Commit

Permalink
[parser] Exception to 8 and 9 in tagged template (#10567)
Browse files Browse the repository at this point in the history
  • Loading branch information
pnowak authored and nicolo-ribaudo committed Oct 16, 2019
1 parent 2254542 commit 5800fc9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/babel-parser/src/tokenizer/index.js
Expand Up @@ -1239,6 +1239,14 @@ export default class Tokenizer extends LocationParser {
case charCodes.lineSeparator:
case charCodes.paragraphSeparator:
return "";
case charCodes.digit8:
case charCodes.digit9:
if (inTemplate) {
const codePos = this.state.pos - 1;

this.state.invalidTemplateEscapePosition = codePos;
return null;
}
default:
if (ch >= charCodes.digit0 && ch <= charCodes.digit7) {
const codePos = this.state.pos - 1;
Expand Down
@@ -0,0 +1 @@
`\8`;
@@ -0,0 +1,3 @@
{
"throws": "Invalid escape sequence in template (1:2)"
}
@@ -0,0 +1 @@
`\9`;
@@ -0,0 +1,3 @@
{
"throws": "Invalid escape sequence in template (1:2)"
}

0 comments on commit 5800fc9

Please sign in to comment.