83696cff554477b379cd3027386840ed.js 164 KB

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