corrade-nucleus-nucleons – Blame information for rev 24
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) { |
2 | "use strict"; |
||
3 | |||
4 | var Range = require("../range").Range; |
||
5 | |||
6 | var MatchingBraceOutdent = function() {}; |
||
7 | |||
8 | (function() { |
||
9 | |||
10 | this.checkOutdent = function(line, input) { |
||
11 | if (! /^\s+$/.test(line)) |
||
12 | return false; |
||
13 | |||
14 | return /^\s*\}/.test(input); |
||
15 | }; |
||
16 | |||
17 | this.autoOutdent = function(doc, row) { |
||
18 | var line = doc.getLine(row); |
||
19 | var match = line.match(/^(\s*\})/); |
||
20 | |||
21 | if (!match) return 0; |
||
22 | |||
23 | var column = match[1].length; |
||
24 | var openBracePos = doc.findMatchingBracket({row: row, column: column}); |
||
25 | |||
26 | if (!openBracePos || openBracePos.row == row) return 0; |
||
27 | |||
28 | var indent = this.$getIndent(doc.getLine(openBracePos.row)); |
||
29 | doc.replace(new Range(row, 0, row, column-1), indent); |
||
30 | }; |
||
31 | |||
32 | this.$getIndent = function(line) { |
||
33 | return line.match(/^\s*/)[0]; |
||
34 | }; |
||
35 | |||
36 | }).call(MatchingBraceOutdent.prototype); |
||
37 | |||
38 | exports.MatchingBraceOutdent = MatchingBraceOutdent; |
||
39 | }); |
||
40 | |||
41 | ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { |
||
42 | "use strict"; |
||
43 | |||
44 | var oop = require("../lib/oop"); |
||
45 | var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
||
46 | |||
47 | var DocCommentHighlightRules = function() { |
||
48 | this.$rules = { |
||
49 | "start" : [ { |
||
50 | token : "comment.doc.tag", |
||
51 | regex : "@[\\w\\d_]+" // TODO: fix email addresses |
||
52 | }, |
||
53 | DocCommentHighlightRules.getTagRule(), |
||
54 | { |
||
55 | defaultToken : "comment.doc", |
||
56 | caseInsensitive: true |
||
57 | }] |
||
58 | }; |
||
59 | }; |
||
60 | |||
61 | oop.inherits(DocCommentHighlightRules, TextHighlightRules); |
||
62 | |||
63 | DocCommentHighlightRules.getTagRule = function(start) { |
||
64 | return { |
||
65 | token : "comment.doc.tag.storage.type", |
||
66 | regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b" |
||
67 | }; |
||
68 | } |
||
69 | |||
70 | DocCommentHighlightRules.getStartRule = function(start) { |
||
71 | return { |
||
72 | token : "comment.doc", // doc comment |
||
73 | regex : "\\/\\*(?=\\*)", |
||
74 | next : start |
||
75 | }; |
||
76 | }; |
||
77 | |||
78 | DocCommentHighlightRules.getEndRule = function (start) { |
||
79 | return { |
||
80 | token : "comment.doc", // closing comment |
||
81 | regex : "\\*\\/", |
||
82 | next : start |
||
83 | }; |
||
84 | }; |
||
85 | |||
86 | |||
87 | exports.DocCommentHighlightRules = DocCommentHighlightRules; |
||
88 | |||
89 | }); |
||
90 | |||
91 | ace.define("ace/mode/dot_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/doc_comment_highlight_rules"], function(require, exports, module) { |
||
92 | "use strict"; |
||
93 | |||
94 | var oop = require("../lib/oop"); |
||
95 | var lang = require("../lib/lang"); |
||
96 | var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
||
97 | var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; |
||
98 | |||
99 | var DotHighlightRules = function() { |
||
100 | |||
101 | var keywords = lang.arrayToMap( |
||
102 | ("strict|node|edge|graph|digraph|subgraph").split("|") |
||
103 | ); |
||
104 | |||
105 | var attributes = lang.arrayToMap( |
||
106 | ("damping|k|url|area|arrowhead|arrowsize|arrowtail|aspect|bb|bgcolor|center|charset|clusterrank|color|colorscheme|comment|compound|concentrate|constraint|decorate|defaultdist|dim|dimen|dir|diredgeconstraints|distortion|dpi|edgeurl|edgehref|edgetarget|edgetooltip|epsilon|esep|fillcolor|fixedsize|fontcolor|fontname|fontnames|fontpath|fontsize|forcelabels|gradientangle|group|headurl|head_lp|headclip|headhref|headlabel|headport|headtarget|headtooltip|height|href|id|image|imagepath|imagescale|label|labelurl|label_scheme|labelangle|labeldistance|labelfloat|labelfontcolor|labelfontname|labelfontsize|labelhref|labeljust|labelloc|labeltarget|labeltooltip|landscape|layer|layerlistsep|layers|layerselect|layersep|layout|len|levels|levelsgap|lhead|lheight|lp|ltail|lwidth|margin|maxiter|mclimit|mindist|minlen|mode|model|mosek|nodesep|nojustify|normalize|nslimit|nslimit1|ordering|orientation|outputorder|overlap|overlap_scaling|pack|packmode|pad|page|pagedir|pencolor|penwidth|peripheries|pin|pos|quadtree|quantum|rank|rankdir|ranksep|ratio|rects|regular|remincross|repulsiveforce|resolution|root|rotate|rotation|samehead|sametail|samplepoints|scale|searchsize|sep|shape|shapefile|showboxes|sides|size|skew|smoothing|sortv|splines|start|style|stylesheet|tailurl|tail_lp|tailclip|tailhref|taillabel|tailport|tailtarget|tailtooltip|target|tooltip|truecolor|vertices|viewport|voro_margin|weight|width|xlabel|xlp|z").split("|") |
||
107 | ); |
||
108 | |||
109 | this.$rules = { |
||
110 | "start" : [ |
||
111 | { |
||
112 | token : "comment", |
||
113 | regex : /\/\/.*$/ |
||
114 | }, { |
||
115 | token : "comment", |
||
116 | regex : /#.*$/ |
||
117 | }, { |
||
118 | token : "comment", // multi line comment |
||
119 | merge : true, |
||
120 | regex : /\/\*/, |
||
121 | next : "comment" |
||
122 | }, { |
||
123 | token : "string", |
||
124 | regex : "'(?=.)", |
||
125 | next : "qstring" |
||
126 | }, { |
||
127 | token : "string", |
||
128 | regex : '"(?=.)', |
||
129 | next : "qqstring" |
||
130 | }, { |
||
131 | token : "constant.numeric", |
||
132 | regex : /[+\-]?\d+(?:(?:\.\d*)?(?:[eE][+\-]?\d+)?)?\b/ |
||
133 | }, { |
||
134 | token : "keyword.operator", |
||
135 | regex : /\+|=|\->/ |
||
136 | }, { |
||
137 | token : "punctuation.operator", |
||
138 | regex : /,|;/ |
||
139 | }, { |
||
140 | token : "paren.lparen", |
||
141 | regex : /[\[{]/ |
||
142 | }, { |
||
143 | token : "paren.rparen", |
||
144 | regex : /[\]}]/ |
||
145 | }, { |
||
146 | token: "comment", |
||
147 | regex: /^#!.*$/ |
||
148 | }, { |
||
149 | token: function(value) { |
||
150 | if (keywords.hasOwnProperty(value.toLowerCase())) { |
||
151 | return "keyword"; |
||
152 | } |
||
153 | else if (attributes.hasOwnProperty(value.toLowerCase())) { |
||
154 | return "variable"; |
||
155 | } |
||
156 | else { |
||
157 | return "text"; |
||
158 | } |
||
159 | }, |
||
160 | regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" |
||
161 | } |
||
162 | ], |
||
163 | "comment" : [ |
||
164 | { |
||
165 | token : "comment", // closing comment |
||
166 | regex : ".*?\\*\\/", |
||
167 | merge : true, |
||
168 | next : "start" |
||
169 | }, { |
||
170 | token : "comment", // comment spanning whole line |
||
171 | merge : true, |
||
172 | regex : ".+" |
||
173 | } |
||
174 | ], |
||
175 | "qqstring" : [ |
||
176 | { |
||
177 | token : "string", |
||
178 | regex : '[^"\\\\]+', |
||
179 | merge : true |
||
180 | }, { |
||
181 | token : "string", |
||
182 | regex : "\\\\$", |
||
183 | next : "qqstring", |
||
184 | merge : true |
||
185 | }, { |
||
186 | token : "string", |
||
187 | regex : '"|$', |
||
188 | next : "start", |
||
189 | merge : true |
||
190 | } |
||
191 | ], |
||
192 | "qstring" : [ |
||
193 | { |
||
194 | token : "string", |
||
195 | regex : "[^'\\\\]+", |
||
196 | merge : true |
||
197 | }, { |
||
198 | token : "string", |
||
199 | regex : "\\\\$", |
||
200 | next : "qstring", |
||
201 | merge : true |
||
202 | }, { |
||
203 | token : "string", |
||
204 | regex : "'|$", |
||
205 | next : "start", |
||
206 | merge : true |
||
207 | } |
||
208 | ] |
||
209 | }; |
||
210 | }; |
||
211 | |||
212 | oop.inherits(DotHighlightRules, TextHighlightRules); |
||
213 | |||
214 | exports.DotHighlightRules = DotHighlightRules; |
||
215 | |||
216 | }); |
||
217 | |||
218 | ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { |
||
219 | "use strict"; |
||
220 | |||
221 | var oop = require("../../lib/oop"); |
||
222 | var Range = require("../../range").Range; |
||
223 | var BaseFoldMode = require("./fold_mode").FoldMode; |
||
224 | |||
225 | var FoldMode = exports.FoldMode = function(commentRegex) { |
||
226 | if (commentRegex) { |
||
227 | this.foldingStartMarker = new RegExp( |
||
228 | this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) |
||
229 | ); |
||
230 | this.foldingStopMarker = new RegExp( |
||
231 | this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) |
||
232 | ); |
||
233 | } |
||
234 | }; |
||
235 | oop.inherits(FoldMode, BaseFoldMode); |
||
236 | |||
237 | (function() { |
||
238 | |||
239 | this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/; |
||
240 | this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/; |
||
241 | this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; |
||
242 | this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; |
||
243 | this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; |
||
244 | this._getFoldWidgetBase = this.getFoldWidget; |
||
245 | this.getFoldWidget = function(session, foldStyle, row) { |
||
246 | var line = session.getLine(row); |
||
247 | |||
248 | if (this.singleLineBlockCommentRe.test(line)) { |
||
249 | if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) |
||
250 | return ""; |
||
251 | } |
||
252 | |||
253 | var fw = this._getFoldWidgetBase(session, foldStyle, row); |
||
254 | |||
255 | if (!fw && this.startRegionRe.test(line)) |
||
256 | return "start"; // lineCommentRegionStart |
||
257 | |||
258 | return fw; |
||
259 | }; |
||
260 | |||
261 | this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { |
||
262 | var line = session.getLine(row); |
||
263 | |||
264 | if (this.startRegionRe.test(line)) |
||
265 | return this.getCommentRegionBlock(session, line, row); |
||
266 | |||
267 | var match = line.match(this.foldingStartMarker); |
||
268 | if (match) { |
||
269 | var i = match.index; |
||
270 | |||
271 | if (match[1]) |
||
272 | return this.openingBracketBlock(session, match[1], row, i); |
||
273 | |||
274 | var range = session.getCommentFoldRange(row, i + match[0].length, 1); |
||
275 | |||
276 | if (range && !range.isMultiLine()) { |
||
277 | if (forceMultiline) { |
||
278 | range = this.getSectionRange(session, row); |
||
279 | } else if (foldStyle != "all") |
||
280 | range = null; |
||
281 | } |
||
282 | |||
283 | return range; |
||
284 | } |
||
285 | |||
286 | if (foldStyle === "markbegin") |
||
287 | return; |
||
288 | |||
289 | var match = line.match(this.foldingStopMarker); |
||
290 | if (match) { |
||
291 | var i = match.index + match[0].length; |
||
292 | |||
293 | if (match[1]) |
||
294 | return this.closingBracketBlock(session, match[1], row, i); |
||
295 | |||
296 | return session.getCommentFoldRange(row, i, -1); |
||
297 | } |
||
298 | }; |
||
299 | |||
300 | this.getSectionRange = function(session, row) { |
||
301 | var line = session.getLine(row); |
||
302 | var startIndent = line.search(/\S/); |
||
303 | var startRow = row; |
||
304 | var startColumn = line.length; |
||
305 | row = row + 1; |
||
306 | var endRow = row; |
||
307 | var maxRow = session.getLength(); |
||
308 | while (++row < maxRow) { |
||
309 | line = session.getLine(row); |
||
310 | var indent = line.search(/\S/); |
||
311 | if (indent === -1) |
||
312 | continue; |
||
313 | if (startIndent > indent) |
||
314 | break; |
||
315 | var subRange = this.getFoldWidgetRange(session, "all", row); |
||
316 | |||
317 | if (subRange) { |
||
318 | if (subRange.start.row <= startRow) { |
||
319 | break; |
||
320 | } else if (subRange.isMultiLine()) { |
||
321 | row = subRange.end.row; |
||
322 | } else if (startIndent == indent) { |
||
323 | break; |
||
324 | } |
||
325 | } |
||
326 | endRow = row; |
||
327 | } |
||
328 | |||
329 | return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); |
||
330 | }; |
||
331 | this.getCommentRegionBlock = function(session, line, row) { |
||
332 | var startColumn = line.search(/\s*$/); |
||
333 | var maxRow = session.getLength(); |
||
334 | var startRow = row; |
||
335 | |||
336 | var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; |
||
337 | var depth = 1; |
||
338 | while (++row < maxRow) { |
||
339 | line = session.getLine(row); |
||
340 | var m = re.exec(line); |
||
341 | if (!m) continue; |
||
342 | if (m[1]) depth--; |
||
343 | else depth++; |
||
344 | |||
345 | if (!depth) break; |
||
346 | } |
||
347 | |||
348 | var endRow = row; |
||
349 | if (endRow > startRow) { |
||
350 | return new Range(startRow, startColumn, endRow, line.length); |
||
351 | } |
||
352 | }; |
||
353 | |||
354 | }).call(FoldMode.prototype); |
||
355 | |||
356 | }); |
||
357 | |||
358 | ace.define("ace/mode/dot",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/matching_brace_outdent","ace/mode/dot_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) { |
||
359 | "use strict"; |
||
360 | |||
361 | var oop = require("../lib/oop"); |
||
362 | var TextMode = require("./text").Mode; |
||
363 | var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; |
||
364 | var DotHighlightRules = require("./dot_highlight_rules").DotHighlightRules; |
||
365 | var DotFoldMode = require("./folding/cstyle").FoldMode; |
||
366 | |||
367 | var Mode = function() { |
||
368 | this.HighlightRules = DotHighlightRules; |
||
369 | this.$outdent = new MatchingBraceOutdent(); |
||
370 | this.foldingRules = new DotFoldMode(); |
||
371 | this.$behaviour = this.$defaultBehaviour; |
||
372 | }; |
||
373 | oop.inherits(Mode, TextMode); |
||
374 | |||
375 | (function() { |
||
376 | |||
377 | this.lineCommentStart = ["//", "#"]; |
||
378 | this.blockComment = {start: "/*", end: "*/"}; |
||
379 | |||
380 | this.getNextLineIndent = function(state, line, tab) { |
||
381 | var indent = this.$getIndent(line); |
||
382 | |||
383 | var tokenizedLine = this.getTokenizer().getLineTokens(line, state); |
||
384 | var tokens = tokenizedLine.tokens; |
||
385 | var endState = tokenizedLine.state; |
||
386 | |||
387 | if (tokens.length && tokens[tokens.length-1].type == "comment") { |
||
388 | return indent; |
||
389 | } |
||
390 | |||
391 | if (state == "start") { |
||
392 | var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/); |
||
393 | if (match) { |
||
394 | indent += tab; |
||
395 | } |
||
396 | } |
||
397 | |||
398 | return indent; |
||
399 | }; |
||
400 | |||
401 | this.checkOutdent = function(state, line, input) { |
||
402 | return this.$outdent.checkOutdent(line, input); |
||
403 | }; |
||
404 | |||
405 | this.autoOutdent = function(state, doc, row) { |
||
406 | this.$outdent.autoOutdent(doc, row); |
||
407 | }; |
||
408 | |||
409 | this.$id = "ace/mode/dot"; |
||
410 | }).call(Mode.prototype); |
||
411 | |||
412 | exports.Mode = Mode; |
||
413 | }); |