Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 9f6a8ac

Browse files
author
Alhadis
committed
Add pattern-matching for Unicode escape sequences
1 parent f9520c4 commit 9f6a8ac

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

Diff for: grammars/javascript.cson

+25-10
Original file line numberDiff line numberDiff line change
@@ -1214,8 +1214,7 @@
12141214
'name': 'string.quoted.single.js'
12151215
'patterns': [
12161216
{
1217-
'match': '\\\\(x\\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)'
1218-
'name': 'constant.character.escape.js'
1217+
'include': '#string_escapes'
12191218
}
12201219
{
12211220
'match': "[^']*[^\\n\\r'\\\\]$"
@@ -1235,8 +1234,7 @@
12351234
'name': 'string.quoted.double.js'
12361235
'patterns': [
12371236
{
1238-
'match': '\\\\(x\\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)'
1239-
'name': 'constant.character.escape.js'
1237+
'include': '#string_escapes'
12401238
}
12411239
{
12421240
'match': '[^"]*[^\\n\\r"\\\\]$'
@@ -1258,8 +1256,7 @@
12581256
'name': 'string.quoted.template.html.js'
12591257
'patterns': [
12601258
{
1261-
'match': '\\\\(x\\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)'
1262-
'name': 'constant.character.escape.js'
1259+
'include': '#string_escapes'
12631260
}
12641261
{
12651262
'include': '#interpolated_js'
@@ -1283,8 +1280,7 @@
12831280
'name': 'string.quoted.template.graphql.js'
12841281
'patterns': [
12851282
{
1286-
'match': '\\\\(x\\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)'
1287-
'name': 'constant.character.escape.js'
1283+
'include': '#string_escapes'
12881284
}
12891285
{
12901286
'include': '#interpolated_js'
@@ -1306,15 +1302,34 @@
13061302
'name': 'string.quoted.template.js'
13071303
'patterns': [
13081304
{
1309-
'match': '\\\\(x\\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)'
1310-
'name': 'constant.character.escape.js'
1305+
'include': '#string_escapes'
13111306
}
13121307
{
13131308
'include': '#interpolated_js'
13141309
}
13151310
]
13161311
}
13171312
]
1313+
'string_escapes':
1314+
'patterns': [
1315+
{
1316+
'match': '\\\\u(?![A-Fa-f0-9]{4}|\\{[A-Fa-f0-9]+\\})[^\'"]*'
1317+
'name': 'invalid.illegal.identifier.js'
1318+
}
1319+
{
1320+
'match': '\\\\u(?:[A-Fa-f0-9]{4}|(\\{)[A-Fa-f0-9]+(\\}))'
1321+
'name': 'constant.character.escape.js'
1322+
'captures':
1323+
'1':
1324+
'name': 'punctuation.section.scope.begin.js'
1325+
'2':
1326+
'name': 'punctuation.section.scope.end.js'
1327+
}
1328+
{
1329+
'match': '\\\\(x\\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)'
1330+
'name': 'constant.character.escape.js'
1331+
}
1332+
]
13181333
'function_params':
13191334
'patterns': [
13201335
{

0 commit comments

Comments
 (0)