1[
2 (string)
3 (raw_string)
4 (heredoc_body)
5 (heredoc_start)
6 (heredoc_end)
7 (ansi_c_string)
8 (word)
9] @string
10
11(variable_name) @variable
12
13[
14 "export"
15 "function"
16 "unset"
17 "local"
18 "declare"
19] @keyword
20
21[
22 "case"
23 "do"
24 "done"
25 "elif"
26 "else"
27 "esac"
28 "fi"
29 "for"
30 "if"
31 "in"
32 "select"
33 "then"
34 "until"
35 "while"
36] @keyword.control
37
38(comment) @comment
39
40; Shebang
41((program
42 .
43 (comment) @keyword.directive)
44 (#match? @keyword.directive "^#![ \t]*/"))
45
46(function_definition
47 name: (word) @function)
48
49(command_name
50 (word) @function)
51
52(command
53 argument: [
54 (word) @variable.parameter
55 (_
56 (word) @variable.parameter)
57 ])
58
59[
60 (file_descriptor)
61 (number)
62] @number
63
64(regex) @string.regex
65
66[
67 (command_substitution)
68 (process_substitution)
69 (expansion)
70] @embedded
71
72[
73 "$"
74 "&&"
75 ">"
76 "<<"
77 ">>"
78 ">&"
79 ">&-"
80 "<"
81 "|"
82 ":"
83 "//"
84 "/"
85 "%"
86 "%%"
87 "#"
88 "##"
89 "="
90 "=="
91] @operator
92
93(test_operator) @keyword.operator
94
95";" @punctuation.delimiter
96
97[
98 "("
99 ")"
100 "{"
101 "}"
102 "["
103 "]"
104] @punctuation.bracket
105
106(simple_expansion
107 "$" @punctuation.special)
108
109(expansion
110 "${" @punctuation.special
111 "}" @punctuation.special) @embedded
112
113(command_substitution
114 "$(" @punctuation.special
115 ")" @punctuation.special)
116
117((command
118 (_) @constant)
119 (#match? @constant "^-"))
120
121(case_item
122 value: (_) @string.regex)
123
124(special_variable_name) @variable.special