mode-jade.js 86 KB

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