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

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

((variable_declarator
   (field_expression object:(*) @definition.associated (property_identifier) @definition.var)))

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

;; 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)
(function_definition) @scope

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

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