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.

3059 lines
124 KiB

10 months ago
  1. 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) {
  2. "use strict";
  3. var oop = acequire("../lib/oop");
  4. var lang = acequire("../lib/lang");
  5. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  6. 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";
  7. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  8. 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";
  9. 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";
  10. 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";
  11. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  12. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  13. 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";
  14. var CssHighlightRules = function() {
  15. var keywordMapper = this.createKeywordMapper({
  16. "support.function": supportFunction,
  17. "support.constant": supportConstant,
  18. "support.type": supportType,
  19. "support.constant.color": supportConstantColor,
  20. "support.constant.fonts": supportConstantFonts
  21. }, "text", true);
  22. this.$rules = {
  23. "start" : [{
  24. include : ["strings", "url", "comments"]
  25. }, {
  26. token: "paren.lparen",
  27. regex: "\\{",
  28. next: "ruleset"
  29. }, {
  30. token: "paren.rparen",
  31. regex: "\\}"
  32. }, {
  33. token: "string",
  34. regex: "@",
  35. next: "media"
  36. }, {
  37. token: "keyword",
  38. regex: "#[a-z0-9-_]+"
  39. }, {
  40. token: "keyword",
  41. regex: "%"
  42. }, {
  43. token: "variable",
  44. regex: "\\.[a-z0-9-_]+"
  45. }, {
  46. token: "string",
  47. regex: ":[a-z0-9-_]+"
  48. }, {
  49. token : "constant.numeric",
  50. regex : numRe
  51. }, {
  52. token: "constant",
  53. regex: "[a-z0-9-_]+"
  54. }, {
  55. caseInsensitive: true
  56. }],
  57. "media": [{
  58. include : ["strings", "url", "comments"]
  59. }, {
  60. token: "paren.lparen",
  61. regex: "\\{",
  62. next: "start"
  63. }, {
  64. token: "paren.rparen",
  65. regex: "\\}",
  66. next: "start"
  67. }, {
  68. token: "string",
  69. regex: ";",
  70. next: "start"
  71. }, {
  72. token: "keyword",
  73. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  74. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  75. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  76. }],
  77. "comments" : [{
  78. token: "comment", // multi line comment
  79. regex: "\\/\\*",
  80. push: [{
  81. token : "comment",
  82. regex : "\\*\\/",
  83. next : "pop"
  84. }, {
  85. defaultToken : "comment"
  86. }]
  87. }],
  88. "ruleset" : [{
  89. regex : "-(webkit|ms|moz|o)-",
  90. token : "text"
  91. }, {
  92. token : "paren.rparen",
  93. regex : "\\}",
  94. next : "start"
  95. }, {
  96. include : ["strings", "url", "comments"]
  97. }, {
  98. token : ["constant.numeric", "keyword"],
  99. 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|%)"
  100. }, {
  101. token : "constant.numeric",
  102. regex : numRe
  103. }, {
  104. token : "constant.numeric", // hex6 color
  105. regex : "#[a-f0-9]{6}"
  106. }, {
  107. token : "constant.numeric", // hex3 color
  108. regex : "#[a-f0-9]{3}"
  109. }, {
  110. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  111. regex : pseudoElements
  112. }, {
  113. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  114. regex : pseudoClasses
  115. }, {
  116. include: "url"
  117. }, {
  118. token : keywordMapper,
  119. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  120. }, {
  121. caseInsensitive: true
  122. }],
  123. url: [{
  124. token : "support.function",
  125. regex : "(?:url(:?-prefix)?|domain|regexp)\\(",
  126. push: [{
  127. token : "support.function",
  128. regex : "\\)",
  129. next : "pop"
  130. }, {
  131. defaultToken: "string"
  132. }]
  133. }],
  134. strings: [{
  135. token : "string.start",
  136. regex : "'",
  137. push : [{
  138. token : "string.end",
  139. regex : "'|$",
  140. next: "pop"
  141. }, {
  142. include : "escapes"
  143. }, {
  144. token : "constant.language.escape",
  145. regex : /\\$/,
  146. consumeLineEnd: true
  147. }, {
  148. defaultToken: "string"
  149. }]
  150. }, {
  151. token : "string.start",
  152. regex : '"',
  153. push : [{
  154. token : "string.end",
  155. regex : '"|$',
  156. next: "pop"
  157. }, {
  158. include : "escapes"
  159. }, {
  160. token : "constant.language.escape",
  161. regex : /\\$/,
  162. consumeLineEnd: true
  163. }, {
  164. defaultToken: "string"
  165. }]
  166. }],
  167. escapes: [{
  168. token : "constant.language.escape",
  169. regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  170. }]
  171. };
  172. this.normalizeRules();
  173. };
  174. oop.inherits(CssHighlightRules, TextHighlightRules);
  175. exports.CssHighlightRules = CssHighlightRules;
  176. });
  177. ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
  178. "use strict";
  179. var oop = acequire("../lib/oop");
  180. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  181. var DocCommentHighlightRules = function() {
  182. this.$rules = {
  183. "start" : [ {
  184. token : "comment.doc.tag",
  185. regex : "@[\\w\\d_]+" // TODO: fix email addresses
  186. },
  187. DocCommentHighlightRules.getTagRule(),
  188. {
  189. defaultToken : "comment.doc",
  190. caseInsensitive: true
  191. }]
  192. };
  193. };
  194. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  195. DocCommentHighlightRules.getTagRule = function(start) {
  196. return {
  197. token : "comment.doc.tag.storage.type",
  198. regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  199. };
  200. };
  201. DocCommentHighlightRules.getStartRule = function(start) {
  202. return {
  203. token : "comment.doc", // doc comment
  204. regex : "\\/\\*(?=\\*)",
  205. next : start
  206. };
  207. };
  208. DocCommentHighlightRules.getEndRule = function (start) {
  209. return {
  210. token : "comment.doc", // closing comment
  211. regex : "\\*\\/",
  212. next : start
  213. };
  214. };
  215. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  216. });
  217. 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) {
  218. "use strict";
  219. var oop = acequire("../lib/oop");
  220. var DocCommentHighlightRules = acequire("./doc_comment_highlight_rules").DocCommentHighlightRules;
  221. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  222. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  223. var JavaScriptHighlightRules = function(options) {
  224. var keywordMapper = this.createKeywordMapper({
  225. "variable.language":
  226. "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  227. "Namespace|QName|XML|XMLList|" + // E4X
  228. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  229. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  230. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  231. "SyntaxError|TypeError|URIError|" +
  232. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  233. "isNaN|parseFloat|parseInt|" +
  234. "JSON|Math|" + // Other
  235. "this|arguments|prototype|window|document" , // Pseudo
  236. "keyword":
  237. "const|yield|import|get|set|async|await|" +
  238. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  239. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  240. "__parent__|__count__|escape|unescape|with|__proto__|" +
  241. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  242. "storage.type":
  243. "const|let|var|function",
  244. "constant.language":
  245. "null|Infinity|NaN|undefined",
  246. "support.function":
  247. "alert",
  248. "constant.language.boolean": "true|false"
  249. }, "identifier");
  250. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  251. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  252. "u[0-9a-fA-F]{4}|" + // unicode
  253. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  254. "[0-2][0-7]{0,2}|" + // oct
  255. "3[0-7][0-7]?|" + // oct
  256. "[4-7][0-7]?|" + //oct
  257. ".)";
  258. this.$rules = {
  259. "no_regex" : [
  260. DocCommentHighlightRules.getStartRule("doc-start"),
  261. comments("no_regex"),
  262. {
  263. token : "string",
  264. regex : "'(?=.)",
  265. next : "qstring"
  266. }, {
  267. token : "string",
  268. regex : '"(?=.)',
  269. next : "qqstring"
  270. }, {
  271. token : "constant.numeric", // hexadecimal, octal and binary
  272. regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
  273. }, {
  274. token : "constant.numeric", // decimal integers and floats
  275. regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
  276. }, {
  277. token : [
  278. "storage.type", "punctuation.operator", "support.function",
  279. "punctuation.operator", "entity.name.function", "text","keyword.operator"
  280. ],
  281. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
  282. next: "function_arguments"
  283. }, {
  284. token : [
  285. "storage.type", "punctuation.operator", "entity.name.function", "text",
  286. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  287. ],
  288. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  289. next: "function_arguments"
  290. }, {
  291. token : [
  292. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  293. "text", "paren.lparen"
  294. ],
  295. regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  296. next: "function_arguments"
  297. }, {
  298. token : [
  299. "storage.type", "punctuation.operator", "entity.name.function", "text",
  300. "keyword.operator", "text",
  301. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  302. ],
  303. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  304. next: "function_arguments"
  305. }, {
  306. token : [
  307. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  308. ],
  309. regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  310. next: "function_arguments"
  311. }, {
  312. token : [
  313. "entity.name.function", "text", "punctuation.operator",
  314. "text", "storage.type", "text", "paren.lparen"
  315. ],
  316. regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  317. next: "function_arguments"
  318. }, {
  319. token : [
  320. "text", "text", "storage.type", "text", "paren.lparen"
  321. ],
  322. regex : "(:)(\\s*)(function)(\\s*)(\\()",
  323. next: "function_arguments"
  324. }, {
  325. token : "keyword",
  326. regex : "from(?=\\s*('|\"))"
  327. }, {
  328. token : "keyword",
  329. regex : "(?:" + kwBeforeRe + ")\\b",
  330. next : "start"
  331. }, {
  332. token : ["support.constant"],
  333. regex : /that\b/
  334. }, {
  335. token : ["storage.type", "punctuation.operator", "support.function.firebug"],
  336. regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  337. }, {
  338. token : keywordMapper,
  339. regex : identifierRe
  340. }, {
  341. token : "punctuation.operator",
  342. regex : /[.](?![.])/,
  343. next : "property"
  344. }, {
  345. token : "storage.type",
  346. regex : /=>/
  347. }, {
  348. token : "keyword.operator",
  349. regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
  350. next : "start"
  351. }, {
  352. token : "punctuation.operator",
  353. regex : /[?:,;.]/,
  354. next : "start"
  355. }, {
  356. token : "paren.lparen",
  357. regex : /[\[({]/,
  358. next : "start"
  359. }, {
  360. token : "paren.rparen",
  361. regex : /[\])}]/
  362. }, {
  363. token: "comment",
  364. regex: /^#!.*$/
  365. }
  366. ],
  367. property: [{
  368. token : "text",
  369. regex : "\\s+"
  370. }, {
  371. token : [
  372. "storage.type", "punctuation.operator", "entity.name.function", "text",
  373. "keyword.operator", "text",
  374. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  375. ],
  376. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
  377. next: "function_arguments"
  378. }, {
  379. token : "punctuation.operator",
  380. regex : /[.](?![.])/
  381. }, {
  382. token : "support.function",
  383. 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(?=\()/
  384. }, {
  385. token : "support.function.dom",
  386. 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(?=\()/
  387. }, {
  388. token : "support.constant",
  389. 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/
  390. }, {
  391. token : "identifier",
  392. regex : identifierRe
  393. }, {
  394. regex: "",
  395. token: "empty",
  396. next: "no_regex"
  397. }
  398. ],
  399. "start": [
  400. DocCommentHighlightRules.getStartRule("doc-start"),
  401. comments("start"),
  402. {
  403. token: "string.regexp",
  404. regex: "\\/",
  405. next: "regex"
  406. }, {
  407. token : "text",
  408. regex : "\\s+|^$",
  409. next : "start"
  410. }, {
  411. token: "empty",
  412. regex: "",
  413. next: "no_regex"
  414. }
  415. ],
  416. "regex": [
  417. {
  418. token: "regexp.keyword.operator",
  419. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  420. }, {
  421. token: "string.regexp",
  422. regex: "/[sxngimy]*",
  423. next: "no_regex"
  424. }, {
  425. token : "invalid",
  426. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  427. }, {
  428. token : "constant.language.escape",
  429. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  430. }, {
  431. token : "constant.language.delimiter",
  432. regex: /\|/
  433. }, {
  434. token: "constant.language.escape",
  435. regex: /\[\^?/,
  436. next: "regex_character_class"
  437. }, {
  438. token: "empty",
  439. regex: "$",
  440. next: "no_regex"
  441. }, {
  442. defaultToken: "string.regexp"
  443. }
  444. ],
  445. "regex_character_class": [
  446. {
  447. token: "regexp.charclass.keyword.operator",
  448. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  449. }, {
  450. token: "constant.language.escape",
  451. regex: "]",
  452. next: "regex"
  453. }, {
  454. token: "constant.language.escape",
  455. regex: "-"
  456. }, {
  457. token: "empty",
  458. regex: "$",
  459. next: "no_regex"
  460. }, {
  461. defaultToken: "string.regexp.charachterclass"
  462. }
  463. ],
  464. "function_arguments": [
  465. {
  466. token: "variable.parameter",
  467. regex: identifierRe
  468. }, {
  469. token: "punctuation.operator",
  470. regex: "[, ]+"
  471. }, {
  472. token: "punctuation.operator",
  473. regex: "$"
  474. }, {
  475. token: "empty",
  476. regex: "",
  477. next: "no_regex"
  478. }
  479. ],
  480. "qqstring" : [
  481. {
  482. token : "constant.language.escape",
  483. regex : escapedRe
  484. }, {
  485. token : "string",
  486. regex : "\\\\$",
  487. consumeLineEnd : true
  488. }, {
  489. token : "string",
  490. regex : '"|$',
  491. next : "no_regex"
  492. }, {
  493. defaultToken: "string"
  494. }
  495. ],
  496. "qstring" : [
  497. {
  498. token : "constant.language.escape",
  499. regex : escapedRe
  500. }, {
  501. token : "string",
  502. regex : "\\\\$",
  503. consumeLineEnd : true
  504. }, {
  505. token : "string",
  506. regex : "'|$",
  507. next : "no_regex"
  508. }, {
  509. defaultToken: "string"
  510. }
  511. ]
  512. };
  513. if (!options || !options.noES6) {
  514. this.$rules.no_regex.unshift({
  515. regex: "[{}]", onMatch: function(val, state, stack) {
  516. this.next = val == "{" ? this.nextState : "";
  517. if (val == "{" && stack.length) {
  518. stack.unshift("start", state);
  519. }
  520. else if (val == "}" && stack.length) {
  521. stack.shift();
  522. this.next = stack.shift();
  523. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  524. return "paren.quasi.end";
  525. }
  526. return val == "{" ? "paren.lparen" : "paren.rparen";
  527. },
  528. nextState: "start"
  529. }, {
  530. token : "string.quasi.start",
  531. regex : /`/,
  532. push : [{
  533. token : "constant.language.escape",
  534. regex : escapedRe
  535. }, {
  536. token : "paren.quasi.start",
  537. regex : /\${/,
  538. push : "start"
  539. }, {
  540. token : "string.quasi.end",
  541. regex : /`/,
  542. next : "pop"
  543. }, {
  544. defaultToken: "string.quasi"
  545. }]
  546. });
  547. if (!options || options.jsx != false)
  548. JSX.call(this);
  549. }
  550. this.embedRules(DocCommentHighlightRules, "doc-",
  551. [ DocCommentHighlightRules.getEndRule("no_regex") ]);
  552. this.normalizeRules();
  553. };
  554. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  555. function JSX() {
  556. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  557. var jsxTag = {
  558. onMatch : function(val, state, stack) {
  559. var offset = val.charAt(1) == "/" ? 2 : 1;
  560. if (offset == 1) {
  561. if (state != this.nextState)
  562. stack.unshift(this.next, this.nextState, 0);
  563. else
  564. stack.unshift(this.next);
  565. stack[2]++;
  566. } else if (offset == 2) {
  567. if (state == this.nextState) {
  568. stack[1]--;
  569. if (!stack[1] || stack[1] < 0) {
  570. stack.shift();
  571. stack.shift();
  572. }
  573. }
  574. }
  575. return [{
  576. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  577. value: val.slice(0, offset)
  578. }, {
  579. type: "meta.tag.tag-name.xml",
  580. value: val.substr(offset)
  581. }];
  582. },
  583. regex : "</?" + tagRegex + "",
  584. next: "jsxAttributes",
  585. nextState: "jsx"
  586. };
  587. this.$rules.start.unshift(jsxTag);
  588. var jsxJsRule = {
  589. regex: "{",
  590. token: "paren.quasi.start",
  591. push: "start"
  592. };
  593. this.$rules.jsx = [
  594. jsxJsRule,
  595. jsxTag,
  596. {include : "reference"},
  597. {defaultToken: "string"}
  598. ];
  599. this.$rules.jsxAttributes = [{
  600. token : "meta.tag.punctuation.tag-close.xml",
  601. regex : "/?>",
  602. onMatch : function(value, currentState, stack) {
  603. if (currentState == stack[0])
  604. stack.shift();
  605. if (value.length == 2) {
  606. if (stack[0] == this.nextState)
  607. stack[1]--;
  608. if (!stack[1] || stack[1] < 0) {
  609. stack.splice(0, 2);
  610. }
  611. }
  612. this.next = stack[0] || "start";
  613. return [{type: this.token, value: value}];
  614. },
  615. nextState: "jsx"
  616. },
  617. jsxJsRule,
  618. comments("jsxAttributes"),
  619. {
  620. token : "entity.other.attribute-name.xml",
  621. regex : tagRegex
  622. }, {
  623. token : "keyword.operator.attribute-equals.xml",
  624. regex : "="
  625. }, {
  626. token : "text.tag-whitespace.xml",
  627. regex : "\\s+"
  628. }, {
  629. token : "string.attribute-value.xml",
  630. regex : "'",
  631. stateName : "jsx_attr_q",
  632. push : [
  633. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  634. {include : "reference"},
  635. {defaultToken : "string.attribute-value.xml"}
  636. ]
  637. }, {
  638. token : "string.attribute-value.xml",
  639. regex : '"',
  640. stateName : "jsx_attr_qq",
  641. push : [
  642. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  643. {include : "reference"},
  644. {defaultToken : "string.attribute-value.xml"}
  645. ]
  646. },
  647. jsxTag
  648. ];
  649. this.$rules.reference = [{
  650. token : "constant.language.escape.reference.xml",
  651. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  652. }];
  653. }
  654. function comments(next) {
  655. return [
  656. {
  657. token : "comment", // multi line comment
  658. regex : /\/\*/,
  659. next: [
  660. DocCommentHighlightRules.getTagRule(),
  661. {token : "comment", regex : "\\*\\/", next : next || "pop"},
  662. {defaultToken : "comment", caseInsensitive: true}
  663. ]
  664. }, {
  665. token : "comment",
  666. regex : "\\/\\/",
  667. next: [
  668. DocCommentHighlightRules.getTagRule(),
  669. {token : "comment", regex : "$|^", next : next || "pop"},
  670. {defaultToken : "comment", caseInsensitive: true}
  671. ]
  672. }
  673. ];
  674. }
  675. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  676. });
  677. ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
  678. "use strict";
  679. var oop = acequire("../lib/oop");
  680. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  681. var XmlHighlightRules = function(normalize) {
  682. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  683. this.$rules = {
  684. start : [
  685. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  686. {
  687. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  688. regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
  689. },
  690. {token : "comment.start.xml", regex : "<\\!--", next : "comment"},
  691. {
  692. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  693. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  694. },
  695. {include : "tag"},
  696. {token : "text.end-tag-open.xml", regex: "</"},
  697. {token : "text.tag-open.xml", regex: "<"},
  698. {include : "reference"},
  699. {defaultToken : "text.xml"}
  700. ],
  701. processing_instruction : [{
  702. token : "entity.other.attribute-name.decl-attribute-name.xml",
  703. regex : tagRegex
  704. }, {
  705. token : "keyword.operator.decl-attribute-equals.xml",
  706. regex : "="
  707. }, {
  708. include: "whitespace"
  709. }, {
  710. include: "string"
  711. }, {
  712. token : "punctuation.xml-decl.xml",
  713. regex : "\\?>",
  714. next : "start"
  715. }],
  716. doctype : [
  717. {include : "whitespace"},
  718. {include : "string"},
  719. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  720. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  721. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  722. ],
  723. int_subset : [{
  724. token : "text.xml",
  725. regex : "\\s+"
  726. }, {
  727. token: "punctuation.int-subset.xml",
  728. regex: "]",
  729. next: "pop"
  730. }, {
  731. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  732. regex : "(<\\!)(" + tagRegex + ")",
  733. push : [{
  734. token : "text",
  735. regex : "\\s+"
  736. },
  737. {
  738. token : "punctuation.markup-decl.xml",
  739. regex : ">",
  740. next : "pop"
  741. },
  742. {include : "string"}]
  743. }],
  744. cdata : [
  745. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  746. {token : "text.xml", regex : "\\s+"},
  747. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  748. ],
  749. comment : [
  750. {token : "comment.end.xml", regex : "-->", next : "start"},
  751. {defaultToken : "comment.xml"}
  752. ],
  753. reference : [{
  754. token : "constant.language.escape.reference.xml",
  755. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  756. }],
  757. attr_reference : [{
  758. token : "constant.language.escape.reference.attribute-value.xml",
  759. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  760. }],
  761. tag : [{
  762. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  763. regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  764. next: [
  765. {include : "attributes"},
  766. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  767. ]
  768. }],
  769. tag_whitespace : [
  770. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  771. ],
  772. whitespace : [
  773. {token : "text.whitespace.xml", regex : "\\s+"}
  774. ],
  775. string: [{
  776. token : "string.xml",
  777. regex : "'",
  778. push : [
  779. {token : "string.xml", regex: "'", next: "pop"},
  780. {defaultToken : "string.xml"}
  781. ]
  782. }, {
  783. token : "string.xml",
  784. regex : '"',
  785. push : [
  786. {token : "string.xml", regex: '"', next: "pop"},
  787. {defaultToken : "string.xml"}
  788. ]
  789. }],
  790. attributes: [{
  791. token : "entity.other.attribute-name.xml",
  792. regex : tagRegex
  793. }, {
  794. token : "keyword.operator.attribute-equals.xml",
  795. regex : "="
  796. }, {
  797. include: "tag_whitespace"
  798. }, {
  799. include: "attribute_value"
  800. }],
  801. attribute_value: [{
  802. token : "string.attribute-value.xml",
  803. regex : "'",
  804. push : [
  805. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  806. {include : "attr_reference"},
  807. {defaultToken : "string.attribute-value.xml"}
  808. ]
  809. }, {
  810. token : "string.attribute-value.xml",
  811. regex : '"',
  812. push : [
  813. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  814. {include : "attr_reference"},
  815. {defaultToken : "string.attribute-value.xml"}
  816. ]
  817. }]
  818. };
  819. if (this.constructor === XmlHighlightRules)
  820. this.normalizeRules();
  821. };
  822. (function() {
  823. this.embedTagRules = function(HighlightRules, prefix, tag){
  824. this.$rules.tag.unshift({
  825. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  826. regex : "(<)(" + tag + "(?=\\s|>|$))",
  827. next: [
  828. {include : "attributes"},
  829. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  830. ]
  831. });
  832. this.$rules[tag + "-end"] = [
  833. {include : "attributes"},
  834. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  835. onMatch : function(value, currentState, stack) {
  836. stack.splice(0);
  837. return this.token;
  838. }}
  839. ];
  840. this.embedRules(HighlightRules, prefix, [{
  841. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  842. regex : "(</)(" + tag + "(?=\\s|>|$))",
  843. next: tag + "-end"
  844. }, {
  845. token: "string.cdata.xml",
  846. regex : "<\\!\\[CDATA\\["
  847. }, {
  848. token: "string.cdata.xml",
  849. regex : "\\]\\]>"
  850. }]);
  851. };
  852. }).call(TextHighlightRules.prototype);
  853. oop.inherits(XmlHighlightRules, TextHighlightRules);
  854. exports.XmlHighlightRules = XmlHighlightRules;
  855. });
  856. ace.define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(acequire, exports, module) {
  857. "use strict";
  858. var oop = acequire("../lib/oop");
  859. var lang = acequire("../lib/lang");
  860. var CssHighlightRules = acequire("./css_highlight_rules").CssHighlightRules;
  861. var JavaScriptHighlightRules = acequire("./javascript_highlight_rules").JavaScriptHighlightRules;
  862. var XmlHighlightRules = acequire("./xml_highlight_rules").XmlHighlightRules;
  863. var tagMap = lang.createMap({
  864. a : 'anchor',
  865. button : 'form',
  866. form : 'form',
  867. img : 'image',
  868. input : 'form',
  869. label : 'form',
  870. option : 'form',
  871. script : 'script',
  872. select : 'form',
  873. textarea : 'form',
  874. style : 'style',
  875. table : 'table',
  876. tbody : 'table',
  877. td : 'table',
  878. tfoot : 'table',
  879. th : 'table',
  880. tr : 'table'
  881. });
  882. var HtmlHighlightRules = function() {
  883. XmlHighlightRules.call(this);
  884. this.addRules({
  885. attributes: [{
  886. include : "tag_whitespace"
  887. }, {
  888. token : "entity.other.attribute-name.xml",
  889. regex : "[-_a-zA-Z0-9:.]+"
  890. }, {
  891. token : "keyword.operator.attribute-equals.xml",
  892. regex : "=",
  893. push : [{
  894. include: "tag_whitespace"
  895. }, {
  896. token : "string.unquoted.attribute-value.html",
  897. regex : "[^<>='\"`\\s]+",
  898. next : "pop"
  899. }, {
  900. token : "empty",
  901. regex : "",
  902. next : "pop"
  903. }]
  904. }, {
  905. include : "attribute_value"
  906. }],
  907. tag: [{
  908. token : function(start, tag) {
  909. var group = tagMap[tag];
  910. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  911. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  912. },
  913. regex : "(</?)([-_a-zA-Z0-9:.]+)",
  914. next: "tag_stuff"
  915. }],
  916. tag_stuff: [
  917. {include : "attributes"},
  918. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  919. ]
  920. });
  921. this.embedTagRules(CssHighlightRules, "css-", "style");
  922. this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script");
  923. if (this.constructor === HtmlHighlightRules)
  924. this.normalizeRules();
  925. };
  926. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  927. exports.HtmlHighlightRules = HtmlHighlightRules;
  928. });
  929. ace.define("ace/mode/elixir_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
  930. "use strict";
  931. var oop = acequire("../lib/oop");
  932. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  933. var ElixirHighlightRules = function() {
  934. this.$rules = { start:
  935. [ { token:
  936. [ 'meta.module.elixir',
  937. 'keyword.control.module.elixir',
  938. 'meta.module.elixir',
  939. 'entity.name.type.module.elixir' ],
  940. regex: '^(\\s*)(defmodule)(\\s+)((?:[A-Z]\\w*\\s*\\.\\s*)*[A-Z]\\w*)' },
  941. { token: 'comment.documentation.heredoc',
  942. regex: '@(?:module|type)?doc (?:~[a-z])?"""',
  943. push:
  944. [ { token: 'comment.documentation.heredoc',
  945. regex: '\\s*"""',
  946. next: 'pop' },
  947. { include: '#interpolated_elixir' },
  948. { include: '#escaped_char' },
  949. { defaultToken: 'comment.documentation.heredoc' } ],
  950. comment: '@doc with heredocs is treated as documentation' },
  951. { token: 'comment.documentation.heredoc',
  952. regex: '@(?:module|type)?doc ~[A-Z]"""',
  953. push:
  954. [ { token: 'comment.documentation.heredoc',
  955. regex: '\\s*"""',
  956. next: 'pop' },
  957. { defaultToken: 'comment.documentation.heredoc' } ],
  958. comment: '@doc with heredocs is treated as documentation' },
  959. { token: 'comment.documentation.heredoc',
  960. regex: '@(?:module|type)?doc (?:~[a-z])?\'\'\'',
  961. push:
  962. [ { token: 'comment.documentation.heredoc',
  963. regex: '\\s*\'\'\'',
  964. next: 'pop' },
  965. { include: '#interpolated_elixir' },
  966. { include: '#escaped_char' },
  967. { defaultToken: 'comment.documentation.heredoc' } ],
  968. comment: '@doc with heredocs is treated as documentation' },
  969. { token: 'comment.documentation.heredoc',
  970. regex: '@(?:module|type)?doc ~[A-Z]\'\'\'',
  971. push:
  972. [ { token: 'comment.documentation.heredoc',
  973. regex: '\\s*\'\'\'',
  974. next: 'pop' },
  975. { defaultToken: 'comment.documentation.heredoc' } ],
  976. comment: '@doc with heredocs is treated as documentation' },
  977. { token: 'comment.documentation.false',
  978. regex: '@(?:module|type)?doc false',
  979. comment: '@doc false is treated as documentation' },
  980. { token: 'comment.documentation.string',
  981. regex: '@(?:module|type)?doc "',
  982. push:
  983. [ { token: 'comment.documentation.string',
  984. regex: '"',
  985. next: 'pop' },
  986. { include: '#interpolated_elixir' },
  987. { include: '#escaped_char' },
  988. { defaultToken: 'comment.documentation.string' } ],
  989. comment: '@doc with string is treated as documentation' },
  990. { token: 'keyword.control.elixir',
  991. regex: '\\b(?:do|end|case|bc|lc|for|if|cond|unless|try|receive|fn|defmodule|defp?|defprotocol|defimpl|defrecord|defstruct|defmacrop?|defdelegate|defcallback|defmacrocallback|defexception|defoverridable|exit|after|rescue|catch|else|raise|throw|import|acequire|alias|use|quote|unquote|super)\\b(?![?!])',
  992. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  993. originalRegex: '(?<!\\.)\\b(do|end|case|bc|lc|for|if|cond|unless|try|receive|fn|defmodule|defp?|defprotocol|defimpl|defrecord|defstruct|defmacrop?|defdelegate|defcallback|defmacrocallback|defexception|defoverridable|exit|after|rescue|catch|else|raise|throw|import|acequire|alias|use|quote|unquote|super)\\b(?![?!])' },
  994. { token: 'keyword.operator.elixir',
  995. regex: '\\b(?:and|not|or|when|xor|in|inlist|inbits)\\b',
  996. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  997. originalRegex: '(?<!\\.)\\b(and|not|or|when|xor|in|inlist|inbits)\\b',
  998. comment: ' as above, just doesn\'t need a \'end\' and does a logic operation' },
  999. { token: 'constant.language.elixir',
  1000. regex: '\\b(?:nil|true|false)\\b(?![?!])' },
  1001. { token: 'variable.language.elixir',
  1002. regex: '\\b__(?:CALLER|ENV|MODULE|DIR)__\\b(?![?!])' },
  1003. { token:
  1004. [ 'punctuation.definition.variable.elixir',
  1005. 'variable.other.readwrite.module.elixir' ],
  1006. regex: '(@)([a-zA-Z_]\\w*)' },
  1007. { token:
  1008. [ 'punctuation.definition.variable.elixir',
  1009. 'variable.other.anonymous.elixir' ],
  1010. regex: '(&)(\\d*)' },
  1011. { token: 'variable.other.constant.elixir',
  1012. regex: '\\b[A-Z]\\w*\\b' },
  1013. { token: 'constant.numeric.elixir',
  1014. regex: '\\b(?:0x[\\da-fA-F](?:_?[\\da-fA-F])*|\\d(?:_?\\d)*(?:\\.(?![^[:space:][:digit:]])(?:_?\\d)*)?(?:[eE][-+]?\\d(?:_?\\d)*)?|0b[01]+|0o[0-7]+)\\b',
  1015. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  1016. originalRegex: '\\b(0x\\h(?>_?\\h)*|\\d(?>_?\\d)*(\\.(?![^[:space:][:digit:]])(?>_?\\d)*)?([eE][-+]?\\d(?>_?\\d)*)?|0b[01]+|0o[0-7]+)\\b' },
  1017. { token: 'punctuation.definition.constant.elixir',
  1018. regex: ':\'',
  1019. push:
  1020. [ { token: 'punctuation.definition.constant.elixir',
  1021. regex: '\'',
  1022. next: 'pop' },
  1023. { include: '#interpolated_elixir' },
  1024. { include: '#escaped_char' },
  1025. { defaultToken: 'constant.other.symbol.single-quoted.elixir' } ] },
  1026. { token: 'punctuation.definition.constant.elixir',
  1027. regex: ':"',
  1028. push:
  1029. [ { token: 'punctuation.definition.constant.elixir',
  1030. regex: '"',
  1031. next: 'pop' },
  1032. { include: '#interpolated_elixir' },
  1033. { include: '#escaped_char' },
  1034. { defaultToken: 'constant.other.symbol.double-quoted.elixir' } ] },
  1035. { token: 'punctuation.definition.string.begin.elixir',
  1036. regex: '(?:\'\'\')',
  1037. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  1038. originalRegex: '(?>\'\'\')',
  1039. push:
  1040. [ { token: 'punctuation.definition.string.end.elixir',
  1041. regex: '^\\s*\'\'\'',
  1042. next: 'pop' },
  1043. { include: '#interpolated_elixir' },
  1044. { include: '#escaped_char' },
  1045. { defaultToken: 'support.function.variable.quoted.single.heredoc.elixir' } ],
  1046. comment: 'Single-quoted heredocs' },
  1047. { token: 'punctuation.definition.string.begin.elixir',
  1048. regex: '\'',
  1049. push:
  1050. [ { token: 'punctuation.definition.string.end.elixir',
  1051. regex: '\'',
  1052. next: 'pop' },
  1053. { include: '#interpolated_elixir' },
  1054. { include: '#escaped_char' },
  1055. { defaultToken: 'support.function.variable.quoted.single.elixir' } ],
  1056. comment: 'single quoted string (allows for interpolation)' },
  1057. { token: 'punctuation.definition.string.begin.elixir',
  1058. regex: '(?:""")',
  1059. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  1060. originalRegex: '(?>""")',
  1061. push:
  1062. [ { token: 'punctuation.definition.string.end.elixir',
  1063. regex: '^\\s*"""',
  1064. next: 'pop' },
  1065. { include: '#interpolated_elixir' },
  1066. { include: '#escaped_char' },
  1067. { defaultToken: 'string.quoted.double.heredoc.elixir' } ],
  1068. comment: 'Double-quoted heredocs' },
  1069. { token: 'punctuation.definition.string.begin.elixir',
  1070. regex: '"',
  1071. push:
  1072. [ { token: 'punctuation.definition.string.end.elixir',
  1073. regex: '"',
  1074. next: 'pop' },
  1075. { include: '#interpolated_elixir' },
  1076. { include: '#escaped_char' },
  1077. { defaultToken: 'string.quoted.double.elixir' } ],
  1078. comment: 'double quoted string (allows for interpolation)' },
  1079. { token: 'punctuation.definition.string.begin.elixir',
  1080. regex: '~[a-z](?:""")',
  1081. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  1082. originalRegex: '~[a-z](?>""")',
  1083. push:
  1084. [ { token: 'punctuation.definition.string.end.elixir',
  1085. regex: '^\\s*"""',
  1086. next: 'pop' },
  1087. { include: '#interpolated_elixir' },
  1088. { include: '#escaped_char' },
  1089. { defaultToken: 'string.quoted.double.heredoc.elixir' } ],
  1090. comment: 'Double-quoted heredocs sigils' },
  1091. { token: 'punctuation.definition.string.begin.elixir',
  1092. regex: '~[a-z]\\{',
  1093. push:
  1094. [ { token: 'punctuation.definition.string.end.elixir',
  1095. regex: '\\}[a-z]*',
  1096. next: 'pop' },
  1097. { include: '#interpolated_elixir' },
  1098. { include: '#escaped_char' },
  1099. { defaultToken: 'string.interpolated.elixir' } ],
  1100. comment: 'sigil (allow for interpolation)' },
  1101. { token: 'punctuation.definition.string.begin.elixir',
  1102. regex: '~[a-z]\\[',
  1103. push:
  1104. [ { token: 'punctuation.definition.string.end.elixir',
  1105. regex: '\\][a-z]*',
  1106. next: 'pop' },
  1107. { include: '#interpolated_elixir' },
  1108. { include: '#escaped_char' },
  1109. { defaultToken: 'string.interpolated.elixir' } ],
  1110. comment: 'sigil (allow for interpolation)' },
  1111. { token: 'punctuation.definition.string.begin.elixir',
  1112. regex: '~[a-z]\\<',
  1113. push:
  1114. [ { token: 'punctuation.definition.string.end.elixir',
  1115. regex: '\\>[a-z]*',
  1116. next: 'pop' },
  1117. { include: '#interpolated_elixir' },
  1118. { include: '#escaped_char' },
  1119. { defaultToken: 'string.interpolated.elixir' } ],
  1120. comment: 'sigil (allow for interpolation)' },
  1121. { token: 'punctuation.definition.string.begin.elixir',
  1122. regex: '~[a-z]\\(',
  1123. push:
  1124. [ { token: 'punctuation.definition.string.end.elixir',
  1125. regex: '\\)[a-z]*',
  1126. next: 'pop' },
  1127. { include: '#interpolated_elixir' },
  1128. { include: '#escaped_char' },
  1129. { defaultToken: 'string.interpolated.elixir' } ],
  1130. comment: 'sigil (allow for interpolation)' },
  1131. { token: 'punctuation.definition.string.begin.elixir',
  1132. regex: '~[a-z][^\\w]',
  1133. push:
  1134. [ { token: 'punctuation.definition.string.end.elixir',
  1135. regex: '[^\\w][a-z]*',
  1136. next: 'pop' },
  1137. { include: '#interpolated_elixir' },
  1138. { include: '#escaped_char' },
  1139. { include: '#escaped_char' },
  1140. { defaultToken: 'string.interpolated.elixir' } ],
  1141. comment: 'sigil (allow for interpolation)' },
  1142. { token: 'punctuation.definition.string.begin.elixir',
  1143. regex: '~[A-Z](?:""")',
  1144. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  1145. originalRegex: '~[A-Z](?>""")',
  1146. push:
  1147. [ { token: 'punctuation.definition.string.end.elixir',
  1148. regex: '^\\s*"""',
  1149. next: 'pop' },
  1150. { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
  1151. comment: 'Double-quoted heredocs sigils' },
  1152. { token: 'punctuation.definition.string.begin.elixir',
  1153. regex: '~[A-Z]\\{',
  1154. push:
  1155. [ { token: 'punctuation.definition.string.end.elixir',
  1156. regex: '\\}[a-z]*',
  1157. next: 'pop' },
  1158. { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
  1159. comment: 'sigil (without interpolation)' },
  1160. { token: 'punctuation.definition.string.begin.elixir',
  1161. regex: '~[A-Z]\\[',
  1162. push:
  1163. [ { token: 'punctuation.definition.string.end.elixir',
  1164. regex: '\\][a-z]*',
  1165. next: 'pop' },
  1166. { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
  1167. comment: 'sigil (without interpolation)' },
  1168. { token: 'punctuation.definition.string.begin.elixir',
  1169. regex: '~[A-Z]\\<',
  1170. push:
  1171. [ { token: 'punctuation.definition.string.end.elixir',
  1172. regex: '\\>[a-z]*',
  1173. next: 'pop' },
  1174. { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
  1175. comment: 'sigil (without interpolation)' },
  1176. { token: 'punctuation.definition.string.begin.elixir',
  1177. regex: '~[A-Z]\\(',
  1178. push:
  1179. [ { token: 'punctuation.definition.string.end.elixir',
  1180. regex: '\\)[a-z]*',
  1181. next: 'pop' },
  1182. { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
  1183. comment: 'sigil (without interpolation)' },
  1184. { token: 'punctuation.definition.string.begin.elixir',
  1185. regex: '~[A-Z][^\\w]',
  1186. push:
  1187. [ { token: 'punctuation.definition.string.end.elixir',
  1188. regex: '[^\\w][a-z]*',
  1189. next: 'pop' },
  1190. { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
  1191. comment: 'sigil (without interpolation)' },
  1192. { token: ['punctuation.definition.constant.elixir', 'constant.other.symbol.elixir'],
  1193. regex: '(:)([a-zA-Z_][\\w@]*(?:[?!]|=(?![>=]))?|\\<\\>|===?|!==?|<<>>|<<<|>>>|~~~|::|<\\-|\\|>|=>|~|~=|=|/|\\\\\\\\|\\*\\*?|\\.\\.?\\.?|>=?|<=?|&&?&?|\\+\\+?|\\-\\-?|\\|\\|?\\|?|\\!|@|\\%?\\{\\}|%|\\[\\]|\\^(?:\\^\\^)?)',
  1194. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  1195. originalRegex: '(?<!:)(:)(?>[a-zA-Z_][\\w@]*(?>[?!]|=(?![>=]))?|\\<\\>|===?|!==?|<<>>|<<<|>>>|~~~|::|<\\-|\\|>|=>|~|~=|=|/|\\\\\\\\|\\*\\*?|\\.\\.?\\.?|>=?|<=?|&&?&?|\\+\\+?|\\-\\-?|\\|\\|?\\|?|\\!|@|\\%?\\{\\}|%|\\[\\]|\\^(\\^\\^)?)',
  1196. comment: 'symbols' },
  1197. { token: 'punctuation.definition.constant.elixir',
  1198. regex: '(?:[a-zA-Z_][\\w@]*(?:[?!])?):(?!:)',
  1199. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  1200. originalRegex: '(?>[a-zA-Z_][\\w@]*(?>[?!])?)(:)(?!:)',
  1201. comment: 'symbols' },
  1202. { token:
  1203. [ 'punctuation.definition.comment.elixir',
  1204. 'comment.line.number-sign.elixir' ],
  1205. regex: '(#)(.*)' },
  1206. { token: 'constant.numeric.elixir',
  1207. regex: '\\?(?:\\\\(?:x[\\da-fA-F]{1,2}(?![\\da-fA-F])\\b|[^xMC])|[^\\s\\\\])',
  1208. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  1209. originalRegex: '(?<!\\w)\\?(\\\\(x\\h{1,2}(?!\\h)\\b|[^xMC])|[^\\s\\\\])',
  1210. comment: '\n\t\t\tmatches questionmark-letters.\n\n\t\t\texamples (1st alternation = hex):\n\t\t\t?\\x1 ?\\x61\n\n\t\t\texamples (2rd alternation = escaped):\n\t\t\t?\\n ?\\b\n\n\t\t\texamples (3rd alternation = normal):\n\t\t\t?a ?A ?0 \n\t\t\t?* ?" ?( \n\t\t\t?. ?#\n\t\t\t\n\t\t\tthe negative lookbehind prevents against matching\n\t\t\tp(42.tainted?)\n\t\t\t' },
  1211. { token: 'keyword.operator.assignment.augmented.elixir',
  1212. regex: '\\+=|\\-=|\\|\\|=|~=|&&=' },
  1213. { token: 'keyword.operator.comparison.elixir',
  1214. regex: '===?|!==?|<=?|>=?' },
  1215. { token: 'keyword.operator.bitwise.elixir',
  1216. regex: '\\|{3}|&{3}|\\^{3}|<{3}|>{3}|~{3}' },
  1217. { token: 'keyword.operator.logical.elixir',
  1218. regex: '!+|\\bnot\\b|&&|\\band\\b|\\|\\||\\bor\\b|\\bxor\\b',
  1219. originalRegex: '(?<=[ \\t])!+|\\bnot\\b|&&|\\band\\b|\\|\\||\\bor\\b|\\bxor\\b' },
  1220. { token: 'keyword.operator.arithmetic.elixir',
  1221. regex: '\\*|\\+|\\-|/' },
  1222. { token: 'keyword.operator.other.elixir',
  1223. regex: '\\||\\+\\+|\\-\\-|\\*\\*|\\\\\\\\|\\<\\-|\\<\\>|\\<\\<|\\>\\>|\\:\\:|\\.\\.|\\|>|~|=>' },
  1224. { token: 'keyword.operator.assignment.elixir', regex: '=' },
  1225. { token: 'punctuation.separator.other.elixir', regex: ':' },
  1226. { token: 'punctuation.separator.statement.elixir',
  1227. regex: '\\;' },
  1228. { token: 'punctuation.separator.object.elixir', regex: ',' },
  1229. { token: 'punctuation.separator.method.elixir', regex: '\\.' },
  1230. { token: 'punctuation.section.scope.elixir', regex: '\\{|\\}' },
  1231. { token: 'punctuation.section.array.elixir', regex: '\\[|\\]' },
  1232. { token: 'punctuation.section.function.elixir',
  1233. regex: '\\(|\\)' } ],
  1234. '#escaped_char':
  1235. [ { token: 'constant.character.escape.elixir',
  1236. regex: '\\\\(?:x[\\da-fA-F]{1,2}|.)' } ],
  1237. '#interpolated_elixir':
  1238. [ { token:
  1239. [ 'source.elixir.embedded.source',
  1240. 'source.elixir.embedded.source.empty' ],
  1241. regex: '(#\\{)(\\})' },
  1242. { todo:
  1243. { token: 'punctuation.section.embedded.elixir',
  1244. regex: '#\\{',
  1245. push:
  1246. [ { token: 'punctuation.section.embedded.elixir',
  1247. regex: '\\}',
  1248. next: 'pop' },
  1249. { include: '#nest_curly_and_self' },
  1250. { include: '$self' },
  1251. { defaultToken: 'source.elixir.embedded.source' } ] } } ],
  1252. '#nest_curly_and_self':
  1253. [ { token: 'punctuation.section.scope.elixir',
  1254. regex: '\\{',
  1255. push:
  1256. [ { token: 'punctuation.section.scope.elixir',
  1257. regex: '\\}',
  1258. next: 'pop' },
  1259. { include: '#nest_curly_and_self' } ] },
  1260. { include: '$self' } ],
  1261. '#regex_sub':
  1262. [ { include: '#interpolated_elixir' },
  1263. { include: '#escaped_char' },
  1264. { token:
  1265. [ 'punctuation.definition.arbitrary-repitition.elixir',
  1266. 'string.regexp.arbitrary-repitition.elixir',
  1267. 'string.regexp.arbitrary-repitition.elixir',
  1268. 'punctuation.definition.arbitrary-repitition.elixir' ],
  1269. regex: '(\\{)(\\d+)((?:,\\d+)?)(\\})' },
  1270. { token: 'punctuation.definition.character-class.elixir',
  1271. regex: '\\[(?:\\^?\\])?',
  1272. push:
  1273. [ { token: 'punctuation.definition.character-class.elixir',
  1274. regex: '\\]',
  1275. next: 'pop' },
  1276. { include: '#escaped_char' },
  1277. { defaultToken: 'string.regexp.character-class.elixir' } ] },
  1278. { token: 'punctuation.definition.group.elixir',
  1279. regex: '\\(',
  1280. push:
  1281. [ { token: 'punctuation.definition.group.elixir',
  1282. regex: '\\)',
  1283. next: 'pop' },
  1284. { include: '#regex_sub' },
  1285. { defaultToken: 'string.regexp.group.elixir' } ] },
  1286. { token:
  1287. [ 'punctuation.definition.comment.elixir',
  1288. 'comment.line.number-sign.elixir' ],
  1289. regex: '(?:^|\\s)(#)(\\s[[a-zA-Z0-9,. \\t?!-][^\\x00-\\x7F]]*$)',
  1290. originalRegex: '(?<=^|\\s)(#)\\s[[a-zA-Z0-9,. \\t?!-][^\\x{00}-\\x{7F}]]*$',
  1291. comment: 'We are restrictive in what we allow to go after the comment character to avoid false positives, since the availability of comments depend on regexp flags.' } ] };
  1292. this.normalizeRules();
  1293. };
  1294. ElixirHighlightRules.metaData = { comment: 'Textmate bundle for Elixir Programming Language.',
  1295. fileTypes: [ 'ex', 'exs' ],
  1296. firstLineMatch: '^#!/.*\\belixir',
  1297. foldingStartMarker: '(after|else|catch|rescue|\\-\\>|\\{|\\[|do)\\s*$',
  1298. foldingStopMarker: '^\\s*((\\}|\\]|after|else|catch|rescue)\\s*$|end\\b)',
  1299. keyEquivalent: '^~E',
  1300. name: 'Elixir',
  1301. scopeName: 'source.elixir' };
  1302. oop.inherits(ElixirHighlightRules, TextHighlightRules);
  1303. exports.ElixirHighlightRules = ElixirHighlightRules;
  1304. });
  1305. ace.define("ace/mode/html_elixir_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/html_highlight_rules","ace/mode/elixir_highlight_rules"], function(acequire, exports, module) {
  1306. "use strict";
  1307. var oop = acequire("../lib/oop");
  1308. var HtmlHighlightRules = acequire("./html_highlight_rules").HtmlHighlightRules;
  1309. var ElixirHighlightRules = acequire("./elixir_highlight_rules").ElixirHighlightRules;
  1310. var HtmlElixirHighlightRules = function() {
  1311. HtmlHighlightRules.call(this);
  1312. var startRules = [
  1313. {
  1314. regex: "<%%|%%>",
  1315. token: "constant.language.escape"
  1316. }, {
  1317. token : "comment.start.eex",
  1318. regex : "<%#",
  1319. push : [{
  1320. token : "comment.end.eex",
  1321. regex: "%>",
  1322. next: "pop",
  1323. defaultToken:"comment"
  1324. }]
  1325. }, {
  1326. token : "support.elixir_tag",
  1327. regex : "<%+(?!>)[-=]?",
  1328. push : "elixir-start"
  1329. }
  1330. ];
  1331. var endRules = [
  1332. {
  1333. token : "support.elixir_tag",
  1334. regex : "%>",
  1335. next : "pop"
  1336. }, {
  1337. token: "comment",
  1338. regex: "#(?:[^%]|%[^>])*"
  1339. }
  1340. ];
  1341. for (var key in this.$rules)
  1342. this.$rules[key].unshift.apply(this.$rules[key], startRules);
  1343. this.embedRules(ElixirHighlightRules, "elixir-", endRules, ["start"]);
  1344. this.normalizeRules();
  1345. };
  1346. oop.inherits(HtmlElixirHighlightRules, HtmlHighlightRules);
  1347. exports.HtmlElixirHighlightRules = HtmlElixirHighlightRules;
  1348. });
  1349. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(acequire, exports, module) {
  1350. "use strict";
  1351. var Range = acequire("../range").Range;
  1352. var MatchingBraceOutdent = function() {};
  1353. (function() {
  1354. this.checkOutdent = function(line, input) {
  1355. if (! /^\s+$/.test(line))
  1356. return false;
  1357. return /^\s*\}/.test(input);
  1358. };
  1359. this.autoOutdent = function(doc, row) {
  1360. var line = doc.getLine(row);
  1361. var match = line.match(/^(\s*\})/);
  1362. if (!match) return 0;
  1363. var column = match[1].length;
  1364. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  1365. if (!openBracePos || openBracePos.row == row) return 0;
  1366. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  1367. doc.replace(new Range(row, 0, row, column-1), indent);
  1368. };
  1369. this.$getIndent = function(line) {
  1370. return line.match(/^\s*/)[0];
  1371. };
  1372. }).call(MatchingBraceOutdent.prototype);
  1373. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  1374. });
  1375. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(acequire, exports, module) {
  1376. "use strict";
  1377. var oop = acequire("../../lib/oop");
  1378. var Range = acequire("../../range").Range;
  1379. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  1380. var FoldMode = exports.FoldMode = function(commentRegex) {
  1381. if (commentRegex) {
  1382. this.foldingStartMarker = new RegExp(
  1383. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  1384. );
  1385. this.foldingStopMarker = new RegExp(
  1386. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  1387. );
  1388. }
  1389. };
  1390. oop.inherits(FoldMode, BaseFoldMode);
  1391. (function() {
  1392. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  1393. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  1394. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  1395. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  1396. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  1397. this._getFoldWidgetBase = this.getFoldWidget;
  1398. this.getFoldWidget = function(session, foldStyle, row) {
  1399. var line = session.getLine(row);
  1400. if (this.singleLineBlockCommentRe.test(line)) {
  1401. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  1402. return "";
  1403. }
  1404. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  1405. if (!fw && this.startRegionRe.test(line))
  1406. return "start"; // lineCommentRegionStart
  1407. return fw;
  1408. };
  1409. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  1410. var line = session.getLine(row);
  1411. if (this.startRegionRe.test(line))
  1412. return this.getCommentRegionBlock(session, line, row);
  1413. var match = line.match(this.foldingStartMarker);
  1414. if (match) {
  1415. var i = match.index;
  1416. if (match[1])
  1417. return this.openingBracketBlock(session, match[1], row, i);
  1418. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  1419. if (range && !range.isMultiLine()) {
  1420. if (forceMultiline) {
  1421. range = this.getSectionRange(session, row);
  1422. } else if (foldStyle != "all")
  1423. range = null;
  1424. }
  1425. return range;
  1426. }
  1427. if (foldStyle === "markbegin")
  1428. return;
  1429. var match = line.match(this.foldingStopMarker);
  1430. if (match) {
  1431. var i = match.index + match[0].length;
  1432. if (match[1])
  1433. return this.closingBracketBlock(session, match[1], row, i);
  1434. return session.getCommentFoldRange(row, i, -1);
  1435. }
  1436. };
  1437. this.getSectionRange = function(session, row) {
  1438. var line = session.getLine(row);
  1439. var startIndent = line.search(/\S/);
  1440. var startRow = row;
  1441. var startColumn = line.length;
  1442. row = row + 1;
  1443. var endRow = row;
  1444. var maxRow = session.getLength();
  1445. while (++row < maxRow) {
  1446. line = session.getLine(row);
  1447. var indent = line.search(/\S/);
  1448. if (indent === -1)
  1449. continue;
  1450. if (startIndent > indent)
  1451. break;
  1452. var subRange = this.getFoldWidgetRange(session, "all", row);
  1453. if (subRange) {
  1454. if (subRange.start.row <= startRow) {
  1455. break;
  1456. } else if (subRange.isMultiLine()) {
  1457. row = subRange.end.row;
  1458. } else if (startIndent == indent) {
  1459. break;
  1460. }
  1461. }
  1462. endRow = row;
  1463. }
  1464. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  1465. };
  1466. this.getCommentRegionBlock = function(session, line, row) {
  1467. var startColumn = line.search(/\s*$/);
  1468. var maxRow = session.getLength();
  1469. var startRow = row;
  1470. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  1471. var depth = 1;
  1472. while (++row < maxRow) {
  1473. line = session.getLine(row);
  1474. var m = re.exec(line);
  1475. if (!m) continue;
  1476. if (m[1]) depth--;
  1477. else depth++;
  1478. if (!depth) break;
  1479. }
  1480. var endRow = row;
  1481. if (endRow > startRow) {
  1482. return new Range(startRow, startColumn, endRow, line.length);
  1483. }
  1484. };
  1485. }).call(FoldMode.prototype);
  1486. });
  1487. 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) {
  1488. "use strict";
  1489. var oop = acequire("../lib/oop");
  1490. var TextMode = acequire("./text").Mode;
  1491. var JavaScriptHighlightRules = acequire("./javascript_highlight_rules").JavaScriptHighlightRules;
  1492. var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent;
  1493. var WorkerClient = acequire("../worker/worker_client").WorkerClient;
  1494. var CstyleBehaviour = acequire("./behaviour/cstyle").CstyleBehaviour;
  1495. var CStyleFoldMode = acequire("./folding/cstyle").FoldMode;
  1496. var Mode = function() {
  1497. this.HighlightRules = JavaScriptHighlightRules;
  1498. this.$outdent = new MatchingBraceOutdent();
  1499. this.$behaviour = new CstyleBehaviour();
  1500. this.foldingRules = new CStyleFoldMode();
  1501. };
  1502. oop.inherits(Mode, TextMode);
  1503. (function() {
  1504. this.lineCommentStart = "//";
  1505. this.blockComment = {start: "/*", end: "*/"};
  1506. this.$quotes = {'"': '"', "'": "'", "`": "`"};
  1507. this.getNextLineIndent = function(state, line, tab) {
  1508. var indent = this.$getIndent(line);
  1509. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  1510. var tokens = tokenizedLine.tokens;
  1511. var endState = tokenizedLine.state;
  1512. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1513. return indent;
  1514. }
  1515. if (state == "start" || state == "no_regex") {
  1516. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  1517. if (match) {
  1518. indent += tab;
  1519. }
  1520. } else if (state == "doc-start") {
  1521. if (endState == "start" || endState == "no_regex") {
  1522. return "";
  1523. }
  1524. var match = line.match(/^\s*(\/?)\*/);
  1525. if (match) {
  1526. if (match[1]) {
  1527. indent += " ";
  1528. }
  1529. indent += "* ";
  1530. }
  1531. }
  1532. return indent;
  1533. };
  1534. this.checkOutdent = function(state, line, input) {
  1535. return this.$outdent.checkOutdent(line, input);
  1536. };
  1537. this.autoOutdent = function(state, doc, row) {
  1538. this.$outdent.autoOutdent(doc, row);
  1539. };
  1540. this.createWorker = function(session) {
  1541. var worker = new WorkerClient(["ace"], require("../worker/javascript"), "JavaScriptWorker");
  1542. worker.attachToDocument(session.getDocument());
  1543. worker.on("annotate", function(results) {
  1544. session.setAnnotations(results.data);
  1545. });
  1546. worker.on("terminate", function() {
  1547. session.clearAnnotations();
  1548. });
  1549. return worker;
  1550. };
  1551. this.$id = "ace/mode/javascript";
  1552. }).call(Mode.prototype);
  1553. exports.Mode = Mode;
  1554. });
  1555. ace.define("ace/mode/css_completions",["require","exports","module"], function(acequire, exports, module) {
  1556. "use strict";
  1557. var propertyMap = {
  1558. "background": {"#$0": 1},
  1559. "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
  1560. "background-image": {"url('/$0')": 1},
  1561. "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
  1562. "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
  1563. "background-attachment": {"scroll": 1, "fixed": 1},
  1564. "background-size": {"cover": 1, "contain": 1},
  1565. "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1566. "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1567. "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
  1568. "border-color": {"#$0": 1},
  1569. "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
  1570. "border-collapse": {"collapse": 1, "separate": 1},
  1571. "bottom": {"px": 1, "em": 1, "%": 1},
  1572. "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
  1573. "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
  1574. "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},
  1575. "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
  1576. "empty-cells": {"show": 1, "hide": 1},
  1577. "float": {"left": 1, "right": 1, "none": 1},
  1578. "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},
  1579. "font-size": {"px": 1, "em": 1, "%": 1},
  1580. "font-weight": {"bold": 1, "normal": 1},
  1581. "font-style": {"italic": 1, "normal": 1},
  1582. "font-variant": {"normal": 1, "small-caps": 1},
  1583. "height": {"px": 1, "em": 1, "%": 1},
  1584. "left": {"px": 1, "em": 1, "%": 1},
  1585. "letter-spacing": {"normal": 1},
  1586. "line-height": {"normal": 1},
  1587. "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},
  1588. "margin": {"px": 1, "em": 1, "%": 1},
  1589. "margin-right": {"px": 1, "em": 1, "%": 1},
  1590. "margin-left": {"px": 1, "em": 1, "%": 1},
  1591. "margin-top": {"px": 1, "em": 1, "%": 1},
  1592. "margin-bottom": {"px": 1, "em": 1, "%": 1},
  1593. "max-height": {"px": 1, "em": 1, "%": 1},
  1594. "max-width": {"px": 1, "em": 1, "%": 1},
  1595. "min-height": {"px": 1, "em": 1, "%": 1},
  1596. "min-width": {"px": 1, "em": 1, "%": 1},
  1597. "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1598. "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1599. "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1600. "padding": {"px": 1, "em": 1, "%": 1},
  1601. "padding-top": {"px": 1, "em": 1, "%": 1},
  1602. "padding-right": {"px": 1, "em": 1, "%": 1},
  1603. "padding-bottom": {"px": 1, "em": 1, "%": 1},
  1604. "padding-left": {"px": 1, "em": 1, "%": 1},
  1605. "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1606. "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1607. "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
  1608. "right": {"px": 1, "em": 1, "%": 1},
  1609. "table-layout": {"fixed": 1, "auto": 1},
  1610. "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
  1611. "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
  1612. "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
  1613. "top": {"px": 1, "em": 1, "%": 1},
  1614. "vertical-align": {"top": 1, "bottom": 1},
  1615. "visibility": {"hidden": 1, "visible": 1},
  1616. "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
  1617. "width": {"px": 1, "em": 1, "%": 1},
  1618. "word-spacing": {"normal": 1},
  1619. "filter": {"alpha(opacity=$0100)": 1},
  1620. "text-shadow": {"$02px 2px 2px #777": 1},
  1621. "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
  1622. "-moz-border-radius": 1,
  1623. "-moz-border-radius-topright": 1,
  1624. "-moz-border-radius-bottomright": 1,
  1625. "-moz-border-radius-topleft": 1,
  1626. "-moz-border-radius-bottomleft": 1,
  1627. "-webkit-border-radius": 1,
  1628. "-webkit-border-top-right-radius": 1,
  1629. "-webkit-border-top-left-radius": 1,
  1630. "-webkit-border-bottom-right-radius": 1,
  1631. "-webkit-border-bottom-left-radius": 1,
  1632. "-moz-box-shadow": 1,
  1633. "-webkit-box-shadow": 1,
  1634. "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1635. "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1636. "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
  1637. };
  1638. var CssCompletions = function() {
  1639. };
  1640. (function() {
  1641. this.completionsDefined = false;
  1642. this.defineCompletions = function() {
  1643. if (document) {
  1644. var style = document.createElement('c').style;
  1645. for (var i in style) {
  1646. if (typeof style[i] !== 'string')
  1647. continue;
  1648. var name = i.replace(/[A-Z]/g, function(x) {
  1649. return '-' + x.toLowerCase();
  1650. });
  1651. if (!propertyMap.hasOwnProperty(name))
  1652. propertyMap[name] = 1;
  1653. }
  1654. }
  1655. this.completionsDefined = true;
  1656. };
  1657. this.getCompletions = function(state, session, pos, prefix) {
  1658. if (!this.completionsDefined) {
  1659. this.defineCompletions();
  1660. }
  1661. var token = session.getTokenAt(pos.row, pos.column);
  1662. if (!token)
  1663. return [];
  1664. if (state==='ruleset'){
  1665. var line = session.getLine(pos.row).substr(0, pos.column);
  1666. if (/:[^;]+$/.test(line)) {
  1667. /([\w\-]+):[^:]*$/.test(line);
  1668. return this.getPropertyValueCompletions(state, session, pos, prefix);
  1669. } else {
  1670. return this.getPropertyCompletions(state, session, pos, prefix);
  1671. }
  1672. }
  1673. return [];
  1674. };
  1675. this.getPropertyCompletions = function(state, session, pos, prefix) {
  1676. var properties = Object.keys(propertyMap);
  1677. return properties.map(function(property){
  1678. return {
  1679. caption: property,
  1680. snippet: property + ': $0;',
  1681. meta: "property",
  1682. score: Number.MAX_VALUE
  1683. };
  1684. });
  1685. };
  1686. this.getPropertyValueCompletions = function(state, session, pos, prefix) {
  1687. var line = session.getLine(pos.row).substr(0, pos.column);
  1688. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  1689. if (!property)
  1690. return [];
  1691. var values = [];
  1692. if (property in propertyMap && typeof propertyMap[property] === "object") {
  1693. values = Object.keys(propertyMap[property]);
  1694. }
  1695. return values.map(function(value){
  1696. return {
  1697. caption: value,
  1698. snippet: value,
  1699. meta: "property value",
  1700. score: Number.MAX_VALUE
  1701. };
  1702. });
  1703. };
  1704. }).call(CssCompletions.prototype);
  1705. exports.CssCompletions = CssCompletions;
  1706. });
  1707. 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) {
  1708. "use strict";
  1709. var oop = acequire("../../lib/oop");
  1710. var Behaviour = acequire("../behaviour").Behaviour;
  1711. var CstyleBehaviour = acequire("./cstyle").CstyleBehaviour;
  1712. var TokenIterator = acequire("../../token_iterator").TokenIterator;
  1713. var CssBehaviour = function () {
  1714. this.inherit(CstyleBehaviour);
  1715. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1716. if (text === ':') {
  1717. var cursor = editor.getCursorPosition();
  1718. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1719. var token = iterator.getCurrentToken();
  1720. if (token && token.value.match(/\s+/)) {
  1721. token = iterator.stepBackward();
  1722. }
  1723. if (token && token.type === 'support.type') {
  1724. var line = session.doc.getLine(cursor.row);
  1725. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1726. if (rightChar === ':') {
  1727. return {
  1728. text: '',
  1729. selection: [1, 1]
  1730. };
  1731. }
  1732. if (!line.substring(cursor.column).match(/^\s*;/)) {
  1733. return {
  1734. text: ':;',
  1735. selection: [1, 1]
  1736. };
  1737. }
  1738. }
  1739. }
  1740. });
  1741. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1742. var selected = session.doc.getTextRange(range);
  1743. if (!range.isMultiLine() && selected === ':') {
  1744. var cursor = editor.getCursorPosition();
  1745. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1746. var token = iterator.getCurrentToken();
  1747. if (token && token.value.match(/\s+/)) {
  1748. token = iterator.stepBackward();
  1749. }
  1750. if (token && token.type === 'support.type') {
  1751. var line = session.doc.getLine(range.start.row);
  1752. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1753. if (rightChar === ';') {
  1754. range.end.column ++;
  1755. return range;
  1756. }
  1757. }
  1758. }
  1759. });
  1760. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1761. if (text === ';') {
  1762. var cursor = editor.getCursorPosition();
  1763. var line = session.doc.getLine(cursor.row);
  1764. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1765. if (rightChar === ';') {
  1766. return {
  1767. text: '',
  1768. selection: [1, 1]
  1769. };
  1770. }
  1771. }
  1772. });
  1773. };
  1774. oop.inherits(CssBehaviour, CstyleBehaviour);
  1775. exports.CssBehaviour = CssBehaviour;
  1776. });
  1777. 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) {
  1778. "use strict";
  1779. var oop = acequire("../lib/oop");
  1780. var TextMode = acequire("./text").Mode;
  1781. var CssHighlightRules = acequire("./css_highlight_rules").CssHighlightRules;
  1782. var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent;
  1783. var WorkerClient = acequire("../worker/worker_client").WorkerClient;
  1784. var CssCompletions = acequire("./css_completions").CssCompletions;
  1785. var CssBehaviour = acequire("./behaviour/css").CssBehaviour;
  1786. var CStyleFoldMode = acequire("./folding/cstyle").FoldMode;
  1787. var Mode = function() {
  1788. this.HighlightRules = CssHighlightRules;
  1789. this.$outdent = new MatchingBraceOutdent();
  1790. this.$behaviour = new CssBehaviour();
  1791. this.$completer = new CssCompletions();
  1792. this.foldingRules = new CStyleFoldMode();
  1793. };
  1794. oop.inherits(Mode, TextMode);
  1795. (function() {
  1796. this.foldingRules = "cStyle";
  1797. this.blockComment = {start: "/*", end: "*/"};
  1798. this.getNextLineIndent = function(state, line, tab) {
  1799. var indent = this.$getIndent(line);
  1800. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1801. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1802. return indent;
  1803. }
  1804. var match = line.match(/^.*\{\s*$/);
  1805. if (match) {
  1806. indent += tab;
  1807. }
  1808. return indent;
  1809. };
  1810. this.checkOutdent = function(state, line, input) {
  1811. return this.$outdent.checkOutdent(line, input);
  1812. };
  1813. this.autoOutdent = function(state, doc, row) {
  1814. this.$outdent.autoOutdent(doc, row);
  1815. };
  1816. this.getCompletions = function(state, session, pos, prefix) {
  1817. return this.$completer.getCompletions(state, session, pos, prefix);
  1818. };
  1819. this.createWorker = function(session) {
  1820. var worker = new WorkerClient(["ace"], require("../worker/css"), "Worker");
  1821. worker.attachToDocument(session.getDocument());
  1822. worker.on("annotate", function(e) {
  1823. session.setAnnotations(e.data);
  1824. });
  1825. worker.on("terminate", function() {
  1826. session.clearAnnotations();
  1827. });
  1828. return worker;
  1829. };
  1830. this.$id = "ace/mode/css";
  1831. }).call(Mode.prototype);
  1832. exports.Mode = Mode;
  1833. });
  1834. 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) {
  1835. "use strict";
  1836. var oop = acequire("../../lib/oop");
  1837. var Behaviour = acequire("../behaviour").Behaviour;
  1838. var TokenIterator = acequire("../../token_iterator").TokenIterator;
  1839. var lang = acequire("../../lib/lang");
  1840. function is(token, type) {
  1841. return token.type.lastIndexOf(type + ".xml") > -1;
  1842. }
  1843. var XmlBehaviour = function () {
  1844. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  1845. if (text == '"' || text == "'") {
  1846. var quote = text;
  1847. var selected = session.doc.getTextRange(editor.getSelectionRange());
  1848. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  1849. return {
  1850. text: quote + selected + quote,
  1851. selection: false
  1852. };
  1853. }
  1854. var cursor = editor.getCursorPosition();
  1855. var line = session.doc.getLine(cursor.row);
  1856. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1857. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1858. var token = iterator.getCurrentToken();
  1859. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  1860. return {
  1861. text: "",
  1862. selection: [1, 1]
  1863. };
  1864. }
  1865. if (!token)
  1866. token = iterator.stepBackward();
  1867. if (!token)
  1868. return;
  1869. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  1870. token = iterator.stepBackward();
  1871. }
  1872. var rightSpace = !rightChar || rightChar.match(/\s/);
  1873. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  1874. return {
  1875. text: quote + quote,
  1876. selection: [1, 1]
  1877. };
  1878. }
  1879. }
  1880. });
  1881. this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
  1882. var selected = session.doc.getTextRange(range);
  1883. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  1884. var line = session.doc.getLine(range.start.row);
  1885. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  1886. if (rightChar == selected) {
  1887. range.end.column++;
  1888. return range;
  1889. }
  1890. }
  1891. });
  1892. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  1893. if (text == '>') {
  1894. var position = editor.getSelectionRange().start;
  1895. var iterator = new TokenIterator(session, position.row, position.column);
  1896. var token = iterator.getCurrentToken() || iterator.stepBackward();
  1897. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  1898. return;
  1899. if (is(token, "reference.attribute-value"))
  1900. return;
  1901. if (is(token, "attribute-value")) {
  1902. var firstChar = token.value.charAt(0);
  1903. if (firstChar == '"' || firstChar == "'") {
  1904. var lastChar = token.value.charAt(token.value.length - 1);
  1905. var tokenEnd = iterator.getCurrentTokenColumn() + token.value.length;
  1906. if (tokenEnd > position.column || tokenEnd == position.column && firstChar != lastChar)
  1907. return;
  1908. }
  1909. }
  1910. while (!is(token, "tag-name")) {
  1911. token = iterator.stepBackward();
  1912. if (token.value == "<") {
  1913. token = iterator.stepForward();
  1914. break;
  1915. }
  1916. }
  1917. var tokenRow = iterator.getCurrentTokenRow();
  1918. var tokenColumn = iterator.getCurrentTokenColumn();
  1919. if (is(iterator.stepBackward(), "end-tag-open"))
  1920. return;
  1921. var element = token.value;
  1922. if (tokenRow == position.row)
  1923. element = element.substring(0, position.column - tokenColumn);
  1924. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  1925. return;
  1926. return {
  1927. text: ">" + "</" + element + ">",
  1928. selection: [1, 1]
  1929. };
  1930. }
  1931. });
  1932. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  1933. if (text == "\n") {
  1934. var cursor = editor.getCursorPosition();
  1935. var line = session.getLine(cursor.row);
  1936. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1937. var token = iterator.getCurrentToken();
  1938. if (token && token.type.indexOf("tag-close") !== -1) {
  1939. if (token.value == "/>")
  1940. return;
  1941. while (token && token.type.indexOf("tag-name") === -1) {
  1942. token = iterator.stepBackward();
  1943. }
  1944. if (!token) {
  1945. return;
  1946. }
  1947. var tag = token.value;
  1948. var row = iterator.getCurrentTokenRow();
  1949. token = iterator.stepBackward();
  1950. if (!token || token.type.indexOf("end-tag") !== -1) {
  1951. return;
  1952. }
  1953. if (this.voidElements && !this.voidElements[tag]) {
  1954. var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
  1955. var line = session.getLine(row);
  1956. var nextIndent = this.$getIndent(line);
  1957. var indent = nextIndent + session.getTabString();
  1958. if (nextToken && nextToken.value === "</") {
  1959. return {
  1960. text: "\n" + indent + "\n" + nextIndent,
  1961. selection: [1, indent.length, 1, indent.length]
  1962. };
  1963. } else {
  1964. return {
  1965. text: "\n" + indent
  1966. };
  1967. }
  1968. }
  1969. }
  1970. }
  1971. });
  1972. };
  1973. oop.inherits(XmlBehaviour, Behaviour);
  1974. exports.XmlBehaviour = XmlBehaviour;
  1975. });
  1976. ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(acequire, exports, module) {
  1977. "use strict";
  1978. var oop = acequire("../../lib/oop");
  1979. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  1980. var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
  1981. this.defaultMode = defaultMode;
  1982. this.subModes = subModes;
  1983. };
  1984. oop.inherits(FoldMode, BaseFoldMode);
  1985. (function() {
  1986. this.$getMode = function(state) {
  1987. if (typeof state != "string")
  1988. state = state[0];
  1989. for (var key in this.subModes) {
  1990. if (state.indexOf(key) === 0)
  1991. return this.subModes[key];
  1992. }
  1993. return null;
  1994. };
  1995. this.$tryMode = function(state, session, foldStyle, row) {
  1996. var mode = this.$getMode(state);
  1997. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  1998. };
  1999. this.getFoldWidget = function(session, foldStyle, row) {
  2000. return (
  2001. this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
  2002. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  2003. this.defaultMode.getFoldWidget(session, foldStyle, row)
  2004. );
  2005. };
  2006. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2007. var mode = this.$getMode(session.getState(row-1));
  2008. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  2009. mode = this.$getMode(session.getState(row));
  2010. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  2011. mode = this.defaultMode;
  2012. return mode.getFoldWidgetRange(session, foldStyle, row);
  2013. };
  2014. }).call(FoldMode.prototype);
  2015. });
  2016. 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) {
  2017. "use strict";
  2018. var oop = acequire("../../lib/oop");
  2019. var lang = acequire("../../lib/lang");
  2020. var Range = acequire("../../range").Range;
  2021. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  2022. var TokenIterator = acequire("../../token_iterator").TokenIterator;
  2023. var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
  2024. BaseFoldMode.call(this);
  2025. this.voidElements = voidElements || {};
  2026. this.optionalEndTags = oop.mixin({}, this.voidElements);
  2027. if (optionalEndTags)
  2028. oop.mixin(this.optionalEndTags, optionalEndTags);
  2029. };
  2030. oop.inherits(FoldMode, BaseFoldMode);
  2031. var Tag = function() {
  2032. this.tagName = "";
  2033. this.closing = false;
  2034. this.selfClosing = false;
  2035. this.start = {row: 0, column: 0};
  2036. this.end = {row: 0, column: 0};
  2037. };
  2038. function is(token, type) {
  2039. return token.type.lastIndexOf(type + ".xml") > -1;
  2040. }
  2041. (function() {
  2042. this.getFoldWidget = function(session, foldStyle, row) {
  2043. var tag = this._getFirstTagInLine(session, row);
  2044. if (!tag)
  2045. return this.getCommentFoldWidget(session, row);
  2046. if (tag.closing || (!tag.tagName && tag.selfClosing))
  2047. return foldStyle == "markbeginend" ? "end" : "";
  2048. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  2049. return "";
  2050. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  2051. return "";
  2052. return "start";
  2053. };
  2054. this.getCommentFoldWidget = function(session, row) {
  2055. if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
  2056. return "start";
  2057. return "";
  2058. };
  2059. this._getFirstTagInLine = function(session, row) {
  2060. var tokens = session.getTokens(row);
  2061. var tag = new Tag();
  2062. for (var i = 0; i < tokens.length; i++) {
  2063. var token = tokens[i];
  2064. if (is(token, "tag-open")) {
  2065. tag.end.column = tag.start.column + token.value.length;
  2066. tag.closing = is(token, "end-tag-open");
  2067. token = tokens[++i];
  2068. if (!token)
  2069. return null;
  2070. tag.tagName = token.value;
  2071. tag.end.column += token.value.length;
  2072. for (i++; i < tokens.length; i++) {
  2073. token = tokens[i];
  2074. tag.end.column += token.value.length;
  2075. if (is(token, "tag-close")) {
  2076. tag.selfClosing = token.value == '/>';
  2077. break;
  2078. }
  2079. }
  2080. return tag;
  2081. } else if (is(token, "tag-close")) {
  2082. tag.selfClosing = token.value == '/>';
  2083. return tag;
  2084. }
  2085. tag.start.column += token.value.length;
  2086. }
  2087. return null;
  2088. };
  2089. this._findEndTagInLine = function(session, row, tagName, startColumn) {
  2090. var tokens = session.getTokens(row);
  2091. var column = 0;
  2092. for (var i = 0; i < tokens.length; i++) {
  2093. var token = tokens[i];
  2094. column += token.value.length;
  2095. if (column < startColumn)
  2096. continue;
  2097. if (is(token, "end-tag-open")) {
  2098. token = tokens[i + 1];
  2099. if (token && token.value == tagName)
  2100. return true;
  2101. }
  2102. }
  2103. return false;
  2104. };
  2105. this._readTagForward = function(iterator) {
  2106. var token = iterator.getCurrentToken();
  2107. if (!token)
  2108. return null;
  2109. var tag = new Tag();
  2110. do {
  2111. if (is(token, "tag-open")) {
  2112. tag.closing = is(token, "end-tag-open");
  2113. tag.start.row = iterator.getCurrentTokenRow();
  2114. tag.start.column = iterator.getCurrentTokenColumn();
  2115. } else if (is(token, "tag-name")) {
  2116. tag.tagName = token.value;
  2117. } else if (is(token, "tag-close")) {
  2118. tag.selfClosing = token.value == "/>";
  2119. tag.end.row = iterator.getCurrentTokenRow();
  2120. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  2121. iterator.stepForward();
  2122. return tag;
  2123. }
  2124. } while(token = iterator.stepForward());
  2125. return null;
  2126. };
  2127. this._readTagBackward = function(iterator) {
  2128. var token = iterator.getCurrentToken();
  2129. if (!token)
  2130. return null;
  2131. var tag = new Tag();
  2132. do {
  2133. if (is(token, "tag-open")) {
  2134. tag.closing = is(token, "end-tag-open");
  2135. tag.start.row = iterator.getCurrentTokenRow();
  2136. tag.start.column = iterator.getCurrentTokenColumn();
  2137. iterator.stepBackward();
  2138. return tag;
  2139. } else if (is(token, "tag-name")) {
  2140. tag.tagName = token.value;
  2141. } else if (is(token, "tag-close")) {
  2142. tag.selfClosing = token.value == "/>";
  2143. tag.end.row = iterator.getCurrentTokenRow();
  2144. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  2145. }
  2146. } while(token = iterator.stepBackward());
  2147. return null;
  2148. };
  2149. this._pop = function(stack, tag) {
  2150. while (stack.length) {
  2151. var top = stack[stack.length-1];
  2152. if (!tag || top.tagName == tag.tagName) {
  2153. return stack.pop();
  2154. }
  2155. else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
  2156. stack.pop();
  2157. continue;
  2158. } else {
  2159. return null;
  2160. }
  2161. }
  2162. };
  2163. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2164. var firstTag = this._getFirstTagInLine(session, row);
  2165. if (!firstTag) {
  2166. return this.getCommentFoldWidget(session, row)
  2167. && session.getCommentFoldRange(row, session.getLine(row).length);
  2168. }
  2169. var isBackward = firstTag.closing || firstTag.selfClosing;
  2170. var stack = [];
  2171. var tag;
  2172. if (!isBackward) {
  2173. var iterator = new TokenIterator(session, row, firstTag.start.column);
  2174. var start = {
  2175. row: row,
  2176. column: firstTag.start.column + firstTag.tagName.length + 2
  2177. };
  2178. if (firstTag.start.row == firstTag.end.row)
  2179. start.column = firstTag.end.column;
  2180. while (tag = this._readTagForward(iterator)) {
  2181. if (tag.selfClosing) {
  2182. if (!stack.length) {
  2183. tag.start.column += tag.tagName.length + 2;
  2184. tag.end.column -= 2;
  2185. return Range.fromPoints(tag.start, tag.end);
  2186. } else
  2187. continue;
  2188. }
  2189. if (tag.closing) {
  2190. this._pop(stack, tag);
  2191. if (stack.length == 0)
  2192. return Range.fromPoints(start, tag.start);
  2193. }
  2194. else {
  2195. stack.push(tag);
  2196. }
  2197. }
  2198. }
  2199. else {
  2200. var iterator = new TokenIterator(session, row, firstTag.end.column);
  2201. var end = {
  2202. row: row,
  2203. column: firstTag.start.column
  2204. };
  2205. while (tag = this._readTagBackward(iterator)) {
  2206. if (tag.selfClosing) {
  2207. if (!stack.length) {
  2208. tag.start.column += tag.tagName.length + 2;
  2209. tag.end.column -= 2;
  2210. return Range.fromPoints(tag.start, tag.end);
  2211. } else
  2212. continue;
  2213. }
  2214. if (!tag.closing) {
  2215. this._pop(stack, tag);
  2216. if (stack.length == 0) {
  2217. tag.start.column += tag.tagName.length + 2;
  2218. if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
  2219. tag.start.column = tag.end.column;
  2220. return Range.fromPoints(tag.start, end);
  2221. }
  2222. }
  2223. else {
  2224. stack.push(tag);
  2225. }
  2226. }
  2227. }
  2228. };
  2229. }).call(FoldMode.prototype);
  2230. });
  2231. 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) {
  2232. "use strict";
  2233. var oop = acequire("../../lib/oop");
  2234. var MixedFoldMode = acequire("./mixed").FoldMode;
  2235. var XmlFoldMode = acequire("./xml").FoldMode;
  2236. var CStyleFoldMode = acequire("./cstyle").FoldMode;
  2237. var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
  2238. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  2239. "js-": new CStyleFoldMode(),
  2240. "css-": new CStyleFoldMode()
  2241. });
  2242. };
  2243. oop.inherits(FoldMode, MixedFoldMode);
  2244. });
  2245. ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(acequire, exports, module) {
  2246. "use strict";
  2247. var TokenIterator = acequire("../token_iterator").TokenIterator;
  2248. var commonAttributes = [
  2249. "accesskey",
  2250. "class",
  2251. "contenteditable",
  2252. "contextmenu",
  2253. "dir",
  2254. "draggable",
  2255. "dropzone",
  2256. "hidden",
  2257. "id",
  2258. "inert",
  2259. "itemid",
  2260. "itemprop",
  2261. "itemref",
  2262. "itemscope",
  2263. "itemtype",
  2264. "lang",
  2265. "spellcheck",
  2266. "style",
  2267. "tabindex",
  2268. "title",
  2269. "translate"
  2270. ];
  2271. var eventAttributes = [
  2272. "onabort",
  2273. "onblur",
  2274. "oncancel",
  2275. "oncanplay",
  2276. "oncanplaythrough",
  2277. "onchange",
  2278. "onclick",
  2279. "onclose",
  2280. "oncontextmenu",
  2281. "oncuechange",
  2282. "ondblclick",
  2283. "ondrag",
  2284. "ondragend",
  2285. "ondragenter",
  2286. "ondragleave",
  2287. "ondragover",
  2288. "ondragstart",
  2289. "ondrop",
  2290. "ondurationchange",
  2291. "onemptied",
  2292. "onended",
  2293. "onerror",
  2294. "onfocus",
  2295. "oninput",
  2296. "oninvalid",
  2297. "onkeydown",
  2298. "onkeypress",
  2299. "onkeyup",
  2300. "onload",
  2301. "onloadeddata",
  2302. "onloadedmetadata",
  2303. "onloadstart",
  2304. "onmousedown",
  2305. "onmousemove",
  2306. "onmouseout",
  2307. "onmouseover",
  2308. "onmouseup",
  2309. "onmousewheel",
  2310. "onpause",
  2311. "onplay",
  2312. "onplaying",
  2313. "onprogress",
  2314. "onratechange",
  2315. "onreset",
  2316. "onscroll",
  2317. "onseeked",
  2318. "onseeking",
  2319. "onselect",
  2320. "onshow",
  2321. "onstalled",
  2322. "onsubmit",
  2323. "onsuspend",
  2324. "ontimeupdate",
  2325. "onvolumechange",
  2326. "onwaiting"
  2327. ];
  2328. var globalAttributes = commonAttributes.concat(eventAttributes);
  2329. var attributeMap = {
  2330. "html": {"manifest": 1},
  2331. "head": {},
  2332. "title": {},
  2333. "base": {"href": 1, "target": 1},
  2334. "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},
  2335. "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
  2336. "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
  2337. "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
  2338. "noscript": {"href": 1},
  2339. "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},
  2340. "section": {},
  2341. "nav": {},
  2342. "article": {"pubdate": 1},
  2343. "aside": {},
  2344. "h1": {},
  2345. "h2": {},
  2346. "h3": {},
  2347. "h4": {},
  2348. "h5": {},
  2349. "h6": {},
  2350. "header": {},
  2351. "footer": {},
  2352. "address": {},
  2353. "main": {},
  2354. "p": {},
  2355. "hr": {},
  2356. "pre": {},
  2357. "blockquote": {"cite": 1},
  2358. "ol": {"start": 1, "reversed": 1},
  2359. "ul": {},
  2360. "li": {"value": 1},
  2361. "dl": {},
  2362. "dt": {},
  2363. "dd": {},
  2364. "figure": {},
  2365. "figcaption": {},
  2366. "div": {},
  2367. "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},
  2368. "em": {},
  2369. "strong": {},
  2370. "small": {},
  2371. "s": {},
  2372. "cite": {},
  2373. "q": {"cite": 1},
  2374. "dfn": {},
  2375. "abbr": {},
  2376. "data": {},
  2377. "time": {"datetime": 1},
  2378. "code": {},
  2379. "var": {},
  2380. "samp": {},
  2381. "kbd": {},
  2382. "sub": {},
  2383. "sup": {},
  2384. "i": {},
  2385. "b": {},
  2386. "u": {},
  2387. "mark": {},
  2388. "ruby": {},
  2389. "rt": {},
  2390. "rp": {},
  2391. "bdi": {},
  2392. "bdo": {},
  2393. "span": {},
  2394. "br": {},
  2395. "wbr": {},
  2396. "ins": {"cite": 1, "datetime": 1},
  2397. "del": {"cite": 1, "datetime": 1},
  2398. "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
  2399. "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}},
  2400. "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
  2401. "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
  2402. "param": {"name": 1, "value": 1},
  2403. "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}},
  2404. "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
  2405. "source": {"src": 1, "type": 1, "media": 1},
  2406. "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
  2407. "canvas": {"width": 1, "height": 1},
  2408. "map": {"name": 1},
  2409. "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
  2410. "svg": {},
  2411. "math": {},
  2412. "table": {"summary": 1},
  2413. "caption": {},
  2414. "colgroup": {"span": 1},
  2415. "col": {"span": 1},
  2416. "tbody": {},
  2417. "thead": {},
  2418. "tfoot": {},
  2419. "tr": {},
  2420. "td": {"headers": 1, "rowspan": 1, "colspan": 1},
  2421. "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
  2422. "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}},
  2423. "fieldset": {"disabled": 1, "form": 1, "name": 1},
  2424. "legend": {},
  2425. "label": {"form": 1, "for": 1},
  2426. "input": {
  2427. "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},
  2428. "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},
  2429. "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}},
  2430. "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
  2431. "datalist": {},
  2432. "optgroup": {"disabled": 1, "label": 1},
  2433. "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
  2434. "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}},
  2435. "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
  2436. "output": {"for": 1, "form": 1, "name": 1},
  2437. "progress": {"value": 1, "max": 1},
  2438. "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
  2439. "details": {"open": 1},
  2440. "summary": {},
  2441. "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
  2442. "menu": {"type": 1, "label": 1},
  2443. "dialog": {"open": 1}
  2444. };
  2445. var elements = Object.keys(attributeMap);
  2446. function is(token, type) {
  2447. return token.type.lastIndexOf(type + ".xml") > -1;
  2448. }
  2449. function findTagName(session, pos) {
  2450. var iterator = new TokenIterator(session, pos.row, pos.column);
  2451. var token = iterator.getCurrentToken();
  2452. while (token && !is(token, "tag-name")){
  2453. token = iterator.stepBackward();
  2454. }
  2455. if (token)
  2456. return token.value;
  2457. }
  2458. function findAttributeName(session, pos) {
  2459. var iterator = new TokenIterator(session, pos.row, pos.column);
  2460. var token = iterator.getCurrentToken();
  2461. while (token && !is(token, "attribute-name")){
  2462. token = iterator.stepBackward();
  2463. }
  2464. if (token)
  2465. return token.value;
  2466. }
  2467. var HtmlCompletions = function() {
  2468. };
  2469. (function() {
  2470. this.getCompletions = function(state, session, pos, prefix) {
  2471. var token = session.getTokenAt(pos.row, pos.column);
  2472. if (!token)
  2473. return [];
  2474. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2475. return this.getTagCompletions(state, session, pos, prefix);
  2476. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2477. return this.getAttributeCompletions(state, session, pos, prefix);
  2478. if (is(token, "attribute-value"))
  2479. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2480. var line = session.getLine(pos.row).substr(0, pos.column);
  2481. if (/&[a-z]*$/i.test(line))
  2482. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2483. return [];
  2484. };
  2485. this.getTagCompletions = function(state, session, pos, prefix) {
  2486. return elements.map(function(element){
  2487. return {
  2488. value: element,
  2489. meta: "tag",
  2490. score: Number.MAX_VALUE
  2491. };
  2492. });
  2493. };
  2494. this.getAttributeCompletions = function(state, session, pos, prefix) {
  2495. var tagName = findTagName(session, pos);
  2496. if (!tagName)
  2497. return [];
  2498. var attributes = globalAttributes;
  2499. if (tagName in attributeMap) {
  2500. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2501. }
  2502. return attributes.map(function(attribute){
  2503. return {
  2504. caption: attribute,
  2505. snippet: attribute + '="$0"',
  2506. meta: "attribute",
  2507. score: Number.MAX_VALUE
  2508. };
  2509. });
  2510. };
  2511. this.getAttributeValueCompletions = function(state, session, pos, prefix) {
  2512. var tagName = findTagName(session, pos);
  2513. var attributeName = findAttributeName(session, pos);
  2514. if (!tagName)
  2515. return [];
  2516. var values = [];
  2517. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2518. values = Object.keys(attributeMap[tagName][attributeName]);
  2519. }
  2520. return values.map(function(value){
  2521. return {
  2522. caption: value,
  2523. snippet: value,
  2524. meta: "attribute value",
  2525. score: Number.MAX_VALUE
  2526. };
  2527. });
  2528. };
  2529. this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
  2530. 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;'];
  2531. return values.map(function(value){
  2532. return {
  2533. caption: value,
  2534. snippet: value,
  2535. meta: "html entity",
  2536. score: Number.MAX_VALUE
  2537. };
  2538. });
  2539. };
  2540. }).call(HtmlCompletions.prototype);
  2541. exports.HtmlCompletions = HtmlCompletions;
  2542. });
  2543. 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) {
  2544. "use strict";
  2545. var oop = acequire("../lib/oop");
  2546. var lang = acequire("../lib/lang");
  2547. var TextMode = acequire("./text").Mode;
  2548. var JavaScriptMode = acequire("./javascript").Mode;
  2549. var CssMode = acequire("./css").Mode;
  2550. var HtmlHighlightRules = acequire("./html_highlight_rules").HtmlHighlightRules;
  2551. var XmlBehaviour = acequire("./behaviour/xml").XmlBehaviour;
  2552. var HtmlFoldMode = acequire("./folding/html").FoldMode;
  2553. var HtmlCompletions = acequire("./html_completions").HtmlCompletions;
  2554. var WorkerClient = acequire("../worker/worker_client").WorkerClient;
  2555. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2556. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2557. var Mode = function(options) {
  2558. this.fragmentContext = options && options.fragmentContext;
  2559. this.HighlightRules = HtmlHighlightRules;
  2560. this.$behaviour = new XmlBehaviour();
  2561. this.$completer = new HtmlCompletions();
  2562. this.createModeDelegates({
  2563. "js-": JavaScriptMode,
  2564. "css-": CssMode
  2565. });
  2566. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2567. };
  2568. oop.inherits(Mode, TextMode);
  2569. (function() {
  2570. this.blockComment = {start: "<!--", end: "-->"};
  2571. this.voidElements = lang.arrayToMap(voidElements);
  2572. this.getNextLineIndent = function(state, line, tab) {
  2573. return this.$getIndent(line);
  2574. };
  2575. this.checkOutdent = function(state, line, input) {
  2576. return false;
  2577. };
  2578. this.getCompletions = function(state, session, pos, prefix) {
  2579. return this.$completer.getCompletions(state, session, pos, prefix);
  2580. };
  2581. this.createWorker = function(session) {
  2582. if (this.constructor != Mode)
  2583. return;
  2584. var worker = new WorkerClient(["ace"], require("../worker/html"), "Worker");
  2585. worker.attachToDocument(session.getDocument());
  2586. if (this.fragmentContext)
  2587. worker.call("setOptions", [{context: this.fragmentContext}]);
  2588. worker.on("error", function(e) {
  2589. session.setAnnotations(e.data);
  2590. });
  2591. worker.on("terminate", function() {
  2592. session.clearAnnotations();
  2593. });
  2594. return worker;
  2595. };
  2596. this.$id = "ace/mode/html";
  2597. }).call(Mode.prototype);
  2598. exports.Mode = Mode;
  2599. });
  2600. ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(acequire, exports, module) {
  2601. "use strict";
  2602. var oop = acequire("../../lib/oop");
  2603. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  2604. var Range = acequire("../../range").Range;
  2605. var FoldMode = exports.FoldMode = function() {};
  2606. oop.inherits(FoldMode, BaseFoldMode);
  2607. (function() {
  2608. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2609. var range = this.indentationBlock(session, row);
  2610. if (range)
  2611. return range;
  2612. var re = /\S/;
  2613. var line = session.getLine(row);
  2614. var startLevel = line.search(re);
  2615. if (startLevel == -1 || line[startLevel] != "#")
  2616. return;
  2617. var startColumn = line.length;
  2618. var maxRow = session.getLength();
  2619. var startRow = row;
  2620. var endRow = row;
  2621. while (++row < maxRow) {
  2622. line = session.getLine(row);
  2623. var level = line.search(re);
  2624. if (level == -1)
  2625. continue;
  2626. if (line[level] != "#")
  2627. break;
  2628. endRow = row;
  2629. }
  2630. if (endRow > startRow) {
  2631. var endColumn = session.getLine(endRow).length;
  2632. return new Range(startRow, startColumn, endRow, endColumn);
  2633. }
  2634. };
  2635. this.getFoldWidget = function(session, foldStyle, row) {
  2636. var line = session.getLine(row);
  2637. var indent = line.search(/\S/);
  2638. var next = session.getLine(row + 1);
  2639. var prev = session.getLine(row - 1);
  2640. var prevIndent = prev.search(/\S/);
  2641. var nextIndent = next.search(/\S/);
  2642. if (indent == -1) {
  2643. session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
  2644. return "";
  2645. }
  2646. if (prevIndent == -1) {
  2647. if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
  2648. session.foldWidgets[row - 1] = "";
  2649. session.foldWidgets[row + 1] = "";
  2650. return "start";
  2651. }
  2652. } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
  2653. if (session.getLine(row - 2).search(/\S/) == -1) {
  2654. session.foldWidgets[row - 1] = "start";
  2655. session.foldWidgets[row + 1] = "";
  2656. return "";
  2657. }
  2658. }
  2659. if (prevIndent!= -1 && prevIndent < indent)
  2660. session.foldWidgets[row - 1] = "start";
  2661. else
  2662. session.foldWidgets[row - 1] = "";
  2663. if (indent < nextIndent)
  2664. return "start";
  2665. else
  2666. return "";
  2667. };
  2668. }).call(FoldMode.prototype);
  2669. });
  2670. ace.define("ace/mode/elixir",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/elixir_highlight_rules","ace/mode/folding/coffee"], function(acequire, exports, module) {
  2671. "use strict";
  2672. var oop = acequire("../lib/oop");
  2673. var TextMode = acequire("./text").Mode;
  2674. var ElixirHighlightRules = acequire("./elixir_highlight_rules").ElixirHighlightRules;
  2675. var FoldMode = acequire("./folding/coffee").FoldMode;
  2676. var Mode = function() {
  2677. this.HighlightRules = ElixirHighlightRules;
  2678. this.foldingRules = new FoldMode();
  2679. this.$behaviour = this.$defaultBehaviour;
  2680. };
  2681. oop.inherits(Mode, TextMode);
  2682. (function() {
  2683. this.lineCommentStart = "#";
  2684. this.$id = "ace/mode/elixir";
  2685. }).call(Mode.prototype);
  2686. exports.Mode = Mode;
  2687. });
  2688. ace.define("ace/mode/html_elixir",["require","exports","module","ace/lib/oop","ace/mode/html_elixir_highlight_rules","ace/mode/html","ace/mode/javascript","ace/mode/css","ace/mode/elixir"], function(acequire, exports, module) {
  2689. "use strict";
  2690. var oop = acequire("../lib/oop");
  2691. var HtmlElixirHighlightRules = acequire("./html_elixir_highlight_rules").HtmlElixirHighlightRules;
  2692. var HtmlMode = acequire("./html").Mode;
  2693. var JavaScriptMode = acequire("./javascript").Mode;
  2694. var CssMode = acequire("./css").Mode;
  2695. var ElixirMode = acequire("./elixir").Mode;
  2696. var Mode = function() {
  2697. HtmlMode.call(this);
  2698. this.HighlightRules = HtmlElixirHighlightRules;
  2699. this.createModeDelegates({
  2700. "js-": JavaScriptMode,
  2701. "css-": CssMode,
  2702. "elixir-": ElixirMode
  2703. });
  2704. };
  2705. oop.inherits(Mode, HtmlMode);
  2706. (function() {
  2707. this.$id = "ace/mode/html_elixir";
  2708. }).call(Mode.prototype);
  2709. exports.Mode = Mode;
  2710. });