1(identifier) @variable
2
3(type_identifier) @type
4(type_spec
5 name: (type_identifier) @type.definition)
6
7(field_identifier) @property
8(package_identifier) @namespace
9
10(label_name) @label
11
12(keyed_element
13 .
14 (literal_element
15 (identifier) @property))
16
17(call_expression
18 function: (identifier) @function.call)
19
20(call_expression
21 function: (selector_expression
22 field: (field_identifier) @function.method.call))
23
24(function_declaration
25 name: (identifier) @function)
26
27(method_declaration
28 name: (field_identifier) @function.method)
29(method_elem
30 name: (field_identifier) @function.method)
31
32[
33 ";"
34 "."
35 ","
36 ":"
37] @punctuation.delimiter
38
39[
40 "("
41 ")"
42 "{"
43 "}"
44 "["
45 "]"
46] @punctuation.bracket
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] @operator
87
88[
89 "break"
90 "case"
91 "chan"
92 "const"
93 "continue"
94 "default"
95 "defer"
96 "else"
97 "fallthrough"
98 "for"
99 "func"
100 "go"
101 "goto"
102 "if"
103 "import"
104 "interface"
105 "map"
106 "package"
107 "range"
108 "return"
109 "select"
110 "struct"
111 "switch"
112 "type"
113 "var"
114] @keyword
115
116[
117 (interpreted_string_literal)
118 (raw_string_literal)
119 (rune_literal)
120] @string
121
122(escape_sequence) @string.escape
123
124[
125 (int_literal)
126 (float_literal)
127 (imaginary_literal)
128] @number
129
130(const_spec
131 name: (identifier) @constant)
132
133[
134 (true)
135 (false)
136] @boolean
137
138[
139 (nil)
140 (iota)
141] @constant.builtin
142
143(comment) @comment
144
145; Go directives
146((comment) @preproc
147 (#match? @preproc "^//go:"))
148
149((comment) @preproc
150 (#match? @preproc "^// \\+build"))
151