-
Notifications
You must be signed in to change notification settings - Fork 0
/
aurelia-typescript-v2.sublime-syntax
214 lines (168 loc) · 4.93 KB
/
aurelia-typescript-v2.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
%YAML 1.2
---
name: Aurelia TypeScript v2
scope: source.ts.aurelia.v2
version: 2
extends: Packages/JavaScript/TypeScript.sublime-syntax
file_extensions: [ts,cts,mts]
# variables:
# au_quotes: (?:\'[^\']*\')|(?:\"[^\"]*\")|(?:\`[^\`]*\`)
contexts:
main:
- meta_prepend: true
decorator:
- match: '@(?=customElement)'
scope: punctuation.definition.annotation.js
push:
- decorator-meta
- decorator-expression-end
# - decorator-expression-begin
- decorator-expression-begin-au
- match: '@'
scope: punctuation.definition.annotation.js
push:
- decorator-meta
- decorator-expression-end
- decorator-expression-begin
decorator-expression-begin-au:
- include: decorator-name
- include: parenthesized-expression
- include: expression-begin-au
expression-begin-au:
- match: (?=customElement)
scope: meta.function-call.js
set:
- function-call-arguments-au
- literal-variable
- include: literal-string
- include: literal-string-template
- include: literal-number
- include: prefix-operators
# - include: object-literal
- include: object-literal-au
- include: array-literal
- include: else-pop
function-call-arguments-au:
- match: \(
scope: punctuation.section.group.begin.js
set:
- meta_scope: meta.group.js
- match: \)
scope: punctuation.section.group.end.js
pop: true
- include: expression-list-au
expression-list-au:
- include: expression-break
- include: comma-separator
- match: (?=\S)
push: expression-no-comma-au
expression-no-comma-au:
- meta_include_prototype: false
- match: ''
set:
- expression-end-no-comma
- expression-begin-au
object-literal-au:
- match: '\{'
scope: punctuation.section.mapping.begin.js
# set: object-literal-contents
set: object-literal-contents-au
object-literal-contents-au:
- meta_scope: meta.mapping.js
- match: '\}'
scope: punctuation.section.mapping.end.js
pop: 1
- match: \.\.\.
scope: keyword.operator.spread.js
push: expression-no-comma
- match: >-
(?x)(?=
{{property_name}}\s*:\s*
{{either_func_lookahead}}
)
push:
- object-literal-meta-key
- method-name
- match: (?=\*)
push: method-declaration
- match: (?={{property_name}})
# push: object-literal-element
push: object-literal-element-au
- include: comma-separator
- match: ':'
scope: punctuation.separator.key-value.js
push: expression-no-comma
# If there's any garbage, parse it as an expression
# so that close braces won't break things.
- match: (?=\S)
push: expression-no-comma
object-literal-element-au:
- match: '{{identifier_name}}(?=\s*(?:[},]|$|//|/\*))'
scope: variable.other.readwrite.js
pop: 1
- match: (?=\S)
pop: 1
branch_point: object-literal-property-au
branch:
- object-literal-property-au
- method-declaration
object-literal-property-au:
- match: ''
set:
- object-literal-property-check-au
- object-literal-meta-key
- object-property-name-au
object-literal-property-check-au:
- match: (?=\()
fail: object-literal-property-au
- include: else-pop
object-property-name-au:
- match: '\btemplate\b(?=\s*\:)'
pop: 2
set:
- match: ':'
scope: punctuation.separator.key-value.js
pop: 2
set:
- include: literal-string-au
- include: literal-string-template-au
- include: literal-number
- include: prefix-operators
- include: else-pop
- include: else-pop
- include: computed-property-name
- include: literal-string
- include: literal-number
- match: '{{identifier_name}}'
pop: 1
- include: else-pop
literal-string-au:
- include: literal-double-quoted-string-au
- include: literal-single-quoted-string-au
literal-double-quoted-string-au:
- clear_scopes: true
- match: \"
scope: punctuation.definition.string.begin.js
embed: scope:text.html.aurelia.v2
embed_scope: text.html.aurelia.v2
escape: \"
escape_captures:
0: punctuation.definition.string.end.js
literal-single-quoted-string-au:
- clear_scopes: true
- match: \'
scope: punctuation.definition.string.begin.js
embed: scope:text.html.aurelia.v2
embed_scope: text.html.aurelia.v2
escape: \'
escape_captures:
0: punctuation.definition.string.end.js
literal-string-template-au:
- clear_scopes: true
- match: \`
scope: punctuation.definition.string.begin.js
embed: scope:text.html.aurelia.v2
embed_scope: text.html.aurelia.v2
escape: \`
escape_captures:
0: punctuation.definition.string.end.js