corrade-nucleus-nucleons – Blame information for rev 20

Subversion Repositories:
Rev:
Rev Author Line No. Line
20 office 1 define("ace/mode/applescript_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 AppleScriptHighlightRules = function() {
8 var keywords = (
9 "about|above|after|against|and|around|as|at|back|before|beginning|" +
10 "behind|below|beneath|beside|between|but|by|considering|" +
11 "contain|contains|continue|copy|div|does|eighth|else|end|equal|" +
12 "equals|error|every|exit|fifth|first|for|fourth|from|front|" +
13 "get|given|global|if|ignoring|in|into|is|it|its|last|local|me|" +
14 "middle|mod|my|ninth|not|of|on|onto|or|over|prop|property|put|ref|" +
15 "reference|repeat|returning|script|second|set|seventh|since|" +
16 "sixth|some|tell|tenth|that|the|then|third|through|thru|" +
17 "timeout|times|to|transaction|try|until|where|while|whose|with|without"
18 );
19  
20 var builtinConstants = (
21 "AppleScript|false|linefeed|return|pi|quote|result|space|tab|true"
22 );
23  
24 var builtinFunctions = (
25 "activate|beep|count|delay|launch|log|offset|read|round|run|say|" +
26 "summarize|write"
27 );
28  
29 var builtinTypes = (
30 "alias|application|boolean|class|constant|date|file|integer|list|" +
31 "number|real|record|string|text|character|characters|contents|day|" +
32 "frontmost|id|item|length|month|name|paragraph|paragraphs|rest|" +
33 "reverse|running|time|version|weekday|word|words|year"
34 );
35  
36 var keywordMapper = this.createKeywordMapper({
37 "support.function": builtinFunctions,
38 "constant.language": builtinConstants,
39 "support.type": builtinTypes,
40 "keyword": keywords
41 }, "identifier");
42  
43 this.$rules = {
44 "start": [
45 {
46 token: "comment",
47 regex: "--.*$"
48 },
49 {
50 token : "comment", // multi line comment
51 regex : "\\(\\*",
52 next : "comment"
53 },
54 {
55 token: "string", // " string
56 regex: '".*?"'
57 },
58 {
59 token: "support.type",
60 regex: '\\b(POSIX file|POSIX path|(date|time) string|quoted form)\\b'
61 },
62 {
63 token: "support.function",
64 regex: '\\b(clipboard info|the clipboard|info for|list (disks|folder)|' +
65 'mount volume|path to|(close|open for) access|(get|set) eof|' +
66 'current date|do shell script|get volume settings|random number|' +
67 'set volume|system attribute|system info|time to GMT|' +
68 '(load|run|store) script|scripting components|' +
69 'ASCII (character|number)|localized string|' +
70 'choose (application|color|file|file name|' +
71 'folder|from list|remote application|URL)|' +
72 'display (alert|dialog))\\b|^\\s*return\\b'
73 },
74 {
75 token: "constant.language",
76 regex: '\\b(text item delimiters|current application|missing value)\\b'
77 },
78 {
79 token: "keyword",
80 regex: '\\b(apart from|aside from|instead of|out of|greater than|' +
81 "isn't|(doesn't|does not) (equal|come before|come after|contain)|" +
82 '(greater|less) than( or equal)?|(starts?|ends|begins?) with|' +
83 'contained by|comes (before|after)|a (ref|reference))\\b'
84 },
85 {
86 token: keywordMapper,
87 regex: "[a-zA-Z][a-zA-Z0-9_]*\\b"
88 }
89 ],
90 "comment": [
91 {
92 token: "comment", // closing comment
93 regex: "\\*\\)",
94 next: "start"
95 }, {
96 defaultToken: "comment"
97 }
98 ]
99 }
100  
101 this.normalizeRules();
102 };
103  
104 oop.inherits(AppleScriptHighlightRules, TextHighlightRules);
105  
106 exports.AppleScriptHighlightRules = AppleScriptHighlightRules;
107 });
108  
109 define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
110 "use strict";
111  
112 var oop = require("../../lib/oop");
113 var Range = require("../../range").Range;
114 var BaseFoldMode = require("./fold_mode").FoldMode;
115  
116 var FoldMode = exports.FoldMode = function(commentRegex) {
117 if (commentRegex) {
118 this.foldingStartMarker = new RegExp(
119 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
120 );
121 this.foldingStopMarker = new RegExp(
122 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
123 );
124 }
125 };
126 oop.inherits(FoldMode, BaseFoldMode);
127  
128 (function() {
129  
130 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
131 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
132 this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
133 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
134 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
135 this._getFoldWidgetBase = this.getFoldWidget;
136 this.getFoldWidget = function(session, foldStyle, row) {
137 var line = session.getLine(row);
138  
139 if (this.singleLineBlockCommentRe.test(line)) {
140 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
141 return "";
142 }
143  
144 var fw = this._getFoldWidgetBase(session, foldStyle, row);
145  
146 if (!fw && this.startRegionRe.test(line))
147 return "start"; // lineCommentRegionStart
148  
149 return fw;
150 };
151  
152 this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
153 var line = session.getLine(row);
154  
155 if (this.startRegionRe.test(line))
156 return this.getCommentRegionBlock(session, line, row);
157  
158 var match = line.match(this.foldingStartMarker);
159 if (match) {
160 var i = match.index;
161  
162 if (match[1])
163 return this.openingBracketBlock(session, match[1], row, i);
164  
165 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
166  
167 if (range && !range.isMultiLine()) {
168 if (forceMultiline) {
169 range = this.getSectionRange(session, row);
170 } else if (foldStyle != "all")
171 range = null;
172 }
173  
174 return range;
175 }
176  
177 if (foldStyle === "markbegin")
178 return;
179  
180 var match = line.match(this.foldingStopMarker);
181 if (match) {
182 var i = match.index + match[0].length;
183  
184 if (match[1])
185 return this.closingBracketBlock(session, match[1], row, i);
186  
187 return session.getCommentFoldRange(row, i, -1);
188 }
189 };
190  
191 this.getSectionRange = function(session, row) {
192 var line = session.getLine(row);
193 var startIndent = line.search(/\S/);
194 var startRow = row;
195 var startColumn = line.length;
196 row = row + 1;
197 var endRow = row;
198 var maxRow = session.getLength();
199 while (++row < maxRow) {
200 line = session.getLine(row);
201 var indent = line.search(/\S/);
202 if (indent === -1)
203 continue;
204 if (startIndent > indent)
205 break;
206 var subRange = this.getFoldWidgetRange(session, "all", row);
207  
208 if (subRange) {
209 if (subRange.start.row <= startRow) {
210 break;
211 } else if (subRange.isMultiLine()) {
212 row = subRange.end.row;
213 } else if (startIndent == indent) {
214 break;
215 }
216 }
217 endRow = row;
218 }
219  
220 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
221 };
222 this.getCommentRegionBlock = function(session, line, row) {
223 var startColumn = line.search(/\s*$/);
224 var maxRow = session.getLength();
225 var startRow = row;
226  
227 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
228 var depth = 1;
229 while (++row < maxRow) {
230 line = session.getLine(row);
231 var m = re.exec(line);
232 if (!m) continue;
233 if (m[1]) depth--;
234 else depth++;
235  
236 if (!depth) break;
237 }
238  
239 var endRow = row;
240 if (endRow > startRow) {
241 return new Range(startRow, startColumn, endRow, line.length);
242 }
243 };
244  
245 }).call(FoldMode.prototype);
246  
247 });
248  
249 define("ace/mode/applescript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/applescript_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
250 "use strict";
251  
252 var oop = require("../lib/oop");
253 var TextMode = require("./text").Mode;
254 var AppleScriptHighlightRules = require("./applescript_highlight_rules").AppleScriptHighlightRules;
255 var FoldMode = require("./folding/cstyle").FoldMode;
256  
257 var Mode = function() {
258 this.HighlightRules = AppleScriptHighlightRules;
259 this.foldingRules = new FoldMode();
260 this.$behaviour = this.$defaultBehaviour;
261 };
262 oop.inherits(Mode, TextMode);
263  
264 (function() {
265 this.lineCommentStart = "--";
266 this.blockComment = {start: "(*", end: "*)"};
267 this.$id = "ace/mode/applescript";
268 }).call(Mode.prototype);
269  
270 exports.Mode = Mode;
271 });