From 692b051b09935653befdb8f7ba8afdb640adf17b Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 12 Jun 2023 09:54:30 -0600 Subject: feat!: drop modules, general refactor and cleanup --- runtime/queries/elvish/highlights.scm | 157 ++++++++++++++++++++++++++++++++++ runtime/queries/elvish/injections.scm | 2 + 2 files changed, 159 insertions(+) create mode 100644 runtime/queries/elvish/highlights.scm create mode 100644 runtime/queries/elvish/injections.scm (limited to 'runtime/queries/elvish') diff --git a/runtime/queries/elvish/highlights.scm b/runtime/queries/elvish/highlights.scm new file mode 100644 index 000000000..9836a6c78 --- /dev/null +++ b/runtime/queries/elvish/highlights.scm @@ -0,0 +1,157 @@ +(comment) @comment @spell + +[ + "if" + "elif" +] @keyword.conditional + +(if + (else + "else" @keyword.conditional)) + +[ + "while" + "for" +] @keyword.repeat + +(while + (else + "else" @keyword.repeat)) + +(for + (else + "else" @keyword.repeat)) + +[ + "try" + "catch" + "finally" +] @keyword.exception + +(try + (else + "else" @keyword.exception)) + +"use" @keyword.import + +(import + (bareword) @string.special.path) + +(wildcard + [ + "*" + "**" + "?" + ] @character.special) + +(command + argument: (bareword) @variable.parameter) + +(command + head: (identifier) @function.call) + +((command + head: (identifier) @keyword.return) + (#eq? @keyword.return "return")) + +((command + (identifier) @keyword.operator) + (#any-of? @keyword.operator "and" "or" "coalesce")) + +[ + "+" + "-" + "*" + "/" + "%" + "<" + "<=" + "==" + "!=" + ">" + ">=" + "s" + ">=s" +] @function.builtin + +[ + ">" + "<" + ">>" + "<>" + "|" +] @operator + +(io_port) @number + +(function_definition + "fn" @keyword.function + (identifier) @function) + +(parameter_list) @variable.parameter + +(parameter_list + "|" @punctuation.bracket) + +[ + "var" + "set" + "tmp" + "del" +] @keyword + +(variable_declaration + (lhs + (identifier) @variable)) + +(variable_assignment + (lhs + (identifier) @variable)) + +(temporary_assignment + (lhs + (identifier) @variable)) + +(variable_deletion + (identifier) @variable) + +(number) @number + +(string) @string + +(variable + (identifier) @variable) + +((variable + (identifier) @function) + (#lua-match? @function ".+[~]$")) + +((variable + (identifier) @boolean) + (#any-of? @boolean "true" "false")) + +((variable + (identifier) @constant.builtin) + (#any-of? @constant.builtin + "_" "after-chdir" "args" "before-chdir" "buildinfo" "nil" "notify-bg-job-success" "num-bg-jobs" + "ok" "paths" "pid" "pwd" "value-out-indicator" "version")) + +[ + "$" + "@" +] @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 000000000..2f0e58eb6 --- /dev/null +++ b/runtime/queries/elvish/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) -- cgit v1.2.3-70-g09d2