aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/snl/locals.scm
blob: 35c8da5c9596c8b80117d9c256e8710b6aa26181 (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
; Functions definitions
(function_declarator
  declarator: (identifier) @local.definition.function)

(preproc_function_def
  name: (identifier) @local.definition.macro) @local.scope

(preproc_def
  name: (identifier) @local.definition.macro)

((identifier) @local.definition.parameter
  (#has-ancestor? @local.definition.parameter param_decl))

(init_declarator
  (declarator
    (identifier)) @local.definition.var)

(array_declarator
  (identifier) @local.definition.var)

; Struct
(member_decl
  (declarator
    (identifier)) @local.definition.field)

(structdef
  name: (identifier) @local.definition.type)

; References
((field_expression
  field: (identifier) @local.reference)
  (#set! reference.kind "field"))

((call_expression
  function: (identifier) @local.reference)
  (#set! reference.kind "call"))

((basetype
  (identifier) @local.reference)
  (#set! reference.kind "type"))

; SNL specific
(state_set
  name: (identifier) @local.definition)

(state
  name: (identifier) @local.definition)

(state_statement
  name: (identifier) @local.reference)

(transition
  name: (identifier) @local.reference)

(identifier) @local.reference

[
  (for_statement)
  (if_statement)
  (while_statement)
  (source_file)
  (block)
  (state_set)
  (state_block)
] @local.scope