-
Notifications
You must be signed in to change notification settings - Fork 6
/
Regular Expression (Escaped).JSON-tmLanguage
129 lines (113 loc) · 3.8 KB
/
Regular Expression (Escaped).JSON-tmLanguage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
{ "name": "Regular Expression (Escaped)",
"scopeName": "source.escapedregexp",
"patterns": [
{ "include": "#classes" },
{ "include": "#anchorsWithBackslash" },
{ "include": "#allEscapes" },
{ "include": "#anchors" },
{ "include": "#quantifiers" },
{ "include": "#granularQuantifier" },
{ "include": "#operators" },
{ "include": "#sets" },
{ "include": "#groups" }
],
"repository": {
"allEscapes": {
"comment": "Order matters.",
"patterns" : [
{ "include": "#regexpEscapeSequences" },
{ "include": "#regexpEscapedBackslash" },
{ "include": "#jsonEscapeSequences" }
]
},
"regexpEscapeSequences": {
"match": "(?<!\\\\\\\\)\\\\\\\\(?:[]^+?*.(){}$\\[])",
"name": "constant.character.escape.sequence.regexp.escapedregexp",
"comment": "Escape next char if the slash isn't being escaped itself."
},
"regexpEscapedBackslash": {
"match": "\\\\\\\\",
"name": "constant.character.escape.sequence.regexp.escapedregexp"
},
"jsonEscapeSequences": {
"match": "\\\\[bfntr\"\/]",
"name": "entity.other.attribute-name.escape.sequence.json.escapedregexp"
},
"quantifiers": {
"match": "(\\+|\\*|\\?)(\\?)?",
"name": "keyword.other.quantifier.escapedregexp"
},
"granularQuantifier": {
"match": "(\\{)([0-9]+)(,)?([0-9]+)?(\\})",
"name": "meta.granular.quantifier.escapedregexp",
"captures": {
"1": { "name": "keyword.other.punctuation.quantifier.start.escapedregexp" },
"2": { "name": "constant.numeric.escapedregexp" },
"3": { "name": "keyword.other.separator.escapedregexp" },
"4": { "name": "constant.numeric.escapedregexp" },
"5": { "name": "keyword.other.punctuation.quantifier.end.escapedregexp" }
}
},
"classes": {
"match": "\\\\\\\\[dDsSwW]",
"name": "keyword.other.character-class.escapedregexp",
"comment": "XXX: Add unicode escapes \\x00 and escapes within comments."
},
"operators": {
"match": "[|.]",
"name": "keyword.other.operator.escapedregexp"
},
"sets": {
"begin": "(\\[)(\\^)?(\\])?",
"beginCaptures": {
"1": { "name": "keyword.other.set.escapedregexp" },
"2": { "name": "keyword.other.set.operator.negate.escapedregexp" },
"3": { "name": "string.set.element.escapedregexp" }
},
"end": "]",
"endCaptures": {
"0": { "name": "keyword.other.set.escapedregexp" }
},
"patterns": [
{ "name": "support.function.set.range.escapedregexp",
"match": "[A-Za-z0-9](-)[A-Za-z0-9]",
"captures": {
"1": { "name": "keyword.operator.other.set.range.separator.escapedregexp" }
}
},
{ "include": "#regexpEscapeSequences" },
{ "include": "#classes" },
{ "include": "#jsonEscapeSequences" },
{ "name": "string.set.element.escapedregexp",
"match": ".*?"
}
]
},
"groups": {
"begin": "\\(",
"beginCaptures": {
"0": { "name": "string.regexp.group.escapedregexp" }
},
"endCaptures": {
"0": { "name": "string.regexp.group.escapedregexp" }
},
"end": "\\)",
"patterns": [
{ "name": "support.function.assertion.escapedregexp",
"match": "(\\?(?:[:=!>]|<[=!]))"
},
{ "include": "$self" }
],
"comment": "XXX: Implement named groups, options and yes/no groups."
},
"anchorsWithBackslash": {
"match": "(?:\\\\\\\\[AbBZ])",
"name": "entity.other.attribute-name.anchor.escapedregexp"
},
"anchors": {
"match": "[$^]",
"name": "entity.other.attribute-name.anchor.escapedregexp"
}
},
"uuid": "26c6799e-6824-4926-b2e5-87140300b97b"
}