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

;; Variable and field declarations
((variable_declarator
   (identifier) @definition.var))

((variable_declarator
   (field_expression . (_) @definition.associated (property_identifier) @definition.var)))

;; Parameters
(parameters (identifier) @definition.parameter)

;; Loops
((loop_expression
   (identifier) @definition.var))

;; Function definitions
;; Functions definitions creates both a definition and a new scope
((function
   (function_name
     (function_name_field
       (identifier) @definition.associated
       (property_identifier) @definition.method))) @scope)

((function
   (function_name (identifier) @definition.function)) @scope)

((local_function
   (identifier) @definition.function) @scope)
[
(local_variable_declaration
  (variable_declarator
    (identifier) @definition.function)
  (function_definition) @scope)
(function_definition) @scope
]


(program) @scope
((if_statement) @scope)
((for_in_statement) @scope)
((repeat_statement) @scope)
((while_statement) @scope)

;;; REFERENCES
((identifier) @reference)
((property_identifier) @reference)