Skip to content

Commit 6d3703b

Browse files
ValdezFOmaramaanq
authored andcommitted
feat: support hexadecimal escape sequences
1 parent b518ad4 commit 6d3703b

File tree

5 files changed

+1565
-1302
lines changed

5 files changed

+1565
-1302
lines changed

grammar.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,14 @@ module.exports = grammar({
123123
choice(
124124
$.class_character,
125125
$.character_class_escape,
126+
$.control_escape,
126127
alias('-', $.class_character),
127128
),
128129
'-',
129130
choice(
130131
$.class_character,
131132
$.character_class_escape,
133+
$.control_escape,
132134
alias('-', $.class_character),
133135
),
134136
)),
@@ -200,7 +202,10 @@ module.exports = grammar({
200202
// lookahead is not also a digit.
201203
// I think this has little bearing on the highlighting of
202204
// correct regexes.
203-
control_escape: _ => /\\[bfnrtv0]/,
205+
control_escape: _ => choice(
206+
/\\[bfnrtv0]/,
207+
/\\x[0-9a-fA-F]{2}/,
208+
),
204209

205210
control_letter_escape: _ => /\\c[a-zA-Z]/,
206211

src/grammar.json

Lines changed: 19 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/node-types.json

Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)