Skip to content

Commit

Permalink
Merge pull request #108 from jviereck/fix/107
Browse files Browse the repository at this point in the history
Fix #107: Adding handling for missing ClassEscape -> ClassControlLetter = _ rule
  • Loading branch information
jviereck authored Jan 30, 2021
2 parents 321fd60 + d810951 commit 8f433f2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
6 changes: 5 additions & 1 deletion parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,12 @@
bail('\\B not possible inside of CharacterClass', '', from);
} else if (!hasUnicodeFlag && (res = matchReg(/^c([0-9])/))) {
// B.1.4
// c ClassControlLetter
// c ClassControlLetter, ClassControlLetter = DecimalDigit
return createEscaped('controlLetter', res[1] + 16, res[1], 2);
} else if (!hasUnicodeFlag && (res = matchReg(/^c_/))) {
// B.1.4
// c ClassControlLetter, ClassControlLetter = _
return createEscaped('controlLetter', 31, '_', 2);
}
// [+U] -
if (match('-') && hasUnicodeFlag) {
Expand Down
21 changes: 21 additions & 0 deletions test/test-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -37633,5 +37633,26 @@
2
],
"raw": "{}"
},
"[\\c_]": {
"type": "characterClass",
"body": [
{
"type": "value",
"kind": "controlLetter",
"codePoint": 31,
"range": [
1,
4
],
"raw": "\\c_"
}
],
"negative": false,
"range": [
0,
5
],
"raw": "[\\c_]"
}
}

0 comments on commit 8f433f2

Please sign in to comment.