Debian Codegraph @

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

raw symbols SCIP
1 ace.define("ace/mode/jack_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
2 var oop = require("../lib/oop");
3 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
4 var JackHighlightRules = function () {
5 this.$rules = {
6 "start": [
7 {
8 token: "string",
9 regex: '"',
10 next: "string2"
11 }, {
12 token: "string",
13 regex: "'",
14 next: "string1"
15 }, {
16 token: "constant.numeric", // hex
17 regex: "-?0[xX][0-9a-fA-F]+\\b"
18 }, {
19 token: "constant.numeric", // float
20 regex: "(?:0|[-+]?[1-9][0-9]*)\\b"
21 }, {
22 token: "constant.binary",
23 regex: "<[0-9A-Fa-f][0-9A-Fa-f](\\s+[0-9A-Fa-f][0-9A-Fa-f])*>"
24 }, {
25 token: "constant.language.boolean",
26 regex: "(?:true|false)\\b"
27 }, {
28 token: "constant.language.null",
29 regex: "null\\b"
30 }, {
31 token: "storage.type",
32 regex: "(?:Integer|Boolean|Null|String|Buffer|Tuple|List|Object|Function|Coroutine|Form)\\b"
33 }, {
34 token: "keyword",
35 regex: "(?:return|abort|vars|for|delete|in|is|escape|exec|split|and|if|elif|else|while)\\b"
36 }, {
37 token: "language.builtin",
38 regex: "(?:lines|source|parse|read-stream|interval|substr|parseint|write|print|range|rand|inspect|bind|i-values|i-pairs|i-map|i-filter|i-chunk|i-all\\?|i-any\\?|i-collect|i-zip|i-merge|i-each)\\b"
39 }, {
40 token: "comment",
41 regex: "--.*$"
42 }, {
43 token: "paren.lparen",
44 regex: "[[({]"
45 }, {
46 token: "paren.rparen",
47 regex: "[\\])}]"
48 }, {
49 token: "storage.form",
50 regex: "@[a-z]+"
51 }, {
52 token: "constant.other.symbol",
53 regex: ':+[a-zA-Z_]([-]?[a-zA-Z0-9_])*[?!]?'
54 }, {
55 token: "variable",
56 regex: '[a-zA-Z_]([-]?[a-zA-Z0-9_])*[?!]?'
57 }, {
58 token: "keyword.operator",
59 regex: "\\|\\||\\^\\^|&&|!=|==|<=|<|>=|>|\\+|-|\\*|\\/|\\^|\\%|\\#|\\!"
60 }, {
61 token: "text",
62 regex: "\\s+"
63 }
64 ],
65 "string1": [
66 {
67 token: "constant.language.escape",
68 regex: /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|['"\\\/bfnrt])/
69 }, {
70 token: "string",
71 regex: "[^'\\\\]+"
72 }, {
73 token: "string",
74 regex: "'",
75 next: "start"
76 }, {
77 token: "string",
78 regex: "",
79 next: "start"
80 }
81 ],
82 "string2": [
83 {
84 token: "constant.language.escape",
85 regex: /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|['"\\\/bfnrt])/
86 }, {
87 token: "string",
88 regex: '[^"\\\\]+'
89 }, {
90 token: "string",
91 regex: '"',
92 next: "start"
93 }, {
94 token: "string",
95 regex: "",
96 next: "start"
97 }
98 ]
99 };
100 };
101 oop.inherits(JackHighlightRules, TextHighlightRules);
102 exports.JackHighlightRules = JackHighlightRules;
103
104 });
105
106 ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
107 var Range = require("../range").Range;
108 var MatchingBraceOutdent = function () { };
109 (function () {
110 this.checkOutdent = function (line, input) {
111 if (!/^\s+$/.test(line))
112 return false;
113 return /^\s*\}/.test(input);
114 };
115 this.autoOutdent = function (doc, row) {
116 var line = doc.getLine(row);
117 var match = line.match(/^(\s*\})/);
118 if (!match)
119 return 0;
120 var column = match[1].length;
121 var openBracePos = doc.findMatchingBracket({ row: row, column: column });
122 if (!openBracePos || openBracePos.row == row)
123 return 0;
124 var indent = this.$getIndent(doc.getLine(openBracePos.row));
125 doc.replace(new Range(row, 0, row, column - 1), indent);
126 };
127 this.$getIndent = function (line) {
128 return line.match(/^\s*/)[0];
129 };
130 }).call(MatchingBraceOutdent.prototype);
131 exports.MatchingBraceOutdent = MatchingBraceOutdent;
132
133 });
134
135 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";
136 var oop = require("../../lib/oop");
137 var Range = require("../../range").Range;
138 var BaseFoldMode = require("./fold_mode").FoldMode;
139 var FoldMode = exports.FoldMode = function (commentRegex) {
140 if (commentRegex) {
141 this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
142 this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
143 }
144 };
145 oop.inherits(FoldMode, BaseFoldMode);
146 (function () {
147 this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
148 this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
149 this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
150 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
151 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
152 this._getFoldWidgetBase = this.getFoldWidget;
153 this.getFoldWidget = function (session, foldStyle, row) {
154 var line = session.getLine(row);
155 if (this.singleLineBlockCommentRe.test(line)) {
156 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
157 return "";
158 }
159 var fw = this._getFoldWidgetBase(session, foldStyle, row);
160 if (!fw && this.startRegionRe.test(line))
161 return "start"; // lineCommentRegionStart
162 return fw;
163 };
164 this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
165 var line = session.getLine(row);
166 if (this.startRegionRe.test(line))
167 return this.getCommentRegionBlock(session, line, row);
168 var match = line.match(this.foldingStartMarker);
169 if (match) {
170 var i = match.index;
171 if (match[1])
172 return this.openingBracketBlock(session, match[1], row, i);
173 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
174 if (range && !range.isMultiLine()) {
175 if (forceMultiline) {
176 range = this.getSectionRange(session, row);
177 }
178 else if (foldStyle != "all")
179 range = null;
180 }
181 return range;
182 }
183 if (foldStyle === "markbegin")
184 return;
185 var match = line.match(this.foldingStopMarker);
186 if (match) {
187 var i = match.index + match[0].length;
188 if (match[1])
189 return this.closingBracketBlock(session, match[1], row, i);
190 return session.getCommentFoldRange(row, i, -1);
191 }
192 };
193 this.getSectionRange = function (session, row) {
194 var line = session.getLine(row);
195 var startIndent = line.search(/\S/);
196 var startRow = row;
197 var startColumn = line.length;
198 row = row + 1;
199 var endRow = row;
200 var maxRow = session.getLength();
201 while (++row < maxRow) {
202 line = session.getLine(row);
203 var indent = line.search(/\S/);
204 if (indent === -1)
205 continue;
206 if (startIndent > indent)
207 break;
208 var subRange = this.getFoldWidgetRange(session, "all", row);
209 if (subRange) {
210 if (subRange.start.row <= startRow) {
211 break;
212 }
213 else if (subRange.isMultiLine()) {
214 row = subRange.end.row;
215 }
216 else if (startIndent == indent) {
217 break;
218 }
219 }
220 endRow = row;
221 }
222 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
223 };
224 this.getCommentRegionBlock = function (session, line, row) {
225 var startColumn = line.search(/\s*$/);
226 var maxRow = session.getLength();
227 var startRow = row;
228 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
229 var depth = 1;
230 while (++row < maxRow) {
231 line = session.getLine(row);
232 var m = re.exec(line);
233 if (!m)
234 continue;
235 if (m[1])
236 depth--;
237 else
238 depth++;
239 if (!depth)
240 break;
241 }
242 var endRow = row;
243 if (endRow > startRow) {
244 return new Range(startRow, startColumn, endRow, line.length);
245 }
246 };
247 }).call(FoldMode.prototype);
248
249 });
250
251 ace.define("ace/mode/jack",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/jack_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
252 var oop = require("../lib/oop");
253 var TextMode = require("./text").Mode;
254 var HighlightRules = require("./jack_highlight_rules").JackHighlightRules;
255 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
256 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
257 var Mode = function () {
258 this.HighlightRules = HighlightRules;
259 this.$outdent = new MatchingBraceOutdent();
260 this.$behaviour = this.$defaultBehaviour;
261 this.foldingRules = new CStyleFoldMode();
262 };
263 oop.inherits(Mode, TextMode);
264 (function () {
265 this.lineCommentStart = "--";
266 this.getNextLineIndent = function (state, line, tab) {
267 var indent = this.$getIndent(line);
268 if (state == "start") {
269 var match = line.match(/^.*[\{\(\[]\s*$/);
270 if (match) {
271 indent += tab;
272 }
273 }
274 return indent;
275 };
276 this.checkOutdent = function (state, line, input) {
277 return this.$outdent.checkOutdent(line, input);
278 };
279 this.autoOutdent = function (state, doc, row) {
280 this.$outdent.autoOutdent(doc, row);
281 };
282 this.$id = "ace/mode/jack";
283 }).call(Mode.prototype);
284 exports.Mode = Mode;
285
286 }); (function() {
287 ace.require(["ace/mode/jack"], function(m) {
288 if (typeof module == "object" && typeof exports == "object" && module) {
289 module.exports = m;
290 }
291 });
292 })();
293