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.

2606 lines
103 KiB

12 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/matching_brace_outdent",["require","exports","module","ace/range"], function(acequire, exports, module) {
  502. "use strict";
  503. var Range = acequire("../range").Range;
  504. var MatchingBraceOutdent = function() {};
  505. (function() {
  506. this.checkOutdent = function(line, input) {
  507. if (! /^\s+$/.test(line))
  508. return false;
  509. return /^\s*\}/.test(input);
  510. };
  511. this.autoOutdent = function(doc, row) {
  512. var line = doc.getLine(row);
  513. var match = line.match(/^(\s*\})/);
  514. if (!match) return 0;
  515. var column = match[1].length;
  516. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  517. if (!openBracePos || openBracePos.row == row) return 0;
  518. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  519. doc.replace(new Range(row, 0, row, column-1), indent);
  520. };
  521. this.$getIndent = function(line) {
  522. return line.match(/^\s*/)[0];
  523. };
  524. }).call(MatchingBraceOutdent.prototype);
  525. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  526. });
  527. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(acequire, exports, module) {
  528. "use strict";
  529. var oop = acequire("../../lib/oop");
  530. var Range = acequire("../../range").Range;
  531. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  532. var FoldMode = exports.FoldMode = function(commentRegex) {
  533. if (commentRegex) {
  534. this.foldingStartMarker = new RegExp(
  535. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  536. );
  537. this.foldingStopMarker = new RegExp(
  538. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  539. );
  540. }
  541. };
  542. oop.inherits(FoldMode, BaseFoldMode);
  543. (function() {
  544. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  545. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  546. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  547. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  548. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  549. this._getFoldWidgetBase = this.getFoldWidget;
  550. this.getFoldWidget = function(session, foldStyle, row) {
  551. var line = session.getLine(row);
  552. if (this.singleLineBlockCommentRe.test(line)) {
  553. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  554. return "";
  555. }
  556. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  557. if (!fw && this.startRegionRe.test(line))
  558. return "start"; // lineCommentRegionStart
  559. return fw;
  560. };
  561. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  562. var line = session.getLine(row);
  563. if (this.startRegionRe.test(line))
  564. return this.getCommentRegionBlock(session, line, row);
  565. var match = line.match(this.foldingStartMarker);
  566. if (match) {
  567. var i = match.index;
  568. if (match[1])
  569. return this.openingBracketBlock(session, match[1], row, i);
  570. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  571. if (range && !range.isMultiLine()) {
  572. if (forceMultiline) {
  573. range = this.getSectionRange(session, row);
  574. } else if (foldStyle != "all")
  575. range = null;
  576. }
  577. return range;
  578. }
  579. if (foldStyle === "markbegin")
  580. return;
  581. var match = line.match(this.foldingStopMarker);
  582. if (match) {
  583. var i = match.index + match[0].length;
  584. if (match[1])
  585. return this.closingBracketBlock(session, match[1], row, i);
  586. return session.getCommentFoldRange(row, i, -1);
  587. }
  588. };
  589. this.getSectionRange = function(session, row) {
  590. var line = session.getLine(row);
  591. var startIndent = line.search(/\S/);
  592. var startRow = row;
  593. var startColumn = line.length;
  594. row = row + 1;
  595. var endRow = row;
  596. var maxRow = session.getLength();
  597. while (++row < maxRow) {
  598. line = session.getLine(row);
  599. var indent = line.search(/\S/);
  600. if (indent === -1)
  601. continue;
  602. if (startIndent > indent)
  603. break;
  604. var subRange = this.getFoldWidgetRange(session, "all", row);
  605. if (subRange) {
  606. if (subRange.start.row <= startRow) {
  607. break;
  608. } else if (subRange.isMultiLine()) {
  609. row = subRange.end.row;
  610. } else if (startIndent == indent) {
  611. break;
  612. }
  613. }
  614. endRow = row;
  615. }
  616. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  617. };
  618. this.getCommentRegionBlock = function(session, line, row) {
  619. var startColumn = line.search(/\s*$/);
  620. var maxRow = session.getLength();
  621. var startRow = row;
  622. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  623. var depth = 1;
  624. while (++row < maxRow) {
  625. line = session.getLine(row);
  626. var m = re.exec(line);
  627. if (!m) continue;
  628. if (m[1]) depth--;
  629. else depth++;
  630. if (!depth) break;
  631. }
  632. var endRow = row;
  633. if (endRow > startRow) {
  634. return new Range(startRow, startColumn, endRow, line.length);
  635. }
  636. };
  637. }).call(FoldMode.prototype);
  638. });
  639. ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(acequire, exports, module) {
  640. "use strict";
  641. var oop = acequire("../lib/oop");
  642. var TextMode = acequire("./text").Mode;
  643. var JavaScriptHighlightRules = acequire("./javascript_highlight_rules").JavaScriptHighlightRules;
  644. var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent;
  645. var WorkerClient = acequire("../worker/worker_client").WorkerClient;
  646. var CstyleBehaviour = acequire("./behaviour/cstyle").CstyleBehaviour;
  647. var CStyleFoldMode = acequire("./folding/cstyle").FoldMode;
  648. var Mode = function() {
  649. this.HighlightRules = JavaScriptHighlightRules;
  650. this.$outdent = new MatchingBraceOutdent();
  651. this.$behaviour = new CstyleBehaviour();
  652. this.foldingRules = new CStyleFoldMode();
  653. };
  654. oop.inherits(Mode, TextMode);
  655. (function() {
  656. this.lineCommentStart = "//";
  657. this.blockComment = {start: "/*", end: "*/"};
  658. this.$quotes = {'"': '"', "'": "'", "`": "`"};
  659. this.getNextLineIndent = function(state, line, tab) {
  660. var indent = this.$getIndent(line);
  661. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  662. var tokens = tokenizedLine.tokens;
  663. var endState = tokenizedLine.state;
  664. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  665. return indent;
  666. }
  667. if (state == "start" || state == "no_regex") {
  668. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  669. if (match) {
  670. indent += tab;
  671. }
  672. } else if (state == "doc-start") {
  673. if (endState == "start" || endState == "no_regex") {
  674. return "";
  675. }
  676. var match = line.match(/^\s*(\/?)\*/);
  677. if (match) {
  678. if (match[1]) {
  679. indent += " ";
  680. }
  681. indent += "* ";
  682. }
  683. }
  684. return indent;
  685. };
  686. this.checkOutdent = function(state, line, input) {
  687. return this.$outdent.checkOutdent(line, input);
  688. };
  689. this.autoOutdent = function(state, doc, row) {
  690. this.$outdent.autoOutdent(doc, row);
  691. };
  692. this.createWorker = function(session) {
  693. var worker = new WorkerClient(["ace"], require("../worker/javascript"), "JavaScriptWorker");
  694. worker.attachToDocument(session.getDocument());
  695. worker.on("annotate", function(results) {
  696. session.setAnnotations(results.data);
  697. });
  698. worker.on("terminate", function() {
  699. session.clearAnnotations();
  700. });
  701. return worker;
  702. };
  703. this.$id = "ace/mode/javascript";
  704. }).call(Mode.prototype);
  705. exports.Mode = Mode;
  706. });
  707. 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) {
  708. "use strict";
  709. var oop = acequire("../lib/oop");
  710. var lang = acequire("../lib/lang");
  711. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  712. 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";
  713. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  714. 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";
  715. 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";
  716. 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";
  717. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  718. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  719. 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";
  720. var CssHighlightRules = function() {
  721. var keywordMapper = this.createKeywordMapper({
  722. "support.function": supportFunction,
  723. "support.constant": supportConstant,
  724. "support.type": supportType,
  725. "support.constant.color": supportConstantColor,
  726. "support.constant.fonts": supportConstantFonts
  727. }, "text", true);
  728. this.$rules = {
  729. "start" : [{
  730. include : ["strings", "url", "comments"]
  731. }, {
  732. token: "paren.lparen",
  733. regex: "\\{",
  734. next: "ruleset"
  735. }, {
  736. token: "paren.rparen",
  737. regex: "\\}"
  738. }, {
  739. token: "string",
  740. regex: "@",
  741. next: "media"
  742. }, {
  743. token: "keyword",
  744. regex: "#[a-z0-9-_]+"
  745. }, {
  746. token: "keyword",
  747. regex: "%"
  748. }, {
  749. token: "variable",
  750. regex: "\\.[a-z0-9-_]+"
  751. }, {
  752. token: "string",
  753. regex: ":[a-z0-9-_]+"
  754. }, {
  755. token : "constant.numeric",
  756. regex : numRe
  757. }, {
  758. token: "constant",
  759. regex: "[a-z0-9-_]+"
  760. }, {
  761. caseInsensitive: true
  762. }],
  763. "media": [{
  764. include : ["strings", "url", "comments"]
  765. }, {
  766. token: "paren.lparen",
  767. regex: "\\{",
  768. next: "start"
  769. }, {
  770. token: "paren.rparen",
  771. regex: "\\}",
  772. next: "start"
  773. }, {
  774. token: "string",
  775. regex: ";",
  776. next: "start"
  777. }, {
  778. token: "keyword",
  779. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  780. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  781. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  782. }],
  783. "comments" : [{
  784. token: "comment", // multi line comment
  785. regex: "\\/\\*",
  786. push: [{
  787. token : "comment",
  788. regex : "\\*\\/",
  789. next : "pop"
  790. }, {
  791. defaultToken : "comment"
  792. }]
  793. }],
  794. "ruleset" : [{
  795. regex : "-(webkit|ms|moz|o)-",
  796. token : "text"
  797. }, {
  798. token : "paren.rparen",
  799. regex : "\\}",
  800. next : "start"
  801. }, {
  802. include : ["strings", "url", "comments"]
  803. }, {
  804. token : ["constant.numeric", "keyword"],
  805. 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|%)"
  806. }, {
  807. token : "constant.numeric",
  808. regex : numRe
  809. }, {
  810. token : "constant.numeric", // hex6 color
  811. regex : "#[a-f0-9]{6}"
  812. }, {
  813. token : "constant.numeric", // hex3 color
  814. regex : "#[a-f0-9]{3}"
  815. }, {
  816. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  817. regex : pseudoElements
  818. }, {
  819. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  820. regex : pseudoClasses
  821. }, {
  822. include: "url"
  823. }, {
  824. token : keywordMapper,
  825. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  826. }, {
  827. caseInsensitive: true
  828. }],
  829. url: [{
  830. token : "support.function",
  831. regex : "(?:url(:?-prefix)?|domain|regexp)\\(",
  832. push: [{
  833. token : "support.function",
  834. regex : "\\)",
  835. next : "pop"
  836. }, {
  837. defaultToken: "string"
  838. }]
  839. }],
  840. strings: [{
  841. token : "string.start",
  842. regex : "'",
  843. push : [{
  844. token : "string.end",
  845. regex : "'|$",
  846. next: "pop"
  847. }, {
  848. include : "escapes"
  849. }, {
  850. token : "constant.language.escape",
  851. regex : /\\$/,
  852. consumeLineEnd: true
  853. }, {
  854. defaultToken: "string"
  855. }]
  856. }, {
  857. token : "string.start",
  858. regex : '"',
  859. push : [{
  860. token : "string.end",
  861. regex : '"|$',
  862. next: "pop"
  863. }, {
  864. include : "escapes"
  865. }, {
  866. token : "constant.language.escape",
  867. regex : /\\$/,
  868. consumeLineEnd: true
  869. }, {
  870. defaultToken: "string"
  871. }]
  872. }],
  873. escapes: [{
  874. token : "constant.language.escape",
  875. regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  876. }]
  877. };
  878. this.normalizeRules();
  879. };
  880. oop.inherits(CssHighlightRules, TextHighlightRules);
  881. exports.CssHighlightRules = CssHighlightRules;
  882. });
  883. ace.define("ace/mode/css_completions",["require","exports","module"], function(acequire, exports, module) {
  884. "use strict";
  885. var propertyMap = {
  886. "background": {"#$0": 1},
  887. "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
  888. "background-image": {"url('/$0')": 1},
  889. "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
  890. "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
  891. "background-attachment": {"scroll": 1, "fixed": 1},
  892. "background-size": {"cover": 1, "contain": 1},
  893. "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
  894. "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
  895. "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
  896. "border-color": {"#$0": 1},
  897. "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
  898. "border-collapse": {"collapse": 1, "separate": 1},
  899. "bottom": {"px": 1, "em": 1, "%": 1},
  900. "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
  901. "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
  902. "cursor": {"default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1},
  903. "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
  904. "empty-cells": {"show": 1, "hide": 1},
  905. "float": {"left": 1, "right": 1, "none": 1},
  906. "font-family": {"Arial":2,"Comic Sans MS":2,"Consolas":2,"Courier New":2,"Courier":2,"Georgia":2,"Monospace":2,"Sans-Serif":2, "Segoe UI":2,"Tahoma":2,"Times New Roman":2,"Trebuchet MS":2,"Verdana": 1},
  907. "font-size": {"px": 1, "em": 1, "%": 1},
  908. "font-weight": {"bold": 1, "normal": 1},
  909. "font-style": {"italic": 1, "normal": 1},
  910. "font-variant": {"normal": 1, "small-caps": 1},
  911. "height": {"px": 1, "em": 1, "%": 1},
  912. "left": {"px": 1, "em": 1, "%": 1},
  913. "letter-spacing": {"normal": 1},
  914. "line-height": {"normal": 1},
  915. "list-style-type": {"none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1},
  916. "margin": {"px": 1, "em": 1, "%": 1},
  917. "margin-right": {"px": 1, "em": 1, "%": 1},
  918. "margin-left": {"px": 1, "em": 1, "%": 1},
  919. "margin-top": {"px": 1, "em": 1, "%": 1},
  920. "margin-bottom": {"px": 1, "em": 1, "%": 1},
  921. "max-height": {"px": 1, "em": 1, "%": 1},
  922. "max-width": {"px": 1, "em": 1, "%": 1},
  923. "min-height": {"px": 1, "em": 1, "%": 1},
  924. "min-width": {"px": 1, "em": 1, "%": 1},
  925. "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  926. "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  927. "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  928. "padding": {"px": 1, "em": 1, "%": 1},
  929. "padding-top": {"px": 1, "em": 1, "%": 1},
  930. "padding-right": {"px": 1, "em": 1, "%": 1},
  931. "padding-bottom": {"px": 1, "em": 1, "%": 1},
  932. "padding-left": {"px": 1, "em": 1, "%": 1},
  933. "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  934. "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  935. "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
  936. "right": {"px": 1, "em": 1, "%": 1},
  937. "table-layout": {"fixed": 1, "auto": 1},
  938. "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
  939. "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
  940. "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
  941. "top": {"px": 1, "em": 1, "%": 1},
  942. "vertical-align": {"top": 1, "bottom": 1},
  943. "visibility": {"hidden": 1, "visible": 1},
  944. "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
  945. "width": {"px": 1, "em": 1, "%": 1},
  946. "word-spacing": {"normal": 1},
  947. "filter": {"alpha(opacity=$0100)": 1},
  948. "text-shadow": {"$02px 2px 2px #777": 1},
  949. "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
  950. "-moz-border-radius": 1,
  951. "-moz-border-radius-topright": 1,
  952. "-moz-border-radius-bottomright": 1,
  953. "-moz-border-radius-topleft": 1,
  954. "-moz-border-radius-bottomleft": 1,
  955. "-webkit-border-radius": 1,
  956. "-webkit-border-top-right-radius": 1,
  957. "-webkit-border-top-left-radius": 1,
  958. "-webkit-border-bottom-right-radius": 1,
  959. "-webkit-border-bottom-left-radius": 1,
  960. "-moz-box-shadow": 1,
  961. "-webkit-box-shadow": 1,
  962. "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  963. "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  964. "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
  965. };
  966. var CssCompletions = function() {
  967. };
  968. (function() {
  969. this.completionsDefined = false;
  970. this.defineCompletions = function() {
  971. if (document) {
  972. var style = document.createElement('c').style;
  973. for (var i in style) {
  974. if (typeof style[i] !== 'string')
  975. continue;
  976. var name = i.replace(/[A-Z]/g, function(x) {
  977. return '-' + x.toLowerCase();
  978. });
  979. if (!propertyMap.hasOwnProperty(name))
  980. propertyMap[name] = 1;
  981. }
  982. }
  983. this.completionsDefined = true;
  984. };
  985. this.getCompletions = function(state, session, pos, prefix) {
  986. if (!this.completionsDefined) {
  987. this.defineCompletions();
  988. }
  989. var token = session.getTokenAt(pos.row, pos.column);
  990. if (!token)
  991. return [];
  992. if (state==='ruleset'){
  993. var line = session.getLine(pos.row).substr(0, pos.column);
  994. if (/:[^;]+$/.test(line)) {
  995. /([\w\-]+):[^:]*$/.test(line);
  996. return this.getPropertyValueCompletions(state, session, pos, prefix);
  997. } else {
  998. return this.getPropertyCompletions(state, session, pos, prefix);
  999. }
  1000. }
  1001. return [];
  1002. };
  1003. this.getPropertyCompletions = function(state, session, pos, prefix) {
  1004. var properties = Object.keys(propertyMap);
  1005. return properties.map(function(property){
  1006. return {
  1007. caption: property,
  1008. snippet: property + ': $0;',
  1009. meta: "property",
  1010. score: Number.MAX_VALUE
  1011. };
  1012. });
  1013. };
  1014. this.getPropertyValueCompletions = function(state, session, pos, prefix) {
  1015. var line = session.getLine(pos.row).substr(0, pos.column);
  1016. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  1017. if (!property)
  1018. return [];
  1019. var values = [];
  1020. if (property in propertyMap && typeof propertyMap[property] === "object") {
  1021. values = Object.keys(propertyMap[property]);
  1022. }
  1023. return values.map(function(value){
  1024. return {
  1025. caption: value,
  1026. snippet: value,
  1027. meta: "property value",
  1028. score: Number.MAX_VALUE
  1029. };
  1030. });
  1031. };
  1032. }).call(CssCompletions.prototype);
  1033. exports.CssCompletions = CssCompletions;
  1034. });
  1035. 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) {
  1036. "use strict";
  1037. var oop = acequire("../../lib/oop");
  1038. var Behaviour = acequire("../behaviour").Behaviour;
  1039. var CstyleBehaviour = acequire("./cstyle").CstyleBehaviour;
  1040. var TokenIterator = acequire("../../token_iterator").TokenIterator;
  1041. var CssBehaviour = function () {
  1042. this.inherit(CstyleBehaviour);
  1043. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1044. if (text === ':') {
  1045. var cursor = editor.getCursorPosition();
  1046. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1047. var token = iterator.getCurrentToken();
  1048. if (token && token.value.match(/\s+/)) {
  1049. token = iterator.stepBackward();
  1050. }
  1051. if (token && token.type === 'support.type') {
  1052. var line = session.doc.getLine(cursor.row);
  1053. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1054. if (rightChar === ':') {
  1055. return {
  1056. text: '',
  1057. selection: [1, 1]
  1058. };
  1059. }
  1060. if (!line.substring(cursor.column).match(/^\s*;/)) {
  1061. return {
  1062. text: ':;',
  1063. selection: [1, 1]
  1064. };
  1065. }
  1066. }
  1067. }
  1068. });
  1069. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1070. var selected = session.doc.getTextRange(range);
  1071. if (!range.isMultiLine() && selected === ':') {
  1072. var cursor = editor.getCursorPosition();
  1073. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1074. var token = iterator.getCurrentToken();
  1075. if (token && token.value.match(/\s+/)) {
  1076. token = iterator.stepBackward();
  1077. }
  1078. if (token && token.type === 'support.type') {
  1079. var line = session.doc.getLine(range.start.row);
  1080. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1081. if (rightChar === ';') {
  1082. range.end.column ++;
  1083. return range;
  1084. }
  1085. }
  1086. }
  1087. });
  1088. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1089. if (text === ';') {
  1090. var cursor = editor.getCursorPosition();
  1091. var line = session.doc.getLine(cursor.row);
  1092. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1093. if (rightChar === ';') {
  1094. return {
  1095. text: '',
  1096. selection: [1, 1]
  1097. };
  1098. }
  1099. }
  1100. });
  1101. };
  1102. oop.inherits(CssBehaviour, CstyleBehaviour);
  1103. exports.CssBehaviour = CssBehaviour;
  1104. });
  1105. ace.define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(acequire, exports, module) {
  1106. "use strict";
  1107. var oop = acequire("../lib/oop");
  1108. var TextMode = acequire("./text").Mode;
  1109. var CssHighlightRules = acequire("./css_highlight_rules").CssHighlightRules;
  1110. var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent;
  1111. var WorkerClient = acequire("../worker/worker_client").WorkerClient;
  1112. var CssCompletions = acequire("./css_completions").CssCompletions;
  1113. var CssBehaviour = acequire("./behaviour/css").CssBehaviour;
  1114. var CStyleFoldMode = acequire("./folding/cstyle").FoldMode;
  1115. var Mode = function() {
  1116. this.HighlightRules = CssHighlightRules;
  1117. this.$outdent = new MatchingBraceOutdent();
  1118. this.$behaviour = new CssBehaviour();
  1119. this.$completer = new CssCompletions();
  1120. this.foldingRules = new CStyleFoldMode();
  1121. };
  1122. oop.inherits(Mode, TextMode);
  1123. (function() {
  1124. this.foldingRules = "cStyle";
  1125. this.blockComment = {start: "/*", end: "*/"};
  1126. this.getNextLineIndent = function(state, line, tab) {
  1127. var indent = this.$getIndent(line);
  1128. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1129. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1130. return indent;
  1131. }
  1132. var match = line.match(/^.*\{\s*$/);
  1133. if (match) {
  1134. indent += tab;
  1135. }
  1136. return indent;
  1137. };
  1138. this.checkOutdent = function(state, line, input) {
  1139. return this.$outdent.checkOutdent(line, input);
  1140. };
  1141. this.autoOutdent = function(state, doc, row) {
  1142. this.$outdent.autoOutdent(doc, row);
  1143. };
  1144. this.getCompletions = function(state, session, pos, prefix) {
  1145. return this.$completer.getCompletions(state, session, pos, prefix);
  1146. };
  1147. this.createWorker = function(session) {
  1148. var worker = new WorkerClient(["ace"], require("../worker/css"), "Worker");
  1149. worker.attachToDocument(session.getDocument());
  1150. worker.on("annotate", function(e) {
  1151. session.setAnnotations(e.data);
  1152. });
  1153. worker.on("terminate", function() {
  1154. session.clearAnnotations();
  1155. });
  1156. return worker;
  1157. };
  1158. this.$id = "ace/mode/css";
  1159. }).call(Mode.prototype);
  1160. exports.Mode = Mode;
  1161. });
  1162. ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
  1163. "use strict";
  1164. var oop = acequire("../lib/oop");
  1165. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  1166. var XmlHighlightRules = function(normalize) {
  1167. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  1168. this.$rules = {
  1169. start : [
  1170. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  1171. {
  1172. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  1173. regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
  1174. },
  1175. {token : "comment.start.xml", regex : "<\\!--", next : "comment"},
  1176. {
  1177. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  1178. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  1179. },
  1180. {include : "tag"},
  1181. {token : "text.end-tag-open.xml", regex: "</"},
  1182. {token : "text.tag-open.xml", regex: "<"},
  1183. {include : "reference"},
  1184. {defaultToken : "text.xml"}
  1185. ],
  1186. processing_instruction : [{
  1187. token : "entity.other.attribute-name.decl-attribute-name.xml",
  1188. regex : tagRegex
  1189. }, {
  1190. token : "keyword.operator.decl-attribute-equals.xml",
  1191. regex : "="
  1192. }, {
  1193. include: "whitespace"
  1194. }, {
  1195. include: "string"
  1196. }, {
  1197. token : "punctuation.xml-decl.xml",
  1198. regex : "\\?>",
  1199. next : "start"
  1200. }],
  1201. doctype : [
  1202. {include : "whitespace"},
  1203. {include : "string"},
  1204. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  1205. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  1206. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  1207. ],
  1208. int_subset : [{
  1209. token : "text.xml",
  1210. regex : "\\s+"
  1211. }, {
  1212. token: "punctuation.int-subset.xml",
  1213. regex: "]",
  1214. next: "pop"
  1215. }, {
  1216. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  1217. regex : "(<\\!)(" + tagRegex + ")",
  1218. push : [{
  1219. token : "text",
  1220. regex : "\\s+"
  1221. },
  1222. {
  1223. token : "punctuation.markup-decl.xml",
  1224. regex : ">",
  1225. next : "pop"
  1226. },
  1227. {include : "string"}]
  1228. }],
  1229. cdata : [
  1230. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  1231. {token : "text.xml", regex : "\\s+"},
  1232. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  1233. ],
  1234. comment : [
  1235. {token : "comment.end.xml", regex : "-->", next : "start"},
  1236. {defaultToken : "comment.xml"}
  1237. ],
  1238. reference : [{
  1239. token : "constant.language.escape.reference.xml",
  1240. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  1241. }],
  1242. attr_reference : [{
  1243. token : "constant.language.escape.reference.attribute-value.xml",
  1244. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  1245. }],
  1246. tag : [{
  1247. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  1248. regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  1249. next: [
  1250. {include : "attributes"},
  1251. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  1252. ]
  1253. }],
  1254. tag_whitespace : [
  1255. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  1256. ],
  1257. whitespace : [
  1258. {token : "text.whitespace.xml", regex : "\\s+"}
  1259. ],
  1260. string: [{
  1261. token : "string.xml",
  1262. regex : "'",
  1263. push : [
  1264. {token : "string.xml", regex: "'", next: "pop"},
  1265. {defaultToken : "string.xml"}
  1266. ]
  1267. }, {
  1268. token : "string.xml",
  1269. regex : '"',
  1270. push : [
  1271. {token : "string.xml", regex: '"', next: "pop"},
  1272. {defaultToken : "string.xml"}
  1273. ]
  1274. }],
  1275. attributes: [{
  1276. token : "entity.other.attribute-name.xml",
  1277. regex : tagRegex
  1278. }, {
  1279. token : "keyword.operator.attribute-equals.xml",
  1280. regex : "="
  1281. }, {
  1282. include: "tag_whitespace"
  1283. }, {
  1284. include: "attribute_value"
  1285. }],
  1286. attribute_value: [{
  1287. token : "string.attribute-value.xml",
  1288. regex : "'",
  1289. push : [
  1290. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  1291. {include : "attr_reference"},
  1292. {defaultToken : "string.attribute-value.xml"}
  1293. ]
  1294. }, {
  1295. token : "string.attribute-value.xml",
  1296. regex : '"',
  1297. push : [
  1298. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  1299. {include : "attr_reference"},
  1300. {defaultToken : "string.attribute-value.xml"}
  1301. ]
  1302. }]
  1303. };
  1304. if (this.constructor === XmlHighlightRules)
  1305. this.normalizeRules();
  1306. };
  1307. (function() {
  1308. this.embedTagRules = function(HighlightRules, prefix, tag){
  1309. this.$rules.tag.unshift({
  1310. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  1311. regex : "(<)(" + tag + "(?=\\s|>|$))",
  1312. next: [
  1313. {include : "attributes"},
  1314. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  1315. ]
  1316. });
  1317. this.$rules[tag + "-end"] = [
  1318. {include : "attributes"},
  1319. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  1320. onMatch : function(value, currentState, stack) {
  1321. stack.splice(0);
  1322. return this.token;
  1323. }}
  1324. ];
  1325. this.embedRules(HighlightRules, prefix, [{
  1326. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  1327. regex : "(</)(" + tag + "(?=\\s|>|$))",
  1328. next: tag + "-end"
  1329. }, {
  1330. token: "string.cdata.xml",
  1331. regex : "<\\!\\[CDATA\\["
  1332. }, {
  1333. token: "string.cdata.xml",
  1334. regex : "\\]\\]>"
  1335. }]);
  1336. };
  1337. }).call(TextHighlightRules.prototype);
  1338. oop.inherits(XmlHighlightRules, TextHighlightRules);
  1339. exports.XmlHighlightRules = XmlHighlightRules;
  1340. });
  1341. 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) {
  1342. "use strict";
  1343. var oop = acequire("../lib/oop");
  1344. var lang = acequire("../lib/lang");
  1345. var CssHighlightRules = acequire("./css_highlight_rules").CssHighlightRules;
  1346. var JavaScriptHighlightRules = acequire("./javascript_highlight_rules").JavaScriptHighlightRules;
  1347. var XmlHighlightRules = acequire("./xml_highlight_rules").XmlHighlightRules;
  1348. var tagMap = lang.createMap({
  1349. a : 'anchor',
  1350. button : 'form',
  1351. form : 'form',
  1352. img : 'image',
  1353. input : 'form',
  1354. label : 'form',
  1355. option : 'form',
  1356. script : 'script',
  1357. select : 'form',
  1358. textarea : 'form',
  1359. style : 'style',
  1360. table : 'table',
  1361. tbody : 'table',
  1362. td : 'table',
  1363. tfoot : 'table',
  1364. th : 'table',
  1365. tr : 'table'
  1366. });
  1367. var HtmlHighlightRules = function() {
  1368. XmlHighlightRules.call(this);
  1369. this.addRules({
  1370. attributes: [{
  1371. include : "tag_whitespace"
  1372. }, {
  1373. token : "entity.other.attribute-name.xml",
  1374. regex : "[-_a-zA-Z0-9:.]+"
  1375. }, {
  1376. token : "keyword.operator.attribute-equals.xml",
  1377. regex : "=",
  1378. push : [{
  1379. include: "tag_whitespace"
  1380. }, {
  1381. token : "string.unquoted.attribute-value.html",
  1382. regex : "[^<>='\"`\\s]+",
  1383. next : "pop"
  1384. }, {
  1385. token : "empty",
  1386. regex : "",
  1387. next : "pop"
  1388. }]
  1389. }, {
  1390. include : "attribute_value"
  1391. }],
  1392. tag: [{
  1393. token : function(start, tag) {
  1394. var group = tagMap[tag];
  1395. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  1396. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  1397. },
  1398. regex : "(</?)([-_a-zA-Z0-9:.]+)",
  1399. next: "tag_stuff"
  1400. }],
  1401. tag_stuff: [
  1402. {include : "attributes"},
  1403. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  1404. ]
  1405. });
  1406. this.embedTagRules(CssHighlightRules, "css-", "style");
  1407. this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script");
  1408. if (this.constructor === HtmlHighlightRules)
  1409. this.normalizeRules();
  1410. };
  1411. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  1412. exports.HtmlHighlightRules = HtmlHighlightRules;
  1413. });
  1414. ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(acequire, exports, module) {
  1415. "use strict";
  1416. var oop = acequire("../../lib/oop");
  1417. var Behaviour = acequire("../behaviour").Behaviour;
  1418. var TokenIterator = acequire("../../token_iterator").TokenIterator;
  1419. var lang = acequire("../../lib/lang");
  1420. function is(token, type) {
  1421. return token.type.lastIndexOf(type + ".xml") > -1;
  1422. }
  1423. var XmlBehaviour = function () {
  1424. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  1425. if (text == '"' || text == "'") {
  1426. var quote = text;
  1427. var selected = session.doc.getTextRange(editor.getSelectionRange());
  1428. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  1429. return {
  1430. text: quote + selected + quote,
  1431. selection: false
  1432. };
  1433. }
  1434. var cursor = editor.getCursorPosition();
  1435. var line = session.doc.getLine(cursor.row);
  1436. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1437. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1438. var token = iterator.getCurrentToken();
  1439. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  1440. return {
  1441. text: "",
  1442. selection: [1, 1]
  1443. };
  1444. }
  1445. if (!token)
  1446. token = iterator.stepBackward();
  1447. if (!token)
  1448. return;
  1449. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  1450. token = iterator.stepBackward();
  1451. }
  1452. var rightSpace = !rightChar || rightChar.match(/\s/);
  1453. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  1454. return {
  1455. text: quote + quote,
  1456. selection: [1, 1]
  1457. };
  1458. }
  1459. }
  1460. });
  1461. this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
  1462. var selected = session.doc.getTextRange(range);
  1463. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  1464. var line = session.doc.getLine(range.start.row);
  1465. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  1466. if (rightChar == selected) {
  1467. range.end.column++;
  1468. return range;
  1469. }
  1470. }
  1471. });
  1472. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  1473. if (text == '>') {
  1474. var position = editor.getSelectionRange().start;
  1475. var iterator = new TokenIterator(session, position.row, position.column);
  1476. var token = iterator.getCurrentToken() || iterator.stepBackward();
  1477. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  1478. return;
  1479. if (is(token, "reference.attribute-value"))
  1480. return;
  1481. if (is(token, "attribute-value")) {
  1482. var firstChar = token.value.charAt(0);
  1483. if (firstChar == '"' || firstChar == "'") {
  1484. var lastChar = token.value.charAt(token.value.length - 1);
  1485. var tokenEnd = iterator.getCurrentTokenColumn() + token.value.length;
  1486. if (tokenEnd > position.column || tokenEnd == position.column && firstChar != lastChar)
  1487. return;
  1488. }
  1489. }
  1490. while (!is(token, "tag-name")) {
  1491. token = iterator.stepBackward();
  1492. if (token.value == "<") {
  1493. token = iterator.stepForward();
  1494. break;
  1495. }
  1496. }
  1497. var tokenRow = iterator.getCurrentTokenRow();
  1498. var tokenColumn = iterator.getCurrentTokenColumn();
  1499. if (is(iterator.stepBackward(), "end-tag-open"))
  1500. return;
  1501. var element = token.value;
  1502. if (tokenRow == position.row)
  1503. element = element.substring(0, position.column - tokenColumn);
  1504. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  1505. return;
  1506. return {
  1507. text: ">" + "</" + element + ">",
  1508. selection: [1, 1]
  1509. };
  1510. }
  1511. });
  1512. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  1513. if (text == "\n") {
  1514. var cursor = editor.getCursorPosition();
  1515. var line = session.getLine(cursor.row);
  1516. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1517. var token = iterator.getCurrentToken();
  1518. if (token && token.type.indexOf("tag-close") !== -1) {
  1519. if (token.value == "/>")
  1520. return;
  1521. while (token && token.type.indexOf("tag-name") === -1) {
  1522. token = iterator.stepBackward();
  1523. }
  1524. if (!token) {
  1525. return;
  1526. }
  1527. var tag = token.value;
  1528. var row = iterator.getCurrentTokenRow();
  1529. token = iterator.stepBackward();
  1530. if (!token || token.type.indexOf("end-tag") !== -1) {
  1531. return;
  1532. }
  1533. if (this.voidElements && !this.voidElements[tag]) {
  1534. var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
  1535. var line = session.getLine(row);
  1536. var nextIndent = this.$getIndent(line);
  1537. var indent = nextIndent + session.getTabString();
  1538. if (nextToken && nextToken.value === "</") {
  1539. return {
  1540. text: "\n" + indent + "\n" + nextIndent,
  1541. selection: [1, indent.length, 1, indent.length]
  1542. };
  1543. } else {
  1544. return {
  1545. text: "\n" + indent
  1546. };
  1547. }
  1548. }
  1549. }
  1550. }
  1551. });
  1552. };
  1553. oop.inherits(XmlBehaviour, Behaviour);
  1554. exports.XmlBehaviour = XmlBehaviour;
  1555. });
  1556. ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(acequire, exports, module) {
  1557. "use strict";
  1558. var oop = acequire("../../lib/oop");
  1559. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  1560. var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
  1561. this.defaultMode = defaultMode;
  1562. this.subModes = subModes;
  1563. };
  1564. oop.inherits(FoldMode, BaseFoldMode);
  1565. (function() {
  1566. this.$getMode = function(state) {
  1567. if (typeof state != "string")
  1568. state = state[0];
  1569. for (var key in this.subModes) {
  1570. if (state.indexOf(key) === 0)
  1571. return this.subModes[key];
  1572. }
  1573. return null;
  1574. };
  1575. this.$tryMode = function(state, session, foldStyle, row) {
  1576. var mode = this.$getMode(state);
  1577. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  1578. };
  1579. this.getFoldWidget = function(session, foldStyle, row) {
  1580. return (
  1581. this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
  1582. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  1583. this.defaultMode.getFoldWidget(session, foldStyle, row)
  1584. );
  1585. };
  1586. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1587. var mode = this.$getMode(session.getState(row-1));
  1588. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1589. mode = this.$getMode(session.getState(row));
  1590. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1591. mode = this.defaultMode;
  1592. return mode.getFoldWidgetRange(session, foldStyle, row);
  1593. };
  1594. }).call(FoldMode.prototype);
  1595. });
  1596. ace.define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/range","ace/mode/folding/fold_mode","ace/token_iterator"], function(acequire, exports, module) {
  1597. "use strict";
  1598. var oop = acequire("../../lib/oop");
  1599. var lang = acequire("../../lib/lang");
  1600. var Range = acequire("../../range").Range;
  1601. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  1602. var TokenIterator = acequire("../../token_iterator").TokenIterator;
  1603. var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
  1604. BaseFoldMode.call(this);
  1605. this.voidElements = voidElements || {};
  1606. this.optionalEndTags = oop.mixin({}, this.voidElements);
  1607. if (optionalEndTags)
  1608. oop.mixin(this.optionalEndTags, optionalEndTags);
  1609. };
  1610. oop.inherits(FoldMode, BaseFoldMode);
  1611. var Tag = function() {
  1612. this.tagName = "";
  1613. this.closing = false;
  1614. this.selfClosing = false;
  1615. this.start = {row: 0, column: 0};
  1616. this.end = {row: 0, column: 0};
  1617. };
  1618. function is(token, type) {
  1619. return token.type.lastIndexOf(type + ".xml") > -1;
  1620. }
  1621. (function() {
  1622. this.getFoldWidget = function(session, foldStyle, row) {
  1623. var tag = this._getFirstTagInLine(session, row);
  1624. if (!tag)
  1625. return this.getCommentFoldWidget(session, row);
  1626. if (tag.closing || (!tag.tagName && tag.selfClosing))
  1627. return foldStyle == "markbeginend" ? "end" : "";
  1628. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  1629. return "";
  1630. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  1631. return "";
  1632. return "start";
  1633. };
  1634. this.getCommentFoldWidget = function(session, row) {
  1635. if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
  1636. return "start";
  1637. return "";
  1638. };
  1639. this._getFirstTagInLine = function(session, row) {
  1640. var tokens = session.getTokens(row);
  1641. var tag = new Tag();
  1642. for (var i = 0; i < tokens.length; i++) {
  1643. var token = tokens[i];
  1644. if (is(token, "tag-open")) {
  1645. tag.end.column = tag.start.column + token.value.length;
  1646. tag.closing = is(token, "end-tag-open");
  1647. token = tokens[++i];
  1648. if (!token)
  1649. return null;
  1650. tag.tagName = token.value;
  1651. tag.end.column += token.value.length;
  1652. for (i++; i < tokens.length; i++) {
  1653. token = tokens[i];
  1654. tag.end.column += token.value.length;
  1655. if (is(token, "tag-close")) {
  1656. tag.selfClosing = token.value == '/>';
  1657. break;
  1658. }
  1659. }
  1660. return tag;
  1661. } else if (is(token, "tag-close")) {
  1662. tag.selfClosing = token.value == '/>';
  1663. return tag;
  1664. }
  1665. tag.start.column += token.value.length;
  1666. }
  1667. return null;
  1668. };
  1669. this._findEndTagInLine = function(session, row, tagName, startColumn) {
  1670. var tokens = session.getTokens(row);
  1671. var column = 0;
  1672. for (var i = 0; i < tokens.length; i++) {
  1673. var token = tokens[i];
  1674. column += token.value.length;
  1675. if (column < startColumn)
  1676. continue;
  1677. if (is(token, "end-tag-open")) {
  1678. token = tokens[i + 1];
  1679. if (token && token.value == tagName)
  1680. return true;
  1681. }
  1682. }
  1683. return false;
  1684. };
  1685. this._readTagForward = function(iterator) {
  1686. var token = iterator.getCurrentToken();
  1687. if (!token)
  1688. return null;
  1689. var tag = new Tag();
  1690. do {
  1691. if (is(token, "tag-open")) {
  1692. tag.closing = is(token, "end-tag-open");
  1693. tag.start.row = iterator.getCurrentTokenRow();
  1694. tag.start.column = iterator.getCurrentTokenColumn();
  1695. } else if (is(token, "tag-name")) {
  1696. tag.tagName = token.value;
  1697. } else if (is(token, "tag-close")) {
  1698. tag.selfClosing = token.value == "/>";
  1699. tag.end.row = iterator.getCurrentTokenRow();
  1700. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1701. iterator.stepForward();
  1702. return tag;
  1703. }
  1704. } while(token = iterator.stepForward());
  1705. return null;
  1706. };
  1707. this._readTagBackward = function(iterator) {
  1708. var token = iterator.getCurrentToken();
  1709. if (!token)
  1710. return null;
  1711. var tag = new Tag();
  1712. do {
  1713. if (is(token, "tag-open")) {
  1714. tag.closing = is(token, "end-tag-open");
  1715. tag.start.row = iterator.getCurrentTokenRow();
  1716. tag.start.column = iterator.getCurrentTokenColumn();
  1717. iterator.stepBackward();
  1718. return tag;
  1719. } else if (is(token, "tag-name")) {
  1720. tag.tagName = token.value;
  1721. } else if (is(token, "tag-close")) {
  1722. tag.selfClosing = token.value == "/>";
  1723. tag.end.row = iterator.getCurrentTokenRow();
  1724. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1725. }
  1726. } while(token = iterator.stepBackward());
  1727. return null;
  1728. };
  1729. this._pop = function(stack, tag) {
  1730. while (stack.length) {
  1731. var top = stack[stack.length-1];
  1732. if (!tag || top.tagName == tag.tagName) {
  1733. return stack.pop();
  1734. }
  1735. else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
  1736. stack.pop();
  1737. continue;
  1738. } else {
  1739. return null;
  1740. }
  1741. }
  1742. };
  1743. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1744. var firstTag = this._getFirstTagInLine(session, row);
  1745. if (!firstTag) {
  1746. return this.getCommentFoldWidget(session, row)
  1747. && session.getCommentFoldRange(row, session.getLine(row).length);
  1748. }
  1749. var isBackward = firstTag.closing || firstTag.selfClosing;
  1750. var stack = [];
  1751. var tag;
  1752. if (!isBackward) {
  1753. var iterator = new TokenIterator(session, row, firstTag.start.column);
  1754. var start = {
  1755. row: row,
  1756. column: firstTag.start.column + firstTag.tagName.length + 2
  1757. };
  1758. if (firstTag.start.row == firstTag.end.row)
  1759. start.column = firstTag.end.column;
  1760. while (tag = this._readTagForward(iterator)) {
  1761. if (tag.selfClosing) {
  1762. if (!stack.length) {
  1763. tag.start.column += tag.tagName.length + 2;
  1764. tag.end.column -= 2;
  1765. return Range.fromPoints(tag.start, tag.end);
  1766. } else
  1767. continue;
  1768. }
  1769. if (tag.closing) {
  1770. this._pop(stack, tag);
  1771. if (stack.length == 0)
  1772. return Range.fromPoints(start, tag.start);
  1773. }
  1774. else {
  1775. stack.push(tag);
  1776. }
  1777. }
  1778. }
  1779. else {
  1780. var iterator = new TokenIterator(session, row, firstTag.end.column);
  1781. var end = {
  1782. row: row,
  1783. column: firstTag.start.column
  1784. };
  1785. while (tag = this._readTagBackward(iterator)) {
  1786. if (tag.selfClosing) {
  1787. if (!stack.length) {
  1788. tag.start.column += tag.tagName.length + 2;
  1789. tag.end.column -= 2;
  1790. return Range.fromPoints(tag.start, tag.end);
  1791. } else
  1792. continue;
  1793. }
  1794. if (!tag.closing) {
  1795. this._pop(stack, tag);
  1796. if (stack.length == 0) {
  1797. tag.start.column += tag.tagName.length + 2;
  1798. if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
  1799. tag.start.column = tag.end.column;
  1800. return Range.fromPoints(tag.start, end);
  1801. }
  1802. }
  1803. else {
  1804. stack.push(tag);
  1805. }
  1806. }
  1807. }
  1808. };
  1809. }).call(FoldMode.prototype);
  1810. });
  1811. ace.define("ace/mode/folding/html",["require","exports","module","ace/lib/oop","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"], function(acequire, exports, module) {
  1812. "use strict";
  1813. var oop = acequire("../../lib/oop");
  1814. var MixedFoldMode = acequire("./mixed").FoldMode;
  1815. var XmlFoldMode = acequire("./xml").FoldMode;
  1816. var CStyleFoldMode = acequire("./cstyle").FoldMode;
  1817. var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
  1818. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  1819. "js-": new CStyleFoldMode(),
  1820. "css-": new CStyleFoldMode()
  1821. });
  1822. };
  1823. oop.inherits(FoldMode, MixedFoldMode);
  1824. });
  1825. ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(acequire, exports, module) {
  1826. "use strict";
  1827. var TokenIterator = acequire("../token_iterator").TokenIterator;
  1828. var commonAttributes = [
  1829. "accesskey",
  1830. "class",
  1831. "contenteditable",
  1832. "contextmenu",
  1833. "dir",
  1834. "draggable",
  1835. "dropzone",
  1836. "hidden",
  1837. "id",
  1838. "inert",
  1839. "itemid",
  1840. "itemprop",
  1841. "itemref",
  1842. "itemscope",
  1843. "itemtype",
  1844. "lang",
  1845. "spellcheck",
  1846. "style",
  1847. "tabindex",
  1848. "title",
  1849. "translate"
  1850. ];
  1851. var eventAttributes = [
  1852. "onabort",
  1853. "onblur",
  1854. "oncancel",
  1855. "oncanplay",
  1856. "oncanplaythrough",
  1857. "onchange",
  1858. "onclick",
  1859. "onclose",
  1860. "oncontextmenu",
  1861. "oncuechange",
  1862. "ondblclick",
  1863. "ondrag",
  1864. "ondragend",
  1865. "ondragenter",
  1866. "ondragleave",
  1867. "ondragover",
  1868. "ondragstart",
  1869. "ondrop",
  1870. "ondurationchange",
  1871. "onemptied",
  1872. "onended",
  1873. "onerror",
  1874. "onfocus",
  1875. "oninput",
  1876. "oninvalid",
  1877. "onkeydown",
  1878. "onkeypress",
  1879. "onkeyup",
  1880. "onload",
  1881. "onloadeddata",
  1882. "onloadedmetadata",
  1883. "onloadstart",
  1884. "onmousedown",
  1885. "onmousemove",
  1886. "onmouseout",
  1887. "onmouseover",
  1888. "onmouseup",
  1889. "onmousewheel",
  1890. "onpause",
  1891. "onplay",
  1892. "onplaying",
  1893. "onprogress",
  1894. "onratechange",
  1895. "onreset",
  1896. "onscroll",
  1897. "onseeked",
  1898. "onseeking",
  1899. "onselect",
  1900. "onshow",
  1901. "onstalled",
  1902. "onsubmit",
  1903. "onsuspend",
  1904. "ontimeupdate",
  1905. "onvolumechange",
  1906. "onwaiting"
  1907. ];
  1908. var globalAttributes = commonAttributes.concat(eventAttributes);
  1909. var attributeMap = {
  1910. "html": {"manifest": 1},
  1911. "head": {},
  1912. "title": {},
  1913. "base": {"href": 1, "target": 1},
  1914. "link": {"href": 1, "hreflang": 1, "rel": {"stylesheet": 1, "icon": 1}, "media": {"all": 1, "screen": 1, "print": 1}, "type": {"text/css": 1, "image/png": 1, "image/jpeg": 1, "image/gif": 1}, "sizes": 1},
  1915. "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
  1916. "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
  1917. "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
  1918. "noscript": {"href": 1},
  1919. "body": {"onafterprint": 1, "onbeforeprint": 1, "onbeforeunload": 1, "onhashchange": 1, "onmessage": 1, "onoffline": 1, "onpopstate": 1, "onredo": 1, "onresize": 1, "onstorage": 1, "onundo": 1, "onunload": 1},
  1920. "section": {},
  1921. "nav": {},
  1922. "article": {"pubdate": 1},
  1923. "aside": {},
  1924. "h1": {},
  1925. "h2": {},
  1926. "h3": {},
  1927. "h4": {},
  1928. "h5": {},
  1929. "h6": {},
  1930. "header": {},
  1931. "footer": {},
  1932. "address": {},
  1933. "main": {},
  1934. "p": {},
  1935. "hr": {},
  1936. "pre": {},
  1937. "blockquote": {"cite": 1},
  1938. "ol": {"start": 1, "reversed": 1},
  1939. "ul": {},
  1940. "li": {"value": 1},
  1941. "dl": {},
  1942. "dt": {},
  1943. "dd": {},
  1944. "figure": {},
  1945. "figcaption": {},
  1946. "div": {},
  1947. "a": {"href": 1, "target": {"_blank": 1, "top": 1}, "ping": 1, "rel": {"nofollow": 1, "alternate": 1, "author": 1, "bookmark": 1, "help": 1, "license": 1, "next": 1, "noreferrer": 1, "prefetch": 1, "prev": 1, "search": 1, "tag": 1}, "media": 1, "hreflang": 1, "type": 1},
  1948. "em": {},
  1949. "strong": {},
  1950. "small": {},
  1951. "s": {},
  1952. "cite": {},
  1953. "q": {"cite": 1},
  1954. "dfn": {},
  1955. "abbr": {},
  1956. "data": {},
  1957. "time": {"datetime": 1},
  1958. "code": {},
  1959. "var": {},
  1960. "samp": {},
  1961. "kbd": {},
  1962. "sub": {},
  1963. "sup": {},
  1964. "i": {},
  1965. "b": {},
  1966. "u": {},
  1967. "mark": {},
  1968. "ruby": {},
  1969. "rt": {},
  1970. "rp": {},
  1971. "bdi": {},
  1972. "bdo": {},
  1973. "span": {},
  1974. "br": {},
  1975. "wbr": {},
  1976. "ins": {"cite": 1, "datetime": 1},
  1977. "del": {"cite": 1, "datetime": 1},
  1978. "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
  1979. "iframe": {"name": 1, "src": 1, "height": 1, "width": 1, "sandbox": {"allow-same-origin": 1, "allow-top-navigation": 1, "allow-forms": 1, "allow-scripts": 1}, "seamless": {"seamless": 1}},
  1980. "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
  1981. "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
  1982. "param": {"name": 1, "value": 1},
  1983. "video": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "width": 1, "height": 1, "poster": 1, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1}},
  1984. "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
  1985. "source": {"src": 1, "type": 1, "media": 1},
  1986. "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
  1987. "canvas": {"width": 1, "height": 1},
  1988. "map": {"name": 1},
  1989. "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
  1990. "svg": {},
  1991. "math": {},
  1992. "table": {"summary": 1},
  1993. "caption": {},
  1994. "colgroup": {"span": 1},
  1995. "col": {"span": 1},
  1996. "tbody": {},
  1997. "thead": {},
  1998. "tfoot": {},
  1999. "tr": {},
  2000. "td": {"headers": 1, "rowspan": 1, "colspan": 1},
  2001. "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
  2002. "form": {"accept-charset": 1, "action": 1, "autocomplete": 1, "enctype": {"multipart/form-data": 1, "application/x-www-form-urlencoded": 1}, "method": {"get": 1, "post": 1}, "name": 1, "novalidate": 1, "target": {"_blank": 1, "top": 1}},
  2003. "fieldset": {"disabled": 1, "form": 1, "name": 1},
  2004. "legend": {},
  2005. "label": {"form": 1, "for": 1},
  2006. "input": {
  2007. "type": {"text": 1, "password": 1, "hidden": 1, "checkbox": 1, "submit": 1, "radio": 1, "file": 1, "button": 1, "reset": 1, "image": 31, "color": 1, "date": 1, "datetime": 1, "datetime-local": 1, "email": 1, "month": 1, "number": 1, "range": 1, "search": 1, "tel": 1, "time": 1, "url": 1, "week": 1},
  2008. "accept": 1, "alt": 1, "autocomplete": {"on": 1, "off": 1}, "autofocus": {"autofocus": 1}, "checked": {"checked": 1}, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": {"application/x-www-form-urlencoded": 1, "multipart/form-data": 1, "text/plain": 1}, "formmethod": {"get": 1, "post": 1}, "formnovalidate": {"formnovalidate": 1}, "formtarget": {"_blank": 1, "_self": 1, "_parent": 1, "_top": 1}, "height": 1, "list": 1, "max": 1, "maxlength": 1, "min": 1, "multiple": {"multiple": 1}, "name": 1, "pattern": 1, "placeholder": 1, "readonly": {"readonly": 1}, "acequired": {"acequired": 1}, "size": 1, "src": 1, "step": 1, "width": 1, "files": 1, "value": 1},
  2009. "button": {"autofocus": 1, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": 1, "formmethod": 1, "formnovalidate": 1, "formtarget": 1, "name": 1, "value": 1, "type": {"button": 1, "submit": 1}},
  2010. "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
  2011. "datalist": {},
  2012. "optgroup": {"disabled": 1, "label": 1},
  2013. "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
  2014. "textarea": {"autofocus": {"autofocus": 1}, "disabled": {"disabled": 1}, "form": 1, "maxlength": 1, "name": 1, "placeholder": 1, "readonly": {"readonly": 1}, "acequired": {"acequired": 1}, "rows": 1, "cols": 1, "wrap": {"on": 1, "off": 1, "hard": 1, "soft": 1}},
  2015. "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
  2016. "output": {"for": 1, "form": 1, "name": 1},
  2017. "progress": {"value": 1, "max": 1},
  2018. "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
  2019. "details": {"open": 1},
  2020. "summary": {},
  2021. "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
  2022. "menu": {"type": 1, "label": 1},
  2023. "dialog": {"open": 1}
  2024. };
  2025. var elements = Object.keys(attributeMap);
  2026. function is(token, type) {
  2027. return token.type.lastIndexOf(type + ".xml") > -1;
  2028. }
  2029. function findTagName(session, pos) {
  2030. var iterator = new TokenIterator(session, pos.row, pos.column);
  2031. var token = iterator.getCurrentToken();
  2032. while (token && !is(token, "tag-name")){
  2033. token = iterator.stepBackward();
  2034. }
  2035. if (token)
  2036. return token.value;
  2037. }
  2038. function findAttributeName(session, pos) {
  2039. var iterator = new TokenIterator(session, pos.row, pos.column);
  2040. var token = iterator.getCurrentToken();
  2041. while (token && !is(token, "attribute-name")){
  2042. token = iterator.stepBackward();
  2043. }
  2044. if (token)
  2045. return token.value;
  2046. }
  2047. var HtmlCompletions = function() {
  2048. };
  2049. (function() {
  2050. this.getCompletions = function(state, session, pos, prefix) {
  2051. var token = session.getTokenAt(pos.row, pos.column);
  2052. if (!token)
  2053. return [];
  2054. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2055. return this.getTagCompletions(state, session, pos, prefix);
  2056. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2057. return this.getAttributeCompletions(state, session, pos, prefix);
  2058. if (is(token, "attribute-value"))
  2059. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2060. var line = session.getLine(pos.row).substr(0, pos.column);
  2061. if (/&[a-z]*$/i.test(line))
  2062. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2063. return [];
  2064. };
  2065. this.getTagCompletions = function(state, session, pos, prefix) {
  2066. return elements.map(function(element){
  2067. return {
  2068. value: element,
  2069. meta: "tag",
  2070. score: Number.MAX_VALUE
  2071. };
  2072. });
  2073. };
  2074. this.getAttributeCompletions = function(state, session, pos, prefix) {
  2075. var tagName = findTagName(session, pos);
  2076. if (!tagName)
  2077. return [];
  2078. var attributes = globalAttributes;
  2079. if (tagName in attributeMap) {
  2080. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2081. }
  2082. return attributes.map(function(attribute){
  2083. return {
  2084. caption: attribute,
  2085. snippet: attribute + '="$0"',
  2086. meta: "attribute",
  2087. score: Number.MAX_VALUE
  2088. };
  2089. });
  2090. };
  2091. this.getAttributeValueCompletions = function(state, session, pos, prefix) {
  2092. var tagName = findTagName(session, pos);
  2093. var attributeName = findAttributeName(session, pos);
  2094. if (!tagName)
  2095. return [];
  2096. var values = [];
  2097. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2098. values = Object.keys(attributeMap[tagName][attributeName]);
  2099. }
  2100. return values.map(function(value){
  2101. return {
  2102. caption: value,
  2103. snippet: value,
  2104. meta: "attribute value",
  2105. score: Number.MAX_VALUE
  2106. };
  2107. });
  2108. };
  2109. this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
  2110. var values = ['Aacute;', 'aacute;', 'Acirc;', 'acirc;', 'acute;', 'AElig;', 'aelig;', 'Agrave;', 'agrave;', 'alefsym;', 'Alpha;', 'alpha;', 'amp;', 'and;', 'ang;', 'Aring;', 'aring;', 'asymp;', 'Atilde;', 'atilde;', 'Auml;', 'auml;', 'bdquo;', 'Beta;', 'beta;', 'brvbar;', 'bull;', 'cap;', 'Ccedil;', 'ccedil;', 'cedil;', 'cent;', 'Chi;', 'chi;', 'circ;', 'clubs;', 'cong;', 'copy;', 'crarr;', 'cup;', 'curren;', 'Dagger;', 'dagger;', 'dArr;', 'darr;', 'deg;', 'Delta;', 'delta;', 'diams;', 'divide;', 'Eacute;', 'eacute;', 'Ecirc;', 'ecirc;', 'Egrave;', 'egrave;', 'empty;', 'emsp;', 'ensp;', 'Epsilon;', 'epsilon;', 'equiv;', 'Eta;', 'eta;', 'ETH;', 'eth;', 'Euml;', 'euml;', 'euro;', 'exist;', 'fnof;', 'forall;', 'frac12;', 'frac14;', 'frac34;', 'frasl;', 'Gamma;', 'gamma;', 'ge;', 'gt;', 'hArr;', 'harr;', 'hearts;', 'hellip;', 'Iacute;', 'iacute;', 'Icirc;', 'icirc;', 'iexcl;', 'Igrave;', 'igrave;', 'image;', 'infin;', 'int;', 'Iota;', 'iota;', 'iquest;', 'isin;', 'Iuml;', 'iuml;', 'Kappa;', 'kappa;', 'Lambda;', 'lambda;', 'lang;', 'laquo;', 'lArr;', 'larr;', 'lceil;', 'ldquo;', 'le;', 'lfloor;', 'lowast;', 'loz;', 'lrm;', 'lsaquo;', 'lsquo;', 'lt;', 'macr;', 'mdash;', 'micro;', 'middot;', 'minus;', 'Mu;', 'mu;', 'nabla;', 'nbsp;', 'ndash;', 'ne;', 'ni;', 'not;', 'notin;', 'nsub;', 'Ntilde;', 'ntilde;', 'Nu;', 'nu;', 'Oacute;', 'oacute;', 'Ocirc;', 'ocirc;', 'OElig;', 'oelig;', 'Ograve;', 'ograve;', 'oline;', 'Omega;', 'omega;', 'Omicron;', 'omicron;', 'oplus;', 'or;', 'ordf;', 'ordm;', 'Oslash;', 'oslash;', 'Otilde;', 'otilde;', 'otimes;', 'Ouml;', 'ouml;', 'para;', 'part;', 'permil;', 'perp;', 'Phi;', 'phi;', 'Pi;', 'pi;', 'piv;', 'plusmn;', 'pound;', 'Prime;', 'prime;', 'prod;', 'prop;', 'Psi;', 'psi;', 'quot;', 'radic;', 'rang;', 'raquo;', 'rArr;', 'rarr;', 'rceil;', 'rdquo;', 'real;', 'reg;', 'rfloor;', 'Rho;', 'rho;', 'rlm;', 'rsaquo;', 'rsquo;', 'sbquo;', 'Scaron;', 'scaron;', 'sdot;', 'sect;', 'shy;', 'Sigma;', 'sigma;', 'sigmaf;', 'sim;', 'spades;', 'sub;', 'sube;', 'sum;', 'sup;', 'sup1;', 'sup2;', 'sup3;', 'supe;', 'szlig;', 'Tau;', 'tau;', 'there4;', 'Theta;', 'theta;', 'thetasym;', 'thinsp;', 'THORN;', 'thorn;', 'tilde;', 'times;', 'trade;', 'Uacute;', 'uacute;', 'uArr;', 'uarr;', 'Ucirc;', 'ucirc;', 'Ugrave;', 'ugrave;', 'uml;', 'upsih;', 'Upsilon;', 'upsilon;', 'Uuml;', 'uuml;', 'weierp;', 'Xi;', 'xi;', 'Yacute;', 'yacute;', 'yen;', 'Yuml;', 'yuml;', 'Zeta;', 'zeta;', 'zwj;', 'zwnj;'];
  2111. return values.map(function(value){
  2112. return {
  2113. caption: value,
  2114. snippet: value,
  2115. meta: "html entity",
  2116. score: Number.MAX_VALUE
  2117. };
  2118. });
  2119. };
  2120. }).call(HtmlCompletions.prototype);
  2121. exports.HtmlCompletions = HtmlCompletions;
  2122. });
  2123. ace.define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"], function(acequire, exports, module) {
  2124. "use strict";
  2125. var oop = acequire("../lib/oop");
  2126. var lang = acequire("../lib/lang");
  2127. var TextMode = acequire("./text").Mode;
  2128. var JavaScriptMode = acequire("./javascript").Mode;
  2129. var CssMode = acequire("./css").Mode;
  2130. var HtmlHighlightRules = acequire("./html_highlight_rules").HtmlHighlightRules;
  2131. var XmlBehaviour = acequire("./behaviour/xml").XmlBehaviour;
  2132. var HtmlFoldMode = acequire("./folding/html").FoldMode;
  2133. var HtmlCompletions = acequire("./html_completions").HtmlCompletions;
  2134. var WorkerClient = acequire("../worker/worker_client").WorkerClient;
  2135. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2136. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2137. var Mode = function(options) {
  2138. this.fragmentContext = options && options.fragmentContext;
  2139. this.HighlightRules = HtmlHighlightRules;
  2140. this.$behaviour = new XmlBehaviour();
  2141. this.$completer = new HtmlCompletions();
  2142. this.createModeDelegates({
  2143. "js-": JavaScriptMode,
  2144. "css-": CssMode
  2145. });
  2146. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2147. };
  2148. oop.inherits(Mode, TextMode);
  2149. (function() {
  2150. this.blockComment = {start: "<!--", end: "-->"};
  2151. this.voidElements = lang.arrayToMap(voidElements);
  2152. this.getNextLineIndent = function(state, line, tab) {
  2153. return this.$getIndent(line);
  2154. };
  2155. this.checkOutdent = function(state, line, input) {
  2156. return false;
  2157. };
  2158. this.getCompletions = function(state, session, pos, prefix) {
  2159. return this.$completer.getCompletions(state, session, pos, prefix);
  2160. };
  2161. this.createWorker = function(session) {
  2162. if (this.constructor != Mode)
  2163. return;
  2164. var worker = new WorkerClient(["ace"], require("../worker/html"), "Worker");
  2165. worker.attachToDocument(session.getDocument());
  2166. if (this.fragmentContext)
  2167. worker.call("setOptions", [{context: this.fragmentContext}]);
  2168. worker.on("error", function(e) {
  2169. session.setAnnotations(e.data);
  2170. });
  2171. worker.on("terminate", function() {
  2172. session.clearAnnotations();
  2173. });
  2174. return worker;
  2175. };
  2176. this.$id = "ace/mode/html";
  2177. }).call(Mode.prototype);
  2178. exports.Mode = Mode;
  2179. });
  2180. ace.define("ace/mode/smarty_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/html_highlight_rules"], function(acequire, exports, module) {
  2181. "use strict";
  2182. var oop = acequire("../lib/oop");
  2183. var HtmlHighlightRules = acequire("./html_highlight_rules").HtmlHighlightRules;
  2184. var SmartyHighlightRules = function() {
  2185. HtmlHighlightRules.call(this);
  2186. var smartyRules = { start:
  2187. [ { include: '#comments' },
  2188. { include: '#blocks' } ],
  2189. '#blocks':
  2190. [ { token: 'punctuation.section.embedded.begin.smarty',
  2191. regex: '\\{%?',
  2192. push:
  2193. [ { token: 'punctuation.section.embedded.end.smarty',
  2194. regex: '%?\\}',
  2195. next: 'pop' },
  2196. { include: '#strings' },
  2197. { include: '#variables' },
  2198. { include: '#lang' },
  2199. { defaultToken: 'source.smarty' } ] } ],
  2200. '#comments':
  2201. [ { token:
  2202. [ 'punctuation.definition.comment.smarty',
  2203. 'comment.block.smarty' ],
  2204. regex: '(\\{%?)(\\*)',
  2205. push:
  2206. [ { token: 'comment.block.smarty', regex: '\\*%?\\}', next: 'pop' },
  2207. { defaultToken: 'comment.block.smarty' } ] } ],
  2208. '#lang':
  2209. [ { token: 'keyword.operator.smarty',
  2210. regex: '(?:!=|!|<=|>=|<|>|===|==|%|&&|\\|\\|)|\\b(?:and|or|eq|neq|ne|gte|gt|ge|lte|lt|le|not|mod)\\b' },
  2211. { token: 'constant.language.smarty',
  2212. regex: '\\b(?:TRUE|FALSE|true|false)\\b' },
  2213. { token: 'keyword.control.smarty',
  2214. regex: '\\b(?:if|else|elseif|foreach|foreachelse|section|switch|case|break|default)\\b' },
  2215. { token: 'variable.parameter.smarty', regex: '\\b[a-zA-Z]+=' },
  2216. { token: 'support.function.built-in.smarty',
  2217. regex: '\\b(?:capture|config_load|counter|cycle|debug|eval|fetch|include_php|include|insert|literal|math|strip|rdelim|ldelim|assign|constant|block|html_[a-z_]*)\\b' },
  2218. { token: 'support.function.variable-modifier.smarty',
  2219. regex: '\\|(?:capitalize|cat|count_characters|count_paragraphs|count_sentences|count_words|date_format|default|escape|indent|lower|nl2br|regex_replace|replace|spacify|string_format|strip_tags|strip|truncate|upper|wordwrap)' } ],
  2220. '#strings':
  2221. [ { token: 'punctuation.definition.string.begin.smarty',
  2222. regex: '\'',
  2223. push:
  2224. [ { token: 'punctuation.definition.string.end.smarty',
  2225. regex: '\'',
  2226. next: 'pop' },
  2227. { token: 'constant.character.escape.smarty', regex: '\\\\.' },
  2228. { defaultToken: 'string.quoted.single.smarty' } ] },
  2229. { token: 'punctuation.definition.string.begin.smarty',
  2230. regex: '"',
  2231. push:
  2232. [ { token: 'punctuation.definition.string.end.smarty',
  2233. regex: '"',
  2234. next: 'pop' },
  2235. { token: 'constant.character.escape.smarty', regex: '\\\\.' },
  2236. { defaultToken: 'string.quoted.double.smarty' } ] } ],
  2237. '#variables':
  2238. [ { token:
  2239. [ 'punctuation.definition.variable.smarty',
  2240. 'variable.other.global.smarty' ],
  2241. regex: '\\b(\\$)(Smarty\\.)' },
  2242. { token:
  2243. [ 'punctuation.definition.variable.smarty',
  2244. 'variable.other.smarty' ],
  2245. regex: '(\\$)([a-zA-Z_][a-zA-Z0-9_]*)\\b' },
  2246. { token: [ 'keyword.operator.smarty', 'variable.other.property.smarty' ],
  2247. regex: '(->)([a-zA-Z_][a-zA-Z0-9_]*)\\b' },
  2248. { token:
  2249. [ 'keyword.operator.smarty',
  2250. 'meta.function-call.object.smarty',
  2251. 'punctuation.definition.variable.smarty',
  2252. 'variable.other.smarty',
  2253. 'punctuation.definition.variable.smarty' ],
  2254. regex: '(->)([a-zA-Z_][a-zA-Z0-9_]*)(\\()(.*?)(\\))' } ] };
  2255. var smartyStart = smartyRules.start;
  2256. for (var rule in this.$rules) {
  2257. this.$rules[rule].unshift.apply(this.$rules[rule], smartyStart);
  2258. }
  2259. Object.keys(smartyRules).forEach(function(x) {
  2260. if (!this.$rules[x])
  2261. this.$rules[x] = smartyRules[x];
  2262. }, this);
  2263. this.normalizeRules();
  2264. };
  2265. SmartyHighlightRules.metaData = { fileTypes: [ 'tpl' ],
  2266. foldingStartMarker: '\\{%?',
  2267. foldingStopMarker: '%?\\}',
  2268. name: 'Smarty',
  2269. scopeName: 'text.html.smarty' };
  2270. oop.inherits(SmartyHighlightRules, HtmlHighlightRules);
  2271. exports.SmartyHighlightRules = SmartyHighlightRules;
  2272. });
  2273. ace.define("ace/mode/smarty",["require","exports","module","ace/lib/oop","ace/mode/html","ace/mode/smarty_highlight_rules"], function(acequire, exports, module) {
  2274. "use strict";
  2275. var oop = acequire("../lib/oop");
  2276. var HtmlMode = acequire("./html").Mode;
  2277. var SmartyHighlightRules = acequire("./smarty_highlight_rules").SmartyHighlightRules;
  2278. var Mode = function() {
  2279. HtmlMode.call(this);
  2280. this.HighlightRules = SmartyHighlightRules;
  2281. };
  2282. oop.inherits(Mode, HtmlMode);
  2283. (function() {
  2284. this.$id = "ace/mode/smarty";
  2285. }).call(Mode.prototype);
  2286. exports.Mode = Mode;
  2287. });