summaryrefslogtreecommitdiff
path: root/queries
diff options
context:
space:
mode:
authorTobias Frilling <tobias@frilling.dev>2022-03-27 19:22:39 +0200
committerStephan Seitz <stephan.seitz@fau.de>2022-04-01 09:51:42 +0200
commit570ad70bbb57715ebeefb528bf6cf55845b8c658 (patch)
tree670cbcdb09a1ae2c9063e7a1d763430f6dadc20d /queries
parente06b54b64ebf415b27fc862a8d2d39eb20c2c69e (diff)
refactor(queries): simplify highlight queries for elvish
Diffstat (limited to 'queries')
-rw-r--r--queries/elvish/highlights.scm31
1 files changed, 11 insertions, 20 deletions
diff --git a/queries/elvish/highlights.scm b/queries/elvish/highlights.scm
index 40637ae8..4dba8eec 100644
--- a/queries/elvish/highlights.scm
+++ b/queries/elvish/highlights.scm
@@ -1,23 +1,19 @@
(comment) @comment
-(if "if" @conditional)
-(if (elif "elif" @conditional))
+["if" "elif"] @conditional
(if (else "else" @conditional))
-(while "while" @repeat)
+["while" "for"] @repeat
(while (else "else" @repeat))
-(for "for" @repeat)
(for (else "else" @repeat))
-(try "try" @exception)
-(try (catch "catch" @exception))
+["try" "catch" "finally"] @exception
(try (else "else" @exception))
-(try (finally "finally" @exception))
-(import "use" @include)
+"use" @include
(import (bareword) @string.special)
-(wildcard ["*" "**" "?"] @string.special)
+["*" "**" "?"] @string.special
(command argument: (bareword) @parameter)
(command head: (identifier) @function)
@@ -25,14 +21,12 @@
(#eq? @keyword.return "return"))
((command (identifier) @keyword.operator)
(#any-of? @keyword.operator "and" "or" "coalesce"))
-((command head: _ @function)
- (#any-of? @function
- "+" "-" "*" "/" "%" "<" "<=""==" "!=" ">"
- ">=" "<s" "<=s" "==s" "!=s" ">s" ">=s"
-))
+[
+ "+" "-" "*" "/" "%" "<" "<=""==" "!=" ">"
+ ">=" "<s" "<=s" "==s" "!=s" ">s" ">=s"
+] @function
-(pipeline "|" @operator)
-(redirection [">" "<" ">>" "<>"] @operator)
+[">" "<" ">>" "<>" "|"] @operator
(io_port) @number
@@ -43,20 +37,17 @@
(parameter_list) @parameter
(parameter_list "|" @punctuation.bracket)
+["var" "set" "tmp" "del"] @keyword
(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)