generated from openpeeps/pistachio
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tim.sublime-syntax
211 lines (170 loc) · 5.56 KB
/
tim.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
%YAML 1.2
---
# See http://www.sublimetext.com/docs/syntax.html
file_extensions:
- timl
scope: source.tim
variables:
ident: '[A-Za-z_][A-Za-z_0-9]*'
html_id: '[a-zA-Z_-][a-zA-Z0-9_-]*'
end_block: '^(\s*?)@\b(end)\b'
contexts:
main:
- include: cssSnippet
- include: scriptSnippet
- include: styleSnippet
- include: jsSnippet
- include: json
- include: yaml
- include: identCall
- match: '\b(echo)\b|@\b(include|import|end|client|placeholder)\b'
scope: keyword.control.import.timl
- match: '@view'
scope: entity.name.function.timl
- match: '(@[\w+-]*)'
scope: entity.name.function.tim
- match: '(@[\w+-]*)(\((.*)?\))'
captures:
1: entity.name.function.tim
- match: '\b(true|false)\b'
scope: constant.language.timl
- match: '\$(app|this)\b'
scope: constant.language.timl
- match: '\b(if|elif|else|for|while|in|and|or|fn|func|block|component|return|discard|break|type|typeof)\b'
scope: keyword.control.timl
- match: '\b(string|int|float|bool|array|object|stream)\b'
scope: keyword.control.timl
- match: '\b(var|const)\b'
captures:
1: keyword.control.bro
push: varIdent
- match: (\$)([a-zA-Z_][a-zA-Z0-9_]*)\b
scope: variable.member.timl
- match: '([\w-]*)(=)'
captures:
1: entity.other.attribute-name
- match: (\.)({{html_id}})\b
captures:
1: markup.bold entity.name.function
# 2: entity.name.function
- match: "'"
scope: punctuation.definition.string.begin.timl
push: single_quoted_string
- match: '"""'
scope: punctuation.definition.string.begin.timl
push: triple_quoted_string
- match: '"'
scope: punctuation.definition.string.begin.timl
push: double_quoted_string
# Comments begin with a '//' and finish at the end of the line
- match: '//'
scope: punctuation.definition.comment.tim
push: line_comment
# - match: '>'
# scope: markup.bold
- match: '(\?|\||\*|/|&|\-|\+)'
scope: keyword.operator.logical
- match: '(:|\.)'
scope: markup.bold
- match: '='
scope: markup.bold keyword.operator.assignment.timl
- match: '\b(?<!\-|\+)(html|head|meta|script|body|title)\b'
scope: entity.name.tag.timl
- match: '\b(?<!\-|\+)(main|section|article|aside|div|footer|header)\b'
scope: entity.name.tag.timl
- match: '\b(?<!\-|\+)(h1|h2|h3|h4|h5|h6|a|p|em|b|strong|span|small|u|pre|code|blockquote|iframe)\b'
scope: entity.name.tag.text.timl
- match: '\b(?<!\-|\+)(table|tbody|td|tfoot|th|thead|tr)\b'
scope: entity.name.tag.table.timl
- match: '\b(?<!\-|\+)(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)\b'
scope: entity.name.tag.selfclosing.timl
- match: '\b(?<!\-|\+)(button|form|label|select|textarea|legend|datalist|output|option|optgroup)\b'
scope: entity.name.tag.form.timl
- match: '\b(?<!\-|\+)(ul|ol|dl|dt|dd|li)\b'
scope: entity.name.tag.list.timl
- match: '\b(-)?[0-9.]+\b'
scope: constant.numeric.tim
varIdent:
- match: '[A-Za-z_][A-Za-z_0-9]*'
scope: entity.name
pop: true
identCall:
- match: '([A-Za-z_-][A-Za-z_0-9-]*)(\()'
captures:
1: entity.name.function
pop: true
single_quoted_string:
- meta_scope: string.quoted.single.tim
- match: '\\.'
scope: constant.character.escape.tim
- match: "'"
scope: punctuation.definition.string.end.tim
pop: true
double_quoted_string:
- meta_scope: string.quoted.double.tim
- match: '\\.'
scope: constant.character.escape.tim
- match: '"'
scope: punctuation.definition.string.end.tim
pop: true
triple_quoted_string:
- meta_scope: string.quoted.double.tim
- match: '"""'
scope: punctuation.definition.string.end.tim
pop: true
- match: '"'
pop: false
line_comment:
- meta_scope: comment.line.tim
- match: $
pop: true
jsSnippet:
- match: '@\b(js|do)\b'
scope: keyword.control.import.tim
embed: scope:source.js
embed_scope: meta.tag.tim
escape: ({{end_block}})
escape_captures:
0: keyword.control.import.tim punctuation.definition.tag.end.tim
json:
- match: '@\b(json)\b'
scope: keyword.control.import.tim
embed: scope:source.json
embed_scope: meta.tag.tim
escape: ({{end_block}})
escape_captures:
0: keyword.control.import.tim punctuation.definition.tag.end.tim
yaml:
- match: '@\b(yaml)\b'
scope: keyword.control.import.tim
embed: scope:source.yaml
embed_scope: meta.tag.tim
escape: ({{end_block}})
escape_captures:
0: keyword.control.import.tim punctuation.definition.tag.end.tim
cssSnippet:
- match: '@\b(css)\b'
scope: keyword.control.import.tim
embed: scope:source.css
embed_scope: meta.tag.tim
escape: ({{end_block}})
escape_captures:
0: keyword.control.import.tim punctuation.definition.tag.end.tim
styleSnippet:
- match: '\b(style)\b:(\s*?)(\"\"\")'
captures:
1: entity.name.tag.timl
embed: scope:source.css
embed_scope: meta.tag.tim
escape: (\"\"\")
escape_captures:
0: triple_quoted_string punctuation.definition.tag.end.tim
scriptSnippet:
- match: '\b(script)\b:(\s*?)(\"\"\")'
captures:
1: entity.name.tag.timl
embed: scope:source.js
embed_scope: meta.tag.tim
escape: (\"\"\")
escape_captures:
0: triple_quoted_string punctuation.definition.tag.end.tim