-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
source.js.js
1238 lines (1236 loc) · 56.4 KB
/
source.js.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/atom/language-javascript>
// and licensed `mit`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: [
'._js',
'.bones',
'.cjs',
'.code-snippets',
'.code-workspace',
'.cy',
'.es6',
'.jake',
'.javascript',
'.js',
'.js.erb',
'.jsb',
'.jscad',
'.jsfl',
'.jslib',
'.jsm',
'.json5',
'.jsonc',
'.jsonld',
'.jspre',
'.jss',
'.jsx',
'.mjs',
'.njs',
'.pac',
'.sjs',
'.ssjs',
'.sublime-build',
'.sublime-color-scheme',
'.sublime-commands',
'.sublime-completions',
'.sublime-keymap',
'.sublime-macro',
'.sublime-menu',
'.sublime-mousemap',
'.sublime-project',
'.sublime-settings',
'.sublime-theme',
'.sublime-workspace',
'.sublime_metrics',
'.sublime_session',
'.xsjs',
'.xsjslib'
],
names: [
'cycript',
'javascript',
'javascript+erb',
'js',
'json-with-comments',
'json5',
'jsonc',
'jsonld',
'node',
'qt-script'
],
patterns: [
{
begin: '(?<!\\.)\\b(import)(?!\\s*[:(])\\b',
beginCaptures: {1: {name: 'keyword.control.js'}},
end: '(?=;|$)',
name: 'meta.import.js',
patterns: [
{
begin: '{',
beginCaptures: {0: {name: 'punctuation.definition.modules.begin.js'}},
end: '}',
endCaptures: {0: {name: 'punctuation.definition.modules.end.js'}},
patterns: [
{
captures: {
1: {name: 'variable.language.default.js'},
2: {name: 'variable.other.module.js'},
3: {name: 'keyword.control.js'},
4: {name: 'invalid.illegal.js'},
5: {name: 'variable.other.module-alias.js'}
},
match:
'(?x)\n(?: \\b(default)\\b | \\b([a-zA-Z_$][\\w$]*)\\b)\n\\s*\n(\\b as \\b)\n\\s*\n(?: (\\b default \\b | \\*) | \\b([a-zA-Z_$][\\w$]*)\\b)'
},
{match: ',', name: 'meta.delimiter.object.comma.js'},
{include: '#comments'},
{
match: '\\b([a-zA-Z_$][\\w$]*)\\b',
name: 'variable.other.module.js'
}
]
},
{
captures: {
1: {name: 'variable.language.default.js'},
2: {name: 'variable.language.import-all.js'},
3: {name: 'variable.other.module.js'},
4: {name: 'keyword.control.js'},
5: {name: 'invalid.illegal.js'},
6: {name: 'variable.other.module-alias.js'}
},
match:
'(?x)\n(?: \\b(default)\\b | (\\*) | \\b([a-zA-Z_$][\\w$]*)\\b)\n\\s*\n(\\b as \\b)\n\\s*\n(?: (\\b default \\b | \\*) | \\b([a-zA-Z_$][\\w$]*)\\b)'
},
{match: '\\*', name: 'variable.language.import-all.js'},
{match: '\\b(default)\\b', name: 'variable.language.default.js'},
{include: '#strings'},
{include: '#comments'},
{match: '\\b(from)\\b', name: 'keyword.control.js'},
{
match: '\\b([a-zA-Z_$][\\w$]*)\\b(?=.*\\bfrom\\b)',
name: 'variable.other.module.js'
},
{match: ',', name: 'meta.delimiter.object.comma.js'}
]
},
{
captures: {
0: {name: 'meta.export.js'},
1: {name: 'keyword.control.js'},
2: {name: 'variable.language.default.js'},
3: {name: 'variable.other.module.js'}
},
match:
'(?x)\n\\b(export)\\b\\s*\n\\b(default)\\b\\s*\n\\b((?!\\b(?:function|class|let|var|const)\\b)[a-zA-Z_$][\\w$]*)?\\b'
},
{
begin: '(?<!\\.)\\b(export)(?!\\s*[:(])\\b',
beginCaptures: {1: {name: 'keyword.control.js'}},
end: '(?=;|\\bfunction\\b|\\bclass\\b|\\blet\\b|\\bvar\\b|\\bconst\\b|$)',
name: 'meta.export.js',
patterns: [
{include: '#numbers'},
{
begin: '(?![a-zA-Z_$0-9]){',
beginCaptures: {0: {name: 'punctuation.definition.modules.begin.js'}},
end: '}',
endCaptures: {0: {name: 'punctuation.definition.modules.end.js'}},
patterns: [
{
captures: {
1: {name: 'variable.language.default.js'},
2: {name: 'variable.other.module.js'},
3: {name: 'keyword.control.js'},
4: {name: 'variable.language.default.js'},
5: {name: 'invalid.illegal.js'},
6: {name: 'variable.other.module-alias.js'}
},
match:
'(?x)\n(?: \\b(default)\\b | \\b([a-zA-Z_$][\\w$]*)\\b)\n\\s*\n(\\b as \\b)\n\\s*\n(?: \\b(default)\\b | (\\*) | \\b([a-zA-Z_$][\\w$]*)\\b)'
},
{include: '#comments'},
{match: ',', name: 'meta.delimiter.object.comma.js'},
{
match: '\\b([a-zA-Z_$][\\w$]*)\\b',
name: 'variable.other.module.js'
}
]
},
{match: '\\*(?=.*\\bfrom\\b)', name: 'variable.language.import-all.js'},
{match: '\\b(default)\\b', name: 'variable.language.default.js'},
{include: '#strings'},
{include: '#comments'},
{match: '\\b(from)\\b', name: 'keyword.control.js'},
{match: '\\b([a-zA-Z_$][\\w$]*)\\b', name: 'variable.other.module.js'},
{match: ',', name: 'meta.delimiter.object.comma.js'},
{include: '#operators'}
]
},
{
match:
'(?:(?<=\\.{3})|(?<!\\.)\\b)(?<!\\$)(super|this|arguments)(?!\\s*:|\\$)\\b',
name: 'variable.language.js'
},
{
begin: '(?=(\\basync\\b\\s*)?\\bfunction\\b(?!\\s*:))',
end: '(?<=})',
patterns: [
{include: '#comments'},
{include: '#function_body'},
{
begin: '\\G',
end: '(?<=\\))',
name: 'meta.function.js',
patterns: [{include: '#function_innards'}]
}
]
},
{
begin:
'(?=(\\.)?[a-zA-Z_$][\\w$]*\\s*=\\s*(\\basync\\b\\s*)?\\bfunction\\b)',
end: '(?<=})',
patterns: [
{include: '#comments'},
{include: '#function_body'},
{
begin: '\\G',
end: '(?!\\G)(?<=\\))',
name: 'meta.function.js',
patterns: [
{
captures: {
1: {name: 'meta.delimiter.method.period.js'},
2: {name: 'entity.name.function.js'},
3: {name: 'keyword.operator.assignment.js'}
},
match: '(\\.)?([a-zA-Z_$][\\w$]*)\\s*(=)\\s*'
},
{include: '#function_innards'}
]
}
]
},
{
begin:
'(?=\\b[a-zA-Z_$][\\w$]*\\s*:\\s*(\\basync\\b\\s*)?\\bfunction\\b)',
end: '(?<=})',
patterns: [
{include: '#comments'},
{include: '#function_body'},
{
begin: '\\G',
end: '(?<=\\))',
name: 'meta.function.json.js',
patterns: [
{
captures: {
1: {name: 'entity.name.function.js'},
2: {name: 'keyword.operator.assignment.js'}
},
match: '\\b([a-zA-Z_$][\\w$]*)\\s*(:)\\s*'
},
{include: '#function_innards'}
]
}
]
},
{
begin:
'(?=((\'[^\']*?\')|("[^"]*?"))\\s*:\\s*(\\basync\\b\\s*)?\\bfunction\\b)',
end: '(?<=})',
patterns: [
{include: '#comments'},
{include: '#function_body'},
{
begin: '\\G',
end: '(?<=\\))',
name: 'meta.function.json.js',
patterns: [
{
captures: {
1: {name: 'string.quoted.single.js'},
2: {name: 'punctuation.definition.string.begin.js'},
3: {name: 'entity.name.function.js'},
4: {name: 'punctuation.definition.string.end.js'},
5: {name: 'string.quoted.double.js'},
6: {name: 'punctuation.definition.string.begin.js'},
7: {name: 'entity.name.function.js'},
8: {name: 'punctuation.definition.string.end.js'},
9: {name: 'keyword.operator.assignment.js'}
},
match: '(?:((\')([^\']*?)(\'))|((")([^"]*?)(")))\\s*(:)'
},
{include: '#function_innards'}
]
}
]
},
{
begin: '(?=\\bconstructor\\b\\s*)',
end: '(?<=})',
patterns: [
{include: '#comments'},
{include: '#function_body'},
{
begin: '\\G',
end: '(?<=\\))',
name: 'meta.function.js',
patterns: [
{
match: '\\b(constructor)\\s*',
name: 'entity.name.function.constructor.js'
},
{include: '#function_innards'}
]
}
]
},
{
begin:
'(?x)\n(?=\n (?!\n (break|case|catch|continue|do|else|finally|for|function|if|\n return|switch|throw|try|while|with)\n [\\s\\(]\n )\n (\n \\b(get|set) # Property getter/setter: get foo(){}\n (?:\\s+|(?=\\[)) # Followed by whitespace or square bracket\n )?+\n ( # Method name\n \\b[a-zA-Z_$][\\w$]* # Fixed name\n |\n \\[ # Computed property key\n [^\\[\\]]++ # Contains at least one non-brace character\n \\]\n )\n \\s*\\(\\s* # Start of arguments list\n (\n "[^"]*" | # Double-quoted string\n \'[^\']*\' | # Single-quoted string\n [^"()\'] # Any non-bracket or non-quote\n )*\n \\)\\s* # End of arguments\n { # Beginning of body\n)',
end: '(?<=})',
patterns: [
{include: '#comments'},
{include: '#function_body'},
{
begin: '\\G',
end: '(?<=\\))',
name: 'meta.function.method.definition.js',
patterns: [
{
captures: {
1: {
name: 'punctuation.definition.computed-key.begin.bracket.square.js'
},
2: {
patterns: [
{include: '$self'},
{
match: '[a-zA-Z_$][\\w$]*',
name: 'variable.parameter.property.js'
}
]
},
3: {
name: 'punctuation.definition.computed-key.end.bracket.square.js'
}
},
match: '(\\[)(.+)(\\])(?=\\s*\\()',
name: 'meta.computed-key.js'
},
{
match:
'\\b(get|set)(?=\\s*\\[.+\\]\\s*\\(|\\s+[^\\s\\[(]+\\s*\\()',
name: 'keyword.operator.$1ter.js'
},
{match: '\\b([a-zA-Z_$][\\w$]*)', name: 'entity.name.function.js'},
{include: '#function_params'}
]
}
]
},
{
begin:
'(?x)\n(?=\n (?<![A-Za-z0-9])\n ((\\(([^\\(\\)]*)?\\))|[\\w$]+)\n \\s*=>\n)',
end: '(?x)\n(?<=})|\n((?!\n \\s*{|\n \\G\\(|\n \\G[\\w$]+|\n \\s*/\\*|\\s*//\n)(?=\\s*\\S))',
patterns: [
{include: '#comments'},
{include: '#function_body'},
{
begin: '\\G',
end: '(?<=(=>))',
name: 'meta.function.arrow.js',
patterns: [{include: '#arrow_function_innards'}]
}
]
},
{
begin:
'(?x)\n(?=\n (\\.)?[a-zA-Z_$][\\w$]*\n \\s*(=)\\s*\n ((\\(([^\\(\\)]*)?\\))|[\\w$]+)\n \\s*=>\n)',
end: '(?x)\n(?<=})|\n((?!\n \\s*{|\n \\G(\\.)?[a-zA-Z_$][\\w$]*\\s*(=)\\s*\\(|\n \\G(\\.)?[a-zA-Z_$][\\w$]*\\s*(=)\\s*[\\w$]+|\n \\s*/\\*|\\s*//\n)(?=\\s*\\S))',
patterns: [
{include: '#comments'},
{include: '#function_body'},
{
begin: '\\G',
end: '(?<=(=>))',
name: 'meta.function.arrow.js',
patterns: [
{
captures: {
1: {name: 'meta.delimiter.method.period.js'},
2: {name: 'entity.name.function.js'},
3: {name: 'keyword.operator.assignment.js'}
},
match: '\\G(\\.)?([a-zA-Z_$][\\w$]*)\\s*(=)'
},
{include: '#arrow_function_innards'}
]
}
]
},
{
begin:
'(?x)\n(?=\n \\b[a-zA-Z_$][\\w$]*\n \\s*:\\s*\n ((\\(([^\\(\\)]*)?\\))|[\\w$]+)\n \\s*=>\n)',
end: '(?x)\n(?<=})|\n((?!\n \\s*{|\n \\G[\\w$]+\\s*:|\n \\s*/\\*|\\s*//\n)(?=\\s*\\S))',
patterns: [
{include: '#comments'},
{include: '#function_body'},
{
begin: '\\G',
end: '(?<=(=>))',
name: 'meta.function.arrow.json.js',
patterns: [
{
captures: {
1: {name: 'entity.name.function.js'},
2: {name: 'keyword.operator.assignment.js'}
},
match: '\\b([a-zA-Z_$][\\w$]*)\\s*(:)\\s*'
},
{include: '#arrow_function_innards'}
]
}
]
},
{
begin:
'(?x)\n(?=\n ((\'[^\']*?\')|("[^"]*?"))\n \\s*:\\s*\n ((\\(([^\\(\\)]*)?\\))|[\\w$]+)\n \\s*=>\n)',
end: '(?x)\n(?<=})|\n((?!\n \\G((\'[^\']*?\')|("[^"]*?"))|\n \\s*{|\n \\s*/\\*|\\s*//\n)(?=\\s*\\S))',
patterns: [
{include: '#comments'},
{include: '#function_body'},
{
begin: '\\G',
end: '(?<=(=>))',
name: 'meta.function.arrow.json.js',
patterns: [
{
captures: {
1: {name: 'string.quoted.single.js'},
2: {name: 'punctuation.definition.string.begin.js'},
3: {name: 'entity.name.function.js'},
4: {name: 'punctuation.definition.string.end.js'},
5: {name: 'string.quoted.double.js'},
6: {name: 'punctuation.definition.string.begin.js'},
7: {name: 'entity.name.function.js'},
8: {name: 'punctuation.definition.string.end.js'},
9: {name: 'keyword.operator.assignment.js'}
},
match: '(?:((\')([^\']*?)(\'))|((")([^"]*?)(")))\\s*(:)'
},
{include: '#arrow_function_innards'}
]
}
]
},
{
captures: {
0: {name: 'meta.function.arrow.js'},
1: {name: 'storage.type.function.arrow.js'}
},
match: '(=>)'
},
{
captures: {
1: {name: 'storage.type.class.js'},
2: {name: 'storage.modifier.js'},
3: {name: 'entity.other.inherited-class.js'},
4: {name: 'entity.name.type.class.js'},
5: {name: 'storage.modifier.js'},
6: {name: 'entity.other.inherited-class.js'}
},
match:
'(?x)\n\\b(class)\n(?:\n (?:\\s+(extends)\\s+([a-zA-Z_$][\\w$]*))\n |\n (?:\n (?:\\s+([a-zA-Z_$][\\w$]*))\n (?:\\s+(extends)\\s+([a-zA-Z_$][\\w$]*))?\n )\n)',
name: 'meta.class.js'
},
{
captures: {
1: {name: 'keyword.operator.new.js'},
2: {
name: 'entity.name.type.instance.js',
patterns: [{match: '\\.', name: 'meta.delimiter.property.period.js'}]
}
},
match: '(new)\\s+([\\w$]+[\\w.$]*)',
name: 'meta.class.instance.constructor.js'
},
{
begin: '(?<![\\w$])console(?![\\w$]|\\s*:)',
beginCaptures: {0: {name: 'entity.name.type.object.console.js'}},
end: '(?x)\n(?<=\\)) | (?=\n (?! (\\s*//)|(\\s*/\\*)|(\\s*(\\.)\\s*\n (assert|clear|debug|error|info|log|profile|profileEnd|time|timeEnd|warn)\n \\s*\\(\n )) \\s*\\S\n)',
patterns: [
{include: '#comments'},
{
begin: '\\s*(\\.)\\s*(\\w+)\\s*(?=\\()',
beginCaptures: {
1: {name: 'meta.delimiter.method.period.js'},
2: {name: 'support.function.console.js'}
},
end: '(?<=\\))',
name: 'meta.method-call.js',
patterns: [{include: '#arguments'}]
}
]
},
{
begin: '(?<![\\w$])Math(?![\\w$]|\\s*:)',
beginCaptures: {0: {name: 'support.class.math.js'}},
end: '(?x)\n(?<=E|LN10|LN2|LOG10E|LOG2E|PI|SQRT1_2|SQRT2|\\)\n) | (?=\n (?! (\\s*//)|(\\s*/\\*)|(\\s*\\.\\s* (\n ((abs|acos|acosh|asin|asinh|atan|atan2|atanh|cbrt|ceil|clz32|cos|cosh|exp|\n expm1|floor|fround|hypot|imul|log|log10|log1p|log2|max|min|pow|random|\n round|sign|sin|sinh|sqrt|tan|tanh|trunc)\\s*\\(\n ) | (E|LN10|LN2|LOG10E|LOG2E|PI|SQRT1_2|SQRT2)(?!\\s*[\\w$(]))\n )) \\s*\\S\n)',
patterns: [
{include: '#comments'},
{
begin: '\\s*(\\.)\\s*(\\w+)\\s*(?=\\()',
beginCaptures: {
1: {name: 'meta.delimiter.method.period.js'},
2: {name: 'support.function.math.js'}
},
end: '(?<=\\))',
name: 'meta.method-call.js',
patterns: [{include: '#arguments'}]
},
{
captures: {
1: {name: 'meta.delimiter.property.period.js'},
2: {name: 'support.constant.property.math.js'}
},
match: '\\s*(\\.)\\s*(\\w+)\\b'
}
]
},
{
begin: '(?<![\\w$])Promise(?![\\w$]|\\s*:)',
beginCaptures: {0: {name: 'support.class.promise.js'}},
end: '(?x)\n(?<=\\)) | (?=\n (?! (\\s*//)|(\\s*/\\*)|(\\s*\\.\\s*(all|race|reject|resolve)\\s*\\() )\\s*\\S\n)',
patterns: [
{include: '#comments'},
{
begin: '\\s*(\\.)\\s*(\\w+)\\s*(?=\\()',
beginCaptures: {
1: {name: 'meta.delimiter.method.period.js'},
2: {name: 'support.function.promise.js'}
},
end: '(?<=\\))',
name: 'meta.method-call.js',
patterns: [{include: '#arguments'}]
}
]
},
{include: '#strings'},
{include: '#comments'},
{
captures: {
0: {name: 'punctuation.definition.comment.html.js'},
2: {name: 'punctuation.definition.comment.html.js'}
},
match: '(<!--|-->)',
name: 'comment.block.html.js'
},
{
match: '(?<!\\.)\\b(class|enum|function|interface)(?!\\s*:)\\b',
name: 'storage.type.js'
},
{
match:
'(?<!\\.)\\b(async|export|extends|implements|private|protected|public|static)(?!\\s*:)\\b',
name: 'storage.modifier.js'
},
{match: '(?<!\\.)\\b(let|var)(?!\\s*:)\\b', name: 'storage.type.var.js'},
{
begin: '(?<!\\.)\\b(const)(?!\\s*:)\\b',
beginCaptures: {1: {name: 'storage.type.const.js'}},
end: '(\\bof\\b|\\bin\\b)|(;)|(=)|(?<![,{])\\n',
endCaptures: {
1: {name: 'keyword.operator.$1.js'},
2: {name: 'punctuation.terminator.statement.js'},
3: {name: 'keyword.operator.assignment.js'}
},
patterns: [
{
captures: {
2: {name: 'keyword.operator.assignment.js'},
3: {name: 'constant.other.js'}
},
match:
'([$_a-zA-Z][$_a-zA-Z0-9]*)\\s*(:)\\s*([$_a-zA-Z][$_a-zA-Z0-9]*)?'
},
{
captures: {1: {name: 'constant.other.js'}},
match: '([$_a-zA-Z][$_a-zA-Z0-9]*)'
},
{match: '\\.\\.\\.', name: 'keyword.operator.spread.js'},
{match: ',', name: 'meta.delimiter.object.comma.js'},
{match: '\\(|\\)', name: 'meta.brace.round.js'},
{match: '{|}', name: 'meta.brace.curly.js'},
{match: '\\[|\\]', name: 'meta.brace.square.js'},
{include: '#comments'}
]
},
{
captures: {
1: {name: 'keyword.control.js'},
2: {name: 'storage.modifier.js'}
},
match: '(?<!\\.)\\b(yield)(?!\\s*:)\\b(?:\\s*(\\*))?',
name: 'meta.control.yield.js'
},
{
match: '(?:(?<=\\.{3})|(?<!\\.))\\b(await)(?!\\s*:)\\b',
name: 'keyword.control.js'
},
{
match:
'(?<!\\.)\\b(break|catch|continue|do|else|finally|for|if|import|package|return|throw|try|while|with)(?!\\s*:)\\b',
name: 'keyword.control.js'
},
{include: '#switch_statement'},
{
match: '(?<!\\.)\\b(delete|in|of|instanceof|new|typeof|void)(?!\\s*:)\\b',
name: 'keyword.operator.$1.js'
},
{match: '\\.\\.\\.', name: 'keyword.operator.spread.js'},
{
match: '(?<!\\.)\\b(true|false)(?!\\s*:)\\b',
name: 'constant.language.boolean.$1.js'
},
{match: '(?<!\\.)\\b(null)(?!\\s*:)\\b', name: 'constant.language.null.js'},
{
match: '(?<!\\.)\\b(debugger)(?!\\s*:)\\b',
name: 'keyword.other.debugger.js'
},
{
match:
'(?x) (?<!\\$) \\b\n(AggregateError|Array|ArrayBuffer|Atomics|Boolean|DataView|Date|Error|EvalError|Float32Array|Float64Array\n|Function|Generator|GeneratorFunction|Int16Array|Int32Array|Int8Array|InternalError|Intl|JSON|Map|Number\n|Object|Proxy|RangeError|ReferenceError|Reflect|RegExp|Set|SharedArrayBuffer|SIMD|String|Symbol|SyntaxError\n|TypeError|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|URIError|WeakMap|WeakSet)\n\\b',
name: 'support.class.js'
},
{
captures: {
1: {name: 'meta.delimiter.property.period.js'},
2: {name: 'support.variable.property.js'},
3: {name: 'support.constant.js'}
},
match:
'(?x) (\\.) \\s* (?:\n (constructor|length|prototype) |\n (EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\n)\\b'
},
{
captures: {
1: {name: 'support.variable.dom.js'},
2: {name: 'support.class.dom.js'}
},
match:
'(?x) (?<!\\$) \\b (?:\n (document|event|navigator|performance|screen|window|self|frames)\n |\n (AnalyserNode|ArrayBufferView|Attr|AudioBuffer|AudioBufferSourceNode|AudioContext|AudioDestinationNode|AudioListener\n |AudioNode|AudioParam|BatteryManager|BeforeUnloadEvent|BiquadFilterNode|Blob|BufferSource|ByteString|CSS|CSSConditionRule\n |CSSCounterStyleRule|CSSGroupingRule|CSSMatrix|CSSMediaRule|CSSPageRule|CSSPrimitiveValue|CSSRule|CSSRuleList|CSSStyleDeclaration\n |CSSStyleRule|CSSStyleSheet|CSSSupportsRule|CSSValue|CSSValueList|CanvasGradient|CanvasImageSource|CanvasPattern\n |CanvasRenderingContext2D|ChannelMergerNode|ChannelSplitterNode|CharacterData|ChromeWorker|CloseEvent|Comment|CompositionEvent\n |Console|ConvolverNode|Coordinates|Credential|CredentialsContainer|Crypto|CryptoKey|CustomEvent|DOMError|DOMException\n |DOMHighResTimeStamp|DOMImplementation|DOMString|DOMStringList|DOMStringMap|DOMTimeStamp|DOMTokenList|DataTransfer\n |DataTransferItem|DataTransferItemList|DedicatedWorkerGlobalScope|DelayNode|DeviceProximityEvent|DirectoryEntry\n |DirectoryEntrySync|DirectoryReader|DirectoryReaderSync|Document|DocumentFragment|DocumentTouch|DocumentType|DragEvent\n |DynamicsCompressorNode|Element|Entry|EntrySync|ErrorEvent|Event|EventListener|EventSource|EventTarget|FederatedCredential\n |FetchEvent|File|FileEntry|FileEntrySync|FileException|FileList|FileReader|FileReaderSync|FileSystem|FileSystemSync\n |FontFace|FormData|GainNode|Gamepad|GamepadButton|GamepadEvent|Geolocation|GlobalEventHandlers|HTMLAnchorElement\n |HTMLAreaElement|HTMLAudioElement|HTMLBRElement|HTMLBaseElement|HTMLBodyElement|HTMLButtonElement|HTMLCanvasElement\n |HTMLCollection|HTMLContentElement|HTMLDListElement|HTMLDataElement|HTMLDataListElement|HTMLDialogElement|HTMLDivElement\n |HTMLDocument|HTMLElement|HTMLEmbedElement|HTMLFieldSetElement|HTMLFontElement|HTMLFormControlsCollection|HTMLFormElement\n |HTMLHRElement|HTMLHeadElement|HTMLHeadingElement|HTMLHtmlElement|HTMLIFrameElement|HTMLImageElement|HTMLInputElement\n |HTMLKeygenElement|HTMLLIElement|HTMLLabelElement|HTMLLegendElement|HTMLLinkElement|HTMLMapElement|HTMLMediaElement\n |HTMLMetaElement|HTMLMeterElement|HTMLModElement|HTMLOListElement|HTMLObjectElement|HTMLOptGroupElement|HTMLOptionElement\n |HTMLOptionsCollection|HTMLOutputElement|HTMLParagraphElement|HTMLParamElement|HTMLPreElement|HTMLProgressElement\n |HTMLQuoteElement|HTMLScriptElement|HTMLSelectElement|HTMLShadowElement|HTMLSourceElement|HTMLSpanElement|HTMLStyleElement\n |HTMLTableCaptionElement|HTMLTableCellElement|HTMLTableColElement|HTMLTableDataCellElement|HTMLTableElement|HTMLTableHeaderCellElement\n |HTMLTableRowElement|HTMLTableSectionElement|HTMLTextAreaElement|HTMLTimeElement|HTMLTitleElement|HTMLTrackElement\n |HTMLUListElement|HTMLUnknownElement|HTMLVideoElement|HashChangeEvent|History|IDBCursor|IDBCursorWithValue|IDBDatabase\n |IDBEnvironment|IDBFactory|IDBIndex|IDBKeyRange|IDBMutableFile|IDBObjectStore|IDBOpenDBRequest|IDBRequest|IDBTransaction\n |IDBVersionChangeEvent|IIRFilterNode|IdentityManager|ImageBitmap|ImageBitmapFactories|ImageData|Index|InputDeviceCapabilities\n |InputEvent|InstallEvent|InstallTrigger|KeyboardEvent|LinkStyle|LocalFileSystem|LocalFileSystemSync|Location|MIDIAccess\n |MIDIConnectionEvent|MIDIInput|MIDIInputMap|MIDIOutputMap|MediaElementAudioSourceNode|MediaError|MediaKeyMessageEvent\n |MediaKeySession|MediaKeyStatusMap|MediaKeySystemAccess|MediaKeySystemConfiguration|MediaKeys|MediaRecorder|MediaStream\n |MediaStreamAudioDestinationNode|MediaStreamAudioSourceNode|MessageChannel|MessageEvent|MessagePort|MouseEvent\n |MutationObserver|MutationRecord|NamedNodeMap|Navigator|NavigatorConcurrentHardware|NavigatorGeolocation|NavigatorID\n |NavigatorLanguage|NavigatorOnLine|Node|NodeFilter|NodeIterator|NodeList|NonDocumentTypeChildNode|Notification\n |OfflineAudioCompletionEvent|OfflineAudioContext|OscillatorNode|PageTransitionEvent|PannerNode|ParentNode|PasswordCredential\n |Path2D|PaymentAddress|PaymentRequest|PaymentResponse|Performance|PerformanceEntry|PerformanceFrameTiming|PerformanceMark\n |PerformanceMeasure|PerformanceNavigation|PerformanceNavigationTiming|PerformanceObserver|PerformanceObserverEntryList\n |PerformanceResourceTiming|PerformanceTiming|PeriodicSyncEvent|PeriodicWave|Plugin|Point|PointerEvent|PopStateEvent\n |PortCollection|Position|PositionError|PositionOptions|PresentationConnectionClosedEvent|PresentationConnectionList\n |PresentationReceiver|ProcessingInstruction|ProgressEvent|PromiseRejectionEvent|PushEvent|PushRegistrationManager\n |RTCCertificate|RTCConfiguration|RTCPeerConnection|RTCSessionDescriptionCallback|RTCStatsReport|RadioNodeList|RandomSource\n |Range|ReadableByteStream|RenderingContext|SVGAElement|SVGAngle|SVGAnimateColorElement|SVGAnimateElement|SVGAnimateMotionElement\n |SVGAnimateTransformElement|SVGAnimatedAngle|SVGAnimatedBoolean|SVGAnimatedEnumeration|SVGAnimatedInteger|SVGAnimatedLength\n |SVGAnimatedLengthList|SVGAnimatedNumber|SVGAnimatedNumberList|SVGAnimatedPoints|SVGAnimatedPreserveAspectRatio\n |SVGAnimatedRect|SVGAnimatedString|SVGAnimatedTransformList|SVGAnimationElement|SVGCircleElement|SVGClipPathElement\n |SVGCursorElement|SVGDefsElement|SVGDescElement|SVGElement|SVGEllipseElement|SVGEvent|SVGFilterElement|SVGFontElement\n |SVGFontFaceElement|SVGFontFaceFormatElement|SVGFontFaceNameElement|SVGFontFaceSrcElement|SVGFontFaceUriElement\n |SVGForeignObjectElement|SVGGElement|SVGGlyphElement|SVGGradientElement|SVGHKernElement|SVGImageElement|SVGLength\n |SVGLengthList|SVGLineElement|SVGLinearGradientElement|SVGMPathElement|SVGMaskElement|SVGMatrix|SVGMissingGlyphElement\n |SVGNumber|SVGNumberList|SVGPathElement|SVGPatternElement|SVGPoint|SVGPolygonElement|SVGPolylineElement|SVGPreserveAspectRatio\n |SVGRadialGradientElement|SVGRect|SVGRectElement|SVGSVGElement|SVGScriptElement|SVGSetElement|SVGStopElement|SVGStringList\n |SVGStylable|SVGStyleElement|SVGSwitchElement|SVGSymbolElement|SVGTRefElement|SVGTSpanElement|SVGTests|SVGTextElement\n |SVGTextPositioningElement|SVGTitleElement|SVGTransform|SVGTransformList|SVGTransformable|SVGUseElement|SVGVKernElement\n |SVGViewElement|ServiceWorker|ServiceWorkerContainer|ServiceWorkerGlobalScope|ServiceWorkerRegistration|ServiceWorkerState\n |ShadowRoot|SharedWorker|SharedWorkerGlobalScope|SourceBufferList|StereoPannerNode|Storage|StorageEvent|StyleSheet\n |StyleSheetList|SubtleCrypto|SyncEvent|Text|TextMetrics|TimeEvent|TimeRanges|Touch|TouchEvent|TouchList|Transferable\n |TreeWalker|UIEvent|USVString|VRDisplayCapabilities|ValidityState|WaveShaperNode|WebGL|WebGLActiveInfo|WebGLBuffer\n |WebGLContextEvent|WebGLFramebuffer|WebGLProgram|WebGLRenderbuffer|WebGLRenderingContext|WebGLShader|WebGLShaderPrecisionFormat\n |WebGLTexture|WebGLTimerQueryEXT|WebGLTransformFeedback|WebGLUniformLocation|WebGLVertexArrayObject|WebGLVertexArrayObjectOES\n |WebSocket|WebSockets|WebVTT|WheelEvent|Window|WindowBase64|WindowEventHandlers|WindowTimers|Worker|WorkerGlobalScope\n |WorkerLocation|WorkerNavigator|XMLHttpRequest|XMLHttpRequestEventTarget|XMLSerializer|XPathExpression|XPathResult\n |XSLTProcessor)\n)\\b'
},
{
captures: {
1: {name: 'meta.delimiter.property.period.js'},
2: {name: 'support.constant.dom.js'},
3: {name: 'support.variable.property.dom.js'}
},
match:
'(?x) (\\.) \\s*\n(?:\n (ATTRIBUTE_NODE|CDATA_SECTION_NODE|COMMENT_NODE|DOCUMENT_FRAGMENT_NODE|DOCUMENT_NODE|DOCUMENT_TYPE_NODE\n |DOMSTRING_SIZE_ERR|ELEMENT_NODE|ENTITY_NODE|ENTITY_REFERENCE_NODE|HIERARCHY_REQUEST_ERR|INDEX_SIZE_ERR\n |INUSE_ATTRIBUTE_ERR|INVALID_CHARACTER_ERR|NO_DATA_ALLOWED_ERR|NO_MODIFICATION_ALLOWED_ERR|NOT_FOUND_ERR\n |NOT_SUPPORTED_ERR|NOTATION_NODE|PROCESSING_INSTRUCTION_NODE|TEXT_NODE|WRONG_DOCUMENT_ERR)\n |\n (_content|[xyz]|abbr|above|accept|acceptCharset|accessKey|action|align|[av]Link(?:color)?|all|alt|anchors|appCodeName\n |appCore|applets|appMinorVersion|appName|appVersion|archive|areas|arguments|attributes|availHeight|availLeft|availTop\n |availWidth|axis|background|backgroundColor|backgroundImage|below|bgColor|body|border|borderBottomWidth|borderColor\n |borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|borderWidth|bottom|bufferDepth|callee|caller|caption\n |cellPadding|cells|cellSpacing|ch|characterSet|charset|checked|childNodes|chOff|cite|classes|className|clear\n |clientInformation|clip|clipBoardData|closed|code|codeBase|codeType|color|colorDepth|cols|colSpan|compact|complete\n |components|content|controllers|cookie|cookieEnabled|cords|cpuClass|crypto|current|data|dateTime|declare|defaultCharset\n |defaultChecked|defaultSelected|defaultStatus|defaultValue|defaultView|defer|description|dialogArguments|dialogHeight\n |dialogLeft|dialogTop|dialogWidth|dir|directories|disabled|display|docmain|doctype|documentElement|elements|embeds\n |enabledPlugin|encoding|enctype|entities|event|expando|external|face|fgColor|filename|firstChild|fontFamily|fontSize\n |fontWeight|form|formName|forms|frame|frameBorder|frameElement|frames|hasFocus|hash|headers|height|history|host\n |hostname|href|hreflang|hspace|htmlFor|httpEquiv|id|ids|ignoreCase|images|implementation|index|innerHeight|innerWidth\n |input|isMap|label|lang|language|lastChild|lastIndex|lastMatch|lastModified|lastParen|layer[sXY]|left|leftContext\n |lineHeight|link|linkColor|links|listStyleType|localName|location|locationbar|longDesc|lowsrc|lowSrc|marginBottom\n |marginHeight|marginLeft|marginRight|marginTop|marginWidth|maxLength|media|menubar|method|mimeTypes|multiline|multiple\n |name|nameProp|namespaces|namespaceURI|next|nextSibling|nodeName|nodeType|nodeValue|noHref|noResize|noShade|notationName\n |notations|noWrap|object|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|options|oscpu|outerHeight\n |outerWidth|ownerDocument|paddingBottom|paddingLeft|paddingRight|paddingTop|page[XY]|page[XY]Offset|parent|parentLayer\n |parentNode|parentWindow|pathname|personalbar|pixelDepth|pkcs11|platform|plugins|port|prefix|previous|previousDibling\n |product|productSub|profile|profileend|prompt|prompter|protocol|publicId|readOnly|readyState|referrer|rel|responseText\n |responseXML|rev|right|rightContext|rowIndex|rows|rowSpan|rules|scheme|scope|screen[XY]|screenLeft|screenTop|scripts\n |scrollbars|scrolling|sectionRowIndex|security|securityPolicy|selected|selectedIndex|selection|self|shape|siblingAbove\n |siblingBelow|size|source|specified|standby|start|status|statusbar|statusText|style|styleSheets|suffixes|summary\n |systemId|systemLanguage|tagName|tags|target|tBodies|text|textAlign|textDecoration|textIndent|textTransform|tFoot|tHead\n |title|toolbar|top|type|undefined|uniqueID|updateInterval|URL|URLUnencoded|useMap|userAgent|userLanguage|userProfile\n |vAlign|value|valueType|vendor|vendorSub|version|visibility|vspace|whiteSpace|width|X[MS]LDocument|zIndex)\n)\n\\b'
},
{
match:
'(?<!\\.)\\b(module|exports|__filename|__dirname|global|globalThis|process)(?!\\s*:)\\b',
name: 'support.variable.js'
},
{match: '\\b(Infinity|NaN|undefined)\\b', name: 'constant.language.js'},
{
begin:
'(?<=[\\[{=(?:+*,!~-]|^|return|=>|&&|\\|\\|)\\s*(/)(?![/*+?])(?=.*/)',
beginCaptures: {1: {name: 'punctuation.definition.string.begin.js'}},
end: '(/)([gimsuy]*)',
endCaptures: {
1: {name: 'punctuation.definition.string.end.js'},
2: {name: 'meta.flag.regexp'}
},
name: 'string.regexp.js',
patterns: [{include: 'source.js.regexp'}]
},
{
begin: '\\?',
beginCaptures: {0: {name: 'keyword.operator.ternary.js'}},
end: ':',
endCaptures: {0: {name: 'keyword.operator.ternary.js'}},
patterns: [{include: '#prevent_object_keys_matching'}, {include: '$self'}]
},
{include: '#operators'},
{include: '#method_calls'},
{include: '#function_calls'},
{include: '#numbers'},
{include: '#objects'},
{include: '#properties'},
{
match:
'((?<!\\.|[\\w$])(?![_\\$]+[^A-Z0-9_$])\\$*\\b(?:[A-Z_$][A-Z0-9_$]*)\\b\\$*)',
name: 'constant.other.js'
},
{match: '(?<!\\$)\\b[0-9]+[\\w$]*', name: 'invalid.illegal.identifier.js'},
{match: '\\;', name: 'punctuation.terminator.statement.js'},
{match: ',', name: 'meta.delimiter.object.comma.js'},
{match: '\\.', name: 'meta.delimiter.method.period.js'},
{
captures: {
1: {name: 'punctuation.section.scope.begin.js'},
2: {name: 'punctuation.section.scope.end.js'}
},
match: '({)(})'
},
{
begin: '{',
beginCaptures: {0: {name: 'meta.brace.curly.js'}},
end: '}',
endCaptures: {0: {name: 'meta.brace.curly.js'}},
patterns: [{include: '$self'}]
},
{
begin: '\\(',
beginCaptures: {0: {name: 'meta.brace.round.js'}},
end: '\\)',
endCaptures: {0: {name: 'meta.brace.round.js'}},
patterns: [{include: '$self'}]
},
{match: '\\[|\\]', name: 'meta.brace.square.js'},
{match: '\\A#!.*$', name: 'comment.line.shebang.js'}
],
repository: {
arguments: {
patterns: [
{
begin: '\\(',
beginCaptures: {
0: {name: 'punctuation.definition.arguments.begin.bracket.round.js'}
},
end: '\\)',
endCaptures: {
0: {name: 'punctuation.definition.arguments.end.bracket.round.js'}
},
name: 'meta.arguments.js',
patterns: [{include: '$self'}]
}
]
},
arrow_function_innards: {
patterns: [
{match: '=>', name: 'storage.type.function.arrow.js'},
{include: '#function_params'},
{
captures: {
0: {name: 'meta.parameters.js'},
1: {name: 'variable.parameter.function.js'}
},
match: '([a-zA-Z_$][\\w$]*)(?=\\s*=>)'
},
{
captures: {
0: {name: 'meta.parameters.js'},
1: {name: 'invalid.illegal.identifier.js'}
},
match: '(\\d[\\w$]*)'
}
]
},
comments: {
patterns: [
{
captures: {
1: {name: 'punctuation.definition.comment.begin.js'},
2: {name: 'punctuation.definition.comment.end.js'}
},
match: '(/\\*)(\\*/)',
name: 'comment.block.empty.js'
},
{
begin: '/\\*\\*',
beginCaptures: {0: {name: 'punctuation.definition.comment.begin.js'}},
end: '\\*/',
endCaptures: {0: {name: 'punctuation.definition.comment.end.js'}},
name: 'comment.block.documentation.js',
patterns: [{include: 'source.jsdoc'}]
},
{
begin: '/\\*',
beginCaptures: {0: {name: 'punctuation.definition.comment.begin.js'}},
end: '\\*/',
endCaptures: {0: {name: 'punctuation.definition.comment.end.js'}},
name: 'comment.block.js'
},
{
begin: '//',
beginCaptures: {0: {name: 'punctuation.definition.comment.js'}},
end: '$',
name: 'comment.line.double-slash.js'
}
]
},
function_body: {
patterns: [
{
begin: '{',
beginCaptures: {
0: {
name: 'punctuation.definition.function.body.begin.bracket.curly.js'
}
},
end: '}',
endCaptures: {
0: {
name: 'punctuation.definition.function.body.end.bracket.curly.js'
}
},
patterns: [{include: '$self'}]
}
]
},
function_calls: {
patterns: [
{
begin: '([\\w$]+)\\s*(?=\\()',
beginCaptures: {
1: {
patterns: [
{
match:
'(?x)\n\\b(isNaN|isFinite|eval|uneval|parseInt|parseFloat|decodeURI|\ndecodeURIComponent|encodeURI|encodeURIComponent|escape|unescape|\nrequire|set(Interval|Timeout)|clear(Interval|Timeout))\\b',
name: 'support.function.js'
},
{match: '[a-zA-Z_$][\\w$]*', name: 'entity.name.function.js'},
{match: '\\d[\\w$]*', name: 'invalid.illegal.identifier.js'}
]
}
},
end: '(?<=\\))',
name: 'meta.function-call.js',
patterns: [{include: '#arguments'}]
}
]
},
function_innards: {
patterns: [
{
captures: {
1: {name: 'storage.modifier.async.js'},
2: {name: 'storage.type.function.js'},
3: {name: 'storage.modifier.generator.js'}
},
match: '(?:\\b(async)\\b\\s*)?\\b(function)\\b(?:\\s*(\\*))?'
},
{
match: '[a-zA-Z_$][\\w$]*(?=\\s*\\()',
name: 'entity.name.function.js'
},
{include: '#function_params'},
{include: '#comments'}
]
},
function_params: {
patterns: [
{
begin: '\\(',
beginCaptures: {
0: {
name: 'punctuation.definition.parameters.begin.bracket.round.js'
}
},
end: '\\)',
endCaptures: {
0: {name: 'punctuation.definition.parameters.end.bracket.round.js'}
},
name: 'meta.parameters.js',
patterns: [
{
captures: {
1: {name: 'keyword.operator.spread.js'},
2: {name: 'variable.parameter.rest.function.js'}
},
match: '(\\.\\.\\.)([a-zA-Z_$][\\w$]*)'
},
{include: '$self'},
{match: '[a-zA-Z_$][\\w$]*', name: 'variable.parameter.function.js'}
]
}
]
},
interpolated_js: {
patterns: [
{
begin: '\\${',
captures: {0: {name: 'punctuation.section.embedded.js'}},
end: '}',
name: 'source.js.embedded.source',
patterns: [
{
begin: '{',
beginCaptures: {0: {name: 'meta.brace.curly.js'}},
end: '}',
endCaptures: {0: {name: 'meta.brace.curly.js'}},
patterns: [{include: '$self'}]
},
{include: '$self'}
]
}
]
},
method_calls: {
patterns: [
{
begin: '(\\.)\\s*([\\w$]+)\\s*(?=\\()',
beginCaptures: {
1: {name: 'meta.delimiter.method.period.js'},
2: {
patterns: [
{
match:
'(?x)\n\\bon(Rowsinserted|Rowsdelete|Rowenter|Rowexit|Resize|Resizestart|Resizeend|Reset|\nReadystatechange|Mouseout|Mouseover|Mousedown|Mouseup|Mousemove|\nBefore(cut|deactivate|unload|update|paste|print|editfocus|activate)|\nBlur|Scrolltop|Submit|Select|Selectstart|Selectionchange|Hover|Help|\nChange|Contextmenu|Controlselect|Cut|Cellchange|Clock|Close|Deactivate|\nDatasetchanged|Datasetcomplete|Dataavailable|Drop|Drag|Dragstart|Dragover|\nDragdrop|Dragenter|Dragend|Dragleave|Dblclick|Unload|Paste|Propertychange|Error|\nErrorupdate|Keydown|Keyup|Keypress|Focus|Load|Activate|Afterupdate|Afterprint|Abort)\\b',
name: 'support.function.event-handler.js'
},
{
match:
'(?x)\n\\b(catch|finally|then|shift|showModelessDialog|showModalDialog|showHelp|scroll|scrollX|scrollByPages|\nscrollByLines|scrollY|scrollTo|stop|strike|sizeToContent|sidebar|signText|sort|\nsup|sub|substr|substring|splice|split|send|set(Milliseconds|Seconds|Minutes|Hours|\nMonth|Year|FullYear|Date|UTC(Milliseconds|Seconds|Minutes|Hours|Month|FullYear|Date)|\nTime|Hotkeys|Cursor|ZOptions|Active|Resizable|RequestHeader)|search|slice|\nsavePreferences|small|home|handleEvent|navigate|char|charCodeAt|charAt|concat|\ncontextual|confirm|compile|clear|captureEvents|call|createStyleSheet|createPopup|\ncreateEventObject|to(GMTString|UTCString|String|Source|UpperCase|LowerCase|LocaleString)|\ntest|taint|taintEnabled|indexOf|italics|disableExternalCapture|dump|detachEvent|unshift|\nuntaint|unwatch|updateCommands|join|javaEnabled|pop|push|plugins.refresh|paddings|parse|stringify|\nprint|prompt|preference|enableExternalCapture|exec|execScript|valueOf|UTC|find|file|\nfileModifiedDate|fileSize|fileCreatedDate|fileUpdatedDate|fixed|fontsize|fontcolor|\nforward|fromCharCode|watch|link|load|lastIndexOf|anchor|attachEvent|atob|apply|alert|\nabort|routeEvents|resize|resizeBy|resizeTo|recalc|returnValue|replace|reverse|reload|\nreleaseCapture|releaseEvents|go|get(Milliseconds|Seconds|Minutes|Hours|Month|Day|Year|FullYear|\nTime|Date|TimezoneOffset|UTC(Milliseconds|Seconds|Minutes|Hours|Day|Month|FullYear|Date)|\nAttention|Selection|ResponseHeader|AllResponseHeaders)|moveBy|moveBelow|moveTo|\nmoveToAbsolute|moveAbove|mergeAttributes|match|margins|btoa|big|bold|borderWidths|blink|back)\\b',
name: 'support.function.js'
},
{
match:
'(?x)\n\\b(acceptNode|add|addEventListener|addTextTrack|adoptNode|after|animate|append|\nappendChild|appendData|before|blur|canPlayType|captureStream|\ncaretPositionFromPoint|caretRangeFromPoint|checkValidity|clear|click|\ncloneContents|cloneNode|cloneRange|close|closest|collapse|\ncompareBoundaryPoints|compareDocumentPosition|comparePoint|contains|\nconvertPointFromNode|convertQuadFromNode|convertRectFromNode|createAttribute|\ncreateAttributeNS|createCaption|createCDATASection|createComment|\ncreateContextualFragment|createDocument|createDocumentFragment|\ncreateDocumentType|createElement|createElementNS|createEntityReference|\ncreateEvent|createExpression|createHTMLDocument|createNodeIterator|\ncreateNSResolver|createProcessingInstruction|createRange|createShadowRoot|\ncreateTBody|createTextNode|createTFoot|createTHead|createTreeWalker|delete|\ndeleteCaption|deleteCell|deleteContents|deleteData|deleteRow|deleteTFoot|\ndeleteTHead|detach|disconnect|dispatchEvent|elementFromPoint|elementsFromPoint|\nenableStyleSheetsForSet|entries|evaluate|execCommand|exitFullscreen|\nexitPointerLock|expand|extractContents|fastSeek|firstChild|focus|forEach|get|\ngetAll|getAnimations|getAttribute|getAttributeNames|getAttributeNode|\ngetAttributeNodeNS|getAttributeNS|getBoundingClientRect|getBoxQuads|\ngetClientRects|getContext|getDestinationInsertionPoints|getElementById|\ngetElementsByClassName|getElementsByName|getElementsByTagName|\ngetElementsByTagNameNS|getItem|getNamedItem|getSelection|getStartDate|\ngetVideoPlaybackQuality|has|hasAttribute|hasAttributeNS|hasAttributes|\nhasChildNodes|hasFeature|hasFocus|importNode|initEvent|insertAdjacentElement|\ninsertAdjacentHTML|insertAdjacentText|insertBefore|insertCell|insertData|\ninsertNode|insertRow|intersectsNode|isDefaultNamespace|isEqualNode|\nisPointInRange|isSameNode|item|key|keys|lastChild|load|lookupNamespaceURI|\nlookupPrefix|matches|move|moveAttribute|moveAttributeNode|moveChild|\nmoveNamedItem|namedItem|nextNode|nextSibling|normalize|observe|open|\nparentNode|pause|play|postMessage|prepend|preventDefault|previousNode|\npreviousSibling|probablySupportsContext|queryCommandEnabled|\nqueryCommandIndeterm|queryCommandState|queryCommandSupported|queryCommandValue|\nquerySelector|querySelectorAll|registerContentHandler|registerElement|\nregisterProtocolHandler|releaseCapture|releaseEvents|remove|removeAttribute|\nremoveAttributeNode|removeAttributeNS|removeChild|removeEventListener|\nremoveItem|replace|replaceChild|replaceData|replaceWith|reportValidity|\nrequestFullscreen|requestPointerLock|reset|scroll|scrollBy|scrollIntoView|\nscrollTo|seekToNextFrame|select|selectNode|selectNodeContents|set|setAttribute|\nsetAttributeNode|setAttributeNodeNS|setAttributeNS|setCapture|\nsetCustomValidity|setEnd|setEndAfter|setEndBefore|setItem|setNamedItem|\nsetRangeText|setSelectionRange|setSinkId|setStart|setStartAfter|setStartBefore|\nslice|splitText|stepDown|stepUp|stopImmediatePropagation|stopPropagation|\nsubmit|substringData|supports|surroundContents|takeRecords|terminate|toBlob|\ntoDataURL|toggle|toString|values|write|writeln)\\b',
name: 'support.function.dom.js'
},
{match: '[a-zA-Z_$][\\w$]*', name: 'entity.name.function.js'},
{match: '\\d[\\w$]*', name: 'invalid.illegal.identifier.js'}
]
}
},
end: '(?<=\\))',
name: 'meta.method-call.js',
patterns: [{include: '#arguments'}]
}
]
},
numbers: {
patterns: [
{
captures: {0: {patterns: [{include: '#numeric_separators'}]}},
match: '\\b(?<!\\$)0(x|X)[0-9a-fA-F]+(?:_[0-9a-fA-F]+)*n?\\b(?!\\$)',
name: 'constant.numeric.hex.js'
},
{
captures: {0: {patterns: [{include: '#numeric_separators'}]}},
match: '\\b(?<!\\$)0(b|B)[01]+(?:_[01]+)*n?\\b(?!\\$)',
name: 'constant.numeric.binary.js'
},
{
captures: {0: {patterns: [{include: '#numeric_separators'}]}},
match: '\\b(?<!\\$)0(o|O)?[0-7]+(?:_[0-7]+)*n?\\b(?!\\$)',
name: 'constant.numeric.octal.js'
},
{
captures: {0: {patterns: [{include: '#numeric_separators'}]}},
match:
'(?x)\n(?<!\\$)(?:\n (?:\\b[0-9]+(?:_[0-9]+)*\\.[0-9]+(?:_[0-9]+)*[eE][+-]?[0-9]+(?:_[0-9]+)*\\b)| # 1.1E+3\n (?:\\b[0-9]+(?:_[0-9]+)*\\.[eE][+-]?[0-9]+(?:_[0-9]+)*\\b)| # 1.E+3\n (?:\\B\\.[0-9]+(?:_[0-9]+)*[eE][+-]?[0-9]+(?:_[0-9]+)*\\b)| # .1E+3\n (?:\\b[0-9]+(?:_[0-9]+)*[eE][+-]?[0-9]+(?:_[0-9]+)*\\b)| # 1E+3\n (?:\\b[0-9]+(?:_[0-9]+)*\\.[0-9]+(?:_[0-9]+)*\\b)| # 1.1\n (?:\\b[0-9]+(?:_[0-9]+)*\\.\\B)| # 1.\n (?:\\B\\.[0-9]+(?:_[0-9]+)*\\b)| # .1\n (?:\\b[0-9]+(?:_[0-9]+)*n?\\b(?!\\.)) # 1n\n)(?!\\$)',
name: 'constant.numeric.decimal.js'
}
]
},
numeric_separators: {
patterns: [
{
captures: {
1: {name: 'meta.delimiter.numeric.separator.js'},
2: {name: 'meta.delimiter.decimal.period.js'}
},
match: '(_)|(\\.)'
}
]
},
objects: {
patterns: [
{
match: '[A-Z][A-Z0-9_$]*(?=\\s*\\.\\s*[a-zA-Z_$]\\w*)',
name: 'constant.other.object.js'
},
{
match: '[a-zA-Z_$][\\w$]*(?=\\s*\\.\\s*[a-zA-Z_$]\\w*)',
name: 'variable.other.object.js'
}
]
},
operators: {
patterns: [
{
match: '%=|\\+=|-=|\\*=|(?<!\\()/=',
name: 'keyword.operator.assignment.compound.js'
},
{
match: '&=|\\^=|<<=|>>=|>>>=|\\|=',
name: 'keyword.operator.assignment.compound.bitwise.js'
},
{match: '<<|>>>|>>', name: 'keyword.operator.bitwise.shift.js'},
{
match: '!==|!=|<=|>=|===|==|<|>',
name: 'keyword.operator.comparison.js'
},
{match: '&&|!!|!|\\|\\|', name: 'keyword.operator.logical.js'},
{match: '&|\\||\\^|~', name: 'keyword.operator.bitwise.js'},
{match: '=|:', name: 'keyword.operator.assignment.js'},
{match: '--', name: 'keyword.operator.decrement.js'},
{match: '\\+\\+', name: 'keyword.operator.increment.js'},
{match: '%|\\*|/|-|\\+', name: 'keyword.operator.js'}
]
},
prevent_object_keys_matching: {
patterns: [
{
captures: {1: {patterns: [{include: '$self'}]}},
match: '(\\w+)(?=\\s*:)'
}
]
},
properties: {
patterns: [
{
captures: {
1: {name: 'meta.delimiter.property.period.js'},