mode-swig.js 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099
  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 = "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|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|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|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|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|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]*\\b";
  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|" +
  193. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  194. "if|in|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. "[0-2][0-7]{0,2}|" + // oct
  209. "3[0-6][0-7]?|" + // oct
  210. "37[0-7]?|" + // oct
  211. "[4-7][0-7]?|" + //oct
  212. ".)";
  213. this.$rules = {
  214. "no_regex" : [
  215. {
  216. token : "comment",
  217. regex : "\\/\\/",
  218. next : "line_comment"
  219. },
  220. DocCommentHighlightRules.getStartRule("doc-start"),
  221. {
  222. token : "comment", // multi line comment
  223. regex : /\/\*/,
  224. next : "comment"
  225. }, {
  226. token : "string",
  227. regex : "'(?=.)",
  228. next : "qstring"
  229. }, {
  230. token : "string",
  231. regex : '"(?=.)',
  232. next : "qqstring"
  233. }, {
  234. token : "constant.numeric", // hex
  235. regex : /0[xX][0-9a-fA-F]+\b/
  236. }, {
  237. token : "constant.numeric", // float
  238. regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
  239. }, {
  240. token : [
  241. "storage.type", "punctuation.operator", "support.function",
  242. "punctuation.operator", "entity.name.function", "text","keyword.operator"
  243. ],
  244. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
  245. next: "function_arguments"
  246. }, {
  247. token : [
  248. "storage.type", "punctuation.operator", "entity.name.function", "text",
  249. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  250. ],
  251. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  252. next: "function_arguments"
  253. }, {
  254. token : [
  255. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  256. "text", "paren.lparen"
  257. ],
  258. regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  259. next: "function_arguments"
  260. }, {
  261. token : [
  262. "storage.type", "punctuation.operator", "entity.name.function", "text",
  263. "keyword.operator", "text",
  264. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  265. ],
  266. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  267. next: "function_arguments"
  268. }, {
  269. token : [
  270. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  271. ],
  272. regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  273. next: "function_arguments"
  274. }, {
  275. token : [
  276. "entity.name.function", "text", "punctuation.operator",
  277. "text", "storage.type", "text", "paren.lparen"
  278. ],
  279. regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  280. next: "function_arguments"
  281. }, {
  282. token : [
  283. "text", "text", "storage.type", "text", "paren.lparen"
  284. ],
  285. regex : "(:)(\\s*)(function)(\\s*)(\\()",
  286. next: "function_arguments"
  287. }, {
  288. token : "keyword",
  289. regex : "(?:" + kwBeforeRe + ")\\b",
  290. next : "start"
  291. }, {
  292. token : ["support.constant"],
  293. regex : /that\b/
  294. }, {
  295. token : ["storage.type", "punctuation.operator", "support.function.firebug"],
  296. regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  297. }, {
  298. token : keywordMapper,
  299. regex : identifierRe
  300. }, {
  301. token : "punctuation.operator",
  302. regex : /[.](?![.])/,
  303. next : "property"
  304. }, {
  305. token : "keyword.operator",
  306. regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
  307. next : "start"
  308. }, {
  309. token : "punctuation.operator",
  310. regex : /[?:,;.]/,
  311. next : "start"
  312. }, {
  313. token : "paren.lparen",
  314. regex : /[\[({]/,
  315. next : "start"
  316. }, {
  317. token : "paren.rparen",
  318. regex : /[\])}]/
  319. }, {
  320. token: "comment",
  321. regex: /^#!.*$/
  322. }
  323. ],
  324. property: [{
  325. token : "text",
  326. regex : "\\s+"
  327. }, {
  328. token : [
  329. "storage.type", "punctuation.operator", "entity.name.function", "text",
  330. "keyword.operator", "text",
  331. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  332. ],
  333. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
  334. next: "function_arguments"
  335. }, {
  336. token : "punctuation.operator",
  337. regex : /[.](?![.])/
  338. }, {
  339. token : "support.function",
  340. 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(?=\()/
  341. }, {
  342. token : "support.function.dom",
  343. 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(?=\()/
  344. }, {
  345. token : "support.constant",
  346. 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/
  347. }, {
  348. token : "identifier",
  349. regex : identifierRe
  350. }, {
  351. regex: "",
  352. token: "empty",
  353. next: "no_regex"
  354. }
  355. ],
  356. "start": [
  357. DocCommentHighlightRules.getStartRule("doc-start"),
  358. {
  359. token : "comment", // multi line comment
  360. regex : "\\/\\*",
  361. next : "comment_regex_allowed"
  362. }, {
  363. token : "comment",
  364. regex : "\\/\\/",
  365. next : "line_comment_regex_allowed"
  366. }, {
  367. token: "string.regexp",
  368. regex: "\\/",
  369. next: "regex"
  370. }, {
  371. token : "text",
  372. regex : "\\s+|^$",
  373. next : "start"
  374. }, {
  375. token: "empty",
  376. regex: "",
  377. next: "no_regex"
  378. }
  379. ],
  380. "regex": [
  381. {
  382. token: "regexp.keyword.operator",
  383. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  384. }, {
  385. token: "string.regexp",
  386. regex: "/[sxngimy]*",
  387. next: "no_regex"
  388. }, {
  389. token : "invalid",
  390. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  391. }, {
  392. token : "constant.language.escape",
  393. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  394. }, {
  395. token : "constant.language.delimiter",
  396. regex: /\|/
  397. }, {
  398. token: "constant.language.escape",
  399. regex: /\[\^?/,
  400. next: "regex_character_class"
  401. }, {
  402. token: "empty",
  403. regex: "$",
  404. next: "no_regex"
  405. }, {
  406. defaultToken: "string.regexp"
  407. }
  408. ],
  409. "regex_character_class": [
  410. {
  411. token: "regexp.charclass.keyword.operator",
  412. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  413. }, {
  414. token: "constant.language.escape",
  415. regex: "]",
  416. next: "regex"
  417. }, {
  418. token: "constant.language.escape",
  419. regex: "-"
  420. }, {
  421. token: "empty",
  422. regex: "$",
  423. next: "no_regex"
  424. }, {
  425. defaultToken: "string.regexp.charachterclass"
  426. }
  427. ],
  428. "function_arguments": [
  429. {
  430. token: "variable.parameter",
  431. regex: identifierRe
  432. }, {
  433. token: "punctuation.operator",
  434. regex: "[, ]+"
  435. }, {
  436. token: "punctuation.operator",
  437. regex: "$"
  438. }, {
  439. token: "empty",
  440. regex: "",
  441. next: "no_regex"
  442. }
  443. ],
  444. "comment_regex_allowed" : [
  445. DocCommentHighlightRules.getTagRule(),
  446. {token : "comment", regex : "\\*\\/", next : "start"},
  447. {defaultToken : "comment", caseInsensitive: true}
  448. ],
  449. "comment" : [
  450. DocCommentHighlightRules.getTagRule(),
  451. {token : "comment", regex : "\\*\\/", next : "no_regex"},
  452. {defaultToken : "comment", caseInsensitive: true}
  453. ],
  454. "line_comment_regex_allowed" : [
  455. DocCommentHighlightRules.getTagRule(),
  456. {token : "comment", regex : "$|^", next : "start"},
  457. {defaultToken : "comment", caseInsensitive: true}
  458. ],
  459. "line_comment" : [
  460. DocCommentHighlightRules.getTagRule(),
  461. {token : "comment", regex : "$|^", next : "no_regex"},
  462. {defaultToken : "comment", caseInsensitive: true}
  463. ],
  464. "qqstring" : [
  465. {
  466. token : "constant.language.escape",
  467. regex : escapedRe
  468. }, {
  469. token : "string",
  470. regex : "\\\\$",
  471. next : "qqstring"
  472. }, {
  473. token : "string",
  474. regex : '"|$',
  475. next : "no_regex"
  476. }, {
  477. defaultToken: "string"
  478. }
  479. ],
  480. "qstring" : [
  481. {
  482. token : "constant.language.escape",
  483. regex : escapedRe
  484. }, {
  485. token : "string",
  486. regex : "\\\\$",
  487. next : "qstring"
  488. }, {
  489. token : "string",
  490. regex : "'|$",
  491. next : "no_regex"
  492. }, {
  493. defaultToken: "string"
  494. }
  495. ]
  496. };
  497. if (!options || !options.noES6) {
  498. this.$rules.no_regex.unshift({
  499. regex: "[{}]", onMatch: function(val, state, stack) {
  500. this.next = val == "{" ? this.nextState : "";
  501. if (val == "{" && stack.length) {
  502. stack.unshift("start", state);
  503. return "paren";
  504. }
  505. if (val == "}" && stack.length) {
  506. stack.shift();
  507. this.next = stack.shift();
  508. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  509. return "paren.quasi.end";
  510. }
  511. return val == "{" ? "paren.lparen" : "paren.rparen";
  512. },
  513. nextState: "start"
  514. }, {
  515. token : "string.quasi.start",
  516. regex : /`/,
  517. push : [{
  518. token : "constant.language.escape",
  519. regex : escapedRe
  520. }, {
  521. token : "paren.quasi.start",
  522. regex : /\${/,
  523. push : "start"
  524. }, {
  525. token : "string.quasi.end",
  526. regex : /`/,
  527. next : "pop"
  528. }, {
  529. defaultToken: "string.quasi"
  530. }]
  531. });
  532. if (!options || !options.noJSX)
  533. JSX.call(this);
  534. }
  535. this.embedRules(DocCommentHighlightRules, "doc-",
  536. [ DocCommentHighlightRules.getEndRule("no_regex") ]);
  537. this.normalizeRules();
  538. };
  539. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  540. function JSX() {
  541. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  542. var jsxTag = {
  543. onMatch : function(val, state, stack) {
  544. var offset = val.charAt(1) == "/" ? 2 : 1;
  545. if (offset == 1) {
  546. if (state != this.nextState)
  547. stack.unshift(this.next, this.nextState, 0);
  548. else
  549. stack.unshift(this.next);
  550. stack[2]++;
  551. } else if (offset == 2) {
  552. if (state == this.nextState) {
  553. stack[1]--;
  554. if (!stack[1] || stack[1] < 0) {
  555. stack.shift();
  556. stack.shift();
  557. }
  558. }
  559. }
  560. return [{
  561. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  562. value: val.slice(0, offset)
  563. }, {
  564. type: "meta.tag.tag-name.xml",
  565. value: val.substr(offset)
  566. }];
  567. },
  568. regex : "</?" + tagRegex + "",
  569. next: "jsxAttributes",
  570. nextState: "jsx"
  571. };
  572. this.$rules.start.unshift(jsxTag);
  573. var jsxJsRule = {
  574. regex: "{",
  575. token: "paren.quasi.start",
  576. push: "start"
  577. };
  578. this.$rules.jsx = [
  579. jsxJsRule,
  580. jsxTag,
  581. {include : "reference"},
  582. {defaultToken: "string"}
  583. ];
  584. this.$rules.jsxAttributes = [{
  585. token : "meta.tag.punctuation.tag-close.xml",
  586. regex : "/?>",
  587. onMatch : function(value, currentState, stack) {
  588. if (currentState == stack[0])
  589. stack.shift();
  590. if (value.length == 2) {
  591. if (stack[0] == this.nextState)
  592. stack[1]--;
  593. if (!stack[1] || stack[1] < 0) {
  594. stack.splice(0, 2);
  595. }
  596. }
  597. this.next = stack[0] || "start";
  598. return [{type: this.token, value: value}];
  599. },
  600. nextState: "jsx"
  601. },
  602. jsxJsRule,
  603. {
  604. token : "entity.other.attribute-name.xml",
  605. regex : tagRegex
  606. }, {
  607. token : "keyword.operator.attribute-equals.xml",
  608. regex : "="
  609. }, {
  610. token : "text.tag-whitespace.xml",
  611. regex : "\\s+"
  612. }, {
  613. token : "string.attribute-value.xml",
  614. regex : "'",
  615. stateName : "jsx_attr_q",
  616. push : [
  617. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  618. jsxJsRule,
  619. {include : "reference"},
  620. {defaultToken : "string.attribute-value.xml"}
  621. ]
  622. }, {
  623. token : "string.attribute-value.xml",
  624. regex : '"',
  625. stateName : "jsx_attr_qq",
  626. push : [
  627. jsxJsRule,
  628. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  629. {include : "reference"},
  630. {defaultToken : "string.attribute-value.xml"}
  631. ]
  632. }];
  633. this.$rules.reference = [{
  634. token : "constant.language.escape.reference.xml",
  635. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  636. }];
  637. }
  638. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  639. });
  640. ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  641. "use strict";
  642. var oop = require("../lib/oop");
  643. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  644. var XmlHighlightRules = function(normalize) {
  645. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  646. this.$rules = {
  647. start : [
  648. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  649. {
  650. token : ["punctuation.xml-decl.xml", "keyword.xml-decl.xml"],
  651. regex : "(<\\?)(xml)(?=[\\s])", next : "xml_decl", caseInsensitive: true
  652. },
  653. {
  654. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  655. regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction",
  656. },
  657. {token : "comment.xml", regex : "<\\!--", next : "comment"},
  658. {
  659. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  660. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  661. },
  662. {include : "tag"},
  663. {token : "text.end-tag-open.xml", regex: "</"},
  664. {token : "text.tag-open.xml", regex: "<"},
  665. {include : "reference"},
  666. {defaultToken : "text.xml"}
  667. ],
  668. xml_decl : [{
  669. token : "entity.other.attribute-name.decl-attribute-name.xml",
  670. regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
  671. }, {
  672. token : "keyword.operator.decl-attribute-equals.xml",
  673. regex : "="
  674. }, {
  675. include: "whitespace"
  676. }, {
  677. include: "string"
  678. }, {
  679. token : "punctuation.xml-decl.xml",
  680. regex : "\\?>",
  681. next : "start"
  682. }],
  683. processing_instruction : [
  684. {token : "punctuation.instruction.xml", regex : "\\?>", next : "start"},
  685. {defaultToken : "instruction.xml"}
  686. ],
  687. doctype : [
  688. {include : "whitespace"},
  689. {include : "string"},
  690. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  691. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  692. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  693. ],
  694. int_subset : [{
  695. token : "text.xml",
  696. regex : "\\s+"
  697. }, {
  698. token: "punctuation.int-subset.xml",
  699. regex: "]",
  700. next: "pop"
  701. }, {
  702. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  703. regex : "(<\\!)(" + tagRegex + ")",
  704. push : [{
  705. token : "text",
  706. regex : "\\s+"
  707. },
  708. {
  709. token : "punctuation.markup-decl.xml",
  710. regex : ">",
  711. next : "pop"
  712. },
  713. {include : "string"}]
  714. }],
  715. cdata : [
  716. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  717. {token : "text.xml", regex : "\\s+"},
  718. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  719. ],
  720. comment : [
  721. {token : "comment.xml", regex : "-->", next : "start"},
  722. {defaultToken : "comment.xml"}
  723. ],
  724. reference : [{
  725. token : "constant.language.escape.reference.xml",
  726. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  727. }],
  728. attr_reference : [{
  729. token : "constant.language.escape.reference.attribute-value.xml",
  730. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  731. }],
  732. tag : [{
  733. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  734. regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  735. next: [
  736. {include : "attributes"},
  737. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  738. ]
  739. }],
  740. tag_whitespace : [
  741. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  742. ],
  743. whitespace : [
  744. {token : "text.whitespace.xml", regex : "\\s+"}
  745. ],
  746. string: [{
  747. token : "string.xml",
  748. regex : "'",
  749. push : [
  750. {token : "string.xml", regex: "'", next: "pop"},
  751. {defaultToken : "string.xml"}
  752. ]
  753. }, {
  754. token : "string.xml",
  755. regex : '"',
  756. push : [
  757. {token : "string.xml", regex: '"', next: "pop"},
  758. {defaultToken : "string.xml"}
  759. ]
  760. }],
  761. attributes: [{
  762. token : "entity.other.attribute-name.xml",
  763. regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
  764. }, {
  765. token : "keyword.operator.attribute-equals.xml",
  766. regex : "="
  767. }, {
  768. include: "tag_whitespace"
  769. }, {
  770. include: "attribute_value"
  771. }],
  772. attribute_value: [{
  773. token : "string.attribute-value.xml",
  774. regex : "'",
  775. push : [
  776. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  777. {include : "attr_reference"},
  778. {defaultToken : "string.attribute-value.xml"}
  779. ]
  780. }, {
  781. token : "string.attribute-value.xml",
  782. regex : '"',
  783. push : [
  784. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  785. {include : "attr_reference"},
  786. {defaultToken : "string.attribute-value.xml"}
  787. ]
  788. }]
  789. };
  790. if (this.constructor === XmlHighlightRules)
  791. this.normalizeRules();
  792. };
  793. (function() {
  794. this.embedTagRules = function(HighlightRules, prefix, tag){
  795. this.$rules.tag.unshift({
  796. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  797. regex : "(<)(" + tag + "(?=\\s|>|$))",
  798. next: [
  799. {include : "attributes"},
  800. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  801. ]
  802. });
  803. this.$rules[tag + "-end"] = [
  804. {include : "attributes"},
  805. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  806. onMatch : function(value, currentState, stack) {
  807. stack.splice(0);
  808. return this.token;
  809. }}
  810. ]
  811. this.embedRules(HighlightRules, prefix, [{
  812. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  813. regex : "(</)(" + tag + "(?=\\s|>|$))",
  814. next: tag + "-end"
  815. }, {
  816. token: "string.cdata.xml",
  817. regex : "<\\!\\[CDATA\\["
  818. }, {
  819. token: "string.cdata.xml",
  820. regex : "\\]\\]>"
  821. }]);
  822. };
  823. }).call(TextHighlightRules.prototype);
  824. oop.inherits(XmlHighlightRules, TextHighlightRules);
  825. exports.XmlHighlightRules = XmlHighlightRules;
  826. });
  827. 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) {
  828. "use strict";
  829. var oop = require("../lib/oop");
  830. var lang = require("../lib/lang");
  831. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  832. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  833. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  834. var tagMap = lang.createMap({
  835. a : 'anchor',
  836. button : 'form',
  837. form : 'form',
  838. img : 'image',
  839. input : 'form',
  840. label : 'form',
  841. option : 'form',
  842. script : 'script',
  843. select : 'form',
  844. textarea : 'form',
  845. style : 'style',
  846. table : 'table',
  847. tbody : 'table',
  848. td : 'table',
  849. tfoot : 'table',
  850. th : 'table',
  851. tr : 'table'
  852. });
  853. var HtmlHighlightRules = function() {
  854. XmlHighlightRules.call(this);
  855. this.addRules({
  856. attributes: [{
  857. include : "tag_whitespace"
  858. }, {
  859. token : "entity.other.attribute-name.xml",
  860. regex : "[-_a-zA-Z0-9:.]+"
  861. }, {
  862. token : "keyword.operator.attribute-equals.xml",
  863. regex : "=",
  864. push : [{
  865. include: "tag_whitespace"
  866. }, {
  867. token : "string.unquoted.attribute-value.html",
  868. regex : "[^<>='\"`\\s]+",
  869. next : "pop"
  870. }, {
  871. token : "empty",
  872. regex : "",
  873. next : "pop"
  874. }]
  875. }, {
  876. include : "attribute_value"
  877. }],
  878. tag: [{
  879. token : function(start, tag) {
  880. var group = tagMap[tag];
  881. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  882. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  883. },
  884. regex : "(</?)([-_a-zA-Z0-9:.]+)",
  885. next: "tag_stuff"
  886. }],
  887. tag_stuff: [
  888. {include : "attributes"},
  889. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  890. ],
  891. });
  892. this.embedTagRules(CssHighlightRules, "css-", "style");
  893. this.embedTagRules(new JavaScriptHighlightRules({noJSX: true}).getRules(), "js-", "script");
  894. if (this.constructor === HtmlHighlightRules)
  895. this.normalizeRules();
  896. };
  897. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  898. exports.HtmlHighlightRules = HtmlHighlightRules;
  899. });
  900. ace.define("ace/mode/swig",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/html_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
  901. "use strict";
  902. var oop = require("../lib/oop");
  903. var lang = require("../lib/lang");
  904. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  905. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  906. var SwigHighlightRules = function() {
  907. HtmlHighlightRules.call(this);
  908. var tags = "autoescape|block|else|elif|extends|filter|for|if|import|include|macro|parent|raw|set|spaceless";
  909. tags = tags + "|end" + tags.replace(/\|/g, "|end");
  910. var filters = "addslashes|capitalize|date|default|escape|first|groupBy|join|json|last|lower|raw|replace|reverse|safe|sort|striptags|title|uniq|upper|url_encode|url_decode";
  911. var special = "first|last|index|index0|revindex|revindex0|key"
  912. var constants = "null|none|true|false|loop";
  913. var operators = "in|is|and|or|not|as|with|only";
  914. var keywordMapper = this.createKeywordMapper({
  915. "keyword.control.swig": tags,
  916. "support.function.swig": filters+"|"+special,
  917. "keyword.operator.swig": operators,
  918. "constant.language.swig": constants,
  919. }, "identifier");
  920. for (var rule in this.$rules) {
  921. this.$rules[rule].unshift({
  922. token : "variable.other.readwrite.local.swig",
  923. regex : "\\{\\{-?",
  924. push : "swig-start"
  925. }, {
  926. token : "meta.tag.swig",
  927. regex : "\\{%-?",
  928. push : "swig-start"
  929. }, {
  930. token : "comment.block.swig",
  931. regex : "\\{#-?",
  932. push : "swig-comment"
  933. });
  934. }
  935. this.$rules["swig-comment"] = [{
  936. token : "comment.block.swig",
  937. regex : ".*-?#}",
  938. next : "pop"
  939. }];
  940. this.$rules["swig-start"] = [{
  941. token : "variable.other.readwrite.local.swig",
  942. regex : "-?\\}\\}",
  943. next : "pop"
  944. }, {
  945. token : "meta.tag.swig",
  946. regex : "-?%\\}",
  947. next : "pop"
  948. }, {
  949. token : "string",
  950. regex : "'",
  951. next : "swig-qstring"
  952. }, {
  953. token : "string",
  954. regex : '"',
  955. next : "swig-qqstring"
  956. }, {
  957. token : "constant.numeric", // hex
  958. regex : "0[xX][0-9a-fA-F]+\\b"
  959. }, {
  960. token : "constant.numeric", // float
  961. regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
  962. }, {
  963. token : "constant.language.boolean",
  964. regex : "(?:true|false)\\b"
  965. }, {
  966. token : keywordMapper,
  967. regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  968. }, {
  969. token : "keyword.operator.assignment",
  970. regex : "=|~"
  971. }, {
  972. token : "keyword.operator.comparison",
  973. regex : "==|!=|<|>|>=|<=|==="
  974. }, {
  975. token : "keyword.operator.arithmetic",
  976. regex : "\\+|-|/|%|//|\\*|\\*\\*"
  977. }, {
  978. token : "keyword.operator.other",
  979. regex : "\\.\\.|\\|"
  980. }, {
  981. token : "punctuation.operator",
  982. regex : /\?|\:|\,|\;|\./
  983. }, {
  984. token : "paren.lparen",
  985. regex : /[\[\({]/
  986. }, {
  987. token : "paren.rparen",
  988. regex : /[\])}]/
  989. }, {
  990. token : "text",
  991. regex : "\\s+"
  992. } ];
  993. this.$rules["swig-qqstring"] = [{
  994. token : "constant.language.escape",
  995. regex : /\\[\\"$#ntr]|#{[^"}]*}/
  996. }, {
  997. token : "string",
  998. regex : '"',
  999. next : "swig-start"
  1000. }, {
  1001. defaultToken : "string"
  1002. }
  1003. ];
  1004. this.$rules["swig-qstring"] = [{
  1005. token : "constant.language.escape",
  1006. regex : /\\[\\'ntr]}/
  1007. }, {
  1008. token : "string",
  1009. regex : "'",
  1010. next : "swig-start"
  1011. }, {
  1012. defaultToken : "string"
  1013. }
  1014. ];
  1015. this.normalizeRules();
  1016. };
  1017. oop.inherits(SwigHighlightRules, TextHighlightRules);
  1018. exports.SwigHighlightRules = SwigHighlightRules;
  1019. });