Skip to content

Commit

Permalink
Merge pull request #110 from jviereck/jviereck/fix109
Browse files Browse the repository at this point in the history
Fix escaped dash in non-unicode mode.
  • Loading branch information
jviereck authored Mar 23, 2021
2 parents 971e752 + 124890a commit c919eee
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@
return createEscaped('controlLetter', 31, '_', 2);
}
// [+U] -
if (match('-') && hasUnicodeFlag) {
if (hasUnicodeFlag && match('-')) {
return createEscaped('singleEscape', 0x002d, '\\-');
}
}
Expand Down
21 changes: 21 additions & 0 deletions test/test-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -37654,5 +37654,26 @@
5
],
"raw": "[\\c_]"
},
"[\\-]": {
"type": "characterClass",
"body": [
{
"type": "value",
"kind": "identifier",
"codePoint": 45,
"range": [
1,
3
],
"raw": "\\-"
}
],
"negative": false,
"range": [
0,
4
],
"raw": "[\\-]"
}
}

0 comments on commit c919eee

Please sign in to comment.