corrade-nucleus-nucleons – Blame information for rev 20

Subversion Repositories:
Rev:
Rev Author Line No. Line
20 office 1 ace.define("ace/mode/elm_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 ElmHighlightRules = function() {
8 var keywordMapper = this.createKeywordMapper({
9 "keyword": "as|case|class|data|default|deriving|do|else|export|foreign|" +
10 "hiding|jsevent|if|import|in|infix|infixl|infixr|instance|let|" +
11 "module|newtype|of|open|then|type|where|_|port|\u03BB"
12 }, "identifier");
13  
14 var escapeRe = /\\(\d+|['"\\&trnbvf])/;
15  
16 var smallRe = /[a-z_]/.source;
17 var largeRe = /[A-Z]/.source;
18 var idRe = /[a-z_A-Z0-9']/.source;
19  
20 this.$rules = {
21 start: [{
22 token: "string.start",
23 regex: '"',
24 next: "string"
25 }, {
26 token: "string.character",
27 regex: "'(?:" + escapeRe.source + "|.)'?"
28 }, {
29 regex: /0(?:[xX][0-9A-Fa-f]+|[oO][0-7]+)|\d+(\.\d+)?([eE][-+]?\d*)?/,
30 token: "constant.numeric"
31 }, {
32 token: "comment",
33 regex: "--.*"
34 }, {
35 token : "keyword",
36 regex : /\.\.|\||:|=|\\|"|->|<-|\u2192/
37 <-|\u2192/ }, {
38 <-|\u2192/ token : "keyword.operator",
39 <-|\u2192/ regex : /[-!#$%&*+.\/<=>?@\\^|~:\u03BB\u2192]+/
40 <-|\u2192/<=> }, {
41 <-|\u2192/<=> token : "operator.punctuation",
42 <-|\u2192/<=> regex : /[,;`]/
43 <-|\u2192/<=> }, {
44 <-|\u2192/<=> regex : largeRe + idRe + "+\\.?",
45 <-|\u2192/<=> token : function(value) {
46 <-|\u2192/<=> if (value[value.length - 1] == ".")
47 <-|\u2192/<=> return "entity.name.function";
48 <-|\u2192/<=> return "constant.language";
49 <-|\u2192/<=> }
50 <-|\u2192/<=> }, {
51 <-|\u2192/<=> regex : "^" + smallRe + idRe + "+",
52 <-|\u2192/<=> token : function(value) {
53 <-|\u2192/<=> return "constant.language";
54 <-|\u2192/<=> }
55 <-|\u2192/<=> }, {
56 <-|\u2192/<=> token : keywordMapper,
57 <-|\u2192/<=> regex : "[\\w\\xff-\\u218e\\u2455-\\uffff]+\\b"
58 <-|\u2192/<=> }, {
59 <-|\u2192/<=> regex: "{-#?",
60 <-|\u2192/<=> token: "comment.start",
61 <-|\u2192/<=> onMatch: function(value, currentState, stack) {
62 <-|\u2192/<=> this.next = value.length == 2 ? "blockComment" : "docComment";
63 <-|\u2192/<=> return this.token;
64 <-|\u2192/<=> }
65 <-|\u2192/<=> }, {
66 <-|\u2192/<=> token: "variable.language",
67 <-|\u2192/<=> regex: /\[markdown\|/,
68 <-|\u2192/<=> next: "markdown"
69 <-|\u2192/<=> }, {
70 <-|\u2192/<=> token: "paren.lparen",
71 <-|\u2192/<=> regex: /[\[({]/
72 <-|\u2192/<=> }, {
73 <-|\u2192/<=> token: "paren.rparen",
74 <-|\u2192/<=> regex: /[\])}]/
75 <-|\u2192/<=> } ],
76 <-|\u2192/<=> markdown: [{
77 <-|\u2192/<=> regex: /\|\]/,
78 <-|\u2192/<=> next: "start"
79 <-|\u2192/<=> }, {
80 <-|\u2192/<=> defaultToken : "string"
81 <-|\u2192/<=> }],
82 <-|\u2192/<=> blockComment: [{
83 <-|\u2192/<=> regex: "{-",
84 <-|\u2192/<=> token: "comment.start",
85 <-|\u2192/<=> push: "blockComment"
86 <-|\u2192/<=> }, {
87 <-|\u2192/<=> regex: "-}",
88 <-|\u2192/<=> token: "comment.end",
89 <-|\u2192/<=> next: "pop"
90 <-|\u2192/<=> }, {
91 <-|\u2192/<=> defaultToken: "comment"
92 <-|\u2192/<=> }],
93 <-|\u2192/<=> docComment: [{
94 <-|\u2192/<=> regex: "{-",
95 <-|\u2192/<=> token: "comment.start",
96 <-|\u2192/<=> push: "docComment"
97 <-|\u2192/<=> }, {
98 <-|\u2192/<=> regex: "-}",
99 <-|\u2192/<=> token: "comment.end",
100 <-|\u2192/<=> next: "pop"
101 <-|\u2192/<=> }, {
102 <-|\u2192/<=> defaultToken: "doc.comment"
103 <-|\u2192/<=> }],
104 <-|\u2192/<=> string: [{
105 <-|\u2192/<=> token: "constant.language.escape",
106 <-|\u2192/<=> regex: escapeRe
107 <-|\u2192/<=> }, {
108 <-|\u2192/<=> token: "text",
109 <-|\u2192/<=> regex: /\\(\s|$)/,
110 <-|\u2192/<=> next: "stringGap"
111 <-|\u2192/<=> }, {
112 <-|\u2192/<=> token: "string.end",
113 <-|\u2192/<=> regex: '"',
114 <-|\u2192/<=> next: "start"
115 <-|\u2192/<=> }, {
116 <-|\u2192/<=> defaultToken: "string"
117 <-|\u2192/<=> }],
118 <-|\u2192/<=> stringGap: [{
119 <-|\u2192/<=> token: "text",
120 <-|\u2192/<=> regex: /\\/,
121 <-|\u2192/<=> next: "string"
122 <-|\u2192/<=> }, {
123 <-|\u2192/<=> token: "error",
124 <-|\u2192/<=> regex: "",
125 <-|\u2192/<=> next: "start"
126 <-|\u2192/<=> }]
127 <-|\u2192/<=> };
128  
129 <-|\u2192/<=> this.normalizeRules();
130 <-|\u2192/<=>};
131  
132 <-|\u2192/<=>oop.inherits(ElmHighlightRules, TextHighlightRules);
133  
134 <-|\u2192/<=>exports.ElmHighlightRules = ElmHighlightRules;
135 <-|\u2192/<=>});
136  
137 <-|\u2192/<=>ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
138 <-|\u2192/<=>"use strict";
139  
140 <-|\u2192/<=>var oop = require("../../lib/oop");
141 <-|\u2192/<=>var Range = require("../../range").Range;
142 <-|\u2192/<=>var BaseFoldMode = require("./fold_mode").FoldMode;
143  
144 <-|\u2192/<=>var FoldMode = exports.FoldMode = function(commentRegex) {
145 <-|\u2192/<=> if (commentRegex) {
146 <-|\u2192/<=> this.foldingStartMarker = new RegExp(
147 <-|\u2192/<=> this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
148 <-|\u2192/<=> );
149 <-|\u2192/<=> this.foldingStopMarker = new RegExp(
150 <-|\u2192/<=> this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
151 <-|\u2192/<=> );
152 <-|\u2192/<=> }
153 <-|\u2192/<=>};
154 <-|\u2192/<=>oop.inherits(FoldMode, BaseFoldMode);
155  
156 <-|\u2192/<=>(function() {
157  
158 <-|\u2192/<=> this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
159 <-|\u2192/<=> this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
160 <-|\u2192/<=> this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
161 <-|\u2192/<=> this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
162 <-|\u2192/<=> this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
163 <-|\u2192/<=> this._getFoldWidgetBase = this.getFoldWidget;
164 <-|\u2192/<=> this.getFoldWidget = function(session, foldStyle, row) {
165 <-|\u2192/<=> var line = session.getLine(row);
166  
167 <-|\u2192/<=> if (this.singleLineBlockCommentRe.test(line)) {
168 <-|\u2192/<=> if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
169 <-|\u2192/<=> return "";
170 <-|\u2192/<=> }
171  
172 <-|\u2192/<=> var fw = this._getFoldWidgetBase(session, foldStyle, row);
173  
174 <-|\u2192/<=> if (!fw && this.startRegionRe.test(line))
175 <-|\u2192/<=> return "start"; // lineCommentRegionStart
176  
177 <-|\u2192/<=> return fw;
178 <-|\u2192/<=> };
179  
180 <-|\u2192/<=> this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
181 <-|\u2192/<=> var line = session.getLine(row);
182  
183 <-|\u2192/<=> if (this.startRegionRe.test(line))
184 <-|\u2192/<=> return this.getCommentRegionBlock(session, line, row);
185  
186 <-|\u2192/<=> var match = line.match(this.foldingStartMarker);
187 <-|\u2192/<=> if (match) {
188 <-|\u2192/<=> var i = match.index;
189  
190 <-|\u2192/<=> if (match[1])
191 <-|\u2192/<=> return this.openingBracketBlock(session, match[1], row, i);
192  
193 <-|\u2192/<=> var range = session.getCommentFoldRange(row, i + match[0].length, 1);
194  
195 <-|\u2192/<=> if (range && !range.isMultiLine()) {
196 <-|\u2192/<=> if (forceMultiline) {
197 <-|\u2192/<=> range = this.getSectionRange(session, row);
198 <-|\u2192/<=> } else if (foldStyle != "all")
199 <-|\u2192/<=> range = null;
200 <-|\u2192/<=> }
201  
202 <-|\u2192/<=> return range;
203 <-|\u2192/<=> }
204  
205 <-|\u2192/<=> if (foldStyle === "markbegin")
206 <-|\u2192/<=> return;
207  
208 <-|\u2192/<=> var match = line.match(this.foldingStopMarker);
209 <-|\u2192/<=> if (match) {
210 <-|\u2192/<=> var i = match.index + match[0].length;
211  
212 <-|\u2192/<=> if (match[1])
213 <-|\u2192/<=> return this.closingBracketBlock(session, match[1], row, i);
214  
215 <-|\u2192/<=> return session.getCommentFoldRange(row, i, -1);
216 <-|\u2192/<=> }
217 <-|\u2192/<=> };
218  
219 <-|\u2192/<=> this.getSectionRange = function(session, row) {
220 <-|\u2192/<=> var line = session.getLine(row);
221 <-|\u2192/<=> var startIndent = line.search(/\S/);
222 <-|\u2192/<=> var startRow = row;
223 <-|\u2192/<=> var startColumn = line.length;
224 <-|\u2192/<=> row = row + 1;
225 <-|\u2192/<=> var endRow = row;
226 <-|\u2192/<=> var maxRow = session.getLength();
227 <-|\u2192/<=> while (++row < maxRow) {
228 <-|\u2192/<=> line = session.getLine(row);
229 <-|\u2192/<=> var indent = line.search(/\S/);
230 <-|\u2192/<=> if (indent === -1)
231 <-|\u2192/<=> continue;
232 <-|\u2192/<=> if (startIndent > indent)
233 <-|\u2192/<=> break;
234 <-|\u2192/<=> var subRange = this.getFoldWidgetRange(session, "all", row);
235  
236 <-|\u2192/<=> if (subRange) {
237 <-|\u2192/<=> if (subRange.start.row <= startRow) {
238 <-|\u2192/<=> break;
239 <-|\u2192/<=> } else if (subRange.isMultiLine()) {
240 <-|\u2192/<=> row = subRange.end.row;
241 <-|\u2192/<=> } else if (startIndent == indent) {
242 <-|\u2192/<=> break;
243 <-|\u2192/<=> }
244 <-|\u2192/<=> }
245 <-|\u2192/<=> endRow = row;
246 <-|\u2192/<=> }
247  
248 <-|\u2192/<=> return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
249 <-|\u2192/<=> };
250 <-|\u2192/<=> this.getCommentRegionBlock = function(session, line, row) {
251 <-|\u2192/<=> var startColumn = line.search(/\s*$/);
252 <-|\u2192/<=> var maxRow = session.getLength();
253 <-|\u2192/<=> var startRow = row;
254  
255 <-|\u2192/<=> var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
256 <-|\u2192/<=> var depth = 1;
257 <-|\u2192/<=> while (++row < maxRow) {
258 <-|\u2192/<=> line = session.getLine(row);
259 <-|\u2192/<=> var m = re.exec(line);
260 <-|\u2192/<=> if (!m) continue;
261 <-|\u2192/<=> if (m[1]) depth--;
262 <-|\u2192/<=> else depth++;
263  
264 <-|\u2192/<=> if (!depth) break;
265 <-|\u2192/<=> }
266  
267 <-|\u2192/<=> var endRow = row;
268 <-|\u2192/<=> if (endRow > startRow) {
269 <-|\u2192/<=> return new Range(startRow, startColumn, endRow, line.length);
270 <-|\u2192/<=> }
271 <-|\u2192/<=> };
272  
273 <-|\u2192/<=>}).call(FoldMode.prototype);
274  
275 <-|\u2192/<=>});
276  
277 <-|\u2192/<=>ace.define("ace/mode/elm",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/elm_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
278 <-|\u2192/<=>"use strict";
279  
280 <-|\u2192/<=>var oop = require("../lib/oop");
281 <-|\u2192/<=>var TextMode = require("./text").Mode;
282 <-|\u2192/<=>var HighlightRules = require("./elm_highlight_rules").ElmHighlightRules;
283 <-|\u2192/<=>var FoldMode = require("./folding/cstyle").FoldMode;
284  
285 <-|\u2192/<=>var Mode = function() {
286 <-|\u2192/<=> this.HighlightRules = HighlightRules;
287 <-|\u2192/<=> this.foldingRules = new FoldMode();
288 <-|\u2192/<=> this.$behaviour = this.$defaultBehaviour;
289 <-|\u2192/<=>};
290 <-|\u2192/<=>oop.inherits(Mode, TextMode);
291  
292 <-|\u2192/<=>(function() {
293 <-|\u2192/<=> this.lineCommentStart = "--";
294 <-|\u2192/<=> this.blockComment = {start: "{-", end: "-}", nestable: true};
295 <-|\u2192/<=> this.$id = "ace/mode/elm";
296 <-|\u2192/<=>}).call(Mode.prototype);
297  
298 <-|\u2192/<=>exports.Mode = Mode;
299 <-|\u2192/<=>});