main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.7 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | 'use strict'
|
---|
| 2 |
|
---|
| 3 | module.exports = nix
|
---|
| 4 | nix.displayName = 'nix'
|
---|
| 5 | nix.aliases = []
|
---|
| 6 | function nix(Prism) {
|
---|
| 7 | Prism.languages.nix = {
|
---|
| 8 | comment: {
|
---|
| 9 | pattern: /\/\*[\s\S]*?\*\/|#.*/,
|
---|
| 10 | greedy: true
|
---|
| 11 | },
|
---|
| 12 | string: {
|
---|
| 13 | pattern: /"(?:[^"\\]|\\[\s\S])*"|''(?:(?!'')[\s\S]|''(?:'|\\|\$\{))*''/,
|
---|
| 14 | greedy: true,
|
---|
| 15 | inside: {
|
---|
| 16 | interpolation: {
|
---|
| 17 | // The lookbehind ensures the ${} is not preceded by \ or ''
|
---|
| 18 | pattern: /(^|(?:^|(?!'').)[^\\])\$\{(?:[^{}]|\{[^}]*\})*\}/,
|
---|
| 19 | lookbehind: true,
|
---|
| 20 | inside: null // see below
|
---|
| 21 | }
|
---|
| 22 | }
|
---|
| 23 | },
|
---|
| 24 | url: [
|
---|
| 25 | /\b(?:[a-z]{3,7}:\/\/)[\w\-+%~\/.:#=?&]+/,
|
---|
| 26 | {
|
---|
| 27 | pattern:
|
---|
| 28 | /([^\/])(?:[\w\-+%~.:#=?&]*(?!\/\/)[\w\-+%~\/.:#=?&])?(?!\/\/)\/[\w\-+%~\/.:#=?&]*/,
|
---|
| 29 | lookbehind: true
|
---|
| 30 | }
|
---|
| 31 | ],
|
---|
| 32 | antiquotation: {
|
---|
| 33 | pattern: /\$(?=\{)/,
|
---|
| 34 | alias: 'important'
|
---|
| 35 | },
|
---|
| 36 | number: /\b\d+\b/,
|
---|
| 37 | keyword: /\b(?:assert|builtins|else|if|in|inherit|let|null|or|then|with)\b/,
|
---|
| 38 | function:
|
---|
| 39 | /\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/,
|
---|
| 40 | boolean: /\b(?:false|true)\b/,
|
---|
| 41 | operator: /[=!<>]=?|\+\+?|\|\||&&|\/\/|->?|[?@]/,
|
---|
| 42 | punctuation: /[{}()[\].,:;]/
|
---|
| 43 | }
|
---|
| 44 | Prism.languages.nix.string.inside.interpolation.inside = Prism.languages.nix
|
---|
| 45 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.