Debian Codegraph @

runtime/queries/rescript/highlights.scm

raw symbols SCIP
1 (comment) @comment
2
3 [
4 "."
5 ","
6 "|"
7 ] @punctuation.delimiter
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 (uncurry)
35 ] @operator
36
37 ; Explicitly enclose these operators with binary_expression
38 ; to avoid confusion with JSX tag delimiters
39 (binary_expression ["<" ">" "/"] @operator)
40
41 [
42 "("
43 ")"
44 "{"
45 "}"
46 "["
47 "]"
48 ] @punctuation.bracket
49
50 (polyvar_type
51 [
52 "["
53 "[>"
54 "[<"
55 "]"
56 ] @punctuation.bracket)
57
58 [
59 "~"
60 "?"
61 "=>"
62 ".."
63 "..."
64 ] @punctuation.special
65
66
67 ; Identifiers
68 ;------------
69
70 ; Base catch-all for value-level identifiers (let bindings, references); the
71 ; specific rules below (params, calls, escaped operators, raise) override it.
72 (value_identifier) @variable
73
74 ; Escaped identifiers like \"+."
75 ((value_identifier) @function.macro
76 (#match? @function.macro "^\\.*$"))
77
78 [
79 (type_identifier)
80 (unit_type)
81 (list)
82 (list_pattern)
83 ] @type
84
85 [
86 (variant_identifier)
87 (polyvar_identifier)
88 ] @constructor
89
90 (record_type_field (property_identifier) @type)
91 (object_type (field (property_identifier) @type))
92 (record_field (property_identifier) @variable.other.member)
93 (object (field (property_identifier) @variable.other.member))
94 (member_expression (property_identifier) @variable.other.member)
95 (module_identifier) @namespace
96
97 ; Parameters
98 ;----------------
99
100 (list_pattern (value_identifier) @variable.parameter)
101 (spread_pattern (value_identifier) @variable.parameter)
102
103 ; String literals
104 ;----------------
105
106 [
107 (string)
108 (template_string)
109 ] @string
110
111 (template_substitution
112 "${" @punctuation.bracket
113 "}" @punctuation.bracket) @embedded
114
115 (character) @string.special
116 (escape_sequence) @string.special
117
118 ; Other literals
119 ;---------------
120
121 [
122 (true)
123 (false)
124 ] @constant.builtin.boolean
125
126 (number) @constant.numeric
127 (polyvar) @constant
128 (polyvar_string) @constant
129
130 ; Functions
131 ;----------
132
133 ; parameter(s) in parens
134 [
135 (parameter (value_identifier))
136 (labeled_parameter (value_identifier))
137 ] @variable.parameter
138
139 ; single parameter with no parens
140 (function parameter: (value_identifier) @variable.parameter)
141
142 ; first-level descructuring (required for nvim-tree-sitter as it only matches direct
143 ; children and the above patterns do not match destructuring patterns in NeoVim)
144 (parameter (tuple_pattern (tuple_item_pattern (value_identifier) @variable.parameter)))
145 (parameter (array_pattern (value_identifier) @variable.parameter))
146 (parameter (record_pattern (value_identifier) @variable.parameter))
147
148 ; Meta
149 ;-----
150
151 (decorator_identifier) @keyword.directive
152
153 (extension_identifier) @keyword
154 ("%") @keyword
155
156 ; Misc
157 ;-----
158
159 (subscript_expression index: (string) @attribute)
160 (polyvar_type_pattern "#" @constant)
161
162 [
163 ("include")
164 ("open")
165 ] @keyword.control.import
166
167 [
168 "as"
169 "export"
170 "external"
171 "let"
172 "module"
173 "mutable"
174 "private"
175 "rec"
176 "type"
177 "and"
178 "assert"
179 "await"
180 "with"
181 "lazy"
182 "constraint"
183 ] @keyword
184
185 ((function "async" @keyword.storage))
186
187 (module_unpack "unpack" @keyword)
188
189 [
190 "if"
191 "else"
192 "switch"
193 "when"
194 ] @keyword.control.conditional
195
196 [
197 "exception"
198 "try"
199 "catch"
200 ] @keyword.control.exception
201
202 ; A call's callee is a function (before the raise special-case below).
203 (call_expression
204 function: (value_identifier) @function)
205
206 (call_expression
207 function: (value_identifier) @keyword.control.exception
208 (#eq? @keyword.control.exception "raise"))
209
210 [
211 "for"
212 "in"
213 "to"
214 "downto"
215 "while"
216 ] @keyword.control.conditional
217
218 (ternary_expression ["?" ":"] @operator)
219
220 ; JSX
221 ;----------
222 (jsx_identifier) @tag
223 (jsx_element
224 open_tag: (jsx_opening_element ["<" ">"] @punctuation.special))
225 (jsx_element
226 close_tag: (jsx_closing_element ["<" "/" ">"] @punctuation.special))
227 (jsx_self_closing_element ["/" ">" "<"] @punctuation.special)
228 (jsx_fragment [">" "<" "/"] @punctuation.special)
229 (jsx_attribute (property_identifier) @attribute)