mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 03:40:04 -04:00
refactor(queries): simplify highlight queries for elvish
This commit is contained in:
parent
e06b54b64e
commit
570ad70bbb
1 changed files with 11 additions and 20 deletions
|
|
@ -1,23 +1,19 @@
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
|
|
||||||
(if "if" @conditional)
|
["if" "elif"] @conditional
|
||||||
(if (elif "elif" @conditional))
|
|
||||||
(if (else "else" @conditional))
|
(if (else "else" @conditional))
|
||||||
|
|
||||||
(while "while" @repeat)
|
["while" "for"] @repeat
|
||||||
(while (else "else" @repeat))
|
(while (else "else" @repeat))
|
||||||
(for "for" @repeat)
|
|
||||||
(for (else "else" @repeat))
|
(for (else "else" @repeat))
|
||||||
|
|
||||||
(try "try" @exception)
|
["try" "catch" "finally"] @exception
|
||||||
(try (catch "catch" @exception))
|
|
||||||
(try (else "else" @exception))
|
(try (else "else" @exception))
|
||||||
(try (finally "finally" @exception))
|
|
||||||
|
|
||||||
(import "use" @include)
|
"use" @include
|
||||||
(import (bareword) @string.special)
|
(import (bareword) @string.special)
|
||||||
|
|
||||||
(wildcard ["*" "**" "?"] @string.special)
|
["*" "**" "?"] @string.special
|
||||||
|
|
||||||
(command argument: (bareword) @parameter)
|
(command argument: (bareword) @parameter)
|
||||||
(command head: (identifier) @function)
|
(command head: (identifier) @function)
|
||||||
|
|
@ -25,14 +21,12 @@
|
||||||
(#eq? @keyword.return "return"))
|
(#eq? @keyword.return "return"))
|
||||||
((command (identifier) @keyword.operator)
|
((command (identifier) @keyword.operator)
|
||||||
(#any-of? @keyword.operator "and" "or" "coalesce"))
|
(#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)
|
[">" "<" ">>" "<>" "|"] @operator
|
||||||
(redirection [">" "<" ">>" "<>"] @operator)
|
|
||||||
|
|
||||||
(io_port) @number
|
(io_port) @number
|
||||||
|
|
||||||
|
|
@ -43,20 +37,17 @@
|
||||||
(parameter_list) @parameter
|
(parameter_list) @parameter
|
||||||
(parameter_list "|" @punctuation.bracket)
|
(parameter_list "|" @punctuation.bracket)
|
||||||
|
|
||||||
|
["var" "set" "tmp" "del"] @keyword
|
||||||
(variable_declaration
|
(variable_declaration
|
||||||
"var" @keyword
|
|
||||||
(lhs (identifier) @variable))
|
(lhs (identifier) @variable))
|
||||||
|
|
||||||
(variable_assignment
|
(variable_assignment
|
||||||
"set" @keyword
|
|
||||||
(lhs (identifier) @variable))
|
(lhs (identifier) @variable))
|
||||||
|
|
||||||
(temporary_assignment
|
(temporary_assignment
|
||||||
"tmp" @keyword
|
|
||||||
(lhs (identifier) @variable))
|
(lhs (identifier) @variable))
|
||||||
|
|
||||||
(variable_deletion
|
(variable_deletion
|
||||||
"del" @keyword
|
|
||||||
(identifier) @variable)
|
(identifier) @variable)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue