corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { |
2 | "use strict"; |
||
3 | |||
4 | var oop = require("../../lib/oop"); |
||
5 | var Range = require("../../range").Range; |
||
6 | var BaseFoldMode = require("./fold_mode").FoldMode; |
||
7 | |||
8 | var FoldMode = exports.FoldMode = function(commentRegex) { |
||
9 | if (commentRegex) { |
||
10 | this.foldingStartMarker = new RegExp( |
||
11 | this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) |
||
12 | ); |
||
13 | this.foldingStopMarker = new RegExp( |
||
14 | this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) |
||
15 | ); |
||
16 | } |
||
17 | }; |
||
18 | oop.inherits(FoldMode, BaseFoldMode); |
||
19 | |||
20 | (function() { |
||
21 | |||
22 | this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/; |
||
23 | this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/; |
||
24 | this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; |
||
25 | this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; |
||
26 | this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; |
||
27 | this._getFoldWidgetBase = this.getFoldWidget; |
||
28 | this.getFoldWidget = function(session, foldStyle, row) { |
||
29 | var line = session.getLine(row); |
||
30 | |||
31 | if (this.singleLineBlockCommentRe.test(line)) { |
||
32 | if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) |
||
33 | return ""; |
||
34 | } |
||
35 | |||
36 | var fw = this._getFoldWidgetBase(session, foldStyle, row); |
||
37 | |||
38 | if (!fw && this.startRegionRe.test(line)) |
||
39 | return "start"; // lineCommentRegionStart |
||
40 | |||
41 | return fw; |
||
42 | }; |
||
43 | |||
44 | this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { |
||
45 | var line = session.getLine(row); |
||
46 | |||
47 | if (this.startRegionRe.test(line)) |
||
48 | return this.getCommentRegionBlock(session, line, row); |
||
49 | |||
50 | var match = line.match(this.foldingStartMarker); |
||
51 | if (match) { |
||
52 | var i = match.index; |
||
53 | |||
54 | if (match[1]) |
||
55 | return this.openingBracketBlock(session, match[1], row, i); |
||
56 | |||
57 | var range = session.getCommentFoldRange(row, i + match[0].length, 1); |
||
58 | |||
59 | if (range && !range.isMultiLine()) { |
||
60 | if (forceMultiline) { |
||
61 | range = this.getSectionRange(session, row); |
||
62 | } else if (foldStyle != "all") |
||
63 | range = null; |
||
64 | } |
||
65 | |||
66 | return range; |
||
67 | } |
||
68 | |||
69 | if (foldStyle === "markbegin") |
||
70 | return; |
||
71 | |||
72 | var match = line.match(this.foldingStopMarker); |
||
73 | if (match) { |
||
74 | var i = match.index + match[0].length; |
||
75 | |||
76 | if (match[1]) |
||
77 | return this.closingBracketBlock(session, match[1], row, i); |
||
78 | |||
79 | return session.getCommentFoldRange(row, i, -1); |
||
80 | } |
||
81 | }; |
||
82 | |||
83 | this.getSectionRange = function(session, row) { |
||
84 | var line = session.getLine(row); |
||
85 | var startIndent = line.search(/\S/); |
||
86 | var startRow = row; |
||
87 | var startColumn = line.length; |
||
88 | row = row + 1; |
||
89 | var endRow = row; |
||
90 | var maxRow = session.getLength(); |
||
91 | while (++row < maxRow) { |
||
92 | line = session.getLine(row); |
||
93 | var indent = line.search(/\S/); |
||
94 | if (indent === -1) |
||
95 | continue; |
||
96 | if (startIndent > indent) |
||
97 | break; |
||
98 | var subRange = this.getFoldWidgetRange(session, "all", row); |
||
99 | |||
100 | if (subRange) { |
||
101 | if (subRange.start.row <= startRow) { |
||
102 | break; |
||
103 | } else if (subRange.isMultiLine()) { |
||
104 | row = subRange.end.row; |
||
105 | } else if (startIndent == indent) { |
||
106 | break; |
||
107 | } |
||
108 | } |
||
109 | endRow = row; |
||
110 | } |
||
111 | |||
112 | return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); |
||
113 | }; |
||
114 | this.getCommentRegionBlock = function(session, line, row) { |
||
115 | var startColumn = line.search(/\s*$/); |
||
116 | var maxRow = session.getLength(); |
||
117 | var startRow = row; |
||
118 | |||
119 | var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; |
||
120 | var depth = 1; |
||
121 | while (++row < maxRow) { |
||
122 | line = session.getLine(row); |
||
123 | var m = re.exec(line); |
||
124 | if (!m) continue; |
||
125 | if (m[1]) depth--; |
||
126 | else depth++; |
||
127 | |||
128 | if (!depth) break; |
||
129 | } |
||
130 | |||
131 | var endRow = row; |
||
132 | if (endRow > startRow) { |
||
133 | return new Range(startRow, startColumn, endRow, line.length); |
||
134 | } |
||
135 | }; |
||
136 | |||
137 | }).call(FoldMode.prototype); |
||
138 | |||
139 | }); |
||
140 | |||
141 | ace.define("ace/mode/tcl_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { |
||
142 | "use strict"; |
||
143 | |||
144 | var oop = require("../lib/oop"); |
||
145 | var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
||
146 | |||
147 | var TclHighlightRules = function() { |
||
148 | |||
149 | this.$rules = { |
||
150 | "start" : [ |
||
151 | { |
||
152 | token : "comment", |
||
153 | regex : "#.*\\\\$", |
||
154 | next : "commentfollow" |
||
155 | }, { |
||
156 | token : "comment", |
||
157 | regex : "#.*$" |
||
158 | }, { |
||
159 | token : "support.function", |
||
160 | regex : '[\\\\]$', |
||
161 | next : "splitlineStart" |
||
162 | }, { |
||
163 | token : "text", |
||
164 | regex : /\\(?:["{}\[\]$\\])/ |
||
165 | }, { |
||
166 | token : "text", // last value before command |
||
167 | regex : '^|[^{][;][^}]|[/\r/]', |
||
168 | next : "commandItem" |
||
169 | }, { |
||
170 | token : "string", // single line |
||
171 | regex : '[ ]*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' |
||
172 | }, { |
||
173 | token : "string", // multi line """ string start |
||
174 | regex : '[ ]*["]', |
||
175 | next : "qqstring" |
||
176 | }, { |
||
177 | token : "variable.instance", |
||
178 | regex : "[$]", |
||
179 | next : "variable" |
||
180 | }, { |
||
181 | token : "support.function", |
||
182 | regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|{\\*}|;|::" |
||
183 | }, { |
||
184 | token : "identifier", |
||
185 | regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" |
||
186 | }, { |
||
187 | token : "paren.lparen", |
||
188 | regex : "[[{]", |
||
189 | next : "commandItem" |
||
190 | }, { |
||
191 | token : "paren.lparen", |
||
192 | regex : "[(]" |
||
193 | }, { |
||
194 | token : "paren.rparen", |
||
195 | regex : "[\\])}]" |
||
196 | }, { |
||
197 | token : "text", |
||
198 | regex : "\\s+" |
||
199 | } |
||
200 | ], |
||
201 | "commandItem" : [ |
||
202 | { |
||
203 | token : "comment", |
||
204 | regex : "#.*\\\\$", |
||
205 | next : "commentfollow" |
||
206 | }, { |
||
207 | token : "comment", |
||
208 | regex : "#.*$", |
||
209 | next : "start" |
||
210 | }, { |
||
211 | token : "string", // single line |
||
212 | regex : '[ ]*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' |
||
213 | }, { |
||
214 | token : "variable.instance", |
||
215 | regex : "[$]", |
||
216 | next : "variable" |
||
217 | }, { |
||
218 | token : "support.function", |
||
219 | regex : "(?:[:][:])[a-zA-Z0-9_/]+(?:[:][:])", |
||
220 | next : "commandItem" |
||
221 | }, { |
||
222 | token : "support.function", |
||
223 | regex : "[a-zA-Z0-9_/]+(?:[:][:])", |
||
224 | next : "commandItem" |
||
225 | }, { |
||
226 | token : "support.function", |
||
227 | regex : "(?:[:][:])", |
||
228 | next : "commandItem" |
||
229 | }, { |
||
230 | token : "paren.rparen", |
||
231 | regex : "[\\])}]" |
||
232 | }, { |
||
233 | token : "support.function", |
||
234 | regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|{\\*}|;|::" |
||
235 | }, { |
||
236 | token : "keyword", |
||
237 | regex : "[a-zA-Z0-9_/]+", |
||
238 | next : "start" |
||
239 | } ], |
||
240 | "commentfollow" : [ |
||
241 | { |
||
242 | token : "comment", |
||
243 | regex : ".*\\\\$", |
||
244 | next : "commentfollow" |
||
245 | }, { |
||
246 | token : "comment", |
||
247 | regex : '.+', |
||
248 | next : "start" |
||
249 | } ], |
||
250 | "splitlineStart" : [ |
||
251 | { |
||
252 | token : "text", |
||
253 | regex : "^.", |
||
254 | next : "start" |
||
255 | }], |
||
256 | "variable" : [ |
||
257 | { |
||
258 | token : "variable.instance", // variable tcl |
||
259 | regex : "[a-zA-Z_\\d]+(?:[(][a-zA-Z_\\d]+[)])?", |
||
260 | next : "start" |
||
261 | }, { |
||
262 | token : "variable.instance", // variable tcl with braces |
||
263 | regex : "{?[a-zA-Z_\\d]+}?", |
||
264 | next : "start" |
||
265 | }], |
||
266 | "qqstring" : [ { |
||
267 | token : "string", // multi line """ string end |
||
268 | regex : '(?:[^\\\\]|\\\\.)*?["]', |
||
269 | next : "start" |
||
270 | }, { |
||
271 | token : "string", |
||
272 | regex : '.+' |
||
273 | } ] |
||
274 | }; |
||
275 | }; |
||
276 | |||
277 | oop.inherits(TclHighlightRules, TextHighlightRules); |
||
278 | |||
279 | exports.TclHighlightRules = TclHighlightRules; |
||
280 | }); |
||
281 | |||
282 | ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) { |
||
283 | "use strict"; |
||
284 | |||
285 | var Range = require("../range").Range; |
||
286 | |||
287 | var MatchingBraceOutdent = function() {}; |
||
288 | |||
289 | (function() { |
||
290 | |||
291 | this.checkOutdent = function(line, input) { |
||
292 | if (! /^\s+$/.test(line)) |
||
293 | return false; |
||
294 | |||
295 | return /^\s*\}/.test(input); |
||
296 | }; |
||
297 | |||
298 | this.autoOutdent = function(doc, row) { |
||
299 | var line = doc.getLine(row); |
||
300 | var match = line.match(/^(\s*\})/); |
||
301 | |||
302 | if (!match) return 0; |
||
303 | |||
304 | var column = match[1].length; |
||
305 | var openBracePos = doc.findMatchingBracket({row: row, column: column}); |
||
306 | |||
307 | if (!openBracePos || openBracePos.row == row) return 0; |
||
308 | |||
309 | var indent = this.$getIndent(doc.getLine(openBracePos.row)); |
||
310 | doc.replace(new Range(row, 0, row, column-1), indent); |
||
311 | }; |
||
312 | |||
313 | this.$getIndent = function(line) { |
||
314 | return line.match(/^\s*/)[0]; |
||
315 | }; |
||
316 | |||
317 | }).call(MatchingBraceOutdent.prototype); |
||
318 | |||
319 | exports.MatchingBraceOutdent = MatchingBraceOutdent; |
||
320 | }); |
||
321 | |||
322 | ace.define("ace/mode/tcl",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/folding/cstyle","ace/mode/tcl_highlight_rules","ace/mode/matching_brace_outdent","ace/range"], function(require, exports, module) { |
||
323 | "use strict"; |
||
324 | |||
325 | var oop = require("../lib/oop"); |
||
326 | var TextMode = require("./text").Mode; |
||
327 | var CStyleFoldMode = require("./folding/cstyle").FoldMode; |
||
328 | var TclHighlightRules = require("./tcl_highlight_rules").TclHighlightRules; |
||
329 | var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; |
||
330 | var Range = require("../range").Range; |
||
331 | |||
332 | var Mode = function() { |
||
333 | this.HighlightRules = TclHighlightRules; |
||
334 | this.$outdent = new MatchingBraceOutdent(); |
||
335 | this.foldingRules = new CStyleFoldMode(); |
||
336 | this.$behaviour = this.$defaultBehaviour; |
||
337 | }; |
||
338 | oop.inherits(Mode, TextMode); |
||
339 | |||
340 | (function() { |
||
341 | |||
342 | this.lineCommentStart = "#"; |
||
343 | |||
344 | this.getNextLineIndent = function(state, line, tab) { |
||
345 | var indent = this.$getIndent(line); |
||
346 | |||
347 | var tokenizedLine = this.getTokenizer().getLineTokens(line, state); |
||
348 | var tokens = tokenizedLine.tokens; |
||
349 | |||
350 | if (tokens.length && tokens[tokens.length-1].type == "comment") { |
||
351 | return indent; |
||
352 | } |
||
353 | |||
354 | if (state == "start") { |
||
355 | var match = line.match(/^.*[\{\(\[]\s*$/); |
||
356 | if (match) { |
||
357 | indent += tab; |
||
358 | } |
||
359 | } |
||
360 | |||
361 | return indent; |
||
362 | }; |
||
363 | |||
364 | this.checkOutdent = function(state, line, input) { |
||
365 | return this.$outdent.checkOutdent(line, input); |
||
366 | }; |
||
367 | |||
368 | this.autoOutdent = function(state, doc, row) { |
||
369 | this.$outdent.autoOutdent(doc, row); |
||
370 | }; |
||
371 | |||
372 | this.$id = "ace/mode/tcl"; |
||
373 | }).call(Mode.prototype); |
||
374 | |||
375 | exports.Mode = Mode; |
||
376 | }); |