blob: bc33d306b493b1fe5ab65ce1588803163005da55 (
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
66
67
68
69
70
71
|
;;; Programm structure
(module) @scope
(class_definition
body: (block
(expression_statement
(assignment
left: (expression_list
(identifier) @definition.associated))))) @scope
; Function with parameters, defines parameters
(function_definition
name: (identifier)
parameters: (parameters
(identifier) @definition.var))
; Function defines function and scope
(function_definition
name: (identifier) @definition.function) @scope
;; Should be extended to when syntax supported
;(function_definition
;name: (identifier) @definition.function
;body: (block (expression_statement (string) @definition.function.doc)?)) @scope
(class_definition
name: (identifier) @definition.type) @scope
(class_definition
body: (block
(function_definition
name: (identifier) @definition.method)))
;;; Loops
; not a scope!
(for_statement
left: (variables
(identifier) @definition.var))
; not a scope!
;(while_statement) @scope
; for in list comprehension
(for_in_clause
left: (variables
(identifier) @definition.var))
(dictionary_comprehension) @scope
(list_comprehension) @scope
(set_comprehension) @scope
;;; Assignments
(assignment
left: (expression_list
(identifier) @definition.var))
(assignment
left: (expression_list
(attribute
(identifier)
(identifier) @definition.field)))
; Walrus operator x := 1
(named_expression
(identifier) @definition.var)
;;; REFERENCES
(identifier) @reference
|