microsoft/typespec

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
4ddf43ae0dffb11cf982bebe006f37d5524bee69

Branches

Tags

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

Clone

HTTPS

Download ZIP

grammars/typespec.json

1392lines · 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-body": {
240 "name": "meta.enum-body.typespec",
241 "begin": "\\{",
242 "beginCaptures": {
243 "0": {
244 "name": "punctuation.curlybrace.open.tsp"
245 }
246 },
247 "end": "\\}",
248 "endCaptures": {
249 "0": {
250 "name": "punctuation.curlybrace.close.tsp"
251 }
252 },
253 "patterns": [
254 {
255 "include": "#enum-member"
256 },
257 {
258 "include": "#token"
259 },
260 {
261 "include": "#directive"
262 },
263 {
264 "include": "#decorator"
265 },
266 {
267 "include": "#punctuation-comma"
268 }
269 ]
270 },
271 "enum-member": {
272 "name": "meta.enum-member.typespec",
273 "begin": "(?:(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)\\s*(:?))",
274 "beginCaptures": {
275 "1": {
276 "name": "variable.name.tsp"
277 },
278 "2": {
279 "name": "keyword.operator.type.annotation.tsp"
280 }
281 },
282 "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
283 "patterns": [
284 {
285 "include": "#token"
286 },
287 {
288 "include": "#type-annotation"
289 }
290 ]
291 },
292 "enum-statement": {
293 "name": "meta.enum-statement.typespec",
294 "begin": "\\b(enum)\\b\\s+(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)",
295 "beginCaptures": {
296 "1": {
297 "name": "keyword.other.tsp"
298 },
299 "2": {
300 "name": "entity.name.type.tsp"
301 }
302 },
303 "end": "(?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
304 "patterns": [
305 {
306 "include": "#token"
307 },
308 {
309 "include": "#enum-body"
310 }
311 ]
312 },
313 "escape-character": {
314 "name": "constant.character.escape.tsp",
315 "match": "\\\\."
316 },
317 "expression": {
318 "patterns": [
319 {
320 "include": "#token"
321 },
322 {
323 "include": "#directive"
324 },
325 {
326 "include": "#parenthesized-expression"
327 },
328 {
329 "include": "#valueof"
330 },
331 {
332 "include": "#type-arguments"
333 },
334 {
335 "include": "#tuple-expression"
336 },
337 {
338 "include": "#model-expression"
339 },
340 {
341 "include": "#identifier-expression"
342 }
343 ]
344 },
345 "function-call": {
346 "name": "meta.function-call.typespec",
347 "begin": "(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)\\s*(\\()",
348 "beginCaptures": {
349 "1": {
350 "name": "entity.name.function.tsp"
351 },
352 "2": {
353 "name": "punctuation.parenthesis.open.tsp"
354 }
355 },
356 "end": "\\)",
357 "endCaptures": {
358 "0": {
359 "name": "punctuation.parenthesis.close.tsp"
360 }
361 },
362 "patterns": [
363 {
364 "include": "#expression"
365 }
366 ]
367 },
368 "function-declaration-statement": {
369 "name": "meta.function-declaration-statement.typespec",
370 "begin": "(?:(extern)\\s+)?\\b(fn)\\b\\s+(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)",
371 "beginCaptures": {
372 "1": {
373 "name": "keyword.other.tsp"
374 },
375 "2": {
376 "name": "keyword.other.tsp"
377 },
378 "3": {
379 "name": "entity.name.function.tsp"
380 }
381 },
382 "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
383 "patterns": [
384 {
385 "include": "#token"
386 },
387 {
388 "include": "#operation-parameters"
389 },
390 {
391 "include": "#type-annotation"
392 }
393 ]
394 },
395 "identifier-expression": {
396 "name": "entity.name.type.tsp",
397 "match": "\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`"
398 },
399 "if-expression": {
400 "name": "meta.if-expression.typespec",
401 "begin": "\\b(if)\\b",
402 "beginCaptures": {
403 "1": {
404 "name": "keyword.other.tsp"
405 }
406 },
407 "end": "((?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b))",
408 "patterns": [
409 {
410 "include": "#projection-expression"
411 },
412 {
413 "include": "#projection-body"
414 }
415 ]
416 },
417 "import-statement": {
418 "name": "meta.import-statement.typespec",
419 "begin": "\\b(import)\\b",
420 "beginCaptures": {
421 "1": {
422 "name": "keyword.other.tsp"
423 }
424 },
425 "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
426 "patterns": [
427 {
428 "include": "#token"
429 }
430 ]
431 },
432 "interface-body": {
433 "name": "meta.interface-body.typespec",
434 "begin": "\\{",
435 "beginCaptures": {
436 "0": {
437 "name": "punctuation.curlybrace.open.tsp"
438 }
439 },
440 "end": "\\}",
441 "endCaptures": {
442 "0": {
443 "name": "punctuation.curlybrace.close.tsp"
444 }
445 },
446 "patterns": [
447 {
448 "include": "#token"
449 },
450 {
451 "include": "#directive"
452 },
453 {
454 "include": "#decorator"
455 },
456 {
457 "include": "#interface-member"
458 },
459 {
460 "include": "#punctuation-semicolon"
461 }
462 ]
463 },
464 "interface-heritage": {
465 "name": "meta.interface-heritage.typespec",
466 "begin": "\\b(extends)\\b",
467 "beginCaptures": {
468 "1": {
469 "name": "keyword.other.tsp"
470 }
471 },
472 "end": "((?=\\{)|(?=;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b))",
473 "patterns": [
474 {
475 "include": "#expression"
476 },
477 {
478 "include": "#punctuation-comma"
479 }
480 ]
481 },
482 "interface-member": {
483 "name": "meta.interface-member.typespec",
484 "begin": "(?:\\b(op)\\b\\s+)?(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)",
485 "beginCaptures": {
486 "1": {
487 "name": "keyword.other.tsp"
488 },
489 "2": {
490 "name": "entity.name.function.tsp"
491 }
492 },
493 "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
494 "patterns": [
495 {
496 "include": "#token"
497 },
498 {
499 "include": "#operation-signature"
500 }
501 ]
502 },
503 "interface-statement": {
504 "name": "meta.interface-statement.typespec",
505 "begin": "\\b(interface)\\b",
506 "beginCaptures": {
507 "1": {
508 "name": "keyword.other.tsp"
509 }
510 },
511 "end": "(?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
512 "patterns": [
513 {
514 "include": "#token"
515 },
516 {
517 "include": "#type-parameters"
518 },
519 {
520 "include": "#interface-heritage"
521 },
522 {
523 "include": "#interface-body"
524 },
525 {
526 "include": "#expression"
527 }
528 ]
529 },
530 "line-comment": {
531 "name": "comment.line.double-slash.tsp",
532 "match": "//.*$"
533 },
534 "model-expression": {
535 "name": "meta.model-expression.typespec",
536 "begin": "\\{",
537 "beginCaptures": {
538 "0": {
539 "name": "punctuation.curlybrace.open.tsp"
540 }
541 },
542 "end": "\\}",
543 "endCaptures": {
544 "0": {
545 "name": "punctuation.curlybrace.close.tsp"
546 }
547 },
548 "patterns": [
549 {
550 "include": "#model-property"
551 },
552 {
553 "include": "#token"
554 },
555 {
556 "include": "#directive"
557 },
558 {
559 "include": "#decorator"
560 },
561 {
562 "include": "#spread-operator"
563 },
564 {
565 "include": "#punctuation-semicolon"
566 }
567 ]
568 },
569 "model-heritage": {
570 "name": "meta.model-heritage.typespec",
571 "begin": "\\b(extends|is)\\b",
572 "beginCaptures": {
573 "1": {
574 "name": "keyword.other.tsp"
575 }
576 },
577 "end": "((?=\\{)|(?=;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b))",
578 "patterns": [
579 {
580 "include": "#expression"
581 },
582 {
583 "include": "#punctuation-comma"
584 }
585 ]
586 },
587 "model-property": {
588 "name": "meta.model-property.typespec",
589 "begin": "(?:(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)|(\\\"(?:[^\\\"\\\\]|\\\\.)*\\\"))",
590 "beginCaptures": {
591 "1": {
592 "name": "variable.name.tsp"
593 },
594 "2": {
595 "name": "string.quoted.double.tsp"
596 }
597 },
598 "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
599 "patterns": [
600 {
601 "include": "#token"
602 },
603 {
604 "include": "#type-annotation"
605 },
606 {
607 "include": "#operator-assignment"
608 },
609 {
610 "include": "#expression"
611 }
612 ]
613 },
614 "model-statement": {
615 "name": "meta.model-statement.typespec",
616 "begin": "\\b(model)\\b",
617 "beginCaptures": {
618 "1": {
619 "name": "keyword.other.tsp"
620 }
621 },
622 "end": "(?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
623 "patterns": [
624 {
625 "include": "#token"
626 },
627 {
628 "include": "#type-parameters"
629 },
630 {
631 "include": "#model-heritage"
632 },
633 {
634 "include": "#expression"
635 }
636 ]
637 },
638 "namespace-body": {
639 "name": "meta.namespace-body.typespec",
640 "begin": "\\{",
641 "beginCaptures": {
642 "0": {
643 "name": "punctuation.curlybrace.open.tsp"
644 }
645 },
646 "end": "\\}",
647 "endCaptures": {
648 "0": {
649 "name": "punctuation.curlybrace.close.tsp"
650 }
651 },
652 "patterns": [
653 {
654 "include": "#statement"
655 }
656 ]
657 },
658 "namespace-name": {
659 "name": "meta.namespace-name.typespec",
660 "begin": "(?=[_$[:alpha:]])",
661 "end": "((?=\\{)|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b))",
662 "patterns": [
663 {
664 "include": "#identifier-expression"
665 },
666 {
667 "include": "#punctuation-accessor"
668 }
669 ]
670 },
671 "namespace-statement": {
672 "name": "meta.namespace-statement.typespec",
673 "begin": "\\b(namespace)\\b",
674 "beginCaptures": {
675 "1": {
676 "name": "keyword.other.tsp"
677 }
678 },
679 "end": "((?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b))",
680 "patterns": [
681 {
682 "include": "#token"
683 },
684 {
685 "include": "#namespace-name"
686 },
687 {
688 "include": "#namespace-body"
689 }
690 ]
691 },
692 "numeric-literal": {
693 "name": "constant.numeric.tsp",
694 "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(?!\\.)))(?!\\$))"
695 },
696 "operation-heritage": {
697 "name": "meta.operation-heritage.typespec",
698 "begin": "\\b(is)\\b",
699 "beginCaptures": {
700 "1": {
701 "name": "keyword.other.tsp"
702 }
703 },
704 "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
705 "patterns": [
706 {
707 "include": "#expression"
708 }
709 ]
710 },
711 "operation-parameters": {
712 "name": "meta.operation-parameters.typespec",
713 "begin": "\\(",
714 "beginCaptures": {
715 "0": {
716 "name": "punctuation.parenthesis.open.tsp"
717 }
718 },
719 "end": "\\)",
720 "endCaptures": {
721 "0": {
722 "name": "punctuation.parenthesis.close.tsp"
723 }
724 },
725 "patterns": [
726 {
727 "include": "#token"
728 },
729 {
730 "include": "#decorator"
731 },
732 {
733 "include": "#model-property"
734 },
735 {
736 "include": "#spread-operator"
737 },
738 {
739 "include": "#punctuation-comma"
740 }
741 ]
742 },
743 "operation-signature": {
744 "patterns": [
745 {
746 "include": "#type-parameters"
747 },
748 {
749 "include": "#operation-heritage"
750 },
751 {
752 "include": "#operation-parameters"
753 },
754 {
755 "include": "#type-annotation"
756 }
757 ]
758 },
759 "operation-statement": {
760 "name": "meta.operation-statement.typespec",
761 "begin": "\\b(op)\\b\\s+(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)",
762 "beginCaptures": {
763 "1": {
764 "name": "keyword.other.tsp"
765 },
766 "2": {
767 "name": "entity.name.function.tsp"
768 }
769 },
770 "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
771 "patterns": [
772 {
773 "include": "#token"
774 },
775 {
776 "include": "#operation-signature"
777 }
778 ]
779 },
780 "operator-assignment": {
781 "name": "keyword.operator.assignment.tsp",
782 "match": "="
783 },
784 "parenthesized-expression": {
785 "name": "meta.parenthesized-expression.typespec",
786 "begin": "\\(",
787 "beginCaptures": {
788 "0": {
789 "name": "punctuation.parenthesis.open.tsp"
790 }
791 },
792 "end": "\\)",
793 "endCaptures": {
794 "0": {
795 "name": "punctuation.parenthesis.close.tsp"
796 }
797 },
798 "patterns": [
799 {
800 "include": "#expression"
801 },
802 {
803 "include": "#punctuation-comma"
804 }
805 ]
806 },
807 "projection": {
808 "name": "meta.projection.typespec",
809 "begin": "(from|to)",
810 "beginCaptures": {
811 "1": {
812 "name": "keyword.other.tsp"
813 }
814 },
815 "end": "((?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b))",
816 "patterns": [
817 {
818 "include": "#projection-parameters"
819 },
820 {
821 "include": "#projection-body"
822 }
823 ]
824 },
825 "projection-body": {
826 "name": "meta.projection-body.typespec",
827 "begin": "\\{",
828 "beginCaptures": {
829 "0": {
830 "name": "punctuation.curlybrace.open.tsp"
831 }
832 },
833 "end": "\\}",
834 "endCaptures": {
835 "0": {
836 "name": "punctuation.curlybrace.close.tsp"
837 }
838 },
839 "patterns": [
840 {
841 "include": "#projection-expression"
842 },
843 {
844 "include": "#punctuation-semicolon"
845 }
846 ]
847 },
848 "projection-expression": {
849 "patterns": [
850 {
851 "include": "#else-if-expression"
852 },
853 {
854 "include": "#if-expression"
855 },
856 {
857 "include": "#else-expression"
858 },
859 {
860 "include": "#function-call"
861 }
862 ]
863 },
864 "projection-parameter": {
865 "name": "meta.projection-parameter.typespec",
866 "begin": "(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)",
867 "beginCaptures": {
868 "1": {
869 "name": "variable.name.tsp"
870 }
871 },
872 "end": "(?=\\))|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
873 "patterns": []
874 },
875 "projection-parameters": {
876 "name": "meta.projection-parameters.typespec",
877 "begin": "\\(",
878 "beginCaptures": {
879 "0": {
880 "name": "punctuation.parenthesis.open.tsp"
881 }
882 },
883 "end": "\\)",
884 "endCaptures": {
885 "0": {
886 "name": "punctuation.parenthesis.close.tsp"
887 }
888 },
889 "patterns": [
890 {
891 "include": "#token"
892 },
893 {
894 "include": "#projection-parameter"
895 }
896 ]
897 },
898 "projection-statement": {
899 "name": "meta.projection-statement.typespec",
900 "begin": "\\b(projection)\\b\\s+(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)(#)(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)",
901 "beginCaptures": {
902 "1": {
903 "name": "keyword.other.tsp"
904 },
905 "2": {
906 "name": "keyword.other.tsp"
907 },
908 "3": {
909 "name": "keyword.operator.selector.tsp"
910 },
911 "4": {
912 "name": "variable.name.tsp"
913 }
914 },
915 "end": "((?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b))",
916 "patterns": [
917 {
918 "include": "#projection-statement-body"
919 }
920 ]
921 },
922 "projection-statement-body": {
923 "name": "meta.projection-statement-body.typespec",
924 "begin": "\\{",
925 "beginCaptures": {
926 "0": {
927 "name": "punctuation.curlybrace.open.tsp"
928 }
929 },
930 "end": "\\}",
931 "endCaptures": {
932 "0": {
933 "name": "punctuation.curlybrace.close.tsp"
934 }
935 },
936 "patterns": [
937 {
938 "include": "#projection"
939 }
940 ]
941 },
942 "punctuation-accessor": {
943 "name": "punctuation.accessor.tsp",
944 "match": "\\."
945 },
946 "punctuation-comma": {
947 "name": "punctuation.comma.tsp",
948 "match": ","
949 },
950 "punctuation-semicolon": {
951 "name": "punctuation.terminator.statement.tsp",
952 "match": ";"
953 },
954 "scalar-extends": {
955 "name": "meta.scalar-extends.typespec",
956 "begin": "\\b(extends)\\b",
957 "beginCaptures": {
958 "1": {
959 "name": "keyword.other.tsp"
960 }
961 },
962 "end": "(?=;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
963 "patterns": [
964 {
965 "include": "#expression"
966 },
967 {
968 "include": "#punctuation-comma"
969 }
970 ]
971 },
972 "scalar-statement": {
973 "name": "meta.scalar-statement.typespec",
974 "begin": "\\b(scalar)\\b",
975 "beginCaptures": {
976 "1": {
977 "name": "keyword.other.tsp"
978 }
979 },
980 "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
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 "name": "meta.spread-operator.typespec",
998 "begin": "\\.\\.\\.",
999 "beginCaptures": {
1000 "0": {
1001 "name": "keyword.operator.spread.tsp"
1002 }
1003 },
1004 "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
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 "name": "string.quoted.double.tsp",
1071 "begin": "\"",
1072 "end": "\"|$",
1073 "patterns": [
1074 {
1075 "include": "#template-expression"
1076 },
1077 {
1078 "include": "#escape-character"
1079 }
1080 ]
1081 },
1082 "template-expression": {
1083 "name": "meta.template-expression.typespec",
1084 "begin": "\\$\\{",
1085 "beginCaptures": {
1086 "0": {
1087 "name": "punctuation.definition.template-expression.begin.tsp"
1088 }
1089 },
1090 "end": "\\}",
1091 "endCaptures": {
1092 "0": {
1093 "name": "punctuation.definition.template-expression.end.tsp"
1094 }
1095 },
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 "name": "string.quoted.triple.tsp",
1129 "begin": "\"\"\"",
1130 "end": "\"\"\"",
1131 "patterns": [
1132 {
1133 "include": "#template-expression"
1134 },
1135 {
1136 "include": "#escape-character"
1137 }
1138 ]
1139 },
1140 "tuple-expression": {
1141 "name": "meta.tuple-expression.typespec",
1142 "begin": "\\[",
1143 "beginCaptures": {
1144 "0": {
1145 "name": "punctuation.squarebracket.open.tsp"
1146 }
1147 },
1148 "end": "\\]",
1149 "endCaptures": {
1150 "0": {
1151 "name": "punctuation.squarebracket.close.tsp"
1152 }
1153 },
1154 "patterns": [
1155 {
1156 "include": "#expression"
1157 }
1158 ]
1159 },
1160 "type-annotation": {
1161 "name": "meta.type-annotation.typespec",
1162 "begin": "\\s*(\\??)\\s*(:)",
1163 "beginCaptures": {
1164 "1": {
1165 "name": "keyword.operator.optional.tsp"
1166 },
1167 "2": {
1168 "name": "keyword.operator.type.annotation.tsp"
1169 }
1170 },
1171 "end": "(?=,|;|@|\\)|\\}|=|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
1172 "patterns": [
1173 {
1174 "include": "#expression"
1175 }
1176 ]
1177 },
1178 "type-arguments": {
1179 "name": "meta.type-arguments.typespec",
1180 "begin": "<",
1181 "beginCaptures": {
1182 "0": {
1183 "name": "punctuation.definition.typeparameters.begin.tsp"
1184 }
1185 },
1186 "end": ">",
1187 "endCaptures": {
1188 "0": {
1189 "name": "punctuation.definition.typeparameters.end.tsp"
1190 }
1191 },
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 "name": "meta.type-parameter.typespec",
1209 "begin": "(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)",
1210 "beginCaptures": {
1211 "1": {
1212 "name": "entity.name.type.tsp"
1213 }
1214 },
1215 "end": "(?=>)|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
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 "name": "meta.type-parameter-constraint.typespec",
1230 "begin": "extends",
1231 "beginCaptures": {
1232 "0": {
1233 "name": "keyword.other.tsp"
1234 }
1235 },
1236 "end": "(?=>)|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
1237 "patterns": [
1238 {
1239 "include": "#expression"
1240 }
1241 ]
1242 },
1243 "type-parameter-default": {
1244 "name": "meta.type-parameter-default.typespec",
1245 "begin": "=",
1246 "beginCaptures": {
1247 "0": {
1248 "name": "keyword.operator.assignment.tsp"
1249 }
1250 },
1251 "end": "(?=>)|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
1252 "patterns": [
1253 {
1254 "include": "#expression"
1255 }
1256 ]
1257 },
1258 "type-parameters": {
1259 "name": "meta.type-parameters.typespec",
1260 "begin": "<",
1261 "beginCaptures": {
1262 "0": {
1263 "name": "punctuation.definition.typeparameters.begin.tsp"
1264 }
1265 },
1266 "end": ">",
1267 "endCaptures": {
1268 "0": {
1269 "name": "punctuation.definition.typeparameters.end.tsp"
1270 }
1271 },
1272 "patterns": [
1273 {
1274 "include": "#type-parameter"
1275 },
1276 {
1277 "include": "#punctuation-comma"
1278 }
1279 ]
1280 },
1281 "union-body": {
1282 "name": "meta.union-body.typespec",
1283 "begin": "\\{",
1284 "beginCaptures": {
1285 "0": {
1286 "name": "punctuation.curlybrace.open.tsp"
1287 }
1288 },
1289 "end": "\\}",
1290 "endCaptures": {
1291 "0": {
1292 "name": "punctuation.curlybrace.close.tsp"
1293 }
1294 },
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 "name": "meta.union-statement.typespec",
1318 "begin": "\\b(union)\\b\\s+(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)",
1319 "beginCaptures": {
1320 "1": {
1321 "name": "keyword.other.tsp"
1322 },
1323 "2": {
1324 "name": "entity.name.type.tsp"
1325 }
1326 },
1327 "end": "(?<=\\})|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
1328 "patterns": [
1329 {
1330 "include": "#token"
1331 },
1332 {
1333 "include": "#union-body"
1334 }
1335 ]
1336 },
1337 "union-variant": {
1338 "name": "meta.union-variant.typespec",
1339 "begin": "(?:(\\b[_$[:alpha:]][_$[:alnum:]]*\\b|`(?:[^`\\\\]|\\\\.)*`)\\s*(:))",
1340 "beginCaptures": {
1341 "1": {
1342 "name": "variable.name.tsp"
1343 },
1344 "2": {
1345 "name": "keyword.operator.type.annotation.tsp"
1346 }
1347 },
1348 "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
1349 "patterns": [
1350 {
1351 "include": "#token"
1352 },
1353 {
1354 "include": "#expression"
1355 }
1356 ]
1357 },
1358 "using-statement": {
1359 "name": "meta.using-statement.typespec",
1360 "begin": "\\b(using)\\b",
1361 "beginCaptures": {
1362 "1": {
1363 "name": "keyword.other.tsp"
1364 }
1365 },
1366 "end": "(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
1367 "patterns": [
1368 {
1369 "include": "#token"
1370 },
1371 {
1372 "include": "#identifier-expression"
1373 }
1374 ]
1375 },
1376 "valueof": {
1377 "name": "meta.valueof.typespec",
1378 "begin": "\\b(valueof)",
1379 "beginCaptures": {
1380 "1": {
1381 "name": "keyword.other.tsp"
1382 }
1383 },
1384 "end": "(?=>)|(?=,|;|@|\\)|\\}|\\b(?:extern)\\b|\\b(?:namespace|model|op|using|import|enum|alias|union|interface|dec|fn)\\b)",
1385 "patterns": [
1386 {
1387 "include": "#expression"
1388 }
1389 ]
1390 }
1391 }
1392}