summaryrefslogtreecommitdiffstats
path: root/misc/syntax/erlang.syntax
blob: cfed3ce302f9abcd75cc0dd1e92b79d2a5d0346c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# -------------------------------
#
# Erlang programming language syntax highlighting
# for CoolEdit
#
# Homepage of Erlang: http://www.erlang.org
#
# Author: Witold Baryluk < baryluk at smp if uj edu pl >
# Date: 07-07-2009, 08-02-2009
#
# -------------------------------
#
# Useful links:
# http://www.erlang.org/doc/doc-5.4.13/doc/reference_manual/part_frame.html
# http://www.erlang.org/doc/reference_manual/data_types.html#2.14
# http://www.regular-expressions.info/reference.html
# gedit: http://martin.ankerl.com/files/erlang.lang
# joe: http://www.straatinvestments.com/~tlack/erlang/joe-editor/erlang.jsf
# geshi: http://www.kreisquadratur.de/blog/?p=305
# vim: http://erlang.org/pipermail/erlang-questions/2006-July/021362.html
# kate: http://bugsfiles.kde.org/attachment.cgi?id=21155
#
# entries for Syntax file:
#
# file ..\*\\.erl$ Erlang\sProgram (-module\\(|#!.*escript)
# include erlang.syntax
#
# file ..\*\\.hrl$ Erlang\sHeader -record\\(
# include erlang.syntax

context default
    keyword whole after yellow
    keyword whole and brown
    keyword whole andalso brown
    keyword whole band brown
    keyword whole begin yellow
    keyword whole bnot brown
    keyword whole bor brown
    keyword whole bsl brown
    keyword whole bsr brown
    keyword whole bxor brown
    keyword whole case yellow
    keyword whole catch yellow
    keyword whole cond yellow
    keyword whole div brown
    keyword whole end yellow
    keyword whole fun yellow
    keyword whole if yellow
    keyword whole let yellow
    keyword whole not brown
    keyword whole of yellow
    keyword whole or brown
    keyword whole orelse brown
    keyword whole query yellow
    keyword whole receive yellow
    keyword whole rem brown
    keyword whole try yellow
    keyword whole throw yellow
    keyword whole xor brown

    keyword whole when yellow

    keyword whole -module brightmagenta
    keyword whole -compile brightmagenta
    keyword whole -behaviour brightmagenta
    keyword whole -record brightmagenta
    keyword whole -define brightmagenta
    keyword whole -include brightmagenta
    keyword whole -include_lib brightmagenta
    keyword whole -vsn magenta
    keyword whole -author magenta
    keyword whole -copyright magenta
    keyword whole -export brightmagenta
    keyword whole -\{abcdefghijklmnoprqstuvwxyz\}\[abcdefghijklmnoprqstuvwxyzABCDEFGHIJKLMNOPRQSTVWXYZ0123456789_\] red

# erlang:*
    keyword whole abs brightgreen
    keyword whole accept brightgreen
    keyword whole alarm brightgreen
    keyword whole apply brightgreen
    keyword whole atom_to_list brightgreen
    keyword whole binary_to_list brightgreen
    keyword whole binary_to_term brightgreen
    keyword whole check_process_code brightgreen
    keyword whole concat_binary brightgreen
    keyword whole date brightgreen
    keyword whole delete_module brightgreen
    keyword whole disconnect_node brightgreen
    keyword whole element brightgreen
    keyword whole erase brightgreen
    keyword whole exit brightgreen
    keyword whole float brightgreen
    keyword whole float_to_list brightgreen
    keyword whole garbage_collect brightgreen
    keyword whole get brightgreen
    keyword whole get_keys brightgreen
    keyword whole group_leader brightgreen
    keyword whole halt brightgreen
    keyword whole hd brightgreen
    keyword whole integer_to_list brightgreen
    keyword whole is_alive brightgreen
    keyword whole is_atom brightgreen
    keyword whole is_binary brightgreen
    keyword whole is_boolean brightgreen
    keyword whole is_float brightgreen
    keyword whole is_function brightgreen
    keyword whole is_integer brightgreen
    keyword whole is_list brightgreen
    keyword whole is_number brightgreen
    keyword whole is_pid brightgreen
    keyword whole is_port brightgreen
    keyword whole is_process_alive brightgreen
    keyword whole is_record brightgreen
    keyword whole is_reference brightgreen
    keyword whole is_tuple brightgreen
    keyword whole length brightgreen
    keyword whole link brightgreen
    keyword whole list_to_atom brightgreen
    keyword whole list_to_binary brightgreen
    keyword whole list_to_float brightgreen
    keyword whole list_to_integer brightgreen
    keyword whole list_to_pid brightgreen
    keyword whole list_to_tuple brightgreen
    keyword whole load_module brightgreen
    keyword whole loaded brightgreen
    keyword whole localtime brightgreen
    keyword whole make_ref brightgreen
    keyword whole module_loaded brightgreen
    keyword whole node brightgreen
    keyword whole nodes brightgreen
    keyword whole now brightgreen
    keyword whole open_port brightgreen
    keyword whole pid_to_list brightgreen
    keyword whole port_close brightgreen
    keyword whole port_command brightgreen
    keyword whole port_connect brightgreen
    keyword whole port_control brightgreen
    keyword whole ports brightgreen
    keyword whole pre_loaded brightgreen
    keyword whole process_flag brightgreen
    keyword whole process_info brightgreen
    keyword whole processes brightgreen
    keyword whole purge_module brightgreen
    keyword whole put brightgreen
    keyword whole register brightgreen
    keyword whole registered brightgreen
    keyword whole round brightgreen
    keyword whole self brightgreen
    keyword whole setelement brightgreen
    keyword whole size brightgreen
    keyword whole spawn brightgreen
    keyword whole spawn_link brightgreen
    keyword whole spawn_opt brightgreen
    keyword whole split_binary brightgreen
    keyword whole statistics brightgreen
    keyword whole term_to_binary brightgreen
    keyword whole throw brightgreen
    keyword whole time brightgreen
    keyword whole tl brightgreen
    keyword whole trunc brightgreen
    keyword whole tuple_to_list brightgreen
    keyword whole unlink brightgreen
    keyword whole unregister brightgreen
    keyword whole whereis brightgreen

    keyword whole gen_server:cast brightgreen
    keyword whole gen_server:call brightgreen
    keyword whole gen_server:reply brightgreen
    keyword whole gen_server:start_link brightgreen
    keyword whole gen_server:start brightgreen
    keyword whole io:format brightgreen

    keyword whole init white
    keyword whole handle_cast white
    keyword whole handle_call white
    keyword whole handle_info white
    keyword whole handle_event white
    keyword whole handle_sync_event white
    keyword whole terminate white
    keyword whole code_change white

# list comprehension
    keyword <- yellow
# clause
    keyword -> yellow
# guards
    keyword =:= brown
    keyword == brown
    keyword /= brown
    keyword =/= brown
# binary
    keyword << brightcyan
    keyword >> brightcyan
# guards
    keyword < brown
    keyword =< brown
    keyword >= brown
    keyword > brown
# ops
    keyword - yellow
    keyword \+ yellow
    keyword / yellow
    keyword \* yellow

    keyword ; brightcyan
    keyword , brightcyan
    keyword . brightcyan
    keyword = yellow
    keyword % brown

    keyword \+\+ yellow
    keyword -- yellow
    keyword ! yellow
# TODO this does not work for $" or $', use $\" or $\' instead. ?
    keyword $\{abcdefghijklmnoprqstuvwxyzABCDEFGHIJKLMNOPRQSTUVWXYZ0123456789_{}[]()(\\/`~!@#$%^&\*+-=;:'"|,./?<>\} red
    keyword $\ red

#    keyword '\\\{0123\}\{01234567\}\{01234567\}' brightgreen

# TODO: integers, inegers of form Base#digits, 2#1010101
# todo: records access via #state{}

    keyword whole ?MODULE red
    keyword whole ?LINE red
    keyword whole ?FILE red
    keyword whole ?\[abcdefghijklmnoprqstuvwxyzABCDEFGHIJKLMNOPRQSTUVWXYZ0123456789_@\] red

# gray operatory
# cyan - moduly


    keyword whole true red
    keyword whole false red

    keyword [ brightcyan
    keyword || brightcyan
    keyword | brightcyan
    keyword ] brightcyan
    keyword ( brightcyan
    keyword ) brightcyan
    keyword { cyan
    keyword } cyan

    keyword whole lists:seq gray
    keyword whole lists:map gray
    keyword whole lists:filter gray
    keyword whole lists:reduce gray
    keyword whole lists:foldl gray
    keyword whole lists:foldr gray
    keyword whole lists:append gray
    keyword whole lists:nth gray
    keyword whole behaviour_info gray
    keyword whole dict:find gray
    keyword whole dict:is_key gray
    keyword whole dict:erase gray
    keyword whole dict:new gray
    keyword whole dict:map gray
    keyword whole dict:store gray
    keyword whole dict:fetch_keys gray
    keyword whole dict:append gray
    keyword whole dict:update gray
    keyword whole dict:update_counter gray
    keyword whole dict:fold gray
    keyword whole dict:to_list gray
    keyword whole dict:fetch gray

# todo: no more than one dot in atom, and not at the end
    keyword whole \{abcdefghijklmnoprqstuvwxyz\}\[abcdefghijklmnoprqstuvwxyzABCDEFGHIJKLMNOPRQSTUVWXYZ0123456789_.@\] lightgray
    keyword whole \{_ABCDEFGHIJKLMNOPRQSTUVWXYZ\}\[abcdefghijklmnoprqstuvwxyzABCDEFGHIJKLMNOPRQSTUVWXYZ0123456789_@\] white

context exclusive % \n brown
    spellcheck

context " " green
    spellcheck
    keyword ~p brightgreen
    keyword ~n brightgreen
    keyword ~w brightgreen
    keyword ~~ brightgreen
    keyword \\" brightgreen
    keyword \\\{0123\}\{01234567\}\{01234567\} brightgreen
    keyword \\\{01234567\}\{01234567\} brightgreen
    keyword \\\{01234567\} brightgreen
    keyword \\x\{0123456789abcdefABCDEF\}\{0123456789abcdefABCDEF\} brightgreen
    keyword \\\\ brightgreen
    keyword \\' brightgreen
    keyword \\\{bdefrstv\} brightgreen
    keyword \\^\{abcdefghijklmnoprqstuvwxyzABCDEFGHIJKLMNOPRQSTUVWXYZ\} brightgreen

context ' ' red
    keyword \\" brightred
    keyword \\\{0123\}\{01234567\}\{01234567\} brightred
    keyword \\\{01234567\}\{01234567\} brightred
    keyword \\\{01234567\} brightred
    keyword \\x\{0123456789abcdefABCDEF\}\{0123456789abcdefABCDEF\} brightred
    keyword \\\\ brightred
    keyword \\' brightred
    keyword \\\{bdefrstv\} brightred
    keyword \\^\{abcdefghijklmnoprqstuvwxyzABCDEFGHIJKLMNOPRQSTUVWXYZ\} brightred