aboutsummaryrefslogtreecommitdiffstats
path: root/queries/bash/highlights.scm
blob: 892546fc21588429fc6042aa9018113948eaaee2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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
  (#vim-match? @constant "SIG(INT|TERM|QUIT|TIN|TOU|STP|HUP)"))

((word) @boolean
  (#vim-match? @boolean "true|false"))

((word) @number
  (#vim-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
              (#vim-match? @number "^\d*$"))
             (concatenation (word) @parameter)
             ])

(file_redirect
  descriptor: (file_descriptor) @operator
  destination: (word) @parameter)


("$" (variable_name)) @variable

(expansion
  [ "${" "}" ] @punctuation.bracket)

(variable_name) @variable

(case_item
  value: (word) @parameter)

(concatenation (word) @parameter)