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