@@ -0,0 +1,118 @@
1+; Attributes
2+; module declaration
3+(attribute
4+ name: (atom) @keyword
5+ (arguments (atom) @module)
6+ (#eq? @keyword "module"))
7+
8+(attribute
9+ name: (atom) @keyword
10+ (arguments
11+ .
12+ (atom) @module)
13+ (#eq? @keyword "import"))
14+
15+(attribute
16+ name: (atom) @keyword
17+ (arguments
18+ .
19+ (atom) @type
20+ [
21+ (tuple (atom) @variable.other.member)
22+ (tuple
23+ (binary_operator
24+ left: (atom) @variable.other.member
25+ operator: "="))
26+ (tuple
27+ (binary_operator
28+ left:
29+ (binary_operator
30+ left: (atom) @variable.other.member
31+ operator: "=")
32+ operator: "::"))
33+ ])
34+ (#eq? @keyword "record"))
35+
36+(attribute
37+ name: (atom) @keyword
38+ (arguments
39+ .
40+ [
41+ (atom) @keyword.directive
42+ (variable) @keyword.directive
43+ (call
44+ function:
45+ [(variable) (atom)] @keyword.directive)
46+ ])
47+ (#eq? @keyword "define"))
48+
49+(attribute
50+ name: (atom) @keyword
51+ module: (atom) @module
52+ (#eq? @keyword "spec"))
53+
54+; Functions
55+(function name: (atom) @function)
56+(call module: (atom) @module)
57+(call function: (atom) @function)
58+(stab_clause name: (atom) @function)
59+(function_capture module: (atom) @module)
60+(function_capture function: (atom) @function)
61+
62+; Records
63+(record_content
64+ (binary_operator
65+ left: (atom) @variable.other.member
66+ operator: "="))
67+
68+(record field: (atom) @variable.other.member)
69+(record name: (atom) @type)
70+
71+; Keywords
72+((attribute name: (atom) @keyword)
73+ (#match?
74+ @keyword
75+ "^(define|export|export_type|include|include_lib|ifdef|ifndef|if|elif|else|endif|vsn|on_load|behaviour|record|file|type|opaque|spec)$"))
76+
77+["case" "fun" "if" "of" "when" "end" "receive" "try" "catch" "after"] @keyword
78+
79+; Operators
80+(binary_operator
81+ left: (atom) @function
82+ operator: "/"
83+ right: (integer) @constant.numeric.integer)
84+
85+(binary_operator operator: _ @operator)
86+(unary_operator operator: _ @operator)
87+["/" ":" "#" "->"] @operator
88+
89+; Comments
90+((variable) @comment.discard
91+ (#match? @comment.discard "^_"))
92+
93+(tripledot) @comment.discard
94+
95+(comment) @comment
96+
97+; Macros
98+(macro
99+ "?"+ @keyword.directive
100+ name: (_) @keyword.directive)
101+
102+; Basic types
103+(variable) @variable
104+[
105+ (atom)
106+ (quoted_atom)
107+] @string.special.symbol
108+(string) @string
109+(character) @constant.character
110+
111+(integer) @constant.numeric.integer
112+(float) @constant.numeric.float
113+
114+; Punctuation
115+["," "." "-" ";"] @punctuation.delimiter
116+["(" ")" "{" "}" "[" "]" "<<" ">>"] @punctuation.bracket
117+
118+; (ERROR) @error