| 1 |
{ |
| 2 |
"name": "v", |
| 3 |
"scopeName": "source.v", |
| 4 |
"fileTypes": [".v", ".vh", ".vsh", ".vv", "v.mod"], |
| 5 |
"patterns": [ |
| 6 |
{ |
| 7 |
"include": "#comments" |
| 8 |
}, |
| 9 |
{ |
| 10 |
"include": "#function-decl" |
| 11 |
}, |
| 12 |
{ |
| 13 |
"include": "#as-is" |
| 14 |
}, |
| 15 |
{ |
| 16 |
"include": "#attributes" |
| 17 |
}, |
| 18 |
{ |
| 19 |
"include": "#assignment" |
| 20 |
}, |
| 21 |
{ |
| 22 |
"include": "#module-decl" |
| 23 |
}, |
| 24 |
{ |
| 25 |
"include": "#import-decl" |
| 26 |
}, |
| 27 |
{ |
| 28 |
"include": "#hash-decl" |
| 29 |
}, |
| 30 |
{ |
| 31 |
"include": "#brackets" |
| 32 |
}, |
| 33 |
{ |
| 34 |
"include": "#builtin-fix" |
| 35 |
}, |
| 36 |
{ |
| 37 |
"include": "#escaped-fix" |
| 38 |
}, |
| 39 |
{ |
| 40 |
"include": "#operators" |
| 41 |
}, |
| 42 |
{ |
| 43 |
"include": "#function-limited-overload-decl" |
| 44 |
}, |
| 45 |
{ |
| 46 |
"include": "#function-extend-decl" |
| 47 |
}, |
| 48 |
{ |
| 49 |
"include": "#function-exist" |
| 50 |
}, |
| 51 |
{ |
| 52 |
"include": "#generic" |
| 53 |
}, |
| 54 |
{ |
| 55 |
"include": "#constants" |
| 56 |
}, |
| 57 |
{ |
| 58 |
"include": "#type" |
| 59 |
}, |
| 60 |
{ |
| 61 |
"include": "#enum" |
| 62 |
}, |
| 63 |
{ |
| 64 |
"include": "#interface" |
| 65 |
}, |
| 66 |
{ |
| 67 |
"include": "#struct" |
| 68 |
}, |
| 69 |
{ |
| 70 |
"include": "#keywords" |
| 71 |
}, |
| 72 |
{ |
| 73 |
"include": "#storage" |
| 74 |
}, |
| 75 |
{ |
| 76 |
"include": "#numbers" |
| 77 |
}, |
| 78 |
{ |
| 79 |
"include": "#strings" |
| 80 |
}, |
| 81 |
{ |
| 82 |
"include": "#types" |
| 83 |
}, |
| 84 |
{ |
| 85 |
"include": "#punctuations" |
| 86 |
}, |
| 87 |
{ |
| 88 |
"include": "#variable-assign" |
| 89 |
}, |
| 90 |
{ |
| 91 |
"include": "#function-decl" |
| 92 |
} |
| 93 |
], |
| 94 |
"repository": { |
| 95 |
"as-is": { |
| 96 |
"begin": "\\s+(as|is)\\s+", |
| 97 |
"beginCaptures": { |
| 98 |
"1": { |
| 99 |
"name": "keyword.$1.v" |
| 100 |
} |
| 101 |
}, |
| 102 |
"end": "([\\w.]*)", |
| 103 |
"endCaptures": { |
| 104 |
"1": { |
| 105 |
"name": "entity.name.alias.v" |
| 106 |
} |
| 107 |
} |
| 108 |
}, |
| 109 |
"assignment": { |
| 110 |
"name": "meta.definition.variable.v", |
| 111 |
"match": "\\s+((?:\\:|\\+|\\-|\\*|/|\\%|\\&|\\||\\^)?=)\\s+", |
| 112 |
"captures": { |
| 113 |
"1": { |
| 114 |
"patterns": [ |
| 115 |
{ |
| 116 |
"include": "#operators" |
| 117 |
} |
| 118 |
] |
| 119 |
} |
| 120 |
} |
| 121 |
}, |
| 122 |
"attributes": { |
| 123 |
"name": "meta.definition.attribute.v", |
| 124 |
"match": "^\\s*((\\[)(deprecated|unsafe|console|heap|manualfree|typedef|live|inline|flag|ref_only|direct_array_access|callconv)(\\]))", |
| 125 |
"captures": { |
| 126 |
"1": { |
| 127 |
"name": "meta.function.attribute.v" |
| 128 |
}, |
| 129 |
"2": { |
| 130 |
"name": "punctuation.definition.begin.bracket.square.v" |
| 131 |
}, |
| 132 |
"3": { |
| 133 |
"name": "storage.modifier.attribute.v" |
| 134 |
}, |
| 135 |
"4": { |
| 136 |
"name": "punctuation.definition.end.bracket.square.v" |
| 137 |
} |
| 138 |
} |
| 139 |
}, |
| 140 |
"variable-assign": { |
| 141 |
"match": "[a-zA-Z_]\\w*(?:,\\s*[a-zA-Z_]\\w*)*(?=\\s*(?:=|:=))", |
| 142 |
"captures": { |
| 143 |
"0": { |
| 144 |
"patterns": [ |
| 145 |
{ |
| 146 |
"match": "[a-zA-Z_]\\w*", |
| 147 |
"name": "variable.other.assignment.v" |
| 148 |
}, |
| 149 |
{ |
| 150 |
"include": "#punctuation" |
| 151 |
} |
| 152 |
] |
| 153 |
} |
| 154 |
} |
| 155 |
}, |
| 156 |
"module-decl": { |
| 157 |
"name": "meta.module.v", |
| 158 |
"begin": "^\\s*(module)\\s+", |
| 159 |
"beginCaptures": { |
| 160 |
"1": { |
| 161 |
"name": "keyword.module.v" |
| 162 |
} |
| 163 |
}, |
| 164 |
"end": "([\\w.]+)", |
| 165 |
"endCaptures": { |
| 166 |
"1": { |
| 167 |
"name": "entity.name.module.v" |
| 168 |
} |
| 169 |
} |
| 170 |
}, |
| 171 |
"import-decl": { |
| 172 |
"name": "meta.import.v", |
| 173 |
"begin": "^\\s*(import)\\s+", |
| 174 |
"beginCaptures": { |
| 175 |
"1": { |
| 176 |
"name": "keyword.import.v" |
| 177 |
} |
| 178 |
}, |
| 179 |
"end": "([\\w.]+)", |
| 180 |
"endCaptures": { |
| 181 |
"1": { |
| 182 |
"name": "entity.name.import.v" |
| 183 |
} |
| 184 |
} |
| 185 |
}, |
| 186 |
"hash-decl": { |
| 187 |
"name": "markup.bold.v", |
| 188 |
"begin": "^\\s*(#)", |
| 189 |
"end": "$" |
| 190 |
}, |
| 191 |
"brackets": { |
| 192 |
"patterns": [ |
| 193 |
{ |
| 194 |
"begin": "{", |
| 195 |
"beginCaptures": { |
| 196 |
"0": { |
| 197 |
"name": "punctuation.definition.bracket.curly.begin.v" |
| 198 |
} |
| 199 |
}, |
| 200 |
"end": "}", |
| 201 |
"endCaptures": { |
| 202 |
"0": { |
| 203 |
"name": "punctuation.definition.bracket.curly.end.v" |
| 204 |
} |
| 205 |
}, |
| 206 |
"patterns": [ |
| 207 |
{ |
| 208 |
"include": "$self" |
| 209 |
} |
| 210 |
] |
| 211 |
}, |
| 212 |
{ |
| 213 |
"begin": "\\(", |
| 214 |
"beginCaptures": { |
| 215 |
"0": { |
| 216 |
"name": "punctuation.definition.bracket.round.begin.v" |
| 217 |
} |
| 218 |
}, |
| 219 |
"end": "\\)", |
| 220 |
"endCaptures": { |
| 221 |
"0": { |
| 222 |
"name": "punctuation.definition.bracket.round.end.v" |
| 223 |
} |
| 224 |
}, |
| 225 |
"patterns": [ |
| 226 |
{ |
| 227 |
"include": "$self" |
| 228 |
} |
| 229 |
] |
| 230 |
}, |
| 231 |
{ |
| 232 |
"begin": "\\[", |
| 233 |
"beginCaptures": { |
| 234 |
"0": { |
| 235 |
"name": "punctuation.definition.bracket.square.begin.v" |
| 236 |
} |
| 237 |
}, |
| 238 |
"end": "\\]", |
| 239 |
"endCaptures": { |
| 240 |
"0": { |
| 241 |
"name": "punctuation.definition.bracket.square.end.v" |
| 242 |
} |
| 243 |
}, |
| 244 |
"patterns": [ |
| 245 |
{ |
| 246 |
"include": "$self" |
| 247 |
} |
| 248 |
] |
| 249 |
} |
| 250 |
] |
| 251 |
}, |
| 252 |
"builtin-fix": { |
| 253 |
"patterns": [ |
| 254 |
{ |
| 255 |
"patterns": [ |
| 256 |
{ |
| 257 |
"name": "storage.modifier.v", |
| 258 |
"match": "(const)(?=\\s*\\()" |
| 259 |
}, |
| 260 |
{ |
| 261 |
"name": "keyword.$1.v", |
| 262 |
"match": "\\b(fn|type|enum|struct|union|interface|map|assert|sizeof|typeof|__offsetof)\\b(?=\\s*\\()" |
| 263 |
} |
| 264 |
] |
| 265 |
}, |
| 266 |
{ |
| 267 |
"patterns": [ |
| 268 |
{ |
| 269 |
"name": "keyword.control.v", |
| 270 |
"match": "(\\$if|\\$else)(?=\\s*\\()" |
| 271 |
}, |
| 272 |
{ |
| 273 |
"name": "keyword.control.v", |
| 274 |
"match": "\\b(as|in|is|or|break|continue|default|unsafe|match|if|else|for|go|spawn|goto|defer|return|shared|select|rlock|lock|atomic|asm)\\b(?=\\s*\\()" |
| 275 |
} |
| 276 |
] |
| 277 |
}, |
| 278 |
{ |
| 279 |
"patterns": [ |
| 280 |
{ |
| 281 |
"match": "(?<!.)(i?(?:8|16|nt|64|128)|u?(?:16|32|64|128)|f?(?:32|64))(?=\\s*\\()", |
| 282 |
"captures": { |
| 283 |
"1": { |
| 284 |
"name": "storage.type.numeric.v" |
| 285 |
} |
| 286 |
}, |
| 287 |
"name": "meta.expr.numeric.cast.v" |
| 288 |
}, |
| 289 |
{ |
| 290 |
"match": "(bool|byte|byteptr|charptr|voidptr|string|rune|size_t|[ui]size)(?=\\s*\\()", |
| 291 |
"captures": { |
| 292 |
"1": { |
| 293 |
"name": "storage.type.$1.v" |
| 294 |
} |
| 295 |
}, |
| 296 |
"name": "meta.expr.bool.cast.v" |
| 297 |
} |
| 298 |
] |
| 299 |
} |
| 300 |
] |
| 301 |
}, |
| 302 |
"comments": { |
| 303 |
"patterns": [ |
| 304 |
{ |
| 305 |
"name": "comment.block.documentation.v", |
| 306 |
"begin": "/\\*", |
| 307 |
"beginCaptures": { |
| 308 |
"0": { |
| 309 |
"name": "punctuation.definition.comment.begin.v" |
| 310 |
} |
| 311 |
}, |
| 312 |
"end": "\\*/", |
| 313 |
"endCaptures": { |
| 314 |
"0": { |
| 315 |
"name": "punctuation.definition.comment.end.v" |
| 316 |
} |
| 317 |
}, |
| 318 |
"patterns": [ |
| 319 |
{ |
| 320 |
"include": "#comments" |
| 321 |
} |
| 322 |
] |
| 323 |
}, |
| 324 |
{ |
| 325 |
"name": "comment.line.double-slash.v", |
| 326 |
"begin": "//", |
| 327 |
"beginCaptures": { |
| 328 |
"0": { |
| 329 |
"name": "punctuation.definition.comment.begin.v" |
| 330 |
} |
| 331 |
}, |
| 332 |
"end": "$" |
| 333 |
} |
| 334 |
] |
| 335 |
}, |
| 336 |
"constants": { |
| 337 |
"name": "constant.language.v", |
| 338 |
"match": "\\b(true|false|none)\\b" |
| 339 |
}, |
| 340 |
"generic": { |
| 341 |
"patterns": [ |
| 342 |
{ |
| 343 |
"name": "meta.definition.generic.v", |
| 344 |
"match": "(?<=[\\w\\s+])(\\<)(\\w+)(\\>)", |
| 345 |
"captures": { |
| 346 |
"1": { |
| 347 |
"name": "punctuation.definition.bracket.angle.begin.v" |
| 348 |
}, |
| 349 |
"2": { |
| 350 |
"patterns": [ |
| 351 |
{ |
| 352 |
"include": "#illegal-name" |
| 353 |
}, |
| 354 |
{ |
| 355 |
"match": "\\w+", |
| 356 |
"name": "entity.name.generic.v" |
| 357 |
} |
| 358 |
] |
| 359 |
}, |
| 360 |
"3": { |
| 361 |
"name": "punctuation.definition.bracket.angle.end.v" |
| 362 |
} |
| 363 |
} |
| 364 |
} |
| 365 |
] |
| 366 |
}, |
| 367 |
"function-decl": { |
| 368 |
"name": "meta.definition.function.v", |
| 369 |
"match": "^(\\bpub\\b\\s+)?(\\bfn\\b)\\s+(?:\\([^\\)]+\\)\\s+)?(?:(?:C\\.)?)(\\w+)\\s*((?<=[\\w\\s+])(\\<)(\\w+)(\\>))?", |
| 370 |
"captures": { |
| 371 |
"1": { |
| 372 |
"name": "storage.modifier.v" |
| 373 |
}, |
| 374 |
"2": { |
| 375 |
"name": "keyword.fn.v" |
| 376 |
}, |
| 377 |
"3": { |
| 378 |
"name": "entity.name.function.v" |
| 379 |
}, |
| 380 |
"4": { |
| 381 |
"patterns": [ |
| 382 |
{ |
| 383 |
"include": "#generic" |
| 384 |
} |
| 385 |
] |
| 386 |
} |
| 387 |
} |
| 388 |
}, |
| 389 |
"function-extend-decl": { |
| 390 |
"name": "meta.definition.function.v", |
| 391 |
"match": "^\\s*(pub)?\\s*(fn)\\s*(\\()([^\\)]*)(\\))\\s*(?:(?:C\\.)?)(\\w+)\\s*((?<=[\\w\\s+])(\\<)(\\w+)(\\>))?", |
| 392 |
"captures": { |
| 393 |
"1": { |
| 394 |
"name": "storage.modifier.v" |
| 395 |
}, |
| 396 |
"2": { |
| 397 |
"name": "keyword.fn.v" |
| 398 |
}, |
| 399 |
"3": { |
| 400 |
"name": "punctuation.definition.bracket.round.begin.v" |
| 401 |
}, |
| 402 |
"4": { |
| 403 |
"patterns": [ |
| 404 |
{ |
| 405 |
"include": "#brackets" |
| 406 |
}, |
| 407 |
{ |
| 408 |
"include": "#storage" |
| 409 |
}, |
| 410 |
{ |
| 411 |
"include": "#generic" |
| 412 |
}, |
| 413 |
{ |
| 414 |
"include": "#types" |
| 415 |
}, |
| 416 |
{ |
| 417 |
"include": "#punctuation" |
| 418 |
} |
| 419 |
] |
| 420 |
}, |
| 421 |
"5": { |
| 422 |
"name": "punctuation.definition.bracket.round.end.v" |
| 423 |
}, |
| 424 |
"6": { |
| 425 |
"patterns": [ |
| 426 |
{ |
| 427 |
"include": "#illegal-name" |
| 428 |
}, |
| 429 |
{ |
| 430 |
"match": "\\w+", |
| 431 |
"name": "entity.name.function.v" |
| 432 |
} |
| 433 |
] |
| 434 |
}, |
| 435 |
"7": { |
| 436 |
"patterns": [ |
| 437 |
{ |
| 438 |
"include": "#generic" |
| 439 |
} |
| 440 |
] |
| 441 |
} |
| 442 |
} |
| 443 |
}, |
| 444 |
"function-limited-overload-decl": { |
| 445 |
"name": "meta.definition.function.v", |
| 446 |
"match": "^\\s*(pub)?\\s*(fn)\\s*(\\()([^\\)]*)(\\))\\s*([\\+\\-\\*\\/])?\\s*(\\()([^\\)]*)(\\))\\s*(?:(?:C\\.)?)(\\w+)", |
| 447 |
"captures": { |
| 448 |
"1": { |
| 449 |
"name": "storage.modifier.v" |
| 450 |
}, |
| 451 |
"2": { |
| 452 |
"name": "keyword.fn.v" |
| 453 |
}, |
| 454 |
"3": { |
| 455 |
"name": "punctuation.definition.bracket.round.begin.v" |
| 456 |
}, |
| 457 |
"4": { |
| 458 |
"patterns": [ |
| 459 |
{ |
| 460 |
"include": "#brackets" |
| 461 |
}, |
| 462 |
{ |
| 463 |
"include": "#storage" |
| 464 |
}, |
| 465 |
{ |
| 466 |
"include": "#generic" |
| 467 |
}, |
| 468 |
{ |
| 469 |
"include": "#types" |
| 470 |
}, |
| 471 |
{ |
| 472 |
"include": "#punctuation" |
| 473 |
} |
| 474 |
] |
| 475 |
}, |
| 476 |
"5": { |
| 477 |
"name": "punctuation.definition.bracket.round.end.v" |
| 478 |
}, |
| 479 |
"6": { |
| 480 |
"patterns": [ |
| 481 |
{ |
| 482 |
"include": "#operators" |
| 483 |
} |
| 484 |
] |
| 485 |
}, |
| 486 |
"7": { |
| 487 |
"name": "punctuation.definition.bracket.round.begin.v" |
| 488 |
}, |
| 489 |
"8": { |
| 490 |
"patterns": [ |
| 491 |
{ |
| 492 |
"include": "#brackets" |
| 493 |
}, |
| 494 |
{ |
| 495 |
"include": "#storage" |
| 496 |
}, |
| 497 |
{ |
| 498 |
"include": "#generic" |
| 499 |
}, |
| 500 |
{ |
| 501 |
"include": "#types" |
| 502 |
}, |
| 503 |
{ |
| 504 |
"include": "#punctuation" |
| 505 |
} |
| 506 |
] |
| 507 |
}, |
| 508 |
"9": { |
| 509 |
"name": "punctuation.definition.bracket.round.end.v" |
| 510 |
}, |
| 511 |
"10": { |
| 512 |
"patterns": [ |
| 513 |
{ |
| 514 |
"include": "#illegal-name" |
| 515 |
}, |
| 516 |
{ |
| 517 |
"match": "\\w+", |
| 518 |
"name": "entity.name.function.v" |
| 519 |
} |
| 520 |
] |
| 521 |
} |
| 522 |
} |
| 523 |
}, |
| 524 |
"function-exist": { |
| 525 |
"name": "meta.support.function.v", |
| 526 |
"match": "(\\w+)((?<=[\\w\\s+])(\\<)(\\w+)(\\>))?(?=\\s*\\()", |
| 527 |
"captures": { |
| 528 |
"0": { |
| 529 |
"name": "meta.function.call.v" |
| 530 |
}, |
| 531 |
"1": { |
| 532 |
"patterns": [ |
| 533 |
{ |
| 534 |
"include": "#illegal-name" |
| 535 |
}, |
| 536 |
{ |
| 537 |
"match": "\\w+", |
| 538 |
"name": "entity.name.function.v" |
| 539 |
} |
| 540 |
] |
| 541 |
}, |
| 542 |
"2": { |
| 543 |
"patterns": [ |
| 544 |
{ |
| 545 |
"include": "#generic" |
| 546 |
} |
| 547 |
] |
| 548 |
} |
| 549 |
} |
| 550 |
}, |
| 551 |
"type": { |
| 552 |
"name": "meta.definition.type.v", |
| 553 |
"match": "^\\s*(?:(pub)?\\s+)?(type)\\s+(\\w*)\\s+(?:\\w+\\.+)?(\\w*)", |
| 554 |
"captures": { |
| 555 |
"1": { |
| 556 |
"name": "storage.modifier.$1.v" |
| 557 |
}, |
| 558 |
"2": { |
| 559 |
"name": "storage.type.type.v" |
| 560 |
}, |
| 561 |
"3": { |
| 562 |
"patterns": [ |
| 563 |
{ |
| 564 |
"include": "#illegal-name" |
| 565 |
}, |
| 566 |
{ |
| 567 |
"include": "#types" |
| 568 |
}, |
| 569 |
{ |
| 570 |
"name": "entity.name.type.v", |
| 571 |
"match": "\\w+" |
| 572 |
} |
| 573 |
] |
| 574 |
}, |
| 575 |
"4": { |
| 576 |
"patterns": [ |
| 577 |
{ |
| 578 |
"include": "#illegal-name" |
| 579 |
}, |
| 580 |
{ |
| 581 |
"include": "#types" |
| 582 |
}, |
| 583 |
{ |
| 584 |
"name": "entity.name.type.v", |
| 585 |
"match": "\\w+" |
| 586 |
} |
| 587 |
] |
| 588 |
} |
| 589 |
} |
| 590 |
}, |
| 591 |
"enum": { |
| 592 |
"name": "meta.definition.enum.v", |
| 593 |
"match": "^\\s*(?:(pub)?\\s+)?(enum)\\s+(?:\\w+\\.)?(\\w*)", |
| 594 |
"captures": { |
| 595 |
"1": { |
| 596 |
"name": "storage.modifier.$1.v" |
| 597 |
}, |
| 598 |
"2": { |
| 599 |
"name": "storage.type.enum.v" |
| 600 |
}, |
| 601 |
"3": { |
| 602 |
"name": "entity.name.enum.v" |
| 603 |
} |
| 604 |
} |
| 605 |
}, |
| 606 |
"interface": { |
| 607 |
"name": "meta.definition.interface.v", |
| 608 |
"match": "^\\s*(?:(pub)?\\s+)?(interface)\\s+(\\w*)", |
| 609 |
"captures": { |
| 610 |
"1": { |
| 611 |
"name": "storage.modifier.$1.v" |
| 612 |
}, |
| 613 |
"2": { |
| 614 |
"name": "keyword.interface.v" |
| 615 |
}, |
| 616 |
"3": { |
| 617 |
"patterns": [ |
| 618 |
{ |
| 619 |
"include": "#illegal-name" |
| 620 |
}, |
| 621 |
{ |
| 622 |
"name": "entity.name.interface.v", |
| 623 |
"match": "\\w+" |
| 624 |
} |
| 625 |
] |
| 626 |
} |
| 627 |
} |
| 628 |
}, |
| 629 |
"struct": { |
| 630 |
"patterns": [ |
| 631 |
{ |
| 632 |
"name": "meta.definition.struct.v", |
| 633 |
"begin": "^\\s*(?:(mut|pub(?:\\s+mut)?|__global)\\s+)?(struct|union)\\s+([\\w.]+)\\s*|({)", |
| 634 |
"beginCaptures": { |
| 635 |
"1": { |
| 636 |
"name": "storage.modifier.$1.v" |
| 637 |
}, |
| 638 |
"2": { |
| 639 |
"name": "storage.type.struct.v" |
| 640 |
}, |
| 641 |
"3": { |
| 642 |
"name": "entity.name.type.v" |
| 643 |
}, |
| 644 |
"4": { |
| 645 |
"name": "punctuation.definition.bracket.curly.begin.v" |
| 646 |
} |
| 647 |
}, |
| 648 |
"end": "\\s*|(})", |
| 649 |
"endCaptures": { |
| 650 |
"1": { |
| 651 |
"name": "punctuation.definition.bracket.curly.end.v" |
| 652 |
} |
| 653 |
}, |
| 654 |
"patterns": [ |
| 655 |
{ |
| 656 |
"include": "#struct-access-modifier" |
| 657 |
}, |
| 658 |
{ |
| 659 |
"match": "\\b(\\w+)\\s+([\\w\\[\\]\\*&.]+)(?:\\s*(=)\\s*((?:.(?=$|//|/\\*))*+))?", |
| 660 |
"captures": { |
| 661 |
"1": { |
| 662 |
"name": "variable.other.property.v" |
| 663 |
}, |
| 664 |
"2": { |
| 665 |
"patterns": [ |
| 666 |
{ |
| 667 |
"include": "#numbers" |
| 668 |
}, |
| 669 |
{ |
| 670 |
"include": "#brackets" |
| 671 |
}, |
| 672 |
{ |
| 673 |
"include": "#types" |
| 674 |
}, |
| 675 |
{ |
| 676 |
"match": "\\w+", |
| 677 |
"name": "storage.type.other.v" |
| 678 |
} |
| 679 |
] |
| 680 |
}, |
| 681 |
"3": { |
| 682 |
"name": "keyword.operator.assignment.v" |
| 683 |
}, |
| 684 |
"4": { |
| 685 |
"patterns": [ |
| 686 |
{ |
| 687 |
"include": "$self" |
| 688 |
} |
| 689 |
] |
| 690 |
} |
| 691 |
} |
| 692 |
}, |
| 693 |
{ |
| 694 |
"include": "#types" |
| 695 |
}, |
| 696 |
{ |
| 697 |
"include": "$self" |
| 698 |
} |
| 699 |
] |
| 700 |
}, |
| 701 |
{ |
| 702 |
"name": "meta.definition.struct.v", |
| 703 |
"match": "^\\s*(?:(mut|pub(?:\\s+mut)?|__global))\\s+?(struct)\\s+(?:\\s+([\\w.]+))?", |
| 704 |
"captures": { |
| 705 |
"1": { |
| 706 |
"name": "storage.modifier.$1.v" |
| 707 |
}, |
| 708 |
"2": { |
| 709 |
"name": "storage.type.struct.v" |
| 710 |
}, |
| 711 |
"3": { |
| 712 |
"name": "entity.name.struct.v" |
| 713 |
} |
| 714 |
} |
| 715 |
} |
| 716 |
] |
| 717 |
}, |
| 718 |
"struct-access-modifier": { |
| 719 |
"match": "(?<=\\s|^)(mut|pub(?:\\s+mut)?|__global)(:|\\b)", |
| 720 |
"captures": { |
| 721 |
"1": { |
| 722 |
"name": "storage.modifier.$1.v" |
| 723 |
}, |
| 724 |
"2": { |
| 725 |
"name": "punctuation.separator.struct.key-value.v" |
| 726 |
} |
| 727 |
} |
| 728 |
}, |
| 729 |
"punctuation": { |
| 730 |
"patterns": [ |
| 731 |
{ |
| 732 |
"name": "punctuation.delimiter.period.dot.v", |
| 733 |
"match": "\\." |
| 734 |
}, |
| 735 |
{ |
| 736 |
"name": "punctuation.delimiter.comma.v", |
| 737 |
"match": "," |
| 738 |
}, |
| 739 |
{ |
| 740 |
"name": "punctuation.separator.key-value.colon.v", |
| 741 |
"match": ":" |
| 742 |
}, |
| 743 |
{ |
| 744 |
"name": "punctuation.definition.other.semicolon.v", |
| 745 |
"match": ";" |
| 746 |
}, |
| 747 |
{ |
| 748 |
"name": "punctuation.definition.other.questionmark.v", |
| 749 |
"match": "\\?" |
| 750 |
}, |
| 751 |
{ |
| 752 |
"name": "punctuation.hash.v", |
| 753 |
"match": "#" |
| 754 |
} |
| 755 |
] |
| 756 |
}, |
| 757 |
"keywords": { |
| 758 |
"patterns": [ |
| 759 |
{ |
| 760 |
"name": "keyword.control.v", |
| 761 |
"match": "(\\$if|\\$else)" |
| 762 |
}, |
| 763 |
{ |
| 764 |
"name": "keyword.control.v", |
| 765 |
"match": "(?<!@)\\b(as|it|is|in|or|break|continue|default|unsafe|match|if|else|for|go|spawn|goto|defer|return|shared|select|rlock|lock|atomic|asm)\\b" |
| 766 |
}, |
| 767 |
{ |
| 768 |
"name": "keyword.$1.v", |
| 769 |
"match": "(?<!@)\\b(fn|type|typeof|enum|struct|interface|map|assert|sizeof|__offsetof)\\b" |
| 770 |
} |
| 771 |
] |
| 772 |
}, |
| 773 |
"storage": { |
| 774 |
"name": "storage.modifier.v", |
| 775 |
"match": "\\b(const|mut|pub)\\b" |
| 776 |
}, |
| 777 |
"types": { |
| 778 |
"patterns": [ |
| 779 |
{ |
| 780 |
"name": "storage.type.numeric.v", |
| 781 |
"match": "(?<!\\.)\\b(i(8|16|nt|64|128)|u(8|16|32|64|128)|f(32|64))\\b" |
| 782 |
}, |
| 783 |
{ |
| 784 |
"name": "storage.type.$1.v", |
| 785 |
"match": "(?<!\\.)\\b(bool|byte|byteptr|charptr|voidptr|string|ustring|rune)\\b" |
| 786 |
} |
| 787 |
] |
| 788 |
}, |
| 789 |
"operators": { |
| 790 |
"patterns": [ |
| 791 |
{ |
| 792 |
"name": "keyword.operator.arithmetic.v", |
| 793 |
"match": "(\\+|\\-|\\*|\\/|\\%|\\+\\+|\\-\\-|\\>\\>|\\<\\<)" |
| 794 |
}, |
| 795 |
{ |
| 796 |
"name": "keyword.operator.relation.v", |
| 797 |
"match": "(\\=\\=|\\!\\=|\\>|\\<|\\>\\=|\\<\\=)" |
| 798 |
}, |
| 799 |
{ |
| 800 |
"name": "keyword.operator.assignment.v", |
| 801 |
"match": "(\\:\\=|\\=|\\+\\=|\\-\\=|\\*\\=|\\/\\=|\\%\\=|\\&\\=|\\|\\=|\\^\\=|\\~\\=|\\&\\&\\=|\\|\\|\\=|\\>\\>\\=|\\<\\<\\=)" |
| 802 |
}, |
| 803 |
{ |
| 804 |
"name": "keyword.operator.bitwise.v", |
| 805 |
"match": "(\\&|\\||\\^|\\~|<(?!<)|>(?!>))" |
| 806 |
}, |
| 807 |
{ |
| 808 |
"name": "keyword.operator.logical.v", |
| 809 |
"match": "(\\&\\&|\\|\\||\\!)" |
| 810 |
}, |
| 811 |
{ |
| 812 |
"name": "keyword.operator.optional.v", |
| 813 |
"match": "\\?" |
| 814 |
} |
| 815 |
] |
| 816 |
}, |
| 817 |
"numbers": { |
| 818 |
"patterns": [ |
| 819 |
{ |
| 820 |
"name": "constant.numeric.exponential.v", |
| 821 |
"match": "([0-9]+(_?))+(\\.)([0-9]+[eE][-+]?[0-9]+)" |
| 822 |
}, |
| 823 |
{ |
| 824 |
"name": "constant.numeric.float.v", |
| 825 |
"match": "([0-9]+(_?))+(\\.)([0-9]+)" |
| 826 |
}, |
| 827 |
{ |
| 828 |
"name": "constant.numeric.binary.v", |
| 829 |
"match": "(?:0b)(?:(?:[0-1]+)(?:_?))+" |
| 830 |
}, |
| 831 |
{ |
| 832 |
"name": "constant.numeric.octal.v", |
| 833 |
"match": "(?:0o)(?:(?:[0-7]+)(?:_?))+" |
| 834 |
}, |
| 835 |
{ |
| 836 |
"name": "constant.numeric.hex.v", |
| 837 |
"match": "(?:0x)(?:(?:[0-9a-fA-F]+)(?:_?))+" |
| 838 |
}, |
| 839 |
{ |
| 840 |
"name": "constant.numeric.integer.v", |
| 841 |
"match": "(?:(?:[0-9]+)(?:[_]?))+" |
| 842 |
} |
| 843 |
] |
| 844 |
}, |
| 845 |
"punctuations": { |
| 846 |
"patterns": [ |
| 847 |
{ |
| 848 |
"name": "punctuation.accessor.v", |
| 849 |
"match": "(?:\\.)" |
| 850 |
}, |
| 851 |
{ |
| 852 |
"name": "punctuation.separator.comma.v", |
| 853 |
"match": "(?:,)" |
| 854 |
} |
| 855 |
] |
| 856 |
}, |
| 857 |
"strings": { |
| 858 |
"patterns": [ |
| 859 |
{ |
| 860 |
"begin": "`", |
| 861 |
"end": "`", |
| 862 |
"name": "string.quoted.rune.v", |
| 863 |
"patterns": [ |
| 864 |
{ |
| 865 |
"include": "#string-escaped-char" |
| 866 |
}, |
| 867 |
{ |
| 868 |
"include": "#string-interpolation" |
| 869 |
}, |
| 870 |
{ |
| 871 |
"include": "#string-placeholder" |
| 872 |
} |
| 873 |
] |
| 874 |
}, |
| 875 |
{ |
| 876 |
"begin": "(r)'", |
| 877 |
"beginCaptures": { |
| 878 |
"1": { |
| 879 |
"name": "storage.type.string.v" |
| 880 |
} |
| 881 |
}, |
| 882 |
"end": "'", |
| 883 |
"name": "string.quoted.raw.v", |
| 884 |
"patterns": [ |
| 885 |
{ |
| 886 |
"include": "#string-interpolation" |
| 887 |
}, |
| 888 |
{ |
| 889 |
"include": "#string-placeholder" |
| 890 |
} |
| 891 |
] |
| 892 |
}, |
| 893 |
{ |
| 894 |
"begin": "(r)\"", |
| 895 |
"beginCaptures": { |
| 896 |
"1": { |
| 897 |
"name": "storage.type.string.v" |
| 898 |
} |
| 899 |
}, |
| 900 |
"end": "\"", |
| 901 |
"name": "string.quoted.raw.v", |
| 902 |
"patterns": [ |
| 903 |
{ |
| 904 |
"include": "#string-interpolation" |
| 905 |
}, |
| 906 |
{ |
| 907 |
"include": "#string-placeholder" |
| 908 |
} |
| 909 |
] |
| 910 |
}, |
| 911 |
{ |
| 912 |
"begin": "(c?)'", |
| 913 |
"beginCaptures": { |
| 914 |
"1": { |
| 915 |
"name": "storage.type.string.v" |
| 916 |
} |
| 917 |
}, |
| 918 |
"end": "'", |
| 919 |
"name": "string.quoted.v", |
| 920 |
"patterns": [ |
| 921 |
{ |
| 922 |
"include": "#string-escaped-char" |
| 923 |
}, |
| 924 |
{ |
| 925 |
"include": "#string-interpolation" |
| 926 |
}, |
| 927 |
{ |
| 928 |
"include": "#string-placeholder" |
| 929 |
} |
| 930 |
] |
| 931 |
}, |
| 932 |
{ |
| 933 |
"begin": "(c?)\"", |
| 934 |
"beginCaptures": { |
| 935 |
"1": { |
| 936 |
"name": "storage.type.string.v" |
| 937 |
} |
| 938 |
}, |
| 939 |
"end": "\"", |
| 940 |
"name": "string.quoted.v", |
| 941 |
"patterns": [ |
| 942 |
{ |
| 943 |
"include": "#string-escaped-char" |
| 944 |
}, |
| 945 |
{ |
| 946 |
"include": "#string-interpolation" |
| 947 |
}, |
| 948 |
{ |
| 949 |
"include": "#string-placeholder" |
| 950 |
} |
| 951 |
] |
| 952 |
} |
| 953 |
] |
| 954 |
}, |
| 955 |
"string-escaped-char": { |
| 956 |
"patterns": [ |
| 957 |
{ |
| 958 |
"name": "constant.character.escape.v", |
| 959 |
"match": "\\\\([0-7]{3}|[\\$abfnrtv\\\\'\"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})" |
| 960 |
}, |
| 961 |
{ |
| 962 |
"name": "invalid.illegal.unknown-escape.v", |
| 963 |
"match": "\\\\[^0-7\\$xuUabfnrtv\\'\"]" |
| 964 |
} |
| 965 |
] |
| 966 |
}, |
| 967 |
"string-interpolation": { |
| 968 |
"name": "meta.string.interpolation.v", |
| 969 |
"match": "(\\$([\\w.]+|\\{.*?\\}))", |
| 970 |
"captures": { |
| 971 |
"1": { |
| 972 |
"patterns": [ |
| 973 |
{ |
| 974 |
"name": "invalid.illegal.v", |
| 975 |
"match": "\\$\\d[\\.\\w]+" |
| 976 |
}, |
| 977 |
{ |
| 978 |
"name": "variable.other.interpolated.v", |
| 979 |
"match": "\\$([\\.\\w]+|\\{.*?\\})" |
| 980 |
} |
| 981 |
] |
| 982 |
} |
| 983 |
} |
| 984 |
}, |
| 985 |
"string-placeholder": { |
| 986 |
"match": "%(\\[\\d+\\])?([\\+#\\-0\\x20]{,2}((\\d+|\\*)?(\\.?(\\d+|\\*|(\\[\\d+\\])\\*?)?(\\[\\d+\\])?)?))?[vT%tbcdoqxXUbeEfFgGsp]", |
| 987 |
"name": "constant.other.placeholder.v" |
| 988 |
}, |
| 989 |
"illegal-name": { |
| 990 |
"match": "\\d\\w+", |
| 991 |
"name": "invalid.illegal.v" |
| 992 |
} |
| 993 |
} |
| 994 |
} |
| 995 |
|