|
1 | | -; Modules |
2 | | -;-------- |
| 1 | +; Punctuation |
| 2 | +;------------ |
3 | 3 |
|
4 | | -[(module_name) (module_type_name)] @module |
| 4 | +[ |
| 5 | + "," "." ";" ":" "=" "|" "~" "?" "+" "-" "!" ">" "&" |
| 6 | + "->" ";;" ":>" "+=" ":=" ".." |
| 7 | +] @punctuation.delimiter |
5 | 8 |
|
6 | | -; Types |
7 | | -;------ |
| 9 | +["(" ")" "[" "]" "{" "}" "[|" "|]" "[<" "[>"] @punctuation.bracket |
8 | 10 |
|
9 | | -( |
10 | | - (type_constructor) @type.builtin |
11 | | - (#match? @type.builtin "^(int|char|bytes|string|float|bool|unit|exn|array|list|option|int32|int64|nativeint|format6|lazy_t)$") |
12 | | -) |
| 11 | +(object_type ["<" ">"] @punctuation.bracket) |
13 | 12 |
|
14 | | -[(class_name) (class_type_name) (type_constructor)] @type |
| 13 | +"%" @punctuation.special |
15 | 14 |
|
16 | | -[(constructor_name) (tag)] @constructor |
| 15 | +(attribute ["[@" "]"] @punctuation.special) |
| 16 | +(item_attribute ["[@@" "]"] @punctuation.special) |
| 17 | +(floating_attribute ["[@@@" "]"] @punctuation.special) |
| 18 | +(extension ["[%" "]"] @punctuation.special) |
| 19 | +(item_extension ["[%%" "]"] @punctuation.special) |
| 20 | +(quoted_extension ["{%" "}"] @punctuation.special) |
| 21 | +(quoted_item_extension ["{%%" "}"] @punctuation.special) |
17 | 22 |
|
18 | | -; Functions |
| 23 | +; Keywords |
| 24 | +;--------- |
| 25 | + |
| 26 | +[ |
| 27 | + "and" "as" "assert" "begin" "class" "constraint" "do" "done" "downto" "else" |
| 28 | + "end" "exception" "external" "for" "fun" "function" "functor" "if" "in" |
| 29 | + "include" "inherit" "initializer" "lazy" "let" "match" "method" "module" |
| 30 | + "mutable" "new" "nonrec" "object" "of" "open" "private" "rec" "sig" "struct" |
| 31 | + "then" "to" "try" "type" "val" "virtual" "when" "while" "with" |
| 32 | +] @keyword |
| 33 | + |
| 34 | +; Operators |
19 | 35 | ;---------- |
20 | 36 |
|
21 | | -(let_binding |
22 | | - pattern: (value_name) @function |
23 | | - (parameter)) |
| 37 | +[ |
| 38 | + (prefix_operator) |
| 39 | + (sign_operator) |
| 40 | + (pow_operator) |
| 41 | + (mult_operator) |
| 42 | + (add_operator) |
| 43 | + (concat_operator) |
| 44 | + (rel_operator) |
| 45 | + (and_operator) |
| 46 | + (or_operator) |
| 47 | + (assign_operator) |
| 48 | + (hash_operator) |
| 49 | + (indexing_operator) |
| 50 | + (let_operator) |
| 51 | + (let_and_operator) |
| 52 | + (match_operator) |
| 53 | +] @operator |
24 | 54 |
|
25 | | -(let_binding |
26 | | - pattern: (value_name) @function |
27 | | - body: [(fun_expression) (function_expression)]) |
| 55 | +(match_expression (match_operator) @keyword) |
28 | 56 |
|
29 | | -(value_specification (value_name) @function) |
| 57 | +(value_definition [(let_operator) (let_and_operator)] @keyword) |
30 | 58 |
|
31 | | -(external (value_name) @function) |
| 59 | +["*" "#" "::" "<-"] @operator |
32 | 60 |
|
33 | | -(method_name) @function.method |
| 61 | +; Constants |
| 62 | +;---------- |
34 | 63 |
|
35 | | -; Application |
36 | | -;------------ |
| 64 | +(boolean) @constant |
37 | 65 |
|
38 | | -( |
39 | | - (value_name) @function.builtin |
40 | | - (#match? @function.builtin "^(raise(_notrace)?|failwith|invalid_arg)$") |
41 | | -) |
| 66 | +[(number) (signed_number)] @number |
42 | 67 |
|
43 | | -(infix_expression |
44 | | - left: (value_path (value_name) @function) |
45 | | - operator: (concat_operator) @operator |
46 | | - (#eq? @operator "@@")) |
| 68 | +[(string) (character)] @string |
47 | 69 |
|
48 | | -(infix_expression |
49 | | - operator: (rel_operator) @operator |
50 | | - right: (value_path (value_name) @function) |
51 | | - (#eq? @operator "|>")) |
| 70 | +(quoted_string "{" @string "}" @string) @string |
52 | 71 |
|
53 | | -(application_expression |
54 | | - function: (value_path (value_name) @function)) |
| 72 | +(escape_sequence) @escape |
| 73 | + |
| 74 | +(conversion_specification) @string.special |
55 | 75 |
|
56 | 76 | ; Variables |
57 | 77 | ;---------- |
|
65 | 85 |
|
66 | 86 | [(label_name) (field_name) (instance_variable_name)] @property |
67 | 87 |
|
68 | | -; Constants |
| 88 | +; Functions |
69 | 89 | ;---------- |
70 | 90 |
|
71 | | -(boolean) @constant |
72 | | - |
73 | | -[(number) (signed_number)] @number |
74 | | - |
75 | | -[(string) (character)] @string |
76 | | - |
77 | | -(quoted_string "{" @string "}" @string) @string |
78 | | - |
79 | | -(escape_sequence) @escape |
| 91 | +(let_binding |
| 92 | + pattern: (value_name) @function |
| 93 | + (parameter)) |
80 | 94 |
|
81 | | -(conversion_specification) @string.special |
| 95 | +(let_binding |
| 96 | + pattern: (value_name) @function |
| 97 | + body: [(fun_expression) (function_expression)]) |
82 | 98 |
|
83 | | -; Operators |
84 | | -;---------- |
| 99 | +(value_specification (value_name) @function) |
85 | 100 |
|
86 | | -(match_expression (match_operator) @keyword) |
| 101 | +(external (value_name) @function) |
87 | 102 |
|
88 | | -(value_definition [(let_operator) (let_and_operator)] @keyword) |
| 103 | +(method_name) @function.method |
89 | 104 |
|
90 | | -[ |
91 | | - (prefix_operator) |
92 | | - (sign_operator) |
93 | | - (pow_operator) |
94 | | - (mult_operator) |
95 | | - (add_operator) |
96 | | - (concat_operator) |
97 | | - (rel_operator) |
98 | | - (and_operator) |
99 | | - (or_operator) |
100 | | - (assign_operator) |
101 | | - (hash_operator) |
102 | | - (indexing_operator) |
103 | | - (let_operator) |
104 | | - (let_and_operator) |
105 | | - (match_operator) |
106 | | -] @operator |
| 105 | +(application_expression |
| 106 | + function: (value_path (value_name) @function)) |
107 | 107 |
|
108 | | -["*" "#" "::" "<-"] @operator |
| 108 | +(infix_expression |
| 109 | + left: (value_path (value_name) @function) |
| 110 | + operator: (concat_operator) @operator |
| 111 | + (#eq? @operator "@@")) |
109 | 112 |
|
110 | | -; Keywords |
111 | | -;--------- |
| 113 | +(infix_expression |
| 114 | + operator: (rel_operator) @operator |
| 115 | + right: (value_path (value_name) @function) |
| 116 | + (#eq? @operator "|>")) |
112 | 117 |
|
113 | | -[ |
114 | | - "and" "as" "assert" "begin" "class" "constraint" "do" "done" "downto" "else" |
115 | | - "end" "exception" "external" "for" "fun" "function" "functor" "if" "in" |
116 | | - "include" "inherit" "initializer" "lazy" "let" "match" "method" "module" |
117 | | - "mutable" "new" "nonrec" "object" "of" "open" "private" "rec" "sig" "struct" |
118 | | - "then" "to" "try" "type" "val" "virtual" "when" "while" "with" |
119 | | -] @keyword |
| 118 | +( |
| 119 | + (value_name) @function.builtin |
| 120 | + (#match? @function.builtin "^(raise(_notrace)?|failwith|invalid_arg)$") |
| 121 | +) |
120 | 122 |
|
121 | | -; Punctuation |
122 | | -;------------ |
| 123 | +; Types |
| 124 | +;------ |
123 | 125 |
|
124 | | -(attribute ["[@" "]"] @punctuation.special) |
125 | | -(item_attribute ["[@@" "]"] @punctuation.special) |
126 | | -(floating_attribute ["[@@@" "]"] @punctuation.special) |
127 | | -(extension ["[%" "]"] @punctuation.special) |
128 | | -(item_extension ["[%%" "]"] @punctuation.special) |
129 | | -(quoted_extension ["{%" "}"] @punctuation.special) |
130 | | -(quoted_item_extension ["{%%" "}"] @punctuation.special) |
| 126 | +[(class_name) (class_type_name) (type_constructor)] @type |
131 | 127 |
|
132 | | -"%" @punctuation.special |
| 128 | +( |
| 129 | + (type_constructor) @type.builtin |
| 130 | + (#match? @type.builtin "^(int|char|bytes|string|float|bool|unit|exn|array|list|option|int32|int64|nativeint|format6|lazy_t)$") |
| 131 | +) |
133 | 132 |
|
134 | | -["(" ")" "[" "]" "{" "}" "[|" "|]" "[<" "[>"] @punctuation.bracket |
| 133 | +[(constructor_name) (tag)] @constructor |
135 | 134 |
|
136 | | -(object_type ["<" ">"] @punctuation.bracket) |
| 135 | +; Modules |
| 136 | +;-------- |
137 | 137 |
|
138 | | -[ |
139 | | - "," "." ";" ":" "=" "|" "~" "?" "+" "-" "!" ">" "&" |
140 | | - "->" ";;" ":>" "+=" ":=" ".." |
141 | | -] @punctuation.delimiter |
| 138 | +[(module_name) (module_type_name)] @module |
142 | 139 |
|
143 | 140 | ; Attributes |
144 | 141 | ;----------- |
|
0 commit comments