aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/commonlisp/locals.scm
blob: 98036d322a31bb6d6d454279e9e07676632f6af2 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
(defun_header
  function_name: (sym_lit) @local.definition.function
  (#set! definition.function.scope "parent"))

(defun_header
  lambda_list: (list_lit
    (sym_lit) @local.definition.parameter))

(defun_header
  keyword: (defun_keyword
    "defmethod")
  lambda_list: (list_lit
    (list_lit
      .
      (sym_lit)
      .
      (sym_lit) @local.definition.type)))

(defun_header
  lambda_list: (list_lit
    (list_lit
      .
      (sym_lit) @local.definition.parameter
      .
      (_))))

(sym_lit) @local.reference

(defun) @local.scope

((list_lit
  .
  (sym_lit) @_defvar
  .
  (sym_lit) @local.definition.var)
  (#match? @_defvar "^(cl:)?(defvar|defparameter)$"))

(list_lit
  .
  (sym_lit) @_deftest
  .
  (sym_lit) @local.definition.function
  (#eq? @_deftest "deftest")) @local.scope

(list_lit
  .
  (sym_lit) @_deftest
  .
  (sym_lit) @local.definition.function
  (#eq? @_deftest "deftest")) @local.scope

(for_clause
  .
  (sym_lit) @local.definition.var)

(with_clause
  .
  (sym_lit) @local.definition.var)

(loop_macro) @local.scope

(list_lit
  .
  (sym_lit) @_let
  (#match? @_let "(cl:|cffi:)?(with-accessors|with-foreign-objects|let[*]?)")
  .
  (list_lit
    (list_lit
      .
      (sym_lit) @local.definition.var))) @local.scope

(list_lit
  .
  (sym_lit) @_let
  (#match? @_let "(cl:|alexandria:)?(with-gensyms|dotimes|with-foreign-object)")
  .
  (list_lit
    .
    (sym_lit) @local.definition.var)) @local.scope

(list_lit
  .
  (kwd_lit) @_import_from
  (#eq? @_import_from ":import-from")
  .
  (_)
  (kwd_lit
    (kwd_symbol) @local.definition.import))

(list_lit
  .
  (kwd_lit) @_import_from
  (#eq? @_import_from ":import-from")
  .
  (_)
  (sym_lit) @local.definition.import)

(list_lit
  .
  (kwd_lit) @_use
  (#eq? @_use ":use")
  (kwd_lit
    (kwd_symbol) @local.definition.import))

(list_lit
  .
  (kwd_lit) @_use
  (#eq? @_use ":use")
  (sym_lit) @local.definition.import)