Module 246519

3,352 characters · in b03eb3ae7d63aaed.js
Dependencies
Required by (1)
Lazily required by (0)none
Requires (0)none
Lazily requires (0)none
Source Raw
function(e){e.exports=function(e){let t=e.regex,a={keyword:["assert","else","if","in","inherit","let","or","rec","then","with"],literal:["true","false","null"],built_in:["abort","baseNameOf","builtins","derivation","derivationStrict","dirOf","fetchGit","fetchMercurial","fetchTarball","fetchTree","fromTOML","import","isNull","map","placeholder","removeAttrs","scopedImport","throw","toString"]},n={scope:"built_in",match:t.either(...["abort","add","addDrvOutputDependencies","addErrorContext","all","any","appendContext","attrNames","attrValues","baseNameOf","bitAnd","bitOr","bitXor","break","builtins","catAttrs","ceil","compareVersions","concatLists","concatMap","concatStringsSep","convertHash","currentSystem","currentTime","deepSeq","derivation","derivationStrict","dirOf","div","elem","elemAt","false","fetchGit","fetchMercurial","fetchTarball","fetchTree","fetchurl","filter","filterSource","findFile","flakeRefToString","floor","foldl'","fromJSON","fromTOML","functionArgs","genList","genericClosure","getAttr","getContext","getEnv","getFlake","groupBy","hasAttr","hasContext","hashFile","hashString","head","import","intersectAttrs","isAttrs","isBool","isFloat","isFunction","isInt","isList","isNull","isPath","isString","langVersion","length","lessThan","listToAttrs","map","mapAttrs","match","mul","nixPath","nixVersion","null","parseDrvName","parseFlakeRef","partition","path","pathExists","placeholder","readDir","readFile","readFileType","removeAttrs","replaceStrings","scopedImport","seq","sort","split","splitVersion","storeDir","storePath","stringLength","sub","substring","tail","throw","toFile","toJSON","toPath","toString","toXML","trace","traceVerbose","true","tryEval","typeOf","unsafeDiscardOutputDependency","unsafeDiscardStringContext","unsafeGetAttrPos","warn","zipAttrsWith"].map(e=>`builtins\\.${e}`)),relevance:10},r="[A-Za-z_][A-Za-z0-9_'-]*",i={scope:"symbol",match:RegExp(`<${r}(/${r})*>`)},o="[A-Za-z0-9_\\+\\.-]+",s={scope:"symbol",match:RegExp(`(\\.\\.|\\.|~)?/(${o})?(/${o})*(?=[\\s;])`)},l=t.either("==","=","\\+\\+","\\+","<=","<\\|","<",">=",">","->","//","/","!=","!","\\|\\|","\\|>","\\?","\\*","&&"),c={scope:"operator",match:t.concat(l,/(?!-)/),relevance:0},_={scope:"number",match:RegExp(`${e.NUMBER_RE}(?!-)`),relevance:0},d={variants:[{scope:"operator",beforeMatch:/\s/,begin:/-(?!>)/},{begin:[RegExp(`${e.NUMBER_RE}`),/-/,/(?!>)/],beginScope:{1:"number",2:"operator"}},{begin:[l,/-/,/(?!>)/],beginScope:{1:"operator",2:"operator"}}],relevance:0},m={beforeMatch:/(^|\{|;)\s*/,begin:RegExp(`${r}(\\.${r})*\\s*=(?!=)`),returnBegin:!0,relevance:0,contains:[{scope:"attr",match:RegExp(`${r}(\\.${r})*(?=\\s*=)`),relevance:.2}]},p={scope:"subst",begin:/\$\{/,end:/\}/,keywords:a},u={scope:"char.escape",match:/\\(?!\$)./},g={scope:"params",match:RegExp(`${r}\\s*:(?=\\s)`)},E=[_,e.HASH_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.COMMENT(/\/\*\*(?!\/)/,/\*\//,{subLanguage:"markdown",relevance:0}),n,{scope:"string",variants:[{begin:"''",end:"''",contains:[{scope:"char.escape",match:/''\$/},p,{scope:"char.escape",match:/'''/},u]},{begin:'"',end:'"',contains:[{scope:"char.escape",match:/\\\$/},p,u]}]},i,s,g,m,d,c];return p.contains=E,{name:"Nix",aliases:["nixos"],keywords:a,contains:E.concat([{scope:"meta.prompt",match:/^nix-repl>(?=\s)/,relevance:10},{scope:"meta",beforeMatch:/\s+/,begin:/:([a-z]+|\?)/}])}}}