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 name: (word) @function)
47(command_name (word) @function)
48
49(command
50 argument: [
51 (word) @variable.parameter
52 (_ (word) @variable.parameter)
53 ])
54
55[
56 (file_descriptor)
57 (number)
58] @number
59
60(regex) @string.regex
61
62[
63 (command_substitution)
64 (process_substitution)
65 (expansion)
66] @embedded
67
68
69[
70 "$"
71 "&&"
72 ">"
73 "<<"
74 ">>"
75 ">&"
76 ">&-"
77 "<"
78 "|"
79 ":"
80 "//"
81 "/"
82 "%"
83 "%%"
84 "#"
85 "##"
86 "="
87 "=="
88] @operator
89
90(test_operator) @keyword.operator
91
92[
93 ";"
94] @punctuation.delimiter
95
96[
97 "("
98 ")"
99 "{"
100 "}"
101 "["
102 "]"
103] @punctuation.bracket
104
105(simple_expansion
106 "$" @punctuation.special)
107(expansion
108 "${" @punctuation.special
109 "}" @punctuation.special) @embedded
110
111(command_substitution
112 "$(" @punctuation.special
113 ")" @punctuation.special)
114
115(
116 (command (_) @constant)
117 (#match? @constant "^-")
118)
119
120(case_item value: (_) @string.regex)
121(special_variable_name) @variable.special