main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Line | |
---|
1 | Prism.languages.nix = {
|
---|
2 | 'comment': {
|
---|
3 | pattern: /\/\*[\s\S]*?\*\/|#.*/,
|
---|
4 | greedy: true
|
---|
5 | },
|
---|
6 | 'string': {
|
---|
7 | pattern: /"(?:[^"\\]|\\[\s\S])*"|''(?:(?!'')[\s\S]|''(?:'|\\|\$\{))*''/,
|
---|
8 | greedy: true,
|
---|
9 | inside: {
|
---|
10 | 'interpolation': {
|
---|
11 | // The lookbehind ensures the ${} is not preceded by \ or ''
|
---|
12 | pattern: /(^|(?:^|(?!'').)[^\\])\$\{(?:[^{}]|\{[^}]*\})*\}/,
|
---|
13 | lookbehind: true,
|
---|
14 | inside: null // see below
|
---|
15 | }
|
---|
16 | }
|
---|
17 | },
|
---|
18 | 'url': [
|
---|
19 | /\b(?:[a-z]{3,7}:\/\/)[\w\-+%~\/.:#=?&]+/,
|
---|
20 | {
|
---|
21 | pattern: /([^\/])(?:[\w\-+%~.:#=?&]*(?!\/\/)[\w\-+%~\/.:#=?&])?(?!\/\/)\/[\w\-+%~\/.:#=?&]*/,
|
---|
22 | lookbehind: true
|
---|
23 | }
|
---|
24 | ],
|
---|
25 | 'antiquotation': {
|
---|
26 | pattern: /\$(?=\{)/,
|
---|
27 | alias: 'important'
|
---|
28 | },
|
---|
29 | 'number': /\b\d+\b/,
|
---|
30 | 'keyword': /\b(?:assert|builtins|else|if|in|inherit|let|null|or|then|with)\b/,
|
---|
31 | 'function': /\b(?:abort|add|all|any|attrNames|attrValues|baseNameOf|compareVersions|concatLists|currentSystem|deepSeq|derivation|dirOf|div|elem(?:At)?|fetch(?:Tarball|url)|filter(?:Source)?|fromJSON|genList|getAttr|getEnv|hasAttr|hashString|head|import|intersectAttrs|is(?:Attrs|Bool|Function|Int|List|Null|String)|length|lessThan|listToAttrs|map|mul|parseDrvName|pathExists|read(?:Dir|File)|removeAttrs|replaceStrings|seq|sort|stringLength|sub(?:string)?|tail|throw|to(?:File|JSON|Path|String|XML)|trace|typeOf)\b|\bfoldl'\B/,
|
---|
32 | 'boolean': /\b(?:false|true)\b/,
|
---|
33 | 'operator': /[=!<>]=?|\+\+?|\|\||&&|\/\/|->?|[?@]/,
|
---|
34 | 'punctuation': /[{}()[\].,:;]/
|
---|
35 | };
|
---|
36 |
|
---|
37 | Prism.languages.nix.string.inside.interpolation.inside = Prism.languages.nix;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.