1
|
ace.define("ace/mode/logtalk_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 LogtalkHighlightRules = function() {
|
8
|
|
9
|
this.$rules = { start:
|
10
|
[ { token: 'punctuation.definition.comment.logtalk',
|
11
|
regex: '/\\*',
|
12
|
push:
|
13
|
[ { token: 'punctuation.definition.comment.logtalk',
|
14
|
regex: '\\*/',
|
15
|
next: 'pop' },
|
16
|
{ defaultToken: 'comment.block.logtalk' } ] },
|
17
|
{ todo: 'fix grouping',
|
18
|
token:
|
19
|
[ 'comment.line.percentage.logtalk',
|
20
|
'punctuation.definition.comment.logtalk' ],
|
21
|
regex: '%.*$\\n?' },
|
22
|
{ todo: 'fix grouping',
|
23
|
token:
|
24
|
[ 'storage.type.opening.logtalk',
|
25
|
'punctuation.definition.storage.type.logtalk' ],
|
26
|
regex: ':-\\s(?:object|protocol|category|module)(?=[(])' },
|
27
|
{ todo: 'fix grouping',
|
28
|
token:
|
29
|
[ 'storage.type.closing.logtalk',
|
30
|
'punctuation.definition.storage.type.logtalk' ],
|
31
|
regex: ':-\\send_(?:object|protocol|category)(?=[.])' },
|
32
|
{ caseInsensitive: false,
|
33
|
token: 'storage.type.relations.logtalk',
|
34
|
regex: '\\b(?:complements|extends|i(?:nstantiates|mp(?:orts|lements))|specializes)(?=[(])' },
|
35
|
{ caseInsensitive: false,
|
36
|
todo: 'fix grouping',
|
37
|
token:
|
38
|
[ 'storage.modifier.others.logtalk',
|
39
|
'punctuation.definition.storage.modifier.logtalk' ],
|
40
|
regex: ':-\\s(?:e(?:lse|ndif)|built_in|dynamic|synchronized|threaded)(?=[.])' },
|
41
|
{ caseInsensitive: false,
|
42
|
todo: 'fix grouping',
|
43
|
token:
|
44
|
[ 'storage.modifier.others.logtalk',
|
45
|
'punctuation.definition.storage.modifier.logtalk' ],
|
46
|
regex: ':-\\s(?:c(?:alls|oinductive)|e(?:lif|n(?:coding|sure_loaded)|xport)|i(?:f|n(?:clude|itialization|fo))|reexport|set_(?:logtalk|prolog)_flag|uses)(?=[(])' },
|
47
|
{ caseInsensitive: false,
|
48
|
todo: 'fix grouping',
|
49
|
token:
|
50
|
[ 'storage.modifier.others.logtalk',
|
51
|
'punctuation.definition.storage.modifier.logtalk' ],
|
52
|
regex: ':-\\s(?:alias|info|d(?:ynamic|iscontiguous)|m(?:eta_(?:non_terminal|predicate)|ode|ultifile)|p(?:ublic|r(?:otected|ivate))|op|use(?:s|_module)|synchronized)(?=[(])' },
|
53
|
{ token: 'keyword.operator.message-sending.logtalk',
|
54
|
regex: '(:|::|\\^\\^)' },
|
55
|
{ token: 'keyword.operator.external-call.logtalk',
|
56
|
regex: '([{}])' },
|
57
|
{ token: 'keyword.operator.mode.logtalk', regex: '(\\?|@)' },
|
58
|
{ token: 'keyword.operator.comparison.term.logtalk',
|
59
|
regex: '(@=<|@<|@>|@>=|==|\\\\==)' },
|
60
|
{ token: 'keyword.operator.comparison.arithmetic.logtalk',
|
61
|
regex: '(=<|<|>|>=|=:=|=\\\\=)' },
|
62
|
{ token: 'keyword.operator.bitwise.logtalk',
|
63
|
regex: '(<<|>>|/\\\\|\\\\/|\\\\)' },
|
64
|
{ token: 'keyword.operator.evaluable.logtalk',
|
65
|
regex: '\\b(?:e|pi|div|mod|rem)\\b(?![-!(^~])' },
|
66
|
{ token: 'keyword.operator.evaluable.logtalk',
|
67
|
regex: '(\\*\\*|\\+|-|\\*|/|//)' },
|
68
|
{ token: 'keyword.operator.misc.logtalk',
|
69
|
regex: '(:-|!|\\\\+|,|;|-->|->|=|\\=|\\.|=\\.\\.|\\^|\\bas\\b|\\bis\\b)' },
|
70
|
{ caseInsensitive: false,
|
71
|
token: 'support.function.evaluable.logtalk',
|
72
|
regex: '\\b(a(bs|cos|sin|tan|tan2)|c(eiling|os)|div|exp|flo(at(_(integer|fractional)_part)?|or)|log|m(ax|in|od)|r(em|ound)|s(i(n|gn)|qrt)|t(an|runcate)|xor)(?=[(])' },
|
73
|
{ token: 'support.function.control.logtalk',
|
74
|
regex: '\\b(?:true|fa(?:il|lse)|repeat|(?:instantiation|system)_error)\\b(?![-!(^~])' },
|
75
|
{ token: 'support.function.control.logtalk',
|
76
|
regex: '\\b((?:type|domain|existence|permission|representation|evaluation|resource|syntax)_error)(?=[(])' },
|
77
|
{ token: 'support.function.control.logtalk',
|
78
|
regex: '\\b(?:ca(?:ll|tch)|ignore|throw|once)(?=[(])' },
|
79
|
{ token: 'support.function.chars-and-bytes-io.logtalk',
|
80
|
regex: '\\b(?:(?:get|p(?:eek|ut))_(c(?:har|ode)|byte)|nl)(?=[(])' },
|
81
|
{ token: 'support.function.chars-and-bytes-io.logtalk',
|
82
|
regex: '\\bnl\\b' },
|
83
|
{ token: 'support.function.atom-term-processing.logtalk',
|
84
|
regex: '\\b(?:atom_(?:length|c(?:hars|o(?:ncat|des)))|sub_atom|char_code|number_c(?:har|ode)s)(?=[(])' },
|
85
|
{ caseInsensitive: false,
|
86
|
token: 'support.function.term-testing.logtalk',
|
87
|
regex: '\\b(?:var|atom(ic)?|integer|float|c(?:allable|ompound)|n(?:onvar|umber)|ground|acyclic_term)(?=[(])' },
|
88
|
{ token: 'support.function.term-comparison.logtalk',
|
89
|
regex: '\\b(compare)(?=[(])' },
|
90
|
{ token: 'support.function.term-io.logtalk',
|
91
|
regex: '\\b(?:read(_term)?|write(?:q|_(?:canonical|term))?|(current_)?(?:char_conversion|op))(?=[(])' },
|
92
|
{ caseInsensitive: false,
|
93
|
token: 'support.function.term-creation-and-decomposition.logtalk',
|
94
|
regex: '\\b(arg|copy_term|functor|numbervars|term_variables)(?=[(])' },
|
95
|
{ caseInsensitive: false,
|
96
|
token: 'support.function.term-unification.logtalk',
|
97
|
regex: '\\b(subsumes_term|unify_with_occurs_check)(?=[(])' },
|
98
|
{ caseInsensitive: false,
|
99
|
token: 'support.function.stream-selection-and-control.logtalk',
|
100
|
regex: '\\b(?:(?:se|curren)t_(?:in|out)put|open|close|flush_output|stream_property|at_end_of_stream|set_stream_position)(?=[(])' },
|
101
|
{ token: 'support.function.stream-selection-and-control.logtalk',
|
102
|
regex: '\\b(?:flush_output|at_end_of_stream)\\b' },
|
103
|
{ token: 'support.function.prolog-flags.logtalk',
|
104
|
regex: '\\b((?:se|curren)t_prolog_flag)(?=[(])' },
|
105
|
{ token: 'support.function.compiling-and-loading.logtalk',
|
106
|
regex: '\\b(logtalk_(?:compile|l(?:ibrary_path|oad|oad_context)|make(_target_action)?))(?=[(])' },
|
107
|
{ token: 'support.function.compiling-and-loading.logtalk',
|
108
|
regex: '\\b(logtalk_make)\\b' },
|
109
|
{ caseInsensitive: false,
|
110
|
token: 'support.function.event-handling.logtalk',
|
111
|
regex: '\\b(?:(?:abolish|define)_events|current_event)(?=[(])' },
|
112
|
{ token: 'support.function.implementation-defined-hooks.logtalk',
|
113
|
regex: '\\b(?:(?:create|current|set)_logtalk_flag|halt)(?=[(])' },
|
114
|
{ token: 'support.function.implementation-defined-hooks.logtalk',
|
115
|
regex: '\\b(halt)\\b' },
|
116
|
{ token: 'support.function.sorting.logtalk',
|
117
|
regex: '\\b((key)?(sort))(?=[(])' },
|
118
|
{ caseInsensitive: false,
|
119
|
token: 'support.function.entity-creation-and-abolishing.logtalk',
|
120
|
regex: '\\b((c(?:reate|urrent)|abolish)_(?:object|protocol|category))(?=[(])' },
|
121
|
{ caseInsensitive: false,
|
122
|
token: 'support.function.reflection.logtalk',
|
123
|
regex: '\\b((object|protocol|category)_property|co(mplements_object|nforms_to_protocol)|extends_(object|protocol|category)|imp(orts_category|lements_protocol)|(instantiat|specializ)es_class)(?=[(])' },
|
124
|
{ token: 'support.function.logtalk',
|
125
|
regex: '\\b((?:for|retract)all)(?=[(])' },
|
126
|
{ caseInsensitive: false,
|
127
|
token: 'support.function.execution-context.logtalk',
|
128
|
regex: '\\b(?:context|parameter|se(?:lf|nder)|this)(?=[(])' },
|
129
|
{ token: 'support.function.database.logtalk',
|
130
|
regex: '\\b(?:a(?:bolish|ssert(?:a|z))|clause|retract(all)?)(?=[(])' },
|
131
|
{ token: 'support.function.all-solutions.logtalk',
|
132
|
regex: '\\b((?:bag|set)of|f(?:ind|or)all)(?=[(])' },
|
133
|
{ caseInsensitive: false,
|
134
|
token: 'support.function.multi-threading.logtalk',
|
135
|
regex: '\\b(threaded(_(call|once|ignore|exit|peek|wait|notify))?)(?=[(])' },
|
136
|
{ caseInsensitive: false,
|
137
|
token: 'support.function.engines.logtalk',
|
138
|
regex: '\\b(threaded_engine(_(create|destroy|self|next(?:_reified)?|yield|post|fetch))?)(?=[(])' },
|
139
|
{ caseInsensitive: false,
|
140
|
token: 'support.function.reflection.logtalk',
|
141
|
regex: '\\b(?:current_predicate|predicate_property)(?=[(])' },
|
142
|
{ token: 'support.function.event-handler.logtalk',
|
143
|
regex: '\\b(?:before|after)(?=[(])' },
|
144
|
{ token: 'support.function.message-forwarding-handler.logtalk',
|
145
|
regex: '\\b(forward)(?=[(])' },
|
146
|
{ token: 'support.function.grammar-rule.logtalk',
|
147
|
regex: '\\b(?:expand_(?:goal|term)|(?:goal|term)_expansion|phrase)(?=[(])' },
|
148
|
{ token: 'punctuation.definition.string.begin.logtalk',
|
149
|
regex: '\'',
|
150
|
push:
|
151
|
[ { token: 'constant.character.escape.logtalk',
|
152
|
regex: '\\\\([\\\\abfnrtv"\']|(x[a-fA-F0-9]+|[0-7]+)\\\\)' },
|
153
|
{ token: 'punctuation.definition.string.end.logtalk',
|
154
|
regex: '\'',
|
155
|
next: 'pop' },
|
156
|
{ defaultToken: 'string.quoted.single.logtalk' } ] },
|
157
|
{ token: 'punctuation.definition.string.begin.logtalk',
|
158
|
regex: '"',
|
159
|
push:
|
160
|
[ { token: 'constant.character.escape.logtalk', regex: '\\\\.' },
|
161
|
{ token: 'punctuation.definition.string.end.logtalk',
|
162
|
regex: '"',
|
163
|
next: 'pop' },
|
164
|
{ defaultToken: 'string.quoted.double.logtalk' } ] },
|
165
|
{ token: 'constant.numeric.logtalk',
|
166
|
regex: '\\b(0b[0-1]+|0o[0-7]+|0x[0-9a-fA-F]+)\\b' },
|
167
|
{ token: 'constant.numeric.logtalk',
|
168
|
regex: '\\b(0\'\\\\.|0\'.|0\'\'|0\'")' },
|
169
|
{ token: 'constant.numeric.logtalk',
|
170
|
regex: '\\b(\\d+\\.?\\d*((e|E)(\\+|-)?\\d+)?)\\b' },
|
171
|
{ token: 'variable.other.logtalk',
|
172
|
regex: '\\b([A-Z_][A-Za-z0-9_]*)\\b' } ] };
|
173
|
|
174
|
this.normalizeRules();
|
175
|
};
|
176
|
|
177
|
oop.inherits(LogtalkHighlightRules, TextHighlightRules);
|
178
|
|
179
|
exports.LogtalkHighlightRules = LogtalkHighlightRules;
|
180
|
});
|
181
|
|
182
|
ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
|
183
|
"use strict";
|
184
|
|
185
|
var oop = require("../../lib/oop");
|
186
|
var Range = require("../../range").Range;
|
187
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
188
|
|
189
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
190
|
if (commentRegex) {
|
191
|
this.foldingStartMarker = new RegExp(
|
192
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
193
|
);
|
194
|
this.foldingStopMarker = new RegExp(
|
195
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
196
|
);
|
197
|
}
|
198
|
};
|
199
|
oop.inherits(FoldMode, BaseFoldMode);
|
200
|
|
201
|
(function() {
|
202
|
|
203
|
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
|
204
|
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
|
205
|
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
|
206
|
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
|
207
|
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
|
208
|
this._getFoldWidgetBase = this.getFoldWidget;
|
209
|
this.getFoldWidget = function(session, foldStyle, row) {
|
210
|
var line = session.getLine(row);
|
211
|
|
212
|
if (this.singleLineBlockCommentRe.test(line)) {
|
213
|
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
|
214
|
return "";
|
215
|
}
|
216
|
|
217
|
var fw = this._getFoldWidgetBase(session, foldStyle, row);
|
218
|
|
219
|
if (!fw && this.startRegionRe.test(line))
|
220
|
return "start"; // lineCommentRegionStart
|
221
|
|
222
|
return fw;
|
223
|
};
|
224
|
|
225
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
226
|
var line = session.getLine(row);
|
227
|
|
228
|
if (this.startRegionRe.test(line))
|
229
|
return this.getCommentRegionBlock(session, line, row);
|
230
|
|
231
|
var match = line.match(this.foldingStartMarker);
|
232
|
if (match) {
|
233
|
var i = match.index;
|
234
|
|
235
|
if (match[1])
|
236
|
return this.openingBracketBlock(session, match[1], row, i);
|
237
|
|
238
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
239
|
|
240
|
if (range && !range.isMultiLine()) {
|
241
|
if (forceMultiline) {
|
242
|
range = this.getSectionRange(session, row);
|
243
|
} else if (foldStyle != "all")
|
244
|
range = null;
|
245
|
}
|
246
|
|
247
|
return range;
|
248
|
}
|
249
|
|
250
|
if (foldStyle === "markbegin")
|
251
|
return;
|
252
|
|
253
|
var match = line.match(this.foldingStopMarker);
|
254
|
if (match) {
|
255
|
var i = match.index + match[0].length;
|
256
|
|
257
|
if (match[1])
|
258
|
return this.closingBracketBlock(session, match[1], row, i);
|
259
|
|
260
|
return session.getCommentFoldRange(row, i, -1);
|
261
|
}
|
262
|
};
|
263
|
|
264
|
this.getSectionRange = function(session, row) {
|
265
|
var line = session.getLine(row);
|
266
|
var startIndent = line.search(/\S/);
|
267
|
var startRow = row;
|
268
|
var startColumn = line.length;
|
269
|
row = row + 1;
|
270
|
var endRow = row;
|
271
|
var maxRow = session.getLength();
|
272
|
while (++row < maxRow) {
|
273
|
line = session.getLine(row);
|
274
|
var indent = line.search(/\S/);
|
275
|
if (indent === -1)
|
276
|
continue;
|
277
|
if (startIndent > indent)
|
278
|
break;
|
279
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
280
|
|
281
|
if (subRange) {
|
282
|
if (subRange.start.row <= startRow) {
|
283
|
break;
|
284
|
} else if (subRange.isMultiLine()) {
|
285
|
row = subRange.end.row;
|
286
|
} else if (startIndent == indent) {
|
287
|
break;
|
288
|
}
|
289
|
}
|
290
|
endRow = row;
|
291
|
}
|
292
|
|
293
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
294
|
};
|
295
|
this.getCommentRegionBlock = function(session, line, row) {
|
296
|
var startColumn = line.search(/\s*$/);
|
297
|
var maxRow = session.getLength();
|
298
|
var startRow = row;
|
299
|
|
300
|
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
|
301
|
var depth = 1;
|
302
|
while (++row < maxRow) {
|
303
|
line = session.getLine(row);
|
304
|
var m = re.exec(line);
|
305
|
if (!m) continue;
|
306
|
if (m[1]) depth--;
|
307
|
else depth++;
|
308
|
|
309
|
if (!depth) break;
|
310
|
}
|
311
|
|
312
|
var endRow = row;
|
313
|
if (endRow > startRow) {
|
314
|
return new Range(startRow, startColumn, endRow, line.length);
|
315
|
}
|
316
|
};
|
317
|
|
318
|
}).call(FoldMode.prototype);
|
319
|
|
320
|
});
|
321
|
|
322
|
ace.define("ace/mode/logtalk",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/logtalk_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
|
323
|
"use strict";
|
324
|
|
325
|
var oop = require("../lib/oop");
|
326
|
var TextMode = require("./text").Mode;
|
327
|
var Tokenizer = require("../tokenizer").Tokenizer;
|
328
|
var LogtalkHighlightRules = require("./logtalk_highlight_rules").LogtalkHighlightRules;
|
329
|
var FoldMode = require("./folding/cstyle").FoldMode;
|
330
|
|
331
|
var Mode = function() {
|
332
|
this.HighlightRules = LogtalkHighlightRules;
|
333
|
this.foldingRules = new FoldMode();
|
334
|
this.$behaviour = this.$defaultBehaviour;
|
335
|
};
|
336
|
oop.inherits(Mode, TextMode);
|
337
|
|
338
|
(function() {
|
339
|
this.lineCommentStart = "%";
|
340
|
this.blockComment = {start: "/*", end: "*/"};
|
341
|
this.$id = "ace/mode/logtalk";
|
342
|
}).call(Mode.prototype);
|
343
|
|
344
|
exports.Mode = Mode;
|
345
|
}); (function() {
|
346
|
ace.require(["ace/mode/logtalk"], function(m) {
|
347
|
if (typeof module == "object" && typeof exports == "object" && module) {
|
348
|
module.exports = m;
|
349
|
}
|
350
|
});
|
351
|
})();
|
352
|
|