add highlight queries for bash

This commit is contained in:
TravonteD 2020-06-22 17:39:54 -04:00 committed by Thomas Vigouroux
parent 35dfd7e1f4
commit 51a52b85cf
2 changed files with 111 additions and 1 deletions

View file

@ -168,7 +168,7 @@ List of currently supported languages:
- [x] css (maintained by @TravonteD)
- [ ] julia
- [ ] php
- [ ] bash
- [x] bash (maintained by @TravonteD)
- [ ] scala
- [ ] haskell
- [ ] toml

110
queries/bash/highlights.scm Normal file
View file

@ -0,0 +1,110 @@
[
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket
[
";"
";;"
(heredoc_start)
] @punctuation.delimiter
[
">"
"<"
"&"
"&&"
"|"
"||"
"="
"=="
"!="
] @operator
[
(string)
(raw_string)
(heredoc_body)
] @string
[
"if"
"then"
"else"
"elif"
"fi"
"case"
"in"
"esac"
] @conditional
[
"for"
"do"
"done"
"while"
] @repeat
[
"declare"
"export"
"local"
"readonly"
"unset"
] @keyword
[
(special_variable_name)
("$" (special_variable_name))
] @constant
((word) @constant
(#match? @constant "SIG(INT|TERM|QUIT|TIN|TOU|STP|HUP)"))
((word) @boolean
(#match? @boolean "true|false"))
((word) @number
(#match? @number "^\d*$"))
(comment) @comment
(test_operator) @string.
(command_substitution
[ "$(" ")" ] @punctuation.bracket)
(function_definition
name: (word) @function)
(command_name (word)) @function
(command
argument: [
(word) @parameter
((word) @number
(#match? @number "^\d*$"))
(concatenation (word) @parameter)
])
(file_redirect
descriptor: (file_descriptor) @operator
destination: (word) @parameter)
("$" (variable_name)) @identifier
(expansion
[ "${" "}" ] @punctuation.bracket)
(variable_name) @identifier
(case_item
value: (word) @parameter)
(concatenation (word) @parameter)