mode-liquid.js 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139
  1. ace.define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var lang = require("../lib/lang");
  5. var TextHighlightRules = require("./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 = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
  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|required|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. token : "comment", // multi line comment
  25. regex : "\\/\\*",
  26. push : "comment"
  27. }, {
  28. token: "paren.lparen",
  29. regex: "\\{",
  30. push: "ruleset"
  31. }, {
  32. token: "string",
  33. regex: "@.*?{",
  34. push: "media"
  35. }, {
  36. token: "keyword",
  37. regex: "#[a-z0-9-_]+"
  38. }, {
  39. token: "variable",
  40. regex: "\\.[a-z0-9-_]+"
  41. }, {
  42. token: "string",
  43. regex: ":[a-z0-9-_]+"
  44. }, {
  45. token: "constant",
  46. regex: "[a-z0-9-_]+"
  47. }, {
  48. caseInsensitive: true
  49. }],
  50. "media" : [{
  51. token : "comment", // multi line comment
  52. regex : "\\/\\*",
  53. push : "comment"
  54. }, {
  55. token: "paren.lparen",
  56. regex: "\\{",
  57. push: "ruleset"
  58. }, {
  59. token: "string",
  60. regex: "\\}",
  61. next: "pop"
  62. }, {
  63. token: "keyword",
  64. regex: "#[a-z0-9-_]+"
  65. }, {
  66. token: "variable",
  67. regex: "\\.[a-z0-9-_]+"
  68. }, {
  69. token: "string",
  70. regex: ":[a-z0-9-_]+"
  71. }, {
  72. token: "constant",
  73. regex: "[a-z0-9-_]+"
  74. }, {
  75. caseInsensitive: true
  76. }],
  77. "comment" : [{
  78. token : "comment",
  79. regex : "\\*\\/",
  80. next : "pop"
  81. }, {
  82. defaultToken : "comment"
  83. }],
  84. "ruleset" : [
  85. {
  86. token : "paren.rparen",
  87. regex : "\\}",
  88. next: "pop"
  89. }, {
  90. token : "comment", // multi line comment
  91. regex : "\\/\\*",
  92. push : "comment"
  93. }, {
  94. token : "string", // single line
  95. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  96. }, {
  97. token : "string", // single line
  98. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  99. }, {
  100. token : ["constant.numeric", "keyword"],
  101. 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|%)"
  102. }, {
  103. token : "constant.numeric",
  104. regex : numRe
  105. }, {
  106. token : "constant.numeric", // hex6 color
  107. regex : "#[a-f0-9]{6}"
  108. }, {
  109. token : "constant.numeric", // hex3 color
  110. regex : "#[a-f0-9]{3}"
  111. }, {
  112. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  113. regex : pseudoElements
  114. }, {
  115. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  116. regex : pseudoClasses
  117. }, {
  118. token : ["support.function", "string", "support.function"],
  119. regex : "(url\\()(.*)(\\))"
  120. }, {
  121. token : keywordMapper,
  122. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  123. }, {
  124. caseInsensitive: true
  125. }]
  126. };
  127. this.normalizeRules();
  128. };
  129. oop.inherits(CssHighlightRules, TextHighlightRules);
  130. exports.CssHighlightRules = CssHighlightRules;
  131. });
  132. ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  133. "use strict";
  134. var oop = require("../lib/oop");
  135. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  136. var DocCommentHighlightRules = function() {
  137. this.$rules = {
  138. "start" : [ {
  139. token : "comment.doc.tag",
  140. regex : "@[\\w\\d_]+" // TODO: fix email addresses
  141. },
  142. DocCommentHighlightRules.getTagRule(),
  143. {
  144. defaultToken : "comment.doc",
  145. caseInsensitive: true
  146. }]
  147. };
  148. };
  149. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  150. DocCommentHighlightRules.getTagRule = function(start) {
  151. return {
  152. token : "comment.doc.tag.storage.type",
  153. regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  154. };
  155. }
  156. DocCommentHighlightRules.getStartRule = function(start) {
  157. return {
  158. token : "comment.doc", // doc comment
  159. regex : "\\/\\*(?=\\*)",
  160. next : start
  161. };
  162. };
  163. DocCommentHighlightRules.getEndRule = function (start) {
  164. return {
  165. token : "comment.doc", // closing comment
  166. regex : "\\*\\/",
  167. next : start
  168. };
  169. };
  170. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  171. });
  172. 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(require, exports, module) {
  173. "use strict";
  174. var oop = require("../lib/oop");
  175. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  176. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  177. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  178. var JavaScriptHighlightRules = function(options) {
  179. var keywordMapper = this.createKeywordMapper({
  180. "variable.language":
  181. "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  182. "Namespace|QName|XML|XMLList|" + // E4X
  183. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  184. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  185. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  186. "SyntaxError|TypeError|URIError|" +
  187. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  188. "isNaN|parseFloat|parseInt|" +
  189. "JSON|Math|" + // Other
  190. "this|arguments|prototype|window|document" , // Pseudo
  191. "keyword":
  192. "const|yield|import|get|set|async|await|" +
  193. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  194. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  195. "__parent__|__count__|escape|unescape|with|__proto__|" +
  196. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  197. "storage.type":
  198. "const|let|var|function",
  199. "constant.language":
  200. "null|Infinity|NaN|undefined",
  201. "support.function":
  202. "alert",
  203. "constant.language.boolean": "true|false"
  204. }, "identifier");
  205. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  206. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  207. "u[0-9a-fA-F]{4}|" + // unicode
  208. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  209. "[0-2][0-7]{0,2}|" + // oct
  210. "3[0-7][0-7]?|" + // oct
  211. "[4-7][0-7]?|" + //oct
  212. ".)";
  213. this.$rules = {
  214. "no_regex" : [
  215. DocCommentHighlightRules.getStartRule("doc-start"),
  216. comments("no_regex"),
  217. {
  218. token : "string",
  219. regex : "'(?=.)",
  220. next : "qstring"
  221. }, {
  222. token : "string",
  223. regex : '"(?=.)',
  224. next : "qqstring"
  225. }, {
  226. token : "constant.numeric", // hex
  227. regex : /0(?:[xX][0-9a-fA-F]+|[bB][01]+)\b/
  228. }, {
  229. token : "constant.numeric", // float
  230. regex : /[+-]?\d[\d_]*(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
  231. }, {
  232. token : [
  233. "storage.type", "punctuation.operator", "support.function",
  234. "punctuation.operator", "entity.name.function", "text","keyword.operator"
  235. ],
  236. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
  237. next: "function_arguments"
  238. }, {
  239. token : [
  240. "storage.type", "punctuation.operator", "entity.name.function", "text",
  241. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  242. ],
  243. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  244. next: "function_arguments"
  245. }, {
  246. token : [
  247. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  248. "text", "paren.lparen"
  249. ],
  250. regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  251. next: "function_arguments"
  252. }, {
  253. token : [
  254. "storage.type", "punctuation.operator", "entity.name.function", "text",
  255. "keyword.operator", "text",
  256. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  257. ],
  258. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  259. next: "function_arguments"
  260. }, {
  261. token : [
  262. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  263. ],
  264. regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  265. next: "function_arguments"
  266. }, {
  267. token : [
  268. "entity.name.function", "text", "punctuation.operator",
  269. "text", "storage.type", "text", "paren.lparen"
  270. ],
  271. regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  272. next: "function_arguments"
  273. }, {
  274. token : [
  275. "text", "text", "storage.type", "text", "paren.lparen"
  276. ],
  277. regex : "(:)(\\s*)(function)(\\s*)(\\()",
  278. next: "function_arguments"
  279. }, {
  280. token : "keyword",
  281. regex : "(?:" + kwBeforeRe + ")\\b",
  282. next : "start"
  283. }, {
  284. token : ["support.constant"],
  285. regex : /that\b/
  286. }, {
  287. token : ["storage.type", "punctuation.operator", "support.function.firebug"],
  288. regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  289. }, {
  290. token : keywordMapper,
  291. regex : identifierRe
  292. }, {
  293. token : "punctuation.operator",
  294. regex : /[.](?![.])/,
  295. next : "property"
  296. }, {
  297. token : "keyword.operator",
  298. regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
  299. next : "start"
  300. }, {
  301. token : "punctuation.operator",
  302. regex : /[?:,;.]/,
  303. next : "start"
  304. }, {
  305. token : "paren.lparen",
  306. regex : /[\[({]/,
  307. next : "start"
  308. }, {
  309. token : "paren.rparen",
  310. regex : /[\])}]/
  311. }, {
  312. token: "comment",
  313. regex: /^#!.*$/
  314. }
  315. ],
  316. property: [{
  317. token : "text",
  318. regex : "\\s+"
  319. }, {
  320. token : [
  321. "storage.type", "punctuation.operator", "entity.name.function", "text",
  322. "keyword.operator", "text",
  323. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  324. ],
  325. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
  326. next: "function_arguments"
  327. }, {
  328. token : "punctuation.operator",
  329. regex : /[.](?![.])/
  330. }, {
  331. token : "support.function",
  332. 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(?=\()/
  333. }, {
  334. token : "support.function.dom",
  335. 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(?=\()/
  336. }, {
  337. token : "support.constant",
  338. 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/
  339. }, {
  340. token : "identifier",
  341. regex : identifierRe
  342. }, {
  343. regex: "",
  344. token: "empty",
  345. next: "no_regex"
  346. }
  347. ],
  348. "start": [
  349. DocCommentHighlightRules.getStartRule("doc-start"),
  350. comments("start"),
  351. {
  352. token: "string.regexp",
  353. regex: "\\/",
  354. next: "regex"
  355. }, {
  356. token : "text",
  357. regex : "\\s+|^$",
  358. next : "start"
  359. }, {
  360. token: "empty",
  361. regex: "",
  362. next: "no_regex"
  363. }
  364. ],
  365. "regex": [
  366. {
  367. token: "regexp.keyword.operator",
  368. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  369. }, {
  370. token: "string.regexp",
  371. regex: "/[sxngimy]*",
  372. next: "no_regex"
  373. }, {
  374. token : "invalid",
  375. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  376. }, {
  377. token : "constant.language.escape",
  378. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  379. }, {
  380. token : "constant.language.delimiter",
  381. regex: /\|/
  382. }, {
  383. token: "constant.language.escape",
  384. regex: /\[\^?/,
  385. next: "regex_character_class"
  386. }, {
  387. token: "empty",
  388. regex: "$",
  389. next: "no_regex"
  390. }, {
  391. defaultToken: "string.regexp"
  392. }
  393. ],
  394. "regex_character_class": [
  395. {
  396. token: "regexp.charclass.keyword.operator",
  397. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  398. }, {
  399. token: "constant.language.escape",
  400. regex: "]",
  401. next: "regex"
  402. }, {
  403. token: "constant.language.escape",
  404. regex: "-"
  405. }, {
  406. token: "empty",
  407. regex: "$",
  408. next: "no_regex"
  409. }, {
  410. defaultToken: "string.regexp.charachterclass"
  411. }
  412. ],
  413. "function_arguments": [
  414. {
  415. token: "variable.parameter",
  416. regex: identifierRe
  417. }, {
  418. token: "punctuation.operator",
  419. regex: "[, ]+"
  420. }, {
  421. token: "punctuation.operator",
  422. regex: "$"
  423. }, {
  424. token: "empty",
  425. regex: "",
  426. next: "no_regex"
  427. }
  428. ],
  429. "qqstring" : [
  430. {
  431. token : "constant.language.escape",
  432. regex : escapedRe
  433. }, {
  434. token : "string",
  435. regex : "\\\\$",
  436. next : "qqstring"
  437. }, {
  438. token : "string",
  439. regex : '"|$',
  440. next : "no_regex"
  441. }, {
  442. defaultToken: "string"
  443. }
  444. ],
  445. "qstring" : [
  446. {
  447. token : "constant.language.escape",
  448. regex : escapedRe
  449. }, {
  450. token : "string",
  451. regex : "\\\\$",
  452. next : "qstring"
  453. }, {
  454. token : "string",
  455. regex : "'|$",
  456. next : "no_regex"
  457. }, {
  458. defaultToken: "string"
  459. }
  460. ]
  461. };
  462. if (!options || !options.noES6) {
  463. this.$rules.no_regex.unshift({
  464. regex: "[{}]", onMatch: function(val, state, stack) {
  465. this.next = val == "{" ? this.nextState : "";
  466. if (val == "{" && stack.length) {
  467. stack.unshift("start", state);
  468. }
  469. else if (val == "}" && stack.length) {
  470. stack.shift();
  471. this.next = stack.shift();
  472. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  473. return "paren.quasi.end";
  474. }
  475. return val == "{" ? "paren.lparen" : "paren.rparen";
  476. },
  477. nextState: "start"
  478. }, {
  479. token : "string.quasi.start",
  480. regex : /`/,
  481. push : [{
  482. token : "constant.language.escape",
  483. regex : escapedRe
  484. }, {
  485. token : "paren.quasi.start",
  486. regex : /\${/,
  487. push : "start"
  488. }, {
  489. token : "string.quasi.end",
  490. regex : /`/,
  491. next : "pop"
  492. }, {
  493. defaultToken: "string.quasi"
  494. }]
  495. });
  496. if (!options || options.jsx != false)
  497. JSX.call(this);
  498. }
  499. this.embedRules(DocCommentHighlightRules, "doc-",
  500. [ DocCommentHighlightRules.getEndRule("no_regex") ]);
  501. this.normalizeRules();
  502. };
  503. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  504. function JSX() {
  505. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  506. var jsxTag = {
  507. onMatch : function(val, state, stack) {
  508. var offset = val.charAt(1) == "/" ? 2 : 1;
  509. if (offset == 1) {
  510. if (state != this.nextState)
  511. stack.unshift(this.next, this.nextState, 0);
  512. else
  513. stack.unshift(this.next);
  514. stack[2]++;
  515. } else if (offset == 2) {
  516. if (state == this.nextState) {
  517. stack[1]--;
  518. if (!stack[1] || stack[1] < 0) {
  519. stack.shift();
  520. stack.shift();
  521. }
  522. }
  523. }
  524. return [{
  525. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  526. value: val.slice(0, offset)
  527. }, {
  528. type: "meta.tag.tag-name.xml",
  529. value: val.substr(offset)
  530. }];
  531. },
  532. regex : "</?" + tagRegex + "",
  533. next: "jsxAttributes",
  534. nextState: "jsx"
  535. };
  536. this.$rules.start.unshift(jsxTag);
  537. var jsxJsRule = {
  538. regex: "{",
  539. token: "paren.quasi.start",
  540. push: "start"
  541. };
  542. this.$rules.jsx = [
  543. jsxJsRule,
  544. jsxTag,
  545. {include : "reference"},
  546. {defaultToken: "string"}
  547. ];
  548. this.$rules.jsxAttributes = [{
  549. token : "meta.tag.punctuation.tag-close.xml",
  550. regex : "/?>",
  551. onMatch : function(value, currentState, stack) {
  552. if (currentState == stack[0])
  553. stack.shift();
  554. if (value.length == 2) {
  555. if (stack[0] == this.nextState)
  556. stack[1]--;
  557. if (!stack[1] || stack[1] < 0) {
  558. stack.splice(0, 2);
  559. }
  560. }
  561. this.next = stack[0] || "start";
  562. return [{type: this.token, value: value}];
  563. },
  564. nextState: "jsx"
  565. },
  566. jsxJsRule,
  567. comments("jsxAttributes"),
  568. {
  569. token : "entity.other.attribute-name.xml",
  570. regex : tagRegex
  571. }, {
  572. token : "keyword.operator.attribute-equals.xml",
  573. regex : "="
  574. }, {
  575. token : "text.tag-whitespace.xml",
  576. regex : "\\s+"
  577. }, {
  578. token : "string.attribute-value.xml",
  579. regex : "'",
  580. stateName : "jsx_attr_q",
  581. push : [
  582. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  583. {include : "reference"},
  584. {defaultToken : "string.attribute-value.xml"}
  585. ]
  586. }, {
  587. token : "string.attribute-value.xml",
  588. regex : '"',
  589. stateName : "jsx_attr_qq",
  590. push : [
  591. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  592. {include : "reference"},
  593. {defaultToken : "string.attribute-value.xml"}
  594. ]
  595. },
  596. jsxTag
  597. ];
  598. this.$rules.reference = [{
  599. token : "constant.language.escape.reference.xml",
  600. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  601. }];
  602. }
  603. function comments(next) {
  604. return [
  605. {
  606. token : "comment", // multi line comment
  607. regex : /\/\*/,
  608. next: [
  609. DocCommentHighlightRules.getTagRule(),
  610. {token : "comment", regex : "\\*\\/", next : next || "pop"},
  611. {defaultToken : "comment", caseInsensitive: true}
  612. ]
  613. }, {
  614. token : "comment",
  615. regex : "\\/\\/",
  616. next: [
  617. DocCommentHighlightRules.getTagRule(),
  618. {token : "comment", regex : "$|^", next : next || "pop"},
  619. {defaultToken : "comment", caseInsensitive: true}
  620. ]
  621. }
  622. ];
  623. }
  624. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  625. });
  626. ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  627. "use strict";
  628. var oop = require("../lib/oop");
  629. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  630. var XmlHighlightRules = function(normalize) {
  631. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  632. this.$rules = {
  633. start : [
  634. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  635. {
  636. token : ["punctuation.xml-decl.xml", "keyword.xml-decl.xml"],
  637. regex : "(<\\?)(xml)(?=[\\s])", next : "xml_decl", caseInsensitive: true
  638. },
  639. {
  640. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  641. regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
  642. },
  643. {token : "comment.xml", regex : "<\\!--", next : "comment"},
  644. {
  645. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  646. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  647. },
  648. {include : "tag"},
  649. {token : "text.end-tag-open.xml", regex: "</"},
  650. {token : "text.tag-open.xml", regex: "<"},
  651. {include : "reference"},
  652. {defaultToken : "text.xml"}
  653. ],
  654. xml_decl : [{
  655. token : "entity.other.attribute-name.decl-attribute-name.xml",
  656. regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
  657. }, {
  658. token : "keyword.operator.decl-attribute-equals.xml",
  659. regex : "="
  660. }, {
  661. include: "whitespace"
  662. }, {
  663. include: "string"
  664. }, {
  665. token : "punctuation.xml-decl.xml",
  666. regex : "\\?>",
  667. next : "start"
  668. }],
  669. processing_instruction : [
  670. {token : "punctuation.instruction.xml", regex : "\\?>", next : "start"},
  671. {defaultToken : "instruction.xml"}
  672. ],
  673. doctype : [
  674. {include : "whitespace"},
  675. {include : "string"},
  676. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  677. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  678. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  679. ],
  680. int_subset : [{
  681. token : "text.xml",
  682. regex : "\\s+"
  683. }, {
  684. token: "punctuation.int-subset.xml",
  685. regex: "]",
  686. next: "pop"
  687. }, {
  688. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  689. regex : "(<\\!)(" + tagRegex + ")",
  690. push : [{
  691. token : "text",
  692. regex : "\\s+"
  693. },
  694. {
  695. token : "punctuation.markup-decl.xml",
  696. regex : ">",
  697. next : "pop"
  698. },
  699. {include : "string"}]
  700. }],
  701. cdata : [
  702. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  703. {token : "text.xml", regex : "\\s+"},
  704. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  705. ],
  706. comment : [
  707. {token : "comment.xml", regex : "-->", next : "start"},
  708. {defaultToken : "comment.xml"}
  709. ],
  710. reference : [{
  711. token : "constant.language.escape.reference.xml",
  712. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  713. }],
  714. attr_reference : [{
  715. token : "constant.language.escape.reference.attribute-value.xml",
  716. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  717. }],
  718. tag : [{
  719. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  720. regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  721. next: [
  722. {include : "attributes"},
  723. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  724. ]
  725. }],
  726. tag_whitespace : [
  727. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  728. ],
  729. whitespace : [
  730. {token : "text.whitespace.xml", regex : "\\s+"}
  731. ],
  732. string: [{
  733. token : "string.xml",
  734. regex : "'",
  735. push : [
  736. {token : "string.xml", regex: "'", next: "pop"},
  737. {defaultToken : "string.xml"}
  738. ]
  739. }, {
  740. token : "string.xml",
  741. regex : '"',
  742. push : [
  743. {token : "string.xml", regex: '"', next: "pop"},
  744. {defaultToken : "string.xml"}
  745. ]
  746. }],
  747. attributes: [{
  748. token : "entity.other.attribute-name.xml",
  749. regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
  750. }, {
  751. token : "keyword.operator.attribute-equals.xml",
  752. regex : "="
  753. }, {
  754. include: "tag_whitespace"
  755. }, {
  756. include: "attribute_value"
  757. }],
  758. attribute_value: [{
  759. token : "string.attribute-value.xml",
  760. regex : "'",
  761. push : [
  762. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  763. {include : "attr_reference"},
  764. {defaultToken : "string.attribute-value.xml"}
  765. ]
  766. }, {
  767. token : "string.attribute-value.xml",
  768. regex : '"',
  769. push : [
  770. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  771. {include : "attr_reference"},
  772. {defaultToken : "string.attribute-value.xml"}
  773. ]
  774. }]
  775. };
  776. if (this.constructor === XmlHighlightRules)
  777. this.normalizeRules();
  778. };
  779. (function() {
  780. this.embedTagRules = function(HighlightRules, prefix, tag){
  781. this.$rules.tag.unshift({
  782. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  783. regex : "(<)(" + tag + "(?=\\s|>|$))",
  784. next: [
  785. {include : "attributes"},
  786. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  787. ]
  788. });
  789. this.$rules[tag + "-end"] = [
  790. {include : "attributes"},
  791. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  792. onMatch : function(value, currentState, stack) {
  793. stack.splice(0);
  794. return this.token;
  795. }}
  796. ]
  797. this.embedRules(HighlightRules, prefix, [{
  798. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  799. regex : "(</)(" + tag + "(?=\\s|>|$))",
  800. next: tag + "-end"
  801. }, {
  802. token: "string.cdata.xml",
  803. regex : "<\\!\\[CDATA\\["
  804. }, {
  805. token: "string.cdata.xml",
  806. regex : "\\]\\]>"
  807. }]);
  808. };
  809. }).call(TextHighlightRules.prototype);
  810. oop.inherits(XmlHighlightRules, TextHighlightRules);
  811. exports.XmlHighlightRules = XmlHighlightRules;
  812. });
  813. 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(require, exports, module) {
  814. "use strict";
  815. var oop = require("../lib/oop");
  816. var lang = require("../lib/lang");
  817. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  818. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  819. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  820. var tagMap = lang.createMap({
  821. a : 'anchor',
  822. button : 'form',
  823. form : 'form',
  824. img : 'image',
  825. input : 'form',
  826. label : 'form',
  827. option : 'form',
  828. script : 'script',
  829. select : 'form',
  830. textarea : 'form',
  831. style : 'style',
  832. table : 'table',
  833. tbody : 'table',
  834. td : 'table',
  835. tfoot : 'table',
  836. th : 'table',
  837. tr : 'table'
  838. });
  839. var HtmlHighlightRules = function() {
  840. XmlHighlightRules.call(this);
  841. this.addRules({
  842. attributes: [{
  843. include : "tag_whitespace"
  844. }, {
  845. token : "entity.other.attribute-name.xml",
  846. regex : "[-_a-zA-Z0-9:.]+"
  847. }, {
  848. token : "keyword.operator.attribute-equals.xml",
  849. regex : "=",
  850. push : [{
  851. include: "tag_whitespace"
  852. }, {
  853. token : "string.unquoted.attribute-value.html",
  854. regex : "[^<>='\"`\\s]+",
  855. next : "pop"
  856. }, {
  857. token : "empty",
  858. regex : "",
  859. next : "pop"
  860. }]
  861. }, {
  862. include : "attribute_value"
  863. }],
  864. tag: [{
  865. token : function(start, tag) {
  866. var group = tagMap[tag];
  867. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  868. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  869. },
  870. regex : "(</?)([-_a-zA-Z0-9:.]+)",
  871. next: "tag_stuff"
  872. }],
  873. tag_stuff: [
  874. {include : "attributes"},
  875. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  876. ]
  877. });
  878. this.embedTagRules(CssHighlightRules, "css-", "style");
  879. this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script");
  880. if (this.constructor === HtmlHighlightRules)
  881. this.normalizeRules();
  882. };
  883. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  884. exports.HtmlHighlightRules = HtmlHighlightRules;
  885. });
  886. ace.define("ace/mode/liquid_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module) {
  887. "use strict";
  888. var oop = require("../lib/oop");
  889. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  890. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  891. var LiquidHighlightRules = function() {
  892. HtmlHighlightRules.call(this);
  893. var functions = (
  894. "date|capitalize|downcase|upcase|first|last|join|sort|map|size|escape|" +
  895. "escape_once|strip_html|strip_newlines|newline_to_br|replace|replace_first|" +
  896. "truncate|truncatewords|prepend|append|minus|plus|times|divided_by|split"
  897. );
  898. var keywords = (
  899. "capture|endcapture|case|endcase|when|comment|endcomment|" +
  900. "cycle|for|endfor|in|reversed|if|endif|else|elsif|include|endinclude|unless|endunless|" +
  901. "style|text|image|widget|plugin|marker|endmarker|tablerow|endtablerow"
  902. );
  903. var builtinVariables = 'forloop|tablerowloop';
  904. var definitions = ("assign");
  905. var keywordMapper = this.createKeywordMapper({
  906. "variable.language": builtinVariables,
  907. "keyword": keywords,
  908. "support.function": functions,
  909. "keyword.definition": definitions
  910. }, "identifier");
  911. for (var rule in this.$rules) {
  912. this.$rules[rule].unshift({
  913. token : "variable",
  914. regex : "{%",
  915. push : "liquid-start"
  916. }, {
  917. token : "variable",
  918. regex : "{{",
  919. push : "liquid-start"
  920. });
  921. }
  922. this.addRules({
  923. "liquid-start" : [{
  924. token: "variable",
  925. regex: "}}",
  926. next: "pop"
  927. }, {
  928. token: "variable",
  929. regex: "%}",
  930. next: "pop"
  931. }, {
  932. token : "string", // single line
  933. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  934. }, {
  935. token : "string", // single line
  936. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  937. }, {
  938. token : "constant.numeric", // hex
  939. regex : "0[xX][0-9a-fA-F]+\\b"
  940. }, {
  941. token : "constant.numeric", // float
  942. regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
  943. }, {
  944. token : "constant.language.boolean",
  945. regex : "(?:true|false)\\b"
  946. }, {
  947. token : keywordMapper,
  948. regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  949. }, {
  950. token : "keyword.operator",
  951. regex : "/|\\*|\\-|\\+|=|!=|\\?\\:"
  952. }, {
  953. token : "paren.lparen",
  954. regex : /[\[\({]/
  955. }, {
  956. token : "paren.rparen",
  957. regex : /[\])}]/
  958. }, {
  959. token : "text",
  960. regex : "\\s+"
  961. }]
  962. });
  963. this.normalizeRules();
  964. };
  965. oop.inherits(LiquidHighlightRules, TextHighlightRules);
  966. exports.LiquidHighlightRules = LiquidHighlightRules;
  967. });
  968. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
  969. "use strict";
  970. var Range = require("../range").Range;
  971. var MatchingBraceOutdent = function() {};
  972. (function() {
  973. this.checkOutdent = function(line, input) {
  974. if (! /^\s+$/.test(line))
  975. return false;
  976. return /^\s*\}/.test(input);
  977. };
  978. this.autoOutdent = function(doc, row) {
  979. var line = doc.getLine(row);
  980. var match = line.match(/^(\s*\})/);
  981. if (!match) return 0;
  982. var column = match[1].length;
  983. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  984. if (!openBracePos || openBracePos.row == row) return 0;
  985. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  986. doc.replace(new Range(row, 0, row, column-1), indent);
  987. };
  988. this.$getIndent = function(line) {
  989. return line.match(/^\s*/)[0];
  990. };
  991. }).call(MatchingBraceOutdent.prototype);
  992. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  993. });
  994. 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(require, exports, module) {
  995. var oop = require("../lib/oop");
  996. var TextMode = require("./text").Mode;
  997. var LiquidHighlightRules = require("./liquid_highlight_rules").LiquidHighlightRules;
  998. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  999. var Mode = function() {
  1000. this.HighlightRules = LiquidHighlightRules;
  1001. this.$outdent = new MatchingBraceOutdent();
  1002. this.$behaviour = this.$defaultBehaviour;
  1003. };
  1004. oop.inherits(Mode, TextMode);
  1005. (function() {
  1006. this.blockComment = {start: "<!--", end: "-->"};
  1007. this.getNextLineIndent = function(state, line, tab) {
  1008. var indent = this.$getIndent(line);
  1009. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  1010. var tokens = tokenizedLine.tokens;
  1011. var endState = tokenizedLine.state;
  1012. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1013. return indent;
  1014. }
  1015. if (state == "start") {
  1016. var match = line.match(/^.*[\{\(\[]\s*$/);
  1017. if (match) {
  1018. indent += tab;
  1019. }
  1020. }
  1021. return indent;
  1022. };
  1023. this.checkOutdent = function(state, line, input) {
  1024. return this.$outdent.checkOutdent(line, input);
  1025. };
  1026. this.autoOutdent = function(state, doc, row) {
  1027. this.$outdent.autoOutdent(doc, row);
  1028. };
  1029. this.$id = "ace/mode/liquid";
  1030. }).call(Mode.prototype);
  1031. exports.Mode = Mode;
  1032. });