Debian Codegraph @

extensions/CodeEditor/modules/lib/ace/mode-ejs.js

raw symbols SCIP
1 ace.define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
2 var oop = require("../lib/oop");
3 var lang = require("../lib/lang");
4 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
5 var supportType = exports.supportType = "align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|max-zoom|min-height|min-width|min-zoom|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|user-zoom|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index";
6 var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
7 var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|flex-end|flex-start|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero|zoom";
8 var supportConstantColor = exports.supportConstantColor = "aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen";
9 var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
10 var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
11 var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
12 var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
13 var CssHighlightRules = function () {
14 var keywordMapper = this.createKeywordMapper({
15 "support.function": supportFunction,
16 "support.constant": supportConstant,
17 "support.type": supportType,
18 "support.constant.color": supportConstantColor,
19 "support.constant.fonts": supportConstantFonts
20 }, "text", true);
21 this.$rules = {
22 "start": [{
23 include: ["strings", "url", "comments"]
24 }, {
25 token: "paren.lparen",
26 regex: "\\{",
27 next: "ruleset"
28 }, {
29 token: "paren.rparen",
30 regex: "\\}"
31 }, {
32 token: "string",
33 regex: "@(?!viewport)",
34 next: "media"
35 }, {
36 token: "keyword",
37 regex: "#[a-z0-9-_]+"
38 }, {
39 token: "keyword",
40 regex: "%"
41 }, {
42 token: "variable",
43 regex: "\\.[a-z0-9-_]+"
44 }, {
45 token: "string",
46 regex: ":[a-z0-9-_]+"
47 }, {
48 token: "constant.numeric",
49 regex: numRe
50 }, {
51 token: "constant",
52 regex: "[a-z0-9-_]+"
53 }, {
54 caseInsensitive: true
55 }],
56 "media": [{
57 include: ["strings", "url", "comments"]
58 }, {
59 token: "paren.lparen",
60 regex: "\\{",
61 next: "start"
62 }, {
63 token: "paren.rparen",
64 regex: "\\}",
65 next: "start"
66 }, {
67 token: "string",
68 regex: ";",
69 next: "start"
70 }, {
71 token: "keyword",
72 regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
73 + "|page|font|keyframes|viewport|counter-style|font-feature-values"
74 + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
75 }],
76 "comments": [{
77 token: "comment", // multi line comment
78 regex: "\\/\\*",
79 push: [{
80 token: "comment",
81 regex: "\\*\\/",
82 next: "pop"
83 }, {
84 defaultToken: "comment"
85 }]
86 }],
87 "ruleset": [{
88 regex: "-(webkit|ms|moz|o)-",
89 token: "text"
90 }, {
91 token: "punctuation.operator",
92 regex: "[:;]"
93 }, {
94 token: "paren.rparen",
95 regex: "\\}",
96 next: "start"
97 }, {
98 include: ["strings", "url", "comments"]
99 }, {
100 token: ["constant.numeric", "keyword"],
101 regex: "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)"
102 }, {
103 token: "constant.numeric",
104 regex: numRe
105 }, {
106 token: "constant.numeric", // hex6 color
107 regex: "#[a-f0-9]{6}"
108 }, {
109 token: "constant.numeric", // hex3 color
110 regex: "#[a-f0-9]{3}"
111 }, {
112 token: ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
113 regex: pseudoElements
114 }, {
115 token: ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
116 regex: pseudoClasses
117 }, {
118 include: "url"
119 }, {
120 token: keywordMapper,
121 regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
122 }, {
123 caseInsensitive: true
124 }],
125 url: [{
126 token: "support.function",
127 regex: "(?:url(:?-prefix)?|domain|regexp)\\(",
128 push: [{
129 token: "support.function",
130 regex: "\\)",
131 next: "pop"
132 }, {
133 defaultToken: "string"
134 }]
135 }],
136 strings: [{
137 token: "string.start",
138 regex: "'",
139 push: [{
140 token: "string.end",
141 regex: "'|$",
142 next: "pop"
143 }, {
144 include: "escapes"
145 }, {
146 token: "constant.language.escape",
147 regex: /\\$/,
148 consumeLineEnd: true
149 }, {
150 defaultToken: "string"
151 }]
152 }, {
153 token: "string.start",
154 regex: '"',
155 push: [{
156 token: "string.end",
157 regex: '"|$',
158 next: "pop"
159 }, {
160 include: "escapes"
161 }, {
162 token: "constant.language.escape",
163 regex: /\\$/,
164 consumeLineEnd: true
165 }, {
166 defaultToken: "string"
167 }]
168 }],
169 escapes: [{
170 token: "constant.language.escape",
171 regex: /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
172 }]
173 };
174 this.normalizeRules();
175 };
176 oop.inherits(CssHighlightRules, TextHighlightRules);
177 exports.CssHighlightRules = CssHighlightRules;
178
179 });
180
181 ace.define("ace/mode/jsdoc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
182 var oop = require("../lib/oop");
183 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
184 var JsDocCommentHighlightRules = function () {
185 this.$rules = {
186 "start": [
187 {
188 token: ["comment.doc.tag", "comment.doc.text", "lparen.doc"],
189 regex: "(@(?:param|member|typedef|property|namespace|var|const|callback))(\\s*)({)",
190 push: [
191 {
192 token: "lparen.doc",
193 regex: "{",
194 push: [
195 {
196 include: "doc-syntax"
197 }, {
198 token: "rparen.doc",
199 regex: "}|(?=$)",
200 next: "pop"
201 }
202 ]
203 }, {
204 token: ["rparen.doc", "text.doc", "variable.parameter.doc", "lparen.doc", "variable.parameter.doc", "rparen.doc"],
205 regex: /(})(\s*)(?:([\w=:\/\.]+)|(?:(\[)([\w=:\/\.]+)(\])))/,
206 next: "pop"
207 }, {
208 token: "rparen.doc",
209 regex: "}|(?=$)",
210 next: "pop"
211 }, {
212 include: "doc-syntax"
213 }, {
214 defaultToken: "text.doc"
215 }
216 ]
217 }, {
218 token: ["comment.doc.tag", "text.doc", "lparen.doc"],
219 regex: "(@(?:returns?|yields|type|this|suppress|public|protected|private|package|modifies|"
220 + "implements|external|exception|throws|enum|define|extends))(\\s*)({)",
221 push: [
222 {
223 token: "lparen.doc",
224 regex: "{",
225 push: [
226 {
227 include: "doc-syntax"
228 }, {
229 token: "rparen.doc",
230 regex: "}|(?=$)",
231 next: "pop"
232 }
233 ]
234 }, {
235 token: "rparen.doc",
236 regex: "}|(?=$)",
237 next: "pop"
238 }, {
239 include: "doc-syntax"
240 }, {
241 defaultToken: "text.doc"
242 }
243 ]
244 }, {
245 token: ["comment.doc.tag", "text.doc", "variable.parameter.doc"],
246 regex: "(@(?:alias|memberof|instance|module|name|lends|namespace|external|this|template|"
247 + "requires|param|implements|function|extends|typedef|mixes|constructor|var|"
248 + "memberof\\!|event|listens|exports|class|constructs|interface|emits|fires|"
249 + "throws|const|callback|borrows|augments))(\\s+)(\\w[\\w#\.:\/~\"\\-]*)?"
250 }, {
251 token: ["comment.doc.tag", "text.doc", "variable.parameter.doc"],
252 regex: "(@method)(\\s+)(\\w[\\w\.\\(\\)]*)"
253 }, {
254 token: "comment.doc.tag",
255 regex: "@access\\s+(?:private|public|protected)"
256 }, {
257 token: "comment.doc.tag",
258 regex: "@kind\\s+(?:class|constant|event|external|file|function|member|mixin|module|namespace|typedef)"
259 }, {
260 token: "comment.doc.tag",
261 regex: "@\\w+(?=\\s|$)"
262 },
263 JsDocCommentHighlightRules.getTagRule(),
264 {
265 defaultToken: "comment.doc",
266 caseInsensitive: true
267 }
268 ],
269 "doc-syntax": [{
270 token: "operator.doc",
271 regex: /[|:]/
272 }, {
273 token: "paren.doc",
274 regex: /[\[\]]/
275 }]
276 };
277 this.normalizeRules();
278 };
279 oop.inherits(JsDocCommentHighlightRules, TextHighlightRules);
280 JsDocCommentHighlightRules.getTagRule = function (start) {
281 return {
282 token: "comment.doc.tag.storage.type",
283 regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b"
284 };
285 };
286 JsDocCommentHighlightRules.getStartRule = function (start) {
287 return {
288 token: "comment.doc", // doc comment
289 regex: "\\/\\*(?=\\*)",
290 next: start
291 };
292 };
293 JsDocCommentHighlightRules.getEndRule = function (start) {
294 return {
295 token: "comment.doc", // closing comment
296 regex: "\\*\\/",
297 next: start
298 };
299 };
300 exports.JsDocCommentHighlightRules = JsDocCommentHighlightRules;
301
302 });
303
304 ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/jsdoc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
305 var oop = require("../lib/oop");
306 var DocCommentHighlightRules = require("./jsdoc_comment_highlight_rules").JsDocCommentHighlightRules;
307 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
308 var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
309 var JavaScriptHighlightRules = function (options) {
310 var keywordMapper = this.createKeywordMapper({
311 "variable.language": "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Symbol|" + // Constructors
312 "Namespace|QName|XML|XMLList|" + // E4X
313 "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
314 "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
315 "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
316 "SyntaxError|TypeError|URIError|" +
317 "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
318 "isNaN|parseFloat|parseInt|" +
319 "JSON|Math|" + // Other
320 "this|arguments|prototype|window|document", // Pseudo
321 "keyword": "const|yield|import|get|set|async|await|" +
322 "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
323 "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
324 "__parent__|__count__|escape|unescape|with|__proto__|" +
325 "class|enum|extends|super|export|implements|private|public|interface|package|protected|static|constructor",
326 "storage.type": "const|let|var|function",
327 "constant.language": "null|Infinity|NaN|undefined",
328 "support.function": "alert",
329 "constant.language.boolean": "true|false"
330 }, "identifier");
331 var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
332 var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
333 "u[0-9a-fA-F]{4}|" + // unicode
334 "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
335 "[0-2][0-7]{0,2}|" + // oct
336 "3[0-7][0-7]?|" + // oct
337 "[4-7][0-7]?|" + //oct
338 ".)";
339 this.$rules = {
340 "no_regex": [
341 DocCommentHighlightRules.getStartRule("doc-start"),
342 comments("no_regex"),
343 {
344 token: "string",
345 regex: "'(?=.)",
346 next: "qstring"
347 }, {
348 token: "string",
349 regex: '"(?=.)',
350 next: "qqstring"
351 }, {
352 token: "constant.numeric", // hexadecimal, octal and binary
353 regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
354 }, {
355 token: "constant.numeric", // decimal integers and floats
356 regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
357 }, {
358 token: [
359 "storage.type", "punctuation.operator", "support.function",
360 "punctuation.operator", "entity.name.function", "text", "keyword.operator"
361 ],
362 regex: "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe + ")(\\s*)(=)",
363 next: "function_arguments"
364 }, {
365 token: [
366 "storage.type", "punctuation.operator", "entity.name.function", "text",
367 "keyword.operator", "text", "storage.type", "text", "paren.lparen"
368 ],
369 regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function\\*?)(\\s*)(\\()",
370 next: "function_arguments"
371 }, {
372 token: [
373 "entity.name.function", "text", "keyword.operator", "text", "storage.type",
374 "text", "paren.lparen"
375 ],
376 regex: "(" + identifierRe + ")(\\s*)(=)(\\s*)(function\\*?)(\\s*)(\\()",
377 next: "function_arguments"
378 }, {
379 token: [
380 "storage.type", "punctuation.operator", "entity.name.function", "text",
381 "keyword.operator", "text",
382 "storage.type", "text", "entity.name.function", "text", "paren.lparen"
383 ],
384 regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function\\*?)(\\s+)(\\w+)(\\s*)(\\()",
385 next: "function_arguments"
386 }, {
387 token: [
388 "storage.type", "text", "entity.name.function", "text", "paren.lparen"
389 ],
390 regex: "(function\\*?)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
391 next: "function_arguments"
392 }, {
393 token: [
394 "entity.name.function", "text", "punctuation.operator",
395 "text", "storage.type", "text", "paren.lparen"
396 ],
397 regex: "(" + identifierRe + ")(\\s*)(:)(\\s*)(function\\*?)(\\s*)(\\()",
398 next: "function_arguments"
399 }, {
400 token: [
401 "text", "text", "storage.type", "text", "paren.lparen"
402 ],
403 regex: "(:)(\\s*)(function\\*?)(\\s*)(\\()",
404 next: "function_arguments"
405 }, {
406 token: "keyword",
407 regex: "from(?=\\s*('|\"))"
408 }, {
409 token: "keyword",
410 regex: "(?:" + kwBeforeRe + ")\\b",
411 next: "start"
412 }, {
413 token: "support.constant",
414 regex: /that\b/
415 }, {
416 token: ["storage.type", "punctuation.operator", "support.function.firebug"],
417 regex: /(console)(\.)(warn|info|log|error|debug|time|trace|timeEnd|assert)\b/
418 }, {
419 token: keywordMapper,
420 regex: identifierRe
421 }, {
422 token: "punctuation.operator",
423 regex: /[.](?![.])/,
424 next: "property"
425 }, {
426 token: "storage.type",
427 regex: /=>/,
428 next: "start"
429 }, {
430 token: "keyword.operator",
431 regex: /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
432 next: "start"
433 }, {
434 token: "punctuation.operator",
435 regex: /[?:,;.]/,
436 next: "start"
437 }, {
438 token: "paren.lparen",
439 regex: /[\[({]/,
440 next: "start"
441 }, {
442 token: "paren.rparen",
443 regex: /[\])}]/
444 }, {
445 token: "comment",
446 regex: /^#!.*$/
447 }
448 ],
449 property: [{
450 token: "text",
451 regex: "\\s+"
452 }, {
453 token: [
454 "storage.type", "punctuation.operator", "entity.name.function", "text",
455 "keyword.operator", "text",
456 "storage.type", "text", "entity.name.function", "text", "paren.lparen"
457 ],
458 regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function\\*?)(?:(\\s+)(\\w+))?(\\s*)(\\()",
459 next: "function_arguments"
460 }, {
461 token: "punctuation.operator",
462 regex: /[.](?![.])/
463 }, {
464 token: "support.function",
465 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|lter|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward|rEach)|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(?=\()/
466 }, {
467 token: "support.function.dom",
468 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(?=\()/
469 }, {
470 token: "support.constant",
471 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/
472 }, {
473 token: "identifier",
474 regex: identifierRe
475 }, {
476 regex: "",
477 token: "empty",
478 next: "no_regex"
479 }
480 ],
481 "start": [
482 DocCommentHighlightRules.getStartRule("doc-start"),
483 comments("start"),
484 {
485 token: "string.regexp",
486 regex: "\\/",
487 next: "regex"
488 }, {
489 token: "text",
490 regex: "\\s+|^$",
491 next: "start"
492 }, {
493 token: "empty",
494 regex: "",
495 next: "no_regex"
496 }
497 ],
498 "regex": [
499 {
500 token: "regexp.keyword.operator",
501 regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
502 }, {
503 token: "string.regexp",
504 regex: "/[sxngimy]*",
505 next: "no_regex"
506 }, {
507 token: "invalid",
508 regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
509 }, {
510 token: "constant.language.escape",
511 regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
512 }, {
513 token: "constant.language.delimiter",
514 regex: /\|/
515 }, {
516 token: "constant.language.escape",
517 regex: /\[\^?/,
518 next: "regex_character_class"
519 }, {
520 token: "empty",
521 regex: "$",
522 next: "no_regex"
523 }, {
524 defaultToken: "string.regexp"
525 }
526 ],
527 "regex_character_class": [
528 {
529 token: "regexp.charclass.keyword.operator",
530 regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
531 }, {
532 token: "constant.language.escape",
533 regex: "]",
534 next: "regex"
535 }, {
536 token: "constant.language.escape",
537 regex: "-"
538 }, {
539 token: "empty",
540 regex: "$",
541 next: "no_regex"
542 }, {
543 defaultToken: "string.regexp.charachterclass"
544 }
545 ],
546 "default_parameter": [
547 {
548 token: "string",
549 regex: "'(?=.)",
550 push: [
551 {
552 token: "string",
553 regex: "'|$",
554 next: "pop"
555 }, {
556 include: "qstring"
557 }
558 ]
559 }, {
560 token: "string",
561 regex: '"(?=.)',
562 push: [
563 {
564 token: "string",
565 regex: '"|$',
566 next: "pop"
567 }, {
568 include: "qqstring"
569 }
570 ]
571 }, {
572 token: "constant.language",
573 regex: "null|Infinity|NaN|undefined"
574 }, {
575 token: "constant.numeric", // hexadecimal, octal and binary
576 regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
577 }, {
578 token: "constant.numeric", // decimal integers and floats
579 regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
580 }, {
581 token: "punctuation.operator",
582 regex: ",",
583 next: "function_arguments"
584 }, {
585 token: "text",
586 regex: "\\s+"
587 }, {
588 token: "punctuation.operator",
589 regex: "$"
590 }, {
591 token: "empty",
592 regex: "",
593 next: "no_regex"
594 }
595 ],
596 "function_arguments": [
597 comments("function_arguments"),
598 {
599 token: "variable.parameter",
600 regex: identifierRe
601 }, {
602 token: "punctuation.operator",
603 regex: ","
604 }, {
605 token: "text",
606 regex: "\\s+"
607 }, {
608 token: "punctuation.operator",
609 regex: "$"
610 }, {
611 token: "empty",
612 regex: "",
613 next: "no_regex"
614 }
615 ],
616 "qqstring": [
617 {
618 token: "constant.language.escape",
619 regex: escapedRe
620 }, {
621 token: "string",
622 regex: "\\\\$",
623 consumeLineEnd: true
624 }, {
625 token: "string",
626 regex: '"|$',
627 next: "no_regex"
628 }, {
629 defaultToken: "string"
630 }
631 ],
632 "qstring": [
633 {
634 token: "constant.language.escape",
635 regex: escapedRe
636 }, {
637 token: "string",
638 regex: "\\\\$",
639 consumeLineEnd: true
640 }, {
641 token: "string",
642 regex: "'|$",
643 next: "no_regex"
644 }, {
645 defaultToken: "string"
646 }
647 ]
648 };
649 if (!options || !options.noES6) {
650 this.$rules.no_regex.unshift({
651 regex: "[{}]", onMatch: function (val, state, stack) {
652 this.next = val == "{" ? this.nextState : "";
653 if (val == "{" && stack.length) {
654 stack.unshift("start", state);
655 }
656 else if (val == "}" && stack.length) {
657 stack.shift();
658 this.next = stack.shift();
659 if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
660 return "paren.quasi.end";
661 }
662 return val == "{" ? "paren.lparen" : "paren.rparen";
663 },
664 nextState: "start"
665 }, {
666 token: "string.quasi.start",
667 regex: /`/,
668 push: [{
669 token: "constant.language.escape",
670 regex: escapedRe
671 }, {
672 token: "paren.quasi.start",
673 regex: /\${/,
674 push: "start"
675 }, {
676 token: "string.quasi.end",
677 regex: /`/,
678 next: "pop"
679 }, {
680 defaultToken: "string.quasi"
681 }]
682 }, {
683 token: ["variable.parameter", "text"],
684 regex: "(" + identifierRe + ")(\\s*)(?=\\=>)"
685 }, {
686 token: "paren.lparen",
687 regex: "(\\()(?=.+\\s*=>)",
688 next: "function_arguments"
689 }, {
690 token: "variable.language",
691 regex: "(?:(?:(?:Weak)?(?:Set|Map))|Promise)\\b"
692 });
693 this.$rules["function_arguments"].unshift({
694 token: "keyword.operator",
695 regex: "=",
696 next: "default_parameter"
697 }, {
698 token: "keyword.operator",
699 regex: "\\.{3}"
700 });
701 this.$rules["property"].unshift({
702 token: "support.function",
703 regex: "(findIndex|repeat|startsWith|endsWith|includes|isSafeInteger|trunc|cbrt|log2|log10|sign|then|catch|"
704 + "finally|resolve|reject|race|any|all|allSettled|keys|entries|isInteger)\\b(?=\\()"
705 }, {
706 token: "constant.language",
707 regex: "(?:MAX_SAFE_INTEGER|MIN_SAFE_INTEGER|EPSILON)\\b"
708 });
709 if (!options || options.jsx != false)
710 JSX.call(this);
711 }
712 this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("no_regex")]);
713 this.normalizeRules();
714 };
715 oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
716 function JSX() {
717 var tagRegex = identifierRe.replace("\\d", "\\d\\-");
718 var jsxTag = {
719 onMatch: function (val, state, stack) {
720 var offset = val.charAt(1) == "/" ? 2 : 1;
721 if (offset == 1) {
722 if (state != this.nextState)
723 stack.unshift(this.next, this.nextState, 0);
724 else
725 stack.unshift(this.next);
726 stack[2]++;
727 }
728 else if (offset == 2) {
729 if (state == this.nextState) {
730 stack[1]--;
731 if (!stack[1] || stack[1] < 0) {
732 stack.shift();
733 stack.shift();
734 }
735 }
736 }
737 return [{
738 type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
739 value: val.slice(0, offset)
740 }, {
741 type: "meta.tag.tag-name.xml",
742 value: val.substr(offset)
743 }];
744 },
745 regex: "</?" + tagRegex + "",
746 next: "jsxAttributes",
747 nextState: "jsx"
748 };
749 this.$rules.start.unshift(jsxTag);
750 var jsxJsRule = {
751 regex: "{",
752 token: "paren.quasi.start",
753 push: "start"
754 };
755 this.$rules.jsx = [
756 jsxJsRule,
757 jsxTag,
758 { include: "reference" },
759 { defaultToken: "string" }
760 ];
761 this.$rules.jsxAttributes = [{
762 token: "meta.tag.punctuation.tag-close.xml",
763 regex: "/?>",
764 onMatch: function (value, currentState, stack) {
765 if (currentState == stack[0])
766 stack.shift();
767 if (value.length == 2) {
768 if (stack[0] == this.nextState)
769 stack[1]--;
770 if (!stack[1] || stack[1] < 0) {
771 stack.splice(0, 2);
772 }
773 }
774 this.next = stack[0] || "start";
775 return [{ type: this.token, value: value }];
776 },
777 nextState: "jsx"
778 },
779 jsxJsRule,
780 comments("jsxAttributes"),
781 {
782 token: "entity.other.attribute-name.xml",
783 regex: tagRegex
784 }, {
785 token: "keyword.operator.attribute-equals.xml",
786 regex: "="
787 }, {
788 token: "text.tag-whitespace.xml",
789 regex: "\\s+"
790 }, {
791 token: "string.attribute-value.xml",
792 regex: "'",
793 stateName: "jsx_attr_q",
794 push: [
795 { token: "string.attribute-value.xml", regex: "'", next: "pop" },
796 { include: "reference" },
797 { defaultToken: "string.attribute-value.xml" }
798 ]
799 }, {
800 token: "string.attribute-value.xml",
801 regex: '"',
802 stateName: "jsx_attr_qq",
803 push: [
804 { token: "string.attribute-value.xml", regex: '"', next: "pop" },
805 { include: "reference" },
806 { defaultToken: "string.attribute-value.xml" }
807 ]
808 },
809 jsxTag
810 ];
811 this.$rules.reference = [{
812 token: "constant.language.escape.reference.xml",
813 regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
814 }];
815 }
816 function comments(next) {
817 return [
818 {
819 token: "comment", // multi line comment
820 regex: /\/\*/,
821 next: [
822 DocCommentHighlightRules.getTagRule(),
823 { token: "comment", regex: "\\*\\/", next: next || "pop" },
824 { defaultToken: "comment", caseInsensitive: true }
825 ]
826 }, {
827 token: "comment",
828 regex: "\\/\\/",
829 next: [
830 DocCommentHighlightRules.getTagRule(),
831 { token: "comment", regex: "$|^", next: next || "pop" },
832 { defaultToken: "comment", caseInsensitive: true }
833 ]
834 }
835 ];
836 }
837 exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
838
839 });
840
841 ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
842 var oop = require("../lib/oop");
843 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
844 var XmlHighlightRules = function (normalize) {
845 var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
846 this.$rules = {
847 start: [
848 { token: "string.cdata.xml", regex: "<\\!\\[CDATA\\[", next: "cdata" },
849 {
850 token: ["punctuation.instruction.xml", "keyword.instruction.xml"],
851 regex: "(<\\?)(" + tagRegex + ")", next: "processing_instruction"
852 },
853 { token: "comment.start.xml", regex: "<\\!--", next: "comment" },
854 {
855 token: ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
856 regex: "(<\\!)(DOCTYPE)(?=[\\s])", next: "doctype", caseInsensitive: true
857 },
858 { include: "tag" },
859 { token: "text.end-tag-open.xml", regex: "</" },
860 { token: "text.tag-open.xml", regex: "<" },
861 { include: "reference" },
862 { defaultToken: "text.xml" }
863 ],
864 processing_instruction: [{
865 token: "entity.other.attribute-name.decl-attribute-name.xml",
866 regex: tagRegex
867 }, {
868 token: "keyword.operator.decl-attribute-equals.xml",
869 regex: "="
870 }, {
871 include: "whitespace"
872 }, {
873 include: "string"
874 }, {
875 token: "punctuation.xml-decl.xml",
876 regex: "\\?>",
877 next: "start"
878 }],
879 doctype: [
880 { include: "whitespace" },
881 { include: "string" },
882 { token: "xml-pe.doctype.xml", regex: ">", next: "start" },
883 { token: "xml-pe.xml", regex: "[-_a-zA-Z0-9:]+" },
884 { token: "punctuation.int-subset", regex: "\\[", push: "int_subset" }
885 ],
886 int_subset: [{
887 token: "text.xml",
888 regex: "\\s+"
889 }, {
890 token: "punctuation.int-subset.xml",
891 regex: "]",
892 next: "pop"
893 }, {
894 token: ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
895 regex: "(<\\!)(" + tagRegex + ")",
896 push: [{
897 token: "text",
898 regex: "\\s+"
899 },
900 {
901 token: "punctuation.markup-decl.xml",
902 regex: ">",
903 next: "pop"
904 },
905 { include: "string" }]
906 }],
907 cdata: [
908 { token: "string.cdata.xml", regex: "\\]\\]>", next: "start" },
909 { token: "text.xml", regex: "\\s+" },
910 { token: "text.xml", regex: "(?:[^\\]]|\\](?!\\]>))+" }
911 ],
912 comment: [
913 { token: "comment.end.xml", regex: "-->", next: "start" },
914 { defaultToken: "comment.xml" }
915 ],
916 reference: [{
917 token: "constant.language.escape.reference.xml",
918 regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
919 }],
920 attr_reference: [{
921 token: "constant.language.escape.reference.attribute-value.xml",
922 regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
923 }],
924 tag: [{
925 token: ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
926 regex: "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
927 next: [
928 { include: "attributes" },
929 { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" }
930 ]
931 }],
932 tag_whitespace: [
933 { token: "text.tag-whitespace.xml", regex: "\\s+" }
934 ],
935 whitespace: [
936 { token: "text.whitespace.xml", regex: "\\s+" }
937 ],
938 string: [{
939 token: "string.xml",
940 regex: "'",
941 push: [
942 { token: "string.xml", regex: "'", next: "pop" },
943 { defaultToken: "string.xml" }
944 ]
945 }, {
946 token: "string.xml",
947 regex: '"',
948 push: [
949 { token: "string.xml", regex: '"', next: "pop" },
950 { defaultToken: "string.xml" }
951 ]
952 }],
953 attributes: [{
954 token: "entity.other.attribute-name.xml",
955 regex: tagRegex
956 }, {
957 token: "keyword.operator.attribute-equals.xml",
958 regex: "="
959 }, {
960 include: "tag_whitespace"
961 }, {
962 include: "attribute_value"
963 }],
964 attribute_value: [{
965 token: "string.attribute-value.xml",
966 regex: "'",
967 push: [
968 { token: "string.attribute-value.xml", regex: "'", next: "pop" },
969 { include: "attr_reference" },
970 { defaultToken: "string.attribute-value.xml" }
971 ]
972 }, {
973 token: "string.attribute-value.xml",
974 regex: '"',
975 push: [
976 { token: "string.attribute-value.xml", regex: '"', next: "pop" },
977 { include: "attr_reference" },
978 { defaultToken: "string.attribute-value.xml" }
979 ]
980 }]
981 };
982 if (this.constructor === XmlHighlightRules)
983 this.normalizeRules();
984 };
985 (function () {
986 this.embedTagRules = function (HighlightRules, prefix, tag) {
987 this.$rules.tag.unshift({
988 token: ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
989 regex: "(<)(" + tag + "(?=\\s|>|$))",
990 next: [
991 { include: "attributes" },
992 { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: prefix + "start" }
993 ]
994 });
995 this.$rules[tag + "-end"] = [
996 { include: "attributes" },
997 { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start",
998 onMatch: function (value, currentState, stack) {
999 stack.splice(0);
1000 return this.token;
1001 } }
1002 ];
1003 this.embedRules(HighlightRules, prefix, [{
1004 token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
1005 regex: "(</)(" + tag + "(?=\\s|>|$))",
1006 next: tag + "-end"
1007 }, {
1008 token: "string.cdata.xml",
1009 regex: "<\\!\\[CDATA\\["
1010 }, {
1011 token: "string.cdata.xml",
1012 regex: "\\]\\]>"
1013 }]);
1014 };
1015 }).call(TextHighlightRules.prototype);
1016 oop.inherits(XmlHighlightRules, TextHighlightRules);
1017 exports.XmlHighlightRules = XmlHighlightRules;
1018
1019 });
1020
1021 ace.define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(require, exports, module){"use strict";
1022 var oop = require("../lib/oop");
1023 var lang = require("../lib/lang");
1024 var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1025 var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1026 var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
1027 var tagMap = lang.createMap({
1028 a: 'anchor',
1029 button: 'form',
1030 form: 'form',
1031 img: 'image',
1032 input: 'form',
1033 label: 'form',
1034 option: 'form',
1035 script: 'script',
1036 select: 'form',
1037 textarea: 'form',
1038 style: 'style',
1039 table: 'table',
1040 tbody: 'table',
1041 td: 'table',
1042 tfoot: 'table',
1043 th: 'table',
1044 tr: 'table'
1045 });
1046 var HtmlHighlightRules = function () {
1047 XmlHighlightRules.call(this);
1048 this.addRules({
1049 attributes: [{
1050 include: "tag_whitespace"
1051 }, {
1052 token: "entity.other.attribute-name.xml",
1053 regex: "[-_a-zA-Z0-9:.]+"
1054 }, {
1055 token: "keyword.operator.attribute-equals.xml",
1056 regex: "=",
1057 push: [{
1058 include: "tag_whitespace"
1059 }, {
1060 token: "string.unquoted.attribute-value.html",
1061 regex: "[^<>='\"`\\s]+",
1062 next: "pop"
1063 }, {
1064 token: "empty",
1065 regex: "",
1066 next: "pop"
1067 }]
1068 }, {
1069 include: "attribute_value"
1070 }],
1071 tag: [{
1072 token: function (start, tag) {
1073 var group = tagMap[tag];
1074 return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
1075 "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
1076 },
1077 regex: "(</?)([-_a-zA-Z0-9:.]+)",
1078 next: "tag_stuff"
1079 }],
1080 tag_stuff: [
1081 { include: "attributes" },
1082 { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" }
1083 ]
1084 });
1085 this.embedTagRules(CssHighlightRules, "css-", "style");
1086 this.embedTagRules(new JavaScriptHighlightRules({ jsx: false }).getRules(), "js-", "script");
1087 if (this.constructor === HtmlHighlightRules)
1088 this.normalizeRules();
1089 };
1090 oop.inherits(HtmlHighlightRules, XmlHighlightRules);
1091 exports.HtmlHighlightRules = HtmlHighlightRules;
1092
1093 });
1094
1095 ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
1096 var Range = require("../range").Range;
1097 var MatchingBraceOutdent = function () { };
1098 (function () {
1099 this.checkOutdent = function (line, input) {
1100 if (!/^\s+$/.test(line))
1101 return false;
1102 return /^\s*\}/.test(input);
1103 };
1104 this.autoOutdent = function (doc, row) {
1105 var line = doc.getLine(row);
1106 var match = line.match(/^(\s*\})/);
1107 if (!match)
1108 return 0;
1109 var column = match[1].length;
1110 var openBracePos = doc.findMatchingBracket({ row: row, column: column });
1111 if (!openBracePos || openBracePos.row == row)
1112 return 0;
1113 var indent = this.$getIndent(doc.getLine(openBracePos.row));
1114 doc.replace(new Range(row, 0, row, column - 1), indent);
1115 };
1116 this.$getIndent = function (line) {
1117 return line.match(/^\s*/)[0];
1118 };
1119 }).call(MatchingBraceOutdent.prototype);
1120 exports.MatchingBraceOutdent = MatchingBraceOutdent;
1121
1122 });
1123
1124 ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
1125 var oop = require("../../lib/oop");
1126 var Range = require("../../range").Range;
1127 var BaseFoldMode = require("./fold_mode").FoldMode;
1128 var FoldMode = exports.FoldMode = function (commentRegex) {
1129 if (commentRegex) {
1130 this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
1131 this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
1132 }
1133 };
1134 oop.inherits(FoldMode, BaseFoldMode);
1135 (function () {
1136 this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
1137 this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
1138 this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
1139 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
1140 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
1141 this._getFoldWidgetBase = this.getFoldWidget;
1142 this.getFoldWidget = function (session, foldStyle, row) {
1143 var line = session.getLine(row);
1144 if (this.singleLineBlockCommentRe.test(line)) {
1145 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
1146 return "";
1147 }
1148 var fw = this._getFoldWidgetBase(session, foldStyle, row);
1149 if (!fw && this.startRegionRe.test(line))
1150 return "start"; // lineCommentRegionStart
1151 return fw;
1152 };
1153 this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
1154 var line = session.getLine(row);
1155 if (this.startRegionRe.test(line))
1156 return this.getCommentRegionBlock(session, line, row);
1157 var match = line.match(this.foldingStartMarker);
1158 if (match) {
1159 var i = match.index;
1160 if (match[1])
1161 return this.openingBracketBlock(session, match[1], row, i);
1162 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
1163 if (range && !range.isMultiLine()) {
1164 if (forceMultiline) {
1165 range = this.getSectionRange(session, row);
1166 }
1167 else if (foldStyle != "all")
1168 range = null;
1169 }
1170 return range;
1171 }
1172 if (foldStyle === "markbegin")
1173 return;
1174 var match = line.match(this.foldingStopMarker);
1175 if (match) {
1176 var i = match.index + match[0].length;
1177 if (match[1])
1178 return this.closingBracketBlock(session, match[1], row, i);
1179 return session.getCommentFoldRange(row, i, -1);
1180 }
1181 };
1182 this.getSectionRange = function (session, row) {
1183 var line = session.getLine(row);
1184 var startIndent = line.search(/\S/);
1185 var startRow = row;
1186 var startColumn = line.length;
1187 row = row + 1;
1188 var endRow = row;
1189 var maxRow = session.getLength();
1190 while (++row < maxRow) {
1191 line = session.getLine(row);
1192 var indent = line.search(/\S/);
1193 if (indent === -1)
1194 continue;
1195 if (startIndent > indent)
1196 break;
1197 var subRange = this.getFoldWidgetRange(session, "all", row);
1198 if (subRange) {
1199 if (subRange.start.row <= startRow) {
1200 break;
1201 }
1202 else if (subRange.isMultiLine()) {
1203 row = subRange.end.row;
1204 }
1205 else if (startIndent == indent) {
1206 break;
1207 }
1208 }
1209 endRow = row;
1210 }
1211 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
1212 };
1213 this.getCommentRegionBlock = function (session, line, row) {
1214 var startColumn = line.search(/\s*$/);
1215 var maxRow = session.getLength();
1216 var startRow = row;
1217 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
1218 var depth = 1;
1219 while (++row < maxRow) {
1220 line = session.getLine(row);
1221 var m = re.exec(line);
1222 if (!m)
1223 continue;
1224 if (m[1])
1225 depth--;
1226 else
1227 depth++;
1228 if (!depth)
1229 break;
1230 }
1231 var endRow = row;
1232 if (endRow > startRow) {
1233 return new Range(startRow, startColumn, endRow, line.length);
1234 }
1235 };
1236 }).call(FoldMode.prototype);
1237
1238 });
1239
1240 ace.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){"use strict";
1241 var oop = require("../lib/oop");
1242 var TextMode = require("./text").Mode;
1243 var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1244 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1245 var WorkerClient = require("../worker/worker_client").WorkerClient;
1246 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
1247 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1248 var Mode = function () {
1249 this.HighlightRules = JavaScriptHighlightRules;
1250 this.$outdent = new MatchingBraceOutdent();
1251 this.$behaviour = new CstyleBehaviour();
1252 this.foldingRules = new CStyleFoldMode();
1253 };
1254 oop.inherits(Mode, TextMode);
1255 (function () {
1256 this.lineCommentStart = "//";
1257 this.blockComment = { start: "/*", end: "*/" };
1258 this.$quotes = { '"': '"', "'": "'", "`": "`" };
1259 this.$pairQuotesAfter = {
1260 "`": /\w/
1261 };
1262 this.getNextLineIndent = function (state, line, tab) {
1263 var indent = this.$getIndent(line);
1264 var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
1265 var tokens = tokenizedLine.tokens;
1266 var endState = tokenizedLine.state;
1267 if (tokens.length && tokens[tokens.length - 1].type == "comment") {
1268 return indent;
1269 }
1270 if (state == "start" || state == "no_regex") {
1271 var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
1272 if (match) {
1273 indent += tab;
1274 }
1275 }
1276 else if (state == "doc-start") {
1277 if (endState == "start" || endState == "no_regex") {
1278 return "";
1279 }
1280 var match = line.match(/^\s*(\/?)\*/);
1281 if (match) {
1282 if (match[1]) {
1283 indent += " ";
1284 }
1285 indent += "* ";
1286 }
1287 }
1288 return indent;
1289 };
1290 this.checkOutdent = function (state, line, input) {
1291 return this.$outdent.checkOutdent(line, input);
1292 };
1293 this.autoOutdent = function (state, doc, row) {
1294 this.$outdent.autoOutdent(doc, row);
1295 };
1296 this.createWorker = function (session) {
1297 var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
1298 worker.attachToDocument(session.getDocument());
1299 worker.on("annotate", function (results) {
1300 session.setAnnotations(results.data);
1301 });
1302 worker.on("terminate", function () {
1303 session.clearAnnotations();
1304 });
1305 return worker;
1306 };
1307 this.$id = "ace/mode/javascript";
1308 this.snippetFileId = "ace/snippets/javascript";
1309 }).call(Mode.prototype);
1310 exports.Mode = Mode;
1311
1312 });
1313
1314 ace.define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module){"use strict";
1315 var propertyMap = {
1316 "background": { "#$0": 1 },
1317 "background-color": { "#$0": 1, "transparent": 1, "fixed": 1 },
1318 "background-image": { "url('/$0')": 1 },
1319 "background-repeat": { "repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1 },
1320 "background-position": { "bottom": 2, "center": 2, "left": 2, "right": 2, "top": 2, "inherit": 2 },
1321 "background-attachment": { "scroll": 1, "fixed": 1 },
1322 "background-size": { "cover": 1, "contain": 1 },
1323 "background-clip": { "border-box": 1, "padding-box": 1, "content-box": 1 },
1324 "background-origin": { "border-box": 1, "padding-box": 1, "content-box": 1 },
1325 "border": { "solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1 },
1326 "border-color": { "#$0": 1 },
1327 "border-style": { "solid": 2, "dashed": 2, "dotted": 2, "double": 2, "groove": 2, "hidden": 2, "inherit": 2, "inset": 2, "none": 2, "outset": 2, "ridged": 2 },
1328 "border-collapse": { "collapse": 1, "separate": 1 },
1329 "bottom": { "px": 1, "em": 1, "%": 1 },
1330 "clear": { "left": 1, "right": 1, "both": 1, "none": 1 },
1331 "color": { "#$0": 1, "rgb(#$00,0,0)": 1 },
1332 "cursor": { "default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1 },
1333 "display": { "none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1 },
1334 "empty-cells": { "show": 1, "hide": 1 },
1335 "float": { "left": 1, "right": 1, "none": 1 },
1336 "font-family": { "Arial": 2, "Comic Sans MS": 2, "Consolas": 2, "Courier New": 2, "Courier": 2, "Georgia": 2, "Monospace": 2, "Sans-Serif": 2, "Segoe UI": 2, "Tahoma": 2, "Times New Roman": 2, "Trebuchet MS": 2, "Verdana": 1 },
1337 "font-size": { "px": 1, "em": 1, "%": 1 },
1338 "font-weight": { "bold": 1, "normal": 1 },
1339 "font-style": { "italic": 1, "normal": 1 },
1340 "font-variant": { "normal": 1, "small-caps": 1 },
1341 "height": { "px": 1, "em": 1, "%": 1 },
1342 "left": { "px": 1, "em": 1, "%": 1 },
1343 "letter-spacing": { "normal": 1 },
1344 "line-height": { "normal": 1 },
1345 "list-style-type": { "none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1 },
1346 "margin": { "px": 1, "em": 1, "%": 1 },
1347 "margin-right": { "px": 1, "em": 1, "%": 1 },
1348 "margin-left": { "px": 1, "em": 1, "%": 1 },
1349 "margin-top": { "px": 1, "em": 1, "%": 1 },
1350 "margin-bottom": { "px": 1, "em": 1, "%": 1 },
1351 "max-height": { "px": 1, "em": 1, "%": 1 },
1352 "max-width": { "px": 1, "em": 1, "%": 1 },
1353 "min-height": { "px": 1, "em": 1, "%": 1 },
1354 "min-width": { "px": 1, "em": 1, "%": 1 },
1355 "overflow": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
1356 "overflow-x": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
1357 "overflow-y": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
1358 "padding": { "px": 1, "em": 1, "%": 1 },
1359 "padding-top": { "px": 1, "em": 1, "%": 1 },
1360 "padding-right": { "px": 1, "em": 1, "%": 1 },
1361 "padding-bottom": { "px": 1, "em": 1, "%": 1 },
1362 "padding-left": { "px": 1, "em": 1, "%": 1 },
1363 "page-break-after": { "auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1 },
1364 "page-break-before": { "auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1 },
1365 "position": { "absolute": 1, "relative": 1, "fixed": 1, "static": 1 },
1366 "right": { "px": 1, "em": 1, "%": 1 },
1367 "table-layout": { "fixed": 1, "auto": 1 },
1368 "text-decoration": { "none": 1, "underline": 1, "line-through": 1, "blink": 1 },
1369 "text-align": { "left": 1, "right": 1, "center": 1, "justify": 1 },
1370 "text-transform": { "capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1 },
1371 "top": { "px": 1, "em": 1, "%": 1 },
1372 "vertical-align": { "top": 1, "bottom": 1 },
1373 "visibility": { "hidden": 1, "visible": 1 },
1374 "white-space": { "nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1 },
1375 "width": { "px": 1, "em": 1, "%": 1 },
1376 "word-spacing": { "normal": 1 },
1377 "filter": { "alpha(opacity=$0100)": 1 },
1378 "text-shadow": { "$02px 2px 2px #777": 1 },
1379 "text-overflow": { "ellipsis-word": 1, "clip": 1, "ellipsis": 1 },
1380 "-moz-border-radius": 1,
1381 "-moz-border-radius-topright": 1,
1382 "-moz-border-radius-bottomright": 1,
1383 "-moz-border-radius-topleft": 1,
1384 "-moz-border-radius-bottomleft": 1,
1385 "-webkit-border-radius": 1,
1386 "-webkit-border-top-right-radius": 1,
1387 "-webkit-border-top-left-radius": 1,
1388 "-webkit-border-bottom-right-radius": 1,
1389 "-webkit-border-bottom-left-radius": 1,
1390 "-moz-box-shadow": 1,
1391 "-webkit-box-shadow": 1,
1392 "transform": { "rotate($00deg)": 1, "skew($00deg)": 1 },
1393 "-moz-transform": { "rotate($00deg)": 1, "skew($00deg)": 1 },
1394 "-webkit-transform": { "rotate($00deg)": 1, "skew($00deg)": 1 }
1395 };
1396 var CssCompletions = function () {
1397 };
1398 (function () {
1399 this.completionsDefined = false;
1400 this.defineCompletions = function () {
1401 if (document) {
1402 var style = document.createElement('c').style;
1403 for (var i in style) {
1404 if (typeof style[i] !== 'string')
1405 continue;
1406 var name = i.replace(/[A-Z]/g, function (x) {
1407 return '-' + x.toLowerCase();
1408 });
1409 if (!propertyMap.hasOwnProperty(name))
1410 propertyMap[name] = 1;
1411 }
1412 }
1413 this.completionsDefined = true;
1414 };
1415 this.getCompletions = function (state, session, pos, prefix) {
1416 if (!this.completionsDefined) {
1417 this.defineCompletions();
1418 }
1419 if (state === 'ruleset' || session.$mode.$id == "ace/mode/scss") {
1420 var line = session.getLine(pos.row).substr(0, pos.column);
1421 var inParens = /\([^)]*$/.test(line);
1422 if (inParens) {
1423 line = line.substr(line.lastIndexOf('(') + 1);
1424 }
1425 if (/:[^;]+$/.test(line)) {
1426 /([\w\-]+):[^:]*$/.test(line);
1427 return this.getPropertyValueCompletions(state, session, pos, prefix);
1428 }
1429 else {
1430 return this.getPropertyCompletions(state, session, pos, prefix, inParens);
1431 }
1432 }
1433 return [];
1434 };
1435 this.getPropertyCompletions = function (state, session, pos, prefix, skipSemicolon) {
1436 skipSemicolon = skipSemicolon || false;
1437 var properties = Object.keys(propertyMap);
1438 return properties.map(function (property) {
1439 return {
1440 caption: property,
1441 snippet: property + ': $0' + (skipSemicolon ? '' : ';'),
1442 meta: "property",
1443 score: 1000000
1444 };
1445 });
1446 };
1447 this.getPropertyValueCompletions = function (state, session, pos, prefix) {
1448 var line = session.getLine(pos.row).substr(0, pos.column);
1449 var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
1450 if (!property)
1451 return [];
1452 var values = [];
1453 if (property in propertyMap && typeof propertyMap[property] === "object") {
1454 values = Object.keys(propertyMap[property]);
1455 }
1456 return values.map(function (value) {
1457 return {
1458 caption: value,
1459 snippet: value,
1460 meta: "property value",
1461 score: 1000000
1462 };
1463 });
1464 };
1465 }).call(CssCompletions.prototype);
1466 exports.CssCompletions = CssCompletions;
1467
1468 });
1469
1470 ace.define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module){"use strict";
1471 var oop = require("../../lib/oop");
1472 var Behaviour = require("../behaviour").Behaviour;
1473 var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1474 var TokenIterator = require("../../token_iterator").TokenIterator;
1475 var CssBehaviour = function () {
1476 this.inherit(CstyleBehaviour);
1477 this.add("colon", "insertion", function (state, action, editor, session, text) {
1478 if (text === ':' && editor.selection.isEmpty()) {
1479 var cursor = editor.getCursorPosition();
1480 var iterator = new TokenIterator(session, cursor.row, cursor.column);
1481 var token = iterator.getCurrentToken();
1482 if (token && token.value.match(/\s+/)) {
1483 token = iterator.stepBackward();
1484 }
1485 if (token && token.type === 'support.type') {
1486 var line = session.doc.getLine(cursor.row);
1487 var rightChar = line.substring(cursor.column, cursor.column + 1);
1488 if (rightChar === ':') {
1489 return {
1490 text: '',
1491 selection: [1, 1]
1492 };
1493 }
1494 if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
1495 return {
1496 text: ':;',
1497 selection: [1, 1]
1498 };
1499 }
1500 }
1501 }
1502 });
1503 this.add("colon", "deletion", function (state, action, editor, session, range) {
1504 var selected = session.doc.getTextRange(range);
1505 if (!range.isMultiLine() && selected === ':') {
1506 var cursor = editor.getCursorPosition();
1507 var iterator = new TokenIterator(session, cursor.row, cursor.column);
1508 var token = iterator.getCurrentToken();
1509 if (token && token.value.match(/\s+/)) {
1510 token = iterator.stepBackward();
1511 }
1512 if (token && token.type === 'support.type') {
1513 var line = session.doc.getLine(range.start.row);
1514 var rightChar = line.substring(range.end.column, range.end.column + 1);
1515 if (rightChar === ';') {
1516 range.end.column++;
1517 return range;
1518 }
1519 }
1520 }
1521 });
1522 this.add("semicolon", "insertion", function (state, action, editor, session, text) {
1523 if (text === ';' && editor.selection.isEmpty()) {
1524 var cursor = editor.getCursorPosition();
1525 var line = session.doc.getLine(cursor.row);
1526 var rightChar = line.substring(cursor.column, cursor.column + 1);
1527 if (rightChar === ';') {
1528 return {
1529 text: '',
1530 selection: [1, 1]
1531 };
1532 }
1533 }
1534 });
1535 this.add("!important", "insertion", function (state, action, editor, session, text) {
1536 if (text === '!' && editor.selection.isEmpty()) {
1537 var cursor = editor.getCursorPosition();
1538 var line = session.doc.getLine(cursor.row);
1539 if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
1540 return {
1541 text: '!important',
1542 selection: [10, 10]
1543 };
1544 }
1545 }
1546 });
1547 };
1548 oop.inherits(CssBehaviour, CstyleBehaviour);
1549 exports.CssBehaviour = CssBehaviour;
1550
1551 });
1552
1553 ace.define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
1554 var oop = require("../lib/oop");
1555 var TextMode = require("./text").Mode;
1556 var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1557 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1558 var WorkerClient = require("../worker/worker_client").WorkerClient;
1559 var CssCompletions = require("./css_completions").CssCompletions;
1560 var CssBehaviour = require("./behaviour/css").CssBehaviour;
1561 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1562 var Mode = function () {
1563 this.HighlightRules = CssHighlightRules;
1564 this.$outdent = new MatchingBraceOutdent();
1565 this.$behaviour = new CssBehaviour();
1566 this.$completer = new CssCompletions();
1567 this.foldingRules = new CStyleFoldMode();
1568 };
1569 oop.inherits(Mode, TextMode);
1570 (function () {
1571 this.foldingRules = "cStyle";
1572 this.blockComment = { start: "/*", end: "*/" };
1573 this.getNextLineIndent = function (state, line, tab) {
1574 var indent = this.$getIndent(line);
1575 var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
1576 if (tokens.length && tokens[tokens.length - 1].type == "comment") {
1577 return indent;
1578 }
1579 var match = line.match(/^.*\{\s*$/);
1580 if (match) {
1581 indent += tab;
1582 }
1583 return indent;
1584 };
1585 this.checkOutdent = function (state, line, input) {
1586 return this.$outdent.checkOutdent(line, input);
1587 };
1588 this.autoOutdent = function (state, doc, row) {
1589 this.$outdent.autoOutdent(doc, row);
1590 };
1591 this.getCompletions = function (state, session, pos, prefix) {
1592 return this.$completer.getCompletions(state, session, pos, prefix);
1593 };
1594 this.createWorker = function (session) {
1595 var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1596 worker.attachToDocument(session.getDocument());
1597 worker.on("annotate", function (e) {
1598 session.setAnnotations(e.data);
1599 });
1600 worker.on("terminate", function () {
1601 session.clearAnnotations();
1602 });
1603 return worker;
1604 };
1605 this.$id = "ace/mode/css";
1606 this.snippetFileId = "ace/snippets/css";
1607 }).call(Mode.prototype);
1608 exports.Mode = Mode;
1609
1610 });
1611
1612 ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module){"use strict";
1613 var oop = require("../../lib/oop");
1614 var Behaviour = require("../behaviour").Behaviour;
1615 var TokenIterator = require("../../token_iterator").TokenIterator;
1616 var lang = require("../../lib/lang");
1617 function is(token, type) {
1618 return token && token.type.lastIndexOf(type + ".xml") > -1;
1619 }
1620 var XmlBehaviour = function () {
1621 this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
1622 if (text == '"' || text == "'") {
1623 var quote = text;
1624 var selected = session.doc.getTextRange(editor.getSelectionRange());
1625 if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
1626 return {
1627 text: quote + selected + quote,
1628 selection: false
1629 };
1630 }
1631 var cursor = editor.getCursorPosition();
1632 var line = session.doc.getLine(cursor.row);
1633 var rightChar = line.substring(cursor.column, cursor.column + 1);
1634 var iterator = new TokenIterator(session, cursor.row, cursor.column);
1635 var token = iterator.getCurrentToken();
1636 if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
1637 return {
1638 text: "",
1639 selection: [1, 1]
1640 };
1641 }
1642 if (!token)
1643 token = iterator.stepBackward();
1644 if (!token)
1645 return;
1646 while (is(token, "tag-whitespace") || is(token, "whitespace")) {
1647 token = iterator.stepBackward();
1648 }
1649 var rightSpace = !rightChar || rightChar.match(/\s/);
1650 if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
1651 return {
1652 text: quote + quote,
1653 selection: [1, 1]
1654 };
1655 }
1656 }
1657 });
1658 this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
1659 var selected = session.doc.getTextRange(range);
1660 if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
1661 var line = session.doc.getLine(range.start.row);
1662 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1663 if (rightChar == selected) {
1664 range.end.column++;
1665 return range;
1666 }
1667 }
1668 });
1669 this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
1670 if (text == '>') {
1671 var position = editor.getSelectionRange().start;
1672 var iterator = new TokenIterator(session, position.row, position.column);
1673 var token = iterator.getCurrentToken() || iterator.stepBackward();
1674 if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
1675 return;
1676 if (is(token, "reference.attribute-value"))
1677 return;
1678 if (is(token, "attribute-value")) {
1679 var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
1680 if (position.column < tokenEndColumn)
1681 return;
1682 if (position.column == tokenEndColumn) {
1683 var nextToken = iterator.stepForward();
1684 if (nextToken && is(nextToken, "attribute-value"))
1685 return;
1686 iterator.stepBackward();
1687 }
1688 }
1689 if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
1690 return;
1691 while (!is(token, "tag-name")) {
1692 token = iterator.stepBackward();
1693 if (token.value == "<") {
1694 token = iterator.stepForward();
1695 break;
1696 }
1697 }
1698 var tokenRow = iterator.getCurrentTokenRow();
1699 var tokenColumn = iterator.getCurrentTokenColumn();
1700 if (is(iterator.stepBackward(), "end-tag-open"))
1701 return;
1702 var element = token.value;
1703 if (tokenRow == position.row)
1704 element = element.substring(0, position.column - tokenColumn);
1705 if (this.voidElements.hasOwnProperty(element.toLowerCase()))
1706 return;
1707 return {
1708 text: ">" + "</" + element + ">",
1709 selection: [1, 1]
1710 };
1711 }
1712 });
1713 this.add("autoindent", "insertion", function (state, action, editor, session, text) {
1714 if (text == "\n") {
1715 var cursor = editor.getCursorPosition();
1716 var line = session.getLine(cursor.row);
1717 var iterator = new TokenIterator(session, cursor.row, cursor.column);
1718 var token = iterator.getCurrentToken();
1719 if (token && token.type.indexOf("tag-close") !== -1) {
1720 if (token.value == "/>")
1721 return;
1722 while (token && token.type.indexOf("tag-name") === -1) {
1723 token = iterator.stepBackward();
1724 }
1725 if (!token) {
1726 return;
1727 }
1728 var tag = token.value;
1729 var row = iterator.getCurrentTokenRow();
1730 token = iterator.stepBackward();
1731 if (!token || token.type.indexOf("end-tag") !== -1) {
1732 return;
1733 }
1734 if (this.voidElements && !this.voidElements[tag]) {
1735 var nextToken = session.getTokenAt(cursor.row, cursor.column + 1);
1736 var line = session.getLine(row);
1737 var nextIndent = this.$getIndent(line);
1738 var indent = nextIndent + session.getTabString();
1739 if (nextToken && nextToken.value === "</") {
1740 return {
1741 text: "\n" + indent + "\n" + nextIndent,
1742 selection: [1, indent.length, 1, indent.length]
1743 };
1744 }
1745 else {
1746 return {
1747 text: "\n" + indent
1748 };
1749 }
1750 }
1751 }
1752 }
1753 });
1754 };
1755 oop.inherits(XmlBehaviour, Behaviour);
1756 exports.XmlBehaviour = XmlBehaviour;
1757
1758 });
1759
1760 ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
1761 var oop = require("../../lib/oop");
1762 var BaseFoldMode = require("./fold_mode").FoldMode;
1763 var FoldMode = exports.FoldMode = function (defaultMode, subModes) {
1764 this.defaultMode = defaultMode;
1765 this.subModes = subModes;
1766 };
1767 oop.inherits(FoldMode, BaseFoldMode);
1768 (function () {
1769 this.$getMode = function (state) {
1770 if (typeof state != "string")
1771 state = state[0];
1772 for (var key in this.subModes) {
1773 if (state.indexOf(key) === 0)
1774 return this.subModes[key];
1775 }
1776 return null;
1777 };
1778 this.$tryMode = function (state, session, foldStyle, row) {
1779 var mode = this.$getMode(state);
1780 return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
1781 };
1782 this.getFoldWidget = function (session, foldStyle, row) {
1783 return (this.$tryMode(session.getState(row - 1), session, foldStyle, row) ||
1784 this.$tryMode(session.getState(row), session, foldStyle, row) ||
1785 this.defaultMode.getFoldWidget(session, foldStyle, row));
1786 };
1787 this.getFoldWidgetRange = function (session, foldStyle, row) {
1788 var mode = this.$getMode(session.getState(row - 1));
1789 if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1790 mode = this.$getMode(session.getState(row));
1791 if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1792 mode = this.defaultMode;
1793 return mode.getFoldWidgetRange(session, foldStyle, row);
1794 };
1795 }).call(FoldMode.prototype);
1796
1797 });
1798
1799 ace.define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
1800 var oop = require("../../lib/oop");
1801 var Range = require("../../range").Range;
1802 var BaseFoldMode = require("./fold_mode").FoldMode;
1803 var FoldMode = exports.FoldMode = function (voidElements, optionalEndTags) {
1804 BaseFoldMode.call(this);
1805 this.voidElements = voidElements || {};
1806 this.optionalEndTags = oop.mixin({}, this.voidElements);
1807 if (optionalEndTags)
1808 oop.mixin(this.optionalEndTags, optionalEndTags);
1809 };
1810 oop.inherits(FoldMode, BaseFoldMode);
1811 var Tag = function () {
1812 this.tagName = "";
1813 this.closing = false;
1814 this.selfClosing = false;
1815 this.start = { row: 0, column: 0 };
1816 this.end = { row: 0, column: 0 };
1817 };
1818 function is(token, type) {
1819 return token.type.lastIndexOf(type + ".xml") > -1;
1820 }
1821 (function () {
1822 this.getFoldWidget = function (session, foldStyle, row) {
1823 var tag = this._getFirstTagInLine(session, row);
1824 if (!tag)
1825 return this.getCommentFoldWidget(session, row);
1826 if (tag.closing || (!tag.tagName && tag.selfClosing))
1827 return foldStyle === "markbeginend" ? "end" : "";
1828 if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
1829 return "";
1830 if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
1831 return "";
1832 return "start";
1833 };
1834 this.getCommentFoldWidget = function (session, row) {
1835 if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
1836 return "start";
1837 return "";
1838 };
1839 this._getFirstTagInLine = function (session, row) {
1840 var tokens = session.getTokens(row);
1841 var tag = new Tag();
1842 for (var i = 0; i < tokens.length; i++) {
1843 var token = tokens[i];
1844 if (is(token, "tag-open")) {
1845 tag.end.column = tag.start.column + token.value.length;
1846 tag.closing = is(token, "end-tag-open");
1847 token = tokens[++i];
1848 if (!token)
1849 return null;
1850 tag.tagName = token.value;
1851 tag.end.column += token.value.length;
1852 for (i++; i < tokens.length; i++) {
1853 token = tokens[i];
1854 tag.end.column += token.value.length;
1855 if (is(token, "tag-close")) {
1856 tag.selfClosing = token.value == '/>';
1857 break;
1858 }
1859 }
1860 return tag;
1861 }
1862 else if (is(token, "tag-close")) {
1863 tag.selfClosing = token.value == '/>';
1864 return tag;
1865 }
1866 tag.start.column += token.value.length;
1867 }
1868 return null;
1869 };
1870 this._findEndTagInLine = function (session, row, tagName, startColumn) {
1871 var tokens = session.getTokens(row);
1872 var column = 0;
1873 for (var i = 0; i < tokens.length; i++) {
1874 var token = tokens[i];
1875 column += token.value.length;
1876 if (column < startColumn)
1877 continue;
1878 if (is(token, "end-tag-open")) {
1879 token = tokens[i + 1];
1880 if (token && token.value == tagName)
1881 return true;
1882 }
1883 }
1884 return false;
1885 };
1886 this.getFoldWidgetRange = function (session, foldStyle, row) {
1887 var tags = session.getMatchingTags({ row: row, column: 0 });
1888 if (tags) {
1889 return new Range(tags.openTag.end.row, tags.openTag.end.column, tags.closeTag.start.row, tags.closeTag.start.column);
1890 }
1891 else {
1892 return this.getCommentFoldWidget(session, row)
1893 && session.getCommentFoldRange(row, session.getLine(row).length);
1894 }
1895 };
1896 }).call(FoldMode.prototype);
1897
1898 });
1899
1900 ace.define("ace/mode/folding/html",["require","exports","module","ace/lib/oop","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
1901 var oop = require("../../lib/oop");
1902 var MixedFoldMode = require("./mixed").FoldMode;
1903 var XmlFoldMode = require("./xml").FoldMode;
1904 var CStyleFoldMode = require("./cstyle").FoldMode;
1905 var FoldMode = exports.FoldMode = function (voidElements, optionalTags) {
1906 MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
1907 "js-": new CStyleFoldMode(),
1908 "css-": new CStyleFoldMode()
1909 });
1910 };
1911 oop.inherits(FoldMode, MixedFoldMode);
1912
1913 });
1914
1915 ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module){"use strict";
1916 var TokenIterator = require("../token_iterator").TokenIterator;
1917 var commonAttributes = [
1918 "accesskey",
1919 "class",
1920 "contenteditable",
1921 "contextmenu",
1922 "dir",
1923 "draggable",
1924 "dropzone",
1925 "hidden",
1926 "id",
1927 "inert",
1928 "itemid",
1929 "itemprop",
1930 "itemref",
1931 "itemscope",
1932 "itemtype",
1933 "lang",
1934 "spellcheck",
1935 "style",
1936 "tabindex",
1937 "title",
1938 "translate"
1939 ];
1940 var eventAttributes = [
1941 "onabort",
1942 "onblur",
1943 "oncancel",
1944 "oncanplay",
1945 "oncanplaythrough",
1946 "onchange",
1947 "onclick",
1948 "onclose",
1949 "oncontextmenu",
1950 "oncuechange",
1951 "ondblclick",
1952 "ondrag",
1953 "ondragend",
1954 "ondragenter",
1955 "ondragleave",
1956 "ondragover",
1957 "ondragstart",
1958 "ondrop",
1959 "ondurationchange",
1960 "onemptied",
1961 "onended",
1962 "onerror",
1963 "onfocus",
1964 "oninput",
1965 "oninvalid",
1966 "onkeydown",
1967 "onkeypress",
1968 "onkeyup",
1969 "onload",
1970 "onloadeddata",
1971 "onloadedmetadata",
1972 "onloadstart",
1973 "onmousedown",
1974 "onmousemove",
1975 "onmouseout",
1976 "onmouseover",
1977 "onmouseup",
1978 "onmousewheel",
1979 "onpause",
1980 "onplay",
1981 "onplaying",
1982 "onprogress",
1983 "onratechange",
1984 "onreset",
1985 "onscroll",
1986 "onseeked",
1987 "onseeking",
1988 "onselect",
1989 "onshow",
1990 "onstalled",
1991 "onsubmit",
1992 "onsuspend",
1993 "ontimeupdate",
1994 "onvolumechange",
1995 "onwaiting"
1996 ];
1997 var globalAttributes = commonAttributes.concat(eventAttributes);
1998 var attributeMap = {
1999 "a": { "href": 1, "target": { "_blank": 1, "top": 1 }, "ping": 1, "rel": { "nofollow": 1, "alternate": 1, "author": 1, "bookmark": 1, "help": 1, "license": 1, "next": 1, "noreferrer": 1, "prefetch": 1, "prev": 1, "search": 1, "tag": 1 }, "media": 1, "hreflang": 1, "type": 1 },
2000 "abbr": {},
2001 "address": {},
2002 "area": { "shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1 },
2003 "article": { "pubdate": 1 },
2004 "aside": {},
2005 "audio": { "src": 1, "autobuffer": 1, "autoplay": { "autoplay": 1 }, "loop": { "loop": 1 }, "controls": { "controls": 1 }, "muted": { "muted": 1 }, "preload": { "auto": 1, "metadata": 1, "none": 1 } },
2006 "b": {},
2007 "base": { "href": 1, "target": 1 },
2008 "bdi": {},
2009 "bdo": {},
2010 "blockquote": { "cite": 1 },
2011 "body": { "onafterprint": 1, "onbeforeprint": 1, "onbeforeunload": 1, "onhashchange": 1, "onmessage": 1, "onoffline": 1, "onpopstate": 1, "onredo": 1, "onresize": 1, "onstorage": 1, "onundo": 1, "onunload": 1 },
2012 "br": {},
2013 "button": { "autofocus": 1, "disabled": { "disabled": 1 }, "form": 1, "formaction": 1, "formenctype": 1, "formmethod": 1, "formnovalidate": 1, "formtarget": 1, "name": 1, "value": 1, "type": { "button": 1, "submit": 1 } },
2014 "canvas": { "width": 1, "height": 1 },
2015 "caption": {},
2016 "cite": {},
2017 "code": {},
2018 "col": { "span": 1 },
2019 "colgroup": { "span": 1 },
2020 "command": { "type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1 },
2021 "data": {},
2022 "datalist": {},
2023 "dd": {},
2024 "del": { "cite": 1, "datetime": 1 },
2025 "details": { "open": 1 },
2026 "dfn": {},
2027 "dialog": { "open": 1 },
2028 "div": {},
2029 "dl": {},
2030 "dt": {},
2031 "em": {},
2032 "embed": { "src": 1, "height": 1, "width": 1, "type": 1 },
2033 "fieldset": { "disabled": 1, "form": 1, "name": 1 },
2034 "figcaption": {},
2035 "figure": {},
2036 "footer": {},
2037 "form": { "accept-charset": 1, "action": 1, "autocomplete": 1, "enctype": { "multipart/form-data": 1, "application/x-www-form-urlencoded": 1 }, "method": { "get": 1, "post": 1 }, "name": 1, "novalidate": 1, "target": { "_blank": 1, "top": 1 } },
2038 "h1": {},
2039 "h2": {},
2040 "h3": {},
2041 "h4": {},
2042 "h5": {},
2043 "h6": {},
2044 "head": {},
2045 "header": {},
2046 "hr": {},
2047 "html": { "manifest": 1 },
2048 "i": {},
2049 "iframe": { "name": 1, "src": 1, "height": 1, "width": 1, "sandbox": { "allow-same-origin": 1, "allow-top-navigation": 1, "allow-forms": 1, "allow-scripts": 1 }, "seamless": { "seamless": 1 } },
2050 "img": { "alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1 },
2051 "input": {
2052 "type": { "text": 1, "password": 1, "hidden": 1, "checkbox": 1, "submit": 1, "radio": 1, "file": 1, "button": 1, "reset": 1, "image": 31, "color": 1, "date": 1, "datetime": 1, "datetime-local": 1, "email": 1, "month": 1, "number": 1, "range": 1, "search": 1, "tel": 1, "time": 1, "url": 1, "week": 1 },
2053 "accept": 1, "alt": 1, "autocomplete": { "on": 1, "off": 1 }, "autofocus": { "autofocus": 1 }, "checked": { "checked": 1 }, "disabled": { "disabled": 1 }, "form": 1, "formaction": 1, "formenctype": { "application/x-www-form-urlencoded": 1, "multipart/form-data": 1, "text/plain": 1 }, "formmethod": { "get": 1, "post": 1 }, "formnovalidate": { "formnovalidate": 1 }, "formtarget": { "_blank": 1, "_self": 1, "_parent": 1, "_top": 1 }, "height": 1, "list": 1, "max": 1, "maxlength": 1, "min": 1, "multiple": { "multiple": 1 }, "name": 1, "pattern": 1, "placeholder": 1, "readonly": { "readonly": 1 }, "required": { "required": 1 }, "size": 1, "src": 1, "step": 1, "width": 1, "files": 1, "value": 1
2054 },
2055 "ins": { "cite": 1, "datetime": 1 },
2056 "kbd": {},
2057 "keygen": { "autofocus": 1, "challenge": { "challenge": 1 }, "disabled": { "disabled": 1 }, "form": 1, "keytype": { "rsa": 1, "dsa": 1, "ec": 1 }, "name": 1 },
2058 "label": { "form": 1, "for": 1 },
2059 "legend": {},
2060 "li": { "value": 1 },
2061 "link": { "href": 1, "hreflang": 1, "rel": { "stylesheet": 1, "icon": 1 }, "media": { "all": 1, "screen": 1, "print": 1 }, "type": { "text/css": 1, "image/png": 1, "image/jpeg": 1, "image/gif": 1 }, "sizes": 1 },
2062 "main": {},
2063 "map": { "name": 1 },
2064 "mark": {},
2065 "math": {},
2066 "menu": { "type": 1, "label": 1 },
2067 "meta": { "http-equiv": { "content-type": 1 }, "name": { "description": 1, "keywords": 1 }, "content": { "text/html; charset=UTF-8": 1 }, "charset": 1 },
2068 "meter": { "value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1 },
2069 "nav": {},
2070 "noscript": { "href": 1 },
2071 "object": { "param": 1, "data": 1, "type": 1, "height": 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1 },
2072 "ol": { "start": 1, "reversed": 1 },
2073 "optgroup": { "disabled": 1, "label": 1 },
2074 "option": { "disabled": 1, "selected": 1, "label": 1, "value": 1 },
2075 "output": { "for": 1, "form": 1, "name": 1 },
2076 "p": {},
2077 "param": { "name": 1, "value": 1 },
2078 "pre": {},
2079 "progress": { "value": 1, "max": 1 },
2080 "q": { "cite": 1 },
2081 "rp": {},
2082 "rt": {},
2083 "ruby": {},
2084 "s": {},
2085 "samp": {},
2086 "script": { "charset": 1, "type": { "text/javascript": 1 }, "src": 1, "defer": 1, "async": 1 },
2087 "select": { "autofocus": 1, "disabled": 1, "form": 1, "multiple": { "multiple": 1 }, "name": 1, "size": 1, "readonly": { "readonly": 1 } },
2088 "small": {},
2089 "source": { "src": 1, "type": 1, "media": 1 },
2090 "span": {},
2091 "strong": {},
2092 "style": { "type": 1, "media": { "all": 1, "screen": 1, "print": 1 }, "scoped": 1 },
2093 "sub": {},
2094 "sup": {},
2095 "svg": {},
2096 "table": { "summary": 1 },
2097 "tbody": {},
2098 "td": { "headers": 1, "rowspan": 1, "colspan": 1 },
2099 "textarea": { "autofocus": { "autofocus": 1 }, "disabled": { "disabled": 1 }, "form": 1, "maxlength": 1, "name": 1, "placeholder": 1, "readonly": { "readonly": 1 }, "required": { "required": 1 }, "rows": 1, "cols": 1, "wrap": { "on": 1, "off": 1, "hard": 1, "soft": 1 } },
2100 "tfoot": {},
2101 "th": { "headers": 1, "rowspan": 1, "colspan": 1, "scope": 1 },
2102 "thead": {},
2103 "time": { "datetime": 1 },
2104 "title": {},
2105 "tr": {},
2106 "track": { "kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1 },
2107 "section": {},
2108 "summary": {},
2109 "u": {},
2110 "ul": {},
2111 "var": {},
2112 "video": { "src": 1, "autobuffer": 1, "autoplay": { "autoplay": 1 }, "loop": { "loop": 1 }, "controls": { "controls": 1 }, "width": 1, "height": 1, "poster": 1, "muted": { "muted": 1 }, "preload": { "auto": 1, "metadata": 1, "none": 1 } },
2113 "wbr": {}
2114 };
2115 var elements = Object.keys(attributeMap);
2116 function is(token, type) {
2117 return token.type.lastIndexOf(type + ".xml") > -1;
2118 }
2119 function findTagName(session, pos) {
2120 var iterator = new TokenIterator(session, pos.row, pos.column);
2121 var token = iterator.getCurrentToken();
2122 while (token && !is(token, "tag-name")) {
2123 token = iterator.stepBackward();
2124 }
2125 if (token)
2126 return token.value;
2127 }
2128 function findAttributeName(session, pos) {
2129 var iterator = new TokenIterator(session, pos.row, pos.column);
2130 var token = iterator.getCurrentToken();
2131 while (token && !is(token, "attribute-name")) {
2132 token = iterator.stepBackward();
2133 }
2134 if (token)
2135 return token.value;
2136 }
2137 var HtmlCompletions = function () {
2138 };
2139 (function () {
2140 this.getCompletions = function (state, session, pos, prefix) {
2141 var token = session.getTokenAt(pos.row, pos.column);
2142 if (!token)
2143 return [];
2144 if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
2145 return this.getTagCompletions(state, session, pos, prefix);
2146 if (is(token, "tag-whitespace") || is(token, "attribute-name"))
2147 return this.getAttributeCompletions(state, session, pos, prefix);
2148 if (is(token, "attribute-value"))
2149 return this.getAttributeValueCompletions(state, session, pos, prefix);
2150 var line = session.getLine(pos.row).substr(0, pos.column);
2151 if (/&[a-z]*$/i.test(line))
2152 return this.getHTMLEntityCompletions(state, session, pos, prefix);
2153 return [];
2154 };
2155 this.getTagCompletions = function (state, session, pos, prefix) {
2156 return elements.map(function (element) {
2157 return {
2158 value: element,
2159 meta: "tag",
2160 score: 1000000
2161 };
2162 });
2163 };
2164 this.getAttributeCompletions = function (state, session, pos, prefix) {
2165 var tagName = findTagName(session, pos);
2166 if (!tagName)
2167 return [];
2168 var attributes = globalAttributes;
2169 if (tagName in attributeMap) {
2170 attributes = attributes.concat(Object.keys(attributeMap[tagName]));
2171 }
2172 return attributes.map(function (attribute) {
2173 return {
2174 caption: attribute,
2175 snippet: attribute + '="$0"',
2176 meta: "attribute",
2177 score: 1000000
2178 };
2179 });
2180 };
2181 this.getAttributeValueCompletions = function (state, session, pos, prefix) {
2182 var tagName = findTagName(session, pos);
2183 var attributeName = findAttributeName(session, pos);
2184 if (!tagName)
2185 return [];
2186 var values = [];
2187 if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
2188 values = Object.keys(attributeMap[tagName][attributeName]);
2189 }
2190 return values.map(function (value) {
2191 return {
2192 caption: value,
2193 snippet: value,
2194 meta: "attribute value",
2195 score: 1000000
2196 };
2197 });
2198 };
2199 this.getHTMLEntityCompletions = function (state, session, pos, prefix) {
2200 var values = ['Aacute;', 'aacute;', 'Acirc;', 'acirc;', 'acute;', 'AElig;', 'aelig;', 'Agrave;', 'agrave;', 'alefsym;', 'Alpha;', 'alpha;', 'amp;', 'and;', 'ang;', 'Aring;', 'aring;', 'asymp;', 'Atilde;', 'atilde;', 'Auml;', 'auml;', 'bdquo;', 'Beta;', 'beta;', 'brvbar;', 'bull;', 'cap;', 'Ccedil;', 'ccedil;', 'cedil;', 'cent;', 'Chi;', 'chi;', 'circ;', 'clubs;', 'cong;', 'copy;', 'crarr;', 'cup;', 'curren;', 'Dagger;', 'dagger;', 'dArr;', 'darr;', 'deg;', 'Delta;', 'delta;', 'diams;', 'divide;', 'Eacute;', 'eacute;', 'Ecirc;', 'ecirc;', 'Egrave;', 'egrave;', 'empty;', 'emsp;', 'ensp;', 'Epsilon;', 'epsilon;', 'equiv;', 'Eta;', 'eta;', 'ETH;', 'eth;', 'Euml;', 'euml;', 'euro;', 'exist;', 'fnof;', 'forall;', 'frac12;', 'frac14;', 'frac34;', 'frasl;', 'Gamma;', 'gamma;', 'ge;', 'gt;', 'hArr;', 'harr;', 'hearts;', 'hellip;', 'Iacute;', 'iacute;', 'Icirc;', 'icirc;', 'iexcl;', 'Igrave;', 'igrave;', 'image;', 'infin;', 'int;', 'Iota;', 'iota;', 'iquest;', 'isin;', 'Iuml;', 'iuml;', 'Kappa;', 'kappa;', 'Lambda;', 'lambda;', 'lang;', 'laquo;', 'lArr;', 'larr;', 'lceil;', 'ldquo;', 'le;', 'lfloor;', 'lowast;', 'loz;', 'lrm;', 'lsaquo;', 'lsquo;', 'lt;', 'macr;', 'mdash;', 'micro;', 'middot;', 'minus;', 'Mu;', 'mu;', 'nabla;', 'nbsp;', 'ndash;', 'ne;', 'ni;', 'not;', 'notin;', 'nsub;', 'Ntilde;', 'ntilde;', 'Nu;', 'nu;', 'Oacute;', 'oacute;', 'Ocirc;', 'ocirc;', 'OElig;', 'oelig;', 'Ograve;', 'ograve;', 'oline;', 'Omega;', 'omega;', 'Omicron;', 'omicron;', 'oplus;', 'or;', 'ordf;', 'ordm;', 'Oslash;', 'oslash;', 'Otilde;', 'otilde;', 'otimes;', 'Ouml;', 'ouml;', 'para;', 'part;', 'permil;', 'perp;', 'Phi;', 'phi;', 'Pi;', 'pi;', 'piv;', 'plusmn;', 'pound;', 'Prime;', 'prime;', 'prod;', 'prop;', 'Psi;', 'psi;', 'quot;', 'radic;', 'rang;', 'raquo;', 'rArr;', 'rarr;', 'rceil;', 'rdquo;', 'real;', 'reg;', 'rfloor;', 'Rho;', 'rho;', 'rlm;', 'rsaquo;', 'rsquo;', 'sbquo;', 'Scaron;', 'scaron;', 'sdot;', 'sect;', 'shy;', 'Sigma;', 'sigma;', 'sigmaf;', 'sim;', 'spades;', 'sub;', 'sube;', 'sum;', 'sup;', 'sup1;', 'sup2;', 'sup3;', 'supe;', 'szlig;', 'Tau;', 'tau;', 'there4;', 'Theta;', 'theta;', 'thetasym;', 'thinsp;', 'THORN;', 'thorn;', 'tilde;', 'times;', 'trade;', 'Uacute;', 'uacute;', 'uArr;', 'uarr;', 'Ucirc;', 'ucirc;', 'Ugrave;', 'ugrave;', 'uml;', 'upsih;', 'Upsilon;', 'upsilon;', 'Uuml;', 'uuml;', 'weierp;', 'Xi;', 'xi;', 'Yacute;', 'yacute;', 'yen;', 'Yuml;', 'yuml;', 'Zeta;', 'zeta;', 'zwj;', 'zwnj;'];
2201 return values.map(function (value) {
2202 return {
2203 caption: value,
2204 snippet: value,
2205 meta: "html entity",
2206 score: 1000000
2207 };
2208 });
2209 };
2210 }).call(HtmlCompletions.prototype);
2211 exports.HtmlCompletions = HtmlCompletions;
2212
2213 });
2214
2215 ace.define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"], function(require, exports, module){"use strict";
2216 var oop = require("../lib/oop");
2217 var lang = require("../lib/lang");
2218 var TextMode = require("./text").Mode;
2219 var JavaScriptMode = require("./javascript").Mode;
2220 var CssMode = require("./css").Mode;
2221 var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
2222 var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
2223 var HtmlFoldMode = require("./folding/html").FoldMode;
2224 var HtmlCompletions = require("./html_completions").HtmlCompletions;
2225 var WorkerClient = require("../worker/worker_client").WorkerClient;
2226 var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
2227 var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
2228 var Mode = function (options) {
2229 this.fragmentContext = options && options.fragmentContext;
2230 this.HighlightRules = HtmlHighlightRules;
2231 this.$behaviour = new XmlBehaviour();
2232 this.$completer = new HtmlCompletions();
2233 this.createModeDelegates({
2234 "js-": JavaScriptMode,
2235 "css-": CssMode
2236 });
2237 this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
2238 };
2239 oop.inherits(Mode, TextMode);
2240 (function () {
2241 this.blockComment = { start: "<!--", end: "-->" };
2242 this.voidElements = lang.arrayToMap(voidElements);
2243 this.getNextLineIndent = function (state, line, tab) {
2244 return this.$getIndent(line);
2245 };
2246 this.checkOutdent = function (state, line, input) {
2247 return false;
2248 };
2249 this.getCompletions = function (state, session, pos, prefix) {
2250 return this.$completer.getCompletions(state, session, pos, prefix);
2251 };
2252 this.createWorker = function (session) {
2253 if (this.constructor != Mode)
2254 return;
2255 var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
2256 worker.attachToDocument(session.getDocument());
2257 if (this.fragmentContext)
2258 worker.call("setOptions", [{ context: this.fragmentContext }]);
2259 worker.on("error", function (e) {
2260 session.setAnnotations(e.data);
2261 });
2262 worker.on("terminate", function () {
2263 session.clearAnnotations();
2264 });
2265 return worker;
2266 };
2267 this.$id = "ace/mode/html";
2268 this.snippetFileId = "ace/snippets/html";
2269 }).call(Mode.prototype);
2270 exports.Mode = Mode;
2271
2272 });
2273
2274 ace.define("ace/mode/ruby_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
2275 var oop = require("../lib/oop");
2276 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
2277 var constantOtherSymbol = exports.constantOtherSymbol = {
2278 token: "constant.other.symbol.ruby", // symbol
2279 regex: "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
2280 };
2281 exports.qString = {
2282 token: "string", // single line
2283 regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
2284 };
2285 exports.qqString = {
2286 token: "string", // single line
2287 regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
2288 };
2289 exports.tString = {
2290 token: "string", // backtick string
2291 regex: "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
2292 };
2293 var constantNumericHex = exports.constantNumericHex = {
2294 token: "constant.numeric", // hex
2295 regex: "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
2296 };
2297 var constantNumericBinary = exports.constantNumericBinary = {
2298 token: "constant.numeric",
2299 regex: /\b(0[bB][01](?:[01]|_(?=[01]))*)\b/
2300 };
2301 var constantNumericDecimal = exports.constantNumericDecimal = {
2302 token: "constant.numeric",
2303 regex: /\b(0[dD](?:[1-9](?:[\d]|_(?=[\d]))*|0))\b/
2304 };
2305 var constantNumericOctal = exports.constantNumericDecimal = {
2306 token: "constant.numeric",
2307 regex: /\b(0[oO]?(?:[1-7](?:[0-7]|_(?=[0-7]))*|0))\b/
2308 };
2309 var constantNumericRational = exports.constantNumericRational = {
2310 token: "constant.numeric", //rational + complex
2311 regex: /\b([\d]+(?:[./][\d]+)?ri?)\b/
2312 };
2313 var constantNumericComplex = exports.constantNumericComplex = {
2314 token: "constant.numeric", //simple complex numbers
2315 regex: /\b([\d]i)\b/
2316 };
2317 var constantNumericFloat = exports.constantNumericFloat = {
2318 token: "constant.numeric", // float + complex
2319 regex: "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?i?\\b"
2320 };
2321 var instanceVariable = exports.instanceVariable = {
2322 token: "variable.instance", // instance variable
2323 regex: "@{1,2}[a-zA-Z_\\d]+"
2324 };
2325 var RubyHighlightRules = function () {
2326 var builtinFunctions = ("abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
2327 "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
2328 "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
2329 "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
2330 "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
2331 "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" +
2332 "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
2333 "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
2334 "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
2335 "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" +
2336 "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
2337 "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
2338 "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" +
2339 "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" +
2340 "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" +
2341 "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" +
2342 "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" +
2343 "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" +
2344 "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" +
2345 "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" +
2346 "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" +
2347 "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" +
2348 "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" +
2349 "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" +
2350 "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
2351 "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
2352 "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
2353 "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" +
2354 "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
2355 "has_many|has_one|belongs_to|has_and_belongs_to_many|p|warn|refine|using|module_function|extend|alias_method|" +
2356 "private_class_method|remove_method|undef_method");
2357 var keywords = ("alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
2358 "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
2359 "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield|__ENCODING__|prepend");
2360 var buildinConstants = ("true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
2361 "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING|RUBY_PATCHLEVEL|RUBY_REVISION|RUBY_COPYRIGHT|RUBY_ENGINE|RUBY_ENGINE_VERSION|RUBY_DESCRIPTION");
2362 var builtinVariables = ("$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|" +
2363 "$!|root_url|flash|session|cookies|params|request|response|logger|self");
2364 var keywordMapper = this.$keywords = this.createKeywordMapper({
2365 "keyword": keywords,
2366 "constant.language": buildinConstants,
2367 "variable.language": builtinVariables,
2368 "support.function": builtinFunctions,
2369 "invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
2370 }, "identifier");
2371 var escapedChars = "\\\\(?:n(?:[1-7][0-7]{0,2}|0)|[nsrtvfbae'\"\\\\]|c(?:\\\\M-)?.|M-(?:\\\\C-|\\\\c)?.|C-(?:\\\\M-)?.|[0-7]{3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|u{[\\da-fA-F]{1,6}(?:\\s[\\da-fA-F]{1,6})*})";
2372 var closeParen = {
2373 "(": ")",
2374 "[": "]",
2375 "{": "}",
2376 "<": ">",
2377 "^": "^",
2378 "|": "|",
2379 "%": "%"
2380 };
2381 this.$rules = {
2382 "start": [
2383 {
2384 token: "comment",
2385 regex: "#.*$"
2386 }, {
2387 token: "comment.multiline", // multi line comment
2388 regex: "^=begin(?=$|\\s.*$)",
2389 next: "comment"
2390 }, {
2391 token: "string.regexp",
2392 regex: /[/](?=.*\/)/,
2393 next: "regex"
2394 },
2395 [{
2396 token: ["constant.other.symbol.ruby", "string.start"],
2397 regex: /(:)?(")/,
2398 push: [{
2399 token: "constant.language.escape",
2400 regex: escapedChars
2401 }, {
2402 token: "paren.start",
2403 regex: /#{/,
2404 push: "start"
2405 }, {
2406 token: "string.end",
2407 regex: /"/,
2408 next: "pop"
2409 }, {
2410 defaultToken: "string"
2411 }]
2412 }, {
2413 token: "string.start",
2414 regex: /`/,
2415 push: [{
2416 token: "constant.language.escape",
2417 regex: escapedChars
2418 }, {
2419 token: "paren.start",
2420 regex: /#{/,
2421 push: "start"
2422 }, {
2423 token: "string.end",
2424 regex: /`/,
2425 next: "pop"
2426 }, {
2427 defaultToken: "string"
2428 }]
2429 }, {
2430 token: ["constant.other.symbol.ruby", "string.start"],
2431 regex: /(:)?(')/,
2432 push: [{
2433 token: "constant.language.escape",
2434 regex: /\\['\\]/
2435 }, {
2436 token: "string.end",
2437 regex: /'/,
2438 next: "pop"
2439 }, {
2440 defaultToken: "string"
2441 }]
2442 }, {
2443 token: "string.start", //doesn't see any differences between strings and array of strings in highlighting
2444 regex: /%[qwx]([(\[<{^|%])/, onMatch: function (val, state, stack) {
2445 if (stack.length)
2446 stack = [];
2447 var paren = val[val.length - 1];
2448 stack.unshift(paren, state);
2449 this.next = "qStateWithoutInterpolation";
2450 return this.token;
2451 }
2452 }, {
2453 token: "string.start", //doesn't see any differences between strings and array of strings in highlighting
2454 regex: /%[QWX]?([(\[<{^|%])/, onMatch: function (val, state, stack) {
2455 if (stack.length)
2456 stack = [];
2457 var paren = val[val.length - 1];
2458 stack.unshift(paren, state);
2459 this.next = "qStateWithInterpolation";
2460 return this.token;
2461 }
2462 }, {
2463 token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting
2464 regex: /%[si]([(\[<{^|%])/, onMatch: function (val, state, stack) {
2465 if (stack.length)
2466 stack = [];
2467 var paren = val[val.length - 1];
2468 stack.unshift(paren, state);
2469 this.next = "sStateWithoutInterpolation";
2470 return this.token;
2471 }
2472 }, {
2473 token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting
2474 regex: /%[SI]([(\[<{^|%])/, onMatch: function (val, state, stack) {
2475 if (stack.length)
2476 stack = [];
2477 var paren = val[val.length - 1];
2478 stack.unshift(paren, state);
2479 this.next = "sStateWithInterpolation";
2480 return this.token;
2481 }
2482 }, {
2483 token: "string.regexp",
2484 regex: /%[r]([(\[<{^|%])/, onMatch: function (val, state, stack) {
2485 if (stack.length)
2486 stack = [];
2487 var paren = val[val.length - 1];
2488 stack.unshift(paren, state);
2489 this.next = "rState";
2490 return this.token;
2491 }
2492 }],
2493 {
2494 token: "punctuation", // namespaces aren't symbols
2495 regex: "::"
2496 },
2497 instanceVariable,
2498 {
2499 token: "variable.global", // global variable
2500 regex: "[$][a-zA-Z_\\d]+"
2501 }, {
2502 token: "support.class", // class name
2503 regex: "[A-Z][a-zA-Z_\\d]*"
2504 }, {
2505 token: ["punctuation.operator", "support.function"],
2506 regex: /(\.)([a-zA-Z_\d]+)(?=\()/
2507 }, {
2508 token: ["punctuation.operator", "identifier"],
2509 regex: /(\.)([a-zA-Z_][a-zA-Z_\d]*)/
2510 }, {
2511 token: "string.character",
2512 regex: "\\B\\?(?:" + escapedChars + "|\\S)"
2513 }, {
2514 token: "punctuation.operator",
2515 regex: /\?(?=.+:)/
2516 },
2517 constantNumericRational,
2518 constantNumericComplex,
2519 constantOtherSymbol,
2520 constantNumericHex,
2521 constantNumericFloat,
2522 constantNumericBinary,
2523 constantNumericDecimal,
2524 constantNumericOctal,
2525 {
2526 token: "constant.language.boolean",
2527 regex: "(?:true|false)\\b"
2528 }, {
2529 token: keywordMapper,
2530 regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
2531 }, {
2532 token: "punctuation.separator.key-value",
2533 regex: "=>"
2534 }, {
2535 stateName: "heredoc",
2536 onMatch: function (value, currentState, stack) {
2537 var next = (value[2] == '-' || value[2] == '~') ? "indentedHeredoc" : "heredoc";
2538 var tokens = value.split(this.splitRegex);
2539 stack.push(next, tokens[3]);
2540 return [
2541 { type: "constant", value: tokens[1] },
2542 { type: "string", value: tokens[2] },
2543 { type: "support.class", value: tokens[3] },
2544 { type: "string", value: tokens[4] }
2545 ];
2546 },
2547 regex: "(<<[-~]?)(['\"`]?)([\\w]+)(['\"`]?)",
2548 rules: {
2549 heredoc: [{
2550 onMatch: function (value, currentState, stack) {
2551 if (value === stack[1]) {
2552 stack.shift();
2553 stack.shift();
2554 this.next = stack[0] || "start";
2555 return "support.class";
2556 }
2557 this.next = "";
2558 return "string";
2559 },
2560 regex: ".*$",
2561 next: "start"
2562 }],
2563 indentedHeredoc: [{
2564 token: "string",
2565 regex: "^ +"
2566 }, {
2567 onMatch: function (value, currentState, stack) {
2568 if (value === stack[1]) {
2569 stack.shift();
2570 stack.shift();
2571 this.next = stack[0] || "start";
2572 return "support.class";
2573 }
2574 this.next = "";
2575 return "string";
2576 },
2577 regex: ".*$",
2578 next: "start"
2579 }]
2580 }
2581 }, {
2582 regex: "$",
2583 token: "empty",
2584 next: function (currentState, stack) {
2585 if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
2586 return stack[0];
2587 return currentState;
2588 }
2589 }, {
2590 token: "keyword.operator",
2591 regex: "!|\\$|%|&|\\*|/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\||\\b(?:in|instanceof|new|delete|typeof|void)"
2592 }, {
2593 token: "paren.lparen",
2594 regex: "[[({]"
2595 }, {
2596 token: "paren.rparen",
2597 regex: "[\\])}]",
2598 onMatch: function (value, currentState, stack) {
2599 this.next = '';
2600 if (value == "}" && stack.length > 1 && stack[1] != "start") {
2601 stack.shift();
2602 this.next = stack.shift();
2603 }
2604 return this.token;
2605 }
2606 }, {
2607 token: "text",
2608 regex: "\\s+"
2609 }, {
2610 token: "punctuation.operator",
2611 regex: /[?:,;.]/
2612 }
2613 ],
2614 "comment": [
2615 {
2616 token: "comment.multiline", // closing comment
2617 regex: "^=end(?=$|\\s.*$)",
2618 next: "start"
2619 }, {
2620 token: "comment", // comment spanning whole line
2621 regex: ".+"
2622 }
2623 ],
2624 "qStateWithInterpolation": [{
2625 token: "string.start", // excluded nested |^% due to difficulty in realization
2626 regex: /[(\[<{]/, onMatch: function (val, state, stack) {
2627 if (stack.length && val === stack[0]) {
2628 stack.unshift(val, state);
2629 return this.token;
2630 }
2631 return "string";
2632 }
2633 }, {
2634 token: "constant.language.escape",
2635 regex: escapedChars
2636 }, {
2637 token: "constant.language.escape",
2638 regex: /\\./
2639 }, {
2640 token: "paren.start",
2641 regex: /#{/,
2642 push: "start"
2643 }, {
2644 token: "string.end",
2645 regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) {
2646 if (stack.length && val === closeParen[stack[0]]) {
2647 stack.shift();
2648 this.next = stack.shift();
2649 return this.token;
2650 }
2651 this.next = '';
2652 return "string";
2653 }
2654 }, {
2655 defaultToken: "string"
2656 }],
2657 "qStateWithoutInterpolation": [{
2658 token: "string.start", // excluded nested |^% due to difficulty in realization
2659 regex: /[(\[<{]/, onMatch: function (val, state, stack) {
2660 if (stack.length && val === stack[0]) {
2661 stack.unshift(val, state);
2662 return this.token;
2663 }
2664 return "string";
2665 }
2666 }, {
2667 token: "constant.language.escape",
2668 regex: /\\['\\]/
2669 }, {
2670 token: "constant.language.escape",
2671 regex: /\\./
2672 }, {
2673 token: "string.end",
2674 regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) {
2675 if (stack.length && val === closeParen[stack[0]]) {
2676 stack.shift();
2677 this.next = stack.shift();
2678 return this.token;
2679 }
2680 this.next = '';
2681 return "string";
2682 }
2683 }, {
2684 defaultToken: "string"
2685 }],
2686 "sStateWithoutInterpolation": [{
2687 token: "constant.other.symbol.ruby", // excluded nested |^% due to difficulty in realization
2688 regex: /[(\[<{]/, onMatch: function (val, state, stack) {
2689 if (stack.length && val === stack[0]) {
2690 stack.unshift(val, state);
2691 return this.token;
2692 }
2693 return "constant.other.symbol.ruby";
2694 }
2695 }, {
2696 token: "constant.other.symbol.ruby",
2697 regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) {
2698 if (stack.length && val === closeParen[stack[0]]) {
2699 stack.shift();
2700 this.next = stack.shift();
2701 return this.token;
2702 }
2703 this.next = '';
2704 return "constant.other.symbol.ruby";
2705 }
2706 }, {
2707 defaultToken: "constant.other.symbol.ruby"
2708 }],
2709 "sStateWithInterpolation": [{
2710 token: "constant.other.symbol.ruby", // excluded nested |^% due to difficulty in realization
2711 regex: /[(\[<{]/, onMatch: function (val, state, stack) {
2712 if (stack.length && val === stack[0]) {
2713 stack.unshift(val, state);
2714 return this.token;
2715 }
2716 return "constant.other.symbol.ruby";
2717 }
2718 }, {
2719 token: "constant.language.escape",
2720 regex: escapedChars
2721 }, {
2722 token: "constant.language.escape",
2723 regex: /\\./
2724 }, {
2725 token: "paren.start",
2726 regex: /#{/,
2727 push: "start"
2728 }, {
2729 token: "constant.other.symbol.ruby",
2730 regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) {
2731 if (stack.length && val === closeParen[stack[0]]) {
2732 stack.shift();
2733 this.next = stack.shift();
2734 return this.token;
2735 }
2736 this.next = '';
2737 return "constant.other.symbol.ruby";
2738 }
2739 }, {
2740 defaultToken: "constant.other.symbol.ruby"
2741 }],
2742 "rState": [{
2743 token: "string.regexp", // excluded nested |^% due to difficulty in realization
2744 regex: /[(\[<{]/, onMatch: function (val, state, stack) {
2745 if (stack.length && val === stack[0]) {
2746 stack.unshift(val, state);
2747 return this.token;
2748 }
2749 return "constant.language.escape";
2750 }
2751 }, {
2752 token: "paren.start",
2753 regex: /#{/,
2754 push: "start"
2755 }, {
2756 token: "string.regexp",
2757 regex: /\//
2758 }, {
2759 token: "string.regexp",
2760 regex: /[)\]>}^|%][imxouesn]*/, onMatch: function (val, state, stack) {
2761 if (stack.length && val[0] === closeParen[stack[0]]) {
2762 stack.shift();
2763 this.next = stack.shift();
2764 return this.token;
2765 }
2766 this.next = '';
2767 return "constant.language.escape";
2768 }
2769 },
2770 { include: "regex" },
2771 {
2772 defaultToken: "string.regexp"
2773 }],
2774 "regex": [
2775 {
2776 token: "regexp.keyword",
2777 regex: /\\[wWdDhHsS]/
2778 }, {
2779 token: "constant.language.escape",
2780 regex: /\\[AGbBzZ]/
2781 }, {
2782 token: "constant.language.escape",
2783 regex: /\\g<[a-zA-Z0-9]*>/
2784 }, {
2785 token: ["constant.language.escape", "regexp.keyword", "constant.language.escape"],
2786 regex: /(\\p{\^?)(Alnum|Alpha|Blank|Cntrl|Digit|Graph|Lower|Print|Punct|Space|Upper|XDigit|Word|ASCII|Any|Assigned|Arabic|Armenian|Balinese|Bengali|Bopomofo|Braille|Buginese|Buhid|Canadian_Aboriginal|Carian|Cham|Cherokee|Common|Coptic|Cuneiform|Cypriot|Cyrillic|Deseret|Devanagari|Ethiopic|Georgian|Glagolitic|Gothic|Greek|Gujarati|Gurmukhi|Han|Hangul|Hanunoo|Hebrew|Hiragana|Inherited|Kannada|Katakana|Kayah_Li|Kharoshthi|Khmer|Lao|Latin|Lepcha|Limbu|Linear_B|Lycian|Lydian|Malayalam|Mongolian|Myanmar|New_Tai_Lue|Nko|Ogham|Ol_Chiki|Old_Italic|Old_Persian|Oriya|Osmanya|Phags_Pa|Phoenician|Rejang|Runic|Saurashtra|Shavian|Sinhala|Sundanese|Syloti_Nagri|Syriac|Tagalog|Tagbanwa|Tai_Le|Tamil|Telugu|Thaana|Thai|Tibetan|Tifinagh|Ugaritic|Vai|Yi|Ll|Lm|Lt|Lu|Lo|Mn|Mc|Me|Nd|Nl|Pc|Pd|Ps|Pe|Pi|Pf|Po|No|Sm|Sc|Sk|So|Zs|Zl|Zp|Cc|Cf|Cn|Co|Cs|N|L|M|P|S|Z|C)(})/
2787 }, {
2788 token: ["constant.language.escape", "invalid", "constant.language.escape"],
2789 regex: /(\\p{\^?)([^/]*)(})/
2790 }, {
2791 token: "regexp.keyword.operator",
2792 regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
2793 }, {
2794 token: "string.regexp",
2795 regex: /[/][imxouesn]*/,
2796 next: "start"
2797 }, {
2798 token: "invalid",
2799 regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
2800 }, {
2801 token: "constant.language.escape",
2802 regex: /\(\?(?:[:=!>]|<'?[a-zA-Z]*'?>|<[=!])|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
2803 }, {
2804 token: "constant.language.delimiter",
2805 regex: /\|/
2806 }, {
2807 token: "regexp.keyword",
2808 regex: /\[\[:(?:alnum|alpha|blank|cntrl|digit|graph|lower|print|punct|space|upper|xdigit|word|ascii):\]\]/
2809 }, {
2810 token: "constant.language.escape",
2811 regex: /\[\^?/,
2812 push: "regex_character_class"
2813 }, {
2814 defaultToken: "string.regexp"
2815 }
2816 ],
2817 "regex_character_class": [
2818 {
2819 token: "regexp.keyword",
2820 regex: /\\[wWdDhHsS]/
2821 }, {
2822 token: "regexp.charclass.keyword.operator",
2823 regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
2824 }, {
2825 token: "constant.language.escape",
2826 regex: /&?&?\[\^?/,
2827 push: "regex_character_class"
2828 }, {
2829 token: "constant.language.escape",
2830 regex: "]",
2831 next: "pop"
2832 }, {
2833 token: "constant.language.escape",
2834 regex: "-"
2835 }, {
2836 defaultToken: "string.regexp.characterclass"
2837 }
2838 ]
2839 };
2840 this.normalizeRules();
2841 };
2842 oop.inherits(RubyHighlightRules, TextHighlightRules);
2843 exports.RubyHighlightRules = RubyHighlightRules;
2844
2845 });
2846
2847 ace.define("ace/mode/folding/ruby",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range","ace/token_iterator"], function(require, exports, module){"use strict";
2848 var oop = require("../../lib/oop");
2849 var BaseFoldMode = require("./fold_mode").FoldMode;
2850 var Range = require("../../range").Range;
2851 var TokenIterator = require("../../token_iterator").TokenIterator;
2852 var FoldMode = exports.FoldMode = function () {
2853 };
2854 oop.inherits(FoldMode, BaseFoldMode);
2855 (function () {
2856 this.indentKeywords = {
2857 "class": 1,
2858 "def": 1,
2859 "module": 1,
2860 "do": 1,
2861 "unless": 1,
2862 "if": 1,
2863 "while": 1,
2864 "for": 1,
2865 "until": 1,
2866 "begin": 1,
2867 "else": 0,
2868 "elsif": 0,
2869 "rescue": 0,
2870 "ensure": 0,
2871 "when": 0,
2872 "end": -1,
2873 "case": 1,
2874 "=begin": 1,
2875 "=end": -1
2876 };
2877 this.foldingStartMarker = /(?:\s|^)(def|do|while|class|unless|module|if|for|until|begin|else|elsif|case|rescue|ensure|when)\b|({\s*$)|(=begin)/;
2878 this.foldingStopMarker = /(=end(?=$|\s.*$))|(^\s*})|\b(end)\b/;
2879 this.getFoldWidget = function (session, foldStyle, row) {
2880 var line = session.getLine(row);
2881 var isStart = this.foldingStartMarker.test(line);
2882 var isEnd = this.foldingStopMarker.test(line);
2883 if (isStart && !isEnd) {
2884 var match = line.match(this.foldingStartMarker);
2885 if (match[1]) {
2886 if (match[1] == "if" || match[1] == "else" || match[1] == "while" || match[1] == "until" || match[1] == "unless") {
2887 if (match[1] == "else" && /^\s*else\s*$/.test(line) === false) {
2888 return;
2889 }
2890 if (/^\s*(?:if|else|while|until|unless)\s*/.test(line) === false) {
2891 return;
2892 }
2893 }
2894 if (match[1] == "when") {
2895 if (/\sthen\s/.test(line) === true) {
2896 return;
2897 }
2898 }
2899 if (session.getTokenAt(row, match.index + 2).type === "keyword")
2900 return "start";
2901 }
2902 else if (match[3]) {
2903 if (session.getTokenAt(row, match.index + 1).type === "comment.multiline")
2904 return "start";
2905 }
2906 else {
2907 return "start";
2908 }
2909 }
2910 if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd)
2911 return "";
2912 var match = line.match(this.foldingStopMarker);
2913 if (match[3] === "end") {
2914 if (session.getTokenAt(row, match.index + 1).type === "keyword")
2915 return "end";
2916 }
2917 else if (match[1]) {
2918 if (session.getTokenAt(row, match.index + 1).type === "comment.multiline")
2919 return "end";
2920 }
2921 else
2922 return "end";
2923 };
2924 this.getFoldWidgetRange = function (session, foldStyle, row) {
2925 var line = session.doc.getLine(row);
2926 var match = this.foldingStartMarker.exec(line);
2927 if (match) {
2928 if (match[1] || match[3])
2929 return this.rubyBlock(session, row, match.index + 2);
2930 return this.openingBracketBlock(session, "{", row, match.index);
2931 }
2932 var match = this.foldingStopMarker.exec(line);
2933 if (match) {
2934 if (match[3] === "end") {
2935 if (session.getTokenAt(row, match.index + 1).type === "keyword")
2936 return this.rubyBlock(session, row, match.index + 1);
2937 }
2938 if (match[1] === "=end") {
2939 if (session.getTokenAt(row, match.index + 1).type === "comment.multiline")
2940 return this.rubyBlock(session, row, match.index + 1);
2941 }
2942 return this.closingBracketBlock(session, "}", row, match.index + match[0].length);
2943 }
2944 };
2945 this.rubyBlock = function (session, row, column, tokenRange) {
2946 var stream = new TokenIterator(session, row, column);
2947 var token = stream.getCurrentToken();
2948 if (!token || (token.type != "keyword" && token.type != "comment.multiline"))
2949 return;
2950 var val = token.value;
2951 var line = session.getLine(row);
2952 switch (token.value) {
2953 case "if":
2954 case "unless":
2955 case "while":
2956 case "until":
2957 var checkToken = new RegExp("^\\s*" + token.value);
2958 if (!checkToken.test(line)) {
2959 return;
2960 }
2961 var dir = this.indentKeywords[val];
2962 break;
2963 case "when":
2964 if (/\sthen\s/.test(line)) {
2965 return;
2966 }
2967 case "elsif":
2968 case "rescue":
2969 case "ensure":
2970 var dir = 1;
2971 break;
2972 case "else":
2973 var checkToken = new RegExp("^\\s*" + token.value + "\\s*$");
2974 if (!checkToken.test(line)) {
2975 return;
2976 }
2977 var dir = 1;
2978 break;
2979 default:
2980 var dir = this.indentKeywords[val];
2981 break;
2982 }
2983 var stack = [val];
2984 if (!dir)
2985 return;
2986 var startColumn = dir === -1 ? session.getLine(row - 1).length : session.getLine(row).length;
2987 var startRow = row;
2988 var ranges = [];
2989 ranges.push(stream.getCurrentTokenRange());
2990 stream.step = dir === -1 ? stream.stepBackward : stream.stepForward;
2991 if (token.type == "comment.multiline") {
2992 while (token = stream.step()) {
2993 if (token.type !== "comment.multiline")
2994 continue;
2995 if (dir == 1) {
2996 startColumn = 6;
2997 if (token.value == "=end") {
2998 break;
2999 }
3000 }
3001 else {
3002 if (token.value == "=begin") {
3003 break;
3004 }
3005 }
3006 }
3007 }
3008 else {
3009 while (token = stream.step()) {
3010 var ignore = false;
3011 if (token.type !== "keyword")
3012 continue;
3013 var level = dir * this.indentKeywords[token.value];
3014 line = session.getLine(stream.getCurrentTokenRow());
3015 switch (token.value) {
3016 case "do":
3017 for (var i = stream.$tokenIndex - 1; i >= 0; i--) {
3018 var prevToken = stream.$rowTokens[i];
3019 if (prevToken && (prevToken.value == "while" || prevToken.value == "until" || prevToken.value == "for")) {
3020 level = 0;
3021 break;
3022 }
3023 }
3024 break;
3025 case "else":
3026 var checkToken = new RegExp("^\\s*" + token.value + "\\s*$");
3027 if (!checkToken.test(line) || val == "case") {
3028 level = 0;
3029 ignore = true;
3030 }
3031 break;
3032 case "if":
3033 case "unless":
3034 case "while":
3035 case "until":
3036 var checkToken = new RegExp("^\\s*" + token.value);
3037 if (!checkToken.test(line)) {
3038 level = 0;
3039 ignore = true;
3040 }
3041 break;
3042 case "when":
3043 if (/\sthen\s/.test(line) || val == "case") {
3044 level = 0;
3045 ignore = true;
3046 }
3047 break;
3048 }
3049 if (level > 0) {
3050 stack.unshift(token.value);
3051 }
3052 else if (level <= 0 && ignore === false) {
3053 stack.shift();
3054 if (!stack.length) {
3055 if ((val == "while" || val == "until" || val == "for") && token.value != "do") {
3056 break;
3057 }
3058 if (token.value == "do" && dir == -1 && level != 0)
3059 break;
3060 if (token.value != "do")
3061 break;
3062 }
3063 if (level === 0) {
3064 stack.unshift(token.value);
3065 }
3066 }
3067 }
3068 }
3069 if (!token)
3070 return null;
3071 if (tokenRange) {
3072 ranges.push(stream.getCurrentTokenRange());
3073 return ranges;
3074 }
3075 var row = stream.getCurrentTokenRow();
3076 if (dir === -1) {
3077 if (token.type === "comment.multiline") {
3078 var endColumn = 6;
3079 }
3080 else {
3081 var endColumn = session.getLine(row).length;
3082 }
3083 return new Range(row, endColumn, startRow - 1, startColumn);
3084 }
3085 else
3086 return new Range(startRow, startColumn, row - 1, session.getLine(row - 1).length);
3087 };
3088 }).call(FoldMode.prototype);
3089
3090 });
3091
3092 ace.define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/folding/ruby"], function(require, exports, module){"use strict";
3093 var oop = require("../lib/oop");
3094 var TextMode = require("./text").Mode;
3095 var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
3096 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
3097 var Range = require("../range").Range;
3098 var FoldMode = require("./folding/ruby").FoldMode;
3099 var Mode = function () {
3100 this.HighlightRules = RubyHighlightRules;
3101 this.$outdent = new MatchingBraceOutdent();
3102 this.$behaviour = this.$defaultBehaviour;
3103 this.foldingRules = new FoldMode();
3104 this.indentKeywords = this.foldingRules.indentKeywords;
3105 };
3106 oop.inherits(Mode, TextMode);
3107 (function () {
3108 this.lineCommentStart = "#";
3109 this.getNextLineIndent = function (state, line, tab) {
3110 var indent = this.$getIndent(line);
3111 var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
3112 var tokens = tokenizedLine.tokens;
3113 if (tokens.length && tokens[tokens.length - 1].type == "comment") {
3114 return indent;
3115 }
3116 if (state == "start") {
3117 var match = line.match(/^.*[\{\(\[]\s*$/);
3118 var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/);
3119 var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/);
3120 var startingConditional = line.match(/^\s*(if|else|when|elsif|unless|while|for|begin|rescue|ensure)\s*/);
3121 if (match || startingClassOrMethod || startingDoBlock || startingConditional) {
3122 indent += tab;
3123 }
3124 }
3125 return indent;
3126 };
3127 this.checkOutdent = function (state, line, input) {
3128 return /^\s+(end|else|rescue|ensure)$/.test(line + input) || this.$outdent.checkOutdent(line, input);
3129 };
3130 this.autoOutdent = function (state, session, row) {
3131 var line = session.getLine(row);
3132 if (/}/.test(line))
3133 return this.$outdent.autoOutdent(session, row);
3134 var indent = this.$getIndent(line);
3135 var prevLine = session.getLine(row - 1);
3136 var prevIndent = this.$getIndent(prevLine);
3137 var tab = session.getTabString();
3138 if (prevIndent.length <= indent.length) {
3139 if (indent.slice(-tab.length) == tab)
3140 session.remove(new Range(row, indent.length - tab.length, row, indent.length));
3141 }
3142 };
3143 this.getMatching = function (session, row, column) {
3144 if (row == undefined) {
3145 var pos = session.selection.lead;
3146 column = pos.column;
3147 row = pos.row;
3148 }
3149 var startToken = session.getTokenAt(row, column);
3150 if (startToken && startToken.value in this.indentKeywords)
3151 return this.foldingRules.rubyBlock(session, row, column, true);
3152 };
3153 this.$id = "ace/mode/ruby";
3154 this.snippetFileId = "ace/snippets/ruby";
3155 }).call(Mode.prototype);
3156 exports.Mode = Mode;
3157
3158 });
3159
3160 ace.define("ace/mode/ejs",["require","exports","module","ace/lib/oop","ace/mode/html_highlight_rules","ace/mode/javascript_highlight_rules","ace/lib/oop","ace/mode/html","ace/mode/javascript","ace/mode/css","ace/mode/ruby"], function(require, exports, module){"use strict";
3161 var oop = require("../lib/oop");
3162 var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
3163 var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
3164 var EjsHighlightRules = function (start, end) {
3165 HtmlHighlightRules.call(this);
3166 if (!start)
3167 start = "(?:<%|<\\?|{{)";
3168 if (!end)
3169 end = "(?:%>|\\?>|}})";
3170 for (var i in this.$rules) {
3171 this.$rules[i].unshift({
3172 token: "markup.list.meta.tag",
3173 regex: start + "(?![>}])[-=]?",
3174 push: "ejs-start"
3175 });
3176 }
3177 this.embedRules(new JavaScriptHighlightRules({ jsx: false }).getRules(), "ejs-", [{
3178 token: "markup.list.meta.tag",
3179 regex: "-?" + end,
3180 next: "pop"
3181 }, {
3182 token: "comment",
3183 regex: "//.*?" + end,
3184 next: "pop"
3185 }]);
3186 this.normalizeRules();
3187 };
3188 oop.inherits(EjsHighlightRules, HtmlHighlightRules);
3189 exports.EjsHighlightRules = EjsHighlightRules;
3190 var oop = require("../lib/oop");
3191 var HtmlMode = require("./html").Mode;
3192 var JavaScriptMode = require("./javascript").Mode;
3193 var CssMode = require("./css").Mode;
3194 var RubyMode = require("./ruby").Mode;
3195 var Mode = function () {
3196 HtmlMode.call(this);
3197 this.HighlightRules = EjsHighlightRules;
3198 this.createModeDelegates({
3199 "js-": JavaScriptMode,
3200 "css-": CssMode,
3201 "ejs-": JavaScriptMode
3202 });
3203 };
3204 oop.inherits(Mode, HtmlMode);
3205 (function () {
3206 this.$id = "ace/mode/ejs";
3207 }).call(Mode.prototype);
3208 exports.Mode = Mode;
3209
3210 }); (function() {
3211 ace.require(["ace/mode/ejs"], function(m) {
3212 if (typeof module == "object" && typeof exports == "object" && module) {
3213 module.exports = m;
3214 }
3215 });
3216 })();
3217