mode-jade.js 82 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065
  1. ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var DocCommentHighlightRules = function() {
  6. this.$rules = {
  7. "start" : [ {
  8. token : "comment.doc.tag",
  9. regex : "@[\\w\\d_]+" // TODO: fix email addresses
  10. },
  11. DocCommentHighlightRules.getTagRule(),
  12. {
  13. defaultToken : "comment.doc",
  14. caseInsensitive: true
  15. }]
  16. };
  17. };
  18. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  19. DocCommentHighlightRules.getTagRule = function(start) {
  20. return {
  21. token : "comment.doc.tag.storage.type",
  22. regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  23. };
  24. }
  25. DocCommentHighlightRules.getStartRule = function(start) {
  26. return {
  27. token : "comment.doc", // doc comment
  28. regex : "\\/\\*(?=\\*)",
  29. next : start
  30. };
  31. };
  32. DocCommentHighlightRules.getEndRule = function (start) {
  33. return {
  34. token : "comment.doc", // closing comment
  35. regex : "\\*\\/",
  36. next : start
  37. };
  38. };
  39. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  40. });
  41. 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) {
  42. "use strict";
  43. var oop = require("../lib/oop");
  44. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  45. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  46. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  47. var JavaScriptHighlightRules = function(options) {
  48. var keywordMapper = this.createKeywordMapper({
  49. "variable.language":
  50. "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  51. "Namespace|QName|XML|XMLList|" + // E4X
  52. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  53. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  54. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  55. "SyntaxError|TypeError|URIError|" +
  56. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  57. "isNaN|parseFloat|parseInt|" +
  58. "JSON|Math|" + // Other
  59. "this|arguments|prototype|window|document" , // Pseudo
  60. "keyword":
  61. "const|yield|import|get|set|async|await|" +
  62. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  63. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  64. "__parent__|__count__|escape|unescape|with|__proto__|" +
  65. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  66. "storage.type":
  67. "const|let|var|function",
  68. "constant.language":
  69. "null|Infinity|NaN|undefined",
  70. "support.function":
  71. "alert",
  72. "constant.language.boolean": "true|false"
  73. }, "identifier");
  74. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  75. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  76. "u[0-9a-fA-F]{4}|" + // unicode
  77. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  78. "[0-2][0-7]{0,2}|" + // oct
  79. "3[0-7][0-7]?|" + // oct
  80. "[4-7][0-7]?|" + //oct
  81. ".)";
  82. this.$rules = {
  83. "no_regex" : [
  84. DocCommentHighlightRules.getStartRule("doc-start"),
  85. comments("no_regex"),
  86. {
  87. token : "string",
  88. regex : "'(?=.)",
  89. next : "qstring"
  90. }, {
  91. token : "string",
  92. regex : '"(?=.)',
  93. next : "qqstring"
  94. }, {
  95. token : "constant.numeric", // hex
  96. regex : /0(?:[xX][0-9a-fA-F]+|[bB][01]+)\b/
  97. }, {
  98. token : "constant.numeric", // float
  99. regex : /[+-]?\d[\d_]*(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
  100. }, {
  101. token : [
  102. "storage.type", "punctuation.operator", "support.function",
  103. "punctuation.operator", "entity.name.function", "text","keyword.operator"
  104. ],
  105. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
  106. next: "function_arguments"
  107. }, {
  108. token : [
  109. "storage.type", "punctuation.operator", "entity.name.function", "text",
  110. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  111. ],
  112. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  113. next: "function_arguments"
  114. }, {
  115. token : [
  116. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  117. "text", "paren.lparen"
  118. ],
  119. regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  120. next: "function_arguments"
  121. }, {
  122. token : [
  123. "storage.type", "punctuation.operator", "entity.name.function", "text",
  124. "keyword.operator", "text",
  125. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  126. ],
  127. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  128. next: "function_arguments"
  129. }, {
  130. token : [
  131. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  132. ],
  133. regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  134. next: "function_arguments"
  135. }, {
  136. token : [
  137. "entity.name.function", "text", "punctuation.operator",
  138. "text", "storage.type", "text", "paren.lparen"
  139. ],
  140. regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  141. next: "function_arguments"
  142. }, {
  143. token : [
  144. "text", "text", "storage.type", "text", "paren.lparen"
  145. ],
  146. regex : "(:)(\\s*)(function)(\\s*)(\\()",
  147. next: "function_arguments"
  148. }, {
  149. token : "keyword",
  150. regex : "(?:" + kwBeforeRe + ")\\b",
  151. next : "start"
  152. }, {
  153. token : ["support.constant"],
  154. regex : /that\b/
  155. }, {
  156. token : ["storage.type", "punctuation.operator", "support.function.firebug"],
  157. regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  158. }, {
  159. token : keywordMapper,
  160. regex : identifierRe
  161. }, {
  162. token : "punctuation.operator",
  163. regex : /[.](?![.])/,
  164. next : "property"
  165. }, {
  166. token : "keyword.operator",
  167. regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
  168. next : "start"
  169. }, {
  170. token : "punctuation.operator",
  171. regex : /[?:,;.]/,
  172. next : "start"
  173. }, {
  174. token : "paren.lparen",
  175. regex : /[\[({]/,
  176. next : "start"
  177. }, {
  178. token : "paren.rparen",
  179. regex : /[\])}]/
  180. }, {
  181. token: "comment",
  182. regex: /^#!.*$/
  183. }
  184. ],
  185. property: [{
  186. token : "text",
  187. regex : "\\s+"
  188. }, {
  189. token : [
  190. "storage.type", "punctuation.operator", "entity.name.function", "text",
  191. "keyword.operator", "text",
  192. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  193. ],
  194. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
  195. next: "function_arguments"
  196. }, {
  197. token : "punctuation.operator",
  198. regex : /[.](?![.])/
  199. }, {
  200. token : "support.function",
  201. 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(?=\()/
  202. }, {
  203. token : "support.function.dom",
  204. 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(?=\()/
  205. }, {
  206. token : "support.constant",
  207. 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/
  208. }, {
  209. token : "identifier",
  210. regex : identifierRe
  211. }, {
  212. regex: "",
  213. token: "empty",
  214. next: "no_regex"
  215. }
  216. ],
  217. "start": [
  218. DocCommentHighlightRules.getStartRule("doc-start"),
  219. comments("start"),
  220. {
  221. token: "string.regexp",
  222. regex: "\\/",
  223. next: "regex"
  224. }, {
  225. token : "text",
  226. regex : "\\s+|^$",
  227. next : "start"
  228. }, {
  229. token: "empty",
  230. regex: "",
  231. next: "no_regex"
  232. }
  233. ],
  234. "regex": [
  235. {
  236. token: "regexp.keyword.operator",
  237. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  238. }, {
  239. token: "string.regexp",
  240. regex: "/[sxngimy]*",
  241. next: "no_regex"
  242. }, {
  243. token : "invalid",
  244. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  245. }, {
  246. token : "constant.language.escape",
  247. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  248. }, {
  249. token : "constant.language.delimiter",
  250. regex: /\|/
  251. }, {
  252. token: "constant.language.escape",
  253. regex: /\[\^?/,
  254. next: "regex_character_class"
  255. }, {
  256. token: "empty",
  257. regex: "$",
  258. next: "no_regex"
  259. }, {
  260. defaultToken: "string.regexp"
  261. }
  262. ],
  263. "regex_character_class": [
  264. {
  265. token: "regexp.charclass.keyword.operator",
  266. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  267. }, {
  268. token: "constant.language.escape",
  269. regex: "]",
  270. next: "regex"
  271. }, {
  272. token: "constant.language.escape",
  273. regex: "-"
  274. }, {
  275. token: "empty",
  276. regex: "$",
  277. next: "no_regex"
  278. }, {
  279. defaultToken: "string.regexp.charachterclass"
  280. }
  281. ],
  282. "function_arguments": [
  283. {
  284. token: "variable.parameter",
  285. regex: identifierRe
  286. }, {
  287. token: "punctuation.operator",
  288. regex: "[, ]+"
  289. }, {
  290. token: "punctuation.operator",
  291. regex: "$"
  292. }, {
  293. token: "empty",
  294. regex: "",
  295. next: "no_regex"
  296. }
  297. ],
  298. "qqstring" : [
  299. {
  300. token : "constant.language.escape",
  301. regex : escapedRe
  302. }, {
  303. token : "string",
  304. regex : "\\\\$",
  305. next : "qqstring"
  306. }, {
  307. token : "string",
  308. regex : '"|$',
  309. next : "no_regex"
  310. }, {
  311. defaultToken: "string"
  312. }
  313. ],
  314. "qstring" : [
  315. {
  316. token : "constant.language.escape",
  317. regex : escapedRe
  318. }, {
  319. token : "string",
  320. regex : "\\\\$",
  321. next : "qstring"
  322. }, {
  323. token : "string",
  324. regex : "'|$",
  325. next : "no_regex"
  326. }, {
  327. defaultToken: "string"
  328. }
  329. ]
  330. };
  331. if (!options || !options.noES6) {
  332. this.$rules.no_regex.unshift({
  333. regex: "[{}]", onMatch: function(val, state, stack) {
  334. this.next = val == "{" ? this.nextState : "";
  335. if (val == "{" && stack.length) {
  336. stack.unshift("start", state);
  337. }
  338. else if (val == "}" && stack.length) {
  339. stack.shift();
  340. this.next = stack.shift();
  341. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  342. return "paren.quasi.end";
  343. }
  344. return val == "{" ? "paren.lparen" : "paren.rparen";
  345. },
  346. nextState: "start"
  347. }, {
  348. token : "string.quasi.start",
  349. regex : /`/,
  350. push : [{
  351. token : "constant.language.escape",
  352. regex : escapedRe
  353. }, {
  354. token : "paren.quasi.start",
  355. regex : /\${/,
  356. push : "start"
  357. }, {
  358. token : "string.quasi.end",
  359. regex : /`/,
  360. next : "pop"
  361. }, {
  362. defaultToken: "string.quasi"
  363. }]
  364. });
  365. if (!options || options.jsx != false)
  366. JSX.call(this);
  367. }
  368. this.embedRules(DocCommentHighlightRules, "doc-",
  369. [ DocCommentHighlightRules.getEndRule("no_regex") ]);
  370. this.normalizeRules();
  371. };
  372. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  373. function JSX() {
  374. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  375. var jsxTag = {
  376. onMatch : function(val, state, stack) {
  377. var offset = val.charAt(1) == "/" ? 2 : 1;
  378. if (offset == 1) {
  379. if (state != this.nextState)
  380. stack.unshift(this.next, this.nextState, 0);
  381. else
  382. stack.unshift(this.next);
  383. stack[2]++;
  384. } else if (offset == 2) {
  385. if (state == this.nextState) {
  386. stack[1]--;
  387. if (!stack[1] || stack[1] < 0) {
  388. stack.shift();
  389. stack.shift();
  390. }
  391. }
  392. }
  393. return [{
  394. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  395. value: val.slice(0, offset)
  396. }, {
  397. type: "meta.tag.tag-name.xml",
  398. value: val.substr(offset)
  399. }];
  400. },
  401. regex : "</?" + tagRegex + "",
  402. next: "jsxAttributes",
  403. nextState: "jsx"
  404. };
  405. this.$rules.start.unshift(jsxTag);
  406. var jsxJsRule = {
  407. regex: "{",
  408. token: "paren.quasi.start",
  409. push: "start"
  410. };
  411. this.$rules.jsx = [
  412. jsxJsRule,
  413. jsxTag,
  414. {include : "reference"},
  415. {defaultToken: "string"}
  416. ];
  417. this.$rules.jsxAttributes = [{
  418. token : "meta.tag.punctuation.tag-close.xml",
  419. regex : "/?>",
  420. onMatch : function(value, currentState, stack) {
  421. if (currentState == stack[0])
  422. stack.shift();
  423. if (value.length == 2) {
  424. if (stack[0] == this.nextState)
  425. stack[1]--;
  426. if (!stack[1] || stack[1] < 0) {
  427. stack.splice(0, 2);
  428. }
  429. }
  430. this.next = stack[0] || "start";
  431. return [{type: this.token, value: value}];
  432. },
  433. nextState: "jsx"
  434. },
  435. jsxJsRule,
  436. comments("jsxAttributes"),
  437. {
  438. token : "entity.other.attribute-name.xml",
  439. regex : tagRegex
  440. }, {
  441. token : "keyword.operator.attribute-equals.xml",
  442. regex : "="
  443. }, {
  444. token : "text.tag-whitespace.xml",
  445. regex : "\\s+"
  446. }, {
  447. token : "string.attribute-value.xml",
  448. regex : "'",
  449. stateName : "jsx_attr_q",
  450. push : [
  451. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  452. {include : "reference"},
  453. {defaultToken : "string.attribute-value.xml"}
  454. ]
  455. }, {
  456. token : "string.attribute-value.xml",
  457. regex : '"',
  458. stateName : "jsx_attr_qq",
  459. push : [
  460. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  461. {include : "reference"},
  462. {defaultToken : "string.attribute-value.xml"}
  463. ]
  464. },
  465. jsxTag
  466. ];
  467. this.$rules.reference = [{
  468. token : "constant.language.escape.reference.xml",
  469. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  470. }];
  471. }
  472. function comments(next) {
  473. return [
  474. {
  475. token : "comment", // multi line comment
  476. regex : /\/\*/,
  477. next: [
  478. DocCommentHighlightRules.getTagRule(),
  479. {token : "comment", regex : "\\*\\/", next : next || "pop"},
  480. {defaultToken : "comment", caseInsensitive: true}
  481. ]
  482. }, {
  483. token : "comment",
  484. regex : "\\/\\/",
  485. next: [
  486. DocCommentHighlightRules.getTagRule(),
  487. {token : "comment", regex : "$|^", next : next || "pop"},
  488. {defaultToken : "comment", caseInsensitive: true}
  489. ]
  490. }
  491. ];
  492. }
  493. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  494. });
  495. ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  496. "use strict";
  497. var oop = require("../lib/oop");
  498. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  499. var XmlHighlightRules = function(normalize) {
  500. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  501. this.$rules = {
  502. start : [
  503. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  504. {
  505. token : ["punctuation.xml-decl.xml", "keyword.xml-decl.xml"],
  506. regex : "(<\\?)(xml)(?=[\\s])", next : "xml_decl", caseInsensitive: true
  507. },
  508. {
  509. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  510. regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
  511. },
  512. {token : "comment.xml", regex : "<\\!--", next : "comment"},
  513. {
  514. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  515. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  516. },
  517. {include : "tag"},
  518. {token : "text.end-tag-open.xml", regex: "</"},
  519. {token : "text.tag-open.xml", regex: "<"},
  520. {include : "reference"},
  521. {defaultToken : "text.xml"}
  522. ],
  523. xml_decl : [{
  524. token : "entity.other.attribute-name.decl-attribute-name.xml",
  525. regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
  526. }, {
  527. token : "keyword.operator.decl-attribute-equals.xml",
  528. regex : "="
  529. }, {
  530. include: "whitespace"
  531. }, {
  532. include: "string"
  533. }, {
  534. token : "punctuation.xml-decl.xml",
  535. regex : "\\?>",
  536. next : "start"
  537. }],
  538. processing_instruction : [
  539. {token : "punctuation.instruction.xml", regex : "\\?>", next : "start"},
  540. {defaultToken : "instruction.xml"}
  541. ],
  542. doctype : [
  543. {include : "whitespace"},
  544. {include : "string"},
  545. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  546. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  547. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  548. ],
  549. int_subset : [{
  550. token : "text.xml",
  551. regex : "\\s+"
  552. }, {
  553. token: "punctuation.int-subset.xml",
  554. regex: "]",
  555. next: "pop"
  556. }, {
  557. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  558. regex : "(<\\!)(" + tagRegex + ")",
  559. push : [{
  560. token : "text",
  561. regex : "\\s+"
  562. },
  563. {
  564. token : "punctuation.markup-decl.xml",
  565. regex : ">",
  566. next : "pop"
  567. },
  568. {include : "string"}]
  569. }],
  570. cdata : [
  571. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  572. {token : "text.xml", regex : "\\s+"},
  573. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  574. ],
  575. comment : [
  576. {token : "comment.xml", regex : "-->", next : "start"},
  577. {defaultToken : "comment.xml"}
  578. ],
  579. reference : [{
  580. token : "constant.language.escape.reference.xml",
  581. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  582. }],
  583. attr_reference : [{
  584. token : "constant.language.escape.reference.attribute-value.xml",
  585. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  586. }],
  587. tag : [{
  588. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  589. regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  590. next: [
  591. {include : "attributes"},
  592. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  593. ]
  594. }],
  595. tag_whitespace : [
  596. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  597. ],
  598. whitespace : [
  599. {token : "text.whitespace.xml", regex : "\\s+"}
  600. ],
  601. string: [{
  602. token : "string.xml",
  603. regex : "'",
  604. push : [
  605. {token : "string.xml", regex: "'", next: "pop"},
  606. {defaultToken : "string.xml"}
  607. ]
  608. }, {
  609. token : "string.xml",
  610. regex : '"',
  611. push : [
  612. {token : "string.xml", regex: '"', next: "pop"},
  613. {defaultToken : "string.xml"}
  614. ]
  615. }],
  616. attributes: [{
  617. token : "entity.other.attribute-name.xml",
  618. regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
  619. }, {
  620. token : "keyword.operator.attribute-equals.xml",
  621. regex : "="
  622. }, {
  623. include: "tag_whitespace"
  624. }, {
  625. include: "attribute_value"
  626. }],
  627. attribute_value: [{
  628. token : "string.attribute-value.xml",
  629. regex : "'",
  630. push : [
  631. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  632. {include : "attr_reference"},
  633. {defaultToken : "string.attribute-value.xml"}
  634. ]
  635. }, {
  636. token : "string.attribute-value.xml",
  637. regex : '"',
  638. push : [
  639. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  640. {include : "attr_reference"},
  641. {defaultToken : "string.attribute-value.xml"}
  642. ]
  643. }]
  644. };
  645. if (this.constructor === XmlHighlightRules)
  646. this.normalizeRules();
  647. };
  648. (function() {
  649. this.embedTagRules = function(HighlightRules, prefix, tag){
  650. this.$rules.tag.unshift({
  651. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  652. regex : "(<)(" + tag + "(?=\\s|>|$))",
  653. next: [
  654. {include : "attributes"},
  655. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  656. ]
  657. });
  658. this.$rules[tag + "-end"] = [
  659. {include : "attributes"},
  660. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  661. onMatch : function(value, currentState, stack) {
  662. stack.splice(0);
  663. return this.token;
  664. }}
  665. ]
  666. this.embedRules(HighlightRules, prefix, [{
  667. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  668. regex : "(</)(" + tag + "(?=\\s|>|$))",
  669. next: tag + "-end"
  670. }, {
  671. token: "string.cdata.xml",
  672. regex : "<\\!\\[CDATA\\["
  673. }, {
  674. token: "string.cdata.xml",
  675. regex : "\\]\\]>"
  676. }]);
  677. };
  678. }).call(TextHighlightRules.prototype);
  679. oop.inherits(XmlHighlightRules, TextHighlightRules);
  680. exports.XmlHighlightRules = XmlHighlightRules;
  681. });
  682. 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) {
  683. "use strict";
  684. var oop = require("../lib/oop");
  685. var lang = require("../lib/lang");
  686. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  687. 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";
  688. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  689. 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";
  690. var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
  691. 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";
  692. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
  693. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  694. 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";
  695. var CssHighlightRules = function() {
  696. var keywordMapper = this.createKeywordMapper({
  697. "support.function": supportFunction,
  698. "support.constant": supportConstant,
  699. "support.type": supportType,
  700. "support.constant.color": supportConstantColor,
  701. "support.constant.fonts": supportConstantFonts
  702. }, "text", true);
  703. this.$rules = {
  704. "start" : [{
  705. token : "comment", // multi line comment
  706. regex : "\\/\\*",
  707. push : "comment"
  708. }, {
  709. token: "paren.lparen",
  710. regex: "\\{",
  711. push: "ruleset"
  712. }, {
  713. token: "string",
  714. regex: "@.*?{",
  715. push: "media"
  716. }, {
  717. token: "keyword",
  718. regex: "#[a-z0-9-_]+"
  719. }, {
  720. token: "variable",
  721. regex: "\\.[a-z0-9-_]+"
  722. }, {
  723. token: "string",
  724. regex: ":[a-z0-9-_]+"
  725. }, {
  726. token: "constant",
  727. regex: "[a-z0-9-_]+"
  728. }, {
  729. caseInsensitive: true
  730. }],
  731. "media" : [{
  732. token : "comment", // multi line comment
  733. regex : "\\/\\*",
  734. push : "comment"
  735. }, {
  736. token: "paren.lparen",
  737. regex: "\\{",
  738. push: "ruleset"
  739. }, {
  740. token: "string",
  741. regex: "\\}",
  742. next: "pop"
  743. }, {
  744. token: "keyword",
  745. regex: "#[a-z0-9-_]+"
  746. }, {
  747. token: "variable",
  748. regex: "\\.[a-z0-9-_]+"
  749. }, {
  750. token: "string",
  751. regex: ":[a-z0-9-_]+"
  752. }, {
  753. token: "constant",
  754. regex: "[a-z0-9-_]+"
  755. }, {
  756. caseInsensitive: true
  757. }],
  758. "comment" : [{
  759. token : "comment",
  760. regex : "\\*\\/",
  761. next : "pop"
  762. }, {
  763. defaultToken : "comment"
  764. }],
  765. "ruleset" : [
  766. {
  767. token : "paren.rparen",
  768. regex : "\\}",
  769. next: "pop"
  770. }, {
  771. token : "comment", // multi line comment
  772. regex : "\\/\\*",
  773. push : "comment"
  774. }, {
  775. token : "string", // single line
  776. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  777. }, {
  778. token : "string", // single line
  779. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  780. }, {
  781. token : ["constant.numeric", "keyword"],
  782. 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|%)"
  783. }, {
  784. token : "constant.numeric",
  785. regex : numRe
  786. }, {
  787. token : "constant.numeric", // hex6 color
  788. regex : "#[a-f0-9]{6}"
  789. }, {
  790. token : "constant.numeric", // hex3 color
  791. regex : "#[a-f0-9]{3}"
  792. }, {
  793. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  794. regex : pseudoElements
  795. }, {
  796. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  797. regex : pseudoClasses
  798. }, {
  799. token : ["support.function", "string", "support.function"],
  800. regex : "(url\\()(.*)(\\))"
  801. }, {
  802. token : keywordMapper,
  803. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  804. }, {
  805. caseInsensitive: true
  806. }]
  807. };
  808. this.normalizeRules();
  809. };
  810. oop.inherits(CssHighlightRules, TextHighlightRules);
  811. exports.CssHighlightRules = CssHighlightRules;
  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/markdown_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules","ace/mode/html_highlight_rules","ace/mode/css_highlight_rules"], function(require, exports, module) {
  887. "use strict";
  888. var oop = require("../lib/oop");
  889. var lang = require("../lib/lang");
  890. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  891. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  892. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  893. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  894. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  895. var escaped = function(ch) {
  896. return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*";
  897. }
  898. function github_embed(tag, prefix) {
  899. return { // Github style block
  900. token : "support.function",
  901. regex : "^\\s*```" + tag + "\\s*$",
  902. push : prefix + "start"
  903. };
  904. }
  905. var MarkdownHighlightRules = function() {
  906. HtmlHighlightRules.call(this);
  907. this.$rules["start"].unshift({
  908. token : "empty_line",
  909. regex : '^$',
  910. next: "allowBlock"
  911. }, { // h1
  912. token: "markup.heading.1",
  913. regex: "^=+(?=\\s*$)"
  914. }, { // h2
  915. token: "markup.heading.2",
  916. regex: "^\\-+(?=\\s*$)"
  917. }, {
  918. token : function(value) {
  919. return "markup.heading." + value.length;
  920. },
  921. regex : /^#{1,6}(?=\s*[^ #]|\s+#.)/,
  922. next : "header"
  923. },
  924. github_embed("(?:javascript|js)", "jscode-"),
  925. github_embed("xml", "xmlcode-"),
  926. github_embed("html", "htmlcode-"),
  927. github_embed("css", "csscode-"),
  928. { // Github style block
  929. token : "support.function",
  930. regex : "^\\s*```\\s*\\S*(?:{.*?\\})?\\s*$",
  931. next : "githubblock"
  932. }, { // block quote
  933. token : "string.blockquote",
  934. regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  935. next : "blockquote"
  936. }, { // HR * - _
  937. token : "constant",
  938. regex : "^ {0,2}(?:(?: ?\\* ?){3,}|(?: ?\\- ?){3,}|(?: ?\\_ ?){3,})\\s*$",
  939. next: "allowBlock"
  940. }, { // list
  941. token : "markup.list",
  942. regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  943. next : "listblock-start"
  944. }, {
  945. include : "basic"
  946. });
  947. this.addRules({
  948. "basic" : [{
  949. token : "constant.language.escape",
  950. regex : /\\[\\`*_{}\[\]()#+\-.!]/
  951. }, { // code span `
  952. token : "support.function",
  953. regex : "(`+)(.*?[^`])(\\1)"
  954. }, { // reference
  955. token : ["text", "constant", "text", "url", "string", "text"],
  956. regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
  957. }, { // link by reference
  958. token : ["text", "string", "text", "constant", "text"],
  959. regex : "(\\[)(" + escaped("]") + ")(\\]\\s*\\[)("+ escaped("]") + ")(\\])"
  960. }, { // link by url
  961. token : ["text", "string", "text", "markup.underline", "string", "text"],
  962. regex : "(\\[)(" + // [
  963. escaped("]") + // link text
  964. ")(\\]\\()"+ // ](
  965. '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href
  966. '(\\s*"' + escaped('"') + '"\\s*)?' + // "title"
  967. "(\\))" // )
  968. }, { // strong ** __
  969. token : "string.strong",
  970. regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
  971. }, { // emphasis * _
  972. token : "string.emphasis",
  973. regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
  974. }, { //
  975. token : ["text", "url", "text"],
  976. regex : "(<)("+
  977. "(?:https?|ftp|dict):[^'\">\\s]+"+
  978. "|"+
  979. "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+"+
  980. ")(>)"
  981. }],
  982. "allowBlock": [
  983. {token : "support.function", regex : "^ {4}.+", next : "allowBlock"},
  984. {token : "empty_line", regex : '^$', next: "allowBlock"},
  985. {token : "empty", regex : "", next : "start"}
  986. ],
  987. "header" : [{
  988. regex: "$",
  989. next : "start"
  990. }, {
  991. include: "basic"
  992. }, {
  993. defaultToken : "heading"
  994. } ],
  995. "listblock-start" : [{
  996. token : "support.variable",
  997. regex : /(?:\[[ x]\])?/,
  998. next : "listblock"
  999. }],
  1000. "listblock" : [ { // Lists only escape on completely blank lines.
  1001. token : "empty_line",
  1002. regex : "^$",
  1003. next : "start"
  1004. }, { // list
  1005. token : "markup.list",
  1006. regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  1007. next : "listblock-start"
  1008. }, {
  1009. include : "basic", noEscape: true
  1010. }, { // Github style block
  1011. token : "support.function",
  1012. regex : "^\\s*```\\s*[a-zA-Z]*(?:{.*?\\})?\\s*$",
  1013. next : "githubblock"
  1014. }, {
  1015. defaultToken : "list" //do not use markup.list to allow stling leading `*` differntly
  1016. } ],
  1017. "blockquote" : [ { // Blockquotes only escape on blank lines.
  1018. token : "empty_line",
  1019. regex : "^\\s*$",
  1020. next : "start"
  1021. }, { // block quote
  1022. token : "string.blockquote",
  1023. regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  1024. next : "blockquote"
  1025. }, {
  1026. include : "basic", noEscape: true
  1027. }, {
  1028. defaultToken : "string.blockquote"
  1029. } ],
  1030. "githubblock" : [ {
  1031. token : "support.function",
  1032. regex : "^\\s*```",
  1033. next : "start"
  1034. }, {
  1035. token : "support.function",
  1036. regex : ".+"
  1037. } ]
  1038. });
  1039. this.embedRules(JavaScriptHighlightRules, "jscode-", [{
  1040. token : "support.function",
  1041. regex : "^\\s*```",
  1042. next : "pop"
  1043. }]);
  1044. this.embedRules(HtmlHighlightRules, "htmlcode-", [{
  1045. token : "support.function",
  1046. regex : "^\\s*```",
  1047. next : "pop"
  1048. }]);
  1049. this.embedRules(CssHighlightRules, "csscode-", [{
  1050. token : "support.function",
  1051. regex : "^\\s*```",
  1052. next : "pop"
  1053. }]);
  1054. this.embedRules(XmlHighlightRules, "xmlcode-", [{
  1055. token : "support.function",
  1056. regex : "^\\s*```",
  1057. next : "pop"
  1058. }]);
  1059. this.normalizeRules();
  1060. };
  1061. oop.inherits(MarkdownHighlightRules, TextHighlightRules);
  1062. exports.MarkdownHighlightRules = MarkdownHighlightRules;
  1063. });
  1064. ace.define("ace/mode/scss_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
  1065. "use strict";
  1066. var oop = require("../lib/oop");
  1067. var lang = require("../lib/lang");
  1068. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  1069. var ScssHighlightRules = function() {
  1070. var properties = lang.arrayToMap( (function () {
  1071. var browserPrefix = ("-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-").split("|");
  1072. var prefixProperties = ("appearance|background-clip|background-inline-policy|background-origin|" +
  1073. "background-size|binding|border-bottom-colors|border-left-colors|" +
  1074. "border-right-colors|border-top-colors|border-end|border-end-color|" +
  1075. "border-end-style|border-end-width|border-image|border-start|" +
  1076. "border-start-color|border-start-style|border-start-width|box-align|" +
  1077. "box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|" +
  1078. "box-pack|box-sizing|column-count|column-gap|column-width|column-rule|" +
  1079. "column-rule-width|column-rule-style|column-rule-color|float-edge|" +
  1080. "font-feature-settings|font-language-override|force-broken-image-icon|" +
  1081. "image-region|margin-end|margin-start|opacity|outline|outline-color|" +
  1082. "outline-offset|outline-radius|outline-radius-bottomleft|" +
  1083. "outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|" +
  1084. "outline-style|outline-width|padding-end|padding-start|stack-sizing|" +
  1085. "tab-size|text-blink|text-decoration-color|text-decoration-line|" +
  1086. "text-decoration-style|transform|transform-origin|transition|" +
  1087. "transition-delay|transition-duration|transition-property|" +
  1088. "transition-timing-function|user-focus|user-input|user-modify|user-select|" +
  1089. "window-shadow|border-radius").split("|");
  1090. var properties = ("azimuth|background-attachment|background-color|background-image|" +
  1091. "background-position|background-repeat|background|border-bottom-color|" +
  1092. "border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
  1093. "border-color|border-left-color|border-left-style|border-left-width|" +
  1094. "border-left|border-right-color|border-right-style|border-right-width|" +
  1095. "border-right|border-spacing|border-style|border-top-color|" +
  1096. "border-top-style|border-top-width|border-top|border-width|border|bottom|" +
  1097. "box-shadow|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
  1098. "counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
  1099. "elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
  1100. "font-stretch|font-style|font-variant|font-weight|font|height|left|" +
  1101. "letter-spacing|line-height|list-style-image|list-style-position|" +
  1102. "list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
  1103. "margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
  1104. "min-width|opacity|orphans|outline-color|" +
  1105. "outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
  1106. "padding-left|padding-right|padding-top|padding|page-break-after|" +
  1107. "page-break-before|page-break-inside|page|pause-after|pause-before|" +
  1108. "pause|pitch-range|pitch|play-during|position|quotes|richness|right|" +
  1109. "size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
  1110. "stress|table-layout|text-align|text-decoration|text-indent|" +
  1111. "text-shadow|text-transform|top|unicode-bidi|vertical-align|" +
  1112. "visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
  1113. "z-index").split("|");
  1114. var ret = [];
  1115. for (var i=0, ln=browserPrefix.length; i<ln; i++) {
  1116. Array.prototype.push.apply(
  1117. ret,
  1118. (( browserPrefix[i] + prefixProperties.join("|" + browserPrefix[i]) ).split("|"))
  1119. );
  1120. }
  1121. Array.prototype.push.apply(ret, prefixProperties);
  1122. Array.prototype.push.apply(ret, properties);
  1123. return ret;
  1124. })() );
  1125. var functions = lang.arrayToMap(
  1126. ("hsl|hsla|rgb|rgba|url|attr|counter|counters|abs|adjust_color|adjust_hue|" +
  1127. "alpha|join|blue|ceil|change_color|comparable|complement|darken|desaturate|" +
  1128. "floor|grayscale|green|hue|if|invert|join|length|lighten|lightness|mix|" +
  1129. "nth|opacify|opacity|percentage|quote|red|round|saturate|saturation|" +
  1130. "scale_color|transparentize|type_of|unit|unitless|unqoute").split("|")
  1131. );
  1132. var constants = lang.arrayToMap(
  1133. ("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
  1134. "block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
  1135. "char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
  1136. "decimal-leading-zero|decimal|default|disabled|disc|" +
  1137. "distribute-all-lines|distribute-letter|distribute-space|" +
  1138. "distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
  1139. "hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
  1140. "ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
  1141. "ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
  1142. "inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
  1143. "keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
  1144. "lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
  1145. "medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
  1146. "nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
  1147. "overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
  1148. "ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
  1149. "solid|square|static|strict|super|sw-resize|table-footer-group|" +
  1150. "table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
  1151. "transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
  1152. "vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
  1153. "zero").split("|")
  1154. );
  1155. var colors = lang.arrayToMap(
  1156. ("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
  1157. "purple|red|silver|teal|white|yellow").split("|")
  1158. );
  1159. var keywords = lang.arrayToMap(
  1160. ("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|def|end|declare").split("|")
  1161. )
  1162. var tags = lang.arrayToMap(
  1163. ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
  1164. "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
  1165. "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
  1166. "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
  1167. "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
  1168. "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
  1169. "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
  1170. "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
  1171. "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
  1172. );
  1173. var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
  1174. this.$rules = {
  1175. "start" : [
  1176. {
  1177. token : "comment",
  1178. regex : "\\/\\/.*$"
  1179. },
  1180. {
  1181. token : "comment", // multi line comment
  1182. regex : "\\/\\*",
  1183. next : "comment"
  1184. }, {
  1185. token : "string", // single line
  1186. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  1187. }, {
  1188. token : "string", // multi line string start
  1189. regex : '["].*\\\\$',
  1190. next : "qqstring"
  1191. }, {
  1192. token : "string", // single line
  1193. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  1194. }, {
  1195. token : "string", // multi line string start
  1196. regex : "['].*\\\\$",
  1197. next : "qstring"
  1198. }, {
  1199. token : "constant.numeric",
  1200. regex : numRe + "(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)"
  1201. }, {
  1202. token : "constant.numeric", // hex6 color
  1203. regex : "#[a-f0-9]{6}"
  1204. }, {
  1205. token : "constant.numeric", // hex3 color
  1206. regex : "#[a-f0-9]{3}"
  1207. }, {
  1208. token : "constant.numeric",
  1209. regex : numRe
  1210. }, {
  1211. token : ["support.function", "string", "support.function"],
  1212. regex : "(url\\()(.*)(\\))"
  1213. }, {
  1214. token : function(value) {
  1215. if (properties.hasOwnProperty(value.toLowerCase()))
  1216. return "support.type";
  1217. if (keywords.hasOwnProperty(value))
  1218. return "keyword";
  1219. else if (constants.hasOwnProperty(value))
  1220. return "constant.language";
  1221. else if (functions.hasOwnProperty(value))
  1222. return "support.function";
  1223. else if (colors.hasOwnProperty(value.toLowerCase()))
  1224. return "support.constant.color";
  1225. else if (tags.hasOwnProperty(value.toLowerCase()))
  1226. return "variable.language";
  1227. else
  1228. return "text";
  1229. },
  1230. regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
  1231. }, {
  1232. token : "variable",
  1233. regex : "[a-z_\\-$][a-z0-9_\\-$]*\\b"
  1234. }, {
  1235. token: "variable.language",
  1236. regex: "#[a-z0-9-_]+"
  1237. }, {
  1238. token: "variable.language",
  1239. regex: "\\.[a-z0-9-_]+"
  1240. }, {
  1241. token: "variable.language",
  1242. regex: ":[a-z0-9-_]+"
  1243. }, {
  1244. token: "constant",
  1245. regex: "[a-z0-9-_]+"
  1246. }, {
  1247. token : "keyword.operator",
  1248. regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
  1249. }, {
  1250. token : "paren.lparen",
  1251. regex : "[[({]"
  1252. }, {
  1253. token : "paren.rparen",
  1254. regex : "[\\])}]"
  1255. }, {
  1256. token : "text",
  1257. regex : "\\s+"
  1258. }, {
  1259. caseInsensitive: true
  1260. }
  1261. ],
  1262. "comment" : [
  1263. {
  1264. token : "comment", // closing comment
  1265. regex : ".*?\\*\\/",
  1266. next : "start"
  1267. }, {
  1268. token : "comment", // comment spanning whole line
  1269. regex : ".+"
  1270. }
  1271. ],
  1272. "qqstring" : [
  1273. {
  1274. token : "string",
  1275. regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
  1276. next : "start"
  1277. }, {
  1278. token : "string",
  1279. regex : '.+'
  1280. }
  1281. ],
  1282. "qstring" : [
  1283. {
  1284. token : "string",
  1285. regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
  1286. next : "start"
  1287. }, {
  1288. token : "string",
  1289. regex : '.+'
  1290. }
  1291. ]
  1292. };
  1293. };
  1294. oop.inherits(ScssHighlightRules, TextHighlightRules);
  1295. exports.ScssHighlightRules = ScssHighlightRules;
  1296. });
  1297. ace.define("ace/mode/less_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/css_highlight_rules"], function(require, exports, module) {
  1298. "use strict";
  1299. var oop = require("../lib/oop");
  1300. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  1301. var CssHighlightRules = require('./css_highlight_rules');
  1302. var LessHighlightRules = function() {
  1303. var keywordList = "@import|@media|@font-face|@keyframes|@-webkit-keyframes|@supports|" +
  1304. "@charset|@plugin|@namespace|@document|@page|@viewport|@-ms-viewport|" +
  1305. "or|and|when|not";
  1306. var keywords = keywordList.split('|');
  1307. var properties = CssHighlightRules.supportType.split('|');
  1308. var keywordMapper = this.createKeywordMapper({
  1309. "support.constant": CssHighlightRules.supportConstant,
  1310. "keyword": keywordList,
  1311. "support.constant.color": CssHighlightRules.supportConstantColor,
  1312. "support.constant.fonts": CssHighlightRules.supportConstantFonts
  1313. }, "identifier", true);
  1314. var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
  1315. this.$rules = {
  1316. "start" : [
  1317. {
  1318. token : "comment",
  1319. regex : "\\/\\/.*$"
  1320. },
  1321. {
  1322. token : "comment", // multi line comment
  1323. regex : "\\/\\*",
  1324. next : "comment"
  1325. }, {
  1326. token : "string", // single line
  1327. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  1328. }, {
  1329. token : "string", // single line
  1330. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  1331. }, {
  1332. token : ["constant.numeric", "keyword"],
  1333. 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|%)"
  1334. }, {
  1335. token : "constant.numeric", // hex6 color
  1336. regex : "#[a-f0-9]{6}"
  1337. }, {
  1338. token : "constant.numeric", // hex3 color
  1339. regex : "#[a-f0-9]{3}"
  1340. }, {
  1341. token : "constant.numeric",
  1342. regex : numRe
  1343. }, {
  1344. token : ["support.function", "paren.lparen", "string", "paren.rparen"],
  1345. regex : "(url)(\\()(.*)(\\))"
  1346. }, {
  1347. token : ["support.function", "paren.lparen"],
  1348. regex : "(:extend|[a-z0-9_\\-]+)(\\()"
  1349. }, {
  1350. token : function(value) {
  1351. if (keywords.indexOf(value.toLowerCase()) > -1)
  1352. return "keyword";
  1353. else
  1354. return "variable";
  1355. },
  1356. regex : "[@\\$][a-z0-9_\\-@\\$]*\\b"
  1357. }, {
  1358. token : "variable",
  1359. regex : "[@\\$]\\{[a-z0-9_\\-@\\$]*\\}"
  1360. }, {
  1361. token : function(first, second) {
  1362. if(properties.indexOf(first.toLowerCase()) > -1) {
  1363. return ["support.type.property", "text"];
  1364. }
  1365. else {
  1366. return ["support.type.unknownProperty", "text"];
  1367. }
  1368. },
  1369. regex : "([a-z0-9-_]+)(\\s*:)"
  1370. }, {
  1371. token : "keyword",
  1372. regex : "&" // special case - always treat as keyword
  1373. }, {
  1374. token : keywordMapper,
  1375. regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
  1376. }, {
  1377. token: "variable.language",
  1378. regex: "#[a-z0-9-_]+"
  1379. }, {
  1380. token: "variable.language",
  1381. regex: "\\.[a-z0-9-_]+"
  1382. }, {
  1383. token: "variable.language",
  1384. regex: ":[a-z_][a-z0-9-_]*"
  1385. }, {
  1386. token: "constant",
  1387. regex: "[a-z0-9-_]+"
  1388. }, {
  1389. token : "keyword.operator",
  1390. regex : "<|>|<=|>=|=|!=|-|%|\\+|\\*"
  1391. }, {
  1392. token : "paren.lparen",
  1393. regex : "[[({]"
  1394. }, {
  1395. token : "paren.rparen",
  1396. regex : "[\\])}]"
  1397. }, {
  1398. token : "text",
  1399. regex : "\\s+"
  1400. }, {
  1401. caseInsensitive: true
  1402. }
  1403. ],
  1404. "comment" : [
  1405. {
  1406. token : "comment", // closing comment
  1407. regex : ".*?\\*\\/",
  1408. next : "start"
  1409. }, {
  1410. token : "comment", // comment spanning whole line
  1411. regex : ".+"
  1412. }
  1413. ]
  1414. };
  1415. this.normalizeRules();
  1416. };
  1417. oop.inherits(LessHighlightRules, TextHighlightRules);
  1418. exports.LessHighlightRules = LessHighlightRules;
  1419. });
  1420. ace.define("ace/mode/coffee_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  1421. "use strict";
  1422. var oop = require("../lib/oop");
  1423. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  1424. oop.inherits(CoffeeHighlightRules, TextHighlightRules);
  1425. function CoffeeHighlightRules() {
  1426. var identifier = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*";
  1427. var keywords = (
  1428. "this|throw|then|try|typeof|super|switch|return|break|by|continue|" +
  1429. "catch|class|in|instanceof|is|isnt|if|else|extends|for|own|" +
  1430. "finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" +
  1431. "or|on|unless|until|and|yes"
  1432. );
  1433. var langConstant = (
  1434. "true|false|null|undefined|NaN|Infinity"
  1435. );
  1436. var illegal = (
  1437. "case|const|default|function|var|void|with|enum|export|implements|" +
  1438. "interface|let|package|private|protected|public|static|yield"
  1439. );
  1440. var supportClass = (
  1441. "Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|String|" +
  1442. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
  1443. "SyntaxError|TypeError|URIError|" +
  1444. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  1445. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray"
  1446. );
  1447. var supportFunction = (
  1448. "Math|JSON|isNaN|isFinite|parseInt|parseFloat|encodeURI|" +
  1449. "encodeURIComponent|decodeURI|decodeURIComponent|String|"
  1450. );
  1451. var variableLanguage = (
  1452. "window|arguments|prototype|document"
  1453. );
  1454. var keywordMapper = this.createKeywordMapper({
  1455. "keyword": keywords,
  1456. "constant.language": langConstant,
  1457. "invalid.illegal": illegal,
  1458. "language.support.class": supportClass,
  1459. "language.support.function": supportFunction,
  1460. "variable.language": variableLanguage
  1461. }, "identifier");
  1462. var functionRule = {
  1463. token: ["paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"],
  1464. regex: /(?:(\()((?:"[^")]*?"|'[^')]*?'|\/[^\/)]*?\/|[^()"'\/])*?)(\))(\s*))?([\-=]>)/.source
  1465. };
  1466. var stringEscape = /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)/;
  1467. this.$rules = {
  1468. start : [
  1469. {
  1470. token : "constant.numeric",
  1471. regex : "(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"
  1472. }, {
  1473. stateName: "qdoc",
  1474. token : "string", regex : "'''", next : [
  1475. {token : "string", regex : "'''", next : "start"},
  1476. {token : "constant.language.escape", regex : stringEscape},
  1477. {defaultToken: "string"}
  1478. ]
  1479. }, {
  1480. stateName: "qqdoc",
  1481. token : "string",
  1482. regex : '"""',
  1483. next : [
  1484. {token : "string", regex : '"""', next : "start"},
  1485. {token : "paren.string", regex : '#{', push : "start"},
  1486. {token : "constant.language.escape", regex : stringEscape},
  1487. {defaultToken: "string"}
  1488. ]
  1489. }, {
  1490. stateName: "qstring",
  1491. token : "string", regex : "'", next : [
  1492. {token : "string", regex : "'", next : "start"},
  1493. {token : "constant.language.escape", regex : stringEscape},
  1494. {defaultToken: "string"}
  1495. ]
  1496. }, {
  1497. stateName: "qqstring",
  1498. token : "string.start", regex : '"', next : [
  1499. {token : "string.end", regex : '"', next : "start"},
  1500. {token : "paren.string", regex : '#{', push : "start"},
  1501. {token : "constant.language.escape", regex : stringEscape},
  1502. {defaultToken: "string"}
  1503. ]
  1504. }, {
  1505. stateName: "js",
  1506. token : "string", regex : "`", next : [
  1507. {token : "string", regex : "`", next : "start"},
  1508. {token : "constant.language.escape", regex : stringEscape},
  1509. {defaultToken: "string"}
  1510. ]
  1511. }, {
  1512. regex: "[{}]", onMatch: function(val, state, stack) {
  1513. this.next = "";
  1514. if (val == "{" && stack.length) {
  1515. stack.unshift("start", state);
  1516. return "paren";
  1517. }
  1518. if (val == "}" && stack.length) {
  1519. stack.shift();
  1520. this.next = stack.shift() || "";
  1521. if (this.next.indexOf("string") != -1)
  1522. return "paren.string";
  1523. }
  1524. return "paren";
  1525. }
  1526. }, {
  1527. token : "string.regex",
  1528. regex : "///",
  1529. next : "heregex"
  1530. }, {
  1531. token : "string.regex",
  1532. regex : /(?:\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)(?:[imgy]{0,4})(?!\w)/
  1533. }, {
  1534. token : "comment",
  1535. regex : "###(?!#)",
  1536. next : "comment"
  1537. }, {
  1538. token : "comment",
  1539. regex : "#.*"
  1540. }, {
  1541. token : ["punctuation.operator", "text", "identifier"],
  1542. regex : "(\\.)(\\s*)(" + illegal + ")"
  1543. }, {
  1544. token : "punctuation.operator",
  1545. regex : "\\.{1,3}"
  1546. }, {
  1547. token : ["keyword", "text", "language.support.class",
  1548. "text", "keyword", "text", "language.support.class"],
  1549. regex : "(class)(\\s+)(" + identifier + ")(?:(\\s+)(extends)(\\s+)(" + identifier + "))?"
  1550. }, {
  1551. token : ["entity.name.function", "text", "keyword.operator", "text"].concat(functionRule.token),
  1552. regex : "(" + identifier + ")(\\s*)([=:])(\\s*)" + functionRule.regex
  1553. },
  1554. functionRule,
  1555. {
  1556. token : "variable",
  1557. regex : "@(?:" + identifier + ")?"
  1558. }, {
  1559. token: keywordMapper,
  1560. regex : identifier
  1561. }, {
  1562. token : "punctuation.operator",
  1563. regex : "\\,|\\."
  1564. }, {
  1565. token : "storage.type",
  1566. regex : "[\\-=]>"
  1567. }, {
  1568. token : "keyword.operator",
  1569. regex : "(?:[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|[!*+-=><])"
  1570. }, {
  1571. token : "paren.lparen",
  1572. regex : "[({[]"
  1573. }, {
  1574. token : "paren.rparen",
  1575. regex : "[\\]})]"
  1576. }, {
  1577. token : "text",
  1578. regex : "\\s+"
  1579. }],
  1580. heregex : [{
  1581. token : "string.regex",
  1582. regex : '.*?///[imgy]{0,4}',
  1583. next : "start"
  1584. }, {
  1585. token : "comment.regex",
  1586. regex : "\\s+(?:#.*)?"
  1587. }, {
  1588. token : "string.regex",
  1589. regex : "\\S+"
  1590. }],
  1591. comment : [{
  1592. token : "comment",
  1593. regex : '###',
  1594. next : "start"
  1595. }, {
  1596. defaultToken : "comment"
  1597. }]
  1598. };
  1599. this.normalizeRules();
  1600. }
  1601. exports.CoffeeHighlightRules = CoffeeHighlightRules;
  1602. });
  1603. ace.define("ace/mode/jade_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/markdown_highlight_rules","ace/mode/scss_highlight_rules","ace/mode/less_highlight_rules","ace/mode/coffee_highlight_rules","ace/mode/javascript_highlight_rules"], function(require, exports, module) {
  1604. "use strict";
  1605. var oop = require("../lib/oop");
  1606. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  1607. var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
  1608. var SassHighlightRules = require("./scss_highlight_rules").ScssHighlightRules;
  1609. var LessHighlightRules = require("./less_highlight_rules").LessHighlightRules;
  1610. var CoffeeHighlightRules = require("./coffee_highlight_rules").CoffeeHighlightRules;
  1611. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1612. function mixin_embed(tag, prefix) {
  1613. return {
  1614. token : "entity.name.function.jade",
  1615. regex : "^\\s*\\:" + tag,
  1616. next : prefix + "start"
  1617. };
  1618. }
  1619. var JadeHighlightRules = function() {
  1620. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  1621. "u[0-9a-fA-F]{4}|" + // unicode
  1622. "[0-2][0-7]{0,2}|" + // oct
  1623. "3[0-6][0-7]?|" + // oct
  1624. "37[0-7]?|" + // oct
  1625. "[4-7][0-7]?|" + //oct
  1626. ".)";
  1627. this.$rules =
  1628. {
  1629. "start": [
  1630. {
  1631. token: "keyword.control.import.include.jade",
  1632. regex: "\\s*\\binclude\\b"
  1633. },
  1634. {
  1635. token: "keyword.other.doctype.jade",
  1636. regex: "^!!!\\s*(?:[a-zA-Z0-9-_]+)?"
  1637. },
  1638. {
  1639. onMatch: function(value, currentState, stack) {
  1640. stack.unshift(this.next, value.length - 2, currentState);
  1641. return "comment";
  1642. },
  1643. regex: /^\s*\/\//,
  1644. next: "comment_block"
  1645. },
  1646. mixin_embed("markdown", "markdown-"),
  1647. mixin_embed("sass", "sass-"),
  1648. mixin_embed("less", "less-"),
  1649. mixin_embed("coffee", "coffee-"),
  1650. {
  1651. token: [ "storage.type.function.jade",
  1652. "entity.name.function.jade",
  1653. "punctuation.definition.parameters.begin.jade",
  1654. "variable.parameter.function.jade",
  1655. "punctuation.definition.parameters.end.jade"
  1656. ],
  1657. regex: "^(\\s*mixin)( [\\w\\-]+)(\\s*\\()(.*?)(\\))"
  1658. },
  1659. {
  1660. token: [ "storage.type.function.jade", "entity.name.function.jade"],
  1661. regex: "^(\\s*mixin)( [\\w\\-]+)"
  1662. },
  1663. {
  1664. token: "source.js.embedded.jade",
  1665. regex: "^\\s*(?:-|=|!=)",
  1666. next: "js-start"
  1667. },
  1668. {
  1669. token: "string.interpolated.jade",
  1670. regex: "[#!]\\{[^\\}]+\\}"
  1671. },
  1672. {
  1673. token: "meta.tag.any.jade",
  1674. regex: /^\s*(?!\w+:)(?:[\w-]+|(?=\.|#)])/,
  1675. next: "tag_single"
  1676. },
  1677. {
  1678. token: "suport.type.attribute.id.jade",
  1679. regex: "#\\w+"
  1680. },
  1681. {
  1682. token: "suport.type.attribute.class.jade",
  1683. regex: "\\.\\w+"
  1684. },
  1685. {
  1686. token: "punctuation",
  1687. regex: "\\s*(?:\\()",
  1688. next: "tag_attributes"
  1689. }
  1690. ],
  1691. "comment_block": [
  1692. {regex: /^\s*(?:\/\/)?/, onMatch: function(value, currentState, stack) {
  1693. if (value.length <= stack[1]) {
  1694. if (value.slice(-1) == "/") {
  1695. stack[1] = value.length - 2;
  1696. this.next = "";
  1697. return "comment";
  1698. }
  1699. stack.shift();
  1700. stack.shift();
  1701. this.next = stack.shift();
  1702. return "text";
  1703. } else {
  1704. this.next = "";
  1705. return "comment";
  1706. }
  1707. }, next: "start"},
  1708. {defaultToken: "comment"}
  1709. ],
  1710. "tag_single": [
  1711. {
  1712. token: "entity.other.attribute-name.class.jade",
  1713. regex: "\\.[\\w-]+"
  1714. },
  1715. {
  1716. token: "entity.other.attribute-name.id.jade",
  1717. regex: "#[\\w-]+"
  1718. },
  1719. {
  1720. token: ["text", "punctuation"],
  1721. regex: "($)|((?!\\.|#|=|-))",
  1722. next: "start"
  1723. }
  1724. ],
  1725. "tag_attributes": [
  1726. {
  1727. token : "string",
  1728. regex : "'(?=.)",
  1729. next : "qstring"
  1730. },
  1731. {
  1732. token : "string",
  1733. regex : '"(?=.)',
  1734. next : "qqstring"
  1735. },
  1736. {
  1737. token: ["entity.other.attribute-name.jade", "punctuation"],
  1738. regex: "([a-zA-Z:\\.-]+)(=)?",
  1739. next: "attribute_strings"
  1740. },
  1741. {
  1742. token: "punctuation",
  1743. regex: "\\)",
  1744. next: "start"
  1745. }
  1746. ],
  1747. "attribute_strings": [
  1748. {
  1749. token : "string",
  1750. regex : "'(?=.)",
  1751. next : "qstring"
  1752. },
  1753. {
  1754. token : "string",
  1755. regex : '"(?=.)',
  1756. next : "qqstring"
  1757. },
  1758. {
  1759. token : "string",
  1760. regex : '(?=\\S)',
  1761. next : "tag_attributes"
  1762. }
  1763. ],
  1764. "qqstring" : [
  1765. {
  1766. token : "constant.language.escape",
  1767. regex : escapedRe
  1768. }, {
  1769. token : "string",
  1770. regex : '[^"\\\\]+'
  1771. }, {
  1772. token : "string",
  1773. regex : "\\\\$",
  1774. next : "qqstring"
  1775. }, {
  1776. token : "string",
  1777. regex : '"|$',
  1778. next : "tag_attributes"
  1779. }
  1780. ],
  1781. "qstring" : [
  1782. {
  1783. token : "constant.language.escape",
  1784. regex : escapedRe
  1785. }, {
  1786. token : "string",
  1787. regex : "[^'\\\\]+"
  1788. }, {
  1789. token : "string",
  1790. regex : "\\\\$",
  1791. next : "qstring"
  1792. }, {
  1793. token : "string",
  1794. regex : "'|$",
  1795. next : "tag_attributes"
  1796. }
  1797. ]
  1798. };
  1799. this.embedRules(JavaScriptHighlightRules, "js-", [{
  1800. token: "text",
  1801. regex: ".$",
  1802. next: "start"
  1803. }]);
  1804. };
  1805. oop.inherits(JadeHighlightRules, TextHighlightRules);
  1806. exports.JadeHighlightRules = JadeHighlightRules;
  1807. });
  1808. ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
  1809. "use strict";
  1810. var oop = require("../../lib/oop");
  1811. var BaseFoldMode = require("./fold_mode").FoldMode;
  1812. var Range = require("../../range").Range;
  1813. var FoldMode = exports.FoldMode = function() {};
  1814. oop.inherits(FoldMode, BaseFoldMode);
  1815. (function() {
  1816. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1817. var range = this.indentationBlock(session, row);
  1818. if (range)
  1819. return range;
  1820. var re = /\S/;
  1821. var line = session.getLine(row);
  1822. var startLevel = line.search(re);
  1823. if (startLevel == -1 || line[startLevel] != "#")
  1824. return;
  1825. var startColumn = line.length;
  1826. var maxRow = session.getLength();
  1827. var startRow = row;
  1828. var endRow = row;
  1829. while (++row < maxRow) {
  1830. line = session.getLine(row);
  1831. var level = line.search(re);
  1832. if (level == -1)
  1833. continue;
  1834. if (line[level] != "#")
  1835. break;
  1836. endRow = row;
  1837. }
  1838. if (endRow > startRow) {
  1839. var endColumn = session.getLine(endRow).length;
  1840. return new Range(startRow, startColumn, endRow, endColumn);
  1841. }
  1842. };
  1843. this.getFoldWidget = function(session, foldStyle, row) {
  1844. var line = session.getLine(row);
  1845. var indent = line.search(/\S/);
  1846. var next = session.getLine(row + 1);
  1847. var prev = session.getLine(row - 1);
  1848. var prevIndent = prev.search(/\S/);
  1849. var nextIndent = next.search(/\S/);
  1850. if (indent == -1) {
  1851. session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
  1852. return "";
  1853. }
  1854. if (prevIndent == -1) {
  1855. if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
  1856. session.foldWidgets[row - 1] = "";
  1857. session.foldWidgets[row + 1] = "";
  1858. return "start";
  1859. }
  1860. } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
  1861. if (session.getLine(row - 2).search(/\S/) == -1) {
  1862. session.foldWidgets[row - 1] = "start";
  1863. session.foldWidgets[row + 1] = "";
  1864. return "";
  1865. }
  1866. }
  1867. if (prevIndent!= -1 && prevIndent < indent)
  1868. session.foldWidgets[row - 1] = "start";
  1869. else
  1870. session.foldWidgets[row - 1] = "";
  1871. if (indent < nextIndent)
  1872. return "start";
  1873. else
  1874. return "";
  1875. };
  1876. }).call(FoldMode.prototype);
  1877. });
  1878. ace.define("ace/mode/jade",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/jade_highlight_rules","ace/mode/folding/coffee"], function(require, exports, module) {
  1879. "use strict";
  1880. var oop = require("../lib/oop");
  1881. var TextMode = require("./text").Mode;
  1882. var JadeHighlightRules = require("./jade_highlight_rules").JadeHighlightRules;
  1883. var FoldMode = require("./folding/coffee").FoldMode;
  1884. var Mode = function() {
  1885. this.HighlightRules = JadeHighlightRules;
  1886. this.foldingRules = new FoldMode();
  1887. this.$behaviour = this.$defaultBehaviour;
  1888. };
  1889. oop.inherits(Mode, TextMode);
  1890. (function() {
  1891. this.lineCommentStart = "//";
  1892. this.$id = "ace/mode/jade";
  1893. }).call(Mode.prototype);
  1894. exports.Mode = Mode;
  1895. });