corrade-nucleus-nucleons – Blame information for rev 20

Subversion Repositories:
Rev:
Rev Author Line No. Line
20 office 1 ace.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 ace.define("ace/mode/csharp_highlight_rules",["require","exports","module","ace/lib/oop","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 DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
56 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
57  
58 var CSharpHighlightRules = function() {
59 var keywordMapper = this.createKeywordMapper({
60 "variable.language": "this",
61 "keyword": "abstract|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string|var|dynamic",
62 "constant.language": "null|true|false"
63 }, "identifier");
64  
65 this.$rules = {
66 "start" : [
67 {
68 token : "comment",
69 regex : "\\/\\/.*$"
70 },
71 DocCommentHighlightRules.getStartRule("doc-start"),
72 {
73 token : "comment", // multi line comment
74 regex : "\\/\\*",
75 next : "comment"
76 }, {
77 token : "string", // character
78 regex : /'(?:.|\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n]))'/
79 }, {
80 token : "string", start : '"', end : '"|$', next: [
81 {token: "constant.language.escape", regex: /\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n])/},
82 {token: "invalid", regex: /\\./}
83 ]
84 }, {
85 token : "string", start : '@"', end : '"', next:[
86 {token: "constant.language.escape", regex: '""'}
87 ]
88 }, {
89 token : "string", start : /\$"/, end : '"|$', next: [
90 {token: "constant.language.escape", regex: /\\(:?$)|{{/},
91 {token: "constant.language.escape", regex: /\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n])/},
92 {token: "invalid", regex: /\\./}
93 ]
94 }, {
95 token : "constant.numeric", // hex
96 regex : "0[xX][0-9a-fA-F]+\\b"
97 }, {
98 token : "constant.numeric", // float
99 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
100 }, {
101 token : "constant.language.boolean",
102 regex : "(?:true|false)\\b"
103 }, {
104 token : keywordMapper,
105 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
106 }, {
107 token : "keyword.operator",
108 regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
109 }, {
110 token : "keyword",
111 regex : "^\\s*#(if|else|elif|endif|define|undef|warning|error|line|region|endregion|pragma)"
112 }, {
113 token : "punctuation.operator",
114 regex : "\\?|\\:|\\,|\\;|\\."
115 }, {
116 token : "paren.lparen",
117 regex : "[[({]"
118 }, {
119 token : "paren.rparen",
120 regex : "[\\])}]"
121 }, {
122 token : "text",
123 regex : "\\s+"
124 }
125 ],
126 "comment" : [
127 {
128 token : "comment", // closing comment
129 regex : ".*?\\*\\/",
130 next : "start"
131 }, {
132 token : "comment", // comment spanning whole line
133 regex : ".+"
134 }
135 ]
136 };
137  
138 this.embedRules(DocCommentHighlightRules, "doc-",
139 [ DocCommentHighlightRules.getEndRule("start") ]);
140 this.normalizeRules();
141 };
142  
143 oop.inherits(CSharpHighlightRules, TextHighlightRules);
144  
145 exports.CSharpHighlightRules = CSharpHighlightRules;
146 });
147  
148 ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
149 "use strict";
150  
151 var Range = require("../range").Range;
152  
153 var MatchingBraceOutdent = function() {};
154  
155 (function() {
156  
157 this.checkOutdent = function(line, input) {
158 if (! /^\s+$/.test(line))
159 return false;
160  
161 return /^\s*\}/.test(input);
162 };
163  
164 this.autoOutdent = function(doc, row) {
165 var line = doc.getLine(row);
166 var match = line.match(/^(\s*\})/);
167  
168 if (!match) return 0;
169  
170 var column = match[1].length;
171 var openBracePos = doc.findMatchingBracket({row: row, column: column});
172  
173 if (!openBracePos || openBracePos.row == row) return 0;
174  
175 var indent = this.$getIndent(doc.getLine(openBracePos.row));
176 doc.replace(new Range(row, 0, row, column-1), indent);
177 };
178  
179 this.$getIndent = function(line) {
180 return line.match(/^\s*/)[0];
181 };
182  
183 }).call(MatchingBraceOutdent.prototype);
184  
185 exports.MatchingBraceOutdent = MatchingBraceOutdent;
186 });
187  
188 ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
189 "use strict";
190  
191 var oop = require("../../lib/oop");
192 var Range = require("../../range").Range;
193 var BaseFoldMode = require("./fold_mode").FoldMode;
194  
195 var FoldMode = exports.FoldMode = function(commentRegex) {
196 if (commentRegex) {
197 this.foldingStartMarker = new RegExp(
198 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
199 );
200 this.foldingStopMarker = new RegExp(
201 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
202 );
203 }
204 };
205 oop.inherits(FoldMode, BaseFoldMode);
206  
207 (function() {
208  
209 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
210 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
211 this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
212 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
213 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
214 this._getFoldWidgetBase = this.getFoldWidget;
215 this.getFoldWidget = function(session, foldStyle, row) {
216 var line = session.getLine(row);
217  
218 if (this.singleLineBlockCommentRe.test(line)) {
219 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
220 return "";
221 }
222  
223 var fw = this._getFoldWidgetBase(session, foldStyle, row);
224  
225 if (!fw && this.startRegionRe.test(line))
226 return "start"; // lineCommentRegionStart
227  
228 return fw;
229 };
230  
231 this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
232 var line = session.getLine(row);
233  
234 if (this.startRegionRe.test(line))
235 return this.getCommentRegionBlock(session, line, row);
236  
237 var match = line.match(this.foldingStartMarker);
238 if (match) {
239 var i = match.index;
240  
241 if (match[1])
242 return this.openingBracketBlock(session, match[1], row, i);
243  
244 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
245  
246 if (range && !range.isMultiLine()) {
247 if (forceMultiline) {
248 range = this.getSectionRange(session, row);
249 } else if (foldStyle != "all")
250 range = null;
251 }
252  
253 return range;
254 }
255  
256 if (foldStyle === "markbegin")
257 return;
258  
259 var match = line.match(this.foldingStopMarker);
260 if (match) {
261 var i = match.index + match[0].length;
262  
263 if (match[1])
264 return this.closingBracketBlock(session, match[1], row, i);
265  
266 return session.getCommentFoldRange(row, i, -1);
267 }
268 };
269  
270 this.getSectionRange = function(session, row) {
271 var line = session.getLine(row);
272 var startIndent = line.search(/\S/);
273 var startRow = row;
274 var startColumn = line.length;
275 row = row + 1;
276 var endRow = row;
277 var maxRow = session.getLength();
278 while (++row < maxRow) {
279 line = session.getLine(row);
280 var indent = line.search(/\S/);
281 if (indent === -1)
282 continue;
283 if (startIndent > indent)
284 break;
285 var subRange = this.getFoldWidgetRange(session, "all", row);
286  
287 if (subRange) {
288 if (subRange.start.row <= startRow) {
289 break;
290 } else if (subRange.isMultiLine()) {
291 row = subRange.end.row;
292 } else if (startIndent == indent) {
293 break;
294 }
295 }
296 endRow = row;
297 }
298  
299 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
300 };
301 this.getCommentRegionBlock = function(session, line, row) {
302 var startColumn = line.search(/\s*$/);
303 var maxRow = session.getLength();
304 var startRow = row;
305  
306 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
307 var depth = 1;
308 while (++row < maxRow) {
309 line = session.getLine(row);
310 var m = re.exec(line);
311 if (!m) continue;
312 if (m[1]) depth--;
313 else depth++;
314  
315 if (!depth) break;
316 }
317  
318 var endRow = row;
319 if (endRow > startRow) {
320 return new Range(startRow, startColumn, endRow, line.length);
321 }
322 };
323  
324 }).call(FoldMode.prototype);
325  
326 });
327  
328 ace.define("ace/mode/folding/csharp",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/cstyle"], function(require, exports, module) {
329 "use strict";
330  
331 var oop = require("../../lib/oop");
332 var Range = require("../../range").Range;
333 var CFoldMode = require("./cstyle").FoldMode;
334  
335 var FoldMode = exports.FoldMode = function(commentRegex) {
336 if (commentRegex) {
337 this.foldingStartMarker = new RegExp(
338 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
339 );
340 this.foldingStopMarker = new RegExp(
341 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
342 );
343 }
344 };
345 oop.inherits(FoldMode, CFoldMode);
346  
347 (function() {
348 this.usingRe = /^\s*using \S/;
349  
350 this.getFoldWidgetRangeBase = this.getFoldWidgetRange;
351 this.getFoldWidgetBase = this.getFoldWidget;
352  
353 this.getFoldWidget = function(session, foldStyle, row) {
354 var fw = this.getFoldWidgetBase(session, foldStyle, row);
355 if (!fw) {
356 var line = session.getLine(row);
357 if (/^\s*#region\b/.test(line))
358 return "start";
359 var usingRe = this.usingRe;
360 if (usingRe.test(line)) {
361 var prev = session.getLine(row - 1);
362 var next = session.getLine(row + 1);
363 if (!usingRe.test(prev) && usingRe.test(next))
364 return "start"
365 }
366 }
367 return fw;
368 };
369  
370 this.getFoldWidgetRange = function(session, foldStyle, row) {
371 var range = this.getFoldWidgetRangeBase(session, foldStyle, row);
372 if (range)
373 return range;
374  
375 var line = session.getLine(row);
376 if (this.usingRe.test(line))
377 return this.getUsingStatementBlock(session, line, row);
378  
379 if (/^\s*#region\b/.test(line))
380 return this.getRegionBlock(session, line, row);
381 };
382  
383 this.getUsingStatementBlock = function(session, line, row) {
384 var startColumn = line.match(this.usingRe)[0].length - 1;
385 var maxRow = session.getLength();
386 var startRow = row;
387 var endRow = row;
388  
389 while (++row < maxRow) {
390 line = session.getLine(row);
391 if (/^\s*$/.test(line))
392 continue;
393 if (!this.usingRe.test(line))
394 break;
395  
396 endRow = row;
397 }
398  
399 if (endRow > startRow) {
400 var endColumn = session.getLine(endRow).length;
401 return new Range(startRow, startColumn, endRow, endColumn);
402 }
403 };
404  
405 this.getRegionBlock = function(session, line, row) {
406 var startColumn = line.search(/\s*$/);
407 var maxRow = session.getLength();
408 var startRow = row;
409  
410 var re = /^\s*#(end)?region\b/;
411 var depth = 1;
412 while (++row < maxRow) {
413 line = session.getLine(row);
414 var m = re.exec(line);
415 if (!m)
416 continue;
417 if (m[1])
418 depth--;
419 else
420 depth++;
421  
422 if (!depth)
423 break;
424 }
425  
426 var endRow = row;
427 if (endRow > startRow) {
428 return new Range(startRow, startColumn, endRow, line.length);
429 }
430 };
431  
432 }).call(FoldMode.prototype);
433  
434 });
435  
436 ace.define("ace/mode/csharp",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/csharp_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/csharp"], function(require, exports, module) {
437 "use strict";
438  
439 var oop = require("../lib/oop");
440 var TextMode = require("./text").Mode;
441 var CSharpHighlightRules = require("./csharp_highlight_rules").CSharpHighlightRules;
442 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
443 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
444 var CStyleFoldMode = require("./folding/csharp").FoldMode;
445  
446 var Mode = function() {
447 this.HighlightRules = CSharpHighlightRules;
448 this.$outdent = new MatchingBraceOutdent();
449 this.$behaviour = new CstyleBehaviour();
450 this.foldingRules = new CStyleFoldMode();
451 };
452 oop.inherits(Mode, TextMode);
453  
454 (function() {
455  
456 this.lineCommentStart = "//";
457 this.blockComment = {start: "/*", end: "*/"};
458  
459 this.getNextLineIndent = function(state, line, tab) {
460 var indent = this.$getIndent(line);
461  
462 var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
463 var tokens = tokenizedLine.tokens;
464  
465 if (tokens.length && tokens[tokens.length-1].type == "comment") {
466 return indent;
467 }
468  
469 if (state == "start") {
470 var match = line.match(/^.*[\{\(\[]\s*$/);
471 if (match) {
472 indent += tab;
473 }
474 }
475  
476 return indent;
477 };
478  
479 this.checkOutdent = function(state, line, input) {
480 return this.$outdent.checkOutdent(line, input);
481 };
482  
483 this.autoOutdent = function(state, doc, row) {
484 this.$outdent.autoOutdent(doc, row);
485 };
486  
487  
488 this.createWorker = function(session) {
489 return null;
490 };
491  
492 this.$id = "ace/mode/csharp";
493 }).call(Mode.prototype);
494  
495 exports.Mode = Mode;
496 });