worker-php.js 148 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302
  1. "no use strict";
  2. ;(function(window) {
  3. if (typeof window.window != "undefined" && window.document)
  4. return;
  5. if (window.require && window.define)
  6. return;
  7. if (!window.console) {
  8. window.console = function() {
  9. var msgs = Array.prototype.slice.call(arguments, 0);
  10. postMessage({type: "log", data: msgs});
  11. };
  12. window.console.error =
  13. window.console.warn =
  14. window.console.log =
  15. window.console.trace = window.console;
  16. }
  17. window.window = window;
  18. window.ace = window;
  19. window.onerror = function(message, file, line, col, err) {
  20. postMessage({type: "error", data: {
  21. message: message,
  22. data: err.data,
  23. file: file,
  24. line: line,
  25. col: col,
  26. stack: err.stack
  27. }});
  28. };
  29. window.normalizeModule = function(parentId, moduleName) {
  30. // normalize plugin requires
  31. if (moduleName.indexOf("!") !== -1) {
  32. var chunks = moduleName.split("!");
  33. return window.normalizeModule(parentId, chunks[0]) + "!" + window.normalizeModule(parentId, chunks[1]);
  34. }
  35. // normalize relative requires
  36. if (moduleName.charAt(0) == ".") {
  37. var base = parentId.split("/").slice(0, -1).join("/");
  38. moduleName = (base ? base + "/" : "") + moduleName;
  39. while (moduleName.indexOf(".") !== -1 && previous != moduleName) {
  40. var previous = moduleName;
  41. moduleName = moduleName.replace(/^\.\//, "").replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
  42. }
  43. }
  44. return moduleName;
  45. };
  46. window.require = function require(parentId, id) {
  47. if (!id) {
  48. id = parentId;
  49. parentId = null;
  50. }
  51. if (!id.charAt)
  52. throw new Error("worker.js require() accepts only (parentId, id) as arguments");
  53. id = window.normalizeModule(parentId, id);
  54. var module = window.require.modules[id];
  55. if (module) {
  56. if (!module.initialized) {
  57. module.initialized = true;
  58. module.exports = module.factory().exports;
  59. }
  60. return module.exports;
  61. }
  62. if (!window.require.tlns)
  63. return console.log("unable to load " + id);
  64. var path = resolveModuleId(id, window.require.tlns);
  65. if (path.slice(-3) != ".js") path += ".js";
  66. window.require.id = id;
  67. window.require.modules[id] = {}; // prevent infinite loop on broken modules
  68. importScripts(path);
  69. return window.require(parentId, id);
  70. };
  71. function resolveModuleId(id, paths) {
  72. var testPath = id, tail = "";
  73. while (testPath) {
  74. var alias = paths[testPath];
  75. if (typeof alias == "string") {
  76. return alias + tail;
  77. } else if (alias) {
  78. return alias.location.replace(/\/*$/, "/") + (tail || alias.main || alias.name);
  79. } else if (alias === false) {
  80. return "";
  81. }
  82. var i = testPath.lastIndexOf("/");
  83. if (i === -1) break;
  84. tail = testPath.substr(i) + tail;
  85. testPath = testPath.slice(0, i);
  86. }
  87. return id;
  88. }
  89. window.require.modules = {};
  90. window.require.tlns = {};
  91. window.define = function(id, deps, factory) {
  92. if (arguments.length == 2) {
  93. factory = deps;
  94. if (typeof id != "string") {
  95. deps = id;
  96. id = window.require.id;
  97. }
  98. } else if (arguments.length == 1) {
  99. factory = id;
  100. deps = [];
  101. id = window.require.id;
  102. }
  103. if (typeof factory != "function") {
  104. window.require.modules[id] = {
  105. exports: factory,
  106. initialized: true
  107. };
  108. return;
  109. }
  110. if (!deps.length)
  111. // If there is no dependencies, we inject "require", "exports" and
  112. // "module" as dependencies, to provide CommonJS compatibility.
  113. deps = ["require", "exports", "module"];
  114. var req = function(childId) {
  115. return window.require(id, childId);
  116. };
  117. window.require.modules[id] = {
  118. exports: {},
  119. factory: function() {
  120. var module = this;
  121. var returnExports = factory.apply(this, deps.map(function(dep) {
  122. switch (dep) {
  123. // Because "require", "exports" and "module" aren't actual
  124. // dependencies, we must handle them seperately.
  125. case "require": return req;
  126. case "exports": return module.exports;
  127. case "module": return module;
  128. // But for all other dependencies, we can just go ahead and
  129. // require them.
  130. default: return req(dep);
  131. }
  132. }));
  133. if (returnExports)
  134. module.exports = returnExports;
  135. return module;
  136. }
  137. };
  138. };
  139. window.define.amd = {};
  140. require.tlns = {};
  141. window.initBaseUrls = function initBaseUrls(topLevelNamespaces) {
  142. for (var i in topLevelNamespaces)
  143. require.tlns[i] = topLevelNamespaces[i];
  144. };
  145. window.initSender = function initSender() {
  146. var EventEmitter = window.require("ace/lib/event_emitter").EventEmitter;
  147. var oop = window.require("ace/lib/oop");
  148. var Sender = function() {};
  149. (function() {
  150. oop.implement(this, EventEmitter);
  151. this.callback = function(data, callbackId) {
  152. postMessage({
  153. type: "call",
  154. id: callbackId,
  155. data: data
  156. });
  157. };
  158. this.emit = function(name, data) {
  159. postMessage({
  160. type: "event",
  161. name: name,
  162. data: data
  163. });
  164. };
  165. }).call(Sender.prototype);
  166. return new Sender();
  167. };
  168. var main = window.main = null;
  169. var sender = window.sender = null;
  170. window.onmessage = function(e) {
  171. var msg = e.data;
  172. if (msg.event && sender) {
  173. sender._signal(msg.event, msg.data);
  174. }
  175. else if (msg.command) {
  176. if (main[msg.command])
  177. main[msg.command].apply(main, msg.args);
  178. else if (window[msg.command])
  179. window[msg.command].apply(window, msg.args);
  180. else
  181. throw new Error("Unknown command:" + msg.command);
  182. }
  183. else if (msg.init) {
  184. window.initBaseUrls(msg.tlns);
  185. require("ace/lib/es5-shim");
  186. sender = window.sender = window.initSender();
  187. var clazz = require(msg.module)[msg.classname];
  188. main = window.main = new clazz(sender);
  189. }
  190. };
  191. })(this);
  192. ace.define("ace/lib/oop",["require","exports","module"], function(require, exports, module) {
  193. "use strict";
  194. exports.inherits = function(ctor, superCtor) {
  195. ctor.super_ = superCtor;
  196. ctor.prototype = Object.create(superCtor.prototype, {
  197. constructor: {
  198. value: ctor,
  199. enumerable: false,
  200. writable: true,
  201. configurable: true
  202. }
  203. });
  204. };
  205. exports.mixin = function(obj, mixin) {
  206. for (var key in mixin) {
  207. obj[key] = mixin[key];
  208. }
  209. return obj;
  210. };
  211. exports.implement = function(proto, mixin) {
  212. exports.mixin(proto, mixin);
  213. };
  214. });
  215. ace.define("ace/range",["require","exports","module"], function(require, exports, module) {
  216. "use strict";
  217. var comparePoints = function(p1, p2) {
  218. return p1.row - p2.row || p1.column - p2.column;
  219. };
  220. var Range = function(startRow, startColumn, endRow, endColumn) {
  221. this.start = {
  222. row: startRow,
  223. column: startColumn
  224. };
  225. this.end = {
  226. row: endRow,
  227. column: endColumn
  228. };
  229. };
  230. (function() {
  231. this.isEqual = function(range) {
  232. return this.start.row === range.start.row &&
  233. this.end.row === range.end.row &&
  234. this.start.column === range.start.column &&
  235. this.end.column === range.end.column;
  236. };
  237. this.toString = function() {
  238. return ("Range: [" + this.start.row + "/" + this.start.column +
  239. "] -> [" + this.end.row + "/" + this.end.column + "]");
  240. };
  241. this.contains = function(row, column) {
  242. return this.compare(row, column) == 0;
  243. };
  244. this.compareRange = function(range) {
  245. var cmp,
  246. end = range.end,
  247. start = range.start;
  248. cmp = this.compare(end.row, end.column);
  249. if (cmp == 1) {
  250. cmp = this.compare(start.row, start.column);
  251. if (cmp == 1) {
  252. return 2;
  253. } else if (cmp == 0) {
  254. return 1;
  255. } else {
  256. return 0;
  257. }
  258. } else if (cmp == -1) {
  259. return -2;
  260. } else {
  261. cmp = this.compare(start.row, start.column);
  262. if (cmp == -1) {
  263. return -1;
  264. } else if (cmp == 1) {
  265. return 42;
  266. } else {
  267. return 0;
  268. }
  269. }
  270. };
  271. this.comparePoint = function(p) {
  272. return this.compare(p.row, p.column);
  273. };
  274. this.containsRange = function(range) {
  275. return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
  276. };
  277. this.intersects = function(range) {
  278. var cmp = this.compareRange(range);
  279. return (cmp == -1 || cmp == 0 || cmp == 1);
  280. };
  281. this.isEnd = function(row, column) {
  282. return this.end.row == row && this.end.column == column;
  283. };
  284. this.isStart = function(row, column) {
  285. return this.start.row == row && this.start.column == column;
  286. };
  287. this.setStart = function(row, column) {
  288. if (typeof row == "object") {
  289. this.start.column = row.column;
  290. this.start.row = row.row;
  291. } else {
  292. this.start.row = row;
  293. this.start.column = column;
  294. }
  295. };
  296. this.setEnd = function(row, column) {
  297. if (typeof row == "object") {
  298. this.end.column = row.column;
  299. this.end.row = row.row;
  300. } else {
  301. this.end.row = row;
  302. this.end.column = column;
  303. }
  304. };
  305. this.inside = function(row, column) {
  306. if (this.compare(row, column) == 0) {
  307. if (this.isEnd(row, column) || this.isStart(row, column)) {
  308. return false;
  309. } else {
  310. return true;
  311. }
  312. }
  313. return false;
  314. };
  315. this.insideStart = function(row, column) {
  316. if (this.compare(row, column) == 0) {
  317. if (this.isEnd(row, column)) {
  318. return false;
  319. } else {
  320. return true;
  321. }
  322. }
  323. return false;
  324. };
  325. this.insideEnd = function(row, column) {
  326. if (this.compare(row, column) == 0) {
  327. if (this.isStart(row, column)) {
  328. return false;
  329. } else {
  330. return true;
  331. }
  332. }
  333. return false;
  334. };
  335. this.compare = function(row, column) {
  336. if (!this.isMultiLine()) {
  337. if (row === this.start.row) {
  338. return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
  339. }
  340. }
  341. if (row < this.start.row)
  342. return -1;
  343. if (row > this.end.row)
  344. return 1;
  345. if (this.start.row === row)
  346. return column >= this.start.column ? 0 : -1;
  347. if (this.end.row === row)
  348. return column <= this.end.column ? 0 : 1;
  349. return 0;
  350. };
  351. this.compareStart = function(row, column) {
  352. if (this.start.row == row && this.start.column == column) {
  353. return -1;
  354. } else {
  355. return this.compare(row, column);
  356. }
  357. };
  358. this.compareEnd = function(row, column) {
  359. if (this.end.row == row && this.end.column == column) {
  360. return 1;
  361. } else {
  362. return this.compare(row, column);
  363. }
  364. };
  365. this.compareInside = function(row, column) {
  366. if (this.end.row == row && this.end.column == column) {
  367. return 1;
  368. } else if (this.start.row == row && this.start.column == column) {
  369. return -1;
  370. } else {
  371. return this.compare(row, column);
  372. }
  373. };
  374. this.clipRows = function(firstRow, lastRow) {
  375. if (this.end.row > lastRow)
  376. var end = {row: lastRow + 1, column: 0};
  377. else if (this.end.row < firstRow)
  378. var end = {row: firstRow, column: 0};
  379. if (this.start.row > lastRow)
  380. var start = {row: lastRow + 1, column: 0};
  381. else if (this.start.row < firstRow)
  382. var start = {row: firstRow, column: 0};
  383. return Range.fromPoints(start || this.start, end || this.end);
  384. };
  385. this.extend = function(row, column) {
  386. var cmp = this.compare(row, column);
  387. if (cmp == 0)
  388. return this;
  389. else if (cmp == -1)
  390. var start = {row: row, column: column};
  391. else
  392. var end = {row: row, column: column};
  393. return Range.fromPoints(start || this.start, end || this.end);
  394. };
  395. this.isEmpty = function() {
  396. return (this.start.row === this.end.row && this.start.column === this.end.column);
  397. };
  398. this.isMultiLine = function() {
  399. return (this.start.row !== this.end.row);
  400. };
  401. this.clone = function() {
  402. return Range.fromPoints(this.start, this.end);
  403. };
  404. this.collapseRows = function() {
  405. if (this.end.column == 0)
  406. return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
  407. else
  408. return new Range(this.start.row, 0, this.end.row, 0)
  409. };
  410. this.toScreenRange = function(session) {
  411. var screenPosStart = session.documentToScreenPosition(this.start);
  412. var screenPosEnd = session.documentToScreenPosition(this.end);
  413. return new Range(
  414. screenPosStart.row, screenPosStart.column,
  415. screenPosEnd.row, screenPosEnd.column
  416. );
  417. };
  418. this.moveBy = function(row, column) {
  419. this.start.row += row;
  420. this.start.column += column;
  421. this.end.row += row;
  422. this.end.column += column;
  423. };
  424. }).call(Range.prototype);
  425. Range.fromPoints = function(start, end) {
  426. return new Range(start.row, start.column, end.row, end.column);
  427. };
  428. Range.comparePoints = comparePoints;
  429. Range.comparePoints = function(p1, p2) {
  430. return p1.row - p2.row || p1.column - p2.column;
  431. };
  432. exports.Range = Range;
  433. });
  434. ace.define("ace/apply_delta",["require","exports","module"], function(require, exports, module) {
  435. "use strict";
  436. function throwDeltaError(delta, errorText){
  437. console.log("Invalid Delta:", delta);
  438. throw "Invalid Delta: " + errorText;
  439. }
  440. function positionInDocument(docLines, position) {
  441. return position.row >= 0 && position.row < docLines.length &&
  442. position.column >= 0 && position.column <= docLines[position.row].length;
  443. }
  444. function validateDelta(docLines, delta) {
  445. if (delta.action != "insert" && delta.action != "remove")
  446. throwDeltaError(delta, "delta.action must be 'insert' or 'remove'");
  447. if (!(delta.lines instanceof Array))
  448. throwDeltaError(delta, "delta.lines must be an Array");
  449. if (!delta.start || !delta.end)
  450. throwDeltaError(delta, "delta.start/end must be an present");
  451. var start = delta.start;
  452. if (!positionInDocument(docLines, delta.start))
  453. throwDeltaError(delta, "delta.start must be contained in document");
  454. var end = delta.end;
  455. if (delta.action == "remove" && !positionInDocument(docLines, end))
  456. throwDeltaError(delta, "delta.end must contained in document for 'remove' actions");
  457. var numRangeRows = end.row - start.row;
  458. var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0));
  459. if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars)
  460. throwDeltaError(delta, "delta.range must match delta lines");
  461. }
  462. exports.applyDelta = function(docLines, delta, doNotValidate) {
  463. var row = delta.start.row;
  464. var startColumn = delta.start.column;
  465. var line = docLines[row] || "";
  466. switch (delta.action) {
  467. case "insert":
  468. var lines = delta.lines;
  469. if (lines.length === 1) {
  470. docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn);
  471. } else {
  472. var args = [row, 1].concat(delta.lines);
  473. docLines.splice.apply(docLines, args);
  474. docLines[row] = line.substring(0, startColumn) + docLines[row];
  475. docLines[row + delta.lines.length - 1] += line.substring(startColumn);
  476. }
  477. break;
  478. case "remove":
  479. var endColumn = delta.end.column;
  480. var endRow = delta.end.row;
  481. if (row === endRow) {
  482. docLines[row] = line.substring(0, startColumn) + line.substring(endColumn);
  483. } else {
  484. docLines.splice(
  485. row, endRow - row + 1,
  486. line.substring(0, startColumn) + docLines[endRow].substring(endColumn)
  487. );
  488. }
  489. break;
  490. }
  491. }
  492. });
  493. ace.define("ace/lib/event_emitter",["require","exports","module"], function(require, exports, module) {
  494. "use strict";
  495. var EventEmitter = {};
  496. var stopPropagation = function() { this.propagationStopped = true; };
  497. var preventDefault = function() { this.defaultPrevented = true; };
  498. EventEmitter._emit =
  499. EventEmitter._dispatchEvent = function(eventName, e) {
  500. this._eventRegistry || (this._eventRegistry = {});
  501. this._defaultHandlers || (this._defaultHandlers = {});
  502. var listeners = this._eventRegistry[eventName] || [];
  503. var defaultHandler = this._defaultHandlers[eventName];
  504. if (!listeners.length && !defaultHandler)
  505. return;
  506. if (typeof e != "object" || !e)
  507. e = {};
  508. if (!e.type)
  509. e.type = eventName;
  510. if (!e.stopPropagation)
  511. e.stopPropagation = stopPropagation;
  512. if (!e.preventDefault)
  513. e.preventDefault = preventDefault;
  514. listeners = listeners.slice();
  515. for (var i=0; i<listeners.length; i++) {
  516. listeners[i](e, this);
  517. if (e.propagationStopped)
  518. break;
  519. }
  520. if (defaultHandler && !e.defaultPrevented)
  521. return defaultHandler(e, this);
  522. };
  523. EventEmitter._signal = function(eventName, e) {
  524. var listeners = (this._eventRegistry || {})[eventName];
  525. if (!listeners)
  526. return;
  527. listeners = listeners.slice();
  528. for (var i=0; i<listeners.length; i++)
  529. listeners[i](e, this);
  530. };
  531. EventEmitter.once = function(eventName, callback) {
  532. var _self = this;
  533. callback && this.addEventListener(eventName, function newCallback() {
  534. _self.removeEventListener(eventName, newCallback);
  535. callback.apply(null, arguments);
  536. });
  537. };
  538. EventEmitter.setDefaultHandler = function(eventName, callback) {
  539. var handlers = this._defaultHandlers
  540. if (!handlers)
  541. handlers = this._defaultHandlers = {_disabled_: {}};
  542. if (handlers[eventName]) {
  543. var old = handlers[eventName];
  544. var disabled = handlers._disabled_[eventName];
  545. if (!disabled)
  546. handlers._disabled_[eventName] = disabled = [];
  547. disabled.push(old);
  548. var i = disabled.indexOf(callback);
  549. if (i != -1)
  550. disabled.splice(i, 1);
  551. }
  552. handlers[eventName] = callback;
  553. };
  554. EventEmitter.removeDefaultHandler = function(eventName, callback) {
  555. var handlers = this._defaultHandlers
  556. if (!handlers)
  557. return;
  558. var disabled = handlers._disabled_[eventName];
  559. if (handlers[eventName] == callback) {
  560. var old = handlers[eventName];
  561. if (disabled)
  562. this.setDefaultHandler(eventName, disabled.pop());
  563. } else if (disabled) {
  564. var i = disabled.indexOf(callback);
  565. if (i != -1)
  566. disabled.splice(i, 1);
  567. }
  568. };
  569. EventEmitter.on =
  570. EventEmitter.addEventListener = function(eventName, callback, capturing) {
  571. this._eventRegistry = this._eventRegistry || {};
  572. var listeners = this._eventRegistry[eventName];
  573. if (!listeners)
  574. listeners = this._eventRegistry[eventName] = [];
  575. if (listeners.indexOf(callback) == -1)
  576. listeners[capturing ? "unshift" : "push"](callback);
  577. return callback;
  578. };
  579. EventEmitter.off =
  580. EventEmitter.removeListener =
  581. EventEmitter.removeEventListener = function(eventName, callback) {
  582. this._eventRegistry = this._eventRegistry || {};
  583. var listeners = this._eventRegistry[eventName];
  584. if (!listeners)
  585. return;
  586. var index = listeners.indexOf(callback);
  587. if (index !== -1)
  588. listeners.splice(index, 1);
  589. };
  590. EventEmitter.removeAllListeners = function(eventName) {
  591. if (this._eventRegistry) this._eventRegistry[eventName] = [];
  592. };
  593. exports.EventEmitter = EventEmitter;
  594. });
  595. ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"], function(require, exports, module) {
  596. "use strict";
  597. var oop = require("./lib/oop");
  598. var EventEmitter = require("./lib/event_emitter").EventEmitter;
  599. var Anchor = exports.Anchor = function(doc, row, column) {
  600. this.$onChange = this.onChange.bind(this);
  601. this.attach(doc);
  602. if (typeof column == "undefined")
  603. this.setPosition(row.row, row.column);
  604. else
  605. this.setPosition(row, column);
  606. };
  607. (function() {
  608. oop.implement(this, EventEmitter);
  609. this.getPosition = function() {
  610. return this.$clipPositionToDocument(this.row, this.column);
  611. };
  612. this.getDocument = function() {
  613. return this.document;
  614. };
  615. this.$insertRight = false;
  616. this.onChange = function(delta) {
  617. if (delta.start.row == delta.end.row && delta.start.row != this.row)
  618. return;
  619. if (delta.start.row > this.row)
  620. return;
  621. var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight);
  622. this.setPosition(point.row, point.column, true);
  623. };
  624. function $pointsInOrder(point1, point2, equalPointsInOrder) {
  625. var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column;
  626. return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter);
  627. }
  628. function $getTransformedPoint(delta, point, moveIfEqual) {
  629. var deltaIsInsert = delta.action == "insert";
  630. var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row);
  631. var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);
  632. var deltaStart = delta.start;
  633. var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range.
  634. if ($pointsInOrder(point, deltaStart, moveIfEqual)) {
  635. return {
  636. row: point.row,
  637. column: point.column
  638. };
  639. }
  640. if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) {
  641. return {
  642. row: point.row + deltaRowShift,
  643. column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0)
  644. };
  645. }
  646. return {
  647. row: deltaStart.row,
  648. column: deltaStart.column
  649. };
  650. }
  651. this.setPosition = function(row, column, noClip) {
  652. var pos;
  653. if (noClip) {
  654. pos = {
  655. row: row,
  656. column: column
  657. };
  658. } else {
  659. pos = this.$clipPositionToDocument(row, column);
  660. }
  661. if (this.row == pos.row && this.column == pos.column)
  662. return;
  663. var old = {
  664. row: this.row,
  665. column: this.column
  666. };
  667. this.row = pos.row;
  668. this.column = pos.column;
  669. this._signal("change", {
  670. old: old,
  671. value: pos
  672. });
  673. };
  674. this.detach = function() {
  675. this.document.removeEventListener("change", this.$onChange);
  676. };
  677. this.attach = function(doc) {
  678. this.document = doc || this.document;
  679. this.document.on("change", this.$onChange);
  680. };
  681. this.$clipPositionToDocument = function(row, column) {
  682. var pos = {};
  683. if (row >= this.document.getLength()) {
  684. pos.row = Math.max(0, this.document.getLength() - 1);
  685. pos.column = this.document.getLine(pos.row).length;
  686. }
  687. else if (row < 0) {
  688. pos.row = 0;
  689. pos.column = 0;
  690. }
  691. else {
  692. pos.row = row;
  693. pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
  694. }
  695. if (column < 0)
  696. pos.column = 0;
  697. return pos;
  698. };
  699. }).call(Anchor.prototype);
  700. });
  701. ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"], function(require, exports, module) {
  702. "use strict";
  703. var oop = require("./lib/oop");
  704. var applyDelta = require("./apply_delta").applyDelta;
  705. var EventEmitter = require("./lib/event_emitter").EventEmitter;
  706. var Range = require("./range").Range;
  707. var Anchor = require("./anchor").Anchor;
  708. var Document = function(textOrLines) {
  709. this.$lines = [""];
  710. if (textOrLines.length === 0) {
  711. this.$lines = [""];
  712. } else if (Array.isArray(textOrLines)) {
  713. this.insertMergedLines({row: 0, column: 0}, textOrLines);
  714. } else {
  715. this.insert({row: 0, column:0}, textOrLines);
  716. }
  717. };
  718. (function() {
  719. oop.implement(this, EventEmitter);
  720. this.setValue = function(text) {
  721. var len = this.getLength() - 1;
  722. this.remove(new Range(0, 0, len, this.getLine(len).length));
  723. this.insert({row: 0, column: 0}, text);
  724. };
  725. this.getValue = function() {
  726. return this.getAllLines().join(this.getNewLineCharacter());
  727. };
  728. this.createAnchor = function(row, column) {
  729. return new Anchor(this, row, column);
  730. };
  731. if ("aaa".split(/a/).length === 0) {
  732. this.$split = function(text) {
  733. return text.replace(/\r\n|\r/g, "\n").split("\n");
  734. };
  735. } else {
  736. this.$split = function(text) {
  737. return text.split(/\r\n|\r|\n/);
  738. };
  739. }
  740. this.$detectNewLine = function(text) {
  741. var match = text.match(/^.*?(\r\n|\r|\n)/m);
  742. this.$autoNewLine = match ? match[1] : "\n";
  743. this._signal("changeNewLineMode");
  744. };
  745. this.getNewLineCharacter = function() {
  746. switch (this.$newLineMode) {
  747. case "windows":
  748. return "\r\n";
  749. case "unix":
  750. return "\n";
  751. default:
  752. return this.$autoNewLine || "\n";
  753. }
  754. };
  755. this.$autoNewLine = "";
  756. this.$newLineMode = "auto";
  757. this.setNewLineMode = function(newLineMode) {
  758. if (this.$newLineMode === newLineMode)
  759. return;
  760. this.$newLineMode = newLineMode;
  761. this._signal("changeNewLineMode");
  762. };
  763. this.getNewLineMode = function() {
  764. return this.$newLineMode;
  765. };
  766. this.isNewLine = function(text) {
  767. return (text == "\r\n" || text == "\r" || text == "\n");
  768. };
  769. this.getLine = function(row) {
  770. return this.$lines[row] || "";
  771. };
  772. this.getLines = function(firstRow, lastRow) {
  773. return this.$lines.slice(firstRow, lastRow + 1);
  774. };
  775. this.getAllLines = function() {
  776. return this.getLines(0, this.getLength());
  777. };
  778. this.getLength = function() {
  779. return this.$lines.length;
  780. };
  781. this.getTextRange = function(range) {
  782. return this.getLinesForRange(range).join(this.getNewLineCharacter());
  783. };
  784. this.getLinesForRange = function(range) {
  785. var lines;
  786. if (range.start.row === range.end.row) {
  787. lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)];
  788. } else {
  789. lines = this.getLines(range.start.row, range.end.row);
  790. lines[0] = (lines[0] || "").substring(range.start.column);
  791. var l = lines.length - 1;
  792. if (range.end.row - range.start.row == l)
  793. lines[l] = lines[l].substring(0, range.end.column);
  794. }
  795. return lines;
  796. };
  797. this.insertLines = function(row, lines) {
  798. console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead.");
  799. return this.insertFullLines(row, lines);
  800. };
  801. this.removeLines = function(firstRow, lastRow) {
  802. console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead.");
  803. return this.removeFullLines(firstRow, lastRow);
  804. };
  805. this.insertNewLine = function(position) {
  806. console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.");
  807. return this.insertMergedLines(position, ["", ""]);
  808. };
  809. this.insert = function(position, text) {
  810. if (this.getLength() <= 1)
  811. this.$detectNewLine(text);
  812. return this.insertMergedLines(position, this.$split(text));
  813. };
  814. this.insertInLine = function(position, text) {
  815. var start = this.clippedPos(position.row, position.column);
  816. var end = this.pos(position.row, position.column + text.length);
  817. this.applyDelta({
  818. start: start,
  819. end: end,
  820. action: "insert",
  821. lines: [text]
  822. }, true);
  823. return this.clonePos(end);
  824. };
  825. this.clippedPos = function(row, column) {
  826. var length = this.getLength();
  827. if (row === undefined) {
  828. row = length;
  829. } else if (row < 0) {
  830. row = 0;
  831. } else if (row >= length) {
  832. row = length - 1;
  833. column = undefined;
  834. }
  835. var line = this.getLine(row);
  836. if (column == undefined)
  837. column = line.length;
  838. column = Math.min(Math.max(column, 0), line.length);
  839. return {row: row, column: column};
  840. };
  841. this.clonePos = function(pos) {
  842. return {row: pos.row, column: pos.column};
  843. };
  844. this.pos = function(row, column) {
  845. return {row: row, column: column};
  846. };
  847. this.$clipPosition = function(position) {
  848. var length = this.getLength();
  849. if (position.row >= length) {
  850. position.row = Math.max(0, length - 1);
  851. position.column = this.getLine(length - 1).length;
  852. } else {
  853. position.row = Math.max(0, position.row);
  854. position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length);
  855. }
  856. return position;
  857. };
  858. this.insertFullLines = function(row, lines) {
  859. row = Math.min(Math.max(row, 0), this.getLength());
  860. var column = 0;
  861. if (row < this.getLength()) {
  862. lines = lines.concat([""]);
  863. column = 0;
  864. } else {
  865. lines = [""].concat(lines);
  866. row--;
  867. column = this.$lines[row].length;
  868. }
  869. this.insertMergedLines({row: row, column: column}, lines);
  870. };
  871. this.insertMergedLines = function(position, lines) {
  872. var start = this.clippedPos(position.row, position.column);
  873. var end = {
  874. row: start.row + lines.length - 1,
  875. column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length
  876. };
  877. this.applyDelta({
  878. start: start,
  879. end: end,
  880. action: "insert",
  881. lines: lines
  882. });
  883. return this.clonePos(end);
  884. };
  885. this.remove = function(range) {
  886. var start = this.clippedPos(range.start.row, range.start.column);
  887. var end = this.clippedPos(range.end.row, range.end.column);
  888. this.applyDelta({
  889. start: start,
  890. end: end,
  891. action: "remove",
  892. lines: this.getLinesForRange({start: start, end: end})
  893. });
  894. return this.clonePos(start);
  895. };
  896. this.removeInLine = function(row, startColumn, endColumn) {
  897. var start = this.clippedPos(row, startColumn);
  898. var end = this.clippedPos(row, endColumn);
  899. this.applyDelta({
  900. start: start,
  901. end: end,
  902. action: "remove",
  903. lines: this.getLinesForRange({start: start, end: end})
  904. }, true);
  905. return this.clonePos(start);
  906. };
  907. this.removeFullLines = function(firstRow, lastRow) {
  908. firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1);
  909. lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1);
  910. var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0;
  911. var deleteLastNewLine = lastRow < this.getLength() - 1;
  912. var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow );
  913. var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 );
  914. var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow );
  915. var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length );
  916. var range = new Range(startRow, startCol, endRow, endCol);
  917. var deletedLines = this.$lines.slice(firstRow, lastRow + 1);
  918. this.applyDelta({
  919. start: range.start,
  920. end: range.end,
  921. action: "remove",
  922. lines: this.getLinesForRange(range)
  923. });
  924. return deletedLines;
  925. };
  926. this.removeNewLine = function(row) {
  927. if (row < this.getLength() - 1 && row >= 0) {
  928. this.applyDelta({
  929. start: this.pos(row, this.getLine(row).length),
  930. end: this.pos(row + 1, 0),
  931. action: "remove",
  932. lines: ["", ""]
  933. });
  934. }
  935. };
  936. this.replace = function(range, text) {
  937. if (!(range instanceof Range))
  938. range = Range.fromPoints(range.start, range.end);
  939. if (text.length === 0 && range.isEmpty())
  940. return range.start;
  941. if (text == this.getTextRange(range))
  942. return range.end;
  943. this.remove(range);
  944. var end;
  945. if (text) {
  946. end = this.insert(range.start, text);
  947. }
  948. else {
  949. end = range.start;
  950. }
  951. return end;
  952. };
  953. this.applyDeltas = function(deltas) {
  954. for (var i=0; i<deltas.length; i++) {
  955. this.applyDelta(deltas[i]);
  956. }
  957. };
  958. this.revertDeltas = function(deltas) {
  959. for (var i=deltas.length-1; i>=0; i--) {
  960. this.revertDelta(deltas[i]);
  961. }
  962. };
  963. this.applyDelta = function(delta, doNotValidate) {
  964. var isInsert = delta.action == "insert";
  965. if (isInsert ? delta.lines.length <= 1 && !delta.lines[0]
  966. : !Range.comparePoints(delta.start, delta.end)) {
  967. return;
  968. }
  969. if (isInsert && delta.lines.length > 20000)
  970. this.$splitAndapplyLargeDelta(delta, 20000);
  971. applyDelta(this.$lines, delta, doNotValidate);
  972. this._signal("change", delta);
  973. };
  974. this.$splitAndapplyLargeDelta = function(delta, MAX) {
  975. var lines = delta.lines;
  976. var l = lines.length;
  977. var row = delta.start.row;
  978. var column = delta.start.column;
  979. var from = 0, to = 0;
  980. do {
  981. from = to;
  982. to += MAX - 1;
  983. var chunk = lines.slice(from, to);
  984. if (to > l) {
  985. delta.lines = chunk;
  986. delta.start.row = row + from;
  987. delta.start.column = column;
  988. break;
  989. }
  990. chunk.push("");
  991. this.applyDelta({
  992. start: this.pos(row + from, column),
  993. end: this.pos(row + to, column = 0),
  994. action: delta.action,
  995. lines: chunk
  996. }, true);
  997. } while(true);
  998. };
  999. this.revertDelta = function(delta) {
  1000. this.applyDelta({
  1001. start: this.clonePos(delta.start),
  1002. end: this.clonePos(delta.end),
  1003. action: (delta.action == "insert" ? "remove" : "insert"),
  1004. lines: delta.lines.slice()
  1005. });
  1006. };
  1007. this.indexToPosition = function(index, startRow) {
  1008. var lines = this.$lines || this.getAllLines();
  1009. var newlineLength = this.getNewLineCharacter().length;
  1010. for (var i = startRow || 0, l = lines.length; i < l; i++) {
  1011. index -= lines[i].length + newlineLength;
  1012. if (index < 0)
  1013. return {row: i, column: index + lines[i].length + newlineLength};
  1014. }
  1015. return {row: l-1, column: lines[l-1].length};
  1016. };
  1017. this.positionToIndex = function(pos, startRow) {
  1018. var lines = this.$lines || this.getAllLines();
  1019. var newlineLength = this.getNewLineCharacter().length;
  1020. var index = 0;
  1021. var row = Math.min(pos.row, lines.length);
  1022. for (var i = startRow || 0; i < row; ++i)
  1023. index += lines[i].length + newlineLength;
  1024. return index + pos.column;
  1025. };
  1026. }).call(Document.prototype);
  1027. exports.Document = Document;
  1028. });
  1029. ace.define("ace/lib/lang",["require","exports","module"], function(require, exports, module) {
  1030. "use strict";
  1031. exports.last = function(a) {
  1032. return a[a.length - 1];
  1033. };
  1034. exports.stringReverse = function(string) {
  1035. return string.split("").reverse().join("");
  1036. };
  1037. exports.stringRepeat = function (string, count) {
  1038. var result = '';
  1039. while (count > 0) {
  1040. if (count & 1)
  1041. result += string;
  1042. if (count >>= 1)
  1043. string += string;
  1044. }
  1045. return result;
  1046. };
  1047. var trimBeginRegexp = /^\s\s*/;
  1048. var trimEndRegexp = /\s\s*$/;
  1049. exports.stringTrimLeft = function (string) {
  1050. return string.replace(trimBeginRegexp, '');
  1051. };
  1052. exports.stringTrimRight = function (string) {
  1053. return string.replace(trimEndRegexp, '');
  1054. };
  1055. exports.copyObject = function(obj) {
  1056. var copy = {};
  1057. for (var key in obj) {
  1058. copy[key] = obj[key];
  1059. }
  1060. return copy;
  1061. };
  1062. exports.copyArray = function(array){
  1063. var copy = [];
  1064. for (var i=0, l=array.length; i<l; i++) {
  1065. if (array[i] && typeof array[i] == "object")
  1066. copy[i] = this.copyObject(array[i]);
  1067. else
  1068. copy[i] = array[i];
  1069. }
  1070. return copy;
  1071. };
  1072. exports.deepCopy = function deepCopy(obj) {
  1073. if (typeof obj !== "object" || !obj)
  1074. return obj;
  1075. var copy;
  1076. if (Array.isArray(obj)) {
  1077. copy = [];
  1078. for (var key = 0; key < obj.length; key++) {
  1079. copy[key] = deepCopy(obj[key]);
  1080. }
  1081. return copy;
  1082. }
  1083. if (Object.prototype.toString.call(obj) !== "[object Object]")
  1084. return obj;
  1085. copy = {};
  1086. for (var key in obj)
  1087. copy[key] = deepCopy(obj[key]);
  1088. return copy;
  1089. };
  1090. exports.arrayToMap = function(arr) {
  1091. var map = {};
  1092. for (var i=0; i<arr.length; i++) {
  1093. map[arr[i]] = 1;
  1094. }
  1095. return map;
  1096. };
  1097. exports.createMap = function(props) {
  1098. var map = Object.create(null);
  1099. for (var i in props) {
  1100. map[i] = props[i];
  1101. }
  1102. return map;
  1103. };
  1104. exports.arrayRemove = function(array, value) {
  1105. for (var i = 0; i <= array.length; i++) {
  1106. if (value === array[i]) {
  1107. array.splice(i, 1);
  1108. }
  1109. }
  1110. };
  1111. exports.escapeRegExp = function(str) {
  1112. return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
  1113. };
  1114. exports.escapeHTML = function(str) {
  1115. return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
  1116. };
  1117. exports.getMatchOffsets = function(string, regExp) {
  1118. var matches = [];
  1119. string.replace(regExp, function(str) {
  1120. matches.push({
  1121. offset: arguments[arguments.length-2],
  1122. length: str.length
  1123. });
  1124. });
  1125. return matches;
  1126. };
  1127. exports.deferredCall = function(fcn) {
  1128. var timer = null;
  1129. var callback = function() {
  1130. timer = null;
  1131. fcn();
  1132. };
  1133. var deferred = function(timeout) {
  1134. deferred.cancel();
  1135. timer = setTimeout(callback, timeout || 0);
  1136. return deferred;
  1137. };
  1138. deferred.schedule = deferred;
  1139. deferred.call = function() {
  1140. this.cancel();
  1141. fcn();
  1142. return deferred;
  1143. };
  1144. deferred.cancel = function() {
  1145. clearTimeout(timer);
  1146. timer = null;
  1147. return deferred;
  1148. };
  1149. deferred.isPending = function() {
  1150. return timer;
  1151. };
  1152. return deferred;
  1153. };
  1154. exports.delayedCall = function(fcn, defaultTimeout) {
  1155. var timer = null;
  1156. var callback = function() {
  1157. timer = null;
  1158. fcn();
  1159. };
  1160. var _self = function(timeout) {
  1161. if (timer == null)
  1162. timer = setTimeout(callback, timeout || defaultTimeout);
  1163. };
  1164. _self.delay = function(timeout) {
  1165. timer && clearTimeout(timer);
  1166. timer = setTimeout(callback, timeout || defaultTimeout);
  1167. };
  1168. _self.schedule = _self;
  1169. _self.call = function() {
  1170. this.cancel();
  1171. fcn();
  1172. };
  1173. _self.cancel = function() {
  1174. timer && clearTimeout(timer);
  1175. timer = null;
  1176. };
  1177. _self.isPending = function() {
  1178. return timer;
  1179. };
  1180. return _self;
  1181. };
  1182. });
  1183. ace.define("ace/worker/mirror",["require","exports","module","ace/range","ace/document","ace/lib/lang"], function(require, exports, module) {
  1184. "use strict";
  1185. var Range = require("../range").Range;
  1186. var Document = require("../document").Document;
  1187. var lang = require("../lib/lang");
  1188. var Mirror = exports.Mirror = function(sender) {
  1189. this.sender = sender;
  1190. var doc = this.doc = new Document("");
  1191. var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
  1192. var _self = this;
  1193. sender.on("change", function(e) {
  1194. var data = e.data;
  1195. if (data[0].start) {
  1196. doc.applyDeltas(data);
  1197. } else {
  1198. for (var i = 0; i < data.length; i += 2) {
  1199. if (Array.isArray(data[i+1])) {
  1200. var d = {action: "insert", start: data[i], lines: data[i+1]};
  1201. } else {
  1202. var d = {action: "remove", start: data[i], end: data[i+1]};
  1203. }
  1204. doc.applyDelta(d, true);
  1205. }
  1206. }
  1207. if (_self.$timeout)
  1208. return deferredUpdate.schedule(_self.$timeout);
  1209. _self.onUpdate();
  1210. });
  1211. };
  1212. (function() {
  1213. this.$timeout = 500;
  1214. this.setTimeout = function(timeout) {
  1215. this.$timeout = timeout;
  1216. };
  1217. this.setValue = function(value) {
  1218. this.doc.setValue(value);
  1219. this.deferredUpdate.schedule(this.$timeout);
  1220. };
  1221. this.getValue = function(callbackId) {
  1222. this.sender.callback(this.doc.getValue(), callbackId);
  1223. };
  1224. this.onUpdate = function() {
  1225. };
  1226. this.isPending = function() {
  1227. return this.deferredUpdate.isPending();
  1228. };
  1229. }).call(Mirror.prototype);
  1230. });
  1231. ace.define("ace/mode/php/php",["require","exports","module"], function(require, exports, module) {
  1232. var PHP = {Constants:{}};
  1233. PHP.Constants.T_INCLUDE = 257;
  1234. PHP.Constants.T_INCLUDE_ONCE = 258;
  1235. PHP.Constants.T_EVAL = 259;
  1236. PHP.Constants.T_REQUIRE = 260;
  1237. PHP.Constants.T_REQUIRE_ONCE = 261;
  1238. PHP.Constants.T_LOGICAL_OR = 262;
  1239. PHP.Constants.T_LOGICAL_XOR = 263;
  1240. PHP.Constants.T_LOGICAL_AND = 264;
  1241. PHP.Constants.T_PRINT = 265;
  1242. PHP.Constants.T_YIELD = 266;
  1243. PHP.Constants.T_DOUBLE_ARROW = 267;
  1244. PHP.Constants.T_YIELD_FROM = 268;
  1245. PHP.Constants.T_PLUS_EQUAL = 269;
  1246. PHP.Constants.T_MINUS_EQUAL = 270;
  1247. PHP.Constants.T_MUL_EQUAL = 271;
  1248. PHP.Constants.T_DIV_EQUAL = 272;
  1249. PHP.Constants.T_CONCAT_EQUAL = 273;
  1250. PHP.Constants.T_MOD_EQUAL = 274;
  1251. PHP.Constants.T_AND_EQUAL = 275;
  1252. PHP.Constants.T_OR_EQUAL = 276;
  1253. PHP.Constants.T_XOR_EQUAL = 277;
  1254. PHP.Constants.T_SL_EQUAL = 278;
  1255. PHP.Constants.T_SR_EQUAL = 279;
  1256. PHP.Constants.T_POW_EQUAL = 280;
  1257. PHP.Constants.T_COALESCE = 281;
  1258. PHP.Constants.T_BOOLEAN_OR = 282;
  1259. PHP.Constants.T_BOOLEAN_AND = 283;
  1260. PHP.Constants.T_IS_EQUAL = 284;
  1261. PHP.Constants.T_IS_NOT_EQUAL = 285;
  1262. PHP.Constants.T_IS_IDENTICAL = 286;
  1263. PHP.Constants.T_IS_NOT_IDENTICAL = 287;
  1264. PHP.Constants.T_SPACESHIP = 288;
  1265. PHP.Constants.T_IS_SMALLER_OR_EQUAL = 289;
  1266. PHP.Constants.T_IS_GREATER_OR_EQUAL = 290;
  1267. PHP.Constants.T_SL = 291;
  1268. PHP.Constants.T_SR = 292;
  1269. PHP.Constants.T_INSTANCEOF = 293;
  1270. PHP.Constants.T_INC = 294;
  1271. PHP.Constants.T_DEC = 295;
  1272. PHP.Constants.T_INT_CAST = 296;
  1273. PHP.Constants.T_DOUBLE_CAST = 297;
  1274. PHP.Constants.T_STRING_CAST = 298;
  1275. PHP.Constants.T_ARRAY_CAST = 299;
  1276. PHP.Constants.T_OBJECT_CAST = 300;
  1277. PHP.Constants.T_BOOL_CAST = 301;
  1278. PHP.Constants.T_UNSET_CAST = 302;
  1279. PHP.Constants.T_POW = 303;
  1280. PHP.Constants.T_NEW = 304;
  1281. PHP.Constants.T_CLONE = 305;
  1282. PHP.Constants.T_EXIT = 306;
  1283. PHP.Constants.T_IF = 307;
  1284. PHP.Constants.T_ELSEIF = 308;
  1285. PHP.Constants.T_ELSE = 309;
  1286. PHP.Constants.T_ENDIF = 310;
  1287. PHP.Constants.T_LNUMBER = 311;
  1288. PHP.Constants.T_DNUMBER = 312;
  1289. PHP.Constants.T_STRING = 313;
  1290. PHP.Constants.T_STRING_VARNAME = 314;
  1291. PHP.Constants.T_VARIABLE = 315;
  1292. PHP.Constants.T_NUM_STRING = 316;
  1293. PHP.Constants.T_INLINE_HTML = 317;
  1294. PHP.Constants.T_CHARACTER = 318;
  1295. PHP.Constants.T_BAD_CHARACTER = 319;
  1296. PHP.Constants.T_ENCAPSED_AND_WHITESPACE = 320;
  1297. PHP.Constants.T_CONSTANT_ENCAPSED_STRING = 321;
  1298. PHP.Constants.T_ECHO = 322;
  1299. PHP.Constants.T_DO = 323;
  1300. PHP.Constants.T_WHILE = 324;
  1301. PHP.Constants.T_ENDWHILE = 325;
  1302. PHP.Constants.T_FOR = 326;
  1303. PHP.Constants.T_ENDFOR = 327;
  1304. PHP.Constants.T_FOREACH = 328;
  1305. PHP.Constants.T_ENDFOREACH = 329;
  1306. PHP.Constants.T_DECLARE = 330;
  1307. PHP.Constants.T_ENDDECLARE = 331;
  1308. PHP.Constants.T_AS = 332;
  1309. PHP.Constants.T_SWITCH = 333;
  1310. PHP.Constants.T_ENDSWITCH = 334;
  1311. PHP.Constants.T_CASE = 335;
  1312. PHP.Constants.T_DEFAULT = 336;
  1313. PHP.Constants.T_BREAK = 337;
  1314. PHP.Constants.T_CONTINUE = 338;
  1315. PHP.Constants.T_GOTO = 339;
  1316. PHP.Constants.T_FUNCTION = 340;
  1317. PHP.Constants.T_CONST = 341;
  1318. PHP.Constants.T_RETURN = 342;
  1319. PHP.Constants.T_TRY = 343;
  1320. PHP.Constants.T_CATCH = 344;
  1321. PHP.Constants.T_FINALLY = 345;
  1322. PHP.Constants.T_THROW = 346;
  1323. PHP.Constants.T_USE = 347;
  1324. PHP.Constants.T_INSTEADOF = 348;
  1325. PHP.Constants.T_GLOBAL = 349;
  1326. PHP.Constants.T_STATIC = 350;
  1327. PHP.Constants.T_ABSTRACT = 351;
  1328. PHP.Constants.T_FINAL = 352;
  1329. PHP.Constants.T_PRIVATE = 353;
  1330. PHP.Constants.T_PROTECTED = 354;
  1331. PHP.Constants.T_PUBLIC = 355;
  1332. PHP.Constants.T_VAR = 356;
  1333. PHP.Constants.T_UNSET = 357;
  1334. PHP.Constants.T_ISSET = 358;
  1335. PHP.Constants.T_EMPTY = 359;
  1336. PHP.Constants.T_HALT_COMPILER = 360;
  1337. PHP.Constants.T_CLASS = 361;
  1338. PHP.Constants.T_TRAIT = 362;
  1339. PHP.Constants.T_INTERFACE = 363;
  1340. PHP.Constants.T_EXTENDS = 364;
  1341. PHP.Constants.T_IMPLEMENTS = 365;
  1342. PHP.Constants.T_OBJECT_OPERATOR = 366;
  1343. PHP.Constants.T_LIST = 367;
  1344. PHP.Constants.T_ARRAY = 368;
  1345. PHP.Constants.T_CALLABLE = 369;
  1346. PHP.Constants.T_CLASS_C = 370;
  1347. PHP.Constants.T_TRAIT_C = 371;
  1348. PHP.Constants.T_METHOD_C = 372;
  1349. PHP.Constants.T_FUNC_C = 373;
  1350. PHP.Constants.T_LINE = 374;
  1351. PHP.Constants.T_FILE = 375;
  1352. PHP.Constants.T_COMMENT = 376;
  1353. PHP.Constants.T_DOC_COMMENT = 377;
  1354. PHP.Constants.T_OPEN_TAG = 378;
  1355. PHP.Constants.T_OPEN_TAG_WITH_ECHO = 379;
  1356. PHP.Constants.T_CLOSE_TAG = 380;
  1357. PHP.Constants.T_WHITESPACE = 381;
  1358. PHP.Constants.T_START_HEREDOC = 382;
  1359. PHP.Constants.T_END_HEREDOC = 383;
  1360. PHP.Constants.T_DOLLAR_OPEN_CURLY_BRACES = 384;
  1361. PHP.Constants.T_CURLY_OPEN = 385;
  1362. PHP.Constants.T_PAAMAYIM_NEKUDOTAYIM = 386;
  1363. PHP.Constants.T_NAMESPACE = 387;
  1364. PHP.Constants.T_NS_C = 388;
  1365. PHP.Constants.T_DIR = 389;
  1366. PHP.Constants.T_NS_SEPARATOR = 390;
  1367. PHP.Constants.T_ELLIPSIS = 391;
  1368. PHP.Lexer = function(src, ini) {
  1369. var heredoc, heredocEndAllowed,
  1370. stateStack = ['INITIAL'], stackPos = 0,
  1371. swapState = function(state) {
  1372. stateStack[stackPos] = state;
  1373. },
  1374. pushState = function(state) {
  1375. stateStack[++stackPos] = state;
  1376. },
  1377. popState = function() {
  1378. --stackPos;
  1379. },
  1380. shortOpenTag = ini === undefined || /^(on|true|1)$/i.test(ini.short_open_tag),
  1381. openTag = shortOpenTag
  1382. ? /^(\<\?php(?:\r\n|[ \t\r\n])|<\?|\<script language\=('|")?php('|")?\>)/i
  1383. : /^(\<\?php(?:\r\n|[ \t\r\n])|\<script language\=('|")?php('|")?\>)/i,
  1384. inlineHtml = shortOpenTag
  1385. ? /[^<]*(?:<(?!\?|script language\=('|")?php('|")?\>)[^<]*)*/i
  1386. : /[^<]*(?:<(?!\?=|\?php[ \t\r\n]|script language\=('|")?php('|")?\>)[^<]*)*/i;
  1387. labelRegexPart = '[a-zA-Z_\\x7f-\\uffff][a-zA-Z0-9_\\x7f-\\uffff]*',
  1388. stringRegexPart = function(quote) {
  1389. return '[^' + quote + '\\\\${]*(?:(?:\\\\[\\s\\S]|\\$(?!\\{|[a-zA-Z_\\x7f-\\uffff])|\\{(?!\\$))[^' + quote + '\\\\${]*)*';
  1390. },
  1391. sharedStringTokens = [
  1392. {
  1393. value: PHP.Constants.T_VARIABLE,
  1394. re: new RegExp('^\\$' + labelRegexPart + '(?=\\[)'),
  1395. func: function() {
  1396. pushState('VAR_OFFSET');
  1397. }
  1398. },
  1399. {
  1400. value: PHP.Constants.T_VARIABLE,
  1401. re: new RegExp('^\\$' + labelRegexPart + '(?=->' + labelRegexPart + ')'),
  1402. func: function() {
  1403. pushState('LOOKING_FOR_PROPERTY');
  1404. }
  1405. },
  1406. {
  1407. value: PHP.Constants.T_DOLLAR_OPEN_CURLY_BRACES,
  1408. re: new RegExp('^\\$\\{(?=' + labelRegexPart + '[\\[}])'),
  1409. func: function() {
  1410. pushState('LOOKING_FOR_VARNAME');
  1411. }
  1412. },
  1413. {
  1414. value: PHP.Constants.T_VARIABLE,
  1415. re: new RegExp('^\\$' + labelRegexPart)
  1416. },
  1417. {
  1418. value: PHP.Constants.T_DOLLAR_OPEN_CURLY_BRACES,
  1419. re: /^\$\{/,
  1420. func: function() {
  1421. pushState('IN_SCRIPTING');
  1422. }
  1423. },
  1424. {
  1425. value: PHP.Constants.T_CURLY_OPEN,
  1426. re: /^\{(?=\$)/,
  1427. func: function() {
  1428. pushState('IN_SCRIPTING');
  1429. }
  1430. }
  1431. ],
  1432. data = {
  1433. 'INITIAL': [
  1434. {
  1435. value: PHP.Constants.T_OPEN_TAG_WITH_ECHO,
  1436. re: /^<\?=/i,
  1437. func: function() {
  1438. swapState('IN_SCRIPTING');
  1439. }
  1440. },
  1441. {
  1442. value: PHP.Constants.T_OPEN_TAG,
  1443. re: openTag,
  1444. func: function() {
  1445. swapState('IN_SCRIPTING');
  1446. }
  1447. },
  1448. {
  1449. value: PHP.Constants.T_INLINE_HTML,
  1450. re: inlineHtml
  1451. },
  1452. ],
  1453. 'IN_SCRIPTING': [
  1454. {
  1455. value: PHP.Constants.T_WHITESPACE,
  1456. re: /^[ \n\r\t]+/
  1457. },
  1458. {
  1459. value: PHP.Constants.T_ABSTRACT,
  1460. re: /^abstract\b/i
  1461. },
  1462. {
  1463. value: PHP.Constants.T_LOGICAL_AND,
  1464. re: /^and\b/i
  1465. },
  1466. {
  1467. value: PHP.Constants.T_ARRAY,
  1468. re: /^array\b/i
  1469. },
  1470. {
  1471. value: PHP.Constants.T_AS,
  1472. re: /^as\b/i
  1473. },
  1474. {
  1475. value: PHP.Constants.T_BREAK,
  1476. re: /^break\b/i
  1477. },
  1478. {
  1479. value: PHP.Constants.T_CALLABLE,
  1480. re: /^callable\b/i
  1481. },
  1482. {
  1483. value: PHP.Constants.T_CASE,
  1484. re: /^case\b/i
  1485. },
  1486. {
  1487. value: PHP.Constants.T_CATCH,
  1488. re: /^catch\b/i
  1489. },
  1490. {
  1491. value: PHP.Constants.T_CLASS,
  1492. re: /^class\b/i,
  1493. },
  1494. {
  1495. value: PHP.Constants.T_CLONE,
  1496. re: /^clone\b/i
  1497. },
  1498. {
  1499. value: PHP.Constants.T_CONST,
  1500. re: /^const\b/i
  1501. },
  1502. {
  1503. value: PHP.Constants.T_CONTINUE,
  1504. re: /^continue\b/i
  1505. },
  1506. {
  1507. value: PHP.Constants.T_DECLARE,
  1508. re: /^declare\b/i
  1509. },
  1510. {
  1511. value: PHP.Constants.T_DEFAULT,
  1512. re: /^default\b/i
  1513. },
  1514. {
  1515. value: PHP.Constants.T_DO,
  1516. re: /^do\b/i
  1517. },
  1518. {
  1519. value: PHP.Constants.T_ECHO,
  1520. re: /^echo\b/i
  1521. },
  1522. {
  1523. value: PHP.Constants.T_ELSE,
  1524. re: /^else\b/i
  1525. },
  1526. {
  1527. value: PHP.Constants.T_ELSEIF,
  1528. re: /^elseif\b/i
  1529. },
  1530. {
  1531. value: PHP.Constants.T_ENDDECLARE,
  1532. re: /^enddeclare\b/i
  1533. },
  1534. {
  1535. value: PHP.Constants.T_ENDFOR,
  1536. re: /^endfor\b/i
  1537. },
  1538. {
  1539. value: PHP.Constants.T_ENDFOREACH,
  1540. re: /^endforeach\b/i
  1541. },
  1542. {
  1543. value: PHP.Constants.T_ENDIF,
  1544. re: /^endif\b/i
  1545. },
  1546. {
  1547. value: PHP.Constants.T_ENDSWITCH,
  1548. re: /^endswitch\b/i
  1549. },
  1550. {
  1551. value: PHP.Constants.T_ENDWHILE,
  1552. re: /^endwhile\b/i
  1553. },
  1554. {
  1555. value: PHP.Constants.T_EMPTY,
  1556. re: /^empty\b/i
  1557. },
  1558. {
  1559. value: PHP.Constants.T_EVAL,
  1560. re: /^eval\b/i
  1561. },
  1562. {
  1563. value: PHP.Constants.T_EXIT,
  1564. re: /^(?:exit|die)\b/i
  1565. },
  1566. {
  1567. value: PHP.Constants.T_EXTENDS,
  1568. re: /^extends\b/i
  1569. },
  1570. {
  1571. value: PHP.Constants.T_FINAL,
  1572. re: /^final\b/i
  1573. },
  1574. {
  1575. value: PHP.Constants.T_FINALLY,
  1576. re: /^finally\b/i
  1577. },
  1578. {
  1579. value: PHP.Constants.T_FOR,
  1580. re: /^for\b/i
  1581. },
  1582. {
  1583. value: PHP.Constants.T_FOREACH,
  1584. re: /^foreach\b/i
  1585. },
  1586. {
  1587. value: PHP.Constants.T_FUNCTION,
  1588. re: /^function\b/i
  1589. },
  1590. {
  1591. value: PHP.Constants.T_GLOBAL,
  1592. re: /^global\b/i
  1593. },
  1594. {
  1595. value: PHP.Constants.T_GOTO,
  1596. re: /^goto\b/i
  1597. },
  1598. {
  1599. value: PHP.Constants.T_IF,
  1600. re: /^if\b/i
  1601. },
  1602. {
  1603. value: PHP.Constants.T_IMPLEMENTS,
  1604. re: /^implements\b/i
  1605. },
  1606. {
  1607. value: PHP.Constants.T_INCLUDE,
  1608. re: /^include\b/i
  1609. },
  1610. {
  1611. value: PHP.Constants.T_INCLUDE_ONCE,
  1612. re: /^include_once\b/i
  1613. },
  1614. {
  1615. value: PHP.Constants.T_INSTANCEOF,
  1616. re: /^instanceof\b/i
  1617. },
  1618. {
  1619. value: PHP.Constants.T_INSTEADOF,
  1620. re: /^insteadof\b/i
  1621. },
  1622. {
  1623. value: PHP.Constants.T_INTERFACE,
  1624. re: /^interface\b/i
  1625. },
  1626. {
  1627. value: PHP.Constants.T_ISSET,
  1628. re: /^isset\b/i
  1629. },
  1630. {
  1631. value: PHP.Constants.T_LIST,
  1632. re: /^list\b/i
  1633. },
  1634. {
  1635. value: PHP.Constants.T_NAMESPACE,
  1636. re: /^namespace\b/i
  1637. },
  1638. {
  1639. value: PHP.Constants.T_NEW,
  1640. re: /^new\b/i
  1641. },
  1642. {
  1643. value: PHP.Constants.T_LOGICAL_OR,
  1644. re: /^or\b/i
  1645. },
  1646. {
  1647. value: PHP.Constants.T_PRINT,
  1648. re: /^print\b/i
  1649. },
  1650. {
  1651. value: PHP.Constants.T_PRIVATE,
  1652. re: /^private\b/i
  1653. },
  1654. {
  1655. value: PHP.Constants.T_PROTECTED,
  1656. re: /^protected\b/i
  1657. },
  1658. {
  1659. value: PHP.Constants.T_PUBLIC,
  1660. re: /^public\b/i
  1661. },
  1662. {
  1663. value: PHP.Constants.T_REQUIRE,
  1664. re: /^require\b/i
  1665. },
  1666. {
  1667. value: PHP.Constants.T_REQUIRE_ONCE,
  1668. re: /^require_once\b/i
  1669. },
  1670. {
  1671. value: PHP.Constants.T_STATIC,
  1672. re: /^static\b/i
  1673. },
  1674. {
  1675. value: PHP.Constants.T_SWITCH,
  1676. re: /^switch\b/i
  1677. },
  1678. {
  1679. value: PHP.Constants.T_THROW,
  1680. re: /^throw\b/i
  1681. },
  1682. {
  1683. value: PHP.Constants.T_TRAIT,
  1684. re: /^trait\b/i,
  1685. },
  1686. {
  1687. value: PHP.Constants.T_TRY,
  1688. re: /^try\b/i
  1689. },
  1690. {
  1691. value: PHP.Constants.T_UNSET,
  1692. re: /^unset\b/i
  1693. },
  1694. {
  1695. value: PHP.Constants.T_USE,
  1696. re: /^use\b/i
  1697. },
  1698. {
  1699. value: PHP.Constants.T_VAR,
  1700. re: /^var\b/i
  1701. },
  1702. {
  1703. value: PHP.Constants.T_WHILE,
  1704. re: /^while\b/i
  1705. },
  1706. {
  1707. value: PHP.Constants.T_LOGICAL_XOR,
  1708. re: /^xor\b/i
  1709. },
  1710. {
  1711. value: PHP.Constants.T_YIELD_FROM,
  1712. re: /^yield\s+from\b/i
  1713. },
  1714. {
  1715. value: PHP.Constants.T_YIELD,
  1716. re: /^yield\b/i
  1717. },
  1718. {
  1719. value: PHP.Constants.T_RETURN,
  1720. re: /^return\b/i
  1721. },
  1722. {
  1723. value: PHP.Constants.T_METHOD_C,
  1724. re: /^__METHOD__\b/i
  1725. },
  1726. {
  1727. value: PHP.Constants.T_LINE,
  1728. re: /^__LINE__\b/i
  1729. },
  1730. {
  1731. value: PHP.Constants.T_FILE,
  1732. re: /^__FILE__\b/i
  1733. },
  1734. {
  1735. value: PHP.Constants.T_FUNC_C,
  1736. re: /^__FUNCTION__\b/i
  1737. },
  1738. {
  1739. value: PHP.Constants.T_NS_C,
  1740. re: /^__NAMESPACE__\b/i
  1741. },
  1742. {
  1743. value: PHP.Constants.T_TRAIT_C,
  1744. re: /^__TRAIT__\b/i
  1745. },
  1746. {
  1747. value: PHP.Constants.T_DIR,
  1748. re: /^__DIR__\b/i
  1749. },
  1750. {
  1751. value: PHP.Constants.T_CLASS_C,
  1752. re: /^__CLASS__\b/i
  1753. },
  1754. {
  1755. value: PHP.Constants.T_AND_EQUAL,
  1756. re: /^&=/
  1757. },
  1758. {
  1759. value: PHP.Constants.T_ARRAY_CAST,
  1760. re: /^\([ \t]*array[ \t]*\)/i
  1761. },
  1762. {
  1763. value: PHP.Constants.T_BOOL_CAST,
  1764. re: /^\([ \t]*(?:bool|boolean)[ \t]*\)/i
  1765. },
  1766. {
  1767. value: PHP.Constants.T_DOUBLE_CAST,
  1768. re: /^\([ \t]*(?:real|float|double)[ \t]*\)/i
  1769. },
  1770. {
  1771. value: PHP.Constants.T_INT_CAST,
  1772. re: /^\([ \t]*(?:int|integer)[ \t]*\)/i
  1773. },
  1774. {
  1775. value: PHP.Constants.T_OBJECT_CAST,
  1776. re: /^\([ \t]*object[ \t]*\)/i
  1777. },
  1778. {
  1779. value: PHP.Constants.T_STRING_CAST,
  1780. re: /^\([ \t]*(?:binary|string)[ \t]*\)/i
  1781. },
  1782. {
  1783. value: PHP.Constants.T_UNSET_CAST,
  1784. re: /^\([ \t]*unset[ \t]*\)/i
  1785. },
  1786. {
  1787. value: PHP.Constants.T_BOOLEAN_AND,
  1788. re: /^&&/
  1789. },
  1790. {
  1791. value: PHP.Constants.T_BOOLEAN_OR,
  1792. re: /^\|\|/
  1793. },
  1794. {
  1795. value: PHP.Constants.T_CLOSE_TAG,
  1796. re: /^(?:\?>|<\/script>)(\r\n|\r|\n)?/i,
  1797. func: function() {
  1798. swapState('INITIAL');
  1799. }
  1800. },
  1801. {
  1802. value: PHP.Constants.T_DOUBLE_ARROW,
  1803. re: /^=>/
  1804. },
  1805. {
  1806. value: PHP.Constants.T_PAAMAYIM_NEKUDOTAYIM,
  1807. re: /^::/
  1808. },
  1809. {
  1810. value: PHP.Constants.T_INC,
  1811. re: /^\+\+/
  1812. },
  1813. {
  1814. value: PHP.Constants.T_DEC,
  1815. re: /^--/
  1816. },
  1817. {
  1818. value: PHP.Constants.T_CONCAT_EQUAL,
  1819. re: /^\.=/
  1820. },
  1821. {
  1822. value: PHP.Constants.T_DIV_EQUAL,
  1823. re: /^\/=/
  1824. },
  1825. {
  1826. value: PHP.Constants.T_XOR_EQUAL,
  1827. re: /^\^=/
  1828. },
  1829. {
  1830. value: PHP.Constants.T_MUL_EQUAL,
  1831. re: /^\*=/
  1832. },
  1833. {
  1834. value: PHP.Constants.T_MOD_EQUAL,
  1835. re: /^%=/
  1836. },
  1837. {
  1838. value: PHP.Constants.T_SL_EQUAL,
  1839. re: /^<<=/
  1840. },
  1841. {
  1842. value: PHP.Constants.T_START_HEREDOC,
  1843. re: new RegExp('^[bB]?<<<[ \\t]*\'(' + labelRegexPart + ')\'(?:\\r\\n|\\r|\\n)'),
  1844. func: function(result) {
  1845. heredoc = result[1];
  1846. swapState('NOWDOC');
  1847. }
  1848. },
  1849. {
  1850. value: PHP.Constants.T_START_HEREDOC,
  1851. re: new RegExp('^[bB]?<<<[ \\t]*("?)(' + labelRegexPart + ')\\1(?:\\r\\n|\\r|\\n)'),
  1852. func: function(result) {
  1853. heredoc = result[2];
  1854. heredocEndAllowed = true;
  1855. swapState('HEREDOC');
  1856. }
  1857. },
  1858. {
  1859. value: PHP.Constants.T_SL,
  1860. re: /^<</
  1861. },
  1862. {
  1863. value: PHP.Constants.T_SPACESHIP,
  1864. re: /^<=>/
  1865. },
  1866. {
  1867. value: PHP.Constants.T_IS_SMALLER_OR_EQUAL,
  1868. re: /^<=/
  1869. },
  1870. {
  1871. value: PHP.Constants.T_SR_EQUAL,
  1872. re: /^>>=/
  1873. },
  1874. {
  1875. value: PHP.Constants.T_SR,
  1876. re: /^>>/
  1877. },
  1878. {
  1879. value: PHP.Constants.T_IS_GREATER_OR_EQUAL,
  1880. re: /^>=/
  1881. },
  1882. {
  1883. value: PHP.Constants.T_OR_EQUAL,
  1884. re: /^\|=/
  1885. },
  1886. {
  1887. value: PHP.Constants.T_PLUS_EQUAL,
  1888. re: /^\+=/
  1889. },
  1890. {
  1891. value: PHP.Constants.T_MINUS_EQUAL,
  1892. re: /^-=/
  1893. },
  1894. {
  1895. value: PHP.Constants.T_OBJECT_OPERATOR,
  1896. re: new RegExp('^->(?=[ \n\r\t]*' + labelRegexPart + ')'),
  1897. func: function() {
  1898. pushState('LOOKING_FOR_PROPERTY');
  1899. }
  1900. },
  1901. {
  1902. value: PHP.Constants.T_OBJECT_OPERATOR,
  1903. re: /^->/i
  1904. },
  1905. {
  1906. value: PHP.Constants.T_ELLIPSIS,
  1907. re: /^\.\.\./
  1908. },
  1909. {
  1910. value: PHP.Constants.T_POW_EQUAL,
  1911. re: /^\*\*=/
  1912. },
  1913. {
  1914. value: PHP.Constants.T_POW,
  1915. re: /^\*\*/
  1916. },
  1917. {
  1918. value: PHP.Constants.T_COALESCE,
  1919. re: /^\?\?/
  1920. },
  1921. {
  1922. value: PHP.Constants.T_COMMENT,
  1923. re: /^\/\*([\S\s]*?)(?:\*\/|$)/
  1924. },
  1925. {
  1926. value: PHP.Constants.T_COMMENT,
  1927. re: /^(?:\/\/|#)[^\r\n?]*(?:\?(?!>)[^\r\n?]*)*(?:\r\n|\r|\n)?/
  1928. },
  1929. {
  1930. value: PHP.Constants.T_IS_IDENTICAL,
  1931. re: /^===/
  1932. },
  1933. {
  1934. value: PHP.Constants.T_IS_EQUAL,
  1935. re: /^==/
  1936. },
  1937. {
  1938. value: PHP.Constants.T_IS_NOT_IDENTICAL,
  1939. re: /^!==/
  1940. },
  1941. {
  1942. value: PHP.Constants.T_IS_NOT_EQUAL,
  1943. re: /^(!=|<>)/
  1944. },
  1945. {
  1946. value: PHP.Constants.T_DNUMBER,
  1947. re: /^(?:[0-9]+\.[0-9]*|\.[0-9]+)(?:[eE][+-]?[0-9]+)?/
  1948. },
  1949. {
  1950. value: PHP.Constants.T_DNUMBER,
  1951. re: /^[0-9]+[eE][+-]?[0-9]+/
  1952. },
  1953. {
  1954. value: PHP.Constants.T_LNUMBER,
  1955. re: /^(?:0x[0-9A-F]+|0b[01]+|[0-9]+)/i
  1956. },
  1957. {
  1958. value: PHP.Constants.T_VARIABLE,
  1959. re: new RegExp('^\\$' + labelRegexPart)
  1960. },
  1961. {
  1962. value: PHP.Constants.T_CONSTANT_ENCAPSED_STRING,
  1963. re: /^[bB]?'[^'\\]*(?:\\[\s\S][^'\\]*)*'/,
  1964. },
  1965. {
  1966. value: PHP.Constants.T_CONSTANT_ENCAPSED_STRING,
  1967. re: new RegExp('^[bB]?"' + stringRegexPart('"') + '"')
  1968. },
  1969. {
  1970. value: -1,
  1971. re: /^[bB]?"/,
  1972. func: function() {
  1973. swapState('DOUBLE_QUOTES');
  1974. }
  1975. },
  1976. {
  1977. value: -1,
  1978. re: /^`/,
  1979. func: function() {
  1980. swapState('BACKTICKS');
  1981. }
  1982. },
  1983. {
  1984. value: PHP.Constants.T_NS_SEPARATOR,
  1985. re: /^\\/
  1986. },
  1987. {
  1988. value: PHP.Constants.T_STRING,
  1989. re: /^[a-zA-Z_\x7f-\uffff][a-zA-Z0-9_\x7f-\uffff]*/
  1990. },
  1991. {
  1992. value: -1,
  1993. re: /^\{/,
  1994. func: function() {
  1995. pushState('IN_SCRIPTING');
  1996. }
  1997. },
  1998. {
  1999. value: -1,
  2000. re: /^\}/,
  2001. func: function() {
  2002. if (stackPos > 0) {
  2003. popState();
  2004. }
  2005. }
  2006. },
  2007. {
  2008. value: -1,
  2009. re: /^[\[\];:?()!.,><=+-/*|&@^%"'$~]/
  2010. }
  2011. ],
  2012. 'DOUBLE_QUOTES': sharedStringTokens.concat([
  2013. {
  2014. value: -1,
  2015. re: /^"/,
  2016. func: function() {
  2017. swapState('IN_SCRIPTING');
  2018. }
  2019. },
  2020. {
  2021. value: PHP.Constants.T_ENCAPSED_AND_WHITESPACE,
  2022. re: new RegExp('^' + stringRegexPart('"'))
  2023. }
  2024. ]),
  2025. 'BACKTICKS': sharedStringTokens.concat([
  2026. {
  2027. value: -1,
  2028. re: /^`/,
  2029. func: function() {
  2030. swapState('IN_SCRIPTING');
  2031. }
  2032. },
  2033. {
  2034. value: PHP.Constants.T_ENCAPSED_AND_WHITESPACE,
  2035. re: new RegExp('^' + stringRegexPart('`'))
  2036. }
  2037. ]),
  2038. 'VAR_OFFSET': [
  2039. {
  2040. value: -1,
  2041. re: /^\]/,
  2042. func: function() {
  2043. popState();
  2044. }
  2045. },
  2046. {
  2047. value: PHP.Constants.T_NUM_STRING,
  2048. re: /^(?:0x[0-9A-F]+|0b[01]+|[0-9]+)/i
  2049. },
  2050. {
  2051. value: PHP.Constants.T_VARIABLE,
  2052. re: new RegExp('^\\$' + labelRegexPart)
  2053. },
  2054. {
  2055. value: PHP.Constants.T_STRING,
  2056. re: new RegExp('^' + labelRegexPart)
  2057. },
  2058. {
  2059. value: -1,
  2060. re: /^[;:,.\[()|^&+-/*=%!~$<>?@{}"`]/
  2061. }
  2062. ],
  2063. 'LOOKING_FOR_PROPERTY': [
  2064. {
  2065. value: PHP.Constants.T_OBJECT_OPERATOR,
  2066. re: /^->/
  2067. },
  2068. {
  2069. value: PHP.Constants.T_STRING,
  2070. re: new RegExp('^' + labelRegexPart),
  2071. func: function() {
  2072. popState();
  2073. }
  2074. },
  2075. {
  2076. value: PHP.Constants.T_WHITESPACE,
  2077. re: /^[ \n\r\t]+/
  2078. }
  2079. ],
  2080. 'LOOKING_FOR_VARNAME': [
  2081. {
  2082. value: PHP.Constants.T_STRING_VARNAME,
  2083. re: new RegExp('^' + labelRegexPart + '(?=[\\[}])'),
  2084. func: function() {
  2085. swapState('IN_SCRIPTING');
  2086. }
  2087. }
  2088. ],
  2089. 'NOWDOC': [
  2090. {
  2091. value: PHP.Constants.T_END_HEREDOC,
  2092. matchFunc: function(src) {
  2093. var re = new RegExp('^' + heredoc + '(?=;?[\\r\\n])');
  2094. if (src.match(re)) {
  2095. return [src.substr(0, heredoc.length)];
  2096. } else {
  2097. return null;
  2098. }
  2099. },
  2100. func: function() {
  2101. swapState('IN_SCRIPTING');
  2102. }
  2103. },
  2104. {
  2105. value: PHP.Constants.T_ENCAPSED_AND_WHITESPACE,
  2106. matchFunc: function(src) {
  2107. var re = new RegExp('[\\r\\n]' + heredoc + '(?=;?[\\r\\n])');
  2108. var result = re.exec(src);
  2109. var end = result ? result.index + 1 : src.length;
  2110. return [src.substring(0, end)];
  2111. }
  2112. }
  2113. ],
  2114. 'HEREDOC': sharedStringTokens.concat([
  2115. {
  2116. value: PHP.Constants.T_END_HEREDOC,
  2117. matchFunc: function(src) {
  2118. if (!heredocEndAllowed) {
  2119. return null;
  2120. }
  2121. var re = new RegExp('^' + heredoc + '(?=;?[\\r\\n])');
  2122. if (src.match(re)) {
  2123. return [src.substr(0, heredoc.length)];
  2124. } else {
  2125. return null;
  2126. }
  2127. },
  2128. func: function() {
  2129. swapState('IN_SCRIPTING');
  2130. }
  2131. },
  2132. {
  2133. value: PHP.Constants.T_ENCAPSED_AND_WHITESPACE,
  2134. matchFunc: function(src) {
  2135. var end = src.length;
  2136. var re = new RegExp('^' + stringRegexPart(''));
  2137. var result = re.exec(src);
  2138. if (result) {
  2139. end = result[0].length;
  2140. }
  2141. re = new RegExp('([\\r\\n])' + heredoc + '(?=;?[\\r\\n])');
  2142. result = re.exec(src.substring(0, end));
  2143. if (result) {
  2144. end = result.index + 1;
  2145. heredocEndAllowed = true;
  2146. } else {
  2147. heredocEndAllowed = false;
  2148. }
  2149. if (end == 0) {
  2150. return null;
  2151. }
  2152. return [src.substring(0, end)];
  2153. }
  2154. }
  2155. ])
  2156. };
  2157. var results = [],
  2158. line = 1,
  2159. cancel = true;
  2160. if (src === null) {
  2161. return results;
  2162. }
  2163. if (typeof src !== "string") {
  2164. src = src.toString();
  2165. }
  2166. while (src.length > 0 && cancel === true) {
  2167. var state = stateStack[stackPos];
  2168. var tokens = data[state];
  2169. cancel = tokens.some(function(token){
  2170. var result = token.matchFunc !== undefined
  2171. ? token.matchFunc(src)
  2172. : src.match(token.re);
  2173. if (result !== null) {
  2174. if (result[0].length == 0) {
  2175. throw new Error("empty match");
  2176. }
  2177. if (token.func !== undefined) {
  2178. token.func(result);
  2179. }
  2180. if (token.value === -1) {
  2181. results.push(result[0]);
  2182. } else {
  2183. var resultString = result[0];
  2184. results.push([
  2185. parseInt(token.value, 10),
  2186. resultString,
  2187. line
  2188. ]);
  2189. line += resultString.split('\n').length - 1;
  2190. }
  2191. src = src.substring(result[0].length);
  2192. return true;
  2193. }
  2194. return false;
  2195. });
  2196. }
  2197. return results;
  2198. };
  2199. PHP.Parser = function ( preprocessedTokens, eval ) {
  2200. var yybase = this.yybase,
  2201. yydefault = this.yydefault,
  2202. yycheck = this.yycheck,
  2203. yyaction = this.yyaction,
  2204. yylen = this.yylen,
  2205. yygbase = this.yygbase,
  2206. yygcheck = this.yygcheck,
  2207. yyp = this.yyp,
  2208. yygoto = this.yygoto,
  2209. yylhs = this.yylhs,
  2210. terminals = this.terminals,
  2211. translate = this.translate,
  2212. yygdefault = this.yygdefault;
  2213. this.pos = -1;
  2214. this.line = 1;
  2215. this.tokenMap = this.createTokenMap( );
  2216. this.dropTokens = {};
  2217. this.dropTokens[ PHP.Constants.T_WHITESPACE ] = 1;
  2218. this.dropTokens[ PHP.Constants.T_OPEN_TAG ] = 1;
  2219. var tokens = [];
  2220. preprocessedTokens.forEach( function( token, index ) {
  2221. if ( typeof token === "object" && token[ 0 ] === PHP.Constants.T_OPEN_TAG_WITH_ECHO) {
  2222. tokens.push([
  2223. PHP.Constants.T_OPEN_TAG,
  2224. token[ 1 ],
  2225. token[ 2 ]
  2226. ]);
  2227. tokens.push([
  2228. PHP.Constants.T_ECHO,
  2229. token[ 1 ],
  2230. token[ 2 ]
  2231. ]);
  2232. } else {
  2233. tokens.push( token );
  2234. }
  2235. });
  2236. this.tokens = tokens;
  2237. var tokenId = this.TOKEN_NONE;
  2238. this.startAttributes = {
  2239. 'startLine': 1
  2240. };
  2241. this.endAttributes = {};
  2242. var attributeStack = [ this.startAttributes ];
  2243. var state = 0;
  2244. var stateStack = [ state ];
  2245. this.yyastk = [];
  2246. this.stackPos = 0;
  2247. var yyn;
  2248. var origTokenId;
  2249. for (;;) {
  2250. if ( yybase[ state ] === 0 ) {
  2251. yyn = yydefault[ state ];
  2252. } else {
  2253. if (tokenId === this.TOKEN_NONE ) {
  2254. origTokenId = this.getNextToken( );
  2255. tokenId = (origTokenId >= 0 && origTokenId < this.TOKEN_MAP_SIZE) ? translate[ origTokenId ] : this.TOKEN_INVALID;
  2256. attributeStack[ this.stackPos ] = this.startAttributes;
  2257. }
  2258. if (((yyn = yybase[ state ] + tokenId) >= 0
  2259. && yyn < this.YYLAST && yycheck[ yyn ] === tokenId
  2260. || (state < this.YY2TBLSTATE
  2261. && (yyn = yybase[state + this.YYNLSTATES] + tokenId) >= 0
  2262. && yyn < this.YYLAST
  2263. && yycheck[ yyn ] === tokenId))
  2264. && (yyn = yyaction[ yyn ]) !== this.YYDEFAULT ) {
  2265. if (yyn > 0) {
  2266. ++this.stackPos;
  2267. stateStack[ this.stackPos ] = state = yyn;
  2268. this.yyastk[ this.stackPos ] = this.tokenValue;
  2269. attributeStack[ this.stackPos ] = this.startAttributes;
  2270. tokenId = this.TOKEN_NONE;
  2271. if (yyn < this.YYNLSTATES)
  2272. continue;
  2273. yyn -= this.YYNLSTATES;
  2274. } else {
  2275. yyn = -yyn;
  2276. }
  2277. } else {
  2278. yyn = yydefault[ state ];
  2279. }
  2280. }
  2281. for (;;) {
  2282. if ( yyn === 0 ) {
  2283. return this.yyval;
  2284. } else if (yyn !== this.YYUNEXPECTED ) {
  2285. for (var attr in this.endAttributes) {
  2286. attributeStack[ this.stackPos - yylen[ yyn ] ][ attr ] = this.endAttributes[ attr ];
  2287. }
  2288. this.stackPos -= yylen[ yyn ];
  2289. yyn = yylhs[ yyn ];
  2290. if ((yyp = yygbase[ yyn ] + stateStack[ this.stackPos ]) >= 0
  2291. && yyp < this.YYGLAST
  2292. && yygcheck[ yyp ] === yyn) {
  2293. state = yygoto[ yyp ];
  2294. } else {
  2295. state = yygdefault[ yyn ];
  2296. }
  2297. ++this.stackPos;
  2298. stateStack[ this.stackPos ] = state;
  2299. this.yyastk[ this.stackPos ] = this.yyval;
  2300. attributeStack[ this.stackPos ] = this.startAttributes;
  2301. } else {
  2302. if (eval !== true) {
  2303. var expected = [];
  2304. for (var i = 0; i < this.TOKEN_MAP_SIZE; ++i) {
  2305. if ((yyn = yybase[ state ] + i) >= 0 && yyn < this.YYLAST && yycheck[ yyn ] == i
  2306. || state < this.YY2TBLSTATE
  2307. && (yyn = yybase[ state + this.YYNLSTATES] + i)
  2308. && yyn < this.YYLAST && yycheck[ yyn ] == i
  2309. ) {
  2310. if (yyaction[ yyn ] != this.YYUNEXPECTED) {
  2311. if (expected.length == 4) {
  2312. expected = [];
  2313. break;
  2314. }
  2315. expected.push( this.terminals[ i ] );
  2316. }
  2317. }
  2318. }
  2319. var expectedString = '';
  2320. if (expected.length) {
  2321. expectedString = ', expecting ' + expected.join(' or ');
  2322. }
  2323. throw new PHP.ParseError('syntax error, unexpected ' + terminals[ tokenId ] + expectedString, this.startAttributes['startLine']);
  2324. } else {
  2325. return this.startAttributes['startLine'];
  2326. }
  2327. }
  2328. if (state < this.YYNLSTATES)
  2329. break;
  2330. yyn = state - this.YYNLSTATES;
  2331. }
  2332. }
  2333. };
  2334. PHP.ParseError = function( msg, line ) {
  2335. this.message = msg;
  2336. this.line = line;
  2337. };
  2338. PHP.Parser.prototype.getNextToken = function( ) {
  2339. this.startAttributes = {};
  2340. this.endAttributes = {};
  2341. var token,
  2342. tmp;
  2343. while (this.tokens[++this.pos] !== undefined) {
  2344. token = this.tokens[this.pos];
  2345. if (typeof token === "string") {
  2346. this.startAttributes['startLine'] = this.line;
  2347. this.endAttributes['endLine'] = this.line;
  2348. if ('b"' === token) {
  2349. this.tokenValue = 'b"';
  2350. return '"'.charCodeAt(0);
  2351. } else {
  2352. this.tokenValue = token;
  2353. return token.charCodeAt(0);
  2354. }
  2355. } else {
  2356. this.line += ((tmp = token[ 1 ].match(/\n/g)) === null) ? 0 : tmp.length;
  2357. if (PHP.Constants.T_COMMENT === token[0]) {
  2358. if (!Array.isArray(this.startAttributes['comments'])) {
  2359. this.startAttributes['comments'] = [];
  2360. }
  2361. this.startAttributes['comments'].push( {
  2362. type: "comment",
  2363. comment: token[1],
  2364. line: token[2]
  2365. });
  2366. } else if (PHP.Constants.T_DOC_COMMENT === token[0]) {
  2367. this.startAttributes['comments'].push( new PHPParser_Comment_Doc(token[1], token[2]) );
  2368. } else if (this.dropTokens[token[0]] === undefined) {
  2369. this.tokenValue = token[1];
  2370. this.startAttributes['startLine'] = token[2];
  2371. this.endAttributes['endLine'] = this.line;
  2372. return this.tokenMap[token[0]];
  2373. }
  2374. }
  2375. }
  2376. this.startAttributes['startLine'] = this.line;
  2377. return 0;
  2378. };
  2379. PHP.Parser.prototype.tokenName = function( token ) {
  2380. var constants = ["T_INCLUDE","T_INCLUDE_ONCE","T_EVAL","T_REQUIRE","T_REQUIRE_ONCE","T_LOGICAL_OR","T_LOGICAL_XOR","T_LOGICAL_AND","T_PRINT","T_YIELD","T_DOUBLE_ARROW","T_YIELD_FROM","T_PLUS_EQUAL","T_MINUS_EQUAL","T_MUL_EQUAL","T_DIV_EQUAL","T_CONCAT_EQUAL","T_MOD_EQUAL","T_AND_EQUAL","T_OR_EQUAL","T_XOR_EQUAL","T_SL_EQUAL","T_SR_EQUAL","T_POW_EQUAL","T_COALESCE","T_BOOLEAN_OR","T_BOOLEAN_AND","T_IS_EQUAL","T_IS_NOT_EQUAL","T_IS_IDENTICAL","T_IS_NOT_IDENTICAL","T_SPACESHIP","T_IS_SMALLER_OR_EQUAL","T_IS_GREATER_OR_EQUAL","T_SL","T_SR","T_INSTANCEOF","T_INC","T_DEC","T_INT_CAST","T_DOUBLE_CAST","T_STRING_CAST","T_ARRAY_CAST","T_OBJECT_CAST","T_BOOL_CAST","T_UNSET_CAST","T_POW","T_NEW","T_CLONE","T_EXIT","T_IF","T_ELSEIF","T_ELSE","T_ENDIF","T_LNUMBER","T_DNUMBER","T_STRING","T_STRING_VARNAME","T_VARIABLE","T_NUM_STRING","T_INLINE_HTML","T_CHARACTER","T_BAD_CHARACTER","T_ENCAPSED_AND_WHITESPACE","T_CONSTANT_ENCAPSED_STRING","T_ECHO","T_DO","T_WHILE","T_ENDWHILE","T_FOR","T_ENDFOR","T_FOREACH","T_ENDFOREACH","T_DECLARE","T_ENDDECLARE","T_AS","T_SWITCH","T_ENDSWITCH","T_CASE","T_DEFAULT","T_BREAK","T_CONTINUE","T_GOTO","T_FUNCTION","T_CONST","T_RETURN","T_TRY","T_CATCH","T_FINALLY","T_THROW","T_USE","T_INSTEADOF","T_GLOBAL","T_STATIC","T_ABSTRACT","T_FINAL","T_PRIVATE","T_PROTECTED","T_PUBLIC","T_VAR","T_UNSET","T_ISSET","T_EMPTY","T_HALT_COMPILER","T_CLASS","T_TRAIT","T_INTERFACE","T_EXTENDS","T_IMPLEMENTS","T_OBJECT_OPERATOR","T_DOUBLE_ARROW","T_LIST","T_ARRAY","T_CALLABLE","T_CLASS_C","T_TRAIT_C","T_METHOD_C","T_FUNC_C","T_LINE","T_FILE","T_COMMENT","T_DOC_COMMENT","T_OPEN_TAG","T_OPEN_TAG_WITH_ECHO","T_CLOSE_TAG","T_WHITESPACE","T_START_HEREDOC","T_END_HEREDOC","T_DOLLAR_OPEN_CURLY_BRACES","T_CURLY_OPEN","T_PAAMAYIM_NEKUDOTAYIM","T_NAMESPACE","T_NS_C","T_DIR","T_NS_SEPARATOR","T_ELLIPSIS"];
  2381. var current = "UNKNOWN";
  2382. constants.some(function( constant ) {
  2383. if (PHP.Constants[ constant ] === token) {
  2384. current = constant;
  2385. return true;
  2386. } else {
  2387. return false;
  2388. }
  2389. });
  2390. return current;
  2391. };
  2392. PHP.Parser.prototype.createTokenMap = function() {
  2393. var tokenMap = {},
  2394. name,
  2395. i;
  2396. for ( i = 256; i < 1000; ++i ) {
  2397. if( PHP.Constants.T_OPEN_TAG_WITH_ECHO === i ) {
  2398. tokenMap[ i ] = PHP.Constants.T_ECHO;
  2399. } else if( PHP.Constants.T_CLOSE_TAG === i ) {
  2400. tokenMap[ i ] = 59;
  2401. } else if ( 'UNKNOWN' !== (name = this.tokenName( i ) ) ) {
  2402. tokenMap[ i ] = this[name];
  2403. }
  2404. }
  2405. return tokenMap;
  2406. };
  2407. PHP.Parser.prototype.TOKEN_NONE = -1;
  2408. PHP.Parser.prototype.TOKEN_INVALID = 157;
  2409. PHP.Parser.prototype.TOKEN_MAP_SIZE = 392;
  2410. PHP.Parser.prototype.YYLAST = 889;
  2411. PHP.Parser.prototype.YY2TBLSTATE = 337;
  2412. PHP.Parser.prototype.YYGLAST = 410;
  2413. PHP.Parser.prototype.YYNLSTATES = 564;
  2414. PHP.Parser.prototype.YYUNEXPECTED = 32767;
  2415. PHP.Parser.prototype.YYDEFAULT = -32766;
  2416. PHP.Parser.prototype.YYERRTOK = 256;
  2417. PHP.Parser.prototype.T_INCLUDE = 257;
  2418. PHP.Parser.prototype.T_INCLUDE_ONCE = 258;
  2419. PHP.Parser.prototype.T_EVAL = 259;
  2420. PHP.Parser.prototype.T_REQUIRE = 260;
  2421. PHP.Parser.prototype.T_REQUIRE_ONCE = 261;
  2422. PHP.Parser.prototype.T_LOGICAL_OR = 262;
  2423. PHP.Parser.prototype.T_LOGICAL_XOR = 263;
  2424. PHP.Parser.prototype.T_LOGICAL_AND = 264;
  2425. PHP.Parser.prototype.T_PRINT = 265;
  2426. PHP.Parser.prototype.T_YIELD = 266;
  2427. PHP.Parser.prototype.T_DOUBLE_ARROW = 267;
  2428. PHP.Parser.prototype.T_YIELD_FROM = 268;
  2429. PHP.Parser.prototype.T_PLUS_EQUAL = 269;
  2430. PHP.Parser.prototype.T_MINUS_EQUAL = 270;
  2431. PHP.Parser.prototype.T_MUL_EQUAL = 271;
  2432. PHP.Parser.prototype.T_DIV_EQUAL = 272;
  2433. PHP.Parser.prototype.T_CONCAT_EQUAL = 273;
  2434. PHP.Parser.prototype.T_MOD_EQUAL = 274;
  2435. PHP.Parser.prototype.T_AND_EQUAL = 275;
  2436. PHP.Parser.prototype.T_OR_EQUAL = 276;
  2437. PHP.Parser.prototype.T_XOR_EQUAL = 277;
  2438. PHP.Parser.prototype.T_SL_EQUAL = 278;
  2439. PHP.Parser.prototype.T_SR_EQUAL = 279;
  2440. PHP.Parser.prototype.T_POW_EQUAL = 280;
  2441. PHP.Parser.prototype.T_COALESCE = 281;
  2442. PHP.Parser.prototype.T_BOOLEAN_OR = 282;
  2443. PHP.Parser.prototype.T_BOOLEAN_AND = 283;
  2444. PHP.Parser.prototype.T_IS_EQUAL = 284;
  2445. PHP.Parser.prototype.T_IS_NOT_EQUAL = 285;
  2446. PHP.Parser.prototype.T_IS_IDENTICAL = 286;
  2447. PHP.Parser.prototype.T_IS_NOT_IDENTICAL = 287;
  2448. PHP.Parser.prototype.T_SPACESHIP = 288;
  2449. PHP.Parser.prototype.T_IS_SMALLER_OR_EQUAL = 289;
  2450. PHP.Parser.prototype.T_IS_GREATER_OR_EQUAL = 290;
  2451. PHP.Parser.prototype.T_SL = 291;
  2452. PHP.Parser.prototype.T_SR = 292;
  2453. PHP.Parser.prototype.T_INSTANCEOF = 293;
  2454. PHP.Parser.prototype.T_INC = 294;
  2455. PHP.Parser.prototype.T_DEC = 295;
  2456. PHP.Parser.prototype.T_INT_CAST = 296;
  2457. PHP.Parser.prototype.T_DOUBLE_CAST = 297;
  2458. PHP.Parser.prototype.T_STRING_CAST = 298;
  2459. PHP.Parser.prototype.T_ARRAY_CAST = 299;
  2460. PHP.Parser.prototype.T_OBJECT_CAST = 300;
  2461. PHP.Parser.prototype.T_BOOL_CAST = 301;
  2462. PHP.Parser.prototype.T_UNSET_CAST = 302;
  2463. PHP.Parser.prototype.T_POW = 303;
  2464. PHP.Parser.prototype.T_NEW = 304;
  2465. PHP.Parser.prototype.T_CLONE = 305;
  2466. PHP.Parser.prototype.T_EXIT = 306;
  2467. PHP.Parser.prototype.T_IF = 307;
  2468. PHP.Parser.prototype.T_ELSEIF = 308;
  2469. PHP.Parser.prototype.T_ELSE = 309;
  2470. PHP.Parser.prototype.T_ENDIF = 310;
  2471. PHP.Parser.prototype.T_LNUMBER = 311;
  2472. PHP.Parser.prototype.T_DNUMBER = 312;
  2473. PHP.Parser.prototype.T_STRING = 313;
  2474. PHP.Parser.prototype.T_STRING_VARNAME = 314;
  2475. PHP.Parser.prototype.T_VARIABLE = 315;
  2476. PHP.Parser.prototype.T_NUM_STRING = 316;
  2477. PHP.Parser.prototype.T_INLINE_HTML = 317;
  2478. PHP.Parser.prototype.T_CHARACTER = 318;
  2479. PHP.Parser.prototype.T_BAD_CHARACTER = 319;
  2480. PHP.Parser.prototype.T_ENCAPSED_AND_WHITESPACE = 320;
  2481. PHP.Parser.prototype.T_CONSTANT_ENCAPSED_STRING = 321;
  2482. PHP.Parser.prototype.T_ECHO = 322;
  2483. PHP.Parser.prototype.T_DO = 323;
  2484. PHP.Parser.prototype.T_WHILE = 324;
  2485. PHP.Parser.prototype.T_ENDWHILE = 325;
  2486. PHP.Parser.prototype.T_FOR = 326;
  2487. PHP.Parser.prototype.T_ENDFOR = 327;
  2488. PHP.Parser.prototype.T_FOREACH = 328;
  2489. PHP.Parser.prototype.T_ENDFOREACH = 329;
  2490. PHP.Parser.prototype.T_DECLARE = 330;
  2491. PHP.Parser.prototype.T_ENDDECLARE = 331;
  2492. PHP.Parser.prototype.T_AS = 332;
  2493. PHP.Parser.prototype.T_SWITCH = 333;
  2494. PHP.Parser.prototype.T_ENDSWITCH = 334;
  2495. PHP.Parser.prototype.T_CASE = 335;
  2496. PHP.Parser.prototype.T_DEFAULT = 336;
  2497. PHP.Parser.prototype.T_BREAK = 337;
  2498. PHP.Parser.prototype.T_CONTINUE = 338;
  2499. PHP.Parser.prototype.T_GOTO = 339;
  2500. PHP.Parser.prototype.T_FUNCTION = 340;
  2501. PHP.Parser.prototype.T_CONST = 341;
  2502. PHP.Parser.prototype.T_RETURN = 342;
  2503. PHP.Parser.prototype.T_TRY = 343;
  2504. PHP.Parser.prototype.T_CATCH = 344;
  2505. PHP.Parser.prototype.T_FINALLY = 345;
  2506. PHP.Parser.prototype.T_THROW = 346;
  2507. PHP.Parser.prototype.T_USE = 347;
  2508. PHP.Parser.prototype.T_INSTEADOF = 348;
  2509. PHP.Parser.prototype.T_GLOBAL = 349;
  2510. PHP.Parser.prototype.T_STATIC = 350;
  2511. PHP.Parser.prototype.T_ABSTRACT = 351;
  2512. PHP.Parser.prototype.T_FINAL = 352;
  2513. PHP.Parser.prototype.T_PRIVATE = 353;
  2514. PHP.Parser.prototype.T_PROTECTED = 354;
  2515. PHP.Parser.prototype.T_PUBLIC = 355;
  2516. PHP.Parser.prototype.T_VAR = 356;
  2517. PHP.Parser.prototype.T_UNSET = 357;
  2518. PHP.Parser.prototype.T_ISSET = 358;
  2519. PHP.Parser.prototype.T_EMPTY = 359;
  2520. PHP.Parser.prototype.T_HALT_COMPILER = 360;
  2521. PHP.Parser.prototype.T_CLASS = 361;
  2522. PHP.Parser.prototype.T_TRAIT = 362;
  2523. PHP.Parser.prototype.T_INTERFACE = 363;
  2524. PHP.Parser.prototype.T_EXTENDS = 364;
  2525. PHP.Parser.prototype.T_IMPLEMENTS = 365;
  2526. PHP.Parser.prototype.T_OBJECT_OPERATOR = 366;
  2527. PHP.Parser.prototype.T_LIST = 367;
  2528. PHP.Parser.prototype.T_ARRAY = 368;
  2529. PHP.Parser.prototype.T_CALLABLE = 369;
  2530. PHP.Parser.prototype.T_CLASS_C = 370;
  2531. PHP.Parser.prototype.T_TRAIT_C = 371;
  2532. PHP.Parser.prototype.T_METHOD_C = 372;
  2533. PHP.Parser.prototype.T_FUNC_C = 373;
  2534. PHP.Parser.prototype.T_LINE = 374;
  2535. PHP.Parser.prototype.T_FILE = 375;
  2536. PHP.Parser.prototype.T_COMMENT = 376;
  2537. PHP.Parser.prototype.T_DOC_COMMENT = 377;
  2538. PHP.Parser.prototype.T_OPEN_TAG = 378;
  2539. PHP.Parser.prototype.T_OPEN_TAG_WITH_ECHO = 379;
  2540. PHP.Parser.prototype.T_CLOSE_TAG = 380;
  2541. PHP.Parser.prototype.T_WHITESPACE = 381;
  2542. PHP.Parser.prototype.T_START_HEREDOC = 382;
  2543. PHP.Parser.prototype.T_END_HEREDOC = 383;
  2544. PHP.Parser.prototype.T_DOLLAR_OPEN_CURLY_BRACES = 384;
  2545. PHP.Parser.prototype.T_CURLY_OPEN = 385;
  2546. PHP.Parser.prototype.T_PAAMAYIM_NEKUDOTAYIM = 386;
  2547. PHP.Parser.prototype.T_NAMESPACE = 387;
  2548. PHP.Parser.prototype.T_NS_C = 388;
  2549. PHP.Parser.prototype.T_DIR = 389;
  2550. PHP.Parser.prototype.T_NS_SEPARATOR = 390;
  2551. PHP.Parser.prototype.T_ELLIPSIS = 391;
  2552. PHP.Parser.prototype.terminals = [
  2553. "$EOF",
  2554. "error",
  2555. "T_INCLUDE",
  2556. "T_INCLUDE_ONCE",
  2557. "T_EVAL",
  2558. "T_REQUIRE",
  2559. "T_REQUIRE_ONCE",
  2560. "','",
  2561. "T_LOGICAL_OR",
  2562. "T_LOGICAL_XOR",
  2563. "T_LOGICAL_AND",
  2564. "T_PRINT",
  2565. "T_YIELD",
  2566. "T_DOUBLE_ARROW",
  2567. "T_YIELD_FROM",
  2568. "'='",
  2569. "T_PLUS_EQUAL",
  2570. "T_MINUS_EQUAL",
  2571. "T_MUL_EQUAL",
  2572. "T_DIV_EQUAL",
  2573. "T_CONCAT_EQUAL",
  2574. "T_MOD_EQUAL",
  2575. "T_AND_EQUAL",
  2576. "T_OR_EQUAL",
  2577. "T_XOR_EQUAL",
  2578. "T_SL_EQUAL",
  2579. "T_SR_EQUAL",
  2580. "T_POW_EQUAL",
  2581. "'?'",
  2582. "':'",
  2583. "T_COALESCE",
  2584. "T_BOOLEAN_OR",
  2585. "T_BOOLEAN_AND",
  2586. "'|'",
  2587. "'^'",
  2588. "'&'",
  2589. "T_IS_EQUAL",
  2590. "T_IS_NOT_EQUAL",
  2591. "T_IS_IDENTICAL",
  2592. "T_IS_NOT_IDENTICAL",
  2593. "T_SPACESHIP",
  2594. "'<'",
  2595. "T_IS_SMALLER_OR_EQUAL",
  2596. "'>'",
  2597. "T_IS_GREATER_OR_EQUAL",
  2598. "T_SL",
  2599. "T_SR",
  2600. "'+'",
  2601. "'-'",
  2602. "'.'",
  2603. "'*'",
  2604. "'/'",
  2605. "'%'",
  2606. "'!'",
  2607. "T_INSTANCEOF",
  2608. "'~'",
  2609. "T_INC",
  2610. "T_DEC",
  2611. "T_INT_CAST",
  2612. "T_DOUBLE_CAST",
  2613. "T_STRING_CAST",
  2614. "T_ARRAY_CAST",
  2615. "T_OBJECT_CAST",
  2616. "T_BOOL_CAST",
  2617. "T_UNSET_CAST",
  2618. "'@'",
  2619. "T_POW",
  2620. "'['",
  2621. "T_NEW",
  2622. "T_CLONE",
  2623. "T_EXIT",
  2624. "T_IF",
  2625. "T_ELSEIF",
  2626. "T_ELSE",
  2627. "T_ENDIF",
  2628. "T_LNUMBER",
  2629. "T_DNUMBER",
  2630. "T_STRING",
  2631. "T_STRING_VARNAME",
  2632. "T_VARIABLE",
  2633. "T_NUM_STRING",
  2634. "T_INLINE_HTML",
  2635. "T_ENCAPSED_AND_WHITESPACE",
  2636. "T_CONSTANT_ENCAPSED_STRING",
  2637. "T_ECHO",
  2638. "T_DO",
  2639. "T_WHILE",
  2640. "T_ENDWHILE",
  2641. "T_FOR",
  2642. "T_ENDFOR",
  2643. "T_FOREACH",
  2644. "T_ENDFOREACH",
  2645. "T_DECLARE",
  2646. "T_ENDDECLARE",
  2647. "T_AS",
  2648. "T_SWITCH",
  2649. "T_ENDSWITCH",
  2650. "T_CASE",
  2651. "T_DEFAULT",
  2652. "T_BREAK",
  2653. "T_CONTINUE",
  2654. "T_GOTO",
  2655. "T_FUNCTION",
  2656. "T_CONST",
  2657. "T_RETURN",
  2658. "T_TRY",
  2659. "T_CATCH",
  2660. "T_FINALLY",
  2661. "T_THROW",
  2662. "T_USE",
  2663. "T_INSTEADOF",
  2664. "T_GLOBAL",
  2665. "T_STATIC",
  2666. "T_ABSTRACT",
  2667. "T_FINAL",
  2668. "T_PRIVATE",
  2669. "T_PROTECTED",
  2670. "T_PUBLIC",
  2671. "T_VAR",
  2672. "T_UNSET",
  2673. "T_ISSET",
  2674. "T_EMPTY",
  2675. "T_HALT_COMPILER",
  2676. "T_CLASS",
  2677. "T_TRAIT",
  2678. "T_INTERFACE",
  2679. "T_EXTENDS",
  2680. "T_IMPLEMENTS",
  2681. "T_OBJECT_OPERATOR",
  2682. "T_LIST",
  2683. "T_ARRAY",
  2684. "T_CALLABLE",
  2685. "T_CLASS_C",
  2686. "T_TRAIT_C",
  2687. "T_METHOD_C",
  2688. "T_FUNC_C",
  2689. "T_LINE",
  2690. "T_FILE",
  2691. "T_START_HEREDOC",
  2692. "T_END_HEREDOC",
  2693. "T_DOLLAR_OPEN_CURLY_BRACES",
  2694. "T_CURLY_OPEN",
  2695. "T_PAAMAYIM_NEKUDOTAYIM",
  2696. "T_NAMESPACE",
  2697. "T_NS_C",
  2698. "T_DIR",
  2699. "T_NS_SEPARATOR",
  2700. "T_ELLIPSIS",
  2701. "';'",
  2702. "'{'",
  2703. "'}'",
  2704. "'('",
  2705. "')'",
  2706. "'`'",
  2707. "']'",
  2708. "'\"'",
  2709. "'$'"
  2710. , "???"
  2711. ];
  2712. PHP.Parser.prototype.translate = [
  2713. 0, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2714. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2715. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2716. 157, 157, 157, 53, 155, 157, 156, 52, 35, 157,
  2717. 151, 152, 50, 47, 7, 48, 49, 51, 157, 157,
  2718. 157, 157, 157, 157, 157, 157, 157, 157, 29, 148,
  2719. 41, 15, 43, 28, 65, 157, 157, 157, 157, 157,
  2720. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2721. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2722. 157, 67, 157, 154, 34, 157, 153, 157, 157, 157,
  2723. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2724. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2725. 157, 157, 157, 149, 33, 150, 55, 157, 157, 157,
  2726. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2727. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2728. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2729. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2730. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2731. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2732. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2733. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2734. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2735. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2736. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2737. 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
  2738. 157, 157, 157, 157, 157, 157, 1, 2, 3, 4,
  2739. 5, 6, 8, 9, 10, 11, 12, 13, 14, 16,
  2740. 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
  2741. 27, 30, 31, 32, 36, 37, 38, 39, 40, 42,
  2742. 44, 45, 46, 54, 56, 57, 58, 59, 60, 61,
  2743. 62, 63, 64, 66, 68, 69, 70, 71, 72, 73,
  2744. 74, 75, 76, 77, 78, 79, 80, 81, 157, 157,
  2745. 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
  2746. 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
  2747. 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2748. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
  2749. 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
  2750. 132, 133, 134, 135, 136, 137, 157, 157, 157, 157,
  2751. 157, 157, 138, 139, 140, 141, 142, 143, 144, 145,
  2752. 146, 147
  2753. ];
  2754. PHP.Parser.prototype.yyaction = [
  2755. 569, 570, 571, 572, 573, 215, 574, 575, 576, 612,
  2756. 613, 0, 27, 99, 100, 101, 102, 103, 104, 105,
  2757. 106, 107, 108, 109, 110,-32766,-32766,-32766, 95, 96,
  2758. 97, 24, 240, 226, -267,-32766,-32766,-32766,-32766,-32766,
  2759. -32766, 530, 344, 114, 98,-32766, 286,-32766,-32766,-32766,
  2760. -32766,-32766, 577, 870, 872,-32766,-32766,-32766,-32766,-32766,
  2761. -32766,-32766,-32766, 224,-32766, 714, 578, 579, 580, 581,
  2762. 582, 583, 584,-32766, 264, 644, 840, 841, 842, 839,
  2763. 838, 837, 585, 586, 587, 588, 589, 590, 591, 592,
  2764. 593, 594, 595, 615, 616, 617, 618, 619, 607, 608,
  2765. 609, 610, 611, 596, 597, 598, 599, 600, 601, 602,
  2766. 638, 639, 640, 641, 642, 643, 603, 604, 605, 606,
  2767. 636, 627, 625, 626, 622, 623, 116, 614, 620, 621,
  2768. 628, 629, 631, 630, 632, 633, 42, 43, 381, 44,
  2769. 45, 624, 635, 634, -214, 46, 47, 289, 48,-32767,
  2770. -32767,-32767,-32767, 90, 91, 92, 93, 94, 267, 241,
  2771. 22, 840, 841, 842, 839, 838, 837, 832,-32766,-32766,
  2772. -32766, 306, 1000, 1000, 1037, 120, 966, 436, -423, 244,
  2773. 797, 49, 50, 660, 661, 272, 362, 51,-32766, 52,
  2774. 219, 220, 53, 54, 55, 56, 57, 58, 59, 60,
  2775. 1016, 22, 238, 61, 351, 945,-32766,-32766,-32766, 967,
  2776. 968, 646, 705, 1000, 28, -456, 125, 966,-32766,-32766,
  2777. -32766, 715, 398, 399, 216, 1000,-32766, 339,-32766,-32766,
  2778. -32766,-32766, 25, 222, 980, 552, 355, 378,-32766, -423,
  2779. -32766,-32766,-32766, 121, 65, 1045, 408, 1047, 1046, 274,
  2780. 274, 131, 244, -423, 394, 395, 358, 519, 945, 537,
  2781. -423, 111, -426, 398, 399, 130, 972, 973, 974, 975,
  2782. 969, 970, 243, 128, -422, -421, 1013, 409, 976, 971,
  2783. 353, 791, 792, 7, -162, 63, 124, 255, 701, 256,
  2784. 274, 382, -122, -122, -122, -4, 715, 383, 646, 1042,
  2785. -421, 704, 274, -219, 33, 17, 384, -122, 385, -122,
  2786. 386, -122, 387, -122, 369, 388, -122, -122, -122, 34,
  2787. 35, 389, 352, 520, 36, 390, 353, 702, 62, 112,
  2788. 818, 287, 288, 391, 392, -422, -421, -161, 350, 393,
  2789. 40, 38, 690, 735, 396, 397, 361, 22, 122, -422,
  2790. -421,-32766,-32766,-32766, 791, 792, -422, -421, -425, 1000,
  2791. -456, -421, -238, 966, 409, 41, 382, 353, 717, 535,
  2792. -122,-32766, 383,-32766,-32766, -421, 704, 21, 813, 33,
  2793. 17, 384, -421, 385, -466, 386, 224, 387, -467, 273,
  2794. 388, 367, 945, -458, 34, 35, 389, 352, 345, 36,
  2795. 390, 248, 247, 62, 254, 715, 287, 288, 391, 392,
  2796. 399,-32766,-32766,-32766, 393, 295, 1000, 652, 735, 396,
  2797. 397, 117, 115, 113, 814, 119, 72, 73, 74, -162,
  2798. 764, 65, 240, 541, 370, 518, 274, 118, 270, 92,
  2799. 93, 94, 242, 717, 535, -4, 26, 1000, 75, 76,
  2800. 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
  2801. 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
  2802. 97, 547, 240, 713, 715, 382, 276,-32766,-32766, 126,
  2803. 945, 383, -161, 938, 98, 704, 225, 659, 33, 17,
  2804. 384, 346, 385, 274, 386, 728, 387, 221, 120, 388,
  2805. 505, 506, 540, 34, 35, 389, 715, -238, 36, 390,
  2806. 1017, 223, 62, 494, 18, 287, 288, 127, 297, 376,
  2807. 6, 98, 798, 393, 274, 660, 661, 490, 491, -466,
  2808. 39, -466, 514, -467, 539, -467, 16, 458, -458, 315,
  2809. 791, 792, 829, 553, 382, 817, 563, 653, 538, 765,
  2810. 383, 449, 751, 535, 704, 448, 435, 33, 17, 384,
  2811. 430, 385, 646, 386, 359, 387, 357, 647, 388, 673,
  2812. 429, 1040, 34, 35, 389, 715, 382, 36, 390, 941,
  2813. 492, 62, 383, 503, 287, 288, 704, 434, 440, 33,
  2814. 17, 384, 393, 385,-32766, 386, 445, 387, 495, 509,
  2815. 388, 10, 529, 542, 34, 35, 389, 715, 515, 36,
  2816. 390, 499, 500, 62, 214, -80, 287, 288, 452, 269,
  2817. 736, 717, 535, 488, 393, 356, 266, 979, 265, 730,
  2818. 982, 722, 358, 338, 493, 548, 0, 294, 737, 0,
  2819. 3, 0, 309, 0, 0, 382, 0, 0, 271, 0,
  2820. 0, 383, 0, 717, 535, 704, 227, 0, 33, 17,
  2821. 384, 9, 385, 0, 386, 0, 387, -382, 0, 388,
  2822. 0, 0, 325, 34, 35, 389, 715, 382, 36, 390,
  2823. 321, 341, 62, 383, 340, 287, 288, 704, 22, 320,
  2824. 33, 17, 384, 393, 385, 442, 386, 337, 387, 562,
  2825. 1000, 388, 32, 31, 966, 34, 35, 389, 823, 657,
  2826. 36, 390, 656, 821, 62, 703, 711, 287, 288, 561,
  2827. 822, 825, 717, 535, 695, 393, 747, 749, 693, 759,
  2828. 758, 752, 767, 945, 824, 706, 700, 712, 699, 698,
  2829. 658, 0, 263, 262, 559, 558, 382, 556, 554, 551,
  2830. 398, 399, 383, 550, 717, 535, 704, 546, 545, 33,
  2831. 17, 384, 543, 385, 536, 386, 71, 387, 933, 932,
  2832. 388, 30, 65, 731, 34, 35, 389, 274, 724, 36,
  2833. 390, 830, 734, 62, 663, 662, 287, 288,-32766,-32766,
  2834. -32766, 733, 732, 934, 393, 665, 664, 756, 555, 691,
  2835. 1041, 1001, 994, 1006, 1011, 1014, 757, 1043,-32766, 654,
  2836. -32766,-32766,-32766,-32766,-32766,-32766,-32767,-32767,-32767,-32767,
  2837. -32767, 655, 1044, 717, 535, -446, 926, 348, 343, 268,
  2838. 237, 236, 235, 234, 218, 217, 132, 129, -426, -425,
  2839. -424, 123, 20, 23, 70, 69, 29, 37, 64, 68,
  2840. 66, 67, -448, 0, 15, 19, 250, 910, 296, -217,
  2841. 467, 484, 909, 472, 528, 913, 11, 964, 955, -215,
  2842. 525, 379, 375, 373, 371, 14, 13, 12, -214, 0,
  2843. -393, 0, 1005, 1039, 992, 993, 963, 0, 981
  2844. ];
  2845. PHP.Parser.prototype.yycheck = [
  2846. 2, 3, 4, 5, 6, 13, 8, 9, 10, 11,
  2847. 12, 0, 15, 16, 17, 18, 19, 20, 21, 22,
  2848. 23, 24, 25, 26, 27, 8, 9, 10, 50, 51,
  2849. 52, 7, 54, 7, 79, 8, 9, 10, 8, 9,
  2850. 10, 77, 7, 13, 66, 28, 7, 30, 31, 32,
  2851. 33, 34, 54, 56, 57, 28, 8, 30, 31, 32,
  2852. 33, 34, 35, 35, 109, 1, 68, 69, 70, 71,
  2853. 72, 73, 74, 118, 7, 77, 112, 113, 114, 115,
  2854. 116, 117, 84, 85, 86, 87, 88, 89, 90, 91,
  2855. 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
  2856. 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  2857. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
  2858. 122, 123, 124, 125, 126, 127, 7, 129, 130, 131,
  2859. 132, 133, 134, 135, 136, 137, 2, 3, 4, 5,
  2860. 6, 143, 144, 145, 152, 11, 12, 7, 14, 41,
  2861. 42, 43, 44, 45, 46, 47, 48, 49, 109, 7,
  2862. 67, 112, 113, 114, 115, 116, 117, 118, 8, 9,
  2863. 10, 79, 79, 79, 82, 147, 83, 82, 67, 28,
  2864. 152, 47, 48, 102, 103, 7, 7, 53, 28, 55,
  2865. 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
  2866. 1, 67, 68, 69, 70, 112, 8, 9, 10, 75,
  2867. 76, 77, 148, 79, 13, 7, 67, 83, 8, 9,
  2868. 10, 1, 129, 130, 13, 79, 28, 146, 30, 31,
  2869. 32, 33, 140, 141, 139, 29, 102, 7, 28, 128,
  2870. 30, 31, 32, 149, 151, 77, 112, 79, 80, 156,
  2871. 156, 15, 28, 142, 120, 121, 146, 77, 112, 149,
  2872. 149, 15, 151, 129, 130, 15, 132, 133, 134, 135,
  2873. 136, 137, 138, 15, 67, 67, 77, 143, 144, 145,
  2874. 146, 130, 131, 7, 7, 151, 15, 153, 148, 155,
  2875. 156, 71, 72, 73, 74, 0, 1, 77, 77, 150,
  2876. 67, 81, 156, 152, 84, 85, 86, 87, 88, 89,
  2877. 90, 91, 92, 93, 29, 95, 96, 97, 98, 99,
  2878. 100, 101, 102, 143, 104, 105, 146, 148, 108, 15,
  2879. 150, 111, 112, 113, 114, 128, 128, 7, 7, 119,
  2880. 67, 67, 122, 123, 124, 125, 7, 67, 149, 142,
  2881. 142, 8, 9, 10, 130, 131, 149, 149, 151, 79,
  2882. 152, 128, 7, 83, 143, 7, 71, 146, 148, 149,
  2883. 150, 28, 77, 30, 31, 142, 81, 7, 148, 84,
  2884. 85, 86, 149, 88, 7, 90, 35, 92, 7, 33,
  2885. 95, 7, 112, 7, 99, 100, 101, 102, 103, 104,
  2886. 105, 128, 128, 108, 109, 1, 111, 112, 113, 114,
  2887. 130, 8, 9, 10, 119, 142, 79, 122, 123, 124,
  2888. 125, 15, 149, 149, 148, 29, 8, 9, 10, 152,
  2889. 29, 151, 54, 29, 149, 79, 156, 15, 143, 47,
  2890. 48, 49, 29, 148, 149, 150, 28, 79, 30, 31,
  2891. 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
  2892. 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
  2893. 52, 29, 54, 29, 1, 71, 67, 8, 9, 29,
  2894. 112, 77, 152, 152, 66, 81, 35, 148, 84, 85,
  2895. 86, 123, 88, 156, 90, 35, 92, 35, 147, 95,
  2896. 72, 73, 29, 99, 100, 101, 1, 152, 104, 105,
  2897. 152, 35, 108, 72, 73, 111, 112, 97, 98, 102,
  2898. 103, 66, 152, 119, 156, 102, 103, 106, 107, 152,
  2899. 67, 154, 74, 152, 29, 154, 152, 128, 152, 78,
  2900. 130, 131, 148, 149, 71, 148, 149, 148, 149, 148,
  2901. 77, 77, 148, 149, 81, 77, 77, 84, 85, 86,
  2902. 77, 88, 77, 90, 77, 92, 77, 77, 95, 77,
  2903. 77, 77, 99, 100, 101, 1, 71, 104, 105, 79,
  2904. 79, 108, 77, 79, 111, 112, 81, 79, 82, 84,
  2905. 85, 86, 119, 88, 82, 90, 86, 92, 87, 96,
  2906. 95, 94, 89, 29, 99, 100, 101, 1, 91, 104,
  2907. 105, 93, 96, 108, 94, 94, 111, 112, 94, 110,
  2908. 123, 148, 149, 109, 119, 102, 127, 139, 126, 147,
  2909. 139, 150, 146, 149, 154, 29, -1, 142, 123, -1,
  2910. 142, -1, 146, -1, -1, 71, -1, -1, 126, -1,
  2911. -1, 77, -1, 148, 149, 81, 35, -1, 84, 85,
  2912. 86, 142, 88, -1, 90, -1, 92, 142, -1, 95,
  2913. -1, -1, 146, 99, 100, 101, 1, 71, 104, 105,
  2914. 146, 146, 108, 77, 146, 111, 112, 81, 67, 146,
  2915. 84, 85, 86, 119, 88, 146, 90, 149, 92, 148,
  2916. 79, 95, 148, 148, 83, 99, 100, 101, 148, 148,
  2917. 104, 105, 148, 148, 108, 148, 148, 111, 112, 148,
  2918. 148, 148, 148, 149, 148, 119, 148, 148, 148, 148,
  2919. 148, 148, 148, 112, 148, 148, 148, 148, 148, 148,
  2920. 148, -1, 149, 149, 149, 149, 71, 149, 149, 149,
  2921. 129, 130, 77, 149, 148, 149, 81, 149, 149, 84,
  2922. 85, 86, 149, 88, 149, 90, 149, 92, 150, 150,
  2923. 95, 151, 151, 150, 99, 100, 101, 156, 150, 104,
  2924. 105, 150, 150, 108, 150, 150, 111, 112, 8, 9,
  2925. 10, 150, 150, 150, 119, 150, 150, 150, 150, 150,
  2926. 150, 150, 150, 150, 150, 150, 150, 150, 28, 150,
  2927. 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
  2928. 40, 150, 150, 148, 149, 151, 153, 151, 151, 151,
  2929. 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
  2930. 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
  2931. 151, 151, 151, -1, 152, 152, 152, 152, 152, 152,
  2932. 152, 152, 152, 152, 152, 152, 152, 152, 152, 152,
  2933. 152, 152, 152, 152, 152, 152, 152, 152, 152, -1,
  2934. 153, -1, 154, 154, 154, 154, 154, -1, 155
  2935. ];
  2936. PHP.Parser.prototype.yybase = [
  2937. 0, 220, 295, 94, 180, 560, -2, -2, -2, -2,
  2938. -36, 473, 574, 606, 574, 505, 404, 675, 675, 675,
  2939. 28, 351, 462, 462, 462, 461, 396, 476, 451, 134,
  2940. 134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
  2941. 134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
  2942. 134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
  2943. 134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
  2944. 134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
  2945. 134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
  2946. 134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
  2947. 134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
  2948. 134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
  2949. 134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
  2950. 134, 134, 134, 401, 64, 201, 568, 704, 713, 708,
  2951. 702, 714, 520, 706, 705, 211, 650, 651, 450, 652,
  2952. 653, 654, 655, 709, 480, 703, 712, 418, 418, 418,
  2953. 418, 418, 418, 418, 418, 418, 418, 418, 418, 418,
  2954. 418, 418, 418, 48, 30, 469, 403, 403, 403, 403,
  2955. 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
  2956. 403, 403, 403, 403, 403, 160, 160, 160, 343, 210,
  2957. 208, 198, 17, 233, 27, 780, 780, 780, 780, 780,
  2958. 108, 108, 108, 108, 621, 621, 93, 280, 280, 280,
  2959. 280, 280, 280, 280, 280, 280, 280, 280, 632, 641,
  2960. 642, 643, 392, 392, 151, 151, 151, 151, 368, -45,
  2961. 146, 224, 224, 95, 410, 491, 733, 199, 199, 111,
  2962. 207, -22, -22, -22, 81, 506, 92, 92, 233, 233,
  2963. 273, 233, 423, 423, 423, 221, 221, 221, 221, 221,
  2964. 110, 221, 221, 221, 617, 512, 168, 516, 647, 397,
  2965. 503, 656, 274, 381, 377, 538, 535, 337, 523, 337,
  2966. 421, 441, 428, 525, 337, 337, 285, 401, 394, 378,
  2967. 567, 474, 339, 564, 140, 179, 409, 399, 384, 594,
  2968. 561, 711, 330, 710, 358, 149, 378, 378, 378, 370,
  2969. 593, 548, 355, -8, 646, 484, 277, 417, 386, 645,
  2970. 635, 230, 634, 276, 331, 356, 565, 485, 485, 485,
  2971. 485, 485, 485, 460, 485, 483, 691, 691, 478, 501,
  2972. 460, 696, 460, 485, 691, 460, 460, 502, 485, 522,
  2973. 522, 483, 508, 499, 691, 691, 499, 478, 460, 571,
  2974. 551, 514, 482, 413, 413, 514, 460, 413, 501, 413,
  2975. 11, 697, 699, 444, 700, 695, 698, 676, 694, 493,
  2976. 615, 497, 515, 684, 683, 693, 479, 489, 620, 692,
  2977. 549, 592, 487, 246, 314, 498, 463, 689, 523, 486,
  2978. 455, 455, 455, 463, 687, 455, 455, 455, 455, 455,
  2979. 455, 455, 455, 732, 24, 495, 510, 591, 590, 589,
  2980. 406, 588, 496, 524, 422, 599, 488, 549, 549, 649,
  2981. 727, 673, 490, 682, 716, 690, 555, 119, 271, 681,
  2982. 648, 543, 492, 534, 680, 598, 246, 715, 494, 672,
  2983. 549, 671, 455, 674, 701, 730, 731, 688, 728, 722,
  2984. 152, 526, 587, 178, 729, 659, 596, 595, 554, 725,
  2985. 707, 721, 720, 178, 576, 511, 717, 518, 677, 504,
  2986. 678, 613, 258, 657, 686, 584, 724, 723, 726, 583,
  2987. 582, 609, 608, 250, 236, 685, 442, 458, 517, 581,
  2988. 500, 628, 604, 679, 580, 579, 623, 619, 718, 521,
  2989. 486, 519, 509, 507, 513, 600, 618, 719, 206, 578,
  2990. 586, 573, 481, 572, 631, 0, 0, 0, 0, 0,
  2991. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  2992. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  2993. 0, 0, 0, 0, 0, 134, 134, -2, -2, -2,
  2994. 0, 0, 0, 0, -2, 134, 134, 134, 134, 134,
  2995. 134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
  2996. 134, 134, 134, 0, 0, 0, 0, 0, 0, 0,
  2997. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  2998. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  2999. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  3000. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  3001. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  3002. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  3003. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  3004. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  3005. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  3006. 0, 0, 0, 0, 0, 0, 0, 418, 418, 418,
  3007. 418, 418, 418, 418, 418, 418, 418, 418, 418, 418,
  3008. 418, 418, 418, 418, 418, 418, 418, 418, 418, 418,
  3009. 418, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  3010. 0, 0, 0, 0, 0, 0, 0, 418, 418, 418,
  3011. 418, 418, 418, 418, 418, 418, 418, 418, 418, 418,
  3012. 418, 418, 418, 418, 418, 418, 418, 418, 418, 418,
  3013. 418, 418, 418, 418, -3, 418, 418, -3, 418, 418,
  3014. 418, 418, 418, 418, -22, -22, -22, -22, 221, 221,
  3015. 221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
  3016. 221, 221, 49, 49, 49, 49, -22, -22, 221, 221,
  3017. 221, 221, 221, 49, 221, 221, 221, 92, 221, 92,
  3018. 92, 337, 337, 0, 0, 0, 0, 0, 485, 92,
  3019. 0, 0, 0, 0, 0, 0, 485, 485, 485, 0,
  3020. 0, 0, 0, 0, 485, 0, 0, 0, 337, 92,
  3021. 0, 420, 420, 178, 420, 420, 0, 0, 0, 485,
  3022. 485, 0, 508, 0, 0, 0, 0, 691, 0, 0,
  3023. 0, 0, 0, 455, 119, 682, 0, 39, 0, 0,
  3024. 0, 0, 0, 490, 39, 26, 0, 26, 0, 0,
  3025. 455, 455, 455, 0, 490, 490, 0, 0, 67, 490,
  3026. 0, 0, 0, 67, 35, 0, 35, 0, 0, 0,
  3027. 178
  3028. ];
  3029. PHP.Parser.prototype.yydefault = [
  3030. 3,32767,32767,32767,32767,32767,32767,32767,32767,32767,
  3031. 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
  3032. 32767,32767, 468, 468, 468,32767,32767,32767,32767, 285,
  3033. 460, 285, 285,32767, 419, 419, 419, 419, 419, 419,
  3034. 419, 460,32767,32767,32767,32767,32767, 364,32767,32767,
  3035. 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
  3036. 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
  3037. 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
  3038. 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
  3039. 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
  3040. 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
  3041. 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
  3042. 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
  3043. 32767,32767,32767,32767,32767, 465,32767,32767,32767,32767,
  3044. 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
  3045. 32767,32767,32767,32767,32767,32767,32767, 347, 348, 350,
  3046. 351, 284, 420, 237, 464, 283, 116, 246, 239, 191,
  3047. 282, 223, 119, 312, 365, 314, 363, 367, 313, 290,
  3048. 294, 295, 296, 297, 298, 299, 300, 301, 302, 303,
  3049. 304, 305, 288, 289, 366, 344, 343, 342, 310, 311,
  3050. 287, 315, 317, 287, 316, 333, 334, 331, 332, 335,
  3051. 336, 337, 338, 339,32767,32767,32767,32767,32767,32767,
  3052. 32767,32767,32767,32767,32767,32767,32767,32767, 269, 269,
  3053. 269, 269, 324, 325, 229, 229, 229, 229,32767, 270,
  3054. 32767, 229,32767,32767,32767,32767,32767,32767,32767, 413,
  3055. 341, 319, 320, 318,32767, 392,32767, 394, 307, 309,
  3056. 387, 291,32767,32767,32767,32767,32767,32767,32767,32767,
  3057. 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
  3058. 32767,32767, 389, 421, 421,32767,32767,32767, 381,32767,
  3059. 159, 210, 212, 397,32767,32767,32767,32767,32767, 329,
  3060. 32767,32767,32767,32767,32767,32767, 474,32767,32767,32767,
  3061. 32767,32767, 421,32767,32767,32767, 321, 322, 323,32767,
  3062. 32767,32767, 421, 421,32767,32767, 421,32767, 421,32767,
  3063. 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
  3064. 32767,32767,32767, 163,32767,32767, 395, 395,32767,32767,
  3065. 163, 390, 163,32767,32767, 163, 163, 176,32767, 174,
  3066. 174,32767,32767, 178,32767, 435, 178,32767, 163, 196,
  3067. 196, 373, 165, 231, 231, 373, 163, 231,32767, 231,
  3068. 32767,32767,32767, 82,32767,32767,32767,32767,32767,32767,
  3069. 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
  3070. 383,32767,32767,32767, 401,32767, 414, 433, 381,32767,
  3071. 327, 328, 330,32767, 423, 352, 353, 354, 355, 356,
  3072. 357, 358, 360,32767, 461, 386,32767,32767,32767,32767,
  3073. 32767,32767, 84, 108, 245,32767, 473, 84, 384,32767,
  3074. 473,32767,32767,32767,32767,32767,32767, 286,32767,32767,
  3075. 32767, 84,32767, 84,32767,32767, 457,32767,32767, 421,
  3076. 385,32767, 326, 398, 439,32767,32767, 422,32767,32767,
  3077. 218, 84,32767, 177,32767,32767,32767,32767,32767,32767,
  3078. 401,32767,32767, 179,32767,32767, 421,32767,32767,32767,
  3079. 32767,32767, 281,32767,32767,32767,32767,32767, 421,32767,
  3080. 32767,32767,32767, 222,32767,32767,32767,32767,32767,32767,
  3081. 32767,32767,32767,32767,32767,32767,32767,32767,32767, 82,
  3082. 60,32767, 263,32767,32767,32767,32767,32767,32767,32767,
  3083. 32767,32767,32767,32767,32767, 121, 121, 3, 3, 121,
  3084. 121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
  3085. 121, 121, 121, 121, 248, 154, 248, 204, 248, 248,
  3086. 207, 196, 196, 255
  3087. ];
  3088. PHP.Parser.prototype.yygoto = [
  3089. 163, 163, 135, 135, 135, 146, 148, 179, 164, 161,
  3090. 145, 161, 161, 161, 162, 162, 162, 162, 162, 162,
  3091. 162, 145, 157, 158, 159, 160, 176, 174, 177, 410,
  3092. 411, 299, 412, 415, 416, 417, 418, 419, 420, 421,
  3093. 422, 857, 136, 137, 138, 139, 140, 141, 142, 143,
  3094. 144, 147, 173, 175, 178, 195, 198, 199, 201, 202,
  3095. 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
  3096. 232, 233, 251, 252, 253, 316, 317, 318, 462, 180,
  3097. 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
  3098. 191, 192, 193, 149, 194, 150, 165, 166, 167, 196,
  3099. 168, 151, 152, 153, 169, 154, 197, 133, 170, 155,
  3100. 171, 172, 156, 521, 200, 257, 246, 464, 432, 687,
  3101. 649, 278, 481, 482, 527, 200, 437, 437, 437, 766,
  3102. 5, 746, 650, 557, 437, 426, 775, 770, 428, 431,
  3103. 444, 465, 466, 468, 483, 279, 651, 336, 450, 453,
  3104. 437, 560, 485, 487, 508, 511, 763, 516, 517, 777,
  3105. 524, 762, 526, 532, 773, 534, 480, 480, 965, 965,
  3106. 965, 965, 965, 965, 965, 965, 965, 965, 965, 965,
  3107. 413, 413, 413, 413, 413, 413, 413, 413, 413, 413,
  3108. 413, 413, 413, 413, 942, 502, 478, 496, 512, 456,
  3109. 298, 437, 437, 451, 471, 437, 437, 674, 437, 229,
  3110. 456, 230, 231, 463, 828, 533, 681, 438, 513, 826,
  3111. 461, 475, 460, 414, 414, 414, 414, 414, 414, 414,
  3112. 414, 414, 414, 414, 414, 414, 414, 301, 674, 674,
  3113. 443, 454, 1033, 1033, 1034, 1034, 425, 531, 425, 708,
  3114. 750, 800, 457, 372, 1033, 943, 1034, 1026, 300, 1018,
  3115. 497, 8, 313, 904, 796, 944, 996, 785, 789, 1007,
  3116. 285, 670, 1036, 329, 307, 310, 804, 668, 544, 332,
  3117. 935, 940, 366, 807, 678, 477, 377, 754, 844, 0,
  3118. 667, 667, 675, 675, 675, 677, 0, 666, 323, 498,
  3119. 328, 312, 312, 258, 259, 283, 459, 261, 322, 284,
  3120. 326, 486, 280, 281, 0, 0, 0, 0, 0, 0,
  3121. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  3122. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  3123. 0, 0, 0, 790, 790, 790, 790, 946, 0, 946,
  3124. 790, 790, 1004, 790, 1004, 0, 0, 0, 0, 836,
  3125. 0, 1015, 1015, 0, 0, 0, 0, 0, 0, 0,
  3126. 0, 0, 0, 0, 744, 744, 744, 720, 744, 0,
  3127. 739, 745, 721, 780, 780, 1023, 0, 0, 1002, 0,
  3128. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  3129. 0, 806, 0, 806, 0, 0, 0, 0, 1008, 1009
  3130. ];
  3131. PHP.Parser.prototype.yygcheck = [
  3132. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3133. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3134. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3135. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3136. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3137. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3138. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3139. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3140. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3141. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3142. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3143. 23, 23, 23, 52, 45, 112, 112, 80, 8, 10,
  3144. 10, 64, 55, 55, 55, 45, 8, 8, 8, 10,
  3145. 92, 10, 11, 10, 8, 10, 10, 10, 38, 38,
  3146. 38, 38, 38, 38, 62, 62, 12, 62, 28, 8,
  3147. 8, 28, 28, 28, 28, 28, 28, 28, 28, 28,
  3148. 28, 28, 28, 28, 28, 28, 70, 70, 70, 70,
  3149. 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
  3150. 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
  3151. 113, 113, 113, 113, 76, 56, 35, 35, 56, 69,
  3152. 56, 8, 8, 8, 8, 8, 8, 19, 8, 60,
  3153. 69, 60, 60, 7, 7, 7, 25, 8, 7, 7,
  3154. 2, 2, 8, 115, 115, 115, 115, 115, 115, 115,
  3155. 115, 115, 115, 115, 115, 115, 115, 53, 19, 19,
  3156. 53, 53, 123, 123, 124, 124, 109, 5, 109, 44,
  3157. 29, 78, 114, 53, 123, 76, 124, 122, 41, 120,
  3158. 43, 53, 42, 96, 74, 76, 76, 72, 75, 117,
  3159. 14, 21, 123, 18, 9, 13, 79, 20, 66, 17,
  3160. 102, 104, 58, 81, 22, 59, 100, 63, 94, -1,
  3161. 19, 19, 19, 19, 19, 19, -1, 19, 45, 45,
  3162. 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
  3163. 45, 45, 64, 64, -1, -1, -1, -1, -1, -1,
  3164. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  3165. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  3166. -1, -1, -1, 52, 52, 52, 52, 52, -1, 52,
  3167. 52, 52, 80, 52, 80, -1, -1, -1, -1, 92,
  3168. -1, 80, 80, -1, -1, -1, -1, -1, -1, -1,
  3169. -1, -1, -1, -1, 52, 52, 52, 52, 52, -1,
  3170. 52, 52, 52, 69, 69, 69, -1, -1, 80, -1,
  3171. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  3172. -1, 80, -1, 80, -1, -1, -1, -1, 80, 80
  3173. ];
  3174. PHP.Parser.prototype.yygbase = [
  3175. 0, 0, -317, 0, 0, 237, 0, 210, -136, 4,
  3176. 118, 130, 144, -10, 16, 0, 0, -59, 10, -47,
  3177. -9, 7, -77, -20, 0, 209, 0, 0, -388, 234,
  3178. 0, 0, 0, 0, 0, 165, 0, 0, 103, 0,
  3179. 0, 225, 44, 45, 235, 84, 0, 0, 0, 0,
  3180. 0, 0, 109, -115, 0, -113, -179, 0, -78, -81,
  3181. -347, 0, -122, -80, -249, 0, -19, 0, 0, 169,
  3182. -48, 0, 26, 0, 22, 24, -99, 0, 230, -13,
  3183. 114, -79, 0, 0, 0, 0, 0, 0, 0, 0,
  3184. 0, 0, 120, 0, -90, 0, 23, 0, 0, 0,
  3185. -89, 0, -67, 0, -69, 0, 0, 0, 0, 8,
  3186. 0, 0, -140, -34, 229, 9, 0, 21, 0, 0,
  3187. 218, 0, 233, -3, -1, 0
  3188. ];
  3189. PHP.Parser.prototype.yygdefault = [
  3190. -32768, 380, 565, 2, 566, 637, 645, 504, 400, 433,
  3191. 748, 688, 689, 303, 342, 401, 302, 330, 324, 676,
  3192. 669, 671, 679, 134, 333, 682, 1, 684, 439, 716,
  3193. 291, 692, 292, 507, 694, 446, 696, 697, 427, 304,
  3194. 305, 447, 311, 479, 707, 203, 308, 709, 290, 710,
  3195. 719, 335, 293, 510, 489, 469, 501, 402, 363, 476,
  3196. 228, 455, 473, 753, 277, 761, 549, 769, 772, 403,
  3197. 404, 470, 784, 368, 794, 788, 960, 319, 799, 805,
  3198. 991, 808, 811, 349, 331, 327, 815, 816, 4, 820,
  3199. 522, 523, 835, 239, 843, 856, 347, 923, 925, 441,
  3200. 374, 936, 360, 334, 939, 995, 354, 405, 364, 952,
  3201. 260, 282, 245, 406, 423, 249, 407, 365, 998, 314,
  3202. 1019, 424, 1027, 1035, 275, 474
  3203. ];
  3204. PHP.Parser.prototype.yylhs = [
  3205. 0, 1, 3, 3, 2, 5, 5, 5, 5, 5,
  3206. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  3207. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  3208. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  3209. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  3210. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  3211. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  3212. 5, 5, 5, 6, 6, 6, 6, 6, 6, 6,
  3213. 7, 7, 8, 8, 9, 4, 4, 4, 4, 4,
  3214. 4, 4, 4, 4, 4, 4, 14, 14, 15, 15,
  3215. 15, 15, 17, 17, 13, 13, 18, 18, 19, 19,
  3216. 20, 20, 21, 21, 16, 16, 22, 24, 24, 25,
  3217. 26, 26, 28, 27, 27, 27, 27, 29, 29, 29,
  3218. 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
  3219. 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
  3220. 29, 29, 10, 10, 48, 48, 51, 51, 50, 49,
  3221. 49, 42, 42, 53, 53, 54, 54, 11, 12, 12,
  3222. 12, 57, 57, 57, 58, 58, 61, 61, 59, 59,
  3223. 62, 62, 36, 36, 44, 44, 47, 47, 47, 46,
  3224. 46, 63, 37, 37, 37, 37, 64, 64, 65, 65,
  3225. 66, 66, 34, 34, 30, 30, 67, 32, 32, 68,
  3226. 31, 31, 33, 33, 43, 43, 43, 43, 55, 55,
  3227. 71, 71, 72, 72, 74, 74, 75, 75, 75, 73,
  3228. 73, 56, 56, 76, 76, 77, 77, 78, 78, 78,
  3229. 39, 39, 79, 40, 40, 81, 81, 60, 60, 82,
  3230. 82, 82, 82, 87, 87, 88, 88, 89, 89, 89,
  3231. 89, 89, 90, 91, 91, 86, 86, 83, 83, 85,
  3232. 85, 93, 93, 92, 92, 92, 92, 92, 92, 84,
  3233. 84, 94, 94, 41, 41, 35, 35, 23, 23, 23,
  3234. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3235. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3236. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3237. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3238. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3239. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3240. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3241. 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
  3242. 101, 95, 95, 100, 100, 103, 103, 104, 105, 105,
  3243. 105, 109, 109, 52, 52, 52, 96, 96, 107, 107,
  3244. 97, 97, 99, 99, 99, 102, 102, 113, 113, 70,
  3245. 115, 115, 115, 98, 98, 98, 98, 98, 98, 98,
  3246. 98, 98, 98, 98, 98, 98, 98, 98, 98, 38,
  3247. 38, 111, 111, 111, 106, 106, 106, 116, 116, 116,
  3248. 116, 116, 116, 45, 45, 45, 80, 80, 80, 118,
  3249. 110, 110, 110, 110, 110, 110, 108, 108, 108, 117,
  3250. 117, 117, 117, 69, 119, 119, 120, 120, 120, 120,
  3251. 120, 114, 121, 121, 122, 122, 122, 122, 122, 112,
  3252. 112, 112, 112, 124, 123, 123, 123, 123, 123, 123,
  3253. 123, 125, 125, 125
  3254. ];
  3255. PHP.Parser.prototype.yylen = [
  3256. 1, 1, 2, 0, 1, 1, 1, 1, 1, 1,
  3257. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  3258. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  3259. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  3260. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  3261. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  3262. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  3263. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  3264. 1, 1, 1, 3, 1, 1, 1, 1, 1, 3,
  3265. 5, 4, 3, 4, 2, 3, 1, 1, 7, 8,
  3266. 6, 7, 3, 1, 3, 1, 3, 1, 1, 3,
  3267. 1, 2, 1, 2, 3, 1, 3, 3, 1, 3,
  3268. 2, 0, 1, 1, 1, 1, 1, 3, 7, 10,
  3269. 5, 7, 9, 5, 3, 3, 3, 3, 3, 3,
  3270. 1, 2, 5, 7, 9, 5, 6, 3, 3, 2,
  3271. 2, 1, 1, 1, 0, 2, 1, 3, 8, 0,
  3272. 4, 1, 3, 0, 1, 0, 1, 10, 7, 6,
  3273. 5, 1, 2, 2, 0, 2, 0, 2, 0, 2,
  3274. 1, 3, 1, 4, 1, 4, 1, 1, 4, 1,
  3275. 3, 3, 3, 4, 4, 5, 0, 2, 4, 3,
  3276. 1, 1, 1, 4, 0, 2, 5, 0, 2, 6,
  3277. 0, 2, 0, 3, 1, 2, 1, 1, 1, 0,
  3278. 1, 3, 4, 6, 1, 2, 1, 1, 1, 0,
  3279. 1, 0, 2, 2, 3, 1, 3, 1, 2, 2,
  3280. 3, 1, 1, 3, 1, 1, 3, 2, 0, 3,
  3281. 4, 9, 3, 1, 3, 0, 2, 4, 5, 4,
  3282. 4, 4, 3, 1, 1, 1, 3, 1, 1, 0,
  3283. 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
  3284. 3, 1, 3, 3, 1, 0, 1, 1, 3, 3,
  3285. 3, 4, 1, 2, 3, 3, 3, 3, 3, 3,
  3286. 3, 3, 3, 3, 3, 3, 2, 2, 2, 2,
  3287. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  3288. 3, 3, 3, 3, 3, 3, 3, 2, 2, 2,
  3289. 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  3290. 3, 3, 5, 4, 3, 4, 4, 2, 2, 4,
  3291. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  3292. 2, 1, 3, 2, 1, 2, 4, 2, 10, 11,
  3293. 7, 3, 2, 0, 4, 1, 3, 2, 2, 2,
  3294. 4, 1, 1, 1, 2, 3, 1, 1, 1, 1,
  3295. 0, 3, 0, 1, 1, 0, 1, 1, 3, 3,
  3296. 4, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  3297. 1, 1, 1, 1, 1, 3, 2, 3, 3, 0,
  3298. 1, 1, 3, 1, 1, 3, 1, 1, 4, 4,
  3299. 4, 1, 4, 1, 1, 3, 1, 4, 2, 3,
  3300. 1, 4, 4, 3, 3, 3, 1, 3, 1, 1,
  3301. 3, 1, 1, 4, 3, 1, 1, 1, 3, 3,
  3302. 0, 1, 3, 1, 3, 1, 4, 2, 0, 2,
  3303. 2, 1, 2, 1, 1, 4, 3, 3, 3, 6,
  3304. 3, 1, 1, 1
  3305. ];
  3306. exports.PHP = PHP;
  3307. });
  3308. ace.define("ace/mode/php_worker",["require","exports","module","ace/lib/oop","ace/worker/mirror","ace/mode/php/php"], function(require, exports, module) {
  3309. "use strict";
  3310. var oop = require("../lib/oop");
  3311. var Mirror = require("../worker/mirror").Mirror;
  3312. var PHP = require("./php/php").PHP;
  3313. var PhpWorker = exports.PhpWorker = function(sender) {
  3314. Mirror.call(this, sender);
  3315. this.setTimeout(500);
  3316. };
  3317. oop.inherits(PhpWorker, Mirror);
  3318. (function() {
  3319. this.setOptions = function(opts) {
  3320. this.inlinePhp = opts && opts.inline;
  3321. };
  3322. this.onUpdate = function() {
  3323. var value = this.doc.getValue();
  3324. var errors = [];
  3325. if (this.inlinePhp)
  3326. value = "<?" + value + "?>";
  3327. var tokens = PHP.Lexer(value, {short_open_tag: 1});
  3328. try {
  3329. new PHP.Parser(tokens);
  3330. } catch(e) {
  3331. errors.push({
  3332. row: e.line - 1,
  3333. column: null,
  3334. text: e.message.charAt(0).toUpperCase() + e.message.substring(1),
  3335. type: "error"
  3336. });
  3337. }
  3338. this.sender.emit("annotate", errors);
  3339. };
  3340. }).call(PhpWorker.prototype);
  3341. });
  3342. ace.define("ace/lib/es5-shim",["require","exports","module"], function(require, exports, module) {
  3343. function Empty() {}
  3344. if (!Function.prototype.bind) {
  3345. Function.prototype.bind = function bind(that) { // .length is 1
  3346. var target = this;
  3347. if (typeof target != "function") {
  3348. throw new TypeError("Function.prototype.bind called on incompatible " + target);
  3349. }
  3350. var args = slice.call(arguments, 1); // for normal call
  3351. var bound = function () {
  3352. if (this instanceof bound) {
  3353. var result = target.apply(
  3354. this,
  3355. args.concat(slice.call(arguments))
  3356. );
  3357. if (Object(result) === result) {
  3358. return result;
  3359. }
  3360. return this;
  3361. } else {
  3362. return target.apply(
  3363. that,
  3364. args.concat(slice.call(arguments))
  3365. );
  3366. }
  3367. };
  3368. if(target.prototype) {
  3369. Empty.prototype = target.prototype;
  3370. bound.prototype = new Empty();
  3371. Empty.prototype = null;
  3372. }
  3373. return bound;
  3374. };
  3375. }
  3376. var call = Function.prototype.call;
  3377. var prototypeOfArray = Array.prototype;
  3378. var prototypeOfObject = Object.prototype;
  3379. var slice = prototypeOfArray.slice;
  3380. var _toString = call.bind(prototypeOfObject.toString);
  3381. var owns = call.bind(prototypeOfObject.hasOwnProperty);
  3382. var defineGetter;
  3383. var defineSetter;
  3384. var lookupGetter;
  3385. var lookupSetter;
  3386. var supportsAccessors;
  3387. if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
  3388. defineGetter = call.bind(prototypeOfObject.__defineGetter__);
  3389. defineSetter = call.bind(prototypeOfObject.__defineSetter__);
  3390. lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
  3391. lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
  3392. }
  3393. if ([1,2].splice(0).length != 2) {
  3394. if(function() { // test IE < 9 to splice bug - see issue #138
  3395. function makeArray(l) {
  3396. var a = new Array(l+2);
  3397. a[0] = a[1] = 0;
  3398. return a;
  3399. }
  3400. var array = [], lengthBefore;
  3401. array.splice.apply(array, makeArray(20));
  3402. array.splice.apply(array, makeArray(26));
  3403. lengthBefore = array.length; //46
  3404. array.splice(5, 0, "XXX"); // add one element
  3405. lengthBefore + 1 == array.length
  3406. if (lengthBefore + 1 == array.length) {
  3407. return true;// has right splice implementation without bugs
  3408. }
  3409. }()) {//IE 6/7
  3410. var array_splice = Array.prototype.splice;
  3411. Array.prototype.splice = function(start, deleteCount) {
  3412. if (!arguments.length) {
  3413. return [];
  3414. } else {
  3415. return array_splice.apply(this, [
  3416. start === void 0 ? 0 : start,
  3417. deleteCount === void 0 ? (this.length - start) : deleteCount
  3418. ].concat(slice.call(arguments, 2)))
  3419. }
  3420. };
  3421. } else {//IE8
  3422. Array.prototype.splice = function(pos, removeCount){
  3423. var length = this.length;
  3424. if (pos > 0) {
  3425. if (pos > length)
  3426. pos = length;
  3427. } else if (pos == void 0) {
  3428. pos = 0;
  3429. } else if (pos < 0) {
  3430. pos = Math.max(length + pos, 0);
  3431. }
  3432. if (!(pos+removeCount < length))
  3433. removeCount = length - pos;
  3434. var removed = this.slice(pos, pos+removeCount);
  3435. var insert = slice.call(arguments, 2);
  3436. var add = insert.length;
  3437. if (pos === length) {
  3438. if (add) {
  3439. this.push.apply(this, insert);
  3440. }
  3441. } else {
  3442. var remove = Math.min(removeCount, length - pos);
  3443. var tailOldPos = pos + remove;
  3444. var tailNewPos = tailOldPos + add - remove;
  3445. var tailCount = length - tailOldPos;
  3446. var lengthAfterRemove = length - remove;
  3447. if (tailNewPos < tailOldPos) { // case A
  3448. for (var i = 0; i < tailCount; ++i) {
  3449. this[tailNewPos+i] = this[tailOldPos+i];
  3450. }
  3451. } else if (tailNewPos > tailOldPos) { // case B
  3452. for (i = tailCount; i--; ) {
  3453. this[tailNewPos+i] = this[tailOldPos+i];
  3454. }
  3455. } // else, add == remove (nothing to do)
  3456. if (add && pos === lengthAfterRemove) {
  3457. this.length = lengthAfterRemove; // truncate array
  3458. this.push.apply(this, insert);
  3459. } else {
  3460. this.length = lengthAfterRemove + add; // reserves space
  3461. for (i = 0; i < add; ++i) {
  3462. this[pos+i] = insert[i];
  3463. }
  3464. }
  3465. }
  3466. return removed;
  3467. };
  3468. }
  3469. }
  3470. if (!Array.isArray) {
  3471. Array.isArray = function isArray(obj) {
  3472. return _toString(obj) == "[object Array]";
  3473. };
  3474. }
  3475. var boxedString = Object("a"),
  3476. splitString = boxedString[0] != "a" || !(0 in boxedString);
  3477. if (!Array.prototype.forEach) {
  3478. Array.prototype.forEach = function forEach(fun /*, thisp*/) {
  3479. var object = toObject(this),
  3480. self = splitString && _toString(this) == "[object String]" ?
  3481. this.split("") :
  3482. object,
  3483. thisp = arguments[1],
  3484. i = -1,
  3485. length = self.length >>> 0;
  3486. if (_toString(fun) != "[object Function]") {
  3487. throw new TypeError(); // TODO message
  3488. }
  3489. while (++i < length) {
  3490. if (i in self) {
  3491. fun.call(thisp, self[i], i, object);
  3492. }
  3493. }
  3494. };
  3495. }
  3496. if (!Array.prototype.map) {
  3497. Array.prototype.map = function map(fun /*, thisp*/) {
  3498. var object = toObject(this),
  3499. self = splitString && _toString(this) == "[object String]" ?
  3500. this.split("") :
  3501. object,
  3502. length = self.length >>> 0,
  3503. result = Array(length),
  3504. thisp = arguments[1];
  3505. if (_toString(fun) != "[object Function]") {
  3506. throw new TypeError(fun + " is not a function");
  3507. }
  3508. for (var i = 0; i < length; i++) {
  3509. if (i in self)
  3510. result[i] = fun.call(thisp, self[i], i, object);
  3511. }
  3512. return result;
  3513. };
  3514. }
  3515. if (!Array.prototype.filter) {
  3516. Array.prototype.filter = function filter(fun /*, thisp */) {
  3517. var object = toObject(this),
  3518. self = splitString && _toString(this) == "[object String]" ?
  3519. this.split("") :
  3520. object,
  3521. length = self.length >>> 0,
  3522. result = [],
  3523. value,
  3524. thisp = arguments[1];
  3525. if (_toString(fun) != "[object Function]") {
  3526. throw new TypeError(fun + " is not a function");
  3527. }
  3528. for (var i = 0; i < length; i++) {
  3529. if (i in self) {
  3530. value = self[i];
  3531. if (fun.call(thisp, value, i, object)) {
  3532. result.push(value);
  3533. }
  3534. }
  3535. }
  3536. return result;
  3537. };
  3538. }
  3539. if (!Array.prototype.every) {
  3540. Array.prototype.every = function every(fun /*, thisp */) {
  3541. var object = toObject(this),
  3542. self = splitString && _toString(this) == "[object String]" ?
  3543. this.split("") :
  3544. object,
  3545. length = self.length >>> 0,
  3546. thisp = arguments[1];
  3547. if (_toString(fun) != "[object Function]") {
  3548. throw new TypeError(fun + " is not a function");
  3549. }
  3550. for (var i = 0; i < length; i++) {
  3551. if (i in self && !fun.call(thisp, self[i], i, object)) {
  3552. return false;
  3553. }
  3554. }
  3555. return true;
  3556. };
  3557. }
  3558. if (!Array.prototype.some) {
  3559. Array.prototype.some = function some(fun /*, thisp */) {
  3560. var object = toObject(this),
  3561. self = splitString && _toString(this) == "[object String]" ?
  3562. this.split("") :
  3563. object,
  3564. length = self.length >>> 0,
  3565. thisp = arguments[1];
  3566. if (_toString(fun) != "[object Function]") {
  3567. throw new TypeError(fun + " is not a function");
  3568. }
  3569. for (var i = 0; i < length; i++) {
  3570. if (i in self && fun.call(thisp, self[i], i, object)) {
  3571. return true;
  3572. }
  3573. }
  3574. return false;
  3575. };
  3576. }
  3577. if (!Array.prototype.reduce) {
  3578. Array.prototype.reduce = function reduce(fun /*, initial*/) {
  3579. var object = toObject(this),
  3580. self = splitString && _toString(this) == "[object String]" ?
  3581. this.split("") :
  3582. object,
  3583. length = self.length >>> 0;
  3584. if (_toString(fun) != "[object Function]") {
  3585. throw new TypeError(fun + " is not a function");
  3586. }
  3587. if (!length && arguments.length == 1) {
  3588. throw new TypeError("reduce of empty array with no initial value");
  3589. }
  3590. var i = 0;
  3591. var result;
  3592. if (arguments.length >= 2) {
  3593. result = arguments[1];
  3594. } else {
  3595. do {
  3596. if (i in self) {
  3597. result = self[i++];
  3598. break;
  3599. }
  3600. if (++i >= length) {
  3601. throw new TypeError("reduce of empty array with no initial value");
  3602. }
  3603. } while (true);
  3604. }
  3605. for (; i < length; i++) {
  3606. if (i in self) {
  3607. result = fun.call(void 0, result, self[i], i, object);
  3608. }
  3609. }
  3610. return result;
  3611. };
  3612. }
  3613. if (!Array.prototype.reduceRight) {
  3614. Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
  3615. var object = toObject(this),
  3616. self = splitString && _toString(this) == "[object String]" ?
  3617. this.split("") :
  3618. object,
  3619. length = self.length >>> 0;
  3620. if (_toString(fun) != "[object Function]") {
  3621. throw new TypeError(fun + " is not a function");
  3622. }
  3623. if (!length && arguments.length == 1) {
  3624. throw new TypeError("reduceRight of empty array with no initial value");
  3625. }
  3626. var result, i = length - 1;
  3627. if (arguments.length >= 2) {
  3628. result = arguments[1];
  3629. } else {
  3630. do {
  3631. if (i in self) {
  3632. result = self[i--];
  3633. break;
  3634. }
  3635. if (--i < 0) {
  3636. throw new TypeError("reduceRight of empty array with no initial value");
  3637. }
  3638. } while (true);
  3639. }
  3640. do {
  3641. if (i in this) {
  3642. result = fun.call(void 0, result, self[i], i, object);
  3643. }
  3644. } while (i--);
  3645. return result;
  3646. };
  3647. }
  3648. if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
  3649. Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
  3650. var self = splitString && _toString(this) == "[object String]" ?
  3651. this.split("") :
  3652. toObject(this),
  3653. length = self.length >>> 0;
  3654. if (!length) {
  3655. return -1;
  3656. }
  3657. var i = 0;
  3658. if (arguments.length > 1) {
  3659. i = toInteger(arguments[1]);
  3660. }
  3661. i = i >= 0 ? i : Math.max(0, length + i);
  3662. for (; i < length; i++) {
  3663. if (i in self && self[i] === sought) {
  3664. return i;
  3665. }
  3666. }
  3667. return -1;
  3668. };
  3669. }
  3670. if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
  3671. Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
  3672. var self = splitString && _toString(this) == "[object String]" ?
  3673. this.split("") :
  3674. toObject(this),
  3675. length = self.length >>> 0;
  3676. if (!length) {
  3677. return -1;
  3678. }
  3679. var i = length - 1;
  3680. if (arguments.length > 1) {
  3681. i = Math.min(i, toInteger(arguments[1]));
  3682. }
  3683. i = i >= 0 ? i : length - Math.abs(i);
  3684. for (; i >= 0; i--) {
  3685. if (i in self && sought === self[i]) {
  3686. return i;
  3687. }
  3688. }
  3689. return -1;
  3690. };
  3691. }
  3692. if (!Object.getPrototypeOf) {
  3693. Object.getPrototypeOf = function getPrototypeOf(object) {
  3694. return object.__proto__ || (
  3695. object.constructor ?
  3696. object.constructor.prototype :
  3697. prototypeOfObject
  3698. );
  3699. };
  3700. }
  3701. if (!Object.getOwnPropertyDescriptor) {
  3702. var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
  3703. "non-object: ";
  3704. Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
  3705. if ((typeof object != "object" && typeof object != "function") || object === null)
  3706. throw new TypeError(ERR_NON_OBJECT + object);
  3707. if (!owns(object, property))
  3708. return;
  3709. var descriptor, getter, setter;
  3710. descriptor = { enumerable: true, configurable: true };
  3711. if (supportsAccessors) {
  3712. var prototype = object.__proto__;
  3713. object.__proto__ = prototypeOfObject;
  3714. var getter = lookupGetter(object, property);
  3715. var setter = lookupSetter(object, property);
  3716. object.__proto__ = prototype;
  3717. if (getter || setter) {
  3718. if (getter) descriptor.get = getter;
  3719. if (setter) descriptor.set = setter;
  3720. return descriptor;
  3721. }
  3722. }
  3723. descriptor.value = object[property];
  3724. return descriptor;
  3725. };
  3726. }
  3727. if (!Object.getOwnPropertyNames) {
  3728. Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
  3729. return Object.keys(object);
  3730. };
  3731. }
  3732. if (!Object.create) {
  3733. var createEmpty;
  3734. if (Object.prototype.__proto__ === null) {
  3735. createEmpty = function () {
  3736. return { "__proto__": null };
  3737. };
  3738. } else {
  3739. createEmpty = function () {
  3740. var empty = {};
  3741. for (var i in empty)
  3742. empty[i] = null;
  3743. empty.constructor =
  3744. empty.hasOwnProperty =
  3745. empty.propertyIsEnumerable =
  3746. empty.isPrototypeOf =
  3747. empty.toLocaleString =
  3748. empty.toString =
  3749. empty.valueOf =
  3750. empty.__proto__ = null;
  3751. return empty;
  3752. }
  3753. }
  3754. Object.create = function create(prototype, properties) {
  3755. var object;
  3756. if (prototype === null) {
  3757. object = createEmpty();
  3758. } else {
  3759. if (typeof prototype != "object")
  3760. throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
  3761. var Type = function () {};
  3762. Type.prototype = prototype;
  3763. object = new Type();
  3764. object.__proto__ = prototype;
  3765. }
  3766. if (properties !== void 0)
  3767. Object.defineProperties(object, properties);
  3768. return object;
  3769. };
  3770. }
  3771. function doesDefinePropertyWork(object) {
  3772. try {
  3773. Object.defineProperty(object, "sentinel", {});
  3774. return "sentinel" in object;
  3775. } catch (exception) {
  3776. }
  3777. }
  3778. if (Object.defineProperty) {
  3779. var definePropertyWorksOnObject = doesDefinePropertyWork({});
  3780. var definePropertyWorksOnDom = typeof document == "undefined" ||
  3781. doesDefinePropertyWork(document.createElement("div"));
  3782. if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
  3783. var definePropertyFallback = Object.defineProperty;
  3784. }
  3785. }
  3786. if (!Object.defineProperty || definePropertyFallback) {
  3787. var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
  3788. var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
  3789. var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
  3790. "on this javascript engine";
  3791. Object.defineProperty = function defineProperty(object, property, descriptor) {
  3792. if ((typeof object != "object" && typeof object != "function") || object === null)
  3793. throw new TypeError(ERR_NON_OBJECT_TARGET + object);
  3794. if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
  3795. throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
  3796. if (definePropertyFallback) {
  3797. try {
  3798. return definePropertyFallback.call(Object, object, property, descriptor);
  3799. } catch (exception) {
  3800. }
  3801. }
  3802. if (owns(descriptor, "value")) {
  3803. if (supportsAccessors && (lookupGetter(object, property) ||
  3804. lookupSetter(object, property)))
  3805. {
  3806. var prototype = object.__proto__;
  3807. object.__proto__ = prototypeOfObject;
  3808. delete object[property];
  3809. object[property] = descriptor.value;
  3810. object.__proto__ = prototype;
  3811. } else {
  3812. object[property] = descriptor.value;
  3813. }
  3814. } else {
  3815. if (!supportsAccessors)
  3816. throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
  3817. if (owns(descriptor, "get"))
  3818. defineGetter(object, property, descriptor.get);
  3819. if (owns(descriptor, "set"))
  3820. defineSetter(object, property, descriptor.set);
  3821. }
  3822. return object;
  3823. };
  3824. }
  3825. if (!Object.defineProperties) {
  3826. Object.defineProperties = function defineProperties(object, properties) {
  3827. for (var property in properties) {
  3828. if (owns(properties, property))
  3829. Object.defineProperty(object, property, properties[property]);
  3830. }
  3831. return object;
  3832. };
  3833. }
  3834. if (!Object.seal) {
  3835. Object.seal = function seal(object) {
  3836. return object;
  3837. };
  3838. }
  3839. if (!Object.freeze) {
  3840. Object.freeze = function freeze(object) {
  3841. return object;
  3842. };
  3843. }
  3844. try {
  3845. Object.freeze(function () {});
  3846. } catch (exception) {
  3847. Object.freeze = (function freeze(freezeObject) {
  3848. return function freeze(object) {
  3849. if (typeof object == "function") {
  3850. return object;
  3851. } else {
  3852. return freezeObject(object);
  3853. }
  3854. };
  3855. })(Object.freeze);
  3856. }
  3857. if (!Object.preventExtensions) {
  3858. Object.preventExtensions = function preventExtensions(object) {
  3859. return object;
  3860. };
  3861. }
  3862. if (!Object.isSealed) {
  3863. Object.isSealed = function isSealed(object) {
  3864. return false;
  3865. };
  3866. }
  3867. if (!Object.isFrozen) {
  3868. Object.isFrozen = function isFrozen(object) {
  3869. return false;
  3870. };
  3871. }
  3872. if (!Object.isExtensible) {
  3873. Object.isExtensible = function isExtensible(object) {
  3874. if (Object(object) === object) {
  3875. throw new TypeError(); // TODO message
  3876. }
  3877. var name = '';
  3878. while (owns(object, name)) {
  3879. name += '?';
  3880. }
  3881. object[name] = true;
  3882. var returnValue = owns(object, name);
  3883. delete object[name];
  3884. return returnValue;
  3885. };
  3886. }
  3887. if (!Object.keys) {
  3888. var hasDontEnumBug = true,
  3889. dontEnums = [
  3890. "toString",
  3891. "toLocaleString",
  3892. "valueOf",
  3893. "hasOwnProperty",
  3894. "isPrototypeOf",
  3895. "propertyIsEnumerable",
  3896. "constructor"
  3897. ],
  3898. dontEnumsLength = dontEnums.length;
  3899. for (var key in {"toString": null}) {
  3900. hasDontEnumBug = false;
  3901. }
  3902. Object.keys = function keys(object) {
  3903. if (
  3904. (typeof object != "object" && typeof object != "function") ||
  3905. object === null
  3906. ) {
  3907. throw new TypeError("Object.keys called on a non-object");
  3908. }
  3909. var keys = [];
  3910. for (var name in object) {
  3911. if (owns(object, name)) {
  3912. keys.push(name);
  3913. }
  3914. }
  3915. if (hasDontEnumBug) {
  3916. for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
  3917. var dontEnum = dontEnums[i];
  3918. if (owns(object, dontEnum)) {
  3919. keys.push(dontEnum);
  3920. }
  3921. }
  3922. }
  3923. return keys;
  3924. };
  3925. }
  3926. if (!Date.now) {
  3927. Date.now = function now() {
  3928. return new Date().getTime();
  3929. };
  3930. }
  3931. var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
  3932. "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
  3933. "\u2029\uFEFF";
  3934. if (!String.prototype.trim || ws.trim()) {
  3935. ws = "[" + ws + "]";
  3936. var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
  3937. trimEndRegexp = new RegExp(ws + ws + "*$");
  3938. String.prototype.trim = function trim() {
  3939. return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
  3940. };
  3941. }
  3942. function toInteger(n) {
  3943. n = +n;
  3944. if (n !== n) { // isNaN
  3945. n = 0;
  3946. } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
  3947. n = (n > 0 || -1) * Math.floor(Math.abs(n));
  3948. }
  3949. return n;
  3950. }
  3951. function isPrimitive(input) {
  3952. var type = typeof input;
  3953. return (
  3954. input === null ||
  3955. type === "undefined" ||
  3956. type === "boolean" ||
  3957. type === "number" ||
  3958. type === "string"
  3959. );
  3960. }
  3961. function toPrimitive(input) {
  3962. var val, valueOf, toString;
  3963. if (isPrimitive(input)) {
  3964. return input;
  3965. }
  3966. valueOf = input.valueOf;
  3967. if (typeof valueOf === "function") {
  3968. val = valueOf.call(input);
  3969. if (isPrimitive(val)) {
  3970. return val;
  3971. }
  3972. }
  3973. toString = input.toString;
  3974. if (typeof toString === "function") {
  3975. val = toString.call(input);
  3976. if (isPrimitive(val)) {
  3977. return val;
  3978. }
  3979. }
  3980. throw new TypeError();
  3981. }
  3982. var toObject = function (o) {
  3983. if (o == null) { // this matches both null and undefined
  3984. throw new TypeError("can't convert "+o+" to object");
  3985. }
  3986. return Object(o);
  3987. };
  3988. });