b0c095d08205e8f4a04e611ba963a819.js 199 KB

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