Нема описа
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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