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.

1547 lines
64 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/haml_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 RubyExports = acequire("./ruby_highlight_rules");
  1206. var RubyHighlightRules = RubyExports.RubyHighlightRules;
  1207. var HamlHighlightRules = function() {
  1208. HtmlHighlightRules.call(this);
  1209. this.$rules = {
  1210. "start": [
  1211. {
  1212. token: "comment.block", // multiline HTML comment
  1213. regex: /^\/$/,
  1214. next: "comment"
  1215. },
  1216. {
  1217. token: "comment.block", // multiline HAML comment
  1218. regex: /^\-#$/,
  1219. next: "comment"
  1220. },
  1221. {
  1222. token: "comment.line", // HTML comment
  1223. regex: /\/\s*.*/
  1224. },
  1225. {
  1226. token: "comment.line", // HAML comment
  1227. regex: /-#\s*.*/
  1228. },
  1229. {
  1230. token: "keyword.other.doctype",
  1231. regex: "^!!!\\s*(?:[a-zA-Z0-9-_]+)?"
  1232. },
  1233. RubyExports.qString,
  1234. RubyExports.qqString,
  1235. RubyExports.tString,
  1236. {
  1237. token: "meta.tag.haml",
  1238. regex: /(%[\w:\-]+)/
  1239. },
  1240. {
  1241. token: "keyword.attribute-name.class.haml",
  1242. regex: /\.[\w-]+/
  1243. },
  1244. {
  1245. token: "keyword.attribute-name.id.haml",
  1246. regex: /#[\w-]+/,
  1247. next: "element_class"
  1248. },
  1249. RubyExports.constantNumericHex,
  1250. RubyExports.constantNumericFloat,
  1251. RubyExports.constantOtherSymbol,
  1252. {
  1253. token: "text",
  1254. regex: /=|-|~/,
  1255. next: "embedded_ruby"
  1256. }
  1257. ],
  1258. "element_class": [
  1259. {
  1260. token: "keyword.attribute-name.class.haml",
  1261. regex: /\.[\w-]+/
  1262. },
  1263. {
  1264. token: "punctuation.section",
  1265. regex: /\{/,
  1266. next: "element_attributes"
  1267. },
  1268. RubyExports.constantOtherSymbol,
  1269. {
  1270. token: "empty",
  1271. regex: "$|(?!\\.|#|\\{|\\[|=|-|~|\\/])",
  1272. next: "start"
  1273. }
  1274. ],
  1275. "element_attributes": [
  1276. RubyExports.constantOtherSymbol,
  1277. RubyExports.qString,
  1278. RubyExports.qqString,
  1279. RubyExports.tString,
  1280. RubyExports.constantNumericHex,
  1281. RubyExports.constantNumericFloat,
  1282. {
  1283. token: "punctuation.section",
  1284. regex: /$|\}/,
  1285. next: "start"
  1286. }
  1287. ],
  1288. "embedded_ruby": [
  1289. RubyExports.constantNumericHex,
  1290. RubyExports.constantNumericFloat,
  1291. RubyExports.instanceVariable,
  1292. RubyExports.qString,
  1293. RubyExports.qqString,
  1294. RubyExports.tString,
  1295. {
  1296. token : "support.class", // class name
  1297. regex : "[A-Z][a-zA-Z_\\d]+"
  1298. },
  1299. {
  1300. token : new RubyHighlightRules().getKeywords(),
  1301. regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  1302. },
  1303. {
  1304. token : ["keyword", "text", "text"],
  1305. regex : "(?:do|\\{)(?: \\|[^|]+\\|)?$",
  1306. next : "start"
  1307. },
  1308. {
  1309. token : ["text"],
  1310. regex : "^$",
  1311. next : "start"
  1312. },
  1313. {
  1314. token : ["text"],
  1315. regex : "^(?!.*\\|\\s*$)",
  1316. next : "start"
  1317. }
  1318. ],
  1319. "comment": [
  1320. {
  1321. token: "comment.block",
  1322. regex: /^$/,
  1323. next: "start"
  1324. },
  1325. {
  1326. token: "comment.block", // comment spanning the whole line
  1327. regex: /\s+.*/
  1328. }
  1329. ]
  1330. };
  1331. this.normalizeRules();
  1332. };
  1333. oop.inherits(HamlHighlightRules, HtmlHighlightRules);
  1334. exports.HamlHighlightRules = HamlHighlightRules;
  1335. });
  1336. ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(acequire, exports, module) {
  1337. "use strict";
  1338. var oop = acequire("../../lib/oop");
  1339. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  1340. var Range = acequire("../../range").Range;
  1341. var FoldMode = exports.FoldMode = function() {};
  1342. oop.inherits(FoldMode, BaseFoldMode);
  1343. (function() {
  1344. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1345. var range = this.indentationBlock(session, row);
  1346. if (range)
  1347. return range;
  1348. var re = /\S/;
  1349. var line = session.getLine(row);
  1350. var startLevel = line.search(re);
  1351. if (startLevel == -1 || line[startLevel] != "#")
  1352. return;
  1353. var startColumn = line.length;
  1354. var maxRow = session.getLength();
  1355. var startRow = row;
  1356. var endRow = row;
  1357. while (++row < maxRow) {
  1358. line = session.getLine(row);
  1359. var level = line.search(re);
  1360. if (level == -1)
  1361. continue;
  1362. if (line[level] != "#")
  1363. break;
  1364. endRow = row;
  1365. }
  1366. if (endRow > startRow) {
  1367. var endColumn = session.getLine(endRow).length;
  1368. return new Range(startRow, startColumn, endRow, endColumn);
  1369. }
  1370. };
  1371. this.getFoldWidget = function(session, foldStyle, row) {
  1372. var line = session.getLine(row);
  1373. var indent = line.search(/\S/);
  1374. var next = session.getLine(row + 1);
  1375. var prev = session.getLine(row - 1);
  1376. var prevIndent = prev.search(/\S/);
  1377. var nextIndent = next.search(/\S/);
  1378. if (indent == -1) {
  1379. session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
  1380. return "";
  1381. }
  1382. if (prevIndent == -1) {
  1383. if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
  1384. session.foldWidgets[row - 1] = "";
  1385. session.foldWidgets[row + 1] = "";
  1386. return "start";
  1387. }
  1388. } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
  1389. if (session.getLine(row - 2).search(/\S/) == -1) {
  1390. session.foldWidgets[row - 1] = "start";
  1391. session.foldWidgets[row + 1] = "";
  1392. return "";
  1393. }
  1394. }
  1395. if (prevIndent!= -1 && prevIndent < indent)
  1396. session.foldWidgets[row - 1] = "start";
  1397. else
  1398. session.foldWidgets[row - 1] = "";
  1399. if (indent < nextIndent)
  1400. return "start";
  1401. else
  1402. return "";
  1403. };
  1404. }).call(FoldMode.prototype);
  1405. });
  1406. ace.define("ace/mode/haml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/haml_highlight_rules","ace/mode/folding/coffee"], function(acequire, exports, module) {
  1407. "use strict";
  1408. var oop = acequire("../lib/oop");
  1409. var TextMode = acequire("./text").Mode;
  1410. var HamlHighlightRules = acequire("./haml_highlight_rules").HamlHighlightRules;
  1411. var FoldMode = acequire("./folding/coffee").FoldMode;
  1412. var Mode = function() {
  1413. this.HighlightRules = HamlHighlightRules;
  1414. this.foldingRules = new FoldMode();
  1415. this.$behaviour = this.$defaultBehaviour;
  1416. };
  1417. oop.inherits(Mode, TextMode);
  1418. (function() {
  1419. this.lineCommentStart = "//";
  1420. this.$id = "ace/mode/haml";
  1421. }).call(Mode.prototype);
  1422. exports.Mode = Mode;
  1423. });