aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries
diff options
context:
space:
mode:
authorrsteube2022-07-03 21:19:12 +0000
committerGitHub2022-07-03 21:19:12 +0000
commit4c30a3609aa8fbcca97609d281f5df449c234674 (patch)
treec1c792e88ecd236321dd1307d1129045e03c2724 /runtime/queries
parent9f43dbc45d254ff860f7d33db201b2f0a6073195 (diff)
languages: added elvish (#2948)
Diffstat (limited to 'runtime/queries')
-rw-r--r--runtime/queries/elvish/highlights.scm76
-rw-r--r--runtime/queries/elvish/injections.scm2
2 files changed, 78 insertions, 0 deletions
diff --git a/runtime/queries/elvish/highlights.scm b/runtime/queries/elvish/highlights.scm
new file mode 100644
index 00000000..fd70488d
--- /dev/null
+++ b/runtime/queries/elvish/highlights.scm
@@ -0,0 +1,76 @@
+;; SPDX-License-Identifier: 0BSD
+;; SPDX-FileCopyrightText: 2022 Tobias Frilling
+
+(comment) @comment
+
+(if "if" @keyword.control.conditional)
+(if (elif "elif" @keyword.control.conditional))
+(if (else "else" @keyword.control.conditional))
+
+(while "while" @keyword.control.repeat)
+(while (else "else" @keyword.control.repeat))
+(for "for" @keyword.control.repeat)
+(for (else "else" @keyword.control.repeat))
+
+(try "try" @keyword.control.exception)
+(try (catch "catch" @keyword.control.exception))
+(try (else "else" @keyword.control.exception))
+(try (finally "finally" @keyword.control.exception))
+
+(import "use" @keyword.control.import)
+(import (bareword) @string.special)
+
+(wildcard ["*" "**" "?"] @string.special)
+
+(command argument: (bareword) @variable.parameter)
+(command head: (identifier) @function)
+((command head: (identifier) @keyword.control.return)
+ (#eq? @keyword.control.return "return"))
+((command (identifier) @keyword.operator)
+ (#match? @keyword.operator "(and|or|coalesce)"))
+((command head: _ @function)
+ (#match? @function "([+]|[-]|[*]|[/]|[%]|[<]|[<][=]|[=][=]|[!][=]|[>]|[>][=]|[<][s]|[<][=][s]|[=][=][s]|[!][=][s]|[>][s]|[>][=][s])"))
+
+(pipeline "|" @operator)
+(redirection [">" "<" ">>" "<>"] @operator)
+
+(io_port) @constant.numeric
+
+(function_definition
+ "fn" @keyword.function
+ (identifier) @function)
+
+(parameter_list) @variable.parameter
+(parameter_list "|" @punctuation.bracket)
+
+(variable_declaration
+ "var" @keyword
+ (lhs (identifier) @variable))
+
+(variable_assignment
+ "set" @keyword
+ (lhs (identifier) @variable))
+
+(temporary_assignment
+ "tmp" @keyword
+ (lhs (identifier) @variable))
+
+(variable_deletion
+ "del" @keyword
+ (identifier) @variable)
+
+
+(number) @constant.numeric
+(string) @string
+
+((variable (identifier) @function)
+ (#match? @function ".+\\~$"))
+((variable (identifier) @constant.builtin.boolean)
+ (#match? @constant.builtin.boolean "(true|false)"))
+((variable (identifier) @constant.builtin)
+ (#match? @constant.builtin "(_|after-chdir|args|before-chdir|buildinfo|nil|notify-bg-job-success|num-bg-jobs|ok|paths|pid|pwd|value-out-indicator|version)"))
+(variable (identifier) @variable)
+
+["$" "@"] @punctuation.special
+["(" ")" "[" "]" "{" "}"] @punctuation.bracket
+";" @punctuation.delimiter
diff --git a/runtime/queries/elvish/injections.scm b/runtime/queries/elvish/injections.scm
new file mode 100644
index 00000000..321c90ad
--- /dev/null
+++ b/runtime/queries/elvish/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))