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.

3016 lines
118 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/ruby_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 constantOtherSymbol = exports.constantOtherSymbol = {
  934. token : "constant.other.symbol.ruby", // symbol
  935. regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
  936. };
  937. var qString = exports.qString = {
  938. token : "string", // single line
  939. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  940. };
  941. var qqString = exports.qqString = {
  942. token : "string", // single line
  943. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  944. };
  945. var tString = exports.tString = {
  946. token : "string", // backtick string
  947. regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
  948. };
  949. var constantNumericHex = exports.constantNumericHex = {
  950. token : "constant.numeric", // hex
  951. regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
  952. };
  953. var constantNumericFloat = exports.constantNumericFloat = {
  954. token : "constant.numeric", // float
  955. regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"
  956. };
  957. var instanceVariable = exports.instanceVariable = {
  958. token : "variable.instance", // instance variable
  959. regex : "@{1,2}[a-zA-Z_\\d]+"
  960. };
  961. var RubyHighlightRules = function() {
  962. var builtinFunctions = (
  963. "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
  964. "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
  965. "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
  966. "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
  967. "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
  968. "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" +
  969. "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
  970. "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
  971. "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
  972. "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" +
  973. "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
  974. "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
  975. "raw|readline|readlines|redirect?|request_via_redirect|acequire|scan|select|" +
  976. "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" +
  977. "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" +
  978. "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" +
  979. "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" +
  980. "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" +
  981. "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" +
  982. "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" +
  983. "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" +
  984. "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" +
  985. "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" +
  986. "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" +
  987. "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
  988. "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
  989. "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
  990. "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" +
  991. "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
  992. "has_many|has_one|belongs_to|has_and_belongs_to_many"
  993. );
  994. var keywords = (
  995. "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
  996. "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
  997. "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield"
  998. );
  999. var buildinConstants = (
  1000. "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
  1001. "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING"
  1002. );
  1003. var builtinVariables = (
  1004. "$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|" +
  1005. "$!|root_url|flash|session|cookies|params|request|response|logger|self"
  1006. );
  1007. var keywordMapper = this.$keywords = this.createKeywordMapper({
  1008. "keyword": keywords,
  1009. "constant.language": buildinConstants,
  1010. "variable.language": builtinVariables,
  1011. "support.function": builtinFunctions,
  1012. "invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
  1013. }, "identifier");
  1014. this.$rules = {
  1015. "start" : [
  1016. {
  1017. token : "comment",
  1018. regex : "#.*$"
  1019. }, {
  1020. token : "comment", // multi line comment
  1021. regex : "^=begin(?:$|\\s.*$)",
  1022. next : "comment"
  1023. }, {
  1024. token : "string.regexp",
  1025. regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
  1026. },
  1027. [{
  1028. regex: "[{}]", onMatch: function(val, state, stack) {
  1029. this.next = val == "{" ? this.nextState : "";
  1030. if (val == "{" && stack.length) {
  1031. stack.unshift("start", state);
  1032. return "paren.lparen";
  1033. }
  1034. if (val == "}" && stack.length) {
  1035. stack.shift();
  1036. this.next = stack.shift();
  1037. if (this.next.indexOf("string") != -1)
  1038. return "paren.end";
  1039. }
  1040. return val == "{" ? "paren.lparen" : "paren.rparen";
  1041. },
  1042. nextState: "start"
  1043. }, {
  1044. token : "string.start",
  1045. regex : /"/,
  1046. push : [{
  1047. token : "constant.language.escape",
  1048. regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
  1049. }, {
  1050. token : "paren.start",
  1051. regex : /#{/,
  1052. push : "start"
  1053. }, {
  1054. token : "string.end",
  1055. regex : /"/,
  1056. next : "pop"
  1057. }, {
  1058. defaultToken: "string"
  1059. }]
  1060. }, {
  1061. token : "string.start",
  1062. regex : /`/,
  1063. push : [{
  1064. token : "constant.language.escape",
  1065. regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
  1066. }, {
  1067. token : "paren.start",
  1068. regex : /#{/,
  1069. push : "start"
  1070. }, {
  1071. token : "string.end",
  1072. regex : /`/,
  1073. next : "pop"
  1074. }, {
  1075. defaultToken: "string"
  1076. }]
  1077. }, {
  1078. token : "string.start",
  1079. regex : /'/,
  1080. push : [{
  1081. token : "constant.language.escape",
  1082. regex : /\\['\\]/
  1083. }, {
  1084. token : "string.end",
  1085. regex : /'/,
  1086. next : "pop"
  1087. }, {
  1088. defaultToken: "string"
  1089. }]
  1090. }],
  1091. {
  1092. token : "text", // namespaces aren't symbols
  1093. regex : "::"
  1094. }, {
  1095. token : "variable.instance", // instance variable
  1096. regex : "@{1,2}[a-zA-Z_\\d]+"
  1097. }, {
  1098. token : "support.class", // class name
  1099. regex : "[A-Z][a-zA-Z_\\d]+"
  1100. },
  1101. constantOtherSymbol,
  1102. constantNumericHex,
  1103. constantNumericFloat,
  1104. {
  1105. token : "constant.language.boolean",
  1106. regex : "(?:true|false)\\b"
  1107. }, {
  1108. token : keywordMapper,
  1109. regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  1110. }, {
  1111. token : "punctuation.separator.key-value",
  1112. regex : "=>"
  1113. }, {
  1114. stateName: "heredoc",
  1115. onMatch : function(value, currentState, stack) {
  1116. var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
  1117. var tokens = value.split(this.splitRegex);
  1118. stack.push(next, tokens[3]);
  1119. return [
  1120. {type:"constant", value: tokens[1]},
  1121. {type:"string", value: tokens[2]},
  1122. {type:"support.class", value: tokens[3]},
  1123. {type:"string", value: tokens[4]}
  1124. ];
  1125. },
  1126. regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)",
  1127. rules: {
  1128. heredoc: [{
  1129. onMatch: function(value, currentState, stack) {
  1130. if (value === stack[1]) {
  1131. stack.shift();
  1132. stack.shift();
  1133. this.next = stack[0] || "start";
  1134. return "support.class";
  1135. }
  1136. this.next = "";
  1137. return "string";
  1138. },
  1139. regex: ".*$",
  1140. next: "start"
  1141. }],
  1142. indentedHeredoc: [{
  1143. token: "string",
  1144. regex: "^ +"
  1145. }, {
  1146. onMatch: function(value, currentState, stack) {
  1147. if (value === stack[1]) {
  1148. stack.shift();
  1149. stack.shift();
  1150. this.next = stack[0] || "start";
  1151. return "support.class";
  1152. }
  1153. this.next = "";
  1154. return "string";
  1155. },
  1156. regex: ".*$",
  1157. next: "start"
  1158. }]
  1159. }
  1160. }, {
  1161. regex : "$",
  1162. token : "empty",
  1163. next : function(currentState, stack) {
  1164. if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
  1165. return stack[0];
  1166. return currentState;
  1167. }
  1168. }, {
  1169. token : "string.character",
  1170. regex : "\\B\\?."
  1171. }, {
  1172. token : "keyword.operator",
  1173. regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
  1174. }, {
  1175. token : "paren.lparen",
  1176. regex : "[[({]"
  1177. }, {
  1178. token : "paren.rparen",
  1179. regex : "[\\])}]"
  1180. }, {
  1181. token : "text",
  1182. regex : "\\s+"
  1183. }
  1184. ],
  1185. "comment" : [
  1186. {
  1187. token : "comment", // closing comment
  1188. regex : "^=end(?:$|\\s.*$)",
  1189. next : "start"
  1190. }, {
  1191. token : "comment", // comment spanning whole line
  1192. regex : ".+"
  1193. }
  1194. ]
  1195. };
  1196. this.normalizeRules();
  1197. };
  1198. oop.inherits(RubyHighlightRules, TextHighlightRules);
  1199. exports.RubyHighlightRules = RubyHighlightRules;
  1200. });
  1201. ace.define("ace/mode/html_ruby_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/html_highlight_rules","ace/mode/ruby_highlight_rules"], function(acequire, exports, module) {
  1202. "use strict";
  1203. var oop = acequire("../lib/oop");
  1204. var HtmlHighlightRules = acequire("./html_highlight_rules").HtmlHighlightRules;
  1205. var RubyHighlightRules = acequire("./ruby_highlight_rules").RubyHighlightRules;
  1206. var HtmlRubyHighlightRules = function() {
  1207. HtmlHighlightRules.call(this);
  1208. var startRules = [
  1209. {
  1210. regex: "<%%|%%>",
  1211. token: "constant.language.escape"
  1212. }, {
  1213. token : "comment.start.erb",
  1214. regex : "<%#",
  1215. push : [{
  1216. token : "comment.end.erb",
  1217. regex: "%>",
  1218. next: "pop",
  1219. defaultToken:"comment"
  1220. }]
  1221. }, {
  1222. token : "support.ruby_tag",
  1223. regex : "<%+(?!>)[-=]?",
  1224. push : "ruby-start"
  1225. }
  1226. ];
  1227. var endRules = [
  1228. {
  1229. token : "support.ruby_tag",
  1230. regex : "%>",
  1231. next : "pop"
  1232. }, {
  1233. token: "comment",
  1234. regex: "#(?:[^%]|%[^>])*"
  1235. }
  1236. ];
  1237. for (var key in this.$rules)
  1238. this.$rules[key].unshift.apply(this.$rules[key], startRules);
  1239. this.embedRules(RubyHighlightRules, "ruby-", endRules, ["start"]);
  1240. this.normalizeRules();
  1241. };
  1242. oop.inherits(HtmlRubyHighlightRules, HtmlHighlightRules);
  1243. exports.HtmlRubyHighlightRules = HtmlRubyHighlightRules;
  1244. });
  1245. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(acequire, exports, module) {
  1246. "use strict";
  1247. var Range = acequire("../range").Range;
  1248. var MatchingBraceOutdent = function() {};
  1249. (function() {
  1250. this.checkOutdent = function(line, input) {
  1251. if (! /^\s+$/.test(line))
  1252. return false;
  1253. return /^\s*\}/.test(input);
  1254. };
  1255. this.autoOutdent = function(doc, row) {
  1256. var line = doc.getLine(row);
  1257. var match = line.match(/^(\s*\})/);
  1258. if (!match) return 0;
  1259. var column = match[1].length;
  1260. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  1261. if (!openBracePos || openBracePos.row == row) return 0;
  1262. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  1263. doc.replace(new Range(row, 0, row, column-1), indent);
  1264. };
  1265. this.$getIndent = function(line) {
  1266. return line.match(/^\s*/)[0];
  1267. };
  1268. }).call(MatchingBraceOutdent.prototype);
  1269. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  1270. });
  1271. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(acequire, exports, module) {
  1272. "use strict";
  1273. var oop = acequire("../../lib/oop");
  1274. var Range = acequire("../../range").Range;
  1275. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  1276. var FoldMode = exports.FoldMode = function(commentRegex) {
  1277. if (commentRegex) {
  1278. this.foldingStartMarker = new RegExp(
  1279. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  1280. );
  1281. this.foldingStopMarker = new RegExp(
  1282. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  1283. );
  1284. }
  1285. };
  1286. oop.inherits(FoldMode, BaseFoldMode);
  1287. (function() {
  1288. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  1289. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  1290. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  1291. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  1292. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  1293. this._getFoldWidgetBase = this.getFoldWidget;
  1294. this.getFoldWidget = function(session, foldStyle, row) {
  1295. var line = session.getLine(row);
  1296. if (this.singleLineBlockCommentRe.test(line)) {
  1297. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  1298. return "";
  1299. }
  1300. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  1301. if (!fw && this.startRegionRe.test(line))
  1302. return "start"; // lineCommentRegionStart
  1303. return fw;
  1304. };
  1305. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  1306. var line = session.getLine(row);
  1307. if (this.startRegionRe.test(line))
  1308. return this.getCommentRegionBlock(session, line, row);
  1309. var match = line.match(this.foldingStartMarker);
  1310. if (match) {
  1311. var i = match.index;
  1312. if (match[1])
  1313. return this.openingBracketBlock(session, match[1], row, i);
  1314. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  1315. if (range && !range.isMultiLine()) {
  1316. if (forceMultiline) {
  1317. range = this.getSectionRange(session, row);
  1318. } else if (foldStyle != "all")
  1319. range = null;
  1320. }
  1321. return range;
  1322. }
  1323. if (foldStyle === "markbegin")
  1324. return;
  1325. var match = line.match(this.foldingStopMarker);
  1326. if (match) {
  1327. var i = match.index + match[0].length;
  1328. if (match[1])
  1329. return this.closingBracketBlock(session, match[1], row, i);
  1330. return session.getCommentFoldRange(row, i, -1);
  1331. }
  1332. };
  1333. this.getSectionRange = function(session, row) {
  1334. var line = session.getLine(row);
  1335. var startIndent = line.search(/\S/);
  1336. var startRow = row;
  1337. var startColumn = line.length;
  1338. row = row + 1;
  1339. var endRow = row;
  1340. var maxRow = session.getLength();
  1341. while (++row < maxRow) {
  1342. line = session.getLine(row);
  1343. var indent = line.search(/\S/);
  1344. if (indent === -1)
  1345. continue;
  1346. if (startIndent > indent)
  1347. break;
  1348. var subRange = this.getFoldWidgetRange(session, "all", row);
  1349. if (subRange) {
  1350. if (subRange.start.row <= startRow) {
  1351. break;
  1352. } else if (subRange.isMultiLine()) {
  1353. row = subRange.end.row;
  1354. } else if (startIndent == indent) {
  1355. break;
  1356. }
  1357. }
  1358. endRow = row;
  1359. }
  1360. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  1361. };
  1362. this.getCommentRegionBlock = function(session, line, row) {
  1363. var startColumn = line.search(/\s*$/);
  1364. var maxRow = session.getLength();
  1365. var startRow = row;
  1366. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  1367. var depth = 1;
  1368. while (++row < maxRow) {
  1369. line = session.getLine(row);
  1370. var m = re.exec(line);
  1371. if (!m) continue;
  1372. if (m[1]) depth--;
  1373. else depth++;
  1374. if (!depth) break;
  1375. }
  1376. var endRow = row;
  1377. if (endRow > startRow) {
  1378. return new Range(startRow, startColumn, endRow, line.length);
  1379. }
  1380. };
  1381. }).call(FoldMode.prototype);
  1382. });
  1383. 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) {
  1384. "use strict";
  1385. var oop = acequire("../lib/oop");
  1386. var TextMode = acequire("./text").Mode;
  1387. var JavaScriptHighlightRules = acequire("./javascript_highlight_rules").JavaScriptHighlightRules;
  1388. var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent;
  1389. var WorkerClient = acequire("../worker/worker_client").WorkerClient;
  1390. var CstyleBehaviour = acequire("./behaviour/cstyle").CstyleBehaviour;
  1391. var CStyleFoldMode = acequire("./folding/cstyle").FoldMode;
  1392. var Mode = function() {
  1393. this.HighlightRules = JavaScriptHighlightRules;
  1394. this.$outdent = new MatchingBraceOutdent();
  1395. this.$behaviour = new CstyleBehaviour();
  1396. this.foldingRules = new CStyleFoldMode();
  1397. };
  1398. oop.inherits(Mode, TextMode);
  1399. (function() {
  1400. this.lineCommentStart = "//";
  1401. this.blockComment = {start: "/*", end: "*/"};
  1402. this.$quotes = {'"': '"', "'": "'", "`": "`"};
  1403. this.getNextLineIndent = function(state, line, tab) {
  1404. var indent = this.$getIndent(line);
  1405. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  1406. var tokens = tokenizedLine.tokens;
  1407. var endState = tokenizedLine.state;
  1408. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1409. return indent;
  1410. }
  1411. if (state == "start" || state == "no_regex") {
  1412. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  1413. if (match) {
  1414. indent += tab;
  1415. }
  1416. } else if (state == "doc-start") {
  1417. if (endState == "start" || endState == "no_regex") {
  1418. return "";
  1419. }
  1420. var match = line.match(/^\s*(\/?)\*/);
  1421. if (match) {
  1422. if (match[1]) {
  1423. indent += " ";
  1424. }
  1425. indent += "* ";
  1426. }
  1427. }
  1428. return indent;
  1429. };
  1430. this.checkOutdent = function(state, line, input) {
  1431. return this.$outdent.checkOutdent(line, input);
  1432. };
  1433. this.autoOutdent = function(state, doc, row) {
  1434. this.$outdent.autoOutdent(doc, row);
  1435. };
  1436. this.createWorker = function(session) {
  1437. var worker = new WorkerClient(["ace"], require("../worker/javascript"), "JavaScriptWorker");
  1438. worker.attachToDocument(session.getDocument());
  1439. worker.on("annotate", function(results) {
  1440. session.setAnnotations(results.data);
  1441. });
  1442. worker.on("terminate", function() {
  1443. session.clearAnnotations();
  1444. });
  1445. return worker;
  1446. };
  1447. this.$id = "ace/mode/javascript";
  1448. }).call(Mode.prototype);
  1449. exports.Mode = Mode;
  1450. });
  1451. ace.define("ace/mode/css_completions",["require","exports","module"], function(acequire, exports, module) {
  1452. "use strict";
  1453. var propertyMap = {
  1454. "background": {"#$0": 1},
  1455. "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
  1456. "background-image": {"url('/$0')": 1},
  1457. "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
  1458. "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
  1459. "background-attachment": {"scroll": 1, "fixed": 1},
  1460. "background-size": {"cover": 1, "contain": 1},
  1461. "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1462. "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1463. "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
  1464. "border-color": {"#$0": 1},
  1465. "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
  1466. "border-collapse": {"collapse": 1, "separate": 1},
  1467. "bottom": {"px": 1, "em": 1, "%": 1},
  1468. "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
  1469. "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
  1470. "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},
  1471. "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
  1472. "empty-cells": {"show": 1, "hide": 1},
  1473. "float": {"left": 1, "right": 1, "none": 1},
  1474. "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},
  1475. "font-size": {"px": 1, "em": 1, "%": 1},
  1476. "font-weight": {"bold": 1, "normal": 1},
  1477. "font-style": {"italic": 1, "normal": 1},
  1478. "font-variant": {"normal": 1, "small-caps": 1},
  1479. "height": {"px": 1, "em": 1, "%": 1},
  1480. "left": {"px": 1, "em": 1, "%": 1},
  1481. "letter-spacing": {"normal": 1},
  1482. "line-height": {"normal": 1},
  1483. "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},
  1484. "margin": {"px": 1, "em": 1, "%": 1},
  1485. "margin-right": {"px": 1, "em": 1, "%": 1},
  1486. "margin-left": {"px": 1, "em": 1, "%": 1},
  1487. "margin-top": {"px": 1, "em": 1, "%": 1},
  1488. "margin-bottom": {"px": 1, "em": 1, "%": 1},
  1489. "max-height": {"px": 1, "em": 1, "%": 1},
  1490. "max-width": {"px": 1, "em": 1, "%": 1},
  1491. "min-height": {"px": 1, "em": 1, "%": 1},
  1492. "min-width": {"px": 1, "em": 1, "%": 1},
  1493. "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1494. "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1495. "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1496. "padding": {"px": 1, "em": 1, "%": 1},
  1497. "padding-top": {"px": 1, "em": 1, "%": 1},
  1498. "padding-right": {"px": 1, "em": 1, "%": 1},
  1499. "padding-bottom": {"px": 1, "em": 1, "%": 1},
  1500. "padding-left": {"px": 1, "em": 1, "%": 1},
  1501. "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1502. "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1503. "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
  1504. "right": {"px": 1, "em": 1, "%": 1},
  1505. "table-layout": {"fixed": 1, "auto": 1},
  1506. "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
  1507. "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
  1508. "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
  1509. "top": {"px": 1, "em": 1, "%": 1},
  1510. "vertical-align": {"top": 1, "bottom": 1},
  1511. "visibility": {"hidden": 1, "visible": 1},
  1512. "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
  1513. "width": {"px": 1, "em": 1, "%": 1},
  1514. "word-spacing": {"normal": 1},
  1515. "filter": {"alpha(opacity=$0100)": 1},
  1516. "text-shadow": {"$02px 2px 2px #777": 1},
  1517. "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
  1518. "-moz-border-radius": 1,
  1519. "-moz-border-radius-topright": 1,
  1520. "-moz-border-radius-bottomright": 1,
  1521. "-moz-border-radius-topleft": 1,
  1522. "-moz-border-radius-bottomleft": 1,
  1523. "-webkit-border-radius": 1,
  1524. "-webkit-border-top-right-radius": 1,
  1525. "-webkit-border-top-left-radius": 1,
  1526. "-webkit-border-bottom-right-radius": 1,
  1527. "-webkit-border-bottom-left-radius": 1,
  1528. "-moz-box-shadow": 1,
  1529. "-webkit-box-shadow": 1,
  1530. "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1531. "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1532. "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
  1533. };
  1534. var CssCompletions = function() {
  1535. };
  1536. (function() {
  1537. this.completionsDefined = false;
  1538. this.defineCompletions = function() {
  1539. if (document) {
  1540. var style = document.createElement('c').style;
  1541. for (var i in style) {
  1542. if (typeof style[i] !== 'string')
  1543. continue;
  1544. var name = i.replace(/[A-Z]/g, function(x) {
  1545. return '-' + x.toLowerCase();
  1546. });
  1547. if (!propertyMap.hasOwnProperty(name))
  1548. propertyMap[name] = 1;
  1549. }
  1550. }
  1551. this.completionsDefined = true;
  1552. };
  1553. this.getCompletions = function(state, session, pos, prefix) {
  1554. if (!this.completionsDefined) {
  1555. this.defineCompletions();
  1556. }
  1557. var token = session.getTokenAt(pos.row, pos.column);
  1558. if (!token)
  1559. return [];
  1560. if (state==='ruleset'){
  1561. var line = session.getLine(pos.row).substr(0, pos.column);
  1562. if (/:[^;]+$/.test(line)) {
  1563. /([\w\-]+):[^:]*$/.test(line);
  1564. return this.getPropertyValueCompletions(state, session, pos, prefix);
  1565. } else {
  1566. return this.getPropertyCompletions(state, session, pos, prefix);
  1567. }
  1568. }
  1569. return [];
  1570. };
  1571. this.getPropertyCompletions = function(state, session, pos, prefix) {
  1572. var properties = Object.keys(propertyMap);
  1573. return properties.map(function(property){
  1574. return {
  1575. caption: property,
  1576. snippet: property + ': $0;',
  1577. meta: "property",
  1578. score: Number.MAX_VALUE
  1579. };
  1580. });
  1581. };
  1582. this.getPropertyValueCompletions = function(state, session, pos, prefix) {
  1583. var line = session.getLine(pos.row).substr(0, pos.column);
  1584. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  1585. if (!property)
  1586. return [];
  1587. var values = [];
  1588. if (property in propertyMap && typeof propertyMap[property] === "object") {
  1589. values = Object.keys(propertyMap[property]);
  1590. }
  1591. return values.map(function(value){
  1592. return {
  1593. caption: value,
  1594. snippet: value,
  1595. meta: "property value",
  1596. score: Number.MAX_VALUE
  1597. };
  1598. });
  1599. };
  1600. }).call(CssCompletions.prototype);
  1601. exports.CssCompletions = CssCompletions;
  1602. });
  1603. 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) {
  1604. "use strict";
  1605. var oop = acequire("../../lib/oop");
  1606. var Behaviour = acequire("../behaviour").Behaviour;
  1607. var CstyleBehaviour = acequire("./cstyle").CstyleBehaviour;
  1608. var TokenIterator = acequire("../../token_iterator").TokenIterator;
  1609. var CssBehaviour = function () {
  1610. this.inherit(CstyleBehaviour);
  1611. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1612. if (text === ':') {
  1613. var cursor = editor.getCursorPosition();
  1614. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1615. var token = iterator.getCurrentToken();
  1616. if (token && token.value.match(/\s+/)) {
  1617. token = iterator.stepBackward();
  1618. }
  1619. if (token && token.type === 'support.type') {
  1620. var line = session.doc.getLine(cursor.row);
  1621. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1622. if (rightChar === ':') {
  1623. return {
  1624. text: '',
  1625. selection: [1, 1]
  1626. };
  1627. }
  1628. if (!line.substring(cursor.column).match(/^\s*;/)) {
  1629. return {
  1630. text: ':;',
  1631. selection: [1, 1]
  1632. };
  1633. }
  1634. }
  1635. }
  1636. });
  1637. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1638. var selected = session.doc.getTextRange(range);
  1639. if (!range.isMultiLine() && selected === ':') {
  1640. var cursor = editor.getCursorPosition();
  1641. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1642. var token = iterator.getCurrentToken();
  1643. if (token && token.value.match(/\s+/)) {
  1644. token = iterator.stepBackward();
  1645. }
  1646. if (token && token.type === 'support.type') {
  1647. var line = session.doc.getLine(range.start.row);
  1648. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1649. if (rightChar === ';') {
  1650. range.end.column ++;
  1651. return range;
  1652. }
  1653. }
  1654. }
  1655. });
  1656. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1657. if (text === ';') {
  1658. var cursor = editor.getCursorPosition();
  1659. var line = session.doc.getLine(cursor.row);
  1660. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1661. if (rightChar === ';') {
  1662. return {
  1663. text: '',
  1664. selection: [1, 1]
  1665. };
  1666. }
  1667. }
  1668. });
  1669. };
  1670. oop.inherits(CssBehaviour, CstyleBehaviour);
  1671. exports.CssBehaviour = CssBehaviour;
  1672. });
  1673. 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) {
  1674. "use strict";
  1675. var oop = acequire("../lib/oop");
  1676. var TextMode = acequire("./text").Mode;
  1677. var CssHighlightRules = acequire("./css_highlight_rules").CssHighlightRules;
  1678. var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent;
  1679. var WorkerClient = acequire("../worker/worker_client").WorkerClient;
  1680. var CssCompletions = acequire("./css_completions").CssCompletions;
  1681. var CssBehaviour = acequire("./behaviour/css").CssBehaviour;
  1682. var CStyleFoldMode = acequire("./folding/cstyle").FoldMode;
  1683. var Mode = function() {
  1684. this.HighlightRules = CssHighlightRules;
  1685. this.$outdent = new MatchingBraceOutdent();
  1686. this.$behaviour = new CssBehaviour();
  1687. this.$completer = new CssCompletions();
  1688. this.foldingRules = new CStyleFoldMode();
  1689. };
  1690. oop.inherits(Mode, TextMode);
  1691. (function() {
  1692. this.foldingRules = "cStyle";
  1693. this.blockComment = {start: "/*", end: "*/"};
  1694. this.getNextLineIndent = function(state, line, tab) {
  1695. var indent = this.$getIndent(line);
  1696. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1697. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1698. return indent;
  1699. }
  1700. var match = line.match(/^.*\{\s*$/);
  1701. if (match) {
  1702. indent += tab;
  1703. }
  1704. return indent;
  1705. };
  1706. this.checkOutdent = function(state, line, input) {
  1707. return this.$outdent.checkOutdent(line, input);
  1708. };
  1709. this.autoOutdent = function(state, doc, row) {
  1710. this.$outdent.autoOutdent(doc, row);
  1711. };
  1712. this.getCompletions = function(state, session, pos, prefix) {
  1713. return this.$completer.getCompletions(state, session, pos, prefix);
  1714. };
  1715. this.createWorker = function(session) {
  1716. var worker = new WorkerClient(["ace"], require("../worker/css"), "Worker");
  1717. worker.attachToDocument(session.getDocument());
  1718. worker.on("annotate", function(e) {
  1719. session.setAnnotations(e.data);
  1720. });
  1721. worker.on("terminate", function() {
  1722. session.clearAnnotations();
  1723. });
  1724. return worker;
  1725. };
  1726. this.$id = "ace/mode/css";
  1727. }).call(Mode.prototype);
  1728. exports.Mode = Mode;
  1729. });
  1730. 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) {
  1731. "use strict";
  1732. var oop = acequire("../../lib/oop");
  1733. var Behaviour = acequire("../behaviour").Behaviour;
  1734. var TokenIterator = acequire("../../token_iterator").TokenIterator;
  1735. var lang = acequire("../../lib/lang");
  1736. function is(token, type) {
  1737. return token.type.lastIndexOf(type + ".xml") > -1;
  1738. }
  1739. var XmlBehaviour = function () {
  1740. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  1741. if (text == '"' || text == "'") {
  1742. var quote = text;
  1743. var selected = session.doc.getTextRange(editor.getSelectionRange());
  1744. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  1745. return {
  1746. text: quote + selected + quote,
  1747. selection: false
  1748. };
  1749. }
  1750. var cursor = editor.getCursorPosition();
  1751. var line = session.doc.getLine(cursor.row);
  1752. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1753. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1754. var token = iterator.getCurrentToken();
  1755. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  1756. return {
  1757. text: "",
  1758. selection: [1, 1]
  1759. };
  1760. }
  1761. if (!token)
  1762. token = iterator.stepBackward();
  1763. if (!token)
  1764. return;
  1765. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  1766. token = iterator.stepBackward();
  1767. }
  1768. var rightSpace = !rightChar || rightChar.match(/\s/);
  1769. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  1770. return {
  1771. text: quote + quote,
  1772. selection: [1, 1]
  1773. };
  1774. }
  1775. }
  1776. });
  1777. this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
  1778. var selected = session.doc.getTextRange(range);
  1779. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  1780. var line = session.doc.getLine(range.start.row);
  1781. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  1782. if (rightChar == selected) {
  1783. range.end.column++;
  1784. return range;
  1785. }
  1786. }
  1787. });
  1788. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  1789. if (text == '>') {
  1790. var position = editor.getSelectionRange().start;
  1791. var iterator = new TokenIterator(session, position.row, position.column);
  1792. var token = iterator.getCurrentToken() || iterator.stepBackward();
  1793. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  1794. return;
  1795. if (is(token, "reference.attribute-value"))
  1796. return;
  1797. if (is(token, "attribute-value")) {
  1798. var firstChar = token.value.charAt(0);
  1799. if (firstChar == '"' || firstChar == "'") {
  1800. var lastChar = token.value.charAt(token.value.length - 1);
  1801. var tokenEnd = iterator.getCurrentTokenColumn() + token.value.length;
  1802. if (tokenEnd > position.column || tokenEnd == position.column && firstChar != lastChar)
  1803. return;
  1804. }
  1805. }
  1806. while (!is(token, "tag-name")) {
  1807. token = iterator.stepBackward();
  1808. if (token.value == "<") {
  1809. token = iterator.stepForward();
  1810. break;
  1811. }
  1812. }
  1813. var tokenRow = iterator.getCurrentTokenRow();
  1814. var tokenColumn = iterator.getCurrentTokenColumn();
  1815. if (is(iterator.stepBackward(), "end-tag-open"))
  1816. return;
  1817. var element = token.value;
  1818. if (tokenRow == position.row)
  1819. element = element.substring(0, position.column - tokenColumn);
  1820. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  1821. return;
  1822. return {
  1823. text: ">" + "</" + element + ">",
  1824. selection: [1, 1]
  1825. };
  1826. }
  1827. });
  1828. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  1829. if (text == "\n") {
  1830. var cursor = editor.getCursorPosition();
  1831. var line = session.getLine(cursor.row);
  1832. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1833. var token = iterator.getCurrentToken();
  1834. if (token && token.type.indexOf("tag-close") !== -1) {
  1835. if (token.value == "/>")
  1836. return;
  1837. while (token && token.type.indexOf("tag-name") === -1) {
  1838. token = iterator.stepBackward();
  1839. }
  1840. if (!token) {
  1841. return;
  1842. }
  1843. var tag = token.value;
  1844. var row = iterator.getCurrentTokenRow();
  1845. token = iterator.stepBackward();
  1846. if (!token || token.type.indexOf("end-tag") !== -1) {
  1847. return;
  1848. }
  1849. if (this.voidElements && !this.voidElements[tag]) {
  1850. var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
  1851. var line = session.getLine(row);
  1852. var nextIndent = this.$getIndent(line);
  1853. var indent = nextIndent + session.getTabString();
  1854. if (nextToken && nextToken.value === "</") {
  1855. return {
  1856. text: "\n" + indent + "\n" + nextIndent,
  1857. selection: [1, indent.length, 1, indent.length]
  1858. };
  1859. } else {
  1860. return {
  1861. text: "\n" + indent
  1862. };
  1863. }
  1864. }
  1865. }
  1866. }
  1867. });
  1868. };
  1869. oop.inherits(XmlBehaviour, Behaviour);
  1870. exports.XmlBehaviour = XmlBehaviour;
  1871. });
  1872. ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(acequire, exports, module) {
  1873. "use strict";
  1874. var oop = acequire("../../lib/oop");
  1875. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  1876. var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
  1877. this.defaultMode = defaultMode;
  1878. this.subModes = subModes;
  1879. };
  1880. oop.inherits(FoldMode, BaseFoldMode);
  1881. (function() {
  1882. this.$getMode = function(state) {
  1883. if (typeof state != "string")
  1884. state = state[0];
  1885. for (var key in this.subModes) {
  1886. if (state.indexOf(key) === 0)
  1887. return this.subModes[key];
  1888. }
  1889. return null;
  1890. };
  1891. this.$tryMode = function(state, session, foldStyle, row) {
  1892. var mode = this.$getMode(state);
  1893. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  1894. };
  1895. this.getFoldWidget = function(session, foldStyle, row) {
  1896. return (
  1897. this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
  1898. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  1899. this.defaultMode.getFoldWidget(session, foldStyle, row)
  1900. );
  1901. };
  1902. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1903. var mode = this.$getMode(session.getState(row-1));
  1904. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1905. mode = this.$getMode(session.getState(row));
  1906. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1907. mode = this.defaultMode;
  1908. return mode.getFoldWidgetRange(session, foldStyle, row);
  1909. };
  1910. }).call(FoldMode.prototype);
  1911. });
  1912. 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) {
  1913. "use strict";
  1914. var oop = acequire("../../lib/oop");
  1915. var lang = acequire("../../lib/lang");
  1916. var Range = acequire("../../range").Range;
  1917. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  1918. var TokenIterator = acequire("../../token_iterator").TokenIterator;
  1919. var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
  1920. BaseFoldMode.call(this);
  1921. this.voidElements = voidElements || {};
  1922. this.optionalEndTags = oop.mixin({}, this.voidElements);
  1923. if (optionalEndTags)
  1924. oop.mixin(this.optionalEndTags, optionalEndTags);
  1925. };
  1926. oop.inherits(FoldMode, BaseFoldMode);
  1927. var Tag = function() {
  1928. this.tagName = "";
  1929. this.closing = false;
  1930. this.selfClosing = false;
  1931. this.start = {row: 0, column: 0};
  1932. this.end = {row: 0, column: 0};
  1933. };
  1934. function is(token, type) {
  1935. return token.type.lastIndexOf(type + ".xml") > -1;
  1936. }
  1937. (function() {
  1938. this.getFoldWidget = function(session, foldStyle, row) {
  1939. var tag = this._getFirstTagInLine(session, row);
  1940. if (!tag)
  1941. return this.getCommentFoldWidget(session, row);
  1942. if (tag.closing || (!tag.tagName && tag.selfClosing))
  1943. return foldStyle == "markbeginend" ? "end" : "";
  1944. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  1945. return "";
  1946. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  1947. return "";
  1948. return "start";
  1949. };
  1950. this.getCommentFoldWidget = function(session, row) {
  1951. if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
  1952. return "start";
  1953. return "";
  1954. };
  1955. this._getFirstTagInLine = function(session, row) {
  1956. var tokens = session.getTokens(row);
  1957. var tag = new Tag();
  1958. for (var i = 0; i < tokens.length; i++) {
  1959. var token = tokens[i];
  1960. if (is(token, "tag-open")) {
  1961. tag.end.column = tag.start.column + token.value.length;
  1962. tag.closing = is(token, "end-tag-open");
  1963. token = tokens[++i];
  1964. if (!token)
  1965. return null;
  1966. tag.tagName = token.value;
  1967. tag.end.column += token.value.length;
  1968. for (i++; i < tokens.length; i++) {
  1969. token = tokens[i];
  1970. tag.end.column += token.value.length;
  1971. if (is(token, "tag-close")) {
  1972. tag.selfClosing = token.value == '/>';
  1973. break;
  1974. }
  1975. }
  1976. return tag;
  1977. } else if (is(token, "tag-close")) {
  1978. tag.selfClosing = token.value == '/>';
  1979. return tag;
  1980. }
  1981. tag.start.column += token.value.length;
  1982. }
  1983. return null;
  1984. };
  1985. this._findEndTagInLine = function(session, row, tagName, startColumn) {
  1986. var tokens = session.getTokens(row);
  1987. var column = 0;
  1988. for (var i = 0; i < tokens.length; i++) {
  1989. var token = tokens[i];
  1990. column += token.value.length;
  1991. if (column < startColumn)
  1992. continue;
  1993. if (is(token, "end-tag-open")) {
  1994. token = tokens[i + 1];
  1995. if (token && token.value == tagName)
  1996. return true;
  1997. }
  1998. }
  1999. return false;
  2000. };
  2001. this._readTagForward = function(iterator) {
  2002. var token = iterator.getCurrentToken();
  2003. if (!token)
  2004. return null;
  2005. var tag = new Tag();
  2006. do {
  2007. if (is(token, "tag-open")) {
  2008. tag.closing = is(token, "end-tag-open");
  2009. tag.start.row = iterator.getCurrentTokenRow();
  2010. tag.start.column = iterator.getCurrentTokenColumn();
  2011. } else if (is(token, "tag-name")) {
  2012. tag.tagName = token.value;
  2013. } else if (is(token, "tag-close")) {
  2014. tag.selfClosing = token.value == "/>";
  2015. tag.end.row = iterator.getCurrentTokenRow();
  2016. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  2017. iterator.stepForward();
  2018. return tag;
  2019. }
  2020. } while(token = iterator.stepForward());
  2021. return null;
  2022. };
  2023. this._readTagBackward = function(iterator) {
  2024. var token = iterator.getCurrentToken();
  2025. if (!token)
  2026. return null;
  2027. var tag = new Tag();
  2028. do {
  2029. if (is(token, "tag-open")) {
  2030. tag.closing = is(token, "end-tag-open");
  2031. tag.start.row = iterator.getCurrentTokenRow();
  2032. tag.start.column = iterator.getCurrentTokenColumn();
  2033. iterator.stepBackward();
  2034. return tag;
  2035. } else if (is(token, "tag-name")) {
  2036. tag.tagName = token.value;
  2037. } else if (is(token, "tag-close")) {
  2038. tag.selfClosing = token.value == "/>";
  2039. tag.end.row = iterator.getCurrentTokenRow();
  2040. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  2041. }
  2042. } while(token = iterator.stepBackward());
  2043. return null;
  2044. };
  2045. this._pop = function(stack, tag) {
  2046. while (stack.length) {
  2047. var top = stack[stack.length-1];
  2048. if (!tag || top.tagName == tag.tagName) {
  2049. return stack.pop();
  2050. }
  2051. else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
  2052. stack.pop();
  2053. continue;
  2054. } else {
  2055. return null;
  2056. }
  2057. }
  2058. };
  2059. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2060. var firstTag = this._getFirstTagInLine(session, row);
  2061. if (!firstTag) {
  2062. return this.getCommentFoldWidget(session, row)
  2063. && session.getCommentFoldRange(row, session.getLine(row).length);
  2064. }
  2065. var isBackward = firstTag.closing || firstTag.selfClosing;
  2066. var stack = [];
  2067. var tag;
  2068. if (!isBackward) {
  2069. var iterator = new TokenIterator(session, row, firstTag.start.column);
  2070. var start = {
  2071. row: row,
  2072. column: firstTag.start.column + firstTag.tagName.length + 2
  2073. };
  2074. if (firstTag.start.row == firstTag.end.row)
  2075. start.column = firstTag.end.column;
  2076. while (tag = this._readTagForward(iterator)) {
  2077. if (tag.selfClosing) {
  2078. if (!stack.length) {
  2079. tag.start.column += tag.tagName.length + 2;
  2080. tag.end.column -= 2;
  2081. return Range.fromPoints(tag.start, tag.end);
  2082. } else
  2083. continue;
  2084. }
  2085. if (tag.closing) {
  2086. this._pop(stack, tag);
  2087. if (stack.length == 0)
  2088. return Range.fromPoints(start, tag.start);
  2089. }
  2090. else {
  2091. stack.push(tag);
  2092. }
  2093. }
  2094. }
  2095. else {
  2096. var iterator = new TokenIterator(session, row, firstTag.end.column);
  2097. var end = {
  2098. row: row,
  2099. column: firstTag.start.column
  2100. };
  2101. while (tag = this._readTagBackward(iterator)) {
  2102. if (tag.selfClosing) {
  2103. if (!stack.length) {
  2104. tag.start.column += tag.tagName.length + 2;
  2105. tag.end.column -= 2;
  2106. return Range.fromPoints(tag.start, tag.end);
  2107. } else
  2108. continue;
  2109. }
  2110. if (!tag.closing) {
  2111. this._pop(stack, tag);
  2112. if (stack.length == 0) {
  2113. tag.start.column += tag.tagName.length + 2;
  2114. if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
  2115. tag.start.column = tag.end.column;
  2116. return Range.fromPoints(tag.start, end);
  2117. }
  2118. }
  2119. else {
  2120. stack.push(tag);
  2121. }
  2122. }
  2123. }
  2124. };
  2125. }).call(FoldMode.prototype);
  2126. });
  2127. 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) {
  2128. "use strict";
  2129. var oop = acequire("../../lib/oop");
  2130. var MixedFoldMode = acequire("./mixed").FoldMode;
  2131. var XmlFoldMode = acequire("./xml").FoldMode;
  2132. var CStyleFoldMode = acequire("./cstyle").FoldMode;
  2133. var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
  2134. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  2135. "js-": new CStyleFoldMode(),
  2136. "css-": new CStyleFoldMode()
  2137. });
  2138. };
  2139. oop.inherits(FoldMode, MixedFoldMode);
  2140. });
  2141. ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(acequire, exports, module) {
  2142. "use strict";
  2143. var TokenIterator = acequire("../token_iterator").TokenIterator;
  2144. var commonAttributes = [
  2145. "accesskey",
  2146. "class",
  2147. "contenteditable",
  2148. "contextmenu",
  2149. "dir",
  2150. "draggable",
  2151. "dropzone",
  2152. "hidden",
  2153. "id",
  2154. "inert",
  2155. "itemid",
  2156. "itemprop",
  2157. "itemref",
  2158. "itemscope",
  2159. "itemtype",
  2160. "lang",
  2161. "spellcheck",
  2162. "style",
  2163. "tabindex",
  2164. "title",
  2165. "translate"
  2166. ];
  2167. var eventAttributes = [
  2168. "onabort",
  2169. "onblur",
  2170. "oncancel",
  2171. "oncanplay",
  2172. "oncanplaythrough",
  2173. "onchange",
  2174. "onclick",
  2175. "onclose",
  2176. "oncontextmenu",
  2177. "oncuechange",
  2178. "ondblclick",
  2179. "ondrag",
  2180. "ondragend",
  2181. "ondragenter",
  2182. "ondragleave",
  2183. "ondragover",
  2184. "ondragstart",
  2185. "ondrop",
  2186. "ondurationchange",
  2187. "onemptied",
  2188. "onended",
  2189. "onerror",
  2190. "onfocus",
  2191. "oninput",
  2192. "oninvalid",
  2193. "onkeydown",
  2194. "onkeypress",
  2195. "onkeyup",
  2196. "onload",
  2197. "onloadeddata",
  2198. "onloadedmetadata",
  2199. "onloadstart",
  2200. "onmousedown",
  2201. "onmousemove",
  2202. "onmouseout",
  2203. "onmouseover",
  2204. "onmouseup",
  2205. "onmousewheel",
  2206. "onpause",
  2207. "onplay",
  2208. "onplaying",
  2209. "onprogress",
  2210. "onratechange",
  2211. "onreset",
  2212. "onscroll",
  2213. "onseeked",
  2214. "onseeking",
  2215. "onselect",
  2216. "onshow",
  2217. "onstalled",
  2218. "onsubmit",
  2219. "onsuspend",
  2220. "ontimeupdate",
  2221. "onvolumechange",
  2222. "onwaiting"
  2223. ];
  2224. var globalAttributes = commonAttributes.concat(eventAttributes);
  2225. var attributeMap = {
  2226. "html": {"manifest": 1},
  2227. "head": {},
  2228. "title": {},
  2229. "base": {"href": 1, "target": 1},
  2230. "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},
  2231. "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
  2232. "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
  2233. "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
  2234. "noscript": {"href": 1},
  2235. "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},
  2236. "section": {},
  2237. "nav": {},
  2238. "article": {"pubdate": 1},
  2239. "aside": {},
  2240. "h1": {},
  2241. "h2": {},
  2242. "h3": {},
  2243. "h4": {},
  2244. "h5": {},
  2245. "h6": {},
  2246. "header": {},
  2247. "footer": {},
  2248. "address": {},
  2249. "main": {},
  2250. "p": {},
  2251. "hr": {},
  2252. "pre": {},
  2253. "blockquote": {"cite": 1},
  2254. "ol": {"start": 1, "reversed": 1},
  2255. "ul": {},
  2256. "li": {"value": 1},
  2257. "dl": {},
  2258. "dt": {},
  2259. "dd": {},
  2260. "figure": {},
  2261. "figcaption": {},
  2262. "div": {},
  2263. "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},
  2264. "em": {},
  2265. "strong": {},
  2266. "small": {},
  2267. "s": {},
  2268. "cite": {},
  2269. "q": {"cite": 1},
  2270. "dfn": {},
  2271. "abbr": {},
  2272. "data": {},
  2273. "time": {"datetime": 1},
  2274. "code": {},
  2275. "var": {},
  2276. "samp": {},
  2277. "kbd": {},
  2278. "sub": {},
  2279. "sup": {},
  2280. "i": {},
  2281. "b": {},
  2282. "u": {},
  2283. "mark": {},
  2284. "ruby": {},
  2285. "rt": {},
  2286. "rp": {},
  2287. "bdi": {},
  2288. "bdo": {},
  2289. "span": {},
  2290. "br": {},
  2291. "wbr": {},
  2292. "ins": {"cite": 1, "datetime": 1},
  2293. "del": {"cite": 1, "datetime": 1},
  2294. "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
  2295. "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}},
  2296. "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
  2297. "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
  2298. "param": {"name": 1, "value": 1},
  2299. "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}},
  2300. "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
  2301. "source": {"src": 1, "type": 1, "media": 1},
  2302. "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
  2303. "canvas": {"width": 1, "height": 1},
  2304. "map": {"name": 1},
  2305. "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
  2306. "svg": {},
  2307. "math": {},
  2308. "table": {"summary": 1},
  2309. "caption": {},
  2310. "colgroup": {"span": 1},
  2311. "col": {"span": 1},
  2312. "tbody": {},
  2313. "thead": {},
  2314. "tfoot": {},
  2315. "tr": {},
  2316. "td": {"headers": 1, "rowspan": 1, "colspan": 1},
  2317. "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
  2318. "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}},
  2319. "fieldset": {"disabled": 1, "form": 1, "name": 1},
  2320. "legend": {},
  2321. "label": {"form": 1, "for": 1},
  2322. "input": {
  2323. "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},
  2324. "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},
  2325. "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}},
  2326. "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
  2327. "datalist": {},
  2328. "optgroup": {"disabled": 1, "label": 1},
  2329. "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
  2330. "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}},
  2331. "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
  2332. "output": {"for": 1, "form": 1, "name": 1},
  2333. "progress": {"value": 1, "max": 1},
  2334. "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
  2335. "details": {"open": 1},
  2336. "summary": {},
  2337. "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
  2338. "menu": {"type": 1, "label": 1},
  2339. "dialog": {"open": 1}
  2340. };
  2341. var elements = Object.keys(attributeMap);
  2342. function is(token, type) {
  2343. return token.type.lastIndexOf(type + ".xml") > -1;
  2344. }
  2345. function findTagName(session, pos) {
  2346. var iterator = new TokenIterator(session, pos.row, pos.column);
  2347. var token = iterator.getCurrentToken();
  2348. while (token && !is(token, "tag-name")){
  2349. token = iterator.stepBackward();
  2350. }
  2351. if (token)
  2352. return token.value;
  2353. }
  2354. function findAttributeName(session, pos) {
  2355. var iterator = new TokenIterator(session, pos.row, pos.column);
  2356. var token = iterator.getCurrentToken();
  2357. while (token && !is(token, "attribute-name")){
  2358. token = iterator.stepBackward();
  2359. }
  2360. if (token)
  2361. return token.value;
  2362. }
  2363. var HtmlCompletions = function() {
  2364. };
  2365. (function() {
  2366. this.getCompletions = function(state, session, pos, prefix) {
  2367. var token = session.getTokenAt(pos.row, pos.column);
  2368. if (!token)
  2369. return [];
  2370. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2371. return this.getTagCompletions(state, session, pos, prefix);
  2372. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2373. return this.getAttributeCompletions(state, session, pos, prefix);
  2374. if (is(token, "attribute-value"))
  2375. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2376. var line = session.getLine(pos.row).substr(0, pos.column);
  2377. if (/&[a-z]*$/i.test(line))
  2378. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2379. return [];
  2380. };
  2381. this.getTagCompletions = function(state, session, pos, prefix) {
  2382. return elements.map(function(element){
  2383. return {
  2384. value: element,
  2385. meta: "tag",
  2386. score: Number.MAX_VALUE
  2387. };
  2388. });
  2389. };
  2390. this.getAttributeCompletions = function(state, session, pos, prefix) {
  2391. var tagName = findTagName(session, pos);
  2392. if (!tagName)
  2393. return [];
  2394. var attributes = globalAttributes;
  2395. if (tagName in attributeMap) {
  2396. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2397. }
  2398. return attributes.map(function(attribute){
  2399. return {
  2400. caption: attribute,
  2401. snippet: attribute + '="$0"',
  2402. meta: "attribute",
  2403. score: Number.MAX_VALUE
  2404. };
  2405. });
  2406. };
  2407. this.getAttributeValueCompletions = function(state, session, pos, prefix) {
  2408. var tagName = findTagName(session, pos);
  2409. var attributeName = findAttributeName(session, pos);
  2410. if (!tagName)
  2411. return [];
  2412. var values = [];
  2413. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2414. values = Object.keys(attributeMap[tagName][attributeName]);
  2415. }
  2416. return values.map(function(value){
  2417. return {
  2418. caption: value,
  2419. snippet: value,
  2420. meta: "attribute value",
  2421. score: Number.MAX_VALUE
  2422. };
  2423. });
  2424. };
  2425. this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
  2426. 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;'];
  2427. return values.map(function(value){
  2428. return {
  2429. caption: value,
  2430. snippet: value,
  2431. meta: "html entity",
  2432. score: Number.MAX_VALUE
  2433. };
  2434. });
  2435. };
  2436. }).call(HtmlCompletions.prototype);
  2437. exports.HtmlCompletions = HtmlCompletions;
  2438. });
  2439. 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) {
  2440. "use strict";
  2441. var oop = acequire("../lib/oop");
  2442. var lang = acequire("../lib/lang");
  2443. var TextMode = acequire("./text").Mode;
  2444. var JavaScriptMode = acequire("./javascript").Mode;
  2445. var CssMode = acequire("./css").Mode;
  2446. var HtmlHighlightRules = acequire("./html_highlight_rules").HtmlHighlightRules;
  2447. var XmlBehaviour = acequire("./behaviour/xml").XmlBehaviour;
  2448. var HtmlFoldMode = acequire("./folding/html").FoldMode;
  2449. var HtmlCompletions = acequire("./html_completions").HtmlCompletions;
  2450. var WorkerClient = acequire("../worker/worker_client").WorkerClient;
  2451. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2452. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2453. var Mode = function(options) {
  2454. this.fragmentContext = options && options.fragmentContext;
  2455. this.HighlightRules = HtmlHighlightRules;
  2456. this.$behaviour = new XmlBehaviour();
  2457. this.$completer = new HtmlCompletions();
  2458. this.createModeDelegates({
  2459. "js-": JavaScriptMode,
  2460. "css-": CssMode
  2461. });
  2462. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2463. };
  2464. oop.inherits(Mode, TextMode);
  2465. (function() {
  2466. this.blockComment = {start: "<!--", end: "-->"};
  2467. this.voidElements = lang.arrayToMap(voidElements);
  2468. this.getNextLineIndent = function(state, line, tab) {
  2469. return this.$getIndent(line);
  2470. };
  2471. this.checkOutdent = function(state, line, input) {
  2472. return false;
  2473. };
  2474. this.getCompletions = function(state, session, pos, prefix) {
  2475. return this.$completer.getCompletions(state, session, pos, prefix);
  2476. };
  2477. this.createWorker = function(session) {
  2478. if (this.constructor != Mode)
  2479. return;
  2480. var worker = new WorkerClient(["ace"], require("../worker/html"), "Worker");
  2481. worker.attachToDocument(session.getDocument());
  2482. if (this.fragmentContext)
  2483. worker.call("setOptions", [{context: this.fragmentContext}]);
  2484. worker.on("error", function(e) {
  2485. session.setAnnotations(e.data);
  2486. });
  2487. worker.on("terminate", function() {
  2488. session.clearAnnotations();
  2489. });
  2490. return worker;
  2491. };
  2492. this.$id = "ace/mode/html";
  2493. }).call(Mode.prototype);
  2494. exports.Mode = Mode;
  2495. });
  2496. ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(acequire, exports, module) {
  2497. "use strict";
  2498. var oop = acequire("../../lib/oop");
  2499. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  2500. var Range = acequire("../../range").Range;
  2501. var FoldMode = exports.FoldMode = function() {};
  2502. oop.inherits(FoldMode, BaseFoldMode);
  2503. (function() {
  2504. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2505. var range = this.indentationBlock(session, row);
  2506. if (range)
  2507. return range;
  2508. var re = /\S/;
  2509. var line = session.getLine(row);
  2510. var startLevel = line.search(re);
  2511. if (startLevel == -1 || line[startLevel] != "#")
  2512. return;
  2513. var startColumn = line.length;
  2514. var maxRow = session.getLength();
  2515. var startRow = row;
  2516. var endRow = row;
  2517. while (++row < maxRow) {
  2518. line = session.getLine(row);
  2519. var level = line.search(re);
  2520. if (level == -1)
  2521. continue;
  2522. if (line[level] != "#")
  2523. break;
  2524. endRow = row;
  2525. }
  2526. if (endRow > startRow) {
  2527. var endColumn = session.getLine(endRow).length;
  2528. return new Range(startRow, startColumn, endRow, endColumn);
  2529. }
  2530. };
  2531. this.getFoldWidget = function(session, foldStyle, row) {
  2532. var line = session.getLine(row);
  2533. var indent = line.search(/\S/);
  2534. var next = session.getLine(row + 1);
  2535. var prev = session.getLine(row - 1);
  2536. var prevIndent = prev.search(/\S/);
  2537. var nextIndent = next.search(/\S/);
  2538. if (indent == -1) {
  2539. session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
  2540. return "";
  2541. }
  2542. if (prevIndent == -1) {
  2543. if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
  2544. session.foldWidgets[row - 1] = "";
  2545. session.foldWidgets[row + 1] = "";
  2546. return "start";
  2547. }
  2548. } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
  2549. if (session.getLine(row - 2).search(/\S/) == -1) {
  2550. session.foldWidgets[row - 1] = "start";
  2551. session.foldWidgets[row + 1] = "";
  2552. return "";
  2553. }
  2554. }
  2555. if (prevIndent!= -1 && prevIndent < indent)
  2556. session.foldWidgets[row - 1] = "start";
  2557. else
  2558. session.foldWidgets[row - 1] = "";
  2559. if (indent < nextIndent)
  2560. return "start";
  2561. else
  2562. return "";
  2563. };
  2564. }).call(FoldMode.prototype);
  2565. });
  2566. ace.define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/coffee"], function(acequire, exports, module) {
  2567. "use strict";
  2568. var oop = acequire("../lib/oop");
  2569. var TextMode = acequire("./text").Mode;
  2570. var RubyHighlightRules = acequire("./ruby_highlight_rules").RubyHighlightRules;
  2571. var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent;
  2572. var Range = acequire("../range").Range;
  2573. var CstyleBehaviour = acequire("./behaviour/cstyle").CstyleBehaviour;
  2574. var FoldMode = acequire("./folding/coffee").FoldMode;
  2575. var Mode = function() {
  2576. this.HighlightRules = RubyHighlightRules;
  2577. this.$outdent = new MatchingBraceOutdent();
  2578. this.$behaviour = new CstyleBehaviour();
  2579. this.foldingRules = new FoldMode();
  2580. };
  2581. oop.inherits(Mode, TextMode);
  2582. (function() {
  2583. this.lineCommentStart = "#";
  2584. this.getNextLineIndent = function(state, line, tab) {
  2585. var indent = this.$getIndent(line);
  2586. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  2587. var tokens = tokenizedLine.tokens;
  2588. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  2589. return indent;
  2590. }
  2591. if (state == "start") {
  2592. var match = line.match(/^.*[\{\(\[]\s*$/);
  2593. var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/);
  2594. var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/);
  2595. var startingConditional = line.match(/^\s*(if|else|when)\s*/);
  2596. if (match || startingClassOrMethod || startingDoBlock || startingConditional) {
  2597. indent += tab;
  2598. }
  2599. }
  2600. return indent;
  2601. };
  2602. this.checkOutdent = function(state, line, input) {
  2603. return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input);
  2604. };
  2605. this.autoOutdent = function(state, session, row) {
  2606. var line = session.getLine(row);
  2607. if (/}/.test(line))
  2608. return this.$outdent.autoOutdent(session, row);
  2609. var indent = this.$getIndent(line);
  2610. var prevLine = session.getLine(row - 1);
  2611. var prevIndent = this.$getIndent(prevLine);
  2612. var tab = session.getTabString();
  2613. if (prevIndent.length <= indent.length) {
  2614. if (indent.slice(-tab.length) == tab)
  2615. session.remove(new Range(row, indent.length-tab.length, row, indent.length));
  2616. }
  2617. };
  2618. this.$id = "ace/mode/ruby";
  2619. }).call(Mode.prototype);
  2620. exports.Mode = Mode;
  2621. });
  2622. ace.define("ace/mode/html_ruby",["require","exports","module","ace/lib/oop","ace/mode/html_ruby_highlight_rules","ace/mode/html","ace/mode/javascript","ace/mode/css","ace/mode/ruby"], function(acequire, exports, module) {
  2623. "use strict";
  2624. var oop = acequire("../lib/oop");
  2625. var HtmlRubyHighlightRules = acequire("./html_ruby_highlight_rules").HtmlRubyHighlightRules;
  2626. var HtmlMode = acequire("./html").Mode;
  2627. var JavaScriptMode = acequire("./javascript").Mode;
  2628. var CssMode = acequire("./css").Mode;
  2629. var RubyMode = acequire("./ruby").Mode;
  2630. var Mode = function() {
  2631. HtmlMode.call(this);
  2632. this.HighlightRules = HtmlRubyHighlightRules;
  2633. this.createModeDelegates({
  2634. "js-": JavaScriptMode,
  2635. "css-": CssMode,
  2636. "ruby-": RubyMode
  2637. });
  2638. };
  2639. oop.inherits(Mode, HtmlMode);
  2640. (function() {
  2641. this.$id = "ace/mode/html_ruby";
  2642. }).call(Mode.prototype);
  2643. exports.Mode = Mode;
  2644. });