Debian Codegraph @

runtime/queries/scheme/locals.scm

raw symbols SCIP
1 ; Everything in Scheme is `(list (symbol) ...)`, so scopes and definitions are
2 ; gated by `#eq?`/`#any-of?` predicates on the leading symbol of a form.
3
4 ; Scopes
5
6 (list
7 .
8 (symbol) @_f
9 (#any-of? @_f
10 "lambda" "λ" "case-lambda"
11 "let" "let*" "letrec" "letrec*" "let-values" "let*-values"
12 "let-syntax" "letrec-syntax"
13 "do")) @local.scope
14
15 ; A `(define (f args...) ...)` form is also a scope for its parameters.
16 (list
17 .
18 (symbol) @_f
19 .
20 (list)
21 (#eq? @_f "define")) @local.scope
22
23 ; Definitions
24
25 ; (lambda (a b c) ...) and (define (f a b c) ...) parameters
26 (list
27 .
28 (symbol) @_f
29 .
30 (list
31 (symbol) @local.definition.variable.parameter)
32 (#any-of? @_f "lambda" "λ"))
33
34 (list
35 .
36 (symbol) @_f
37 .
38 (list
39 .
40 (symbol) ; function name, not a parameter
41 (symbol) @local.definition.variable.parameter)
42 (#eq? @_f "define"))
43
44 ; (let ((x v) (y w)) ...) and friends: each binding's first symbol
45 (list
46 .
47 (symbol) @_f
48 .
49 (list
50 (list
51 .
52 (symbol) @local.definition.variable))
53 (#any-of? @_f
54 "let" "let*" "letrec" "letrec*" "let-values" "let*-values"
55 "let-syntax" "letrec-syntax" "do"))
56
57 ; (define name value)
58 (list
59 .
60 (symbol) @_f
61 .
62 (symbol) @local.definition.variable
63 (#eq? @_f "define"))
64
65 ; References
66
67 (symbol) @local.reference
68
69 ; The leading symbol of a form is a keyword/operator/call target, not a
70 ; variable reference; cancel resolution there.
71 (list
72 .
73 (symbol) @_)