1(comment) @annotation
2
3(type_declaration
4 "type" @context
5 [
6 (type_spec
7 name: (_) @name) @item
8 ("("
9 (type_spec
10 name: (_) @name) @item
11 ")")
12 ])
13
14(function_declaration
15 "func" @context
16 name: (identifier) @name
17 parameters: (parameter_list
18 "("
19 ")")) @item
20
21(method_declaration
22 "func" @context
23 receiver: (parameter_list
24 "(" @context
25 (parameter_declaration
26 name: (_) @context
27 type: (_) @context)
28 ")" @context)
29 name: (field_identifier) @name
30 parameters: (parameter_list
31 "("
32 ")")) @item
33
34(const_declaration
35 "const" @context
36 (const_spec
37 name: (identifier) @name) @item)
38
39(source_file
40 (var_declaration
41 "var" @context
42 [
43 ; The declaration may define multiple variables, and so @item is on
44 ; the identifier so they get distinct ranges.
45 (var_spec
46 name: (identifier) @name @item)
47 (var_spec_list
48 (var_spec
49 name: (identifier) @name @item))
50 ]))
51
52(method_elem
53 name: (_) @name
54 parameters: (parameter_list
55 "(" @context
56 ")" @context)) @item
57
58; Fields declarations may define multiple fields, and so @item is on the
59; declarator so they each get distinct ranges.
60(field_declaration
61 name: (_) @name @item)