corrade-nucleus-nucleons – Blame information for rev 20

Subversion Repositories:
Rev:
Rev Author Line No. Line
20 office 1 define("ace/mode/perl_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 PerlHighlightRules = function() {
8  
9 var keywords = (
10 "base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|" +
11 "no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars"
12 );
13  
14 var buildinConstants = ("ARGV|ENV|INC|SIG");
15  
16 var builtinFunctions = (
17 "getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|" +
18 "gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|" +
19 "getpeername|setpriority|getprotoent|setprotoent|getpriority|" +
20 "endprotoent|getservent|setservent|endservent|sethostent|socketpair|" +
21 "getsockopt|gethostent|endhostent|setsockopt|setnetent|quotemeta|" +
22 "localtime|prototype|getnetent|endnetent|rewinddir|wantarray|getpwuid|" +
23 "closedir|getlogin|readlink|endgrent|getgrgid|getgrnam|shmwrite|" +
24 "shutdown|readline|endpwent|setgrent|readpipe|formline|truncate|" +
25 "dbmclose|syswrite|setpwent|getpwnam|getgrent|getpwent|ucfirst|sysread|" +
26 "setpgrp|shmread|sysseek|sysopen|telldir|defined|opendir|connect|" +
27 "lcfirst|getppid|binmode|syscall|sprintf|getpgrp|readdir|seekdir|" +
28 "waitpid|reverse|unshift|symlink|dbmopen|semget|msgrcv|rename|listen|" +
29 "chroot|msgsnd|shmctl|accept|unpack|exists|fileno|shmget|system|" +
30 "unlink|printf|gmtime|msgctl|semctl|values|rindex|substr|splice|" +
31 "length|msgget|select|socket|return|caller|delete|alarm|ioctl|index|" +
32 "undef|lstat|times|srand|chown|fcntl|close|write|umask|rmdir|study|" +
33 "sleep|chomp|untie|print|utime|mkdir|atan2|split|crypt|flock|chmod|" +
34 "BEGIN|bless|chdir|semop|shift|reset|link|stat|chop|grep|fork|dump|" +
35 "join|open|tell|pipe|exit|glob|warn|each|bind|sort|pack|eval|push|" +
36 "keys|getc|kill|seek|sqrt|send|wait|rand|tied|read|time|exec|recv|" +
37 "eof|chr|int|ord|exp|pos|pop|sin|log|abs|oct|hex|tie|cos|vec|END|ref|" +
38 "map|die|uc|lc|do"
39 );
40  
41 var keywordMapper = this.createKeywordMapper({
42 "keyword": keywords,
43 "constant.language": buildinConstants,
44 "support.function": builtinFunctions
45 }, "identifier");
46  
47 this.$rules = {
48 "start" : [
49 {
50 token : "comment.doc",
51 regex : "^=(?:begin|item)\\b",
52 next : "block_comment"
53 }, {
54 token : "string.regexp",
55 regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
56 }, {
57 token : "string", // single line
58 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
59 }, {
60 token : "string", // multi line string start
61 regex : '["].*\\\\$',
62 next : "qqstring"
63 }, {
64 token : "string", // single line
65 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
66 }, {
67 token : "string", // multi line string start
68 regex : "['].*\\\\$",
69 next : "qstring"
70 }, {
71 token : "constant.numeric", // hex
72 regex : "0x[0-9a-fA-F]+\\b"
73 }, {
74 token : "constant.numeric", // float
75 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
76 }, {
77 token : keywordMapper,
78 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
79 }, {
80 token : "keyword.operator",
81 regex : "%#|\\$#|\\.\\.\\.|\\|\\|=|>>=|<<=|<=>|&&=|=>|!~|\\^=|&=|\\|=|\\.=|x=|%=|\\/=|\\*=|\\-=|\\+=|=~|\\*\\*|\\-\\-|\\.\\.|\\|\\||&&|\\+\\+|\\->|!=|==|>=|<=|>>|<<|,|=|\\?\\:|\\^|\\||x|%|\\/|\\*|<|&|\\\\|~|!|>|\\.|\\-|\\+|\\-C|\\-b|\\-S|\\-u|\\-t|\\-p|\\-l|\\-d|\\-f|\\-g|\\-s|\\-z|\\-k|\\-e|\\-O|\\-T|\\-B|\\-M|\\-A|\\-X|\\-W|\\-c|\\-R|\\-o|\\-x|\\-w|\\-r|\\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)"
82 }, {
83 token : "comment",
84 regex : "#.*$"
85 }, {
86 token : "lparen",
87 regex : "[[({]"
88 }, {
89 token : "rparen",
90 regex : "[\\])}]"
91 }, {
92 token : "text",
93 regex : "\\s+"
94 }
95 ],
96 "qqstring" : [
97 {
98 token : "string",
99 regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
100 next : "start"
101 }, {
102 token : "string",
103 regex : '.+'
104 }
105 ],
106 "qstring" : [
107 {
108 token : "string",
109 regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
110 next : "start"
111 }, {
112 token : "string",
113 regex : '.+'
114 }
115 ],
116 "block_comment": [
117 {
118 token: "comment.doc",
119 regex: "^=cut\\b",
120 next: "start"
121 },
122 {
123 defaultToken: "comment.doc"
124 }
125 ]
126 };
127 };
128  
129 oop.inherits(PerlHighlightRules, TextHighlightRules);
130  
131 exports.PerlHighlightRules = PerlHighlightRules;
132 });
133  
134 define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
135 "use strict";
136  
137 var Range = require("../range").Range;
138  
139 var MatchingBraceOutdent = function() {};
140  
141 (function() {
142  
143 this.checkOutdent = function(line, input) {
144 if (! /^\s+$/.test(line))
145 return false;
146  
147 return /^\s*\}/.test(input);
148 };
149  
150 this.autoOutdent = function(doc, row) {
151 var line = doc.getLine(row);
152 var match = line.match(/^(\s*\})/);
153  
154 if (!match) return 0;
155  
156 var column = match[1].length;
157 var openBracePos = doc.findMatchingBracket({row: row, column: column});
158  
159 if (!openBracePos || openBracePos.row == row) return 0;
160  
161 var indent = this.$getIndent(doc.getLine(openBracePos.row));
162 doc.replace(new Range(row, 0, row, column-1), indent);
163 };
164  
165 this.$getIndent = function(line) {
166 return line.match(/^\s*/)[0];
167 };
168  
169 }).call(MatchingBraceOutdent.prototype);
170  
171 exports.MatchingBraceOutdent = MatchingBraceOutdent;
172 });
173  
174 define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
175 "use strict";
176  
177 var oop = require("../../lib/oop");
178 var Range = require("../../range").Range;
179 var BaseFoldMode = require("./fold_mode").FoldMode;
180  
181 var FoldMode = exports.FoldMode = function(commentRegex) {
182 if (commentRegex) {
183 this.foldingStartMarker = new RegExp(
184 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
185 );
186 this.foldingStopMarker = new RegExp(
187 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
188 );
189 }
190 };
191 oop.inherits(FoldMode, BaseFoldMode);
192  
193 (function() {
194  
195 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
196 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
197 this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
198 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
199 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
200 this._getFoldWidgetBase = this.getFoldWidget;
201 this.getFoldWidget = function(session, foldStyle, row) {
202 var line = session.getLine(row);
203  
204 if (this.singleLineBlockCommentRe.test(line)) {
205 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
206 return "";
207 }
208  
209 var fw = this._getFoldWidgetBase(session, foldStyle, row);
210  
211 if (!fw && this.startRegionRe.test(line))
212 return "start"; // lineCommentRegionStart
213  
214 return fw;
215 };
216  
217 this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
218 var line = session.getLine(row);
219  
220 if (this.startRegionRe.test(line))
221 return this.getCommentRegionBlock(session, line, row);
222  
223 var match = line.match(this.foldingStartMarker);
224 if (match) {
225 var i = match.index;
226  
227 if (match[1])
228 return this.openingBracketBlock(session, match[1], row, i);
229  
230 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
231  
232 if (range && !range.isMultiLine()) {
233 if (forceMultiline) {
234 range = this.getSectionRange(session, row);
235 } else if (foldStyle != "all")
236 range = null;
237 }
238  
239 return range;
240 }
241  
242 if (foldStyle === "markbegin")
243 return;
244  
245 var match = line.match(this.foldingStopMarker);
246 if (match) {
247 var i = match.index + match[0].length;
248  
249 if (match[1])
250 return this.closingBracketBlock(session, match[1], row, i);
251  
252 return session.getCommentFoldRange(row, i, -1);
253 }
254 };
255  
256 this.getSectionRange = function(session, row) {
257 var line = session.getLine(row);
258 var startIndent = line.search(/\S/);
259 var startRow = row;
260 var startColumn = line.length;
261 row = row + 1;
262 var endRow = row;
263 var maxRow = session.getLength();
264 while (++row < maxRow) {
265 line = session.getLine(row);
266 var indent = line.search(/\S/);
267 if (indent === -1)
268 continue;
269 if (startIndent > indent)
270 break;
271 var subRange = this.getFoldWidgetRange(session, "all", row);
272  
273 if (subRange) {
274 if (subRange.start.row <= startRow) {
275 break;
276 } else if (subRange.isMultiLine()) {
277 row = subRange.end.row;
278 } else if (startIndent == indent) {
279 break;
280 }
281 }
282 endRow = row;
283 }
284  
285 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
286 };
287 this.getCommentRegionBlock = function(session, line, row) {
288 var startColumn = line.search(/\s*$/);
289 var maxRow = session.getLength();
290 var startRow = row;
291  
292 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
293 var depth = 1;
294 while (++row < maxRow) {
295 line = session.getLine(row);
296 var m = re.exec(line);
297 if (!m) continue;
298 if (m[1]) depth--;
299 else depth++;
300  
301 if (!depth) break;
302 }
303  
304 var endRow = row;
305 if (endRow > startRow) {
306 return new Range(startRow, startColumn, endRow, line.length);
307 }
308 };
309  
310 }).call(FoldMode.prototype);
311  
312 });
313  
314 define("ace/mode/perl",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/perl_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/cstyle"], function(require, exports, module) {
315 "use strict";
316  
317 var oop = require("../lib/oop");
318 var TextMode = require("./text").Mode;
319 var PerlHighlightRules = require("./perl_highlight_rules").PerlHighlightRules;
320 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
321 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
322  
323 var Mode = function() {
324 this.HighlightRules = PerlHighlightRules;
325  
326 this.$outdent = new MatchingBraceOutdent();
327 this.foldingRules = new CStyleFoldMode({start: "^=(begin|item)\\b", end: "^=(cut)\\b"});
328 this.$behaviour = this.$defaultBehaviour;
329 };
330 oop.inherits(Mode, TextMode);
331  
332 (function() {
333  
334 this.lineCommentStart = "#";
335 this.blockComment = [
336 {start: "=begin", end: "=cut", lineStartOnly: true},
337 {start: "=item", end: "=cut", lineStartOnly: true}
338 ];
339  
340  
341 this.getNextLineIndent = function(state, line, tab) {
342 var indent = this.$getIndent(line);
343  
344 var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
345 var tokens = tokenizedLine.tokens;
346  
347 if (tokens.length && tokens[tokens.length-1].type == "comment") {
348 return indent;
349 }
350  
351 if (state == "start") {
352 var match = line.match(/^.*[\{\(\[:]\s*$/);
353 if (match) {
354 indent += tab;
355 }
356 }
357  
358 return indent;
359 };
360  
361 this.checkOutdent = function(state, line, input) {
362 return this.$outdent.checkOutdent(line, input);
363 };
364  
365 this.autoOutdent = function(state, doc, row) {
366 this.$outdent.autoOutdent(doc, row);
367 };
368  
369 this.$id = "ace/mode/perl";
370 }).call(Mode.prototype);
371  
372 exports.Mode = Mode;
373 });