5942132f70c16bc9fb88661d9b60afb4.js 198 KB

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