1+ {
2+ "$schema" : " https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json" ,
3+ "name" : " PyWire" ,
4+ "scopeName" : " source.pywire" ,
5+ "patterns" : [
6+ {
7+ "include" : " #python-header"
8+ },
9+ {
10+ "include" : " #separator"
11+ },
12+ {
13+ "include" : " #html-content"
14+ }
15+ ],
16+ "repository" : {
17+ "python-header" : {
18+ "begin" : " \\ A" ,
19+ "end" : " ^(?=\\ s*---+\\ s*html\\ s*---+\\ s*$)|^(?=[ \\ t]*<[!a-zA-Z/])" ,
20+ "contentName" : " meta.embedded.block.python" ,
21+ "patterns" : [
22+ {
23+ "include" : " #directives"
24+ },
25+ {
26+ "include" : " #wire-variable"
27+ },
28+ {
29+ "include" : " source.python"
30+ }
31+ ]
32+ },
33+ "separator" : {
34+ "match" : " ^\\ s*(-{3,})\\ s*[Hh][Tt][Mm][Ll]\\ s*\\ 1\\ s*$" ,
35+ "name" : " punctuation.separator.pywire keyword.control.pywire"
36+ },
37+ "html-content" : {
38+ "patterns" : [
39+ {
40+ "include" : " #directives"
41+ },
42+ {
43+ "include" : " #comments"
44+ },
45+ {
46+ "include" : " #tags"
47+ },
48+ {
49+ "include" : " #interpolation"
50+ },
51+ {
52+ "include" : " #text"
53+ }
54+ ]
55+ },
56+ "directives" : {
57+ "patterns" : [
58+ {
59+ "match" : " ^\\ s*(!\\ w+)" ,
60+ "name" : " keyword.control.directive.pywire"
61+ },
62+ {
63+ "begin" : " (!path)\\ s*(\\ {)" ,
64+ "beginCaptures" : {
65+ "1" : {
66+ "name" : " keyword.control.directive.pywire"
67+ },
68+ "2" : {
69+ "name" : " punctuation.section.embedded.begin.pywire"
70+ }
71+ },
72+ "end" : " (\\ })" ,
73+ "endCaptures" : {
74+ "1" : {
75+ "name" : " punctuation.section.embedded.end.pywire"
76+ }
77+ },
78+ "contentName" : " meta.embedded.block.python" ,
79+ "patterns" : [
80+ {
81+ "include" : " #wire-variable"
82+ },
83+ {
84+ "include" : " source.python"
85+ }
86+ ]
87+ }
88+ ]
89+ },
90+ "comments" : {
91+ "patterns" : [
92+ {
93+ "begin" : " <!--" ,
94+ "end" : " -->" ,
95+ "name" : " comment.block.html"
96+ },
97+ {
98+ "match" : " ^\\ s*#.*$" ,
99+ "name" : " comment.line.number-sign.python"
100+ }
101+ ]
102+ },
103+ "interpolation" : {
104+ "begin" : " \\ {" ,
105+ "beginCaptures" : {
106+ "0" : {
107+ "name" : " punctuation.section.embedded.begin.pywire"
108+ }
109+ },
110+ "end" : " \\ }" ,
111+ "endCaptures" : {
112+ "0" : {
113+ "name" : " punctuation.section.embedded.end.pywire"
114+ }
115+ },
116+ "contentName" : " meta.embedded.inline.python" ,
117+ "patterns" : [
118+ {
119+ "include" : " #wire-variable"
120+ },
121+ {
122+ "include" : " source.python"
123+ }
124+ ]
125+ },
126+ "tags" : {
127+ "patterns" : [
128+ {
129+ "include" : " #tags-void"
130+ },
131+ {
132+ "include" : " #tags-general"
133+ }
134+ ]
135+ },
136+ "tags-void" : {
137+ "begin" : " (<)(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)(?=\\ s|/?>)" ,
138+ "beginCaptures" : {
139+ "1" : {
140+ "name" : " punctuation.definition.tag.begin.html"
141+ },
142+ "2" : {
143+ "name" : " entity.name.tag.html"
144+ }
145+ },
146+ "end" : " /?>" ,
147+ "endCaptures" : {
148+ "0" : {
149+ "name" : " punctuation.definition.tag.end.html"
150+ }
151+ },
152+ "name" : " meta.tag.void.html" ,
153+ "patterns" : [
154+ {
155+ "include" : " #attributes"
156+ }
157+ ]
158+ },
159+ "tags-general" : {
160+ "begin" : " (<)([^/\\ s>/]*)" ,
161+ "beginCaptures" : {
162+ "1" : {
163+ "name" : " punctuation.definition.tag.begin.html"
164+ },
165+ "2" : {
166+ "name" : " entity.name.tag.html"
167+ }
168+ },
169+ "end" : " (/?>)" ,
170+ "endCaptures" : {
171+ "1" : {
172+ "name" : " punctuation.definition.tag.end.html"
173+ }
174+ },
175+ "patterns" : [
176+ {
177+ "include" : " #attributes"
178+ }
179+ ]
180+ },
181+ "tags-end" : {
182+ "match" : " (</)([^/\\ s>]*)(\\ >)" ,
183+ "captures" : {
184+ "1" : {
185+ "name" : " punctuation.definition.tag.begin.html"
186+ },
187+ "2" : {
188+ "name" : " entity.name.tag.html"
189+ },
190+ "3" : {
191+ "name" : " punctuation.definition.tag.end.html"
192+ }
193+ }
194+ },
195+ "attributes" : {
196+ "patterns" : [
197+ {
198+ "include" : " #attribute-event"
199+ },
200+ {
201+ "include" : " #attribute-directive"
202+ },
203+ {
204+ "include" : " #attribute-normal"
205+ }
206+ ]
207+ },
208+ "attribute-event" : {
209+ "begin" : " (@[\\ w\\ .]+)(?=\\ s*=?|/?>)" ,
210+ "beginCaptures" : {
211+ "1" : {
212+ "name" : " entity.other.attribute-name.event.pywire support.function.event.pywire"
213+ }
214+ },
215+ "end" : " (?=[\\ s/>])" ,
216+ "patterns" : [
217+ {
218+ "include" : " #attribute-value-assignment"
219+ }
220+ ]
221+ },
222+ "attribute-directive" : {
223+ "begin" : " (\\ $[\\ w\\ .]+)(?=\\ s*=?|/?>)" ,
224+ "beginCaptures" : {
225+ "1" : {
226+ "name" : " keyword.control.directive.attribute.pywire"
227+ }
228+ },
229+ "end" : " (?=[\\ s/>])" ,
230+ "patterns" : [
231+ {
232+ "include" : " #attribute-value-assignment"
233+ }
234+ ]
235+ },
236+ "attribute-normal" : {
237+ "begin" : " ([^\\ s\" '=<>`/]+)" ,
238+ "beginCaptures" : {
239+ "1" : {
240+ "name" : " entity.other.attribute-name.html"
241+ }
242+ },
243+ "end" : " (?=[\\ s/>])" ,
244+ "patterns" : [
245+ {
246+ "include" : " #attribute-value-assignment"
247+ }
248+ ]
249+ },
250+ "attribute-value-assignment" : {
251+ "begin" : " =" ,
252+ "beginCaptures" : {
253+ "0" : {
254+ "name" : " punctuation.separator.key-value.html"
255+ }
256+ },
257+ "end" : " (?=[\\ s/>])" ,
258+ "patterns" : [
259+ {
260+ "include" : " #interpolation"
261+ },
262+ {
263+ "begin" : " \" " ,
264+ "end" : " \" " ,
265+ "name" : " string.quoted.double.html" ,
266+ "patterns" : [
267+ {
268+ "include" : " #interpolation"
269+ }
270+ ]
271+ },
272+ {
273+ "begin" : " '" ,
274+ "end" : " '" ,
275+ "name" : " string.quoted.single.html" ,
276+ "patterns" : [
277+ {
278+ "include" : " #interpolation"
279+ }
280+ ]
281+ },
282+ {
283+ "match" : " [^\\ s\" '=<>`/]+" ,
284+ "name" : " string.unquoted.html"
285+ }
286+ ]
287+ },
288+ "text" : {
289+ "patterns" : [
290+ {
291+ "include" : " #tags-end"
292+ }
293+ ]
294+ },
295+ "wire-variable" : {
296+ "match" : " (\\ $)([a-zA-Z_]\\ w*)" ,
297+ "captures" : {
298+ "1" : {
299+ "name" : " punctuation.definition.variable.pywire keyword.operator.pywire"
300+ },
301+ "2" : {
302+ "name" : " variable.other.readwrite.pywire"
303+ }
304+ }
305+ }
306+ }
307+ }
0 commit comments