corrade-nucleus-nucleons – Blame information for rev 20

Subversion Repositories:
Rev:
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 });
666  
667 define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
668 "use strict";
669  
670 var oop = require("../lib/oop");
671 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
672  
673 var DocCommentHighlightRules = function() {
674 this.$rules = {
675 "start" : [ {
676 token : "comment.doc.tag",
677 regex : "@[\\w\\d_]+" // TODO: fix email addresses
678 },
679 DocCommentHighlightRules.getTagRule(),
680 {
681 defaultToken : "comment.doc",
682 caseInsensitive: true
683 }]
684 };
685 };
686  
687 oop.inherits(DocCommentHighlightRules, TextHighlightRules);
688  
689 DocCommentHighlightRules.getTagRule = function(start) {
690 return {
691 token : "comment.doc.tag.storage.type",
692 regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
693 };
694 }
695  
696 DocCommentHighlightRules.getStartRule = function(start) {
697 return {
698 token : "comment.doc", // doc comment
699 regex : "\\/\\*(?=\\*)",
700 next : start
701 };
702 };
703  
704 DocCommentHighlightRules.getEndRule = function (start) {
705 return {
706 token : "comment.doc", // closing comment
707 regex : "\\*\\/",
708 next : start
709 };
710 };
711  
712  
713 exports.DocCommentHighlightRules = DocCommentHighlightRules;
714  
715 });
716  
717 define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
718 "use strict";
719  
720 var oop = require("../lib/oop");
721 var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
722 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
723 var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
724  
725 var JavaScriptHighlightRules = function(options) {
726 var keywordMapper = this.createKeywordMapper({
727 "variable.language":
728 "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
729 "Namespace|QName|XML|XMLList|" + // E4X
730 "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
731 "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
732 "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
733 "SyntaxError|TypeError|URIError|" +
734 "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
735 "isNaN|parseFloat|parseInt|" +
736 "JSON|Math|" + // Other
737 "this|arguments|prototype|window|document" , // Pseudo
738 "keyword":
739 "const|yield|import|get|set|async|await|" +
740 "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
741 "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
742 "__parent__|__count__|escape|unescape|with|__proto__|" +
743 "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
744 "storage.type":
745 "const|let|var|function",
746 "constant.language":
747 "null|Infinity|NaN|undefined",
748 "support.function":
749 "alert",
750 "constant.language.boolean": "true|false"
751 }, "identifier");
752 var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
753  
754 var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
755 "u[0-9a-fA-F]{4}|" + // unicode
756 "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
757 "[0-2][0-7]{0,2}|" + // oct
758 "3[0-7][0-7]?|" + // oct
759 "[4-7][0-7]?|" + //oct
760 ".)";
761  
762 this.$rules = {
763 "no_regex" : [
764 DocCommentHighlightRules.getStartRule("doc-start"),
765 comments("no_regex"),
766 {
767 token : "string",
768 regex : "'(?=.)",
769 next : "qstring"
770 }, {
771 token : "string",
772 regex : '"(?=.)',
773 next : "qqstring"
774 }, {
775 token : "constant.numeric", // hex
776 regex : /0(?:[xX][0-9a-fA-F]+|[bB][01]+)\b/
777 }, {
778 token : "constant.numeric", // float
779 regex : /[+-]?\d[\d_]*(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
780 }, {
781 token : [
782 "storage.type", "punctuation.operator", "support.function",
783 "punctuation.operator", "entity.name.function", "text","keyword.operator"
784 ],
785 regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
786 next: "function_arguments"
787 }, {
788 token : [
789 "storage.type", "punctuation.operator", "entity.name.function", "text",
790 "keyword.operator", "text", "storage.type", "text", "paren.lparen"
791 ],
792 regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
793 next: "function_arguments"
794 }, {
795 token : [
796 "entity.name.function", "text", "keyword.operator", "text", "storage.type",
797 "text", "paren.lparen"
798 ],
799 regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
800 next: "function_arguments"
801 }, {
802 token : [
803 "storage.type", "punctuation.operator", "entity.name.function", "text",
804 "keyword.operator", "text",
805 "storage.type", "text", "entity.name.function", "text", "paren.lparen"
806 ],
807 regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
808 next: "function_arguments"
809 }, {
810 token : [
811 "storage.type", "text", "entity.name.function", "text", "paren.lparen"
812 ],
813 regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
814 next: "function_arguments"
815 }, {
816 token : [
817 "entity.name.function", "text", "punctuation.operator",
818 "text", "storage.type", "text", "paren.lparen"
819 ],
820 regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
821 next: "function_arguments"
822 }, {
823 token : [
824 "text", "text", "storage.type", "text", "paren.lparen"
825 ],
826 regex : "(:)(\\s*)(function)(\\s*)(\\()",
827 next: "function_arguments"
828 }, {
829 token : "keyword",
830 regex : "(?:" + kwBeforeRe + ")\\b",
831 next : "start"
832 }, {
833 token : ["support.constant"],
834 regex : /that\b/
835 }, {
836 token : ["storage.type", "punctuation.operator", "support.function.firebug"],
837 regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
838 }, {
839 token : keywordMapper,
840 regex : identifierRe
841 }, {
842 token : "punctuation.operator",
843 regex : /[.](?![.])/,
844 next : "property"
845 }, {
846 token : "keyword.operator",
847 regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
848 <+=?|> next : "start"
849 <+=?|> }, {
850 <+=?|> token : "punctuation.operator",
851 <+=?|> regex : /[?:,;.]/,
852 <+=?|> next : "start"
853 <+=?|> }, {
854 <+=?|> token : "paren.lparen",
855 <+=?|> regex : /[\[({]/,
856 <+=?|> next : "start"
857 <+=?|> }, {
858 <+=?|> token : "paren.rparen",
859 <+=?|> regex : /[\])}]/
860 <+=?|> }, {
861 <+=?|> token: "comment",
862 <+=?|> regex: /^#!.*$/
863 <+=?|> }
864 <+=?|> ],
865 <+=?|> property: [{
866 <+=?|> token : "text",
867 <+=?|> regex : "\\s+"
868 <+=?|> }, {
869 <+=?|> token : [
870 <+=?|> "storage.type", "punctuation.operator", "entity.name.function", "text",
871 <+=?|> "keyword.operator", "text",
872 <+=?|> "storage.type", "text", "entity.name.function", "text", "paren.lparen"
873 <+=?|> ],
874 <+=?|> regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
875 <+=?|> next: "function_arguments"
876 <+=?|> }, {
877 <+=?|> token : "punctuation.operator",
878 <+=?|> regex : /[.](?![.])/
879 <+=?|> }, {
880 <+=?|> token : "support.function",
881 <+=?|> regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
882 <+=?|> }, {
883 <+=?|> token : "support.function.dom",
884 <+=?|> regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
885 <+=?|> }, {
886 <+=?|> token : "support.constant",
887 <+=?|> regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
888 <+=?|> }, {
889 <+=?|> token : "identifier",
890 <+=?|> regex : identifierRe
891 <+=?|> }, {
892 <+=?|> regex: "",
893 <+=?|> token: "empty",
894 <+=?|> next: "no_regex"
895 <+=?|> }
896 <+=?|> ],
897 <+=?|> "start": [
898 <+=?|> DocCommentHighlightRules.getStartRule("doc-start"),
899 <+=?|> comments("start"),
900 <+=?|> {
901 <+=?|> token: "string.regexp",
902 <+=?|> regex: "\\/",
903 <+=?|> next: "regex"
904 <+=?|> }, {
905 <+=?|> token : "text",
906 <+=?|> regex : "\\s+|^$",
907 <+=?|> next : "start"
908 <+=?|> }, {
909 <+=?|> token: "empty",
910 <+=?|> regex: "",
911 <+=?|> next: "no_regex"
912 <+=?|> }
913 <+=?|> ],
914 <+=?|> "regex": [
915 <+=?|> {
916 <+=?|> token: "regexp.keyword.operator",
917 <+=?|> regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
918 <+=?|> }, {
919 <+=?|> token: "string.regexp",
920 <+=?|> regex: "/[sxngimy]*",
921 <+=?|> next: "no_regex"
922 <+=?|> }, {
923 <+=?|> token : "invalid",
924 <+=?|> regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
925 <+=?|> }, {
926 <+=?|> token : "constant.language.escape",
927 <+=?|> regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
928 <+=?|> }, {
929 <+=?|> token : "constant.language.delimiter",
930 <+=?|> regex: /\|/
931 <+=?|> }, {
932 <+=?|> token: "constant.language.escape",
933 <+=?|> regex: /\[\^?/,
934 <+=?|> next: "regex_character_class"
935 <+=?|> }, {
936 <+=?|> token: "empty",
937 <+=?|> regex: "$",
938 <+=?|> next: "no_regex"
939 <+=?|> }, {
940 <+=?|> defaultToken: "string.regexp"
941 <+=?|> }
942 <+=?|> ],
943 <+=?|> "regex_character_class": [
944 <+=?|> {
945 <+=?|> token: "regexp.charclass.keyword.operator",
946 <+=?|> regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
947 <+=?|> }, {
948 <+=?|> token: "constant.language.escape",
949 <+=?|> regex: "]",
950 <+=?|> next: "regex"
951 <+=?|> }, {
952 <+=?|> token: "constant.language.escape",
953 <+=?|> regex: "-"
954 <+=?|> }, {
955 <+=?|> token: "empty",
956 <+=?|> regex: "$",
957 <+=?|> next: "no_regex"
958 <+=?|> }, {
959 <+=?|> defaultToken: "string.regexp.charachterclass"
960 <+=?|> }
961 <+=?|> ],
962 <+=?|> "function_arguments": [
963 <+=?|> {
964 <+=?|> token: "variable.parameter",
965 <+=?|> regex: identifierRe
966 <+=?|> }, {
967 <+=?|> token: "punctuation.operator",
968 <+=?|> regex: "[, ]+"
969 <+=?|> }, {
970 <+=?|> token: "punctuation.operator",
971 <+=?|> regex: "$"
972 <+=?|> }, {
973 <+=?|> token: "empty",
974 <+=?|> regex: "",
975 <+=?|> next: "no_regex"
976 <+=?|> }
977 <+=?|> ],
978 <+=?|> "qqstring" : [
979 <+=?|> {
980 <+=?|> token : "constant.language.escape",
981 <+=?|> regex : escapedRe
982 <+=?|> }, {
983 <+=?|> token : "string",
984 <+=?|> regex : "\\\\$",
985 <+=?|> next : "qqstring"
986 <+=?|> }, {
987 <+=?|> token : "string",
988 <+=?|> regex : '"|$',
989 <+=?|> next : "no_regex"
990 <+=?|> }, {
991 <+=?|> defaultToken: "string"
992 <+=?|> }
993 <+=?|> ],
994 <+=?|> "qstring" : [
995 <+=?|> {
996 <+=?|> token : "constant.language.escape",
997 <+=?|> regex : escapedRe
998 <+=?|> }, {
999 <+=?|> token : "string",
1000 <+=?|> regex : "\\\\$",
1001 <+=?|> next : "qstring"
1002 <+=?|> }, {
1003 <+=?|> token : "string",
1004 <+=?|> regex : "'|$",
1005 <+=?|> next : "no_regex"
1006 <+=?|> }, {
1007 <+=?|> defaultToken: "string"
1008 <+=?|> }
1009 <+=?|> ]
1010 <+=?|> };
1011  
1012  
1013 <+=?|> if (!options || !options.noES6) {
1014 <+=?|> this.$rules.no_regex.unshift({
1015 <+=?|> regex: "[{}]", onMatch: function(val, state, stack) {
1016 <+=?|> this.next = val == "{" ? this.nextState : "";
1017 <+=?|> if (val == "{" && stack.length) {
1018 <+=?|> stack.unshift("start", state);
1019 <+=?|> }
1020 <+=?|> else if (val == "}" && stack.length) {
1021 <+=?|> stack.shift();
1022 <+=?|> this.next = stack.shift();
1023 <+=?|> if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
1024 <+=?|> return "paren.quasi.end";
1025 <+=?|> }
1026 <+=?|> return val == "{" ? "paren.lparen" : "paren.rparen";
1027 <+=?|> },
1028 <+=?|> nextState: "start"
1029 <+=?|> }, {
1030 <+=?|> token : "string.quasi.start",
1031 <+=?|> regex : /`/,
1032 <+=?|> push : [{
1033 <+=?|> token : "constant.language.escape",
1034 <+=?|> regex : escapedRe
1035 <+=?|> }, {
1036 <+=?|> token : "paren.quasi.start",
1037 <+=?|> regex : /\${/,
1038 <+=?|> push : "start"
1039 <+=?|> }, {
1040 <+=?|> token : "string.quasi.end",
1041 <+=?|> regex : /`/,
1042 <+=?|> next : "pop"
1043 <+=?|> }, {
1044 <+=?|> defaultToken: "string.quasi"
1045 <+=?|> }]
1046 <+=?|> });
1047  
1048 <+=?|> if (!options || options.jsx != false)
1049 <+=?|> JSX.call(this);
1050 <+=?|> }
1051  
1052 <+=?|> this.embedRules(DocCommentHighlightRules, "doc-",
1053 <+=?|> [ DocCommentHighlightRules.getEndRule("no_regex") ]);
1054  
1055 <+=?|> this.normalizeRules();
1056 <+=?|>};
1057  
1058 <+=?|>oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
1059  
1060 <+=?|>function JSX() {
1061 <+=?|> var tagRegex = identifierRe.replace("\\d", "\\d\\-");
1062 <+=?|> var jsxTag = {
1063 <+=?|> onMatch : function(val, state, stack) {
1064 <+=?|> var offset = val.charAt(1) == "/" ? 2 : 1;
1065 <+=?|> if (offset == 1) {
1066 <+=?|> if (state != this.nextState)
1067 <+=?|> stack.unshift(this.next, this.nextState, 0);
1068 <+=?|> else
1069 <+=?|> stack.unshift(this.next);
1070 <+=?|> stack[2]++;
1071 <+=?|> } else if (offset == 2) {
1072 <+=?|> if (state == this.nextState) {
1073 <+=?|> stack[1]--;
1074 <+=?|> if (!stack[1] || stack[1] < 0) {
1075 <+=?|> stack.shift();
1076 <+=?|> stack.shift();
1077 <+=?|> }
1078 <+=?|> }
1079 <+=?|> }
1080 <+=?|> return [{
1081 <+=?|> type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
1082 <+=?|> value: val.slice(0, offset)
1083 <+=?|> }, {
1084 <+=?|> type: "meta.tag.tag-name.xml",
1085 <+=?|> value: val.substr(offset)
1086 <+=?|> }];
1087 <+=?|> },
1088 <+=?|> regex : "</?" + tagRegex + "",
1089 <+=?|> next: "jsxAttributes",
1090 <+=?|> nextState: "jsx"
1091 <+=?|> };
1092 <+=?|> this.$rules.start.unshift(jsxTag);
1093 <+=?|> var jsxJsRule = {
1094 <+=?|> regex: "{",
1095 <+=?|> token: "paren.quasi.start",
1096 <+=?|> push: "start"
1097 <+=?|> };
1098 <+=?|> this.$rules.jsx = [
1099 <+=?|> jsxJsRule,
1100 <+=?|> jsxTag,
1101 <+=?|> {include : "reference"},
1102 <+=?|> {defaultToken: "string"}
1103 <+=?|> ];
1104 <+=?|> this.$rules.jsxAttributes = [{
1105 <+=?|> token : "meta.tag.punctuation.tag-close.xml",
1106 <+=?|> regex : "/?>",
1107 <+=?|> onMatch : function(value, currentState, stack) {
1108 <+=?|> if (currentState == stack[0])
1109 <+=?|> stack.shift();
1110 <+=?|> if (value.length == 2) {
1111 <+=?|> if (stack[0] == this.nextState)
1112 <+=?|> stack[1]--;
1113 <+=?|> if (!stack[1] || stack[1] < 0) {
1114 <+=?|> stack.splice(0, 2);
1115 <+=?|> }
1116 <+=?|> }
1117 <+=?|> this.next = stack[0] || "start";
1118 <+=?|> return [{type: this.token, value: value}];
1119 <+=?|> },
1120 <+=?|> nextState: "jsx"
1121 <+=?|> },
1122 <+=?|> jsxJsRule,
1123 <+=?|> comments("jsxAttributes"),
1124 <+=?|> {
1125 <+=?|> token : "entity.other.attribute-name.xml",
1126 <+=?|> regex : tagRegex
1127 <+=?|> }, {
1128 <+=?|> token : "keyword.operator.attribute-equals.xml",
1129 <+=?|> regex : "="
1130 <+=?|> }, {
1131 <+=?|> token : "text.tag-whitespace.xml",
1132 <+=?|> regex : "\\s+"
1133 <+=?|> }, {
1134 <+=?|> token : "string.attribute-value.xml",
1135 <+=?|> regex : "'",
1136 <+=?|> stateName : "jsx_attr_q",
1137 <+=?|> push : [
1138 <+=?|> {token : "string.attribute-value.xml", regex: "'", next: "pop"},
1139 <+=?|> {include : "reference"},
1140 <+=?|> {defaultToken : "string.attribute-value.xml"}
1141 <+=?|> ]
1142 <+=?|> }, {
1143 <+=?|> token : "string.attribute-value.xml",
1144 <+=?|> regex : '"',
1145 <+=?|> stateName : "jsx_attr_qq",
1146 <+=?|> push : [
1147 <+=?|> {token : "string.attribute-value.xml", regex: '"', next: "pop"},
1148 <+=?|> {include : "reference"},
1149 <+=?|> {defaultToken : "string.attribute-value.xml"}
1150 <+=?|> ]
1151 <+=?|> },
1152 <+=?|> jsxTag
1153 <+=?|> ];
1154 <+=?|> this.$rules.reference = [{
1155 <+=?|> token : "constant.language.escape.reference.xml",
1156 <+=?|> regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1157 <+=?|> }];
1158 <+=?|>}
1159  
1160 <+=?|>function comments(next) {
1161 <+=?|> return [
1162 <+=?|> {
1163 <+=?|> token : "comment", // multi line comment
1164 <+=?|> regex : /\/\*/,
1165 <+=?|> next: [
1166 <+=?|> DocCommentHighlightRules.getTagRule(),
1167 <+=?|> {token : "comment", regex : "\\*\\/", next : next || "pop"},
1168 <+=?|> {defaultToken : "comment", caseInsensitive: true}
1169 <+=?|> ]
1170 <+=?|> }, {
1171 <+=?|> token : "comment",
1172 <+=?|> regex : "\\/\\/",
1173 <+=?|> next: [
1174 <+=?|> DocCommentHighlightRules.getTagRule(),
1175 <+=?|> {token : "comment", regex : "$|^", next : next || "pop"},
1176 <+=?|> {defaultToken : "comment", caseInsensitive: true}
1177 <+=?|> ]
1178 <+=?|> }
1179 <+=?|> ];
1180 <+=?|>}
1181 <+=?|>exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
1182 <+=?|>});
1183  
1184 <+=?|>define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
1185 <+=?|>"use strict";
1186  
1187 <+=?|>var Range = require("../range").Range;
1188  
1189 <+=?|>var MatchingBraceOutdent = function() {};
1190  
1191 <+=?|>(function() {
1192  
1193 <+=?|> this.checkOutdent = function(line, input) {
1194 <+=?|> if (! /^\s+$/.test(line))
1195 <+=?|> return false;
1196  
1197 <+=?|> return /^\s*\}/.test(input);
1198 <+=?|> };
1199  
1200 <+=?|> this.autoOutdent = function(doc, row) {
1201 <+=?|> var line = doc.getLine(row);
1202 <+=?|> var match = line.match(/^(\s*\})/);
1203  
1204 <+=?|> if (!match) return 0;
1205  
1206 <+=?|> var column = match[1].length;
1207 <+=?|> var openBracePos = doc.findMatchingBracket({row: row, column: column});
1208  
1209 <+=?|> if (!openBracePos || openBracePos.row == row) return 0;
1210  
1211 <+=?|> var indent = this.$getIndent(doc.getLine(openBracePos.row));
1212 <+=?|> doc.replace(new Range(row, 0, row, column-1), indent);
1213 <+=?|> };
1214  
1215 <+=?|> this.$getIndent = function(line) {
1216 <+=?|> return line.match(/^\s*/)[0];
1217 <+=?|> };
1218  
1219 <+=?|>}).call(MatchingBraceOutdent.prototype);
1220  
1221 <+=?|>exports.MatchingBraceOutdent = MatchingBraceOutdent;
1222 <+=?|>});
1223  
1224 <+=?|>define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
1225 <+=?|>"use strict";
1226  
1227 <+=?|>var oop = require("../../lib/oop");
1228 <+=?|>var Range = require("../../range").Range;
1229 <+=?|>var BaseFoldMode = require("./fold_mode").FoldMode;
1230  
1231 <+=?|>var FoldMode = exports.FoldMode = function(commentRegex) {
1232 <+=?|> if (commentRegex) {
1233 <+=?|> this.foldingStartMarker = new RegExp(
1234 <+=?|> this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
1235 <+=?|> );
1236 <+=?|> this.foldingStopMarker = new RegExp(
1237 <+=?|> this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
1238 <+=?|> );
1239 <+=?|> }
1240 <+=?|>};
1241 <+=?|>oop.inherits(FoldMode, BaseFoldMode);
1242  
1243 <+=?|>(function() {
1244  
1245 <+=?|> this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
1246 <+=?|> this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
1247 <+=?|> this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
1248 <+=?|> this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
1249 <+=?|> this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
1250 <+=?|> this._getFoldWidgetBase = this.getFoldWidget;
1251 <+=?|> this.getFoldWidget = function(session, foldStyle, row) {
1252 <+=?|> var line = session.getLine(row);
1253  
1254 <+=?|> if (this.singleLineBlockCommentRe.test(line)) {
1255 <+=?|> if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
1256 <+=?|> return "";
1257 <+=?|> }
1258  
1259 <+=?|> var fw = this._getFoldWidgetBase(session, foldStyle, row);
1260  
1261 <+=?|> if (!fw && this.startRegionRe.test(line))
1262 <+=?|> return "start"; // lineCommentRegionStart
1263  
1264 <+=?|> return fw;
1265 <+=?|> };
1266  
1267 <+=?|> this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
1268 <+=?|> var line = session.getLine(row);
1269  
1270 <+=?|> if (this.startRegionRe.test(line))
1271 <+=?|> return this.getCommentRegionBlock(session, line, row);
1272  
1273 <+=?|> var match = line.match(this.foldingStartMarker);
1274 <+=?|> if (match) {
1275 <+=?|> var i = match.index;
1276  
1277 <+=?|> if (match[1])
1278 <+=?|> return this.openingBracketBlock(session, match[1], row, i);
1279  
1280 <+=?|> var range = session.getCommentFoldRange(row, i + match[0].length, 1);
1281  
1282 <+=?|> if (range && !range.isMultiLine()) {
1283 <+=?|> if (forceMultiline) {
1284 <+=?|> range = this.getSectionRange(session, row);
1285 <+=?|> } else if (foldStyle != "all")
1286 <+=?|> range = null;
1287 <+=?|> }
1288  
1289 <+=?|> return range;
1290 <+=?|> }
1291  
1292 <+=?|> if (foldStyle === "markbegin")
1293 <+=?|> return;
1294  
1295 <+=?|> var match = line.match(this.foldingStopMarker);
1296 <+=?|> if (match) {
1297 <+=?|> var i = match.index + match[0].length;
1298  
1299 <+=?|> if (match[1])
1300 <+=?|> return this.closingBracketBlock(session, match[1], row, i);
1301  
1302 <+=?|> return session.getCommentFoldRange(row, i, -1);
1303 <+=?|> }
1304 <+=?|> };
1305  
1306 <+=?|> this.getSectionRange = function(session, row) {
1307 <+=?|> var line = session.getLine(row);
1308 <+=?|> var startIndent = line.search(/\S/);
1309 <+=?|> var startRow = row;
1310 <+=?|> var startColumn = line.length;
1311 <+=?|> row = row + 1;
1312 <+=?|> var endRow = row;
1313 <+=?|> var maxRow = session.getLength();
1314 <+=?|> while (++row < maxRow) {
1315 <+=?|> line = session.getLine(row);
1316 <+=?|> var indent = line.search(/\S/);
1317 <+=?|> if (indent === -1)
1318 <+=?|> continue;
1319 <+=?|> if (startIndent > indent)
1320 <+=?|> break;
1321 <+=?|> var subRange = this.getFoldWidgetRange(session, "all", row);
1322  
1323 <+=?|> if (subRange) {
1324 <+=?|> if (subRange.start.row <= startRow) {
1325 <+=?|> break;
1326 <+=?|> } else if (subRange.isMultiLine()) {
1327 <+=?|> row = subRange.end.row;
1328 <+=?|> } else if (startIndent == indent) {
1329 <+=?|> break;
1330 <+=?|> }
1331 <+=?|> }
1332 <+=?|> endRow = row;
1333 <+=?|> }
1334  
1335 <+=?|> return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
1336 <+=?|> };
1337 <+=?|> this.getCommentRegionBlock = function(session, line, row) {
1338 <+=?|> var startColumn = line.search(/\s*$/);
1339 <+=?|> var maxRow = session.getLength();
1340 <+=?|> var startRow = row;
1341  
1342 <+=?|> var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
1343 <+=?|> var depth = 1;
1344 <+=?|> while (++row < maxRow) {
1345 <+=?|> line = session.getLine(row);
1346 <+=?|> var m = re.exec(line);
1347 <+=?|> if (!m) continue;
1348 <+=?|> if (m[1]) depth--;
1349 <+=?|> else depth++;
1350  
1351 <+=?|> if (!depth) break;
1352 <+=?|> }
1353  
1354 <+=?|> var endRow = row;
1355 <+=?|> if (endRow > startRow) {
1356 <+=?|> return new Range(startRow, startColumn, endRow, line.length);
1357 <+=?|> }
1358 <+=?|> };
1359  
1360 <+=?|>}).call(FoldMode.prototype);
1361  
1362 <+=?|>});
1363  
1364 <+=?|>define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
1365 <+=?|>"use strict";
1366  
1367 <+=?|>var oop = require("../lib/oop");
1368 <+=?|>var TextMode = require("./text").Mode;
1369 <+=?|>var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1370 <+=?|>var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1371 <+=?|>var WorkerClient = require("../worker/worker_client").WorkerClient;
1372 <+=?|>var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
1373 <+=?|>var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1374  
1375 <+=?|>var Mode = function() {
1376 <+=?|> this.HighlightRules = JavaScriptHighlightRules;
1377  
1378 <+=?|> this.$outdent = new MatchingBraceOutdent();
1379 <+=?|> this.$behaviour = new CstyleBehaviour();
1380 <+=?|> this.foldingRules = new CStyleFoldMode();
1381 <+=?|>};
1382 <+=?|>oop.inherits(Mode, TextMode);
1383  
1384 <+=?|>(function() {
1385  
1386 <+=?|> this.lineCommentStart = "//";
1387 <+=?|> this.blockComment = {start: "/*", end: "*/"};
1388  
1389 <+=?|> this.getNextLineIndent = function(state, line, tab) {
1390 <+=?|> var indent = this.$getIndent(line);
1391  
1392 <+=?|> var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
1393 <+=?|> var tokens = tokenizedLine.tokens;
1394 <+=?|> var endState = tokenizedLine.state;
1395  
1396 <+=?|> if (tokens.length && tokens[tokens.length-1].type == "comment") {
1397 <+=?|> return indent;
1398 <+=?|> }
1399  
1400 <+=?|> if (state == "start" || state == "no_regex") {
1401 <+=?|> var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
1402 <+=?|> if (match) {
1403 <+=?|> indent += tab;
1404 <+=?|> }
1405 <+=?|> } else if (state == "doc-start") {
1406 <+=?|> if (endState == "start" || endState == "no_regex") {
1407 <+=?|> return "";
1408 <+=?|> }
1409 <+=?|> var match = line.match(/^\s*(\/?)\*/);
1410 <+=?|> if (match) {
1411 <+=?|> if (match[1]) {
1412 <+=?|> indent += " ";
1413 <+=?|> }
1414 <+=?|> indent += "* ";
1415 <+=?|> }
1416 <+=?|> }
1417  
1418 <+=?|> return indent;
1419 <+=?|> };
1420  
1421 <+=?|> this.checkOutdent = function(state, line, input) {
1422 <+=?|> return this.$outdent.checkOutdent(line, input);
1423 <+=?|> };
1424  
1425 <+=?|> this.autoOutdent = function(state, doc, row) {
1426 <+=?|> this.$outdent.autoOutdent(doc, row);
1427 <+=?|> };
1428  
1429 <+=?|> this.createWorker = function(session) {
1430 <+=?|> var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
1431 <+=?|> worker.attachToDocument(session.getDocument());
1432  
1433 <+=?|> worker.on("annotate", function(results) {
1434 <+=?|> session.setAnnotations(results.data);
1435 <+=?|> });
1436  
1437 <+=?|> worker.on("terminate", function() {
1438 <+=?|> session.clearAnnotations();
1439 <+=?|> });
1440  
1441 <+=?|> return worker;
1442 <+=?|> };
1443  
1444 <+=?|> this.$id = "ace/mode/javascript";
1445 <+=?|>}).call(Mode.prototype);
1446  
1447 <+=?|>exports.Mode = Mode;
1448 <+=?|>});
1449  
1450 <+=?|>define("ace/mode/svg_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(require, exports, module) {
1451 <+=?|>"use strict";
1452  
1453 <+=?|>var oop = require("../lib/oop");
1454 <+=?|>var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1455 <+=?|>var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
1456  
1457 <+=?|>var SvgHighlightRules = function() {
1458 <+=?|> XmlHighlightRules.call(this);
1459  
1460 <+=?|> this.embedTagRules(JavaScriptHighlightRules, "js-", "script");
1461  
1462 <+=?|> this.normalizeRules();
1463 <+=?|>};
1464  
1465 <+=?|>oop.inherits(SvgHighlightRules, XmlHighlightRules);
1466  
1467 <+=?|>exports.SvgHighlightRules = SvgHighlightRules;
1468 <+=?|>});
1469  
1470 <+=?|>define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) {
1471 <+=?|>"use strict";
1472  
1473 <+=?|>var oop = require("../../lib/oop");
1474 <+=?|>var BaseFoldMode = require("./fold_mode").FoldMode;
1475  
1476 <+=?|>var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
1477 <+=?|> this.defaultMode = defaultMode;
1478 <+=?|> this.subModes = subModes;
1479 <+=?|>};
1480 <+=?|>oop.inherits(FoldMode, BaseFoldMode);
1481  
1482 <+=?|>(function() {
1483  
1484  
1485 <+=?|> this.$getMode = function(state) {
1486 <+=?|> if (typeof state != "string")
1487 <+=?|> state = state[0];
1488 <+=?|> for (var key in this.subModes) {
1489 <+=?|> if (state.indexOf(key) === 0)
1490 <+=?|> return this.subModes[key];
1491 <+=?|> }
1492 <+=?|> return null;
1493 <+=?|> };
1494  
1495 <+=?|> this.$tryMode = function(state, session, foldStyle, row) {
1496 <+=?|> var mode = this.$getMode(state);
1497 <+=?|> return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
1498 <+=?|> };
1499  
1500 <+=?|> this.getFoldWidget = function(session, foldStyle, row) {
1501 <+=?|> return (
1502 <+=?|> this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
1503 <+=?|> this.$tryMode(session.getState(row), session, foldStyle, row) ||
1504 <+=?|> this.defaultMode.getFoldWidget(session, foldStyle, row)
1505 <+=?|> );
1506 <+=?|> };
1507  
1508 <+=?|> this.getFoldWidgetRange = function(session, foldStyle, row) {
1509 <+=?|> var mode = this.$getMode(session.getState(row-1));
1510  
1511 <+=?|> if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1512 <+=?|> mode = this.$getMode(session.getState(row));
1513  
1514 <+=?|> if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1515 <+=?|> mode = this.defaultMode;
1516  
1517 <+=?|> return mode.getFoldWidgetRange(session, foldStyle, row);
1518 <+=?|> };
1519  
1520 <+=?|>}).call(FoldMode.prototype);
1521  
1522 <+=?|>});
1523  
1524 <+=?|>define("ace/mode/svg",["require","exports","module","ace/lib/oop","ace/mode/xml","ace/mode/javascript","ace/mode/svg_highlight_rules","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"], function(require, exports, module) {
1525 <+=?|>"use strict";
1526  
1527 <+=?|>var oop = require("../lib/oop");
1528 <+=?|>var XmlMode = require("./xml").Mode;
1529 <+=?|>var JavaScriptMode = require("./javascript").Mode;
1530 <+=?|>var SvgHighlightRules = require("./svg_highlight_rules").SvgHighlightRules;
1531 <+=?|>var MixedFoldMode = require("./folding/mixed").FoldMode;
1532 <+=?|>var XmlFoldMode = require("./folding/xml").FoldMode;
1533 <+=?|>var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1534  
1535 <+=?|>var Mode = function() {
1536 <+=?|> XmlMode.call(this);
1537  
1538 <+=?|> this.HighlightRules = SvgHighlightRules;
1539  
1540 <+=?|> this.createModeDelegates({
1541 <+=?|> "js-": JavaScriptMode
1542 <+=?|> });
1543  
1544 <+=?|> this.foldingRules = new MixedFoldMode(new XmlFoldMode(), {
1545 <+=?|> "js-": new CStyleFoldMode()
1546 <+=?|> });
1547 <+=?|>};
1548  
1549 <+=?|>oop.inherits(Mode, XmlMode);
1550  
1551 <+=?|>(function() {
1552  
1553 <+=?|> this.getNextLineIndent = function(state, line, tab) {
1554 <+=?|> return this.$getIndent(line);
1555 <+=?|> };
1556  
1557  
1558 <+=?|> this.$id = "ace/mode/svg";
1559 <+=?|>}).call(Mode.prototype);
1560  
1561 <+=?|>exports.Mode = Mode;
1562 <+=?|>});