mode-jade.js 85 KB

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