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