Debian Codegraph @

extensions/CodeEditor/modules/lib/ace/mode-ion.js

raw symbols SCIP
1 ace.define("ace/mode/ion_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){/*
2 THIS FILE WAS GENERATED BY 'ligand' USING 'mode_highlight_rules.js'
3 */
4 "use strict";
5 var oop = require("../lib/oop");
6 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
7 var IonHighlightRules = function () {
8 var k_keywords_bool = "TRUE|FALSE";
9 var k_bool = k_keywords_bool;
10 var k_keywords_null = "NULL.NULL|NULL.BOOL|NULL.INT|NULL.FLOAT|NULL.DECIMAL|NULL.TIMESTAMP|NULL.STRING|NULL.SYMBOL|NULL.BLOB|NULL.CLOB|"
11 + "NULL.STRUCT|NULL.LIST|NULL.SEXP|NULL";
12 var k_null = k_keywords_null;
13 var keywordMapper = this.createKeywordMapper({
14 "constant.language.bool.ion": k_bool,
15 "constant.language.null.ion": k_null
16 }, "constant.other.symbol.identifier.ion", true);
17 var keywordMapperRule = {
18 token: keywordMapper,
19 regex: "\\b\\w+(?:\\.\\w+)?\\b"
20 };
21 this.$rules = {
22 "start": [
23 {
24 "include": "value"
25 }
26 ],
27 "value": [
28 {
29 "include": "whitespace"
30 },
31 {
32 "include": "comment"
33 },
34 {
35 "include": "annotation"
36 },
37 {
38 "include": "string"
39 },
40 {
41 "include": "number"
42 },
43 {
44 "include": "keywords"
45 },
46 {
47 "include": "symbol"
48 },
49 {
50 "include": "clob"
51 },
52 {
53 "include": "blob"
54 },
55 {
56 "include": "struct"
57 },
58 {
59 "include": "list"
60 },
61 {
62 "include": "sexp"
63 }
64 ],
65 "sexp": [
66 {
67 "token": "punctuation.definition.sexp.begin.ion",
68 "regex": "\\(",
69 "push": [
70 {
71 "token": "punctuation.definition.sexp.end.ion",
72 "regex": "\\)",
73 "next": "pop"
74 },
75 {
76 "include": "comment"
77 },
78 {
79 "include": "value"
80 },
81 {
82 "token": "storage.type.symbol.operator.ion",
83 "regex": "[\\!\\#\\%\\&\\*\\+\\-\\./\\;\\<\\=\\>\\?\\@\\^\\`\\|\\~]+"
84 }
85 ]
86 }
87 ],
88 "comment": [
89 {
90 "token": "comment.line.ion",
91 "regex": "//[^\\n]*"
92 },
93 {
94 "token": "comment.block.ion",
95 "regex": "/\\*",
96 "push": [
97 {
98 "token": "comment.block.ion",
99 "regex": "[*]/",
100 "next": "pop"
101 },
102 {
103 "token": "comment.block.ion",
104 "regex": "[^*/]+"
105 },
106 {
107 "token": "comment.block.ion",
108 "regex": "[*/]+"
109 }
110 ]
111 }
112 ],
113 "list": [
114 {
115 "token": "punctuation.definition.list.begin.ion",
116 "regex": "\\[",
117 "push": [
118 {
119 "token": "punctuation.definition.list.end.ion",
120 "regex": "\\]",
121 "next": "pop"
122 },
123 {
124 "include": "comment"
125 },
126 {
127 "include": "value"
128 },
129 {
130 "token": "punctuation.definition.list.separator.ion",
131 "regex": ","
132 }
133 ]
134 }
135 ],
136 "struct": [
137 {
138 "token": "punctuation.definition.struct.begin.ion",
139 "regex": "\\{",
140 "push": [
141 {
142 "token": "punctuation.definition.struct.end.ion",
143 "regex": "\\}",
144 "next": "pop"
145 },
146 {
147 "include": "comment"
148 },
149 {
150 "include": "value"
151 },
152 {
153 "token": "punctuation.definition.struct.separator.ion",
154 "regex": ",|:"
155 }
156 ]
157 }
158 ],
159 "blob": [
160 {
161 "token": [
162 "punctuation.definition.blob.begin.ion",
163 "string.other.blob.ion",
164 "punctuation.definition.blob.end.ion"
165 ],
166 "regex": "(\\{\\{)([^\"]*)(\\}\\})"
167 }
168 ],
169 "clob": [
170 {
171 "token": [
172 "punctuation.definition.clob.begin.ion",
173 "string.other.clob.ion",
174 "punctuation.definition.clob.end.ion"
175 ],
176 "regex": "(\\{\\{)(\"[^\"]*\")(\\}\\})"
177 }
178 ],
179 "symbol": [
180 {
181 "token": "storage.type.symbol.quoted.ion",
182 "regex": "(['])((?:(?:\\\\')|(?:[^']))*?)(['])"
183 },
184 {
185 "token": "storage.type.symbol.identifier.ion",
186 "regex": "[\\$_a-zA-Z][\\$_a-zA-Z0-9]*"
187 }
188 ],
189 "number": [
190 {
191 "token": "constant.numeric.timestamp.ion",
192 "regex": "\\d{4}(?:-\\d{2})?(?:-\\d{2})?T(?:\\d{2}:\\d{2})(?::\\d{2})?(?:\\.\\d+)?(?:Z|[-+]\\d{2}:\\d{2})?"
193 },
194 {
195 "token": "constant.numeric.timestamp.ion",
196 "regex": "\\d{4}-\\d{2}-\\d{2}T?"
197 },
198 {
199 "token": "constant.numeric.integer.binary.ion",
200 "regex": "-?0[bB][01](?:_?[01])*"
201 },
202 {
203 "token": "constant.numeric.integer.hex.ion",
204 "regex": "-?0[xX][0-9a-fA-F](?:_?[0-9a-fA-F])*"
205 },
206 {
207 "token": "constant.numeric.float.ion",
208 "regex": "-?(?:0|[1-9](?:_?\\d)*)(?:\\.(?:\\d(?:_?\\d)*)?)?(?:[eE][+-]?\\d+)"
209 },
210 {
211 "token": "constant.numeric.float.ion",
212 "regex": "(?:[-+]inf)|(?:nan)"
213 },
214 {
215 "token": "constant.numeric.decimal.ion",
216 "regex": "-?(?:0|[1-9](?:_?\\d)*)(?:(?:(?:\\.(?:\\d(?:_?\\d)*)?)(?:[dD][+-]?\\d+)|\\.(?:\\d(?:_?\\d)*)?)|(?:[dD][+-]?\\d+))"
217 },
218 {
219 "token": "constant.numeric.integer.ion",
220 "regex": "-?(?:0|[1-9](?:_?\\d)*)"
221 }
222 ],
223 "string": [
224 {
225 "token": [
226 "punctuation.definition.string.begin.ion",
227 "string.quoted.double.ion",
228 "punctuation.definition.string.end.ion"
229 ],
230 "regex": "([\"])((?:(?:\\\\\")|(?:[^\"]))*?)([\"])"
231 },
232 {
233 "token": "punctuation.definition.string.begin.ion",
234 "regex": "'{3}",
235 "push": [
236 {
237 "token": "punctuation.definition.string.end.ion",
238 "regex": "'{3}",
239 "next": "pop"
240 },
241 {
242 "token": "string.quoted.triple.ion",
243 "regex": "(?:\\\\'|[^'])+"
244 },
245 {
246 "token": "string.quoted.triple.ion",
247 "regex": "'"
248 }
249 ]
250 }
251 ],
252 "annotation": [
253 {
254 "token": [
255 "variable.language.annotation.ion",
256 "punctuation.definition.annotation.ion"
257 ],
258 "regex": /('(?:[^'\\]|\\.)*')\s*(::)/
259 },
260 {
261 "token": [
262 "variable.language.annotation.ion",
263 "punctuation.definition.annotation.ion"
264 ],
265 "regex": "([\\$_a-zA-Z][\\$_a-zA-Z0-9]*)\\s*(::)"
266 }
267 ],
268 "whitespace": [
269 {
270 "token": "text.ion",
271 "regex": "\\s+"
272 }
273 ]
274 };
275 this.$rules["keywords"] = [keywordMapperRule];
276 this.normalizeRules();
277 };
278 oop.inherits(IonHighlightRules, TextHighlightRules);
279 exports.IonHighlightRules = IonHighlightRules;
280
281 });
282
283 ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
284 var Range = require("../range").Range;
285 var MatchingBraceOutdent = function () { };
286 (function () {
287 this.checkOutdent = function (line, input) {
288 if (!/^\s+$/.test(line))
289 return false;
290 return /^\s*\}/.test(input);
291 };
292 this.autoOutdent = function (doc, row) {
293 var line = doc.getLine(row);
294 var match = line.match(/^(\s*\})/);
295 if (!match)
296 return 0;
297 var column = match[1].length;
298 var openBracePos = doc.findMatchingBracket({ row: row, column: column });
299 if (!openBracePos || openBracePos.row == row)
300 return 0;
301 var indent = this.$getIndent(doc.getLine(openBracePos.row));
302 doc.replace(new Range(row, 0, row, column - 1), indent);
303 };
304 this.$getIndent = function (line) {
305 return line.match(/^\s*/)[0];
306 };
307 }).call(MatchingBraceOutdent.prototype);
308 exports.MatchingBraceOutdent = MatchingBraceOutdent;
309
310 });
311
312 ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
313 var oop = require("../../lib/oop");
314 var Range = require("../../range").Range;
315 var BaseFoldMode = require("./fold_mode").FoldMode;
316 var FoldMode = exports.FoldMode = function (commentRegex) {
317 if (commentRegex) {
318 this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
319 this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
320 }
321 };
322 oop.inherits(FoldMode, BaseFoldMode);
323 (function () {
324 this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
325 this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
326 this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
327 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
328 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
329 this._getFoldWidgetBase = this.getFoldWidget;
330 this.getFoldWidget = function (session, foldStyle, row) {
331 var line = session.getLine(row);
332 if (this.singleLineBlockCommentRe.test(line)) {
333 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
334 return "";
335 }
336 var fw = this._getFoldWidgetBase(session, foldStyle, row);
337 if (!fw && this.startRegionRe.test(line))
338 return "start"; // lineCommentRegionStart
339 return fw;
340 };
341 this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
342 var line = session.getLine(row);
343 if (this.startRegionRe.test(line))
344 return this.getCommentRegionBlock(session, line, row);
345 var match = line.match(this.foldingStartMarker);
346 if (match) {
347 var i = match.index;
348 if (match[1])
349 return this.openingBracketBlock(session, match[1], row, i);
350 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
351 if (range && !range.isMultiLine()) {
352 if (forceMultiline) {
353 range = this.getSectionRange(session, row);
354 }
355 else if (foldStyle != "all")
356 range = null;
357 }
358 return range;
359 }
360 if (foldStyle === "markbegin")
361 return;
362 var match = line.match(this.foldingStopMarker);
363 if (match) {
364 var i = match.index + match[0].length;
365 if (match[1])
366 return this.closingBracketBlock(session, match[1], row, i);
367 return session.getCommentFoldRange(row, i, -1);
368 }
369 };
370 this.getSectionRange = function (session, row) {
371 var line = session.getLine(row);
372 var startIndent = line.search(/\S/);
373 var startRow = row;
374 var startColumn = line.length;
375 row = row + 1;
376 var endRow = row;
377 var maxRow = session.getLength();
378 while (++row < maxRow) {
379 line = session.getLine(row);
380 var indent = line.search(/\S/);
381 if (indent === -1)
382 continue;
383 if (startIndent > indent)
384 break;
385 var subRange = this.getFoldWidgetRange(session, "all", row);
386 if (subRange) {
387 if (subRange.start.row <= startRow) {
388 break;
389 }
390 else if (subRange.isMultiLine()) {
391 row = subRange.end.row;
392 }
393 else if (startIndent == indent) {
394 break;
395 }
396 }
397 endRow = row;
398 }
399 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
400 };
401 this.getCommentRegionBlock = function (session, line, row) {
402 var startColumn = line.search(/\s*$/);
403 var maxRow = session.getLength();
404 var startRow = row;
405 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
406 var depth = 1;
407 while (++row < maxRow) {
408 line = session.getLine(row);
409 var m = re.exec(line);
410 if (!m)
411 continue;
412 if (m[1])
413 depth--;
414 else
415 depth++;
416 if (!depth)
417 break;
418 }
419 var endRow = row;
420 if (endRow > startRow) {
421 return new Range(startRow, startColumn, endRow, line.length);
422 }
423 };
424 }).call(FoldMode.prototype);
425
426 });
427
428 ace.define("ace/mode/ion",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ion_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/cstyle"], function(require, exports, module){/*
429 THIS FILE WAS GENERATED BY 'ligand' USING 'mode.js'
430 */
431 "use strict";
432 var oop = require("../lib/oop");
433 var TextMode = require("./text").Mode;
434 var HighlightRules = require("./ion_highlight_rules").IonHighlightRules;
435 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
436 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
437 var Mode = function () {
438 this.HighlightRules = HighlightRules;
439 this.$outdent = new MatchingBraceOutdent();
440 this.$behaviour = this.$defaultBehaviour;
441 this.foldingRules = new CStyleFoldMode();
442 };
443 oop.inherits(Mode, TextMode);
444 (function () {
445 this.lineCommentStart = "//";
446 this.blockComment = {
447 start: "/*",
448 end: "*/"
449 };
450 this.getNextLineIndent = function (state, line, tab) {
451 var indent = this.$getIndent(line);
452 if (state == "start") {
453 var match = line.match(/^.*[\{\(\[]\s*$/);
454 if (match) {
455 indent += tab;
456 }
457 }
458 return indent;
459 };
460 this.checkOutdent = function (state, line, input) {
461 return this.$outdent.checkOutdent(line, input);
462 };
463 this.autoOutdent = function (state, doc, row) {
464 this.$outdent.autoOutdent(doc, row);
465 };
466 this.$id = "ace/mode/ion";
467 }).call(Mode.prototype);
468 exports.Mode = Mode;
469
470 }); (function() {
471 ace.require(["ace/mode/ion"], function(m) {
472 if (typeof module == "object" && typeof exports == "object" && module) {
473 module.exports = m;
474 }
475 });
476 })();
477