nvim-treesitter/queries/bash/highlights.scm

187 lines
3.2 KiB
Scheme
Raw Normal View History

2020-06-22 17:39:54 -04:00
[
2023-08-23 13:02:30 +03:00
"(" ")"
"{" "}"
"[" "]"
"[[" "]]"
2023-08-24 17:12:10 -04:00
"((" "))"
2023-08-23 13:02:30 +03:00
] @punctuation.bracket
2020-06-22 17:39:54 -04:00
[
";"
";;"
2023-08-24 17:12:10 -04:00
";&"
";;&"
2023-08-23 13:02:30 +03:00
"&"
] @punctuation.delimiter
2020-06-22 17:39:54 -04:00
[
">"
">>"
2020-06-22 17:39:54 -04:00
"<"
"<<"
2020-06-22 17:39:54 -04:00
"&&"
"|"
2023-08-24 17:12:10 -04:00
"|&"
2020-06-22 17:39:54 -04:00
"||"
"="
2023-08-24 17:12:10 -04:00
"+="
2020-12-19 20:59:02 +00:00
"=~"
2020-06-22 17:39:54 -04:00
"=="
"!="
2023-08-24 17:12:10 -04:00
"&>"
"&>>"
"<&"
">&"
">|"
2023-08-30 14:17:40 -04:00
"<&-"
">&-"
2023-08-24 17:12:10 -04:00
"<<-"
"<<<"
".."
2023-08-23 13:02:30 +03:00
] @operator
2020-06-22 17:39:54 -04:00
; Do *not* spell check strings since they typically have some sort of
; interpolation in them, or, are typically used for things like filenames, URLs,
; flags and file content.
2020-06-22 17:39:54 -04:00
[
(string)
2020-06-22 17:39:54 -04:00
(raw_string)
(ansi_c_string)
2020-06-22 17:39:54 -04:00
(heredoc_body)
] @string
2020-06-22 17:39:54 -04:00
2023-08-23 13:02:30 +03:00
[
(heredoc_start)
(heredoc_end)
] @label
(variable_assignment (word) @string)
2023-08-24 17:12:10 -04:00
(command argument: "$" @string) ; bare dollar
2020-06-22 17:39:54 -04:00
[
"if"
"then"
"else"
"elif"
"fi"
"case"
"in"
"esac"
2023-08-23 13:02:30 +03:00
] @conditional
2020-06-22 17:39:54 -04:00
[
"for"
"do"
"done"
"select"
"until"
2020-06-22 17:39:54 -04:00
"while"
2023-08-23 13:02:30 +03:00
] @repeat
2020-06-22 17:39:54 -04:00
[
2023-08-24 17:12:10 -04:00
"declare"
"typeset"
"export"
"readonly"
"local"
"unset"
"unsetenv"
2023-08-23 13:02:30 +03:00
] @keyword
2020-06-22 17:39:54 -04:00
2021-07-05 15:04:42 -05:00
"function" @keyword.function
(special_variable_name) @constant
2020-06-22 17:39:54 -04:00
2022-09-18 20:39:53 +03:00
; trap -l
((word) @constant.builtin
2022-09-18 20:39:53 +03:00
(#match? @constant.builtin "^SIG(HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR[12]|SEGV|PIPE|ALRM|TERM|STKFLT|CHLD|CONT|STOP|TSTP|TT(IN|OU)|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS|RTMIN([+]([1-9]|1[0-5]))?|RTMAX(-([1-9]|1[0-4]))?)$"))
2020-06-22 17:39:54 -04:00
((word) @boolean
2023-08-23 13:02:30 +03:00
(#any-of? @boolean "true" "false"))
2020-06-22 17:39:54 -04:00
2022-09-26 10:19:02 +01:00
(comment) @comment @spell
2020-06-22 17:39:54 -04:00
2023-08-23 13:02:30 +03:00
(test_operator) @operator
(command_substitution "$(" @punctuation.bracket)
(process_substitution "<(" @punctuation.bracket)
(arithmetic_expansion
[ "$((" "((" ] @punctuation.special
"))" @punctuation.special)
(arithmetic_expansion "," @punctuation.delimiter)
2020-06-22 17:39:54 -04:00
2023-08-23 13:02:30 +03:00
(ternary_expression [ "?" ":" ] @conditional.ternary)
2023-08-23 13:02:30 +03:00
(binary_expression operator: _ @operator)
(unary_expression operator: _ @operator)
(postfix_expression operator: _ @operator)
2020-06-22 17:39:54 -04:00
(function_definition
name: (word) @function)
(command_name (word) @function.call)
((command_name (word) @function.builtin)
(#any-of? @function.builtin
2023-06-18 10:46:56 +02:00
"alias" "bg" "bind" "break" "builtin" "caller" "cd"
"command" "compgen" "complete" "compopt" "continue"
"coproc" "dirs" "disown" "echo" "enable" "eval"
"exec" "exit" "fc" "fg" "getopts" "hash" "help"
"history" "jobs" "kill" "let" "logout" "mapfile"
"popd" "printf" "pushd" "pwd" "read" "readarray"
"return" "set" "shift" "shopt" "source" "suspend"
"test" "time" "times" "trap" "type" "typeset"
"ulimit" "umask" "unalias" "wait"))
2020-06-22 17:39:54 -04:00
(command
2020-06-22 17:39:54 -04:00
argument: [
(word) @parameter
(concatenation (word) @parameter)
])
2023-08-23 13:02:30 +03:00
(number) @number
2020-12-24 19:48:02 +00:00
((word) @number
2023-08-23 13:02:30 +03:00
(#lua-match? @number "^[0-9]+$"))
2020-12-19 20:31:55 +00:00
2020-06-22 17:39:54 -04:00
(file_redirect
destination: (word) @parameter)
2023-08-24 17:12:10 -04:00
(file_descriptor) @operator
2023-08-23 13:02:30 +03:00
(simple_expansion
"$" @punctuation.special) @none
(expansion
2023-08-23 13:02:30 +03:00
"${" @punctuation.special
"}" @punctuation.special) @none
(expansion operator: _ @punctuation.special)
(expansion "@" . operator: _ @character.special)
((expansion
(subscript
index: (word) @character.special))
(#any-of? @character.special "@" "*"))
2020-06-22 17:39:54 -04:00
2023-08-24 17:12:10 -04:00
"``" @punctuation.special
2020-09-07 18:14:54 +02:00
(variable_name) @variable
2020-06-22 17:39:54 -04:00
((variable_name) @constant
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
(case_item
2020-06-22 17:39:54 -04:00
value: (word) @parameter)
2020-12-19 20:59:02 +00:00
2023-08-24 17:12:10 -04:00
[
(regex)
(extglob_pattern)
] @string.regex
((program . (comment) @preproc)
2023-08-23 13:02:30 +03:00
(#lua-match? @preproc "^#!/"))