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