aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorTimothy DeHerrera2021-06-10 01:07:24 +0000
committerBlaž Hrastnik2021-06-10 13:01:48 +0000
commitd8df10f2958f70ee84b7c78cb7ea00aa195bc1c5 (patch)
tree52100e46c10933c84547008e7f533c95e02aee96 /runtime
parent38073fd64c1d277b19442ed5e802a853e817c743 (diff)
Add Nix runtime
Diffstat (limited to 'runtime')
-rw-r--r--runtime/queries/nix/highlights.scm87
-rw-r--r--runtime/queries/nix/indents.toml9
2 files changed, 96 insertions, 0 deletions
diff --git a/runtime/queries/nix/highlights.scm b/runtime/queries/nix/highlights.scm
new file mode 100644
index 00000000..741b73b5
--- /dev/null
+++ b/runtime/queries/nix/highlights.scm
@@ -0,0 +1,87 @@
+(comment) @comment
+
+[
+ "if"
+ "then"
+ "else"
+ "let"
+ "inherit"
+ "in"
+ "rec"
+ "with"
+ "assert"
+] @keyword
+
+((identifier) @variable.builtin
+ (#match? @variable.builtin "^(__currentSystem|__currentTime|__nixPath|__nixVersion|__storeDir|builtins|false|null|true)$")
+ (#is-not? local))
+
+((identifier) @function.builtin
+ (#match? @function.builtin "^(__add|__addErrorContext|__all|__any|__appendContext|__attrNames|__attrValues|__bitAnd|__bitOr|__bitXor|__catAttrs|__compareVersions|__concatLists|__concatMap|__concatStringsSep|__deepSeq|__div|__elem|__elemAt|__fetchurl|__filter|__filterSource|__findFile|__foldl'|__fromJSON|__functionArgs|__genList|__genericClosure|__getAttr|__getContext|__getEnv|__hasAttr|__hasContext|__hashFile|__hashString|__head|__intersectAttrs|__isAttrs|__isBool|__isFloat|__isFunction|__isInt|__isList|__isPath|__isString|__langVersion|__length|__lessThan|__listToAttrs|__mapAttrs|__match|__mul|__parseDrvName|__partition|__path|__pathExists|__readDir|__readFile|__replaceStrings|__seq|__sort|__split|__splitVersion|__storePath|__stringLength|__sub|__substring|__tail|__toFile|__toJSON|__toPath|__toXML|__trace|__tryEval|__typeOf|__unsafeDiscardOutputDependency|__unsafeDiscardStringContext|__unsafeGetAttrPos|__valueSize|abort|baseNameOf|derivation|derivationStrict|dirOf|fetchGit|fetchMercurial|fetchTarball|fromTOML|import|isNull|map|placeholder|removeAttrs|scopedImport|throw|toString)$")
+ (#is-not? local))
+
+[
+ (string)
+ (indented_string)
+] @string
+
+[
+ (path)
+ (hpath)
+ (spath)
+] @string.special.path
+
+(uri) @string.special.uri
+
+[
+ (integer)
+ (float)
+] @number
+
+(interpolation
+ "${" @punctuation.special
+ "}" @punctuation.special) @embedded
+
+(escape_sequence) @escape
+
+(function
+ universal: (identifier) @variable.parameter
+)
+
+(formal
+ name: (identifier) @variable.parameter
+ "?"? @punctuation.delimiter)
+
+(app
+ function: [
+ (identifier) @function
+ (select
+ attrpath: (attrpath
+ attr: (attr_identifier) @function .))])
+
+
+(unary
+ operator: _ @operator)
+
+(binary
+ operator: _ @operator)
+
+(attr_identifier) @property
+(inherit attrs: (attrs_inherited (identifier) @property) )
+
+[
+ ";"
+ "."
+ ","
+] @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
+(identifier) @variable
diff --git a/runtime/queries/nix/indents.toml b/runtime/queries/nix/indents.toml
new file mode 100644
index 00000000..9058a408
--- /dev/null
+++ b/runtime/queries/nix/indents.toml
@@ -0,0 +1,9 @@
+indent = [
+ "if",
+ "let",
+ "function",
+ "attrset",
+ "list",
+ "indented_string",
+ "parenthesized"
+]