worker-php.js 147 KB

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