Skip to content

Commit 44e0ce2

Browse files
committed
Support unicode regex groups syntax
1 parent f3b9ca2 commit 44e0ce2

File tree

1 file changed

+42
-22
lines changed

1 file changed

+42
-22
lines changed

syntaxes/regex.tmLanguage.json

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -183,33 +183,39 @@
183183
},
184184
"non-capture-group": {
185185
"comment": "(?:...) (?>...)",
186-
"begin": "\\G(\\()(\\?[:>])",
186+
"begin": "\\G(\\()(\\?(?>[:>]|(\\\\u(003[aAeE]))))",
187187
"end": "\\)|(?=\")",
188188
"beginCaptures": {
189189
"1": { "name": "constant.character.set.regexp.tm" },
190-
"2": { "name": "support.function.tm regex" }
190+
"2": { "name": "support.function.tm regex" },
191+
"3": { "name": "constant.character.escape.json.tm" },
192+
"4": { "name": "constant.numeric.json.tm" }
191193
},
192194
"endCaptures": { "0": { "name": "constant.character.set.regexp.tm" } },
193195
"patterns": [ { "include": "$self" } ]
194196
},
195197
"non-capture-group-extended": {
196198
"comment": "(?:...) (?>...)",
197-
"begin": "\\G(\\()(\\?[:>])",
199+
"begin": "\\G(\\()(\\?(?>[:>]|(\\\\u(003[aAeE]))))",
198200
"end": "\\)|(?=\")",
199201
"beginCaptures": {
200202
"1": { "name": "constant.character.set.regexp.tm" },
201-
"2": { "name": "support.function.tm regex" }
203+
"2": { "name": "support.function.tm regex" },
204+
"3": { "name": "constant.character.escape.json.tm" },
205+
"4": { "name": "constant.numeric.json.tm" }
202206
},
203207
"endCaptures": { "0": { "name": "constant.character.set.regexp.tm" } },
204208
"patterns": [ { "include": "#$self-extended" } ]
205209
},
206210
"capture-group-lookahead": {
207211
"comment": "(?=...) (?!...)",
208-
"begin": "\\G(\\()(\\?[!=])",
212+
"begin": "\\G(\\()(\\?(?>[!=]|(\\\\u(003[dD]|0021))))",
209213
"end": "(\\))([+*?]|{(?>[0-9]+,?[0-9]*|,[0-9]+)})?|(?=\")",
210214
"beginCaptures": {
211215
"1": { "name": "constant.character.set.regexp.tm markup.italic" },
212-
"2": { "name": "support.function.tm" }
216+
"2": { "name": "support.function.tm" },
217+
"3": { "name": "constant.character.escape.json.tm" },
218+
"4": { "name": "constant.numeric.json.tm" }
213219
},
214220
"endCaptures": {
215221
"1": { "name": "constant.character.set.regexp.tm markup.italic" },
@@ -219,11 +225,13 @@
219225
},
220226
"capture-group-lookahead-extended": {
221227
"comment": "(?=...) (?!...)",
222-
"begin": "\\G(\\()(\\?[!=])",
228+
"begin": "\\G(\\()(\\?(?>[!=]|(\\\\u(003[dD]|0021))))",
223229
"end": "(\\))([+*?]|{(?>[0-9]+,?[0-9]*|,[0-9]+)})?|(?=\")",
224230
"beginCaptures": {
225231
"1": { "name": "constant.character.set.regexp.tm markup.italic" },
226-
"2": { "name": "support.function.tm" }
232+
"2": { "name": "support.function.tm" },
233+
"3": { "name": "constant.character.escape.json.tm" },
234+
"4": { "name": "constant.numeric.json.tm" }
227235
},
228236
"endCaptures": {
229237
"1": { "name": "constant.character.set.regexp.tm markup.italic" },
@@ -233,11 +241,15 @@
233241
},
234242
"capture-group-lookbehind": {
235243
"comment": "(?<=...)",
236-
"begin": "\\G(\\()(\\?<=)",
244+
"begin": "\\G(\\()(\\?(?><|(\\\\u(003[cC])))(?>=|(\\\\u(003[dD]))))",
237245
"end": "(\\))([+*?]|{(?>[0-9]+,?[0-9]*|,[0-9]+)})?|(?=\")",
238246
"beginCaptures": {
239247
"1": { "name": "constant.character.set.regexp.tm markup.italic" },
240-
"2": { "name": "support.function.tm regex" }
248+
"2": { "name": "support.function.tm regex" },
249+
"3": { "name": "constant.character.escape.json.tm" },
250+
"4": { "name": "constant.numeric.json.tm" },
251+
"5": { "name": "constant.character.escape.json.tm" },
252+
"6": { "name": "constant.numeric.json.tm" }
241253
},
242254
"endCaptures": {
243255
"1": { "name": "constant.character.set.regexp.tm markup.italic" },
@@ -252,11 +264,15 @@
252264
},
253265
"capture-group-lookbehind-extended": {
254266
"comment": "(?<=...)",
255-
"begin": "\\G(\\()(\\?<=)",
267+
"begin": "\\G(\\()(\\?(?><|(\\\\u(003[cC])))(?>=|(\\\\u(003[dD]))))",
256268
"end": "(\\))([+*?]|{(?>[0-9]+,?[0-9]*|,[0-9]+)})?|(?=\")",
257269
"beginCaptures": {
258270
"1": { "name": "constant.character.set.regexp.tm markup.italic" },
259-
"2": { "name": "support.function.tm regex" }
271+
"2": { "name": "support.function.tm regex" },
272+
"3": { "name": "constant.character.escape.json.tm" },
273+
"4": { "name": "constant.numeric.json.tm" },
274+
"5": { "name": "constant.character.escape.json.tm" },
275+
"6": { "name": "constant.numeric.json.tm" }
260276
},
261277
"endCaptures": {
262278
"1": { "name": "constant.character.set.regexp.tm markup.italic" },
@@ -271,7 +287,7 @@
271287
},
272288
"capture-group-lookbehind-invalid": {
273289
"comment": "(?=...)? (?!...)+ (?<!...)* (?~...)",
274-
"begin": "\\G\\(\\?(<?!|=)",
290+
"begin": "\\G\\(\\?((?>\\\\u003[cC])?!|<?!|\\\\u003[dD])",
275291
"end": "\\)(?>[+*?]|{(?>[0-9]+,?[0-9]*|,[0-9]+)})?|(?=\")",
276292
"captures": {
277293
"0": { "name": "invalid.illegal.tm markup.underline" },
@@ -285,7 +301,7 @@
285301
},
286302
"capture-group-lookbehind-invalid-extended": {
287303
"comment": "(?=...)? (?!...)+ (?<!...)* (?~...)",
288-
"begin": "\\G\\(\\?(<?!|=)",
304+
"begin": "\\G\\(\\?((?>\\\\u003[cC])?!|<?!|\\\\u003[dD])",
289305
"end": "\\)(?>[+*?]|{(?>[0-9]+,?[0-9]*|,[0-9]+)})?|(?=\")",
290306
"captures": {
291307
"0": { "name": "invalid.illegal.tm markup.underline" },
@@ -299,11 +315,13 @@
299315
},
300316
"capture-group-negative-lookbehind": {
301317
"comment": "(?<!...)",
302-
"begin": "\\G(\\()(\\?<!)",
318+
"begin": "\\G(\\()(\\?(?><|(\\\\u(003[cC])))!)",
303319
"end": "(\\))([+*?]|{(?>[0-9]+,?[0-9]*|,[0-9]+)})?|(?=\")",
304320
"beginCaptures": {
305321
"1": { "name": "constant.character.set.regexp.tm markup.italic" },
306-
"2": { "name": "support.function.tm regex" }
322+
"2": { "name": "support.function.tm regex" },
323+
"3": { "name": "constant.character.escape.json.tm" },
324+
"4": { "name": "constant.numeric.json.tm" }
307325
},
308326
"endCaptures": {
309327
"1": { "name": "constant.character.set.regexp.tm markup.italic" },
@@ -318,11 +336,13 @@
318336
},
319337
"capture-group-negative-lookbehind-extended": {
320338
"comment": "(?<!...)",
321-
"begin": "\\G(\\()(\\?<!)",
339+
"begin": "\\G(\\()(\\?(?><|(\\\\u(003[cC])))!)",
322340
"end": "(\\))([+*?]|{(?>[0-9]+,?[0-9]*|,[0-9]+)})?|(?=\")",
323341
"beginCaptures": {
324342
"1": { "name": "constant.character.set.regexp.tm markup.italic" },
325-
"2": { "name": "support.function.tm regex" }
343+
"2": { "name": "support.function.tm regex" },
344+
"3": { "name": "constant.character.escape.json.tm" },
345+
"4": { "name": "constant.numeric.json.tm" }
326346
},
327347
"endCaptures": {
328348
"1": { "name": "constant.character.set.regexp.tm markup.italic" },
@@ -346,7 +366,7 @@
346366
},
347367
{
348368
"comment": "(...)",
349-
"begin": "\\G\\((?!\\?[-~<>=:!{(|IimxWDSPy]|\\*[A-Za-z_])",
369+
"begin": "\\G\\((?!\\?[-~<>=:!{(|#*'IimxWDSPy])",
350370
"end": "\\)|(?=\")",
351371
"captures": { "0": { "name": "invalid.illegal.tm markup.underline" } },
352372
"patterns": [
@@ -372,7 +392,7 @@
372392
},
373393
{
374394
"comment": "(...)",
375-
"begin": "\\G\\((?!\\?[-~<>=:!{(|IimxWDSPy]|\\*[A-Za-z_])",
395+
"begin": "\\G\\((?!\\?[-~<>=:!{(|#*'IimxWDSPy])",
376396
"end": "\\)|(?=\")",
377397
"captures": { "0": { "name": "invalid.illegal.tm markup.underline" } },
378398
"patterns": [
@@ -1746,7 +1766,7 @@
17461766
{ "match": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ " },
17471767
{ "match": " \"\/\b\f\n\r\t\u0000 " },
17481768
{ "match": " \\ \\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\0\\10\\20\\30\\40\\50\\60\\70\\80\\90\\:\\;\\<\\=\\>\\\\\\?\\@\\A\\B\\C- \\D\\E\\F\\G\\H\\I\\J\\K\\L\\M-a\\N\\O\\P\\Q\\R\\S\\T\\U\\V\\W\\X\\Y\\Z\\[\\\\\\]\\^\\_\\`\\a\\b\\c]\\d\\e\\f\\g\\h\\i\\j\\k\\l\\m\\n\\o\\p\\q\\r\\s\\t\\u0000\\v\\w\\x\\y\\z\\{\\|\\}\\~ " },
1749-
{ "match": " \\\"\\\/\\\b\\\f\\\n\\\r\\\t\\\u0000 " },
1769+
{ "match": " \\\"\\\/\\\b\\\f\\\n\\\r\\\t\\\u0001 " },
17501770
{ "match": " \\\\ " },
17511771
{ "match": " (?x).{2,3}{2,3}(.{2,3}(?:.{2,3})){2,3}{,3}{2,}{2} {000} *{0} {0}* *{0}* {0}{0}{0} {0}{2,3} {2,3}{0}{2,3} {2,3\\} " },
17521772
{ "match": " () (?<= (= (?: (=) ) ) ) (?= (?= ) ) " },
@@ -1763,4 +1783,4 @@
17631783
]
17641784
}
17651785
}
1766-
}
1786+
}

0 commit comments

Comments
 (0)