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