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