@@ -10,20 +10,23 @@
1010[
1111 (type_identifier)
1212 (unit_type)
13− "list"
1413] @type
1514
15+(list ["list{" "}"] @type)
16+(list_pattern ["list{" "}"] @type)
17+
1618[
1719 (variant_identifier)
1820 (polyvar_identifier)
19−] @constant
21+] @constructor
2022
21−(property_identifier) @variable.other.member
23+(record_type_field (property_identifier) @type)
24+(object_type (field (property_identifier) @type))
25+(record_field (property_identifier) @variable.other.member)
26+(object (field (property_identifier) @variable.other.member))
27+(member_expression (property_identifier) @variable.other.member)
2228(module_identifier) @namespace
2329
24−(jsx_identifier) @tag
25−(jsx_attribute (property_identifier) @variable.parameter)
26−
2730; Parameters
2831;----------------
2932
@@ -42,8 +45,8 @@
4245 "${" @punctuation.bracket
4346 "}" @punctuation.bracket) @embedded
4447
45−(character) @constant.character
46−(escape_sequence) @constant.character.escape
48+(character) @string.special
49+(escape_sequence) @string.special
4750
4851; Other literals
4952;---------------
@@ -60,11 +63,13 @@
6063; Functions
6164;----------
6265
66+; parameter(s) in parens
6367[
64− (formal_parameters (value_identifier))
68+ (parameter (value_identifier))
6569 (labeled_parameter (value_identifier))
6670] @variable.parameter
6771
72+; single parameter with no parens
6873(function parameter: (value_identifier) @variable.parameter)
6974
7075; Meta
@@ -74,7 +79,7 @@
7479 "@"
7580 "@@"
7681 (decorator_identifier)
77−] @label
82+] @keyword.directive
7883
7984(extension_identifier) @keyword
8085("%") @keyword
@@ -82,13 +87,13 @@
8287; Misc
8388;-----
8489
85−(subscript_expression index: (string) @variable.other.member)
90+; (subscript_expression index: (string) @attribute)
8691(polyvar_type_pattern "#" @constant)
8792
8893[
8994 ("include")
9095 ("open")
91−] @keyword
96+] @keyword.control.import
9297
9398[
9499 "as"
@@ -96,25 +101,43 @@
96101 "external"
97102 "let"
98103 "module"
99− "mutable"
100104 "private"
101105 "rec"
102106 "type"
103107 "and"
104−] @keyword
108+ "assert"
109+ "async"
110+ "await"
111+ "with"
112+ "unpack"
113+] @keyword.storage.type
114+
115+"mutable" @keyword.storage.modifier
105116
106117[
107118 "if"
108119 "else"
109120 "switch"
110−] @keyword
121+ "when"
122+] @keyword.control.conditional
111123
112124[
113125 "exception"
114126 "try"
115127 "catch"
116− "raise"
117−] @keyword
128+] @keyword.control.exception
129+
130+(call_expression
131+ function: (value_identifier) @keyword.control.exception
132+ (#eq? @keyword.control.exception "raise"))
133+
134+[
135+ "for"
136+ "in"
137+ "to"
138+ "downto"
139+ "while"
140+] @keyword.control.conditional
118141
119142[
120143 "."
@@ -129,17 +152,15 @@
129152 "-"
130153 "-."
131154 "*"
155+ "**"
132156 "*."
133− "/"
134157 "/."
135− "<"
136158 "<="
137159 "=="
138160 "==="
139161 "!"
140162 "!="
141163 "!=="
142− ">"
143164 ">="
144165 "&&"
145166 "||"
@@ -151,6 +172,10 @@
151172 (uncurry)
152173] @operator
153174
175+; Explicitly enclose these operators with binary_expression
176+; to avoid confusion with JSX tag delimiters
177+(binary_expression ["<" ">" "/"] @operator)
178+
154179[
155180 "("
156181 ")"
@@ -172,7 +197,24 @@
172197 "~"
173198 "?"
174199 "=>"
200+ ".."
175201 "..."
176−] @punctuation
202+] @punctuation.special
177203
178204(ternary_expression ["?" ":"] @operator)
205+
206+; JSX
207+;----------
208+(jsx_identifier) @tag
209+(jsx_element
210+ open_tag: (jsx_opening_element ["<" ">"] @punctuation.special))
211+(jsx_element
212+ close_tag: (jsx_closing_element ["<" "/" ">"] @punctuation.special))
213+(jsx_self_closing_element ["/" ">" "<"] @punctuation.special)
214+(jsx_fragment [">" "<" "/"] @punctuation.special)
215+(jsx_attribute (property_identifier) @attribute)
216+
217+; Error
218+;----------
219+
220+(ERROR) @keyword.control.exception