corrade-nucleus-nucleons – Blame information for rev 20

Subversion Repositories:
Rev:
Rev Author Line No. Line
20 office 1 define("ace/mode/doc_comment_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 DocCommentHighlightRules = function() {
8 this.$rules = {
9 "start" : [ {
10 token : "comment.doc.tag",
11 regex : "@[\\w\\d_]+" // TODO: fix email addresses
12 },
13 DocCommentHighlightRules.getTagRule(),
14 {
15 defaultToken : "comment.doc",
16 caseInsensitive: true
17 }]
18 };
19 };
20  
21 oop.inherits(DocCommentHighlightRules, TextHighlightRules);
22  
23 DocCommentHighlightRules.getTagRule = function(start) {
24 return {
25 token : "comment.doc.tag.storage.type",
26 regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
27 };
28 }
29  
30 DocCommentHighlightRules.getStartRule = function(start) {
31 return {
32 token : "comment.doc", // doc comment
33 regex : "\\/\\*(?=\\*)",
34 next : start
35 };
36 };
37  
38 DocCommentHighlightRules.getEndRule = function (start) {
39 return {
40 token : "comment.doc", // closing comment
41 regex : "\\*\\/",
42 next : start
43 };
44 };
45  
46  
47 exports.DocCommentHighlightRules = DocCommentHighlightRules;
48  
49 });
50  
51 define("ace/mode/scad_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
52 "use strict";
53  
54 var oop = require("../lib/oop");
55 var lang = require("../lib/lang");
56 var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
57 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
58  
59 var scadHighlightRules = function() {
60 var keywordMapper = this.createKeywordMapper({
61 "variable.language": "this",
62 "keyword": "module|if|else|for",
63 "constant.language": "NULL"
64 }, "identifier");
65  
66 this.$rules = {
67 "start" : [
68 {
69 token : "comment",
70 regex : "\\/\\/.*$"
71 },
72 DocCommentHighlightRules.getStartRule("start"),
73 {
74 token : "comment", // multi line comment
75 regex : "\\/\\*",
76 next : "comment"
77 }, {
78 token : "string", // single line
79 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
80 }, {
81 token : "string", // multi line string start
82 regex : '["].*\\\\$',
83 next : "qqstring"
84 }, {
85 token : "string", // single line
86 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
87 }, {
88 token : "string", // multi line string start
89 regex : "['].*\\\\$",
90 next : "qstring"
91 }, {
92 token : "constant.numeric", // hex
93 regex : "0[xX][0-9a-fA-F]+\\b"
94 }, {
95 token : "constant.numeric", // float
96 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
97 }, {
98 token : "constant", // <CONSTANT>
99 regex : "<[a-zA-Z0-9.]+>"
100 }, {
101 token : "keyword", // pre-compiler directivs
102 regex : "(?:use|include)"
103 }, {
104 token : keywordMapper,
105 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
106 }, {
107 token : "keyword.operator",
108 regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
109 }, {
110 token : "paren.lparen",
111 regex : "[[({]"
112 }, {
113 token : "paren.rparen",
114 regex : "[\\])}]"
115 }, {
116 token : "text",
117 regex : "\\s+"
118 }
119 ],
120 "comment" : [
121 {
122 token : "comment", // closing comment
123 regex : ".*?\\*\\/",
124 next : "start"
125 }, {
126 token : "comment", // comment spanning whole line
127 regex : ".+"
128 }
129 ],
130 "qqstring" : [
131 {
132 token : "string",
133 regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
134 next : "start"
135 }, {
136 token : "string",
137 regex : '.+'
138 }
139 ],
140 "qstring" : [
141 {
142 token : "string",
143 regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
144 next : "start"
145 }, {
146 token : "string",
147 regex : '.+'
148 }
149 ]
150 };
151  
152 this.embedRules(DocCommentHighlightRules, "doc-",
153 [ DocCommentHighlightRules.getEndRule("start") ]);
154 };
155  
156 oop.inherits(scadHighlightRules, TextHighlightRules);
157  
158 exports.scadHighlightRules = scadHighlightRules;
159 });
160  
161 define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
162 "use strict";
163  
164 var Range = require("../range").Range;
165  
166 var MatchingBraceOutdent = function() {};
167  
168 (function() {
169  
170 this.checkOutdent = function(line, input) {
171 if (! /^\s+$/.test(line))
172 return false;
173  
174 return /^\s*\}/.test(input);
175 };
176  
177 this.autoOutdent = function(doc, row) {
178 var line = doc.getLine(row);
179 var match = line.match(/^(\s*\})/);
180  
181 if (!match) return 0;
182  
183 var column = match[1].length;
184 var openBracePos = doc.findMatchingBracket({row: row, column: column});
185  
186 if (!openBracePos || openBracePos.row == row) return 0;
187  
188 var indent = this.$getIndent(doc.getLine(openBracePos.row));
189 doc.replace(new Range(row, 0, row, column-1), indent);
190 };
191  
192 this.$getIndent = function(line) {
193 return line.match(/^\s*/)[0];
194 };
195  
196 }).call(MatchingBraceOutdent.prototype);
197  
198 exports.MatchingBraceOutdent = MatchingBraceOutdent;
199 });
200  
201 define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
202 "use strict";
203  
204 var oop = require("../../lib/oop");
205 var Range = require("../../range").Range;
206 var BaseFoldMode = require("./fold_mode").FoldMode;
207  
208 var FoldMode = exports.FoldMode = function(commentRegex) {
209 if (commentRegex) {
210 this.foldingStartMarker = new RegExp(
211 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
212 );
213 this.foldingStopMarker = new RegExp(
214 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
215 );
216 }
217 };
218 oop.inherits(FoldMode, BaseFoldMode);
219  
220 (function() {
221  
222 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
223 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
224 this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
225 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
226 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
227 this._getFoldWidgetBase = this.getFoldWidget;
228 this.getFoldWidget = function(session, foldStyle, row) {
229 var line = session.getLine(row);
230  
231 if (this.singleLineBlockCommentRe.test(line)) {
232 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
233 return "";
234 }
235  
236 var fw = this._getFoldWidgetBase(session, foldStyle, row);
237  
238 if (!fw && this.startRegionRe.test(line))
239 return "start"; // lineCommentRegionStart
240  
241 return fw;
242 };
243  
244 this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
245 var line = session.getLine(row);
246  
247 if (this.startRegionRe.test(line))
248 return this.getCommentRegionBlock(session, line, row);
249  
250 var match = line.match(this.foldingStartMarker);
251 if (match) {
252 var i = match.index;
253  
254 if (match[1])
255 return this.openingBracketBlock(session, match[1], row, i);
256  
257 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
258  
259 if (range && !range.isMultiLine()) {
260 if (forceMultiline) {
261 range = this.getSectionRange(session, row);
262 } else if (foldStyle != "all")
263 range = null;
264 }
265  
266 return range;
267 }
268  
269 if (foldStyle === "markbegin")
270 return;
271  
272 var match = line.match(this.foldingStopMarker);
273 if (match) {
274 var i = match.index + match[0].length;
275  
276 if (match[1])
277 return this.closingBracketBlock(session, match[1], row, i);
278  
279 return session.getCommentFoldRange(row, i, -1);
280 }
281 };
282  
283 this.getSectionRange = function(session, row) {
284 var line = session.getLine(row);
285 var startIndent = line.search(/\S/);
286 var startRow = row;
287 var startColumn = line.length;
288 row = row + 1;
289 var endRow = row;
290 var maxRow = session.getLength();
291 while (++row < maxRow) {
292 line = session.getLine(row);
293 var indent = line.search(/\S/);
294 if (indent === -1)
295 continue;
296 if (startIndent > indent)
297 break;
298 var subRange = this.getFoldWidgetRange(session, "all", row);
299  
300 if (subRange) {
301 if (subRange.start.row <= startRow) {
302 break;
303 } else if (subRange.isMultiLine()) {
304 row = subRange.end.row;
305 } else if (startIndent == indent) {
306 break;
307 }
308 }
309 endRow = row;
310 }
311  
312 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
313 };
314 this.getCommentRegionBlock = function(session, line, row) {
315 var startColumn = line.search(/\s*$/);
316 var maxRow = session.getLength();
317 var startRow = row;
318  
319 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
320 var depth = 1;
321 while (++row < maxRow) {
322 line = session.getLine(row);
323 var m = re.exec(line);
324 if (!m) continue;
325 if (m[1]) depth--;
326 else depth++;
327  
328 if (!depth) break;
329 }
330  
331 var endRow = row;
332 if (endRow > startRow) {
333 return new Range(startRow, startColumn, endRow, line.length);
334 }
335 };
336  
337 }).call(FoldMode.prototype);
338  
339 });
340  
341 define("ace/mode/scad",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/scad_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
342 "use strict";
343  
344 var oop = require("../lib/oop");
345 var TextMode = require("./text").Mode;
346 var scadHighlightRules = require("./scad_highlight_rules").scadHighlightRules;
347 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
348 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
349 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
350  
351 var Mode = function() {
352 this.HighlightRules = scadHighlightRules;
353 this.$outdent = new MatchingBraceOutdent();
354 this.$behaviour = new CstyleBehaviour();
355 this.foldingRules = new CStyleFoldMode();
356 };
357 oop.inherits(Mode, TextMode);
358  
359 (function() {
360  
361 this.lineCommentStart = "//";
362 this.blockComment = {start: "/*", end: "*/"};
363  
364 this.getNextLineIndent = function(state, line, tab) {
365 var indent = this.$getIndent(line);
366  
367 var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
368 var tokens = tokenizedLine.tokens;
369 var endState = tokenizedLine.state;
370  
371 if (tokens.length && tokens[tokens.length-1].type == "comment") {
372 return indent;
373 }
374  
375 if (state == "start") {
376 var match = line.match(/^.*[\{\(\[]\s*$/);
377 if (match) {
378 indent += tab;
379 }
380 } else if (state == "doc-start") {
381 if (endState == "start") {
382 return "";
383 }
384 var match = line.match(/^\s*(\/?)\*/);
385 if (match) {
386 if (match[1]) {
387 indent += " ";
388 }
389 indent += "* ";
390 }
391 }
392  
393 return indent;
394 };
395  
396 this.checkOutdent = function(state, line, input) {
397 return this.$outdent.checkOutdent(line, input);
398 };
399  
400 this.autoOutdent = function(state, doc, row) {
401 this.$outdent.autoOutdent(doc, row);
402 };
403  
404 this.$id = "ace/mode/scad";
405 }).call(Mode.prototype);
406  
407 exports.Mode = Mode;
408 });