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