d52896296e342d88ba80d738b00e902e.js 204 KB

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