on 5e93514 help sign in
bat/assets/syntaxes/TypeScript.sublime-syntax
3027 lines 151 kB history raw
1%YAML 1.2
2---
3# http://www.sublimetext.com/docs/3/syntax.html
4name: TypeScript
5file_extensions:
6 - ts
7scope: source.ts
8contexts:
9 main:
10 - include: directives
11 - include: statements
12 - match: \A(#!).*(?=$)
13 scope: comment.line.shebang.ts
14 captures:
15 1: punctuation.definition.comment.ts
16 comment:
17 - match: /\*\*(?!/)
18 captures:
19 0: punctuation.definition.comment.ts
20 push:
21 - meta_scope: comment.block.documentation.ts
22 - match: \*/
23 captures:
24 0: punctuation.definition.comment.ts
25 pop: true
26 - include: docblock
27 - match: (/\*)(?:\s*((@)internal)(?=\s|(\*/)))?
28 captures:
29 1: punctuation.definition.comment.ts
30 2: storage.type.internaldeclaration.ts
31 3: punctuation.decorator.internaldeclaration.ts
32 push:
33 - meta_scope: comment.block.ts
34 - match: \*/
35 captures:
36 0: punctuation.definition.comment.ts
37 pop: true
38 - match: '(^[ \t]+)?((//)(?:\s*((@)internal)(?=\s|$))?)'
39 captures:
40 1: punctuation.whitespace.comment.leading.ts
41 2: comment.line.double-slash.ts
42 3: punctuation.definition.comment.ts
43 4: storage.type.internaldeclaration.ts
44 5: punctuation.decorator.internaldeclaration.ts
45 push:
46 - meta_content_scope: comment.line.double-slash.ts
47 - match: (?=^)
48 pop: true
49 access-modifier:
50 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(abstract|public|protected|private|readonly|static)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
51 scope: storage.modifier.ts
52 after-operator-block-as-object-literal:
53 - match: '(?<!\+\+|--)(?<=[:=(,\[?+!>]|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^yield|[^\._$[:alnum:]]yield|^throw|[^\._$[:alnum:]]throw|^in|[^\._$[:alnum:]]in|^of|[^\._$[:alnum:]]of|^typeof|[^\._$[:alnum:]]typeof|&&|\|\||\*)\s*(\{)'
54 captures:
55 1: punctuation.definition.block.ts
56 push:
57 - meta_scope: meta.objectliteral.ts
58 - match: '\}'
59 captures:
60 0: punctuation.definition.block.ts
61 pop: true
62 - include: object-member
63 array-binding-pattern:
64 - match: '(?:(\.\.\.)\s*)?(\[)'
65 captures:
66 1: keyword.operator.rest.ts
67 2: punctuation.definition.binding-pattern.array.ts
68 push:
69 - match: '\]'
70 captures:
71 0: punctuation.definition.binding-pattern.array.ts
72 pop: true
73 - include: binding-element
74 - include: punctuation-comma
75 array-binding-pattern-const:
76 - match: '(?:(\.\.\.)\s*)?(\[)'
77 captures:
78 1: keyword.operator.rest.ts
79 2: punctuation.definition.binding-pattern.array.ts
80 push:
81 - match: '\]'
82 captures:
83 0: punctuation.definition.binding-pattern.array.ts
84 pop: true
85 - include: binding-element-const
86 - include: punctuation-comma
87 array-literal:
88 - match: '\s*(\[)'
89 captures:
90 1: meta.brace.square.ts
91 push:
92 - meta_scope: meta.array.literal.ts
93 - match: '\]'
94 captures:
95 0: meta.brace.square.ts
96 pop: true
97 - include: expression
98 - include: punctuation-comma
99 arrow-function:
100 - match: '(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(\basync)\s+)?([_$[:alpha:]][_$[:alnum:]]*)\s*(?==>)'
101 scope: meta.arrow.ts
102 captures:
103 1: storage.modifier.async.ts
104 2: variable.parameter.ts
105 - match: |-
106 (?x) (?:
107 (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(\basync)
108 )? ((?<![})!\]])\s*
109 (?=
110 # sure shot arrow functions even if => is on new line
111 (
112 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
113 [(]\s*
114 (
115 ([)]\s*:) | # ():
116 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
117 )
118 ) |
119 (
120 [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends
121 ) |
122 # arrow function possible to detect only with => on same line
123 (
124 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
125 \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
126 (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
127 \s*=> # arrow operator
128 )
129 )
130 )
131 captures:
132 1: storage.modifier.async.ts
133 push:
134 - meta_scope: meta.arrow.ts
135 - match: '(?==>|\{|(^\s*(export|function|class|interface|let|var|const|import|enum|namespace|module|type|abstract|declare)\s+))'
136 pop: true
137 - include: comment
138 - include: type-parameters
139 - include: function-parameters
140 - include: arrow-return-type
141 - match: "=>"
142 captures:
143 0: storage.type.function.arrow.ts
144 push:
145 - meta_scope: meta.arrow.ts
146 - match: '(?<=\}|\S)(?<!=>)|((?!\{)(?=\S))'
147 pop: true
148 - include: decl-block
149 - include: expression
150 arrow-return-type:
151 - match: (?<=\))\s*(:)
152 captures:
153 1: keyword.operator.type.annotation.ts
154 push:
155 - meta_scope: meta.return.type.arrow.ts
156 - match: '(?==>|\{|(^\s*(export|function|class|interface|let|var|const|import|enum|namespace|module|type|abstract|declare)\s+))'
157 pop: true
158 - include: arrow-return-type-body
159 arrow-return-type-body:
160 - match: '(?<=[:])(?=\s*\{)'
161 push:
162 - match: '(?<=\})'
163 pop: true
164 - include: type-object
165 - include: type-predicate-operator
166 - include: type
167 async-modifier:
168 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(async)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
169 scope: storage.modifier.async.ts
170 binding-element:
171 - include: comment
172 - include: string
173 - include: object-binding-pattern
174 - include: array-binding-pattern
175 - include: destructuring-variable-rest
176 - include: variable-initializer
177 binding-element-const:
178 - include: comment
179 - include: string
180 - include: object-binding-pattern-const
181 - include: array-binding-pattern-const
182 - include: destructuring-variable-rest-const
183 - include: variable-initializer
184 boolean-literal:
185 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))true(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
186 scope: constant.language.boolean.true.ts
187 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))false(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
188 scope: constant.language.boolean.false.ts
189 brackets:
190 - match: "{"
191 push:
192 - match: '}|(?=\*/)'
193 pop: true
194 - include: brackets
195 - match: '\['
196 push:
197 - match: '\]|(?=\*/)'
198 pop: true
199 - include: brackets
200 cast:
201 - match: '(?:(?<!\+\+|--)(?<=^return|[^\._$[:alnum:]]return|^throw|[^\._$[:alnum:]]throw|^yield|[^\._$[:alnum:]]yield|^await|[^\._$[:alnum:]]await|^default|[^\._$[:alnum:]]default|[=(,:>*?\&\|\^]|[^_$[:alnum:]](?:\+\+|\-\-)|[^\+]\+|[^\-]\-))\s*(<)(?!<?\=)(?!\s*$)'
202 captures:
203 1: meta.brace.angle.ts
204 push:
205 - meta_scope: cast.expr.ts
206 - match: (\>)\s*
207 captures:
208 1: meta.brace.angle.ts
209 pop: true
210 - include: type
211 - match: '(?:(?<=^))\s*(<)(?=[_$[:alpha:]][_$[:alnum:]]*\s*>)'
212 captures:
213 1: meta.brace.angle.ts
214 push:
215 - meta_scope: cast.expr.ts
216 - match: (\>)\s*
217 captures:
218 1: meta.brace.angle.ts
219 pop: true
220 - include: type
221 class-declaration:
222 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(export)\s+)?\b(?:(abstract)\s+)?\b(class)\b(?=\s+|/[/*])'
223 captures:
224 1: keyword.control.export.ts
225 2: storage.modifier.ts
226 3: storage.type.class.ts
227 push:
228 - meta_scope: meta.class.ts
229 - match: '(?<=\})'
230 pop: true
231 - include: class-declaration-or-expression-patterns
232 class-declaration-or-expression-patterns:
233 - include: comment
234 - include: class-or-interface-heritage
235 - match: "[_$[:alpha:]][_$[:alnum:]]*"
236 captures:
237 0: entity.name.type.class.ts
238 - include: type-parameters
239 - include: class-or-interface-body
240 class-expression:
241 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(class)\b(?=\s+|[<{]|\/[\/*])'
242 captures:
243 1: storage.type.class.ts
244 push:
245 - meta_scope: meta.class.ts
246 - match: '(?<=\})'
247 pop: true
248 - include: class-declaration-or-expression-patterns
249 class-or-interface-body:
250 - match: '\{'
251 captures:
252 0: punctuation.definition.block.ts
253 push:
254 - match: '\}'
255 captures:
256 0: punctuation.definition.block.ts
257 pop: true
258 - include: comment
259 - include: decorator
260 - include: method-declaration
261 - include: indexer-declaration
262 - include: field-declaration
263 - include: string
264 - include: type-annotation
265 - include: variable-initializer
266 - include: access-modifier
267 - include: property-accessor
268 - include: async-modifier
269 - include: after-operator-block-as-object-literal
270 - include: decl-block
271 - include: expression
272 - include: punctuation-comma
273 - include: punctuation-semicolon
274 class-or-interface-heritage:
275 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(extends|implements)\b)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
276 captures:
277 1: storage.modifier.ts
278 push:
279 - match: '(?=\{)'
280 pop: true
281 - include: comment
282 - include: class-or-interface-heritage
283 - include: type-parameters
284 - include: expressionWithoutIdentifiers
285 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))(?=\s*[_$[:alpha:]][_$[:alnum:]]*(\s*\??\.\s*[_$[:alpha:]][_$[:alnum:]]*)*\s*)'
286 captures:
287 1: entity.name.type.module.ts
288 2: punctuation.accessor.ts
289 3: punctuation.accessor.optional.ts
290 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
291 captures:
292 1: entity.other.inherited-class.ts
293 - include: expressionPunctuations
294 control-statement:
295 - include: switch-statement
296 - include: for-loop
297 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(catch|finally|throw|try)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
298 scope: keyword.control.trycatch.ts
299 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(break|continue|goto)\s+([_$[:alpha:]][_$[:alnum:]]*)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
300 captures:
301 1: keyword.control.loop.ts
302 2: entity.name.label.ts
303 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(break|continue|do|goto|while)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
304 scope: keyword.control.loop.ts
305 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(return)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
306 scope: keyword.control.flow.ts
307 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(case|default|switch)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
308 scope: keyword.control.switch.ts
309 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(else|if)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
310 scope: keyword.control.conditional.ts
311 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(with)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
312 scope: keyword.control.with.ts
313 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(package)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
314 scope: keyword.control.ts
315 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(debugger)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
316 scope: keyword.other.debugger.ts
317 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(declare)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
318 scope: storage.modifier.ts
319 decl-block:
320 - match: '\{'
321 captures:
322 0: punctuation.definition.block.ts
323 push:
324 - meta_scope: meta.block.ts
325 - match: '\}'
326 captures:
327 0: punctuation.definition.block.ts
328 pop: true
329 - include: statements
330 declaration:
331 - include: decorator
332 - include: var-expr
333 - include: function-declaration
334 - include: class-declaration
335 - include: interface-declaration
336 - include: enum-declaration
337 - include: namespace-declaration
338 - include: type-alias-declaration
339 - include: import-equals-declaration
340 - include: import-declaration
341 - include: export-declaration
342 decorator:
343 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))\@'
344 captures:
345 0: punctuation.decorator.ts
346 push:
347 - meta_scope: meta.decorator.ts
348 - match: (?=\s)
349 pop: true
350 - include: expression
351 destructuring-const:
352 - match: '(?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\{)'
353 push:
354 - meta_scope: meta.object-binding-pattern-variable.ts
355 - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
356 pop: true
357 - include: object-binding-pattern-const
358 - include: type-annotation
359 - include: comment
360 - match: '(?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\[)'
361 push:
362 - meta_scope: meta.array-binding-pattern-variable.ts
363 - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
364 pop: true
365 - include: array-binding-pattern-const
366 - include: type-annotation
367 - include: comment
368 destructuring-parameter:
369 - match: '(?<!=|:)\s*(\{)'
370 captures:
371 1: punctuation.definition.binding-pattern.object.ts
372 push:
373 - meta_scope: meta.parameter.object-binding-pattern.ts
374 - match: '\}'
375 captures:
376 0: punctuation.definition.binding-pattern.object.ts
377 pop: true
378 - include: parameter-object-binding-element
379 - match: '(?<!=|:)\s*(\[)'
380 captures:
381 1: punctuation.definition.binding-pattern.array.ts
382 push:
383 - meta_scope: meta.paramter.array-binding-pattern.ts
384 - match: '\]'
385 captures:
386 0: punctuation.definition.binding-pattern.array.ts
387 pop: true
388 - include: parameter-binding-element
389 - include: punctuation-comma
390 destructuring-parameter-rest:
391 - match: '(?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*)'
392 captures:
393 1: keyword.operator.rest.ts
394 2: variable.parameter.ts
395 destructuring-variable:
396 - match: '(?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\{)'
397 push:
398 - meta_scope: meta.object-binding-pattern-variable.ts
399 - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
400 pop: true
401 - include: object-binding-pattern
402 - include: type-annotation
403 - include: comment
404 - match: '(?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\[)'
405 push:
406 - meta_scope: meta.array-binding-pattern-variable.ts
407 - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
408 pop: true
409 - include: array-binding-pattern
410 - include: type-annotation
411 - include: comment
412 destructuring-variable-rest:
413 - match: '(?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*)'
414 captures:
415 1: keyword.operator.rest.ts
416 2: meta.definition.variable.ts variable.other.readwrite.ts
417 destructuring-variable-rest-const:
418 - match: '(?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*)'
419 captures:
420 1: keyword.operator.rest.ts
421 2: meta.definition.variable.ts variable.other.constant.ts
422 directives:
423 - match: '^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*((\''([^\''\\]|\\\''|\\)*\'')|(\"([^\"\\]|\\\"|\\)*\")))+\s*/>\s*$)'
424 captures:
425 1: punctuation.definition.comment.ts
426 push:
427 - meta_scope: comment.line.triple-slash.directive.ts
428 - match: (?=^)
429 pop: true
430 - match: (<)(reference|amd-dependency|amd-module)
431 captures:
432 1: punctuation.definition.tag.directive.ts
433 2: entity.name.tag.directive.ts
434 push:
435 - meta_scope: meta.tag.ts
436 - match: />
437 captures:
438 0: punctuation.definition.tag.directive.ts
439 pop: true
440 - match: path|types|no-default-lib|lib|name
441 scope: entity.other.attribute-name.directive.ts
442 - match: "="
443 scope: keyword.operator.assignment.ts
444 - include: string
445 docblock:
446 - match: |-
447 (?x)
448 ((@)(?:access|api))
449 \s+
450 (private|protected|public)
451 \b
452 captures:
453 1: storage.type.class.jsdoc
454 2: punctuation.definition.block.tag.jsdoc
455 3: constant.language.access-type.jsdoc
456 - match: |-
457 (?x)
458 ((@)author)
459 \s+
460 (
461 [^@\s<>*/]
462 (?:[^@<>*/]|\*[^/])*
463 )
464 (?:
465 \s*
466 (<)
467 ([^>\s]+)
468 (>)
469 )?
470 captures:
471 1: storage.type.class.jsdoc
472 2: punctuation.definition.block.tag.jsdoc
473 3: entity.name.type.instance.jsdoc
474 4: punctuation.definition.bracket.angle.begin.jsdoc
475 5: constant.other.email.link.underline.jsdoc
476 6: punctuation.definition.bracket.angle.end.jsdoc
477 - match: |-
478 (?x)
479 ((@)borrows) \s+
480 ((?:[^@\s*/]|\*[^/])+) # <that namepath>
481 \s+ (as) \s+ # as
482 ((?:[^@\s*/]|\*[^/])+) # <this namepath>
483 captures:
484 1: storage.type.class.jsdoc
485 2: punctuation.definition.block.tag.jsdoc
486 3: entity.name.type.instance.jsdoc
487 4: keyword.operator.control.jsdoc
488 5: entity.name.type.instance.jsdoc
489 - match: ((@)example)\s+
490 captures:
491 1: storage.type.class.jsdoc
492 2: punctuation.definition.block.tag.jsdoc
493 push:
494 - meta_scope: meta.example.jsdoc
495 - match: (?=@|\*/)
496 pop: true
497 - match: ^\s\*\s+
498 - match: \G(<)caption(>)
499 captures:
500 0: entity.name.tag.inline.jsdoc
501 1: punctuation.definition.bracket.angle.begin.jsdoc
502 2: punctuation.definition.bracket.angle.end.jsdoc
503 push:
504 - meta_content_scope: constant.other.description.jsdoc
505 - match: (</)caption(>)|(?=\*/)
506 captures:
507 0: entity.name.tag.inline.jsdoc
508 1: punctuation.definition.bracket.angle.begin.jsdoc
509 2: punctuation.definition.bracket.angle.end.jsdoc
510 pop: true
511 - match: '[^\s@*](?:[^*]|\*[^/])*'
512 captures:
513 0: source.embedded.ts
514 - match: (?x) ((@)kind) \s+ (class|constant|event|external|file|function|member|mixin|module|namespace|typedef) \b
515 captures:
516 1: storage.type.class.jsdoc
517 2: punctuation.definition.block.tag.jsdoc
518 3: constant.language.symbol-type.jsdoc
519 - match: |-
520 (?x)
521 ((@)see)
522 \s+
523 (?:
524 # URL
525 (
526 (?=https?://)
527 (?:[^\s*]|\*[^/])+
528 )
529 |
530 # JSDoc namepath
531 (
532 (?!
533 # Avoid matching bare URIs (also acceptable as links)
534 https?://
535 |
536 # Avoid matching {@inline tags}; we match those below
537 (?:\[[^\[\]]*\])? # Possible description [preceding]{@tag}
538 {@(?:link|linkcode|linkplain|tutorial)\b
539 )
540 # Matched namepath
541 (?:[^@\s*/]|\*[^/])+
542 )
543 )
544 captures:
545 1: storage.type.class.jsdoc
546 2: punctuation.definition.block.tag.jsdoc
547 3: variable.other.link.underline.jsdoc
548 4: entity.name.type.instance.jsdoc
549 - match: |-
550 (?x)
551 ((@)template)
552 \s+
553 # One or more valid identifiers
554 (
555 [A-Za-z_$] # First character: non-numeric word character
556 [\w$.\[\]]* # Rest of identifier
557 (?: # Possible list of additional identifiers
558 \s* , \s*
559 [A-Za-z_$]
560 [\w$.\[\]]*
561 )*
562 )
563 captures:
564 1: storage.type.class.jsdoc
565 2: punctuation.definition.block.tag.jsdoc
566 3: variable.other.jsdoc
567 - match: |-
568 (?x)
569 (
570 (@)
571 (?:arg|argument|const|constant|member|namespace|param|var)
572 )
573 \s+
574 (
575 [A-Za-z_$]
576 [\w$.\[\]]*
577 )
578 captures:
579 1: storage.type.class.jsdoc
580 2: punctuation.definition.block.tag.jsdoc
581 3: variable.other.jsdoc
582 - match: '((@)typedef)\s+(?={)'
583 captures:
584 1: storage.type.class.jsdoc
585 2: punctuation.definition.block.tag.jsdoc
586 push:
587 - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])'
588 pop: true
589 - include: jsdoctype
590 - match: '(?:[^@\s*/]|\*[^/])+'
591 scope: entity.name.type.instance.jsdoc
592 - match: '((@)(?:arg|argument|const|constant|member|namespace|param|prop|property|var))\s+(?={)'
593 captures:
594 1: storage.type.class.jsdoc
595 2: punctuation.definition.block.tag.jsdoc
596 push:
597 - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])'
598 pop: true
599 - include: jsdoctype
600 - match: '([A-Za-z_$][\w$.\[\]]*)'
601 scope: variable.other.jsdoc
602 - match: |-
603 (?x)
604 (\[)\s*
605 [\w$]+
606 (?:
607 (?:\[\])? # Foo[ ].bar properties within an array
608 \. # Foo.Bar namespaced parameter
609 [\w$]+
610 )*
611 (?:
612 \s*
613 (=) # [foo=bar] Default parameter value
614 \s*
615 (
616 # The inner regexes are to stop the match early at */ and to not stop at escaped quotes
617 (?>
618 "(?:(?:\*(?!/))|(?:\\(?!"))|[^*\\])*?" | # [foo="bar"] Double-quoted
619 '(?:(?:\*(?!/))|(?:\\(?!'))|[^*\\])*?' | # [foo='bar'] Single-quoted
620 \[ (?:(?:\*(?!/))|[^*])*? \] | # [foo=[1,2]] Array literal
621 (?:(?:\*(?!/))|\s(?!\s*\])|\[.*?(?:\]|(?=\*/))|[^*\s\[\]])* # Everything else
622 )*
623 )
624 )?
625 \s*(?:(\])((?:[^*\s]|\*[^\s/])+)?|(?=\*/))
626 scope: variable.other.jsdoc
627 captures:
628 1: punctuation.definition.optional-value.begin.bracket.square.jsdoc
629 2: keyword.operator.assignment.jsdoc
630 3: source.embedded.ts
631 4: punctuation.definition.optional-value.end.bracket.square.jsdoc
632 5: invalid.illegal.syntax.jsdoc
633 - match: |-
634 (?x)
635 (
636 (@)
637 (?:define|enum|exception|export|extends|lends|implements|modifies
638 |namespace|private|protected|returns?|suppress|this|throws|type
639 |yields?)
640 )
641 \s+(?={)
642 captures:
643 1: storage.type.class.jsdoc
644 2: punctuation.definition.block.tag.jsdoc
645 push:
646 - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])'
647 pop: true
648 - include: jsdoctype
649 - match: |-
650 (?x)
651 (
652 (@)
653 (?:alias|augments|callback|constructs|emits|event|fires|exports?
654 |extends|external|function|func|host|lends|listens|interface|memberof!?
655 |method|module|mixes|mixin|name|requires|see|this|typedef|uses)
656 )
657 \s+
658 (
659 (?:
660 [^{}@\s*] | \*[^/]
661 )+
662 )
663 captures:
664 1: storage.type.class.jsdoc
665 2: punctuation.definition.block.tag.jsdoc
666 3: entity.name.type.instance.jsdoc
667 - match: '((@)(?:default(?:value)?|license|version))\s+(([''''"]))'
668 captures:
669 1: storage.type.class.jsdoc
670 2: punctuation.definition.block.tag.jsdoc
671 3: variable.other.jsdoc
672 4: punctuation.definition.string.begin.jsdoc
673 push:
674 - meta_content_scope: variable.other.jsdoc
675 - match: (\3)|(?=$|\*/)
676 captures:
677 0: variable.other.jsdoc
678 1: punctuation.definition.string.end.jsdoc
679 pop: true
680 - match: '((@)(?:default(?:value)?|license|tutorial|variation|version))\s+([^\s*]+)'
681 captures:
682 1: storage.type.class.jsdoc
683 2: punctuation.definition.block.tag.jsdoc
684 3: variable.other.jsdoc
685 - match: '(?x) (@) (?:abstract|access|alias|api|arg|argument|async|attribute|augments|author|beta|borrows|bubbles |callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright |default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exception |exports?|extends|extension(?:_?for)?|external|externs|file|fileoverview|final|fires|for|func |function|generator|global|hideconstructor|host|ignore|implements|implicitCast|inherit[Dd]oc |inner|instance|interface|internal|kind|lends|license|listens|main|member|memberof!?|method |mixes|mixins?|modifies|module|name|namespace|noalias|nocollapse|nocompile|nosideeffects |override|overview|package|param|polymer(?:Behavior)?|preserve|private|prop|property|protected |public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule|summary |suppress|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation |version|virtual|writeOnce|yields?) \b'
686 scope: storage.type.class.jsdoc
687 captures:
688 1: punctuation.definition.block.tag.jsdoc
689 - include: inline-tags
690 enum-declaration:
691 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:\b(const)\s+)?\b(enum)\s+([_$[:alpha:]][_$[:alnum:]]*)'
692 captures:
693 1: keyword.control.export.ts
694 2: storage.modifier.ts
695 3: storage.type.enum.ts
696 4: entity.name.type.enum.ts
697 push:
698 - meta_scope: meta.enum.declaration.ts
699 - match: '(?<=\})'
700 pop: true
701 - include: comment
702 - match: '\{'
703 captures:
704 0: punctuation.definition.block.ts
705 push:
706 - match: '\}'
707 captures:
708 0: punctuation.definition.block.ts
709 pop: true
710 - include: comment
711 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
712 captures:
713 0: variable.other.enummember.ts
714 push:
715 - match: '(?=,|\}|$)'
716 pop: true
717 - include: comment
718 - include: variable-initializer
719 - match: '(?=((\''([^\''\\]|\\\''|\\)*\'')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\])))'
720 push:
721 - match: '(?=,|\}|$)'
722 pop: true
723 - include: string
724 - include: array-literal
725 - include: comment
726 - include: variable-initializer
727 - include: punctuation-comma
728 export-declaration:
729 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(export)\s+(as)\s+(namespace)\s+([_$[:alpha:]][_$[:alnum:]]*)'
730 captures:
731 1: keyword.control.export.ts
732 2: keyword.control.as.ts
733 3: storage.type.namespace.ts
734 4: entity.name.type.module.ts
735 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(export)(?:(?:\s*(=))|(?:\s+(default)(?=\s+)))'
736 captures:
737 1: keyword.control.export.ts
738 2: keyword.operator.assignment.ts
739 3: keyword.control.default.ts
740 push:
741 - meta_scope: meta.export.default.ts
742 - match: (?=$|;|^\s*abstract\b|^\s*async\b|^\s*class\b|^\s*const\b|^\s*declare\b|^\s*enum\b|^\s*export\b|^\s*function\b|^\s*import\b|^\s*interface\b|^\s*let\b|^\s*module\b|^\s*namespace\b|^\s*return\b|^\s*type\b|^\s*var\b)
743 pop: true
744 - include: expression
745 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(export)(?!\s*:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
746 captures:
747 0: keyword.control.export.ts
748 push:
749 - meta_scope: meta.export.ts
750 - match: (?=$|;|^\s*abstract\b|^\s*async\b|^\s*class\b|^\s*const\b|^\s*declare\b|^\s*enum\b|^\s*export\b|^\s*function\b|^\s*import\b|^\s*interface\b|^\s*let\b|^\s*module\b|^\s*namespace\b|^\s*return\b|^\s*type\b|^\s*var\b)
751 pop: true
752 - include: import-export-declaration
753 expression:
754 - include: expressionWithoutIdentifiers
755 - include: identifiers
756 - include: expressionPunctuations
757 expression-inside-possibly-arrow-parens:
758 - include: expressionWithoutIdentifiers
759 - include: function-parameters-body
760 - include: identifiers
761 - include: expressionPunctuations
762 expression-operators:
763 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(await)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
764 scope: keyword.control.flow.ts
765 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(yield)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?=\s*\/\*([^\*]|(\*[^\/]))*\*\/\s*\*)'
766 captures:
767 1: keyword.control.flow.ts
768 push:
769 - match: \*
770 captures:
771 0: keyword.generator.asterisk.ts
772 pop: true
773 - include: comment
774 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(yield)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?:\s*(\*))?'
775 captures:
776 1: keyword.control.flow.ts
777 2: keyword.generator.asterisk.ts
778 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))delete(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
779 scope: keyword.operator.expression.delete.ts
780 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))in(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?!\()'
781 scope: keyword.operator.expression.in.ts
782 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))of(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?!\()'
783 scope: keyword.operator.expression.of.ts
784 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))instanceof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
785 scope: keyword.operator.expression.instanceof.ts
786 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
787 scope: keyword.operator.new.ts
788 - include: typeof-operator
789 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))void(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
790 scope: keyword.operator.expression.void.ts
791 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+'
792 captures:
793 1: keyword.control.as.ts
794 push:
795 - match: '(?=$|^|[;,:})\]]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+))'
796 pop: true
797 - include: type
798 - match: \.\.\.
799 scope: keyword.operator.spread.ts
800 - match: \*=|(?<!\()/=|%=|\+=|\-=
801 scope: keyword.operator.assignment.compound.ts
802 - match: \&=|\^=|<<=|>>=|>>>=|\|=
803 scope: keyword.operator.assignment.compound.bitwise.ts
804 - match: "<<|>>>|>>"
805 scope: keyword.operator.bitwise.shift.ts
806 - match: "===|!==|==|!="
807 scope: keyword.operator.comparison.ts
808 - match: <=|>=|<>|<|>
809 scope: keyword.operator.relational.ts
810 - match: \!|&&|\|\|
811 scope: keyword.operator.logical.ts
812 - match: \&|~|\^|\|
813 scope: keyword.operator.bitwise.ts
814 - match: \=
815 scope: keyword.operator.assignment.ts
816 - match: "--"
817 scope: keyword.operator.decrement.ts
818 - match: \+\+
819 scope: keyword.operator.increment.ts
820 - match: '%|\*|/|-|\+'
821 scope: keyword.operator.arithmetic.ts
822 - match: '(?<=[_$[:alnum:])\]])\s*(/)(?![/*])'
823 captures:
824 1: keyword.operator.arithmetic.ts
825 expressionPunctuations:
826 - include: punctuation-comma
827 - include: punctuation-accessor
828 expressionWithoutIdentifiers:
829 - include: string
830 - include: regex
831 - include: template
832 - include: comment
833 - include: function-expression
834 - include: class-expression
835 - include: arrow-function
836 - include: paren-expression-possibly-arrow
837 - include: cast
838 - include: ternary-expression
839 - include: new-expr
840 - include: instanceof-expr
841 - include: object-literal
842 - include: expression-operators
843 - include: function-call
844 - include: literal
845 - include: support-objects
846 - include: paren-expression
847 field-declaration:
848 - match: |-
849 (?x)(?<!\()(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(readonly)\s+)?(?=\s*((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
850 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
851 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
852 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
853 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
854 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
855 (?:\b[0-9][0-9_]*(\.)\B)| # 1.
856 (?:\B(\.)[0-9][0-9_]*\b)| # .1
857 (?:\b[0-9][0-9_]*\b(?!\.)) # 1
858 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:))
859 captures:
860 1: storage.modifier.ts
861 push:
862 - meta_scope: meta.field.declaration.ts
863 - match: |-
864 (?x)(?=\}|;|,|$|(^(?!\s*((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
865 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
866 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
867 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
868 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
869 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
870 (?:\b[0-9][0-9_]*(\.)\B)| # 1.
871 (?:\B(\.)[0-9][0-9_]*\b)| # .1
872 (?:\b[0-9][0-9_]*\b(?!\.)) # 1
873 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:))))|(?<=\})
874 pop: true
875 - include: variable-initializer
876 - match: |-
877 (?x)(?=((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
878 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
879 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
880 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
881 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
882 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
883 (?:\b[0-9][0-9_]*(\.)\B)| # 1.
884 (?:\B(\.)[0-9][0-9_]*\b)| # .1
885 (?:\b[0-9][0-9_]*\b(?!\.)) # 1
886 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:))
887 push:
888 - match: |-
889 (?x)(?=[};,=]|$|(^(?!\s*((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
890 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
891 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
892 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
893 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
894 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
895 (?:\b[0-9][0-9_]*(\.)\B)| # 1.
896 (?:\B(\.)[0-9][0-9_]*\b)| # .1
897 (?:\b[0-9][0-9_]*\b(?!\.)) # 1
898 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:))))|(?<=\})
899 pop: true
900 - include: type-annotation
901 - include: string
902 - include: array-literal
903 - include: numeric-literal
904 - include: comment
905 - match: |-
906 (?x)([_$[:alpha:]][_$[:alnum:]]*)(\?)?(?=(\?\s*)?\s*
907 # function assignment |
908 (=\s*(
909 ((async\s+)?(
910 (function\s*[(<*]) |
911 (function\s+) |
912 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
913 )) |
914 ((async\s*)?(
915 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?[\(]\s*([\{\[]\s*)?$)) |
916 # sure shot arrow functions even if => is on new line
917 (
918 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
919 [(]\s*
920 (
921 ([)]\s*:) | # ():
922 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
923 )
924 ) |
925 (
926 [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends
927 ) |
928 # arrow function possible to detect only with => on same line
929 (
930 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
931 \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
932 (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
933 \s*=> # arrow operator
934 )
935 ))
936 )) |
937 # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
938 (:\s*(
939 (<) |
940 ([(]\s*(
941 ([)]) |
942 (\.\.\.) |
943 ([_$[:alnum:]]+\s*(
944 ([:,?=])|
945 ([)]\s*=>)
946 ))
947 ))
948 )) |
949 (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?[\(]\s*([\{\[]\s*)?$))) |
950 (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
951 ((async\s+)?(
952 (function\s*[(<*]) |
953 (function\s+) |
954 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
955 )) |
956 ((async\s*)?(
957 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?[\(]\s*([\{\[]\s*)?$)) |
958 # sure shot arrow functions even if => is on new line
959 (
960 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
961 [(]\s*
962 (
963 ([)]\s*:) | # ():
964 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
965 )
966 ) |
967 (
968 [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends
969 ) |
970 # arrow function possible to detect only with => on same line
971 (
972 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
973 \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
974 (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
975 \s*=> # arrow operator
976 )
977 ))
978 )))
979 captures:
980 1: meta.definition.property.ts entity.name.function.ts
981 2: keyword.operator.optional.ts
982 - match: "[_$[:alpha:]][_$[:alnum:]]*"
983 scope: meta.definition.property.ts variable.object.property.ts
984 - match: \?
985 scope: keyword.operator.optional.ts
986 for-loop:
987 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))for(?=((\s+|(\s*\/\*([^\*]|(\*[^\/]))*\*\/\s*))await)?\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)?(\())'
988 captures:
989 0: keyword.control.loop.ts
990 push:
991 - match: (?<=\))
992 pop: true
993 - include: comment
994 - match: await
995 scope: keyword.control.loop.ts
996 - match: \(
997 captures:
998 0: meta.brace.round.ts
999 push:
1000 - match: \)
1001 captures:
1002 0: meta.brace.round.ts
1003 pop: true
1004 - include: var-expr
1005 - include: expression
1006 - include: punctuation-semicolon
1007 function-body:
1008 - include: comment
1009 - include: type-parameters
1010 - include: function-parameters
1011 - include: return-type
1012 - include: decl-block
1013 - match: \*
1014 scope: keyword.generator.asterisk.ts
1015 function-call:
1016 - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(\?\.\s*)?(<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?!=)\>)*(?!=)>\s*)?\()'
1017 push:
1018 - match: '(?<=\))(?!(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(\?\.\s*)?(<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?!=)\>)*(?!=)>\s*)?\()'
1019 pop: true
1020 - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))'
1021 push:
1022 - meta_scope: meta.function-call.ts
1023 - match: '(?=\s*(\?\.\s*)?(<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?!=)\>)*(?!=)>\s*)?\()'
1024 pop: true
1025 - include: literal
1026 - include: support-objects
1027 - include: object-identifiers
1028 - include: punctuation-accessor
1029 - match: '(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*[\(]\s*[\"\''\`]))'
1030 scope: keyword.operator.expression.import.ts
1031 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
1032 scope: entity.name.function.ts
1033 - include: comment
1034 - match: \?\.
1035 scope: meta.function-call.ts punctuation.accessor.optional.ts
1036 - include: type-arguments
1037 - include: paren-expression
1038 function-declaration:
1039 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(export)\s+)?(?:(async)\s+)?(function\b)(?:\s*(\*))?(?:(?:\s+|(?<=\*))([_$[:alpha:]][_$[:alnum:]]*))?\s*'
1040 captures:
1041 1: keyword.control.export.ts
1042 2: storage.modifier.async.ts
1043 3: storage.type.function.ts
1044 4: keyword.generator.asterisk.ts
1045 5: meta.definition.function.ts entity.name.function.ts
1046 push:
1047 - meta_scope: meta.function.ts
1048 - match: '(?=$|^|;)|(?<=\})'
1049 pop: true
1050 - include: function-name
1051 - include: function-body
1052 function-expression:
1053 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(async)\s+)?(function\b)(?:\s*(\*))?(?:(?:\s+|(?<=\*))([_$[:alpha:]][_$[:alnum:]]*))?\s*'
1054 captures:
1055 1: storage.modifier.async.ts
1056 2: storage.type.function.ts
1057 3: keyword.generator.asterisk.ts
1058 4: meta.definition.function.ts entity.name.function.ts
1059 push:
1060 - meta_scope: meta.function.expression.ts
1061 - match: '(?<=\})'
1062 pop: true
1063 - include: function-name
1064 - include: function-body
1065 function-name:
1066 - match: "[_$[:alpha:]][_$[:alnum:]]*"
1067 scope: meta.definition.function.ts entity.name.function.ts
1068 function-parameters:
1069 - match: \(
1070 captures:
1071 0: punctuation.definition.parameters.begin.ts
1072 push:
1073 - meta_scope: meta.parameters.ts
1074 - match: \)
1075 captures:
1076 0: punctuation.definition.parameters.end.ts
1077 pop: true
1078 - include: function-parameters-body
1079 function-parameters-body:
1080 - include: comment
1081 - include: decorator
1082 - include: destructuring-parameter
1083 - include: parameter-name
1084 - include: type-annotation
1085 - include: variable-initializer
1086 - match: ","
1087 scope: punctuation.separator.parameter.ts
1088 identifiers:
1089 - include: object-identifiers
1090 - match: |-
1091 (?x)(?:(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*)?([_$[:alpha:]][_$[:alnum:]]*)(?=\s*=\s*(
1092 ((async\s+)?(
1093 (function\s*[(<*]) |
1094 (function\s+) |
1095 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
1096 )) |
1097 ((async\s*)?(
1098 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?[\(]\s*([\{\[]\s*)?$)) |
1099 # sure shot arrow functions even if => is on new line
1101 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
1102 [(]\s*
1104 ([)]\s*:) | # ():
1105 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
1107 ) |
1109 [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends
1110 ) |
1111 # arrow function possible to detect only with => on same line
1113 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
1114 \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
1115 (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
1116 \s*=> # arrow operator
1118 ))
1119 ))
1120 captures:
1121 1: punctuation.accessor.ts
1122 2: punctuation.accessor.optional.ts
1123 3: entity.name.function.ts
1124 - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])'
1125 captures:
1126 1: punctuation.accessor.ts
1127 2: punctuation.accessor.optional.ts
1128 3: variable.other.constant.property.ts
1129 - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*([_$[:alpha:]][_$[:alnum:]]*)'
1130 captures:
1131 1: punctuation.accessor.ts
1132 2: punctuation.accessor.optional.ts
1133 3: variable.other.property.ts
1134 - match: "([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])"
1135 scope: variable.other.constant.ts
1136 - match: "[_$[:alpha:]][_$[:alnum:]]*"
1137 scope: variable.other.readwrite.ts
1138 import-declaration:
1139 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?\b(import)(?!\s*[:\(])(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1140 captures:
1141 1: keyword.control.export.ts
1142 2: keyword.control.import.ts
1143 push:
1144 - meta_scope: meta.import.ts
1145 - match: '(?<!^import|[^\._$[:alnum:]]import)(?=;|$|^)'
1146 pop: true
1147 - include: comment
1148 - include: string
1149 - match: '(?<=^import|[^\._$[:alnum:]]import)(?!\s*["''])'
1150 push:
1151 - match: \bfrom\b
1152 captures:
1153 0: keyword.control.from.ts
1154 pop: true
1155 - include: import-export-declaration
1156 - include: import-export-declaration
1157 import-equals-declaration:
1158 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?\b(import)\s+([_$[:alpha:]][_$[:alnum:]]*)\s*(=)\s*(require)\s*(\()'
1159 captures:
1160 1: keyword.control.export.ts
1161 2: keyword.control.import.ts
1162 3: variable.other.readwrite.alias.ts
1163 4: keyword.operator.assignment.ts
1164 5: keyword.control.require.ts
1165 6: meta.brace.round.ts
1166 push:
1167 - meta_scope: meta.import-equals.external.ts
1168 - match: \)
1169 captures:
1170 0: meta.brace.round.ts
1171 pop: true
1172 - include: comment
1173 - include: string
1174 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?\b(import)\s+([_$[:alpha:]][_$[:alnum:]]*)\s*(=)\s*(?!require\b)'
1175 captures:
1176 1: keyword.control.export.ts
1177 2: keyword.control.import.ts
1178 3: variable.other.readwrite.alias.ts
1179 4: keyword.operator.assignment.ts
1180 push:
1181 - meta_scope: meta.import-equals.internal.ts
1182 - match: (?=;|$|^)
1183 pop: true
1184 - include: comment
1185 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))'
1186 captures:
1187 1: entity.name.type.module.ts
1188 2: punctuation.accessor.ts
1189 3: punctuation.accessor.optional.ts
1190 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
1191 scope: variable.other.readwrite.ts
1192 import-export-block:
1193 - match: '\{'
1194 captures:
1195 0: punctuation.definition.block.ts
1196 push:
1197 - meta_scope: meta.block.ts
1198 - match: '\}'
1199 captures:
1200 0: punctuation.definition.block.ts
1201 pop: true
1202 - include: import-export-clause
1203 import-export-clause:
1204 - include: comment
1205 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bdefault)|(\*)|(\b[_$[:alpha:]][_$[:alnum:]]*))\s+(as)\s+(?:(\bdefault(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|(\b[_$[:alpha:]][_$[:alnum:]]*))'
1206 captures:
1207 1: keyword.control.default.ts
1208 2: constant.language.import-export-all.ts
1209 3: variable.other.readwrite.ts
1210 4: keyword.control.as.ts
1211 5: keyword.control.default.ts
1212 6: variable.other.readwrite.alias.ts
1213 - include: punctuation-comma
1214 - match: \*
1215 scope: constant.language.import-export-all.ts
1216 - match: \b(default)\b
1217 scope: keyword.control.default.ts
1218 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
1219 scope: variable.other.readwrite.alias.ts
1220 import-export-declaration:
1221 - include: comment
1222 - include: string
1223 - include: import-export-block
1224 - match: \bfrom\b
1225 scope: keyword.control.from.ts
1226 - include: import-export-clause
1227 indexer-declaration:
1228 - match: '(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(readonly)\s*)?\s*(\[)\s*([_$[:alpha:]][_$[:alnum:]]*)\s*(?=:)'
1229 captures:
1230 1: storage.modifier.ts
1231 2: meta.brace.square.ts
1232 3: variable.parameter.ts
1233 push:
1234 - meta_scope: meta.indexer.declaration.ts
1235 - match: '(\])\s*(\?\s*)?|$'
1236 captures:
1237 1: meta.brace.square.ts
1238 2: keyword.operator.optional.ts
1239 pop: true
1240 - include: type-annotation
1241 indexer-mapped-type-declaration:
1242 - match: '(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))([+-])?(readonly)\s*)?\s*(\[)\s*([_$[:alpha:]][_$[:alnum:]]*)\s+(in)\s+'
1243 captures:
1244 1: keyword.operator.type.modifier.ts
1245 2: storage.modifier.ts
1246 3: meta.brace.square.ts
1247 4: entity.name.type.ts
1248 5: keyword.operator.expression.in.ts
1249 push:
1250 - meta_scope: meta.indexer.mappedtype.declaration.ts
1251 - match: '(\])([+-])?\s*(\?\s*)?|$'
1252 captures:
1253 1: meta.brace.square.ts
1254 2: keyword.operator.type.modifier.ts
1255 3: keyword.operator.optional.ts
1256 pop: true
1257 - include: type
1258 inline-tags:
1259 - match: '(\[)[^\]]+(\])(?={@(?:link|linkcode|linkplain|tutorial))'
1260 scope: constant.other.description.jsdoc
1261 captures:
1262 1: punctuation.definition.bracket.square.begin.jsdoc
1263 2: punctuation.definition.bracket.square.end.jsdoc
1264 - match: '({)((@)(?:link(?:code|plain)?|tutorial))\s*'
1265 captures:
1266 1: punctuation.definition.bracket.curly.begin.jsdoc
1267 2: storage.type.class.jsdoc
1268 3: punctuation.definition.inline.tag.jsdoc
1269 push:
1270 - meta_scope: entity.name.type.instance.jsdoc
1271 - match: '}|(?=\*/)'
1272 captures:
1273 0: punctuation.definition.bracket.curly.end.jsdoc
1274 pop: true
1275 - match: '\G((?=https?://)(?:[^|}\s*]|\*[/])+)(\|)?'
1276 captures:
1277 1: variable.other.link.underline.jsdoc
1278 2: punctuation.separator.pipe.jsdoc
1279 - match: '\G((?:[^{}@\s|*]|\*[^/])+)(\|)?'
1280 captures:
1281 1: variable.other.description.jsdoc
1282 2: punctuation.separator.pipe.jsdoc
1283 instanceof-expr:
1284 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(instanceof)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1285 captures:
1286 1: keyword.operator.expression.instanceof.ts
1287 push:
1288 - match: '(?<=\))|(?=[;),}\]:?]|\|\||\&\&|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
1289 pop: true
1290 - include: type
1291 interface-declaration:
1292 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(export)\s+)?\b(?:(abstract)\s+)?\b(interface)\b(?=\s+|/[/*])'
1293 captures:
1294 1: keyword.control.export.ts
1295 2: storage.modifier.ts
1296 3: storage.type.interface.ts
1297 push:
1298 - meta_scope: meta.interface.ts
1299 - match: '(?<=\})'
1300 pop: true
1301 - include: comment
1302 - include: class-or-interface-heritage
1303 - match: "[_$[:alpha:]][_$[:alnum:]]*"
1304 captures:
1305 0: entity.name.type.interface.ts
1306 - include: type-parameters
1307 - include: class-or-interface-body
1308 jsdoctype:
1309 - match: '\G{(?:[^}*]|\*[^/}])+$'
1310 scope: invalid.illegal.type.jsdoc
1311 - match: '\G({)'
1312 captures:
1313 0: entity.name.type.instance.jsdoc
1314 1: punctuation.definition.bracket.curly.begin.jsdoc
1315 push:
1316 - meta_content_scope: entity.name.type.instance.jsdoc
1317 - match: '((}))\s*|(?=\*/)'
1318 captures:
1319 1: entity.name.type.instance.jsdoc
1320 2: punctuation.definition.bracket.curly.end.jsdoc
1321 pop: true
1322 - include: brackets
1323 label:
1324 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(:)(?=\s*\{)'
1325 captures:
1326 1: entity.name.label.ts
1327 2: punctuation.separator.label.ts
1328 push:
1329 - match: '(?<=\})'
1330 pop: true
1331 - include: decl-block
1332 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(:)'
1333 captures:
1334 1: entity.name.label.ts
1335 2: punctuation.separator.label.ts
1336 literal:
1337 - include: numeric-literal
1338 - include: boolean-literal
1339 - include: null-literal
1340 - include: undefined-literal
1341 - include: numericConstant-literal
1342 - include: array-literal
1343 - include: this-literal
1344 - include: super-literal
1345 method-declaration:
1346 - match: '(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?\s*\b(constructor)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1347 captures:
1348 1: storage.modifier.ts
1349 2: storage.modifier.ts
1350 3: storage.modifier.async.ts
1351 4: storage.type.ts
1352 push:
1353 - meta_scope: meta.method.declaration.ts
1354 - match: '(?=\}|;|,|$)|(?<=\})'
1355 pop: true
1356 - include: method-declaration-name
1357 - include: function-body
1358 - match: '(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:(?:\s*\b(new)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|(?:(\*)\s*)?)(?=\s*[\(\<])'
1359 captures:
1360 1: storage.modifier.ts
1361 2: storage.modifier.ts
1362 3: storage.modifier.async.ts
1363 4: keyword.operator.new.ts
1364 5: keyword.generator.asterisk.ts
1365 push:
1366 - meta_scope: meta.method.declaration.ts
1367 - match: '(?=\}|;|,|$)|(?<=\})'
1368 pop: true
1369 - include: method-declaration-name
1370 - include: function-body
1371 - match: |-
1372 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
1373 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
1374 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
1375 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
1376 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
1377 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
1378 (?:\b[0-9][0-9_]*(\.)\B)| # 1.
1379 (?:\B(\.)[0-9][0-9_]*\b)| # .1
1380 (?:\b[0-9][0-9_]*\b(?!\.)) # 1
1381 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<])
1382 captures:
1383 1: storage.modifier.ts
1384 2: storage.modifier.ts
1385 3: storage.modifier.async.ts
1386 4: storage.type.property.ts
1387 5: keyword.generator.asterisk.ts
1388 push:
1389 - meta_scope: meta.method.declaration.ts
1390 - match: '(?=\}|;|,|$)|(?<=\})'
1391 pop: true
1392 - include: method-declaration-name
1393 - include: function-body
1394 method-declaration-name:
1395 - match: |-
1396 (?x)(?=((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
1397 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
1398 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
1399 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
1400 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
1401 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
1402 (?:\b[0-9][0-9_]*(\.)\B)| # 1.
1403 (?:\B(\.)[0-9][0-9_]*\b)| # .1
1404 (?:\b[0-9][0-9_]*\b(?!\.)) # 1
1405 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??)\s*[\(\<])
1406 push:
1407 - match: (?=\(|\<)
1408 pop: true
1409 - include: string
1410 - include: array-literal
1411 - include: numeric-literal
1412 - match: "[_$[:alpha:]][_$[:alnum:]]*"
1413 scope: meta.definition.method.ts entity.name.function.ts
1414 - match: \?
1415 scope: keyword.operator.optional.ts
1416 namespace-declaration:
1417 - match: '(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?\b(namespace|module)\s+(?=[_$[:alpha:]"''`]))'
1418 captures:
1419 1: keyword.control.export.ts
1420 2: storage.type.namespace.ts
1421 push:
1422 - meta_scope: meta.namespace.declaration.ts
1423 - match: '(?<=\})|(?=;|^\s*abstract\b|^\s*async\b|^\s*class\b|^\s*const\b|^\s*declare\b|^\s*enum\b|^\s*export\b|^\s*function\b|^\s*import\b|^\s*interface\b|^\s*let\b|^\s*module\b|^\s*namespace\b|^\s*return\b|^\s*type\b|^\s*var\b)'
1424 pop: true
1425 - include: comment
1426 - include: string
1427 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
1428 scope: entity.name.type.module.ts
1429 - include: punctuation-accessor
1430 - include: decl-block
1431 new-expr:
1432 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1433 captures:
1434 1: keyword.operator.new.ts
1435 push:
1436 - meta_scope: new.expr.ts
1437 - match: '(?<=\))|(?=[;),}\]:]|\|\||\&\&|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
1438 pop: true
1439 - include: paren-expression
1440 - include: class-declaration
1441 - include: type
1442 null-literal:
1443 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))null(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1444 scope: constant.language.null.ts
1445 numeric-literal:
1446 - match: '\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$)'
1447 scope: constant.numeric.hex.ts
1448 - match: '\b(?<!\$)0(b|B)[01][01_]*\b(?!\$)'
1449 scope: constant.numeric.binary.ts
1450 - match: '\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$)'
1451 scope: constant.numeric.octal.ts
1452 - match: |-
1453 (?x)
1454 (?<!\$)(?:
1455 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
1456 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
1457 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
1458 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
1459 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
1460 (?:\b[0-9][0-9_]*(\.)\B)| # 1.
1461 (?:\B(\.)[0-9][0-9_]*\b)| # .1
1462 (?:\b[0-9][0-9_]*\b(?!\.)) # 1
1463 )(?!\$)
1464 captures:
1465 0: constant.numeric.decimal.ts
1466 1: meta.delimiter.decimal.period.ts
1467 2: meta.delimiter.decimal.period.ts
1468 3: meta.delimiter.decimal.period.ts
1469 4: meta.delimiter.decimal.period.ts
1470 5: meta.delimiter.decimal.period.ts
1471 6: meta.delimiter.decimal.period.ts
1472 numericConstant-literal:
1473 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))NaN(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1474 scope: constant.language.nan.ts
1475 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Infinity(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1476 scope: constant.language.infinity.ts
1477 object-binding-element:
1478 - include: comment
1479 - match: |-
1480 (?x)(?=((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
1481 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
1482 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
1483 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
1484 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
1485 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
1486 (?:\b[0-9][0-9_]*(\.)\B)| # 1.
1487 (?:\B(\.)[0-9][0-9_]*\b)| # .1
1488 (?:\b[0-9][0-9_]*\b(?!\.)) # 1
1489 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
1490 push:
1491 - match: '(?=,|\})'
1492 pop: true
1493 - include: object-binding-element-propertyName
1494 - include: binding-element
1495 - include: object-binding-pattern
1496 - include: destructuring-variable-rest
1497 - include: variable-initializer
1498 - include: punctuation-comma
1499 object-binding-element-const:
1500 - include: comment
1501 - match: |-
1502 (?x)(?=((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
1503 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
1504 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
1505 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
1506 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
1507 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
1508 (?:\b[0-9][0-9_]*(\.)\B)| # 1.
1509 (?:\B(\.)[0-9][0-9_]*\b)| # .1
1510 (?:\b[0-9][0-9_]*\b(?!\.)) # 1
1511 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
1512 push:
1513 - match: '(?=,|\})'
1514 pop: true
1515 - include: object-binding-element-propertyName
1516 - include: binding-element-const
1517 - include: object-binding-pattern-const
1518 - include: destructuring-variable-rest-const
1519 - include: variable-initializer
1520 - include: punctuation-comma
1521 object-binding-element-propertyName:
1522 - match: |-
1523 (?x)(?=((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
1524 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
1525 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
1526 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
1527 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
1528 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
1529 (?:\b[0-9][0-9_]*(\.)\B)| # 1.
1530 (?:\B(\.)[0-9][0-9_]*\b)| # .1
1531 (?:\b[0-9][0-9_]*\b(?!\.)) # 1
1532 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
1533 push:
1534 - match: (:)
1535 captures:
1536 0: punctuation.destructuring.ts
1537 pop: true
1538 - include: string
1539 - include: array-literal
1540 - include: numeric-literal
1541 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
1542 scope: variable.object.property.ts
1543 object-binding-pattern:
1544 - match: '(?:(\.\.\.)\s*)?(\{)'
1545 captures:
1546 1: keyword.operator.rest.ts
1547 2: punctuation.definition.binding-pattern.object.ts
1548 push:
1549 - match: '\}'
1550 captures:
1551 0: punctuation.definition.binding-pattern.object.ts
1552 pop: true
1553 - include: object-binding-element
1554 object-binding-pattern-const:
1555 - match: '(?:(\.\.\.)\s*)?(\{)'
1556 captures:
1557 1: keyword.operator.rest.ts
1558 2: punctuation.definition.binding-pattern.object.ts
1559 push:
1560 - match: '\}'
1561 captures:
1562 0: punctuation.definition.binding-pattern.object.ts
1563 pop: true
1564 - include: object-binding-element-const
1565 object-identifiers:
1566 - match: '([_$[:alpha:]][_$[:alnum:]]*)(?=\s*\??\.\s*prototype\b(?!\$))'
1567 scope: support.class.ts
1568 - match: |-
1569 (?x)(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(?:
1570 ([[:upper:]][_$[:digit:][:upper:]]*) |
1571 ([_$[:alpha:]][_$[:alnum:]]*)
1572 )(?=\s*\??\.\s*[_$[:alpha:]][_$[:alnum:]]*)
1573 captures:
1574 1: punctuation.accessor.ts
1575 2: punctuation.accessor.optional.ts
1576 3: variable.other.constant.object.property.ts
1577 4: variable.other.object.property.ts
1578 - match: |-
1579 (?x)(?:
1580 ([[:upper:]][_$[:digit:][:upper:]]*) |
1581 ([_$[:alpha:]][_$[:alnum:]]*)
1582 )(?=\s*\??\.\s*[_$[:alpha:]][_$[:alnum:]]*)
1583 captures:
1584 1: variable.other.constant.object.ts
1585 2: variable.other.object.ts
1586 object-literal:
1587 - match: '\{'
1588 captures:
1589 0: punctuation.definition.block.ts
1590 push:
1591 - meta_scope: meta.objectliteral.ts
1592 - match: '\}'
1593 captures:
1594 0: punctuation.definition.block.ts
1595 pop: true
1596 - include: object-member
1597 object-literal-method-declaration:
1598 - match: |-
1599 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
1600 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
1601 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
1602 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
1603 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
1604 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
1605 (?:\b[0-9][0-9_]*(\.)\B)| # 1.
1606 (?:\B(\.)[0-9][0-9_]*\b)| # .1
1607 (?:\b[0-9][0-9_]*\b(?!\.)) # 1
1608 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<])
1609 captures:
1610 1: storage.modifier.async.ts
1611 2: storage.type.property.ts
1612 3: keyword.generator.asterisk.ts
1613 push:
1614 - meta_scope: meta.method.declaration.ts
1615 - match: '(?=\}|;|,)|(?<=\})'
1616 pop: true
1617 - include: method-declaration-name
1618 - include: function-body
1619 - match: |-
1620 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
1621 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
1622 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
1623 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
1624 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
1625 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
1626 (?:\b[0-9][0-9_]*(\.)\B)| # 1.
1627 (?:\B(\.)[0-9][0-9_]*\b)| # .1
1628 (?:\b[0-9][0-9_]*\b(?!\.)) # 1
1629 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<])
1630 captures:
1631 1: storage.modifier.async.ts
1632 2: storage.type.property.ts
1633 3: keyword.generator.asterisk.ts
1634 push:
1635 - match: (?=\(|\<)
1636 pop: true
1637 - include: method-declaration-name
1638 object-member:
1639 - include: comment
1640 - include: object-literal-method-declaration
1641 - match: '(?=\[)'
1642 push:
1643 - meta_scope: meta.object.member.ts meta.object-literal.key.ts
1644 - match: '(?=:)|((?<=[\]])(?=\s*[\(\<]))'
1645 pop: true
1646 - include: array-literal
1647 - match: '(?=[\''\"])'
1648 push:
1649 - meta_scope: meta.object.member.ts meta.object-literal.key.ts
1650 - match: '(?=:)|((?<=[\''\"])(?=\s*[\(\<]))'
1651 pop: true
1652 - include: string
1653 - match: '(?<=[\]\''\"])(?=\s*[\(\<])'
1654 push:
1655 - meta_scope: meta.method.declaration.ts
1656 - match: '(?=\}|;|,)|(?<=\})'
1657 pop: true
1658 - include: function-body
1659 - match: '(?![_$[:alpha:]])([[:digit:]]+)\s*(?=:)'
1660 scope: meta.object.member.ts
1661 captures:
1662 0: meta.object-literal.key.ts
1663 1: constant.numeric.decimal.ts
1664 - match: |-
1665 (?x)(?:([_$[:alpha:]][_$[:alnum:]]*)\s*(?=:\s*(
1666 ((async\s+)?(
1667 (function\s*[(<*]) |
1668 (function\s+) |
1669 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
1670 )) |
1671 ((async\s*)?(
1672 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?[\(]\s*([\{\[]\s*)?$)) |
1673 # sure shot arrow functions even if => is on new line
1675 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
1676 [(]\s*
1678 ([)]\s*:) | # ():
1679 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
1681 ) |
1683 [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends
1684 ) |
1685 # arrow function possible to detect only with => on same line
1687 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
1688 \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
1689 (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
1690 \s*=> # arrow operator
1692 ))
1693 )))
1694 scope: meta.object.member.ts
1695 captures:
1696 0: meta.object-literal.key.ts
1697 1: entity.name.function.ts
1698 - match: '(?:[_$[:alpha:]][_$[:alnum:]]*)\s*(?=:)'
1699 scope: meta.object.member.ts
1700 captures:
1701 0: meta.object-literal.key.ts
1702 - match: \.\.\.
1703 captures:
1704 0: keyword.operator.spread.ts
1705 push:
1706 - meta_scope: meta.object.member.ts
1707 - match: '(?=,|\})'
1708 pop: true
1709 - include: expression
1710 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?=,|\}|$)'
1711 scope: meta.object.member.ts
1712 captures:
1713 1: variable.other.readwrite.ts
1714 - match: '(?=[_$[:alpha:]][_$[:alnum:]]*\s*=)'
1715 push:
1716 - meta_scope: meta.object.member.ts
1717 - match: '(?=,|\}|$)'
1718 pop: true
1719 - include: expression
1720 - match: ":"
1721 captures:
1722 0: meta.object-literal.key.ts punctuation.separator.key-value.ts
1723 push:
1724 - meta_scope: meta.object.member.ts
1725 - match: '(?=,|\})'
1726 pop: true
1727 - match: '(?<=:)\s*(async)?(?=\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)\(\s*([\{\[]\s*)?$)'
1728 captures:
1729 1: storage.modifier.async.ts
1730 push:
1731 - match: (?<=\))
1732 pop: true
1733 - include: type-parameters
1734 - match: \(
1735 captures:
1736 0: meta.brace.round.ts
1737 push:
1738 - match: \)
1739 captures:
1740 0: meta.brace.round.ts
1741 pop: true
1742 - include: expression-inside-possibly-arrow-parens
1743 - match: '(?<=:)\s*(async)?\s*(\()(?=\s*([\{\[]\s*)?$)'
1744 captures:
1745 1: storage.modifier.async.ts
1746 2: meta.brace.round.ts
1747 push:
1748 - match: \)
1749 captures:
1750 0: meta.brace.round.ts
1751 pop: true
1752 - include: expression-inside-possibly-arrow-parens
1753 - include: expression
1754 - include: punctuation-comma
1755 parameter-array-binding-pattern:
1756 - match: '(?:(\.\.\.)\s*)?(\[)'
1757 captures:
1758 1: keyword.operator.rest.ts
1759 2: punctuation.definition.binding-pattern.array.ts
1760 push:
1761 - match: '\]'
1762 captures:
1763 0: punctuation.definition.binding-pattern.array.ts
1764 pop: true
1765 - include: parameter-binding-element
1766 - include: punctuation-comma
1767 parameter-binding-element:
1768 - include: comment
1769 - include: string
1770 - include: parameter-object-binding-pattern
1771 - include: parameter-array-binding-pattern
1772 - include: destructuring-parameter-rest
1773 - include: variable-initializer
1774 parameter-name:
1775 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|protected|private|readonly)\s+(?=(public|protected|private|readonly)\s+)'
1776 captures:
1777 1: storage.modifier.ts
1778 - match: |-
1779 (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
1780 # function assignment |
1781 (=\s*(
1782 ((async\s+)?(
1783 (function\s*[(<*]) |
1784 (function\s+) |
1785 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
1786 )) |
1787 ((async\s*)?(
1788 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?[\(]\s*([\{\[]\s*)?$)) |
1789 # sure shot arrow functions even if => is on new line
1791 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
1792 [(]\s*
1794 ([)]\s*:) | # ():
1795 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
1797 ) |
1799 [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends
1800 ) |
1801 # arrow function possible to detect only with => on same line
1803 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
1804 \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
1805 (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
1806 \s*=> # arrow operator
1808 ))
1809 )) |
1810 # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
1811 (:\s*(
1812 (<) |
1813 ([(]\s*(
1814 ([)]) |
1815 (\.\.\.) |
1816 ([_$[:alnum:]]+\s*(
1817 ([:,?=])|
1818 ([)]\s*=>)
1819 ))
1820 ))
1821 )) |
1822 (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?[\(]\s*([\{\[]\s*)?$))) |
1823 (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
1824 ((async\s+)?(
1825 (function\s*[(<*]) |
1826 (function\s+) |
1827 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
1828 )) |
1829 ((async\s*)?(
1830 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?[\(]\s*([\{\[]\s*)?$)) |
1831 # sure shot arrow functions even if => is on new line
1833 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
1834 [(]\s*
1836 ([)]\s*:) | # ():
1837 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
1839 ) |
1841 [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends
1842 ) |
1843 # arrow function possible to detect only with => on same line
1845 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
1846 \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
1847 (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
1848 \s*=> # arrow operator
1850 ))
1851 )))
1852 captures:
1853 1: storage.modifier.ts
1854 2: keyword.operator.rest.ts
1855 3: entity.name.function.ts variable.language.this.ts
1856 4: entity.name.function.ts
1857 5: keyword.operator.optional.ts
1858 - match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)'
1859 captures:
1860 1: storage.modifier.ts
1861 2: keyword.operator.rest.ts
1862 3: variable.parameter.ts variable.language.this.ts
1863 4: variable.parameter.ts
1864 5: keyword.operator.optional.ts
1865 parameter-object-binding-element:
1866 - include: comment
1867 - match: |-
1868 (?x)(?=((\b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$))|(\b(?<!\$)0(b|B)[01][01_]*\b(?!\$))|(\b(?<!\$)0(o|O)?[0-7][0-7_]*\b(?!\$))|((?<!\$)(?:
1869 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1.1E+3
1870 (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*\b)| # 1.E+3
1871 (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # .1E+3
1872 (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\b)| # 1E+3
1873 (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*\b)| # 1.1
1874 (?:\b[0-9][0-9_]*(\.)\B)| # 1.
1875 (?:\B(\.)[0-9][0-9_]*\b)| # .1
1876 (?:\b[0-9][0-9_]*\b(?!\.)) # 1
1877 )(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))
1878 push:
1879 - match: '(?=,|\})'
1880 pop: true
1881 - include: object-binding-element-propertyName
1882 - include: parameter-binding-element
1883 - include: parameter-object-binding-pattern
1884 - include: destructuring-parameter-rest
1885 - include: variable-initializer
1886 - include: punctuation-comma
1887 parameter-object-binding-pattern:
1888 - match: '(?:(\.\.\.)\s*)?(\{)'
1889 captures:
1890 1: keyword.operator.rest.ts
1891 2: punctuation.definition.binding-pattern.object.ts
1892 push:
1893 - match: '\}'
1894 captures:
1895 0: punctuation.definition.binding-pattern.object.ts
1896 pop: true
1897 - include: parameter-object-binding-element
1898 paren-expression:
1899 - match: \(
1900 captures:
1901 0: meta.brace.round.ts
1902 push:
1903 - match: \)
1904 captures:
1905 0: meta.brace.round.ts
1906 pop: true
1907 - include: expression
1908 paren-expression-possibly-arrow:
1909 - match: '(?<=[(=,])\s*(async)?(?=\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*))?\(\s*[\{\[]\s*$)'
1910 captures:
1911 1: storage.modifier.async.ts
1912 push:
1913 - match: (?<=\))
1914 pop: true
1915 - include: paren-expression-possibly-arrow-with-typeparameters
1916 - match: '(?<=[(=,]|=>)\s*(async)?(?=\s*((((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*))?\()|(<))\s*$)'
1917 captures:
1918 1: storage.modifier.async.ts
1919 push:
1920 - match: (?<=\))
1921 pop: true
1922 - include: paren-expression-possibly-arrow-with-typeparameters
1923 - include: possibly-arrow-return-type
1924 paren-expression-possibly-arrow-with-typeparameters:
1925 - include: type-parameters
1926 - match: \(
1927 captures:
1928 0: meta.brace.round.ts
1929 push:
1930 - match: \)
1931 captures:
1932 0: meta.brace.round.ts
1933 pop: true
1934 - include: expression-inside-possibly-arrow-parens
1935 possibly-arrow-return-type:
1936 - match: '(?<=\))\s*(:)(?=\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+\s*=>)'
1937 captures:
1938 1: meta.arrow.ts meta.return.type.arrow.ts keyword.operator.type.annotation.ts
1939 push:
1940 - meta_content_scope: meta.arrow.ts meta.return.type.arrow.ts
1941 - match: '(?==>|\{|(^\s*(export|function|class|interface|let|var|const|import|enum|namespace|module|type|abstract|declare)\s+))'
1942 pop: true
1943 - include: arrow-return-type-body
1944 property-accessor:
1945 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(get|set)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
1946 scope: storage.type.property.ts
1947 punctuation-accessor:
1948 - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))'
1949 captures:
1950 1: punctuation.accessor.ts
1951 2: punctuation.accessor.optional.ts
1952 punctuation-comma:
1953 - match: ","
1954 scope: punctuation.separator.comma.ts
1955 punctuation-semicolon:
1956 - match: ;
1957 scope: punctuation.terminator.statement.ts
1958 qstring-double:
1959 - match: '"'
1960 captures:
1961 0: punctuation.definition.string.begin.ts
1962 push:
1963 - meta_scope: string.quoted.double.ts
1964 - match: '(")|((?:[^\\\n])$)'
1965 captures:
1966 1: punctuation.definition.string.end.ts
1967 2: invalid.illegal.newline.ts
1968 pop: true
1969 - include: string-character-escape
1970 qstring-single:
1971 - match: "'"
1972 captures:
1973 0: punctuation.definition.string.begin.ts
1974 push:
1975 - meta_scope: string.quoted.single.ts
1976 - match: '(\'')|((?:[^\\\n])$)'
1977 captures:
1978 1: punctuation.definition.string.end.ts
1979 2: invalid.illegal.newline.ts
1980 pop: true
1981 - include: string-character-escape
1982 regex:
1983 - match: '(?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/[gimsuy]*(?!\s*[a-zA-Z0-9_$]))'
1984 captures:
1985 1: punctuation.definition.string.begin.ts
1986 push:
1987 - meta_scope: string.regexp.ts
1988 - match: "(/)([gimsuy]*)"
1989 captures:
1990 1: punctuation.definition.string.end.ts
1991 2: keyword.other.ts
1992 pop: true
1993 - include: regexp
1994 - match: '(?<![_$[:alnum:])\]]|\+\+|--|})\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/[gimsuy]*(?!\s*[a-zA-Z0-9_$]))'
1995 captures:
1996 0: punctuation.definition.string.begin.ts
1997 push:
1998 - meta_scope: string.regexp.ts
1999 - match: "(/)([gimsuy]*)"
2000 captures:
2001 1: punctuation.definition.string.end.ts
2002 2: keyword.other.ts
2003 pop: true
2004 - include: regexp
2005 regex-character-class:
2006 - match: '\\[wWsSdDtrnvf]|\.'
2007 scope: constant.other.character-class.regexp
2008 - match: '\\([0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4})'
2009 scope: constant.character.numeric.regexp
2010 - match: '\\c[A-Z]'
2011 scope: constant.character.control.regexp
2012 - match: \\.
2013 scope: constant.character.escape.backslash.regexp
2014 regexp:
2015 - match: '\\[bB]|\^|\$'
2016 scope: keyword.control.anchor.regexp
2017 - match: '\\[1-9]\d*|\\k<([a-zA-Z_$][\w$]*)>'
2018 captures:
2019 0: keyword.other.back-reference.regexp
2020 1: variable.other.regexp
2021 - match: '[?+*]|\{(\d+,\d+|\d+,|,\d+|\d+)\}\??'
2022 scope: keyword.operator.quantifier.regexp
2023 - match: \|
2024 scope: keyword.operator.or.regexp
2025 - match: (\()((\?=)|(\?!)|(\?<=)|(\?<!))
2026 captures:
2027 1: punctuation.definition.group.regexp
2028 2: punctuation.definition.group.assertion.regexp
2029 3: meta.assertion.look-ahead.regexp
2030 4: meta.assertion.negative-look-ahead.regexp
2031 5: meta.assertion.look-behind.regexp
2032 6: meta.assertion.negative-look-behind.regexp
2033 push:
2034 - meta_scope: meta.group.assertion.regexp
2035 - match: (\))
2036 captures:
2037 1: punctuation.definition.group.regexp
2038 pop: true
2039 - include: regexp
2040 - match: '\((?:(\?:)|(?:\?<([a-zA-Z_$][\w$]*)>))?'
2041 captures:
2042 0: punctuation.definition.group.regexp
2043 1: punctuation.definition.group.no-capture.regexp
2044 2: variable.other.regexp
2045 push:
2046 - meta_scope: meta.group.regexp
2047 - match: \)
2048 captures:
2049 0: punctuation.definition.group.regexp
2050 pop: true
2051 - include: regexp
2052 - match: '(\[)(\^)?'
2053 captures:
2054 1: punctuation.definition.character-class.regexp
2055 2: keyword.operator.negation.regexp
2056 push:
2057 - meta_scope: constant.other.character-class.set.regexp
2058 - match: '(\])'
2059 captures:
2060 1: punctuation.definition.character-class.regexp
2061 pop: true
2062 - match: '(?:.|(\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\c[A-Z])|(\\.))\-(?:[^\]\\]|(\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\c[A-Z])|(\\.))'
2063 scope: constant.other.character-class.range.regexp
2064 captures:
2065 1: constant.character.numeric.regexp
2066 2: constant.character.control.regexp
2067 3: constant.character.escape.backslash.regexp
2068 4: constant.character.numeric.regexp
2069 5: constant.character.control.regexp
2070 6: constant.character.escape.backslash.regexp
2071 - include: regex-character-class
2072 - include: regex-character-class
2073 return-type:
2074 - match: (?<=\))\s*(:)(?=\s*\S)
2075 captures:
2076 1: keyword.operator.type.annotation.ts
2077 push:
2078 - meta_scope: meta.return.type.ts
2079 - match: "(?<![:|&])(?=$|^|[{};,]|//)"
2080 pop: true
2081 - include: return-type-core
2082 - match: (?<=\))\s*(:)
2083 captures:
2084 1: keyword.operator.type.annotation.ts
2085 push:
2086 - meta_scope: meta.return.type.ts
2087 - match: '(?<![:|&])((?=[{};,]|//|^\s*$)|((?<=\S)(?=\s*$)))'
2088 pop: true
2089 - include: return-type-core
2090 return-type-core:
2091 - include: comment
2092 - match: '(?<=[:|&])(?=\s*\{)'
2093 push:
2094 - match: '(?<=\})'
2095 pop: true
2096 - include: type-object
2097 - include: type-predicate-operator
2098 - include: type
2099 statements:
2100 - include: string
2101 - include: template
2102 - include: comment
2103 - include: declaration
2104 - include: control-statement
2105 - include: after-operator-block-as-object-literal
2106 - include: decl-block
2107 - include: label
2108 - include: expression
2109 - include: punctuation-semicolon
2110 string:
2111 - include: qstring-single
2112 - include: qstring-double
2113 string-character-escape:
2114 - match: '\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$)'
2115 scope: constant.character.escape.ts
2116 super-literal:
2117 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))super\b(?!\$)'
2118 scope: variable.language.super.ts
2119 support-objects:
2120 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(arguments)\b(?!\$)'
2121 scope: variable.language.arguments.ts
2122 - match: |-
2123 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Array|ArrayBuffer|Atomics|Boolean|DataView|Date|Float32Array|Float64Array|Function|Generator
2124 |GeneratorFunction|Int8Array|Int16Array|Int32Array|Intl|Map|Number|Object|Proxy
2125 |Reflect|RegExp|Set|SharedArrayBuffer|SIMD|String|Symbol|TypedArray
2126 |Uint8Array|Uint16Array|Uint32Array|Uint8ClampedArray|WeakMap|WeakSet)\b(?!\$)
2127 scope: support.class.builtin.ts
2128 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))((Eval|Internal|Range|Reference|Syntax|Type|URI)?Error)\b(?!\$)'
2129 scope: support.class.error.ts
2130 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Promise)\b(?!\$)'
2131 scope: support.class.promise.ts
2132 - match: |-
2133 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(clear(Interval|Timeout)|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|escape|eval|
2134 isFinite|isNaN|parseFloat|parseInt|require|set(Interval|Timeout)|super|unescape|uneval)(?=\s*\()
2135 scope: support.function.ts
2136 - match: |-
2137 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Math)(?:\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(?:
2138 (abs|acos|acosh|asin|asinh|atan|atan2|atanh|cbrt|ceil|clz32|cos|cosh|exp|
2139 expm1|floor|fround|hypot|imul|log|log10|log1p|log2|max|min|pow|random|
2140 round|sign|sin|sinh|sqrt|tan|tanh|trunc)
2142 (E|LN10|LN2|LOG10E|LOG2E|PI|SQRT1_2|SQRT2)))?\b(?!\$)
2143 captures:
2144 1: support.constant.math.ts
2145 2: punctuation.accessor.ts
2146 3: punctuation.accessor.optional.ts
2147 4: support.function.math.ts
2148 5: support.constant.property.math.ts
2149 - match: |-
2150 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(console)(?:\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(
2151 assert|clear|count|debug|dir|error|group|groupCollapsed|groupEnd|info|log
2152 |profile|profileEnd|table|time|timeEnd|timeStamp|trace|warn))?\b(?!\$)
2153 captures:
2154 1: support.class.console.ts
2155 2: punctuation.accessor.ts
2156 3: punctuation.accessor.optional.ts
2157 4: support.function.console.ts
2158 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(JSON)(?:\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(parse|stringify))?\b(?!\$)'
2159 captures:
2160 1: support.constant.json.ts
2161 2: punctuation.accessor.ts
2162 3: punctuation.accessor.optional.ts
2163 4: support.function.json.ts
2164 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(import)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(meta)\b(?!\$)'
2165 captures:
2166 1: keyword.control.import.ts
2167 2: punctuation.accessor.ts
2168 3: punctuation.accessor.optional.ts
2169 4: support.variable.property.importmeta.ts
2170 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(target)\b(?!\$)'
2171 captures:
2172 1: keyword.operator.new.ts
2173 2: punctuation.accessor.ts
2174 3: punctuation.accessor.optional.ts
2175 4: support.variable.property.target.ts
2176 - match: |-
2177 (?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?:
2178 (constructor|length|prototype|__proto__)
2180 (EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY))\b(?!\$)
2181 captures:
2182 1: punctuation.accessor.ts
2183 2: punctuation.accessor.optional.ts
2184 3: support.variable.property.ts
2185 4: support.constant.ts
2186 - match: |-
2187 (?x) (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.)) \b (?:
2188 (document|event|navigator|performance|screen|window)
2190 (AnalyserNode|ArrayBufferView|Attr|AudioBuffer|AudioBufferSourceNode|AudioContext|AudioDestinationNode|AudioListener
2191 |AudioNode|AudioParam|BatteryManager|BeforeUnloadEvent|BiquadFilterNode|Blob|BufferSource|ByteString|CSS|CSSConditionRule
2192 |CSSCounterStyleRule|CSSGroupingRule|CSSMatrix|CSSMediaRule|CSSPageRule|CSSPrimitiveValue|CSSRule|CSSRuleList|CSSStyleDeclaration
2193 |CSSStyleRule|CSSStyleSheet|CSSSupportsRule|CSSValue|CSSValueList|CanvasGradient|CanvasImageSource|CanvasPattern
2194 |CanvasRenderingContext2D|ChannelMergerNode|ChannelSplitterNode|CharacterData|ChromeWorker|CloseEvent|Comment|CompositionEvent
2195 |Console|ConvolverNode|Coordinates|Credential|CredentialsContainer|Crypto|CryptoKey|CustomEvent|DOMError|DOMException
2196 |DOMHighResTimeStamp|DOMImplementation|DOMString|DOMStringList|DOMStringMap|DOMTimeStamp|DOMTokenList|DataTransfer
2197 |DataTransferItem|DataTransferItemList|DedicatedWorkerGlobalScope|DelayNode|DeviceProximityEvent|DirectoryEntry
2198 |DirectoryEntrySync|DirectoryReader|DirectoryReaderSync|Document|DocumentFragment|DocumentTouch|DocumentType|DragEvent
2199 |DynamicsCompressorNode|Element|Entry|EntrySync|ErrorEvent|Event|EventListener|EventSource|EventTarget|FederatedCredential
2200 |FetchEvent|File|FileEntry|FileEntrySync|FileException|FileList|FileReader|FileReaderSync|FileSystem|FileSystemSync
2201 |FontFace|FormData|GainNode|Gamepad|GamepadButton|GamepadEvent|Geolocation|GlobalEventHandlers|HTMLAnchorElement
2202 |HTMLAreaElement|HTMLAudioElement|HTMLBRElement|HTMLBaseElement|HTMLBodyElement|HTMLButtonElement|HTMLCanvasElement
2203 |HTMLCollection|HTMLContentElement|HTMLDListElement|HTMLDataElement|HTMLDataListElement|HTMLDialogElement|HTMLDivElement
2204 |HTMLDocument|HTMLElement|HTMLEmbedElement|HTMLFieldSetElement|HTMLFontElement|HTMLFormControlsCollection|HTMLFormElement
2205 |HTMLHRElement|HTMLHeadElement|HTMLHeadingElement|HTMLHtmlElement|HTMLIFrameElement|HTMLImageElement|HTMLInputElement
2206 |HTMLKeygenElement|HTMLLIElement|HTMLLabelElement|HTMLLegendElement|HTMLLinkElement|HTMLMapElement|HTMLMediaElement
2207 |HTMLMetaElement|HTMLMeterElement|HTMLModElement|HTMLOListElement|HTMLObjectElement|HTMLOptGroupElement|HTMLOptionElement
2208 |HTMLOptionsCollection|HTMLOutputElement|HTMLParagraphElement|HTMLParamElement|HTMLPreElement|HTMLProgressElement
2209 |HTMLQuoteElement|HTMLScriptElement|HTMLSelectElement|HTMLShadowElement|HTMLSourceElement|HTMLSpanElement|HTMLStyleElement
2210 |HTMLTableCaptionElement|HTMLTableCellElement|HTMLTableColElement|HTMLTableDataCellElement|HTMLTableElement|HTMLTableHeaderCellElement
2211 |HTMLTableRowElement|HTMLTableSectionElement|HTMLTextAreaElement|HTMLTimeElement|HTMLTitleElement|HTMLTrackElement
2212 |HTMLUListElement|HTMLUnknownElement|HTMLVideoElement|HashChangeEvent|History|IDBCursor|IDBCursorWithValue|IDBDatabase
2213 |IDBEnvironment|IDBFactory|IDBIndex|IDBKeyRange|IDBMutableFile|IDBObjectStore|IDBOpenDBRequest|IDBRequest|IDBTransaction
2214 |IDBVersionChangeEvent|IIRFilterNode|IdentityManager|ImageBitmap|ImageBitmapFactories|ImageData|Index|InputDeviceCapabilities
2215 |InputEvent|InstallEvent|InstallTrigger|KeyboardEvent|LinkStyle|LocalFileSystem|LocalFileSystemSync|Location|MIDIAccess
2216 |MIDIConnectionEvent|MIDIInput|MIDIInputMap|MIDIOutputMap|MediaElementAudioSourceNode|MediaError|MediaKeyMessageEvent
2217 |MediaKeySession|MediaKeyStatusMap|MediaKeySystemAccess|MediaKeySystemConfiguration|MediaKeys|MediaRecorder|MediaStream
2218 |MediaStreamAudioDestinationNode|MediaStreamAudioSourceNode|MessageChannel|MessageEvent|MessagePort|MouseEvent
2219 |MutationObserver|MutationRecord|NamedNodeMap|Navigator|NavigatorConcurrentHardware|NavigatorGeolocation|NavigatorID
2220 |NavigatorLanguage|NavigatorOnLine|Node|NodeFilter|NodeIterator|NodeList|NonDocumentTypeChildNode|Notification
2221 |OfflineAudioCompletionEvent|OfflineAudioContext|OscillatorNode|PageTransitionEvent|PannerNode|ParentNode|PasswordCredential
2222 |Path2D|PaymentAddress|PaymentRequest|PaymentResponse|Performance|PerformanceEntry|PerformanceFrameTiming|PerformanceMark
2223 |PerformanceMeasure|PerformanceNavigation|PerformanceNavigationTiming|PerformanceObserver|PerformanceObserverEntryList
2224 |PerformanceResourceTiming|PerformanceTiming|PeriodicSyncEvent|PeriodicWave|Plugin|Point|PointerEvent|PopStateEvent
2225 |PortCollection|Position|PositionError|PositionOptions|PresentationConnectionClosedEvent|PresentationConnectionList
2226 |PresentationReceiver|ProcessingInstruction|ProgressEvent|PromiseRejectionEvent|PushEvent|PushRegistrationManager
2227 |RTCCertificate|RTCConfiguration|RTCPeerConnection|RTCSessionDescriptionCallback|RTCStatsReport|RadioNodeList|RandomSource
2228 |Range|ReadableByteStream|RenderingContext|SVGAElement|SVGAngle|SVGAnimateColorElement|SVGAnimateElement|SVGAnimateMotionElement
2229 |SVGAnimateTransformElement|SVGAnimatedAngle|SVGAnimatedBoolean|SVGAnimatedEnumeration|SVGAnimatedInteger|SVGAnimatedLength
2230 |SVGAnimatedLengthList|SVGAnimatedNumber|SVGAnimatedNumberList|SVGAnimatedPoints|SVGAnimatedPreserveAspectRatio
2231 |SVGAnimatedRect|SVGAnimatedString|SVGAnimatedTransformList|SVGAnimationElement|SVGCircleElement|SVGClipPathElement
2232 |SVGCursorElement|SVGDefsElement|SVGDescElement|SVGElement|SVGEllipseElement|SVGEvent|SVGFilterElement|SVGFontElement
2233 |SVGFontFaceElement|SVGFontFaceFormatElement|SVGFontFaceNameElement|SVGFontFaceSrcElement|SVGFontFaceUriElement
2234 |SVGForeignObjectElement|SVGGElement|SVGGlyphElement|SVGGradientElement|SVGHKernElement|SVGImageElement|SVGLength
2235 |SVGLengthList|SVGLineElement|SVGLinearGradientElement|SVGMPathElement|SVGMaskElement|SVGMatrix|SVGMissingGlyphElement
2236 |SVGNumber|SVGNumberList|SVGPathElement|SVGPatternElement|SVGPoint|SVGPolygonElement|SVGPolylineElement|SVGPreserveAspectRatio
2237 |SVGRadialGradientElement|SVGRect|SVGRectElement|SVGSVGElement|SVGScriptElement|SVGSetElement|SVGStopElement|SVGStringList
2238 |SVGStylable|SVGStyleElement|SVGSwitchElement|SVGSymbolElement|SVGTRefElement|SVGTSpanElement|SVGTests|SVGTextElement
2239 |SVGTextPositioningElement|SVGTitleElement|SVGTransform|SVGTransformList|SVGTransformable|SVGUseElement|SVGVKernElement
2240 |SVGViewElement|ServiceWorker|ServiceWorkerContainer|ServiceWorkerGlobalScope|ServiceWorkerRegistration|ServiceWorkerState
2241 |ShadowRoot|SharedWorker|SharedWorkerGlobalScope|SourceBufferList|StereoPannerNode|Storage|StorageEvent|StyleSheet
2242 |StyleSheetList|SubtleCrypto|SyncEvent|Text|TextMetrics|TimeEvent|TimeRanges|Touch|TouchEvent|TouchList|Transferable
2243 |TreeWalker|UIEvent|USVString|VRDisplayCapabilities|ValidityState|WaveShaperNode|WebGL|WebGLActiveInfo|WebGLBuffer
2244 |WebGLContextEvent|WebGLFramebuffer|WebGLProgram|WebGLRenderbuffer|WebGLRenderingContext|WebGLShader|WebGLShaderPrecisionFormat
2245 |WebGLTexture|WebGLTimerQueryEXT|WebGLTransformFeedback|WebGLUniformLocation|WebGLVertexArrayObject|WebGLVertexArrayObjectOES
2246 |WebSocket|WebSockets|WebVTT|WheelEvent|Window|WindowBase64|WindowEventHandlers|WindowTimers|Worker|WorkerGlobalScope
2247 |WorkerLocation|WorkerNavigator|XMLHttpRequest|XMLHttpRequestEventTarget|XMLSerializer|XPathExpression|XPathResult
2248 |XSLTProcessor))\b(?!\$)
2249 captures:
2250 1: support.variable.dom.ts
2251 2: support.class.dom.ts
2252 - match: |-
2253 (?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?:
2254 (ATTRIBUTE_NODE|CDATA_SECTION_NODE|COMMENT_NODE|DOCUMENT_FRAGMENT_NODE|DOCUMENT_NODE|DOCUMENT_TYPE_NODE
2255 |DOMSTRING_SIZE_ERR|ELEMENT_NODE|ENTITY_NODE|ENTITY_REFERENCE_NODE|HIERARCHY_REQUEST_ERR|INDEX_SIZE_ERR
2256 |INUSE_ATTRIBUTE_ERR|INVALID_CHARACTER_ERR|NO_DATA_ALLOWED_ERR|NO_MODIFICATION_ALLOWED_ERR|NOT_FOUND_ERR
2257 |NOT_SUPPORTED_ERR|NOTATION_NODE|PROCESSING_INSTRUCTION_NODE|TEXT_NODE|WRONG_DOCUMENT_ERR)
2259 (_content|[xyz]|abbr|above|accept|acceptCharset|accessKey|action|align|[av]Link(?:color)?|all|alt|anchors|appCodeName
2260 |appCore|applets|appMinorVersion|appName|appVersion|archive|areas|arguments|attributes|availHeight|availLeft|availTop
2261 |availWidth|axis|background|backgroundColor|backgroundImage|below|bgColor|body|border|borderBottomWidth|borderColor
2262 |borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|borderWidth|bottom|bufferDepth|callee|caller|caption
2263 |cellPadding|cells|cellSpacing|ch|characterSet|charset|checked|childNodes|chOff|cite|classes|className|clear
2264 |clientInformation|clip|clipBoardData|closed|code|codeBase|codeType|color|colorDepth|cols|colSpan|compact|complete
2265 |components|content|controllers|cookie|cookieEnabled|cords|cpuClass|crypto|current|data|dateTime|declare|defaultCharset
2266 |defaultChecked|defaultSelected|defaultStatus|defaultValue|defaultView|defer|description|dialogArguments|dialogHeight
2267 |dialogLeft|dialogTop|dialogWidth|dir|directories|disabled|display|docmain|doctype|documentElement|elements|embeds
2268 |enabledPlugin|encoding|enctype|entities|event|expando|external|face|fgColor|filename|firstChild|fontFamily|fontSize
2269 |fontWeight|form|formName|forms|frame|frameBorder|frameElement|frames|hasFocus|hash|headers|height|history|host
2270 |hostname|href|hreflang|hspace|htmlFor|httpEquiv|id|ids|ignoreCase|images|implementation|index|innerHeight|innerWidth
2271 |input|isMap|label|lang|language|lastChild|lastIndex|lastMatch|lastModified|lastParen|layer[sXY]|left|leftContext
2272 |lineHeight|link|linkColor|links|listStyleType|localName|location|locationbar|longDesc|lowsrc|lowSrc|marginBottom
2273 |marginHeight|marginLeft|marginRight|marginTop|marginWidth|maxLength|media|menubar|method|mimeTypes|multiline|multiple
2274 |name|nameProp|namespaces|namespaceURI|next|nextSibling|nodeName|nodeType|nodeValue|noHref|noResize|noShade|notationName
2275 |notations|noWrap|object|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|options|oscpu|outerHeight
2276 |outerWidth|ownerDocument|paddingBottom|paddingLeft|paddingRight|paddingTop|page[XY]|page[XY]Offset|parent|parentLayer
2277 |parentNode|parentWindow|pathname|personalbar|pixelDepth|pkcs11|platform|plugins|port|prefix|previous|previousDibling
2278 |product|productSub|profile|profileend|prompt|prompter|protocol|publicId|readOnly|readyState|referrer|rel|responseText
2279 |responseXML|rev|right|rightContext|rowIndex|rows|rowSpan|rules|scheme|scope|screen[XY]|screenLeft|screenTop|scripts
2280 |scrollbars|scrolling|sectionRowIndex|security|securityPolicy|selected|selectedIndex|selection|self|shape|siblingAbove
2281 |siblingBelow|size|source|specified|standby|start|status|statusbar|statusText|style|styleSheets|suffixes|summary
2282 |systemId|systemLanguage|tagName|tags|target|tBodies|text|textAlign|textDecoration|textIndent|textTransform|tFoot|tHead
2283 |title|toolbar|top|type|undefined|uniqueID|updateInterval|URL|URLUnencoded|useMap|userAgent|userLanguage|userProfile
2284 |vAlign|value|valueType|vendor|vendorSub|version|visibility|vspace|whiteSpace|width|X[MS]LDocument|zIndex))\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?\()
2285 captures:
2286 1: punctuation.accessor.ts
2287 2: punctuation.accessor.optional.ts
2288 3: support.constant.dom.ts
2289 4: support.variable.property.dom.ts
2290 - match: |-
2291 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Buffer|EventEmitter|Server|Pipe|Socket|REPLServer|ReadStream|WriteStream|Stream
2292 |Inflate|Deflate|InflateRaw|DeflateRaw|GZip|GUnzip|Unzip|Zip)\b(?!\$)
2293 scope: support.class.node.ts
2294 - match: |-
2295 (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(process)(?:(?:(\.)|(\?\.(?!\s*[[:digit:]])))(?:
2296 (arch|argv|config|connected|env|execArgv|execPath|exitCode|mainModule|pid|platform|release|stderr|stdin|stdout|title|version|versions)
2298 (abort|chdir|cwd|disconnect|exit|[sg]ete?[gu]id|send|[sg]etgroups|initgroups|kill|memoryUsage|nextTick|umask|uptime|hrtime)
2299 ))?\b(?!\$)
2300 captures:
2301 1: support.variable.object.process.ts
2302 2: punctuation.accessor.ts
2303 3: punctuation.accessor.optional.ts
2304 4: support.variable.property.process.ts
2305 5: support.function.process.ts
2306 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(exports)|(module)(?:(?:(\.)|(\?\.(?!\s*[[:digit:]])))(exports|id|filename|loaded|parent|children))?)\b(?!\$)'
2307 captures:
2308 1: support.type.object.module.ts
2309 2: support.type.object.module.ts
2310 3: punctuation.accessor.ts
2311 4: punctuation.accessor.optional.ts
2312 5: support.type.object.module.ts
2313 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(global|GLOBAL|root|__dirname|__filename)\b(?!\$)'
2314 scope: support.variable.object.node.ts
2315 - match: |-
2316 (?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s*
2317 (?:
2318 (on(?:Rowsinserted|Rowsdelete|Rowenter|Rowexit|Resize|Resizestart|Resizeend|Reset|
2319 Readystatechange|Mouseout|Mouseover|Mousedown|Mouseup|Mousemove|
2320 Before(?:cut|deactivate|unload|update|paste|print|editfocus|activate)|
2321 Blur|Scrolltop|Submit|Select|Selectstart|Selectionchange|Hover|Help|
2322 Change|Contextmenu|Controlselect|Cut|Cellchange|Clock|Close|Deactivate|
2323 Datasetchanged|Datasetcomplete|Dataavailable|Drop|Drag|Dragstart|Dragover|
2324 Dragdrop|Dragenter|Dragend|Dragleave|Dblclick|Unload|Paste|Propertychange|Error|
2325 Errorupdate|Keydown|Keyup|Keypress|Focus|Load|Activate|Afterupdate|Afterprint|Abort)
2326 ) |
2327 (shift|showModelessDialog|showModalDialog|showHelp|scroll|scrollX|scrollByPages|
2328 scrollByLines|scrollY|scrollTo|stop|strike|sizeToContent|sidebar|signText|sort|
2329 sup|sub|substr|substring|splice|split|send|set(?:Milliseconds|Seconds|Minutes|Hours|
2330 Month|Year|FullYear|Date|UTC(?:Milliseconds|Seconds|Minutes|Hours|Month|FullYear|Date)|
2331 Time|Hotkeys|Cursor|ZOptions|Active|Resizable|RequestHeader)|search|slice|
2332 savePreferences|small|home|handleEvent|navigate|char|charCodeAt|charAt|concat|
2333 contextual|confirm|compile|clear|captureEvents|call|createStyleSheet|createPopup|
2334 createEventObject|to(?:GMTString|UTCString|String|Source|UpperCase|LowerCase|LocaleString)|
2335 test|taint|taintEnabled|indexOf|italics|disableExternalCapture|dump|detachEvent|unshift|
2336 untaint|unwatch|updateCommands|join|javaEnabled|pop|push|plugins.refresh|paddings|parse|
2337 print|prompt|preference|enableExternalCapture|exec|execScript|valueOf|UTC|find|file|
2338 fileModifiedDate|fileSize|fileCreatedDate|fileUpdatedDate|fixed|fontsize|fontcolor|
2339 forward|fromCharCode|watch|link|load|lastIndexOf|anchor|attachEvent|atob|apply|alert|
2340 abort|routeEvents|resize|resizeBy|resizeTo|recalc|returnValue|replace|reverse|reload|
2341 releaseCapture|releaseEvents|go|get(?:Milliseconds|Seconds|Minutes|Hours|Month|Day|Year|FullYear|
2342 Time|Date|TimezoneOffset|UTC(?:Milliseconds|Seconds|Minutes|Hours|Day|Month|FullYear|Date)|
2343 Attention|Selection|ResponseHeader|AllResponseHeaders)|moveBy|moveBelow|moveTo|
2344 moveToAbsolute|moveAbove|mergeAttributes|match|margins|btoa|big|bold|borderWidths|blink|back
2345 ) |
2346 (acceptNode|add|addEventListener|addTextTrack|adoptNode|after|animate|append|
2347 appendChild|appendData|before|blur|canPlayType|captureStream|
2348 caretPositionFromPoint|caretRangeFromPoint|checkValidity|clear|click|
2349 cloneContents|cloneNode|cloneRange|close|closest|collapse|
2350 compareBoundaryPoints|compareDocumentPosition|comparePoint|contains|
2351 convertPointFromNode|convertQuadFromNode|convertRectFromNode|createAttribute|
2352 createAttributeNS|createCaption|createCDATASection|createComment|
2353 createContextualFragment|createDocument|createDocumentFragment|
2354 createDocumentType|createElement|createElementNS|createEntityReference|
2355 createEvent|createExpression|createHTMLDocument|createNodeIterator|
2356 createNSResolver|createProcessingInstruction|createRange|createShadowRoot|
2357 createTBody|createTextNode|createTFoot|createTHead|createTreeWalker|delete|
2358 deleteCaption|deleteCell|deleteContents|deleteData|deleteRow|deleteTFoot|
2359 deleteTHead|detach|disconnect|dispatchEvent|elementFromPoint|elementsFromPoint|
2360 enableStyleSheetsForSet|entries|evaluate|execCommand|exitFullscreen|
2361 exitPointerLock|expand|extractContents|fastSeek|firstChild|focus|forEach|get|
2362 getAll|getAnimations|getAttribute|getAttributeNames|getAttributeNode|
2363 getAttributeNodeNS|getAttributeNS|getBoundingClientRect|getBoxQuads|
2364 getClientRects|getContext|getDestinationInsertionPoints|getElementById|
2365 getElementsByClassName|getElementsByName|getElementsByTagName|
2366 getElementsByTagNameNS|getItem|getNamedItem|getSelection|getStartDate|
2367 getVideoPlaybackQuality|has|hasAttribute|hasAttributeNS|hasAttributes|
2368 hasChildNodes|hasFeature|hasFocus|importNode|initEvent|insertAdjacentElement|
2369 insertAdjacentHTML|insertAdjacentText|insertBefore|insertCell|insertData|
2370 insertNode|insertRow|intersectsNode|isDefaultNamespace|isEqualNode|
2371 isPointInRange|isSameNode|item|key|keys|lastChild|load|lookupNamespaceURI|
2372 lookupPrefix|matches|move|moveAttribute|moveAttributeNode|moveChild|
2373 moveNamedItem|namedItem|nextNode|nextSibling|normalize|observe|open|
2374 parentNode|pause|play|postMessage|prepend|preventDefault|previousNode|
2375 previousSibling|probablySupportsContext|queryCommandEnabled|
2376 queryCommandIndeterm|queryCommandState|queryCommandSupported|queryCommandValue|
2377 querySelector|querySelectorAll|registerContentHandler|registerElement|
2378 registerProtocolHandler|releaseCapture|releaseEvents|remove|removeAttribute|
2379 removeAttributeNode|removeAttributeNS|removeChild|removeEventListener|
2380 removeItem|replace|replaceChild|replaceData|replaceWith|reportValidity|
2381 requestFullscreen|requestPointerLock|reset|scroll|scrollBy|scrollIntoView|
2382 scrollTo|seekToNextFrame|select|selectNode|selectNodeContents|set|setAttribute|
2383 setAttributeNode|setAttributeNodeNS|setAttributeNS|setCapture|
2384 setCustomValidity|setEnd|setEndAfter|setEndBefore|setItem|setNamedItem|
2385 setRangeText|setSelectionRange|setSinkId|setStart|setStartAfter|setStartBefore|
2386 slice|splitText|stepDown|stepUp|stopImmediatePropagation|stopPropagation|
2387 submit|substringData|supports|surroundContents|takeRecords|terminate|toBlob|
2388 toDataURL|toggle|toString|values|write|writeln
2389 ) |
2390 (all|catch|finally|race|reject|resolve|then
2392 )(?=\s*\()
2393 captures:
2394 1: punctuation.accessor.ts
2395 2: punctuation.accessor.optional.ts
2396 3: support.function.event-handler.ts
2397 4: support.function.ts
2398 5: support.function.dom.ts
2399 6: support.function.promise.ts
2400 switch-statement:
2401 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?=\bswitch\s*\()'
2402 push:
2403 - meta_scope: switch-statement.expr.ts
2404 - match: '\}'
2405 captures:
2406 0: punctuation.definition.block.ts
2407 pop: true
2408 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(switch)\s*(\()'
2409 captures:
2410 1: keyword.control.switch.ts
2411 2: meta.brace.round.ts
2412 push:
2413 - meta_scope: switch-expression.expr.ts
2414 - match: \)
2415 captures:
2416 0: meta.brace.round.ts
2417 pop: true
2418 - include: expression
2419 - match: '\{'
2420 captures:
2421 0: punctuation.definition.block.ts
2422 push:
2423 - meta_scope: switch-block.expr.ts
2424 - match: '(?=\})'
2425 pop: true
2426 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(case|default(?=:))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2427 captures:
2428 1: keyword.control.switch.ts
2429 push:
2430 - meta_scope: case-clause.expr.ts
2431 - match: (?=:)
2432 pop: true
2433 - include: expression
2434 - match: '(:)\s*(\{)'
2435 captures:
2436 1: case-clause.expr.ts punctuation.definition.section.case-statement.ts
2437 2: meta.block.ts punctuation.definition.block.ts
2438 push:
2439 - meta_content_scope: meta.block.ts
2440 - match: '\}'
2441 captures:
2442 0: meta.block.ts punctuation.definition.block.ts
2443 pop: true
2444 - include: statements
2445 - match: (:)
2446 captures:
2447 0: case-clause.expr.ts punctuation.definition.section.case-statement.ts
2448 - include: statements
2449 template:
2450 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?=(<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?!=)\>)*(?!=)>\s*)`)'
2451 captures:
2452 1: entity.name.function.tagged-template.ts
2453 push:
2454 - meta_scope: string.template.ts
2455 - match: (?=`)
2456 pop: true
2457 - include: type-arguments
2458 - match: "([_$[:alpha:]][_$[:alnum:]]*)?(`)"
2459 captures:
2460 1: entity.name.function.tagged-template.ts
2461 2: punctuation.definition.string.template.begin.ts
2462 push:
2463 - meta_scope: string.template.ts
2464 - match: "`"
2465 captures:
2466 0: punctuation.definition.string.template.end.ts
2467 pop: true
2468 - include: template-substitution-element
2469 - include: string-character-escape
2470 template-substitution-element:
2471 - match: '\$\{'
2472 captures:
2473 0: punctuation.definition.template-expression.begin.ts
2474 push:
2475 - meta_scope: meta.template.expression.ts
2476 - meta_content_scope: meta.embedded.line.ts
2477 - match: '\}'
2478 captures:
2479 0: punctuation.definition.template-expression.end.ts
2480 pop: true
2481 - include: expression
2482 ternary-expression:
2483 - match: '(?!\?\.\s*[^[:digit:]])(\?)'
2484 captures:
2485 1: keyword.operator.ternary.ts
2486 push:
2487 - match: \s*(:)
2488 captures:
2489 1: keyword.operator.ternary.ts
2490 pop: true
2491 - include: expression
2492 this-literal:
2493 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))this\b(?!\$)'
2494 scope: variable.language.this.ts
2495 type:
2496 - include: comment
2497 - include: string
2498 - include: numeric-literal
2499 - include: type-primitive
2500 - include: type-builtin-literals
2501 - include: type-parameters
2502 - include: type-tuple
2503 - include: type-object
2504 - include: type-conditional
2505 - include: type-operators
2506 - include: type-fn-type-parameters
2507 - include: type-paren-or-function-parameters
2508 - include: type-function-return-type
2509 - include: type-name
2510 type-alias-declaration:
2511 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?\b(type)\b\s+([_$[:alpha:]][_$[:alnum:]]*)\s*'
2512 captures:
2513 1: keyword.control.export.ts
2514 2: storage.type.type.ts
2515 3: entity.name.type.alias.ts
2516 push:
2517 - meta_scope: meta.type.declaration.ts
2518 - match: '(?=\}|;|^\s*abstract\b|^\s*async\b|^\s*class\b|^\s*const\b|^\s*declare\b|^\s*enum\b|^\s*export\b|^\s*function\b|^\s*import\b|^\s*interface\b|^\s*let\b|^\s*module\b|^\s*namespace\b|^\s*return\b|^\s*type\b|^\s*var\b)'
2519 pop: true
2520 - include: comment
2521 - include: type-parameters
2522 - match: (=)\s*
2523 captures:
2524 1: keyword.operator.assignment.ts
2525 push:
2526 - match: '(?=\}|;|^\s*abstract\b|^\s*async\b|^\s*class\b|^\s*const\b|^\s*declare\b|^\s*enum\b|^\s*export\b|^\s*function\b|^\s*import\b|^\s*interface\b|^\s*let\b|^\s*module\b|^\s*namespace\b|^\s*return\b|^\s*type\b|^\s*var\b)'
2527 pop: true
2528 - include: type
2529 type-annotation:
2530 - match: (:)(?=\s*\S)
2531 captures:
2532 1: keyword.operator.type.annotation.ts
2533 push:
2534 - meta_scope: meta.type.annotation.ts
2535 - match: '(?<![:|&])((?=$|^|[,);\}\]]|//)|(?==[^>])|((?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{)))'
2536 pop: true
2537 - include: type
2538 - match: (:)
2539 captures:
2540 1: keyword.operator.type.annotation.ts
2541 push:
2542 - meta_scope: meta.type.annotation.ts
2543 - match: '(?<![:|&])((?=[,);\}\]]|//)|(?==[^>])|(?=^\s*$)|((?<=\S)(?=\s*$))|((?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{)))'
2544 pop: true
2545 - include: type
2546 type-arguments:
2547 - match: \<
2548 captures:
2549 0: punctuation.definition.typeparameters.begin.ts
2550 push:
2551 - meta_scope: meta.type.parameters.ts
2552 - match: \>
2553 captures:
2554 0: punctuation.definition.typeparameters.end.ts
2555 pop: true
2556 - include: type
2557 - include: punctuation-comma
2558 type-builtin-literals:
2559 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(this|true|false|undefined|null|object)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2560 scope: support.type.builtin.ts
2561 type-conditional:
2562 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(extends)\s+'
2563 captures:
2564 1: storage.modifier.ts
2565 push:
2566 - match: (?<=:)
2567 pop: true
2568 - match: \?
2569 captures:
2570 0: keyword.operator.ternary.ts
2571 push:
2572 - match: ":"
2573 captures:
2574 0: keyword.operator.ternary.ts
2575 pop: true
2576 - include: type
2577 - include: type
2578 type-fn-type-parameters:
2579 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\b(?=\s*\<)'
2580 scope: meta.type.constructor.ts
2581 captures:
2582 1: keyword.control.new.ts
2583 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\b\s*(?=\()'
2584 captures:
2585 1: keyword.control.new.ts
2586 push:
2587 - meta_scope: meta.type.constructor.ts
2588 - match: (?<=\))
2589 pop: true
2590 - include: function-parameters
2591 - match: |-
2592 (?x)(
2593 (?=
2594 [(]\s*(
2595 ([)]) |
2596 (\.\.\.) |
2597 ([_$[:alnum:]]+\s*(
2598 ([:,?=])|
2599 ([)]\s*=>)
2600 ))
2604 push:
2605 - meta_scope: meta.type.function.ts
2606 - match: (?<=\))
2607 pop: true
2608 - include: function-parameters
2609 type-function-return-type:
2610 - match: (=>)(?=\s*\S)
2611 captures:
2612 1: storage.type.function.arrow.ts
2613 push:
2614 - meta_scope: meta.type.function.return.ts
2615 - match: '(?<!=>)(?<![|&])(?=[,\]\)\{\}=;>:\?]|//|$)'
2616 pop: true
2617 - include: type-function-return-type-core
2618 - match: "=>"
2619 captures:
2620 0: storage.type.function.arrow.ts
2621 push:
2622 - meta_scope: meta.type.function.return.ts
2623 - match: '(?<!=>)(?<![|&])((?=[,\]\)\{\}=;:\?>]|//|^\s*$)|((?<=\S)(?=\s*$)))'
2624 pop: true
2625 - include: type-function-return-type-core
2626 type-function-return-type-core:
2627 - include: comment
2628 - match: '(?<==>)(?=\s*\{)'
2629 push:
2630 - match: '(?<=\})'
2631 pop: true
2632 - include: type-object
2633 - include: type-predicate-operator
2634 - include: type
2635 type-name:
2636 - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))'
2637 captures:
2638 1: entity.name.type.module.ts
2639 2: punctuation.accessor.ts
2640 3: punctuation.accessor.optional.ts
2641 - match: "[_$[:alpha:]][_$[:alnum:]]*"
2642 scope: entity.name.type.ts
2643 type-object:
2644 - match: '\{'
2645 captures:
2646 0: punctuation.definition.block.ts
2647 push:
2648 - meta_scope: meta.object.type.ts
2649 - match: '\}'
2650 captures:
2651 0: punctuation.definition.block.ts
2652 pop: true
2653 - include: comment
2654 - include: method-declaration
2655 - include: indexer-declaration
2656 - include: indexer-mapped-type-declaration
2657 - include: field-declaration
2658 - include: type-annotation
2659 - match: \.\.\.
2660 captures:
2661 0: keyword.operator.spread.ts
2662 push:
2663 - match: '(?=\}|;|,|$)|(?<=\})'
2664 pop: true
2665 - include: type
2666 - include: punctuation-comma
2667 - include: punctuation-semicolon
2668 - include: type
2669 type-operators:
2670 - include: typeof-operator
2671 - match: '(?:([&|])|(=(?!>)))(?=\s*\{)'
2672 captures:
2673 1: keyword.operator.type.ts
2674 2: keyword.operator.assignment.ts
2675 push:
2676 - match: '(?<=\})'
2677 pop: true
2678 - include: type-object
2679 - match: "([&|])|(=(?!>))"
2680 captures:
2681 1: keyword.operator.type.ts
2682 2: keyword.operator.assignment.ts
2683 push:
2684 - match: (?=\S)
2685 pop: true
2686 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))keyof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2687 scope: keyword.operator.expression.keyof.ts
2688 - match: (\?|\:)
2689 scope: keyword.operator.ternary.ts
2690 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))infer(?=\s+[_$[:alpha:]])'
2691 scope: keyword.operator.expression.infer.ts
2692 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*\()'
2693 scope: keyword.operator.expression.import.ts
2694 type-parameters:
2695 - match: (<)
2696 captures:
2697 1: punctuation.definition.typeparameters.begin.ts
2698 push:
2699 - meta_scope: meta.type.parameters.ts
2700 - match: (>)
2701 captures:
2702 1: punctuation.definition.typeparameters.end.ts
2703 pop: true
2704 - include: comment
2705 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(extends)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2706 scope: storage.modifier.ts
2707 - include: type
2708 - include: punctuation-comma
2709 type-paren-or-function-parameters:
2710 - match: \(
2711 captures:
2712 0: meta.brace.round.ts
2713 push:
2714 - meta_scope: meta.type.paren.cover.ts
2715 - match: \)
2716 captures:
2717 0: meta.brace.round.ts
2718 pop: true
2719 - include: destructuring-parameter
2720 - match: |-
2721 (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))\s*(\??)(?=\s*(:\s*(
2722 (<) |
2723 ([(]\s*(
2724 ([)]) |
2725 (\.\.\.) |
2726 ([_$[:alnum:]]+\s*(
2727 ([:,?=])|
2728 ([)]\s*=>)
2729 ))
2730 ))
2731 )) |
2732 (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?[\(]\s*([\{\[]\s*)?$))))
2733 captures:
2734 1: storage.modifier.ts
2735 2: keyword.operator.rest.ts
2736 3: entity.name.function.ts variable.language.this.ts
2737 4: entity.name.function.ts
2738 5: keyword.operator.optional.ts
2739 - match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))\s*(\??)(?=:)'
2740 captures:
2741 1: storage.modifier.ts
2742 2: keyword.operator.rest.ts
2743 3: variable.parameter.ts variable.language.this.ts
2744 4: variable.parameter.ts
2745 5: keyword.operator.optional.ts
2746 - include: type-annotation
2747 - match: ","
2748 scope: punctuation.separator.parameter.ts
2749 - include: type
2750 type-predicate-operator:
2751 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))is(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2752 scope: keyword.operator.expression.is.ts
2753 type-primitive:
2754 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(string|number|boolean|symbol|any|void|never)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2755 scope: support.type.primitive.ts
2756 type-tuple:
2757 - match: '\['
2758 captures:
2759 0: meta.brace.square.ts
2760 push:
2761 - meta_scope: meta.type.tuple.ts
2762 - match: '\]'
2763 captures:
2764 0: meta.brace.square.ts
2765 pop: true
2766 - include: type
2767 - include: punctuation-comma
2768 typeof-operator:
2769 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))typeof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2770 scope: keyword.operator.expression.typeof.ts
2771 undefined-literal:
2772 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))undefined(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2773 scope: constant.language.undefined.ts
2774 var-expr:
2775 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2776 captures:
2777 1: keyword.control.export.ts
2778 2: storage.type.ts
2779 push:
2780 - meta_scope: meta.var.expr.ts
2781 - match: '((?=;|}|(\s+(of|in)\s+)|^\s*$|;|^\s*abstract\b|^\s*async\b|^\s*class\b|^\s*const\b|^\s*declare\b|^\s*enum\b|^\s*export\b|^\s*function\b|^\s*import\b|^\s*interface\b|^\s*let\b|^\s*module\b|^\s*namespace\b|^\s*return\b|^\s*type\b|^\s*var\b)|((?<=\S)(?<!^let|[^\._$[:alnum:]]let|^var|[^\._$[:alnum:]]var)(?=\s*$)))'
2782 pop: true
2783 - include: destructuring-variable
2784 - include: var-single-variable
2785 - include: variable-initializer
2786 - include: comment
2787 - match: (,)\s*(?!\S)
2788 captures:
2789 1: punctuation.separator.comma.ts
2790 push:
2791 - match: '(?<!,)(((?==|;|}|(\s+(of|in)\s+)|^\s*$))|((?<=\S)(?=\s*$)))'
2792 pop: true
2793 - include: comment
2794 - include: destructuring-variable
2795 - include: var-single-variable
2796 - include: punctuation-comma
2797 - include: punctuation-comma
2798 - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
2799 captures:
2800 1: keyword.control.export.ts
2801 2: storage.type.ts
2802 push:
2803 - meta_scope: meta.var.expr.ts
2804 - match: '((?=;|}|(\s+(of|in)\s+)|^\s*$|;|^\s*abstract\b|^\s*async\b|^\s*class\b|^\s*const\b|^\s*declare\b|^\s*enum\b|^\s*export\b|^\s*function\b|^\s*import\b|^\s*interface\b|^\s*let\b|^\s*module\b|^\s*namespace\b|^\s*return\b|^\s*type\b|^\s*var\b)|((?<=\S)(?<!^const|[^\._$[:alnum:]]const)(?=\s*$)))'
2805 pop: true
2806 - include: destructuring-const
2807 - include: var-single-const
2808 - include: variable-initializer
2809 - include: comment
2810 - match: (,)\s*(?!\S)
2811 captures:
2812 1: punctuation.separator.comma.ts
2813 push:
2814 - match: '(?<!,)(((?==|;|}|(\s+(of|in)\s+)|^\s*$))|((?<=\S)(?=\s*$)))'
2815 pop: true
2816 - include: comment
2817 - include: destructuring-const
2818 - include: var-single-const
2819 - include: punctuation-comma
2820 - include: punctuation-comma
2821 var-single-const:
2822 - match: |-
2823 (?x)([_$[:alpha:]][_$[:alnum:]]*)(?=\s*
2824 # function assignment |
2825 (=\s*(
2826 ((async\s+)?(
2827 (function\s*[(<*]) |
2828 (function\s+) |
2829 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
2830 )) |
2831 ((async\s*)?(
2832 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?[\(]\s*([\{\[]\s*)?$)) |
2833 # sure shot arrow functions even if => is on new line
2835 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
2836 [(]\s*
2838 ([)]\s*:) | # ():
2839 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
2841 ) |
2843 [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends
2844 ) |
2845 # arrow function possible to detect only with => on same line
2847 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
2848 \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
2849 (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
2850 \s*=> # arrow operator
2852 ))
2853 )) |
2854 # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
2855 (:\s*(
2856 (<) |
2857 ([(]\s*(
2858 ([)]) |
2859 (\.\.\.) |
2860 ([_$[:alnum:]]+\s*(
2861 ([:,?=])|
2862 ([)]\s*=>)
2863 ))
2864 ))
2865 )) |
2866 (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?[\(]\s*([\{\[]\s*)?$))) |
2867 (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
2868 ((async\s+)?(
2869 (function\s*[(<*]) |
2870 (function\s+) |
2871 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
2872 )) |
2873 ((async\s*)?(
2874 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?[\(]\s*([\{\[]\s*)?$)) |
2875 # sure shot arrow functions even if => is on new line
2877 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
2878 [(]\s*
2880 ([)]\s*:) | # ():
2881 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
2883 ) |
2885 [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends
2886 ) |
2887 # arrow function possible to detect only with => on same line
2889 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
2890 \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
2891 (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
2892 \s*=> # arrow operator
2894 ))
2895 )))
2896 captures:
2897 1: meta.definition.variable.ts variable.other.constant.ts entity.name.function.ts
2898 push:
2899 - meta_scope: meta.var-single-variable.expr.ts
2900 - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
2901 pop: true
2902 - include: var-single-variable-type-annotation
2903 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
2904 captures:
2905 1: meta.definition.variable.ts variable.other.constant.ts
2906 push:
2907 - meta_scope: meta.var-single-variable.expr.ts
2908 - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
2909 pop: true
2910 - include: var-single-variable-type-annotation
2911 var-single-variable:
2912 - match: |-
2913 (?x)([_$[:alpha:]][_$[:alnum:]]*)(?=\s*
2914 # function assignment |
2915 (=\s*(
2916 ((async\s+)?(
2917 (function\s*[(<*]) |
2918 (function\s+) |
2919 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
2920 )) |
2921 ((async\s*)?(
2922 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?[\(]\s*([\{\[]\s*)?$)) |
2923 # sure shot arrow functions even if => is on new line
2925 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
2926 [(]\s*
2928 ([)]\s*:) | # ():
2929 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
2931 ) |
2933 [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends
2934 ) |
2935 # arrow function possible to detect only with => on same line
2937 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
2938 \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
2939 (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
2940 \s*=> # arrow operator
2942 ))
2943 )) |
2944 # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
2945 (:\s*(
2946 (<) |
2947 ([(]\s*(
2948 ([)]) |
2949 (\.\.\.) |
2950 ([_$[:alnum:]]+\s*(
2951 ([:,?=])|
2952 ([)]\s*=>)
2953 ))
2954 ))
2955 )) |
2956 (:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?[\(]\s*([\{\[]\s*)?$))) |
2957 (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
2958 ((async\s+)?(
2959 (function\s*[(<*]) |
2960 (function\s+) |
2961 ([_$[:alpha:]][_$[:alnum:]]*\s*=>)
2962 )) |
2963 ((async\s*)?(
2964 ((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?[\(]\s*([\{\[]\s*)?$)) |
2965 # sure shot arrow functions even if => is on new line
2967 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?
2968 [(]\s*
2970 ([)]\s*:) | # ():
2971 ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param:
2973 ) |
2975 [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends
2976 ) |
2977 # arrow function possible to detect only with => on same line
2979 (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters
2980 \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
2981 (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
2982 \s*=> # arrow operator
2984 ))
2985 )))
2986 captures:
2987 1: meta.definition.variable.ts entity.name.function.ts
2988 push:
2989 - meta_scope: meta.var-single-variable.expr.ts
2990 - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
2991 pop: true
2992 - include: var-single-variable-type-annotation
2993 - match: "([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])"
2994 captures:
2995 1: meta.definition.variable.ts variable.other.constant.ts
2996 push:
2997 - meta_scope: meta.var-single-variable.expr.ts
2998 - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
2999 pop: true
3000 - include: var-single-variable-type-annotation
3001 - match: "([_$[:alpha:]][_$[:alnum:]]*)"
3002 captures:
3003 1: meta.definition.variable.ts variable.other.readwrite.ts
3004 push:
3005 - meta_scope: meta.var-single-variable.expr.ts
3006 - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))'
3007 pop: true
3008 - include: var-single-variable-type-annotation
3009 var-single-variable-type-annotation:
3010 - include: type-annotation
3011 - include: string
3012 - include: comment
3013 variable-initializer:
3014 - match: (?<!=|!)(=)(?!=)(?=\s*\S)
3015 captures:
3016 1: keyword.operator.assignment.ts
3017 push:
3018 - match: '(?=$|^|[,);}\]])'
3019 pop: true
3020 - include: expression
3021 - match: (?<!=|!)(=)(?!=)
3022 captures:
3023 1: keyword.operator.assignment.ts
3024 push:
3025 - match: '(?=[,);}\]])|(?=^\s*$)|(?<=\S)(?<!=)(?=\s*$)'
3026 pop: true
3027 - include: expression