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.

1184 lines
49 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/liquid_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/html_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 HtmlHighlightRules = acequire("./html_highlight_rules").HtmlHighlightRules;
  934. var LiquidHighlightRules = function() {
  935. HtmlHighlightRules.call(this);
  936. var functions = (
  937. "date|capitalize|downcase|upcase|first|last|join|sort|map|size|escape|" +
  938. "escape_once|strip_html|strip_newlines|newline_to_br|replace|replace_first|" +
  939. "truncate|truncatewords|prepend|append|minus|plus|times|divided_by|split"
  940. );
  941. var keywords = (
  942. "capture|endcapture|case|endcase|when|comment|endcomment|" +
  943. "cycle|for|endfor|in|reversed|if|endif|else|elsif|include|endinclude|unless|endunless|" +
  944. "style|text|image|widget|plugin|marker|endmarker|tablerow|endtablerow"
  945. );
  946. var builtinVariables = 'forloop|tablerowloop';
  947. var definitions = ("assign");
  948. var keywordMapper = this.createKeywordMapper({
  949. "variable.language": builtinVariables,
  950. "keyword": keywords,
  951. "support.function": functions,
  952. "keyword.definition": definitions
  953. }, "identifier");
  954. for (var rule in this.$rules) {
  955. this.$rules[rule].unshift({
  956. token : "variable",
  957. regex : "{%",
  958. push : "liquid-start"
  959. }, {
  960. token : "variable",
  961. regex : "{{",
  962. push : "liquid-start"
  963. });
  964. }
  965. this.addRules({
  966. "liquid-start" : [{
  967. token: "variable",
  968. regex: "}}",
  969. next: "pop"
  970. }, {
  971. token: "variable",
  972. regex: "%}",
  973. next: "pop"
  974. }, {
  975. token : "string", // single line
  976. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  977. }, {
  978. token : "string", // single line
  979. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  980. }, {
  981. token : "constant.numeric", // hex
  982. regex : "0[xX][0-9a-fA-F]+\\b"
  983. }, {
  984. token : "constant.numeric", // float
  985. regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
  986. }, {
  987. token : "constant.language.boolean",
  988. regex : "(?:true|false)\\b"
  989. }, {
  990. token : keywordMapper,
  991. regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  992. }, {
  993. token : "keyword.operator",
  994. regex : "/|\\*|\\-|\\+|=|!=|\\?\\:"
  995. }, {
  996. token : "paren.lparen",
  997. regex : /[\[\({]/
  998. }, {
  999. token : "paren.rparen",
  1000. regex : /[\])}]/
  1001. }, {
  1002. token : "text",
  1003. regex : "\\s+"
  1004. }]
  1005. });
  1006. this.normalizeRules();
  1007. };
  1008. oop.inherits(LiquidHighlightRules, TextHighlightRules);
  1009. exports.LiquidHighlightRules = LiquidHighlightRules;
  1010. });
  1011. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(acequire, exports, module) {
  1012. "use strict";
  1013. var Range = acequire("../range").Range;
  1014. var MatchingBraceOutdent = function() {};
  1015. (function() {
  1016. this.checkOutdent = function(line, input) {
  1017. if (! /^\s+$/.test(line))
  1018. return false;
  1019. return /^\s*\}/.test(input);
  1020. };
  1021. this.autoOutdent = function(doc, row) {
  1022. var line = doc.getLine(row);
  1023. var match = line.match(/^(\s*\})/);
  1024. if (!match) return 0;
  1025. var column = match[1].length;
  1026. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  1027. if (!openBracePos || openBracePos.row == row) return 0;
  1028. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  1029. doc.replace(new Range(row, 0, row, column-1), indent);
  1030. };
  1031. this.$getIndent = function(line) {
  1032. return line.match(/^\s*/)[0];
  1033. };
  1034. }).call(MatchingBraceOutdent.prototype);
  1035. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  1036. });
  1037. ace.define("ace/mode/liquid",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/liquid_highlight_rules","ace/mode/matching_brace_outdent"], function(acequire, exports, module) {
  1038. var oop = acequire("../lib/oop");
  1039. var TextMode = acequire("./text").Mode;
  1040. var LiquidHighlightRules = acequire("./liquid_highlight_rules").LiquidHighlightRules;
  1041. var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent;
  1042. var Mode = function() {
  1043. this.HighlightRules = LiquidHighlightRules;
  1044. this.$outdent = new MatchingBraceOutdent();
  1045. this.$behaviour = this.$defaultBehaviour;
  1046. };
  1047. oop.inherits(Mode, TextMode);
  1048. (function() {
  1049. this.blockComment = {start: "<!--", end: "-->"};
  1050. this.getNextLineIndent = function(state, line, tab) {
  1051. var indent = this.$getIndent(line);
  1052. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  1053. var tokens = tokenizedLine.tokens;
  1054. var endState = tokenizedLine.state;
  1055. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1056. return indent;
  1057. }
  1058. if (state == "start") {
  1059. var match = line.match(/^.*[\{\(\[]\s*$/);
  1060. if (match) {
  1061. indent += tab;
  1062. }
  1063. }
  1064. return indent;
  1065. };
  1066. this.checkOutdent = function(state, line, input) {
  1067. return this.$outdent.checkOutdent(line, input);
  1068. };
  1069. this.autoOutdent = function(state, doc, row) {
  1070. this.$outdent.autoOutdent(doc, row);
  1071. };
  1072. this.$id = "ace/mode/liquid";
  1073. }).call(Mode.prototype);
  1074. exports.Mode = Mode;
  1075. });