corrade-nucleus-nucleons – Blame information for rev 2

Subversion Repositories:
Rev:
Rev Author Line No. Line
2 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/jsx_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 var oop = require("../lib/oop");
53 var lang = require("../lib/lang");
54 var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
55 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
56  
57 var JsxHighlightRules = function() {
58 var keywords = lang.arrayToMap(
59 ("break|do|instanceof|typeof|case|else|new|var|catch|finally|return|void|continue|for|switch|default|while|function|this|" +
60 "if|throw|" +
61 "delete|in|try|" +
62 "class|extends|super|import|from|into|implements|interface|static|mixin|override|abstract|final|" +
63 "number|int|string|boolean|variant|" +
64 "log|assert").split("|")
65 );
66  
67 var buildinConstants = lang.arrayToMap(
68 ("null|true|false|NaN|Infinity|__FILE__|__LINE__|undefined").split("|")
69 );
70  
71 var reserved = lang.arrayToMap(
72 ("debugger|with|" +
73 "const|export|" +
74 "let|private|public|yield|protected|" +
75 "extern|native|as|operator|__fake__|__readonly__").split("|")
76 );
77  
78 var identifierRe = "[a-zA-Z_][a-zA-Z0-9_]*\\b";
79  
80 this.$rules = {
81 "start" : [
82 {
83 token : "comment",
84 regex : "\\/\\/.*$"
85 },
86 DocCommentHighlightRules.getStartRule("doc-start"),
87 {
88 token : "comment", // multi line comment
89 regex : "\\/\\*",
90 next : "comment"
91 }, {
92 token : "string.regexp",
93 regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
94 }, {
95 token : "string", // single line
96 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
97 }, {
98 token : "string", // single line
99 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
100 }, {
101 token : "constant.numeric", // hex
102 regex : "0[xX][0-9a-fA-F]+\\b"
103 }, {
104 token : "constant.numeric", // float
105 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
106 }, {
107 token : "constant.language.boolean",
108 regex : "(?:true|false)\\b"
109 }, {
110 token : [
111 "storage.type",
112 "text",
113 "entity.name.function"
114 ],
115 regex : "(function)(\\s+)(" + identifierRe + ")"
116 }, {
117 token : function(value) {
118 if (value == "this")
119 return "variable.language";
120 else if (value == "function")
121 return "storage.type";
122 else if (keywords.hasOwnProperty(value) || reserved.hasOwnProperty(value))
123 return "keyword";
124 else if (buildinConstants.hasOwnProperty(value))
125 return "constant.language";
126 else if (/^_?[A-Z][a-zA-Z0-9_]*$/.test(value))
127 return "language.support.class";
128 else
129 return "identifier";
130 },
131 regex : identifierRe
132 }, {
133 token : "keyword.operator",
134 regex : "!|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
135 }, {
136 token : "punctuation.operator",
137 regex : "\\?|\\:|\\,|\\;|\\."
138 }, {
139 token : "paren.lparen",
140 regex : "[[({<]"
141 }, {
142 token : "paren.rparen",
143 regex : "[\\])}>]"
144 }, {
145 token : "text",
146 regex : "\\s+"
147 }
148 ],
149 "comment" : [
150 {
151 token : "comment", // closing comment
152 regex : ".*?\\*\\/",
153 next : "start"
154 }, {
155 token : "comment", // comment spanning whole line
156 regex : ".+"
157 }
158 ]
159 };
160  
161 this.embedRules(DocCommentHighlightRules, "doc-",
162 [ DocCommentHighlightRules.getEndRule("start") ]);
163 };
164  
165 oop.inherits(JsxHighlightRules, TextHighlightRules);
166  
167 exports.JsxHighlightRules = JsxHighlightRules;
168 });
169  
170 define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
171 "use strict";
172  
173 var Range = require("../range").Range;
174  
175 var MatchingBraceOutdent = function() {};
176  
177 (function() {
178  
179 this.checkOutdent = function(line, input) {
180 if (! /^\s+$/.test(line))
181 return false;
182  
183 return /^\s*\}/.test(input);
184 };
185  
186 this.autoOutdent = function(doc, row) {
187 var line = doc.getLine(row);
188 var match = line.match(/^(\s*\})/);
189  
190 if (!match) return 0;
191  
192 var column = match[1].length;
193 var openBracePos = doc.findMatchingBracket({row: row, column: column});
194  
195 if (!openBracePos || openBracePos.row == row) return 0;
196  
197 var indent = this.$getIndent(doc.getLine(openBracePos.row));
198 doc.replace(new Range(row, 0, row, column-1), indent);
199 };
200  
201 this.$getIndent = function(line) {
202 return line.match(/^\s*/)[0];
203 };
204  
205 }).call(MatchingBraceOutdent.prototype);
206  
207 exports.MatchingBraceOutdent = MatchingBraceOutdent;
208 });
209  
210 define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
211 "use strict";
212  
213 var oop = require("../../lib/oop");
214 var Range = require("../../range").Range;
215 var BaseFoldMode = require("./fold_mode").FoldMode;
216  
217 var FoldMode = exports.FoldMode = function(commentRegex) {
218 if (commentRegex) {
219 this.foldingStartMarker = new RegExp(
220 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
221 );
222 this.foldingStopMarker = new RegExp(
223 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
224 );
225 }
226 };
227 oop.inherits(FoldMode, BaseFoldMode);
228  
229 (function() {
230  
231 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
232 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
233 this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
234 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
235 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
236 this._getFoldWidgetBase = this.getFoldWidget;
237 this.getFoldWidget = function(session, foldStyle, row) {
238 var line = session.getLine(row);
239  
240 if (this.singleLineBlockCommentRe.test(line)) {
241 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
242 return "";
243 }
244  
245 var fw = this._getFoldWidgetBase(session, foldStyle, row);
246  
247 if (!fw && this.startRegionRe.test(line))
248 return "start"; // lineCommentRegionStart
249  
250 return fw;
251 };
252  
253 this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
254 var line = session.getLine(row);
255  
256 if (this.startRegionRe.test(line))
257 return this.getCommentRegionBlock(session, line, row);
258  
259 var match = line.match(this.foldingStartMarker);
260 if (match) {
261 var i = match.index;
262  
263 if (match[1])
264 return this.openingBracketBlock(session, match[1], row, i);
265  
266 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
267  
268 if (range && !range.isMultiLine()) {
269 if (forceMultiline) {
270 range = this.getSectionRange(session, row);
271 } else if (foldStyle != "all")
272 range = null;
273 }
274  
275 return range;
276 }
277  
278 if (foldStyle === "markbegin")
279 return;
280  
281 var match = line.match(this.foldingStopMarker);
282 if (match) {
283 var i = match.index + match[0].length;
284  
285 if (match[1])
286 return this.closingBracketBlock(session, match[1], row, i);
287  
288 return session.getCommentFoldRange(row, i, -1);
289 }
290 };
291  
292 this.getSectionRange = function(session, row) {
293 var line = session.getLine(row);
294 var startIndent = line.search(/\S/);
295 var startRow = row;
296 var startColumn = line.length;
297 row = row + 1;
298 var endRow = row;
299 var maxRow = session.getLength();
300 while (++row < maxRow) {
301 line = session.getLine(row);
302 var indent = line.search(/\S/);
303 if (indent === -1)
304 continue;
305 if (startIndent > indent)
306 break;
307 var subRange = this.getFoldWidgetRange(session, "all", row);
308  
309 if (subRange) {
310 if (subRange.start.row <= startRow) {
311 break;
312 } else if (subRange.isMultiLine()) {
313 row = subRange.end.row;
314 } else if (startIndent == indent) {
315 break;
316 }
317 }
318 endRow = row;
319 }
320  
321 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
322 };
323 this.getCommentRegionBlock = function(session, line, row) {
324 var startColumn = line.search(/\s*$/);
325 var maxRow = session.getLength();
326 var startRow = row;
327  
328 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
329 var depth = 1;
330 while (++row < maxRow) {
331 line = session.getLine(row);
332 var m = re.exec(line);
333 if (!m) continue;
334 if (m[1]) depth--;
335 else depth++;
336  
337 if (!depth) break;
338 }
339  
340 var endRow = row;
341 if (endRow > startRow) {
342 return new Range(startRow, startColumn, endRow, line.length);
343 }
344 };
345  
346 }).call(FoldMode.prototype);
347  
348 });
349  
350 define("ace/mode/jsx",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/jsx_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
351 "use strict";
352  
353 var oop = require("../lib/oop");
354 var TextMode = require("./text").Mode;
355 var JsxHighlightRules = require("./jsx_highlight_rules").JsxHighlightRules;
356 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
357 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
358 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
359  
360 function Mode() {
361 this.HighlightRules = JsxHighlightRules;
362 this.$outdent = new MatchingBraceOutdent();
363 this.$behaviour = new CstyleBehaviour();
364 this.foldingRules = new CStyleFoldMode();
365 }
366 oop.inherits(Mode, TextMode);
367  
368 (function() {
369  
370 this.lineCommentStart = "//";
371 this.blockComment = {start: "/*", end: "*/"};
372  
373 this.getNextLineIndent = function(state, line, tab) {
374 var indent = this.$getIndent(line);
375  
376 var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
377 var tokens = tokenizedLine.tokens;
378  
379 if (tokens.length && tokens[tokens.length-1].type == "comment") {
380 return indent;
381 }
382  
383 if (state == "start") {
384 var match = line.match(/^.*[\{\(\[]\s*$/);
385 if (match) {
386 indent += tab;
387 }
388 }
389  
390 return indent;
391 };
392  
393 this.checkOutdent = function(state, line, input) {
394 return this.$outdent.checkOutdent(line, input);
395 };
396  
397 this.autoOutdent = function(state, doc, row) {
398 this.$outdent.autoOutdent(doc, row);
399 };
400  
401 this.$id = "ace/mode/jsx";
402 }).call(Mode.prototype);
403  
404 exports.Mode = Mode;
405 });