1
|
ace.define("ace/mode/erlang_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
|
2
|
"use strict";
|
3
|
|
4
|
var oop = require("../lib/oop");
|
5
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
6
|
|
7
|
var ErlangHighlightRules = function() {
|
8
|
|
9
|
this.$rules = { start:
|
10
|
[ { include: '#module-directive' },
|
11
|
{ include: '#import-export-directive' },
|
12
|
{ include: '#behaviour-directive' },
|
13
|
{ include: '#record-directive' },
|
14
|
{ include: '#define-directive' },
|
15
|
{ include: '#macro-directive' },
|
16
|
{ include: '#directive' },
|
17
|
{ include: '#function' },
|
18
|
{ include: '#everything-else' } ],
|
19
|
'#atom':
|
20
|
[ { token: 'punctuation.definition.symbol.begin.erlang',
|
21
|
regex: '\'',
|
22
|
push:
|
23
|
[ { token: 'punctuation.definition.symbol.end.erlang',
|
24
|
regex: '\'',
|
25
|
next: 'pop' },
|
26
|
{ token:
|
27
|
[ 'punctuation.definition.escape.erlang',
|
28
|
'constant.other.symbol.escape.erlang',
|
29
|
'punctuation.definition.escape.erlang',
|
30
|
'constant.other.symbol.escape.erlang',
|
31
|
'constant.other.symbol.escape.erlang' ],
|
32
|
regex: '(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
|
33
|
{ token: 'invalid.illegal.atom.erlang', regex: '\\\\\\^?.?' },
|
34
|
{ defaultToken: 'constant.other.symbol.quoted.single.erlang' } ] },
|
35
|
{ token: 'constant.other.symbol.unquoted.erlang',
|
36
|
regex: '[a-z][a-zA-Z\\d@_]*' } ],
|
37
|
'#behaviour-directive':
|
38
|
[ { token:
|
39
|
[ 'meta.directive.behaviour.erlang',
|
40
|
'punctuation.section.directive.begin.erlang',
|
41
|
'meta.directive.behaviour.erlang',
|
42
|
'keyword.control.directive.behaviour.erlang',
|
43
|
'meta.directive.behaviour.erlang',
|
44
|
'punctuation.definition.parameters.begin.erlang',
|
45
|
'meta.directive.behaviour.erlang',
|
46
|
'entity.name.type.class.behaviour.definition.erlang',
|
47
|
'meta.directive.behaviour.erlang',
|
48
|
'punctuation.definition.parameters.end.erlang',
|
49
|
'meta.directive.behaviour.erlang',
|
50
|
'punctuation.section.directive.end.erlang' ],
|
51
|
regex: '^(\\s*)(-)(\\s*)(behaviour)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\))(\\s*)(\\.)' } ],
|
52
|
'#binary':
|
53
|
[ { token: 'punctuation.definition.binary.begin.erlang',
|
54
|
regex: '<<',
|
55
|
push:
|
56
|
[ { token: 'punctuation.definition.binary.end.erlang',
|
57
|
regex: '>>',
|
58
|
next: 'pop' },
|
59
|
{ token:
|
60
|
[ 'punctuation.separator.binary.erlang',
|
61
|
'punctuation.separator.value-size.erlang' ],
|
62
|
regex: '(,)|(:)' },
|
63
|
{ include: '#internal-type-specifiers' },
|
64
|
{ include: '#everything-else' },
|
65
|
{ defaultToken: 'meta.structure.binary.erlang' } ] } ],
|
66
|
'#character':
|
67
|
[ { token:
|
68
|
[ 'punctuation.definition.character.erlang',
|
69
|
'punctuation.definition.escape.erlang',
|
70
|
'constant.character.escape.erlang',
|
71
|
'punctuation.definition.escape.erlang',
|
72
|
'constant.character.escape.erlang',
|
73
|
'constant.character.escape.erlang' ],
|
74
|
regex: '(\\$)(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
|
75
|
{ token: 'invalid.illegal.character.erlang',
|
76
|
regex: '\\$\\\\\\^?.?' },
|
77
|
{ token:
|
78
|
[ 'punctuation.definition.character.erlang',
|
79
|
'constant.character.erlang' ],
|
80
|
regex: '(\\$)(\\S)' },
|
81
|
{ token: 'invalid.illegal.character.erlang', regex: '\\$.?' } ],
|
82
|
'#comment':
|
83
|
[ { token: 'punctuation.definition.comment.erlang',
|
84
|
regex: '%.*$',
|
85
|
push_:
|
86
|
[ { token: 'comment.line.percentage.erlang',
|
87
|
regex: '$',
|
88
|
next: 'pop' },
|
89
|
{ defaultToken: 'comment.line.percentage.erlang' } ] } ],
|
90
|
'#define-directive':
|
91
|
[ { token:
|
92
|
[ 'meta.directive.define.erlang',
|
93
|
'punctuation.section.directive.begin.erlang',
|
94
|
'meta.directive.define.erlang',
|
95
|
'keyword.control.directive.define.erlang',
|
96
|
'meta.directive.define.erlang',
|
97
|
'punctuation.definition.parameters.begin.erlang',
|
98
|
'meta.directive.define.erlang',
|
99
|
'entity.name.function.macro.definition.erlang',
|
100
|
'meta.directive.define.erlang',
|
101
|
'punctuation.separator.parameters.erlang' ],
|
102
|
regex: '^(\\s*)(-)(\\s*)(define)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(,)',
|
103
|
push:
|
104
|
[ { token:
|
105
|
[ 'punctuation.definition.parameters.end.erlang',
|
106
|
'meta.directive.define.erlang',
|
107
|
'punctuation.section.directive.end.erlang' ],
|
108
|
regex: '(\\))(\\s*)(\\.)',
|
109
|
next: 'pop' },
|
110
|
{ include: '#everything-else' },
|
111
|
{ defaultToken: 'meta.directive.define.erlang' } ] },
|
112
|
{ token: 'meta.directive.define.erlang',
|
113
|
regex: '(?=^\\s*-\\s*define\\s*\\(\\s*[a-zA-Z\\d@_]+\\s*\\()',
|
114
|
push:
|
115
|
[ { token:
|
116
|
[ 'punctuation.definition.parameters.end.erlang',
|
117
|
'meta.directive.define.erlang',
|
118
|
'punctuation.section.directive.end.erlang' ],
|
119
|
regex: '(\\))(\\s*)(\\.)',
|
120
|
next: 'pop' },
|
121
|
{ token:
|
122
|
[ 'text',
|
123
|
'punctuation.section.directive.begin.erlang',
|
124
|
'text',
|
125
|
'keyword.control.directive.define.erlang',
|
126
|
'text',
|
127
|
'punctuation.definition.parameters.begin.erlang',
|
128
|
'text',
|
129
|
'entity.name.function.macro.definition.erlang',
|
130
|
'text',
|
131
|
'punctuation.definition.parameters.begin.erlang' ],
|
132
|
regex: '^(\\s*)(-)(\\s*)(define)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\()',
|
133
|
push:
|
134
|
[ { token:
|
135
|
[ 'punctuation.definition.parameters.end.erlang',
|
136
|
'text',
|
137
|
'punctuation.separator.parameters.erlang' ],
|
138
|
regex: '(\\))(\\s*)(,)',
|
139
|
next: 'pop' },
|
140
|
{ token: 'punctuation.separator.parameters.erlang', regex: ',' },
|
141
|
{ include: '#everything-else' } ] },
|
142
|
{ token: 'punctuation.separator.define.erlang',
|
143
|
regex: '\\|\\||\\||:|;|,|\\.|->' },
|
144
|
{ include: '#everything-else' },
|
145
|
{ defaultToken: 'meta.directive.define.erlang' } ] } ],
|
146
|
'#directive':
|
147
|
[ { token:
|
148
|
[ 'meta.directive.erlang',
|
149
|
'punctuation.section.directive.begin.erlang',
|
150
|
'meta.directive.erlang',
|
151
|
'keyword.control.directive.erlang',
|
152
|
'meta.directive.erlang',
|
153
|
'punctuation.definition.parameters.begin.erlang' ],
|
154
|
regex: '^(\\s*)(-)(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\(?)',
|
155
|
push:
|
156
|
[ { token:
|
157
|
[ 'punctuation.definition.parameters.end.erlang',
|
158
|
'meta.directive.erlang',
|
159
|
'punctuation.section.directive.end.erlang' ],
|
160
|
regex: '(\\)?)(\\s*)(\\.)',
|
161
|
next: 'pop' },
|
162
|
{ include: '#everything-else' },
|
163
|
{ defaultToken: 'meta.directive.erlang' } ] },
|
164
|
{ token:
|
165
|
[ 'meta.directive.erlang',
|
166
|
'punctuation.section.directive.begin.erlang',
|
167
|
'meta.directive.erlang',
|
168
|
'keyword.control.directive.erlang',
|
169
|
'meta.directive.erlang',
|
170
|
'punctuation.section.directive.end.erlang' ],
|
171
|
regex: '^(\\s*)(-)(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\.)' } ],
|
172
|
'#everything-else':
|
173
|
[ { include: '#comment' },
|
174
|
{ include: '#record-usage' },
|
175
|
{ include: '#macro-usage' },
|
176
|
{ include: '#expression' },
|
177
|
{ include: '#keyword' },
|
178
|
{ include: '#textual-operator' },
|
179
|
{ include: '#function-call' },
|
180
|
{ include: '#tuple' },
|
181
|
{ include: '#list' },
|
182
|
{ include: '#binary' },
|
183
|
{ include: '#parenthesized-expression' },
|
184
|
{ include: '#character' },
|
185
|
{ include: '#number' },
|
186
|
{ include: '#atom' },
|
187
|
{ include: '#string' },
|
188
|
{ include: '#symbolic-operator' },
|
189
|
{ include: '#variable' } ],
|
190
|
'#expression':
|
191
|
[ { token: 'keyword.control.if.erlang',
|
192
|
regex: '\\bif\\b',
|
193
|
push:
|
194
|
[ { token: 'keyword.control.end.erlang',
|
195
|
regex: '\\bend\\b',
|
196
|
next: 'pop' },
|
197
|
{ include: '#internal-expression-punctuation' },
|
198
|
{ include: '#everything-else' },
|
199
|
{ defaultToken: 'meta.expression.if.erlang' } ] },
|
200
|
{ token: 'keyword.control.case.erlang',
|
201
|
regex: '\\bcase\\b',
|
202
|
push:
|
203
|
[ { token: 'keyword.control.end.erlang',
|
204
|
regex: '\\bend\\b',
|
205
|
next: 'pop' },
|
206
|
{ include: '#internal-expression-punctuation' },
|
207
|
{ include: '#everything-else' },
|
208
|
{ defaultToken: 'meta.expression.case.erlang' } ] },
|
209
|
{ token: 'keyword.control.receive.erlang',
|
210
|
regex: '\\breceive\\b',
|
211
|
push:
|
212
|
[ { token: 'keyword.control.end.erlang',
|
213
|
regex: '\\bend\\b',
|
214
|
next: 'pop' },
|
215
|
{ include: '#internal-expression-punctuation' },
|
216
|
{ include: '#everything-else' },
|
217
|
{ defaultToken: 'meta.expression.receive.erlang' } ] },
|
218
|
{ token:
|
219
|
[ 'keyword.control.fun.erlang',
|
220
|
'text',
|
221
|
'entity.name.type.class.module.erlang',
|
222
|
'text',
|
223
|
'punctuation.separator.module-function.erlang',
|
224
|
'text',
|
225
|
'entity.name.function.erlang',
|
226
|
'text',
|
227
|
'punctuation.separator.function-arity.erlang' ],
|
228
|
regex: '\\b(fun)(\\s*)(?:([a-z][a-zA-Z\\d@_]*)(\\s*)(:)(\\s*))?([a-z][a-zA-Z\\d@_]*)(\\s*)(/)' },
|
229
|
{ token: 'keyword.control.fun.erlang',
|
230
|
regex: '\\bfun\\b',
|
231
|
push:
|
232
|
[ { token: 'keyword.control.end.erlang',
|
233
|
regex: '\\bend\\b',
|
234
|
next: 'pop' },
|
235
|
{ token: 'text',
|
236
|
regex: '(?=\\()',
|
237
|
push:
|
238
|
[ { token: 'punctuation.separator.clauses.erlang',
|
239
|
regex: ';|(?=\\bend\\b)',
|
240
|
next: 'pop' },
|
241
|
{ include: '#internal-function-parts' } ] },
|
242
|
{ include: '#everything-else' },
|
243
|
{ defaultToken: 'meta.expression.fun.erlang' } ] },
|
244
|
{ token: 'keyword.control.try.erlang',
|
245
|
regex: '\\btry\\b',
|
246
|
push:
|
247
|
[ { token: 'keyword.control.end.erlang',
|
248
|
regex: '\\bend\\b',
|
249
|
next: 'pop' },
|
250
|
{ include: '#internal-expression-punctuation' },
|
251
|
{ include: '#everything-else' },
|
252
|
{ defaultToken: 'meta.expression.try.erlang' } ] },
|
253
|
{ token: 'keyword.control.begin.erlang',
|
254
|
regex: '\\bbegin\\b',
|
255
|
push:
|
256
|
[ { token: 'keyword.control.end.erlang',
|
257
|
regex: '\\bend\\b',
|
258
|
next: 'pop' },
|
259
|
{ include: '#internal-expression-punctuation' },
|
260
|
{ include: '#everything-else' },
|
261
|
{ defaultToken: 'meta.expression.begin.erlang' } ] },
|
262
|
{ token: 'keyword.control.query.erlang',
|
263
|
regex: '\\bquery\\b',
|
264
|
push:
|
265
|
[ { token: 'keyword.control.end.erlang',
|
266
|
regex: '\\bend\\b',
|
267
|
next: 'pop' },
|
268
|
{ include: '#everything-else' },
|
269
|
{ defaultToken: 'meta.expression.query.erlang' } ] } ],
|
270
|
'#function':
|
271
|
[ { token:
|
272
|
[ 'meta.function.erlang',
|
273
|
'entity.name.function.definition.erlang',
|
274
|
'meta.function.erlang' ],
|
275
|
regex: '^(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(?=\\()',
|
276
|
push:
|
277
|
[ { token: 'punctuation.terminator.function.erlang',
|
278
|
regex: '\\.',
|
279
|
next: 'pop' },
|
280
|
{ token: [ 'text', 'entity.name.function.erlang', 'text' ],
|
281
|
regex: '^(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(?=\\()' },
|
282
|
{ token: 'text',
|
283
|
regex: '(?=\\()',
|
284
|
push:
|
285
|
[ { token: 'punctuation.separator.clauses.erlang',
|
286
|
regex: ';|(?=\\.)',
|
287
|
next: 'pop' },
|
288
|
{ include: '#parenthesized-expression' },
|
289
|
{ include: '#internal-function-parts' } ] },
|
290
|
{ include: '#everything-else' },
|
291
|
{ defaultToken: 'meta.function.erlang' } ] } ],
|
292
|
'#function-call':
|
293
|
[ { token: 'meta.function-call.erlang',
|
294
|
regex: '(?=(?:[a-z][a-zA-Z\\d@_]*|\'[^\']*\')\\s*(?:\\(|:\\s*(?:[a-z][a-zA-Z\\d@_]*|\'[^\']*\')\\s*\\())',
|
295
|
push:
|
296
|
[ { token: 'punctuation.definition.parameters.end.erlang',
|
297
|
regex: '\\)',
|
298
|
next: 'pop' },
|
299
|
{ token:
|
300
|
[ 'entity.name.type.class.module.erlang',
|
301
|
'text',
|
302
|
'punctuation.separator.module-function.erlang',
|
303
|
'text',
|
304
|
'entity.name.function.guard.erlang',
|
305
|
'text',
|
306
|
'punctuation.definition.parameters.begin.erlang' ],
|
307
|
regex: '(?:(erlang)(\\s*)(:)(\\s*))?(is_atom|is_binary|is_constant|is_float|is_function|is_integer|is_list|is_number|is_pid|is_port|is_reference|is_tuple|is_record|abs|element|hd|length|node|round|self|size|tl|trunc)(\\s*)(\\()',
|
308
|
push:
|
309
|
[ { token: 'text', regex: '(?=\\))', next: 'pop' },
|
310
|
{ token: 'punctuation.separator.parameters.erlang', regex: ',' },
|
311
|
{ include: '#everything-else' } ] },
|
312
|
{ token:
|
313
|
[ 'entity.name.type.class.module.erlang',
|
314
|
'text',
|
315
|
'punctuation.separator.module-function.erlang',
|
316
|
'text',
|
317
|
'entity.name.function.erlang',
|
318
|
'text',
|
319
|
'punctuation.definition.parameters.begin.erlang' ],
|
320
|
regex: '(?:([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(:)(\\s*))?([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(\\()',
|
321
|
push:
|
322
|
[ { token: 'text', regex: '(?=\\))', next: 'pop' },
|
323
|
{ token: 'punctuation.separator.parameters.erlang', regex: ',' },
|
324
|
{ include: '#everything-else' } ] },
|
325
|
{ defaultToken: 'meta.function-call.erlang' } ] } ],
|
326
|
'#import-export-directive':
|
327
|
[ { token:
|
328
|
[ 'meta.directive.import.erlang',
|
329
|
'punctuation.section.directive.begin.erlang',
|
330
|
'meta.directive.import.erlang',
|
331
|
'keyword.control.directive.import.erlang',
|
332
|
'meta.directive.import.erlang',
|
333
|
'punctuation.definition.parameters.begin.erlang',
|
334
|
'meta.directive.import.erlang',
|
335
|
'entity.name.type.class.module.erlang',
|
336
|
'meta.directive.import.erlang',
|
337
|
'punctuation.separator.parameters.erlang' ],
|
338
|
regex: '^(\\s*)(-)(\\s*)(import)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(,)',
|
339
|
push:
|
340
|
[ { token:
|
341
|
[ 'punctuation.definition.parameters.end.erlang',
|
342
|
'meta.directive.import.erlang',
|
343
|
'punctuation.section.directive.end.erlang' ],
|
344
|
regex: '(\\))(\\s*)(\\.)',
|
345
|
next: 'pop' },
|
346
|
{ include: '#internal-function-list' },
|
347
|
{ defaultToken: 'meta.directive.import.erlang' } ] },
|
348
|
{ token:
|
349
|
[ 'meta.directive.export.erlang',
|
350
|
'punctuation.section.directive.begin.erlang',
|
351
|
'meta.directive.export.erlang',
|
352
|
'keyword.control.directive.export.erlang',
|
353
|
'meta.directive.export.erlang',
|
354
|
'punctuation.definition.parameters.begin.erlang' ],
|
355
|
regex: '^(\\s*)(-)(\\s*)(export)(\\s*)(\\()',
|
356
|
push:
|
357
|
[ { token:
|
358
|
[ 'punctuation.definition.parameters.end.erlang',
|
359
|
'meta.directive.export.erlang',
|
360
|
'punctuation.section.directive.end.erlang' ],
|
361
|
regex: '(\\))(\\s*)(\\.)',
|
362
|
next: 'pop' },
|
363
|
{ include: '#internal-function-list' },
|
364
|
{ defaultToken: 'meta.directive.export.erlang' } ] } ],
|
365
|
'#internal-expression-punctuation':
|
366
|
[ { token:
|
367
|
[ 'punctuation.separator.clause-head-body.erlang',
|
368
|
'punctuation.separator.clauses.erlang',
|
369
|
'punctuation.separator.expressions.erlang' ],
|
370
|
regex: '(->)|(;)|(,)' } ],
|
371
|
'#internal-function-list':
|
372
|
[ { token: 'punctuation.definition.list.begin.erlang',
|
373
|
regex: '\\[',
|
374
|
push:
|
375
|
[ { token: 'punctuation.definition.list.end.erlang',
|
376
|
regex: '\\]',
|
377
|
next: 'pop' },
|
378
|
{ token:
|
379
|
[ 'entity.name.function.erlang',
|
380
|
'text',
|
381
|
'punctuation.separator.function-arity.erlang' ],
|
382
|
regex: '([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(/)',
|
383
|
push:
|
384
|
[ { token: 'punctuation.separator.list.erlang',
|
385
|
regex: ',|(?=\\])',
|
386
|
next: 'pop' },
|
387
|
{ include: '#everything-else' } ] },
|
388
|
{ include: '#everything-else' },
|
389
|
{ defaultToken: 'meta.structure.list.function.erlang' } ] } ],
|
390
|
'#internal-function-parts':
|
391
|
[ { token: 'text',
|
392
|
regex: '(?=\\()',
|
393
|
push:
|
394
|
[ { token: 'punctuation.separator.clause-head-body.erlang',
|
395
|
regex: '->',
|
396
|
next: 'pop' },
|
397
|
{ token: 'punctuation.definition.parameters.begin.erlang',
|
398
|
regex: '\\(',
|
399
|
push:
|
400
|
[ { token: 'punctuation.definition.parameters.end.erlang',
|
401
|
regex: '\\)',
|
402
|
next: 'pop' },
|
403
|
{ token: 'punctuation.separator.parameters.erlang', regex: ',' },
|
404
|
{ include: '#everything-else' } ] },
|
405
|
{ token: 'punctuation.separator.guards.erlang', regex: ',|;' },
|
406
|
{ include: '#everything-else' } ] },
|
407
|
{ token: 'punctuation.separator.expressions.erlang',
|
408
|
regex: ',' },
|
409
|
{ include: '#everything-else' } ],
|
410
|
'#internal-record-body':
|
411
|
[ { token: 'punctuation.definition.class.record.begin.erlang',
|
412
|
regex: '\\{',
|
413
|
push:
|
414
|
[ { token: 'meta.structure.record.erlang',
|
415
|
regex: '(?=\\})',
|
416
|
next: 'pop' },
|
417
|
{ token:
|
418
|
[ 'variable.other.field.erlang',
|
419
|
'variable.language.omitted.field.erlang',
|
420
|
'text',
|
421
|
'keyword.operator.assignment.erlang' ],
|
422
|
regex: '(?:([a-z][a-zA-Z\\d@_]*|\'[^\']*\')|(_))(\\s*)(=|::)',
|
423
|
push:
|
424
|
[ { token: 'punctuation.separator.class.record.erlang',
|
425
|
regex: ',|(?=\\})',
|
426
|
next: 'pop' },
|
427
|
{ include: '#everything-else' } ] },
|
428
|
{ token:
|
429
|
[ 'variable.other.field.erlang',
|
430
|
'text',
|
431
|
'punctuation.separator.class.record.erlang' ],
|
432
|
regex: '([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)((?:,)?)' },
|
433
|
{ include: '#everything-else' },
|
434
|
{ defaultToken: 'meta.structure.record.erlang' } ] } ],
|
435
|
'#internal-type-specifiers':
|
436
|
[ { token: 'punctuation.separator.value-type.erlang',
|
437
|
regex: '/',
|
438
|
push:
|
439
|
[ { token: 'text', regex: '(?=,|:|>>)', next: 'pop' },
|
440
|
{ token:
|
441
|
[ 'storage.type.erlang',
|
442
|
'storage.modifier.signedness.erlang',
|
443
|
'storage.modifier.endianness.erlang',
|
444
|
'storage.modifier.unit.erlang',
|
445
|
'punctuation.separator.type-specifiers.erlang' ],
|
446
|
regex: '(integer|float|binary|bytes|bitstring|bits)|(signed|unsigned)|(big|little|native)|(unit)|(-)' } ] } ],
|
447
|
'#keyword':
|
448
|
[ { token: 'keyword.control.erlang',
|
449
|
regex: '\\b(?:after|begin|case|catch|cond|end|fun|if|let|of|query|try|receive|when)\\b' } ],
|
450
|
'#list':
|
451
|
[ { token: 'punctuation.definition.list.begin.erlang',
|
452
|
regex: '\\[',
|
453
|
push:
|
454
|
[ { token: 'punctuation.definition.list.end.erlang',
|
455
|
regex: '\\]',
|
456
|
next: 'pop' },
|
457
|
{ token: 'punctuation.separator.list.erlang',
|
458
|
regex: '\\||\\|\\||,' },
|
459
|
{ include: '#everything-else' },
|
460
|
{ defaultToken: 'meta.structure.list.erlang' } ] } ],
|
461
|
'#macro-directive':
|
462
|
[ { token:
|
463
|
[ 'meta.directive.ifdef.erlang',
|
464
|
'punctuation.section.directive.begin.erlang',
|
465
|
'meta.directive.ifdef.erlang',
|
466
|
'keyword.control.directive.ifdef.erlang',
|
467
|
'meta.directive.ifdef.erlang',
|
468
|
'punctuation.definition.parameters.begin.erlang',
|
469
|
'meta.directive.ifdef.erlang',
|
470
|
'entity.name.function.macro.erlang',
|
471
|
'meta.directive.ifdef.erlang',
|
472
|
'punctuation.definition.parameters.end.erlang',
|
473
|
'meta.directive.ifdef.erlang',
|
474
|
'punctuation.section.directive.end.erlang' ],
|
475
|
regex: '^(\\s*)(-)(\\s*)(ifdef)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' },
|
476
|
{ token:
|
477
|
[ 'meta.directive.ifndef.erlang',
|
478
|
'punctuation.section.directive.begin.erlang',
|
479
|
'meta.directive.ifndef.erlang',
|
480
|
'keyword.control.directive.ifndef.erlang',
|
481
|
'meta.directive.ifndef.erlang',
|
482
|
'punctuation.definition.parameters.begin.erlang',
|
483
|
'meta.directive.ifndef.erlang',
|
484
|
'entity.name.function.macro.erlang',
|
485
|
'meta.directive.ifndef.erlang',
|
486
|
'punctuation.definition.parameters.end.erlang',
|
487
|
'meta.directive.ifndef.erlang',
|
488
|
'punctuation.section.directive.end.erlang' ],
|
489
|
regex: '^(\\s*)(-)(\\s*)(ifndef)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' },
|
490
|
{ token:
|
491
|
[ 'meta.directive.undef.erlang',
|
492
|
'punctuation.section.directive.begin.erlang',
|
493
|
'meta.directive.undef.erlang',
|
494
|
'keyword.control.directive.undef.erlang',
|
495
|
'meta.directive.undef.erlang',
|
496
|
'punctuation.definition.parameters.begin.erlang',
|
497
|
'meta.directive.undef.erlang',
|
498
|
'entity.name.function.macro.erlang',
|
499
|
'meta.directive.undef.erlang',
|
500
|
'punctuation.definition.parameters.end.erlang',
|
501
|
'meta.directive.undef.erlang',
|
502
|
'punctuation.section.directive.end.erlang' ],
|
503
|
regex: '^(\\s*)(-)(\\s*)(undef)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' } ],
|
504
|
'#macro-usage':
|
505
|
[ { token:
|
506
|
[ 'keyword.operator.macro.erlang',
|
507
|
'meta.macro-usage.erlang',
|
508
|
'entity.name.function.macro.erlang' ],
|
509
|
regex: '(\\?\\??)(\\s*)([a-zA-Z\\d@_]+)' } ],
|
510
|
'#module-directive':
|
511
|
[ { token:
|
512
|
[ 'meta.directive.module.erlang',
|
513
|
'punctuation.section.directive.begin.erlang',
|
514
|
'meta.directive.module.erlang',
|
515
|
'keyword.control.directive.module.erlang',
|
516
|
'meta.directive.module.erlang',
|
517
|
'punctuation.definition.parameters.begin.erlang',
|
518
|
'meta.directive.module.erlang',
|
519
|
'entity.name.type.class.module.definition.erlang',
|
520
|
'meta.directive.module.erlang',
|
521
|
'punctuation.definition.parameters.end.erlang',
|
522
|
'meta.directive.module.erlang',
|
523
|
'punctuation.section.directive.end.erlang' ],
|
524
|
regex: '^(\\s*)(-)(\\s*)(module)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\))(\\s*)(\\.)' } ],
|
525
|
'#number':
|
526
|
[ { token: 'text',
|
527
|
regex: '(?=\\d)',
|
528
|
push:
|
529
|
[ { token: 'text', regex: '(?!\\d)', next: 'pop' },
|
530
|
{ token:
|
531
|
[ 'constant.numeric.float.erlang',
|
532
|
'punctuation.separator.integer-float.erlang',
|
533
|
'constant.numeric.float.erlang',
|
534
|
'punctuation.separator.float-exponent.erlang' ],
|
535
|
regex: '(\\d+)(\\.)(\\d+)((?:[eE][\\+\\-]?\\d+)?)' },
|
536
|
{ token:
|
537
|
[ 'constant.numeric.integer.binary.erlang',
|
538
|
'punctuation.separator.base-integer.erlang',
|
539
|
'constant.numeric.integer.binary.erlang' ],
|
540
|
regex: '(2)(#)([0-1]+)' },
|
541
|
{ token:
|
542
|
[ 'constant.numeric.integer.base-3.erlang',
|
543
|
'punctuation.separator.base-integer.erlang',
|
544
|
'constant.numeric.integer.base-3.erlang' ],
|
545
|
regex: '(3)(#)([0-2]+)' },
|
546
|
{ token:
|
547
|
[ 'constant.numeric.integer.base-4.erlang',
|
548
|
'punctuation.separator.base-integer.erlang',
|
549
|
'constant.numeric.integer.base-4.erlang' ],
|
550
|
regex: '(4)(#)([0-3]+)' },
|
551
|
{ token:
|
552
|
[ 'constant.numeric.integer.base-5.erlang',
|
553
|
'punctuation.separator.base-integer.erlang',
|
554
|
'constant.numeric.integer.base-5.erlang' ],
|
555
|
regex: '(5)(#)([0-4]+)' },
|
556
|
{ token:
|
557
|
[ 'constant.numeric.integer.base-6.erlang',
|
558
|
'punctuation.separator.base-integer.erlang',
|
559
|
'constant.numeric.integer.base-6.erlang' ],
|
560
|
regex: '(6)(#)([0-5]+)' },
|
561
|
{ token:
|
562
|
[ 'constant.numeric.integer.base-7.erlang',
|
563
|
'punctuation.separator.base-integer.erlang',
|
564
|
'constant.numeric.integer.base-7.erlang' ],
|
565
|
regex: '(7)(#)([0-6]+)' },
|
566
|
{ token:
|
567
|
[ 'constant.numeric.integer.octal.erlang',
|
568
|
'punctuation.separator.base-integer.erlang',
|
569
|
'constant.numeric.integer.octal.erlang' ],
|
570
|
regex: '(8)(#)([0-7]+)' },
|
571
|
{ token:
|
572
|
[ 'constant.numeric.integer.base-9.erlang',
|
573
|
'punctuation.separator.base-integer.erlang',
|
574
|
'constant.numeric.integer.base-9.erlang' ],
|
575
|
regex: '(9)(#)([0-8]+)' },
|
576
|
{ token:
|
577
|
[ 'constant.numeric.integer.decimal.erlang',
|
578
|
'punctuation.separator.base-integer.erlang',
|
579
|
'constant.numeric.integer.decimal.erlang' ],
|
580
|
regex: '(10)(#)(\\d+)' },
|
581
|
{ token:
|
582
|
[ 'constant.numeric.integer.base-11.erlang',
|
583
|
'punctuation.separator.base-integer.erlang',
|
584
|
'constant.numeric.integer.base-11.erlang' ],
|
585
|
regex: '(11)(#)([\\daA]+)' },
|
586
|
{ token:
|
587
|
[ 'constant.numeric.integer.base-12.erlang',
|
588
|
'punctuation.separator.base-integer.erlang',
|
589
|
'constant.numeric.integer.base-12.erlang' ],
|
590
|
regex: '(12)(#)([\\da-bA-B]+)' },
|
591
|
{ token:
|
592
|
[ 'constant.numeric.integer.base-13.erlang',
|
593
|
'punctuation.separator.base-integer.erlang',
|
594
|
'constant.numeric.integer.base-13.erlang' ],
|
595
|
regex: '(13)(#)([\\da-cA-C]+)' },
|
596
|
{ token:
|
597
|
[ 'constant.numeric.integer.base-14.erlang',
|
598
|
'punctuation.separator.base-integer.erlang',
|
599
|
'constant.numeric.integer.base-14.erlang' ],
|
600
|
regex: '(14)(#)([\\da-dA-D]+)' },
|
601
|
{ token:
|
602
|
[ 'constant.numeric.integer.base-15.erlang',
|
603
|
'punctuation.separator.base-integer.erlang',
|
604
|
'constant.numeric.integer.base-15.erlang' ],
|
605
|
regex: '(15)(#)([\\da-eA-E]+)' },
|
606
|
{ token:
|
607
|
[ 'constant.numeric.integer.hexadecimal.erlang',
|
608
|
'punctuation.separator.base-integer.erlang',
|
609
|
'constant.numeric.integer.hexadecimal.erlang' ],
|
610
|
regex: '(16)(#)([\\da-fA-F]+)' },
|
611
|
{ token:
|
612
|
[ 'constant.numeric.integer.base-17.erlang',
|
613
|
'punctuation.separator.base-integer.erlang',
|
614
|
'constant.numeric.integer.base-17.erlang' ],
|
615
|
regex: '(17)(#)([\\da-gA-G]+)' },
|
616
|
{ token:
|
617
|
[ 'constant.numeric.integer.base-18.erlang',
|
618
|
'punctuation.separator.base-integer.erlang',
|
619
|
'constant.numeric.integer.base-18.erlang' ],
|
620
|
regex: '(18)(#)([\\da-hA-H]+)' },
|
621
|
{ token:
|
622
|
[ 'constant.numeric.integer.base-19.erlang',
|
623
|
'punctuation.separator.base-integer.erlang',
|
624
|
'constant.numeric.integer.base-19.erlang' ],
|
625
|
regex: '(19)(#)([\\da-iA-I]+)' },
|
626
|
{ token:
|
627
|
[ 'constant.numeric.integer.base-20.erlang',
|
628
|
'punctuation.separator.base-integer.erlang',
|
629
|
'constant.numeric.integer.base-20.erlang' ],
|
630
|
regex: '(20)(#)([\\da-jA-J]+)' },
|
631
|
{ token:
|
632
|
[ 'constant.numeric.integer.base-21.erlang',
|
633
|
'punctuation.separator.base-integer.erlang',
|
634
|
'constant.numeric.integer.base-21.erlang' ],
|
635
|
regex: '(21)(#)([\\da-kA-K]+)' },
|
636
|
{ token:
|
637
|
[ 'constant.numeric.integer.base-22.erlang',
|
638
|
'punctuation.separator.base-integer.erlang',
|
639
|
'constant.numeric.integer.base-22.erlang' ],
|
640
|
regex: '(22)(#)([\\da-lA-L]+)' },
|
641
|
{ token:
|
642
|
[ 'constant.numeric.integer.base-23.erlang',
|
643
|
'punctuation.separator.base-integer.erlang',
|
644
|
'constant.numeric.integer.base-23.erlang' ],
|
645
|
regex: '(23)(#)([\\da-mA-M]+)' },
|
646
|
{ token:
|
647
|
[ 'constant.numeric.integer.base-24.erlang',
|
648
|
'punctuation.separator.base-integer.erlang',
|
649
|
'constant.numeric.integer.base-24.erlang' ],
|
650
|
regex: '(24)(#)([\\da-nA-N]+)' },
|
651
|
{ token:
|
652
|
[ 'constant.numeric.integer.base-25.erlang',
|
653
|
'punctuation.separator.base-integer.erlang',
|
654
|
'constant.numeric.integer.base-25.erlang' ],
|
655
|
regex: '(25)(#)([\\da-oA-O]+)' },
|
656
|
{ token:
|
657
|
[ 'constant.numeric.integer.base-26.erlang',
|
658
|
'punctuation.separator.base-integer.erlang',
|
659
|
'constant.numeric.integer.base-26.erlang' ],
|
660
|
regex: '(26)(#)([\\da-pA-P]+)' },
|
661
|
{ token:
|
662
|
[ 'constant.numeric.integer.base-27.erlang',
|
663
|
'punctuation.separator.base-integer.erlang',
|
664
|
'constant.numeric.integer.base-27.erlang' ],
|
665
|
regex: '(27)(#)([\\da-qA-Q]+)' },
|
666
|
{ token:
|
667
|
[ 'constant.numeric.integer.base-28.erlang',
|
668
|
'punctuation.separator.base-integer.erlang',
|
669
|
'constant.numeric.integer.base-28.erlang' ],
|
670
|
regex: '(28)(#)([\\da-rA-R]+)' },
|
671
|
{ token:
|
672
|
[ 'constant.numeric.integer.base-29.erlang',
|
673
|
'punctuation.separator.base-integer.erlang',
|
674
|
'constant.numeric.integer.base-29.erlang' ],
|
675
|
regex: '(29)(#)([\\da-sA-S]+)' },
|
676
|
{ token:
|
677
|
[ 'constant.numeric.integer.base-30.erlang',
|
678
|
'punctuation.separator.base-integer.erlang',
|
679
|
'constant.numeric.integer.base-30.erlang' ],
|
680
|
regex: '(30)(#)([\\da-tA-T]+)' },
|
681
|
{ token:
|
682
|
[ 'constant.numeric.integer.base-31.erlang',
|
683
|
'punctuation.separator.base-integer.erlang',
|
684
|
'constant.numeric.integer.base-31.erlang' ],
|
685
|
regex: '(31)(#)([\\da-uA-U]+)' },
|
686
|
{ token:
|
687
|
[ 'constant.numeric.integer.base-32.erlang',
|
688
|
'punctuation.separator.base-integer.erlang',
|
689
|
'constant.numeric.integer.base-32.erlang' ],
|
690
|
regex: '(32)(#)([\\da-vA-V]+)' },
|
691
|
{ token:
|
692
|
[ 'constant.numeric.integer.base-33.erlang',
|
693
|
'punctuation.separator.base-integer.erlang',
|
694
|
'constant.numeric.integer.base-33.erlang' ],
|
695
|
regex: '(33)(#)([\\da-wA-W]+)' },
|
696
|
{ token:
|
697
|
[ 'constant.numeric.integer.base-34.erlang',
|
698
|
'punctuation.separator.base-integer.erlang',
|
699
|
'constant.numeric.integer.base-34.erlang' ],
|
700
|
regex: '(34)(#)([\\da-xA-X]+)' },
|
701
|
{ token:
|
702
|
[ 'constant.numeric.integer.base-35.erlang',
|
703
|
'punctuation.separator.base-integer.erlang',
|
704
|
'constant.numeric.integer.base-35.erlang' ],
|
705
|
regex: '(35)(#)([\\da-yA-Y]+)' },
|
706
|
{ token:
|
707
|
[ 'constant.numeric.integer.base-36.erlang',
|
708
|
'punctuation.separator.base-integer.erlang',
|
709
|
'constant.numeric.integer.base-36.erlang' ],
|
710
|
regex: '(36)(#)([\\da-zA-Z]+)' },
|
711
|
{ token: 'invalid.illegal.integer.erlang',
|
712
|
regex: '\\d+#[\\da-zA-Z]+' },
|
713
|
{ token: 'constant.numeric.integer.decimal.erlang',
|
714
|
regex: '\\d+' } ] } ],
|
715
|
'#parenthesized-expression':
|
716
|
[ { token: 'punctuation.section.expression.begin.erlang',
|
717
|
regex: '\\(',
|
718
|
push:
|
719
|
[ { token: 'punctuation.section.expression.end.erlang',
|
720
|
regex: '\\)',
|
721
|
next: 'pop' },
|
722
|
{ include: '#everything-else' },
|
723
|
{ defaultToken: 'meta.expression.parenthesized' } ] } ],
|
724
|
'#record-directive':
|
725
|
[ { token:
|
726
|
[ 'meta.directive.record.erlang',
|
727
|
'punctuation.section.directive.begin.erlang',
|
728
|
'meta.directive.record.erlang',
|
729
|
'keyword.control.directive.import.erlang',
|
730
|
'meta.directive.record.erlang',
|
731
|
'punctuation.definition.parameters.begin.erlang',
|
732
|
'meta.directive.record.erlang',
|
733
|
'entity.name.type.class.record.definition.erlang',
|
734
|
'meta.directive.record.erlang',
|
735
|
'punctuation.separator.parameters.erlang' ],
|
736
|
regex: '^(\\s*)(-)(\\s*)(record)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(,)',
|
737
|
push:
|
738
|
[ { token:
|
739
|
[ 'punctuation.definition.class.record.end.erlang',
|
740
|
'meta.directive.record.erlang',
|
741
|
'punctuation.definition.parameters.end.erlang',
|
742
|
'meta.directive.record.erlang',
|
743
|
'punctuation.section.directive.end.erlang' ],
|
744
|
regex: '(\\})(\\s*)(\\))(\\s*)(\\.)',
|
745
|
next: 'pop' },
|
746
|
{ include: '#internal-record-body' },
|
747
|
{ defaultToken: 'meta.directive.record.erlang' } ] } ],
|
748
|
'#record-usage':
|
749
|
[ { token:
|
750
|
[ 'keyword.operator.record.erlang',
|
751
|
'meta.record-usage.erlang',
|
752
|
'entity.name.type.class.record.erlang',
|
753
|
'meta.record-usage.erlang',
|
754
|
'punctuation.separator.record-field.erlang',
|
755
|
'meta.record-usage.erlang',
|
756
|
'variable.other.field.erlang' ],
|
757
|
regex: '(#)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(\\.)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')' },
|
758
|
{ token:
|
759
|
[ 'keyword.operator.record.erlang',
|
760
|
'meta.record-usage.erlang',
|
761
|
'entity.name.type.class.record.erlang' ],
|
762
|
regex: '(#)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')',
|
763
|
push:
|
764
|
[ { token: 'punctuation.definition.class.record.end.erlang',
|
765
|
regex: '\\}',
|
766
|
next: 'pop' },
|
767
|
{ include: '#internal-record-body' },
|
768
|
{ defaultToken: 'meta.record-usage.erlang' } ] } ],
|
769
|
'#string':
|
770
|
[ { token: 'punctuation.definition.string.begin.erlang',
|
771
|
regex: '"',
|
772
|
push:
|
773
|
[ { token: 'punctuation.definition.string.end.erlang',
|
774
|
regex: '"',
|
775
|
next: 'pop' },
|
776
|
{ token:
|
777
|
[ 'punctuation.definition.escape.erlang',
|
778
|
'constant.character.escape.erlang',
|
779
|
'punctuation.definition.escape.erlang',
|
780
|
'constant.character.escape.erlang',
|
781
|
'constant.character.escape.erlang' ],
|
782
|
regex: '(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
|
783
|
{ token: 'invalid.illegal.string.erlang', regex: '\\\\\\^?.?' },
|
784
|
{ token:
|
785
|
[ 'punctuation.definition.placeholder.erlang',
|
786
|
'punctuation.separator.placeholder-parts.erlang',
|
787
|
'constant.other.placeholder.erlang',
|
788
|
'punctuation.separator.placeholder-parts.erlang',
|
789
|
'punctuation.separator.placeholder-parts.erlang',
|
790
|
'constant.other.placeholder.erlang',
|
791
|
'punctuation.separator.placeholder-parts.erlang',
|
792
|
'punctuation.separator.placeholder-parts.erlang',
|
793
|
'punctuation.separator.placeholder-parts.erlang',
|
794
|
'constant.other.placeholder.erlang',
|
795
|
'constant.other.placeholder.erlang' ],
|
796
|
regex: '(~)(?:((?:\\-)?)(\\d+)|(\\*))?(?:(\\.)(?:(\\d+)|(\\*)))?(?:(\\.)(?:(\\*)|(.)))?([~cfegswpWPBX#bx\\+ni])' },
|
797
|
{ token:
|
798
|
[ 'punctuation.definition.placeholder.erlang',
|
799
|
'punctuation.separator.placeholder-parts.erlang',
|
800
|
'constant.other.placeholder.erlang',
|
801
|
'constant.other.placeholder.erlang' ],
|
802
|
regex: '(~)((?:\\*)?)((?:\\d+)?)([~du\\-#fsacl])' },
|
803
|
{ token: 'invalid.illegal.string.erlang', regex: '~.?' },
|
804
|
{ defaultToken: 'string.quoted.double.erlang' } ] } ],
|
805
|
'#symbolic-operator':
|
806
|
[ { token: 'keyword.operator.symbolic.erlang',
|
807
|
regex: '\\+\\+|\\+|--|-|\\*|/=|/|=/=|=:=|==|=<|=|<-|<|>=|>|!|::' } ],
|
808
|
'#textual-operator':
|
809
|
[ { token: 'keyword.operator.textual.erlang',
|
810
|
regex: '\\b(?:andalso|band|and|bxor|xor|bor|orelse|or|bnot|not|bsl|bsr|div|rem)\\b' } ],
|
811
|
'#tuple':
|
812
|
[ { token: 'punctuation.definition.tuple.begin.erlang',
|
813
|
regex: '\\{',
|
814
|
push:
|
815
|
[ { token: 'punctuation.definition.tuple.end.erlang',
|
816
|
regex: '\\}',
|
817
|
next: 'pop' },
|
818
|
{ token: 'punctuation.separator.tuple.erlang', regex: ',' },
|
819
|
{ include: '#everything-else' },
|
820
|
{ defaultToken: 'meta.structure.tuple.erlang' } ] } ],
|
821
|
'#variable':
|
822
|
[ { token: [ 'variable.other.erlang', 'variable.language.omitted.erlang' ],
|
823
|
regex: '(_[a-zA-Z\\d@_]+|[A-Z][a-zA-Z\\d@_]*)|(_)' } ] };
|
824
|
|
825
|
this.normalizeRules();
|
826
|
};
|
827
|
|
828
|
ErlangHighlightRules.metaData = { comment: 'The recognition of function definitions and compiler directives (such as module, record and macro definitions) requires that each of the aforementioned constructs must be the first string inside a line (except for whitespace). Also, the function/module/record/macro names must be given unquoted. -- desp',
|
829
|
fileTypes: [ 'erl', 'hrl' ],
|
830
|
keyEquivalent: '^~E',
|
831
|
name: 'Erlang',
|
832
|
scopeName: 'source.erlang' };
|
833
|
|
834
|
|
835
|
oop.inherits(ErlangHighlightRules, TextHighlightRules);
|
836
|
|
837
|
exports.ErlangHighlightRules = ErlangHighlightRules;
|
838
|
});
|
839
|
|
840
|
ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
|
841
|
"use strict";
|
842
|
|
843
|
var oop = require("../../lib/oop");
|
844
|
var Range = require("../../range").Range;
|
845
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
846
|
|
847
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
848
|
if (commentRegex) {
|
849
|
this.foldingStartMarker = new RegExp(
|
850
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
851
|
);
|
852
|
this.foldingStopMarker = new RegExp(
|
853
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
854
|
);
|
855
|
}
|
856
|
};
|
857
|
oop.inherits(FoldMode, BaseFoldMode);
|
858
|
|
859
|
(function() {
|
860
|
|
861
|
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
|
862
|
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
|
863
|
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
|
864
|
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
|
865
|
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
|
866
|
this._getFoldWidgetBase = this.getFoldWidget;
|
867
|
this.getFoldWidget = function(session, foldStyle, row) {
|
868
|
var line = session.getLine(row);
|
869
|
|
870
|
if (this.singleLineBlockCommentRe.test(line)) {
|
871
|
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
|
872
|
return "";
|
873
|
}
|
874
|
|
875
|
var fw = this._getFoldWidgetBase(session, foldStyle, row);
|
876
|
|
877
|
if (!fw && this.startRegionRe.test(line))
|
878
|
return "start"; // lineCommentRegionStart
|
879
|
|
880
|
return fw;
|
881
|
};
|
882
|
|
883
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
884
|
var line = session.getLine(row);
|
885
|
|
886
|
if (this.startRegionRe.test(line))
|
887
|
return this.getCommentRegionBlock(session, line, row);
|
888
|
|
889
|
var match = line.match(this.foldingStartMarker);
|
890
|
if (match) {
|
891
|
var i = match.index;
|
892
|
|
893
|
if (match[1])
|
894
|
return this.openingBracketBlock(session, match[1], row, i);
|
895
|
|
896
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
897
|
|
898
|
if (range && !range.isMultiLine()) {
|
899
|
if (forceMultiline) {
|
900
|
range = this.getSectionRange(session, row);
|
901
|
} else if (foldStyle != "all")
|
902
|
range = null;
|
903
|
}
|
904
|
|
905
|
return range;
|
906
|
}
|
907
|
|
908
|
if (foldStyle === "markbegin")
|
909
|
return;
|
910
|
|
911
|
var match = line.match(this.foldingStopMarker);
|
912
|
if (match) {
|
913
|
var i = match.index + match[0].length;
|
914
|
|
915
|
if (match[1])
|
916
|
return this.closingBracketBlock(session, match[1], row, i);
|
917
|
|
918
|
return session.getCommentFoldRange(row, i, -1);
|
919
|
}
|
920
|
};
|
921
|
|
922
|
this.getSectionRange = function(session, row) {
|
923
|
var line = session.getLine(row);
|
924
|
var startIndent = line.search(/\S/);
|
925
|
var startRow = row;
|
926
|
var startColumn = line.length;
|
927
|
row = row + 1;
|
928
|
var endRow = row;
|
929
|
var maxRow = session.getLength();
|
930
|
while (++row < maxRow) {
|
931
|
line = session.getLine(row);
|
932
|
var indent = line.search(/\S/);
|
933
|
if (indent === -1)
|
934
|
continue;
|
935
|
if (startIndent > indent)
|
936
|
break;
|
937
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
938
|
|
939
|
if (subRange) {
|
940
|
if (subRange.start.row <= startRow) {
|
941
|
break;
|
942
|
} else if (subRange.isMultiLine()) {
|
943
|
row = subRange.end.row;
|
944
|
} else if (startIndent == indent) {
|
945
|
break;
|
946
|
}
|
947
|
}
|
948
|
endRow = row;
|
949
|
}
|
950
|
|
951
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
952
|
};
|
953
|
this.getCommentRegionBlock = function(session, line, row) {
|
954
|
var startColumn = line.search(/\s*$/);
|
955
|
var maxRow = session.getLength();
|
956
|
var startRow = row;
|
957
|
|
958
|
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
|
959
|
var depth = 1;
|
960
|
while (++row < maxRow) {
|
961
|
line = session.getLine(row);
|
962
|
var m = re.exec(line);
|
963
|
if (!m) continue;
|
964
|
if (m[1]) depth--;
|
965
|
else depth++;
|
966
|
|
967
|
if (!depth) break;
|
968
|
}
|
969
|
|
970
|
var endRow = row;
|
971
|
if (endRow > startRow) {
|
972
|
return new Range(startRow, startColumn, endRow, line.length);
|
973
|
}
|
974
|
};
|
975
|
|
976
|
}).call(FoldMode.prototype);
|
977
|
|
978
|
});
|
979
|
|
980
|
ace.define("ace/mode/erlang",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/erlang_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
|
981
|
"use strict";
|
982
|
|
983
|
var oop = require("../lib/oop");
|
984
|
var TextMode = require("./text").Mode;
|
985
|
var ErlangHighlightRules = require("./erlang_highlight_rules").ErlangHighlightRules;
|
986
|
var FoldMode = require("./folding/cstyle").FoldMode;
|
987
|
|
988
|
var Mode = function() {
|
989
|
this.HighlightRules = ErlangHighlightRules;
|
990
|
this.foldingRules = new FoldMode();
|
991
|
this.$behaviour = this.$defaultBehaviour;
|
992
|
};
|
993
|
oop.inherits(Mode, TextMode);
|
994
|
|
995
|
(function() {
|
996
|
this.lineCommentStart = "%";
|
997
|
this.blockComment = null;
|
998
|
this.$id = "ace/mode/erlang";
|
999
|
this.snippetFileId = "ace/snippets/erlang";
|
1000
|
}).call(Mode.prototype);
|
1001
|
|
1002
|
exports.Mode = Mode;
|
1003
|
}); (function() {
|
1004
|
ace.require(["ace/mode/erlang"], function(m) {
|
1005
|
if (typeof module == "object" && typeof exports == "object" && module) {
|
1006
|
module.exports = m;
|
1007
|
}
|
1008
|
});
|
1009
|
})();
|
1010
|
|