forked from phil65/KodiDevKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
KodiSkinXML.sublime-syntax
248 lines (227 loc) · 7.08 KB
/
KodiSkinXML.sublime-syntax
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
%YAML 1.2
---
name: KodiSkinXML
file_extensions:
- xml
first_line_match: '^<\?xml '
scope: text.xml
contexts:
main:
# xml header ?
- match: '(<\?)\s*([-_a-zA-Z0-9]+)'
captures:
1: punctuation.definition.tag.begin.xml
2: entity.name.tag.xml
push:
- meta_scope: meta.tag.preprocessor.xml
- match: (\?>)
pop: true
- match: " ([a-zA-Z-]+)"
scope: entity.other.attribute-name.xml
- include: doublequotedString
# comments
- match: "<!--"
captures:
0: punctuation.definition.comment.xml
push:
- meta_scope: comment.block.xml
- match: "-->"
pop: true
- match: '(<)?([-_a-zA-Z0-9:]+)(?=(\s[^>]*)?></\2>)'
captures:
1: punctuation.definition.tag.begin.xml
2: entity.name.tag.xml
3: punctuation.separator.namespace.xml
4: entity.name.tag.localname.xml
push:
- meta_scope: meta.tag.no-content.xml
- match: "(>)(<)(/)?([-_a-zA-Z0-9:]+)(>)"
captures:
1: punctuation.definition.tag.end.xml
2: punctuation.definition.tag.begin.xml meta.scope.between-tag-pair.xml
3: punctuation.definition.tag.begin.xml
4: entity.name.tag.xml
5: entity.name.tag.localname.xml
6: punctuation.definition.tag.end.xml
pop: true
- include: tagStuff
- match: '(</?)(include|variable|constant|color|expression) (name)="([-_a-zA-Z0-9]+)"'
captures:
1: punctuation.definition.tag.begin.xml
2: entity.name.tag.localname.xml
3: entity.other.attribute-name.localname.xml
4: entity.name.function string.quoted.double.xml
push:
- meta_scope: meta.tag.xml
- match: (/?>)
captures:
1: punctuation.definition.tag.end.xml.xxx
pop: true
- include: tagStuff
- include: entity
- include: bare-ampersand
# xml tags
- match: "(</?)([-_a-zA-Z0-9:]+)"
captures:
1: punctuation.definition.tag.begin.xml
2: entity.name.tag.xml
push:
- meta_scope: meta.tag.xml
- match: (/?>)
captures:
1: punctuation.definition.tag.end.xml
pop: true
- include: tagStuff
- include: entity
- include: bare-ampersand
- include: koditranslation
- include: kodiaddontranslation
- include: kodinumber
- include: kodiinfolabel
- include: kodiparam
- include: kodivariable
- include: kodiexpression
- include: kodiincludeparam
- include: brackets
- include: formatter
bare-ampersand:
- match: "&"
scope: invalid.illegal.bad-ampersand.xml
doublequotedString:
- match: '"'
captures:
0: punctuation.definition.string.begin.xml
push:
- meta_scope: string.quoted.double.xml
- match: '"'
captures:
0: punctuation.definition.string.end.xml
pop: true
- include: entity
- include: bare-ampersand
- include: koditranslation
- include: kodiaddontranslation
- include: kodiinfolabel
- include: kodiparam
- include: kodivariable
- include: kodiincludeparam
- include: brackets
- include: formatter
entity:
- match: "(&)([:a-zA-Z_][:a-zA-Z0-9_.-]*|#[0-9]+|#x[0-9a-fA-F]+)(;)"
scope: constant.character.entity.xml
captures:
1: punctuation.definition.constant.xml
3: punctuation.definition.constant.xml
tagStuff:
- match: " (?:([-_a-zA-Z0-9]+)((:)))?([-_a-zA-Z0-9]+)="
captures:
1: entity.other.attribute-name.namespace.xml
2: entity.other.attribute-name.xml
3: punctuation.separator.namespace.xml
4: entity.other.attribute-name.localname.xml
- include: doublequotedString
koditranslation:
- match: '(\$)(LOCALIZE)(\[)([0-9]+)(\])'
name: variable.parameter text.kodi.translation.xml
scope: variable.parameter entity.kodi.label
kodiaddontranslation:
- match: '(\$)(ADDON)(\[)(.*?)([0-9]+)(\])'
name: variable.parameter text.kodi.translation.xml
scope: variable.parameter entity.kodi.label
kodinumber:
- match: '(\$)(NUMBER)(\[)([0-9]+)(\])'
name: variable.parameter text.kodi.number.xml
scope: variable.parameter entity.kodi.number
kodiparam:
- match: '(\$)(PARAM)(\[)(.*?)(\])'
name: variable.parameter text.kodi.param.xml
scope: entity.kodi.param
kodiinfolabel:
- match: '(\$)((?:ESC)?INFO)(\[)'
name: variable.parameter text.kodi.infolabel.xml
captures:
1: entity.kodi.infolabel.dollar
2: entity.kodi.infolabel.info
3: entity.kodi.infolabel.begin
push:
- meta_scope: support.function kodi.infolabel
- match: '(\])'
captures:
1: entity.kodi.infolabel.end
pop: true
- include: koditranslation
- include: kodiparam
- include: kodiaddontranslation
- include: formatter
- include: brackets
kodiincludeparam:
- match: '(\$)(PARAM)(\[)'
name: variable.parameter text.kodi.includeparam.xml
captures:
1: entity.kodi.includeparam.dollar
2: entity.kodi.includeparam.param
3: entity.kodi.includeparam.begin
push:
- meta_scope: support.function kodi.includeparam
- match: '(\])'
captures:
1: entity.kodi.includeparam.end
pop: true
formatter:
- match: '(\[)([A-Za-z0-9\/= ]*?)(\])'
name: invalid.deprecated
captures:
'1': kodi.formatter.begin invalid.deprecated
'2': kodi.formatter.content invalid.deprecated
'3': kodi.formatter.end invalid.deprecated
kodivariable:
- match: '(\$)((?:ESC)?VAR)(\[)'
name: variable.parameter text.kodi.variable.xml
captures:
1: entity.kodi.variable.dollar
2: entity.kodi.variable.var
3: entity.kodi.variable.begin
push:
- meta_scope: storage.type kodi.variable
- match: '(\])'
captures:
1: entity.kodi.variable.end
pop: true
- include: formatter
kodiexpression:
- match: '(\$)(EXP)(\[)'
name: expression.parameter text.kodi.expression.xml
captures:
1: entity.kodi.expression.dollar
2: entity.kodi.expression.exp
3: entity.kodi.expression.begin
push:
- meta_scope: storage.type kodi.expression
- match: '(\])'
captures:
1: entity.kodi.expression.end
pop: true
brackets:
- match: '(\()'
name: constant.other.allcaps
captures:
1: constant.other.allcaps
push:
- meta_scope: constant.other.allcaps
- match: '(\))'
captures:
1: constant.other.allcaps
pop: true
- include: brackets
- include: koditranslation
# brackets:
# - match: \(
# push: closingbracket
# - match: \)
# scope: invalid.illegal.stray-bracket-end
# closingbracket:
# - meta_content_scope: constant.other.allcaps
# - match: \)
# pop: true
# - include: brackets