Skip to content

Commit d77cbfb

Browse files
authored
refactor(javascript): convert JS regexp PLIST to JSON (#8)
1 parent c8c9cd6 commit d77cbfb

File tree

3 files changed

+77
-238
lines changed

3 files changed

+77
-238
lines changed

grammars/grammars.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@
463463
"scopeName": "source.js.regexp",
464464
"grammar": {
465465
"base": "javascript",
466-
"file": "jsregexp.tmLanguage"
466+
"file": "RegularExpressions.tmLanguage.json"
467467
}
468468
},
469469
{
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"information_for_contributors": [
3+
"This file has been converted from https://github.com/microsoft/vscode/blob/main/extensions/javascript/syntaxes/Regular%20Expressions%20(JavaScript).tmLanguage",
4+
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
5+
"Once accepted there, we are happy to receive an update request."
6+
],
7+
"hideFromUser": true,
8+
"fileTypes": [],
9+
"repository": {
10+
"regex-character-class": {
11+
"patterns": [
12+
{ "match": "\\\\[wWsSdD]|\\.", "name": "constant.character.character-class.regexp" },
13+
{ "match": "\\\\([0-7]{3}|x\\h\\h|u\\h\\h\\h\\h)", "name": "constant.character.numeric.regexp" },
14+
{ "match": "\\\\c[A-Z]", "name": "constant.character.control.regexp" },
15+
{ "match": "\\\\.", "name": "constant.character.escape.backslash.regexp" }
16+
]
17+
},
18+
"regexp": {
19+
"patterns": [
20+
{ "match": "\\\\[bB]|\\^|\\$", "name": "keyword.control.anchor.regexp" },
21+
{ "match": "\\\\[1-9]\\d*", "name": "keyword.other.back-reference.regexp" },
22+
{ "match": "[?+*]|\\{(\\d+,\\d+|\\d+,|,\\d+|\\d+)\\}\\??", "name": "keyword.operator.quantifier.regexp" },
23+
{ "match": "\\|", "name": "keyword.operator.or.regexp" },
24+
{
25+
"begin": "(\\()((\\?=)|(\\?!))",
26+
"endCaptures": { "1": { "name": "punctuation.definition.group.regexp" } },
27+
"end": "(\\))",
28+
"patterns": [{ "include": "#regexp" }],
29+
"name": "meta.group.assertion.regexp",
30+
"beginCaptures": {
31+
"1": { "name": "punctuation.definition.group.regexp" },
32+
"3": { "name": "meta.assertion.look-ahead.regexp" },
33+
"4": { "name": "meta.assertion.negative-look-ahead.regexp" }
34+
}
35+
},
36+
{
37+
"begin": "\\((\\?:)?",
38+
"endCaptures": { "0": { "name": "punctuation.definition.group.regexp" } },
39+
"end": "\\)",
40+
"patterns": [{ "include": "#regexp" }],
41+
"name": "meta.group.regexp",
42+
"beginCaptures": { "0": { "name": "punctuation.definition.group.regexp" } }
43+
},
44+
{
45+
"begin": "(\\[)(\\^)?",
46+
"endCaptures": { "1": { "name": "punctuation.definition.character-class.regexp" } },
47+
"end": "(\\])",
48+
"patterns": [
49+
{
50+
"match": "(?:.|(\\\\(?:[0-7]{3}|x\\h\\h|u\\h\\h\\h\\h))|(\\\\c[A-Z])|(\\\\.))\\-(?:[^\\]\\\\]|(\\\\(?:[0-7]{3}|x\\h\\h|u\\h\\h\\h\\h))|(\\\\c[A-Z])|(\\\\.))",
51+
"name": "constant.other.character-class.range.regexp",
52+
"captures": {
53+
"3": { "name": "constant.character.escape.backslash.regexp" },
54+
"1": { "name": "constant.character.numeric.regexp" },
55+
"6": { "name": "constant.character.escape.backslash.regexp" },
56+
"4": { "name": "constant.character.numeric.regexp" },
57+
"2": { "name": "constant.character.control.regexp" },
58+
"5": { "name": "constant.character.control.regexp" }
59+
}
60+
},
61+
{ "include": "#regex-character-class" }
62+
],
63+
"name": "constant.other.character-class.set.regexp",
64+
"beginCaptures": {
65+
"1": { "name": "punctuation.definition.character-class.regexp" },
66+
"2": { "name": "keyword.operator.negation.regexp" }
67+
}
68+
},
69+
{ "include": "#regex-character-class" }
70+
]
71+
}
72+
},
73+
"patterns": [{ "include": "#regexp" }],
74+
"name": "Regular Expressions (JavaScript)",
75+
"scopeName": "source.js.regexp"
76+
}

grammars/javascript/syntaxes/jsregexp.tmLanguage

Lines changed: 0 additions & 237 deletions
This file was deleted.

0 commit comments

Comments
 (0)