Debian Codegraph @

runtime/queries/fennel/highlights.scm

raw symbols SCIP
1 ; Most primitive nodes
2 (shebang) @keyword.directive
3
4 [
5 (symbol)
6 (symbol_binding)
7 ] @variable
8
9 (comment) @comment
10
11 (fn_form
12 name: [
13 (symbol) @function
14 (multi_symbol
15 member: (symbol_fragment) @function .)
16 ])
17
18 (lambda_form
19 name: [
20 (symbol) @function
21 (multi_symbol
22 member: (symbol_fragment) @function .)
23 ])
24
25 ((symbol) @operator
26 (#any-of? @operator
27 ; arithmetic
28 "+" "-" "*" "/" "//" "%" "^"
29 ; comparison
30 ">" "<" ">=" "<=" "=" "~="
31 ; other
32 "#" "." "?." ".."))
33
34 ((symbol) @keyword.operator
35 (#any-of? @keyword.operator
36 ; comparison
37 "not="
38 ; boolean
39 "and" "or" "not"
40 ; bitwise
41 "lshift" "rshift" "band" "bor" "bxor" "bnot"
42 ; other
43 "length"))
44
45 (case_guard
46 call: (_) @keyword.control.conditional)
47
48 (case_guard_or_special
49 call: (_) @keyword.control.conditional)
50
51 (case_catch
52 call: (symbol) @keyword)
53
54 (import_macros_form
55 imports: (table_binding
56 (table_binding_pair
57 value: (symbol_binding) @function.macro)))
58
59
60 ((symbol) @keyword.function
61 (#any-of? @keyword.function "fn" "lambda" "λ" "hashfn"))
62
63 ((symbol) @keyword.control.repeat
64 (#any-of? @keyword.control.repeat "for" "each" "while"))
65
66 ((symbol) @keyword.control.conditional
67 (#any-of? @keyword.control.conditional "if" "when" "match" "case" "match-try" "case-try"))
68
69 ((symbol) @keyword
70 (#any-of? @keyword
71 "global" "local" "let" "set" "var" "comment" "do" "doc" "eval-compiler" "lua" "macros" "unquote"
72 "quote" "tset" "values" "tail!"))
73
74 ((symbol) @keyword.control.import
75 (#any-of? @keyword.control.import "require" "require-macros" "import-macros" "include"))
76
77 ((symbol) @function.macro
78 (#any-of? @function.macro
79 "collect" "icollect" "fcollect" "accumulate" "faccumulate" "->" "->>" "-?>" "-?>>" "?." "doto"
80 "macro" "macrodebug" "partial" "pick-args" "pick-values" "with-open"))
81
82 ((symbol) @variable.builtin
83 (#eq? @variable.builtin "..."))
84
85 ((symbol) @constant.builtin
86 (#eq? @constant.builtin "_VERSION"))
87
88 ((symbol) @function.builtin
89 (#any-of? @function.builtin
90 "assert" "collectgarbage" "dofile" "error" "getmetatable" "ipairs" "load" "loadfile" "next"
91 "pairs" "pcall" "print" "rawequal" "rawget" "rawlen" "rawset" "require" "select" "setmetatable"
92 "tonumber" "tostring" "type" "warn" "xpcall" "module" "setfenv" "loadstring" "unpack"))
93
94 ; TODO: Highlight builtin methods (`table.unpack`, etc) as @function.builtin
95 ([
96 (symbol) @variable.builtin
97 (multi_symbol
98 base: (symbol_fragment) @variable.builtin)
99 ]
100 (#any-of? @variable.builtin
101 "vim" "_G" "_ENV" "debug" "io" "jit" "math" "os" "package" "string" "table" "utf8"))
102
103 ([
104 (symbol) @variable.builtin
105 (multi_symbol
106 .
107 (symbol_fragment) @variable.builtin)
108 ]
109 (#eq? @variable.builtin "arg"))
110 (symbol_option) @keyword.directive
111
112 (escape_sequence) @constant.character.escape
113
114 (multi_symbol
115 "." @punctuation.delimiter
116 member: (symbol_fragment) @variable.other.member)
117
118 (list
119 call: (symbol) @function)
120
121 (list
122 call: (multi_symbol
123 member: (symbol_fragment) @function .))
124
125 (multi_symbol_method
126 ":" @punctuation.delimiter
127 method: (symbol_fragment) @function.method)
128
129 (quasi_quote_reader_macro
130 macro: _ @punctuation.special)
131
132 (quote_reader_macro
133 macro: _ @punctuation.special)
134
135 (unquote_reader_macro
136 macro: _ @punctuation.special)
137
138 (hashfn_reader_macro
139 macro: _ @keyword.function)
140
141 (docstring) @comment.block.documentation
142
143 ; NOTE: The macro name is highlighted as @variable because it
144 ; gives a nicer contrast instead of everything being the same
145 ; color. Rust queries use this workaround too for `macro_rules!`.
146 (macro_form
147 name: [
148 (symbol) @variable
149 (multi_symbol
150 member: (symbol_fragment) @variable .)
151 ])
152
153 [
154 "("
155 ")"
156 "{"
157 "}"
158 "["
159 "]"
160 ] @punctuation.bracket
161
162 (sequence_arguments
163 (symbol_binding) @variable.parameter)
164
165 (sequence_arguments
166 (rest_binding
167 rhs: (symbol_binding) @variable.parameter))
168
169 ((symbol) @variable.parameter
170 (#any-of? @variable.parameter "$" "$..."))
171
172 ((symbol) @variable.parameter
173 (#any-of? @variable.parameter "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"))
174
175 [
176 (nil)
177 (nil_binding)
178 ] @constant.builtin
179
180 [
181 (boolean)
182 (boolean_binding)
183 ] @constant.builtin.boolean
184
185 [
186 (number)
187 (number_binding)
188 ] @constant.numeric
189
190 [
191 (string)
192 (string_binding)
193 ] @string