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.

2129 lines
86 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/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
  502. "use strict";
  503. var oop = acequire("../lib/oop");
  504. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  505. var XmlHighlightRules = function(normalize) {
  506. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  507. this.$rules = {
  508. start : [
  509. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  510. {
  511. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  512. regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
  513. },
  514. {token : "comment.start.xml", regex : "<\\!--", next : "comment"},
  515. {
  516. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  517. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  518. },
  519. {include : "tag"},
  520. {token : "text.end-tag-open.xml", regex: "</"},
  521. {token : "text.tag-open.xml", regex: "<"},
  522. {include : "reference"},
  523. {defaultToken : "text.xml"}
  524. ],
  525. processing_instruction : [{
  526. token : "entity.other.attribute-name.decl-attribute-name.xml",
  527. regex : tagRegex
  528. }, {
  529. token : "keyword.operator.decl-attribute-equals.xml",
  530. regex : "="
  531. }, {
  532. include: "whitespace"
  533. }, {
  534. include: "string"
  535. }, {
  536. token : "punctuation.xml-decl.xml",
  537. regex : "\\?>",
  538. next : "start"
  539. }],
  540. doctype : [
  541. {include : "whitespace"},
  542. {include : "string"},
  543. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  544. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  545. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  546. ],
  547. int_subset : [{
  548. token : "text.xml",
  549. regex : "\\s+"
  550. }, {
  551. token: "punctuation.int-subset.xml",
  552. regex: "]",
  553. next: "pop"
  554. }, {
  555. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  556. regex : "(<\\!)(" + tagRegex + ")",
  557. push : [{
  558. token : "text",
  559. regex : "\\s+"
  560. },
  561. {
  562. token : "punctuation.markup-decl.xml",
  563. regex : ">",
  564. next : "pop"
  565. },
  566. {include : "string"}]
  567. }],
  568. cdata : [
  569. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  570. {token : "text.xml", regex : "\\s+"},
  571. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  572. ],
  573. comment : [
  574. {token : "comment.end.xml", regex : "-->", next : "start"},
  575. {defaultToken : "comment.xml"}
  576. ],
  577. reference : [{
  578. token : "constant.language.escape.reference.xml",
  579. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  580. }],
  581. attr_reference : [{
  582. token : "constant.language.escape.reference.attribute-value.xml",
  583. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  584. }],
  585. tag : [{
  586. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  587. regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  588. next: [
  589. {include : "attributes"},
  590. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  591. ]
  592. }],
  593. tag_whitespace : [
  594. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  595. ],
  596. whitespace : [
  597. {token : "text.whitespace.xml", regex : "\\s+"}
  598. ],
  599. string: [{
  600. token : "string.xml",
  601. regex : "'",
  602. push : [
  603. {token : "string.xml", regex: "'", next: "pop"},
  604. {defaultToken : "string.xml"}
  605. ]
  606. }, {
  607. token : "string.xml",
  608. regex : '"',
  609. push : [
  610. {token : "string.xml", regex: '"', next: "pop"},
  611. {defaultToken : "string.xml"}
  612. ]
  613. }],
  614. attributes: [{
  615. token : "entity.other.attribute-name.xml",
  616. regex : tagRegex
  617. }, {
  618. token : "keyword.operator.attribute-equals.xml",
  619. regex : "="
  620. }, {
  621. include: "tag_whitespace"
  622. }, {
  623. include: "attribute_value"
  624. }],
  625. attribute_value: [{
  626. token : "string.attribute-value.xml",
  627. regex : "'",
  628. push : [
  629. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  630. {include : "attr_reference"},
  631. {defaultToken : "string.attribute-value.xml"}
  632. ]
  633. }, {
  634. token : "string.attribute-value.xml",
  635. regex : '"',
  636. push : [
  637. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  638. {include : "attr_reference"},
  639. {defaultToken : "string.attribute-value.xml"}
  640. ]
  641. }]
  642. };
  643. if (this.constructor === XmlHighlightRules)
  644. this.normalizeRules();
  645. };
  646. (function() {
  647. this.embedTagRules = function(HighlightRules, prefix, tag){
  648. this.$rules.tag.unshift({
  649. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  650. regex : "(<)(" + tag + "(?=\\s|>|$))",
  651. next: [
  652. {include : "attributes"},
  653. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  654. ]
  655. });
  656. this.$rules[tag + "-end"] = [
  657. {include : "attributes"},
  658. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  659. onMatch : function(value, currentState, stack) {
  660. stack.splice(0);
  661. return this.token;
  662. }}
  663. ];
  664. this.embedRules(HighlightRules, prefix, [{
  665. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  666. regex : "(</)(" + tag + "(?=\\s|>|$))",
  667. next: tag + "-end"
  668. }, {
  669. token: "string.cdata.xml",
  670. regex : "<\\!\\[CDATA\\["
  671. }, {
  672. token: "string.cdata.xml",
  673. regex : "\\]\\]>"
  674. }]);
  675. };
  676. }).call(TextHighlightRules.prototype);
  677. oop.inherits(XmlHighlightRules, TextHighlightRules);
  678. exports.XmlHighlightRules = XmlHighlightRules;
  679. });
  680. 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) {
  681. "use strict";
  682. var oop = acequire("../lib/oop");
  683. var lang = acequire("../lib/lang");
  684. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  685. 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";
  686. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  687. 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";
  688. 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";
  689. 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";
  690. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  691. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  692. 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";
  693. var CssHighlightRules = function() {
  694. var keywordMapper = this.createKeywordMapper({
  695. "support.function": supportFunction,
  696. "support.constant": supportConstant,
  697. "support.type": supportType,
  698. "support.constant.color": supportConstantColor,
  699. "support.constant.fonts": supportConstantFonts
  700. }, "text", true);
  701. this.$rules = {
  702. "start" : [{
  703. include : ["strings", "url", "comments"]
  704. }, {
  705. token: "paren.lparen",
  706. regex: "\\{",
  707. next: "ruleset"
  708. }, {
  709. token: "paren.rparen",
  710. regex: "\\}"
  711. }, {
  712. token: "string",
  713. regex: "@",
  714. next: "media"
  715. }, {
  716. token: "keyword",
  717. regex: "#[a-z0-9-_]+"
  718. }, {
  719. token: "keyword",
  720. regex: "%"
  721. }, {
  722. token: "variable",
  723. regex: "\\.[a-z0-9-_]+"
  724. }, {
  725. token: "string",
  726. regex: ":[a-z0-9-_]+"
  727. }, {
  728. token : "constant.numeric",
  729. regex : numRe
  730. }, {
  731. token: "constant",
  732. regex: "[a-z0-9-_]+"
  733. }, {
  734. caseInsensitive: true
  735. }],
  736. "media": [{
  737. include : ["strings", "url", "comments"]
  738. }, {
  739. token: "paren.lparen",
  740. regex: "\\{",
  741. next: "start"
  742. }, {
  743. token: "paren.rparen",
  744. regex: "\\}",
  745. next: "start"
  746. }, {
  747. token: "string",
  748. regex: ";",
  749. next: "start"
  750. }, {
  751. token: "keyword",
  752. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  753. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  754. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  755. }],
  756. "comments" : [{
  757. token: "comment", // multi line comment
  758. regex: "\\/\\*",
  759. push: [{
  760. token : "comment",
  761. regex : "\\*\\/",
  762. next : "pop"
  763. }, {
  764. defaultToken : "comment"
  765. }]
  766. }],
  767. "ruleset" : [{
  768. regex : "-(webkit|ms|moz|o)-",
  769. token : "text"
  770. }, {
  771. token : "paren.rparen",
  772. regex : "\\}",
  773. next : "start"
  774. }, {
  775. include : ["strings", "url", "comments"]
  776. }, {
  777. token : ["constant.numeric", "keyword"],
  778. 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|%)"
  779. }, {
  780. token : "constant.numeric",
  781. regex : numRe
  782. }, {
  783. token : "constant.numeric", // hex6 color
  784. regex : "#[a-f0-9]{6}"
  785. }, {
  786. token : "constant.numeric", // hex3 color
  787. regex : "#[a-f0-9]{3}"
  788. }, {
  789. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  790. regex : pseudoElements
  791. }, {
  792. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  793. regex : pseudoClasses
  794. }, {
  795. include: "url"
  796. }, {
  797. token : keywordMapper,
  798. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  799. }, {
  800. caseInsensitive: true
  801. }],
  802. url: [{
  803. token : "support.function",
  804. regex : "(?:url(:?-prefix)?|domain|regexp)\\(",
  805. push: [{
  806. token : "support.function",
  807. regex : "\\)",
  808. next : "pop"
  809. }, {
  810. defaultToken: "string"
  811. }]
  812. }],
  813. strings: [{
  814. token : "string.start",
  815. regex : "'",
  816. push : [{
  817. token : "string.end",
  818. regex : "'|$",
  819. next: "pop"
  820. }, {
  821. include : "escapes"
  822. }, {
  823. token : "constant.language.escape",
  824. regex : /\\$/,
  825. consumeLineEnd: true
  826. }, {
  827. defaultToken: "string"
  828. }]
  829. }, {
  830. token : "string.start",
  831. regex : '"',
  832. push : [{
  833. token : "string.end",
  834. regex : '"|$',
  835. next: "pop"
  836. }, {
  837. include : "escapes"
  838. }, {
  839. token : "constant.language.escape",
  840. regex : /\\$/,
  841. consumeLineEnd: true
  842. }, {
  843. defaultToken: "string"
  844. }]
  845. }],
  846. escapes: [{
  847. token : "constant.language.escape",
  848. regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  849. }]
  850. };
  851. this.normalizeRules();
  852. };
  853. oop.inherits(CssHighlightRules, TextHighlightRules);
  854. exports.CssHighlightRules = CssHighlightRules;
  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/scss_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
  1107. "use strict";
  1108. var oop = acequire("../lib/oop");
  1109. var lang = acequire("../lib/lang");
  1110. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  1111. var ScssHighlightRules = function() {
  1112. var properties = lang.arrayToMap( (function () {
  1113. var browserPrefix = ("-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-").split("|");
  1114. var prefixProperties = ("appearance|background-clip|background-inline-policy|background-origin|" +
  1115. "background-size|binding|border-bottom-colors|border-left-colors|" +
  1116. "border-right-colors|border-top-colors|border-end|border-end-color|" +
  1117. "border-end-style|border-end-width|border-image|border-start|" +
  1118. "border-start-color|border-start-style|border-start-width|box-align|" +
  1119. "box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|" +
  1120. "box-pack|box-sizing|column-count|column-gap|column-width|column-rule|" +
  1121. "column-rule-width|column-rule-style|column-rule-color|float-edge|" +
  1122. "font-feature-settings|font-language-override|force-broken-image-icon|" +
  1123. "image-region|margin-end|margin-start|opacity|outline|outline-color|" +
  1124. "outline-offset|outline-radius|outline-radius-bottomleft|" +
  1125. "outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|" +
  1126. "outline-style|outline-width|padding-end|padding-start|stack-sizing|" +
  1127. "tab-size|text-blink|text-decoration-color|text-decoration-line|" +
  1128. "text-decoration-style|transform|transform-origin|transition|" +
  1129. "transition-delay|transition-duration|transition-property|" +
  1130. "transition-timing-function|user-focus|user-input|user-modify|user-select|" +
  1131. "window-shadow|border-radius").split("|");
  1132. var properties = ("azimuth|background-attachment|background-color|background-image|" +
  1133. "background-position|background-repeat|background|border-bottom-color|" +
  1134. "border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
  1135. "border-color|border-left-color|border-left-style|border-left-width|" +
  1136. "border-left|border-right-color|border-right-style|border-right-width|" +
  1137. "border-right|border-spacing|border-style|border-top-color|" +
  1138. "border-top-style|border-top-width|border-top|border-width|border|bottom|" +
  1139. "box-shadow|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
  1140. "counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
  1141. "elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
  1142. "font-stretch|font-style|font-variant|font-weight|font|height|left|" +
  1143. "letter-spacing|line-height|list-style-image|list-style-position|" +
  1144. "list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
  1145. "margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
  1146. "min-width|opacity|orphans|outline-color|" +
  1147. "outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
  1148. "padding-left|padding-right|padding-top|padding|page-break-after|" +
  1149. "page-break-before|page-break-inside|page|pause-after|pause-before|" +
  1150. "pause|pitch-range|pitch|play-during|position|quotes|richness|right|" +
  1151. "size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
  1152. "stress|table-layout|text-align|text-decoration|text-indent|" +
  1153. "text-shadow|text-transform|top|unicode-bidi|vertical-align|" +
  1154. "visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
  1155. "z-index").split("|");
  1156. var ret = [];
  1157. for (var i=0, ln=browserPrefix.length; i<ln; i++) {
  1158. Array.prototype.push.apply(
  1159. ret,
  1160. (( browserPrefix[i] + prefixProperties.join("|" + browserPrefix[i]) ).split("|"))
  1161. );
  1162. }
  1163. Array.prototype.push.apply(ret, prefixProperties);
  1164. Array.prototype.push.apply(ret, properties);
  1165. return ret;
  1166. })() );
  1167. var functions = lang.arrayToMap(
  1168. ("hsl|hsla|rgb|rgba|url|attr|counter|counters|abs|adjust_color|adjust_hue|" +
  1169. "alpha|join|blue|ceil|change_color|comparable|complement|darken|desaturate|" +
  1170. "floor|grayscale|green|hue|if|invert|join|length|lighten|lightness|mix|" +
  1171. "nth|opacify|opacity|percentage|quote|red|round|saturate|saturation|" +
  1172. "scale_color|transparentize|type_of|unit|unitless|unquote").split("|")
  1173. );
  1174. var constants = lang.arrayToMap(
  1175. ("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
  1176. "block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
  1177. "char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
  1178. "decimal-leading-zero|decimal|default|disabled|disc|" +
  1179. "distribute-all-lines|distribute-letter|distribute-space|" +
  1180. "distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
  1181. "hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
  1182. "ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
  1183. "ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
  1184. "inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
  1185. "keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
  1186. "lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
  1187. "medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
  1188. "nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
  1189. "overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
  1190. "ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
  1191. "solid|square|static|strict|super|sw-resize|table-footer-group|" +
  1192. "table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
  1193. "transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
  1194. "vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
  1195. "zero").split("|")
  1196. );
  1197. var colors = lang.arrayToMap(
  1198. ("aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|" +
  1199. "blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|" +
  1200. "chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|" +
  1201. "darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|" +
  1202. "darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|" +
  1203. "darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|" +
  1204. "darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|" +
  1205. "dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|" +
  1206. "ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|" +
  1207. "hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|" +
  1208. "lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|" +
  1209. "lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|" +
  1210. "lightsalmon|lightseagreen|lightskyblue|lightslategray|" +
  1211. "lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|" +
  1212. "magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|" +
  1213. "mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|" +
  1214. "mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|" +
  1215. "moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|" +
  1216. "orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|" +
  1217. "papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|" +
  1218. "red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|" +
  1219. "seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|" +
  1220. "springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|" +
  1221. "wheat|white|whitesmoke|yellow|yellowgreen").split("|")
  1222. );
  1223. var keywords = lang.arrayToMap(
  1224. ("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|def|end|declare").split("|")
  1225. );
  1226. var tags = lang.arrayToMap(
  1227. ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
  1228. "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
  1229. "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
  1230. "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
  1231. "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
  1232. "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
  1233. "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
  1234. "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
  1235. "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
  1236. );
  1237. var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
  1238. this.$rules = {
  1239. "start" : [
  1240. {
  1241. token : "comment",
  1242. regex : "\\/\\/.*$"
  1243. },
  1244. {
  1245. token : "comment", // multi line comment
  1246. regex : "\\/\\*",
  1247. next : "comment"
  1248. }, {
  1249. token : "string", // single line
  1250. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  1251. }, {
  1252. token : "string", // multi line string start
  1253. regex : '["].*\\\\$',
  1254. next : "qqstring"
  1255. }, {
  1256. token : "string", // single line
  1257. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  1258. }, {
  1259. token : "string", // multi line string start
  1260. regex : "['].*\\\\$",
  1261. next : "qstring"
  1262. }, {
  1263. token : "constant.numeric",
  1264. regex : numRe + "(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)"
  1265. }, {
  1266. token : "constant.numeric", // hex6 color
  1267. regex : "#[a-f0-9]{6}"
  1268. }, {
  1269. token : "constant.numeric", // hex3 color
  1270. regex : "#[a-f0-9]{3}"
  1271. }, {
  1272. token : "constant.numeric",
  1273. regex : numRe
  1274. }, {
  1275. token : ["support.function", "string", "support.function"],
  1276. regex : "(url\\()(.*)(\\))"
  1277. }, {
  1278. token : function(value) {
  1279. if (properties.hasOwnProperty(value.toLowerCase()))
  1280. return "support.type";
  1281. if (keywords.hasOwnProperty(value))
  1282. return "keyword";
  1283. else if (constants.hasOwnProperty(value))
  1284. return "constant.language";
  1285. else if (functions.hasOwnProperty(value))
  1286. return "support.function";
  1287. else if (colors.hasOwnProperty(value.toLowerCase()))
  1288. return "support.constant.color";
  1289. else if (tags.hasOwnProperty(value.toLowerCase()))
  1290. return "variable.language";
  1291. else
  1292. return "text";
  1293. },
  1294. regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
  1295. }, {
  1296. token : "variable",
  1297. regex : "[a-z_\\-$][a-z0-9_\\-$]*\\b"
  1298. }, {
  1299. token: "variable.language",
  1300. regex: "#[a-z0-9-_]+"
  1301. }, {
  1302. token: "variable.language",
  1303. regex: "\\.[a-z0-9-_]+"
  1304. }, {
  1305. token: "variable.language",
  1306. regex: ":[a-z0-9-_]+"
  1307. }, {
  1308. token: "constant",
  1309. regex: "[a-z0-9-_]+"
  1310. }, {
  1311. token : "keyword.operator",
  1312. regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
  1313. }, {
  1314. token : "paren.lparen",
  1315. regex : "[[({]"
  1316. }, {
  1317. token : "paren.rparen",
  1318. regex : "[\\])}]"
  1319. }, {
  1320. token : "text",
  1321. regex : "\\s+"
  1322. }, {
  1323. caseInsensitive: true
  1324. }
  1325. ],
  1326. "comment" : [
  1327. {
  1328. token : "comment", // closing comment
  1329. regex : "\\*\\/",
  1330. next : "start"
  1331. }, {
  1332. defaultToken : "comment"
  1333. }
  1334. ],
  1335. "qqstring" : [
  1336. {
  1337. token : "string",
  1338. regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
  1339. next : "start"
  1340. }, {
  1341. token : "string",
  1342. regex : '.+'
  1343. }
  1344. ],
  1345. "qstring" : [
  1346. {
  1347. token : "string",
  1348. regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
  1349. next : "start"
  1350. }, {
  1351. token : "string",
  1352. regex : '.+'
  1353. }
  1354. ]
  1355. };
  1356. };
  1357. oop.inherits(ScssHighlightRules, TextHighlightRules);
  1358. exports.ScssHighlightRules = ScssHighlightRules;
  1359. });
  1360. ace.define("ace/mode/less_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/css_highlight_rules"], function(acequire, exports, module) {
  1361. "use strict";
  1362. var oop = acequire("../lib/oop");
  1363. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  1364. var CssHighlightRules = acequire('./css_highlight_rules');
  1365. var LessHighlightRules = function() {
  1366. var keywordList = "@import|@media|@font-face|@keyframes|@-webkit-keyframes|@supports|" +
  1367. "@charset|@plugin|@namespace|@document|@page|@viewport|@-ms-viewport|" +
  1368. "or|and|when|not";
  1369. var keywords = keywordList.split('|');
  1370. var properties = CssHighlightRules.supportType.split('|');
  1371. var keywordMapper = this.createKeywordMapper({
  1372. "support.constant": CssHighlightRules.supportConstant,
  1373. "keyword": keywordList,
  1374. "support.constant.color": CssHighlightRules.supportConstantColor,
  1375. "support.constant.fonts": CssHighlightRules.supportConstantFonts
  1376. }, "identifier", true);
  1377. var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
  1378. this.$rules = {
  1379. "start" : [
  1380. {
  1381. token : "comment",
  1382. regex : "\\/\\/.*$"
  1383. },
  1384. {
  1385. token : "comment", // multi line comment
  1386. regex : "\\/\\*",
  1387. next : "comment"
  1388. }, {
  1389. token : "string", // single line
  1390. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  1391. }, {
  1392. token : "string", // single line
  1393. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  1394. }, {
  1395. token : ["constant.numeric", "keyword"],
  1396. 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|%)"
  1397. }, {
  1398. token : "constant.numeric", // hex6 color
  1399. regex : "#[a-f0-9]{6}"
  1400. }, {
  1401. token : "constant.numeric", // hex3 color
  1402. regex : "#[a-f0-9]{3}"
  1403. }, {
  1404. token : "constant.numeric",
  1405. regex : numRe
  1406. }, {
  1407. token : ["support.function", "paren.lparen", "string", "paren.rparen"],
  1408. regex : "(url)(\\()(.*)(\\))"
  1409. }, {
  1410. token : ["support.function", "paren.lparen"],
  1411. regex : "(:extend|[a-z0-9_\\-]+)(\\()"
  1412. }, {
  1413. token : function(value) {
  1414. if (keywords.indexOf(value.toLowerCase()) > -1)
  1415. return "keyword";
  1416. else
  1417. return "variable";
  1418. },
  1419. regex : "[@\\$][a-z0-9_\\-@\\$]*\\b"
  1420. }, {
  1421. token : "variable",
  1422. regex : "[@\\$]\\{[a-z0-9_\\-@\\$]*\\}"
  1423. }, {
  1424. token : function(first, second) {
  1425. if(properties.indexOf(first.toLowerCase()) > -1) {
  1426. return ["support.type.property", "text"];
  1427. }
  1428. else {
  1429. return ["support.type.unknownProperty", "text"];
  1430. }
  1431. },
  1432. regex : "([a-z0-9-_]+)(\\s*:)"
  1433. }, {
  1434. token : "keyword",
  1435. regex : "&" // special case - always treat as keyword
  1436. }, {
  1437. token : keywordMapper,
  1438. regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
  1439. }, {
  1440. token: "variable.language",
  1441. regex: "#[a-z0-9-_]+"
  1442. }, {
  1443. token: "variable.language",
  1444. regex: "\\.[a-z0-9-_]+"
  1445. }, {
  1446. token: "variable.language",
  1447. regex: ":[a-z_][a-z0-9-_]*"
  1448. }, {
  1449. token: "constant",
  1450. regex: "[a-z0-9-_]+"
  1451. }, {
  1452. token : "keyword.operator",
  1453. regex : "<|>|<=|>=|=|!=|-|%|\\+|\\*"
  1454. }, {
  1455. token : "paren.lparen",
  1456. regex : "[[({]"
  1457. }, {
  1458. token : "paren.rparen",
  1459. regex : "[\\])}]"
  1460. }, {
  1461. token : "text",
  1462. regex : "\\s+"
  1463. }, {
  1464. caseInsensitive: true
  1465. }
  1466. ],
  1467. "comment" : [
  1468. {
  1469. token : "comment", // closing comment
  1470. regex : "\\*\\/",
  1471. next : "start"
  1472. }, {
  1473. defaultToken : "comment"
  1474. }
  1475. ]
  1476. };
  1477. this.normalizeRules();
  1478. };
  1479. oop.inherits(LessHighlightRules, TextHighlightRules);
  1480. exports.LessHighlightRules = LessHighlightRules;
  1481. });
  1482. ace.define("ace/mode/coffee_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
  1483. "use strict";
  1484. var oop = acequire("../lib/oop");
  1485. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  1486. oop.inherits(CoffeeHighlightRules, TextHighlightRules);
  1487. function CoffeeHighlightRules() {
  1488. var identifier = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*";
  1489. var keywords = (
  1490. "this|throw|then|try|typeof|super|switch|return|break|by|continue|" +
  1491. "catch|class|in|instanceof|is|isnt|if|else|extends|for|own|" +
  1492. "finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" +
  1493. "or|on|unless|until|and|yes"
  1494. );
  1495. var langConstant = (
  1496. "true|false|null|undefined|NaN|Infinity"
  1497. );
  1498. var illegal = (
  1499. "case|const|default|function|var|void|with|enum|export|implements|" +
  1500. "interface|let|package|private|protected|public|static|yield"
  1501. );
  1502. var supportClass = (
  1503. "Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|String|" +
  1504. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
  1505. "SyntaxError|TypeError|URIError|" +
  1506. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  1507. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray"
  1508. );
  1509. var supportFunction = (
  1510. "Math|JSON|isNaN|isFinite|parseInt|parseFloat|encodeURI|" +
  1511. "encodeURIComponent|decodeURI|decodeURIComponent|String|"
  1512. );
  1513. var variableLanguage = (
  1514. "window|arguments|prototype|document"
  1515. );
  1516. var keywordMapper = this.createKeywordMapper({
  1517. "keyword": keywords,
  1518. "constant.language": langConstant,
  1519. "invalid.illegal": illegal,
  1520. "language.support.class": supportClass,
  1521. "language.support.function": supportFunction,
  1522. "variable.language": variableLanguage
  1523. }, "identifier");
  1524. var functionRule = {
  1525. token: ["paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"],
  1526. regex: /(?:(\()((?:"[^")]*?"|'[^')]*?'|\/[^\/)]*?\/|[^()"'\/])*?)(\))(\s*))?([\-=]>)/.source
  1527. };
  1528. var stringEscape = /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)/;
  1529. this.$rules = {
  1530. start : [
  1531. {
  1532. token : "constant.numeric",
  1533. regex : "(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"
  1534. }, {
  1535. stateName: "qdoc",
  1536. token : "string", regex : "'''", next : [
  1537. {token : "string", regex : "'''", next : "start"},
  1538. {token : "constant.language.escape", regex : stringEscape},
  1539. {defaultToken: "string"}
  1540. ]
  1541. }, {
  1542. stateName: "qqdoc",
  1543. token : "string",
  1544. regex : '"""',
  1545. next : [
  1546. {token : "string", regex : '"""', next : "start"},
  1547. {token : "paren.string", regex : '#{', push : "start"},
  1548. {token : "constant.language.escape", regex : stringEscape},
  1549. {defaultToken: "string"}
  1550. ]
  1551. }, {
  1552. stateName: "qstring",
  1553. token : "string", regex : "'", next : [
  1554. {token : "string", regex : "'", next : "start"},
  1555. {token : "constant.language.escape", regex : stringEscape},
  1556. {defaultToken: "string"}
  1557. ]
  1558. }, {
  1559. stateName: "qqstring",
  1560. token : "string.start", regex : '"', next : [
  1561. {token : "string.end", regex : '"', next : "start"},
  1562. {token : "paren.string", regex : '#{', push : "start"},
  1563. {token : "constant.language.escape", regex : stringEscape},
  1564. {defaultToken: "string"}
  1565. ]
  1566. }, {
  1567. stateName: "js",
  1568. token : "string", regex : "`", next : [
  1569. {token : "string", regex : "`", next : "start"},
  1570. {token : "constant.language.escape", regex : stringEscape},
  1571. {defaultToken: "string"}
  1572. ]
  1573. }, {
  1574. regex: "[{}]", onMatch: function(val, state, stack) {
  1575. this.next = "";
  1576. if (val == "{" && stack.length) {
  1577. stack.unshift("start", state);
  1578. return "paren";
  1579. }
  1580. if (val == "}" && stack.length) {
  1581. stack.shift();
  1582. this.next = stack.shift() || "";
  1583. if (this.next.indexOf("string") != -1)
  1584. return "paren.string";
  1585. }
  1586. return "paren";
  1587. }
  1588. }, {
  1589. token : "string.regex",
  1590. regex : "///",
  1591. next : "heregex"
  1592. }, {
  1593. token : "string.regex",
  1594. regex : /(?:\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)(?:[imgy]{0,4})(?!\w)/
  1595. }, {
  1596. token : "comment",
  1597. regex : "###(?!#)",
  1598. next : "comment"
  1599. }, {
  1600. token : "comment",
  1601. regex : "#.*"
  1602. }, {
  1603. token : ["punctuation.operator", "text", "identifier"],
  1604. regex : "(\\.)(\\s*)(" + illegal + ")"
  1605. }, {
  1606. token : "punctuation.operator",
  1607. regex : "\\.{1,3}"
  1608. }, {
  1609. token : ["keyword", "text", "language.support.class",
  1610. "text", "keyword", "text", "language.support.class"],
  1611. regex : "(class)(\\s+)(" + identifier + ")(?:(\\s+)(extends)(\\s+)(" + identifier + "))?"
  1612. }, {
  1613. token : ["entity.name.function", "text", "keyword.operator", "text"].concat(functionRule.token),
  1614. regex : "(" + identifier + ")(\\s*)([=:])(\\s*)" + functionRule.regex
  1615. },
  1616. functionRule,
  1617. {
  1618. token : "variable",
  1619. regex : "@(?:" + identifier + ")?"
  1620. }, {
  1621. token: keywordMapper,
  1622. regex : identifier
  1623. }, {
  1624. token : "punctuation.operator",
  1625. regex : "\\,|\\."
  1626. }, {
  1627. token : "storage.type",
  1628. regex : "[\\-=]>"
  1629. }, {
  1630. token : "keyword.operator",
  1631. regex : "(?:[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|[!*+-=><])"
  1632. }, {
  1633. token : "paren.lparen",
  1634. regex : "[({[]"
  1635. }, {
  1636. token : "paren.rparen",
  1637. regex : "[\\]})]"
  1638. }, {
  1639. token : "text",
  1640. regex : "\\s+"
  1641. }],
  1642. heregex : [{
  1643. token : "string.regex",
  1644. regex : '.*?///[imgy]{0,4}',
  1645. next : "start"
  1646. }, {
  1647. token : "comment.regex",
  1648. regex : "\\s+(?:#.*)?"
  1649. }, {
  1650. token : "string.regex",
  1651. regex : "\\S+"
  1652. }],
  1653. comment : [{
  1654. token : "comment",
  1655. regex : '###',
  1656. next : "start"
  1657. }, {
  1658. defaultToken : "comment"
  1659. }]
  1660. };
  1661. this.normalizeRules();
  1662. }
  1663. exports.CoffeeHighlightRules = CoffeeHighlightRules;
  1664. });
  1665. ace.define("ace/mode/jade_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/markdown_highlight_rules","ace/mode/scss_highlight_rules","ace/mode/less_highlight_rules","ace/mode/coffee_highlight_rules","ace/mode/javascript_highlight_rules"], function(acequire, exports, module) {
  1666. "use strict";
  1667. var oop = acequire("../lib/oop");
  1668. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  1669. var MarkdownHighlightRules = acequire("./markdown_highlight_rules").MarkdownHighlightRules;
  1670. var SassHighlightRules = acequire("./scss_highlight_rules").ScssHighlightRules;
  1671. var LessHighlightRules = acequire("./less_highlight_rules").LessHighlightRules;
  1672. var CoffeeHighlightRules = acequire("./coffee_highlight_rules").CoffeeHighlightRules;
  1673. var JavaScriptHighlightRules = acequire("./javascript_highlight_rules").JavaScriptHighlightRules;
  1674. function mixin_embed(tag, prefix) {
  1675. return {
  1676. token : "entity.name.function.jade",
  1677. regex : "^\\s*\\:" + tag,
  1678. next : prefix + "start"
  1679. };
  1680. }
  1681. var JadeHighlightRules = function() {
  1682. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  1683. "u[0-9a-fA-F]{4}|" + // unicode
  1684. "[0-2][0-7]{0,2}|" + // oct
  1685. "3[0-6][0-7]?|" + // oct
  1686. "37[0-7]?|" + // oct
  1687. "[4-7][0-7]?|" + //oct
  1688. ".)";
  1689. this.$rules =
  1690. {
  1691. "start": [
  1692. {
  1693. token: "keyword.control.import.include.jade",
  1694. regex: "\\s*\\binclude\\b"
  1695. },
  1696. {
  1697. token: "keyword.other.doctype.jade",
  1698. regex: "^!!!\\s*(?:[a-zA-Z0-9-_]+)?"
  1699. },
  1700. {
  1701. onMatch: function(value, currentState, stack) {
  1702. stack.unshift(this.next, value.length - 2, currentState);
  1703. return "comment";
  1704. },
  1705. regex: /^\s*\/\//,
  1706. next: "comment_block"
  1707. },
  1708. mixin_embed("markdown", "markdown-"),
  1709. mixin_embed("sass", "sass-"),
  1710. mixin_embed("less", "less-"),
  1711. mixin_embed("coffee", "coffee-"),
  1712. {
  1713. token: [ "storage.type.function.jade",
  1714. "entity.name.function.jade",
  1715. "punctuation.definition.parameters.begin.jade",
  1716. "variable.parameter.function.jade",
  1717. "punctuation.definition.parameters.end.jade"
  1718. ],
  1719. regex: "^(\\s*mixin)( [\\w\\-]+)(\\s*\\()(.*?)(\\))"
  1720. },
  1721. {
  1722. token: [ "storage.type.function.jade", "entity.name.function.jade"],
  1723. regex: "^(\\s*mixin)( [\\w\\-]+)"
  1724. },
  1725. {
  1726. token: "source.js.embedded.jade",
  1727. regex: "^\\s*(?:-|=|!=)",
  1728. next: "js-start"
  1729. },
  1730. {
  1731. token: "string.interpolated.jade",
  1732. regex: "[#!]\\{[^\\}]+\\}"
  1733. },
  1734. {
  1735. token: "meta.tag.any.jade",
  1736. regex: /^\s*(?!\w+:)(?:[\w-]+|(?=\.|#)])/,
  1737. next: "tag_single"
  1738. },
  1739. {
  1740. token: "suport.type.attribute.id.jade",
  1741. regex: "#\\w+"
  1742. },
  1743. {
  1744. token: "suport.type.attribute.class.jade",
  1745. regex: "\\.\\w+"
  1746. },
  1747. {
  1748. token: "punctuation",
  1749. regex: "\\s*(?:\\()",
  1750. next: "tag_attributes"
  1751. }
  1752. ],
  1753. "comment_block": [
  1754. {regex: /^\s*(?:\/\/)?/, onMatch: function(value, currentState, stack) {
  1755. if (value.length <= stack[1]) {
  1756. if (value.slice(-1) == "/") {
  1757. stack[1] = value.length - 2;
  1758. this.next = "";
  1759. return "comment";
  1760. }
  1761. stack.shift();
  1762. stack.shift();
  1763. this.next = stack.shift();
  1764. return "text";
  1765. } else {
  1766. this.next = "";
  1767. return "comment";
  1768. }
  1769. }, next: "start"},
  1770. {defaultToken: "comment"}
  1771. ],
  1772. "tag_single": [
  1773. {
  1774. token: "entity.other.attribute-name.class.jade",
  1775. regex: "\\.[\\w-]+"
  1776. },
  1777. {
  1778. token: "entity.other.attribute-name.id.jade",
  1779. regex: "#[\\w-]+"
  1780. },
  1781. {
  1782. token: ["text", "punctuation"],
  1783. regex: "($)|((?!\\.|#|=|-))",
  1784. next: "start"
  1785. }
  1786. ],
  1787. "tag_attributes": [
  1788. {
  1789. token : "string",
  1790. regex : "'(?=.)",
  1791. next : "qstring"
  1792. },
  1793. {
  1794. token : "string",
  1795. regex : '"(?=.)',
  1796. next : "qqstring"
  1797. },
  1798. {
  1799. token: ["entity.other.attribute-name.jade", "punctuation"],
  1800. regex: "([a-zA-Z:\\.-]+)(=)?",
  1801. next: "attribute_strings"
  1802. },
  1803. {
  1804. token: "punctuation",
  1805. regex: "\\)",
  1806. next: "start"
  1807. }
  1808. ],
  1809. "attribute_strings": [
  1810. {
  1811. token : "string",
  1812. regex : "'(?=.)",
  1813. next : "qstring"
  1814. },
  1815. {
  1816. token : "string",
  1817. regex : '"(?=.)',
  1818. next : "qqstring"
  1819. },
  1820. {
  1821. token : "string",
  1822. regex : '(?=\\S)',
  1823. next : "tag_attributes"
  1824. }
  1825. ],
  1826. "qqstring" : [
  1827. {
  1828. token : "constant.language.escape",
  1829. regex : escapedRe
  1830. }, {
  1831. token : "string",
  1832. regex : '[^"\\\\]+'
  1833. }, {
  1834. token : "string",
  1835. regex : "\\\\$",
  1836. next : "qqstring"
  1837. }, {
  1838. token : "string",
  1839. regex : '"|$',
  1840. next : "tag_attributes"
  1841. }
  1842. ],
  1843. "qstring" : [
  1844. {
  1845. token : "constant.language.escape",
  1846. regex : escapedRe
  1847. }, {
  1848. token : "string",
  1849. regex : "[^'\\\\]+"
  1850. }, {
  1851. token : "string",
  1852. regex : "\\\\$",
  1853. next : "qstring"
  1854. }, {
  1855. token : "string",
  1856. regex : "'|$",
  1857. next : "tag_attributes"
  1858. }
  1859. ]
  1860. };
  1861. this.embedRules(JavaScriptHighlightRules, "js-", [{
  1862. token: "text",
  1863. regex: ".$",
  1864. next: "start"
  1865. }]);
  1866. };
  1867. oop.inherits(JadeHighlightRules, TextHighlightRules);
  1868. exports.JadeHighlightRules = JadeHighlightRules;
  1869. });
  1870. ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(acequire, exports, module) {
  1871. "use strict";
  1872. var oop = acequire("../../lib/oop");
  1873. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  1874. var Range = acequire("../../range").Range;
  1875. var FoldMode = exports.FoldMode = function() {};
  1876. oop.inherits(FoldMode, BaseFoldMode);
  1877. (function() {
  1878. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1879. var range = this.indentationBlock(session, row);
  1880. if (range)
  1881. return range;
  1882. var re = /\S/;
  1883. var line = session.getLine(row);
  1884. var startLevel = line.search(re);
  1885. if (startLevel == -1 || line[startLevel] != "#")
  1886. return;
  1887. var startColumn = line.length;
  1888. var maxRow = session.getLength();
  1889. var startRow = row;
  1890. var endRow = row;
  1891. while (++row < maxRow) {
  1892. line = session.getLine(row);
  1893. var level = line.search(re);
  1894. if (level == -1)
  1895. continue;
  1896. if (line[level] != "#")
  1897. break;
  1898. endRow = row;
  1899. }
  1900. if (endRow > startRow) {
  1901. var endColumn = session.getLine(endRow).length;
  1902. return new Range(startRow, startColumn, endRow, endColumn);
  1903. }
  1904. };
  1905. this.getFoldWidget = function(session, foldStyle, row) {
  1906. var line = session.getLine(row);
  1907. var indent = line.search(/\S/);
  1908. var next = session.getLine(row + 1);
  1909. var prev = session.getLine(row - 1);
  1910. var prevIndent = prev.search(/\S/);
  1911. var nextIndent = next.search(/\S/);
  1912. if (indent == -1) {
  1913. session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
  1914. return "";
  1915. }
  1916. if (prevIndent == -1) {
  1917. if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
  1918. session.foldWidgets[row - 1] = "";
  1919. session.foldWidgets[row + 1] = "";
  1920. return "start";
  1921. }
  1922. } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
  1923. if (session.getLine(row - 2).search(/\S/) == -1) {
  1924. session.foldWidgets[row - 1] = "start";
  1925. session.foldWidgets[row + 1] = "";
  1926. return "";
  1927. }
  1928. }
  1929. if (prevIndent!= -1 && prevIndent < indent)
  1930. session.foldWidgets[row - 1] = "start";
  1931. else
  1932. session.foldWidgets[row - 1] = "";
  1933. if (indent < nextIndent)
  1934. return "start";
  1935. else
  1936. return "";
  1937. };
  1938. }).call(FoldMode.prototype);
  1939. });
  1940. ace.define("ace/mode/jade",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/jade_highlight_rules","ace/mode/folding/coffee"], function(acequire, exports, module) {
  1941. "use strict";
  1942. var oop = acequire("../lib/oop");
  1943. var TextMode = acequire("./text").Mode;
  1944. var JadeHighlightRules = acequire("./jade_highlight_rules").JadeHighlightRules;
  1945. var FoldMode = acequire("./folding/coffee").FoldMode;
  1946. var Mode = function() {
  1947. this.HighlightRules = JadeHighlightRules;
  1948. this.foldingRules = new FoldMode();
  1949. this.$behaviour = this.$defaultBehaviour;
  1950. };
  1951. oop.inherits(Mode, TextMode);
  1952. (function() {
  1953. this.lineCommentStart = "//";
  1954. this.$id = "ace/mode/jade";
  1955. }).call(Mode.prototype);
  1956. exports.Mode = Mode;
  1957. });