main
Last change
on this file since 9293100 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | /*
|
---|
| 2 | Language: Nix
|
---|
| 3 | Author: Domen Kožar <domen@dev.si>
|
---|
| 4 | Description: Nix functional language
|
---|
| 5 | Website: http://nixos.org/nix
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | function nix(hljs) {
|
---|
| 9 | const NIX_KEYWORDS = {
|
---|
| 10 | keyword:
|
---|
| 11 | 'rec with let in inherit assert if else then',
|
---|
| 12 | literal:
|
---|
| 13 | 'true false or and null',
|
---|
| 14 | built_in:
|
---|
| 15 | 'import abort baseNameOf dirOf isNull builtins map removeAttrs throw ' +
|
---|
| 16 | 'toString derivation'
|
---|
| 17 | };
|
---|
| 18 | const ANTIQUOTE = {
|
---|
| 19 | className: 'subst',
|
---|
| 20 | begin: /\$\{/,
|
---|
| 21 | end: /\}/,
|
---|
| 22 | keywords: NIX_KEYWORDS
|
---|
| 23 | };
|
---|
| 24 | const ATTRS = {
|
---|
| 25 | begin: /[a-zA-Z0-9-_]+(\s*=)/,
|
---|
| 26 | returnBegin: true,
|
---|
| 27 | relevance: 0,
|
---|
| 28 | contains: [
|
---|
| 29 | {
|
---|
| 30 | className: 'attr',
|
---|
| 31 | begin: /\S+/
|
---|
| 32 | }
|
---|
| 33 | ]
|
---|
| 34 | };
|
---|
| 35 | const STRING = {
|
---|
| 36 | className: 'string',
|
---|
| 37 | contains: [ ANTIQUOTE ],
|
---|
| 38 | variants: [
|
---|
| 39 | {
|
---|
| 40 | begin: "''",
|
---|
| 41 | end: "''"
|
---|
| 42 | },
|
---|
| 43 | {
|
---|
| 44 | begin: '"',
|
---|
| 45 | end: '"'
|
---|
| 46 | }
|
---|
| 47 | ]
|
---|
| 48 | };
|
---|
| 49 | const EXPRESSIONS = [
|
---|
| 50 | hljs.NUMBER_MODE,
|
---|
| 51 | hljs.HASH_COMMENT_MODE,
|
---|
| 52 | hljs.C_BLOCK_COMMENT_MODE,
|
---|
| 53 | STRING,
|
---|
| 54 | ATTRS
|
---|
| 55 | ];
|
---|
| 56 | ANTIQUOTE.contains = EXPRESSIONS;
|
---|
| 57 | return {
|
---|
| 58 | name: 'Nix',
|
---|
| 59 | aliases: [ "nixos" ],
|
---|
| 60 | keywords: NIX_KEYWORDS,
|
---|
| 61 | contains: EXPRESSIONS
|
---|
| 62 | };
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | module.exports = nix;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.