Debian Codegraph @

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

raw symbols SCIP
1 ace.define("ace/mode/maze_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 MazeHighlightRules = function () {
5 this.$rules = {
6 start: [{
7 token: "keyword.control",
8 regex: /##|``/,
9 comment: "Wall"
10 }, {
11 token: "entity.name.tag",
12 regex: /\.\./,
13 comment: "Path"
14 }, {
15 token: "keyword.control",
16 regex: /<>/,
17 comment: "Splitter"
18 }, {
19 token: "entity.name.tag",
20 regex: /\*[\*A-Za-z0-9]/,
21 comment: "Signal"
22 }, {
23 token: "constant.numeric",
24 regex: /[0-9]{2}/,
25 comment: "Pause"
26 }, {
27 token: "keyword.control",
28 regex: /\^\^/,
29 comment: "Start"
30 }, {
31 token: "keyword.control",
32 regex: /\(\)/,
33 comment: "Hole"
34 }, {
35 token: "support.function",
36 regex: />>/,
37 comment: "Out"
38 }, {
39 token: "support.function",
40 regex: />\//,
41 comment: "Ln Out"
42 }, {
43 token: "support.function",
44 regex: /<</,
45 comment: "In"
46 }, {
47 token: "keyword.control",
48 regex: /--/,
49 comment: "One use"
50 }, {
51 token: "constant.language",
52 regex: /%[LRUDNlrudn]/,
53 comment: "Direction"
54 }, {
55 token: [
56 "entity.name.function",
57 "keyword.other",
58 "keyword.operator",
59 "keyword.other",
60 "keyword.operator",
61 "constant.numeric",
62 "keyword.operator",
63 "keyword.other",
64 "keyword.operator",
65 "constant.numeric",
66 "string.quoted.double",
67 "string.quoted.single"
68 ],
69 regex: /([A-Za-z][A-Za-z0-9])( *-> *)(?:([-+*\/]=)( *)((?:-)?)([0-9]+)|(=)( *)(?:((?:-)?)([0-9]+)|("[^"]*")|('[^']*')))/,
70 comment: "Assignment function"
71 }, {
72 token: [
73 "entity.name.function",
74 "keyword.other",
75 "keyword.control",
76 "keyword.other",
77 "keyword.operator",
78 "keyword.other",
79 "keyword.operator",
80 "constant.numeric",
81 "entity.name.tag",
82 "keyword.other",
83 "keyword.control",
84 "keyword.other",
85 "constant.language",
86 "keyword.other",
87 "keyword.control",
88 "keyword.other",
89 "constant.language"
90 ],
91 regex: /([A-Za-z][A-Za-z0-9])( *-> *)(IF|if)( *)(?:([<>]=?|==)( *)((?:-)?)([0-9]+)|(\*[\*A-Za-z0-9]))( *)(THEN|then)( *)(%[LRUDNlrudn])(?:( *)(ELSE|else)( *)(%[LRUDNlrudn]))?/,
92 comment: "Equality Function"
93 }, {
94 token: "entity.name.function",
95 regex: /[A-Za-z][A-Za-z0-9]/,
96 comment: "Function cell"
97 }, {
98 token: "comment.line.double-slash",
99 regex: / *\/\/.*/,
100 comment: "Comment"
101 }]
102 };
103 this.normalizeRules();
104 };
105 MazeHighlightRules.metaData = {
106 fileTypes: ["mz"],
107 name: "Maze",
108 scopeName: "source.maze"
109 };
110 oop.inherits(MazeHighlightRules, TextHighlightRules);
111 exports.MazeHighlightRules = MazeHighlightRules;
112
113 });
114
115 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";
116 var oop = require("../../lib/oop");
117 var Range = require("../../range").Range;
118 var BaseFoldMode = require("./fold_mode").FoldMode;
119 var FoldMode = exports.FoldMode = function (commentRegex) {
120 if (commentRegex) {
121 this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
122 this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
123 }
124 };
125 oop.inherits(FoldMode, BaseFoldMode);
126 (function () {
127 this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
128 this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
129 this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
130 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
131 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
132 this._getFoldWidgetBase = this.getFoldWidget;
133 this.getFoldWidget = function (session, foldStyle, row) {
134 var line = session.getLine(row);
135 if (this.singleLineBlockCommentRe.test(line)) {
136 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
137 return "";
138 }
139 var fw = this._getFoldWidgetBase(session, foldStyle, row);
140 if (!fw && this.startRegionRe.test(line))
141 return "start"; // lineCommentRegionStart
142 return fw;
143 };
144 this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
145 var line = session.getLine(row);
146 if (this.startRegionRe.test(line))
147 return this.getCommentRegionBlock(session, line, row);
148 var match = line.match(this.foldingStartMarker);
149 if (match) {
150 var i = match.index;
151 if (match[1])
152 return this.openingBracketBlock(session, match[1], row, i);
153 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
154 if (range && !range.isMultiLine()) {
155 if (forceMultiline) {
156 range = this.getSectionRange(session, row);
157 }
158 else if (foldStyle != "all")
159 range = null;
160 }
161 return range;
162 }
163 if (foldStyle === "markbegin")
164 return;
165 var match = line.match(this.foldingStopMarker);
166 if (match) {
167 var i = match.index + match[0].length;
168 if (match[1])
169 return this.closingBracketBlock(session, match[1], row, i);
170 return session.getCommentFoldRange(row, i, -1);
171 }
172 };
173 this.getSectionRange = function (session, row) {
174 var line = session.getLine(row);
175 var startIndent = line.search(/\S/);
176 var startRow = row;
177 var startColumn = line.length;
178 row = row + 1;
179 var endRow = row;
180 var maxRow = session.getLength();
181 while (++row < maxRow) {
182 line = session.getLine(row);
183 var indent = line.search(/\S/);
184 if (indent === -1)
185 continue;
186 if (startIndent > indent)
187 break;
188 var subRange = this.getFoldWidgetRange(session, "all", row);
189 if (subRange) {
190 if (subRange.start.row <= startRow) {
191 break;
192 }
193 else if (subRange.isMultiLine()) {
194 row = subRange.end.row;
195 }
196 else if (startIndent == indent) {
197 break;
198 }
199 }
200 endRow = row;
201 }
202 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
203 };
204 this.getCommentRegionBlock = function (session, line, row) {
205 var startColumn = line.search(/\s*$/);
206 var maxRow = session.getLength();
207 var startRow = row;
208 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
209 var depth = 1;
210 while (++row < maxRow) {
211 line = session.getLine(row);
212 var m = re.exec(line);
213 if (!m)
214 continue;
215 if (m[1])
216 depth--;
217 else
218 depth++;
219 if (!depth)
220 break;
221 }
222 var endRow = row;
223 if (endRow > startRow) {
224 return new Range(startRow, startColumn, endRow, line.length);
225 }
226 };
227 }).call(FoldMode.prototype);
228
229 });
230
231 ace.define("ace/mode/maze",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/maze_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
232 var oop = require("../lib/oop");
233 var TextMode = require("./text").Mode;
234 var MazeHighlightRules = require("./maze_highlight_rules").MazeHighlightRules;
235 var FoldMode = require("./folding/cstyle").FoldMode;
236 var Mode = function () {
237 this.HighlightRules = MazeHighlightRules;
238 this.foldingRules = new FoldMode();
239 this.$behaviour = this.$defaultBehaviour;
240 };
241 oop.inherits(Mode, TextMode);
242 (function () {
243 this.lineCommentStart = "//";
244 this.$id = "ace/mode/maze";
245 this.snippetFileId = "ace/snippets/maze";
246 }).call(Mode.prototype);
247 exports.Mode = Mode;
248
249 }); (function() {
250 ace.require(["ace/mode/maze"], function(m) {
251 if (typeof module == "object" && typeof exports == "object" && module) {
252 module.exports = m;
253 }
254 });
255 })();
256