aboutsummaryrefslogtreecommitdiffstats
path: root/queries/lua/locals.scm
blob: a7b15d1e5ec28bb3d7c8c355b5d8f16e0b116eab (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
;;; DECLARATIONS AND SCOPES

;; Variable and field declarations
((variable_declarator
   (identifier) @definition)
  (set! kind "v"))

((variable_declarator
   (field_expression object:(*) @definition.associated (property_identifier) @definition))
  (set! kind "v"))

;; Parameters
((local_function
   (parameters (identifier) @definition))
  (set! kind "v"))
((function
   (parameters (identifier) @definition))
  (set! kind "v"))

;; Function definitions
;; Functions definitions creates both a definition and a new scope
((function
   (function_name_field
     object: (identifier) @definition.associated
     (property_identifier) @definition)) @scope
  (set! kind "m"))

((function
   (function_name (identifier) @definition)) @scope
  (set! kind "f"))

((local_function
   (identifier) @definition) @scope
  (set! kind "f"))

((if_statement) @scope)
((for_in_statement) @scope)
((repeat_statement) @scope)
;; Loops
((loop_expression
   (identifier) @definition)
  (set! kind "v"))

;;; REFERENCES
((identifier) @reference)