You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1786 lines
70 KiB

10 months ago
  1. ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
  2. "use strict";
  3. var oop = acequire("../lib/oop");
  4. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  5. var DocCommentHighlightRules = function() {
  6. this.$rules = {
  7. "start" : [ {
  8. token : "comment.doc.tag",
  9. regex : "@[\\w\\d_]+" // TODO: fix email addresses
  10. },
  11. DocCommentHighlightRules.getTagRule(),
  12. {
  13. defaultToken : "comment.doc",
  14. caseInsensitive: true
  15. }]
  16. };
  17. };
  18. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  19. DocCommentHighlightRules.getTagRule = function(start) {
  20. return {
  21. token : "comment.doc.tag.storage.type",
  22. regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  23. };
  24. };
  25. DocCommentHighlightRules.getStartRule = function(start) {
  26. return {
  27. token : "comment.doc", // doc comment
  28. regex : "\\/\\*(?=\\*)",
  29. next : start
  30. };
  31. };
  32. DocCommentHighlightRules.getEndRule = function (start) {
  33. return {
  34. token : "comment.doc", // closing comment
  35. regex : "\\*\\/",
  36. next : start
  37. };
  38. };
  39. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  40. });
  41. ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
  42. "use strict";
  43. var oop = acequire("../lib/oop");
  44. var DocCommentHighlightRules = acequire("./doc_comment_highlight_rules").DocCommentHighlightRules;
  45. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  46. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  47. var JavaScriptHighlightRules = function(options) {
  48. var keywordMapper = this.createKeywordMapper({
  49. "variable.language":
  50. "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  51. "Namespace|QName|XML|XMLList|" + // E4X
  52. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  53. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  54. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  55. "SyntaxError|TypeError|URIError|" +
  56. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  57. "isNaN|parseFloat|parseInt|" +
  58. "JSON|Math|" + // Other
  59. "this|arguments|prototype|window|document" , // Pseudo
  60. "keyword":
  61. "const|yield|import|get|set|async|await|" +
  62. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  63. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  64. "__parent__|__count__|escape|unescape|with|__proto__|" +
  65. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  66. "storage.type":
  67. "const|let|var|function",
  68. "constant.language":
  69. "null|Infinity|NaN|undefined",
  70. "support.function":
  71. "alert",
  72. "constant.language.boolean": "true|false"
  73. }, "identifier");
  74. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  75. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  76. "u[0-9a-fA-F]{4}|" + // unicode
  77. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  78. "[0-2][0-7]{0,2}|" + // oct
  79. "3[0-7][0-7]?|" + // oct
  80. "[4-7][0-7]?|" + //oct
  81. ".)";
  82. this.$rules = {
  83. "no_regex" : [
  84. DocCommentHighlightRules.getStartRule("doc-start"),
  85. comments("no_regex"),
  86. {
  87. token : "string",
  88. regex : "'(?=.)",
  89. next : "qstring"
  90. }, {
  91. token : "string",
  92. regex : '"(?=.)',
  93. next : "qqstring"
  94. }, {
  95. token : "constant.numeric", // hexadecimal, octal and binary
  96. regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
  97. }, {
  98. token : "constant.numeric", // decimal integers and floats
  99. regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
  100. }, {
  101. token : [
  102. "storage.type", "punctuation.operator", "support.function",
  103. "punctuation.operator", "entity.name.function", "text","keyword.operator"
  104. ],
  105. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
  106. next: "function_arguments"
  107. }, {
  108. token : [
  109. "storage.type", "punctuation.operator", "entity.name.function", "text",
  110. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  111. ],
  112. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  113. next: "function_arguments"
  114. }, {
  115. token : [
  116. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  117. "text", "paren.lparen"
  118. ],
  119. regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  120. next: "function_arguments"
  121. }, {
  122. token : [
  123. "storage.type", "punctuation.operator", "entity.name.function", "text",
  124. "keyword.operator", "text",
  125. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  126. ],
  127. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  128. next: "function_arguments"
  129. }, {
  130. token : [
  131. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  132. ],
  133. regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  134. next: "function_arguments"
  135. }, {
  136. token : [
  137. "entity.name.function", "text", "punctuation.operator",
  138. "text", "storage.type", "text", "paren.lparen"
  139. ],
  140. regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  141. next: "function_arguments"
  142. }, {
  143. token : [
  144. "text", "text", "storage.type", "text", "paren.lparen"
  145. ],
  146. regex : "(:)(\\s*)(function)(\\s*)(\\()",
  147. next: "function_arguments"
  148. }, {
  149. token : "keyword",
  150. regex : "from(?=\\s*('|\"))"
  151. }, {
  152. token : "keyword",
  153. regex : "(?:" + kwBeforeRe + ")\\b",
  154. next : "start"
  155. }, {
  156. token : ["support.constant"],
  157. regex : /that\b/
  158. }, {
  159. token : ["storage.type", "punctuation.operator", "support.function.firebug"],
  160. regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  161. }, {
  162. token : keywordMapper,
  163. regex : identifierRe
  164. }, {
  165. token : "punctuation.operator",
  166. regex : /[.](?![.])/,
  167. next : "property"
  168. }, {
  169. token : "storage.type",
  170. regex : /=>/
  171. }, {
  172. token : "keyword.operator",
  173. regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
  174. next : "start"
  175. }, {
  176. token : "punctuation.operator",
  177. regex : /[?:,;.]/,
  178. next : "start"
  179. }, {
  180. token : "paren.lparen",
  181. regex : /[\[({]/,
  182. next : "start"
  183. }, {
  184. token : "paren.rparen",
  185. regex : /[\])}]/
  186. }, {
  187. token: "comment",
  188. regex: /^#!.*$/
  189. }
  190. ],
  191. property: [{
  192. token : "text",
  193. regex : "\\s+"
  194. }, {
  195. token : [
  196. "storage.type", "punctuation.operator", "entity.name.function", "text",
  197. "keyword.operator", "text",
  198. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  199. ],
  200. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
  201. next: "function_arguments"
  202. }, {
  203. token : "punctuation.operator",
  204. regex : /[.](?![.])/
  205. }, {
  206. token : "support.function",
  207. regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
  208. }, {
  209. token : "support.function.dom",
  210. 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(?=\()/
  211. }, {
  212. token : "support.constant",
  213. 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/
  214. }, {
  215. token : "identifier",
  216. regex : identifierRe
  217. }, {
  218. regex: "",
  219. token: "empty",
  220. next: "no_regex"
  221. }
  222. ],
  223. "start": [
  224. DocCommentHighlightRules.getStartRule("doc-start"),
  225. comments("start"),
  226. {
  227. token: "string.regexp",
  228. regex: "\\/",
  229. next: "regex"
  230. }, {
  231. token : "text",
  232. regex : "\\s+|^$",
  233. next : "start"
  234. }, {
  235. token: "empty",
  236. regex: "",
  237. next: "no_regex"
  238. }
  239. ],
  240. "regex": [
  241. {
  242. token: "regexp.keyword.operator",
  243. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  244. }, {
  245. token: "string.regexp",
  246. regex: "/[sxngimy]*",
  247. next: "no_regex"
  248. }, {
  249. token : "invalid",
  250. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  251. }, {
  252. token : "constant.language.escape",
  253. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  254. }, {
  255. token : "constant.language.delimiter",
  256. regex: /\|/
  257. }, {
  258. token: "constant.language.escape",
  259. regex: /\[\^?/,
  260. next: "regex_character_class"
  261. }, {
  262. token: "empty",
  263. regex: "$",
  264. next: "no_regex"
  265. }, {
  266. defaultToken: "string.regexp"
  267. }
  268. ],
  269. "regex_character_class": [
  270. {
  271. token: "regexp.charclass.keyword.operator",
  272. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  273. }, {
  274. token: "constant.language.escape",
  275. regex: "]",
  276. next: "regex"
  277. }, {
  278. token: "constant.language.escape",
  279. regex: "-"
  280. }, {
  281. token: "empty",
  282. regex: "$",
  283. next: "no_regex"
  284. }, {
  285. defaultToken: "string.regexp.charachterclass"
  286. }
  287. ],
  288. "function_arguments": [
  289. {
  290. token: "variable.parameter",
  291. regex: identifierRe
  292. }, {
  293. token: "punctuation.operator",
  294. regex: "[, ]+"
  295. }, {
  296. token: "punctuation.operator",
  297. regex: "$"
  298. }, {
  299. token: "empty",
  300. regex: "",
  301. next: "no_regex"
  302. }
  303. ],
  304. "qqstring" : [
  305. {
  306. token : "constant.language.escape",
  307. regex : escapedRe
  308. }, {
  309. token : "string",
  310. regex : "\\\\$",
  311. consumeLineEnd : true
  312. }, {
  313. token : "string",
  314. regex : '"|$',
  315. next : "no_regex"
  316. }, {
  317. defaultToken: "string"
  318. }
  319. ],
  320. "qstring" : [
  321. {
  322. token : "constant.language.escape",
  323. regex : escapedRe
  324. }, {
  325. token : "string",
  326. regex : "\\\\$",
  327. consumeLineEnd : true
  328. }, {
  329. token : "string",
  330. regex : "'|$",
  331. next : "no_regex"
  332. }, {
  333. defaultToken: "string"
  334. }
  335. ]
  336. };
  337. if (!options || !options.noES6) {
  338. this.$rules.no_regex.unshift({
  339. regex: "[{}]", onMatch: function(val, state, stack) {
  340. this.next = val == "{" ? this.nextState : "";
  341. if (val == "{" && stack.length) {
  342. stack.unshift("start", state);
  343. }
  344. else if (val == "}" && stack.length) {
  345. stack.shift();
  346. this.next = stack.shift();
  347. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  348. return "paren.quasi.end";
  349. }
  350. return val == "{" ? "paren.lparen" : "paren.rparen";
  351. },
  352. nextState: "start"
  353. }, {
  354. token : "string.quasi.start",
  355. regex : /`/,
  356. push : [{
  357. token : "constant.language.escape",
  358. regex : escapedRe
  359. }, {
  360. token : "paren.quasi.start",
  361. regex : /\${/,
  362. push : "start"
  363. }, {
  364. token : "string.quasi.end",
  365. regex : /`/,
  366. next : "pop"
  367. }, {
  368. defaultToken: "string.quasi"
  369. }]
  370. });
  371. if (!options || options.jsx != false)
  372. JSX.call(this);
  373. }
  374. this.embedRules(DocCommentHighlightRules, "doc-",
  375. [ DocCommentHighlightRules.getEndRule("no_regex") ]);
  376. this.normalizeRules();
  377. };
  378. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  379. function JSX() {
  380. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  381. var jsxTag = {
  382. onMatch : function(val, state, stack) {
  383. var offset = val.charAt(1) == "/" ? 2 : 1;
  384. if (offset == 1) {
  385. if (state != this.nextState)
  386. stack.unshift(this.next, this.nextState, 0);
  387. else
  388. stack.unshift(this.next);
  389. stack[2]++;
  390. } else if (offset == 2) {
  391. if (state == this.nextState) {
  392. stack[1]--;
  393. if (!stack[1] || stack[1] < 0) {
  394. stack.shift();
  395. stack.shift();
  396. }
  397. }
  398. }
  399. return [{
  400. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  401. value: val.slice(0, offset)
  402. }, {
  403. type: "meta.tag.tag-name.xml",
  404. value: val.substr(offset)
  405. }];
  406. },
  407. regex : "</?" + tagRegex + "",
  408. next: "jsxAttributes",
  409. nextState: "jsx"
  410. };
  411. this.$rules.start.unshift(jsxTag);
  412. var jsxJsRule = {
  413. regex: "{",
  414. token: "paren.quasi.start",
  415. push: "start"
  416. };
  417. this.$rules.jsx = [
  418. jsxJsRule,
  419. jsxTag,
  420. {include : "reference"},
  421. {defaultToken: "string"}
  422. ];
  423. this.$rules.jsxAttributes = [{
  424. token : "meta.tag.punctuation.tag-close.xml",
  425. regex : "/?>",
  426. onMatch : function(value, currentState, stack) {
  427. if (currentState == stack[0])
  428. stack.shift();
  429. if (value.length == 2) {
  430. if (stack[0] == this.nextState)
  431. stack[1]--;
  432. if (!stack[1] || stack[1] < 0) {
  433. stack.splice(0, 2);
  434. }
  435. }
  436. this.next = stack[0] || "start";
  437. return [{type: this.token, value: value}];
  438. },
  439. nextState: "jsx"
  440. },
  441. jsxJsRule,
  442. comments("jsxAttributes"),
  443. {
  444. token : "entity.other.attribute-name.xml",
  445. regex : tagRegex
  446. }, {
  447. token : "keyword.operator.attribute-equals.xml",
  448. regex : "="
  449. }, {
  450. token : "text.tag-whitespace.xml",
  451. regex : "\\s+"
  452. }, {
  453. token : "string.attribute-value.xml",
  454. regex : "'",
  455. stateName : "jsx_attr_q",
  456. push : [
  457. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  458. {include : "reference"},
  459. {defaultToken : "string.attribute-value.xml"}
  460. ]
  461. }, {
  462. token : "string.attribute-value.xml",
  463. regex : '"',
  464. stateName : "jsx_attr_qq",
  465. push : [
  466. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  467. {include : "reference"},
  468. {defaultToken : "string.attribute-value.xml"}
  469. ]
  470. },
  471. jsxTag
  472. ];
  473. this.$rules.reference = [{
  474. token : "constant.language.escape.reference.xml",
  475. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  476. }];
  477. }
  478. function comments(next) {
  479. return [
  480. {
  481. token : "comment", // multi line comment
  482. regex : /\/\*/,
  483. next: [
  484. DocCommentHighlightRules.getTagRule(),
  485. {token : "comment", regex : "\\*\\/", next : next || "pop"},
  486. {defaultToken : "comment", caseInsensitive: true}
  487. ]
  488. }, {
  489. token : "comment",
  490. regex : "\\/\\/",
  491. next: [
  492. DocCommentHighlightRules.getTagRule(),
  493. {token : "comment", regex : "$|^", next : next || "pop"},
  494. {defaultToken : "comment", caseInsensitive: true}
  495. ]
  496. }
  497. ];
  498. }
  499. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  500. });
  501. ace.define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
  502. "use strict";
  503. var oop = acequire("../lib/oop");
  504. var lang = acequire("../lib/lang");
  505. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  506. 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|min-height|min-width|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|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index";
  507. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  508. 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|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";
  509. 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";
  510. 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";
  511. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  512. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  513. 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|acequired|root|target|valid|visited)\\b";
  514. var CssHighlightRules = function() {
  515. var keywordMapper = this.createKeywordMapper({
  516. "support.function": supportFunction,
  517. "support.constant": supportConstant,
  518. "support.type": supportType,
  519. "support.constant.color": supportConstantColor,
  520. "support.constant.fonts": supportConstantFonts
  521. }, "text", true);
  522. this.$rules = {
  523. "start" : [{
  524. include : ["strings", "url", "comments"]
  525. }, {
  526. token: "paren.lparen",
  527. regex: "\\{",
  528. next: "ruleset"
  529. }, {
  530. token: "paren.rparen",
  531. regex: "\\}"
  532. }, {
  533. token: "string",
  534. regex: "@",
  535. next: "media"
  536. }, {
  537. token: "keyword",
  538. regex: "#[a-z0-9-_]+"
  539. }, {
  540. token: "keyword",
  541. regex: "%"
  542. }, {
  543. token: "variable",
  544. regex: "\\.[a-z0-9-_]+"
  545. }, {
  546. token: "string",
  547. regex: ":[a-z0-9-_]+"
  548. }, {
  549. token : "constant.numeric",
  550. regex : numRe
  551. }, {
  552. token: "constant",
  553. regex: "[a-z0-9-_]+"
  554. }, {
  555. caseInsensitive: true
  556. }],
  557. "media": [{
  558. include : ["strings", "url", "comments"]
  559. }, {
  560. token: "paren.lparen",
  561. regex: "\\{",
  562. next: "start"
  563. }, {
  564. token: "paren.rparen",
  565. regex: "\\}",
  566. next: "start"
  567. }, {
  568. token: "string",
  569. regex: ";",
  570. next: "start"
  571. }, {
  572. token: "keyword",
  573. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  574. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  575. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  576. }],
  577. "comments" : [{
  578. token: "comment", // multi line comment
  579. regex: "\\/\\*",
  580. push: [{
  581. token : "comment",
  582. regex : "\\*\\/",
  583. next : "pop"
  584. }, {
  585. defaultToken : "comment"
  586. }]
  587. }],
  588. "ruleset" : [{
  589. regex : "-(webkit|ms|moz|o)-",
  590. token : "text"
  591. }, {
  592. token : "paren.rparen",
  593. regex : "\\}",
  594. next : "start"
  595. }, {
  596. include : ["strings", "url", "comments"]
  597. }, {
  598. token : ["constant.numeric", "keyword"],
  599. regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
  600. }, {
  601. token : "constant.numeric",
  602. regex : numRe
  603. }, {
  604. token : "constant.numeric", // hex6 color
  605. regex : "#[a-f0-9]{6}"
  606. }, {
  607. token : "constant.numeric", // hex3 color
  608. regex : "#[a-f0-9]{3}"
  609. }, {
  610. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  611. regex : pseudoElements
  612. }, {
  613. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  614. regex : pseudoClasses
  615. }, {
  616. include: "url"
  617. }, {
  618. token : keywordMapper,
  619. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  620. }, {
  621. caseInsensitive: true
  622. }],
  623. url: [{
  624. token : "support.function",
  625. regex : "(?:url(:?-prefix)?|domain|regexp)\\(",
  626. push: [{
  627. token : "support.function",
  628. regex : "\\)",
  629. next : "pop"
  630. }, {
  631. defaultToken: "string"
  632. }]
  633. }],
  634. strings: [{
  635. token : "string.start",
  636. regex : "'",
  637. push : [{
  638. token : "string.end",
  639. regex : "'|$",
  640. next: "pop"
  641. }, {
  642. include : "escapes"
  643. }, {
  644. token : "constant.language.escape",
  645. regex : /\\$/,
  646. consumeLineEnd: true
  647. }, {
  648. defaultToken: "string"
  649. }]
  650. }, {
  651. token : "string.start",
  652. regex : '"',
  653. push : [{
  654. token : "string.end",
  655. regex : '"|$',
  656. next: "pop"
  657. }, {
  658. include : "escapes"
  659. }, {
  660. token : "constant.language.escape",
  661. regex : /\\$/,
  662. consumeLineEnd: true
  663. }, {
  664. defaultToken: "string"
  665. }]
  666. }],
  667. escapes: [{
  668. token : "constant.language.escape",
  669. regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  670. }]
  671. };
  672. this.normalizeRules();
  673. };
  674. oop.inherits(CssHighlightRules, TextHighlightRules);
  675. exports.CssHighlightRules = CssHighlightRules;
  676. });
  677. ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
  678. "use strict";
  679. var oop = acequire("../lib/oop");
  680. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  681. var XmlHighlightRules = function(normalize) {
  682. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  683. this.$rules = {
  684. start : [
  685. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  686. {
  687. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  688. regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
  689. },
  690. {token : "comment.start.xml", regex : "<\\!--", next : "comment"},
  691. {
  692. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  693. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  694. },
  695. {include : "tag"},
  696. {token : "text.end-tag-open.xml", regex: "</"},
  697. {token : "text.tag-open.xml", regex: "<"},
  698. {include : "reference"},
  699. {defaultToken : "text.xml"}
  700. ],
  701. processing_instruction : [{
  702. token : "entity.other.attribute-name.decl-attribute-name.xml",
  703. regex : tagRegex
  704. }, {
  705. token : "keyword.operator.decl-attribute-equals.xml",
  706. regex : "="
  707. }, {
  708. include: "whitespace"
  709. }, {
  710. include: "string"
  711. }, {
  712. token : "punctuation.xml-decl.xml",
  713. regex : "\\?>",
  714. next : "start"
  715. }],
  716. doctype : [
  717. {include : "whitespace"},
  718. {include : "string"},
  719. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  720. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  721. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  722. ],
  723. int_subset : [{
  724. token : "text.xml",
  725. regex : "\\s+"
  726. }, {
  727. token: "punctuation.int-subset.xml",
  728. regex: "]",
  729. next: "pop"
  730. }, {
  731. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  732. regex : "(<\\!)(" + tagRegex + ")",
  733. push : [{
  734. token : "text",
  735. regex : "\\s+"
  736. },
  737. {
  738. token : "punctuation.markup-decl.xml",
  739. regex : ">",
  740. next : "pop"
  741. },
  742. {include : "string"}]
  743. }],
  744. cdata : [
  745. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  746. {token : "text.xml", regex : "\\s+"},
  747. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  748. ],
  749. comment : [
  750. {token : "comment.end.xml", regex : "-->", next : "start"},
  751. {defaultToken : "comment.xml"}
  752. ],
  753. reference : [{
  754. token : "constant.language.escape.reference.xml",
  755. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  756. }],
  757. attr_reference : [{
  758. token : "constant.language.escape.reference.attribute-value.xml",
  759. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  760. }],
  761. tag : [{
  762. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  763. regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  764. next: [
  765. {include : "attributes"},
  766. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  767. ]
  768. }],
  769. tag_whitespace : [
  770. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  771. ],
  772. whitespace : [
  773. {token : "text.whitespace.xml", regex : "\\s+"}
  774. ],
  775. string: [{
  776. token : "string.xml",
  777. regex : "'",
  778. push : [
  779. {token : "string.xml", regex: "'", next: "pop"},
  780. {defaultToken : "string.xml"}
  781. ]
  782. }, {
  783. token : "string.xml",
  784. regex : '"',
  785. push : [
  786. {token : "string.xml", regex: '"', next: "pop"},
  787. {defaultToken : "string.xml"}
  788. ]
  789. }],
  790. attributes: [{
  791. token : "entity.other.attribute-name.xml",
  792. regex : tagRegex
  793. }, {
  794. token : "keyword.operator.attribute-equals.xml",
  795. regex : "="
  796. }, {
  797. include: "tag_whitespace"
  798. }, {
  799. include: "attribute_value"
  800. }],
  801. attribute_value: [{
  802. token : "string.attribute-value.xml",
  803. regex : "'",
  804. push : [
  805. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  806. {include : "attr_reference"},
  807. {defaultToken : "string.attribute-value.xml"}
  808. ]
  809. }, {
  810. token : "string.attribute-value.xml",
  811. regex : '"',
  812. push : [
  813. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  814. {include : "attr_reference"},
  815. {defaultToken : "string.attribute-value.xml"}
  816. ]
  817. }]
  818. };
  819. if (this.constructor === XmlHighlightRules)
  820. this.normalizeRules();
  821. };
  822. (function() {
  823. this.embedTagRules = function(HighlightRules, prefix, tag){
  824. this.$rules.tag.unshift({
  825. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  826. regex : "(<)(" + tag + "(?=\\s|>|$))",
  827. next: [
  828. {include : "attributes"},
  829. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  830. ]
  831. });
  832. this.$rules[tag + "-end"] = [
  833. {include : "attributes"},
  834. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  835. onMatch : function(value, currentState, stack) {
  836. stack.splice(0);
  837. return this.token;
  838. }}
  839. ];
  840. this.embedRules(HighlightRules, prefix, [{
  841. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  842. regex : "(</)(" + tag + "(?=\\s|>|$))",
  843. next: tag + "-end"
  844. }, {
  845. token: "string.cdata.xml",
  846. regex : "<\\!\\[CDATA\\["
  847. }, {
  848. token: "string.cdata.xml",
  849. regex : "\\]\\]>"
  850. }]);
  851. };
  852. }).call(TextHighlightRules.prototype);
  853. oop.inherits(XmlHighlightRules, TextHighlightRules);
  854. exports.XmlHighlightRules = XmlHighlightRules;
  855. });
  856. 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(acequire, exports, module) {
  857. "use strict";
  858. var oop = acequire("../lib/oop");
  859. var lang = acequire("../lib/lang");
  860. var CssHighlightRules = acequire("./css_highlight_rules").CssHighlightRules;
  861. var JavaScriptHighlightRules = acequire("./javascript_highlight_rules").JavaScriptHighlightRules;
  862. var XmlHighlightRules = acequire("./xml_highlight_rules").XmlHighlightRules;
  863. var tagMap = lang.createMap({
  864. a : 'anchor',
  865. button : 'form',
  866. form : 'form',
  867. img : 'image',
  868. input : 'form',
  869. label : 'form',
  870. option : 'form',
  871. script : 'script',
  872. select : 'form',
  873. textarea : 'form',
  874. style : 'style',
  875. table : 'table',
  876. tbody : 'table',
  877. td : 'table',
  878. tfoot : 'table',
  879. th : 'table',
  880. tr : 'table'
  881. });
  882. var HtmlHighlightRules = function() {
  883. XmlHighlightRules.call(this);
  884. this.addRules({
  885. attributes: [{
  886. include : "tag_whitespace"
  887. }, {
  888. token : "entity.other.attribute-name.xml",
  889. regex : "[-_a-zA-Z0-9:.]+"
  890. }, {
  891. token : "keyword.operator.attribute-equals.xml",
  892. regex : "=",
  893. push : [{
  894. include: "tag_whitespace"
  895. }, {
  896. token : "string.unquoted.attribute-value.html",
  897. regex : "[^<>='\"`\\s]+",
  898. next : "pop"
  899. }, {
  900. token : "empty",
  901. regex : "",
  902. next : "pop"
  903. }]
  904. }, {
  905. include : "attribute_value"
  906. }],
  907. tag: [{
  908. token : function(start, tag) {
  909. var group = tagMap[tag];
  910. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  911. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  912. },
  913. regex : "(</?)([-_a-zA-Z0-9:.]+)",
  914. next: "tag_stuff"
  915. }],
  916. tag_stuff: [
  917. {include : "attributes"},
  918. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  919. ]
  920. });
  921. this.embedTagRules(CssHighlightRules, "css-", "style");
  922. this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script");
  923. if (this.constructor === HtmlHighlightRules)
  924. this.normalizeRules();
  925. };
  926. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  927. exports.HtmlHighlightRules = HtmlHighlightRules;
  928. });
  929. ace.define("ace/mode/markdown_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules","ace/mode/html_highlight_rules","ace/mode/css_highlight_rules"], function(acequire, exports, module) {
  930. "use strict";
  931. var oop = acequire("../lib/oop");
  932. var lang = acequire("../lib/lang");
  933. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  934. var JavaScriptHighlightRules = acequire("./javascript_highlight_rules").JavaScriptHighlightRules;
  935. var XmlHighlightRules = acequire("./xml_highlight_rules").XmlHighlightRules;
  936. var HtmlHighlightRules = acequire("./html_highlight_rules").HtmlHighlightRules;
  937. var CssHighlightRules = acequire("./css_highlight_rules").CssHighlightRules;
  938. var escaped = function(ch) {
  939. return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*";
  940. };
  941. function github_embed(tag, prefix) {
  942. return { // Github style block
  943. token : "support.function",
  944. regex : "^\\s*```" + tag + "\\s*$",
  945. push : prefix + "start"
  946. };
  947. }
  948. var MarkdownHighlightRules = function() {
  949. HtmlHighlightRules.call(this);
  950. this.$rules["start"].unshift({
  951. token : "empty_line",
  952. regex : '^$',
  953. next: "allowBlock"
  954. }, { // h1
  955. token: "markup.heading.1",
  956. regex: "^=+(?=\\s*$)"
  957. }, { // h2
  958. token: "markup.heading.2",
  959. regex: "^\\-+(?=\\s*$)"
  960. }, {
  961. token : function(value) {
  962. return "markup.heading." + value.length;
  963. },
  964. regex : /^#{1,6}(?=\s*[^ #]|\s+#.)/,
  965. next : "header"
  966. },
  967. github_embed("(?:javascript|js)", "jscode-"),
  968. github_embed("xml", "xmlcode-"),
  969. github_embed("html", "htmlcode-"),
  970. github_embed("css", "csscode-"),
  971. { // Github style block
  972. token : "support.function",
  973. regex : "^\\s*```\\s*\\S*(?:{.*?\\})?\\s*$",
  974. next : "githubblock"
  975. }, { // block quote
  976. token : "string.blockquote",
  977. regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  978. next : "blockquote"
  979. }, { // HR * - _
  980. token : "constant",
  981. regex : "^ {0,2}(?:(?: ?\\* ?){3,}|(?: ?\\- ?){3,}|(?: ?\\_ ?){3,})\\s*$",
  982. next: "allowBlock"
  983. }, { // list
  984. token : "markup.list",
  985. regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  986. next : "listblock-start"
  987. }, {
  988. include : "basic"
  989. });
  990. this.addRules({
  991. "basic" : [{
  992. token : "constant.language.escape",
  993. regex : /\\[\\`*_{}\[\]()#+\-.!]/
  994. }, { // code span `
  995. token : "support.function",
  996. regex : "(`+)(.*?[^`])(\\1)"
  997. }, { // reference
  998. token : ["text", "constant", "text", "url", "string", "text"],
  999. regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
  1000. }, { // link by reference
  1001. token : ["text", "string", "text", "constant", "text"],
  1002. regex : "(\\[)(" + escaped("]") + ")(\\]\\s*\\[)("+ escaped("]") + ")(\\])"
  1003. }, { // link by url
  1004. token : ["text", "string", "text", "markup.underline", "string", "text"],
  1005. regex : "(\\[)(" + // [
  1006. escaped("]") + // link text
  1007. ")(\\]\\()"+ // ](
  1008. '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href
  1009. '(\\s*"' + escaped('"') + '"\\s*)?' + // "title"
  1010. "(\\))" // )
  1011. }, { // strong ** __
  1012. token : "string.strong",
  1013. regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
  1014. }, { // emphasis * _
  1015. token : "string.emphasis",
  1016. regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
  1017. }, { //
  1018. token : ["text", "url", "text"],
  1019. regex : "(<)("+
  1020. "(?:https?|ftp|dict):[^'\">\\s]+"+
  1021. "|"+
  1022. "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+"+
  1023. ")(>)"
  1024. }],
  1025. "allowBlock": [
  1026. {token : "support.function", regex : "^ {4}.+", next : "allowBlock"},
  1027. {token : "empty_line", regex : '^$', next: "allowBlock"},
  1028. {token : "empty", regex : "", next : "start"}
  1029. ],
  1030. "header" : [{
  1031. regex: "$",
  1032. next : "start"
  1033. }, {
  1034. include: "basic"
  1035. }, {
  1036. defaultToken : "heading"
  1037. } ],
  1038. "listblock-start" : [{
  1039. token : "support.variable",
  1040. regex : /(?:\[[ x]\])?/,
  1041. next : "listblock"
  1042. }],
  1043. "listblock" : [ { // Lists only escape on completely blank lines.
  1044. token : "empty_line",
  1045. regex : "^$",
  1046. next : "start"
  1047. }, { // list
  1048. token : "markup.list",
  1049. regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  1050. next : "listblock-start"
  1051. }, {
  1052. include : "basic", noEscape: true
  1053. }, { // Github style block
  1054. token : "support.function",
  1055. regex : "^\\s*```\\s*[a-zA-Z]*(?:{.*?\\})?\\s*$",
  1056. next : "githubblock"
  1057. }, {
  1058. defaultToken : "list" //do not use markup.list to allow stling leading `*` differntly
  1059. } ],
  1060. "blockquote" : [ { // Blockquotes only escape on blank lines.
  1061. token : "empty_line",
  1062. regex : "^\\s*$",
  1063. next : "start"
  1064. }, { // block quote
  1065. token : "string.blockquote",
  1066. regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  1067. next : "blockquote"
  1068. }, {
  1069. include : "basic", noEscape: true
  1070. }, {
  1071. defaultToken : "string.blockquote"
  1072. } ],
  1073. "githubblock" : [ {
  1074. token : "support.function",
  1075. regex : "^\\s*```",
  1076. next : "start"
  1077. }, {
  1078. defaultToken : "support.function"
  1079. } ]
  1080. });
  1081. this.embedRules(JavaScriptHighlightRules, "jscode-", [{
  1082. token : "support.function",
  1083. regex : "^\\s*```",
  1084. next : "pop"
  1085. }]);
  1086. this.embedRules(HtmlHighlightRules, "htmlcode-", [{
  1087. token : "support.function",
  1088. regex : "^\\s*```",
  1089. next : "pop"
  1090. }]);
  1091. this.embedRules(CssHighlightRules, "csscode-", [{
  1092. token : "support.function",
  1093. regex : "^\\s*```",
  1094. next : "pop"
  1095. }]);
  1096. this.embedRules(XmlHighlightRules, "xmlcode-", [{
  1097. token : "support.function",
  1098. regex : "^\\s*```",
  1099. next : "pop"
  1100. }]);
  1101. this.normalizeRules();
  1102. };
  1103. oop.inherits(MarkdownHighlightRules, TextHighlightRules);
  1104. exports.MarkdownHighlightRules = MarkdownHighlightRules;
  1105. });
  1106. 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(acequire, exports, module) {
  1107. "use strict";
  1108. exports.MaskHighlightRules = MaskHighlightRules;
  1109. var oop = acequire("../lib/oop");
  1110. var lang = acequire("../lib/lang");
  1111. var TextRules = acequire("./text_highlight_rules").TextHighlightRules;
  1112. var JSRules = acequire("./javascript_highlight_rules").JavaScriptHighlightRules;
  1113. var CssRules = acequire("./css_highlight_rules").CssHighlightRules;
  1114. var MDRules = acequire("./markdown_highlight_rules").MarkdownHighlightRules;
  1115. var HTMLRules = acequire("./html_highlight_rules").HtmlHighlightRules;
  1116. var token_TAG = "keyword.support.constant.language",
  1117. token_COMPO = "support.function.markup.bold",
  1118. token_KEYWORD = "keyword",
  1119. token_LANG = "constant.language",
  1120. token_UTIL = "keyword.control.markup.italic",
  1121. token_ATTR = "support.variable.class",
  1122. token_PUNKT = "keyword.operator",
  1123. token_ITALIC = "markup.italic",
  1124. token_BOLD = "markup.bold",
  1125. token_LPARE = "paren.lparen",
  1126. token_RPARE = "paren.rparen";
  1127. var const_FUNCTIONS,
  1128. const_KEYWORDS,
  1129. const_CONST,
  1130. const_TAGS;
  1131. (function(){
  1132. const_FUNCTIONS = lang.arrayToMap(
  1133. ("log").split("|")
  1134. );
  1135. const_CONST = lang.arrayToMap(
  1136. (":dualbind|:bind|:import|slot|event|style|html|markdown|md").split("|")
  1137. );
  1138. const_KEYWORDS = lang.arrayToMap(
  1139. ("debugger|define|var|if|each|for|of|else|switch|case|with|visible|+if|+each|+for|+switch|+with|+visible|include|import").split("|")
  1140. );
  1141. const_TAGS = lang.arrayToMap(
  1142. ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
  1143. "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
  1144. "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
  1145. "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
  1146. "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
  1147. "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
  1148. "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
  1149. "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
  1150. "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
  1151. );
  1152. }());
  1153. function MaskHighlightRules () {
  1154. this.$rules = {
  1155. "start" : [
  1156. Token("comment", "\\/\\/.*$"),
  1157. Token("comment", "\\/\\*", [
  1158. Token("comment", ".*?\\*\\/", "start"),
  1159. Token("comment", ".+")
  1160. ]),
  1161. Blocks.string("'''"),
  1162. Blocks.string('"""'),
  1163. Blocks.string('"'),
  1164. Blocks.string("'"),
  1165. Blocks.syntax(/(markdown|md)\b/, "md-multiline", "multiline"),
  1166. Blocks.syntax(/html\b/, "html-multiline", "multiline"),
  1167. Blocks.syntax(/(slot|event)\b/, "js-block", "block"),
  1168. Blocks.syntax(/style\b/, "css-block", "block"),
  1169. Blocks.syntax(/var\b/, "js-statement", "attr"),
  1170. Blocks.tag(),
  1171. Token(token_LPARE, "[[({>]"),
  1172. Token(token_RPARE, "[\\])};]", "start"),
  1173. {
  1174. caseInsensitive: true
  1175. }
  1176. ]
  1177. };
  1178. var rules = this;
  1179. addJavaScript("interpolation", /\]/, token_RPARE + "." + token_ITALIC);
  1180. addJavaScript("statement", /\)|}|;/);
  1181. addJavaScript("block", /\}/);
  1182. addCss();
  1183. addMarkdown();
  1184. addHtml();
  1185. function addJavaScript(name, escape, closeType) {
  1186. var prfx = "js-" + name + "-",
  1187. rootTokens = name === "block" ? ["start"] : ["start", "no_regex"];
  1188. add(
  1189. JSRules
  1190. , prfx
  1191. , escape
  1192. , rootTokens
  1193. , closeType
  1194. );
  1195. }
  1196. function addCss() {
  1197. add(CssRules, "css-block-", /\}/);
  1198. }
  1199. function addMarkdown() {
  1200. add(MDRules, "md-multiline-", /("""|''')/, []);
  1201. }
  1202. function addHtml() {
  1203. add(HTMLRules, "html-multiline-", /("""|''')/);
  1204. }
  1205. function add(Rules, strPrfx, rgxEnd, rootTokens, closeType) {
  1206. var next = "pop";
  1207. var tokens = rootTokens || [ "start" ];
  1208. if (tokens.length === 0) {
  1209. tokens = null;
  1210. }
  1211. if (/block|multiline/.test(strPrfx)) {
  1212. next = strPrfx + "end";
  1213. rules.$rules[next] = [
  1214. Token("empty", "", "start")
  1215. ];
  1216. }
  1217. rules.embedRules(
  1218. Rules
  1219. , strPrfx
  1220. , [ Token(closeType || token_RPARE, rgxEnd, next) ]
  1221. , tokens
  1222. , tokens == null ? true : false
  1223. );
  1224. }
  1225. this.normalizeRules();
  1226. }
  1227. oop.inherits(MaskHighlightRules, TextRules);
  1228. var Blocks = {
  1229. string: function(str, next){
  1230. var token = Token(
  1231. "string.start"
  1232. , str
  1233. , [
  1234. Token(token_LPARE + "." + token_ITALIC, /~\[/, Blocks.interpolation()),
  1235. Token("string.end", str, "pop"),
  1236. {
  1237. defaultToken: "string"
  1238. }
  1239. ]
  1240. , next
  1241. );
  1242. if (str.length === 1){
  1243. var escaped = Token("string.escape", "\\\\" + str);
  1244. token.push.unshift(escaped);
  1245. }
  1246. return token;
  1247. },
  1248. interpolation: function(){
  1249. return [
  1250. Token(token_UTIL, /\s*\w*\s*:/),
  1251. "js-interpolation-start"
  1252. ];
  1253. },
  1254. tagHead: function (rgx) {
  1255. return Token(token_ATTR, rgx, [
  1256. Token(token_ATTR, /[\w\-_]+/),
  1257. Token(token_LPARE + "." + token_ITALIC, /~\[/, Blocks.interpolation()),
  1258. Blocks.goUp()
  1259. ]);
  1260. },
  1261. tag: function () {
  1262. return {
  1263. token: 'tag',
  1264. onMatch : function(value) {
  1265. if (void 0 !== const_KEYWORDS[value])
  1266. return token_KEYWORD;
  1267. if (void 0 !== const_CONST[value])
  1268. return token_LANG;
  1269. if (void 0 !== const_FUNCTIONS[value])
  1270. return "support.function";
  1271. if (void 0 !== const_TAGS[value.toLowerCase()])
  1272. return token_TAG;
  1273. return token_COMPO;
  1274. },
  1275. regex : /([@\w\-_:+]+)|((^|\s)(?=\s*(\.|#)))/,
  1276. push: [
  1277. Blocks.tagHead(/\./) ,
  1278. Blocks.tagHead(/#/) ,
  1279. Blocks.expression(),
  1280. Blocks.attribute(),
  1281. Token(token_LPARE, /[;>{]/, "pop")
  1282. ]
  1283. };
  1284. },
  1285. syntax: function(rgx, next, type){
  1286. return {
  1287. token: token_LANG,
  1288. regex : rgx,
  1289. push: ({
  1290. "attr": [
  1291. next + "-start",
  1292. Token(token_PUNKT, /;/, "start")
  1293. ],
  1294. "multiline": [
  1295. Blocks.tagHead(/\./) ,
  1296. Blocks.tagHead(/#/) ,
  1297. Blocks.attribute(),
  1298. Blocks.expression(),
  1299. Token(token_LPARE, /[>\{]/),
  1300. Token(token_PUNKT, /;/, "start"),
  1301. Token(token_LPARE, /'''|"""/, [ next + "-start" ])
  1302. ],
  1303. "block": [
  1304. Blocks.tagHead(/\./) ,
  1305. Blocks.tagHead(/#/) ,
  1306. Blocks.attribute(),
  1307. Blocks.expression(),
  1308. Token(token_LPARE, /\{/, [ next + "-start" ])
  1309. ]
  1310. })[type]
  1311. };
  1312. },
  1313. attribute: function(){
  1314. return Token(function(value){
  1315. return /^x\-/.test(value)
  1316. ? token_ATTR + "." + token_BOLD
  1317. : token_ATTR;
  1318. }, /[\w_-]+/, [
  1319. Token(token_PUNKT, /\s*=\s*/, [
  1320. Blocks.string('"'),
  1321. Blocks.string("'"),
  1322. Blocks.word(),
  1323. Blocks.goUp()
  1324. ]),
  1325. Blocks.goUp()
  1326. ]);
  1327. },
  1328. expression: function(){
  1329. return Token(token_LPARE, /\(/, [ "js-statement-start" ]);
  1330. },
  1331. word: function(){
  1332. return Token("string", /[\w-_]+/);
  1333. },
  1334. goUp: function(){
  1335. return Token("text", "", "pop");
  1336. },
  1337. goStart: function(){
  1338. return Token("text", "", "start");
  1339. }
  1340. };
  1341. function Token(token, rgx, mix) {
  1342. var push, next, onMatch;
  1343. if (arguments.length === 4) {
  1344. push = mix;
  1345. next = arguments[3];
  1346. }
  1347. else if (typeof mix === "string") {
  1348. next = mix;
  1349. }
  1350. else {
  1351. push = mix;
  1352. }
  1353. if (typeof token === "function") {
  1354. onMatch = token;
  1355. token = "empty";
  1356. }
  1357. return {
  1358. token: token,
  1359. regex: rgx,
  1360. push: push,
  1361. next: next,
  1362. onMatch: onMatch
  1363. };
  1364. }
  1365. });
  1366. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(acequire, exports, module) {
  1367. "use strict";
  1368. var Range = acequire("../range").Range;
  1369. var MatchingBraceOutdent = function() {};
  1370. (function() {
  1371. this.checkOutdent = function(line, input) {
  1372. if (! /^\s+$/.test(line))
  1373. return false;
  1374. return /^\s*\}/.test(input);
  1375. };
  1376. this.autoOutdent = function(doc, row) {
  1377. var line = doc.getLine(row);
  1378. var match = line.match(/^(\s*\})/);
  1379. if (!match) return 0;
  1380. var column = match[1].length;
  1381. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  1382. if (!openBracePos || openBracePos.row == row) return 0;
  1383. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  1384. doc.replace(new Range(row, 0, row, column-1), indent);
  1385. };
  1386. this.$getIndent = function(line) {
  1387. return line.match(/^\s*/)[0];
  1388. };
  1389. }).call(MatchingBraceOutdent.prototype);
  1390. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  1391. });
  1392. ace.define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(acequire, exports, module) {
  1393. "use strict";
  1394. var oop = acequire("../../lib/oop");
  1395. var Behaviour = acequire("../behaviour").Behaviour;
  1396. var CstyleBehaviour = acequire("./cstyle").CstyleBehaviour;
  1397. var TokenIterator = acequire("../../token_iterator").TokenIterator;
  1398. var CssBehaviour = function () {
  1399. this.inherit(CstyleBehaviour);
  1400. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1401. if (text === ':') {
  1402. var cursor = editor.getCursorPosition();
  1403. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1404. var token = iterator.getCurrentToken();
  1405. if (token && token.value.match(/\s+/)) {
  1406. token = iterator.stepBackward();
  1407. }
  1408. if (token && token.type === 'support.type') {
  1409. var line = session.doc.getLine(cursor.row);
  1410. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1411. if (rightChar === ':') {
  1412. return {
  1413. text: '',
  1414. selection: [1, 1]
  1415. };
  1416. }
  1417. if (!line.substring(cursor.column).match(/^\s*;/)) {
  1418. return {
  1419. text: ':;',
  1420. selection: [1, 1]
  1421. };
  1422. }
  1423. }
  1424. }
  1425. });
  1426. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1427. var selected = session.doc.getTextRange(range);
  1428. if (!range.isMultiLine() && selected === ':') {
  1429. var cursor = editor.getCursorPosition();
  1430. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1431. var token = iterator.getCurrentToken();
  1432. if (token && token.value.match(/\s+/)) {
  1433. token = iterator.stepBackward();
  1434. }
  1435. if (token && token.type === 'support.type') {
  1436. var line = session.doc.getLine(range.start.row);
  1437. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1438. if (rightChar === ';') {
  1439. range.end.column ++;
  1440. return range;
  1441. }
  1442. }
  1443. }
  1444. });
  1445. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1446. if (text === ';') {
  1447. var cursor = editor.getCursorPosition();
  1448. var line = session.doc.getLine(cursor.row);
  1449. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1450. if (rightChar === ';') {
  1451. return {
  1452. text: '',
  1453. selection: [1, 1]
  1454. };
  1455. }
  1456. }
  1457. });
  1458. };
  1459. oop.inherits(CssBehaviour, CstyleBehaviour);
  1460. exports.CssBehaviour = CssBehaviour;
  1461. });
  1462. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(acequire, exports, module) {
  1463. "use strict";
  1464. var oop = acequire("../../lib/oop");
  1465. var Range = acequire("../../range").Range;
  1466. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  1467. var FoldMode = exports.FoldMode = function(commentRegex) {
  1468. if (commentRegex) {
  1469. this.foldingStartMarker = new RegExp(
  1470. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  1471. );
  1472. this.foldingStopMarker = new RegExp(
  1473. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  1474. );
  1475. }
  1476. };
  1477. oop.inherits(FoldMode, BaseFoldMode);
  1478. (function() {
  1479. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  1480. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  1481. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  1482. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  1483. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  1484. this._getFoldWidgetBase = this.getFoldWidget;
  1485. this.getFoldWidget = function(session, foldStyle, row) {
  1486. var line = session.getLine(row);
  1487. if (this.singleLineBlockCommentRe.test(line)) {
  1488. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  1489. return "";
  1490. }
  1491. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  1492. if (!fw && this.startRegionRe.test(line))
  1493. return "start"; // lineCommentRegionStart
  1494. return fw;
  1495. };
  1496. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  1497. var line = session.getLine(row);
  1498. if (this.startRegionRe.test(line))
  1499. return this.getCommentRegionBlock(session, line, row);
  1500. var match = line.match(this.foldingStartMarker);
  1501. if (match) {
  1502. var i = match.index;
  1503. if (match[1])
  1504. return this.openingBracketBlock(session, match[1], row, i);
  1505. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  1506. if (range && !range.isMultiLine()) {
  1507. if (forceMultiline) {
  1508. range = this.getSectionRange(session, row);
  1509. } else if (foldStyle != "all")
  1510. range = null;
  1511. }
  1512. return range;
  1513. }
  1514. if (foldStyle === "markbegin")
  1515. return;
  1516. var match = line.match(this.foldingStopMarker);
  1517. if (match) {
  1518. var i = match.index + match[0].length;
  1519. if (match[1])
  1520. return this.closingBracketBlock(session, match[1], row, i);
  1521. return session.getCommentFoldRange(row, i, -1);
  1522. }
  1523. };
  1524. this.getSectionRange = function(session, row) {
  1525. var line = session.getLine(row);
  1526. var startIndent = line.search(/\S/);
  1527. var startRow = row;
  1528. var startColumn = line.length;
  1529. row = row + 1;
  1530. var endRow = row;
  1531. var maxRow = session.getLength();
  1532. while (++row < maxRow) {
  1533. line = session.getLine(row);
  1534. var indent = line.search(/\S/);
  1535. if (indent === -1)
  1536. continue;
  1537. if (startIndent > indent)
  1538. break;
  1539. var subRange = this.getFoldWidgetRange(session, "all", row);
  1540. if (subRange) {
  1541. if (subRange.start.row <= startRow) {
  1542. break;
  1543. } else if (subRange.isMultiLine()) {
  1544. row = subRange.end.row;
  1545. } else if (startIndent == indent) {
  1546. break;
  1547. }
  1548. }
  1549. endRow = row;
  1550. }
  1551. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  1552. };
  1553. this.getCommentRegionBlock = function(session, line, row) {
  1554. var startColumn = line.search(/\s*$/);
  1555. var maxRow = session.getLength();
  1556. var startRow = row;
  1557. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  1558. var depth = 1;
  1559. while (++row < maxRow) {
  1560. line = session.getLine(row);
  1561. var m = re.exec(line);
  1562. if (!m) continue;
  1563. if (m[1]) depth--;
  1564. else depth++;
  1565. if (!depth) break;
  1566. }
  1567. var endRow = row;
  1568. if (endRow > startRow) {
  1569. return new Range(startRow, startColumn, endRow, line.length);
  1570. }
  1571. };
  1572. }).call(FoldMode.prototype);
  1573. });
  1574. 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(acequire, exports, module) {
  1575. "use strict";
  1576. var oop = acequire("../lib/oop");
  1577. var TextMode = acequire("./text").Mode;
  1578. var MaskHighlightRules = acequire("./mask_highlight_rules").MaskHighlightRules;
  1579. var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent;
  1580. var CssBehaviour = acequire("./behaviour/css").CssBehaviour;
  1581. var CStyleFoldMode = acequire("./folding/cstyle").FoldMode;
  1582. var Mode = function() {
  1583. this.HighlightRules = MaskHighlightRules;
  1584. this.$outdent = new MatchingBraceOutdent();
  1585. this.$behaviour = new CssBehaviour();
  1586. this.foldingRules = new CStyleFoldMode();
  1587. };
  1588. oop.inherits(Mode, TextMode);
  1589. (function() {
  1590. this.lineCommentStart = "//";
  1591. this.blockComment = {start: "/*", end: "*/"};
  1592. this.getNextLineIndent = function(state, line, tab) {
  1593. var indent = this.$getIndent(line);
  1594. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1595. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1596. return indent;
  1597. }
  1598. var match = line.match(/^.*\{\s*$/);
  1599. if (match) {
  1600. indent += tab;
  1601. }
  1602. return indent;
  1603. };
  1604. this.checkOutdent = function(state, line, input) {
  1605. return this.$outdent.checkOutdent(line, input);
  1606. };
  1607. this.autoOutdent = function(state, doc, row) {
  1608. this.$outdent.autoOutdent(doc, row);
  1609. };
  1610. this.$id = "ace/mode/mask";
  1611. }).call(Mode.prototype);
  1612. exports.Mode = Mode;
  1613. });