View raw

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