tm-grammars 1.8.1 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1393 @@
1
+ {
2
+ "displayName": "TypeSpec",
3
+ "fileTypes": [
4
+ "tsp"
5
+ ],
6
+ "name": "typespec",
7
+ "patterns": [
8
+ {
9
+ "include": "#statement"
10
+ }
11
+ ],
12
+ "repository": {
13
+ "alias-statement": {
14
+ "begin": "\\b(alias)\\b",
15
+ "beginCaptures": {
16
+ "1": {
17
+ "name": "keyword.other.tsp"
18
+ }
19
+ },
20
+ "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
21
+ "name": "meta.alias-statement.typespec",
22
+ "patterns": [
23
+ {
24
+ "include": "#type-parameters"
25
+ },
26
+ {
27
+ "include": "#operator-assignment"
28
+ },
29
+ {
30
+ "include": "#expression"
31
+ }
32
+ ]
33
+ },
34
+ "augment-decorator-statement": {
35
+ "begin": "((@@)\\b[_$[:alpha:]]([_$[:alnum:]]|\\.[_$[:alpha:]])*\\b)",
36
+ "beginCaptures": {
37
+ "1": {
38
+ "name": "entity.name.tag.tsp"
39
+ },
40
+ "2": {
41
+ "name": "entity.name.tag.tsp"
42
+ }
43
+ },
44
+ "end": "(?=[_$[:alpha:]])|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
45
+ "name": "meta.augment-decorator-statement.typespec",
46
+ "patterns": [
47
+ {
48
+ "include": "#token"
49
+ },
50
+ {
51
+ "include": "#parenthesized-expression"
52
+ }
53
+ ]
54
+ },
55
+ "block-comment": {
56
+ "begin": "/\\*",
57
+ "end": "\\*/",
58
+ "name": "comment.block.tsp"
59
+ },
60
+ "boolean-literal": {
61
+ "match": "\\b(true|false)\\b",
62
+ "name": "constant.language.tsp"
63
+ },
64
+ "decorator": {
65
+ "begin": "((@)\\b[_$[:alpha:]]([_$[:alnum:]]|\\.[_$[:alpha:]])*\\b)",
66
+ "beginCaptures": {
67
+ "1": {
68
+ "name": "entity.name.tag.tsp"
69
+ },
70
+ "2": {
71
+ "name": "entity.name.tag.tsp"
72
+ }
73
+ },
74
+ "end": "(?=[_$[:alpha:]])|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
75
+ "name": "meta.decorator.typespec",
76
+ "patterns": [
77
+ {
78
+ "include": "#token"
79
+ },
80
+ {
81
+ "include": "#parenthesized-expression"
82
+ }
83
+ ]
84
+ },
85
+ "decorator-declaration-statement": {
86
+ "begin": "(?:(extern)\\s+)?\\b(dec)\\b\\s+(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)",
87
+ "beginCaptures": {
88
+ "1": {
89
+ "name": "keyword.other.tsp"
90
+ },
91
+ "2": {
92
+ "name": "keyword.other.tsp"
93
+ },
94
+ "3": {
95
+ "name": "entity.name.function.tsp"
96
+ }
97
+ },
98
+ "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
99
+ "name": "meta.decorator-declaration-statement.typespec",
100
+ "patterns": [
101
+ {
102
+ "include": "#token"
103
+ },
104
+ {
105
+ "include": "#operation-parameters"
106
+ }
107
+ ]
108
+ },
109
+ "directive": {
110
+ "begin": "\\s*(#\\b[_$[:alpha:]][_$[:alnum:]]*\\b)",
111
+ "beginCaptures": {
112
+ "1": {
113
+ "name": "keyword.directive.name.tsp"
114
+ }
115
+ },
116
+ "end": "$|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
117
+ "name": "meta.directive.typespec",
118
+ "patterns": [
119
+ {
120
+ "include": "#string-literal"
121
+ },
122
+ {
123
+ "include": "#identifier-expression"
124
+ }
125
+ ]
126
+ },
127
+ "doc-comment": {
128
+ "begin": "/\\*\\*",
129
+ "beginCaptures": {
130
+ "0": {
131
+ "name": "comment.block.tsp"
132
+ }
133
+ },
134
+ "end": "\\*/",
135
+ "endCaptures": {
136
+ "0": {
137
+ "name": "comment.block.tsp"
138
+ }
139
+ },
140
+ "name": "comment.block.tsp",
141
+ "patterns": [
142
+ {
143
+ "include": "#doc-comment-block"
144
+ }
145
+ ]
146
+ },
147
+ "doc-comment-block": {
148
+ "patterns": [
149
+ {
150
+ "include": "#doc-comment-param"
151
+ },
152
+ {
153
+ "include": "#doc-comment-return-tag"
154
+ },
155
+ {
156
+ "include": "#doc-comment-unknown-tag"
157
+ }
158
+ ]
159
+ },
160
+ "doc-comment-param": {
161
+ "captures": {
162
+ "1": {
163
+ "name": "keyword.tag.tspdoc"
164
+ },
165
+ "2": {
166
+ "name": "keyword.tag.tspdoc"
167
+ },
168
+ "3": {
169
+ "name": "variable.name.tsp"
170
+ }
171
+ },
172
+ "match": "(?x)((@)(?:param|template))\\s+(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)\\b",
173
+ "name": "comment.block.tsp"
174
+ },
175
+ "doc-comment-return-tag": {
176
+ "captures": {
177
+ "1": {
178
+ "name": "keyword.tag.tspdoc"
179
+ },
180
+ "2": {
181
+ "name": "keyword.tag.tspdoc"
182
+ }
183
+ },
184
+ "match": "(?x)((@)(?:returns))\\b",
185
+ "name": "comment.block.tsp"
186
+ },
187
+ "doc-comment-unknown-tag": {
188
+ "captures": {
189
+ "1": {
190
+ "name": "entity.name.tag.tsp"
191
+ },
192
+ "2": {
193
+ "name": "entity.name.tag.tsp"
194
+ }
195
+ },
196
+ "match": "(?x)((@)(?:\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`))\\b",
197
+ "name": "comment.block.tsp"
198
+ },
199
+ "else-expression": {
200
+ "begin": "\\b(else)\\b",
201
+ "beginCaptures": {
202
+ "1": {
203
+ "name": "keyword.other.tsp"
204
+ }
205
+ },
206
+ "end": "((?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b))",
207
+ "name": "meta.else-expression.typespec",
208
+ "patterns": [
209
+ {
210
+ "include": "#projection-expression"
211
+ },
212
+ {
213
+ "include": "#projection-body"
214
+ }
215
+ ]
216
+ },
217
+ "else-if-expression": {
218
+ "begin": "\\b(else)\\s+(if)\\b",
219
+ "beginCaptures": {
220
+ "1": {
221
+ "name": "keyword.other.tsp"
222
+ },
223
+ "2": {
224
+ "name": "keyword.other.tsp"
225
+ }
226
+ },
227
+ "end": "((?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b))",
228
+ "name": "meta.else-if-expression.typespec",
229
+ "patterns": [
230
+ {
231
+ "include": "#projection-expression"
232
+ },
233
+ {
234
+ "include": "#projection-body"
235
+ }
236
+ ]
237
+ },
238
+ "enum-body": {
239
+ "begin": "\\{",
240
+ "beginCaptures": {
241
+ "0": {
242
+ "name": "punctuation.curlybrace.open.tsp"
243
+ }
244
+ },
245
+ "end": "\\}",
246
+ "endCaptures": {
247
+ "0": {
248
+ "name": "punctuation.curlybrace.close.tsp"
249
+ }
250
+ },
251
+ "name": "meta.enum-body.typespec",
252
+ "patterns": [
253
+ {
254
+ "include": "#enum-member"
255
+ },
256
+ {
257
+ "include": "#token"
258
+ },
259
+ {
260
+ "include": "#directive"
261
+ },
262
+ {
263
+ "include": "#decorator"
264
+ },
265
+ {
266
+ "include": "#punctuation-comma"
267
+ }
268
+ ]
269
+ },
270
+ "enum-member": {
271
+ "begin": "(?:(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)\\s*(:?))",
272
+ "beginCaptures": {
273
+ "1": {
274
+ "name": "variable.name.tsp"
275
+ },
276
+ "2": {
277
+ "name": "keyword.operator.type.annotation.tsp"
278
+ }
279
+ },
280
+ "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
281
+ "name": "meta.enum-member.typespec",
282
+ "patterns": [
283
+ {
284
+ "include": "#token"
285
+ },
286
+ {
287
+ "include": "#type-annotation"
288
+ }
289
+ ]
290
+ },
291
+ "enum-statement": {
292
+ "begin": "\\b(enum)\\b\\s+(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)",
293
+ "beginCaptures": {
294
+ "1": {
295
+ "name": "keyword.other.tsp"
296
+ },
297
+ "2": {
298
+ "name": "entity.name.type.tsp"
299
+ }
300
+ },
301
+ "end": "(?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
302
+ "name": "meta.enum-statement.typespec",
303
+ "patterns": [
304
+ {
305
+ "include": "#token"
306
+ },
307
+ {
308
+ "include": "#enum-body"
309
+ }
310
+ ]
311
+ },
312
+ "escape-character": {
313
+ "match": "\\\\.",
314
+ "name": "constant.character.escape.tsp"
315
+ },
316
+ "expression": {
317
+ "patterns": [
318
+ {
319
+ "include": "#token"
320
+ },
321
+ {
322
+ "include": "#directive"
323
+ },
324
+ {
325
+ "include": "#parenthesized-expression"
326
+ },
327
+ {
328
+ "include": "#valueof"
329
+ },
330
+ {
331
+ "include": "#type-arguments"
332
+ },
333
+ {
334
+ "include": "#tuple-expression"
335
+ },
336
+ {
337
+ "include": "#model-expression"
338
+ },
339
+ {
340
+ "include": "#identifier-expression"
341
+ }
342
+ ]
343
+ },
344
+ "function-call": {
345
+ "begin": "(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)\\s*(\\()",
346
+ "beginCaptures": {
347
+ "1": {
348
+ "name": "entity.name.function.tsp"
349
+ },
350
+ "2": {
351
+ "name": "punctuation.parenthesis.open.tsp"
352
+ }
353
+ },
354
+ "end": "\\)",
355
+ "endCaptures": {
356
+ "0": {
357
+ "name": "punctuation.parenthesis.close.tsp"
358
+ }
359
+ },
360
+ "name": "meta.function-call.typespec",
361
+ "patterns": [
362
+ {
363
+ "include": "#expression"
364
+ }
365
+ ]
366
+ },
367
+ "function-declaration-statement": {
368
+ "begin": "(?:(extern)\\s+)?\\b(fn)\\b\\s+(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)",
369
+ "beginCaptures": {
370
+ "1": {
371
+ "name": "keyword.other.tsp"
372
+ },
373
+ "2": {
374
+ "name": "keyword.other.tsp"
375
+ },
376
+ "3": {
377
+ "name": "entity.name.function.tsp"
378
+ }
379
+ },
380
+ "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
381
+ "name": "meta.function-declaration-statement.typespec",
382
+ "patterns": [
383
+ {
384
+ "include": "#token"
385
+ },
386
+ {
387
+ "include": "#operation-parameters"
388
+ },
389
+ {
390
+ "include": "#type-annotation"
391
+ }
392
+ ]
393
+ },
394
+ "identifier-expression": {
395
+ "match": "\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`",
396
+ "name": "entity.name.type.tsp"
397
+ },
398
+ "if-expression": {
399
+ "begin": "\\b(if)\\b",
400
+ "beginCaptures": {
401
+ "1": {
402
+ "name": "keyword.other.tsp"
403
+ }
404
+ },
405
+ "end": "((?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b))",
406
+ "name": "meta.if-expression.typespec",
407
+ "patterns": [
408
+ {
409
+ "include": "#projection-expression"
410
+ },
411
+ {
412
+ "include": "#projection-body"
413
+ }
414
+ ]
415
+ },
416
+ "import-statement": {
417
+ "begin": "\\b(import)\\b",
418
+ "beginCaptures": {
419
+ "1": {
420
+ "name": "keyword.other.tsp"
421
+ }
422
+ },
423
+ "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
424
+ "name": "meta.import-statement.typespec",
425
+ "patterns": [
426
+ {
427
+ "include": "#token"
428
+ }
429
+ ]
430
+ },
431
+ "interface-body": {
432
+ "begin": "\\{",
433
+ "beginCaptures": {
434
+ "0": {
435
+ "name": "punctuation.curlybrace.open.tsp"
436
+ }
437
+ },
438
+ "end": "\\}",
439
+ "endCaptures": {
440
+ "0": {
441
+ "name": "punctuation.curlybrace.close.tsp"
442
+ }
443
+ },
444
+ "name": "meta.interface-body.typespec",
445
+ "patterns": [
446
+ {
447
+ "include": "#token"
448
+ },
449
+ {
450
+ "include": "#directive"
451
+ },
452
+ {
453
+ "include": "#decorator"
454
+ },
455
+ {
456
+ "include": "#interface-member"
457
+ },
458
+ {
459
+ "include": "#punctuation-semicolon"
460
+ }
461
+ ]
462
+ },
463
+ "interface-heritage": {
464
+ "begin": "\\b(extends)\\b",
465
+ "beginCaptures": {
466
+ "1": {
467
+ "name": "keyword.other.tsp"
468
+ }
469
+ },
470
+ "end": "((?=\\{)|(?=;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b))",
471
+ "name": "meta.interface-heritage.typespec",
472
+ "patterns": [
473
+ {
474
+ "include": "#expression"
475
+ },
476
+ {
477
+ "include": "#punctuation-comma"
478
+ }
479
+ ]
480
+ },
481
+ "interface-member": {
482
+ "begin": "(?:\\b(op)\\b\\s+)?(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)",
483
+ "beginCaptures": {
484
+ "1": {
485
+ "name": "keyword.other.tsp"
486
+ },
487
+ "2": {
488
+ "name": "entity.name.function.tsp"
489
+ }
490
+ },
491
+ "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
492
+ "name": "meta.interface-member.typespec",
493
+ "patterns": [
494
+ {
495
+ "include": "#token"
496
+ },
497
+ {
498
+ "include": "#operation-signature"
499
+ }
500
+ ]
501
+ },
502
+ "interface-statement": {
503
+ "begin": "\\b(interface)\\b",
504
+ "beginCaptures": {
505
+ "1": {
506
+ "name": "keyword.other.tsp"
507
+ }
508
+ },
509
+ "end": "(?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
510
+ "name": "meta.interface-statement.typespec",
511
+ "patterns": [
512
+ {
513
+ "include": "#token"
514
+ },
515
+ {
516
+ "include": "#type-parameters"
517
+ },
518
+ {
519
+ "include": "#interface-heritage"
520
+ },
521
+ {
522
+ "include": "#interface-body"
523
+ },
524
+ {
525
+ "include": "#expression"
526
+ }
527
+ ]
528
+ },
529
+ "line-comment": {
530
+ "match": "//.*$",
531
+ "name": "comment.line.double-slash.tsp"
532
+ },
533
+ "model-expression": {
534
+ "begin": "\\{",
535
+ "beginCaptures": {
536
+ "0": {
537
+ "name": "punctuation.curlybrace.open.tsp"
538
+ }
539
+ },
540
+ "end": "\\}",
541
+ "endCaptures": {
542
+ "0": {
543
+ "name": "punctuation.curlybrace.close.tsp"
544
+ }
545
+ },
546
+ "name": "meta.model-expression.typespec",
547
+ "patterns": [
548
+ {
549
+ "include": "#model-property"
550
+ },
551
+ {
552
+ "include": "#token"
553
+ },
554
+ {
555
+ "include": "#directive"
556
+ },
557
+ {
558
+ "include": "#decorator"
559
+ },
560
+ {
561
+ "include": "#spread-operator"
562
+ },
563
+ {
564
+ "include": "#punctuation-semicolon"
565
+ }
566
+ ]
567
+ },
568
+ "model-heritage": {
569
+ "begin": "\\b(extends|is)\\b",
570
+ "beginCaptures": {
571
+ "1": {
572
+ "name": "keyword.other.tsp"
573
+ }
574
+ },
575
+ "end": "((?=\\{)|(?=;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b))",
576
+ "name": "meta.model-heritage.typespec",
577
+ "patterns": [
578
+ {
579
+ "include": "#expression"
580
+ },
581
+ {
582
+ "include": "#punctuation-comma"
583
+ }
584
+ ]
585
+ },
586
+ "model-property": {
587
+ "begin": "(?:(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)|(\\\"(?:[^\\\"\\\\]|\\\\.)*\\\"))",
588
+ "beginCaptures": {
589
+ "1": {
590
+ "name": "variable.name.tsp"
591
+ },
592
+ "2": {
593
+ "name": "string.quoted.double.tsp"
594
+ }
595
+ },
596
+ "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
597
+ "name": "meta.model-property.typespec",
598
+ "patterns": [
599
+ {
600
+ "include": "#token"
601
+ },
602
+ {
603
+ "include": "#type-annotation"
604
+ },
605
+ {
606
+ "include": "#operator-assignment"
607
+ },
608
+ {
609
+ "include": "#expression"
610
+ }
611
+ ]
612
+ },
613
+ "model-statement": {
614
+ "begin": "\\b(model)\\b",
615
+ "beginCaptures": {
616
+ "1": {
617
+ "name": "keyword.other.tsp"
618
+ }
619
+ },
620
+ "end": "(?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
621
+ "name": "meta.model-statement.typespec",
622
+ "patterns": [
623
+ {
624
+ "include": "#token"
625
+ },
626
+ {
627
+ "include": "#type-parameters"
628
+ },
629
+ {
630
+ "include": "#model-heritage"
631
+ },
632
+ {
633
+ "include": "#expression"
634
+ }
635
+ ]
636
+ },
637
+ "namespace-body": {
638
+ "begin": "\\{",
639
+ "beginCaptures": {
640
+ "0": {
641
+ "name": "punctuation.curlybrace.open.tsp"
642
+ }
643
+ },
644
+ "end": "\\}",
645
+ "endCaptures": {
646
+ "0": {
647
+ "name": "punctuation.curlybrace.close.tsp"
648
+ }
649
+ },
650
+ "name": "meta.namespace-body.typespec",
651
+ "patterns": [
652
+ {
653
+ "include": "#statement"
654
+ }
655
+ ]
656
+ },
657
+ "namespace-name": {
658
+ "begin": "(?=[_$[:alpha:]])",
659
+ "end": "((?=\\{)|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b))",
660
+ "name": "meta.namespace-name.typespec",
661
+ "patterns": [
662
+ {
663
+ "include": "#identifier-expression"
664
+ },
665
+ {
666
+ "include": "#punctuation-accessor"
667
+ }
668
+ ]
669
+ },
670
+ "namespace-statement": {
671
+ "begin": "\\b(namespace)\\b",
672
+ "beginCaptures": {
673
+ "1": {
674
+ "name": "keyword.other.tsp"
675
+ }
676
+ },
677
+ "end": "((?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b))",
678
+ "name": "meta.namespace-statement.typespec",
679
+ "patterns": [
680
+ {
681
+ "include": "#token"
682
+ },
683
+ {
684
+ "include": "#namespace-name"
685
+ },
686
+ {
687
+ "include": "#namespace-body"
688
+ }
689
+ ]
690
+ },
691
+ "numeric-literal": {
692
+ "match": "(?:\\b(?<!\\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\\b(?!\\$)|\\b(?<!\\$)0(?:b|B)[01][01_]*(n)?\\b(?!\\$)|(?<!\\$)(?:(?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\\b)|(?:\\b[0-9][0-9_]*(\\.)[eE][+-]?[0-9][0-9_]*(n)?\\b)|(?:\\B(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\\b)|(?:\\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\\b)|(?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*(n)?\\b)|(?:\\b[0-9][0-9_]*(\\.)(n)?\\B)|(?:\\B(\\.)[0-9][0-9_]*(n)?\\b)|(?:\\b[0-9][0-9_]*(n)?\\b(?!\\.)))(?!\\$))",
693
+ "name": "constant.numeric.tsp"
694
+ },
695
+ "operation-heritage": {
696
+ "begin": "\\b(is)\\b",
697
+ "beginCaptures": {
698
+ "1": {
699
+ "name": "keyword.other.tsp"
700
+ }
701
+ },
702
+ "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
703
+ "name": "meta.operation-heritage.typespec",
704
+ "patterns": [
705
+ {
706
+ "include": "#expression"
707
+ }
708
+ ]
709
+ },
710
+ "operation-parameters": {
711
+ "begin": "\\(",
712
+ "beginCaptures": {
713
+ "0": {
714
+ "name": "punctuation.parenthesis.open.tsp"
715
+ }
716
+ },
717
+ "end": "\\)",
718
+ "endCaptures": {
719
+ "0": {
720
+ "name": "punctuation.parenthesis.close.tsp"
721
+ }
722
+ },
723
+ "name": "meta.operation-parameters.typespec",
724
+ "patterns": [
725
+ {
726
+ "include": "#token"
727
+ },
728
+ {
729
+ "include": "#decorator"
730
+ },
731
+ {
732
+ "include": "#model-property"
733
+ },
734
+ {
735
+ "include": "#spread-operator"
736
+ },
737
+ {
738
+ "include": "#punctuation-comma"
739
+ }
740
+ ]
741
+ },
742
+ "operation-signature": {
743
+ "patterns": [
744
+ {
745
+ "include": "#type-parameters"
746
+ },
747
+ {
748
+ "include": "#operation-heritage"
749
+ },
750
+ {
751
+ "include": "#operation-parameters"
752
+ },
753
+ {
754
+ "include": "#type-annotation"
755
+ }
756
+ ]
757
+ },
758
+ "operation-statement": {
759
+ "begin": "\\b(op)\\b\\s+(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)",
760
+ "beginCaptures": {
761
+ "1": {
762
+ "name": "keyword.other.tsp"
763
+ },
764
+ "2": {
765
+ "name": "entity.name.function.tsp"
766
+ }
767
+ },
768
+ "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
769
+ "name": "meta.operation-statement.typespec",
770
+ "patterns": [
771
+ {
772
+ "include": "#token"
773
+ },
774
+ {
775
+ "include": "#operation-signature"
776
+ }
777
+ ]
778
+ },
779
+ "operator-assignment": {
780
+ "match": "=",
781
+ "name": "keyword.operator.assignment.tsp"
782
+ },
783
+ "parenthesized-expression": {
784
+ "begin": "\\(",
785
+ "beginCaptures": {
786
+ "0": {
787
+ "name": "punctuation.parenthesis.open.tsp"
788
+ }
789
+ },
790
+ "end": "\\)",
791
+ "endCaptures": {
792
+ "0": {
793
+ "name": "punctuation.parenthesis.close.tsp"
794
+ }
795
+ },
796
+ "name": "meta.parenthesized-expression.typespec",
797
+ "patterns": [
798
+ {
799
+ "include": "#expression"
800
+ },
801
+ {
802
+ "include": "#punctuation-comma"
803
+ }
804
+ ]
805
+ },
806
+ "projection": {
807
+ "begin": "(from|to)",
808
+ "beginCaptures": {
809
+ "1": {
810
+ "name": "keyword.other.tsp"
811
+ }
812
+ },
813
+ "end": "((?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b))",
814
+ "name": "meta.projection.typespec",
815
+ "patterns": [
816
+ {
817
+ "include": "#projection-parameters"
818
+ },
819
+ {
820
+ "include": "#projection-body"
821
+ }
822
+ ]
823
+ },
824
+ "projection-body": {
825
+ "begin": "\\{",
826
+ "beginCaptures": {
827
+ "0": {
828
+ "name": "punctuation.curlybrace.open.tsp"
829
+ }
830
+ },
831
+ "end": "\\}",
832
+ "endCaptures": {
833
+ "0": {
834
+ "name": "punctuation.curlybrace.close.tsp"
835
+ }
836
+ },
837
+ "name": "meta.projection-body.typespec",
838
+ "patterns": [
839
+ {
840
+ "include": "#projection-expression"
841
+ },
842
+ {
843
+ "include": "#punctuation-semicolon"
844
+ }
845
+ ]
846
+ },
847
+ "projection-expression": {
848
+ "patterns": [
849
+ {
850
+ "include": "#else-if-expression"
851
+ },
852
+ {
853
+ "include": "#if-expression"
854
+ },
855
+ {
856
+ "include": "#else-expression"
857
+ },
858
+ {
859
+ "include": "#function-call"
860
+ }
861
+ ]
862
+ },
863
+ "projection-parameter": {
864
+ "begin": "(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)",
865
+ "beginCaptures": {
866
+ "1": {
867
+ "name": "variable.name.tsp"
868
+ }
869
+ },
870
+ "end": "(?=\\))|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
871
+ "name": "meta.projection-parameter.typespec",
872
+ "patterns": [
873
+ ]
874
+ },
875
+ "projection-parameters": {
876
+ "begin": "\\(",
877
+ "beginCaptures": {
878
+ "0": {
879
+ "name": "punctuation.parenthesis.open.tsp"
880
+ }
881
+ },
882
+ "end": "\\)",
883
+ "endCaptures": {
884
+ "0": {
885
+ "name": "punctuation.parenthesis.close.tsp"
886
+ }
887
+ },
888
+ "name": "meta.projection-parameters.typespec",
889
+ "patterns": [
890
+ {
891
+ "include": "#token"
892
+ },
893
+ {
894
+ "include": "#projection-parameter"
895
+ }
896
+ ]
897
+ },
898
+ "projection-statement": {
899
+ "begin": "\\b(projection)\\b\\s+(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)(#)(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)",
900
+ "beginCaptures": {
901
+ "1": {
902
+ "name": "keyword.other.tsp"
903
+ },
904
+ "2": {
905
+ "name": "keyword.other.tsp"
906
+ },
907
+ "3": {
908
+ "name": "keyword.operator.selector.tsp"
909
+ },
910
+ "4": {
911
+ "name": "variable.name.tsp"
912
+ }
913
+ },
914
+ "end": "((?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b))",
915
+ "name": "meta.projection-statement.typespec",
916
+ "patterns": [
917
+ {
918
+ "include": "#projection-statement-body"
919
+ }
920
+ ]
921
+ },
922
+ "projection-statement-body": {
923
+ "begin": "\\{",
924
+ "beginCaptures": {
925
+ "0": {
926
+ "name": "punctuation.curlybrace.open.tsp"
927
+ }
928
+ },
929
+ "end": "\\}",
930
+ "endCaptures": {
931
+ "0": {
932
+ "name": "punctuation.curlybrace.close.tsp"
933
+ }
934
+ },
935
+ "name": "meta.projection-statement-body.typespec",
936
+ "patterns": [
937
+ {
938
+ "include": "#projection"
939
+ }
940
+ ]
941
+ },
942
+ "punctuation-accessor": {
943
+ "match": "\\.",
944
+ "name": "punctuation.accessor.tsp"
945
+ },
946
+ "punctuation-comma": {
947
+ "match": ",",
948
+ "name": "punctuation.comma.tsp"
949
+ },
950
+ "punctuation-semicolon": {
951
+ "match": ";",
952
+ "name": "punctuation.terminator.statement.tsp"
953
+ },
954
+ "scalar-extends": {
955
+ "begin": "\\b(extends)\\b",
956
+ "beginCaptures": {
957
+ "1": {
958
+ "name": "keyword.other.tsp"
959
+ }
960
+ },
961
+ "end": "(?=;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
962
+ "name": "meta.scalar-extends.typespec",
963
+ "patterns": [
964
+ {
965
+ "include": "#expression"
966
+ },
967
+ {
968
+ "include": "#punctuation-comma"
969
+ }
970
+ ]
971
+ },
972
+ "scalar-statement": {
973
+ "begin": "\\b(scalar)\\b",
974
+ "beginCaptures": {
975
+ "1": {
976
+ "name": "keyword.other.tsp"
977
+ }
978
+ },
979
+ "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
980
+ "name": "meta.scalar-statement.typespec",
981
+ "patterns": [
982
+ {
983
+ "include": "#token"
984
+ },
985
+ {
986
+ "include": "#type-parameters"
987
+ },
988
+ {
989
+ "include": "#scalar-extends"
990
+ },
991
+ {
992
+ "include": "#expression"
993
+ }
994
+ ]
995
+ },
996
+ "spread-operator": {
997
+ "begin": "\\.\\.\\.",
998
+ "beginCaptures": {
999
+ "0": {
1000
+ "name": "keyword.operator.spread.tsp"
1001
+ }
1002
+ },
1003
+ "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
1004
+ "name": "meta.spread-operator.typespec",
1005
+ "patterns": [
1006
+ {
1007
+ "include": "#expression"
1008
+ }
1009
+ ]
1010
+ },
1011
+ "statement": {
1012
+ "patterns": [
1013
+ {
1014
+ "include": "#token"
1015
+ },
1016
+ {
1017
+ "include": "#directive"
1018
+ },
1019
+ {
1020
+ "include": "#augment-decorator-statement"
1021
+ },
1022
+ {
1023
+ "include": "#decorator"
1024
+ },
1025
+ {
1026
+ "include": "#model-statement"
1027
+ },
1028
+ {
1029
+ "include": "#scalar-statement"
1030
+ },
1031
+ {
1032
+ "include": "#union-statement"
1033
+ },
1034
+ {
1035
+ "include": "#interface-statement"
1036
+ },
1037
+ {
1038
+ "include": "#enum-statement"
1039
+ },
1040
+ {
1041
+ "include": "#alias-statement"
1042
+ },
1043
+ {
1044
+ "include": "#namespace-statement"
1045
+ },
1046
+ {
1047
+ "include": "#operation-statement"
1048
+ },
1049
+ {
1050
+ "include": "#import-statement"
1051
+ },
1052
+ {
1053
+ "include": "#using-statement"
1054
+ },
1055
+ {
1056
+ "include": "#decorator-declaration-statement"
1057
+ },
1058
+ {
1059
+ "include": "#function-declaration-statement"
1060
+ },
1061
+ {
1062
+ "include": "#projection-statement"
1063
+ },
1064
+ {
1065
+ "include": "#punctuation-semicolon"
1066
+ }
1067
+ ]
1068
+ },
1069
+ "string-literal": {
1070
+ "begin": "\"",
1071
+ "end": "\"|$",
1072
+ "name": "string.quoted.double.tsp",
1073
+ "patterns": [
1074
+ {
1075
+ "include": "#template-expression"
1076
+ },
1077
+ {
1078
+ "include": "#escape-character"
1079
+ }
1080
+ ]
1081
+ },
1082
+ "template-expression": {
1083
+ "begin": "\\$\\{",
1084
+ "beginCaptures": {
1085
+ "0": {
1086
+ "name": "punctuation.definition.template-expression.begin.tsp"
1087
+ }
1088
+ },
1089
+ "end": "\\}",
1090
+ "endCaptures": {
1091
+ "0": {
1092
+ "name": "punctuation.definition.template-expression.end.tsp"
1093
+ }
1094
+ },
1095
+ "name": "meta.template-expression.typespec",
1096
+ "patterns": [
1097
+ {
1098
+ "include": "#expression"
1099
+ }
1100
+ ]
1101
+ },
1102
+ "token": {
1103
+ "patterns": [
1104
+ {
1105
+ "include": "#doc-comment"
1106
+ },
1107
+ {
1108
+ "include": "#line-comment"
1109
+ },
1110
+ {
1111
+ "include": "#block-comment"
1112
+ },
1113
+ {
1114
+ "include": "#triple-quoted-string-literal"
1115
+ },
1116
+ {
1117
+ "include": "#string-literal"
1118
+ },
1119
+ {
1120
+ "include": "#boolean-literal"
1121
+ },
1122
+ {
1123
+ "include": "#numeric-literal"
1124
+ }
1125
+ ]
1126
+ },
1127
+ "triple-quoted-string-literal": {
1128
+ "begin": "\"\"\"",
1129
+ "end": "\"\"\"",
1130
+ "name": "string.quoted.triple.tsp",
1131
+ "patterns": [
1132
+ {
1133
+ "include": "#template-expression"
1134
+ },
1135
+ {
1136
+ "include": "#escape-character"
1137
+ }
1138
+ ]
1139
+ },
1140
+ "tuple-expression": {
1141
+ "begin": "\\[",
1142
+ "beginCaptures": {
1143
+ "0": {
1144
+ "name": "punctuation.squarebracket.open.tsp"
1145
+ }
1146
+ },
1147
+ "end": "\\]",
1148
+ "endCaptures": {
1149
+ "0": {
1150
+ "name": "punctuation.squarebracket.close.tsp"
1151
+ }
1152
+ },
1153
+ "name": "meta.tuple-expression.typespec",
1154
+ "patterns": [
1155
+ {
1156
+ "include": "#expression"
1157
+ }
1158
+ ]
1159
+ },
1160
+ "type-annotation": {
1161
+ "begin": "\\s*(\\??)\\s*(:)",
1162
+ "beginCaptures": {
1163
+ "1": {
1164
+ "name": "keyword.operator.optional.tsp"
1165
+ },
1166
+ "2": {
1167
+ "name": "keyword.operator.type.annotation.tsp"
1168
+ }
1169
+ },
1170
+ "end": "(?=,|;|@|\\)|\\}|=|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
1171
+ "name": "meta.type-annotation.typespec",
1172
+ "patterns": [
1173
+ {
1174
+ "include": "#expression"
1175
+ }
1176
+ ]
1177
+ },
1178
+ "type-arguments": {
1179
+ "begin": "<",
1180
+ "beginCaptures": {
1181
+ "0": {
1182
+ "name": "punctuation.definition.typeparameters.begin.tsp"
1183
+ }
1184
+ },
1185
+ "end": ">",
1186
+ "endCaptures": {
1187
+ "0": {
1188
+ "name": "punctuation.definition.typeparameters.end.tsp"
1189
+ }
1190
+ },
1191
+ "name": "meta.type-arguments.typespec",
1192
+ "patterns": [
1193
+ {
1194
+ "include": "#identifier-expression"
1195
+ },
1196
+ {
1197
+ "include": "#operator-assignment"
1198
+ },
1199
+ {
1200
+ "include": "#expression"
1201
+ },
1202
+ {
1203
+ "include": "#punctuation-comma"
1204
+ }
1205
+ ]
1206
+ },
1207
+ "type-parameter": {
1208
+ "begin": "(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)",
1209
+ "beginCaptures": {
1210
+ "1": {
1211
+ "name": "entity.name.type.tsp"
1212
+ }
1213
+ },
1214
+ "end": "(?=>)|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
1215
+ "name": "meta.type-parameter.typespec",
1216
+ "patterns": [
1217
+ {
1218
+ "include": "#token"
1219
+ },
1220
+ {
1221
+ "include": "#type-parameter-constraint"
1222
+ },
1223
+ {
1224
+ "include": "#type-parameter-default"
1225
+ }
1226
+ ]
1227
+ },
1228
+ "type-parameter-constraint": {
1229
+ "begin": "extends",
1230
+ "beginCaptures": {
1231
+ "0": {
1232
+ "name": "keyword.other.tsp"
1233
+ }
1234
+ },
1235
+ "end": "(?=>)|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
1236
+ "name": "meta.type-parameter-constraint.typespec",
1237
+ "patterns": [
1238
+ {
1239
+ "include": "#expression"
1240
+ }
1241
+ ]
1242
+ },
1243
+ "type-parameter-default": {
1244
+ "begin": "=",
1245
+ "beginCaptures": {
1246
+ "0": {
1247
+ "name": "keyword.operator.assignment.tsp"
1248
+ }
1249
+ },
1250
+ "end": "(?=>)|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
1251
+ "name": "meta.type-parameter-default.typespec",
1252
+ "patterns": [
1253
+ {
1254
+ "include": "#expression"
1255
+ }
1256
+ ]
1257
+ },
1258
+ "type-parameters": {
1259
+ "begin": "<",
1260
+ "beginCaptures": {
1261
+ "0": {
1262
+ "name": "punctuation.definition.typeparameters.begin.tsp"
1263
+ }
1264
+ },
1265
+ "end": ">",
1266
+ "endCaptures": {
1267
+ "0": {
1268
+ "name": "punctuation.definition.typeparameters.end.tsp"
1269
+ }
1270
+ },
1271
+ "name": "meta.type-parameters.typespec",
1272
+ "patterns": [
1273
+ {
1274
+ "include": "#type-parameter"
1275
+ },
1276
+ {
1277
+ "include": "#punctuation-comma"
1278
+ }
1279
+ ]
1280
+ },
1281
+ "union-body": {
1282
+ "begin": "\\{",
1283
+ "beginCaptures": {
1284
+ "0": {
1285
+ "name": "punctuation.curlybrace.open.tsp"
1286
+ }
1287
+ },
1288
+ "end": "\\}",
1289
+ "endCaptures": {
1290
+ "0": {
1291
+ "name": "punctuation.curlybrace.close.tsp"
1292
+ }
1293
+ },
1294
+ "name": "meta.union-body.typespec",
1295
+ "patterns": [
1296
+ {
1297
+ "include": "#union-variant"
1298
+ },
1299
+ {
1300
+ "include": "#token"
1301
+ },
1302
+ {
1303
+ "include": "#directive"
1304
+ },
1305
+ {
1306
+ "include": "#decorator"
1307
+ },
1308
+ {
1309
+ "include": "#expression"
1310
+ },
1311
+ {
1312
+ "include": "#punctuation-comma"
1313
+ }
1314
+ ]
1315
+ },
1316
+ "union-statement": {
1317
+ "begin": "\\b(union)\\b\\s+(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)",
1318
+ "beginCaptures": {
1319
+ "1": {
1320
+ "name": "keyword.other.tsp"
1321
+ },
1322
+ "2": {
1323
+ "name": "entity.name.type.tsp"
1324
+ }
1325
+ },
1326
+ "end": "(?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
1327
+ "name": "meta.union-statement.typespec",
1328
+ "patterns": [
1329
+ {
1330
+ "include": "#token"
1331
+ },
1332
+ {
1333
+ "include": "#union-body"
1334
+ }
1335
+ ]
1336
+ },
1337
+ "union-variant": {
1338
+ "begin": "(?:(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)\\s*(:))",
1339
+ "beginCaptures": {
1340
+ "1": {
1341
+ "name": "variable.name.tsp"
1342
+ },
1343
+ "2": {
1344
+ "name": "keyword.operator.type.annotation.tsp"
1345
+ }
1346
+ },
1347
+ "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
1348
+ "name": "meta.union-variant.typespec",
1349
+ "patterns": [
1350
+ {
1351
+ "include": "#token"
1352
+ },
1353
+ {
1354
+ "include": "#expression"
1355
+ }
1356
+ ]
1357
+ },
1358
+ "using-statement": {
1359
+ "begin": "\\b(using)\\b",
1360
+ "beginCaptures": {
1361
+ "1": {
1362
+ "name": "keyword.other.tsp"
1363
+ }
1364
+ },
1365
+ "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
1366
+ "name": "meta.using-statement.typespec",
1367
+ "patterns": [
1368
+ {
1369
+ "include": "#token"
1370
+ },
1371
+ {
1372
+ "include": "#identifier-expression"
1373
+ }
1374
+ ]
1375
+ },
1376
+ "valueof": {
1377
+ "begin": "\\b(valueof)",
1378
+ "beginCaptures": {
1379
+ "1": {
1380
+ "name": "keyword.other.tsp"
1381
+ }
1382
+ },
1383
+ "end": "(?=>)|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
1384
+ "name": "meta.valueof.typespec",
1385
+ "patterns": [
1386
+ {
1387
+ "include": "#expression"
1388
+ }
1389
+ ]
1390
+ }
1391
+ },
1392
+ "scopeName": "source.tsp"
1393
+ }