corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | define("ace/mode/xml_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 XmlHighlightRules = function(normalize) { |
||
8 | var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*"; |
||
9 | |||
10 | this.$rules = { |
||
11 | start : [ |
||
12 | {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"}, |
||
13 | { |
||
14 | token : ["punctuation.xml-decl.xml", "keyword.xml-decl.xml"], |
||
15 | regex : "(<\\?)(xml)(?=[\\s])", next : "xml_decl", caseInsensitive: true |
||
16 | }, |
||
17 | { |
||
18 | token : ["punctuation.instruction.xml", "keyword.instruction.xml"], |
||
19 | regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction" |
||
20 | }, |
||
21 | {token : "comment.xml", regex : "<\\!--", next : "comment"}, |
||
22 | { |
||
23 | token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"], |
||
24 | regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true |
||
25 | }, |
||
26 | {include : "tag"}, |
||
27 | {token : "text.end-tag-open.xml", regex: "</"}, |
||
28 | {token : "text.tag-open.xml", regex: "<"}, |
||
29 | {include : "reference"}, |
||
30 | {defaultToken : "text.xml"} |
||
31 | ], |
||
32 | |||
33 | xml_decl : [{ |
||
34 | token : "entity.other.attribute-name.decl-attribute-name.xml", |
||
35 | regex : "(?:" + tagRegex + ":)?" + tagRegex + "" |
||
36 | }, { |
||
37 | token : "keyword.operator.decl-attribute-equals.xml", |
||
38 | regex : "=" |
||
39 | }, { |
||
40 | include: "whitespace" |
||
41 | }, { |
||
42 | include: "string" |
||
43 | }, { |
||
44 | token : "punctuation.xml-decl.xml", |
||
45 | regex : "\\?>", |
||
46 | next : "start" |
||
47 | }], |
||
48 | |||
49 | processing_instruction : [ |
||
50 | {token : "punctuation.instruction.xml", regex : "\\?>", next : "start"}, |
||
51 | {defaultToken : "instruction.xml"} |
||
52 | ], |
||
53 | |||
54 | doctype : [ |
||
55 | {include : "whitespace"}, |
||
56 | {include : "string"}, |
||
57 | {token : "xml-pe.doctype.xml", regex : ">", next : "start"}, |
||
58 | {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"}, |
||
59 | {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"} |
||
60 | ], |
||
61 | |||
62 | int_subset : [{ |
||
63 | token : "text.xml", |
||
64 | regex : "\\s+" |
||
65 | }, { |
||
66 | token: "punctuation.int-subset.xml", |
||
67 | regex: "]", |
||
68 | next: "pop" |
||
69 | }, { |
||
70 | token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"], |
||
71 | regex : "(<\\!)(" + tagRegex + ")", |
||
72 | push : [{ |
||
73 | token : "text", |
||
74 | regex : "\\s+" |
||
75 | }, |
||
76 | { |
||
77 | token : "punctuation.markup-decl.xml", |
||
78 | regex : ">", |
||
79 | next : "pop" |
||
80 | }, |
||
81 | {include : "string"}] |
||
82 | }], |
||
83 | |||
84 | cdata : [ |
||
85 | {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"}, |
||
86 | {token : "text.xml", regex : "\\s+"}, |
||
87 | {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"} |
||
88 | ], |
||
89 | |||
90 | comment : [ |
||
91 | {token : "comment.xml", regex : "-->", next : "start"}, |
||
92 | {defaultToken : "comment.xml"} |
||
93 | ], |
||
94 | |||
95 | reference : [{ |
||
96 | token : "constant.language.escape.reference.xml", |
||
97 | regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" |
||
98 | }], |
||
99 | |||
100 | attr_reference : [{ |
||
101 | token : "constant.language.escape.reference.attribute-value.xml", |
||
102 | regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" |
||
103 | }], |
||
104 | |||
105 | tag : [{ |
||
106 | token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"], |
||
107 | regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")", |
||
108 | next: [ |
||
109 | {include : "attributes"}, |
||
110 | {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"} |
||
111 | ] |
||
112 | }], |
||
113 | |||
114 | tag_whitespace : [ |
||
115 | {token : "text.tag-whitespace.xml", regex : "\\s+"} |
||
116 | ], |
||
117 | whitespace : [ |
||
118 | {token : "text.whitespace.xml", regex : "\\s+"} |
||
119 | ], |
||
120 | string: [{ |
||
121 | token : "string.xml", |
||
122 | regex : "'", |
||
123 | push : [ |
||
124 | {token : "string.xml", regex: "'", next: "pop"}, |
||
125 | {defaultToken : "string.xml"} |
||
126 | ] |
||
127 | }, { |
||
128 | token : "string.xml", |
||
129 | regex : '"', |
||
130 | push : [ |
||
131 | {token : "string.xml", regex: '"', next: "pop"}, |
||
132 | {defaultToken : "string.xml"} |
||
133 | ] |
||
134 | }], |
||
135 | |||
136 | attributes: [{ |
||
137 | token : "entity.other.attribute-name.xml", |
||
138 | regex : "(?:" + tagRegex + ":)?" + tagRegex + "" |
||
139 | }, { |
||
140 | token : "keyword.operator.attribute-equals.xml", |
||
141 | regex : "=" |
||
142 | }, { |
||
143 | include: "tag_whitespace" |
||
144 | }, { |
||
145 | include: "attribute_value" |
||
146 | }], |
||
147 | |||
148 | attribute_value: [{ |
||
149 | token : "string.attribute-value.xml", |
||
150 | regex : "'", |
||
151 | push : [ |
||
152 | {token : "string.attribute-value.xml", regex: "'", next: "pop"}, |
||
153 | {include : "attr_reference"}, |
||
154 | {defaultToken : "string.attribute-value.xml"} |
||
155 | ] |
||
156 | }, { |
||
157 | token : "string.attribute-value.xml", |
||
158 | regex : '"', |
||
159 | push : [ |
||
160 | {token : "string.attribute-value.xml", regex: '"', next: "pop"}, |
||
161 | {include : "attr_reference"}, |
||
162 | {defaultToken : "string.attribute-value.xml"} |
||
163 | ] |
||
164 | }] |
||
165 | }; |
||
166 | |||
167 | if (this.constructor === XmlHighlightRules) |
||
168 | this.normalizeRules(); |
||
169 | }; |
||
170 | |||
171 | |||
172 | (function() { |
||
173 | |||
174 | this.embedTagRules = function(HighlightRules, prefix, tag){ |
||
175 | this.$rules.tag.unshift({ |
||
176 | token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"], |
||
177 | regex : "(<)(" + tag + "(?=\\s|>|$))", |
||
178 | next: [ |
||
179 | {include : "attributes"}, |
||
180 | {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"} |
||
181 | ] |
||
182 | }); |
||
183 | |||
184 | this.$rules[tag + "-end"] = [ |
||
185 | {include : "attributes"}, |
||
186 | {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start", |
||
187 | onMatch : function(value, currentState, stack) { |
||
188 | stack.splice(0); |
||
189 | return this.token; |
||
190 | }} |
||
191 | ] |
||
192 | |||
193 | this.embedRules(HighlightRules, prefix, [{ |
||
194 | token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"], |
||
195 | regex : "(</)(" + tag + "(?=\\s|>|$))", |
||
196 | next: tag + "-end" |
||
197 | }, { |
||
198 | token: "string.cdata.xml", |
||
199 | regex : "<\\!\\[CDATA\\[" |
||
200 | }, { |
||
201 | token: "string.cdata.xml", |
||
202 | regex : "\\]\\]>" |
||
203 | }]); |
||
204 | }; |
||
205 | |||
206 | }).call(TextHighlightRules.prototype); |
||
207 | |||
208 | oop.inherits(XmlHighlightRules, TextHighlightRules); |
||
209 | |||
210 | exports.XmlHighlightRules = XmlHighlightRules; |
||
211 | }); |
||
212 | |||
213 | define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) { |
||
214 | "use strict"; |
||
215 | |||
216 | var oop = require("../../lib/oop"); |
||
217 | var Behaviour = require("../behaviour").Behaviour; |
||
218 | var TokenIterator = require("../../token_iterator").TokenIterator; |
||
219 | var lang = require("../../lib/lang"); |
||
220 | |||
221 | function is(token, type) { |
||
222 | return token.type.lastIndexOf(type + ".xml") > -1; |
||
223 | } |
||
224 | |||
225 | var XmlBehaviour = function () { |
||
226 | |||
227 | this.add("string_dquotes", "insertion", function (state, action, editor, session, text) { |
||
228 | if (text == '"' || text == "'") { |
||
229 | var quote = text; |
||
230 | var selected = session.doc.getTextRange(editor.getSelectionRange()); |
||
231 | if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { |
||
232 | return { |
||
233 | text: quote + selected + quote, |
||
234 | selection: false |
||
235 | }; |
||
236 | } |
||
237 | |||
238 | var cursor = editor.getCursorPosition(); |
||
239 | var line = session.doc.getLine(cursor.row); |
||
240 | var rightChar = line.substring(cursor.column, cursor.column + 1); |
||
241 | var iterator = new TokenIterator(session, cursor.row, cursor.column); |
||
242 | var token = iterator.getCurrentToken(); |
||
243 | |||
244 | if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) { |
||
245 | return { |
||
246 | text: "", |
||
247 | selection: [1, 1] |
||
248 | }; |
||
249 | } |
||
250 | |||
251 | if (!token) |
||
252 | token = iterator.stepBackward(); |
||
253 | |||
254 | if (!token) |
||
255 | return; |
||
256 | |||
257 | while (is(token, "tag-whitespace") || is(token, "whitespace")) { |
||
258 | token = iterator.stepBackward(); |
||
259 | } |
||
260 | var rightSpace = !rightChar || rightChar.match(/\s/); |
||
261 | if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) { |
||
262 | return { |
||
263 | text: quote + quote, |
||
264 | selection: [1, 1] |
||
265 | }; |
||
266 | } |
||
267 | } |
||
268 | }); |
||
269 | |||
270 | this.add("string_dquotes", "deletion", function(state, action, editor, session, range) { |
||
271 | var selected = session.doc.getTextRange(range); |
||
272 | if (!range.isMultiLine() && (selected == '"' || selected == "'")) { |
||
273 | var line = session.doc.getLine(range.start.row); |
||
274 | var rightChar = line.substring(range.start.column + 1, range.start.column + 2); |
||
275 | if (rightChar == selected) { |
||
276 | range.end.column++; |
||
277 | return range; |
||
278 | } |
||
279 | } |
||
280 | }); |
||
281 | |||
282 | this.add("autoclosing", "insertion", function (state, action, editor, session, text) { |
||
283 | if (text == '>') { |
||
284 | var position = editor.getSelectionRange().start; |
||
285 | var iterator = new TokenIterator(session, position.row, position.column); |
||
286 | var token = iterator.getCurrentToken() || iterator.stepBackward(); |
||
287 | if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value"))) |
||
288 | return; |
||
289 | if (is(token, "reference.attribute-value")) |
||
290 | return; |
||
291 | if (is(token, "attribute-value")) { |
||
292 | var firstChar = token.value.charAt(0); |
||
293 | if (firstChar == '"' || firstChar == "'") { |
||
294 | var lastChar = token.value.charAt(token.value.length - 1); |
||
295 | var tokenEnd = iterator.getCurrentTokenColumn() + token.value.length; |
||
296 | if (tokenEnd > position.column || tokenEnd == position.column && firstChar != lastChar) |
||
297 | return; |
||
298 | } |
||
299 | } |
||
300 | while (!is(token, "tag-name")) { |
||
301 | token = iterator.stepBackward(); |
||
302 | if (token.value == "<") { |
||
303 | token = iterator.stepForward(); |
||
304 | break; |
||
305 | } |
||
306 | } |
||
307 | |||
308 | var tokenRow = iterator.getCurrentTokenRow(); |
||
309 | var tokenColumn = iterator.getCurrentTokenColumn(); |
||
310 | if (is(iterator.stepBackward(), "end-tag-open")) |
||
311 | return; |
||
312 | |||
313 | var element = token.value; |
||
314 | if (tokenRow == position.row) |
||
315 | element = element.substring(0, position.column - tokenColumn); |
||
316 | |||
317 | if (this.voidElements.hasOwnProperty(element.toLowerCase())) |
||
318 | return; |
||
319 | |||
320 | return { |
||
321 | text: ">" + "</" + element + ">", |
||
322 | selection: [1, 1] |
||
323 | }; |
||
324 | } |
||
325 | }); |
||
326 | |||
327 | this.add("autoindent", "insertion", function (state, action, editor, session, text) { |
||
328 | if (text == "\n") { |
||
329 | var cursor = editor.getCursorPosition(); |
||
330 | var line = session.getLine(cursor.row); |
||
331 | var iterator = new TokenIterator(session, cursor.row, cursor.column); |
||
332 | var token = iterator.getCurrentToken(); |
||
333 | |||
334 | if (token && token.type.indexOf("tag-close") !== -1) { |
||
335 | if (token.value == "/>") |
||
336 | return; |
||
337 | while (token && token.type.indexOf("tag-name") === -1) { |
||
338 | token = iterator.stepBackward(); |
||
339 | } |
||
340 | |||
341 | if (!token) { |
||
342 | return; |
||
343 | } |
||
344 | |||
345 | var tag = token.value; |
||
346 | var row = iterator.getCurrentTokenRow(); |
||
347 | token = iterator.stepBackward(); |
||
348 | if (!token || token.type.indexOf("end-tag") !== -1) { |
||
349 | return; |
||
350 | } |
||
351 | |||
352 | if (this.voidElements && !this.voidElements[tag]) { |
||
353 | var nextToken = session.getTokenAt(cursor.row, cursor.column+1); |
||
354 | var line = session.getLine(row); |
||
355 | var nextIndent = this.$getIndent(line); |
||
356 | var indent = nextIndent + session.getTabString(); |
||
357 | |||
358 | if (nextToken && nextToken.value === "</") { |
||
359 | return { |
||
360 | text: "\n" + indent + "\n" + nextIndent, |
||
361 | selection: [1, indent.length, 1, indent.length] |
||
362 | }; |
||
363 | } else { |
||
364 | return { |
||
365 | text: "\n" + indent |
||
366 | }; |
||
367 | } |
||
368 | } |
||
369 | } |
||
370 | } |
||
371 | }); |
||
372 | |||
373 | }; |
||
374 | |||
375 | oop.inherits(XmlBehaviour, Behaviour); |
||
376 | |||
377 | exports.XmlBehaviour = XmlBehaviour; |
||
378 | }); |
||
379 | |||
380 | define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/range","ace/mode/folding/fold_mode","ace/token_iterator"], function(require, exports, module) { |
||
381 | "use strict"; |
||
382 | |||
383 | var oop = require("../../lib/oop"); |
||
384 | var lang = require("../../lib/lang"); |
||
385 | var Range = require("../../range").Range; |
||
386 | var BaseFoldMode = require("./fold_mode").FoldMode; |
||
387 | var TokenIterator = require("../../token_iterator").TokenIterator; |
||
388 | |||
389 | var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) { |
||
390 | BaseFoldMode.call(this); |
||
391 | this.voidElements = voidElements || {}; |
||
392 | this.optionalEndTags = oop.mixin({}, this.voidElements); |
||
393 | if (optionalEndTags) |
||
394 | oop.mixin(this.optionalEndTags, optionalEndTags); |
||
395 | |||
396 | }; |
||
397 | oop.inherits(FoldMode, BaseFoldMode); |
||
398 | |||
399 | var Tag = function() { |
||
400 | this.tagName = ""; |
||
401 | this.closing = false; |
||
402 | this.selfClosing = false; |
||
403 | this.start = {row: 0, column: 0}; |
||
404 | this.end = {row: 0, column: 0}; |
||
405 | }; |
||
406 | |||
407 | function is(token, type) { |
||
408 | return token.type.lastIndexOf(type + ".xml") > -1; |
||
409 | } |
||
410 | |||
411 | (function() { |
||
412 | |||
413 | this.getFoldWidget = function(session, foldStyle, row) { |
||
414 | var tag = this._getFirstTagInLine(session, row); |
||
415 | |||
416 | if (!tag) |
||
417 | return ""; |
||
418 | |||
419 | if (tag.closing || (!tag.tagName && tag.selfClosing)) |
||
420 | return foldStyle == "markbeginend" ? "end" : ""; |
||
421 | |||
422 | if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase())) |
||
423 | return ""; |
||
424 | |||
425 | if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column)) |
||
426 | return ""; |
||
427 | |||
428 | return "start"; |
||
429 | }; |
||
430 | this._getFirstTagInLine = function(session, row) { |
||
431 | var tokens = session.getTokens(row); |
||
432 | var tag = new Tag(); |
||
433 | |||
434 | for (var i = 0; i < tokens.length; i++) { |
||
435 | var token = tokens[i]; |
||
436 | if (is(token, "tag-open")) { |
||
437 | tag.end.column = tag.start.column + token.value.length; |
||
438 | tag.closing = is(token, "end-tag-open"); |
||
439 | token = tokens[++i]; |
||
440 | if (!token) |
||
441 | return null; |
||
442 | tag.tagName = token.value; |
||
443 | tag.end.column += token.value.length; |
||
444 | for (i++; i < tokens.length; i++) { |
||
445 | token = tokens[i]; |
||
446 | tag.end.column += token.value.length; |
||
447 | if (is(token, "tag-close")) { |
||
448 | tag.selfClosing = token.value == '/>'; |
||
449 | break; |
||
450 | } |
||
451 | } |
||
452 | return tag; |
||
453 | } else if (is(token, "tag-close")) { |
||
454 | tag.selfClosing = token.value == '/>'; |
||
455 | return tag; |
||
456 | } |
||
457 | tag.start.column += token.value.length; |
||
458 | } |
||
459 | |||
460 | return null; |
||
461 | }; |
||
462 | |||
463 | this._findEndTagInLine = function(session, row, tagName, startColumn) { |
||
464 | var tokens = session.getTokens(row); |
||
465 | var column = 0; |
||
466 | for (var i = 0; i < tokens.length; i++) { |
||
467 | var token = tokens[i]; |
||
468 | column += token.value.length; |
||
469 | if (column < startColumn) |
||
470 | continue; |
||
471 | if (is(token, "end-tag-open")) { |
||
472 | token = tokens[i + 1]; |
||
473 | if (token && token.value == tagName) |
||
474 | return true; |
||
475 | } |
||
476 | } |
||
477 | return false; |
||
478 | }; |
||
479 | this._readTagForward = function(iterator) { |
||
480 | var token = iterator.getCurrentToken(); |
||
481 | if (!token) |
||
482 | return null; |
||
483 | |||
484 | var tag = new Tag(); |
||
485 | do { |
||
486 | if (is(token, "tag-open")) { |
||
487 | tag.closing = is(token, "end-tag-open"); |
||
488 | tag.start.row = iterator.getCurrentTokenRow(); |
||
489 | tag.start.column = iterator.getCurrentTokenColumn(); |
||
490 | } else if (is(token, "tag-name")) { |
||
491 | tag.tagName = token.value; |
||
492 | } else if (is(token, "tag-close")) { |
||
493 | tag.selfClosing = token.value == "/>"; |
||
494 | tag.end.row = iterator.getCurrentTokenRow(); |
||
495 | tag.end.column = iterator.getCurrentTokenColumn() + token.value.length; |
||
496 | iterator.stepForward(); |
||
497 | return tag; |
||
498 | } |
||
499 | } while(token = iterator.stepForward()); |
||
500 | |||
501 | return null; |
||
502 | }; |
||
503 | |||
504 | this._readTagBackward = function(iterator) { |
||
505 | var token = iterator.getCurrentToken(); |
||
506 | if (!token) |
||
507 | return null; |
||
508 | |||
509 | var tag = new Tag(); |
||
510 | do { |
||
511 | if (is(token, "tag-open")) { |
||
512 | tag.closing = is(token, "end-tag-open"); |
||
513 | tag.start.row = iterator.getCurrentTokenRow(); |
||
514 | tag.start.column = iterator.getCurrentTokenColumn(); |
||
515 | iterator.stepBackward(); |
||
516 | return tag; |
||
517 | } else if (is(token, "tag-name")) { |
||
518 | tag.tagName = token.value; |
||
519 | } else if (is(token, "tag-close")) { |
||
520 | tag.selfClosing = token.value == "/>"; |
||
521 | tag.end.row = iterator.getCurrentTokenRow(); |
||
522 | tag.end.column = iterator.getCurrentTokenColumn() + token.value.length; |
||
523 | } |
||
524 | } while(token = iterator.stepBackward()); |
||
525 | |||
526 | return null; |
||
527 | }; |
||
528 | |||
529 | this._pop = function(stack, tag) { |
||
530 | while (stack.length) { |
||
531 | |||
532 | var top = stack[stack.length-1]; |
||
533 | if (!tag || top.tagName == tag.tagName) { |
||
534 | return stack.pop(); |
||
535 | } |
||
536 | else if (this.optionalEndTags.hasOwnProperty(top.tagName)) { |
||
537 | stack.pop(); |
||
538 | continue; |
||
539 | } else { |
||
540 | return null; |
||
541 | } |
||
542 | } |
||
543 | }; |
||
544 | |||
545 | this.getFoldWidgetRange = function(session, foldStyle, row) { |
||
546 | var firstTag = this._getFirstTagInLine(session, row); |
||
547 | |||
548 | if (!firstTag) |
||
549 | return null; |
||
550 | |||
551 | var isBackward = firstTag.closing || firstTag.selfClosing; |
||
552 | var stack = []; |
||
553 | var tag; |
||
554 | |||
555 | if (!isBackward) { |
||
556 | var iterator = new TokenIterator(session, row, firstTag.start.column); |
||
557 | var start = { |
||
558 | row: row, |
||
559 | column: firstTag.start.column + firstTag.tagName.length + 2 |
||
560 | }; |
||
561 | if (firstTag.start.row == firstTag.end.row) |
||
562 | start.column = firstTag.end.column; |
||
563 | while (tag = this._readTagForward(iterator)) { |
||
564 | if (tag.selfClosing) { |
||
565 | if (!stack.length) { |
||
566 | tag.start.column += tag.tagName.length + 2; |
||
567 | tag.end.column -= 2; |
||
568 | return Range.fromPoints(tag.start, tag.end); |
||
569 | } else |
||
570 | continue; |
||
571 | } |
||
572 | |||
573 | if (tag.closing) { |
||
574 | this._pop(stack, tag); |
||
575 | if (stack.length == 0) |
||
576 | return Range.fromPoints(start, tag.start); |
||
577 | } |
||
578 | else { |
||
579 | stack.push(tag); |
||
580 | } |
||
581 | } |
||
582 | } |
||
583 | else { |
||
584 | var iterator = new TokenIterator(session, row, firstTag.end.column); |
||
585 | var end = { |
||
586 | row: row, |
||
587 | column: firstTag.start.column |
||
588 | }; |
||
589 | |||
590 | while (tag = this._readTagBackward(iterator)) { |
||
591 | if (tag.selfClosing) { |
||
592 | if (!stack.length) { |
||
593 | tag.start.column += tag.tagName.length + 2; |
||
594 | tag.end.column -= 2; |
||
595 | return Range.fromPoints(tag.start, tag.end); |
||
596 | } else |
||
597 | continue; |
||
598 | } |
||
599 | |||
600 | if (!tag.closing) { |
||
601 | this._pop(stack, tag); |
||
602 | if (stack.length == 0) { |
||
603 | tag.start.column += tag.tagName.length + 2; |
||
604 | if (tag.start.row == tag.end.row && tag.start.column < tag.end.column) |
||
605 | tag.start.column = tag.end.column; |
||
606 | return Range.fromPoints(tag.start, end); |
||
607 | } |
||
608 | } |
||
609 | else { |
||
610 | stack.push(tag); |
||
611 | } |
||
612 | } |
||
613 | } |
||
614 | |||
615 | }; |
||
616 | |||
617 | }).call(FoldMode.prototype); |
||
618 | |||
619 | }); |
||
620 | |||
621 | define("ace/mode/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/xml_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/xml","ace/worker/worker_client"], function(require, exports, module) { |
||
622 | "use strict"; |
||
623 | |||
624 | var oop = require("../lib/oop"); |
||
625 | var lang = require("../lib/lang"); |
||
626 | var TextMode = require("./text").Mode; |
||
627 | var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; |
||
628 | var XmlBehaviour = require("./behaviour/xml").XmlBehaviour; |
||
629 | var XmlFoldMode = require("./folding/xml").FoldMode; |
||
630 | var WorkerClient = require("../worker/worker_client").WorkerClient; |
||
631 | |||
632 | var Mode = function() { |
||
633 | this.HighlightRules = XmlHighlightRules; |
||
634 | this.$behaviour = new XmlBehaviour(); |
||
635 | this.foldingRules = new XmlFoldMode(); |
||
636 | }; |
||
637 | |||
638 | oop.inherits(Mode, TextMode); |
||
639 | |||
640 | (function() { |
||
641 | |||
642 | this.voidElements = lang.arrayToMap([]); |
||
643 | |||
644 | this.blockComment = {start: "<!--", end: "-->"}; |
||
645 | |||
646 | this.createWorker = function(session) { |
||
647 | var worker = new WorkerClient(["ace"], "ace/mode/xml_worker", "Worker"); |
||
648 | worker.attachToDocument(session.getDocument()); |
||
649 | |||
650 | worker.on("error", function(e) { |
||
651 | session.setAnnotations(e.data); |
||
652 | }); |
||
653 | |||
654 | worker.on("terminate", function() { |
||
655 | session.clearAnnotations(); |
||
656 | }); |
||
657 | |||
658 | return worker; |
||
659 | }; |
||
660 | |||
661 | this.$id = "ace/mode/xml"; |
||
662 | }).call(Mode.prototype); |
||
663 | |||
664 | exports.Mode = Mode; |
||
665 | }); |