Skip to content

Commit 2c6e9a7

Browse files
committed
1 parent b3930c1 commit 2c6e9a7

4 files changed

Lines changed: 36 additions & 6 deletions

File tree

extension.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ language = "ReScript"
1212

1313
[grammars.rescript]
1414
repository = "https://github.com/rescript-lang/tree-sitter-rescript"
15-
commit = "64249e68649c77d3c880e335469b464674ad1cbf"
15+
commit = "5b90cd4e4138b1231a67977303bda47eb608480a"

languages/rescript/highlights.scm

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
(comment) @comment
1+
[
2+
(line_comment)
3+
(block_comment)
4+
] @comment
25

36
; Identifiers
47
;------------
@@ -17,6 +20,14 @@
1720
(list_pattern)
1821
] @type
1922

23+
; Dict
24+
(dict "dict" @type.builtin)
25+
(dict_pattern "dict" @type.builtin)
26+
(dict_entry (string) @property)
27+
(dict_pattern_entry (string) @property)
28+
(dict_pattern_entry (value_identifier) @variable.parameter)
29+
(parameter (dict_pattern (dict_pattern_entry (value_identifier) @variable.parameter)))
30+
2031
((type_identifier) @type.builtin
2132
(#any-of? @type.builtin
2233
"int" "char" "string" "float" "bool" "unit"))
@@ -65,6 +76,8 @@
6576
] @string
6677

6778

79+
(regex) @string.special
80+
6881
(character) @character
6982
(escape_sequence) @string.escape
7083

@@ -215,15 +228,22 @@
215228
"**"
216229
"*."
217230
"/."
231+
"<<"
232+
">>"
233+
">>>"
218234
"<="
219235
"=="
220236
"==="
221237
"!"
222238
"!="
223239
"!=="
224240
">="
241+
"&&&"
225242
"&&"
243+
"|||"
226244
"||"
245+
"^^^"
246+
"~~~"
227247
"="
228248
":="
229249
"->"
@@ -235,8 +255,8 @@
235255
] @operator
236256

237257
; Explicitly enclose these operators with binary_expression
238-
; to avoid confusion with JSX tag delimiters
239-
(binary_expression ["<" ">" "/"] @operator)
258+
; to avoid confusion with JSX tag delimiters and extension expressions.
259+
(binary_expression ["<" ">" "/" "%"] @operator)
240260

241261
[
242262
"("

languages/rescript/injections.scm

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
((comment) @injection.content (#set! injection.language "comment"))
1+
([
2+
(line_comment)
3+
(block_comment)
4+
] @injection.content (#set! injection.language "comment"))
5+
6+
; regex literal
7+
(regex
8+
(regex_pattern) @injection.content (#set! injection.language "regex"))
29

310
; %re
411
(extension_expression

languages/rescript/textobjects.scm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
; Comments
2525
;---------
2626

27-
(comment) @comment.around
27+
([
28+
(line_comment)
29+
(block_comment)
30+
] @comment.around
2831

2932
; Parameters
3033
;-----------

0 commit comments

Comments
 (0)