Skip to content

Commit

Permalink
[loose parser] Clear containsEsc flag when resetting tokenizer
Browse files Browse the repository at this point in the history
FIX: Fix a bug where the parser would raise an error when an invalid
escape was included in an identifier after a keyword.

Closes #1139
  • Loading branch information
marijnh committed Aug 1, 2022
1 parent 18ae3fc commit 516bc12
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions acorn-loose/src/tokenize.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ lp.readToken = function() {

lp.resetTo = function(pos) {
this.toks.pos = pos
this.toks.containsEsc = false
let ch = this.input.charAt(pos - 1)
this.toks.exprAllowed = !ch || /[[{(,;:?/*=+\-~!|&%^<>]/.test(ch) ||
/[enwfd]/.test(ch) &&
Expand Down

0 comments on commit 516bc12

Please sign in to comment.