mode-slim.js 176 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649
  1. define("ace/mode/slim_highlight_rules",["ace_require","exports","module","ace/config","ace/lib/oop","ace/mode/text_highlight_rules"], function(ace_require, exports, module) {
  2. "use strict";
  3. var modes = ace_require("../config").$ace_modes;
  4. var oop = ace_require("../lib/oop");
  5. var TextHighlightRules = ace_require("./text_highlight_rules").TextHighlightRules;
  6. var SlimHighlightRules = function() {
  7. this.$rules = {
  8. "start": [
  9. {
  10. token: "keyword",
  11. regex: /^(\s*)(\w+):\s*/,
  12. onMatch: function(value, state, stack, line) {
  13. var indent = /^\s*/.exec(line)[0];
  14. var m = value.match(/^(\s*)(\w+):/);
  15. var language = m[2];
  16. if (!/^(javascript|ruby|coffee|markdown|css|scss|sass|less)$/.test(language))
  17. language = "";
  18. stack.unshift("language-embed", [], [indent, language], state);
  19. return this.token;
  20. },
  21. stateName: "language-embed",
  22. next: [{
  23. token: "string",
  24. regex: /^(\s*)/,
  25. onMatch: function(value, state, stack, line) {
  26. var indent = stack[2][0];
  27. if (indent.length >= value.length) {
  28. stack.splice(0, 3);
  29. this.next = stack.shift();
  30. return this.token;
  31. }
  32. this.next = "";
  33. return [{type: "text", value: indent}];
  34. },
  35. next: ""
  36. }, {
  37. token: "string",
  38. regex: /.+/,
  39. onMatch: function(value, state, stack, line) {
  40. var indent = stack[2][0];
  41. var language = stack[2][1];
  42. var embedState = stack[1];
  43. if (modes[language]) {
  44. var data = modes[language].getTokenizer().getLineTokens(line.slice(indent.length), embedState.slice(0));
  45. stack[1] = data.state;
  46. return data.tokens;
  47. }
  48. return this.token;
  49. }
  50. }]
  51. },
  52. {
  53. token: 'constant.begin.javascript.filter.slim',
  54. regex: '^(\\s*)():$'
  55. }, {
  56. token: 'constant.begin..filter.slim',
  57. regex: '^(\\s*)(ruby):$'
  58. }, {
  59. token: 'constant.begin.coffeescript.filter.slim',
  60. regex: '^(\\s*)():$'
  61. }, {
  62. token: 'constant.begin..filter.slim',
  63. regex: '^(\\s*)(markdown):$'
  64. }, {
  65. token: 'constant.begin.css.filter.slim',
  66. regex: '^(\\s*)():$'
  67. }, {
  68. token: 'constant.begin.scss.filter.slim',
  69. regex: '^(\\s*)():$'
  70. }, {
  71. token: 'constant.begin..filter.slim',
  72. regex: '^(\\s*)(sass):$'
  73. }, {
  74. token: 'constant.begin..filter.slim',
  75. regex: '^(\\s*)(less):$'
  76. }, {
  77. token: 'constant.begin..filter.slim',
  78. regex: '^(\\s*)(erb):$'
  79. }, {
  80. token: 'keyword.html.tags.slim',
  81. regex: '^(\\s*)((:?\\*(\\w)+)|doctype html|abbr|acronym|address|applet|area|article|aside|audio|base|basefont|bdo|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command|datalist|dd|del|details|dialog|dfn|dir|div|dl|dt|embed|fieldset|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|link|li|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|source|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video|xmp|b|u|s|em|a)(?:([.#](\\w|\\.)+)+\\s?)?\\b'
  82. }, {
  83. token: 'keyword.slim',
  84. regex: '^(\\s*)(?:([.#](\\w|\\.)+)+\\s?)'
  85. }, {
  86. token: "string",
  87. regex: /^(\s*)('|\||\/|(\/!))\s*/,
  88. onMatch: function(val, state, stack, line) {
  89. var indent = /^\s*/.exec(line)[0];
  90. if (stack.length < 1) {
  91. stack.push(this.next);
  92. }
  93. else {
  94. stack[0] = "mlString";
  95. }
  96. if (stack.length < 2) {
  97. stack.push(indent.length);
  98. }
  99. else {
  100. stack[1] = indent.length;
  101. }
  102. return this.token;
  103. },
  104. next: "mlString"
  105. }, {
  106. token: 'keyword.control.slim',
  107. regex: '^(\\s*)(\\-|==|=)',
  108. push: [{
  109. token: 'control.end.slim',
  110. regex: '$',
  111. next: "pop"
  112. }, {
  113. include: "rubyline"
  114. }, {
  115. include: "misc"
  116. }]
  117. }, {
  118. token: 'paren',
  119. regex: '\\(',
  120. push: [{
  121. token: 'paren',
  122. regex: '\\)',
  123. next: "pop"
  124. }, {
  125. include: "misc"
  126. }]
  127. }, {
  128. token: 'paren',
  129. regex: '\\[',
  130. push: [{
  131. token: 'paren',
  132. regex: '\\]',
  133. next: "pop"
  134. }, {
  135. include: "misc"
  136. }]
  137. }, {
  138. include: "misc"
  139. }
  140. ],
  141. "mlString": [{
  142. token: "indent",
  143. regex: /^\s*/,
  144. onMatch: function(val, state, stack) {
  145. var curIndent = stack[1];
  146. if (curIndent >= val.length) {
  147. this.next = "start";
  148. stack.splice(0);
  149. }
  150. else {
  151. this.next = "mlString";
  152. }
  153. return this.token;
  154. },
  155. next: "start"
  156. }, {
  157. defaultToken: "string"
  158. }],
  159. "rubyline": [{
  160. token: "keyword.operator.ruby.embedded.slim",
  161. regex: "(==|=)(<>|><|<'|'<|<|>)?|-"
  162. }, {
  163. token: "list.ruby.operators.slim",
  164. regex: "(\\b)(for|in|do|if|else|elsif|unless|while|yield|not|and|or)\\b"
  165. }, {
  166. token: "string",
  167. regex: "['](.)*?[']"
  168. }, {
  169. token: "string",
  170. regex: "[\"](.)*?[\"]"
  171. }],
  172. "misc": [{
  173. token: 'class.variable.slim',
  174. regex: '\\@([a-zA-Z_][a-zA-Z0-9_]*)\\b'
  175. }, {
  176. token: "list.meta.slim",
  177. regex: "(\\b)(true|false|nil)(\\b)"
  178. }, {
  179. token: 'keyword.operator.equals.slim',
  180. regex: '='
  181. }, {
  182. token: "string",
  183. regex: "['](.)*?[']"
  184. }, {
  185. token: "string",
  186. regex: "[\"](.)*?[\"]"
  187. }]
  188. };
  189. this.normalizeRules();
  190. };
  191. oop.inherits(SlimHighlightRules, TextHighlightRules);
  192. exports.SlimHighlightRules = SlimHighlightRules;
  193. });
  194. define("ace/mode/doc_comment_highlight_rules",["ace_require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(ace_require, exports, module) {
  195. "use strict";
  196. var oop = ace_require("../lib/oop");
  197. var TextHighlightRules = ace_require("./text_highlight_rules").TextHighlightRules;
  198. var DocCommentHighlightRules = function() {
  199. this.$rules = {
  200. "start" : [ {
  201. token : "comment.doc.tag",
  202. regex : "@[\\w\\d_]+" // TODO: fix email addresses
  203. },
  204. DocCommentHighlightRules.getTagRule(),
  205. {
  206. defaultToken : "comment.doc",
  207. caseInsensitive: true
  208. }]
  209. };
  210. };
  211. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  212. DocCommentHighlightRules.getTagRule = function(start) {
  213. return {
  214. token : "comment.doc.tag.storage.type",
  215. regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  216. };
  217. };
  218. DocCommentHighlightRules.getStartRule = function(start) {
  219. return {
  220. token : "comment.doc", // doc comment
  221. regex : "\\/\\*(?=\\*)",
  222. next : start
  223. };
  224. };
  225. DocCommentHighlightRules.getEndRule = function (start) {
  226. return {
  227. token : "comment.doc", // closing comment
  228. regex : "\\*\\/",
  229. next : start
  230. };
  231. };
  232. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  233. });
  234. define("ace/mode/javascript_highlight_rules",["ace_require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(ace_require, exports, module) {
  235. "use strict";
  236. var oop = ace_require("../lib/oop");
  237. var DocCommentHighlightRules = ace_require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  238. var TextHighlightRules = ace_require("./text_highlight_rules").TextHighlightRules;
  239. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  240. var JavaScriptHighlightRules = function(options) {
  241. var keywordMapper = this.createKeywordMapper({
  242. "variable.language":
  243. "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  244. "Namespace|QName|XML|XMLList|" + // E4X
  245. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  246. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  247. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  248. "SyntaxError|TypeError|URIError|" +
  249. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  250. "isNaN|parseFloat|parseInt|" +
  251. "JSON|Math|" + // Other
  252. "this|arguments|prototype|window|document" , // Pseudo
  253. "keyword":
  254. "const|yield|import|get|set|async|await|" +
  255. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  256. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  257. "__parent__|__count__|escape|unescape|with|__proto__|" +
  258. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  259. "storage.type":
  260. "const|let|var|function",
  261. "constant.language":
  262. "null|Infinity|NaN|undefined",
  263. "support.function":
  264. "alert",
  265. "constant.language.boolean": "true|false"
  266. }, "identifier");
  267. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  268. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  269. "u[0-9a-fA-F]{4}|" + // unicode
  270. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  271. "[0-2][0-7]{0,2}|" + // oct
  272. "3[0-7][0-7]?|" + // oct
  273. "[4-7][0-7]?|" + //oct
  274. ".)";
  275. this.$rules = {
  276. "no_regex" : [
  277. DocCommentHighlightRules.getStartRule("doc-start"),
  278. comments("no_regex"),
  279. {
  280. token : "string",
  281. regex : "'(?=.)",
  282. next : "qstring"
  283. }, {
  284. token : "string",
  285. regex : '"(?=.)',
  286. next : "qqstring"
  287. }, {
  288. token : "constant.numeric", // hexadecimal, octal and binary
  289. regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
  290. }, {
  291. token : "constant.numeric", // decimal integers and floats
  292. regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
  293. }, {
  294. token : [
  295. "storage.type", "punctuation.operator", "support.function",
  296. "punctuation.operator", "entity.name.function", "text","keyword.operator"
  297. ],
  298. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
  299. next: "function_arguments"
  300. }, {
  301. token : [
  302. "storage.type", "punctuation.operator", "entity.name.function", "text",
  303. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  304. ],
  305. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  306. next: "function_arguments"
  307. }, {
  308. token : [
  309. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  310. "text", "paren.lparen"
  311. ],
  312. regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  313. next: "function_arguments"
  314. }, {
  315. token : [
  316. "storage.type", "punctuation.operator", "entity.name.function", "text",
  317. "keyword.operator", "text",
  318. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  319. ],
  320. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  321. next: "function_arguments"
  322. }, {
  323. token : [
  324. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  325. ],
  326. regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  327. next: "function_arguments"
  328. }, {
  329. token : [
  330. "entity.name.function", "text", "punctuation.operator",
  331. "text", "storage.type", "text", "paren.lparen"
  332. ],
  333. regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  334. next: "function_arguments"
  335. }, {
  336. token : [
  337. "text", "text", "storage.type", "text", "paren.lparen"
  338. ],
  339. regex : "(:)(\\s*)(function)(\\s*)(\\()",
  340. next: "function_arguments"
  341. }, {
  342. token : "keyword",
  343. regex : "from(?=\\s*('|\"))"
  344. }, {
  345. token : "keyword",
  346. regex : "(?:" + kwBeforeRe + ")\\b",
  347. next : "start"
  348. }, {
  349. token : ["support.constant"],
  350. regex : /that\b/
  351. }, {
  352. token : ["storage.type", "punctuation.operator", "support.function.firebug"],
  353. regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  354. }, {
  355. token : keywordMapper,
  356. regex : identifierRe
  357. }, {
  358. token : "punctuation.operator",
  359. regex : /[.](?![.])/,
  360. next : "property"
  361. }, {
  362. token : "storage.type",
  363. regex : /=>/,
  364. next : "start"
  365. }, {
  366. token : "keyword.operator",
  367. regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
  368. next : "start"
  369. }, {
  370. token : "punctuation.operator",
  371. regex : /[?:,;.]/,
  372. next : "start"
  373. }, {
  374. token : "paren.lparen",
  375. regex : /[\[({]/,
  376. next : "start"
  377. }, {
  378. token : "paren.rparen",
  379. regex : /[\])}]/
  380. }, {
  381. token: "comment",
  382. regex: /^#!.*$/
  383. }
  384. ],
  385. property: [{
  386. token : "text",
  387. regex : "\\s+"
  388. }, {
  389. token : [
  390. "storage.type", "punctuation.operator", "entity.name.function", "text",
  391. "keyword.operator", "text",
  392. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  393. ],
  394. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
  395. next: "function_arguments"
  396. }, {
  397. token : "punctuation.operator",
  398. regex : /[.](?![.])/
  399. }, {
  400. token : "support.function",
  401. 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(?=\()/
  402. }, {
  403. token : "support.function.dom",
  404. 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(?=\()/
  405. }, {
  406. token : "support.constant",
  407. 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/
  408. }, {
  409. token : "identifier",
  410. regex : identifierRe
  411. }, {
  412. regex: "",
  413. token: "empty",
  414. next: "no_regex"
  415. }
  416. ],
  417. "start": [
  418. DocCommentHighlightRules.getStartRule("doc-start"),
  419. comments("start"),
  420. {
  421. token: "string.regexp",
  422. regex: "\\/",
  423. next: "regex"
  424. }, {
  425. token : "text",
  426. regex : "\\s+|^$",
  427. next : "start"
  428. }, {
  429. token: "empty",
  430. regex: "",
  431. next: "no_regex"
  432. }
  433. ],
  434. "regex": [
  435. {
  436. token: "regexp.keyword.operator",
  437. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  438. }, {
  439. token: "string.regexp",
  440. regex: "/[sxngimy]*",
  441. next: "no_regex"
  442. }, {
  443. token : "invalid",
  444. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  445. }, {
  446. token : "constant.language.escape",
  447. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  448. }, {
  449. token : "constant.language.delimiter",
  450. regex: /\|/
  451. }, {
  452. token: "constant.language.escape",
  453. regex: /\[\^?/,
  454. next: "regex_character_class"
  455. }, {
  456. token: "empty",
  457. regex: "$",
  458. next: "no_regex"
  459. }, {
  460. defaultToken: "string.regexp"
  461. }
  462. ],
  463. "regex_character_class": [
  464. {
  465. token: "regexp.charclass.keyword.operator",
  466. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  467. }, {
  468. token: "constant.language.escape",
  469. regex: "]",
  470. next: "regex"
  471. }, {
  472. token: "constant.language.escape",
  473. regex: "-"
  474. }, {
  475. token: "empty",
  476. regex: "$",
  477. next: "no_regex"
  478. }, {
  479. defaultToken: "string.regexp.charachterclass"
  480. }
  481. ],
  482. "function_arguments": [
  483. {
  484. token: "variable.parameter",
  485. regex: identifierRe
  486. }, {
  487. token: "punctuation.operator",
  488. regex: "[, ]+"
  489. }, {
  490. token: "punctuation.operator",
  491. regex: "$"
  492. }, {
  493. token: "empty",
  494. regex: "",
  495. next: "no_regex"
  496. }
  497. ],
  498. "qqstring" : [
  499. {
  500. token : "constant.language.escape",
  501. regex : escapedRe
  502. }, {
  503. token : "string",
  504. regex : "\\\\$",
  505. consumeLineEnd : true
  506. }, {
  507. token : "string",
  508. regex : '"|$',
  509. next : "no_regex"
  510. }, {
  511. defaultToken: "string"
  512. }
  513. ],
  514. "qstring" : [
  515. {
  516. token : "constant.language.escape",
  517. regex : escapedRe
  518. }, {
  519. token : "string",
  520. regex : "\\\\$",
  521. consumeLineEnd : true
  522. }, {
  523. token : "string",
  524. regex : "'|$",
  525. next : "no_regex"
  526. }, {
  527. defaultToken: "string"
  528. }
  529. ]
  530. };
  531. if (!options || !options.noES6) {
  532. this.$rules.no_regex.unshift({
  533. regex: "[{}]", onMatch: function(val, state, stack) {
  534. this.next = val == "{" ? this.nextState : "";
  535. if (val == "{" && stack.length) {
  536. stack.unshift("start", state);
  537. }
  538. else if (val == "}" && stack.length) {
  539. stack.shift();
  540. this.next = stack.shift();
  541. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  542. return "paren.quasi.end";
  543. }
  544. return val == "{" ? "paren.lparen" : "paren.rparen";
  545. },
  546. nextState: "start"
  547. }, {
  548. token : "string.quasi.start",
  549. regex : /`/,
  550. push : [{
  551. token : "constant.language.escape",
  552. regex : escapedRe
  553. }, {
  554. token : "paren.quasi.start",
  555. regex : /\${/,
  556. push : "start"
  557. }, {
  558. token : "string.quasi.end",
  559. regex : /`/,
  560. next : "pop"
  561. }, {
  562. defaultToken: "string.quasi"
  563. }]
  564. });
  565. if (!options || options.jsx != false)
  566. JSX.call(this);
  567. }
  568. this.embedRules(DocCommentHighlightRules, "doc-",
  569. [ DocCommentHighlightRules.getEndRule("no_regex") ]);
  570. this.normalizeRules();
  571. };
  572. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  573. function JSX() {
  574. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  575. var jsxTag = {
  576. onMatch : function(val, state, stack) {
  577. var offset = val.charAt(1) == "/" ? 2 : 1;
  578. if (offset == 1) {
  579. if (state != this.nextState)
  580. stack.unshift(this.next, this.nextState, 0);
  581. else
  582. stack.unshift(this.next);
  583. stack[2]++;
  584. } else if (offset == 2) {
  585. if (state == this.nextState) {
  586. stack[1]--;
  587. if (!stack[1] || stack[1] < 0) {
  588. stack.shift();
  589. stack.shift();
  590. }
  591. }
  592. }
  593. return [{
  594. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  595. value: val.slice(0, offset)
  596. }, {
  597. type: "meta.tag.tag-name.xml",
  598. value: val.substr(offset)
  599. }];
  600. },
  601. regex : "</?" + tagRegex + "",
  602. next: "jsxAttributes",
  603. nextState: "jsx"
  604. };
  605. this.$rules.start.unshift(jsxTag);
  606. var jsxJsRule = {
  607. regex: "{",
  608. token: "paren.quasi.start",
  609. push: "start"
  610. };
  611. this.$rules.jsx = [
  612. jsxJsRule,
  613. jsxTag,
  614. {include : "reference"},
  615. {defaultToken: "string"}
  616. ];
  617. this.$rules.jsxAttributes = [{
  618. token : "meta.tag.punctuation.tag-close.xml",
  619. regex : "/?>",
  620. onMatch : function(value, currentState, stack) {
  621. if (currentState == stack[0])
  622. stack.shift();
  623. if (value.length == 2) {
  624. if (stack[0] == this.nextState)
  625. stack[1]--;
  626. if (!stack[1] || stack[1] < 0) {
  627. stack.splice(0, 2);
  628. }
  629. }
  630. this.next = stack[0] || "start";
  631. return [{type: this.token, value: value}];
  632. },
  633. nextState: "jsx"
  634. },
  635. jsxJsRule,
  636. comments("jsxAttributes"),
  637. {
  638. token : "entity.other.attribute-name.xml",
  639. regex : tagRegex
  640. }, {
  641. token : "keyword.operator.attribute-equals.xml",
  642. regex : "="
  643. }, {
  644. token : "text.tag-whitespace.xml",
  645. regex : "\\s+"
  646. }, {
  647. token : "string.attribute-value.xml",
  648. regex : "'",
  649. stateName : "jsx_attr_q",
  650. push : [
  651. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  652. {include : "reference"},
  653. {defaultToken : "string.attribute-value.xml"}
  654. ]
  655. }, {
  656. token : "string.attribute-value.xml",
  657. regex : '"',
  658. stateName : "jsx_attr_qq",
  659. push : [
  660. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  661. {include : "reference"},
  662. {defaultToken : "string.attribute-value.xml"}
  663. ]
  664. },
  665. jsxTag
  666. ];
  667. this.$rules.reference = [{
  668. token : "constant.language.escape.reference.xml",
  669. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  670. }];
  671. }
  672. function comments(next) {
  673. return [
  674. {
  675. token : "comment", // multi line comment
  676. regex : /\/\*/,
  677. next: [
  678. DocCommentHighlightRules.getTagRule(),
  679. {token : "comment", regex : "\\*\\/", next : next || "pop"},
  680. {defaultToken : "comment", caseInsensitive: true}
  681. ]
  682. }, {
  683. token : "comment",
  684. regex : "\\/\\/",
  685. next: [
  686. DocCommentHighlightRules.getTagRule(),
  687. {token : "comment", regex : "$|^", next : next || "pop"},
  688. {defaultToken : "comment", caseInsensitive: true}
  689. ]
  690. }
  691. ];
  692. }
  693. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  694. });
  695. define("ace/mode/matching_brace_outdent",["ace_require","exports","module","ace/range"], function(ace_require, exports, module) {
  696. "use strict";
  697. var Range = ace_require("../range").Range;
  698. var MatchingBraceOutdent = function() {};
  699. (function() {
  700. this.checkOutdent = function(line, input) {
  701. if (! /^\s+$/.test(line))
  702. return false;
  703. return /^\s*\}/.test(input);
  704. };
  705. this.autoOutdent = function(doc, row) {
  706. var line = doc.getLine(row);
  707. var match = line.match(/^(\s*\})/);
  708. if (!match) return 0;
  709. var column = match[1].length;
  710. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  711. if (!openBracePos || openBracePos.row == row) return 0;
  712. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  713. doc.replace(new Range(row, 0, row, column-1), indent);
  714. };
  715. this.$getIndent = function(line) {
  716. return line.match(/^\s*/)[0];
  717. };
  718. }).call(MatchingBraceOutdent.prototype);
  719. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  720. });
  721. define("ace/mode/folding/cstyle",["ace_require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(ace_require, exports, module) {
  722. "use strict";
  723. var oop = ace_require("../../lib/oop");
  724. var Range = ace_require("../../range").Range;
  725. var BaseFoldMode = ace_require("./fold_mode").FoldMode;
  726. var FoldMode = exports.FoldMode = function(commentRegex) {
  727. if (commentRegex) {
  728. this.foldingStartMarker = new RegExp(
  729. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  730. );
  731. this.foldingStopMarker = new RegExp(
  732. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  733. );
  734. }
  735. };
  736. oop.inherits(FoldMode, BaseFoldMode);
  737. (function() {
  738. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  739. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  740. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  741. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  742. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  743. this._getFoldWidgetBase = this.getFoldWidget;
  744. this.getFoldWidget = function(session, foldStyle, row) {
  745. var line = session.getLine(row);
  746. if (this.singleLineBlockCommentRe.test(line)) {
  747. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  748. return "";
  749. }
  750. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  751. if (!fw && this.startRegionRe.test(line))
  752. return "start"; // lineCommentRegionStart
  753. return fw;
  754. };
  755. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  756. var line = session.getLine(row);
  757. if (this.startRegionRe.test(line))
  758. return this.getCommentRegionBlock(session, line, row);
  759. var match = line.match(this.foldingStartMarker);
  760. if (match) {
  761. var i = match.index;
  762. if (match[1])
  763. return this.openingBracketBlock(session, match[1], row, i);
  764. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  765. if (range && !range.isMultiLine()) {
  766. if (forceMultiline) {
  767. range = this.getSectionRange(session, row);
  768. } else if (foldStyle != "all")
  769. range = null;
  770. }
  771. return range;
  772. }
  773. if (foldStyle === "markbegin")
  774. return;
  775. var match = line.match(this.foldingStopMarker);
  776. if (match) {
  777. var i = match.index + match[0].length;
  778. if (match[1])
  779. return this.closingBracketBlock(session, match[1], row, i);
  780. return session.getCommentFoldRange(row, i, -1);
  781. }
  782. };
  783. this.getSectionRange = function(session, row) {
  784. var line = session.getLine(row);
  785. var startIndent = line.search(/\S/);
  786. var startRow = row;
  787. var startColumn = line.length;
  788. row = row + 1;
  789. var endRow = row;
  790. var maxRow = session.getLength();
  791. while (++row < maxRow) {
  792. line = session.getLine(row);
  793. var indent = line.search(/\S/);
  794. if (indent === -1)
  795. continue;
  796. if (startIndent > indent)
  797. break;
  798. var subRange = this.getFoldWidgetRange(session, "all", row);
  799. if (subRange) {
  800. if (subRange.start.row <= startRow) {
  801. break;
  802. } else if (subRange.isMultiLine()) {
  803. row = subRange.end.row;
  804. } else if (startIndent == indent) {
  805. break;
  806. }
  807. }
  808. endRow = row;
  809. }
  810. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  811. };
  812. this.getCommentRegionBlock = function(session, line, row) {
  813. var startColumn = line.search(/\s*$/);
  814. var maxRow = session.getLength();
  815. var startRow = row;
  816. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  817. var depth = 1;
  818. while (++row < maxRow) {
  819. line = session.getLine(row);
  820. var m = re.exec(line);
  821. if (!m) continue;
  822. if (m[1]) depth--;
  823. else depth++;
  824. if (!depth) break;
  825. }
  826. var endRow = row;
  827. if (endRow > startRow) {
  828. return new Range(startRow, startColumn, endRow, line.length);
  829. }
  830. };
  831. }).call(FoldMode.prototype);
  832. });
  833. define("ace/mode/javascript",["ace_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(ace_require, exports, module) {
  834. "use strict";
  835. var oop = ace_require("../lib/oop");
  836. var TextMode = ace_require("./text").Mode;
  837. var JavaScriptHighlightRules = ace_require("./javascript_highlight_rules").JavaScriptHighlightRules;
  838. var MatchingBraceOutdent = ace_require("./matching_brace_outdent").MatchingBraceOutdent;
  839. var WorkerClient = ace_require("../worker/worker_client").WorkerClient;
  840. var CstyleBehaviour = ace_require("./behaviour/cstyle").CstyleBehaviour;
  841. var CStyleFoldMode = ace_require("./folding/cstyle").FoldMode;
  842. var Mode = function() {
  843. this.HighlightRules = JavaScriptHighlightRules;
  844. this.$outdent = new MatchingBraceOutdent();
  845. this.$behaviour = new CstyleBehaviour();
  846. this.foldingRules = new CStyleFoldMode();
  847. };
  848. oop.inherits(Mode, TextMode);
  849. (function() {
  850. this.lineCommentStart = "//";
  851. this.blockComment = {start: "/*", end: "*/"};
  852. this.$quotes = {'"': '"', "'": "'", "`": "`"};
  853. this.getNextLineIndent = function(state, line, tab) {
  854. var indent = this.$getIndent(line);
  855. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  856. var tokens = tokenizedLine.tokens;
  857. var endState = tokenizedLine.state;
  858. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  859. return indent;
  860. }
  861. if (state == "start" || state == "no_regex") {
  862. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  863. if (match) {
  864. indent += tab;
  865. }
  866. } else if (state == "doc-start") {
  867. if (endState == "start" || endState == "no_regex") {
  868. return "";
  869. }
  870. var match = line.match(/^\s*(\/?)\*/);
  871. if (match) {
  872. if (match[1]) {
  873. indent += " ";
  874. }
  875. indent += "* ";
  876. }
  877. }
  878. return indent;
  879. };
  880. this.checkOutdent = function(state, line, input) {
  881. return this.$outdent.checkOutdent(line, input);
  882. };
  883. this.autoOutdent = function(state, doc, row) {
  884. this.$outdent.autoOutdent(doc, row);
  885. };
  886. this.createWorker = function(session) {
  887. var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
  888. worker.attachToDocument(session.getDocument());
  889. worker.on("annotate", function(results) {
  890. session.setAnnotations(results.data);
  891. });
  892. worker.on("terminate", function() {
  893. session.clearAnnotations();
  894. });
  895. return worker;
  896. };
  897. this.$id = "ace/mode/javascript";
  898. this.snippetFileId = "ace/snippets/javascript";
  899. }).call(Mode.prototype);
  900. exports.Mode = Mode;
  901. });
  902. define("ace/mode/xml_highlight_rules",["ace_require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(ace_require, exports, module) {
  903. "use strict";
  904. var oop = ace_require("../lib/oop");
  905. var TextHighlightRules = ace_require("./text_highlight_rules").TextHighlightRules;
  906. var XmlHighlightRules = function(normalize) {
  907. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  908. this.$rules = {
  909. start : [
  910. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  911. {
  912. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  913. regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
  914. },
  915. {token : "comment.start.xml", regex : "<\\!--", next : "comment"},
  916. {
  917. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  918. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  919. },
  920. {include : "tag"},
  921. {token : "text.end-tag-open.xml", regex: "</"},
  922. {token : "text.tag-open.xml", regex: "<"},
  923. {include : "reference"},
  924. {defaultToken : "text.xml"}
  925. ],
  926. processing_instruction : [{
  927. token : "entity.other.attribute-name.decl-attribute-name.xml",
  928. regex : tagRegex
  929. }, {
  930. token : "keyword.operator.decl-attribute-equals.xml",
  931. regex : "="
  932. }, {
  933. include: "whitespace"
  934. }, {
  935. include: "string"
  936. }, {
  937. token : "punctuation.xml-decl.xml",
  938. regex : "\\?>",
  939. next : "start"
  940. }],
  941. doctype : [
  942. {include : "whitespace"},
  943. {include : "string"},
  944. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  945. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  946. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  947. ],
  948. int_subset : [{
  949. token : "text.xml",
  950. regex : "\\s+"
  951. }, {
  952. token: "punctuation.int-subset.xml",
  953. regex: "]",
  954. next: "pop"
  955. }, {
  956. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  957. regex : "(<\\!)(" + tagRegex + ")",
  958. push : [{
  959. token : "text",
  960. regex : "\\s+"
  961. },
  962. {
  963. token : "punctuation.markup-decl.xml",
  964. regex : ">",
  965. next : "pop"
  966. },
  967. {include : "string"}]
  968. }],
  969. cdata : [
  970. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  971. {token : "text.xml", regex : "\\s+"},
  972. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  973. ],
  974. comment : [
  975. {token : "comment.end.xml", regex : "-->", next : "start"},
  976. {defaultToken : "comment.xml"}
  977. ],
  978. reference : [{
  979. token : "constant.language.escape.reference.xml",
  980. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  981. }],
  982. attr_reference : [{
  983. token : "constant.language.escape.reference.attribute-value.xml",
  984. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  985. }],
  986. tag : [{
  987. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  988. regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  989. next: [
  990. {include : "attributes"},
  991. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  992. ]
  993. }],
  994. tag_whitespace : [
  995. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  996. ],
  997. whitespace : [
  998. {token : "text.whitespace.xml", regex : "\\s+"}
  999. ],
  1000. string: [{
  1001. token : "string.xml",
  1002. regex : "'",
  1003. push : [
  1004. {token : "string.xml", regex: "'", next: "pop"},
  1005. {defaultToken : "string.xml"}
  1006. ]
  1007. }, {
  1008. token : "string.xml",
  1009. regex : '"',
  1010. push : [
  1011. {token : "string.xml", regex: '"', next: "pop"},
  1012. {defaultToken : "string.xml"}
  1013. ]
  1014. }],
  1015. attributes: [{
  1016. token : "entity.other.attribute-name.xml",
  1017. regex : tagRegex
  1018. }, {
  1019. token : "keyword.operator.attribute-equals.xml",
  1020. regex : "="
  1021. }, {
  1022. include: "tag_whitespace"
  1023. }, {
  1024. include: "attribute_value"
  1025. }],
  1026. attribute_value: [{
  1027. token : "string.attribute-value.xml",
  1028. regex : "'",
  1029. push : [
  1030. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  1031. {include : "attr_reference"},
  1032. {defaultToken : "string.attribute-value.xml"}
  1033. ]
  1034. }, {
  1035. token : "string.attribute-value.xml",
  1036. regex : '"',
  1037. push : [
  1038. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  1039. {include : "attr_reference"},
  1040. {defaultToken : "string.attribute-value.xml"}
  1041. ]
  1042. }]
  1043. };
  1044. if (this.constructor === XmlHighlightRules)
  1045. this.normalizeRules();
  1046. };
  1047. (function() {
  1048. this.embedTagRules = function(HighlightRules, prefix, tag){
  1049. this.$rules.tag.unshift({
  1050. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  1051. regex : "(<)(" + tag + "(?=\\s|>|$))",
  1052. next: [
  1053. {include : "attributes"},
  1054. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  1055. ]
  1056. });
  1057. this.$rules[tag + "-end"] = [
  1058. {include : "attributes"},
  1059. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  1060. onMatch : function(value, currentState, stack) {
  1061. stack.splice(0);
  1062. return this.token;
  1063. }}
  1064. ];
  1065. this.embedRules(HighlightRules, prefix, [{
  1066. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  1067. regex : "(</)(" + tag + "(?=\\s|>|$))",
  1068. next: tag + "-end"
  1069. }, {
  1070. token: "string.cdata.xml",
  1071. regex : "<\\!\\[CDATA\\["
  1072. }, {
  1073. token: "string.cdata.xml",
  1074. regex : "\\]\\]>"
  1075. }]);
  1076. };
  1077. }).call(TextHighlightRules.prototype);
  1078. oop.inherits(XmlHighlightRules, TextHighlightRules);
  1079. exports.XmlHighlightRules = XmlHighlightRules;
  1080. });
  1081. define("ace/mode/behaviour/xml",["ace_require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(ace_require, exports, module) {
  1082. "use strict";
  1083. var oop = ace_require("../../lib/oop");
  1084. var Behaviour = ace_require("../behaviour").Behaviour;
  1085. var TokenIterator = ace_require("../../token_iterator").TokenIterator;
  1086. var lang = ace_require("../../lib/lang");
  1087. function is(token, type) {
  1088. return token && token.type.lastIndexOf(type + ".xml") > -1;
  1089. }
  1090. var XmlBehaviour = function () {
  1091. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  1092. if (text == '"' || text == "'") {
  1093. var quote = text;
  1094. var selected = session.doc.getTextRange(editor.getSelectionRange());
  1095. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  1096. return {
  1097. text: quote + selected + quote,
  1098. selection: false
  1099. };
  1100. }
  1101. var cursor = editor.getCursorPosition();
  1102. var line = session.doc.getLine(cursor.row);
  1103. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1104. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1105. var token = iterator.getCurrentToken();
  1106. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  1107. return {
  1108. text: "",
  1109. selection: [1, 1]
  1110. };
  1111. }
  1112. if (!token)
  1113. token = iterator.stepBackward();
  1114. if (!token)
  1115. return;
  1116. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  1117. token = iterator.stepBackward();
  1118. }
  1119. var rightSpace = !rightChar || rightChar.match(/\s/);
  1120. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  1121. return {
  1122. text: quote + quote,
  1123. selection: [1, 1]
  1124. };
  1125. }
  1126. }
  1127. });
  1128. this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
  1129. var selected = session.doc.getTextRange(range);
  1130. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  1131. var line = session.doc.getLine(range.start.row);
  1132. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  1133. if (rightChar == selected) {
  1134. range.end.column++;
  1135. return range;
  1136. }
  1137. }
  1138. });
  1139. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  1140. if (text == '>') {
  1141. var position = editor.getSelectionRange().start;
  1142. var iterator = new TokenIterator(session, position.row, position.column);
  1143. var token = iterator.getCurrentToken() || iterator.stepBackward();
  1144. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  1145. return;
  1146. if (is(token, "reference.attribute-value"))
  1147. return;
  1148. if (is(token, "attribute-value")) {
  1149. var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
  1150. if (position.column < tokenEndColumn)
  1151. return;
  1152. if (position.column == tokenEndColumn) {
  1153. var nextToken = iterator.stepForward();
  1154. if (nextToken && is(nextToken, "attribute-value"))
  1155. return;
  1156. iterator.stepBackward();
  1157. }
  1158. }
  1159. if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
  1160. return;
  1161. while (!is(token, "tag-name")) {
  1162. token = iterator.stepBackward();
  1163. if (token.value == "<") {
  1164. token = iterator.stepForward();
  1165. break;
  1166. }
  1167. }
  1168. var tokenRow = iterator.getCurrentTokenRow();
  1169. var tokenColumn = iterator.getCurrentTokenColumn();
  1170. if (is(iterator.stepBackward(), "end-tag-open"))
  1171. return;
  1172. var element = token.value;
  1173. if (tokenRow == position.row)
  1174. element = element.substring(0, position.column - tokenColumn);
  1175. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  1176. return;
  1177. return {
  1178. text: ">" + "</" + element + ">",
  1179. selection: [1, 1]
  1180. };
  1181. }
  1182. });
  1183. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  1184. if (text == "\n") {
  1185. var cursor = editor.getCursorPosition();
  1186. var line = session.getLine(cursor.row);
  1187. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1188. var token = iterator.getCurrentToken();
  1189. if (token && token.type.indexOf("tag-close") !== -1) {
  1190. if (token.value == "/>")
  1191. return;
  1192. while (token && token.type.indexOf("tag-name") === -1) {
  1193. token = iterator.stepBackward();
  1194. }
  1195. if (!token) {
  1196. return;
  1197. }
  1198. var tag = token.value;
  1199. var row = iterator.getCurrentTokenRow();
  1200. token = iterator.stepBackward();
  1201. if (!token || token.type.indexOf("end-tag") !== -1) {
  1202. return;
  1203. }
  1204. if (this.voidElements && !this.voidElements[tag]) {
  1205. var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
  1206. var line = session.getLine(row);
  1207. var nextIndent = this.$getIndent(line);
  1208. var indent = nextIndent + session.getTabString();
  1209. if (nextToken && nextToken.value === "</") {
  1210. return {
  1211. text: "\n" + indent + "\n" + nextIndent,
  1212. selection: [1, indent.length, 1, indent.length]
  1213. };
  1214. } else {
  1215. return {
  1216. text: "\n" + indent
  1217. };
  1218. }
  1219. }
  1220. }
  1221. }
  1222. });
  1223. };
  1224. oop.inherits(XmlBehaviour, Behaviour);
  1225. exports.XmlBehaviour = XmlBehaviour;
  1226. });
  1227. define("ace/mode/folding/xml",["ace_require","exports","module","ace/lib/oop","ace/lib/lang","ace/range","ace/mode/folding/fold_mode","ace/token_iterator"], function(ace_require, exports, module) {
  1228. "use strict";
  1229. var oop = ace_require("../../lib/oop");
  1230. var lang = ace_require("../../lib/lang");
  1231. var Range = ace_require("../../range").Range;
  1232. var BaseFoldMode = ace_require("./fold_mode").FoldMode;
  1233. var TokenIterator = ace_require("../../token_iterator").TokenIterator;
  1234. var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
  1235. BaseFoldMode.call(this);
  1236. this.voidElements = voidElements || {};
  1237. this.optionalEndTags = oop.mixin({}, this.voidElements);
  1238. if (optionalEndTags)
  1239. oop.mixin(this.optionalEndTags, optionalEndTags);
  1240. };
  1241. oop.inherits(FoldMode, BaseFoldMode);
  1242. var Tag = function() {
  1243. this.tagName = "";
  1244. this.closing = false;
  1245. this.selfClosing = false;
  1246. this.start = {row: 0, column: 0};
  1247. this.end = {row: 0, column: 0};
  1248. };
  1249. function is(token, type) {
  1250. return token.type.lastIndexOf(type + ".xml") > -1;
  1251. }
  1252. (function() {
  1253. this.getFoldWidget = function(session, foldStyle, row) {
  1254. var tag = this._getFirstTagInLine(session, row);
  1255. if (!tag)
  1256. return this.getCommentFoldWidget(session, row);
  1257. if (tag.closing || (!tag.tagName && tag.selfClosing))
  1258. return foldStyle == "markbeginend" ? "end" : "";
  1259. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  1260. return "";
  1261. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  1262. return "";
  1263. return "start";
  1264. };
  1265. this.getCommentFoldWidget = function(session, row) {
  1266. if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
  1267. return "start";
  1268. return "";
  1269. };
  1270. this._getFirstTagInLine = function(session, row) {
  1271. var tokens = session.getTokens(row);
  1272. var tag = new Tag();
  1273. for (var i = 0; i < tokens.length; i++) {
  1274. var token = tokens[i];
  1275. if (is(token, "tag-open")) {
  1276. tag.end.column = tag.start.column + token.value.length;
  1277. tag.closing = is(token, "end-tag-open");
  1278. token = tokens[++i];
  1279. if (!token)
  1280. return null;
  1281. tag.tagName = token.value;
  1282. tag.end.column += token.value.length;
  1283. for (i++; i < tokens.length; i++) {
  1284. token = tokens[i];
  1285. tag.end.column += token.value.length;
  1286. if (is(token, "tag-close")) {
  1287. tag.selfClosing = token.value == '/>';
  1288. break;
  1289. }
  1290. }
  1291. return tag;
  1292. } else if (is(token, "tag-close")) {
  1293. tag.selfClosing = token.value == '/>';
  1294. return tag;
  1295. }
  1296. tag.start.column += token.value.length;
  1297. }
  1298. return null;
  1299. };
  1300. this._findEndTagInLine = function(session, row, tagName, startColumn) {
  1301. var tokens = session.getTokens(row);
  1302. var column = 0;
  1303. for (var i = 0; i < tokens.length; i++) {
  1304. var token = tokens[i];
  1305. column += token.value.length;
  1306. if (column < startColumn)
  1307. continue;
  1308. if (is(token, "end-tag-open")) {
  1309. token = tokens[i + 1];
  1310. if (token && token.value == tagName)
  1311. return true;
  1312. }
  1313. }
  1314. return false;
  1315. };
  1316. this._readTagForward = function(iterator) {
  1317. var token = iterator.getCurrentToken();
  1318. if (!token)
  1319. return null;
  1320. var tag = new Tag();
  1321. do {
  1322. if (is(token, "tag-open")) {
  1323. tag.closing = is(token, "end-tag-open");
  1324. tag.start.row = iterator.getCurrentTokenRow();
  1325. tag.start.column = iterator.getCurrentTokenColumn();
  1326. } else if (is(token, "tag-name")) {
  1327. tag.tagName = token.value;
  1328. } else if (is(token, "tag-close")) {
  1329. tag.selfClosing = token.value == "/>";
  1330. tag.end.row = iterator.getCurrentTokenRow();
  1331. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1332. iterator.stepForward();
  1333. return tag;
  1334. }
  1335. } while(token = iterator.stepForward());
  1336. return null;
  1337. };
  1338. this._readTagBackward = function(iterator) {
  1339. var token = iterator.getCurrentToken();
  1340. if (!token)
  1341. return null;
  1342. var tag = new Tag();
  1343. do {
  1344. if (is(token, "tag-open")) {
  1345. tag.closing = is(token, "end-tag-open");
  1346. tag.start.row = iterator.getCurrentTokenRow();
  1347. tag.start.column = iterator.getCurrentTokenColumn();
  1348. iterator.stepBackward();
  1349. return tag;
  1350. } else if (is(token, "tag-name")) {
  1351. tag.tagName = token.value;
  1352. } else if (is(token, "tag-close")) {
  1353. tag.selfClosing = token.value == "/>";
  1354. tag.end.row = iterator.getCurrentTokenRow();
  1355. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1356. }
  1357. } while(token = iterator.stepBackward());
  1358. return null;
  1359. };
  1360. this._pop = function(stack, tag) {
  1361. while (stack.length) {
  1362. var top = stack[stack.length-1];
  1363. if (!tag || top.tagName == tag.tagName) {
  1364. return stack.pop();
  1365. }
  1366. else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
  1367. stack.pop();
  1368. continue;
  1369. } else {
  1370. return null;
  1371. }
  1372. }
  1373. };
  1374. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1375. var firstTag = this._getFirstTagInLine(session, row);
  1376. if (!firstTag) {
  1377. return this.getCommentFoldWidget(session, row)
  1378. && session.getCommentFoldRange(row, session.getLine(row).length);
  1379. }
  1380. var isBackward = firstTag.closing || firstTag.selfClosing;
  1381. var stack = [];
  1382. var tag;
  1383. if (!isBackward) {
  1384. var iterator = new TokenIterator(session, row, firstTag.start.column);
  1385. var start = {
  1386. row: row,
  1387. column: firstTag.start.column + firstTag.tagName.length + 2
  1388. };
  1389. if (firstTag.start.row == firstTag.end.row)
  1390. start.column = firstTag.end.column;
  1391. while (tag = this._readTagForward(iterator)) {
  1392. if (tag.selfClosing) {
  1393. if (!stack.length) {
  1394. tag.start.column += tag.tagName.length + 2;
  1395. tag.end.column -= 2;
  1396. return Range.fromPoints(tag.start, tag.end);
  1397. } else
  1398. continue;
  1399. }
  1400. if (tag.closing) {
  1401. this._pop(stack, tag);
  1402. if (stack.length == 0)
  1403. return Range.fromPoints(start, tag.start);
  1404. }
  1405. else {
  1406. stack.push(tag);
  1407. }
  1408. }
  1409. }
  1410. else {
  1411. var iterator = new TokenIterator(session, row, firstTag.end.column);
  1412. var end = {
  1413. row: row,
  1414. column: firstTag.start.column
  1415. };
  1416. while (tag = this._readTagBackward(iterator)) {
  1417. if (tag.selfClosing) {
  1418. if (!stack.length) {
  1419. tag.start.column += tag.tagName.length + 2;
  1420. tag.end.column -= 2;
  1421. return Range.fromPoints(tag.start, tag.end);
  1422. } else
  1423. continue;
  1424. }
  1425. if (!tag.closing) {
  1426. this._pop(stack, tag);
  1427. if (stack.length == 0) {
  1428. tag.start.column += tag.tagName.length + 2;
  1429. if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
  1430. tag.start.column = tag.end.column;
  1431. return Range.fromPoints(tag.start, end);
  1432. }
  1433. }
  1434. else {
  1435. stack.push(tag);
  1436. }
  1437. }
  1438. }
  1439. };
  1440. }).call(FoldMode.prototype);
  1441. });
  1442. define("ace/mode/xml",["ace_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(ace_require, exports, module) {
  1443. "use strict";
  1444. var oop = ace_require("../lib/oop");
  1445. var lang = ace_require("../lib/lang");
  1446. var TextMode = ace_require("./text").Mode;
  1447. var XmlHighlightRules = ace_require("./xml_highlight_rules").XmlHighlightRules;
  1448. var XmlBehaviour = ace_require("./behaviour/xml").XmlBehaviour;
  1449. var XmlFoldMode = ace_require("./folding/xml").FoldMode;
  1450. var WorkerClient = ace_require("../worker/worker_client").WorkerClient;
  1451. var Mode = function() {
  1452. this.HighlightRules = XmlHighlightRules;
  1453. this.$behaviour = new XmlBehaviour();
  1454. this.foldingRules = new XmlFoldMode();
  1455. };
  1456. oop.inherits(Mode, TextMode);
  1457. (function() {
  1458. this.voidElements = lang.arrayToMap([]);
  1459. this.blockComment = {start: "<!--", end: "-->"};
  1460. this.createWorker = function(session) {
  1461. var worker = new WorkerClient(["ace"], "ace/mode/xml_worker", "Worker");
  1462. worker.attachToDocument(session.getDocument());
  1463. worker.on("error", function(e) {
  1464. session.setAnnotations(e.data);
  1465. });
  1466. worker.on("terminate", function() {
  1467. session.clearAnnotations();
  1468. });
  1469. return worker;
  1470. };
  1471. this.$id = "ace/mode/xml";
  1472. }).call(Mode.prototype);
  1473. exports.Mode = Mode;
  1474. });
  1475. define("ace/mode/css_highlight_rules",["ace_require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(ace_require, exports, module) {
  1476. "use strict";
  1477. var oop = ace_require("../lib/oop");
  1478. var lang = ace_require("../lib/lang");
  1479. var TextHighlightRules = ace_require("./text_highlight_rules").TextHighlightRules;
  1480. 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";
  1481. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  1482. 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";
  1483. 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";
  1484. 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";
  1485. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  1486. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  1487. 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";
  1488. var CssHighlightRules = function() {
  1489. var keywordMapper = this.createKeywordMapper({
  1490. "support.function": supportFunction,
  1491. "support.constant": supportConstant,
  1492. "support.type": supportType,
  1493. "support.constant.color": supportConstantColor,
  1494. "support.constant.fonts": supportConstantFonts
  1495. }, "text", true);
  1496. this.$rules = {
  1497. "start" : [{
  1498. include : ["strings", "url", "comments"]
  1499. }, {
  1500. token: "paren.lparen",
  1501. regex: "\\{",
  1502. next: "ruleset"
  1503. }, {
  1504. token: "paren.rparen",
  1505. regex: "\\}"
  1506. }, {
  1507. token: "string",
  1508. regex: "@(?!viewport)",
  1509. next: "media"
  1510. }, {
  1511. token: "keyword",
  1512. regex: "#[a-z0-9-_]+"
  1513. }, {
  1514. token: "keyword",
  1515. regex: "%"
  1516. }, {
  1517. token: "variable",
  1518. regex: "\\.[a-z0-9-_]+"
  1519. }, {
  1520. token: "string",
  1521. regex: ":[a-z0-9-_]+"
  1522. }, {
  1523. token : "constant.numeric",
  1524. regex : numRe
  1525. }, {
  1526. token: "constant",
  1527. regex: "[a-z0-9-_]+"
  1528. }, {
  1529. caseInsensitive: true
  1530. }],
  1531. "media": [{
  1532. include : ["strings", "url", "comments"]
  1533. }, {
  1534. token: "paren.lparen",
  1535. regex: "\\{",
  1536. next: "start"
  1537. }, {
  1538. token: "paren.rparen",
  1539. regex: "\\}",
  1540. next: "start"
  1541. }, {
  1542. token: "string",
  1543. regex: ";",
  1544. next: "start"
  1545. }, {
  1546. token: "keyword",
  1547. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  1548. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  1549. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  1550. }],
  1551. "comments" : [{
  1552. token: "comment", // multi line comment
  1553. regex: "\\/\\*",
  1554. push: [{
  1555. token : "comment",
  1556. regex : "\\*\\/",
  1557. next : "pop"
  1558. }, {
  1559. defaultToken : "comment"
  1560. }]
  1561. }],
  1562. "ruleset" : [{
  1563. regex : "-(webkit|ms|moz|o)-",
  1564. token : "text"
  1565. }, {
  1566. token : "punctuation.operator",
  1567. regex : "[:;]"
  1568. }, {
  1569. token : "paren.rparen",
  1570. regex : "\\}",
  1571. next : "start"
  1572. }, {
  1573. include : ["strings", "url", "comments"]
  1574. }, {
  1575. token : ["constant.numeric", "keyword"],
  1576. 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|%)"
  1577. }, {
  1578. token : "constant.numeric",
  1579. regex : numRe
  1580. }, {
  1581. token : "constant.numeric", // hex6 color
  1582. regex : "#[a-f0-9]{6}"
  1583. }, {
  1584. token : "constant.numeric", // hex3 color
  1585. regex : "#[a-f0-9]{3}"
  1586. }, {
  1587. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  1588. regex : pseudoElements
  1589. }, {
  1590. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  1591. regex : pseudoClasses
  1592. }, {
  1593. include: "url"
  1594. }, {
  1595. token : keywordMapper,
  1596. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  1597. }, {
  1598. caseInsensitive: true
  1599. }],
  1600. url: [{
  1601. token : "support.function",
  1602. regex : "(?:url(:?-prefix)?|domain|regexp)\\(",
  1603. push: [{
  1604. token : "support.function",
  1605. regex : "\\)",
  1606. next : "pop"
  1607. }, {
  1608. defaultToken: "string"
  1609. }]
  1610. }],
  1611. strings: [{
  1612. token : "string.start",
  1613. regex : "'",
  1614. push : [{
  1615. token : "string.end",
  1616. regex : "'|$",
  1617. next: "pop"
  1618. }, {
  1619. include : "escapes"
  1620. }, {
  1621. token : "constant.language.escape",
  1622. regex : /\\$/,
  1623. consumeLineEnd: true
  1624. }, {
  1625. defaultToken: "string"
  1626. }]
  1627. }, {
  1628. token : "string.start",
  1629. regex : '"',
  1630. push : [{
  1631. token : "string.end",
  1632. regex : '"|$',
  1633. next: "pop"
  1634. }, {
  1635. include : "escapes"
  1636. }, {
  1637. token : "constant.language.escape",
  1638. regex : /\\$/,
  1639. consumeLineEnd: true
  1640. }, {
  1641. defaultToken: "string"
  1642. }]
  1643. }],
  1644. escapes: [{
  1645. token : "constant.language.escape",
  1646. regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  1647. }]
  1648. };
  1649. this.normalizeRules();
  1650. };
  1651. oop.inherits(CssHighlightRules, TextHighlightRules);
  1652. exports.CssHighlightRules = CssHighlightRules;
  1653. });
  1654. define("ace/mode/css_completions",["ace_require","exports","module"], function(ace_require, exports, module) {
  1655. "use strict";
  1656. var propertyMap = {
  1657. "background": {"#$0": 1},
  1658. "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
  1659. "background-image": {"url('/$0')": 1},
  1660. "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
  1661. "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
  1662. "background-attachment": {"scroll": 1, "fixed": 1},
  1663. "background-size": {"cover": 1, "contain": 1},
  1664. "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1665. "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1666. "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
  1667. "border-color": {"#$0": 1},
  1668. "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
  1669. "border-collapse": {"collapse": 1, "separate": 1},
  1670. "bottom": {"px": 1, "em": 1, "%": 1},
  1671. "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
  1672. "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
  1673. "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},
  1674. "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
  1675. "empty-cells": {"show": 1, "hide": 1},
  1676. "float": {"left": 1, "right": 1, "none": 1},
  1677. "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},
  1678. "font-size": {"px": 1, "em": 1, "%": 1},
  1679. "font-weight": {"bold": 1, "normal": 1},
  1680. "font-style": {"italic": 1, "normal": 1},
  1681. "font-variant": {"normal": 1, "small-caps": 1},
  1682. "height": {"px": 1, "em": 1, "%": 1},
  1683. "left": {"px": 1, "em": 1, "%": 1},
  1684. "letter-spacing": {"normal": 1},
  1685. "line-height": {"normal": 1},
  1686. "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},
  1687. "margin": {"px": 1, "em": 1, "%": 1},
  1688. "margin-right": {"px": 1, "em": 1, "%": 1},
  1689. "margin-left": {"px": 1, "em": 1, "%": 1},
  1690. "margin-top": {"px": 1, "em": 1, "%": 1},
  1691. "margin-bottom": {"px": 1, "em": 1, "%": 1},
  1692. "max-height": {"px": 1, "em": 1, "%": 1},
  1693. "max-width": {"px": 1, "em": 1, "%": 1},
  1694. "min-height": {"px": 1, "em": 1, "%": 1},
  1695. "min-width": {"px": 1, "em": 1, "%": 1},
  1696. "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1697. "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1698. "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1699. "padding": {"px": 1, "em": 1, "%": 1},
  1700. "padding-top": {"px": 1, "em": 1, "%": 1},
  1701. "padding-right": {"px": 1, "em": 1, "%": 1},
  1702. "padding-bottom": {"px": 1, "em": 1, "%": 1},
  1703. "padding-left": {"px": 1, "em": 1, "%": 1},
  1704. "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1705. "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1706. "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
  1707. "right": {"px": 1, "em": 1, "%": 1},
  1708. "table-layout": {"fixed": 1, "auto": 1},
  1709. "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
  1710. "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
  1711. "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
  1712. "top": {"px": 1, "em": 1, "%": 1},
  1713. "vertical-align": {"top": 1, "bottom": 1},
  1714. "visibility": {"hidden": 1, "visible": 1},
  1715. "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
  1716. "width": {"px": 1, "em": 1, "%": 1},
  1717. "word-spacing": {"normal": 1},
  1718. "filter": {"alpha(opacity=$0100)": 1},
  1719. "text-shadow": {"$02px 2px 2px #777": 1},
  1720. "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
  1721. "-moz-border-radius": 1,
  1722. "-moz-border-radius-topright": 1,
  1723. "-moz-border-radius-bottomright": 1,
  1724. "-moz-border-radius-topleft": 1,
  1725. "-moz-border-radius-bottomleft": 1,
  1726. "-webkit-border-radius": 1,
  1727. "-webkit-border-top-right-radius": 1,
  1728. "-webkit-border-top-left-radius": 1,
  1729. "-webkit-border-bottom-right-radius": 1,
  1730. "-webkit-border-bottom-left-radius": 1,
  1731. "-moz-box-shadow": 1,
  1732. "-webkit-box-shadow": 1,
  1733. "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1734. "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1735. "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
  1736. };
  1737. var CssCompletions = function() {
  1738. };
  1739. (function() {
  1740. this.completionsDefined = false;
  1741. this.defineCompletions = function() {
  1742. if (document) {
  1743. var style = document.createElement('c').style;
  1744. for (var i in style) {
  1745. if (typeof style[i] !== 'string')
  1746. continue;
  1747. var name = i.replace(/[A-Z]/g, function(x) {
  1748. return '-' + x.toLowerCase();
  1749. });
  1750. if (!propertyMap.hasOwnProperty(name))
  1751. propertyMap[name] = 1;
  1752. }
  1753. }
  1754. this.completionsDefined = true;
  1755. };
  1756. this.getCompletions = function(state, session, pos, prefix) {
  1757. if (!this.completionsDefined) {
  1758. this.defineCompletions();
  1759. }
  1760. if (state==='ruleset' || session.$mode.$id == "ace/mode/scss") {
  1761. var line = session.getLine(pos.row).substr(0, pos.column);
  1762. if (/:[^;]+$/.test(line)) {
  1763. /([\w\-]+):[^:]*$/.test(line);
  1764. return this.getPropertyValueCompletions(state, session, pos, prefix);
  1765. } else {
  1766. return this.getPropertyCompletions(state, session, pos, prefix);
  1767. }
  1768. }
  1769. return [];
  1770. };
  1771. this.getPropertyCompletions = function(state, session, pos, prefix) {
  1772. var properties = Object.keys(propertyMap);
  1773. return properties.map(function(property){
  1774. return {
  1775. caption: property,
  1776. snippet: property + ': $0;',
  1777. meta: "property",
  1778. score: 1000000
  1779. };
  1780. });
  1781. };
  1782. this.getPropertyValueCompletions = function(state, session, pos, prefix) {
  1783. var line = session.getLine(pos.row).substr(0, pos.column);
  1784. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  1785. if (!property)
  1786. return [];
  1787. var values = [];
  1788. if (property in propertyMap && typeof propertyMap[property] === "object") {
  1789. values = Object.keys(propertyMap[property]);
  1790. }
  1791. return values.map(function(value){
  1792. return {
  1793. caption: value,
  1794. snippet: value,
  1795. meta: "property value",
  1796. score: 1000000
  1797. };
  1798. });
  1799. };
  1800. }).call(CssCompletions.prototype);
  1801. exports.CssCompletions = CssCompletions;
  1802. });
  1803. define("ace/mode/behaviour/css",["ace_require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(ace_require, exports, module) {
  1804. "use strict";
  1805. var oop = ace_require("../../lib/oop");
  1806. var Behaviour = ace_require("../behaviour").Behaviour;
  1807. var CstyleBehaviour = ace_require("./cstyle").CstyleBehaviour;
  1808. var TokenIterator = ace_require("../../token_iterator").TokenIterator;
  1809. var CssBehaviour = function () {
  1810. this.inherit(CstyleBehaviour);
  1811. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1812. if (text === ':' && editor.selection.isEmpty()) {
  1813. var cursor = editor.getCursorPosition();
  1814. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1815. var token = iterator.getCurrentToken();
  1816. if (token && token.value.match(/\s+/)) {
  1817. token = iterator.stepBackward();
  1818. }
  1819. if (token && token.type === 'support.type') {
  1820. var line = session.doc.getLine(cursor.row);
  1821. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1822. if (rightChar === ':') {
  1823. return {
  1824. text: '',
  1825. selection: [1, 1]
  1826. };
  1827. }
  1828. if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
  1829. return {
  1830. text: ':;',
  1831. selection: [1, 1]
  1832. };
  1833. }
  1834. }
  1835. }
  1836. });
  1837. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1838. var selected = session.doc.getTextRange(range);
  1839. if (!range.isMultiLine() && selected === ':') {
  1840. var cursor = editor.getCursorPosition();
  1841. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1842. var token = iterator.getCurrentToken();
  1843. if (token && token.value.match(/\s+/)) {
  1844. token = iterator.stepBackward();
  1845. }
  1846. if (token && token.type === 'support.type') {
  1847. var line = session.doc.getLine(range.start.row);
  1848. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1849. if (rightChar === ';') {
  1850. range.end.column ++;
  1851. return range;
  1852. }
  1853. }
  1854. }
  1855. });
  1856. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1857. if (text === ';' && editor.selection.isEmpty()) {
  1858. var cursor = editor.getCursorPosition();
  1859. var line = session.doc.getLine(cursor.row);
  1860. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1861. if (rightChar === ';') {
  1862. return {
  1863. text: '',
  1864. selection: [1, 1]
  1865. };
  1866. }
  1867. }
  1868. });
  1869. this.add("!important", "insertion", function (state, action, editor, session, text) {
  1870. if (text === '!' && editor.selection.isEmpty()) {
  1871. var cursor = editor.getCursorPosition();
  1872. var line = session.doc.getLine(cursor.row);
  1873. if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
  1874. return {
  1875. text: '!important',
  1876. selection: [10, 10]
  1877. };
  1878. }
  1879. }
  1880. });
  1881. };
  1882. oop.inherits(CssBehaviour, CstyleBehaviour);
  1883. exports.CssBehaviour = CssBehaviour;
  1884. });
  1885. define("ace/mode/css",["ace_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(ace_require, exports, module) {
  1886. "use strict";
  1887. var oop = ace_require("../lib/oop");
  1888. var TextMode = ace_require("./text").Mode;
  1889. var CssHighlightRules = ace_require("./css_highlight_rules").CssHighlightRules;
  1890. var MatchingBraceOutdent = ace_require("./matching_brace_outdent").MatchingBraceOutdent;
  1891. var WorkerClient = ace_require("../worker/worker_client").WorkerClient;
  1892. var CssCompletions = ace_require("./css_completions").CssCompletions;
  1893. var CssBehaviour = ace_require("./behaviour/css").CssBehaviour;
  1894. var CStyleFoldMode = ace_require("./folding/cstyle").FoldMode;
  1895. var Mode = function() {
  1896. this.HighlightRules = CssHighlightRules;
  1897. this.$outdent = new MatchingBraceOutdent();
  1898. this.$behaviour = new CssBehaviour();
  1899. this.$completer = new CssCompletions();
  1900. this.foldingRules = new CStyleFoldMode();
  1901. };
  1902. oop.inherits(Mode, TextMode);
  1903. (function() {
  1904. this.foldingRules = "cStyle";
  1905. this.blockComment = {start: "/*", end: "*/"};
  1906. this.getNextLineIndent = function(state, line, tab) {
  1907. var indent = this.$getIndent(line);
  1908. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1909. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1910. return indent;
  1911. }
  1912. var match = line.match(/^.*\{\s*$/);
  1913. if (match) {
  1914. indent += tab;
  1915. }
  1916. return indent;
  1917. };
  1918. this.checkOutdent = function(state, line, input) {
  1919. return this.$outdent.checkOutdent(line, input);
  1920. };
  1921. this.autoOutdent = function(state, doc, row) {
  1922. this.$outdent.autoOutdent(doc, row);
  1923. };
  1924. this.getCompletions = function(state, session, pos, prefix) {
  1925. return this.$completer.getCompletions(state, session, pos, prefix);
  1926. };
  1927. this.createWorker = function(session) {
  1928. var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
  1929. worker.attachToDocument(session.getDocument());
  1930. worker.on("annotate", function(e) {
  1931. session.setAnnotations(e.data);
  1932. });
  1933. worker.on("terminate", function() {
  1934. session.clearAnnotations();
  1935. });
  1936. return worker;
  1937. };
  1938. this.$id = "ace/mode/css";
  1939. this.snippetFileId = "ace/snippets/css";
  1940. }).call(Mode.prototype);
  1941. exports.Mode = Mode;
  1942. });
  1943. define("ace/mode/html_highlight_rules",["ace_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(ace_require, exports, module) {
  1944. "use strict";
  1945. var oop = ace_require("../lib/oop");
  1946. var lang = ace_require("../lib/lang");
  1947. var CssHighlightRules = ace_require("./css_highlight_rules").CssHighlightRules;
  1948. var JavaScriptHighlightRules = ace_require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1949. var XmlHighlightRules = ace_require("./xml_highlight_rules").XmlHighlightRules;
  1950. var tagMap = lang.createMap({
  1951. a : 'anchor',
  1952. button : 'form',
  1953. form : 'form',
  1954. img : 'image',
  1955. input : 'form',
  1956. label : 'form',
  1957. option : 'form',
  1958. script : 'script',
  1959. select : 'form',
  1960. textarea : 'form',
  1961. style : 'style',
  1962. table : 'table',
  1963. tbody : 'table',
  1964. td : 'table',
  1965. tfoot : 'table',
  1966. th : 'table',
  1967. tr : 'table'
  1968. });
  1969. var HtmlHighlightRules = function() {
  1970. XmlHighlightRules.call(this);
  1971. this.addRules({
  1972. attributes: [{
  1973. include : "tag_whitespace"
  1974. }, {
  1975. token : "entity.other.attribute-name.xml",
  1976. regex : "[-_a-zA-Z0-9:.]+"
  1977. }, {
  1978. token : "keyword.operator.attribute-equals.xml",
  1979. regex : "=",
  1980. push : [{
  1981. include: "tag_whitespace"
  1982. }, {
  1983. token : "string.unquoted.attribute-value.html",
  1984. regex : "[^<>='\"`\\s]+",
  1985. next : "pop"
  1986. }, {
  1987. token : "empty",
  1988. regex : "",
  1989. next : "pop"
  1990. }]
  1991. }, {
  1992. include : "attribute_value"
  1993. }],
  1994. tag: [{
  1995. token : function(start, tag) {
  1996. var group = tagMap[tag];
  1997. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  1998. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  1999. },
  2000. regex : "(</?)([-_a-zA-Z0-9:.]+)",
  2001. next: "tag_stuff"
  2002. }],
  2003. tag_stuff: [
  2004. {include : "attributes"},
  2005. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  2006. ]
  2007. });
  2008. this.embedTagRules(CssHighlightRules, "css-", "style");
  2009. this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script");
  2010. if (this.constructor === HtmlHighlightRules)
  2011. this.normalizeRules();
  2012. };
  2013. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  2014. exports.HtmlHighlightRules = HtmlHighlightRules;
  2015. });
  2016. define("ace/mode/folding/mixed",["ace_require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(ace_require, exports, module) {
  2017. "use strict";
  2018. var oop = ace_require("../../lib/oop");
  2019. var BaseFoldMode = ace_require("./fold_mode").FoldMode;
  2020. var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
  2021. this.defaultMode = defaultMode;
  2022. this.subModes = subModes;
  2023. };
  2024. oop.inherits(FoldMode, BaseFoldMode);
  2025. (function() {
  2026. this.$getMode = function(state) {
  2027. if (typeof state != "string")
  2028. state = state[0];
  2029. for (var key in this.subModes) {
  2030. if (state.indexOf(key) === 0)
  2031. return this.subModes[key];
  2032. }
  2033. return null;
  2034. };
  2035. this.$tryMode = function(state, session, foldStyle, row) {
  2036. var mode = this.$getMode(state);
  2037. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  2038. };
  2039. this.getFoldWidget = function(session, foldStyle, row) {
  2040. return (
  2041. this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
  2042. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  2043. this.defaultMode.getFoldWidget(session, foldStyle, row)
  2044. );
  2045. };
  2046. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2047. var mode = this.$getMode(session.getState(row-1));
  2048. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  2049. mode = this.$getMode(session.getState(row));
  2050. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  2051. mode = this.defaultMode;
  2052. return mode.getFoldWidgetRange(session, foldStyle, row);
  2053. };
  2054. }).call(FoldMode.prototype);
  2055. });
  2056. define("ace/mode/folding/html",["ace_require","exports","module","ace/lib/oop","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"], function(ace_require, exports, module) {
  2057. "use strict";
  2058. var oop = ace_require("../../lib/oop");
  2059. var MixedFoldMode = ace_require("./mixed").FoldMode;
  2060. var XmlFoldMode = ace_require("./xml").FoldMode;
  2061. var CStyleFoldMode = ace_require("./cstyle").FoldMode;
  2062. var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
  2063. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  2064. "js-": new CStyleFoldMode(),
  2065. "css-": new CStyleFoldMode()
  2066. });
  2067. };
  2068. oop.inherits(FoldMode, MixedFoldMode);
  2069. });
  2070. define("ace/mode/html_completions",["ace_require","exports","module","ace/token_iterator"], function(ace_require, exports, module) {
  2071. "use strict";
  2072. var TokenIterator = ace_require("../token_iterator").TokenIterator;
  2073. var commonAttributes = [
  2074. "accesskey",
  2075. "class",
  2076. "contenteditable",
  2077. "contextmenu",
  2078. "dir",
  2079. "draggable",
  2080. "dropzone",
  2081. "hidden",
  2082. "id",
  2083. "inert",
  2084. "itemid",
  2085. "itemprop",
  2086. "itemref",
  2087. "itemscope",
  2088. "itemtype",
  2089. "lang",
  2090. "spellcheck",
  2091. "style",
  2092. "tabindex",
  2093. "title",
  2094. "translate"
  2095. ];
  2096. var eventAttributes = [
  2097. "onabort",
  2098. "onblur",
  2099. "oncancel",
  2100. "oncanplay",
  2101. "oncanplaythrough",
  2102. "onchange",
  2103. "onclick",
  2104. "onclose",
  2105. "oncontextmenu",
  2106. "oncuechange",
  2107. "ondblclick",
  2108. "ondrag",
  2109. "ondragend",
  2110. "ondragenter",
  2111. "ondragleave",
  2112. "ondragover",
  2113. "ondragstart",
  2114. "ondrop",
  2115. "ondurationchange",
  2116. "onemptied",
  2117. "onended",
  2118. "onerror",
  2119. "onfocus",
  2120. "oninput",
  2121. "oninvalid",
  2122. "onkeydown",
  2123. "onkeypress",
  2124. "onkeyup",
  2125. "onload",
  2126. "onloadeddata",
  2127. "onloadedmetadata",
  2128. "onloadstart",
  2129. "onmousedown",
  2130. "onmousemove",
  2131. "onmouseout",
  2132. "onmouseover",
  2133. "onmouseup",
  2134. "onmousewheel",
  2135. "onpause",
  2136. "onplay",
  2137. "onplaying",
  2138. "onprogress",
  2139. "onratechange",
  2140. "onreset",
  2141. "onscroll",
  2142. "onseeked",
  2143. "onseeking",
  2144. "onselect",
  2145. "onshow",
  2146. "onstalled",
  2147. "onsubmit",
  2148. "onsuspend",
  2149. "ontimeupdate",
  2150. "onvolumechange",
  2151. "onwaiting"
  2152. ];
  2153. var globalAttributes = commonAttributes.concat(eventAttributes);
  2154. var attributeMap = {
  2155. "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},
  2156. "abbr": {},
  2157. "address": {},
  2158. "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
  2159. "article": {"pubdate": 1},
  2160. "aside": {},
  2161. "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
  2162. "b": {},
  2163. "base": {"href": 1, "target": 1},
  2164. "bdi": {},
  2165. "bdo": {},
  2166. "blockquote": {"cite": 1},
  2167. "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},
  2168. "br": {},
  2169. "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}},
  2170. "canvas": {"width": 1, "height": 1},
  2171. "caption": {},
  2172. "cite": {},
  2173. "code": {},
  2174. "col": {"span": 1},
  2175. "colgroup": {"span": 1},
  2176. "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
  2177. "data": {},
  2178. "datalist": {},
  2179. "dd": {},
  2180. "del": {"cite": 1, "datetime": 1},
  2181. "details": {"open": 1},
  2182. "dfn": {},
  2183. "dialog": {"open": 1},
  2184. "div": {},
  2185. "dl": {},
  2186. "dt": {},
  2187. "em": {},
  2188. "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
  2189. "fieldset": {"disabled": 1, "form": 1, "name": 1},
  2190. "figcaption": {},
  2191. "figure": {},
  2192. "footer": {},
  2193. "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}},
  2194. "h1": {},
  2195. "h2": {},
  2196. "h3": {},
  2197. "h4": {},
  2198. "h5": {},
  2199. "h6": {},
  2200. "head": {},
  2201. "header": {},
  2202. "hr": {},
  2203. "html": {"manifest": 1},
  2204. "i": {},
  2205. "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}},
  2206. "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
  2207. "input": {
  2208. "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},
  2209. "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},
  2210. "ins": {"cite": 1, "datetime": 1},
  2211. "kbd": {},
  2212. "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
  2213. "label": {"form": 1, "for": 1},
  2214. "legend": {},
  2215. "li": {"value": 1},
  2216. "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},
  2217. "main": {},
  2218. "map": {"name": 1},
  2219. "mark": {},
  2220. "math": {},
  2221. "menu": {"type": 1, "label": 1},
  2222. "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
  2223. "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
  2224. "nav": {},
  2225. "noscript": {"href": 1},
  2226. "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
  2227. "ol": {"start": 1, "reversed": 1},
  2228. "optgroup": {"disabled": 1, "label": 1},
  2229. "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
  2230. "output": {"for": 1, "form": 1, "name": 1},
  2231. "p": {},
  2232. "param": {"name": 1, "value": 1},
  2233. "pre": {},
  2234. "progress": {"value": 1, "max": 1},
  2235. "q": {"cite": 1},
  2236. "rp": {},
  2237. "rt": {},
  2238. "ruby": {},
  2239. "s": {},
  2240. "samp": {},
  2241. "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
  2242. "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
  2243. "small": {},
  2244. "source": {"src": 1, "type": 1, "media": 1},
  2245. "span": {},
  2246. "strong": {},
  2247. "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
  2248. "sub": {},
  2249. "sup": {},
  2250. "svg": {},
  2251. "table": {"summary": 1},
  2252. "tbody": {},
  2253. "td": {"headers": 1, "rowspan": 1, "colspan": 1},
  2254. "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}},
  2255. "tfoot": {},
  2256. "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
  2257. "thead": {},
  2258. "time": {"datetime": 1},
  2259. "title": {},
  2260. "tr": {},
  2261. "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
  2262. "section": {},
  2263. "summary": {},
  2264. "u": {},
  2265. "ul": {},
  2266. "var": {},
  2267. "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}},
  2268. "wbr": {}
  2269. };
  2270. var elements = Object.keys(attributeMap);
  2271. function is(token, type) {
  2272. return token.type.lastIndexOf(type + ".xml") > -1;
  2273. }
  2274. function findTagName(session, pos) {
  2275. var iterator = new TokenIterator(session, pos.row, pos.column);
  2276. var token = iterator.getCurrentToken();
  2277. while (token && !is(token, "tag-name")){
  2278. token = iterator.stepBackward();
  2279. }
  2280. if (token)
  2281. return token.value;
  2282. }
  2283. function findAttributeName(session, pos) {
  2284. var iterator = new TokenIterator(session, pos.row, pos.column);
  2285. var token = iterator.getCurrentToken();
  2286. while (token && !is(token, "attribute-name")){
  2287. token = iterator.stepBackward();
  2288. }
  2289. if (token)
  2290. return token.value;
  2291. }
  2292. var HtmlCompletions = function() {
  2293. };
  2294. (function() {
  2295. this.getCompletions = function(state, session, pos, prefix) {
  2296. var token = session.getTokenAt(pos.row, pos.column);
  2297. if (!token)
  2298. return [];
  2299. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2300. return this.getTagCompletions(state, session, pos, prefix);
  2301. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2302. return this.getAttributeCompletions(state, session, pos, prefix);
  2303. if (is(token, "attribute-value"))
  2304. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2305. var line = session.getLine(pos.row).substr(0, pos.column);
  2306. if (/&[a-z]*$/i.test(line))
  2307. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2308. return [];
  2309. };
  2310. this.getTagCompletions = function(state, session, pos, prefix) {
  2311. return elements.map(function(element){
  2312. return {
  2313. value: element,
  2314. meta: "tag",
  2315. score: 1000000
  2316. };
  2317. });
  2318. };
  2319. this.getAttributeCompletions = function(state, session, pos, prefix) {
  2320. var tagName = findTagName(session, pos);
  2321. if (!tagName)
  2322. return [];
  2323. var attributes = globalAttributes;
  2324. if (tagName in attributeMap) {
  2325. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2326. }
  2327. return attributes.map(function(attribute){
  2328. return {
  2329. caption: attribute,
  2330. snippet: attribute + '="$0"',
  2331. meta: "attribute",
  2332. score: 1000000
  2333. };
  2334. });
  2335. };
  2336. this.getAttributeValueCompletions = function(state, session, pos, prefix) {
  2337. var tagName = findTagName(session, pos);
  2338. var attributeName = findAttributeName(session, pos);
  2339. if (!tagName)
  2340. return [];
  2341. var values = [];
  2342. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2343. values = Object.keys(attributeMap[tagName][attributeName]);
  2344. }
  2345. return values.map(function(value){
  2346. return {
  2347. caption: value,
  2348. snippet: value,
  2349. meta: "attribute value",
  2350. score: 1000000
  2351. };
  2352. });
  2353. };
  2354. this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
  2355. 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;'];
  2356. return values.map(function(value){
  2357. return {
  2358. caption: value,
  2359. snippet: value,
  2360. meta: "html entity",
  2361. score: 1000000
  2362. };
  2363. });
  2364. };
  2365. }).call(HtmlCompletions.prototype);
  2366. exports.HtmlCompletions = HtmlCompletions;
  2367. });
  2368. define("ace/mode/html",["ace_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(ace_require, exports, module) {
  2369. "use strict";
  2370. var oop = ace_require("../lib/oop");
  2371. var lang = ace_require("../lib/lang");
  2372. var TextMode = ace_require("./text").Mode;
  2373. var JavaScriptMode = ace_require("./javascript").Mode;
  2374. var CssMode = ace_require("./css").Mode;
  2375. var HtmlHighlightRules = ace_require("./html_highlight_rules").HtmlHighlightRules;
  2376. var XmlBehaviour = ace_require("./behaviour/xml").XmlBehaviour;
  2377. var HtmlFoldMode = ace_require("./folding/html").FoldMode;
  2378. var HtmlCompletions = ace_require("./html_completions").HtmlCompletions;
  2379. var WorkerClient = ace_require("../worker/worker_client").WorkerClient;
  2380. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2381. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2382. var Mode = function(options) {
  2383. this.fragmentContext = options && options.fragmentContext;
  2384. this.HighlightRules = HtmlHighlightRules;
  2385. this.$behaviour = new XmlBehaviour();
  2386. this.$completer = new HtmlCompletions();
  2387. this.createModeDelegates({
  2388. "js-": JavaScriptMode,
  2389. "css-": CssMode
  2390. });
  2391. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2392. };
  2393. oop.inherits(Mode, TextMode);
  2394. (function() {
  2395. this.blockComment = {start: "<!--", end: "-->"};
  2396. this.voidElements = lang.arrayToMap(voidElements);
  2397. this.getNextLineIndent = function(state, line, tab) {
  2398. return this.$getIndent(line);
  2399. };
  2400. this.checkOutdent = function(state, line, input) {
  2401. return false;
  2402. };
  2403. this.getCompletions = function(state, session, pos, prefix) {
  2404. return this.$completer.getCompletions(state, session, pos, prefix);
  2405. };
  2406. this.createWorker = function(session) {
  2407. if (this.constructor != Mode)
  2408. return;
  2409. var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
  2410. worker.attachToDocument(session.getDocument());
  2411. if (this.fragmentContext)
  2412. worker.call("setOptions", [{context: this.fragmentContext}]);
  2413. worker.on("error", function(e) {
  2414. session.setAnnotations(e.data);
  2415. });
  2416. worker.on("terminate", function() {
  2417. session.clearAnnotations();
  2418. });
  2419. return worker;
  2420. };
  2421. this.$id = "ace/mode/html";
  2422. this.snippetFileId = "ace/snippets/html";
  2423. }).call(Mode.prototype);
  2424. exports.Mode = Mode;
  2425. });
  2426. define("ace/mode/markdown_highlight_rules",["ace_require","exports","module","ace/config","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/html_highlight_rules"], function(ace_require, exports, module) {
  2427. "use strict";
  2428. var modes = ace_require("../config").$ace_modes;
  2429. var oop = ace_require("../lib/oop");
  2430. var lang = ace_require("../lib/lang");
  2431. var TextHighlightRules = ace_require("./text_highlight_rules").TextHighlightRules;
  2432. var HtmlHighlightRules = ace_require("./html_highlight_rules").HtmlHighlightRules;
  2433. var escaped = function(ch) {
  2434. return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*";
  2435. };
  2436. var MarkdownHighlightRules = function() {
  2437. HtmlHighlightRules.call(this);
  2438. var codeBlockStartRule = {
  2439. token : "support.function",
  2440. regex : /^\s*(```+[^`]*|~~~+[^~]*)$/,
  2441. onMatch: function(value, state, stack, line) {
  2442. var m = value.match(/^(\s*)([`~]+)(.*)/);
  2443. var language = /[\w-]+|$/.exec(m[3])[0];
  2444. if (!modes[language])
  2445. language = "";
  2446. stack.unshift("githubblock", [], [m[1], m[2], language], state);
  2447. return this.token;
  2448. },
  2449. next : "githubblock"
  2450. };
  2451. var codeBlockRules = [{
  2452. token : "support.function",
  2453. regex : ".*",
  2454. onMatch: function(value, state, stack, line) {
  2455. var embedState = stack[1];
  2456. var indent = stack[2][0];
  2457. var endMarker = stack[2][1];
  2458. var language = stack[2][2];
  2459. var m = /^(\s*)(`+|~+)\s*$/.exec(value);
  2460. if (
  2461. m && m[1].length < indent.length + 3
  2462. && m[2].length >= endMarker.length && m[2][0] == endMarker[0]
  2463. ) {
  2464. stack.splice(0, 3);
  2465. this.next = stack.shift();
  2466. return this.token;
  2467. }
  2468. this.next = "";
  2469. if (language && modes[language]) {
  2470. var data = modes[language].getTokenizer().getLineTokens(value, embedState.slice(0));
  2471. stack[1] = data.state;
  2472. return data.tokens;
  2473. }
  2474. return this.token;
  2475. }
  2476. }];
  2477. this.$rules["start"].unshift({
  2478. token : "empty_line",
  2479. regex : '^$',
  2480. next: "allowBlock"
  2481. }, { // h1
  2482. token: "markup.heading.1",
  2483. regex: "^=+(?=\\s*$)"
  2484. }, { // h2
  2485. token: "markup.heading.2",
  2486. regex: "^\\-+(?=\\s*$)"
  2487. }, {
  2488. token : function(value) {
  2489. return "markup.heading." + value.length;
  2490. },
  2491. regex : /^#{1,6}(?=\s|$)/,
  2492. next : "header"
  2493. },
  2494. codeBlockStartRule,
  2495. { // block quote
  2496. token : "string.blockquote",
  2497. regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  2498. next : "blockquote"
  2499. }, { // HR * - _
  2500. token : "constant",
  2501. regex : "^ {0,3}(?:(?:\\* ?){3,}|(?:\\- ?){3,}|(?:\\_ ?){3,})\\s*$",
  2502. next: "allowBlock"
  2503. }, { // list
  2504. token : "markup.list",
  2505. regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  2506. next : "listblock-start"
  2507. }, {
  2508. include : "basic"
  2509. });
  2510. this.addRules({
  2511. "basic" : [{
  2512. token : "constant.language.escape",
  2513. regex : /\\[\\`*_{}\[\]()#+\-.!]/
  2514. }, { // code span `
  2515. token : "support.function",
  2516. regex : "(`+)(.*?[^`])(\\1)"
  2517. }, { // reference
  2518. token : ["text", "constant", "text", "url", "string", "text"],
  2519. regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
  2520. }, { // link by reference
  2521. token : ["text", "string", "text", "constant", "text"],
  2522. regex : "(\\[)(" + escaped("]") + ")(\\]\\s*\\[)("+ escaped("]") + ")(\\])"
  2523. }, { // link by url
  2524. token : ["text", "string", "text", "markup.underline", "string", "text"],
  2525. regex : "(\\!?\\[)(" + // [
  2526. escaped("]") + // link text or alt text
  2527. ")(\\]\\()"+ // ](
  2528. '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href or image
  2529. '(\\s*"' + escaped('"') + '"\\s*)?' + // "title"
  2530. "(\\))" // )
  2531. }, { // strong ** __
  2532. token : "string.strong",
  2533. regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
  2534. }, { // emphasis * _
  2535. token : "string.emphasis",
  2536. regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
  2537. }, { //
  2538. token : ["text", "url", "text"],
  2539. regex : "(<)("+
  2540. "(?:https?|ftp|dict):[^'\">\\s]+"+
  2541. "|"+
  2542. "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+"+
  2543. ")(>)"
  2544. }],
  2545. "allowBlock": [
  2546. {token : "support.function", regex : "^ {4}.+", next : "allowBlock"},
  2547. {token : "empty_line", regex : '^$', next: "allowBlock"},
  2548. {token : "empty", regex : "", next : "start"}
  2549. ],
  2550. "header" : [{
  2551. regex: "$",
  2552. next : "start"
  2553. }, {
  2554. include: "basic"
  2555. }, {
  2556. defaultToken : "heading"
  2557. } ],
  2558. "listblock-start" : [{
  2559. token : "support.variable",
  2560. regex : /(?:\[[ x]\])?/,
  2561. next : "listblock"
  2562. }],
  2563. "listblock" : [ { // Lists only escape on completely blank lines.
  2564. token : "empty_line",
  2565. regex : "^$",
  2566. next : "start"
  2567. }, { // list
  2568. token : "markup.list",
  2569. regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  2570. next : "listblock-start"
  2571. }, {
  2572. include : "basic", noEscape: true
  2573. },
  2574. codeBlockStartRule,
  2575. {
  2576. defaultToken : "list" //do not use markup.list to allow stling leading `*` differntly
  2577. } ],
  2578. "blockquote" : [ { // Blockquotes only escape on blank lines.
  2579. token : "empty_line",
  2580. regex : "^\\s*$",
  2581. next : "start"
  2582. }, { // block quote
  2583. token : "string.blockquote",
  2584. regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  2585. next : "blockquote"
  2586. }, {
  2587. include : "basic", noEscape: true
  2588. }, {
  2589. defaultToken : "string.blockquote"
  2590. } ],
  2591. "githubblock" : codeBlockRules
  2592. });
  2593. this.normalizeRules();
  2594. };
  2595. oop.inherits(MarkdownHighlightRules, TextHighlightRules);
  2596. exports.MarkdownHighlightRules = MarkdownHighlightRules;
  2597. });
  2598. define("ace/mode/folding/markdown",["ace_require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(ace_require, exports, module) {
  2599. "use strict";
  2600. var oop = ace_require("../../lib/oop");
  2601. var BaseFoldMode = ace_require("./fold_mode").FoldMode;
  2602. var Range = ace_require("../../range").Range;
  2603. var FoldMode = exports.FoldMode = function() {};
  2604. oop.inherits(FoldMode, BaseFoldMode);
  2605. (function() {
  2606. this.foldingStartMarker = /^(?:[=-]+\s*$|#{1,6} |`{3})/;
  2607. this.getFoldWidget = function(session, foldStyle, row) {
  2608. var line = session.getLine(row);
  2609. if (!this.foldingStartMarker.test(line))
  2610. return "";
  2611. if (line[0] == "`") {
  2612. if (session.bgTokenizer.getState(row) == "start")
  2613. return "end";
  2614. return "start";
  2615. }
  2616. return "start";
  2617. };
  2618. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2619. var line = session.getLine(row);
  2620. var startColumn = line.length;
  2621. var maxRow = session.getLength();
  2622. var startRow = row;
  2623. var endRow = row;
  2624. if (!line.match(this.foldingStartMarker))
  2625. return;
  2626. if (line[0] == "`") {
  2627. if (session.bgTokenizer.getState(row) !== "start") {
  2628. while (++row < maxRow) {
  2629. line = session.getLine(row);
  2630. if (line[0] == "`" & line.substring(0, 3) == "```")
  2631. break;
  2632. }
  2633. return new Range(startRow, startColumn, row, 0);
  2634. } else {
  2635. while (row -- > 0) {
  2636. line = session.getLine(row);
  2637. if (line[0] == "`" & line.substring(0, 3) == "```")
  2638. break;
  2639. }
  2640. return new Range(row, line.length, startRow, 0);
  2641. }
  2642. }
  2643. var token;
  2644. function isHeading(row) {
  2645. token = session.getTokens(row)[0];
  2646. return token && token.type.lastIndexOf(heading, 0) === 0;
  2647. }
  2648. var heading = "markup.heading";
  2649. function getLevel() {
  2650. var ch = token.value[0];
  2651. if (ch == "=") return 6;
  2652. if (ch == "-") return 5;
  2653. return 7 - token.value.search(/[^#]|$/);
  2654. }
  2655. if (isHeading(row)) {
  2656. var startHeadingLevel = getLevel();
  2657. while (++row < maxRow) {
  2658. if (!isHeading(row))
  2659. continue;
  2660. var level = getLevel();
  2661. if (level >= startHeadingLevel)
  2662. break;
  2663. }
  2664. endRow = row - (!token || ["=", "-"].indexOf(token.value[0]) == -1 ? 1 : 2);
  2665. if (endRow > startRow) {
  2666. while (endRow > startRow && /^\s*$/.test(session.getLine(endRow)))
  2667. endRow--;
  2668. }
  2669. if (endRow > startRow) {
  2670. var endColumn = session.getLine(endRow).length;
  2671. return new Range(startRow, startColumn, endRow, endColumn);
  2672. }
  2673. }
  2674. };
  2675. }).call(FoldMode.prototype);
  2676. });
  2677. define("ace/mode/sh_highlight_rules",["ace_require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(ace_require, exports, module) {
  2678. "use strict";
  2679. var oop = ace_require("../lib/oop");
  2680. var TextHighlightRules = ace_require("./text_highlight_rules").TextHighlightRules;
  2681. var reservedKeywords = exports.reservedKeywords = (
  2682. '!|{|}|case|do|done|elif|else|'+
  2683. 'esac|fi|for|if|in|then|until|while|'+
  2684. '&|;|export|local|read|typeset|unset|'+
  2685. 'elif|select|set|function|declare|readonly'
  2686. );
  2687. var languageConstructs = exports.languageConstructs = (
  2688. '[|]|alias|bg|bind|break|builtin|'+
  2689. 'cd|command|compgen|complete|continue|'+
  2690. 'dirs|disown|echo|enable|eval|exec|'+
  2691. 'exit|fc|fg|getopts|hash|help|history|'+
  2692. 'jobs|kill|let|logout|popd|printf|pushd|'+
  2693. 'pwd|return|set|shift|shopt|source|'+
  2694. 'suspend|test|times|trap|type|ulimit|'+
  2695. 'umask|unalias|wait'
  2696. );
  2697. var ShHighlightRules = function() {
  2698. var keywordMapper = this.createKeywordMapper({
  2699. "keyword": reservedKeywords,
  2700. "support.function.builtin": languageConstructs,
  2701. "invalid.deprecated": "debugger"
  2702. }, "identifier");
  2703. var integer = "(?:(?:[1-9]\\d*)|(?:0))";
  2704. var fraction = "(?:\\.\\d+)";
  2705. var intPart = "(?:\\d+)";
  2706. var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
  2707. var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + ")";
  2708. var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
  2709. var fileDescriptor = "(?:&" + intPart + ")";
  2710. var variableName = "[a-zA-Z_][a-zA-Z0-9_]*";
  2711. var variable = "(?:" + variableName + "(?==))";
  2712. var builtinVariable = "(?:\\$(?:SHLVL|\\$|\\!|\\?))";
  2713. var func = "(?:" + variableName + "\\s*\\(\\))";
  2714. this.$rules = {
  2715. "start" : [{
  2716. token : "constant",
  2717. regex : /\\./
  2718. }, {
  2719. token : ["text", "comment"],
  2720. regex : /(^|\s)(#.*)$/
  2721. }, {
  2722. token : "string.start",
  2723. regex : '"',
  2724. push : [{
  2725. token : "constant.language.escape",
  2726. regex : /\\(?:[$`"\\]|$)/
  2727. }, {
  2728. include : "variables"
  2729. }, {
  2730. token : "keyword.operator",
  2731. regex : /`/ // TODO highlight `
  2732. }, {
  2733. token : "string.end",
  2734. regex : '"',
  2735. next: "pop"
  2736. }, {
  2737. defaultToken: "string"
  2738. }]
  2739. }, {
  2740. token : "string",
  2741. regex : "\\$'",
  2742. push : [{
  2743. token : "constant.language.escape",
  2744. regex : /\\(?:[abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/
  2745. }, {
  2746. token : "string",
  2747. regex : "'",
  2748. next: "pop"
  2749. }, {
  2750. defaultToken: "string"
  2751. }]
  2752. }, {
  2753. regex : "<<<",
  2754. token : "keyword.operator"
  2755. }, {
  2756. stateName: "heredoc",
  2757. regex : "(<<-?)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)",
  2758. onMatch : function(value, currentState, stack) {
  2759. var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
  2760. var tokens = value.split(this.splitRegex);
  2761. stack.push(next, tokens[4]);
  2762. return [
  2763. {type:"constant", value: tokens[1]},
  2764. {type:"text", value: tokens[2]},
  2765. {type:"string", value: tokens[3]},
  2766. {type:"support.class", value: tokens[4]},
  2767. {type:"string", value: tokens[5]}
  2768. ];
  2769. },
  2770. rules: {
  2771. heredoc: [{
  2772. onMatch: function(value, currentState, stack) {
  2773. if (value === stack[1]) {
  2774. stack.shift();
  2775. stack.shift();
  2776. this.next = stack[0] || "start";
  2777. return "support.class";
  2778. }
  2779. this.next = "";
  2780. return "string";
  2781. },
  2782. regex: ".*$",
  2783. next: "start"
  2784. }],
  2785. indentedHeredoc: [{
  2786. token: "string",
  2787. regex: "^\t+"
  2788. }, {
  2789. onMatch: function(value, currentState, stack) {
  2790. if (value === stack[1]) {
  2791. stack.shift();
  2792. stack.shift();
  2793. this.next = stack[0] || "start";
  2794. return "support.class";
  2795. }
  2796. this.next = "";
  2797. return "string";
  2798. },
  2799. regex: ".*$",
  2800. next: "start"
  2801. }]
  2802. }
  2803. }, {
  2804. regex : "$",
  2805. token : "empty",
  2806. next : function(currentState, stack) {
  2807. if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
  2808. return stack[0];
  2809. return currentState;
  2810. }
  2811. }, {
  2812. token : ["keyword", "text", "text", "text", "variable"],
  2813. regex : /(declare|local|readonly)(\s+)(?:(-[fixar]+)(\s+))?([a-zA-Z_][a-zA-Z0-9_]*\b)/
  2814. }, {
  2815. token : "variable.language",
  2816. regex : builtinVariable
  2817. }, {
  2818. token : "variable",
  2819. regex : variable
  2820. }, {
  2821. include : "variables"
  2822. }, {
  2823. token : "support.function",
  2824. regex : func
  2825. }, {
  2826. token : "support.function",
  2827. regex : fileDescriptor
  2828. }, {
  2829. token : "string", // ' string
  2830. start : "'", end : "'"
  2831. }, {
  2832. token : "constant.numeric", // float
  2833. regex : floatNumber
  2834. }, {
  2835. token : "constant.numeric", // integer
  2836. regex : integer + "\\b"
  2837. }, {
  2838. token : keywordMapper,
  2839. regex : "[a-zA-Z_][a-zA-Z0-9_]*\\b"
  2840. }, {
  2841. token : "keyword.operator",
  2842. regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!=|[%&|`]"
  2843. }, {
  2844. token : "punctuation.operator",
  2845. regex : ";"
  2846. }, {
  2847. token : "paren.lparen",
  2848. regex : "[\\[\\(\\{]"
  2849. }, {
  2850. token : "paren.rparen",
  2851. regex : "[\\]]"
  2852. }, {
  2853. token : "paren.rparen",
  2854. regex : "[\\)\\}]",
  2855. next : "pop"
  2856. }],
  2857. variables: [{
  2858. token : "variable",
  2859. regex : /(\$)(\w+)/
  2860. }, {
  2861. token : ["variable", "paren.lparen"],
  2862. regex : /(\$)(\()/,
  2863. push : "start"
  2864. }, {
  2865. token : ["variable", "paren.lparen", "keyword.operator", "variable", "keyword.operator"],
  2866. regex : /(\$)(\{)([#!]?)(\w+|[*@#?\-$!0_])(:[?+\-=]?|##?|%%?|,,?\/|\^\^?)?/,
  2867. push : "start"
  2868. }, {
  2869. token : "variable",
  2870. regex : /\$[*@#?\-$!0_]/
  2871. }, {
  2872. token : ["variable", "paren.lparen"],
  2873. regex : /(\$)(\{)/,
  2874. push : "start"
  2875. }]
  2876. };
  2877. this.normalizeRules();
  2878. };
  2879. oop.inherits(ShHighlightRules, TextHighlightRules);
  2880. exports.ShHighlightRules = ShHighlightRules;
  2881. });
  2882. define("ace/mode/sh",["ace_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(ace_require, exports, module) {
  2883. "use strict";
  2884. var oop = ace_require("../lib/oop");
  2885. var TextMode = ace_require("./text").Mode;
  2886. var ShHighlightRules = ace_require("./sh_highlight_rules").ShHighlightRules;
  2887. var Range = ace_require("../range").Range;
  2888. var CStyleFoldMode = ace_require("./folding/cstyle").FoldMode;
  2889. var CstyleBehaviour = ace_require("./behaviour/cstyle").CstyleBehaviour;
  2890. var Mode = function() {
  2891. this.HighlightRules = ShHighlightRules;
  2892. this.foldingRules = new CStyleFoldMode();
  2893. this.$behaviour = new CstyleBehaviour();
  2894. };
  2895. oop.inherits(Mode, TextMode);
  2896. (function() {
  2897. this.lineCommentStart = "#";
  2898. this.getNextLineIndent = function(state, line, tab) {
  2899. var indent = this.$getIndent(line);
  2900. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  2901. var tokens = tokenizedLine.tokens;
  2902. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  2903. return indent;
  2904. }
  2905. if (state == "start") {
  2906. var match = line.match(/^.*[\{\(\[:]\s*$/);
  2907. if (match) {
  2908. indent += tab;
  2909. }
  2910. }
  2911. return indent;
  2912. };
  2913. var outdents = {
  2914. "pass": 1,
  2915. "return": 1,
  2916. "raise": 1,
  2917. "break": 1,
  2918. "continue": 1
  2919. };
  2920. this.checkOutdent = function(state, line, input) {
  2921. if (input !== "\r\n" && input !== "\r" && input !== "\n")
  2922. return false;
  2923. var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
  2924. if (!tokens)
  2925. return false;
  2926. do {
  2927. var last = tokens.pop();
  2928. } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
  2929. if (!last)
  2930. return false;
  2931. return (last.type == "keyword" && outdents[last.value]);
  2932. };
  2933. this.autoOutdent = function(state, doc, row) {
  2934. row += 1;
  2935. var indent = this.$getIndent(doc.getLine(row));
  2936. var tab = doc.getTabString();
  2937. if (indent.slice(-tab.length) == tab)
  2938. doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
  2939. };
  2940. this.$id = "ace/mode/sh";
  2941. this.snippetFileId = "ace/snippets/sh";
  2942. }).call(Mode.prototype);
  2943. exports.Mode = Mode;
  2944. });
  2945. define("ace/mode/markdown",["ace_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(ace_require, exports, module) {
  2946. "use strict";
  2947. var oop = ace_require("../lib/oop");
  2948. var TextMode = ace_require("./text").Mode;
  2949. var JavaScriptMode = ace_require("./javascript").Mode;
  2950. var XmlMode = ace_require("./xml").Mode;
  2951. var HtmlMode = ace_require("./html").Mode;
  2952. var MarkdownHighlightRules = ace_require("./markdown_highlight_rules").MarkdownHighlightRules;
  2953. var MarkdownFoldMode = ace_require("./folding/markdown").FoldMode;
  2954. var Mode = function() {
  2955. this.HighlightRules = MarkdownHighlightRules;
  2956. this.createModeDelegates({
  2957. javascript: ace_require("./javascript").Mode,
  2958. html: ace_require("./html").Mode,
  2959. bash: ace_require("./sh").Mode,
  2960. sh: ace_require("./sh").Mode,
  2961. xml: ace_require("./xml").Mode,
  2962. css: ace_require("./css").Mode
  2963. });
  2964. this.foldingRules = new MarkdownFoldMode();
  2965. this.$behaviour = this.$defaultBehaviour;
  2966. };
  2967. oop.inherits(Mode, TextMode);
  2968. (function() {
  2969. this.type = "text";
  2970. this.blockComment = {start: "<!--", end: "-->"};
  2971. this.$quotes = {'"': '"', "`": "`"};
  2972. this.getNextLineIndent = function(state, line, tab) {
  2973. if (state == "listblock") {
  2974. var match = /^(\s*)(?:([-+*])|(\d+)\.)(\s+)/.exec(line);
  2975. if (!match)
  2976. return "";
  2977. var marker = match[2];
  2978. if (!marker)
  2979. marker = parseInt(match[3], 10) + 1 + ".";
  2980. return match[1] + marker + match[4];
  2981. } else {
  2982. return this.$getIndent(line);
  2983. }
  2984. };
  2985. this.$id = "ace/mode/markdown";
  2986. this.snippetFileId = "ace/snippets/markdown";
  2987. }).call(Mode.prototype);
  2988. exports.Mode = Mode;
  2989. });
  2990. define("ace/mode/coffee_highlight_rules",["ace_require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(ace_require, exports, module) {
  2991. "use strict";
  2992. var oop = ace_require("../lib/oop");
  2993. var TextHighlightRules = ace_require("./text_highlight_rules").TextHighlightRules;
  2994. oop.inherits(CoffeeHighlightRules, TextHighlightRules);
  2995. function CoffeeHighlightRules() {
  2996. var identifier = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*";
  2997. var keywords = (
  2998. "this|throw|then|try|typeof|super|switch|return|break|by|continue|" +
  2999. "catch|class|in|instanceof|is|isnt|if|else|extends|for|own|" +
  3000. "finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" +
  3001. "or|on|unless|until|and|yes|yield|export|import|default"
  3002. );
  3003. var langConstant = (
  3004. "true|false|null|undefined|NaN|Infinity"
  3005. );
  3006. var illegal = (
  3007. "case|const|function|var|void|with|enum|implements|" +
  3008. "interface|let|package|private|protected|public|static"
  3009. );
  3010. var supportClass = (
  3011. "Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|String|" +
  3012. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
  3013. "SyntaxError|TypeError|URIError|" +
  3014. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  3015. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray"
  3016. );
  3017. var supportFunction = (
  3018. "Math|JSON|isNaN|isFinite|parseInt|parseFloat|encodeURI|" +
  3019. "encodeURIComponent|decodeURI|decodeURIComponent|String|"
  3020. );
  3021. var variableLanguage = (
  3022. "window|arguments|prototype|document"
  3023. );
  3024. var keywordMapper = this.createKeywordMapper({
  3025. "keyword": keywords,
  3026. "constant.language": langConstant,
  3027. "invalid.illegal": illegal,
  3028. "language.support.class": supportClass,
  3029. "language.support.function": supportFunction,
  3030. "variable.language": variableLanguage
  3031. }, "identifier");
  3032. var functionRule = {
  3033. token: ["paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"],
  3034. regex: /(?:(\()((?:"[^")]*?"|'[^')]*?'|\/[^\/)]*?\/|[^()"'\/])*?)(\))(\s*))?([\-=]>)/.source
  3035. };
  3036. var stringEscape = /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)/;
  3037. this.$rules = {
  3038. start : [
  3039. {
  3040. token : "constant.numeric",
  3041. regex : "(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"
  3042. }, {
  3043. stateName: "qdoc",
  3044. token : "string", regex : "'''", next : [
  3045. {token : "string", regex : "'''", next : "start"},
  3046. {token : "constant.language.escape", regex : stringEscape},
  3047. {defaultToken: "string"}
  3048. ]
  3049. }, {
  3050. stateName: "qqdoc",
  3051. token : "string",
  3052. regex : '"""',
  3053. next : [
  3054. {token : "string", regex : '"""', next : "start"},
  3055. {token : "paren.string", regex : '#{', push : "start"},
  3056. {token : "constant.language.escape", regex : stringEscape},
  3057. {defaultToken: "string"}
  3058. ]
  3059. }, {
  3060. stateName: "qstring",
  3061. token : "string", regex : "'", next : [
  3062. {token : "string", regex : "'", next : "start"},
  3063. {token : "constant.language.escape", regex : stringEscape},
  3064. {defaultToken: "string"}
  3065. ]
  3066. }, {
  3067. stateName: "qqstring",
  3068. token : "string.start", regex : '"', next : [
  3069. {token : "string.end", regex : '"', next : "start"},
  3070. {token : "paren.string", regex : '#{', push : "start"},
  3071. {token : "constant.language.escape", regex : stringEscape},
  3072. {defaultToken: "string"}
  3073. ]
  3074. }, {
  3075. stateName: "js",
  3076. token : "string", regex : "`", next : [
  3077. {token : "string", regex : "`", next : "start"},
  3078. {token : "constant.language.escape", regex : stringEscape},
  3079. {defaultToken: "string"}
  3080. ]
  3081. }, {
  3082. regex: "[{}]", onMatch: function(val, state, stack) {
  3083. this.next = "";
  3084. if (val == "{" && stack.length) {
  3085. stack.unshift("start", state);
  3086. return "paren";
  3087. }
  3088. if (val == "}" && stack.length) {
  3089. stack.shift();
  3090. this.next = stack.shift() || "";
  3091. if (this.next.indexOf("string") != -1)
  3092. return "paren.string";
  3093. }
  3094. return "paren";
  3095. }
  3096. }, {
  3097. token : "string.regex",
  3098. regex : "///",
  3099. next : "heregex"
  3100. }, {
  3101. token : "string.regex",
  3102. regex : /(?:\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)(?:[imgy]{0,4})(?!\w)/
  3103. }, {
  3104. token : "comment",
  3105. regex : "###(?!#)",
  3106. next : "comment"
  3107. }, {
  3108. token : "comment",
  3109. regex : "#.*"
  3110. }, {
  3111. token : ["punctuation.operator", "text", "identifier"],
  3112. regex : "(\\.)(\\s*)(" + illegal + ")"
  3113. }, {
  3114. token : "punctuation.operator",
  3115. regex : "\\.{1,3}"
  3116. }, {
  3117. token : ["keyword", "text", "language.support.class",
  3118. "text", "keyword", "text", "language.support.class"],
  3119. regex : "(class)(\\s+)(" + identifier + ")(?:(\\s+)(extends)(\\s+)(" + identifier + "))?"
  3120. }, {
  3121. token : ["entity.name.function", "text", "keyword.operator", "text"].concat(functionRule.token),
  3122. regex : "(" + identifier + ")(\\s*)([=:])(\\s*)" + functionRule.regex
  3123. },
  3124. functionRule,
  3125. {
  3126. token : "variable",
  3127. regex : "@(?:" + identifier + ")?"
  3128. }, {
  3129. token: keywordMapper,
  3130. regex : identifier
  3131. }, {
  3132. token : "punctuation.operator",
  3133. regex : "\\,|\\."
  3134. }, {
  3135. token : "storage.type",
  3136. regex : "[\\-=]>"
  3137. }, {
  3138. token : "keyword.operator",
  3139. regex : "(?:[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|[!*+-=><])"
  3140. }, {
  3141. token : "paren.lparen",
  3142. regex : "[({[]"
  3143. }, {
  3144. token : "paren.rparen",
  3145. regex : "[\\]})]"
  3146. }, {
  3147. token : "text",
  3148. regex : "\\s+"
  3149. }],
  3150. heregex : [{
  3151. token : "string.regex",
  3152. regex : '.*?///[imgy]{0,4}',
  3153. next : "start"
  3154. }, {
  3155. token : "comment.regex",
  3156. regex : "\\s+(?:#.*)?"
  3157. }, {
  3158. token : "string.regex",
  3159. regex : "\\S+"
  3160. }],
  3161. comment : [{
  3162. token : "comment",
  3163. regex : '###',
  3164. next : "start"
  3165. }, {
  3166. defaultToken : "comment"
  3167. }]
  3168. };
  3169. this.normalizeRules();
  3170. }
  3171. exports.CoffeeHighlightRules = CoffeeHighlightRules;
  3172. });
  3173. define("ace/mode/folding/coffee",["ace_require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(ace_require, exports, module) {
  3174. "use strict";
  3175. var oop = ace_require("../../lib/oop");
  3176. var BaseFoldMode = ace_require("./fold_mode").FoldMode;
  3177. var Range = ace_require("../../range").Range;
  3178. var FoldMode = exports.FoldMode = function() {};
  3179. oop.inherits(FoldMode, BaseFoldMode);
  3180. (function() {
  3181. this.getFoldWidgetRange = function(session, foldStyle, row) {
  3182. var range = this.indentationBlock(session, row);
  3183. if (range)
  3184. return range;
  3185. var re = /\S/;
  3186. var line = session.getLine(row);
  3187. var startLevel = line.search(re);
  3188. if (startLevel == -1 || line[startLevel] != "#")
  3189. return;
  3190. var startColumn = line.length;
  3191. var maxRow = session.getLength();
  3192. var startRow = row;
  3193. var endRow = row;
  3194. while (++row < maxRow) {
  3195. line = session.getLine(row);
  3196. var level = line.search(re);
  3197. if (level == -1)
  3198. continue;
  3199. if (line[level] != "#")
  3200. break;
  3201. endRow = row;
  3202. }
  3203. if (endRow > startRow) {
  3204. var endColumn = session.getLine(endRow).length;
  3205. return new Range(startRow, startColumn, endRow, endColumn);
  3206. }
  3207. };
  3208. this.getFoldWidget = function(session, foldStyle, row) {
  3209. var line = session.getLine(row);
  3210. var indent = line.search(/\S/);
  3211. var next = session.getLine(row + 1);
  3212. var prev = session.getLine(row - 1);
  3213. var prevIndent = prev.search(/\S/);
  3214. var nextIndent = next.search(/\S/);
  3215. if (indent == -1) {
  3216. session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
  3217. return "";
  3218. }
  3219. if (prevIndent == -1) {
  3220. if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
  3221. session.foldWidgets[row - 1] = "";
  3222. session.foldWidgets[row + 1] = "";
  3223. return "start";
  3224. }
  3225. } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
  3226. if (session.getLine(row - 2).search(/\S/) == -1) {
  3227. session.foldWidgets[row - 1] = "start";
  3228. session.foldWidgets[row + 1] = "";
  3229. return "";
  3230. }
  3231. }
  3232. if (prevIndent!= -1 && prevIndent < indent)
  3233. session.foldWidgets[row - 1] = "start";
  3234. else
  3235. session.foldWidgets[row - 1] = "";
  3236. if (indent < nextIndent)
  3237. return "start";
  3238. else
  3239. return "";
  3240. };
  3241. }).call(FoldMode.prototype);
  3242. });
  3243. define("ace/mode/coffee",["ace_require","exports","module","ace/mode/coffee_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/coffee","ace/range","ace/mode/text","ace/worker/worker_client","ace/lib/oop"], function(ace_require, exports, module) {
  3244. "use strict";
  3245. var Rules = ace_require("./coffee_highlight_rules").CoffeeHighlightRules;
  3246. var Outdent = ace_require("./matching_brace_outdent").MatchingBraceOutdent;
  3247. var FoldMode = ace_require("./folding/coffee").FoldMode;
  3248. var Range = ace_require("../range").Range;
  3249. var TextMode = ace_require("./text").Mode;
  3250. var WorkerClient = ace_require("../worker/worker_client").WorkerClient;
  3251. var oop = ace_require("../lib/oop");
  3252. function Mode() {
  3253. this.HighlightRules = Rules;
  3254. this.$outdent = new Outdent();
  3255. this.foldingRules = new FoldMode();
  3256. }
  3257. oop.inherits(Mode, TextMode);
  3258. (function() {
  3259. var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|(?:swi|ca)tch(?:\s+[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$|^\s*(else\b\s*)?(?:if|for|while|loop)\b(?!.*\bthen\b)/;
  3260. this.lineCommentStart = "#";
  3261. this.blockComment = {start: "###", end: "###"};
  3262. this.getNextLineIndent = function(state, line, tab) {
  3263. var indent = this.$getIndent(line);
  3264. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  3265. if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
  3266. state === 'start' && indenter.test(line))
  3267. indent += tab;
  3268. return indent;
  3269. };
  3270. this.checkOutdent = function(state, line, input) {
  3271. return this.$outdent.checkOutdent(line, input);
  3272. };
  3273. this.autoOutdent = function(state, doc, row) {
  3274. this.$outdent.autoOutdent(doc, row);
  3275. };
  3276. this.createWorker = function(session) {
  3277. var worker = new WorkerClient(["ace"], "ace/mode/coffee_worker", "Worker");
  3278. worker.attachToDocument(session.getDocument());
  3279. worker.on("annotate", function(e) {
  3280. session.setAnnotations(e.data);
  3281. });
  3282. worker.on("terminate", function() {
  3283. session.clearAnnotations();
  3284. });
  3285. return worker;
  3286. };
  3287. this.$id = "ace/mode/coffee";
  3288. this.snippetFileId = "ace/snippets/coffee";
  3289. }).call(Mode.prototype);
  3290. exports.Mode = Mode;
  3291. });
  3292. define("ace/mode/scss_highlight_rules",["ace_require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/css_highlight_rules"], function(ace_require, exports, module) {
  3293. "use strict";
  3294. var oop = ace_require("../lib/oop");
  3295. var lang = ace_require("../lib/lang");
  3296. var TextHighlightRules = ace_require("./text_highlight_rules").TextHighlightRules;
  3297. var CssHighlightRules = ace_require("./css_highlight_rules");
  3298. var ScssHighlightRules = function() {
  3299. var properties = lang.arrayToMap(CssHighlightRules.supportType.split("|"));
  3300. var functions = lang.arrayToMap(
  3301. ("hsl|hsla|rgb|rgba|url|attr|counter|counters|abs|adjust_color|adjust_hue|" +
  3302. "alpha|join|blue|ceil|change_color|comparable|complement|darken|desaturate|" +
  3303. "floor|grayscale|green|hue|if|invert|join|length|lighten|lightness|mix|" +
  3304. "nth|opacify|opacity|percentage|quote|red|round|saturate|saturation|" +
  3305. "scale_color|transparentize|type_of|unit|unitless|unquote").split("|")
  3306. );
  3307. var constants = lang.arrayToMap(CssHighlightRules.supportConstant.split("|"));
  3308. var colors = lang.arrayToMap(CssHighlightRules.supportConstantColor.split("|"));
  3309. var keywords = lang.arrayToMap(
  3310. ("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|def|end|declare").split("|")
  3311. );
  3312. var tags = lang.arrayToMap(
  3313. ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
  3314. "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
  3315. "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
  3316. "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
  3317. "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
  3318. "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
  3319. "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
  3320. "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
  3321. "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
  3322. );
  3323. var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
  3324. this.$rules = {
  3325. "start" : [
  3326. {
  3327. token : "comment",
  3328. regex : "\\/\\/.*$"
  3329. },
  3330. {
  3331. token : "comment", // multi line comment
  3332. regex : "\\/\\*",
  3333. next : "comment"
  3334. }, {
  3335. token : "string", // single line
  3336. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  3337. }, {
  3338. token : "string", // multi line string start
  3339. regex : '["].*\\\\$',
  3340. next : "qqstring"
  3341. }, {
  3342. token : "string", // single line
  3343. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  3344. }, {
  3345. token : "string", // multi line string start
  3346. regex : "['].*\\\\$",
  3347. next : "qstring"
  3348. }, {
  3349. token : "constant.numeric",
  3350. 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|%)"
  3351. }, {
  3352. token : "constant.numeric", // hex6 color
  3353. regex : "#[a-f0-9]{6}"
  3354. }, {
  3355. token : "constant.numeric", // hex3 color
  3356. regex : "#[a-f0-9]{3}"
  3357. }, {
  3358. token : "constant.numeric",
  3359. regex : numRe
  3360. }, {
  3361. token : ["support.function", "string", "support.function"],
  3362. regex : "(url\\()(.*)(\\))"
  3363. }, {
  3364. token : function(value) {
  3365. if (properties.hasOwnProperty(value.toLowerCase()))
  3366. return "support.type";
  3367. if (keywords.hasOwnProperty(value))
  3368. return "keyword";
  3369. else if (constants.hasOwnProperty(value))
  3370. return "constant.language";
  3371. else if (functions.hasOwnProperty(value))
  3372. return "support.function";
  3373. else if (colors.hasOwnProperty(value.toLowerCase()))
  3374. return "support.constant.color";
  3375. else if (tags.hasOwnProperty(value.toLowerCase()))
  3376. return "variable.language";
  3377. else
  3378. return "text";
  3379. },
  3380. regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
  3381. }, {
  3382. token : "variable",
  3383. regex : "[a-z_\\-$][a-z0-9_\\-$]*\\b"
  3384. }, {
  3385. token: "variable.language",
  3386. regex: "#[a-z0-9-_]+"
  3387. }, {
  3388. token: "variable.language",
  3389. regex: "\\.[a-z0-9-_]+"
  3390. }, {
  3391. token: "variable.language",
  3392. regex: ":[a-z0-9-_]+"
  3393. }, {
  3394. token: "constant",
  3395. regex: "[a-z0-9-_]+"
  3396. }, {
  3397. token : "keyword.operator",
  3398. regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
  3399. }, {
  3400. token : "paren.lparen",
  3401. regex : "[[({]"
  3402. }, {
  3403. token : "paren.rparen",
  3404. regex : "[\\])}]"
  3405. }, {
  3406. token : "text",
  3407. regex : "\\s+"
  3408. }, {
  3409. caseInsensitive: true
  3410. }
  3411. ],
  3412. "comment" : [
  3413. {
  3414. token : "comment", // closing comment
  3415. regex : "\\*\\/",
  3416. next : "start"
  3417. }, {
  3418. defaultToken : "comment"
  3419. }
  3420. ],
  3421. "qqstring" : [
  3422. {
  3423. token : "string",
  3424. regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
  3425. next : "start"
  3426. }, {
  3427. token : "string",
  3428. regex : '.+'
  3429. }
  3430. ],
  3431. "qstring" : [
  3432. {
  3433. token : "string",
  3434. regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
  3435. next : "start"
  3436. }, {
  3437. token : "string",
  3438. regex : '.+'
  3439. }
  3440. ]
  3441. };
  3442. };
  3443. oop.inherits(ScssHighlightRules, TextHighlightRules);
  3444. exports.ScssHighlightRules = ScssHighlightRules;
  3445. });
  3446. define("ace/mode/scss",["ace_require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/scss_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/css","ace/mode/folding/cstyle","ace/mode/css_completions"], function(ace_require, exports, module) {
  3447. "use strict";
  3448. var oop = ace_require("../lib/oop");
  3449. var TextMode = ace_require("./text").Mode;
  3450. var ScssHighlightRules = ace_require("./scss_highlight_rules").ScssHighlightRules;
  3451. var MatchingBraceOutdent = ace_require("./matching_brace_outdent").MatchingBraceOutdent;
  3452. var CssBehaviour = ace_require("./behaviour/css").CssBehaviour;
  3453. var CStyleFoldMode = ace_require("./folding/cstyle").FoldMode;
  3454. var CssCompletions = ace_require("./css_completions").CssCompletions;
  3455. var Mode = function() {
  3456. this.HighlightRules = ScssHighlightRules;
  3457. this.$outdent = new MatchingBraceOutdent();
  3458. this.$behaviour = new CssBehaviour();
  3459. this.$completer = new CssCompletions();
  3460. this.foldingRules = new CStyleFoldMode();
  3461. };
  3462. oop.inherits(Mode, TextMode);
  3463. (function() {
  3464. this.lineCommentStart = "//";
  3465. this.blockComment = {start: "/*", end: "*/"};
  3466. this.getNextLineIndent = function(state, line, tab) {
  3467. var indent = this.$getIndent(line);
  3468. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  3469. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  3470. return indent;
  3471. }
  3472. var match = line.match(/^.*\{\s*$/);
  3473. if (match) {
  3474. indent += tab;
  3475. }
  3476. return indent;
  3477. };
  3478. this.checkOutdent = function(state, line, input) {
  3479. return this.$outdent.checkOutdent(line, input);
  3480. };
  3481. this.autoOutdent = function(state, doc, row) {
  3482. this.$outdent.autoOutdent(doc, row);
  3483. };
  3484. this.getCompletions = function(state, session, pos, prefix) {
  3485. return this.$completer.getCompletions(state, session, pos, prefix);
  3486. };
  3487. this.$id = "ace/mode/scss";
  3488. }).call(Mode.prototype);
  3489. exports.Mode = Mode;
  3490. });
  3491. define("ace/mode/sass_highlight_rules",["ace_require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/scss_highlight_rules"], function(ace_require, exports, module) {
  3492. "use strict";
  3493. var oop = ace_require("../lib/oop");
  3494. var lang = ace_require("../lib/lang");
  3495. var ScssHighlightRules = ace_require("./scss_highlight_rules").ScssHighlightRules;
  3496. var SassHighlightRules = function() {
  3497. ScssHighlightRules.call(this);
  3498. var start = this.$rules.start;
  3499. if (start[1].token == "comment") {
  3500. start.splice(1, 1, {
  3501. onMatch: function(value, currentState, stack) {
  3502. stack.unshift(this.next, -1, value.length - 2, currentState);
  3503. return "comment";
  3504. },
  3505. regex: /^\s*\/\*/,
  3506. next: "comment"
  3507. }, {
  3508. token: "error.invalid",
  3509. regex: "/\\*|[{;}]"
  3510. }, {
  3511. token: "support.type",
  3512. regex: /^\s*:[\w\-]+\s/
  3513. });
  3514. this.$rules.comment = [
  3515. {regex: /^\s*/, onMatch: function(value, currentState, stack) {
  3516. if (stack[1] === -1)
  3517. stack[1] = Math.max(stack[2], value.length - 1);
  3518. if (value.length <= stack[1]) {stack.shift();stack.shift();stack.shift();
  3519. this.next = stack.shift();
  3520. return "text";
  3521. } else {
  3522. this.next = "";
  3523. return "comment";
  3524. }
  3525. }, next: "start"},
  3526. {defaultToken: "comment"}
  3527. ];
  3528. }
  3529. };
  3530. oop.inherits(SassHighlightRules, ScssHighlightRules);
  3531. exports.SassHighlightRules = SassHighlightRules;
  3532. });
  3533. define("ace/mode/sass",["ace_require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sass_highlight_rules","ace/mode/folding/coffee"], function(ace_require, exports, module) {
  3534. "use strict";
  3535. var oop = ace_require("../lib/oop");
  3536. var TextMode = ace_require("./text").Mode;
  3537. var SassHighlightRules = ace_require("./sass_highlight_rules").SassHighlightRules;
  3538. var FoldMode = ace_require("./folding/coffee").FoldMode;
  3539. var Mode = function() {
  3540. this.HighlightRules = SassHighlightRules;
  3541. this.foldingRules = new FoldMode();
  3542. this.$behaviour = this.$defaultBehaviour;
  3543. };
  3544. oop.inherits(Mode, TextMode);
  3545. (function() {
  3546. this.lineCommentStart = "//";
  3547. this.$id = "ace/mode/sass";
  3548. }).call(Mode.prototype);
  3549. exports.Mode = Mode;
  3550. });
  3551. define("ace/mode/less_highlight_rules",["ace_require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/css_highlight_rules"], function(ace_require, exports, module) {
  3552. "use strict";
  3553. var oop = ace_require("../lib/oop");
  3554. var TextHighlightRules = ace_require("./text_highlight_rules").TextHighlightRules;
  3555. var CssHighlightRules = ace_require('./css_highlight_rules');
  3556. var LessHighlightRules = function() {
  3557. var keywordList = "@import|@media|@font-face|@keyframes|@-webkit-keyframes|@supports|" +
  3558. "@charset|@plugin|@namespace|@document|@page|@viewport|@-ms-viewport|" +
  3559. "or|and|when|not";
  3560. var keywords = keywordList.split('|');
  3561. var properties = CssHighlightRules.supportType.split('|');
  3562. var keywordMapper = this.createKeywordMapper({
  3563. "support.constant": CssHighlightRules.supportConstant,
  3564. "keyword": keywordList,
  3565. "support.constant.color": CssHighlightRules.supportConstantColor,
  3566. "support.constant.fonts": CssHighlightRules.supportConstantFonts
  3567. }, "identifier", true);
  3568. var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
  3569. this.$rules = {
  3570. "start" : [
  3571. {
  3572. token : "comment",
  3573. regex : "\\/\\/.*$"
  3574. },
  3575. {
  3576. token : "comment", // multi line comment
  3577. regex : "\\/\\*",
  3578. next : "comment"
  3579. }, {
  3580. token : "string", // single line
  3581. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  3582. }, {
  3583. token : "string", // single line
  3584. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  3585. }, {
  3586. token : ["constant.numeric", "keyword"],
  3587. regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
  3588. }, {
  3589. token : "constant.numeric", // hex6 color
  3590. regex : "#[a-f0-9]{6}"
  3591. }, {
  3592. token : "constant.numeric", // hex3 color
  3593. regex : "#[a-f0-9]{3}"
  3594. }, {
  3595. token : "constant.numeric",
  3596. regex : numRe
  3597. }, {
  3598. token : ["support.function", "paren.lparen", "string", "paren.rparen"],
  3599. regex : "(url)(\\()(.*)(\\))"
  3600. }, {
  3601. token : ["support.function", "paren.lparen"],
  3602. regex : "(:extend|[a-z0-9_\\-]+)(\\()"
  3603. }, {
  3604. token : function(value) {
  3605. if (keywords.indexOf(value.toLowerCase()) > -1)
  3606. return "keyword";
  3607. else
  3608. return "variable";
  3609. },
  3610. regex : "[@\\$][a-z0-9_\\-@\\$]*\\b"
  3611. }, {
  3612. token : "variable",
  3613. regex : "[@\\$]\\{[a-z0-9_\\-@\\$]*\\}"
  3614. }, {
  3615. token : function(first, second) {
  3616. if(properties.indexOf(first.toLowerCase()) > -1) {
  3617. return ["support.type.property", "text"];
  3618. }
  3619. else {
  3620. return ["support.type.unknownProperty", "text"];
  3621. }
  3622. },
  3623. regex : "([a-z0-9-_]+)(\\s*:)"
  3624. }, {
  3625. token : "keyword",
  3626. regex : "&" // special case - always treat as keyword
  3627. }, {
  3628. token : keywordMapper,
  3629. regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
  3630. }, {
  3631. token: "variable.language",
  3632. regex: "#[a-z0-9-_]+"
  3633. }, {
  3634. token: "variable.language",
  3635. regex: "\\.[a-z0-9-_]+"
  3636. }, {
  3637. token: "variable.language",
  3638. regex: ":[a-z_][a-z0-9-_]*"
  3639. }, {
  3640. token: "constant",
  3641. regex: "[a-z0-9-_]+"
  3642. }, {
  3643. token : "keyword.operator",
  3644. regex : "<|>|<=|>=|=|!=|-|%|\\+|\\*"
  3645. }, {
  3646. token : "paren.lparen",
  3647. regex : "[[({]"
  3648. }, {
  3649. token : "paren.rparen",
  3650. regex : "[\\])}]"
  3651. }, {
  3652. token : "text",
  3653. regex : "\\s+"
  3654. }, {
  3655. caseInsensitive: true
  3656. }
  3657. ],
  3658. "comment" : [
  3659. {
  3660. token : "comment", // closing comment
  3661. regex : "\\*\\/",
  3662. next : "start"
  3663. }, {
  3664. defaultToken : "comment"
  3665. }
  3666. ]
  3667. };
  3668. this.normalizeRules();
  3669. };
  3670. oop.inherits(LessHighlightRules, TextHighlightRules);
  3671. exports.LessHighlightRules = LessHighlightRules;
  3672. });
  3673. define("ace/mode/less",["ace_require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/less_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/css","ace/mode/css_completions","ace/mode/folding/cstyle"], function(ace_require, exports, module) {
  3674. "use strict";
  3675. var oop = ace_require("../lib/oop");
  3676. var TextMode = ace_require("./text").Mode;
  3677. var LessHighlightRules = ace_require("./less_highlight_rules").LessHighlightRules;
  3678. var MatchingBraceOutdent = ace_require("./matching_brace_outdent").MatchingBraceOutdent;
  3679. var CssBehaviour = ace_require("./behaviour/css").CssBehaviour;
  3680. var CssCompletions = ace_require("./css_completions").CssCompletions;
  3681. var CStyleFoldMode = ace_require("./folding/cstyle").FoldMode;
  3682. var Mode = function() {
  3683. this.HighlightRules = LessHighlightRules;
  3684. this.$outdent = new MatchingBraceOutdent();
  3685. this.$behaviour = new CssBehaviour();
  3686. this.$completer = new CssCompletions();
  3687. this.foldingRules = new CStyleFoldMode();
  3688. };
  3689. oop.inherits(Mode, TextMode);
  3690. (function() {
  3691. this.lineCommentStart = "//";
  3692. this.blockComment = {start: "/*", end: "*/"};
  3693. this.getNextLineIndent = function(state, line, tab) {
  3694. var indent = this.$getIndent(line);
  3695. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  3696. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  3697. return indent;
  3698. }
  3699. var match = line.match(/^.*\{\s*$/);
  3700. if (match) {
  3701. indent += tab;
  3702. }
  3703. return indent;
  3704. };
  3705. this.checkOutdent = function(state, line, input) {
  3706. return this.$outdent.checkOutdent(line, input);
  3707. };
  3708. this.autoOutdent = function(state, doc, row) {
  3709. this.$outdent.autoOutdent(doc, row);
  3710. };
  3711. this.getCompletions = function(state, session, pos, prefix) {
  3712. return this.$completer.getCompletions("ruleset", session, pos, prefix);
  3713. };
  3714. this.$id = "ace/mode/less";
  3715. }).call(Mode.prototype);
  3716. exports.Mode = Mode;
  3717. });
  3718. define("ace/mode/ruby_highlight_rules",["ace_require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(ace_require, exports, module) {
  3719. "use strict";
  3720. var oop = ace_require("../lib/oop");
  3721. var TextHighlightRules = ace_require("./text_highlight_rules").TextHighlightRules;
  3722. var constantOtherSymbol = exports.constantOtherSymbol = {
  3723. token : "constant.other.symbol.ruby", // symbol
  3724. regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
  3725. };
  3726. var qString = exports.qString = {
  3727. token : "string", // single line
  3728. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  3729. };
  3730. var qqString = exports.qqString = {
  3731. token : "string", // single line
  3732. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  3733. };
  3734. var tString = exports.tString = {
  3735. token : "string", // backtick string
  3736. regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
  3737. };
  3738. var constantNumericHex = exports.constantNumericHex = {
  3739. token : "constant.numeric", // hex
  3740. regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
  3741. };
  3742. var constantNumericFloat = exports.constantNumericFloat = {
  3743. token : "constant.numeric", // float
  3744. regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"
  3745. };
  3746. var instanceVariable = exports.instanceVariable = {
  3747. token : "variable.instance", // instance variable
  3748. regex : "@{1,2}[a-zA-Z_\\d]+"
  3749. };
  3750. var RubyHighlightRules = function() {
  3751. var builtinFunctions = (
  3752. "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
  3753. "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
  3754. "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
  3755. "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
  3756. "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
  3757. "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" +
  3758. "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
  3759. "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
  3760. "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
  3761. "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" +
  3762. "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
  3763. "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
  3764. "raw|readline|readlines|redirect?|request_via_redirect|ace_require|scan|select|" +
  3765. "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" +
  3766. "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" +
  3767. "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" +
  3768. "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" +
  3769. "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" +
  3770. "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" +
  3771. "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" +
  3772. "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" +
  3773. "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" +
  3774. "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" +
  3775. "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" +
  3776. "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
  3777. "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
  3778. "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
  3779. "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" +
  3780. "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
  3781. "has_many|has_one|belongs_to|has_and_belongs_to_many"
  3782. );
  3783. var keywords = (
  3784. "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
  3785. "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
  3786. "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield"
  3787. );
  3788. var buildinConstants = (
  3789. "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
  3790. "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING"
  3791. );
  3792. var builtinVariables = (
  3793. "$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|" +
  3794. "$!|root_url|flash|session|cookies|params|request|response|logger|self"
  3795. );
  3796. var keywordMapper = this.$keywords = this.createKeywordMapper({
  3797. "keyword": keywords,
  3798. "constant.language": buildinConstants,
  3799. "variable.language": builtinVariables,
  3800. "support.function": builtinFunctions,
  3801. "invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
  3802. }, "identifier");
  3803. this.$rules = {
  3804. "start" : [
  3805. {
  3806. token : "comment",
  3807. regex : "#.*$"
  3808. }, {
  3809. token : "comment", // multi line comment
  3810. regex : "^=begin(?:$|\\s.*$)",
  3811. next : "comment"
  3812. }, {
  3813. token : "string.regexp",
  3814. regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
  3815. },
  3816. [{
  3817. regex: "[{}]", onMatch: function(val, state, stack) {
  3818. this.next = val == "{" ? this.nextState : "";
  3819. if (val == "{" && stack.length) {
  3820. stack.unshift("start", state);
  3821. return "paren.lparen";
  3822. }
  3823. if (val == "}" && stack.length) {
  3824. stack.shift();
  3825. this.next = stack.shift();
  3826. if (this.next.indexOf("string") != -1)
  3827. return "paren.end";
  3828. }
  3829. return val == "{" ? "paren.lparen" : "paren.rparen";
  3830. },
  3831. nextState: "start"
  3832. }, {
  3833. token : "string.start",
  3834. regex : /"/,
  3835. push : [{
  3836. token : "constant.language.escape",
  3837. regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
  3838. }, {
  3839. token : "paren.start",
  3840. regex : /#{/,
  3841. push : "start"
  3842. }, {
  3843. token : "string.end",
  3844. regex : /"/,
  3845. next : "pop"
  3846. }, {
  3847. defaultToken: "string"
  3848. }]
  3849. }, {
  3850. token : "string.start",
  3851. regex : /`/,
  3852. push : [{
  3853. token : "constant.language.escape",
  3854. regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
  3855. }, {
  3856. token : "paren.start",
  3857. regex : /#{/,
  3858. push : "start"
  3859. }, {
  3860. token : "string.end",
  3861. regex : /`/,
  3862. next : "pop"
  3863. }, {
  3864. defaultToken: "string"
  3865. }]
  3866. }, {
  3867. token : "string.start",
  3868. regex : /'/,
  3869. push : [{
  3870. token : "constant.language.escape",
  3871. regex : /\\['\\]/
  3872. }, {
  3873. token : "string.end",
  3874. regex : /'/,
  3875. next : "pop"
  3876. }, {
  3877. defaultToken: "string"
  3878. }]
  3879. }],
  3880. {
  3881. token : "text", // namespaces aren't symbols
  3882. regex : "::"
  3883. }, {
  3884. token : "variable.instance", // instance variable
  3885. regex : "@{1,2}[a-zA-Z_\\d]+"
  3886. }, {
  3887. token : "support.class", // class name
  3888. regex : "[A-Z][a-zA-Z_\\d]+"
  3889. },
  3890. constantOtherSymbol,
  3891. constantNumericHex,
  3892. constantNumericFloat,
  3893. {
  3894. token : "constant.language.boolean",
  3895. regex : "(?:true|false)\\b"
  3896. }, {
  3897. token : keywordMapper,
  3898. regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  3899. }, {
  3900. token : "punctuation.separator.key-value",
  3901. regex : "=>"
  3902. }, {
  3903. stateName: "heredoc",
  3904. onMatch : function(value, currentState, stack) {
  3905. var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
  3906. var tokens = value.split(this.splitRegex);
  3907. stack.push(next, tokens[3]);
  3908. return [
  3909. {type:"constant", value: tokens[1]},
  3910. {type:"string", value: tokens[2]},
  3911. {type:"support.class", value: tokens[3]},
  3912. {type:"string", value: tokens[4]}
  3913. ];
  3914. },
  3915. regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)",
  3916. rules: {
  3917. heredoc: [{
  3918. onMatch: function(value, currentState, stack) {
  3919. if (value === stack[1]) {
  3920. stack.shift();
  3921. stack.shift();
  3922. this.next = stack[0] || "start";
  3923. return "support.class";
  3924. }
  3925. this.next = "";
  3926. return "string";
  3927. },
  3928. regex: ".*$",
  3929. next: "start"
  3930. }],
  3931. indentedHeredoc: [{
  3932. token: "string",
  3933. regex: "^ +"
  3934. }, {
  3935. onMatch: function(value, currentState, stack) {
  3936. if (value === stack[1]) {
  3937. stack.shift();
  3938. stack.shift();
  3939. this.next = stack[0] || "start";
  3940. return "support.class";
  3941. }
  3942. this.next = "";
  3943. return "string";
  3944. },
  3945. regex: ".*$",
  3946. next: "start"
  3947. }]
  3948. }
  3949. }, {
  3950. regex : "$",
  3951. token : "empty",
  3952. next : function(currentState, stack) {
  3953. if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
  3954. return stack[0];
  3955. return currentState;
  3956. }
  3957. }, {
  3958. token : "string.character",
  3959. regex : "\\B\\?."
  3960. }, {
  3961. token : "keyword.operator",
  3962. regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
  3963. }, {
  3964. token : "paren.lparen",
  3965. regex : "[[({]"
  3966. }, {
  3967. token : "paren.rparen",
  3968. regex : "[\\])}]"
  3969. }, {
  3970. token : "text",
  3971. regex : "\\s+"
  3972. }
  3973. ],
  3974. "comment" : [
  3975. {
  3976. token : "comment", // closing comment
  3977. regex : "^=end(?:$|\\s.*$)",
  3978. next : "start"
  3979. }, {
  3980. token : "comment", // comment spanning whole line
  3981. regex : ".+"
  3982. }
  3983. ]
  3984. };
  3985. this.normalizeRules();
  3986. };
  3987. oop.inherits(RubyHighlightRules, TextHighlightRules);
  3988. exports.RubyHighlightRules = RubyHighlightRules;
  3989. });
  3990. define("ace/mode/ruby",["ace_require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/coffee"], function(ace_require, exports, module) {
  3991. "use strict";
  3992. var oop = ace_require("../lib/oop");
  3993. var TextMode = ace_require("./text").Mode;
  3994. var RubyHighlightRules = ace_require("./ruby_highlight_rules").RubyHighlightRules;
  3995. var MatchingBraceOutdent = ace_require("./matching_brace_outdent").MatchingBraceOutdent;
  3996. var Range = ace_require("../range").Range;
  3997. var CstyleBehaviour = ace_require("./behaviour/cstyle").CstyleBehaviour;
  3998. var FoldMode = ace_require("./folding/coffee").FoldMode;
  3999. var Mode = function() {
  4000. this.HighlightRules = RubyHighlightRules;
  4001. this.$outdent = new MatchingBraceOutdent();
  4002. this.$behaviour = new CstyleBehaviour();
  4003. this.foldingRules = new FoldMode();
  4004. };
  4005. oop.inherits(Mode, TextMode);
  4006. (function() {
  4007. this.lineCommentStart = "#";
  4008. this.getNextLineIndent = function(state, line, tab) {
  4009. var indent = this.$getIndent(line);
  4010. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  4011. var tokens = tokenizedLine.tokens;
  4012. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  4013. return indent;
  4014. }
  4015. if (state == "start") {
  4016. var match = line.match(/^.*[\{\(\[]\s*$/);
  4017. var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/);
  4018. var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/);
  4019. var startingConditional = line.match(/^\s*(if|else|when)\s*/);
  4020. if (match || startingClassOrMethod || startingDoBlock || startingConditional) {
  4021. indent += tab;
  4022. }
  4023. }
  4024. return indent;
  4025. };
  4026. this.checkOutdent = function(state, line, input) {
  4027. return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input);
  4028. };
  4029. this.autoOutdent = function(state, session, row) {
  4030. var line = session.getLine(row);
  4031. if (/}/.test(line))
  4032. return this.$outdent.autoOutdent(session, row);
  4033. var indent = this.$getIndent(line);
  4034. var prevLine = session.getLine(row - 1);
  4035. var prevIndent = this.$getIndent(prevLine);
  4036. var tab = session.getTabString();
  4037. if (prevIndent.length <= indent.length) {
  4038. if (indent.slice(-tab.length) == tab)
  4039. session.remove(new Range(row, indent.length-tab.length, row, indent.length));
  4040. }
  4041. };
  4042. this.$id = "ace/mode/ruby";
  4043. this.snippetFileId = "ace/snippets/ruby";
  4044. }).call(Mode.prototype);
  4045. exports.Mode = Mode;
  4046. });
  4047. define("ace/mode/slim",["ace_require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/slim_highlight_rules","ace/mode/javascript","ace/mode/markdown","ace/mode/coffee","ace/mode/scss","ace/mode/sass","ace/mode/less","ace/mode/ruby","ace/mode/css"], function(ace_require, exports, module) {
  4048. "use strict";
  4049. var oop = ace_require("../lib/oop");
  4050. var TextMode = ace_require("./text").Mode;
  4051. var SlimHighlightRules = ace_require("./slim_highlight_rules").SlimHighlightRules;
  4052. var Mode = function() {
  4053. TextMode.call(this);
  4054. this.HighlightRules = SlimHighlightRules;
  4055. this.createModeDelegates({
  4056. javascript: ace_require("./javascript").Mode,
  4057. markdown: ace_require("./markdown").Mode,
  4058. coffee: ace_require("./coffee").Mode,
  4059. scss: ace_require("./scss").Mode,
  4060. sass: ace_require("./sass").Mode,
  4061. less: ace_require("./less").Mode,
  4062. ruby: ace_require("./ruby").Mode,
  4063. css: ace_require("./css").Mode
  4064. });
  4065. };
  4066. oop.inherits(Mode, TextMode);
  4067. (function() {
  4068. this.$id = "ace/mode/slim";
  4069. }).call(Mode.prototype);
  4070. exports.Mode = Mode;
  4071. }); (function() {
  4072. window.ace_require(["ace/mode/slim"], function(m) {
  4073. if (typeof module == "object" && typeof exports == "object" && module) {
  4074. module.exports = m;
  4075. }
  4076. });
  4077. })();