microsoft/typespec

Public

mirrored from https://github.com/microsoft/typespecAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
8b062e33bbc4273d2470fa9fbc182df8ce1ef0b7

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

grammars/typespec.json

1271lines · modecode

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