Debian Codegraph @

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

raw symbols SCIP
1 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";
2 var oop = require("../lib/oop");
3 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
4 var JsDocCommentHighlightRules = function () {
5 this.$rules = {
6 "start": [
7 {
8 token: ["comment.doc.tag", "comment.doc.text", "lparen.doc"],
9 regex: "(@(?:param|member|typedef|property|namespace|var|const|callback))(\\s*)({)",
10 push: [
11 {
12 token: "lparen.doc",
13 regex: "{",
14 push: [
15 {
16 include: "doc-syntax"
17 }, {
18 token: "rparen.doc",
19 regex: "}|(?=$)",
20 next: "pop"
21 }
22 ]
23 }, {
24 token: ["rparen.doc", "text.doc", "variable.parameter.doc", "lparen.doc", "variable.parameter.doc", "rparen.doc"],
25 regex: /(})(\s*)(?:([\w=:\/\.]+)|(?:(\[)([\w=:\/\.]+)(\])))/,
26 next: "pop"
27 }, {
28 token: "rparen.doc",
29 regex: "}|(?=$)",
30 next: "pop"
31 }, {
32 include: "doc-syntax"
33 }, {
34 defaultToken: "text.doc"
35 }
36 ]
37 }, {
38 token: ["comment.doc.tag", "text.doc", "lparen.doc"],
39 regex: "(@(?:returns?|yields|type|this|suppress|public|protected|private|package|modifies|"
40 + "implements|external|exception|throws|enum|define|extends))(\\s*)({)",
41 push: [
42 {
43 token: "lparen.doc",
44 regex: "{",
45 push: [
46 {
47 include: "doc-syntax"
48 }, {
49 token: "rparen.doc",
50 regex: "}|(?=$)",
51 next: "pop"
52 }
53 ]
54 }, {
55 token: "rparen.doc",
56 regex: "}|(?=$)",
57 next: "pop"
58 }, {
59 include: "doc-syntax"
60 }, {
61 defaultToken: "text.doc"
62 }
63 ]
64 }, {
65 token: ["comment.doc.tag", "text.doc", "variable.parameter.doc"],
66 regex: "(@(?:alias|memberof|instance|module|name|lends|namespace|external|this|template|"
67 + "requires|param|implements|function|extends|typedef|mixes|constructor|var|"
68 + "memberof\\!|event|listens|exports|class|constructs|interface|emits|fires|"
69 + "throws|const|callback|borrows|augments))(\\s+)(\\w[\\w#\.:\/~\"\\-]*)?"
70 }, {
71 token: ["comment.doc.tag", "text.doc", "variable.parameter.doc"],
72 regex: "(@method)(\\s+)(\\w[\\w\.\\(\\)]*)"
73 }, {
74 token: "comment.doc.tag",
75 regex: "@access\\s+(?:private|public|protected)"
76 }, {
77 token: "comment.doc.tag",
78 regex: "@kind\\s+(?:class|constant|event|external|file|function|member|mixin|module|namespace|typedef)"
79 }, {
80 token: "comment.doc.tag",
81 regex: "@\\w+(?=\\s|$)"
82 },
83 JsDocCommentHighlightRules.getTagRule(),
84 {
85 defaultToken: "comment.doc",
86 caseInsensitive: true
87 }
88 ],
89 "doc-syntax": [{
90 token: "operator.doc",
91 regex: /[|:]/
92 }, {
93 token: "paren.doc",
94 regex: /[\[\]]/
95 }]
96 };
97 this.normalizeRules();
98 };
99 oop.inherits(JsDocCommentHighlightRules, TextHighlightRules);
100 JsDocCommentHighlightRules.getTagRule = function (start) {
101 return {
102 token: "comment.doc.tag.storage.type",
103 regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b"
104 };
105 };
106 JsDocCommentHighlightRules.getStartRule = function (start) {
107 return {
108 token: "comment.doc", // doc comment
109 regex: "\\/\\*(?=\\*)",
110 next: start
111 };
112 };
113 JsDocCommentHighlightRules.getEndRule = function (start) {
114 return {
115 token: "comment.doc", // closing comment
116 regex: "\\*\\/",
117 next: start
118 };
119 };
120 exports.JsDocCommentHighlightRules = JsDocCommentHighlightRules;
121
122 });
123
124 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";
125 var oop = require("../lib/oop");
126 var DocCommentHighlightRules = require("./jsdoc_comment_highlight_rules").JsDocCommentHighlightRules;
127 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
128 var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
129 var JavaScriptHighlightRules = function (options) {
130 var keywordMapper = this.createKeywordMapper({
131 "variable.language": "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Symbol|" + // Constructors
132 "Namespace|QName|XML|XMLList|" + // E4X
133 "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
134 "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
135 "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
136 "SyntaxError|TypeError|URIError|" +
137 "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
138 "isNaN|parseFloat|parseInt|" +
139 "JSON|Math|" + // Other
140 "this|arguments|prototype|window|document", // Pseudo
141 "keyword": "const|yield|import|get|set|async|await|" +
142 "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
143 "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
144 "__parent__|__count__|escape|unescape|with|__proto__|" +
145 "class|enum|extends|super|export|implements|private|public|interface|package|protected|static|constructor",
146 "storage.type": "const|let|var|function",
147 "constant.language": "null|Infinity|NaN|undefined",
148 "support.function": "alert",
149 "constant.language.boolean": "true|false"
150 }, "identifier");
151 var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
152 var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
153 "u[0-9a-fA-F]{4}|" + // unicode
154 "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
155 "[0-2][0-7]{0,2}|" + // oct
156 "3[0-7][0-7]?|" + // oct
157 "[4-7][0-7]?|" + //oct
158 ".)";
159 this.$rules = {
160 "no_regex": [
161 DocCommentHighlightRules.getStartRule("doc-start"),
162 comments("no_regex"),
163 {
164 token: "string",
165 regex: "'(?=.)",
166 next: "qstring"
167 }, {
168 token: "string",
169 regex: '"(?=.)',
170 next: "qqstring"
171 }, {
172 token: "constant.numeric", // hexadecimal, octal and binary
173 regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
174 }, {
175 token: "constant.numeric", // decimal integers and floats
176 regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
177 }, {
178 token: [
179 "storage.type", "punctuation.operator", "support.function",
180 "punctuation.operator", "entity.name.function", "text", "keyword.operator"
181 ],
182 regex: "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe + ")(\\s*)(=)",
183 next: "function_arguments"
184 }, {
185 token: [
186 "storage.type", "punctuation.operator", "entity.name.function", "text",
187 "keyword.operator", "text", "storage.type", "text", "paren.lparen"
188 ],
189 regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function\\*?)(\\s*)(\\()",
190 next: "function_arguments"
191 }, {
192 token: [
193 "entity.name.function", "text", "keyword.operator", "text", "storage.type",
194 "text", "paren.lparen"
195 ],
196 regex: "(" + identifierRe + ")(\\s*)(=)(\\s*)(function\\*?)(\\s*)(\\()",
197 next: "function_arguments"
198 }, {
199 token: [
200 "storage.type", "punctuation.operator", "entity.name.function", "text",
201 "keyword.operator", "text",
202 "storage.type", "text", "entity.name.function", "text", "paren.lparen"
203 ],
204 regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function\\*?)(\\s+)(\\w+)(\\s*)(\\()",
205 next: "function_arguments"
206 }, {
207 token: [
208 "storage.type", "text", "entity.name.function", "text", "paren.lparen"
209 ],
210 regex: "(function\\*?)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
211 next: "function_arguments"
212 }, {
213 token: [
214 "entity.name.function", "text", "punctuation.operator",
215 "text", "storage.type", "text", "paren.lparen"
216 ],
217 regex: "(" + identifierRe + ")(\\s*)(:)(\\s*)(function\\*?)(\\s*)(\\()",
218 next: "function_arguments"
219 }, {
220 token: [
221 "text", "text", "storage.type", "text", "paren.lparen"
222 ],
223 regex: "(:)(\\s*)(function\\*?)(\\s*)(\\()",
224 next: "function_arguments"
225 }, {
226 token: "keyword",
227 regex: "from(?=\\s*('|\"))"
228 }, {
229 token: "keyword",
230 regex: "(?:" + kwBeforeRe + ")\\b",
231 next: "start"
232 }, {
233 token: "support.constant",
234 regex: /that\b/
235 }, {
236 token: ["storage.type", "punctuation.operator", "support.function.firebug"],
237 regex: /(console)(\.)(warn|info|log|error|debug|time|trace|timeEnd|assert)\b/
238 }, {
239 token: keywordMapper,
240 regex: identifierRe
241 }, {
242 token: "punctuation.operator",
243 regex: /[.](?![.])/,
244 next: "property"
245 }, {
246 token: "storage.type",
247 regex: /=>/,
248 next: "start"
249 }, {
250 token: "keyword.operator",
251 regex: /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
252 next: "start"
253 }, {
254 token: "punctuation.operator",
255 regex: /[?:,;.]/,
256 next: "start"
257 }, {
258 token: "paren.lparen",
259 regex: /[\[({]/,
260 next: "start"
261 }, {
262 token: "paren.rparen",
263 regex: /[\])}]/
264 }, {
265 token: "comment",
266 regex: /^#!.*$/
267 }
268 ],
269 property: [{
270 token: "text",
271 regex: "\\s+"
272 }, {
273 token: [
274 "storage.type", "punctuation.operator", "entity.name.function", "text",
275 "keyword.operator", "text",
276 "storage.type", "text", "entity.name.function", "text", "paren.lparen"
277 ],
278 regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function\\*?)(?:(\\s+)(\\w+))?(\\s*)(\\()",
279 next: "function_arguments"
280 }, {
281 token: "punctuation.operator",
282 regex: /[.](?![.])/
283 }, {
284 token: "support.function",
285 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(?=\()/
286 }, {
287 token: "support.function.dom",
288 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(?=\()/
289 }, {
290 token: "support.constant",
291 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/
292 }, {
293 token: "identifier",
294 regex: identifierRe
295 }, {
296 regex: "",
297 token: "empty",
298 next: "no_regex"
299 }
300 ],
301 "start": [
302 DocCommentHighlightRules.getStartRule("doc-start"),
303 comments("start"),
304 {
305 token: "string.regexp",
306 regex: "\\/",
307 next: "regex"
308 }, {
309 token: "text",
310 regex: "\\s+|^$",
311 next: "start"
312 }, {
313 token: "empty",
314 regex: "",
315 next: "no_regex"
316 }
317 ],
318 "regex": [
319 {
320 token: "regexp.keyword.operator",
321 regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
322 }, {
323 token: "string.regexp",
324 regex: "/[sxngimy]*",
325 next: "no_regex"
326 }, {
327 token: "invalid",
328 regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
329 }, {
330 token: "constant.language.escape",
331 regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
332 }, {
333 token: "constant.language.delimiter",
334 regex: /\|/
335 }, {
336 token: "constant.language.escape",
337 regex: /\[\^?/,
338 next: "regex_character_class"
339 }, {
340 token: "empty",
341 regex: "$",
342 next: "no_regex"
343 }, {
344 defaultToken: "string.regexp"
345 }
346 ],
347 "regex_character_class": [
348 {
349 token: "regexp.charclass.keyword.operator",
350 regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
351 }, {
352 token: "constant.language.escape",
353 regex: "]",
354 next: "regex"
355 }, {
356 token: "constant.language.escape",
357 regex: "-"
358 }, {
359 token: "empty",
360 regex: "$",
361 next: "no_regex"
362 }, {
363 defaultToken: "string.regexp.charachterclass"
364 }
365 ],
366 "default_parameter": [
367 {
368 token: "string",
369 regex: "'(?=.)",
370 push: [
371 {
372 token: "string",
373 regex: "'|$",
374 next: "pop"
375 }, {
376 include: "qstring"
377 }
378 ]
379 }, {
380 token: "string",
381 regex: '"(?=.)',
382 push: [
383 {
384 token: "string",
385 regex: '"|$',
386 next: "pop"
387 }, {
388 include: "qqstring"
389 }
390 ]
391 }, {
392 token: "constant.language",
393 regex: "null|Infinity|NaN|undefined"
394 }, {
395 token: "constant.numeric", // hexadecimal, octal and binary
396 regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
397 }, {
398 token: "constant.numeric", // decimal integers and floats
399 regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
400 }, {
401 token: "punctuation.operator",
402 regex: ",",
403 next: "function_arguments"
404 }, {
405 token: "text",
406 regex: "\\s+"
407 }, {
408 token: "punctuation.operator",
409 regex: "$"
410 }, {
411 token: "empty",
412 regex: "",
413 next: "no_regex"
414 }
415 ],
416 "function_arguments": [
417 comments("function_arguments"),
418 {
419 token: "variable.parameter",
420 regex: identifierRe
421 }, {
422 token: "punctuation.operator",
423 regex: ","
424 }, {
425 token: "text",
426 regex: "\\s+"
427 }, {
428 token: "punctuation.operator",
429 regex: "$"
430 }, {
431 token: "empty",
432 regex: "",
433 next: "no_regex"
434 }
435 ],
436 "qqstring": [
437 {
438 token: "constant.language.escape",
439 regex: escapedRe
440 }, {
441 token: "string",
442 regex: "\\\\$",
443 consumeLineEnd: true
444 }, {
445 token: "string",
446 regex: '"|$',
447 next: "no_regex"
448 }, {
449 defaultToken: "string"
450 }
451 ],
452 "qstring": [
453 {
454 token: "constant.language.escape",
455 regex: escapedRe
456 }, {
457 token: "string",
458 regex: "\\\\$",
459 consumeLineEnd: true
460 }, {
461 token: "string",
462 regex: "'|$",
463 next: "no_regex"
464 }, {
465 defaultToken: "string"
466 }
467 ]
468 };
469 if (!options || !options.noES6) {
470 this.$rules.no_regex.unshift({
471 regex: "[{}]", onMatch: function (val, state, stack) {
472 this.next = val == "{" ? this.nextState : "";
473 if (val == "{" && stack.length) {
474 stack.unshift("start", state);
475 }
476 else if (val == "}" && stack.length) {
477 stack.shift();
478 this.next = stack.shift();
479 if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
480 return "paren.quasi.end";
481 }
482 return val == "{" ? "paren.lparen" : "paren.rparen";
483 },
484 nextState: "start"
485 }, {
486 token: "string.quasi.start",
487 regex: /`/,
488 push: [{
489 token: "constant.language.escape",
490 regex: escapedRe
491 }, {
492 token: "paren.quasi.start",
493 regex: /\${/,
494 push: "start"
495 }, {
496 token: "string.quasi.end",
497 regex: /`/,
498 next: "pop"
499 }, {
500 defaultToken: "string.quasi"
501 }]
502 }, {
503 token: ["variable.parameter", "text"],
504 regex: "(" + identifierRe + ")(\\s*)(?=\\=>)"
505 }, {
506 token: "paren.lparen",
507 regex: "(\\()(?=.+\\s*=>)",
508 next: "function_arguments"
509 }, {
510 token: "variable.language",
511 regex: "(?:(?:(?:Weak)?(?:Set|Map))|Promise)\\b"
512 });
513 this.$rules["function_arguments"].unshift({
514 token: "keyword.operator",
515 regex: "=",
516 next: "default_parameter"
517 }, {
518 token: "keyword.operator",
519 regex: "\\.{3}"
520 });
521 this.$rules["property"].unshift({
522 token: "support.function",
523 regex: "(findIndex|repeat|startsWith|endsWith|includes|isSafeInteger|trunc|cbrt|log2|log10|sign|then|catch|"
524 + "finally|resolve|reject|race|any|all|allSettled|keys|entries|isInteger)\\b(?=\\()"
525 }, {
526 token: "constant.language",
527 regex: "(?:MAX_SAFE_INTEGER|MIN_SAFE_INTEGER|EPSILON)\\b"
528 });
529 if (!options || options.jsx != false)
530 JSX.call(this);
531 }
532 this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("no_regex")]);
533 this.normalizeRules();
534 };
535 oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
536 function JSX() {
537 var tagRegex = identifierRe.replace("\\d", "\\d\\-");
538 var jsxTag = {
539 onMatch: function (val, state, stack) {
540 var offset = val.charAt(1) == "/" ? 2 : 1;
541 if (offset == 1) {
542 if (state != this.nextState)
543 stack.unshift(this.next, this.nextState, 0);
544 else
545 stack.unshift(this.next);
546 stack[2]++;
547 }
548 else if (offset == 2) {
549 if (state == this.nextState) {
550 stack[1]--;
551 if (!stack[1] || stack[1] < 0) {
552 stack.shift();
553 stack.shift();
554 }
555 }
556 }
557 return [{
558 type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
559 value: val.slice(0, offset)
560 }, {
561 type: "meta.tag.tag-name.xml",
562 value: val.substr(offset)
563 }];
564 },
565 regex: "</?" + tagRegex + "",
566 next: "jsxAttributes",
567 nextState: "jsx"
568 };
569 this.$rules.start.unshift(jsxTag);
570 var jsxJsRule = {
571 regex: "{",
572 token: "paren.quasi.start",
573 push: "start"
574 };
575 this.$rules.jsx = [
576 jsxJsRule,
577 jsxTag,
578 { include: "reference" },
579 { defaultToken: "string" }
580 ];
581 this.$rules.jsxAttributes = [{
582 token: "meta.tag.punctuation.tag-close.xml",
583 regex: "/?>",
584 onMatch: function (value, currentState, stack) {
585 if (currentState == stack[0])
586 stack.shift();
587 if (value.length == 2) {
588 if (stack[0] == this.nextState)
589 stack[1]--;
590 if (!stack[1] || stack[1] < 0) {
591 stack.splice(0, 2);
592 }
593 }
594 this.next = stack[0] || "start";
595 return [{ type: this.token, value: value }];
596 },
597 nextState: "jsx"
598 },
599 jsxJsRule,
600 comments("jsxAttributes"),
601 {
602 token: "entity.other.attribute-name.xml",
603 regex: tagRegex
604 }, {
605 token: "keyword.operator.attribute-equals.xml",
606 regex: "="
607 }, {
608 token: "text.tag-whitespace.xml",
609 regex: "\\s+"
610 }, {
611 token: "string.attribute-value.xml",
612 regex: "'",
613 stateName: "jsx_attr_q",
614 push: [
615 { token: "string.attribute-value.xml", regex: "'", next: "pop" },
616 { include: "reference" },
617 { defaultToken: "string.attribute-value.xml" }
618 ]
619 }, {
620 token: "string.attribute-value.xml",
621 regex: '"',
622 stateName: "jsx_attr_qq",
623 push: [
624 { token: "string.attribute-value.xml", regex: '"', next: "pop" },
625 { include: "reference" },
626 { defaultToken: "string.attribute-value.xml" }
627 ]
628 },
629 jsxTag
630 ];
631 this.$rules.reference = [{
632 token: "constant.language.escape.reference.xml",
633 regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
634 }];
635 }
636 function comments(next) {
637 return [
638 {
639 token: "comment", // multi line comment
640 regex: /\/\*/,
641 next: [
642 DocCommentHighlightRules.getTagRule(),
643 { token: "comment", regex: "\\*\\/", next: next || "pop" },
644 { defaultToken: "comment", caseInsensitive: true }
645 ]
646 }, {
647 token: "comment",
648 regex: "\\/\\/",
649 next: [
650 DocCommentHighlightRules.getTagRule(),
651 { token: "comment", regex: "$|^", next: next || "pop" },
652 { defaultToken: "comment", caseInsensitive: true }
653 ]
654 }
655 ];
656 }
657 exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
658
659 });
660
661 ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
662 var Range = require("../range").Range;
663 var MatchingBraceOutdent = function () { };
664 (function () {
665 this.checkOutdent = function (line, input) {
666 if (!/^\s+$/.test(line))
667 return false;
668 return /^\s*\}/.test(input);
669 };
670 this.autoOutdent = function (doc, row) {
671 var line = doc.getLine(row);
672 var match = line.match(/^(\s*\})/);
673 if (!match)
674 return 0;
675 var column = match[1].length;
676 var openBracePos = doc.findMatchingBracket({ row: row, column: column });
677 if (!openBracePos || openBracePos.row == row)
678 return 0;
679 var indent = this.$getIndent(doc.getLine(openBracePos.row));
680 doc.replace(new Range(row, 0, row, column - 1), indent);
681 };
682 this.$getIndent = function (line) {
683 return line.match(/^\s*/)[0];
684 };
685 }).call(MatchingBraceOutdent.prototype);
686 exports.MatchingBraceOutdent = MatchingBraceOutdent;
687
688 });
689
690 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";
691 var oop = require("../../lib/oop");
692 var Range = require("../../range").Range;
693 var BaseFoldMode = require("./fold_mode").FoldMode;
694 var FoldMode = exports.FoldMode = function (commentRegex) {
695 if (commentRegex) {
696 this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
697 this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
698 }
699 };
700 oop.inherits(FoldMode, BaseFoldMode);
701 (function () {
702 this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
703 this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
704 this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
705 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
706 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
707 this._getFoldWidgetBase = this.getFoldWidget;
708 this.getFoldWidget = function (session, foldStyle, row) {
709 var line = session.getLine(row);
710 if (this.singleLineBlockCommentRe.test(line)) {
711 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
712 return "";
713 }
714 var fw = this._getFoldWidgetBase(session, foldStyle, row);
715 if (!fw && this.startRegionRe.test(line))
716 return "start"; // lineCommentRegionStart
717 return fw;
718 };
719 this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
720 var line = session.getLine(row);
721 if (this.startRegionRe.test(line))
722 return this.getCommentRegionBlock(session, line, row);
723 var match = line.match(this.foldingStartMarker);
724 if (match) {
725 var i = match.index;
726 if (match[1])
727 return this.openingBracketBlock(session, match[1], row, i);
728 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
729 if (range && !range.isMultiLine()) {
730 if (forceMultiline) {
731 range = this.getSectionRange(session, row);
732 }
733 else if (foldStyle != "all")
734 range = null;
735 }
736 return range;
737 }
738 if (foldStyle === "markbegin")
739 return;
740 var match = line.match(this.foldingStopMarker);
741 if (match) {
742 var i = match.index + match[0].length;
743 if (match[1])
744 return this.closingBracketBlock(session, match[1], row, i);
745 return session.getCommentFoldRange(row, i, -1);
746 }
747 };
748 this.getSectionRange = function (session, row) {
749 var line = session.getLine(row);
750 var startIndent = line.search(/\S/);
751 var startRow = row;
752 var startColumn = line.length;
753 row = row + 1;
754 var endRow = row;
755 var maxRow = session.getLength();
756 while (++row < maxRow) {
757 line = session.getLine(row);
758 var indent = line.search(/\S/);
759 if (indent === -1)
760 continue;
761 if (startIndent > indent)
762 break;
763 var subRange = this.getFoldWidgetRange(session, "all", row);
764 if (subRange) {
765 if (subRange.start.row <= startRow) {
766 break;
767 }
768 else if (subRange.isMultiLine()) {
769 row = subRange.end.row;
770 }
771 else if (startIndent == indent) {
772 break;
773 }
774 }
775 endRow = row;
776 }
777 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
778 };
779 this.getCommentRegionBlock = function (session, line, row) {
780 var startColumn = line.search(/\s*$/);
781 var maxRow = session.getLength();
782 var startRow = row;
783 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
784 var depth = 1;
785 while (++row < maxRow) {
786 line = session.getLine(row);
787 var m = re.exec(line);
788 if (!m)
789 continue;
790 if (m[1])
791 depth--;
792 else
793 depth++;
794 if (!depth)
795 break;
796 }
797 var endRow = row;
798 if (endRow > startRow) {
799 return new Range(startRow, startColumn, endRow, line.length);
800 }
801 };
802 }).call(FoldMode.prototype);
803
804 });
805
806 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";
807 var oop = require("../lib/oop");
808 var TextMode = require("./text").Mode;
809 var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
810 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
811 var WorkerClient = require("../worker/worker_client").WorkerClient;
812 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
813 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
814 var Mode = function () {
815 this.HighlightRules = JavaScriptHighlightRules;
816 this.$outdent = new MatchingBraceOutdent();
817 this.$behaviour = new CstyleBehaviour();
818 this.foldingRules = new CStyleFoldMode();
819 };
820 oop.inherits(Mode, TextMode);
821 (function () {
822 this.lineCommentStart = "//";
823 this.blockComment = { start: "/*", end: "*/" };
824 this.$quotes = { '"': '"', "'": "'", "`": "`" };
825 this.$pairQuotesAfter = {
826 "`": /\w/
827 };
828 this.getNextLineIndent = function (state, line, tab) {
829 var indent = this.$getIndent(line);
830 var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
831 var tokens = tokenizedLine.tokens;
832 var endState = tokenizedLine.state;
833 if (tokens.length && tokens[tokens.length - 1].type == "comment") {
834 return indent;
835 }
836 if (state == "start" || state == "no_regex") {
837 var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
838 if (match) {
839 indent += tab;
840 }
841 }
842 else if (state == "doc-start") {
843 if (endState == "start" || endState == "no_regex") {
844 return "";
845 }
846 var match = line.match(/^\s*(\/?)\*/);
847 if (match) {
848 if (match[1]) {
849 indent += " ";
850 }
851 indent += "* ";
852 }
853 }
854 return indent;
855 };
856 this.checkOutdent = function (state, line, input) {
857 return this.$outdent.checkOutdent(line, input);
858 };
859 this.autoOutdent = function (state, doc, row) {
860 this.$outdent.autoOutdent(doc, row);
861 };
862 this.createWorker = function (session) {
863 var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
864 worker.attachToDocument(session.getDocument());
865 worker.on("annotate", function (results) {
866 session.setAnnotations(results.data);
867 });
868 worker.on("terminate", function () {
869 session.clearAnnotations();
870 });
871 return worker;
872 };
873 this.$id = "ace/mode/javascript";
874 this.snippetFileId = "ace/snippets/javascript";
875 }).call(Mode.prototype);
876 exports.Mode = Mode;
877
878 });
879
880 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";
881 var oop = require("../lib/oop");
882 var lang = require("../lib/lang");
883 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
884 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";
885 var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
886 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";
887 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";
888 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";
889 var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
890 var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
891 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";
892 var CssHighlightRules = function () {
893 var keywordMapper = this.createKeywordMapper({
894 "support.function": supportFunction,
895 "support.constant": supportConstant,
896 "support.type": supportType,
897 "support.constant.color": supportConstantColor,
898 "support.constant.fonts": supportConstantFonts
899 }, "text", true);
900 this.$rules = {
901 "start": [{
902 include: ["strings", "url", "comments"]
903 }, {
904 token: "paren.lparen",
905 regex: "\\{",
906 next: "ruleset"
907 }, {
908 token: "paren.rparen",
909 regex: "\\}"
910 }, {
911 token: "string",
912 regex: "@(?!viewport)",
913 next: "media"
914 }, {
915 token: "keyword",
916 regex: "#[a-z0-9-_]+"
917 }, {
918 token: "keyword",
919 regex: "%"
920 }, {
921 token: "variable",
922 regex: "\\.[a-z0-9-_]+"
923 }, {
924 token: "string",
925 regex: ":[a-z0-9-_]+"
926 }, {
927 token: "constant.numeric",
928 regex: numRe
929 }, {
930 token: "constant",
931 regex: "[a-z0-9-_]+"
932 }, {
933 caseInsensitive: true
934 }],
935 "media": [{
936 include: ["strings", "url", "comments"]
937 }, {
938 token: "paren.lparen",
939 regex: "\\{",
940 next: "start"
941 }, {
942 token: "paren.rparen",
943 regex: "\\}",
944 next: "start"
945 }, {
946 token: "string",
947 regex: ";",
948 next: "start"
949 }, {
950 token: "keyword",
951 regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
952 + "|page|font|keyframes|viewport|counter-style|font-feature-values"
953 + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
954 }],
955 "comments": [{
956 token: "comment", // multi line comment
957 regex: "\\/\\*",
958 push: [{
959 token: "comment",
960 regex: "\\*\\/",
961 next: "pop"
962 }, {
963 defaultToken: "comment"
964 }]
965 }],
966 "ruleset": [{
967 regex: "-(webkit|ms|moz|o)-",
968 token: "text"
969 }, {
970 token: "punctuation.operator",
971 regex: "[:;]"
972 }, {
973 token: "paren.rparen",
974 regex: "\\}",
975 next: "start"
976 }, {
977 include: ["strings", "url", "comments"]
978 }, {
979 token: ["constant.numeric", "keyword"],
980 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|%)"
981 }, {
982 token: "constant.numeric",
983 regex: numRe
984 }, {
985 token: "constant.numeric", // hex6 color
986 regex: "#[a-f0-9]{6}"
987 }, {
988 token: "constant.numeric", // hex3 color
989 regex: "#[a-f0-9]{3}"
990 }, {
991 token: ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
992 regex: pseudoElements
993 }, {
994 token: ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
995 regex: pseudoClasses
996 }, {
997 include: "url"
998 }, {
999 token: keywordMapper,
1000 regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
1001 }, {
1002 caseInsensitive: true
1003 }],
1004 url: [{
1005 token: "support.function",
1006 regex: "(?:url(:?-prefix)?|domain|regexp)\\(",
1007 push: [{
1008 token: "support.function",
1009 regex: "\\)",
1010 next: "pop"
1011 }, {
1012 defaultToken: "string"
1013 }]
1014 }],
1015 strings: [{
1016 token: "string.start",
1017 regex: "'",
1018 push: [{
1019 token: "string.end",
1020 regex: "'|$",
1021 next: "pop"
1022 }, {
1023 include: "escapes"
1024 }, {
1025 token: "constant.language.escape",
1026 regex: /\\$/,
1027 consumeLineEnd: true
1028 }, {
1029 defaultToken: "string"
1030 }]
1031 }, {
1032 token: "string.start",
1033 regex: '"',
1034 push: [{
1035 token: "string.end",
1036 regex: '"|$',
1037 next: "pop"
1038 }, {
1039 include: "escapes"
1040 }, {
1041 token: "constant.language.escape",
1042 regex: /\\$/,
1043 consumeLineEnd: true
1044 }, {
1045 defaultToken: "string"
1046 }]
1047 }],
1048 escapes: [{
1049 token: "constant.language.escape",
1050 regex: /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
1051 }]
1052 };
1053 this.normalizeRules();
1054 };
1055 oop.inherits(CssHighlightRules, TextHighlightRules);
1056 exports.CssHighlightRules = CssHighlightRules;
1057
1058 });
1059
1060 ace.define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module){"use strict";
1061 var propertyMap = {
1062 "background": { "#$0": 1 },
1063 "background-color": { "#$0": 1, "transparent": 1, "fixed": 1 },
1064 "background-image": { "url('/$0')": 1 },
1065 "background-repeat": { "repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1 },
1066 "background-position": { "bottom": 2, "center": 2, "left": 2, "right": 2, "top": 2, "inherit": 2 },
1067 "background-attachment": { "scroll": 1, "fixed": 1 },
1068 "background-size": { "cover": 1, "contain": 1 },
1069 "background-clip": { "border-box": 1, "padding-box": 1, "content-box": 1 },
1070 "background-origin": { "border-box": 1, "padding-box": 1, "content-box": 1 },
1071 "border": { "solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1 },
1072 "border-color": { "#$0": 1 },
1073 "border-style": { "solid": 2, "dashed": 2, "dotted": 2, "double": 2, "groove": 2, "hidden": 2, "inherit": 2, "inset": 2, "none": 2, "outset": 2, "ridged": 2 },
1074 "border-collapse": { "collapse": 1, "separate": 1 },
1075 "bottom": { "px": 1, "em": 1, "%": 1 },
1076 "clear": { "left": 1, "right": 1, "both": 1, "none": 1 },
1077 "color": { "#$0": 1, "rgb(#$00,0,0)": 1 },
1078 "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 },
1079 "display": { "none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1 },
1080 "empty-cells": { "show": 1, "hide": 1 },
1081 "float": { "left": 1, "right": 1, "none": 1 },
1082 "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 },
1083 "font-size": { "px": 1, "em": 1, "%": 1 },
1084 "font-weight": { "bold": 1, "normal": 1 },
1085 "font-style": { "italic": 1, "normal": 1 },
1086 "font-variant": { "normal": 1, "small-caps": 1 },
1087 "height": { "px": 1, "em": 1, "%": 1 },
1088 "left": { "px": 1, "em": 1, "%": 1 },
1089 "letter-spacing": { "normal": 1 },
1090 "line-height": { "normal": 1 },
1091 "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 },
1092 "margin": { "px": 1, "em": 1, "%": 1 },
1093 "margin-right": { "px": 1, "em": 1, "%": 1 },
1094 "margin-left": { "px": 1, "em": 1, "%": 1 },
1095 "margin-top": { "px": 1, "em": 1, "%": 1 },
1096 "margin-bottom": { "px": 1, "em": 1, "%": 1 },
1097 "max-height": { "px": 1, "em": 1, "%": 1 },
1098 "max-width": { "px": 1, "em": 1, "%": 1 },
1099 "min-height": { "px": 1, "em": 1, "%": 1 },
1100 "min-width": { "px": 1, "em": 1, "%": 1 },
1101 "overflow": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
1102 "overflow-x": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
1103 "overflow-y": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
1104 "padding": { "px": 1, "em": 1, "%": 1 },
1105 "padding-top": { "px": 1, "em": 1, "%": 1 },
1106 "padding-right": { "px": 1, "em": 1, "%": 1 },
1107 "padding-bottom": { "px": 1, "em": 1, "%": 1 },
1108 "padding-left": { "px": 1, "em": 1, "%": 1 },
1109 "page-break-after": { "auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1 },
1110 "page-break-before": { "auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1 },
1111 "position": { "absolute": 1, "relative": 1, "fixed": 1, "static": 1 },
1112 "right": { "px": 1, "em": 1, "%": 1 },
1113 "table-layout": { "fixed": 1, "auto": 1 },
1114 "text-decoration": { "none": 1, "underline": 1, "line-through": 1, "blink": 1 },
1115 "text-align": { "left": 1, "right": 1, "center": 1, "justify": 1 },
1116 "text-transform": { "capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1 },
1117 "top": { "px": 1, "em": 1, "%": 1 },
1118 "vertical-align": { "top": 1, "bottom": 1 },
1119 "visibility": { "hidden": 1, "visible": 1 },
1120 "white-space": { "nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1 },
1121 "width": { "px": 1, "em": 1, "%": 1 },
1122 "word-spacing": { "normal": 1 },
1123 "filter": { "alpha(opacity=$0100)": 1 },
1124 "text-shadow": { "$02px 2px 2px #777": 1 },
1125 "text-overflow": { "ellipsis-word": 1, "clip": 1, "ellipsis": 1 },
1126 "-moz-border-radius": 1,
1127 "-moz-border-radius-topright": 1,
1128 "-moz-border-radius-bottomright": 1,
1129 "-moz-border-radius-topleft": 1,
1130 "-moz-border-radius-bottomleft": 1,
1131 "-webkit-border-radius": 1,
1132 "-webkit-border-top-right-radius": 1,
1133 "-webkit-border-top-left-radius": 1,
1134 "-webkit-border-bottom-right-radius": 1,
1135 "-webkit-border-bottom-left-radius": 1,
1136 "-moz-box-shadow": 1,
1137 "-webkit-box-shadow": 1,
1138 "transform": { "rotate($00deg)": 1, "skew($00deg)": 1 },
1139 "-moz-transform": { "rotate($00deg)": 1, "skew($00deg)": 1 },
1140 "-webkit-transform": { "rotate($00deg)": 1, "skew($00deg)": 1 }
1141 };
1142 var CssCompletions = function () {
1143 };
1144 (function () {
1145 this.completionsDefined = false;
1146 this.defineCompletions = function () {
1147 if (document) {
1148 var style = document.createElement('c').style;
1149 for (var i in style) {
1150 if (typeof style[i] !== 'string')
1151 continue;
1152 var name = i.replace(/[A-Z]/g, function (x) {
1153 return '-' + x.toLowerCase();
1154 });
1155 if (!propertyMap.hasOwnProperty(name))
1156 propertyMap[name] = 1;
1157 }
1158 }
1159 this.completionsDefined = true;
1160 };
1161 this.getCompletions = function (state, session, pos, prefix) {
1162 if (!this.completionsDefined) {
1163 this.defineCompletions();
1164 }
1165 if (state === 'ruleset' || session.$mode.$id == "ace/mode/scss") {
1166 var line = session.getLine(pos.row).substr(0, pos.column);
1167 var inParens = /\([^)]*$/.test(line);
1168 if (inParens) {
1169 line = line.substr(line.lastIndexOf('(') + 1);
1170 }
1171 if (/:[^;]+$/.test(line)) {
1172 /([\w\-]+):[^:]*$/.test(line);
1173 return this.getPropertyValueCompletions(state, session, pos, prefix);
1174 }
1175 else {
1176 return this.getPropertyCompletions(state, session, pos, prefix, inParens);
1177 }
1178 }
1179 return [];
1180 };
1181 this.getPropertyCompletions = function (state, session, pos, prefix, skipSemicolon) {
1182 skipSemicolon = skipSemicolon || false;
1183 var properties = Object.keys(propertyMap);
1184 return properties.map(function (property) {
1185 return {
1186 caption: property,
1187 snippet: property + ': $0' + (skipSemicolon ? '' : ';'),
1188 meta: "property",
1189 score: 1000000
1190 };
1191 });
1192 };
1193 this.getPropertyValueCompletions = function (state, session, pos, prefix) {
1194 var line = session.getLine(pos.row).substr(0, pos.column);
1195 var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
1196 if (!property)
1197 return [];
1198 var values = [];
1199 if (property in propertyMap && typeof propertyMap[property] === "object") {
1200 values = Object.keys(propertyMap[property]);
1201 }
1202 return values.map(function (value) {
1203 return {
1204 caption: value,
1205 snippet: value,
1206 meta: "property value",
1207 score: 1000000
1208 };
1209 });
1210 };
1211 }).call(CssCompletions.prototype);
1212 exports.CssCompletions = CssCompletions;
1213
1214 });
1215
1216 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";
1217 var oop = require("../../lib/oop");
1218 var Behaviour = require("../behaviour").Behaviour;
1219 var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1220 var TokenIterator = require("../../token_iterator").TokenIterator;
1221 var CssBehaviour = function () {
1222 this.inherit(CstyleBehaviour);
1223 this.add("colon", "insertion", function (state, action, editor, session, text) {
1224 if (text === ':' && editor.selection.isEmpty()) {
1225 var cursor = editor.getCursorPosition();
1226 var iterator = new TokenIterator(session, cursor.row, cursor.column);
1227 var token = iterator.getCurrentToken();
1228 if (token && token.value.match(/\s+/)) {
1229 token = iterator.stepBackward();
1230 }
1231 if (token && token.type === 'support.type') {
1232 var line = session.doc.getLine(cursor.row);
1233 var rightChar = line.substring(cursor.column, cursor.column + 1);
1234 if (rightChar === ':') {
1235 return {
1236 text: '',
1237 selection: [1, 1]
1238 };
1239 }
1240 if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
1241 return {
1242 text: ':;',
1243 selection: [1, 1]
1244 };
1245 }
1246 }
1247 }
1248 });
1249 this.add("colon", "deletion", function (state, action, editor, session, range) {
1250 var selected = session.doc.getTextRange(range);
1251 if (!range.isMultiLine() && selected === ':') {
1252 var cursor = editor.getCursorPosition();
1253 var iterator = new TokenIterator(session, cursor.row, cursor.column);
1254 var token = iterator.getCurrentToken();
1255 if (token && token.value.match(/\s+/)) {
1256 token = iterator.stepBackward();
1257 }
1258 if (token && token.type === 'support.type') {
1259 var line = session.doc.getLine(range.start.row);
1260 var rightChar = line.substring(range.end.column, range.end.column + 1);
1261 if (rightChar === ';') {
1262 range.end.column++;
1263 return range;
1264 }
1265 }
1266 }
1267 });
1268 this.add("semicolon", "insertion", function (state, action, editor, session, text) {
1269 if (text === ';' && editor.selection.isEmpty()) {
1270 var cursor = editor.getCursorPosition();
1271 var line = session.doc.getLine(cursor.row);
1272 var rightChar = line.substring(cursor.column, cursor.column + 1);
1273 if (rightChar === ';') {
1274 return {
1275 text: '',
1276 selection: [1, 1]
1277 };
1278 }
1279 }
1280 });
1281 this.add("!important", "insertion", function (state, action, editor, session, text) {
1282 if (text === '!' && editor.selection.isEmpty()) {
1283 var cursor = editor.getCursorPosition();
1284 var line = session.doc.getLine(cursor.row);
1285 if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
1286 return {
1287 text: '!important',
1288 selection: [10, 10]
1289 };
1290 }
1291 }
1292 });
1293 };
1294 oop.inherits(CssBehaviour, CstyleBehaviour);
1295 exports.CssBehaviour = CssBehaviour;
1296
1297 });
1298
1299 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";
1300 var oop = require("../lib/oop");
1301 var TextMode = require("./text").Mode;
1302 var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1303 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1304 var WorkerClient = require("../worker/worker_client").WorkerClient;
1305 var CssCompletions = require("./css_completions").CssCompletions;
1306 var CssBehaviour = require("./behaviour/css").CssBehaviour;
1307 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1308 var Mode = function () {
1309 this.HighlightRules = CssHighlightRules;
1310 this.$outdent = new MatchingBraceOutdent();
1311 this.$behaviour = new CssBehaviour();
1312 this.$completer = new CssCompletions();
1313 this.foldingRules = new CStyleFoldMode();
1314 };
1315 oop.inherits(Mode, TextMode);
1316 (function () {
1317 this.foldingRules = "cStyle";
1318 this.blockComment = { start: "/*", end: "*/" };
1319 this.getNextLineIndent = function (state, line, tab) {
1320 var indent = this.$getIndent(line);
1321 var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
1322 if (tokens.length && tokens[tokens.length - 1].type == "comment") {
1323 return indent;
1324 }
1325 var match = line.match(/^.*\{\s*$/);
1326 if (match) {
1327 indent += tab;
1328 }
1329 return indent;
1330 };
1331 this.checkOutdent = function (state, line, input) {
1332 return this.$outdent.checkOutdent(line, input);
1333 };
1334 this.autoOutdent = function (state, doc, row) {
1335 this.$outdent.autoOutdent(doc, row);
1336 };
1337 this.getCompletions = function (state, session, pos, prefix) {
1338 return this.$completer.getCompletions(state, session, pos, prefix);
1339 };
1340 this.createWorker = function (session) {
1341 var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1342 worker.attachToDocument(session.getDocument());
1343 worker.on("annotate", function (e) {
1344 session.setAnnotations(e.data);
1345 });
1346 worker.on("terminate", function () {
1347 session.clearAnnotations();
1348 });
1349 return worker;
1350 };
1351 this.$id = "ace/mode/css";
1352 this.snippetFileId = "ace/snippets/css";
1353 }).call(Mode.prototype);
1354 exports.Mode = Mode;
1355
1356 });
1357
1358 ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
1359 var oop = require("../lib/oop");
1360 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1361 var XmlHighlightRules = function (normalize) {
1362 var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
1363 this.$rules = {
1364 start: [
1365 { token: "string.cdata.xml", regex: "<\\!\\[CDATA\\[", next: "cdata" },
1366 {
1367 token: ["punctuation.instruction.xml", "keyword.instruction.xml"],
1368 regex: "(<\\?)(" + tagRegex + ")", next: "processing_instruction"
1369 },
1370 { token: "comment.start.xml", regex: "<\\!--", next: "comment" },
1371 {
1372 token: ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
1373 regex: "(<\\!)(DOCTYPE)(?=[\\s])", next: "doctype", caseInsensitive: true
1374 },
1375 { include: "tag" },
1376 { token: "text.end-tag-open.xml", regex: "</" },
1377 { token: "text.tag-open.xml", regex: "<" },
1378 { include: "reference" },
1379 { defaultToken: "text.xml" }
1380 ],
1381 processing_instruction: [{
1382 token: "entity.other.attribute-name.decl-attribute-name.xml",
1383 regex: tagRegex
1384 }, {
1385 token: "keyword.operator.decl-attribute-equals.xml",
1386 regex: "="
1387 }, {
1388 include: "whitespace"
1389 }, {
1390 include: "string"
1391 }, {
1392 token: "punctuation.xml-decl.xml",
1393 regex: "\\?>",
1394 next: "start"
1395 }],
1396 doctype: [
1397 { include: "whitespace" },
1398 { include: "string" },
1399 { token: "xml-pe.doctype.xml", regex: ">", next: "start" },
1400 { token: "xml-pe.xml", regex: "[-_a-zA-Z0-9:]+" },
1401 { token: "punctuation.int-subset", regex: "\\[", push: "int_subset" }
1402 ],
1403 int_subset: [{
1404 token: "text.xml",
1405 regex: "\\s+"
1406 }, {
1407 token: "punctuation.int-subset.xml",
1408 regex: "]",
1409 next: "pop"
1410 }, {
1411 token: ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
1412 regex: "(<\\!)(" + tagRegex + ")",
1413 push: [{
1414 token: "text",
1415 regex: "\\s+"
1416 },
1417 {
1418 token: "punctuation.markup-decl.xml",
1419 regex: ">",
1420 next: "pop"
1421 },
1422 { include: "string" }]
1423 }],
1424 cdata: [
1425 { token: "string.cdata.xml", regex: "\\]\\]>", next: "start" },
1426 { token: "text.xml", regex: "\\s+" },
1427 { token: "text.xml", regex: "(?:[^\\]]|\\](?!\\]>))+" }
1428 ],
1429 comment: [
1430 { token: "comment.end.xml", regex: "-->", next: "start" },
1431 { defaultToken: "comment.xml" }
1432 ],
1433 reference: [{
1434 token: "constant.language.escape.reference.xml",
1435 regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1436 }],
1437 attr_reference: [{
1438 token: "constant.language.escape.reference.attribute-value.xml",
1439 regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1440 }],
1441 tag: [{
1442 token: ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
1443 regex: "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
1444 next: [
1445 { include: "attributes" },
1446 { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" }
1447 ]
1448 }],
1449 tag_whitespace: [
1450 { token: "text.tag-whitespace.xml", regex: "\\s+" }
1451 ],
1452 whitespace: [
1453 { token: "text.whitespace.xml", regex: "\\s+" }
1454 ],
1455 string: [{
1456 token: "string.xml",
1457 regex: "'",
1458 push: [
1459 { token: "string.xml", regex: "'", next: "pop" },
1460 { defaultToken: "string.xml" }
1461 ]
1462 }, {
1463 token: "string.xml",
1464 regex: '"',
1465 push: [
1466 { token: "string.xml", regex: '"', next: "pop" },
1467 { defaultToken: "string.xml" }
1468 ]
1469 }],
1470 attributes: [{
1471 token: "entity.other.attribute-name.xml",
1472 regex: tagRegex
1473 }, {
1474 token: "keyword.operator.attribute-equals.xml",
1475 regex: "="
1476 }, {
1477 include: "tag_whitespace"
1478 }, {
1479 include: "attribute_value"
1480 }],
1481 attribute_value: [{
1482 token: "string.attribute-value.xml",
1483 regex: "'",
1484 push: [
1485 { token: "string.attribute-value.xml", regex: "'", next: "pop" },
1486 { include: "attr_reference" },
1487 { defaultToken: "string.attribute-value.xml" }
1488 ]
1489 }, {
1490 token: "string.attribute-value.xml",
1491 regex: '"',
1492 push: [
1493 { token: "string.attribute-value.xml", regex: '"', next: "pop" },
1494 { include: "attr_reference" },
1495 { defaultToken: "string.attribute-value.xml" }
1496 ]
1497 }]
1498 };
1499 if (this.constructor === XmlHighlightRules)
1500 this.normalizeRules();
1501 };
1502 (function () {
1503 this.embedTagRules = function (HighlightRules, prefix, tag) {
1504 this.$rules.tag.unshift({
1505 token: ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
1506 regex: "(<)(" + tag + "(?=\\s|>|$))",
1507 next: [
1508 { include: "attributes" },
1509 { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: prefix + "start" }
1510 ]
1511 });
1512 this.$rules[tag + "-end"] = [
1513 { include: "attributes" },
1514 { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start",
1515 onMatch: function (value, currentState, stack) {
1516 stack.splice(0);
1517 return this.token;
1518 } }
1519 ];
1520 this.embedRules(HighlightRules, prefix, [{
1521 token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
1522 regex: "(</)(" + tag + "(?=\\s|>|$))",
1523 next: tag + "-end"
1524 }, {
1525 token: "string.cdata.xml",
1526 regex: "<\\!\\[CDATA\\["
1527 }, {
1528 token: "string.cdata.xml",
1529 regex: "\\]\\]>"
1530 }]);
1531 };
1532 }).call(TextHighlightRules.prototype);
1533 oop.inherits(XmlHighlightRules, TextHighlightRules);
1534 exports.XmlHighlightRules = XmlHighlightRules;
1535
1536 });
1537
1538 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";
1539 var oop = require("../lib/oop");
1540 var lang = require("../lib/lang");
1541 var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1542 var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1543 var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
1544 var tagMap = lang.createMap({
1545 a: 'anchor',
1546 button: 'form',
1547 form: 'form',
1548 img: 'image',
1549 input: 'form',
1550 label: 'form',
1551 option: 'form',
1552 script: 'script',
1553 select: 'form',
1554 textarea: 'form',
1555 style: 'style',
1556 table: 'table',
1557 tbody: 'table',
1558 td: 'table',
1559 tfoot: 'table',
1560 th: 'table',
1561 tr: 'table'
1562 });
1563 var HtmlHighlightRules = function () {
1564 XmlHighlightRules.call(this);
1565 this.addRules({
1566 attributes: [{
1567 include: "tag_whitespace"
1568 }, {
1569 token: "entity.other.attribute-name.xml",
1570 regex: "[-_a-zA-Z0-9:.]+"
1571 }, {
1572 token: "keyword.operator.attribute-equals.xml",
1573 regex: "=",
1574 push: [{
1575 include: "tag_whitespace"
1576 }, {
1577 token: "string.unquoted.attribute-value.html",
1578 regex: "[^<>='\"`\\s]+",
1579 next: "pop"
1580 }, {
1581 token: "empty",
1582 regex: "",
1583 next: "pop"
1584 }]
1585 }, {
1586 include: "attribute_value"
1587 }],
1588 tag: [{
1589 token: function (start, tag) {
1590 var group = tagMap[tag];
1591 return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
1592 "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
1593 },
1594 regex: "(</?)([-_a-zA-Z0-9:.]+)",
1595 next: "tag_stuff"
1596 }],
1597 tag_stuff: [
1598 { include: "attributes" },
1599 { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" }
1600 ]
1601 });
1602 this.embedTagRules(CssHighlightRules, "css-", "style");
1603 this.embedTagRules(new JavaScriptHighlightRules({ jsx: false }).getRules(), "js-", "script");
1604 if (this.constructor === HtmlHighlightRules)
1605 this.normalizeRules();
1606 };
1607 oop.inherits(HtmlHighlightRules, XmlHighlightRules);
1608 exports.HtmlHighlightRules = HtmlHighlightRules;
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/handlebars_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/html_highlight_rules"], function(require, exports, module){/* global define */
2275 "use strict";
2276 var oop = require("../lib/oop");
2277 var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
2278 function pop2(currentState, stack) {
2279 stack.splice(0, 3);
2280 return stack.shift() || "start";
2281 }
2282 var HandlebarsHighlightRules = function () {
2283 HtmlHighlightRules.call(this);
2284 var hbs = {
2285 regex: "(?={{)",
2286 push: "handlebars"
2287 };
2288 for (var key in this.$rules) {
2289 this.$rules[key].unshift(hbs);
2290 }
2291 this.$rules.handlebars = [{
2292 token: "comment.start",
2293 regex: "{{!--",
2294 push: [{
2295 token: "comment.end",
2296 regex: "--}}",
2297 next: pop2
2298 }, {
2299 defaultToken: "comment"
2300 }]
2301 }, {
2302 token: "comment.start",
2303 regex: "{{!",
2304 push: [{
2305 token: "comment.end",
2306 regex: "}}",
2307 next: pop2
2308 }, {
2309 defaultToken: "comment"
2310 }]
2311 }, {
2312 token: "support.function", // unescaped variable
2313 regex: "{{{",
2314 push: [{
2315 token: "support.function",
2316 regex: "}}}",
2317 next: pop2
2318 }, {
2319 token: "variable.parameter",
2320 regex: "[a-zA-Z_$][a-zA-Z0-9_$]*"
2321 }]
2322 }, {
2323 token: "storage.type.start", // begin section
2324 regex: "{{[#\\^/&]?",
2325 push: [{
2326 token: "storage.type.end",
2327 regex: "}}",
2328 next: pop2
2329 }, {
2330 token: "variable.parameter",
2331 regex: "[a-zA-Z_$][a-zA-Z0-9_$]*"
2332 }]
2333 }];
2334 this.normalizeRules();
2335 };
2336 oop.inherits(HandlebarsHighlightRules, HtmlHighlightRules);
2337 exports.HandlebarsHighlightRules = HandlebarsHighlightRules;
2338
2339 });
2340
2341 ace.define("ace/mode/behaviour/html",["require","exports","module","ace/lib/oop","ace/mode/behaviour/xml"], function(require, exports, module){"use strict";
2342 var oop = require("../../lib/oop");
2343 var XmlBehaviour = require("../behaviour/xml").XmlBehaviour;
2344 var HtmlBehaviour = function () {
2345 XmlBehaviour.call(this);
2346 };
2347 oop.inherits(HtmlBehaviour, XmlBehaviour);
2348 exports.HtmlBehaviour = HtmlBehaviour;
2349
2350 });
2351
2352 ace.define("ace/mode/handlebars",["require","exports","module","ace/lib/oop","ace/mode/html","ace/mode/handlebars_highlight_rules","ace/mode/behaviour/html","ace/mode/folding/html"], function(require, exports, module){/* global define */
2353 "use strict";
2354 var oop = require("../lib/oop");
2355 var HtmlMode = require("./html").Mode;
2356 var HandlebarsHighlightRules = require("./handlebars_highlight_rules").HandlebarsHighlightRules;
2357 var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour;
2358 var HtmlFoldMode = require("./folding/html").FoldMode;
2359 var Mode = function () {
2360 HtmlMode.call(this);
2361 this.HighlightRules = HandlebarsHighlightRules;
2362 this.$behaviour = new HtmlBehaviour();
2363 };
2364 oop.inherits(Mode, HtmlMode);
2365 (function () {
2366 this.blockComment = { start: "{{!--", end: "--}}" };
2367 this.$id = "ace/mode/handlebars";
2368 }).call(Mode.prototype);
2369 exports.Mode = Mode;
2370
2371 }); (function() {
2372 ace.require(["ace/mode/handlebars"], function(m) {
2373 if (typeof module == "object" && typeof exports == "object" && module) {
2374 module.exports = m;
2375 }
2376 });
2377 })();
2378