Debian Codegraph @

extensions/CodeEditor/modules/lib/ace/mode-mask.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/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
662 var oop = require("../lib/oop");
663 var lang = require("../lib/lang");
664 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
665 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";
666 var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
667 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";
668 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";
669 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";
670 var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
671 var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
672 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";
673 var CssHighlightRules = function () {
674 var keywordMapper = this.createKeywordMapper({
675 "support.function": supportFunction,
676 "support.constant": supportConstant,
677 "support.type": supportType,
678 "support.constant.color": supportConstantColor,
679 "support.constant.fonts": supportConstantFonts
680 }, "text", true);
681 this.$rules = {
682 "start": [{
683 include: ["strings", "url", "comments"]
684 }, {
685 token: "paren.lparen",
686 regex: "\\{",
687 next: "ruleset"
688 }, {
689 token: "paren.rparen",
690 regex: "\\}"
691 }, {
692 token: "string",
693 regex: "@(?!viewport)",
694 next: "media"
695 }, {
696 token: "keyword",
697 regex: "#[a-z0-9-_]+"
698 }, {
699 token: "keyword",
700 regex: "%"
701 }, {
702 token: "variable",
703 regex: "\\.[a-z0-9-_]+"
704 }, {
705 token: "string",
706 regex: ":[a-z0-9-_]+"
707 }, {
708 token: "constant.numeric",
709 regex: numRe
710 }, {
711 token: "constant",
712 regex: "[a-z0-9-_]+"
713 }, {
714 caseInsensitive: true
715 }],
716 "media": [{
717 include: ["strings", "url", "comments"]
718 }, {
719 token: "paren.lparen",
720 regex: "\\{",
721 next: "start"
722 }, {
723 token: "paren.rparen",
724 regex: "\\}",
725 next: "start"
726 }, {
727 token: "string",
728 regex: ";",
729 next: "start"
730 }, {
731 token: "keyword",
732 regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
733 + "|page|font|keyframes|viewport|counter-style|font-feature-values"
734 + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
735 }],
736 "comments": [{
737 token: "comment", // multi line comment
738 regex: "\\/\\*",
739 push: [{
740 token: "comment",
741 regex: "\\*\\/",
742 next: "pop"
743 }, {
744 defaultToken: "comment"
745 }]
746 }],
747 "ruleset": [{
748 regex: "-(webkit|ms|moz|o)-",
749 token: "text"
750 }, {
751 token: "punctuation.operator",
752 regex: "[:;]"
753 }, {
754 token: "paren.rparen",
755 regex: "\\}",
756 next: "start"
757 }, {
758 include: ["strings", "url", "comments"]
759 }, {
760 token: ["constant.numeric", "keyword"],
761 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|%)"
762 }, {
763 token: "constant.numeric",
764 regex: numRe
765 }, {
766 token: "constant.numeric", // hex6 color
767 regex: "#[a-f0-9]{6}"
768 }, {
769 token: "constant.numeric", // hex3 color
770 regex: "#[a-f0-9]{3}"
771 }, {
772 token: ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
773 regex: pseudoElements
774 }, {
775 token: ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
776 regex: pseudoClasses
777 }, {
778 include: "url"
779 }, {
780 token: keywordMapper,
781 regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
782 }, {
783 caseInsensitive: true
784 }],
785 url: [{
786 token: "support.function",
787 regex: "(?:url(:?-prefix)?|domain|regexp)\\(",
788 push: [{
789 token: "support.function",
790 regex: "\\)",
791 next: "pop"
792 }, {
793 defaultToken: "string"
794 }]
795 }],
796 strings: [{
797 token: "string.start",
798 regex: "'",
799 push: [{
800 token: "string.end",
801 regex: "'|$",
802 next: "pop"
803 }, {
804 include: "escapes"
805 }, {
806 token: "constant.language.escape",
807 regex: /\\$/,
808 consumeLineEnd: true
809 }, {
810 defaultToken: "string"
811 }]
812 }, {
813 token: "string.start",
814 regex: '"',
815 push: [{
816 token: "string.end",
817 regex: '"|$',
818 next: "pop"
819 }, {
820 include: "escapes"
821 }, {
822 token: "constant.language.escape",
823 regex: /\\$/,
824 consumeLineEnd: true
825 }, {
826 defaultToken: "string"
827 }]
828 }],
829 escapes: [{
830 token: "constant.language.escape",
831 regex: /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
832 }]
833 };
834 this.normalizeRules();
835 };
836 oop.inherits(CssHighlightRules, TextHighlightRules);
837 exports.CssHighlightRules = CssHighlightRules;
838
839 });
840
841 ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
842 var oop = require("../lib/oop");
843 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
844 var XmlHighlightRules = function (normalize) {
845 var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
846 this.$rules = {
847 start: [
848 { token: "string.cdata.xml", regex: "<\\!\\[CDATA\\[", next: "cdata" },
849 {
850 token: ["punctuation.instruction.xml", "keyword.instruction.xml"],
851 regex: "(<\\?)(" + tagRegex + ")", next: "processing_instruction"
852 },
853 { token: "comment.start.xml", regex: "<\\!--", next: "comment" },
854 {
855 token: ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
856 regex: "(<\\!)(DOCTYPE)(?=[\\s])", next: "doctype", caseInsensitive: true
857 },
858 { include: "tag" },
859 { token: "text.end-tag-open.xml", regex: "</" },
860 { token: "text.tag-open.xml", regex: "<" },
861 { include: "reference" },
862 { defaultToken: "text.xml" }
863 ],
864 processing_instruction: [{
865 token: "entity.other.attribute-name.decl-attribute-name.xml",
866 regex: tagRegex
867 }, {
868 token: "keyword.operator.decl-attribute-equals.xml",
869 regex: "="
870 }, {
871 include: "whitespace"
872 }, {
873 include: "string"
874 }, {
875 token: "punctuation.xml-decl.xml",
876 regex: "\\?>",
877 next: "start"
878 }],
879 doctype: [
880 { include: "whitespace" },
881 { include: "string" },
882 { token: "xml-pe.doctype.xml", regex: ">", next: "start" },
883 { token: "xml-pe.xml", regex: "[-_a-zA-Z0-9:]+" },
884 { token: "punctuation.int-subset", regex: "\\[", push: "int_subset" }
885 ],
886 int_subset: [{
887 token: "text.xml",
888 regex: "\\s+"
889 }, {
890 token: "punctuation.int-subset.xml",
891 regex: "]",
892 next: "pop"
893 }, {
894 token: ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
895 regex: "(<\\!)(" + tagRegex + ")",
896 push: [{
897 token: "text",
898 regex: "\\s+"
899 },
900 {
901 token: "punctuation.markup-decl.xml",
902 regex: ">",
903 next: "pop"
904 },
905 { include: "string" }]
906 }],
907 cdata: [
908 { token: "string.cdata.xml", regex: "\\]\\]>", next: "start" },
909 { token: "text.xml", regex: "\\s+" },
910 { token: "text.xml", regex: "(?:[^\\]]|\\](?!\\]>))+" }
911 ],
912 comment: [
913 { token: "comment.end.xml", regex: "-->", next: "start" },
914 { defaultToken: "comment.xml" }
915 ],
916 reference: [{
917 token: "constant.language.escape.reference.xml",
918 regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
919 }],
920 attr_reference: [{
921 token: "constant.language.escape.reference.attribute-value.xml",
922 regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
923 }],
924 tag: [{
925 token: ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
926 regex: "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
927 next: [
928 { include: "attributes" },
929 { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" }
930 ]
931 }],
932 tag_whitespace: [
933 { token: "text.tag-whitespace.xml", regex: "\\s+" }
934 ],
935 whitespace: [
936 { token: "text.whitespace.xml", regex: "\\s+" }
937 ],
938 string: [{
939 token: "string.xml",
940 regex: "'",
941 push: [
942 { token: "string.xml", regex: "'", next: "pop" },
943 { defaultToken: "string.xml" }
944 ]
945 }, {
946 token: "string.xml",
947 regex: '"',
948 push: [
949 { token: "string.xml", regex: '"', next: "pop" },
950 { defaultToken: "string.xml" }
951 ]
952 }],
953 attributes: [{
954 token: "entity.other.attribute-name.xml",
955 regex: tagRegex
956 }, {
957 token: "keyword.operator.attribute-equals.xml",
958 regex: "="
959 }, {
960 include: "tag_whitespace"
961 }, {
962 include: "attribute_value"
963 }],
964 attribute_value: [{
965 token: "string.attribute-value.xml",
966 regex: "'",
967 push: [
968 { token: "string.attribute-value.xml", regex: "'", next: "pop" },
969 { include: "attr_reference" },
970 { defaultToken: "string.attribute-value.xml" }
971 ]
972 }, {
973 token: "string.attribute-value.xml",
974 regex: '"',
975 push: [
976 { token: "string.attribute-value.xml", regex: '"', next: "pop" },
977 { include: "attr_reference" },
978 { defaultToken: "string.attribute-value.xml" }
979 ]
980 }]
981 };
982 if (this.constructor === XmlHighlightRules)
983 this.normalizeRules();
984 };
985 (function () {
986 this.embedTagRules = function (HighlightRules, prefix, tag) {
987 this.$rules.tag.unshift({
988 token: ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
989 regex: "(<)(" + tag + "(?=\\s|>|$))",
990 next: [
991 { include: "attributes" },
992 { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: prefix + "start" }
993 ]
994 });
995 this.$rules[tag + "-end"] = [
996 { include: "attributes" },
997 { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start",
998 onMatch: function (value, currentState, stack) {
999 stack.splice(0);
1000 return this.token;
1001 } }
1002 ];
1003 this.embedRules(HighlightRules, prefix, [{
1004 token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
1005 regex: "(</)(" + tag + "(?=\\s|>|$))",
1006 next: tag + "-end"
1007 }, {
1008 token: "string.cdata.xml",
1009 regex: "<\\!\\[CDATA\\["
1010 }, {
1011 token: "string.cdata.xml",
1012 regex: "\\]\\]>"
1013 }]);
1014 };
1015 }).call(TextHighlightRules.prototype);
1016 oop.inherits(XmlHighlightRules, TextHighlightRules);
1017 exports.XmlHighlightRules = XmlHighlightRules;
1018
1019 });
1020
1021 ace.define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(require, exports, module){"use strict";
1022 var oop = require("../lib/oop");
1023 var lang = require("../lib/lang");
1024 var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1025 var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1026 var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
1027 var tagMap = lang.createMap({
1028 a: 'anchor',
1029 button: 'form',
1030 form: 'form',
1031 img: 'image',
1032 input: 'form',
1033 label: 'form',
1034 option: 'form',
1035 script: 'script',
1036 select: 'form',
1037 textarea: 'form',
1038 style: 'style',
1039 table: 'table',
1040 tbody: 'table',
1041 td: 'table',
1042 tfoot: 'table',
1043 th: 'table',
1044 tr: 'table'
1045 });
1046 var HtmlHighlightRules = function () {
1047 XmlHighlightRules.call(this);
1048 this.addRules({
1049 attributes: [{
1050 include: "tag_whitespace"
1051 }, {
1052 token: "entity.other.attribute-name.xml",
1053 regex: "[-_a-zA-Z0-9:.]+"
1054 }, {
1055 token: "keyword.operator.attribute-equals.xml",
1056 regex: "=",
1057 push: [{
1058 include: "tag_whitespace"
1059 }, {
1060 token: "string.unquoted.attribute-value.html",
1061 regex: "[^<>='\"`\\s]+",
1062 next: "pop"
1063 }, {
1064 token: "empty",
1065 regex: "",
1066 next: "pop"
1067 }]
1068 }, {
1069 include: "attribute_value"
1070 }],
1071 tag: [{
1072 token: function (start, tag) {
1073 var group = tagMap[tag];
1074 return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
1075 "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
1076 },
1077 regex: "(</?)([-_a-zA-Z0-9:.]+)",
1078 next: "tag_stuff"
1079 }],
1080 tag_stuff: [
1081 { include: "attributes" },
1082 { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" }
1083 ]
1084 });
1085 this.embedTagRules(CssHighlightRules, "css-", "style");
1086 this.embedTagRules(new JavaScriptHighlightRules({ jsx: false }).getRules(), "js-", "script");
1087 if (this.constructor === HtmlHighlightRules)
1088 this.normalizeRules();
1089 };
1090 oop.inherits(HtmlHighlightRules, XmlHighlightRules);
1091 exports.HtmlHighlightRules = HtmlHighlightRules;
1092
1093 });
1094
1095 ace.define("ace/mode/markdown_highlight_rules",["require","exports","module","ace/config","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module){"use strict";
1096 var modes = require("../config").$modes;
1097 var oop = require("../lib/oop");
1098 var lang = require("../lib/lang");
1099 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1100 var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
1101 var escaped = function (ch) {
1102 return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*";
1103 };
1104 var MarkdownHighlightRules = function () {
1105 HtmlHighlightRules.call(this);
1106 var codeBlockStartRule = {
1107 token: "support.function",
1108 regex: /^\s*(```+[^`]*|~~~+[^~]*)$/,
1109 onMatch: function (value, state, stack, line) {
1110 var m = value.match(/^(\s*)([`~]+)(.*)/);
1111 var language = /[\w-]+|$/.exec(m[3])[0];
1112 if (!modes[language])
1113 language = "";
1114 stack.unshift("githubblock", [], [m[1], m[2], language], state);
1115 return this.token;
1116 },
1117 next: "githubblock"
1118 };
1119 var codeBlockRules = [{
1120 token: "support.function",
1121 regex: ".*",
1122 onMatch: function (value, state, stack, line) {
1123 var embedState = stack[1];
1124 var indent = stack[2][0];
1125 var endMarker = stack[2][1];
1126 var language = stack[2][2];
1127 var m = /^(\s*)(`+|~+)\s*$/.exec(value);
1128 if (m && m[1].length < indent.length + 3
1129 && m[2].length >= endMarker.length && m[2][0] == endMarker[0]) {
1130 stack.splice(0, 3);
1131 this.next = stack.shift();
1132 return this.token;
1133 }
1134 this.next = "";
1135 if (language && modes[language]) {
1136 var data = modes[language].getTokenizer().getLineTokens(value, embedState.slice(0));
1137 stack[1] = data.state;
1138 return data.tokens;
1139 }
1140 return this.token;
1141 }
1142 }];
1143 this.$rules["start"].unshift({
1144 token: "empty_line",
1145 regex: '^$',
1146 next: "allowBlock"
1147 }, {
1148 token: "markup.heading.1",
1149 regex: "^=+(?=\\s*$)"
1150 }, {
1151 token: "markup.heading.2",
1152 regex: "^\\-+(?=\\s*$)"
1153 }, {
1154 token: function (value) {
1155 return "markup.heading." + value.length;
1156 },
1157 regex: /^#{1,6}(?=\s|$)/,
1158 next: "header"
1159 }, codeBlockStartRule, {
1160 token: "string.blockquote",
1161 regex: "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
1162 next: "blockquote"
1163 }, {
1164 token: "constant",
1165 regex: "^ {0,3}(?:(?:\\* ?){3,}|(?:\\- ?){3,}|(?:\\_ ?){3,})\\s*$",
1166 next: "allowBlock"
1167 }, {
1168 token: "markup.list",
1169 regex: "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
1170 next: "listblock-start"
1171 }, {
1172 include: "basic"
1173 });
1174 this.addRules({
1175 "basic": [{
1176 token: "constant.language.escape",
1177 regex: /\\[\\`*_{}\[\]()#+\-.!]/
1178 }, {
1179 token: "support.function",
1180 regex: "(`+)(.*?[^`])(\\1)"
1181 }, {
1182 token: ["text", "constant", "text", "url", "string", "text"],
1183 regex: "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
1184 }, {
1185 token: ["text", "string", "text", "constant", "text"],
1186 regex: "(\\[)(" + escaped("]") + ")(\\]\\s*\\[)(" + escaped("]") + ")(\\])"
1187 }, {
1188 token: ["text", "string", "text", "markup.underline", "string", "text"],
1189 regex: "(\\!?\\[)(" + // [
1190 escaped("]") + // link text or alt text
1191 ")(\\]\\()" + // ](
1192 '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href or image
1193 '(\\s*"' + escaped('"') + '"\\s*)?' + // "title"
1194 "(\\))" // )
1195 }, {
1196 token: "string.strong",
1197 regex: "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
1198 }, {
1199 token: "string.emphasis",
1200 regex: "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
1201 }, {
1202 token: ["text", "url", "text"],
1203 regex: "(<)(" +
1204 "(?:https?|ftp|dict):[^'\">\\s]+" +
1205 "|" +
1206 "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+" +
1207 ")(>)"
1208 }],
1209 "allowBlock": [
1210 { token: "support.function", regex: "^ {4}.+", next: "allowBlock" },
1211 { token: "empty_line", regex: '^$', next: "allowBlock" },
1212 { token: "empty", regex: "", next: "start" }
1213 ],
1214 "header": [{
1215 regex: "$",
1216 next: "start"
1217 }, {
1218 include: "basic"
1219 }, {
1220 defaultToken: "heading"
1221 }],
1222 "listblock-start": [{
1223 token: "support.variable",
1224 regex: /(?:\[[ x]\])?/,
1225 next: "listblock"
1226 }],
1227 "listblock": [{
1228 token: "empty_line",
1229 regex: "^$",
1230 next: "start"
1231 }, {
1232 token: "markup.list",
1233 regex: "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
1234 next: "listblock-start"
1235 }, {
1236 include: "basic", noEscape: true
1237 },
1238 codeBlockStartRule,
1239 {
1240 defaultToken: "list" //do not use markup.list to allow stling leading `*` differntly
1241 }],
1242 "blockquote": [{
1243 token: "empty_line",
1244 regex: "^\\s*$",
1245 next: "start"
1246 }, {
1247 token: "string.blockquote",
1248 regex: "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
1249 next: "blockquote"
1250 }, {
1251 include: "basic", noEscape: true
1252 }, {
1253 defaultToken: "string.blockquote"
1254 }],
1255 "githubblock": codeBlockRules
1256 });
1257 this.normalizeRules();
1258 };
1259 oop.inherits(MarkdownHighlightRules, TextHighlightRules);
1260 exports.MarkdownHighlightRules = MarkdownHighlightRules;
1261
1262 });
1263
1264 ace.define("ace/mode/mask_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/css_highlight_rules","ace/mode/markdown_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module){"use strict";
1265 exports.MaskHighlightRules = MaskHighlightRules;
1266 var oop = require("../lib/oop");
1267 var lang = require("../lib/lang");
1268 var TextRules = require("./text_highlight_rules").TextHighlightRules;
1269 var JSRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1270 var CssRules = require("./css_highlight_rules").CssHighlightRules;
1271 var MDRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
1272 var HTMLRules = require("./html_highlight_rules").HtmlHighlightRules;
1273 var token_TAG = "keyword.support.constant.language", token_COMPO = "support.function.markup.bold", token_KEYWORD = "keyword", token_LANG = "constant.language", token_UTIL = "keyword.control.markup.italic", token_ATTR = "support.variable.class", token_PUNKT = "keyword.operator", token_ITALIC = "markup.italic", token_BOLD = "markup.bold", token_LPARE = "paren.lparen", token_RPARE = "paren.rparen";
1274 var const_FUNCTIONS, const_KEYWORDS, const_CONST, const_TAGS;
1275 (function () {
1276 const_FUNCTIONS = lang.arrayToMap(("log").split("|"));
1277 const_CONST = lang.arrayToMap((":dualbind|:bind|:import|slot|event|style|html|markdown|md").split("|"));
1278 const_KEYWORDS = lang.arrayToMap(("debugger|define|var|if|each|for|of|else|switch|case|with|visible|+if|+each|+for|+switch|+with|+visible|include|import").split("|"));
1279 const_TAGS = lang.arrayToMap(("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
1280 "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
1281 "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
1282 "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
1283 "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
1284 "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
1285 "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
1286 "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
1287 "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|"));
1288 }());
1289 function MaskHighlightRules() {
1290 this.$rules = {
1291 "start": [
1292 Token("comment", "\\/\\/.*$"),
1293 Token("comment", "\\/\\*", [
1294 Token("comment", ".*?\\*\\/", "start"),
1295 Token("comment", ".+")
1296 ]),
1297 Blocks.string("'''"),
1298 Blocks.string('"""'),
1299 Blocks.string('"'),
1300 Blocks.string("'"),
1301 Blocks.syntax(/(markdown|md)\b/, "md-multiline", "multiline"),
1302 Blocks.syntax(/html\b/, "html-multiline", "multiline"),
1303 Blocks.syntax(/(slot|event)\b/, "js-block", "block"),
1304 Blocks.syntax(/style\b/, "css-block", "block"),
1305 Blocks.syntax(/var\b/, "js-statement", "attr"),
1306 Blocks.tag(),
1307 Token(token_LPARE, "[[({>]"),
1308 Token(token_RPARE, "[\\])};]", "start"),
1309 {
1310 caseInsensitive: true
1311 }
1312 ]
1313 };
1314 var rules = this;
1315 addJavaScript("interpolation", /\]/, token_RPARE + "." + token_ITALIC);
1316 addJavaScript("statement", /\)|}|;/);
1317 addJavaScript("block", /\}/);
1318 addCss();
1319 addMarkdown();
1320 addHtml();
1321 function addJavaScript(name, escape, closeType) {
1322 var prfx = "js-" + name + "-", rootTokens = name === "block" ? ["start"] : ["start", "no_regex"];
1323 add(JSRules, prfx, escape, rootTokens, closeType);
1324 }
1325 function addCss() {
1326 add(CssRules, "css-block-", /\}/);
1327 }
1328 function addMarkdown() {
1329 add(MDRules, "md-multiline-", /("""|''')/, []);
1330 }
1331 function addHtml() {
1332 add(HTMLRules, "html-multiline-", /("""|''')/);
1333 }
1334 function add(Rules, strPrfx, rgxEnd, rootTokens, closeType) {
1335 var next = "pop";
1336 var tokens = rootTokens || ["start"];
1337 if (tokens.length === 0) {
1338 tokens = null;
1339 }
1340 if (/block|multiline/.test(strPrfx)) {
1341 next = strPrfx + "end";
1342 rules.$rules[next] = [
1343 Token("empty", "", "start")
1344 ];
1345 }
1346 rules.embedRules(Rules, strPrfx, [Token(closeType || token_RPARE, rgxEnd, next)], tokens, tokens == null ? true : false);
1347 }
1348 this.normalizeRules();
1349 }
1350 oop.inherits(MaskHighlightRules, TextRules);
1351 var Blocks = {
1352 string: function (str, next) {
1353 var token = Token("string.start", str, [
1354 Token(token_LPARE + "." + token_ITALIC, /~\[/, Blocks.interpolation()),
1355 Token("string.end", str, "pop"),
1356 {
1357 defaultToken: "string"
1358 }
1359 ], next);
1360 if (str.length === 1) {
1361 var escaped = Token("string.escape", "\\\\" + str);
1362 token.push.unshift(escaped);
1363 }
1364 return token;
1365 },
1366 interpolation: function () {
1367 return [
1368 Token(token_UTIL, /\s*\w*\s*:/),
1369 "js-interpolation-start"
1370 ];
1371 },
1372 tagHead: function (rgx) {
1373 return Token(token_ATTR, rgx, [
1374 Token(token_ATTR, /[\w\-_]+/),
1375 Token(token_LPARE + "." + token_ITALIC, /~\[/, Blocks.interpolation()),
1376 Blocks.goUp()
1377 ]);
1378 },
1379 tag: function () {
1380 return {
1381 token: 'tag',
1382 onMatch: function (value) {
1383 if (void 0 !== const_KEYWORDS[value])
1384 return token_KEYWORD;
1385 if (void 0 !== const_CONST[value])
1386 return token_LANG;
1387 if (void 0 !== const_FUNCTIONS[value])
1388 return "support.function";
1389 if (void 0 !== const_TAGS[value.toLowerCase()])
1390 return token_TAG;
1391 return token_COMPO;
1392 },
1393 regex: /([@\w\-_:+]+)|((^|\s)(?=\s*(\.|#)))/,
1394 push: [
1395 Blocks.tagHead(/\./),
1396 Blocks.tagHead(/#/),
1397 Blocks.expression(),
1398 Blocks.attribute(),
1399 Token(token_LPARE, /[;>{]/, "pop")
1400 ]
1401 };
1402 },
1403 syntax: function (rgx, next, type) {
1404 return {
1405 token: token_LANG,
1406 regex: rgx,
1407 push: ({
1408 "attr": [
1409 next + "-start",
1410 Token(token_PUNKT, /;/, "start")
1411 ],
1412 "multiline": [
1413 Blocks.tagHead(/\./),
1414 Blocks.tagHead(/#/),
1415 Blocks.attribute(),
1416 Blocks.expression(),
1417 Token(token_LPARE, /[>\{]/),
1418 Token(token_PUNKT, /;/, "start"),
1419 Token(token_LPARE, /'''|"""/, [next + "-start"])
1420 ],
1421 "block": [
1422 Blocks.tagHead(/\./),
1423 Blocks.tagHead(/#/),
1424 Blocks.attribute(),
1425 Blocks.expression(),
1426 Token(token_LPARE, /\{/, [next + "-start"])
1427 ]
1428 })[type]
1429 };
1430 },
1431 attribute: function () {
1432 return Token(function (value) {
1433 return /^x\-/.test(value)
1434 ? token_ATTR + "." + token_BOLD
1435 : token_ATTR;
1436 }, /[\w_-]+/, [
1437 Token(token_PUNKT, /\s*=\s*/, [
1438 Blocks.string('"'),
1439 Blocks.string("'"),
1440 Blocks.word(),
1441 Blocks.goUp()
1442 ]),
1443 Blocks.goUp()
1444 ]);
1445 },
1446 expression: function () {
1447 return Token(token_LPARE, /\(/, ["js-statement-start"]);
1448 },
1449 word: function () {
1450 return Token("string", /[\w-_]+/);
1451 },
1452 goUp: function () {
1453 return Token("text", "", "pop");
1454 },
1455 goStart: function () {
1456 return Token("text", "", "start");
1457 }
1458 };
1459 function Token(token, rgx, mix) {
1460 var push, next, onMatch;
1461 if (arguments.length === 4) {
1462 push = mix;
1463 next = arguments[3];
1464 }
1465 else if (typeof mix === "string") {
1466 next = mix;
1467 }
1468 else {
1469 push = mix;
1470 }
1471 if (typeof token === "function") {
1472 onMatch = token;
1473 token = "empty";
1474 }
1475 return {
1476 token: token,
1477 regex: rgx,
1478 push: push,
1479 next: next,
1480 onMatch: onMatch
1481 };
1482 }
1483
1484 });
1485
1486 ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
1487 var Range = require("../range").Range;
1488 var MatchingBraceOutdent = function () { };
1489 (function () {
1490 this.checkOutdent = function (line, input) {
1491 if (!/^\s+$/.test(line))
1492 return false;
1493 return /^\s*\}/.test(input);
1494 };
1495 this.autoOutdent = function (doc, row) {
1496 var line = doc.getLine(row);
1497 var match = line.match(/^(\s*\})/);
1498 if (!match)
1499 return 0;
1500 var column = match[1].length;
1501 var openBracePos = doc.findMatchingBracket({ row: row, column: column });
1502 if (!openBracePos || openBracePos.row == row)
1503 return 0;
1504 var indent = this.$getIndent(doc.getLine(openBracePos.row));
1505 doc.replace(new Range(row, 0, row, column - 1), indent);
1506 };
1507 this.$getIndent = function (line) {
1508 return line.match(/^\s*/)[0];
1509 };
1510 }).call(MatchingBraceOutdent.prototype);
1511 exports.MatchingBraceOutdent = MatchingBraceOutdent;
1512
1513 });
1514
1515 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";
1516 var oop = require("../../lib/oop");
1517 var Behaviour = require("../behaviour").Behaviour;
1518 var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1519 var TokenIterator = require("../../token_iterator").TokenIterator;
1520 var CssBehaviour = function () {
1521 this.inherit(CstyleBehaviour);
1522 this.add("colon", "insertion", function (state, action, editor, session, text) {
1523 if (text === ':' && editor.selection.isEmpty()) {
1524 var cursor = editor.getCursorPosition();
1525 var iterator = new TokenIterator(session, cursor.row, cursor.column);
1526 var token = iterator.getCurrentToken();
1527 if (token && token.value.match(/\s+/)) {
1528 token = iterator.stepBackward();
1529 }
1530 if (token && token.type === 'support.type') {
1531 var line = session.doc.getLine(cursor.row);
1532 var rightChar = line.substring(cursor.column, cursor.column + 1);
1533 if (rightChar === ':') {
1534 return {
1535 text: '',
1536 selection: [1, 1]
1537 };
1538 }
1539 if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
1540 return {
1541 text: ':;',
1542 selection: [1, 1]
1543 };
1544 }
1545 }
1546 }
1547 });
1548 this.add("colon", "deletion", function (state, action, editor, session, range) {
1549 var selected = session.doc.getTextRange(range);
1550 if (!range.isMultiLine() && selected === ':') {
1551 var cursor = editor.getCursorPosition();
1552 var iterator = new TokenIterator(session, cursor.row, cursor.column);
1553 var token = iterator.getCurrentToken();
1554 if (token && token.value.match(/\s+/)) {
1555 token = iterator.stepBackward();
1556 }
1557 if (token && token.type === 'support.type') {
1558 var line = session.doc.getLine(range.start.row);
1559 var rightChar = line.substring(range.end.column, range.end.column + 1);
1560 if (rightChar === ';') {
1561 range.end.column++;
1562 return range;
1563 }
1564 }
1565 }
1566 });
1567 this.add("semicolon", "insertion", function (state, action, editor, session, text) {
1568 if (text === ';' && editor.selection.isEmpty()) {
1569 var cursor = editor.getCursorPosition();
1570 var line = session.doc.getLine(cursor.row);
1571 var rightChar = line.substring(cursor.column, cursor.column + 1);
1572 if (rightChar === ';') {
1573 return {
1574 text: '',
1575 selection: [1, 1]
1576 };
1577 }
1578 }
1579 });
1580 this.add("!important", "insertion", function (state, action, editor, session, text) {
1581 if (text === '!' && editor.selection.isEmpty()) {
1582 var cursor = editor.getCursorPosition();
1583 var line = session.doc.getLine(cursor.row);
1584 if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
1585 return {
1586 text: '!important',
1587 selection: [10, 10]
1588 };
1589 }
1590 }
1591 });
1592 };
1593 oop.inherits(CssBehaviour, CstyleBehaviour);
1594 exports.CssBehaviour = CssBehaviour;
1595
1596 });
1597
1598 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";
1599 var oop = require("../../lib/oop");
1600 var Range = require("../../range").Range;
1601 var BaseFoldMode = require("./fold_mode").FoldMode;
1602 var FoldMode = exports.FoldMode = function (commentRegex) {
1603 if (commentRegex) {
1604 this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
1605 this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
1606 }
1607 };
1608 oop.inherits(FoldMode, BaseFoldMode);
1609 (function () {
1610 this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
1611 this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
1612 this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
1613 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
1614 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
1615 this._getFoldWidgetBase = this.getFoldWidget;
1616 this.getFoldWidget = function (session, foldStyle, row) {
1617 var line = session.getLine(row);
1618 if (this.singleLineBlockCommentRe.test(line)) {
1619 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
1620 return "";
1621 }
1622 var fw = this._getFoldWidgetBase(session, foldStyle, row);
1623 if (!fw && this.startRegionRe.test(line))
1624 return "start"; // lineCommentRegionStart
1625 return fw;
1626 };
1627 this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
1628 var line = session.getLine(row);
1629 if (this.startRegionRe.test(line))
1630 return this.getCommentRegionBlock(session, line, row);
1631 var match = line.match(this.foldingStartMarker);
1632 if (match) {
1633 var i = match.index;
1634 if (match[1])
1635 return this.openingBracketBlock(session, match[1], row, i);
1636 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
1637 if (range && !range.isMultiLine()) {
1638 if (forceMultiline) {
1639 range = this.getSectionRange(session, row);
1640 }
1641 else if (foldStyle != "all")
1642 range = null;
1643 }
1644 return range;
1645 }
1646 if (foldStyle === "markbegin")
1647 return;
1648 var match = line.match(this.foldingStopMarker);
1649 if (match) {
1650 var i = match.index + match[0].length;
1651 if (match[1])
1652 return this.closingBracketBlock(session, match[1], row, i);
1653 return session.getCommentFoldRange(row, i, -1);
1654 }
1655 };
1656 this.getSectionRange = function (session, row) {
1657 var line = session.getLine(row);
1658 var startIndent = line.search(/\S/);
1659 var startRow = row;
1660 var startColumn = line.length;
1661 row = row + 1;
1662 var endRow = row;
1663 var maxRow = session.getLength();
1664 while (++row < maxRow) {
1665 line = session.getLine(row);
1666 var indent = line.search(/\S/);
1667 if (indent === -1)
1668 continue;
1669 if (startIndent > indent)
1670 break;
1671 var subRange = this.getFoldWidgetRange(session, "all", row);
1672 if (subRange) {
1673 if (subRange.start.row <= startRow) {
1674 break;
1675 }
1676 else if (subRange.isMultiLine()) {
1677 row = subRange.end.row;
1678 }
1679 else if (startIndent == indent) {
1680 break;
1681 }
1682 }
1683 endRow = row;
1684 }
1685 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
1686 };
1687 this.getCommentRegionBlock = function (session, line, row) {
1688 var startColumn = line.search(/\s*$/);
1689 var maxRow = session.getLength();
1690 var startRow = row;
1691 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
1692 var depth = 1;
1693 while (++row < maxRow) {
1694 line = session.getLine(row);
1695 var m = re.exec(line);
1696 if (!m)
1697 continue;
1698 if (m[1])
1699 depth--;
1700 else
1701 depth++;
1702 if (!depth)
1703 break;
1704 }
1705 var endRow = row;
1706 if (endRow > startRow) {
1707 return new Range(startRow, startColumn, endRow, line.length);
1708 }
1709 };
1710 }).call(FoldMode.prototype);
1711
1712 });
1713
1714 ace.define("ace/mode/mask",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mask_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
1715 var oop = require("../lib/oop");
1716 var TextMode = require("./text").Mode;
1717 var MaskHighlightRules = require("./mask_highlight_rules").MaskHighlightRules;
1718 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1719 var CssBehaviour = require("./behaviour/css").CssBehaviour;
1720 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1721 var Mode = function () {
1722 this.HighlightRules = MaskHighlightRules;
1723 this.$outdent = new MatchingBraceOutdent();
1724 this.$behaviour = new CssBehaviour();
1725 this.foldingRules = new CStyleFoldMode();
1726 };
1727 oop.inherits(Mode, TextMode);
1728 (function () {
1729 this.lineCommentStart = "//";
1730 this.blockComment = { start: "/*", end: "*/" };
1731 this.getNextLineIndent = function (state, line, tab) {
1732 var indent = this.$getIndent(line);
1733 var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
1734 if (tokens.length && tokens[tokens.length - 1].type == "comment") {
1735 return indent;
1736 }
1737 var match = line.match(/^.*\{\s*$/);
1738 if (match) {
1739 indent += tab;
1740 }
1741 return indent;
1742 };
1743 this.checkOutdent = function (state, line, input) {
1744 return this.$outdent.checkOutdent(line, input);
1745 };
1746 this.autoOutdent = function (state, doc, row) {
1747 this.$outdent.autoOutdent(doc, row);
1748 };
1749 this.$id = "ace/mode/mask";
1750 }).call(Mode.prototype);
1751 exports.Mode = Mode;
1752
1753 }); (function() {
1754 ace.require(["ace/mode/mask"], function(m) {
1755 if (typeof module == "object" && typeof exports == "object" && module) {
1756 module.exports = m;
1757 }
1758 });
1759 })();
1760