@@ -0,0 +1,176 @@
1+[
2+ (line_comment)
3+ (block_comment)
4+] @comment
5+
6+(bool) @constant.builtin.boolean
7+(integer) @constant.numeric.integer
8+(float) @constant.numeric.float
9+(character) @constant.character
10+
11+;; strings and docstring
12+(source_file docstring: (string) @string.special)
13+(entity docstring: (string) @string.special)
14+(method docstring: (string) @string.special) ; docstring for methods without body
15+(behavior docstring: (string) @string.special) ; docstring for methods without body
16+(constructor docstring: (string) @string.special) ; docstring for methods without body
17+(method body: (block . (string) @string.special)) ; docstring for methods with body
18+(behavior body: (block . (string) @string.special))
19+(constructor body: (block . (string) @string.special))
20+(field docstring: (string) @string.special)
21+(string) @string
22+
23+;; Punctuation
24+[
25+ "("
26+ ")"
27+ "{"
28+ "}"
29+ "["
30+ "]"
31+] @punctuation.bracket
32+[
33+ ";"
34+ "."
35+ ","
36+] @punctuation.delimiter
37+
38+(this) @variable.builtin
39+
40+(field name: (identifier) @variable.other.member)
41+
42+"use" @keyword.control.import
43+[
44+ "for"
45+ "in"
46+ "while"
47+ "do"
48+ "repeat"
49+ "until"
50+] @keyword.control.repeat
51+[
52+ "if"
53+ "ifdef"
54+ "iftype"
55+ "then"
56+ "elseif"
57+ "else"
58+ "match"
59+] @keyword.control.conditional
60+[
61+ "break"
62+ "continue"
63+ "return"
64+ "error"
65+ "compile_error"
66+ "compile_intrinsic"
67+] @keyword.control.return
68+[
69+ "recover"
70+ "consume"
71+ "end"
72+ "try"
73+ "with"
74+] @keyword.control
75+
76+[
77+ "as"
78+ "is"
79+ "isnt"
80+ "not"
81+ "and"
82+ "or"
83+ "xor"
84+ "digestof"
85+ "addressof"
86+ (location)
87+] @keyword.operator
88+
89+(entity_type) @keyword.storage.type
90+
91+[
92+ "var"
93+ "let"
94+ "embed"
95+] @keyword.storage
96+
97+[
98+ "fun"
99+ "be"
100+ "new"
101+] @keyword.function
102+
103+[
104+ (cap)
105+ (gencap)
106+ "where"
107+] @keyword
108+
109+[
110+ (partial)
111+ "=>"
112+ "~"
113+ ".>"
114+ "+"
115+ "-"
116+ "*"
117+ "/"
118+ "%"
119+ "%%"
120+ "+~"
121+ "-~"
122+ "/~"
123+ "*~"
124+ "%~"
125+ "%%~"
126+
127+ ">>"
128+ "<<"
129+ ">>~"
130+ "<<~"
131+
132+ "=="
133+ "!="
134+ ">"
135+ "<"
136+ ">="
137+ "<="
138+] @operator
139+
140+;; Types
141+(entity name: (identifier) @type)
142+(nominal_type name: (identifier) @type)
143+(typeparams (typeparam name: (identifier) @type))
144+
145+;; constructors / methods / behaviors
146+(constructor name: (identifier) @constructor)
147+(method name: (identifier) @function.method)
148+(behavior name: (identifier) @function.method)
149+
150+;; method calls
151+; TODO: be more specific about what is the actual function reference
152+(call callee: (field_access field: (identifier) @function.method))
153+(call callee: (_) @function.method)
154+(ffi_call name: (_) @function)
155+(partial_application function: (identifier) @function.method)
156+(chain function: (identifier) @function.method)
157+
158+;; fields and params
159+(field name: (identifier) @variable.other.member)
160+(param (identifier) @variable.parameter)
161+(lambdaparam (identifier) @variable.parameter)
162+
163+;; this.field is considered a member access
164+(field_access base: (this) field: (identifier) @variable.other.member)
165+
166+;; annotations
167+(annotations (identifier) @attribute)
168+
169+;; variables
170+;; references to upper case things are considered constructors
171+(
172+ (identifier) @constructor
173+ (#match @constructor "^[A-Z]")
174+)
175+(identifier) @variable
176+