f8e887c3b2c8ab6323535c3af0f70c77.js 123 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831
  1. ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  2. var oop = require("../lib/oop");
  3. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  4. var DocCommentHighlightRules = function () {
  5. this.$rules = {
  6. "start": [{
  7. token: "comment.doc.tag",
  8. regex: "@[\\w\\d_]+" // TODO: fix email addresses
  9. },
  10. DocCommentHighlightRules.getTagRule(),
  11. {
  12. defaultToken: "comment.doc",
  13. caseInsensitive: true
  14. }]
  15. };
  16. };
  17. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  18. DocCommentHighlightRules.getTagRule = function (start) {
  19. return {
  20. token: "comment.doc.tag.storage.type",
  21. regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  22. };
  23. };
  24. DocCommentHighlightRules.getStartRule = function (start) {
  25. return {
  26. token: "comment.doc",
  27. regex: "\\/\\*(?=\\*)",
  28. next: start
  29. };
  30. };
  31. DocCommentHighlightRules.getEndRule = function (start) {
  32. return {
  33. token: "comment.doc",
  34. regex: "\\*\\/",
  35. next: start
  36. };
  37. };
  38. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  39. });
  40. 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){"use strict";
  41. var oop = require("../lib/oop");
  42. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  43. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  44. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  45. var JavaScriptHighlightRules = function (options) {
  46. var keywordMapper = this.createKeywordMapper({
  47. "variable.language": "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  48. "Namespace|QName|XML|XMLList|" + // E4X
  49. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  50. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  51. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  52. "SyntaxError|TypeError|URIError|" +
  53. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  54. "isNaN|parseFloat|parseInt|" +
  55. "JSON|Math|" + // Other
  56. "this|arguments|prototype|window|document",
  57. "keyword": "const|yield|import|get|set|async|await|" +
  58. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  59. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  60. "__parent__|__count__|escape|unescape|with|__proto__|" +
  61. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  62. "storage.type": "const|let|var|function",
  63. "constant.language": "null|Infinity|NaN|undefined",
  64. "support.function": "alert",
  65. "constant.language.boolean": "true|false"
  66. }, "identifier");
  67. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  68. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  69. "u[0-9a-fA-F]{4}|" + // unicode
  70. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  71. "[0-2][0-7]{0,2}|" + // oct
  72. "3[0-7][0-7]?|" + // oct
  73. "[4-7][0-7]?|" + //oct
  74. ".)";
  75. this.$rules = {
  76. "no_regex": [
  77. DocCommentHighlightRules.getStartRule("doc-start"),
  78. comments("no_regex"),
  79. {
  80. token: "string",
  81. regex: "'(?=.)",
  82. next: "qstring"
  83. }, {
  84. token: "string",
  85. regex: '"(?=.)',
  86. next: "qqstring"
  87. }, {
  88. token: "constant.numeric",
  89. regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
  90. }, {
  91. token: "constant.numeric",
  92. regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
  93. }, {
  94. token: [
  95. "storage.type", "punctuation.operator", "support.function",
  96. "punctuation.operator", "entity.name.function", "text", "keyword.operator"
  97. ],
  98. regex: "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe + ")(\\s*)(=)",
  99. next: "function_arguments"
  100. }, {
  101. token: [
  102. "storage.type", "punctuation.operator", "entity.name.function", "text",
  103. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  104. ],
  105. regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  106. next: "function_arguments"
  107. }, {
  108. token: [
  109. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  110. "text", "paren.lparen"
  111. ],
  112. regex: "(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  113. next: "function_arguments"
  114. }, {
  115. token: [
  116. "storage.type", "punctuation.operator", "entity.name.function", "text",
  117. "keyword.operator", "text",
  118. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  119. ],
  120. regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  121. next: "function_arguments"
  122. }, {
  123. token: [
  124. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  125. ],
  126. regex: "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  127. next: "function_arguments"
  128. }, {
  129. token: [
  130. "entity.name.function", "text", "punctuation.operator",
  131. "text", "storage.type", "text", "paren.lparen"
  132. ],
  133. regex: "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  134. next: "function_arguments"
  135. }, {
  136. token: [
  137. "text", "text", "storage.type", "text", "paren.lparen"
  138. ],
  139. regex: "(:)(\\s*)(function)(\\s*)(\\()",
  140. next: "function_arguments"
  141. }, {
  142. token: "keyword",
  143. regex: "from(?=\\s*('|\"))"
  144. }, {
  145. token: "keyword",
  146. regex: "(?:" + kwBeforeRe + ")\\b",
  147. next: "start"
  148. }, {
  149. token: ["support.constant"],
  150. regex: /that\b/
  151. }, {
  152. token: ["storage.type", "punctuation.operator", "support.function.firebug"],
  153. regex: /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  154. }, {
  155. token: keywordMapper,
  156. regex: identifierRe
  157. }, {
  158. token: "punctuation.operator",
  159. regex: /[.](?![.])/,
  160. next: "property"
  161. }, {
  162. token: "storage.type",
  163. regex: /=>/,
  164. next: "start"
  165. }, {
  166. token: "keyword.operator",
  167. regex: /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
  168. next: "start"
  169. }, {
  170. token: "punctuation.operator",
  171. regex: /[?:,;.]/,
  172. next: "start"
  173. }, {
  174. token: "paren.lparen",
  175. regex: /[\[({]/,
  176. next: "start"
  177. }, {
  178. token: "paren.rparen",
  179. regex: /[\])}]/
  180. }, {
  181. token: "comment",
  182. regex: /^#!.*$/
  183. }
  184. ],
  185. property: [{
  186. token: "text",
  187. regex: "\\s+"
  188. }, {
  189. token: [
  190. "storage.type", "punctuation.operator", "entity.name.function", "text",
  191. "keyword.operator", "text",
  192. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  193. ],
  194. regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
  195. next: "function_arguments"
  196. }, {
  197. token: "punctuation.operator",
  198. regex: /[.](?![.])/
  199. }, {
  200. token: "support.function",
  201. regex: /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
  202. }, {
  203. token: "support.function.dom",
  204. regex: /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
  205. }, {
  206. token: "support.constant",
  207. regex: /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
  208. }, {
  209. token: "identifier",
  210. regex: identifierRe
  211. }, {
  212. regex: "",
  213. token: "empty",
  214. next: "no_regex"
  215. }
  216. ],
  217. "start": [
  218. DocCommentHighlightRules.getStartRule("doc-start"),
  219. comments("start"),
  220. {
  221. token: "string.regexp",
  222. regex: "\\/",
  223. next: "regex"
  224. }, {
  225. token: "text",
  226. regex: "\\s+|^$",
  227. next: "start"
  228. }, {
  229. token: "empty",
  230. regex: "",
  231. next: "no_regex"
  232. }
  233. ],
  234. "regex": [
  235. {
  236. token: "regexp.keyword.operator",
  237. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  238. }, {
  239. token: "string.regexp",
  240. regex: "/[sxngimy]*",
  241. next: "no_regex"
  242. }, {
  243. token: "invalid",
  244. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  245. }, {
  246. token: "constant.language.escape",
  247. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  248. }, {
  249. token: "constant.language.delimiter",
  250. regex: /\|/
  251. }, {
  252. token: "constant.language.escape",
  253. regex: /\[\^?/,
  254. next: "regex_character_class"
  255. }, {
  256. token: "empty",
  257. regex: "$",
  258. next: "no_regex"
  259. }, {
  260. defaultToken: "string.regexp"
  261. }
  262. ],
  263. "regex_character_class": [
  264. {
  265. token: "regexp.charclass.keyword.operator",
  266. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  267. }, {
  268. token: "constant.language.escape",
  269. regex: "]",
  270. next: "regex"
  271. }, {
  272. token: "constant.language.escape",
  273. regex: "-"
  274. }, {
  275. token: "empty",
  276. regex: "$",
  277. next: "no_regex"
  278. }, {
  279. defaultToken: "string.regexp.charachterclass"
  280. }
  281. ],
  282. "function_arguments": [
  283. {
  284. token: "variable.parameter",
  285. regex: identifierRe
  286. }, {
  287. token: "punctuation.operator",
  288. regex: "[, ]+"
  289. }, {
  290. token: "punctuation.operator",
  291. regex: "$"
  292. }, {
  293. token: "empty",
  294. regex: "",
  295. next: "no_regex"
  296. }
  297. ],
  298. "qqstring": [
  299. {
  300. token: "constant.language.escape",
  301. regex: escapedRe
  302. }, {
  303. token: "string",
  304. regex: "\\\\$",
  305. consumeLineEnd: true
  306. }, {
  307. token: "string",
  308. regex: '"|$',
  309. next: "no_regex"
  310. }, {
  311. defaultToken: "string"
  312. }
  313. ],
  314. "qstring": [
  315. {
  316. token: "constant.language.escape",
  317. regex: escapedRe
  318. }, {
  319. token: "string",
  320. regex: "\\\\$",
  321. consumeLineEnd: true
  322. }, {
  323. token: "string",
  324. regex: "'|$",
  325. next: "no_regex"
  326. }, {
  327. defaultToken: "string"
  328. }
  329. ]
  330. };
  331. if (!options || !options.noES6) {
  332. this.$rules.no_regex.unshift({
  333. regex: "[{}]", onMatch: function (val, state, stack) {
  334. this.next = val == "{" ? this.nextState : "";
  335. if (val == "{" && stack.length) {
  336. stack.unshift("start", state);
  337. }
  338. else if (val == "}" && stack.length) {
  339. stack.shift();
  340. this.next = stack.shift();
  341. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  342. return "paren.quasi.end";
  343. }
  344. return val == "{" ? "paren.lparen" : "paren.rparen";
  345. },
  346. nextState: "start"
  347. }, {
  348. token: "string.quasi.start",
  349. regex: /`/,
  350. push: [{
  351. token: "constant.language.escape",
  352. regex: escapedRe
  353. }, {
  354. token: "paren.quasi.start",
  355. regex: /\${/,
  356. push: "start"
  357. }, {
  358. token: "string.quasi.end",
  359. regex: /`/,
  360. next: "pop"
  361. }, {
  362. defaultToken: "string.quasi"
  363. }]
  364. });
  365. if (!options || options.jsx != false)
  366. JSX.call(this);
  367. }
  368. this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("no_regex")]);
  369. this.normalizeRules();
  370. };
  371. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  372. function JSX() {
  373. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  374. var jsxTag = {
  375. onMatch: function (val, state, stack) {
  376. var offset = val.charAt(1) == "/" ? 2 : 1;
  377. if (offset == 1) {
  378. if (state != this.nextState)
  379. stack.unshift(this.next, this.nextState, 0);
  380. else
  381. stack.unshift(this.next);
  382. stack[2]++;
  383. }
  384. else if (offset == 2) {
  385. if (state == this.nextState) {
  386. stack[1]--;
  387. if (!stack[1] || stack[1] < 0) {
  388. stack.shift();
  389. stack.shift();
  390. }
  391. }
  392. }
  393. return [{
  394. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  395. value: val.slice(0, offset)
  396. }, {
  397. type: "meta.tag.tag-name.xml",
  398. value: val.substr(offset)
  399. }];
  400. },
  401. regex: "</?" + tagRegex + "",
  402. next: "jsxAttributes",
  403. nextState: "jsx"
  404. };
  405. this.$rules.start.unshift(jsxTag);
  406. var jsxJsRule = {
  407. regex: "{",
  408. token: "paren.quasi.start",
  409. push: "start"
  410. };
  411. this.$rules.jsx = [
  412. jsxJsRule,
  413. jsxTag,
  414. { include: "reference" },
  415. { defaultToken: "string" }
  416. ];
  417. this.$rules.jsxAttributes = [{
  418. token: "meta.tag.punctuation.tag-close.xml",
  419. regex: "/?>",
  420. onMatch: function (value, currentState, stack) {
  421. if (currentState == stack[0])
  422. stack.shift();
  423. if (value.length == 2) {
  424. if (stack[0] == this.nextState)
  425. stack[1]--;
  426. if (!stack[1] || stack[1] < 0) {
  427. stack.splice(0, 2);
  428. }
  429. }
  430. this.next = stack[0] || "start";
  431. return [{ type: this.token, value: value }];
  432. },
  433. nextState: "jsx"
  434. },
  435. jsxJsRule,
  436. comments("jsxAttributes"),
  437. {
  438. token: "entity.other.attribute-name.xml",
  439. regex: tagRegex
  440. }, {
  441. token: "keyword.operator.attribute-equals.xml",
  442. regex: "="
  443. }, {
  444. token: "text.tag-whitespace.xml",
  445. regex: "\\s+"
  446. }, {
  447. token: "string.attribute-value.xml",
  448. regex: "'",
  449. stateName: "jsx_attr_q",
  450. push: [
  451. { token: "string.attribute-value.xml", regex: "'", next: "pop" },
  452. { include: "reference" },
  453. { defaultToken: "string.attribute-value.xml" }
  454. ]
  455. }, {
  456. token: "string.attribute-value.xml",
  457. regex: '"',
  458. stateName: "jsx_attr_qq",
  459. push: [
  460. { token: "string.attribute-value.xml", regex: '"', next: "pop" },
  461. { include: "reference" },
  462. { defaultToken: "string.attribute-value.xml" }
  463. ]
  464. },
  465. jsxTag
  466. ];
  467. this.$rules.reference = [{
  468. token: "constant.language.escape.reference.xml",
  469. regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  470. }];
  471. }
  472. function comments(next) {
  473. return [
  474. {
  475. token: "comment",
  476. regex: /\/\*/,
  477. next: [
  478. DocCommentHighlightRules.getTagRule(),
  479. { token: "comment", regex: "\\*\\/", next: next || "pop" },
  480. { defaultToken: "comment", caseInsensitive: true }
  481. ]
  482. }, {
  483. token: "comment",
  484. regex: "\\/\\/",
  485. next: [
  486. DocCommentHighlightRules.getTagRule(),
  487. { token: "comment", regex: "$|^", next: next || "pop" },
  488. { defaultToken: "comment", caseInsensitive: true }
  489. ]
  490. }
  491. ];
  492. }
  493. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  494. });
  495. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
  496. var Range = require("../range").Range;
  497. var MatchingBraceOutdent = function () { };
  498. (function () {
  499. this.checkOutdent = function (line, input) {
  500. if (!/^\s+$/.test(line))
  501. return false;
  502. return /^\s*\}/.test(input);
  503. };
  504. this.autoOutdent = function (doc, row) {
  505. var line = doc.getLine(row);
  506. var match = line.match(/^(\s*\})/);
  507. if (!match)
  508. return 0;
  509. var column = match[1].length;
  510. var openBracePos = doc.findMatchingBracket({ row: row, column: column });
  511. if (!openBracePos || openBracePos.row == row)
  512. return 0;
  513. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  514. doc.replace(new Range(row, 0, row, column - 1), indent);
  515. };
  516. this.$getIndent = function (line) {
  517. return line.match(/^\s*/)[0];
  518. };
  519. }).call(MatchingBraceOutdent.prototype);
  520. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  521. });
  522. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
  523. var oop = require("../../lib/oop");
  524. var Range = require("../../range").Range;
  525. var BaseFoldMode = require("./fold_mode").FoldMode;
  526. var FoldMode = exports.FoldMode = function (commentRegex) {
  527. if (commentRegex) {
  528. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  529. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  530. }
  531. };
  532. oop.inherits(FoldMode, BaseFoldMode);
  533. (function () {
  534. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  535. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  536. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  537. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  538. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  539. this._getFoldWidgetBase = this.getFoldWidget;
  540. this.getFoldWidget = function (session, foldStyle, row) {
  541. var line = session.getLine(row);
  542. if (this.singleLineBlockCommentRe.test(line)) {
  543. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  544. return "";
  545. }
  546. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  547. if (!fw && this.startRegionRe.test(line))
  548. return "start"; // lineCommentRegionStart
  549. return fw;
  550. };
  551. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  552. var line = session.getLine(row);
  553. if (this.startRegionRe.test(line))
  554. return this.getCommentRegionBlock(session, line, row);
  555. var match = line.match(this.foldingStartMarker);
  556. if (match) {
  557. var i = match.index;
  558. if (match[1])
  559. return this.openingBracketBlock(session, match[1], row, i);
  560. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  561. if (range && !range.isMultiLine()) {
  562. if (forceMultiline) {
  563. range = this.getSectionRange(session, row);
  564. }
  565. else if (foldStyle != "all")
  566. range = null;
  567. }
  568. return range;
  569. }
  570. if (foldStyle === "markbegin")
  571. return;
  572. var match = line.match(this.foldingStopMarker);
  573. if (match) {
  574. var i = match.index + match[0].length;
  575. if (match[1])
  576. return this.closingBracketBlock(session, match[1], row, i);
  577. return session.getCommentFoldRange(row, i, -1);
  578. }
  579. };
  580. this.getSectionRange = function (session, row) {
  581. var line = session.getLine(row);
  582. var startIndent = line.search(/\S/);
  583. var startRow = row;
  584. var startColumn = line.length;
  585. row = row + 1;
  586. var endRow = row;
  587. var maxRow = session.getLength();
  588. while (++row < maxRow) {
  589. line = session.getLine(row);
  590. var indent = line.search(/\S/);
  591. if (indent === -1)
  592. continue;
  593. if (startIndent > indent)
  594. break;
  595. var subRange = this.getFoldWidgetRange(session, "all", row);
  596. if (subRange) {
  597. if (subRange.start.row <= startRow) {
  598. break;
  599. }
  600. else if (subRange.isMultiLine()) {
  601. row = subRange.end.row;
  602. }
  603. else if (startIndent == indent) {
  604. break;
  605. }
  606. }
  607. endRow = row;
  608. }
  609. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  610. };
  611. this.getCommentRegionBlock = function (session, line, row) {
  612. var startColumn = line.search(/\s*$/);
  613. var maxRow = session.getLength();
  614. var startRow = row;
  615. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  616. var depth = 1;
  617. while (++row < maxRow) {
  618. line = session.getLine(row);
  619. var m = re.exec(line);
  620. if (!m)
  621. continue;
  622. if (m[1])
  623. depth--;
  624. else
  625. depth++;
  626. if (!depth)
  627. break;
  628. }
  629. var endRow = row;
  630. if (endRow > startRow) {
  631. return new Range(startRow, startColumn, endRow, line.length);
  632. }
  633. };
  634. }).call(FoldMode.prototype);
  635. });
  636. ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
  637. var oop = require("../lib/oop");
  638. var TextMode = require("./text").Mode;
  639. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  640. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  641. var WorkerClient = require("../worker/worker_client").WorkerClient;
  642. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  643. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  644. var Mode = function () {
  645. this.HighlightRules = JavaScriptHighlightRules;
  646. this.$outdent = new MatchingBraceOutdent();
  647. this.$behaviour = new CstyleBehaviour();
  648. this.foldingRules = new CStyleFoldMode();
  649. };
  650. oop.inherits(Mode, TextMode);
  651. (function () {
  652. this.lineCommentStart = "//";
  653. this.blockComment = { start: "/*", end: "*/" };
  654. this.$quotes = { '"': '"', "'": "'", "`": "`" };
  655. this.getNextLineIndent = function (state, line, tab) {
  656. var indent = this.$getIndent(line);
  657. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  658. var tokens = tokenizedLine.tokens;
  659. var endState = tokenizedLine.state;
  660. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  661. return indent;
  662. }
  663. if (state == "start" || state == "no_regex") {
  664. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  665. if (match) {
  666. indent += tab;
  667. }
  668. }
  669. else if (state == "doc-start") {
  670. if (endState == "start" || endState == "no_regex") {
  671. return "";
  672. }
  673. var match = line.match(/^\s*(\/?)\*/);
  674. if (match) {
  675. if (match[1]) {
  676. indent += " ";
  677. }
  678. indent += "* ";
  679. }
  680. }
  681. return indent;
  682. };
  683. this.checkOutdent = function (state, line, input) {
  684. return this.$outdent.checkOutdent(line, input);
  685. };
  686. this.autoOutdent = function (state, doc, row) {
  687. this.$outdent.autoOutdent(doc, row);
  688. };
  689. this.createWorker = function (session) {
  690. var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
  691. worker.attachToDocument(session.getDocument());
  692. worker.on("annotate", function (results) {
  693. session.setAnnotations(results.data);
  694. });
  695. worker.on("terminate", function () {
  696. session.clearAnnotations();
  697. });
  698. return worker;
  699. };
  700. this.$id = "ace/mode/javascript";
  701. this.snippetFileId = "ace/snippets/javascript";
  702. }).call(Mode.prototype);
  703. exports.Mode = Mode;
  704. });
  705. ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  706. var oop = require("../lib/oop");
  707. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  708. var XmlHighlightRules = function (normalize) {
  709. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  710. this.$rules = {
  711. start: [
  712. { token: "string.cdata.xml", regex: "<\\!\\[CDATA\\[", next: "cdata" },
  713. {
  714. token: ["punctuation.instruction.xml", "keyword.instruction.xml"],
  715. regex: "(<\\?)(" + tagRegex + ")", next: "processing_instruction"
  716. },
  717. { token: "comment.start.xml", regex: "<\\!--", next: "comment" },
  718. {
  719. token: ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  720. regex: "(<\\!)(DOCTYPE)(?=[\\s])", next: "doctype", caseInsensitive: true
  721. },
  722. { include: "tag" },
  723. { token: "text.end-tag-open.xml", regex: "</" },
  724. { token: "text.tag-open.xml", regex: "<" },
  725. { include: "reference" },
  726. { defaultToken: "text.xml" }
  727. ],
  728. processing_instruction: [{
  729. token: "entity.other.attribute-name.decl-attribute-name.xml",
  730. regex: tagRegex
  731. }, {
  732. token: "keyword.operator.decl-attribute-equals.xml",
  733. regex: "="
  734. }, {
  735. include: "whitespace"
  736. }, {
  737. include: "string"
  738. }, {
  739. token: "punctuation.xml-decl.xml",
  740. regex: "\\?>",
  741. next: "start"
  742. }],
  743. doctype: [
  744. { include: "whitespace" },
  745. { include: "string" },
  746. { token: "xml-pe.doctype.xml", regex: ">", next: "start" },
  747. { token: "xml-pe.xml", regex: "[-_a-zA-Z0-9:]+" },
  748. { token: "punctuation.int-subset", regex: "\\[", push: "int_subset" }
  749. ],
  750. int_subset: [{
  751. token: "text.xml",
  752. regex: "\\s+"
  753. }, {
  754. token: "punctuation.int-subset.xml",
  755. regex: "]",
  756. next: "pop"
  757. }, {
  758. token: ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  759. regex: "(<\\!)(" + tagRegex + ")",
  760. push: [{
  761. token: "text",
  762. regex: "\\s+"
  763. },
  764. {
  765. token: "punctuation.markup-decl.xml",
  766. regex: ">",
  767. next: "pop"
  768. },
  769. { include: "string" }]
  770. }],
  771. cdata: [
  772. { token: "string.cdata.xml", regex: "\\]\\]>", next: "start" },
  773. { token: "text.xml", regex: "\\s+" },
  774. { token: "text.xml", regex: "(?:[^\\]]|\\](?!\\]>))+" }
  775. ],
  776. comment: [
  777. { token: "comment.end.xml", regex: "-->", next: "start" },
  778. { defaultToken: "comment.xml" }
  779. ],
  780. reference: [{
  781. token: "constant.language.escape.reference.xml",
  782. regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  783. }],
  784. attr_reference: [{
  785. token: "constant.language.escape.reference.attribute-value.xml",
  786. regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  787. }],
  788. tag: [{
  789. token: ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  790. regex: "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  791. next: [
  792. { include: "attributes" },
  793. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" }
  794. ]
  795. }],
  796. tag_whitespace: [
  797. { token: "text.tag-whitespace.xml", regex: "\\s+" }
  798. ],
  799. whitespace: [
  800. { token: "text.whitespace.xml", regex: "\\s+" }
  801. ],
  802. string: [{
  803. token: "string.xml",
  804. regex: "'",
  805. push: [
  806. { token: "string.xml", regex: "'", next: "pop" },
  807. { defaultToken: "string.xml" }
  808. ]
  809. }, {
  810. token: "string.xml",
  811. regex: '"',
  812. push: [
  813. { token: "string.xml", regex: '"', next: "pop" },
  814. { defaultToken: "string.xml" }
  815. ]
  816. }],
  817. attributes: [{
  818. token: "entity.other.attribute-name.xml",
  819. regex: tagRegex
  820. }, {
  821. token: "keyword.operator.attribute-equals.xml",
  822. regex: "="
  823. }, {
  824. include: "tag_whitespace"
  825. }, {
  826. include: "attribute_value"
  827. }],
  828. attribute_value: [{
  829. token: "string.attribute-value.xml",
  830. regex: "'",
  831. push: [
  832. { token: "string.attribute-value.xml", regex: "'", next: "pop" },
  833. { include: "attr_reference" },
  834. { defaultToken: "string.attribute-value.xml" }
  835. ]
  836. }, {
  837. token: "string.attribute-value.xml",
  838. regex: '"',
  839. push: [
  840. { token: "string.attribute-value.xml", regex: '"', next: "pop" },
  841. { include: "attr_reference" },
  842. { defaultToken: "string.attribute-value.xml" }
  843. ]
  844. }]
  845. };
  846. if (this.constructor === XmlHighlightRules)
  847. this.normalizeRules();
  848. };
  849. (function () {
  850. this.embedTagRules = function (HighlightRules, prefix, tag) {
  851. this.$rules.tag.unshift({
  852. token: ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  853. regex: "(<)(" + tag + "(?=\\s|>|$))",
  854. next: [
  855. { include: "attributes" },
  856. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: prefix + "start" }
  857. ]
  858. });
  859. this.$rules[tag + "-end"] = [
  860. { include: "attributes" },
  861. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start",
  862. onMatch: function (value, currentState, stack) {
  863. stack.splice(0);
  864. return this.token;
  865. } }
  866. ];
  867. this.embedRules(HighlightRules, prefix, [{
  868. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  869. regex: "(</)(" + tag + "(?=\\s|>|$))",
  870. next: tag + "-end"
  871. }, {
  872. token: "string.cdata.xml",
  873. regex: "<\\!\\[CDATA\\["
  874. }, {
  875. token: "string.cdata.xml",
  876. regex: "\\]\\]>"
  877. }]);
  878. };
  879. }).call(TextHighlightRules.prototype);
  880. oop.inherits(XmlHighlightRules, TextHighlightRules);
  881. exports.XmlHighlightRules = XmlHighlightRules;
  882. });
  883. ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module){"use strict";
  884. var oop = require("../../lib/oop");
  885. var Behaviour = require("../behaviour").Behaviour;
  886. var TokenIterator = require("../../token_iterator").TokenIterator;
  887. var lang = require("../../lib/lang");
  888. function is(token, type) {
  889. return token && token.type.lastIndexOf(type + ".xml") > -1;
  890. }
  891. var XmlBehaviour = function () {
  892. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  893. if (text == '"' || text == "'") {
  894. var quote = text;
  895. var selected = session.doc.getTextRange(editor.getSelectionRange());
  896. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  897. return {
  898. text: quote + selected + quote,
  899. selection: false
  900. };
  901. }
  902. var cursor = editor.getCursorPosition();
  903. var line = session.doc.getLine(cursor.row);
  904. var rightChar = line.substring(cursor.column, cursor.column + 1);
  905. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  906. var token = iterator.getCurrentToken();
  907. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  908. return {
  909. text: "",
  910. selection: [1, 1]
  911. };
  912. }
  913. if (!token)
  914. token = iterator.stepBackward();
  915. if (!token)
  916. return;
  917. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  918. token = iterator.stepBackward();
  919. }
  920. var rightSpace = !rightChar || rightChar.match(/\s/);
  921. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  922. return {
  923. text: quote + quote,
  924. selection: [1, 1]
  925. };
  926. }
  927. }
  928. });
  929. this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
  930. var selected = session.doc.getTextRange(range);
  931. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  932. var line = session.doc.getLine(range.start.row);
  933. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  934. if (rightChar == selected) {
  935. range.end.column++;
  936. return range;
  937. }
  938. }
  939. });
  940. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  941. if (text == '>') {
  942. var position = editor.getSelectionRange().start;
  943. var iterator = new TokenIterator(session, position.row, position.column);
  944. var token = iterator.getCurrentToken() || iterator.stepBackward();
  945. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  946. return;
  947. if (is(token, "reference.attribute-value"))
  948. return;
  949. if (is(token, "attribute-value")) {
  950. var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
  951. if (position.column < tokenEndColumn)
  952. return;
  953. if (position.column == tokenEndColumn) {
  954. var nextToken = iterator.stepForward();
  955. if (nextToken && is(nextToken, "attribute-value"))
  956. return;
  957. iterator.stepBackward();
  958. }
  959. }
  960. if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
  961. return;
  962. while (!is(token, "tag-name")) {
  963. token = iterator.stepBackward();
  964. if (token.value == "<") {
  965. token = iterator.stepForward();
  966. break;
  967. }
  968. }
  969. var tokenRow = iterator.getCurrentTokenRow();
  970. var tokenColumn = iterator.getCurrentTokenColumn();
  971. if (is(iterator.stepBackward(), "end-tag-open"))
  972. return;
  973. var element = token.value;
  974. if (tokenRow == position.row)
  975. element = element.substring(0, position.column - tokenColumn);
  976. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  977. return;
  978. return {
  979. text: ">" + "</" + element + ">",
  980. selection: [1, 1]
  981. };
  982. }
  983. });
  984. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  985. if (text == "\n") {
  986. var cursor = editor.getCursorPosition();
  987. var line = session.getLine(cursor.row);
  988. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  989. var token = iterator.getCurrentToken();
  990. if (token && token.type.indexOf("tag-close") !== -1) {
  991. if (token.value == "/>")
  992. return;
  993. while (token && token.type.indexOf("tag-name") === -1) {
  994. token = iterator.stepBackward();
  995. }
  996. if (!token) {
  997. return;
  998. }
  999. var tag = token.value;
  1000. var row = iterator.getCurrentTokenRow();
  1001. token = iterator.stepBackward();
  1002. if (!token || token.type.indexOf("end-tag") !== -1) {
  1003. return;
  1004. }
  1005. if (this.voidElements && !this.voidElements[tag]) {
  1006. var nextToken = session.getTokenAt(cursor.row, cursor.column + 1);
  1007. var line = session.getLine(row);
  1008. var nextIndent = this.$getIndent(line);
  1009. var indent = nextIndent + session.getTabString();
  1010. if (nextToken && nextToken.value === "</") {
  1011. return {
  1012. text: "\n" + indent + "\n" + nextIndent,
  1013. selection: [1, indent.length, 1, indent.length]
  1014. };
  1015. }
  1016. else {
  1017. return {
  1018. text: "\n" + indent
  1019. };
  1020. }
  1021. }
  1022. }
  1023. }
  1024. });
  1025. };
  1026. oop.inherits(XmlBehaviour, Behaviour);
  1027. exports.XmlBehaviour = XmlBehaviour;
  1028. });
  1029. ace.define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/range","ace/mode/folding/fold_mode","ace/token_iterator"], function(require, exports, module){"use strict";
  1030. var oop = require("../../lib/oop");
  1031. var lang = require("../../lib/lang");
  1032. var Range = require("../../range").Range;
  1033. var BaseFoldMode = require("./fold_mode").FoldMode;
  1034. var TokenIterator = require("../../token_iterator").TokenIterator;
  1035. var FoldMode = exports.FoldMode = function (voidElements, optionalEndTags) {
  1036. BaseFoldMode.call(this);
  1037. this.voidElements = voidElements || {};
  1038. this.optionalEndTags = oop.mixin({}, this.voidElements);
  1039. if (optionalEndTags)
  1040. oop.mixin(this.optionalEndTags, optionalEndTags);
  1041. };
  1042. oop.inherits(FoldMode, BaseFoldMode);
  1043. var Tag = function () {
  1044. this.tagName = "";
  1045. this.closing = false;
  1046. this.selfClosing = false;
  1047. this.start = { row: 0, column: 0 };
  1048. this.end = { row: 0, column: 0 };
  1049. };
  1050. function is(token, type) {
  1051. return token.type.lastIndexOf(type + ".xml") > -1;
  1052. }
  1053. (function () {
  1054. this.getFoldWidget = function (session, foldStyle, row) {
  1055. var tag = this._getFirstTagInLine(session, row);
  1056. if (!tag)
  1057. return this.getCommentFoldWidget(session, row);
  1058. if (tag.closing || (!tag.tagName && tag.selfClosing))
  1059. return foldStyle == "markbeginend" ? "end" : "";
  1060. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  1061. return "";
  1062. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  1063. return "";
  1064. return "start";
  1065. };
  1066. this.getCommentFoldWidget = function (session, row) {
  1067. if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
  1068. return "start";
  1069. return "";
  1070. };
  1071. this._getFirstTagInLine = function (session, row) {
  1072. var tokens = session.getTokens(row);
  1073. var tag = new Tag();
  1074. for (var i = 0; i < tokens.length; i++) {
  1075. var token = tokens[i];
  1076. if (is(token, "tag-open")) {
  1077. tag.end.column = tag.start.column + token.value.length;
  1078. tag.closing = is(token, "end-tag-open");
  1079. token = tokens[++i];
  1080. if (!token)
  1081. return null;
  1082. tag.tagName = token.value;
  1083. tag.end.column += token.value.length;
  1084. for (i++; i < tokens.length; i++) {
  1085. token = tokens[i];
  1086. tag.end.column += token.value.length;
  1087. if (is(token, "tag-close")) {
  1088. tag.selfClosing = token.value == '/>';
  1089. break;
  1090. }
  1091. }
  1092. return tag;
  1093. }
  1094. else if (is(token, "tag-close")) {
  1095. tag.selfClosing = token.value == '/>';
  1096. return tag;
  1097. }
  1098. tag.start.column += token.value.length;
  1099. }
  1100. return null;
  1101. };
  1102. this._findEndTagInLine = function (session, row, tagName, startColumn) {
  1103. var tokens = session.getTokens(row);
  1104. var column = 0;
  1105. for (var i = 0; i < tokens.length; i++) {
  1106. var token = tokens[i];
  1107. column += token.value.length;
  1108. if (column < startColumn)
  1109. continue;
  1110. if (is(token, "end-tag-open")) {
  1111. token = tokens[i + 1];
  1112. if (token && token.value == tagName)
  1113. return true;
  1114. }
  1115. }
  1116. return false;
  1117. };
  1118. this._readTagForward = function (iterator) {
  1119. var token = iterator.getCurrentToken();
  1120. if (!token)
  1121. return null;
  1122. var tag = new Tag();
  1123. do {
  1124. if (is(token, "tag-open")) {
  1125. tag.closing = is(token, "end-tag-open");
  1126. tag.start.row = iterator.getCurrentTokenRow();
  1127. tag.start.column = iterator.getCurrentTokenColumn();
  1128. }
  1129. else if (is(token, "tag-name")) {
  1130. tag.tagName = token.value;
  1131. }
  1132. else if (is(token, "tag-close")) {
  1133. tag.selfClosing = token.value == "/>";
  1134. tag.end.row = iterator.getCurrentTokenRow();
  1135. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1136. iterator.stepForward();
  1137. return tag;
  1138. }
  1139. } while (token = iterator.stepForward());
  1140. return null;
  1141. };
  1142. this._readTagBackward = function (iterator) {
  1143. var token = iterator.getCurrentToken();
  1144. if (!token)
  1145. return null;
  1146. var tag = new Tag();
  1147. do {
  1148. if (is(token, "tag-open")) {
  1149. tag.closing = is(token, "end-tag-open");
  1150. tag.start.row = iterator.getCurrentTokenRow();
  1151. tag.start.column = iterator.getCurrentTokenColumn();
  1152. iterator.stepBackward();
  1153. return tag;
  1154. }
  1155. else if (is(token, "tag-name")) {
  1156. tag.tagName = token.value;
  1157. }
  1158. else if (is(token, "tag-close")) {
  1159. tag.selfClosing = token.value == "/>";
  1160. tag.end.row = iterator.getCurrentTokenRow();
  1161. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1162. }
  1163. } while (token = iterator.stepBackward());
  1164. return null;
  1165. };
  1166. this._pop = function (stack, tag) {
  1167. while (stack.length) {
  1168. var top = stack[stack.length - 1];
  1169. if (!tag || top.tagName == tag.tagName) {
  1170. return stack.pop();
  1171. }
  1172. else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
  1173. stack.pop();
  1174. continue;
  1175. }
  1176. else {
  1177. return null;
  1178. }
  1179. }
  1180. };
  1181. this.getFoldWidgetRange = function (session, foldStyle, row) {
  1182. var firstTag = this._getFirstTagInLine(session, row);
  1183. if (!firstTag) {
  1184. return this.getCommentFoldWidget(session, row)
  1185. && session.getCommentFoldRange(row, session.getLine(row).length);
  1186. }
  1187. var isBackward = firstTag.closing || firstTag.selfClosing;
  1188. var stack = [];
  1189. var tag;
  1190. if (!isBackward) {
  1191. var iterator = new TokenIterator(session, row, firstTag.start.column);
  1192. var start = {
  1193. row: row,
  1194. column: firstTag.start.column + firstTag.tagName.length + 2
  1195. };
  1196. if (firstTag.start.row == firstTag.end.row)
  1197. start.column = firstTag.end.column;
  1198. while (tag = this._readTagForward(iterator)) {
  1199. if (tag.selfClosing) {
  1200. if (!stack.length) {
  1201. tag.start.column += tag.tagName.length + 2;
  1202. tag.end.column -= 2;
  1203. return Range.fromPoints(tag.start, tag.end);
  1204. }
  1205. else
  1206. continue;
  1207. }
  1208. if (tag.closing) {
  1209. this._pop(stack, tag);
  1210. if (stack.length == 0)
  1211. return Range.fromPoints(start, tag.start);
  1212. }
  1213. else {
  1214. stack.push(tag);
  1215. }
  1216. }
  1217. }
  1218. else {
  1219. var iterator = new TokenIterator(session, row, firstTag.end.column);
  1220. var end = {
  1221. row: row,
  1222. column: firstTag.start.column
  1223. };
  1224. while (tag = this._readTagBackward(iterator)) {
  1225. if (tag.selfClosing) {
  1226. if (!stack.length) {
  1227. tag.start.column += tag.tagName.length + 2;
  1228. tag.end.column -= 2;
  1229. return Range.fromPoints(tag.start, tag.end);
  1230. }
  1231. else
  1232. continue;
  1233. }
  1234. if (!tag.closing) {
  1235. this._pop(stack, tag);
  1236. if (stack.length == 0) {
  1237. tag.start.column += tag.tagName.length + 2;
  1238. if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
  1239. tag.start.column = tag.end.column;
  1240. return Range.fromPoints(tag.start, end);
  1241. }
  1242. }
  1243. else {
  1244. stack.push(tag);
  1245. }
  1246. }
  1247. }
  1248. };
  1249. }).call(FoldMode.prototype);
  1250. });
  1251. ace.define("ace/mode/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/xml_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/xml","ace/worker/worker_client"], function(require, exports, module){"use strict";
  1252. var oop = require("../lib/oop");
  1253. var lang = require("../lib/lang");
  1254. var TextMode = require("./text").Mode;
  1255. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  1256. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  1257. var XmlFoldMode = require("./folding/xml").FoldMode;
  1258. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1259. var Mode = function () {
  1260. this.HighlightRules = XmlHighlightRules;
  1261. this.$behaviour = new XmlBehaviour();
  1262. this.foldingRules = new XmlFoldMode();
  1263. };
  1264. oop.inherits(Mode, TextMode);
  1265. (function () {
  1266. this.voidElements = lang.arrayToMap([]);
  1267. this.blockComment = { start: "<!--", end: "-->" };
  1268. this.createWorker = function (session) {
  1269. var worker = new WorkerClient(["ace"], "ace/mode/xml_worker", "Worker");
  1270. worker.attachToDocument(session.getDocument());
  1271. worker.on("error", function (e) {
  1272. session.setAnnotations(e.data);
  1273. });
  1274. worker.on("terminate", function () {
  1275. session.clearAnnotations();
  1276. });
  1277. return worker;
  1278. };
  1279. this.$id = "ace/mode/xml";
  1280. }).call(Mode.prototype);
  1281. exports.Mode = Mode;
  1282. });
  1283. 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){"use strict";
  1284. var oop = require("../lib/oop");
  1285. var lang = require("../lib/lang");
  1286. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  1287. 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";
  1288. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  1289. 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";
  1290. 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";
  1291. 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";
  1292. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  1293. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  1294. 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";
  1295. var CssHighlightRules = function () {
  1296. var keywordMapper = this.createKeywordMapper({
  1297. "support.function": supportFunction,
  1298. "support.constant": supportConstant,
  1299. "support.type": supportType,
  1300. "support.constant.color": supportConstantColor,
  1301. "support.constant.fonts": supportConstantFonts
  1302. }, "text", true);
  1303. this.$rules = {
  1304. "start": [{
  1305. include: ["strings", "url", "comments"]
  1306. }, {
  1307. token: "paren.lparen",
  1308. regex: "\\{",
  1309. next: "ruleset"
  1310. }, {
  1311. token: "paren.rparen",
  1312. regex: "\\}"
  1313. }, {
  1314. token: "string",
  1315. regex: "@(?!viewport)",
  1316. next: "media"
  1317. }, {
  1318. token: "keyword",
  1319. regex: "#[a-z0-9-_]+"
  1320. }, {
  1321. token: "keyword",
  1322. regex: "%"
  1323. }, {
  1324. token: "variable",
  1325. regex: "\\.[a-z0-9-_]+"
  1326. }, {
  1327. token: "string",
  1328. regex: ":[a-z0-9-_]+"
  1329. }, {
  1330. token: "constant.numeric",
  1331. regex: numRe
  1332. }, {
  1333. token: "constant",
  1334. regex: "[a-z0-9-_]+"
  1335. }, {
  1336. caseInsensitive: true
  1337. }],
  1338. "media": [{
  1339. include: ["strings", "url", "comments"]
  1340. }, {
  1341. token: "paren.lparen",
  1342. regex: "\\{",
  1343. next: "start"
  1344. }, {
  1345. token: "paren.rparen",
  1346. regex: "\\}",
  1347. next: "start"
  1348. }, {
  1349. token: "string",
  1350. regex: ";",
  1351. next: "start"
  1352. }, {
  1353. token: "keyword",
  1354. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  1355. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  1356. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  1357. }],
  1358. "comments": [{
  1359. token: "comment",
  1360. regex: "\\/\\*",
  1361. push: [{
  1362. token: "comment",
  1363. regex: "\\*\\/",
  1364. next: "pop"
  1365. }, {
  1366. defaultToken: "comment"
  1367. }]
  1368. }],
  1369. "ruleset": [{
  1370. regex: "-(webkit|ms|moz|o)-",
  1371. token: "text"
  1372. }, {
  1373. token: "punctuation.operator",
  1374. regex: "[:;]"
  1375. }, {
  1376. token: "paren.rparen",
  1377. regex: "\\}",
  1378. next: "start"
  1379. }, {
  1380. include: ["strings", "url", "comments"]
  1381. }, {
  1382. token: ["constant.numeric", "keyword"],
  1383. 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|%)"
  1384. }, {
  1385. token: "constant.numeric",
  1386. regex: numRe
  1387. }, {
  1388. token: "constant.numeric",
  1389. regex: "#[a-f0-9]{6}"
  1390. }, {
  1391. token: "constant.numeric",
  1392. regex: "#[a-f0-9]{3}"
  1393. }, {
  1394. token: ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  1395. regex: pseudoElements
  1396. }, {
  1397. token: ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  1398. regex: pseudoClasses
  1399. }, {
  1400. include: "url"
  1401. }, {
  1402. token: keywordMapper,
  1403. regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  1404. }, {
  1405. caseInsensitive: true
  1406. }],
  1407. url: [{
  1408. token: "support.function",
  1409. regex: "(?:url(:?-prefix)?|domain|regexp)\\(",
  1410. push: [{
  1411. token: "support.function",
  1412. regex: "\\)",
  1413. next: "pop"
  1414. }, {
  1415. defaultToken: "string"
  1416. }]
  1417. }],
  1418. strings: [{
  1419. token: "string.start",
  1420. regex: "'",
  1421. push: [{
  1422. token: "string.end",
  1423. regex: "'|$",
  1424. next: "pop"
  1425. }, {
  1426. include: "escapes"
  1427. }, {
  1428. token: "constant.language.escape",
  1429. regex: /\\$/,
  1430. consumeLineEnd: true
  1431. }, {
  1432. defaultToken: "string"
  1433. }]
  1434. }, {
  1435. token: "string.start",
  1436. regex: '"',
  1437. push: [{
  1438. token: "string.end",
  1439. regex: '"|$',
  1440. next: "pop"
  1441. }, {
  1442. include: "escapes"
  1443. }, {
  1444. token: "constant.language.escape",
  1445. regex: /\\$/,
  1446. consumeLineEnd: true
  1447. }, {
  1448. defaultToken: "string"
  1449. }]
  1450. }],
  1451. escapes: [{
  1452. token: "constant.language.escape",
  1453. regex: /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  1454. }]
  1455. };
  1456. this.normalizeRules();
  1457. };
  1458. oop.inherits(CssHighlightRules, TextHighlightRules);
  1459. exports.CssHighlightRules = CssHighlightRules;
  1460. });
  1461. ace.define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module){"use strict";
  1462. var propertyMap = {
  1463. "background": { "#$0": 1 },
  1464. "background-color": { "#$0": 1, "transparent": 1, "fixed": 1 },
  1465. "background-image": { "url('/$0')": 1 },
  1466. "background-repeat": { "repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1 },
  1467. "background-position": { "bottom": 2, "center": 2, "left": 2, "right": 2, "top": 2, "inherit": 2 },
  1468. "background-attachment": { "scroll": 1, "fixed": 1 },
  1469. "background-size": { "cover": 1, "contain": 1 },
  1470. "background-clip": { "border-box": 1, "padding-box": 1, "content-box": 1 },
  1471. "background-origin": { "border-box": 1, "padding-box": 1, "content-box": 1 },
  1472. "border": { "solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1 },
  1473. "border-color": { "#$0": 1 },
  1474. "border-style": { "solid": 2, "dashed": 2, "dotted": 2, "double": 2, "groove": 2, "hidden": 2, "inherit": 2, "inset": 2, "none": 2, "outset": 2, "ridged": 2 },
  1475. "border-collapse": { "collapse": 1, "separate": 1 },
  1476. "bottom": { "px": 1, "em": 1, "%": 1 },
  1477. "clear": { "left": 1, "right": 1, "both": 1, "none": 1 },
  1478. "color": { "#$0": 1, "rgb(#$00,0,0)": 1 },
  1479. "cursor": { "default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1 },
  1480. "display": { "none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1 },
  1481. "empty-cells": { "show": 1, "hide": 1 },
  1482. "float": { "left": 1, "right": 1, "none": 1 },
  1483. "font-family": { "Arial": 2, "Comic Sans MS": 2, "Consolas": 2, "Courier New": 2, "Courier": 2, "Georgia": 2, "Monospace": 2, "Sans-Serif": 2, "Segoe UI": 2, "Tahoma": 2, "Times New Roman": 2, "Trebuchet MS": 2, "Verdana": 1 },
  1484. "font-size": { "px": 1, "em": 1, "%": 1 },
  1485. "font-weight": { "bold": 1, "normal": 1 },
  1486. "font-style": { "italic": 1, "normal": 1 },
  1487. "font-variant": { "normal": 1, "small-caps": 1 },
  1488. "height": { "px": 1, "em": 1, "%": 1 },
  1489. "left": { "px": 1, "em": 1, "%": 1 },
  1490. "letter-spacing": { "normal": 1 },
  1491. "line-height": { "normal": 1 },
  1492. "list-style-type": { "none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1 },
  1493. "margin": { "px": 1, "em": 1, "%": 1 },
  1494. "margin-right": { "px": 1, "em": 1, "%": 1 },
  1495. "margin-left": { "px": 1, "em": 1, "%": 1 },
  1496. "margin-top": { "px": 1, "em": 1, "%": 1 },
  1497. "margin-bottom": { "px": 1, "em": 1, "%": 1 },
  1498. "max-height": { "px": 1, "em": 1, "%": 1 },
  1499. "max-width": { "px": 1, "em": 1, "%": 1 },
  1500. "min-height": { "px": 1, "em": 1, "%": 1 },
  1501. "min-width": { "px": 1, "em": 1, "%": 1 },
  1502. "overflow": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
  1503. "overflow-x": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
  1504. "overflow-y": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
  1505. "padding": { "px": 1, "em": 1, "%": 1 },
  1506. "padding-top": { "px": 1, "em": 1, "%": 1 },
  1507. "padding-right": { "px": 1, "em": 1, "%": 1 },
  1508. "padding-bottom": { "px": 1, "em": 1, "%": 1 },
  1509. "padding-left": { "px": 1, "em": 1, "%": 1 },
  1510. "page-break-after": { "auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1 },
  1511. "page-break-before": { "auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1 },
  1512. "position": { "absolute": 1, "relative": 1, "fixed": 1, "static": 1 },
  1513. "right": { "px": 1, "em": 1, "%": 1 },
  1514. "table-layout": { "fixed": 1, "auto": 1 },
  1515. "text-decoration": { "none": 1, "underline": 1, "line-through": 1, "blink": 1 },
  1516. "text-align": { "left": 1, "right": 1, "center": 1, "justify": 1 },
  1517. "text-transform": { "capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1 },
  1518. "top": { "px": 1, "em": 1, "%": 1 },
  1519. "vertical-align": { "top": 1, "bottom": 1 },
  1520. "visibility": { "hidden": 1, "visible": 1 },
  1521. "white-space": { "nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1 },
  1522. "width": { "px": 1, "em": 1, "%": 1 },
  1523. "word-spacing": { "normal": 1 },
  1524. "filter": { "alpha(opacity=$0100)": 1 },
  1525. "text-shadow": { "$02px 2px 2px #777": 1 },
  1526. "text-overflow": { "ellipsis-word": 1, "clip": 1, "ellipsis": 1 },
  1527. "-moz-border-radius": 1,
  1528. "-moz-border-radius-topright": 1,
  1529. "-moz-border-radius-bottomright": 1,
  1530. "-moz-border-radius-topleft": 1,
  1531. "-moz-border-radius-bottomleft": 1,
  1532. "-webkit-border-radius": 1,
  1533. "-webkit-border-top-right-radius": 1,
  1534. "-webkit-border-top-left-radius": 1,
  1535. "-webkit-border-bottom-right-radius": 1,
  1536. "-webkit-border-bottom-left-radius": 1,
  1537. "-moz-box-shadow": 1,
  1538. "-webkit-box-shadow": 1,
  1539. "transform": { "rotate($00deg)": 1, "skew($00deg)": 1 },
  1540. "-moz-transform": { "rotate($00deg)": 1, "skew($00deg)": 1 },
  1541. "-webkit-transform": { "rotate($00deg)": 1, "skew($00deg)": 1 }
  1542. };
  1543. var CssCompletions = function () {
  1544. };
  1545. (function () {
  1546. this.completionsDefined = false;
  1547. this.defineCompletions = function () {
  1548. if (document) {
  1549. var style = document.createElement('c').style;
  1550. for (var i in style) {
  1551. if (typeof style[i] !== 'string')
  1552. continue;
  1553. var name = i.replace(/[A-Z]/g, function (x) {
  1554. return '-' + x.toLowerCase();
  1555. });
  1556. if (!propertyMap.hasOwnProperty(name))
  1557. propertyMap[name] = 1;
  1558. }
  1559. }
  1560. this.completionsDefined = true;
  1561. };
  1562. this.getCompletions = function (state, session, pos, prefix) {
  1563. if (!this.completionsDefined) {
  1564. this.defineCompletions();
  1565. }
  1566. if (state === 'ruleset' || session.$mode.$id == "ace/mode/scss") {
  1567. var line = session.getLine(pos.row).substr(0, pos.column);
  1568. if (/:[^;]+$/.test(line)) {
  1569. /([\w\-]+):[^:]*$/.test(line);
  1570. return this.getPropertyValueCompletions(state, session, pos, prefix);
  1571. }
  1572. else {
  1573. return this.getPropertyCompletions(state, session, pos, prefix);
  1574. }
  1575. }
  1576. return [];
  1577. };
  1578. this.getPropertyCompletions = function (state, session, pos, prefix) {
  1579. var properties = Object.keys(propertyMap);
  1580. return properties.map(function (property) {
  1581. return {
  1582. caption: property,
  1583. snippet: property + ': $0;',
  1584. meta: "property",
  1585. score: 1000000
  1586. };
  1587. });
  1588. };
  1589. this.getPropertyValueCompletions = function (state, session, pos, prefix) {
  1590. var line = session.getLine(pos.row).substr(0, pos.column);
  1591. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  1592. if (!property)
  1593. return [];
  1594. var values = [];
  1595. if (property in propertyMap && typeof propertyMap[property] === "object") {
  1596. values = Object.keys(propertyMap[property]);
  1597. }
  1598. return values.map(function (value) {
  1599. return {
  1600. caption: value,
  1601. snippet: value,
  1602. meta: "property value",
  1603. score: 1000000
  1604. };
  1605. });
  1606. };
  1607. }).call(CssCompletions.prototype);
  1608. exports.CssCompletions = CssCompletions;
  1609. });
  1610. ace.define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module){"use strict";
  1611. var oop = require("../../lib/oop");
  1612. var Behaviour = require("../behaviour").Behaviour;
  1613. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  1614. var TokenIterator = require("../../token_iterator").TokenIterator;
  1615. var CssBehaviour = function () {
  1616. this.inherit(CstyleBehaviour);
  1617. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1618. if (text === ':' && editor.selection.isEmpty()) {
  1619. var cursor = editor.getCursorPosition();
  1620. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1621. var token = iterator.getCurrentToken();
  1622. if (token && token.value.match(/\s+/)) {
  1623. token = iterator.stepBackward();
  1624. }
  1625. if (token && token.type === 'support.type') {
  1626. var line = session.doc.getLine(cursor.row);
  1627. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1628. if (rightChar === ':') {
  1629. return {
  1630. text: '',
  1631. selection: [1, 1]
  1632. };
  1633. }
  1634. if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
  1635. return {
  1636. text: ':;',
  1637. selection: [1, 1]
  1638. };
  1639. }
  1640. }
  1641. }
  1642. });
  1643. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1644. var selected = session.doc.getTextRange(range);
  1645. if (!range.isMultiLine() && selected === ':') {
  1646. var cursor = editor.getCursorPosition();
  1647. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1648. var token = iterator.getCurrentToken();
  1649. if (token && token.value.match(/\s+/)) {
  1650. token = iterator.stepBackward();
  1651. }
  1652. if (token && token.type === 'support.type') {
  1653. var line = session.doc.getLine(range.start.row);
  1654. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1655. if (rightChar === ';') {
  1656. range.end.column++;
  1657. return range;
  1658. }
  1659. }
  1660. }
  1661. });
  1662. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1663. if (text === ';' && editor.selection.isEmpty()) {
  1664. var cursor = editor.getCursorPosition();
  1665. var line = session.doc.getLine(cursor.row);
  1666. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1667. if (rightChar === ';') {
  1668. return {
  1669. text: '',
  1670. selection: [1, 1]
  1671. };
  1672. }
  1673. }
  1674. });
  1675. this.add("!important", "insertion", function (state, action, editor, session, text) {
  1676. if (text === '!' && editor.selection.isEmpty()) {
  1677. var cursor = editor.getCursorPosition();
  1678. var line = session.doc.getLine(cursor.row);
  1679. if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
  1680. return {
  1681. text: '!important',
  1682. selection: [10, 10]
  1683. };
  1684. }
  1685. }
  1686. });
  1687. };
  1688. oop.inherits(CssBehaviour, CstyleBehaviour);
  1689. exports.CssBehaviour = CssBehaviour;
  1690. });
  1691. ace.define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
  1692. var oop = require("../lib/oop");
  1693. var TextMode = require("./text").Mode;
  1694. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1695. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1696. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1697. var CssCompletions = require("./css_completions").CssCompletions;
  1698. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  1699. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1700. var Mode = function () {
  1701. this.HighlightRules = CssHighlightRules;
  1702. this.$outdent = new MatchingBraceOutdent();
  1703. this.$behaviour = new CssBehaviour();
  1704. this.$completer = new CssCompletions();
  1705. this.foldingRules = new CStyleFoldMode();
  1706. };
  1707. oop.inherits(Mode, TextMode);
  1708. (function () {
  1709. this.foldingRules = "cStyle";
  1710. this.blockComment = { start: "/*", end: "*/" };
  1711. this.getNextLineIndent = function (state, line, tab) {
  1712. var indent = this.$getIndent(line);
  1713. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1714. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  1715. return indent;
  1716. }
  1717. var match = line.match(/^.*\{\s*$/);
  1718. if (match) {
  1719. indent += tab;
  1720. }
  1721. return indent;
  1722. };
  1723. this.checkOutdent = function (state, line, input) {
  1724. return this.$outdent.checkOutdent(line, input);
  1725. };
  1726. this.autoOutdent = function (state, doc, row) {
  1727. this.$outdent.autoOutdent(doc, row);
  1728. };
  1729. this.getCompletions = function (state, session, pos, prefix) {
  1730. return this.$completer.getCompletions(state, session, pos, prefix);
  1731. };
  1732. this.createWorker = function (session) {
  1733. var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
  1734. worker.attachToDocument(session.getDocument());
  1735. worker.on("annotate", function (e) {
  1736. session.setAnnotations(e.data);
  1737. });
  1738. worker.on("terminate", function () {
  1739. session.clearAnnotations();
  1740. });
  1741. return worker;
  1742. };
  1743. this.$id = "ace/mode/css";
  1744. this.snippetFileId = "ace/snippets/css";
  1745. }).call(Mode.prototype);
  1746. exports.Mode = Mode;
  1747. });
  1748. 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){"use strict";
  1749. var oop = require("../lib/oop");
  1750. var lang = require("../lib/lang");
  1751. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1752. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1753. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  1754. var tagMap = lang.createMap({
  1755. a: 'anchor',
  1756. button: 'form',
  1757. form: 'form',
  1758. img: 'image',
  1759. input: 'form',
  1760. label: 'form',
  1761. option: 'form',
  1762. script: 'script',
  1763. select: 'form',
  1764. textarea: 'form',
  1765. style: 'style',
  1766. table: 'table',
  1767. tbody: 'table',
  1768. td: 'table',
  1769. tfoot: 'table',
  1770. th: 'table',
  1771. tr: 'table'
  1772. });
  1773. var HtmlHighlightRules = function () {
  1774. XmlHighlightRules.call(this);
  1775. this.addRules({
  1776. attributes: [{
  1777. include: "tag_whitespace"
  1778. }, {
  1779. token: "entity.other.attribute-name.xml",
  1780. regex: "[-_a-zA-Z0-9:.]+"
  1781. }, {
  1782. token: "keyword.operator.attribute-equals.xml",
  1783. regex: "=",
  1784. push: [{
  1785. include: "tag_whitespace"
  1786. }, {
  1787. token: "string.unquoted.attribute-value.html",
  1788. regex: "[^<>='\"`\\s]+",
  1789. next: "pop"
  1790. }, {
  1791. token: "empty",
  1792. regex: "",
  1793. next: "pop"
  1794. }]
  1795. }, {
  1796. include: "attribute_value"
  1797. }],
  1798. tag: [{
  1799. token: function (start, tag) {
  1800. var group = tagMap[tag];
  1801. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  1802. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  1803. },
  1804. regex: "(</?)([-_a-zA-Z0-9:.]+)",
  1805. next: "tag_stuff"
  1806. }],
  1807. tag_stuff: [
  1808. { include: "attributes" },
  1809. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" }
  1810. ]
  1811. });
  1812. this.embedTagRules(CssHighlightRules, "css-", "style");
  1813. this.embedTagRules(new JavaScriptHighlightRules({ jsx: false }).getRules(), "js-", "script");
  1814. if (this.constructor === HtmlHighlightRules)
  1815. this.normalizeRules();
  1816. };
  1817. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  1818. exports.HtmlHighlightRules = HtmlHighlightRules;
  1819. });
  1820. ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
  1821. var oop = require("../../lib/oop");
  1822. var BaseFoldMode = require("./fold_mode").FoldMode;
  1823. var FoldMode = exports.FoldMode = function (defaultMode, subModes) {
  1824. this.defaultMode = defaultMode;
  1825. this.subModes = subModes;
  1826. };
  1827. oop.inherits(FoldMode, BaseFoldMode);
  1828. (function () {
  1829. this.$getMode = function (state) {
  1830. if (typeof state != "string")
  1831. state = state[0];
  1832. for (var key in this.subModes) {
  1833. if (state.indexOf(key) === 0)
  1834. return this.subModes[key];
  1835. }
  1836. return null;
  1837. };
  1838. this.$tryMode = function (state, session, foldStyle, row) {
  1839. var mode = this.$getMode(state);
  1840. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  1841. };
  1842. this.getFoldWidget = function (session, foldStyle, row) {
  1843. return (this.$tryMode(session.getState(row - 1), session, foldStyle, row) ||
  1844. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  1845. this.defaultMode.getFoldWidget(session, foldStyle, row));
  1846. };
  1847. this.getFoldWidgetRange = function (session, foldStyle, row) {
  1848. var mode = this.$getMode(session.getState(row - 1));
  1849. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1850. mode = this.$getMode(session.getState(row));
  1851. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1852. mode = this.defaultMode;
  1853. return mode.getFoldWidgetRange(session, foldStyle, row);
  1854. };
  1855. }).call(FoldMode.prototype);
  1856. });
  1857. ace.define("ace/mode/folding/html",["require","exports","module","ace/lib/oop","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
  1858. var oop = require("../../lib/oop");
  1859. var MixedFoldMode = require("./mixed").FoldMode;
  1860. var XmlFoldMode = require("./xml").FoldMode;
  1861. var CStyleFoldMode = require("./cstyle").FoldMode;
  1862. var FoldMode = exports.FoldMode = function (voidElements, optionalTags) {
  1863. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  1864. "js-": new CStyleFoldMode(),
  1865. "css-": new CStyleFoldMode()
  1866. });
  1867. };
  1868. oop.inherits(FoldMode, MixedFoldMode);
  1869. });
  1870. ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module){"use strict";
  1871. var TokenIterator = require("../token_iterator").TokenIterator;
  1872. var commonAttributes = [
  1873. "accesskey",
  1874. "class",
  1875. "contenteditable",
  1876. "contextmenu",
  1877. "dir",
  1878. "draggable",
  1879. "dropzone",
  1880. "hidden",
  1881. "id",
  1882. "inert",
  1883. "itemid",
  1884. "itemprop",
  1885. "itemref",
  1886. "itemscope",
  1887. "itemtype",
  1888. "lang",
  1889. "spellcheck",
  1890. "style",
  1891. "tabindex",
  1892. "title",
  1893. "translate"
  1894. ];
  1895. var eventAttributes = [
  1896. "onabort",
  1897. "onblur",
  1898. "oncancel",
  1899. "oncanplay",
  1900. "oncanplaythrough",
  1901. "onchange",
  1902. "onclick",
  1903. "onclose",
  1904. "oncontextmenu",
  1905. "oncuechange",
  1906. "ondblclick",
  1907. "ondrag",
  1908. "ondragend",
  1909. "ondragenter",
  1910. "ondragleave",
  1911. "ondragover",
  1912. "ondragstart",
  1913. "ondrop",
  1914. "ondurationchange",
  1915. "onemptied",
  1916. "onended",
  1917. "onerror",
  1918. "onfocus",
  1919. "oninput",
  1920. "oninvalid",
  1921. "onkeydown",
  1922. "onkeypress",
  1923. "onkeyup",
  1924. "onload",
  1925. "onloadeddata",
  1926. "onloadedmetadata",
  1927. "onloadstart",
  1928. "onmousedown",
  1929. "onmousemove",
  1930. "onmouseout",
  1931. "onmouseover",
  1932. "onmouseup",
  1933. "onmousewheel",
  1934. "onpause",
  1935. "onplay",
  1936. "onplaying",
  1937. "onprogress",
  1938. "onratechange",
  1939. "onreset",
  1940. "onscroll",
  1941. "onseeked",
  1942. "onseeking",
  1943. "onselect",
  1944. "onshow",
  1945. "onstalled",
  1946. "onsubmit",
  1947. "onsuspend",
  1948. "ontimeupdate",
  1949. "onvolumechange",
  1950. "onwaiting"
  1951. ];
  1952. var globalAttributes = commonAttributes.concat(eventAttributes);
  1953. var attributeMap = {
  1954. "a": { "href": 1, "target": { "_blank": 1, "top": 1 }, "ping": 1, "rel": { "nofollow": 1, "alternate": 1, "author": 1, "bookmark": 1, "help": 1, "license": 1, "next": 1, "noreferrer": 1, "prefetch": 1, "prev": 1, "search": 1, "tag": 1 }, "media": 1, "hreflang": 1, "type": 1 },
  1955. "abbr": {},
  1956. "address": {},
  1957. "area": { "shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1 },
  1958. "article": { "pubdate": 1 },
  1959. "aside": {},
  1960. "audio": { "src": 1, "autobuffer": 1, "autoplay": { "autoplay": 1 }, "loop": { "loop": 1 }, "controls": { "controls": 1 }, "muted": { "muted": 1 }, "preload": { "auto": 1, "metadata": 1, "none": 1 } },
  1961. "b": {},
  1962. "base": { "href": 1, "target": 1 },
  1963. "bdi": {},
  1964. "bdo": {},
  1965. "blockquote": { "cite": 1 },
  1966. "body": { "onafterprint": 1, "onbeforeprint": 1, "onbeforeunload": 1, "onhashchange": 1, "onmessage": 1, "onoffline": 1, "onpopstate": 1, "onredo": 1, "onresize": 1, "onstorage": 1, "onundo": 1, "onunload": 1 },
  1967. "br": {},
  1968. "button": { "autofocus": 1, "disabled": { "disabled": 1 }, "form": 1, "formaction": 1, "formenctype": 1, "formmethod": 1, "formnovalidate": 1, "formtarget": 1, "name": 1, "value": 1, "type": { "button": 1, "submit": 1 } },
  1969. "canvas": { "width": 1, "height": 1 },
  1970. "caption": {},
  1971. "cite": {},
  1972. "code": {},
  1973. "col": { "span": 1 },
  1974. "colgroup": { "span": 1 },
  1975. "command": { "type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1 },
  1976. "data": {},
  1977. "datalist": {},
  1978. "dd": {},
  1979. "del": { "cite": 1, "datetime": 1 },
  1980. "details": { "open": 1 },
  1981. "dfn": {},
  1982. "dialog": { "open": 1 },
  1983. "div": {},
  1984. "dl": {},
  1985. "dt": {},
  1986. "em": {},
  1987. "embed": { "src": 1, "height": 1, "width": 1, "type": 1 },
  1988. "fieldset": { "disabled": 1, "form": 1, "name": 1 },
  1989. "figcaption": {},
  1990. "figure": {},
  1991. "footer": {},
  1992. "form": { "accept-charset": 1, "action": 1, "autocomplete": 1, "enctype": { "multipart/form-data": 1, "application/x-www-form-urlencoded": 1 }, "method": { "get": 1, "post": 1 }, "name": 1, "novalidate": 1, "target": { "_blank": 1, "top": 1 } },
  1993. "h1": {},
  1994. "h2": {},
  1995. "h3": {},
  1996. "h4": {},
  1997. "h5": {},
  1998. "h6": {},
  1999. "head": {},
  2000. "header": {},
  2001. "hr": {},
  2002. "html": { "manifest": 1 },
  2003. "i": {},
  2004. "iframe": { "name": 1, "src": 1, "height": 1, "width": 1, "sandbox": { "allow-same-origin": 1, "allow-top-navigation": 1, "allow-forms": 1, "allow-scripts": 1 }, "seamless": { "seamless": 1 } },
  2005. "img": { "alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1 },
  2006. "input": {
  2007. "type": { "text": 1, "password": 1, "hidden": 1, "checkbox": 1, "submit": 1, "radio": 1, "file": 1, "button": 1, "reset": 1, "image": 31, "color": 1, "date": 1, "datetime": 1, "datetime-local": 1, "email": 1, "month": 1, "number": 1, "range": 1, "search": 1, "tel": 1, "time": 1, "url": 1, "week": 1 },
  2008. "accept": 1, "alt": 1, "autocomplete": { "on": 1, "off": 1 }, "autofocus": { "autofocus": 1 }, "checked": { "checked": 1 }, "disabled": { "disabled": 1 }, "form": 1, "formaction": 1, "formenctype": { "application/x-www-form-urlencoded": 1, "multipart/form-data": 1, "text/plain": 1 }, "formmethod": { "get": 1, "post": 1 }, "formnovalidate": { "formnovalidate": 1 }, "formtarget": { "_blank": 1, "_self": 1, "_parent": 1, "_top": 1 }, "height": 1, "list": 1, "max": 1, "maxlength": 1, "min": 1, "multiple": { "multiple": 1 }, "name": 1, "pattern": 1, "placeholder": 1, "readonly": { "readonly": 1 }, "required": { "required": 1 }, "size": 1, "src": 1, "step": 1, "width": 1, "files": 1, "value": 1
  2009. },
  2010. "ins": { "cite": 1, "datetime": 1 },
  2011. "kbd": {},
  2012. "keygen": { "autofocus": 1, "challenge": { "challenge": 1 }, "disabled": { "disabled": 1 }, "form": 1, "keytype": { "rsa": 1, "dsa": 1, "ec": 1 }, "name": 1 },
  2013. "label": { "form": 1, "for": 1 },
  2014. "legend": {},
  2015. "li": { "value": 1 },
  2016. "link": { "href": 1, "hreflang": 1, "rel": { "stylesheet": 1, "icon": 1 }, "media": { "all": 1, "screen": 1, "print": 1 }, "type": { "text/css": 1, "image/png": 1, "image/jpeg": 1, "image/gif": 1 }, "sizes": 1 },
  2017. "main": {},
  2018. "map": { "name": 1 },
  2019. "mark": {},
  2020. "math": {},
  2021. "menu": { "type": 1, "label": 1 },
  2022. "meta": { "http-equiv": { "content-type": 1 }, "name": { "description": 1, "keywords": 1 }, "content": { "text/html; charset=UTF-8": 1 }, "charset": 1 },
  2023. "meter": { "value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1 },
  2024. "nav": {},
  2025. "noscript": { "href": 1 },
  2026. "object": { "param": 1, "data": 1, "type": 1, "height": 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1 },
  2027. "ol": { "start": 1, "reversed": 1 },
  2028. "optgroup": { "disabled": 1, "label": 1 },
  2029. "option": { "disabled": 1, "selected": 1, "label": 1, "value": 1 },
  2030. "output": { "for": 1, "form": 1, "name": 1 },
  2031. "p": {},
  2032. "param": { "name": 1, "value": 1 },
  2033. "pre": {},
  2034. "progress": { "value": 1, "max": 1 },
  2035. "q": { "cite": 1 },
  2036. "rp": {},
  2037. "rt": {},
  2038. "ruby": {},
  2039. "s": {},
  2040. "samp": {},
  2041. "script": { "charset": 1, "type": { "text/javascript": 1 }, "src": 1, "defer": 1, "async": 1 },
  2042. "select": { "autofocus": 1, "disabled": 1, "form": 1, "multiple": { "multiple": 1 }, "name": 1, "size": 1, "readonly": { "readonly": 1 } },
  2043. "small": {},
  2044. "source": { "src": 1, "type": 1, "media": 1 },
  2045. "span": {},
  2046. "strong": {},
  2047. "style": { "type": 1, "media": { "all": 1, "screen": 1, "print": 1 }, "scoped": 1 },
  2048. "sub": {},
  2049. "sup": {},
  2050. "svg": {},
  2051. "table": { "summary": 1 },
  2052. "tbody": {},
  2053. "td": { "headers": 1, "rowspan": 1, "colspan": 1 },
  2054. "textarea": { "autofocus": { "autofocus": 1 }, "disabled": { "disabled": 1 }, "form": 1, "maxlength": 1, "name": 1, "placeholder": 1, "readonly": { "readonly": 1 }, "required": { "required": 1 }, "rows": 1, "cols": 1, "wrap": { "on": 1, "off": 1, "hard": 1, "soft": 1 } },
  2055. "tfoot": {},
  2056. "th": { "headers": 1, "rowspan": 1, "colspan": 1, "scope": 1 },
  2057. "thead": {},
  2058. "time": { "datetime": 1 },
  2059. "title": {},
  2060. "tr": {},
  2061. "track": { "kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1 },
  2062. "section": {},
  2063. "summary": {},
  2064. "u": {},
  2065. "ul": {},
  2066. "var": {},
  2067. "video": { "src": 1, "autobuffer": 1, "autoplay": { "autoplay": 1 }, "loop": { "loop": 1 }, "controls": { "controls": 1 }, "width": 1, "height": 1, "poster": 1, "muted": { "muted": 1 }, "preload": { "auto": 1, "metadata": 1, "none": 1 } },
  2068. "wbr": {}
  2069. };
  2070. var elements = Object.keys(attributeMap);
  2071. function is(token, type) {
  2072. return token.type.lastIndexOf(type + ".xml") > -1;
  2073. }
  2074. function findTagName(session, pos) {
  2075. var iterator = new TokenIterator(session, pos.row, pos.column);
  2076. var token = iterator.getCurrentToken();
  2077. while (token && !is(token, "tag-name")) {
  2078. token = iterator.stepBackward();
  2079. }
  2080. if (token)
  2081. return token.value;
  2082. }
  2083. function findAttributeName(session, pos) {
  2084. var iterator = new TokenIterator(session, pos.row, pos.column);
  2085. var token = iterator.getCurrentToken();
  2086. while (token && !is(token, "attribute-name")) {
  2087. token = iterator.stepBackward();
  2088. }
  2089. if (token)
  2090. return token.value;
  2091. }
  2092. var HtmlCompletions = function () {
  2093. };
  2094. (function () {
  2095. this.getCompletions = function (state, session, pos, prefix) {
  2096. var token = session.getTokenAt(pos.row, pos.column);
  2097. if (!token)
  2098. return [];
  2099. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2100. return this.getTagCompletions(state, session, pos, prefix);
  2101. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2102. return this.getAttributeCompletions(state, session, pos, prefix);
  2103. if (is(token, "attribute-value"))
  2104. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2105. var line = session.getLine(pos.row).substr(0, pos.column);
  2106. if (/&[a-z]*$/i.test(line))
  2107. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2108. return [];
  2109. };
  2110. this.getTagCompletions = function (state, session, pos, prefix) {
  2111. return elements.map(function (element) {
  2112. return {
  2113. value: element,
  2114. meta: "tag",
  2115. score: 1000000
  2116. };
  2117. });
  2118. };
  2119. this.getAttributeCompletions = function (state, session, pos, prefix) {
  2120. var tagName = findTagName(session, pos);
  2121. if (!tagName)
  2122. return [];
  2123. var attributes = globalAttributes;
  2124. if (tagName in attributeMap) {
  2125. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2126. }
  2127. return attributes.map(function (attribute) {
  2128. return {
  2129. caption: attribute,
  2130. snippet: attribute + '="$0"',
  2131. meta: "attribute",
  2132. score: 1000000
  2133. };
  2134. });
  2135. };
  2136. this.getAttributeValueCompletions = function (state, session, pos, prefix) {
  2137. var tagName = findTagName(session, pos);
  2138. var attributeName = findAttributeName(session, pos);
  2139. if (!tagName)
  2140. return [];
  2141. var values = [];
  2142. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2143. values = Object.keys(attributeMap[tagName][attributeName]);
  2144. }
  2145. return values.map(function (value) {
  2146. return {
  2147. caption: value,
  2148. snippet: value,
  2149. meta: "attribute value",
  2150. score: 1000000
  2151. };
  2152. });
  2153. };
  2154. this.getHTMLEntityCompletions = function (state, session, pos, prefix) {
  2155. var values = ['Aacute;', 'aacute;', 'Acirc;', 'acirc;', 'acute;', 'AElig;', 'aelig;', 'Agrave;', 'agrave;', 'alefsym;', 'Alpha;', 'alpha;', 'amp;', 'and;', 'ang;', 'Aring;', 'aring;', 'asymp;', 'Atilde;', 'atilde;', 'Auml;', 'auml;', 'bdquo;', 'Beta;', 'beta;', 'brvbar;', 'bull;', 'cap;', 'Ccedil;', 'ccedil;', 'cedil;', 'cent;', 'Chi;', 'chi;', 'circ;', 'clubs;', 'cong;', 'copy;', 'crarr;', 'cup;', 'curren;', 'Dagger;', 'dagger;', 'dArr;', 'darr;', 'deg;', 'Delta;', 'delta;', 'diams;', 'divide;', 'Eacute;', 'eacute;', 'Ecirc;', 'ecirc;', 'Egrave;', 'egrave;', 'empty;', 'emsp;', 'ensp;', 'Epsilon;', 'epsilon;', 'equiv;', 'Eta;', 'eta;', 'ETH;', 'eth;', 'Euml;', 'euml;', 'euro;', 'exist;', 'fnof;', 'forall;', 'frac12;', 'frac14;', 'frac34;', 'frasl;', 'Gamma;', 'gamma;', 'ge;', 'gt;', 'hArr;', 'harr;', 'hearts;', 'hellip;', 'Iacute;', 'iacute;', 'Icirc;', 'icirc;', 'iexcl;', 'Igrave;', 'igrave;', 'image;', 'infin;', 'int;', 'Iota;', 'iota;', 'iquest;', 'isin;', 'Iuml;', 'iuml;', 'Kappa;', 'kappa;', 'Lambda;', 'lambda;', 'lang;', 'laquo;', 'lArr;', 'larr;', 'lceil;', 'ldquo;', 'le;', 'lfloor;', 'lowast;', 'loz;', 'lrm;', 'lsaquo;', 'lsquo;', 'lt;', 'macr;', 'mdash;', 'micro;', 'middot;', 'minus;', 'Mu;', 'mu;', 'nabla;', 'nbsp;', 'ndash;', 'ne;', 'ni;', 'not;', 'notin;', 'nsub;', 'Ntilde;', 'ntilde;', 'Nu;', 'nu;', 'Oacute;', 'oacute;', 'Ocirc;', 'ocirc;', 'OElig;', 'oelig;', 'Ograve;', 'ograve;', 'oline;', 'Omega;', 'omega;', 'Omicron;', 'omicron;', 'oplus;', 'or;', 'ordf;', 'ordm;', 'Oslash;', 'oslash;', 'Otilde;', 'otilde;', 'otimes;', 'Ouml;', 'ouml;', 'para;', 'part;', 'permil;', 'perp;', 'Phi;', 'phi;', 'Pi;', 'pi;', 'piv;', 'plusmn;', 'pound;', 'Prime;', 'prime;', 'prod;', 'prop;', 'Psi;', 'psi;', 'quot;', 'radic;', 'rang;', 'raquo;', 'rArr;', 'rarr;', 'rceil;', 'rdquo;', 'real;', 'reg;', 'rfloor;', 'Rho;', 'rho;', 'rlm;', 'rsaquo;', 'rsquo;', 'sbquo;', 'Scaron;', 'scaron;', 'sdot;', 'sect;', 'shy;', 'Sigma;', 'sigma;', 'sigmaf;', 'sim;', 'spades;', 'sub;', 'sube;', 'sum;', 'sup;', 'sup1;', 'sup2;', 'sup3;', 'supe;', 'szlig;', 'Tau;', 'tau;', 'there4;', 'Theta;', 'theta;', 'thetasym;', 'thinsp;', 'THORN;', 'thorn;', 'tilde;', 'times;', 'trade;', 'Uacute;', 'uacute;', 'uArr;', 'uarr;', 'Ucirc;', 'ucirc;', 'Ugrave;', 'ugrave;', 'uml;', 'upsih;', 'Upsilon;', 'upsilon;', 'Uuml;', 'uuml;', 'weierp;', 'Xi;', 'xi;', 'Yacute;', 'yacute;', 'yen;', 'Yuml;', 'yuml;', 'Zeta;', 'zeta;', 'zwj;', 'zwnj;'];
  2156. return values.map(function (value) {
  2157. return {
  2158. caption: value,
  2159. snippet: value,
  2160. meta: "html entity",
  2161. score: 1000000
  2162. };
  2163. });
  2164. };
  2165. }).call(HtmlCompletions.prototype);
  2166. exports.HtmlCompletions = HtmlCompletions;
  2167. });
  2168. ace.define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"], function(require, exports, module){"use strict";
  2169. var oop = require("../lib/oop");
  2170. var lang = require("../lib/lang");
  2171. var TextMode = require("./text").Mode;
  2172. var JavaScriptMode = require("./javascript").Mode;
  2173. var CssMode = require("./css").Mode;
  2174. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2175. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  2176. var HtmlFoldMode = require("./folding/html").FoldMode;
  2177. var HtmlCompletions = require("./html_completions").HtmlCompletions;
  2178. var WorkerClient = require("../worker/worker_client").WorkerClient;
  2179. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2180. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2181. var Mode = function (options) {
  2182. this.fragmentContext = options && options.fragmentContext;
  2183. this.HighlightRules = HtmlHighlightRules;
  2184. this.$behaviour = new XmlBehaviour();
  2185. this.$completer = new HtmlCompletions();
  2186. this.createModeDelegates({
  2187. "js-": JavaScriptMode,
  2188. "css-": CssMode
  2189. });
  2190. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2191. };
  2192. oop.inherits(Mode, TextMode);
  2193. (function () {
  2194. this.blockComment = { start: "<!--", end: "-->" };
  2195. this.voidElements = lang.arrayToMap(voidElements);
  2196. this.getNextLineIndent = function (state, line, tab) {
  2197. return this.$getIndent(line);
  2198. };
  2199. this.checkOutdent = function (state, line, input) {
  2200. return false;
  2201. };
  2202. this.getCompletions = function (state, session, pos, prefix) {
  2203. return this.$completer.getCompletions(state, session, pos, prefix);
  2204. };
  2205. this.createWorker = function (session) {
  2206. if (this.constructor != Mode)
  2207. return;
  2208. var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
  2209. worker.attachToDocument(session.getDocument());
  2210. if (this.fragmentContext)
  2211. worker.call("setOptions", [{ context: this.fragmentContext }]);
  2212. worker.on("error", function (e) {
  2213. session.setAnnotations(e.data);
  2214. });
  2215. worker.on("terminate", function () {
  2216. session.clearAnnotations();
  2217. });
  2218. return worker;
  2219. };
  2220. this.$id = "ace/mode/html";
  2221. this.snippetFileId = "ace/snippets/html";
  2222. }).call(Mode.prototype);
  2223. exports.Mode = Mode;
  2224. });
  2225. ace.define("ace/mode/markdown_highlight_rules",["require","exports","module","ace/config","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module){"use strict";
  2226. var modes = require("../config").$modes;
  2227. var oop = require("../lib/oop");
  2228. var lang = require("../lib/lang");
  2229. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  2230. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2231. var escaped = function (ch) {
  2232. return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*";
  2233. };
  2234. var MarkdownHighlightRules = function () {
  2235. HtmlHighlightRules.call(this);
  2236. var codeBlockStartRule = {
  2237. token: "support.function",
  2238. regex: /^\s*(```+[^`]*|~~~+[^~]*)$/,
  2239. onMatch: function (value, state, stack, line) {
  2240. var m = value.match(/^(\s*)([`~]+)(.*)/);
  2241. var language = /[\w-]+|$/.exec(m[3])[0];
  2242. if (!modes[language])
  2243. language = "";
  2244. stack.unshift("githubblock", [], [m[1], m[2], language], state);
  2245. return this.token;
  2246. },
  2247. next: "githubblock"
  2248. };
  2249. var codeBlockRules = [{
  2250. token: "support.function",
  2251. regex: ".*",
  2252. onMatch: function (value, state, stack, line) {
  2253. var embedState = stack[1];
  2254. var indent = stack[2][0];
  2255. var endMarker = stack[2][1];
  2256. var language = stack[2][2];
  2257. var m = /^(\s*)(`+|~+)\s*$/.exec(value);
  2258. if (m && m[1].length < indent.length + 3
  2259. && m[2].length >= endMarker.length && m[2][0] == endMarker[0]) {
  2260. stack.splice(0, 3);
  2261. this.next = stack.shift();
  2262. return this.token;
  2263. }
  2264. this.next = "";
  2265. if (language && modes[language]) {
  2266. var data = modes[language].getTokenizer().getLineTokens(value, embedState.slice(0));
  2267. stack[1] = data.state;
  2268. return data.tokens;
  2269. }
  2270. return this.token;
  2271. }
  2272. }];
  2273. this.$rules["start"].unshift({
  2274. token: "empty_line",
  2275. regex: '^$',
  2276. next: "allowBlock"
  2277. }, {
  2278. token: "markup.heading.1",
  2279. regex: "^=+(?=\\s*$)"
  2280. }, {
  2281. token: "markup.heading.2",
  2282. regex: "^\\-+(?=\\s*$)"
  2283. }, {
  2284. token: function (value) {
  2285. return "markup.heading." + value.length;
  2286. },
  2287. regex: /^#{1,6}(?=\s|$)/,
  2288. next: "header"
  2289. }, codeBlockStartRule, {
  2290. token: "string.blockquote",
  2291. regex: "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  2292. next: "blockquote"
  2293. }, {
  2294. token: "constant",
  2295. regex: "^ {0,3}(?:(?:\\* ?){3,}|(?:\\- ?){3,}|(?:\\_ ?){3,})\\s*$",
  2296. next: "allowBlock"
  2297. }, {
  2298. token: "markup.list",
  2299. regex: "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  2300. next: "listblock-start"
  2301. }, {
  2302. include: "basic"
  2303. });
  2304. this.addRules({
  2305. "basic": [{
  2306. token: "constant.language.escape",
  2307. regex: /\\[\\`*_{}\[\]()#+\-.!]/
  2308. }, {
  2309. token: "support.function",
  2310. regex: "(`+)(.*?[^`])(\\1)"
  2311. }, {
  2312. token: ["text", "constant", "text", "url", "string", "text"],
  2313. regex: "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
  2314. }, {
  2315. token: ["text", "string", "text", "constant", "text"],
  2316. regex: "(\\[)(" + escaped("]") + ")(\\]\\s*\\[)(" + escaped("]") + ")(\\])"
  2317. }, {
  2318. token: ["text", "string", "text", "markup.underline", "string", "text"],
  2319. regex: "(\\!?\\[)(" + // [
  2320. escaped("]") + // link text or alt text
  2321. ")(\\]\\()" + // ](
  2322. '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href or image
  2323. '(\\s*"' + escaped('"') + '"\\s*)?' + // "title"
  2324. "(\\))" // )
  2325. }, {
  2326. token: "string.strong",
  2327. regex: "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
  2328. }, {
  2329. token: "string.emphasis",
  2330. regex: "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
  2331. }, {
  2332. token: ["text", "url", "text"],
  2333. regex: "(<)(" +
  2334. "(?:https?|ftp|dict):[^'\">\\s]+" +
  2335. "|" +
  2336. "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+" +
  2337. ")(>)"
  2338. }],
  2339. "allowBlock": [
  2340. { token: "support.function", regex: "^ {4}.+", next: "allowBlock" },
  2341. { token: "empty_line", regex: '^$', next: "allowBlock" },
  2342. { token: "empty", regex: "", next: "start" }
  2343. ],
  2344. "header": [{
  2345. regex: "$",
  2346. next: "start"
  2347. }, {
  2348. include: "basic"
  2349. }, {
  2350. defaultToken: "heading"
  2351. }],
  2352. "listblock-start": [{
  2353. token: "support.variable",
  2354. regex: /(?:\[[ x]\])?/,
  2355. next: "listblock"
  2356. }],
  2357. "listblock": [{
  2358. token: "empty_line",
  2359. regex: "^$",
  2360. next: "start"
  2361. }, {
  2362. token: "markup.list",
  2363. regex: "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  2364. next: "listblock-start"
  2365. }, {
  2366. include: "basic", noEscape: true
  2367. },
  2368. codeBlockStartRule,
  2369. {
  2370. defaultToken: "list" //do not use markup.list to allow stling leading `*` differntly
  2371. }],
  2372. "blockquote": [{
  2373. token: "empty_line",
  2374. regex: "^\\s*$",
  2375. next: "start"
  2376. }, {
  2377. token: "string.blockquote",
  2378. regex: "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  2379. next: "blockquote"
  2380. }, {
  2381. include: "basic", noEscape: true
  2382. }, {
  2383. defaultToken: "string.blockquote"
  2384. }],
  2385. "githubblock": codeBlockRules
  2386. });
  2387. this.normalizeRules();
  2388. };
  2389. oop.inherits(MarkdownHighlightRules, TextHighlightRules);
  2390. exports.MarkdownHighlightRules = MarkdownHighlightRules;
  2391. });
  2392. ace.define("ace/mode/folding/markdown",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module){"use strict";
  2393. var oop = require("../../lib/oop");
  2394. var BaseFoldMode = require("./fold_mode").FoldMode;
  2395. var Range = require("../../range").Range;
  2396. var FoldMode = exports.FoldMode = function () { };
  2397. oop.inherits(FoldMode, BaseFoldMode);
  2398. (function () {
  2399. this.foldingStartMarker = /^(?:[=-]+\s*$|#{1,6} |`{3})/;
  2400. this.getFoldWidget = function (session, foldStyle, row) {
  2401. var line = session.getLine(row);
  2402. if (!this.foldingStartMarker.test(line))
  2403. return "";
  2404. if (line[0] == "`") {
  2405. if (session.bgTokenizer.getState(row) == "start")
  2406. return "end";
  2407. return "start";
  2408. }
  2409. return "start";
  2410. };
  2411. this.getFoldWidgetRange = function (session, foldStyle, row) {
  2412. var line = session.getLine(row);
  2413. var startColumn = line.length;
  2414. var maxRow = session.getLength();
  2415. var startRow = row;
  2416. var endRow = row;
  2417. if (!line.match(this.foldingStartMarker))
  2418. return;
  2419. if (line[0] == "`") {
  2420. if (session.bgTokenizer.getState(row) !== "start") {
  2421. while (++row < maxRow) {
  2422. line = session.getLine(row);
  2423. if (line[0] == "`" & line.substring(0, 3) == "```")
  2424. break;
  2425. }
  2426. return new Range(startRow, startColumn, row, 0);
  2427. }
  2428. else {
  2429. while (row-- > 0) {
  2430. line = session.getLine(row);
  2431. if (line[0] == "`" & line.substring(0, 3) == "```")
  2432. break;
  2433. }
  2434. return new Range(row, line.length, startRow, 0);
  2435. }
  2436. }
  2437. var token;
  2438. function isHeading(row) {
  2439. token = session.getTokens(row)[0];
  2440. return token && token.type.lastIndexOf(heading, 0) === 0;
  2441. }
  2442. var heading = "markup.heading";
  2443. function getLevel() {
  2444. var ch = token.value[0];
  2445. if (ch == "=")
  2446. return 6;
  2447. if (ch == "-")
  2448. return 5;
  2449. return 7 - token.value.search(/[^#]|$/);
  2450. }
  2451. if (isHeading(row)) {
  2452. var startHeadingLevel = getLevel();
  2453. while (++row < maxRow) {
  2454. if (!isHeading(row))
  2455. continue;
  2456. var level = getLevel();
  2457. if (level >= startHeadingLevel)
  2458. break;
  2459. }
  2460. endRow = row - (!token || ["=", "-"].indexOf(token.value[0]) == -1 ? 1 : 2);
  2461. if (endRow > startRow) {
  2462. while (endRow > startRow && /^\s*$/.test(session.getLine(endRow)))
  2463. endRow--;
  2464. }
  2465. if (endRow > startRow) {
  2466. var endColumn = session.getLine(endRow).length;
  2467. return new Range(startRow, startColumn, endRow, endColumn);
  2468. }
  2469. }
  2470. };
  2471. }).call(FoldMode.prototype);
  2472. });
  2473. ace.define("ace/mode/sh_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  2474. var oop = require("../lib/oop");
  2475. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  2476. var reservedKeywords = exports.reservedKeywords = ('!|{|}|case|do|done|elif|else|' +
  2477. 'esac|fi|for|if|in|then|until|while|' +
  2478. '&|;|export|local|read|typeset|unset|' +
  2479. 'elif|select|set|function|declare|readonly');
  2480. var languageConstructs = exports.languageConstructs = ('[|]|alias|bg|bind|break|builtin|' +
  2481. 'cd|command|compgen|complete|continue|' +
  2482. 'dirs|disown|echo|enable|eval|exec|' +
  2483. 'exit|fc|fg|getopts|hash|help|history|' +
  2484. 'jobs|kill|let|logout|popd|printf|pushd|' +
  2485. 'pwd|return|set|shift|shopt|source|' +
  2486. 'suspend|test|times|trap|type|ulimit|' +
  2487. 'umask|unalias|wait');
  2488. var ShHighlightRules = function () {
  2489. var keywordMapper = this.createKeywordMapper({
  2490. "keyword": reservedKeywords,
  2491. "support.function.builtin": languageConstructs,
  2492. "invalid.deprecated": "debugger"
  2493. }, "identifier");
  2494. var integer = "(?:(?:[1-9]\\d*)|(?:0))";
  2495. var fraction = "(?:\\.\\d+)";
  2496. var intPart = "(?:\\d+)";
  2497. var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
  2498. var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + ")";
  2499. var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
  2500. var fileDescriptor = "(?:&" + intPart + ")";
  2501. var variableName = "[a-zA-Z_][a-zA-Z0-9_]*";
  2502. var variable = "(?:" + variableName + "(?==))";
  2503. var builtinVariable = "(?:\\$(?:SHLVL|\\$|\\!|\\?))";
  2504. var func = "(?:" + variableName + "\\s*\\(\\))";
  2505. this.$rules = {
  2506. "start": [{
  2507. token: "constant",
  2508. regex: /\\./
  2509. }, {
  2510. token: ["text", "comment"],
  2511. regex: /(^|\s)(#.*)$/
  2512. }, {
  2513. token: "string.start",
  2514. regex: '"',
  2515. push: [{
  2516. token: "constant.language.escape",
  2517. regex: /\\(?:[$`"\\]|$)/
  2518. }, {
  2519. include: "variables"
  2520. }, {
  2521. token: "keyword.operator",
  2522. regex: /`/ // TODO highlight `
  2523. }, {
  2524. token: "string.end",
  2525. regex: '"',
  2526. next: "pop"
  2527. }, {
  2528. defaultToken: "string"
  2529. }]
  2530. }, {
  2531. token: "string",
  2532. regex: "\\$'",
  2533. push: [{
  2534. token: "constant.language.escape",
  2535. regex: /\\(?:[abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/
  2536. }, {
  2537. token: "string",
  2538. regex: "'",
  2539. next: "pop"
  2540. }, {
  2541. defaultToken: "string"
  2542. }]
  2543. }, {
  2544. regex: "<<<",
  2545. token: "keyword.operator"
  2546. }, {
  2547. stateName: "heredoc",
  2548. regex: "(<<-?)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)",
  2549. onMatch: function (value, currentState, stack) {
  2550. var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
  2551. var tokens = value.split(this.splitRegex);
  2552. stack.push(next, tokens[4]);
  2553. return [
  2554. { type: "constant", value: tokens[1] },
  2555. { type: "text", value: tokens[2] },
  2556. { type: "string", value: tokens[3] },
  2557. { type: "support.class", value: tokens[4] },
  2558. { type: "string", value: tokens[5] }
  2559. ];
  2560. },
  2561. rules: {
  2562. heredoc: [{
  2563. onMatch: function (value, currentState, stack) {
  2564. if (value === stack[1]) {
  2565. stack.shift();
  2566. stack.shift();
  2567. this.next = stack[0] || "start";
  2568. return "support.class";
  2569. }
  2570. this.next = "";
  2571. return "string";
  2572. },
  2573. regex: ".*$",
  2574. next: "start"
  2575. }],
  2576. indentedHeredoc: [{
  2577. token: "string",
  2578. regex: "^\t+"
  2579. }, {
  2580. onMatch: function (value, currentState, stack) {
  2581. if (value === stack[1]) {
  2582. stack.shift();
  2583. stack.shift();
  2584. this.next = stack[0] || "start";
  2585. return "support.class";
  2586. }
  2587. this.next = "";
  2588. return "string";
  2589. },
  2590. regex: ".*$",
  2591. next: "start"
  2592. }]
  2593. }
  2594. }, {
  2595. regex: "$",
  2596. token: "empty",
  2597. next: function (currentState, stack) {
  2598. if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
  2599. return stack[0];
  2600. return currentState;
  2601. }
  2602. }, {
  2603. token: ["keyword", "text", "text", "text", "variable"],
  2604. regex: /(declare|local|readonly)(\s+)(?:(-[fixar]+)(\s+))?([a-zA-Z_][a-zA-Z0-9_]*\b)/
  2605. }, {
  2606. token: "variable.language",
  2607. regex: builtinVariable
  2608. }, {
  2609. token: "variable",
  2610. regex: variable
  2611. }, {
  2612. include: "variables"
  2613. }, {
  2614. token: "support.function",
  2615. regex: func
  2616. }, {
  2617. token: "support.function",
  2618. regex: fileDescriptor
  2619. }, {
  2620. token: "string",
  2621. start: "'", end: "'"
  2622. }, {
  2623. token: "constant.numeric",
  2624. regex: floatNumber
  2625. }, {
  2626. token: "constant.numeric",
  2627. regex: integer + "\\b"
  2628. }, {
  2629. token: keywordMapper,
  2630. regex: "[a-zA-Z_][a-zA-Z0-9_]*\\b"
  2631. }, {
  2632. token: "keyword.operator",
  2633. regex: "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!=|[%&|`]"
  2634. }, {
  2635. token: "punctuation.operator",
  2636. regex: ";"
  2637. }, {
  2638. token: "paren.lparen",
  2639. regex: "[\\[\\(\\{]"
  2640. }, {
  2641. token: "paren.rparen",
  2642. regex: "[\\]]"
  2643. }, {
  2644. token: "paren.rparen",
  2645. regex: "[\\)\\}]",
  2646. next: "pop"
  2647. }],
  2648. variables: [{
  2649. token: "variable",
  2650. regex: /(\$)(\w+)/
  2651. }, {
  2652. token: ["variable", "paren.lparen"],
  2653. regex: /(\$)(\()/,
  2654. push: "start"
  2655. }, {
  2656. token: ["variable", "paren.lparen", "keyword.operator", "variable", "keyword.operator"],
  2657. regex: /(\$)(\{)([#!]?)(\w+|[*@#?\-$!0_])(:[?+\-=]?|##?|%%?|,,?\/|\^\^?)?/,
  2658. push: "start"
  2659. }, {
  2660. token: "variable",
  2661. regex: /\$[*@#?\-$!0_]/
  2662. }, {
  2663. token: ["variable", "paren.lparen"],
  2664. regex: /(\$)(\{)/,
  2665. push: "start"
  2666. }]
  2667. };
  2668. this.normalizeRules();
  2669. };
  2670. oop.inherits(ShHighlightRules, TextHighlightRules);
  2671. exports.ShHighlightRules = ShHighlightRules;
  2672. });
  2673. ace.define("ace/mode/sh",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sh_highlight_rules","ace/range","ace/mode/folding/cstyle","ace/mode/behaviour/cstyle"], function(require, exports, module){"use strict";
  2674. var oop = require("../lib/oop");
  2675. var TextMode = require("./text").Mode;
  2676. var ShHighlightRules = require("./sh_highlight_rules").ShHighlightRules;
  2677. var Range = require("../range").Range;
  2678. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  2679. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  2680. var Mode = function () {
  2681. this.HighlightRules = ShHighlightRules;
  2682. this.foldingRules = new CStyleFoldMode();
  2683. this.$behaviour = new CstyleBehaviour();
  2684. };
  2685. oop.inherits(Mode, TextMode);
  2686. (function () {
  2687. this.lineCommentStart = "#";
  2688. this.getNextLineIndent = function (state, line, tab) {
  2689. var indent = this.$getIndent(line);
  2690. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  2691. var tokens = tokenizedLine.tokens;
  2692. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  2693. return indent;
  2694. }
  2695. if (state == "start") {
  2696. var match = line.match(/^.*[\{\(\[:]\s*$/);
  2697. if (match) {
  2698. indent += tab;
  2699. }
  2700. }
  2701. return indent;
  2702. };
  2703. var outdents = {
  2704. "pass": 1,
  2705. "return": 1,
  2706. "raise": 1,
  2707. "break": 1,
  2708. "continue": 1
  2709. };
  2710. this.checkOutdent = function (state, line, input) {
  2711. if (input !== "\r\n" && input !== "\r" && input !== "\n")
  2712. return false;
  2713. var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
  2714. if (!tokens)
  2715. return false;
  2716. do {
  2717. var last = tokens.pop();
  2718. } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
  2719. if (!last)
  2720. return false;
  2721. return (last.type == "keyword" && outdents[last.value]);
  2722. };
  2723. this.autoOutdent = function (state, doc, row) {
  2724. row += 1;
  2725. var indent = this.$getIndent(doc.getLine(row));
  2726. var tab = doc.getTabString();
  2727. if (indent.slice(-tab.length) == tab)
  2728. doc.remove(new Range(row, indent.length - tab.length, row, indent.length));
  2729. };
  2730. this.$id = "ace/mode/sh";
  2731. this.snippetFileId = "ace/snippets/sh";
  2732. }).call(Mode.prototype);
  2733. exports.Mode = Mode;
  2734. });
  2735. ace.define("ace/mode/markdown",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript","ace/mode/xml","ace/mode/html","ace/mode/markdown_highlight_rules","ace/mode/folding/markdown","ace/mode/javascript","ace/mode/html","ace/mode/sh","ace/mode/sh","ace/mode/xml","ace/mode/css"], function(require, exports, module){"use strict";
  2736. var oop = require("../lib/oop");
  2737. var TextMode = require("./text").Mode;
  2738. var JavaScriptMode = require("./javascript").Mode;
  2739. var XmlMode = require("./xml").Mode;
  2740. var HtmlMode = require("./html").Mode;
  2741. var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
  2742. var MarkdownFoldMode = require("./folding/markdown").FoldMode;
  2743. var Mode = function () {
  2744. this.HighlightRules = MarkdownHighlightRules;
  2745. this.createModeDelegates({
  2746. javascript: require("./javascript").Mode,
  2747. html: require("./html").Mode,
  2748. bash: require("./sh").Mode,
  2749. sh: require("./sh").Mode,
  2750. xml: require("./xml").Mode,
  2751. css: require("./css").Mode
  2752. });
  2753. this.foldingRules = new MarkdownFoldMode();
  2754. this.$behaviour = this.$defaultBehaviour;
  2755. };
  2756. oop.inherits(Mode, TextMode);
  2757. (function () {
  2758. this.type = "text";
  2759. this.blockComment = { start: "<!--", end: "-->" };
  2760. this.$quotes = { '"': '"', "`": "`" };
  2761. this.getNextLineIndent = function (state, line, tab) {
  2762. if (state == "listblock") {
  2763. var match = /^(\s*)(?:([-+*])|(\d+)\.)(\s+)/.exec(line);
  2764. if (!match)
  2765. return "";
  2766. var marker = match[2];
  2767. if (!marker)
  2768. marker = parseInt(match[3], 10) + 1 + ".";
  2769. return match[1] + marker + match[4];
  2770. }
  2771. else {
  2772. return this.$getIndent(line);
  2773. }
  2774. };
  2775. this.$id = "ace/mode/markdown";
  2776. this.snippetFileId = "ace/snippets/markdown";
  2777. }).call(Mode.prototype);
  2778. exports.Mode = Mode;
  2779. }); (function() {
  2780. ace.require(["ace/mode/markdown"], function(m) {
  2781. if (typeof module == "object" && typeof exports == "object" && module) {
  2782. module.exports = m;
  2783. }
  2784. });
  2785. })();