on 4b012de help sign in
bat/assets/syntaxes/02_Extra/JavaScript (Babel).sublime-syntax
1290 lines 42 kB history raw
1%YAML 1.2
2---
3# http://www.sublimetext.com/docs/3/syntax.html
4name: JavaScript (Babel)
5file_extensions:
6 - js
7 - mjs
8 - jsx
9 - babel
10 - es6
11 - cjs
12first_line_match: ^#!\s*/.*\b(node|js)$\n?
13scope: source.js
14contexts:
15 main:
16 - include: core
17 brackets:
18 - include: round-brackets
19 - include: square-brackets
20 - include: curly-brackets
21 class-method-definition:
22 - match: '(@@[_$a-zA-Z][$\w]*|static|return)(?=\s*[<(])|(?=\s*<)'
23 captures:
24 1: keyword.operator.flowtype.js
25 push:
26 - meta_scope: meta.short-method.flowtype.js
27 - match: '(?=\s*[;{])'
28 pop: true
29 - include: flowtype-polymorph
30 - include: function-declaration-parameters
31 - include: flowtype-annotation
32 - include: comments
33 - include: curly-brackets
34 - match: '(?<=[]"''])\s*(?=[<(])'
35 push:
36 - meta_scope: meta.class-method.computed.js
37 - match: '(?=\s*[;{])'
38 pop: true
39 - include: flowtype-polymorph
40 - include: function-declaration-parameters
41 - include: flowtype-annotation
42 - include: comments
43 - include: curly-brackets
44 - match: |-
45 (?x)
46 ((?>get|set)\s+)
47 (?>
48 ((')((?>[^'\\]|\\.)*)('))|
49 ((")((?>[^"\\]|\\.)*)("))|
50 (([_$a-zA-Z][$\w]*|\d+))
51 )(?=\s*[<(])
52 captures:
53 1: storage.type.js
54 2: string.quoted.js
55 3: punctuation.definition.string.begin.js
56 4: entity.name.function.js
57 5: punctuation.definition.string.end.js
58 6: string.quoted.js
59 7: punctuation.definition.string.begin.js
60 8: entity.name.function.js
61 9: punctuation.definition.string.end.js
62 10: string.unquoted.js
63 11: entity.name.function.js
64 push:
65 - meta_scope: meta.class-accessor.js
66 - match: '(?=\s*[;{])'
67 pop: true
68 - include: flowtype-polymorph
69 - include: function-declaration-parameters
70 - include: flowtype-annotation
71 - include: comments
72 - include: curly-brackets
73 - match: |-
74 (?x)
75 (?>
76 ((')((?>[^'\\]|\\.)*)('))|
77 ((")((?>[^"\\]|\\.)*)("))|
78 (([_$a-zA-Z][$\w]*|\d+))
79 )(?=\s*[<(])
80 captures:
81 1: string.quoted.js
82 2: punctuation.definition.string.begin.js
83 3: entity.name.function.js
84 4: punctuation.definition.string.end.js
85 5: string.quoted.js
86 6: punctuation.definition.string.begin.js
87 7: entity.name.function.js
88 8: punctuation.definition.string.end.js
89 9: string.unquoted.js
90 10: entity.name.function.js
91 push:
92 - meta_scope: meta.class-method.js
93 - match: '(?=\s*[;{])'
94 pop: true
95 - include: flowtype-polymorph
96 - include: function-declaration-parameters
97 - include: flowtype-annotation
98 - include: comments
99 - include: curly-brackets
100 class-method-storage:
101 - match: (?<!\.)\b(?>static|declare)\b
102 scope: storage.modifier.js
103 - match: (?<!\.)\b(async)\b
104 scope: storage.type.js
105 - match: (?<!\.)\b(get|set)\b(?!\s*\()
106 scope: storage.type.js
107 - match: \*
108 scope: keyword.generator.asterisk.js
109 class-properties:
110 - match: '([_$a-zA-Z][$\w]*)(?=\s*[:=])'
111 captures:
112 1: variable.other.property.js
113 push:
114 - meta_scope: meta.class.property.js
115 - match: '(?=\s*[;}])'
116 pop: true
117 - include: flowtype-annotation
118 - include: expression
119 comments:
120 - match: /\*\*(?!/)
121 captures:
122 0: punctuation.definition.comment.js
123 push:
124 - meta_scope: comment.block.documentation.js
125 - match: \*/
126 captures:
127 0: punctuation.definition.comment.js
128 pop: true
129 - match: /\*
130 captures:
131 0: punctuation.definition.comment.begin.js
132 push:
133 - meta_scope: comment.block.js
134 - match: \*/
135 captures:
136 0: punctuation.definition.comment.end.js
137 pop: true
138 - match: (?><!--|-->)
139 scope: comment.block.html.js
140 captures:
141 0: punctuation.definition.comment.js
142 - match: (//).*$\n?
143 scope: comment.line.double-slash.js
144 captures:
145 1: punctuation.definition.comment.js
146 - match: ^(#!).*$\n?
147 scope: comment.line.shebang.js
148 captures:
149 1: punctuation.definition.comment.js
150 core:
151 - include: literal-function-labels
152 - include: literal-arrow-function-labels
153 - include: literal-labels
154 - include: literal-for
155 - include: literal-switch
156 - include: styled-components
157 - include: graphql
158 - include: expression
159 - include: literal-punctuation
160 curly-brackets:
161 - match: "{"
162 captures:
163 0: meta.brace.curly.begin.js
164 push:
165 - meta_scope: meta.group.braces.curly.js
166 - match: "}"
167 captures:
168 0: meta.brace.curly.end.js
169 pop: true
170 - include: main
171 es7-decorators:
172 - match: |-
173 (?x)
174 (@)([_$a-zA-Z][$\w]*)\b
175 scope: tag.decorator.js
176 captures:
177 1: punctuation.definition.tag.js
178 2: entity.name.tag.js
179 expression:
180 - include: merge-conflits
181 - include: literal-regexp
182 - include: literal-jsx
183 - include: es7-decorators
184 - include: support-class
185 - include: support-other
186 - include: literal-function
187 - include: literal-arrow-function
188 - include: literal-prototype
189 - include: literal-keywords
190 - include: literal-method
191 - include: literal-module
192 - include: literal-class
193 - include: flowtype-declaration
194 - include: literal-number
195 - include: literal-template-string
196 - include: literal-string
197 - include: literal-language-constant
198 - include: literal-language-variable
199 - include: literal-constructor
200 - include: literal-method-call
201 - include: literal-function-call
202 - include: comments
203 - include: brackets
204 - include: literal-operators
205 - include: literal-variable
206 flowtype-annotation:
207 - match: (?:(\?)\s*)?(:)
208 captures:
209 1: keyword.operator.flowtype.optional.js
210 2: keyword.operator.flowtype.annotation.js
211 push:
212 - meta_scope: meta.flowtype.annotation.js
213 - include: flowtype-tokens
214 - match: (?=\S)
215 pop: true
216 flowtype-brackets:
217 - match: "{"
218 captures:
219 0: punctuation.section.flowtype.begin.js
220 push:
221 - match: "}"
222 captures:
223 0: punctuation.section.flowtype.end.js
224 pop: true
225 - include: flowtype-tokens
226 flowtype-declaration:
227 - match: (?<!\.)\b(declare)\b
228 scope: support.type.declare.flowtype.js
229 - match: '(?<!\.)\b(type)\b(?=\s*[_$a-zA-Z])'
230 captures:
231 1: support.type.type.flowtype.js
232 push:
233 - meta_scope: meta.type.flowtype.js
234 - match: (?=\s*(;|from))
235 pop: true
236 - include: flowtype-tokens
237 - match: '(?<!\.)\b(type)\b(?=\s*{)'
238 captures:
239 1: support.type.type.flowtype.js
240 push:
241 - meta_scope: meta.type.flowtype.js
242 - match: "(?<=})"
243 pop: true
244 - include: comments
245 - include: flowtype-brackets
246 - include: flowtype-polymorph
247 - match: '([_$a-zA-Z][$\w]*)'
248 scope: entity.name.type.js
249 flowtype-identifier:
250 - include: support-class
251 - match: \b(?:any|bool|boolean|mixed|number|string|void)\b
252 scope: constant.other.primitve.flowtype.js
253 - match: '[_$a-zA-Z][$\w]*'
254 scope: variable.other.flowtype.js
255 - match: \?
256 scope: keyword.operator.flowtype.optional.js
257 flowtype-polymorph:
258 - match: <
259 captures:
260 0: punctuation.section.flowtype.begin.js
261 push:
262 - meta_scope: meta.flowtype.polymorph.js
263 - match: ">"
264 captures:
265 0: punctuation.section.flowtype.end.js
266 pop: true
267 - include: flowtype-tokens
268 flowtype-tokens:
269 - match: '(?<=[:?|&=])(?=\s*{)'
270 push:
271 - match: "(?<=})"
272 pop: true
273 - include: flowtype-brackets
274 - match: '\s*([|&])\s*'
275 scope: meta.flowtype.set.js
276 captures:
277 1: keyword.operator.flowtype.other.js
278 - match: '[*:?&|.]|\.\.\.|\b(typeof)\b'
279 scope: keyword.operator.flowtype.other.js
280 - match: <
281 captures:
282 0: punctuation.section.flowtype.begin.js
283 push:
284 - match: ">"
285 captures:
286 0: punctuation.section.flowtype.end.js
287 pop: true
288 - include: flowtype-tokens
289 - match: '\['
290 captures:
291 0: punctuation.section.flowtype.begin.js
292 push:
293 - match: '\]'
294 captures:
295 0: punctuation.section.flowtype.end.js
296 pop: true
297 - include: flowtype-tokens
298 - match: \(
299 captures:
300 0: punctuation.section.flowtype.begin.js
301 push:
302 - match: \)
303 captures:
304 0: punctuation.section.flowtype.end.js
305 pop: true
306 - include: flowtype-tokens
307 - match: "=>"
308 captures:
309 0: keyword.operator.flowtype.js
310 push:
311 - meta_scope: meta.flowtype.function.js
312 - match: "(?<=}|[_$a-zA-Z])"
313 pop: true
314 - include: flowtype-brackets
315 - include: flowtype-identifier
316 - include: comments
317 - include: flowtype-identifier
318 - include: literal-string
319 - include: comments
320 function-declaration-parameters:
321 - match: \(
322 captures:
323 0: punctuation.definition.parameters.begin.js
324 push:
325 - match: \)
326 captures:
327 0: punctuation.definition.parameters.end.js
328 pop: true
329 - include: comments
330 - include: flowtype-annotation
331 - match: (?<!\.)\.\.\.
332 scope: keyword.operator.spread.js
333 - match: '([_$a-zA-Z][$\w]*)'
334 scope: variable.parameter.function.js
335 - match: ","
336 scope: punctuation.separator.parameter.function.js
337 - match: "="
338 captures:
339 0: keyword.operator.assignment.js
340 push:
341 - meta_scope: meta.parameter.optional.js
342 - match: "(?=[,)])"
343 pop: true
344 - include: expression
345 graphql:
346 - match: \s*+gql`
347 push:
348 - meta_scope: meta.graphql.js
349 - match: "`"
350 pop: true
351 - include: scope:source.graphql
352 - match: '\${'
353 push:
354 - meta_scope: js
355 - match: "}"
356 pop: true
357 - include: core
358 - match: \s*+`#graphql
359 push:
360 - meta_scope: meta.graphql.js
361 - match: "`"
362 pop: true
363 - include: scope:source.graphql
364 - match: '\${'
365 push:
366 - meta_scope: js
367 - match: "}"
368 pop: true
369 - include: core
370 jsx-attribute-assignment:
371 - match: "="
372 scope: keyword.operator.assignment.jsx
373 jsx-attribute-name:
374 - match: '[_$a-zA-Z][-$\w]*'
375 scope: entity.other.attribute-name.jsx
376 jsx-attributes:
377 - include: jsx-attribute-name
378 - include: jsx-attribute-assignment
379 - include: jsx-string-quoted
380 - include: jsx-evaluated-code
381 - include: comments
382 jsx-entities:
383 - match: '&(?:[a-zA-Z0-9]+|#\d+|#x\h+);'
384 scope: constant.character.entity.jsx
385 - match: '&\S*;'
386 scope: invalid.illegal.bad-ampersand.jsx
387 jsx-evaluated-code:
388 - match: "{"
389 captures:
390 0: punctuation.section.embedded.begin.jsx
391 push:
392 - meta_scope: meta.embedded.expression.jsx
393 - match: "}"
394 captures:
395 0: punctuation.section.embedded.end.jsx
396 pop: true
397 - include: expression
398 jsx-string-quoted:
399 - match: '(["''])'
400 captures:
401 0: punctuation.definition.string.begin.jsx
402 push:
403 - meta_scope: string.quoted.jsx
404 - match: \1
405 captures:
406 0: punctuation.definition.string.end.jsx
407 pop: true
408 - include: jsx-entities
409 jsx-tag-end:
410 - match: ">"
411 captures:
412 0: meta.tag.jsx punctuation.definition.tag.end.jsx
413 push:
414 - match: (?=</)
415 pop: true
416 - include: jsx-tag-start
417 - include: jsx-evaluated-code
418 - include: jsx-entities
419 jsx-tag-start:
420 - match: '(<)([_$a-zA-Z][-$:.\w]*[$\w]*)'
421 captures:
422 1: meta.tag.jsx punctuation.definition.tag.begin.jsx
423 2: meta.tag.jsx entity.name.tag.jsx
424 push:
425 - match: (</)(\2)(>)|(/>)
426 captures:
427 1: meta.tag.jsx punctuation.definition.tag.begin.jsx
428 2: meta.tag.jsx entity.name.tag.jsx
429 3: meta.tag.jsx punctuation.definition.tag.end.jsx
430 4: meta.tag.jsx punctuation.definition.tag.end.jsx
431 pop: true
432 - include: jsx-tag-end
433 - include: jsx-attributes
434 - match: <
435 scope: invalid.illegal.tag.incomplete.jsx
436 literal-arrow-function:
437 - match: |-
438 (?x)
439 (?:([_$a-zA-Z][$\w]*)\s*(=)\s*)?
440 (?:\b(async)\s+)?
441 (?=(\((?>(?>[^()]+)|\g<-1>)*\))\s*(=>))
442 captures:
443 1: entity.name.function.js
444 2: keyword.operator.assignment.js
445 3: storage.type.js
446 push:
447 - meta_scope: meta.function.arrow.js
448 - match: (?<=\))\s*(=>)
449 captures:
450 1: storage.type.function.arrow.js
451 pop: true
452 - include: function-declaration-parameters
453 - match: |-
454 (?x)
455 (?:([_$a-zA-Z][$\w]*)\s*(=)\s*)?
456 (?:(async)\s+)?
457 \b([_$a-zA-Z][$\w]*)\s*(=>)
458 scope: meta.function.arrow.js
459 captures:
460 1: entity.name.function.js
461 2: keyword.operator.assignment.js
462 3: storage.type.js
463 4: variable.parameter.function.js
464 5: storage.type.function.arrow.js
465 - match: |-
466 (?x)
467 (\b_?[A-Z][$\w]*)?
468 (\.)(prototype)
469 (\.)([_$a-zA-Z][$\w]*)
470 \s*(=)
471 \s*(async)?
472 \s*(?=(\((?>(?>[^()]+)|\g<-1>)*\))\s*(=>))
473 captures:
474 1: entity.name.class.js
475 2: keyword.operator.accessor.js
476 3: variable.language.prototype.js
477 4: keyword.operator.accessor.js
478 5: entity.name.function.js
479 6: keyword.operator.assignment.js
480 7: storage.type.js
481 push:
482 - meta_scope: meta.prototype.function.arrow.js
483 - match: (?<=\))\s*(=>)
484 captures:
485 1: storage.type.function.arrow.js
486 pop: true
487 - include: function-declaration-parameters
488 - match: |-
489 (?x)
490 (\b_?[A-Z][$\w]*)?
491 (\.)(prototype)
492 (\.)([_$a-zA-Z][$\w]*)
493 \s*(=)
494 \s*(async)?
495 \s*\b([_$a-zA-Z][$\w]*)\s*(=>)
496 scope: meta.prototype.function.arrow.js
497 captures:
498 1: entity.name.class.js
499 2: keyword.operator.accessor.js
500 3: variable.language.prototype.js
501 4: keyword.operator.accessor.js
502 5: entity.name.function.js
503 6: keyword.operator.assignment.js
504 7: storage.type.js
505 8: variable.parameter.function.js
506 9: storage.type.function.arrow.js
507 - match: |-
508 (?x)
509 (\b_?[A-Z][$\w]*)?
510 (\.)([_$a-zA-Z][$\w]*)
511 \s*(=)
512 \s*(async)?
513 \s*(?=(\((?>(?>[^()]+)|\g<-1>)*\))\s*(=>))
514 captures:
515 1: entity.name.class.js
516 2: keyword.operator.accessor.js
517 3: entity.name.function.js
518 4: keyword.operator.assignment.js
519 5: storage.type.js
520 push:
521 - meta_scope: meta.function.static.arrow.js
522 - match: (?<=\))\s*(=>)
523 captures:
524 1: storage.type.function.arrow.js
525 pop: true
526 - include: function-declaration-parameters
527 - match: |-
528 (?x)
529 (\b_?[A-Z][$\w]*)?
530 (\.)([_$a-zA-Z][$\w]*)
531 \s*(=)
532 \s*(async)?
533 \s*\b([_$a-zA-Z][$\w]*)\s*(=>)
534 scope: meta.function.static.arrow.js
535 captures:
536 1: entity.name.class.js
537 2: keyword.operator.accessor.js
538 3: entity.name.function.js
539 4: keyword.operator.assignment.js
540 5: storage.type.js
541 6: variable.parameter.function.js
542 7: storage.type.function.arrow.js
543 literal-arrow-function-labels:
544 - match: |-
545 (?x)
546 (?>
547 ((')((?>[^'\\]|\\.)*)('))|
548 ((")((?>[^"\\]|\\.)*)("))|
549 (([_$a-zA-Z][$\w]*|\d+))
550 )
551 \s*(:)
552 \s*(?:\b(async)\s+)?
553 \s*(?=(\((?>(?>[^()]+)|\g<-1>)*\))\s*(=>))
554 captures:
555 1: string.quoted.js
556 2: punctuation.definition.string.begin.js
557 3: entity.name.function.js
558 4: punctuation.definition.string.end.js
559 5: string.quoted.js
560 6: punctuation.definition.string.begin.js
561 7: entity.name.function.js
562 8: punctuation.definition.string.end.js
563 9: string.unquoted.js
564 10: entity.name.function.js
565 11: punctuation.separator.key-value.js
566 12: storage.type.js
567 push:
568 - meta_scope: meta.function.json.arrow.js
569 - match: (?<=\))\s*(=>)
570 captures:
571 1: storage.type.function.arrow.js
572 pop: true
573 - include: function-declaration-parameters
574 - match: |-
575 (?x)
576 (?>
577 ((')((?>[^'\\]|\\.)*)('))|
578 ((")((?>[^"\\]|\\.)*)("))|
579 (([_$a-zA-Z][$\w]*|\d+))
580 )
581 \s*(:)
582 \s*(?:\b(async)\s+)?
583 \s*\b([_$a-zA-Z][$\w]*)\s*(=>)
584 scope: meta.function.json.arrow.js
585 captures:
586 1: string.quoted.js
587 2: punctuation.definition.string.begin.js
588 3: entity.name.function.js
589 4: punctuation.definition.string.end.js
590 5: string.quoted.js
591 6: punctuation.definition.string.begin.js
592 7: entity.name.function.js
593 8: punctuation.definition.string.end.js
594 9: string.unquoted.js
595 10: entity.name.function.js
596 11: punctuation.separator.key-value.js
597 12: storage.type.js
598 13: variable.parameter.function.js
599 14: storage.type.function.arrow.js
600 literal-class:
601 - match: (?<!\.)\b(?:(class)|(interface))\b
602 captures:
603 1: storage.type.class.js
604 2: storage.type.interface.flowtype.js
605 push:
606 - meta_scope: meta.class.js
607 - match: '\}'
608 captures:
609 0: meta.brace.curly.end.js
610 pop: true
611 - include: comments
612 - match: '([_$a-zA-Z][$\w]*)'
613 captures:
614 0: entity.name.class.js
615 push:
616 - match: "(?={)"
617 pop: true
618 - include: comments
619 - include: flowtype-polymorph
620 - match: (?<!\.)\b(extends)\b
621 captures:
622 0: storage.type.extends.js
623 push:
624 - meta_scope: meta.class.extends.js
625 - match: "(?={)"
626 pop: true
627 - include: flowtype-polymorph
628 - include: expression
629 - match: '\{'
630 captures:
631 0: meta.brace.curly.begin.js
632 push:
633 - match: "(?=})"
634 pop: true
635 - include: es7-decorators
636 - include: class-properties
637 - include: class-method-definition
638 - include: class-method-storage
639 - include: brackets
640 - include: comments
641 literal-constructor:
642 - match: '(new)\s+(?=[_$a-zA-Z][$\w.]*)'
643 captures:
644 1: keyword.operator.new.js
645 push:
646 - meta_scope: meta.instance.constructor.js
647 - match: '(?![_$a-zA-Z][$\w.]*)'
648 pop: true
649 - include: support-class
650 - include: support-other
651 - match: '([_$a-zA-Z][$\w.]*\.)?([_$a-zA-Z][$\w]*)'
652 captures:
653 2: variable.function.constructor.js
654 literal-for:
655 - match: (?<!\.)\b(for)\b
656 captures:
657 1: keyword.control.loop.js
658 push:
659 - meta_scope: meta.for.js
660 - match: \)
661 captures:
662 0: meta.brace.round.end.js
663 pop: true
664 - include: comments
665 - match: \(
666 captures:
667 0: meta.brace.round.begin.js
668 push:
669 - match: (?=\))
670 pop: true
671 - include: literal-keyword-storage
672 - include: expression
673 - include: literal-punctuation
674 literal-function:
675 - match: |-
676 (?x)
677 (?:([_$a-zA-Z][$\w]*)\s*(=)\s*)?
678 (?:(async)\s+)?
679 (function)(?>\s*(\*)|(?=[\s(<]))
680 \s*([_$a-zA-Z][$\w]*)?
681 captures:
682 1: entity.name.function.js
683 2: keyword.operator.assignment.js
684 3: storage.type.js
685 4: storage.type.function.js
686 5: keyword.generator.asterisk.js
687 6: entity.name.function.js
688 push:
689 - meta_scope: meta.function.js
690 - match: (?<=\))
691 pop: true
692 - include: flowtype-polymorph
693 - include: function-declaration-parameters
694 - match: |-
695 (?x)
696 (\b_?[A-Z][$\w]*)?
697 (\.)(prototype)
698 (\.)([_$a-zA-Z][$\w]*)
699 \s*(=)
700 \s*(?:(async)\s+)?
701 \s*(function)(?>\s*(\*)|(?=[\s(<]))
702 \s*([_$a-zA-Z][$\w]*)?\s*
703 captures:
704 1: entity.name.class.js
705 2: keyword.operator.accessor.js
706 3: variable.language.prototype.js
707 4: keyword.operator.accessor.js
708 5: entity.name.function.js
709 6: keyword.operator.assignment.js
710 7: storage.type.js
711 8: storage.type.function.js
712 9: keyword.generator.asterisk.js
713 10: entity.name.function.js
714 push:
715 - meta_scope: meta.function.prototype.js
716 - match: (?<=\))
717 pop: true
718 - include: flowtype-polymorph
719 - include: function-declaration-parameters
720 - match: |-
721 (?x)
722 (\b_?[A-Z][$\w]*)?
723 (\.)([_$a-zA-Z][$\w]*)
724 \s*(=)
725 \s*(?:(async)\s+)?
726 \s*(function)(?>\s*(\*)|(?=[\s(<]))
727 \s*([_$a-zA-Z][$\w]*)?\s*
728 captures:
729 1: entity.name.class.js
730 2: keyword.operator.accessor.js
731 3: entity.name.function.js
732 4: keyword.operator.assignment.js
733 5: storage.type.js
734 6: storage.type.function.js
735 7: keyword.generator.asterisk.js
736 8: entity.name.function.js
737 push:
738 - meta_scope: meta.function.static.js
739 - match: (?<=\))
740 pop: true
741 - include: flowtype-polymorph
742 - include: function-declaration-parameters
743 literal-function-call:
744 - match: '([_$a-zA-Z][$\w]*)\s*(\(\s*\))'
745 scope: meta.function-call.without-arguments.js
746 captures:
747 1: variable.function.js
748 2: meta.group.braces.round.function.arguments.js
749 - match: '([_$a-zA-Z][$\w]*)\s*(?=\()'
750 scope: meta.function-call.with-arguments.js
751 captures:
752 1: variable.function.js
753 - match: '([_$a-zA-Z][$\w]*)\s*(?=`)'
754 scope: meta.function-call.tagged-template.js
755 captures:
756 1: variable.function.js
757 literal-function-labels:
758 - match: |-
759 (?x)
760 (?>
761 ((')((?>[^'\\]|\\.)*)('))|
762 ((")((?>[^"\\]|\\.)*)("))|
763 (([_$a-zA-Z][$\w]*|\d+))
764 )
765 \s*(:)
766 \s*(?:\b(async)\s+)?
767 \s*(function)(?>\s*(\*)|(?=[\s(<]))
768 \s*([_$a-zA-Z][$\w]*)?
769 captures:
770 1: string.quoted.js
771 2: punctuation.definition.string.begin.js
772 3: entity.name.function.js
773 4: punctuation.definition.string.end.js
774 5: string.quoted.js
775 6: punctuation.definition.string.begin.js
776 7: entity.name.function.js
777 8: punctuation.definition.string.end.js
778 9: string.unquoted.js
779 10: entity.name.function.js
780 11: punctuation.separator.key-value.js
781 12: storage.type.js
782 13: storage.type.function.js
783 14: keyword.generator.asterisk.js
784 15: entity.name.function.js
785 push:
786 - meta_scope: meta.function.json.js
787 - match: (?<=\))
788 pop: true
789 - include: flowtype-polymorph
790 - include: function-declaration-parameters
791 literal-jsx:
792 - match: '(?<=\(|\{|\[|,|&&|\|\||\?|:|=|=>|\Wreturn|^return|\Wdefault|^)(?=\s*<[_$a-zA-Z])'
793 push:
794 - meta_content_scope: meta.jsx.js
795 - match: (?<=/>|>)
796 pop: true
797 - include: jsx-tag-start
798 literal-keyword-storage:
799 - match: (?<!\.)\b(?>const|let|var)\b
800 scope: storage.type.js
801 literal-keywords:
802 - include: literal-keyword-storage
803 - match: (?<!\.)\b((?>await|yield))\b(?:\s*(\*))?
804 captures:
805 1: keyword.control.flow.js
806 2: keyword.generator.asterisk.js
807 - match: (?<!\.)\b(return)\b
808 scope: keyword.control.flow.js
809 - match: (?<!\.)\b(?>if|else)\b
810 scope: keyword.control.conditional.js
811 - match: (?<!\.)\b(?>catch|finally|throw|try)\b
812 scope: keyword.control.trycatch.js
813 - match: (?<!\.)\b(?>break|continue|do|goto|while|case|default)\b
814 scope: keyword.control.loop.js
815 - match: (?<!\.)\b(?>enum|module|public|package|private|interface|protected)\b
816 scope: keyword.other.reserved.js
817 - match: (?<!\.)\b(debugger)\b
818 scope: keyword.other.js
819 literal-labels:
820 - match: |-
821 (?x)
822 (?<!\?)(?<!\?\s)(?=(?>
823 ((')((?>[^'\\]|\\.)*)('))|
824 ((")((?>[^"\\]|\\.)*)("))|
825 )\s*:)
826 push:
827 - match: ":"
828 captures:
829 0: punctuation.separator.key-value.js
830 pop: true
831 - include: literal-string
832 - match: '(?<!\.|\?|\?\s)([_$a-zA-Z][$\w]*)\s*(:)'
833 scope: constant.other.object.key.js
834 captures:
835 1: string.unquoted.label.js
836 2: punctuation.separator.key-value.js
837 literal-language-constant:
838 - match: (?<!\.)\b(true)\b
839 scope: constant.language.boolean.true.js
840 - match: (?<!\.)\b(false)\b
841 scope: constant.language.boolean.false.js
842 - match: (?<!\.)\b(null)\b
843 scope: constant.language.null.js
844 - match: (?<!\.)\b(undefined)\b
845 scope: constant.language.undefined.js
846 - match: (?<!\.)\b(NaN)\b
847 scope: constant.language.nan.js
848 literal-language-variable:
849 - match: (?<!(?<!\.\.)\.)\b(arguments)\b
850 scope: variable.language.arguments.js
851 - match: (?<!(?<!\.\.)\.)\b(super)\b
852 scope: variable.language.super.js
853 - match: (?<!(?<!\.\.)\.)\b(this)\b
854 scope: variable.language.this.js
855 - match: (?<!(?<!\.\.)\.)\b(self)\b
856 scope: variable.language.self.js
857 - match: (?<=\.)(__proto__)\b
858 scope: variable.language.proto.js
859 - match: (?<=\.)(constructor)\b
860 scope: variable.language.constructor.js
861 - match: (?<=\.)(prototype)\b
862 scope: variable.language.prototype.js
863 literal-method:
864 - match: |-
865 (?x)
866 (?:\b(static)\s+)?
867 (?:\b(async)\s+)?
868 (?:(\*)\s*)?
869 (?>
870 ((')((?>[^'\\]|\\.)*)('))|
871 ((")((?>[^"\\]|\\.)*)("))|
872 (([_$a-zA-Z][$\w]*|\d+))
873 )
874 (?=\s*(\((?>(?>[^()]+)|\g<-1>)*\))(?>\s|/\*.*\*/)*\{)
875 captures:
876 1: storage.type.js
877 2: storage.type.js
878 3: keyword.generator.asterisk.js
879 4: string.quoted.js
880 5: punctuation.definition.string.begin.js
881 6: entity.name.function.js
882 7: punctuation.definition.string.end.js
883 8: string.quoted.js
884 9: punctuation.definition.string.begin.js
885 10: entity.name.function.js
886 11: punctuation.definition.string.end.js
887 12: string.unquoted.js
888 13: entity.name.function.js
889 push:
890 - meta_scope: meta.method.js
891 - match: (?<=\))
892 pop: true
893 - include: function-declaration-parameters
894 - match: |-
895 (?x)
896 \b(?:(static)\s+)?
897 (get|set)\s+
898 ([_$a-zA-Z][$\w]*|\d+)\s*
899 (?=(\((?>(?>[^()]+)|\g<-1>)*\))(?>\s|/\*.*\*/)*\{)
900 captures:
901 1: storage.type.js
902 2: storage.type.accessor.js
903 3: entity.name.accessor.js
904 push:
905 - meta_scope: meta.accessor.js
906 - match: (?<=\))
907 pop: true
908 - include: function-declaration-parameters
909 literal-method-call:
910 - match: |-
911 (?x)
912 (?:(?<=\.)|\b)
913 ([A-Z][$\w]*)\s*(\.)
914 ([_$a-zA-Z][$\w]*)\s*
915 (\(\s*\))
916 scope: meta.function-call.static.without-arguments.js
917 captures:
918 1: variable.other.class.js
919 2: keyword.operator.accessor.js
920 3: variable.function.js
921 4: meta.group.braces.round.function.arguments.js
922 - match: |-
923 (?x)
924 (?:(?<=\.)|\b)
925 ([A-Z][$\w]*)\s*(\.)
926 ([_$a-zA-Z][$\w]*)\s*
927 (?=\()
928 scope: meta.function-call.static.with-arguments.js
929 captures:
930 1: variable.other.class.js
931 2: keyword.operator.accessor.js
932 3: variable.function.js
933 - match: |-
934 (?x)
935 (?<=\.)
936 ([_$a-zA-Z][$\w]*)\s*
937 (\(\s*\))
938 scope: meta.function-call.method.without-arguments.js
939 captures:
940 1: variable.function.js
941 2: meta.group.braces.round.function.arguments.js
942 - match: |-
943 (?x)
944 (?<=\.)
945 ([_$a-zA-Z][$\w]*)\s*
946 (?=\()
947 scope: meta.function-call.method.with-arguments.js
948 captures:
949 1: variable.function.js
950 literal-module:
951 - match: (?<!\.)\b(?>import|export|default|from|as)\b
952 scope: keyword.operator.module.js
953 literal-number:
954 - match: '(?i)(?:\B[-+]|\b)0x[0-9a-f]*\.(\B|\b[0-9]+)'
955 scope: invalid.illegal.numeric.hex.js
956 - match: '(?:\B[-+]|\b)0[0-9]+\.(\B|\b[0-9]+)'
957 scope: invalid.illegal.numeric.octal.js
958 - match: |-
959 (?xi)
960 (?:\B[-+])?
961 (?:
962 \b0b[0-1]*| # binary
963 \b0o[0-7]*| # octal
964 \b0x[0-9a-f]*| # hex
965 (
966 \B\.[0-9]+| # e.g. .999
967 \b[0-9]+(\.[0-9]*)? # e.g. 999.999, 999. or 999
968 )(e[-+]?[0-9]+)? # e.g. e+123, E-123
969 )
970 scope: constant.numeric.js
971 - match: '(?:\B[-+]|\b)(Infinity)\b'
972 scope: constant.language.infinity.js
973 literal-operators:
974 - match: (?<!\.)\b(?>delete|instanceof|in|new|of|typeof|void|with)\b
975 scope: keyword.operator.js
976 - match: |-
977 (?x)
978 !(?!=)| # logical-not right-to-left right
979 && | # logical-and left-to-right both
980 \|\| # logical-or left-to-right both
981 scope: keyword.operator.logical.js
982 - match: |-
983 (?x)
984 =(?!=) # assignment right-to-left both
985 scope: keyword.operator.assignment.js
986 - match: |-
987 (?x)
988 %= | # assignment right-to-left both
989 &= | # assignment right-to-left both
990 \*= | # assignment right-to-left both
991 \+= | # assignment right-to-left both
992 -= | # assignment right-to-left both
993 /= | # assignment right-to-left both
994 \^= | # assignment right-to-left both
995 \|= | # assignment right-to-left both
996 <<= | # assignment right-to-left both
997 >>= | # assignment right-to-left both
998 >>>= # assignment right-to-left both
999 scope: keyword.operator.assignment.augmented.js
1000 - match: |-
1001 (?x)
1002 ~ | # bitwise-not right-to-left right
1003 << | # bitwise-shift left-to-right both
1004 >>> | # bitwise-shift left-to-right both
1005 >> | # bitwise-shift left-to-right both
1006 & | # bitwise-and left-to-right both
1007 \^ | # bitwise-xor left-to-right both
1008 \| # bitwise-or left-to-right both
1009 scope: keyword.operator.bitwise.js
1010 - match: |-
1011 (?x)
1012 <= | # relational left-to-right both
1013 >= | # relational left-to-right both
1014 < | # relational left-to-right both
1015 > # relational left-to-right both
1016 scope: keyword.operator.relational.js
1017 - match: |-
1018 (?x)
1019 === | # equality left-to-right both
1020 !== | # equality left-to-right both
1021 == | # equality left-to-right both
1022 != # equality left-to-right both
1023 scope: keyword.operator.comparison.js
1024 - match: |-
1025 (?x)
1026 -- | # decrement n/a right-or-left
1027 \+\+ | # increment n/a right-or-left
1028 / | # division left-to-right both
1029 % | # modulus left-to-right both
1030 \* | # multiplication left-to-right both
1031 \+ | # addition left-to-right both
1032 - # subtraction left-to-right both
1033 scope: keyword.operator.arithmetic.js
1034 - match: "[?:]"
1035 scope: keyword.operator.ternary.js
1036 - match: (?<!\.)\.\.\.
1037 scope: keyword.operator.spread.js
1038 - match: \.
1039 scope: keyword.operator.accessor.js
1040 literal-prototype:
1041 - match: '([_$a-zA-Z][$\w]*)(\.)(prototype)\s*(=)\s*'
1042 scope: meta.prototype.declaration.js
1043 captures:
1044 1: entity.name.class.js
1045 2: keyword.operator.accessor.js
1046 3: variable.language.prototype.js
1047 4: keyword.operator.assignment.js
1048 - match: '([_$a-zA-Z][$\w]*)(\.)(prototype)\b'
1049 scope: meta.prototype.access.js
1050 captures:
1051 1: entity.name.class.js
1052 2: keyword.operator.accessor.js
1053 3: variable.language.prototype.js
1054 literal-punctuation:
1055 - match: ;
1056 scope: punctuation.terminator.statement.js
1057 - match: ","
1058 scope: meta.delimiter.comma.js
1059 literal-regexp:
1060 - match: |-
1061 (?x)
1062 (?<=
1063 \.|\(|,|{|}|\[|;|<|>|<=|>=|==|!=|===|!==|\+|-|\*|%|\+\+|--|<<|>>|>>>|&|\||\^|!|~|&&|\|\||\?|:|=|\+=|-=|\*=|%=|<<=|>>=|>>>=|&=|\|=|\^=|/|/=|
1064 \Wnew|\Wdelete|\Wvoid|\Wtypeof|\Winstanceof|\Win|\Wdo|\Wreturn|\Wcase|\Wthrow|\Wyield|
1065 ^new|^delete|^void|^typeof|^instanceof|^in|^do|^return|^case|^throw|^yield|^
1066 )\s*
1067 (/)
1068 (?!/|\*|$)
1069 captures:
1070 1: punctuation.definition.string.begin.js
1071 push:
1072 - meta_scope: string.regexp.js
1073 - match: "(/)([gimy]*)"
1074 captures:
1075 1: punctuation.definition.string.end.js
1076 2: keyword.other.js
1077 pop: true
1078 - include: scope:source.regexp.js
1079 literal-string:
1080 - match: '(["''])'
1081 captures:
1082 0: punctuation.definition.string.begin.js
1083 push:
1084 - meta_scope: string.quoted.js
1085 - match: (\1)|(\n)
1086 captures:
1087 1: punctuation.definition.string.end.js
1088 2: invalid.illegal.newline.js
1089 pop: true
1090 - include: string-content
1091 literal-switch:
1092 - match: (?<!\.)\b(switch)\b
1093 captures:
1094 1: keyword.control.switch.js
1095 push:
1096 - meta_scope: meta.switch.js
1097 - match: '\}'
1098 captures:
1099 0: meta.brace.curly.end.js
1100 pop: true
1101 - include: comments
1102 - include: round-brackets
1103 - match: '\{'
1104 captures:
1105 0: meta.brace.curly.begin.js
1106 push:
1107 - match: "(?=})"
1108 pop: true
1109 - match: (?<!\.)\b(case|default)\b
1110 captures:
1111 1: keyword.control.switch.js
1112 push:
1113 - match: (?=:)
1114 pop: true
1115 - include: expression
1116 - include: main
1117 literal-template-string:
1118 - match: "`"
1119 captures:
1120 0: string.interpolated.js keyword.other.template.begin.js
1121 push:
1122 - match: "`"
1123 captures:
1124 0: string.interpolated.js keyword.other.template.end.js
1125 pop: true
1126 - include: string-content
1127 - match: \\`
1128 scope: constant.character.escape.js
1129 - match: '\${'
1130 captures:
1131 0: keyword.other.substitution.begin.js
1132 push:
1133 - match: "}"
1134 captures:
1135 0: keyword.other.substitution.end.js
1136 pop: true
1137 - include: expression
1138 - match: .
1139 scope: string.interpolated.js
1140 literal-variable:
1141 - match: '_*?[A-Z][_$\dA-Z]*\b'
1142 scope: variable.other.constant.js
1143 - match: '\b([A-Z][$\w]*)\s*(\.)([_$a-zA-Z][$\w]*)'
1144 scope: meta.property.class.js
1145 captures:
1146 1: variable.other.class.js
1147 2: keyword.operator.accessor.js
1148 3: variable.other.property.static.js
1149 - match: '(?<!\.)([_$a-zA-Z][$\w]*)\s*(?=[\[\.])'
1150 scope: variable.other.object.js
1151 captures:
1152 1: variable.other.object.js
1153 - match: '(?<=\.)\s*([_$a-zA-Z][$\w]*)'
1154 scope: meta.property.object.js
1155 captures:
1156 1: variable.other.property.js
1157 - match: '[_$a-zA-Z][$\w]*'
1158 scope: variable.other.readwrite.js
1159 merge-conflits:
1160 - match: '^([<]{7})\s(.+)$'
1161 captures:
1162 1: invalid.illegal.conflict-marker.merge-into.js
1163 2: invalid.illegal.string.js
1164 - match: "^([=|]{7})$"
1165 captures:
1166 1: invalid.illegal.conflict-marker.separator.js
1167 - match: '^([>]{7})\s(.+)$'
1168 captures:
1169 1: invalid.illegal.conflict-marker.other-commit.js
1170 2: invalid.illegal.string.js
1171 round-brackets:
1172 - match: \(
1173 captures:
1174 0: meta.brace.round.begin.js
1175 push:
1176 - meta_scope: meta.group.braces.round.js
1177 - match: \)
1178 captures:
1179 0: meta.brace.round.end.js
1180 pop: true
1181 - include: expression
1182 square-brackets:
1183 - match: '\['
1184 captures:
1185 0: meta.brace.square.begin.js
1186 push:
1187 - meta_scope: meta.group.braces.square.js
1188 - match: '\]'
1189 captures:
1190 0: meta.brace.square.end.js
1191 pop: true
1192 - include: expression
1193 string-content:
1194 - match: \\\s*\n
1195 scope: constant.character.escape.newline.js
1196 - match: '\\([1-7][0-7]{0,2}|[0-7]{2,3}|[bfnrtv0''"\\]|x\h{2}|u\{\h+\}|u\h{4})'
1197 scope: constant.character.escape.js
1198 styled-components:
1199 - match: (?<!\.)\b(injectGlobal|keyframes)\s*(`)
1200 captures:
1201 1: variable.function.tagged-template.js
1202 2: punctuation.definition.string.template.begin.js
1203 push:
1204 - meta_scope: meta.styled-components.js
1205 - meta_content_scope: source.css.embedded.js
1206 - match: "`"
1207 captures:
1208 0: punctuation.definition.string.template.end.js
1209 pop: true
1210 - include: scope:source.js.css
1211 - match: '(?<!\.)\b(styled)(\.)([_$a-zA-Z][$\w]*)\s*(`)'
1212 captures:
1213 1: variable.other.object.js
1214 2: punctuation.accessor.js
1215 3: variable.function.tagged-template.js
1216 4: punctuation.definition.string.template.begin.js
1217 push:
1218 - meta_scope: meta.styled-components.js
1219 - meta_content_scope: source.css.embedded.js
1220 - match: "`"
1221 captures:
1222 0: punctuation.definition.string.template.end.js
1223 pop: true
1224 - include: scope:source.js.css
1225 - match: '(?<!\.)\b(styled)\s*(?=(\((?>(?>[^()]+)|\g<-1>)*\))\s*`)'
1226 captures:
1227 1: meta.function-call.with-arguments.js variable.function.js
1228 push:
1229 - meta_scope: meta.styled-components.js
1230 - match: (?<=`)
1231 captures:
1232 1: meta.function-call.with-arguments.js variable.function.js
1233 pop: true
1234 - match: \(
1235 captures:
1236 0: punctuation.definition.group.begin.js
1237 push:
1238 - meta_scope: meta.function-call.with-arguments.js meta.group.js
1239 - match: \)
1240 captures:
1241 0: punctuation.definition.group.end.js
1242 pop: true
1243 - include: expression
1244 - match: "`"
1245 captures:
1246 0: punctuation.definition.string.template.begin.js
1247 push:
1248 - meta_content_scope: source.css.embedded.js
1249 - match: "`"
1250 captures:
1251 0: punctuation.definition.string.template.end.js
1252 pop: true
1253 - include: scope:source.js.css
1254 support-class:
1255 - match: (?<!\.)\b(Array|ArrayBuffer|Boolean|DataView|Date|Float32Array|Float64Array|Function|Infinity|Int16Array|Int32Array|Int8Array|JSON|Map|Math|NaN|Number|Object|Promise|Proxy|Reflect|RegExp|Set|String|Symbol|System|TypeError|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|WeakMap|WeakSet)\b
1256 scope: support.class.builtin.js
1257 - match: (?<!\.)\b((?>Eval|Range|Reference|Syntax|Type|URI)?Error)\b
1258 scope: support.class.error.js
1259 - match: \b(?>Buffer)\b
1260 scope: support.class.node.js
1261 support-other:
1262 - match: (?<!\.)\b(constructor|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|escape|eval|hasOwnProperty|isFinite|isNaN|isPrototypeOf|parseFloat|parseInt|propertyIsEnumerable|toLocaleString|toString|unescape|valueOf)\b
1263 scope: support.function.builtin.js
1264 - match: (?<!\.)\b(clearImmediate|clearInterval|clearTimeout|require|setImmediate|setInterval|setTimeout)\b
1265 scope: support.function.node.js
1266 - match: (?<!\.)\b(?>document|window)\b
1267 scope: support.type.object.dom.js
1268 - match: (?<!\.)\b(?>global|GLOBAL|root|__dirname|__filename)\b
1269 scope: support.type.object.node.js
1270 - match: (?<!\.)\b(console)(?:(\.)(assert|count|dir|error|group|groupCollapsed|groupEnd|info|log|profile|profileEnd|table|time|timeEnd|trace|warn))?\b
1271 captures:
1272 1: support.type.object.console.js
1273 2: keyword.operator.accessor.js
1274 3: support.function.console.js
1275 - match: (?<!\.)\b(process)(?:(\.)(?:(arch|argv|config|env|execArgv|execPath|exitCode|mainModule|pid|platform|stderr|stdin|stdout|title|version|versions)|(abort|chdir|cwd|exit|getgid|getgroups|getuid|hrtime|initgroups|kill|memoryUsage|nextTick|setgid|setgroups|setuid|umask|uptime)))?\b
1276 captures:
1277 1: support.type.object.process.js
1278 2: keyword.operator.accessor.js
1279 3: support.type.object.process.js
1280 4: support.function.process.js
1281 - match: (?<!\.)\b(exports|module)(?:(\.)(children|exports|filename|id|loaded|parent))?\b
1282 captures:
1283 1: support.type.object.module.js
1284 2: keyword.operator.accessor.js
1285 3: support.type.object.module.js
1286 - match: "{{"
1287 push:
1288 - meta_scope: meta.tag.mustache.js
1289 - match: "}}"
1290 pop: true