2
0

parser.js 114 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005
  1. smalltalk.parser = (function(){
  2. /* Generated by PEG.js 0.6.2 (http://pegjs.majda.cz/). */
  3. var result = {
  4. /*
  5. * Parses the input with a generated parser. If the parsing is successfull,
  6. * returns a value explicitly or implicitly specified by the grammar from
  7. * which the parser was generated (see |PEG.buildParser|). If the parsing is
  8. * unsuccessful, throws |PEG.parser.SyntaxError| describing the error.
  9. */
  10. parse: function(input, startRule) {
  11. var parseFunctions = {
  12. "assignment": parse_assignment,
  13. "binaryMessage": parse_binaryMessage,
  14. "binaryPattern": parse_binaryPattern,
  15. "binarySelector": parse_binarySelector,
  16. "binarySend": parse_binarySend,
  17. "binaryTail": parse_binaryTail,
  18. "block": parse_block,
  19. "blockParamList": parse_blockParamList,
  20. "cascade": parse_cascade,
  21. "className": parse_className,
  22. "classReference": parse_classReference,
  23. "comments": parse_comments,
  24. "dynamicArray": parse_dynamicArray,
  25. "dynamicDictionary": parse_dynamicDictionary,
  26. "expression": parse_expression,
  27. "expressionList": parse_expressionList,
  28. "expressions": parse_expressions,
  29. "float": parse_float,
  30. "identifier": parse_identifier,
  31. "integer": parse_integer,
  32. "jsStatement": parse_jsStatement,
  33. "keyword": parse_keyword,
  34. "keywordMessage": parse_keywordMessage,
  35. "keywordPair": parse_keywordPair,
  36. "keywordPattern": parse_keywordPattern,
  37. "keywordSend": parse_keywordSend,
  38. "literal": parse_literal,
  39. "literalArray": parse_literalArray,
  40. "message": parse_message,
  41. "method": parse_method,
  42. "number": parse_number,
  43. "operand": parse_operand,
  44. "pseudoVariable": parse_pseudoVariable,
  45. "reference": parse_reference,
  46. "ret": parse_ret,
  47. "separator": parse_separator,
  48. "sequence": parse_sequence,
  49. "statements": parse_statements,
  50. "string": parse_string,
  51. "subexpression": parse_subexpression,
  52. "symbol": parse_symbol,
  53. "temps": parse_temps,
  54. "unaryMessage": parse_unaryMessage,
  55. "unaryPattern": parse_unaryPattern,
  56. "unarySend": parse_unarySend,
  57. "unaryTail": parse_unaryTail,
  58. "variable": parse_variable,
  59. "ws": parse_ws
  60. };
  61. if (startRule !== undefined) {
  62. if (parseFunctions[startRule] === undefined) {
  63. throw new Error("Invalid rule name: " + quote(startRule) + ".");
  64. }
  65. } else {
  66. startRule = "method";
  67. }
  68. var pos = 0;
  69. var reportMatchFailures = true;
  70. var rightmostMatchFailuresPos = 0;
  71. var rightmostMatchFailuresExpected = [];
  72. var cache = {};
  73. function padLeft(input, padding, length) {
  74. var result = input;
  75. var padLength = length - input.length;
  76. for (var i = 0; i < padLength; i++) {
  77. result = padding + result;
  78. }
  79. return result;
  80. }
  81. function escape(ch) {
  82. var charCode = ch.charCodeAt(0);
  83. if (charCode <= 0xFF) {
  84. var escapeChar = 'x';
  85. var length = 2;
  86. } else {
  87. var escapeChar = 'u';
  88. var length = 4;
  89. }
  90. return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length);
  91. }
  92. function quote(s) {
  93. /*
  94. * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a
  95. * string literal except for the closing quote character, backslash,
  96. * carriage return, line separator, paragraph separator, and line feed.
  97. * Any character may appear in the form of an escape sequence.
  98. */
  99. return '"' + s
  100. .replace(/\\/g, '\\\\') // backslash
  101. .replace(/"/g, '\\"') // closing quote character
  102. .replace(/\r/g, '\\r') // carriage return
  103. .replace(/\n/g, '\\n') // line feed
  104. .replace(/[\x80-\uFFFF]/g, escape) // non-ASCII characters
  105. + '"';
  106. }
  107. function matchFailed(failure) {
  108. if (pos < rightmostMatchFailuresPos) {
  109. return;
  110. }
  111. if (pos > rightmostMatchFailuresPos) {
  112. rightmostMatchFailuresPos = pos;
  113. rightmostMatchFailuresExpected = [];
  114. }
  115. rightmostMatchFailuresExpected.push(failure);
  116. }
  117. function parse_separator() {
  118. var cacheKey = 'separator@' + pos;
  119. var cachedResult = cache[cacheKey];
  120. if (cachedResult) {
  121. pos = cachedResult.nextPos;
  122. return cachedResult.result;
  123. }
  124. if (input.substr(pos).match(/^[ \xA0\uFEFF\n\r\u2028\u2029]/) !== null) {
  125. var result1 = input.charAt(pos);
  126. pos++;
  127. } else {
  128. var result1 = null;
  129. if (reportMatchFailures) {
  130. matchFailed("[ \\xA0\\uFEFF\\n\\r\\u2028\\u2029]");
  131. }
  132. }
  133. if (result1 !== null) {
  134. var result0 = [];
  135. while (result1 !== null) {
  136. result0.push(result1);
  137. if (input.substr(pos).match(/^[ \xA0\uFEFF\n\r\u2028\u2029]/) !== null) {
  138. var result1 = input.charAt(pos);
  139. pos++;
  140. } else {
  141. var result1 = null;
  142. if (reportMatchFailures) {
  143. matchFailed("[ \\xA0\\uFEFF\\n\\r\\u2028\\u2029]");
  144. }
  145. }
  146. }
  147. } else {
  148. var result0 = null;
  149. }
  150. cache[cacheKey] = {
  151. nextPos: pos,
  152. result: result0
  153. };
  154. return result0;
  155. }
  156. function parse_comments() {
  157. var cacheKey = 'comments@' + pos;
  158. var cachedResult = cache[cacheKey];
  159. if (cachedResult) {
  160. pos = cachedResult.nextPos;
  161. return cachedResult.result;
  162. }
  163. var savedPos0 = pos;
  164. if (input.substr(pos).match(/^["]/) !== null) {
  165. var result2 = input.charAt(pos);
  166. pos++;
  167. } else {
  168. var result2 = null;
  169. if (reportMatchFailures) {
  170. matchFailed("[\"]");
  171. }
  172. }
  173. if (result2 !== null) {
  174. var result3 = [];
  175. if (input.substr(pos).match(/^[^"]/) !== null) {
  176. var result5 = input.charAt(pos);
  177. pos++;
  178. } else {
  179. var result5 = null;
  180. if (reportMatchFailures) {
  181. matchFailed("[^\"]");
  182. }
  183. }
  184. while (result5 !== null) {
  185. result3.push(result5);
  186. if (input.substr(pos).match(/^[^"]/) !== null) {
  187. var result5 = input.charAt(pos);
  188. pos++;
  189. } else {
  190. var result5 = null;
  191. if (reportMatchFailures) {
  192. matchFailed("[^\"]");
  193. }
  194. }
  195. }
  196. if (result3 !== null) {
  197. if (input.substr(pos).match(/^["]/) !== null) {
  198. var result4 = input.charAt(pos);
  199. pos++;
  200. } else {
  201. var result4 = null;
  202. if (reportMatchFailures) {
  203. matchFailed("[\"]");
  204. }
  205. }
  206. if (result4 !== null) {
  207. var result1 = [result2, result3, result4];
  208. } else {
  209. var result1 = null;
  210. pos = savedPos0;
  211. }
  212. } else {
  213. var result1 = null;
  214. pos = savedPos0;
  215. }
  216. } else {
  217. var result1 = null;
  218. pos = savedPos0;
  219. }
  220. if (result1 !== null) {
  221. var result0 = [];
  222. while (result1 !== null) {
  223. result0.push(result1);
  224. var savedPos0 = pos;
  225. if (input.substr(pos).match(/^["]/) !== null) {
  226. var result2 = input.charAt(pos);
  227. pos++;
  228. } else {
  229. var result2 = null;
  230. if (reportMatchFailures) {
  231. matchFailed("[\"]");
  232. }
  233. }
  234. if (result2 !== null) {
  235. var result3 = [];
  236. if (input.substr(pos).match(/^[^"]/) !== null) {
  237. var result5 = input.charAt(pos);
  238. pos++;
  239. } else {
  240. var result5 = null;
  241. if (reportMatchFailures) {
  242. matchFailed("[^\"]");
  243. }
  244. }
  245. while (result5 !== null) {
  246. result3.push(result5);
  247. if (input.substr(pos).match(/^[^"]/) !== null) {
  248. var result5 = input.charAt(pos);
  249. pos++;
  250. } else {
  251. var result5 = null;
  252. if (reportMatchFailures) {
  253. matchFailed("[^\"]");
  254. }
  255. }
  256. }
  257. if (result3 !== null) {
  258. if (input.substr(pos).match(/^["]/) !== null) {
  259. var result4 = input.charAt(pos);
  260. pos++;
  261. } else {
  262. var result4 = null;
  263. if (reportMatchFailures) {
  264. matchFailed("[\"]");
  265. }
  266. }
  267. if (result4 !== null) {
  268. var result1 = [result2, result3, result4];
  269. } else {
  270. var result1 = null;
  271. pos = savedPos0;
  272. }
  273. } else {
  274. var result1 = null;
  275. pos = savedPos0;
  276. }
  277. } else {
  278. var result1 = null;
  279. pos = savedPos0;
  280. }
  281. }
  282. } else {
  283. var result0 = null;
  284. }
  285. cache[cacheKey] = {
  286. nextPos: pos,
  287. result: result0
  288. };
  289. return result0;
  290. }
  291. function parse_ws() {
  292. var cacheKey = 'ws@' + pos;
  293. var cachedResult = cache[cacheKey];
  294. if (cachedResult) {
  295. pos = cachedResult.nextPos;
  296. return cachedResult.result;
  297. }
  298. var result0 = [];
  299. var result3 = parse_separator();
  300. if (result3 !== null) {
  301. var result1 = result3;
  302. } else {
  303. var result2 = parse_comments();
  304. if (result2 !== null) {
  305. var result1 = result2;
  306. } else {
  307. var result1 = null;;
  308. };
  309. }
  310. while (result1 !== null) {
  311. result0.push(result1);
  312. var result3 = parse_separator();
  313. if (result3 !== null) {
  314. var result1 = result3;
  315. } else {
  316. var result2 = parse_comments();
  317. if (result2 !== null) {
  318. var result1 = result2;
  319. } else {
  320. var result1 = null;;
  321. };
  322. }
  323. }
  324. cache[cacheKey] = {
  325. nextPos: pos,
  326. result: result0
  327. };
  328. return result0;
  329. }
  330. function parse_identifier() {
  331. var cacheKey = 'identifier@' + pos;
  332. var cachedResult = cache[cacheKey];
  333. if (cachedResult) {
  334. pos = cachedResult.nextPos;
  335. return cachedResult.result;
  336. }
  337. var savedPos0 = pos;
  338. var savedPos1 = pos;
  339. if (input.substr(pos).match(/^[a-z]/) !== null) {
  340. var result3 = input.charAt(pos);
  341. pos++;
  342. } else {
  343. var result3 = null;
  344. if (reportMatchFailures) {
  345. matchFailed("[a-z]");
  346. }
  347. }
  348. if (result3 !== null) {
  349. var result4 = [];
  350. if (input.substr(pos).match(/^[a-zA-Z0-9]/) !== null) {
  351. var result5 = input.charAt(pos);
  352. pos++;
  353. } else {
  354. var result5 = null;
  355. if (reportMatchFailures) {
  356. matchFailed("[a-zA-Z0-9]");
  357. }
  358. }
  359. while (result5 !== null) {
  360. result4.push(result5);
  361. if (input.substr(pos).match(/^[a-zA-Z0-9]/) !== null) {
  362. var result5 = input.charAt(pos);
  363. pos++;
  364. } else {
  365. var result5 = null;
  366. if (reportMatchFailures) {
  367. matchFailed("[a-zA-Z0-9]");
  368. }
  369. }
  370. }
  371. if (result4 !== null) {
  372. var result1 = [result3, result4];
  373. } else {
  374. var result1 = null;
  375. pos = savedPos1;
  376. }
  377. } else {
  378. var result1 = null;
  379. pos = savedPos1;
  380. }
  381. var result2 = result1 !== null
  382. ? (function(first, others) {return first + others.join("")})(result1[0], result1[1])
  383. : null;
  384. if (result2 !== null) {
  385. var result0 = result2;
  386. } else {
  387. var result0 = null;
  388. pos = savedPos0;
  389. }
  390. cache[cacheKey] = {
  391. nextPos: pos,
  392. result: result0
  393. };
  394. return result0;
  395. }
  396. function parse_keyword() {
  397. var cacheKey = 'keyword@' + pos;
  398. var cachedResult = cache[cacheKey];
  399. if (cachedResult) {
  400. pos = cachedResult.nextPos;
  401. return cachedResult.result;
  402. }
  403. var savedPos0 = pos;
  404. var savedPos1 = pos;
  405. var result3 = parse_identifier();
  406. if (result3 !== null) {
  407. if (input.substr(pos).match(/^[:]/) !== null) {
  408. var result4 = input.charAt(pos);
  409. pos++;
  410. } else {
  411. var result4 = null;
  412. if (reportMatchFailures) {
  413. matchFailed("[:]");
  414. }
  415. }
  416. if (result4 !== null) {
  417. var result1 = [result3, result4];
  418. } else {
  419. var result1 = null;
  420. pos = savedPos1;
  421. }
  422. } else {
  423. var result1 = null;
  424. pos = savedPos1;
  425. }
  426. var result2 = result1 !== null
  427. ? (function(first, last) {return first + last})(result1[0], result1[1])
  428. : null;
  429. if (result2 !== null) {
  430. var result0 = result2;
  431. } else {
  432. var result0 = null;
  433. pos = savedPos0;
  434. }
  435. cache[cacheKey] = {
  436. nextPos: pos,
  437. result: result0
  438. };
  439. return result0;
  440. }
  441. function parse_className() {
  442. var cacheKey = 'className@' + pos;
  443. var cachedResult = cache[cacheKey];
  444. if (cachedResult) {
  445. pos = cachedResult.nextPos;
  446. return cachedResult.result;
  447. }
  448. var savedPos0 = pos;
  449. var savedPos1 = pos;
  450. if (input.substr(pos).match(/^[A-Z]/) !== null) {
  451. var result3 = input.charAt(pos);
  452. pos++;
  453. } else {
  454. var result3 = null;
  455. if (reportMatchFailures) {
  456. matchFailed("[A-Z]");
  457. }
  458. }
  459. if (result3 !== null) {
  460. var result4 = [];
  461. if (input.substr(pos).match(/^[a-zA-Z0-9]/) !== null) {
  462. var result5 = input.charAt(pos);
  463. pos++;
  464. } else {
  465. var result5 = null;
  466. if (reportMatchFailures) {
  467. matchFailed("[a-zA-Z0-9]");
  468. }
  469. }
  470. while (result5 !== null) {
  471. result4.push(result5);
  472. if (input.substr(pos).match(/^[a-zA-Z0-9]/) !== null) {
  473. var result5 = input.charAt(pos);
  474. pos++;
  475. } else {
  476. var result5 = null;
  477. if (reportMatchFailures) {
  478. matchFailed("[a-zA-Z0-9]");
  479. }
  480. }
  481. }
  482. if (result4 !== null) {
  483. var result1 = [result3, result4];
  484. } else {
  485. var result1 = null;
  486. pos = savedPos1;
  487. }
  488. } else {
  489. var result1 = null;
  490. pos = savedPos1;
  491. }
  492. var result2 = result1 !== null
  493. ? (function(first, others) {return first + others.join("")})(result1[0], result1[1])
  494. : null;
  495. if (result2 !== null) {
  496. var result0 = result2;
  497. } else {
  498. var result0 = null;
  499. pos = savedPos0;
  500. }
  501. cache[cacheKey] = {
  502. nextPos: pos,
  503. result: result0
  504. };
  505. return result0;
  506. }
  507. function parse_string() {
  508. var cacheKey = 'string@' + pos;
  509. var cachedResult = cache[cacheKey];
  510. if (cachedResult) {
  511. pos = cachedResult.nextPos;
  512. return cachedResult.result;
  513. }
  514. var savedPos0 = pos;
  515. var savedPos1 = pos;
  516. if (input.substr(pos).match(/^[']/) !== null) {
  517. var result3 = input.charAt(pos);
  518. pos++;
  519. } else {
  520. var result3 = null;
  521. if (reportMatchFailures) {
  522. matchFailed("[']");
  523. }
  524. }
  525. if (result3 !== null) {
  526. var result4 = [];
  527. var savedPos2 = pos;
  528. if (input.substr(pos, 2) === "''") {
  529. var result9 = "''";
  530. pos += 2;
  531. } else {
  532. var result9 = null;
  533. if (reportMatchFailures) {
  534. matchFailed("\"''\"");
  535. }
  536. }
  537. var result10 = result9 !== null
  538. ? (function() {return "'"})()
  539. : null;
  540. if (result10 !== null) {
  541. var result8 = result10;
  542. } else {
  543. var result8 = null;
  544. pos = savedPos2;
  545. }
  546. if (result8 !== null) {
  547. var result6 = result8;
  548. } else {
  549. if (input.substr(pos).match(/^[^']/) !== null) {
  550. var result7 = input.charAt(pos);
  551. pos++;
  552. } else {
  553. var result7 = null;
  554. if (reportMatchFailures) {
  555. matchFailed("[^']");
  556. }
  557. }
  558. if (result7 !== null) {
  559. var result6 = result7;
  560. } else {
  561. var result6 = null;;
  562. };
  563. }
  564. while (result6 !== null) {
  565. result4.push(result6);
  566. var savedPos2 = pos;
  567. if (input.substr(pos, 2) === "''") {
  568. var result9 = "''";
  569. pos += 2;
  570. } else {
  571. var result9 = null;
  572. if (reportMatchFailures) {
  573. matchFailed("\"''\"");
  574. }
  575. }
  576. var result10 = result9 !== null
  577. ? (function() {return "'"})()
  578. : null;
  579. if (result10 !== null) {
  580. var result8 = result10;
  581. } else {
  582. var result8 = null;
  583. pos = savedPos2;
  584. }
  585. if (result8 !== null) {
  586. var result6 = result8;
  587. } else {
  588. if (input.substr(pos).match(/^[^']/) !== null) {
  589. var result7 = input.charAt(pos);
  590. pos++;
  591. } else {
  592. var result7 = null;
  593. if (reportMatchFailures) {
  594. matchFailed("[^']");
  595. }
  596. }
  597. if (result7 !== null) {
  598. var result6 = result7;
  599. } else {
  600. var result6 = null;;
  601. };
  602. }
  603. }
  604. if (result4 !== null) {
  605. if (input.substr(pos).match(/^[']/) !== null) {
  606. var result5 = input.charAt(pos);
  607. pos++;
  608. } else {
  609. var result5 = null;
  610. if (reportMatchFailures) {
  611. matchFailed("[']");
  612. }
  613. }
  614. if (result5 !== null) {
  615. var result1 = [result3, result4, result5];
  616. } else {
  617. var result1 = null;
  618. pos = savedPos1;
  619. }
  620. } else {
  621. var result1 = null;
  622. pos = savedPos1;
  623. }
  624. } else {
  625. var result1 = null;
  626. pos = savedPos1;
  627. }
  628. var result2 = result1 !== null
  629. ? (function(val) {
  630. return smalltalk.ValueNode._new()
  631. ._value_(val.join("").replace(/\"/ig, '"'))
  632. })(result1[1])
  633. : null;
  634. if (result2 !== null) {
  635. var result0 = result2;
  636. } else {
  637. var result0 = null;
  638. pos = savedPos0;
  639. }
  640. cache[cacheKey] = {
  641. nextPos: pos,
  642. result: result0
  643. };
  644. return result0;
  645. }
  646. function parse_symbol() {
  647. var cacheKey = 'symbol@' + pos;
  648. var cachedResult = cache[cacheKey];
  649. if (cachedResult) {
  650. pos = cachedResult.nextPos;
  651. return cachedResult.result;
  652. }
  653. var savedPos0 = pos;
  654. var savedPos1 = pos;
  655. if (input.substr(pos, 1) === "#") {
  656. var result3 = "#";
  657. pos += 1;
  658. } else {
  659. var result3 = null;
  660. if (reportMatchFailures) {
  661. matchFailed("\"#\"");
  662. }
  663. }
  664. if (result3 !== null) {
  665. var result4 = [];
  666. if (input.substr(pos).match(/^[a-zA-Z0-9]/) !== null) {
  667. var result5 = input.charAt(pos);
  668. pos++;
  669. } else {
  670. var result5 = null;
  671. if (reportMatchFailures) {
  672. matchFailed("[a-zA-Z0-9]");
  673. }
  674. }
  675. while (result5 !== null) {
  676. result4.push(result5);
  677. if (input.substr(pos).match(/^[a-zA-Z0-9]/) !== null) {
  678. var result5 = input.charAt(pos);
  679. pos++;
  680. } else {
  681. var result5 = null;
  682. if (reportMatchFailures) {
  683. matchFailed("[a-zA-Z0-9]");
  684. }
  685. }
  686. }
  687. if (result4 !== null) {
  688. var result1 = [result3, result4];
  689. } else {
  690. var result1 = null;
  691. pos = savedPos1;
  692. }
  693. } else {
  694. var result1 = null;
  695. pos = savedPos1;
  696. }
  697. var result2 = result1 !== null
  698. ? (function(val) {
  699. return smalltalk.ValueNode._new()
  700. ._value_(smalltalk.symbolFor(val.join("").replace(/\"/ig, '"')))
  701. })(result1[1])
  702. : null;
  703. if (result2 !== null) {
  704. var result0 = result2;
  705. } else {
  706. var result0 = null;
  707. pos = savedPos0;
  708. }
  709. cache[cacheKey] = {
  710. nextPos: pos,
  711. result: result0
  712. };
  713. return result0;
  714. }
  715. function parse_number() {
  716. var cacheKey = 'number@' + pos;
  717. var cachedResult = cache[cacheKey];
  718. if (cachedResult) {
  719. pos = cachedResult.nextPos;
  720. return cachedResult.result;
  721. }
  722. var savedPos0 = pos;
  723. var result4 = parse_float();
  724. if (result4 !== null) {
  725. var result1 = result4;
  726. } else {
  727. var result3 = parse_integer();
  728. if (result3 !== null) {
  729. var result1 = result3;
  730. } else {
  731. var result1 = null;;
  732. };
  733. }
  734. var result2 = result1 !== null
  735. ? (function(n) {
  736. return smalltalk.ValueNode._new()
  737. ._value_(n)
  738. })(result1)
  739. : null;
  740. if (result2 !== null) {
  741. var result0 = result2;
  742. } else {
  743. var result0 = null;
  744. pos = savedPos0;
  745. }
  746. cache[cacheKey] = {
  747. nextPos: pos,
  748. result: result0
  749. };
  750. return result0;
  751. }
  752. function parse_float() {
  753. var cacheKey = 'float@' + pos;
  754. var cachedResult = cache[cacheKey];
  755. if (cachedResult) {
  756. pos = cachedResult.nextPos;
  757. return cachedResult.result;
  758. }
  759. var savedPos0 = pos;
  760. var savedPos1 = pos;
  761. if (input.substr(pos).match(/^[\-]/) !== null) {
  762. var result7 = input.charAt(pos);
  763. pos++;
  764. } else {
  765. var result7 = null;
  766. if (reportMatchFailures) {
  767. matchFailed("[\\-]");
  768. }
  769. }
  770. var result3 = result7 !== null ? result7 : '';
  771. if (result3 !== null) {
  772. var result4 = parse_integer();
  773. if (result4 !== null) {
  774. if (input.substr(pos, 1) === ".") {
  775. var result5 = ".";
  776. pos += 1;
  777. } else {
  778. var result5 = null;
  779. if (reportMatchFailures) {
  780. matchFailed("\".\"");
  781. }
  782. }
  783. if (result5 !== null) {
  784. var result6 = parse_integer();
  785. if (result6 !== null) {
  786. var result1 = [result3, result4, result5, result6];
  787. } else {
  788. var result1 = null;
  789. pos = savedPos1;
  790. }
  791. } else {
  792. var result1 = null;
  793. pos = savedPos1;
  794. }
  795. } else {
  796. var result1 = null;
  797. pos = savedPos1;
  798. }
  799. } else {
  800. var result1 = null;
  801. pos = savedPos1;
  802. }
  803. var result2 = result1 !== null
  804. ? (function(neg, int, dec) {return parseFloat((neg+int+"."+dec), 10)})(result1[0], result1[1], result1[3])
  805. : null;
  806. if (result2 !== null) {
  807. var result0 = result2;
  808. } else {
  809. var result0 = null;
  810. pos = savedPos0;
  811. }
  812. cache[cacheKey] = {
  813. nextPos: pos,
  814. result: result0
  815. };
  816. return result0;
  817. }
  818. function parse_integer() {
  819. var cacheKey = 'integer@' + pos;
  820. var cachedResult = cache[cacheKey];
  821. if (cachedResult) {
  822. pos = cachedResult.nextPos;
  823. return cachedResult.result;
  824. }
  825. var savedPos0 = pos;
  826. var savedPos1 = pos;
  827. if (input.substr(pos).match(/^[\-]/) !== null) {
  828. var result6 = input.charAt(pos);
  829. pos++;
  830. } else {
  831. var result6 = null;
  832. if (reportMatchFailures) {
  833. matchFailed("[\\-]");
  834. }
  835. }
  836. var result3 = result6 !== null ? result6 : '';
  837. if (result3 !== null) {
  838. if (input.substr(pos).match(/^[0-9]/) !== null) {
  839. var result5 = input.charAt(pos);
  840. pos++;
  841. } else {
  842. var result5 = null;
  843. if (reportMatchFailures) {
  844. matchFailed("[0-9]");
  845. }
  846. }
  847. if (result5 !== null) {
  848. var result4 = [];
  849. while (result5 !== null) {
  850. result4.push(result5);
  851. if (input.substr(pos).match(/^[0-9]/) !== null) {
  852. var result5 = input.charAt(pos);
  853. pos++;
  854. } else {
  855. var result5 = null;
  856. if (reportMatchFailures) {
  857. matchFailed("[0-9]");
  858. }
  859. }
  860. }
  861. } else {
  862. var result4 = null;
  863. }
  864. if (result4 !== null) {
  865. var result1 = [result3, result4];
  866. } else {
  867. var result1 = null;
  868. pos = savedPos1;
  869. }
  870. } else {
  871. var result1 = null;
  872. pos = savedPos1;
  873. }
  874. var result2 = result1 !== null
  875. ? (function(neg, digits) {return (parseInt(neg+digits.join(""), 10))})(result1[0], result1[1])
  876. : null;
  877. if (result2 !== null) {
  878. var result0 = result2;
  879. } else {
  880. var result0 = null;
  881. pos = savedPos0;
  882. }
  883. cache[cacheKey] = {
  884. nextPos: pos,
  885. result: result0
  886. };
  887. return result0;
  888. }
  889. function parse_literalArray() {
  890. var cacheKey = 'literalArray@' + pos;
  891. var cachedResult = cache[cacheKey];
  892. if (cachedResult) {
  893. pos = cachedResult.nextPos;
  894. return cachedResult.result;
  895. }
  896. var savedPos0 = pos;
  897. var savedPos1 = pos;
  898. if (input.substr(pos, 2) === "#(") {
  899. var result3 = "#(";
  900. pos += 2;
  901. } else {
  902. var result3 = null;
  903. if (reportMatchFailures) {
  904. matchFailed("\"#(\"");
  905. }
  906. }
  907. if (result3 !== null) {
  908. var result4 = parse_ws();
  909. if (result4 !== null) {
  910. var result5 = [];
  911. var savedPos2 = pos;
  912. var savedPos3 = pos;
  913. var result11 = parse_literal();
  914. if (result11 !== null) {
  915. var result12 = parse_ws();
  916. if (result12 !== null) {
  917. var result9 = [result11, result12];
  918. } else {
  919. var result9 = null;
  920. pos = savedPos3;
  921. }
  922. } else {
  923. var result9 = null;
  924. pos = savedPos3;
  925. }
  926. var result10 = result9 !== null
  927. ? (function(lit) {return lit._value()})(result9[0])
  928. : null;
  929. if (result10 !== null) {
  930. var result8 = result10;
  931. } else {
  932. var result8 = null;
  933. pos = savedPos2;
  934. }
  935. while (result8 !== null) {
  936. result5.push(result8);
  937. var savedPos2 = pos;
  938. var savedPos3 = pos;
  939. var result11 = parse_literal();
  940. if (result11 !== null) {
  941. var result12 = parse_ws();
  942. if (result12 !== null) {
  943. var result9 = [result11, result12];
  944. } else {
  945. var result9 = null;
  946. pos = savedPos3;
  947. }
  948. } else {
  949. var result9 = null;
  950. pos = savedPos3;
  951. }
  952. var result10 = result9 !== null
  953. ? (function(lit) {return lit._value()})(result9[0])
  954. : null;
  955. if (result10 !== null) {
  956. var result8 = result10;
  957. } else {
  958. var result8 = null;
  959. pos = savedPos2;
  960. }
  961. }
  962. if (result5 !== null) {
  963. var result6 = parse_ws();
  964. if (result6 !== null) {
  965. if (input.substr(pos, 1) === ")") {
  966. var result7 = ")";
  967. pos += 1;
  968. } else {
  969. var result7 = null;
  970. if (reportMatchFailures) {
  971. matchFailed("\")\"");
  972. }
  973. }
  974. if (result7 !== null) {
  975. var result1 = [result3, result4, result5, result6, result7];
  976. } else {
  977. var result1 = null;
  978. pos = savedPos1;
  979. }
  980. } else {
  981. var result1 = null;
  982. pos = savedPos1;
  983. }
  984. } else {
  985. var result1 = null;
  986. pos = savedPos1;
  987. }
  988. } else {
  989. var result1 = null;
  990. pos = savedPos1;
  991. }
  992. } else {
  993. var result1 = null;
  994. pos = savedPos1;
  995. }
  996. var result2 = result1 !== null
  997. ? (function(lits) {
  998. return smalltalk.ValueNode._new()
  999. ._value_(lits)
  1000. })(result1[2])
  1001. : null;
  1002. if (result2 !== null) {
  1003. var result0 = result2;
  1004. } else {
  1005. var result0 = null;
  1006. pos = savedPos0;
  1007. }
  1008. cache[cacheKey] = {
  1009. nextPos: pos,
  1010. result: result0
  1011. };
  1012. return result0;
  1013. }
  1014. function parse_dynamicArray() {
  1015. var cacheKey = 'dynamicArray@' + pos;
  1016. var cachedResult = cache[cacheKey];
  1017. if (cachedResult) {
  1018. pos = cachedResult.nextPos;
  1019. return cachedResult.result;
  1020. }
  1021. var savedPos0 = pos;
  1022. var savedPos1 = pos;
  1023. if (input.substr(pos, 1) === "{") {
  1024. var result3 = "{";
  1025. pos += 1;
  1026. } else {
  1027. var result3 = null;
  1028. if (reportMatchFailures) {
  1029. matchFailed("\"{\"");
  1030. }
  1031. }
  1032. if (result3 !== null) {
  1033. var result4 = parse_ws();
  1034. if (result4 !== null) {
  1035. var result8 = parse_expressions();
  1036. var result5 = result8 !== null ? result8 : '';
  1037. if (result5 !== null) {
  1038. var result6 = parse_ws();
  1039. if (result6 !== null) {
  1040. if (input.substr(pos, 1) === "}") {
  1041. var result7 = "}";
  1042. pos += 1;
  1043. } else {
  1044. var result7 = null;
  1045. if (reportMatchFailures) {
  1046. matchFailed("\"}\"");
  1047. }
  1048. }
  1049. if (result7 !== null) {
  1050. var result1 = [result3, result4, result5, result6, result7];
  1051. } else {
  1052. var result1 = null;
  1053. pos = savedPos1;
  1054. }
  1055. } else {
  1056. var result1 = null;
  1057. pos = savedPos1;
  1058. }
  1059. } else {
  1060. var result1 = null;
  1061. pos = savedPos1;
  1062. }
  1063. } else {
  1064. var result1 = null;
  1065. pos = savedPos1;
  1066. }
  1067. } else {
  1068. var result1 = null;
  1069. pos = savedPos1;
  1070. }
  1071. var result2 = result1 !== null
  1072. ? (function(expressions) {
  1073. return smalltalk.DynamicArrayNode._new()
  1074. ._nodes_(expressions)
  1075. })(result1[2])
  1076. : null;
  1077. if (result2 !== null) {
  1078. var result0 = result2;
  1079. } else {
  1080. var result0 = null;
  1081. pos = savedPos0;
  1082. }
  1083. cache[cacheKey] = {
  1084. nextPos: pos,
  1085. result: result0
  1086. };
  1087. return result0;
  1088. }
  1089. function parse_dynamicDictionary() {
  1090. var cacheKey = 'dynamicDictionary@' + pos;
  1091. var cachedResult = cache[cacheKey];
  1092. if (cachedResult) {
  1093. pos = cachedResult.nextPos;
  1094. return cachedResult.result;
  1095. }
  1096. var savedPos0 = pos;
  1097. var savedPos1 = pos;
  1098. if (input.substr(pos, 2) === "#{") {
  1099. var result3 = "#{";
  1100. pos += 2;
  1101. } else {
  1102. var result3 = null;
  1103. if (reportMatchFailures) {
  1104. matchFailed("\"#{\"");
  1105. }
  1106. }
  1107. if (result3 !== null) {
  1108. var result4 = parse_ws();
  1109. if (result4 !== null) {
  1110. var result8 = parse_expressions();
  1111. var result5 = result8 !== null ? result8 : '';
  1112. if (result5 !== null) {
  1113. var result6 = parse_ws();
  1114. if (result6 !== null) {
  1115. if (input.substr(pos, 1) === "}") {
  1116. var result7 = "}";
  1117. pos += 1;
  1118. } else {
  1119. var result7 = null;
  1120. if (reportMatchFailures) {
  1121. matchFailed("\"}\"");
  1122. }
  1123. }
  1124. if (result7 !== null) {
  1125. var result1 = [result3, result4, result5, result6, result7];
  1126. } else {
  1127. var result1 = null;
  1128. pos = savedPos1;
  1129. }
  1130. } else {
  1131. var result1 = null;
  1132. pos = savedPos1;
  1133. }
  1134. } else {
  1135. var result1 = null;
  1136. pos = savedPos1;
  1137. }
  1138. } else {
  1139. var result1 = null;
  1140. pos = savedPos1;
  1141. }
  1142. } else {
  1143. var result1 = null;
  1144. pos = savedPos1;
  1145. }
  1146. var result2 = result1 !== null
  1147. ? (function(expressions) {
  1148. return smalltalk.DynamicDictionaryNode._new()
  1149. ._nodes_(expressions)
  1150. })(result1[2])
  1151. : null;
  1152. if (result2 !== null) {
  1153. var result0 = result2;
  1154. } else {
  1155. var result0 = null;
  1156. pos = savedPos0;
  1157. }
  1158. cache[cacheKey] = {
  1159. nextPos: pos,
  1160. result: result0
  1161. };
  1162. return result0;
  1163. }
  1164. function parse_pseudoVariable() {
  1165. var cacheKey = 'pseudoVariable@' + pos;
  1166. var cachedResult = cache[cacheKey];
  1167. if (cachedResult) {
  1168. pos = cachedResult.nextPos;
  1169. return cachedResult.result;
  1170. }
  1171. var savedPos0 = pos;
  1172. var savedPos3 = pos;
  1173. if (input.substr(pos, 4) === "true") {
  1174. var result10 = "true";
  1175. pos += 4;
  1176. } else {
  1177. var result10 = null;
  1178. if (reportMatchFailures) {
  1179. matchFailed("\"true\"");
  1180. }
  1181. }
  1182. var result11 = result10 !== null
  1183. ? (function() {return true})()
  1184. : null;
  1185. if (result11 !== null) {
  1186. var result9 = result11;
  1187. } else {
  1188. var result9 = null;
  1189. pos = savedPos3;
  1190. }
  1191. if (result9 !== null) {
  1192. var result1 = result9;
  1193. } else {
  1194. var savedPos2 = pos;
  1195. if (input.substr(pos, 5) === "false") {
  1196. var result7 = "false";
  1197. pos += 5;
  1198. } else {
  1199. var result7 = null;
  1200. if (reportMatchFailures) {
  1201. matchFailed("\"false\"");
  1202. }
  1203. }
  1204. var result8 = result7 !== null
  1205. ? (function() {return false})()
  1206. : null;
  1207. if (result8 !== null) {
  1208. var result6 = result8;
  1209. } else {
  1210. var result6 = null;
  1211. pos = savedPos2;
  1212. }
  1213. if (result6 !== null) {
  1214. var result1 = result6;
  1215. } else {
  1216. var savedPos1 = pos;
  1217. if (input.substr(pos, 3) === "nil") {
  1218. var result4 = "nil";
  1219. pos += 3;
  1220. } else {
  1221. var result4 = null;
  1222. if (reportMatchFailures) {
  1223. matchFailed("\"nil\"");
  1224. }
  1225. }
  1226. var result5 = result4 !== null
  1227. ? (function() {return nil})()
  1228. : null;
  1229. if (result5 !== null) {
  1230. var result3 = result5;
  1231. } else {
  1232. var result3 = null;
  1233. pos = savedPos1;
  1234. }
  1235. if (result3 !== null) {
  1236. var result1 = result3;
  1237. } else {
  1238. var result1 = null;;
  1239. };
  1240. };
  1241. }
  1242. var result2 = result1 !== null
  1243. ? (function(val) {
  1244. return smalltalk.ValueNode._new()._value_(val)
  1245. })(result1)
  1246. : null;
  1247. if (result2 !== null) {
  1248. var result0 = result2;
  1249. } else {
  1250. var result0 = null;
  1251. pos = savedPos0;
  1252. }
  1253. cache[cacheKey] = {
  1254. nextPos: pos,
  1255. result: result0
  1256. };
  1257. return result0;
  1258. }
  1259. function parse_literal() {
  1260. var cacheKey = 'literal@' + pos;
  1261. var cachedResult = cache[cacheKey];
  1262. if (cachedResult) {
  1263. pos = cachedResult.nextPos;
  1264. return cachedResult.result;
  1265. }
  1266. var result8 = parse_pseudoVariable();
  1267. if (result8 !== null) {
  1268. var result0 = result8;
  1269. } else {
  1270. var result7 = parse_number();
  1271. if (result7 !== null) {
  1272. var result0 = result7;
  1273. } else {
  1274. var result6 = parse_literalArray();
  1275. if (result6 !== null) {
  1276. var result0 = result6;
  1277. } else {
  1278. var result5 = parse_dynamicDictionary();
  1279. if (result5 !== null) {
  1280. var result0 = result5;
  1281. } else {
  1282. var result4 = parse_dynamicArray();
  1283. if (result4 !== null) {
  1284. var result0 = result4;
  1285. } else {
  1286. var result3 = parse_string();
  1287. if (result3 !== null) {
  1288. var result0 = result3;
  1289. } else {
  1290. var result2 = parse_symbol();
  1291. if (result2 !== null) {
  1292. var result0 = result2;
  1293. } else {
  1294. var result1 = parse_block();
  1295. if (result1 !== null) {
  1296. var result0 = result1;
  1297. } else {
  1298. var result0 = null;;
  1299. };
  1300. };
  1301. };
  1302. };
  1303. };
  1304. };
  1305. };
  1306. }
  1307. cache[cacheKey] = {
  1308. nextPos: pos,
  1309. result: result0
  1310. };
  1311. return result0;
  1312. }
  1313. function parse_variable() {
  1314. var cacheKey = 'variable@' + pos;
  1315. var cachedResult = cache[cacheKey];
  1316. if (cachedResult) {
  1317. pos = cachedResult.nextPos;
  1318. return cachedResult.result;
  1319. }
  1320. var savedPos0 = pos;
  1321. var result1 = parse_identifier();
  1322. var result2 = result1 !== null
  1323. ? (function(identifier) {
  1324. return smalltalk.VariableNode._new()
  1325. ._value_(identifier)
  1326. })(result1)
  1327. : null;
  1328. if (result2 !== null) {
  1329. var result0 = result2;
  1330. } else {
  1331. var result0 = null;
  1332. pos = savedPos0;
  1333. }
  1334. cache[cacheKey] = {
  1335. nextPos: pos,
  1336. result: result0
  1337. };
  1338. return result0;
  1339. }
  1340. function parse_classReference() {
  1341. var cacheKey = 'classReference@' + pos;
  1342. var cachedResult = cache[cacheKey];
  1343. if (cachedResult) {
  1344. pos = cachedResult.nextPos;
  1345. return cachedResult.result;
  1346. }
  1347. var savedPos0 = pos;
  1348. var result1 = parse_className();
  1349. var result2 = result1 !== null
  1350. ? (function(className) {
  1351. return smalltalk.ClassReferenceNode._new()
  1352. ._value_(className)
  1353. })(result1)
  1354. : null;
  1355. if (result2 !== null) {
  1356. var result0 = result2;
  1357. } else {
  1358. var result0 = null;
  1359. pos = savedPos0;
  1360. }
  1361. cache[cacheKey] = {
  1362. nextPos: pos,
  1363. result: result0
  1364. };
  1365. return result0;
  1366. }
  1367. function parse_reference() {
  1368. var cacheKey = 'reference@' + pos;
  1369. var cachedResult = cache[cacheKey];
  1370. if (cachedResult) {
  1371. pos = cachedResult.nextPos;
  1372. return cachedResult.result;
  1373. }
  1374. var result2 = parse_variable();
  1375. if (result2 !== null) {
  1376. var result0 = result2;
  1377. } else {
  1378. var result1 = parse_classReference();
  1379. if (result1 !== null) {
  1380. var result0 = result1;
  1381. } else {
  1382. var result0 = null;;
  1383. };
  1384. }
  1385. cache[cacheKey] = {
  1386. nextPos: pos,
  1387. result: result0
  1388. };
  1389. return result0;
  1390. }
  1391. function parse_keywordPair() {
  1392. var cacheKey = 'keywordPair@' + pos;
  1393. var cachedResult = cache[cacheKey];
  1394. if (cachedResult) {
  1395. pos = cachedResult.nextPos;
  1396. return cachedResult.result;
  1397. }
  1398. var savedPos0 = pos;
  1399. var savedPos1 = pos;
  1400. var result3 = parse_keyword();
  1401. if (result3 !== null) {
  1402. var result4 = parse_ws();
  1403. if (result4 !== null) {
  1404. var result5 = parse_binarySend();
  1405. if (result5 !== null) {
  1406. var result6 = parse_ws();
  1407. if (result6 !== null) {
  1408. var result1 = [result3, result4, result5, result6];
  1409. } else {
  1410. var result1 = null;
  1411. pos = savedPos1;
  1412. }
  1413. } else {
  1414. var result1 = null;
  1415. pos = savedPos1;
  1416. }
  1417. } else {
  1418. var result1 = null;
  1419. pos = savedPos1;
  1420. }
  1421. } else {
  1422. var result1 = null;
  1423. pos = savedPos1;
  1424. }
  1425. var result2 = result1 !== null
  1426. ? (function(key, arg) {return {key:key, arg: arg}})(result1[0], result1[2])
  1427. : null;
  1428. if (result2 !== null) {
  1429. var result0 = result2;
  1430. } else {
  1431. var result0 = null;
  1432. pos = savedPos0;
  1433. }
  1434. cache[cacheKey] = {
  1435. nextPos: pos,
  1436. result: result0
  1437. };
  1438. return result0;
  1439. }
  1440. function parse_binarySelector() {
  1441. var cacheKey = 'binarySelector@' + pos;
  1442. var cachedResult = cache[cacheKey];
  1443. if (cachedResult) {
  1444. pos = cachedResult.nextPos;
  1445. return cachedResult.result;
  1446. }
  1447. var savedPos0 = pos;
  1448. if (input.substr(pos).match(/^[\\+*\/=><,@%~|&\-]/) !== null) {
  1449. var result3 = input.charAt(pos);
  1450. pos++;
  1451. } else {
  1452. var result3 = null;
  1453. if (reportMatchFailures) {
  1454. matchFailed("[\\\\+*\\/=><,@%~|&\\-]");
  1455. }
  1456. }
  1457. if (result3 !== null) {
  1458. var result1 = [];
  1459. while (result3 !== null) {
  1460. result1.push(result3);
  1461. if (input.substr(pos).match(/^[\\+*\/=><,@%~|&\-]/) !== null) {
  1462. var result3 = input.charAt(pos);
  1463. pos++;
  1464. } else {
  1465. var result3 = null;
  1466. if (reportMatchFailures) {
  1467. matchFailed("[\\\\+*\\/=><,@%~|&\\-]");
  1468. }
  1469. }
  1470. }
  1471. } else {
  1472. var result1 = null;
  1473. }
  1474. var result2 = result1 !== null
  1475. ? (function(bin) {return bin.join("").replace(/\\/g, '\\\\')})(result1)
  1476. : null;
  1477. if (result2 !== null) {
  1478. var result0 = result2;
  1479. } else {
  1480. var result0 = null;
  1481. pos = savedPos0;
  1482. }
  1483. cache[cacheKey] = {
  1484. nextPos: pos,
  1485. result: result0
  1486. };
  1487. return result0;
  1488. }
  1489. function parse_keywordPattern() {
  1490. var cacheKey = 'keywordPattern@' + pos;
  1491. var cachedResult = cache[cacheKey];
  1492. if (cachedResult) {
  1493. pos = cachedResult.nextPos;
  1494. return cachedResult.result;
  1495. }
  1496. var savedPos0 = pos;
  1497. var savedPos1 = pos;
  1498. var savedPos2 = pos;
  1499. var result6 = parse_ws();
  1500. if (result6 !== null) {
  1501. var result7 = parse_keyword();
  1502. if (result7 !== null) {
  1503. var result8 = parse_ws();
  1504. if (result8 !== null) {
  1505. var result9 = parse_identifier();
  1506. if (result9 !== null) {
  1507. var result4 = [result6, result7, result8, result9];
  1508. } else {
  1509. var result4 = null;
  1510. pos = savedPos2;
  1511. }
  1512. } else {
  1513. var result4 = null;
  1514. pos = savedPos2;
  1515. }
  1516. } else {
  1517. var result4 = null;
  1518. pos = savedPos2;
  1519. }
  1520. } else {
  1521. var result4 = null;
  1522. pos = savedPos2;
  1523. }
  1524. var result5 = result4 !== null
  1525. ? (function(key, arg) {return {key:key, arg: arg}})(result4[1], result4[3])
  1526. : null;
  1527. if (result5 !== null) {
  1528. var result3 = result5;
  1529. } else {
  1530. var result3 = null;
  1531. pos = savedPos1;
  1532. }
  1533. if (result3 !== null) {
  1534. var result1 = [];
  1535. while (result3 !== null) {
  1536. result1.push(result3);
  1537. var savedPos1 = pos;
  1538. var savedPos2 = pos;
  1539. var result6 = parse_ws();
  1540. if (result6 !== null) {
  1541. var result7 = parse_keyword();
  1542. if (result7 !== null) {
  1543. var result8 = parse_ws();
  1544. if (result8 !== null) {
  1545. var result9 = parse_identifier();
  1546. if (result9 !== null) {
  1547. var result4 = [result6, result7, result8, result9];
  1548. } else {
  1549. var result4 = null;
  1550. pos = savedPos2;
  1551. }
  1552. } else {
  1553. var result4 = null;
  1554. pos = savedPos2;
  1555. }
  1556. } else {
  1557. var result4 = null;
  1558. pos = savedPos2;
  1559. }
  1560. } else {
  1561. var result4 = null;
  1562. pos = savedPos2;
  1563. }
  1564. var result5 = result4 !== null
  1565. ? (function(key, arg) {return {key:key, arg: arg}})(result4[1], result4[3])
  1566. : null;
  1567. if (result5 !== null) {
  1568. var result3 = result5;
  1569. } else {
  1570. var result3 = null;
  1571. pos = savedPos1;
  1572. }
  1573. }
  1574. } else {
  1575. var result1 = null;
  1576. }
  1577. var result2 = result1 !== null
  1578. ? (function(pairs) {
  1579. var keywords = [];
  1580. var params = [];
  1581. for(var i=0;i<pairs.length;i++){
  1582. keywords.push(pairs[i].key);
  1583. }
  1584. for(var i=0;i<pairs.length;i++){
  1585. params.push(pairs[i].arg);
  1586. }
  1587. return [keywords.join(""), params]
  1588. })(result1)
  1589. : null;
  1590. if (result2 !== null) {
  1591. var result0 = result2;
  1592. } else {
  1593. var result0 = null;
  1594. pos = savedPos0;
  1595. }
  1596. cache[cacheKey] = {
  1597. nextPos: pos,
  1598. result: result0
  1599. };
  1600. return result0;
  1601. }
  1602. function parse_binaryPattern() {
  1603. var cacheKey = 'binaryPattern@' + pos;
  1604. var cachedResult = cache[cacheKey];
  1605. if (cachedResult) {
  1606. pos = cachedResult.nextPos;
  1607. return cachedResult.result;
  1608. }
  1609. var savedPos0 = pos;
  1610. var savedPos1 = pos;
  1611. var result3 = parse_ws();
  1612. if (result3 !== null) {
  1613. var result4 = parse_binarySelector();
  1614. if (result4 !== null) {
  1615. var result5 = parse_ws();
  1616. if (result5 !== null) {
  1617. var result6 = parse_identifier();
  1618. if (result6 !== null) {
  1619. var result1 = [result3, result4, result5, result6];
  1620. } else {
  1621. var result1 = null;
  1622. pos = savedPos1;
  1623. }
  1624. } else {
  1625. var result1 = null;
  1626. pos = savedPos1;
  1627. }
  1628. } else {
  1629. var result1 = null;
  1630. pos = savedPos1;
  1631. }
  1632. } else {
  1633. var result1 = null;
  1634. pos = savedPos1;
  1635. }
  1636. var result2 = result1 !== null
  1637. ? (function(selector, arg) {return [selector, [arg]]})(result1[1], result1[3])
  1638. : null;
  1639. if (result2 !== null) {
  1640. var result0 = result2;
  1641. } else {
  1642. var result0 = null;
  1643. pos = savedPos0;
  1644. }
  1645. cache[cacheKey] = {
  1646. nextPos: pos,
  1647. result: result0
  1648. };
  1649. return result0;
  1650. }
  1651. function parse_unaryPattern() {
  1652. var cacheKey = 'unaryPattern@' + pos;
  1653. var cachedResult = cache[cacheKey];
  1654. if (cachedResult) {
  1655. pos = cachedResult.nextPos;
  1656. return cachedResult.result;
  1657. }
  1658. var savedPos0 = pos;
  1659. var savedPos1 = pos;
  1660. var result3 = parse_ws();
  1661. if (result3 !== null) {
  1662. var result4 = parse_identifier();
  1663. if (result4 !== null) {
  1664. var result1 = [result3, result4];
  1665. } else {
  1666. var result1 = null;
  1667. pos = savedPos1;
  1668. }
  1669. } else {
  1670. var result1 = null;
  1671. pos = savedPos1;
  1672. }
  1673. var result2 = result1 !== null
  1674. ? (function(selector) {return [selector, []]})(result1[1])
  1675. : null;
  1676. if (result2 !== null) {
  1677. var result0 = result2;
  1678. } else {
  1679. var result0 = null;
  1680. pos = savedPos0;
  1681. }
  1682. cache[cacheKey] = {
  1683. nextPos: pos,
  1684. result: result0
  1685. };
  1686. return result0;
  1687. }
  1688. function parse_expression() {
  1689. var cacheKey = 'expression@' + pos;
  1690. var cachedResult = cache[cacheKey];
  1691. if (cachedResult) {
  1692. pos = cachedResult.nextPos;
  1693. return cachedResult.result;
  1694. }
  1695. var result5 = parse_assignment();
  1696. if (result5 !== null) {
  1697. var result0 = result5;
  1698. } else {
  1699. var result4 = parse_cascade();
  1700. if (result4 !== null) {
  1701. var result0 = result4;
  1702. } else {
  1703. var result3 = parse_keywordSend();
  1704. if (result3 !== null) {
  1705. var result0 = result3;
  1706. } else {
  1707. var result2 = parse_binarySend();
  1708. if (result2 !== null) {
  1709. var result0 = result2;
  1710. } else {
  1711. var result1 = parse_jsStatement();
  1712. if (result1 !== null) {
  1713. var result0 = result1;
  1714. } else {
  1715. var result0 = null;;
  1716. };
  1717. };
  1718. };
  1719. };
  1720. }
  1721. cache[cacheKey] = {
  1722. nextPos: pos,
  1723. result: result0
  1724. };
  1725. return result0;
  1726. }
  1727. function parse_expressionList() {
  1728. var cacheKey = 'expressionList@' + pos;
  1729. var cachedResult = cache[cacheKey];
  1730. if (cachedResult) {
  1731. pos = cachedResult.nextPos;
  1732. return cachedResult.result;
  1733. }
  1734. var savedPos0 = pos;
  1735. var savedPos1 = pos;
  1736. var result3 = parse_ws();
  1737. if (result3 !== null) {
  1738. if (input.substr(pos, 1) === ".") {
  1739. var result4 = ".";
  1740. pos += 1;
  1741. } else {
  1742. var result4 = null;
  1743. if (reportMatchFailures) {
  1744. matchFailed("\".\"");
  1745. }
  1746. }
  1747. if (result4 !== null) {
  1748. var result5 = parse_ws();
  1749. if (result5 !== null) {
  1750. var result6 = parse_expression();
  1751. if (result6 !== null) {
  1752. var result1 = [result3, result4, result5, result6];
  1753. } else {
  1754. var result1 = null;
  1755. pos = savedPos1;
  1756. }
  1757. } else {
  1758. var result1 = null;
  1759. pos = savedPos1;
  1760. }
  1761. } else {
  1762. var result1 = null;
  1763. pos = savedPos1;
  1764. }
  1765. } else {
  1766. var result1 = null;
  1767. pos = savedPos1;
  1768. }
  1769. var result2 = result1 !== null
  1770. ? (function(expression) {return expression})(result1[3])
  1771. : null;
  1772. if (result2 !== null) {
  1773. var result0 = result2;
  1774. } else {
  1775. var result0 = null;
  1776. pos = savedPos0;
  1777. }
  1778. cache[cacheKey] = {
  1779. nextPos: pos,
  1780. result: result0
  1781. };
  1782. return result0;
  1783. }
  1784. function parse_expressions() {
  1785. var cacheKey = 'expressions@' + pos;
  1786. var cachedResult = cache[cacheKey];
  1787. if (cachedResult) {
  1788. pos = cachedResult.nextPos;
  1789. return cachedResult.result;
  1790. }
  1791. var savedPos0 = pos;
  1792. var savedPos1 = pos;
  1793. var result3 = parse_expression();
  1794. if (result3 !== null) {
  1795. var result4 = [];
  1796. var result5 = parse_expressionList();
  1797. while (result5 !== null) {
  1798. result4.push(result5);
  1799. var result5 = parse_expressionList();
  1800. }
  1801. if (result4 !== null) {
  1802. var result1 = [result3, result4];
  1803. } else {
  1804. var result1 = null;
  1805. pos = savedPos1;
  1806. }
  1807. } else {
  1808. var result1 = null;
  1809. pos = savedPos1;
  1810. }
  1811. var result2 = result1 !== null
  1812. ? (function(first, others) {
  1813. var result = [first];
  1814. for(var i=0;i<others.length;i++) {
  1815. result.push(others[i]);
  1816. }
  1817. return result;
  1818. })(result1[0], result1[1])
  1819. : null;
  1820. if (result2 !== null) {
  1821. var result0 = result2;
  1822. } else {
  1823. var result0 = null;
  1824. pos = savedPos0;
  1825. }
  1826. cache[cacheKey] = {
  1827. nextPos: pos,
  1828. result: result0
  1829. };
  1830. return result0;
  1831. }
  1832. function parse_assignment() {
  1833. var cacheKey = 'assignment@' + pos;
  1834. var cachedResult = cache[cacheKey];
  1835. if (cachedResult) {
  1836. pos = cachedResult.nextPos;
  1837. return cachedResult.result;
  1838. }
  1839. var savedPos0 = pos;
  1840. var savedPos1 = pos;
  1841. var result3 = parse_variable();
  1842. if (result3 !== null) {
  1843. var result4 = parse_ws();
  1844. if (result4 !== null) {
  1845. if (input.substr(pos, 2) === ":=") {
  1846. var result5 = ":=";
  1847. pos += 2;
  1848. } else {
  1849. var result5 = null;
  1850. if (reportMatchFailures) {
  1851. matchFailed("\":=\"");
  1852. }
  1853. }
  1854. if (result5 !== null) {
  1855. var result6 = parse_ws();
  1856. if (result6 !== null) {
  1857. var result7 = parse_expression();
  1858. if (result7 !== null) {
  1859. var result1 = [result3, result4, result5, result6, result7];
  1860. } else {
  1861. var result1 = null;
  1862. pos = savedPos1;
  1863. }
  1864. } else {
  1865. var result1 = null;
  1866. pos = savedPos1;
  1867. }
  1868. } else {
  1869. var result1 = null;
  1870. pos = savedPos1;
  1871. }
  1872. } else {
  1873. var result1 = null;
  1874. pos = savedPos1;
  1875. }
  1876. } else {
  1877. var result1 = null;
  1878. pos = savedPos1;
  1879. }
  1880. var result2 = result1 !== null
  1881. ? (function(variable, expression) {
  1882. return smalltalk.AssignmentNode._new()
  1883. ._left_(variable)
  1884. ._right_(expression)
  1885. })(result1[0], result1[4])
  1886. : null;
  1887. if (result2 !== null) {
  1888. var result0 = result2;
  1889. } else {
  1890. var result0 = null;
  1891. pos = savedPos0;
  1892. }
  1893. cache[cacheKey] = {
  1894. nextPos: pos,
  1895. result: result0
  1896. };
  1897. return result0;
  1898. }
  1899. function parse_ret() {
  1900. var cacheKey = 'ret@' + pos;
  1901. var cachedResult = cache[cacheKey];
  1902. if (cachedResult) {
  1903. pos = cachedResult.nextPos;
  1904. return cachedResult.result;
  1905. }
  1906. var savedPos0 = pos;
  1907. var savedPos1 = pos;
  1908. if (input.substr(pos, 1) === "^") {
  1909. var result3 = "^";
  1910. pos += 1;
  1911. } else {
  1912. var result3 = null;
  1913. if (reportMatchFailures) {
  1914. matchFailed("\"^\"");
  1915. }
  1916. }
  1917. if (result3 !== null) {
  1918. var result4 = parse_ws();
  1919. if (result4 !== null) {
  1920. var result5 = parse_expression();
  1921. if (result5 !== null) {
  1922. var result6 = parse_ws();
  1923. if (result6 !== null) {
  1924. if (input.substr(pos, 1) === ".") {
  1925. var result8 = ".";
  1926. pos += 1;
  1927. } else {
  1928. var result8 = null;
  1929. if (reportMatchFailures) {
  1930. matchFailed("\".\"");
  1931. }
  1932. }
  1933. var result7 = result8 !== null ? result8 : '';
  1934. if (result7 !== null) {
  1935. var result1 = [result3, result4, result5, result6, result7];
  1936. } else {
  1937. var result1 = null;
  1938. pos = savedPos1;
  1939. }
  1940. } else {
  1941. var result1 = null;
  1942. pos = savedPos1;
  1943. }
  1944. } else {
  1945. var result1 = null;
  1946. pos = savedPos1;
  1947. }
  1948. } else {
  1949. var result1 = null;
  1950. pos = savedPos1;
  1951. }
  1952. } else {
  1953. var result1 = null;
  1954. pos = savedPos1;
  1955. }
  1956. var result2 = result1 !== null
  1957. ? (function(expression) {
  1958. return smalltalk.ReturnNode._new()
  1959. ._nodes_([expression])
  1960. })(result1[2])
  1961. : null;
  1962. if (result2 !== null) {
  1963. var result0 = result2;
  1964. } else {
  1965. var result0 = null;
  1966. pos = savedPos0;
  1967. }
  1968. cache[cacheKey] = {
  1969. nextPos: pos,
  1970. result: result0
  1971. };
  1972. return result0;
  1973. }
  1974. function parse_temps() {
  1975. var cacheKey = 'temps@' + pos;
  1976. var cachedResult = cache[cacheKey];
  1977. if (cachedResult) {
  1978. pos = cachedResult.nextPos;
  1979. return cachedResult.result;
  1980. }
  1981. var savedPos0 = pos;
  1982. var savedPos1 = pos;
  1983. if (input.substr(pos, 1) === "|") {
  1984. var result3 = "|";
  1985. pos += 1;
  1986. } else {
  1987. var result3 = null;
  1988. if (reportMatchFailures) {
  1989. matchFailed("\"|\"");
  1990. }
  1991. }
  1992. if (result3 !== null) {
  1993. var result4 = [];
  1994. var savedPos2 = pos;
  1995. var savedPos3 = pos;
  1996. var result9 = parse_ws();
  1997. if (result9 !== null) {
  1998. var result10 = parse_identifier();
  1999. if (result10 !== null) {
  2000. var result11 = parse_ws();
  2001. if (result11 !== null) {
  2002. var result7 = [result9, result10, result11];
  2003. } else {
  2004. var result7 = null;
  2005. pos = savedPos3;
  2006. }
  2007. } else {
  2008. var result7 = null;
  2009. pos = savedPos3;
  2010. }
  2011. } else {
  2012. var result7 = null;
  2013. pos = savedPos3;
  2014. }
  2015. var result8 = result7 !== null
  2016. ? (function(variable) {return variable})(result7[1])
  2017. : null;
  2018. if (result8 !== null) {
  2019. var result6 = result8;
  2020. } else {
  2021. var result6 = null;
  2022. pos = savedPos2;
  2023. }
  2024. while (result6 !== null) {
  2025. result4.push(result6);
  2026. var savedPos2 = pos;
  2027. var savedPos3 = pos;
  2028. var result9 = parse_ws();
  2029. if (result9 !== null) {
  2030. var result10 = parse_identifier();
  2031. if (result10 !== null) {
  2032. var result11 = parse_ws();
  2033. if (result11 !== null) {
  2034. var result7 = [result9, result10, result11];
  2035. } else {
  2036. var result7 = null;
  2037. pos = savedPos3;
  2038. }
  2039. } else {
  2040. var result7 = null;
  2041. pos = savedPos3;
  2042. }
  2043. } else {
  2044. var result7 = null;
  2045. pos = savedPos3;
  2046. }
  2047. var result8 = result7 !== null
  2048. ? (function(variable) {return variable})(result7[1])
  2049. : null;
  2050. if (result8 !== null) {
  2051. var result6 = result8;
  2052. } else {
  2053. var result6 = null;
  2054. pos = savedPos2;
  2055. }
  2056. }
  2057. if (result4 !== null) {
  2058. if (input.substr(pos, 1) === "|") {
  2059. var result5 = "|";
  2060. pos += 1;
  2061. } else {
  2062. var result5 = null;
  2063. if (reportMatchFailures) {
  2064. matchFailed("\"|\"");
  2065. }
  2066. }
  2067. if (result5 !== null) {
  2068. var result1 = [result3, result4, result5];
  2069. } else {
  2070. var result1 = null;
  2071. pos = savedPos1;
  2072. }
  2073. } else {
  2074. var result1 = null;
  2075. pos = savedPos1;
  2076. }
  2077. } else {
  2078. var result1 = null;
  2079. pos = savedPos1;
  2080. }
  2081. var result2 = result1 !== null
  2082. ? (function(vars) {return vars})(result1[1])
  2083. : null;
  2084. if (result2 !== null) {
  2085. var result0 = result2;
  2086. } else {
  2087. var result0 = null;
  2088. pos = savedPos0;
  2089. }
  2090. cache[cacheKey] = {
  2091. nextPos: pos,
  2092. result: result0
  2093. };
  2094. return result0;
  2095. }
  2096. function parse_blockParamList() {
  2097. var cacheKey = 'blockParamList@' + pos;
  2098. var cachedResult = cache[cacheKey];
  2099. if (cachedResult) {
  2100. pos = cachedResult.nextPos;
  2101. return cachedResult.result;
  2102. }
  2103. var savedPos0 = pos;
  2104. var savedPos1 = pos;
  2105. var savedPos2 = pos;
  2106. var savedPos3 = pos;
  2107. var result9 = parse_ws();
  2108. if (result9 !== null) {
  2109. if (input.substr(pos, 1) === ":") {
  2110. var result10 = ":";
  2111. pos += 1;
  2112. } else {
  2113. var result10 = null;
  2114. if (reportMatchFailures) {
  2115. matchFailed("\":\"");
  2116. }
  2117. }
  2118. if (result10 !== null) {
  2119. var result11 = parse_ws();
  2120. if (result11 !== null) {
  2121. var result12 = parse_identifier();
  2122. if (result12 !== null) {
  2123. var result7 = [result9, result10, result11, result12];
  2124. } else {
  2125. var result7 = null;
  2126. pos = savedPos3;
  2127. }
  2128. } else {
  2129. var result7 = null;
  2130. pos = savedPos3;
  2131. }
  2132. } else {
  2133. var result7 = null;
  2134. pos = savedPos3;
  2135. }
  2136. } else {
  2137. var result7 = null;
  2138. pos = savedPos3;
  2139. }
  2140. var result8 = result7 !== null
  2141. ? (function(param) {return param})(result7[3])
  2142. : null;
  2143. if (result8 !== null) {
  2144. var result6 = result8;
  2145. } else {
  2146. var result6 = null;
  2147. pos = savedPos2;
  2148. }
  2149. if (result6 !== null) {
  2150. var result3 = [];
  2151. while (result6 !== null) {
  2152. result3.push(result6);
  2153. var savedPos2 = pos;
  2154. var savedPos3 = pos;
  2155. var result9 = parse_ws();
  2156. if (result9 !== null) {
  2157. if (input.substr(pos, 1) === ":") {
  2158. var result10 = ":";
  2159. pos += 1;
  2160. } else {
  2161. var result10 = null;
  2162. if (reportMatchFailures) {
  2163. matchFailed("\":\"");
  2164. }
  2165. }
  2166. if (result10 !== null) {
  2167. var result11 = parse_ws();
  2168. if (result11 !== null) {
  2169. var result12 = parse_identifier();
  2170. if (result12 !== null) {
  2171. var result7 = [result9, result10, result11, result12];
  2172. } else {
  2173. var result7 = null;
  2174. pos = savedPos3;
  2175. }
  2176. } else {
  2177. var result7 = null;
  2178. pos = savedPos3;
  2179. }
  2180. } else {
  2181. var result7 = null;
  2182. pos = savedPos3;
  2183. }
  2184. } else {
  2185. var result7 = null;
  2186. pos = savedPos3;
  2187. }
  2188. var result8 = result7 !== null
  2189. ? (function(param) {return param})(result7[3])
  2190. : null;
  2191. if (result8 !== null) {
  2192. var result6 = result8;
  2193. } else {
  2194. var result6 = null;
  2195. pos = savedPos2;
  2196. }
  2197. }
  2198. } else {
  2199. var result3 = null;
  2200. }
  2201. if (result3 !== null) {
  2202. var result4 = parse_ws();
  2203. if (result4 !== null) {
  2204. if (input.substr(pos, 1) === "|") {
  2205. var result5 = "|";
  2206. pos += 1;
  2207. } else {
  2208. var result5 = null;
  2209. if (reportMatchFailures) {
  2210. matchFailed("\"|\"");
  2211. }
  2212. }
  2213. if (result5 !== null) {
  2214. var result1 = [result3, result4, result5];
  2215. } else {
  2216. var result1 = null;
  2217. pos = savedPos1;
  2218. }
  2219. } else {
  2220. var result1 = null;
  2221. pos = savedPos1;
  2222. }
  2223. } else {
  2224. var result1 = null;
  2225. pos = savedPos1;
  2226. }
  2227. var result2 = result1 !== null
  2228. ? (function(params) {return params})(result1[0])
  2229. : null;
  2230. if (result2 !== null) {
  2231. var result0 = result2;
  2232. } else {
  2233. var result0 = null;
  2234. pos = savedPos0;
  2235. }
  2236. cache[cacheKey] = {
  2237. nextPos: pos,
  2238. result: result0
  2239. };
  2240. return result0;
  2241. }
  2242. function parse_subexpression() {
  2243. var cacheKey = 'subexpression@' + pos;
  2244. var cachedResult = cache[cacheKey];
  2245. if (cachedResult) {
  2246. pos = cachedResult.nextPos;
  2247. return cachedResult.result;
  2248. }
  2249. var savedPos0 = pos;
  2250. var savedPos1 = pos;
  2251. if (input.substr(pos, 1) === "(") {
  2252. var result3 = "(";
  2253. pos += 1;
  2254. } else {
  2255. var result3 = null;
  2256. if (reportMatchFailures) {
  2257. matchFailed("\"(\"");
  2258. }
  2259. }
  2260. if (result3 !== null) {
  2261. var result4 = parse_ws();
  2262. if (result4 !== null) {
  2263. var result5 = parse_expression();
  2264. if (result5 !== null) {
  2265. var result6 = parse_ws();
  2266. if (result6 !== null) {
  2267. if (input.substr(pos, 1) === ")") {
  2268. var result7 = ")";
  2269. pos += 1;
  2270. } else {
  2271. var result7 = null;
  2272. if (reportMatchFailures) {
  2273. matchFailed("\")\"");
  2274. }
  2275. }
  2276. if (result7 !== null) {
  2277. var result1 = [result3, result4, result5, result6, result7];
  2278. } else {
  2279. var result1 = null;
  2280. pos = savedPos1;
  2281. }
  2282. } else {
  2283. var result1 = null;
  2284. pos = savedPos1;
  2285. }
  2286. } else {
  2287. var result1 = null;
  2288. pos = savedPos1;
  2289. }
  2290. } else {
  2291. var result1 = null;
  2292. pos = savedPos1;
  2293. }
  2294. } else {
  2295. var result1 = null;
  2296. pos = savedPos1;
  2297. }
  2298. var result2 = result1 !== null
  2299. ? (function(expression) {return expression})(result1[2])
  2300. : null;
  2301. if (result2 !== null) {
  2302. var result0 = result2;
  2303. } else {
  2304. var result0 = null;
  2305. pos = savedPos0;
  2306. }
  2307. cache[cacheKey] = {
  2308. nextPos: pos,
  2309. result: result0
  2310. };
  2311. return result0;
  2312. }
  2313. function parse_statements() {
  2314. var cacheKey = 'statements@' + pos;
  2315. var cachedResult = cache[cacheKey];
  2316. if (cachedResult) {
  2317. pos = cachedResult.nextPos;
  2318. return cachedResult.result;
  2319. }
  2320. var savedPos4 = pos;
  2321. var savedPos5 = pos;
  2322. var result22 = parse_ret();
  2323. if (result22 !== null) {
  2324. var result23 = [];
  2325. if (input.substr(pos).match(/^[.]/) !== null) {
  2326. var result24 = input.charAt(pos);
  2327. pos++;
  2328. } else {
  2329. var result24 = null;
  2330. if (reportMatchFailures) {
  2331. matchFailed("[.]");
  2332. }
  2333. }
  2334. while (result24 !== null) {
  2335. result23.push(result24);
  2336. if (input.substr(pos).match(/^[.]/) !== null) {
  2337. var result24 = input.charAt(pos);
  2338. pos++;
  2339. } else {
  2340. var result24 = null;
  2341. if (reportMatchFailures) {
  2342. matchFailed("[.]");
  2343. }
  2344. }
  2345. }
  2346. if (result23 !== null) {
  2347. var result20 = [result22, result23];
  2348. } else {
  2349. var result20 = null;
  2350. pos = savedPos5;
  2351. }
  2352. } else {
  2353. var result20 = null;
  2354. pos = savedPos5;
  2355. }
  2356. var result21 = result20 !== null
  2357. ? (function(ret) {return [ret]})(result20[0])
  2358. : null;
  2359. if (result21 !== null) {
  2360. var result19 = result21;
  2361. } else {
  2362. var result19 = null;
  2363. pos = savedPos4;
  2364. }
  2365. if (result19 !== null) {
  2366. var result0 = result19;
  2367. } else {
  2368. var savedPos2 = pos;
  2369. var savedPos3 = pos;
  2370. var result11 = parse_expressions();
  2371. if (result11 !== null) {
  2372. var result12 = parse_ws();
  2373. if (result12 !== null) {
  2374. if (input.substr(pos).match(/^[.]/) !== null) {
  2375. var result18 = input.charAt(pos);
  2376. pos++;
  2377. } else {
  2378. var result18 = null;
  2379. if (reportMatchFailures) {
  2380. matchFailed("[.]");
  2381. }
  2382. }
  2383. if (result18 !== null) {
  2384. var result13 = [];
  2385. while (result18 !== null) {
  2386. result13.push(result18);
  2387. if (input.substr(pos).match(/^[.]/) !== null) {
  2388. var result18 = input.charAt(pos);
  2389. pos++;
  2390. } else {
  2391. var result18 = null;
  2392. if (reportMatchFailures) {
  2393. matchFailed("[.]");
  2394. }
  2395. }
  2396. }
  2397. } else {
  2398. var result13 = null;
  2399. }
  2400. if (result13 !== null) {
  2401. var result14 = parse_ws();
  2402. if (result14 !== null) {
  2403. var result15 = parse_ret();
  2404. if (result15 !== null) {
  2405. var result16 = [];
  2406. if (input.substr(pos).match(/^[.]/) !== null) {
  2407. var result17 = input.charAt(pos);
  2408. pos++;
  2409. } else {
  2410. var result17 = null;
  2411. if (reportMatchFailures) {
  2412. matchFailed("[.]");
  2413. }
  2414. }
  2415. while (result17 !== null) {
  2416. result16.push(result17);
  2417. if (input.substr(pos).match(/^[.]/) !== null) {
  2418. var result17 = input.charAt(pos);
  2419. pos++;
  2420. } else {
  2421. var result17 = null;
  2422. if (reportMatchFailures) {
  2423. matchFailed("[.]");
  2424. }
  2425. }
  2426. }
  2427. if (result16 !== null) {
  2428. var result9 = [result11, result12, result13, result14, result15, result16];
  2429. } else {
  2430. var result9 = null;
  2431. pos = savedPos3;
  2432. }
  2433. } else {
  2434. var result9 = null;
  2435. pos = savedPos3;
  2436. }
  2437. } else {
  2438. var result9 = null;
  2439. pos = savedPos3;
  2440. }
  2441. } else {
  2442. var result9 = null;
  2443. pos = savedPos3;
  2444. }
  2445. } else {
  2446. var result9 = null;
  2447. pos = savedPos3;
  2448. }
  2449. } else {
  2450. var result9 = null;
  2451. pos = savedPos3;
  2452. }
  2453. var result10 = result9 !== null
  2454. ? (function(exps, ret) {
  2455. var expressions = exps;
  2456. expressions.push(ret);
  2457. return expressions
  2458. })(result9[0], result9[4])
  2459. : null;
  2460. if (result10 !== null) {
  2461. var result8 = result10;
  2462. } else {
  2463. var result8 = null;
  2464. pos = savedPos2;
  2465. }
  2466. if (result8 !== null) {
  2467. var result0 = result8;
  2468. } else {
  2469. var savedPos0 = pos;
  2470. var savedPos1 = pos;
  2471. var result7 = parse_expressions();
  2472. var result4 = result7 !== null ? result7 : '';
  2473. if (result4 !== null) {
  2474. var result5 = [];
  2475. if (input.substr(pos).match(/^[.]/) !== null) {
  2476. var result6 = input.charAt(pos);
  2477. pos++;
  2478. } else {
  2479. var result6 = null;
  2480. if (reportMatchFailures) {
  2481. matchFailed("[.]");
  2482. }
  2483. }
  2484. while (result6 !== null) {
  2485. result5.push(result6);
  2486. if (input.substr(pos).match(/^[.]/) !== null) {
  2487. var result6 = input.charAt(pos);
  2488. pos++;
  2489. } else {
  2490. var result6 = null;
  2491. if (reportMatchFailures) {
  2492. matchFailed("[.]");
  2493. }
  2494. }
  2495. }
  2496. if (result5 !== null) {
  2497. var result2 = [result4, result5];
  2498. } else {
  2499. var result2 = null;
  2500. pos = savedPos1;
  2501. }
  2502. } else {
  2503. var result2 = null;
  2504. pos = savedPos1;
  2505. }
  2506. var result3 = result2 !== null
  2507. ? (function(expressions) {
  2508. return expressions || []
  2509. })(result2[0])
  2510. : null;
  2511. if (result3 !== null) {
  2512. var result1 = result3;
  2513. } else {
  2514. var result1 = null;
  2515. pos = savedPos0;
  2516. }
  2517. if (result1 !== null) {
  2518. var result0 = result1;
  2519. } else {
  2520. var result0 = null;;
  2521. };
  2522. };
  2523. }
  2524. cache[cacheKey] = {
  2525. nextPos: pos,
  2526. result: result0
  2527. };
  2528. return result0;
  2529. }
  2530. function parse_sequence() {
  2531. var cacheKey = 'sequence@' + pos;
  2532. var cachedResult = cache[cacheKey];
  2533. if (cachedResult) {
  2534. pos = cachedResult.nextPos;
  2535. return cachedResult.result;
  2536. }
  2537. var savedPos0 = pos;
  2538. var savedPos1 = pos;
  2539. var result8 = parse_temps();
  2540. var result3 = result8 !== null ? result8 : '';
  2541. if (result3 !== null) {
  2542. var result4 = parse_ws();
  2543. if (result4 !== null) {
  2544. var result7 = parse_statements();
  2545. var result5 = result7 !== null ? result7 : '';
  2546. if (result5 !== null) {
  2547. var result6 = parse_ws();
  2548. if (result6 !== null) {
  2549. var result1 = [result3, result4, result5, result6];
  2550. } else {
  2551. var result1 = null;
  2552. pos = savedPos1;
  2553. }
  2554. } else {
  2555. var result1 = null;
  2556. pos = savedPos1;
  2557. }
  2558. } else {
  2559. var result1 = null;
  2560. pos = savedPos1;
  2561. }
  2562. } else {
  2563. var result1 = null;
  2564. pos = savedPos1;
  2565. }
  2566. var result2 = result1 !== null
  2567. ? (function(temps, statements) {
  2568. return smalltalk.SequenceNode._new()
  2569. ._temps_(temps || [])
  2570. ._nodes_(statements || [])
  2571. })(result1[0], result1[2])
  2572. : null;
  2573. if (result2 !== null) {
  2574. var result0 = result2;
  2575. } else {
  2576. var result0 = null;
  2577. pos = savedPos0;
  2578. }
  2579. cache[cacheKey] = {
  2580. nextPos: pos,
  2581. result: result0
  2582. };
  2583. return result0;
  2584. }
  2585. function parse_block() {
  2586. var cacheKey = 'block@' + pos;
  2587. var cachedResult = cache[cacheKey];
  2588. if (cachedResult) {
  2589. pos = cachedResult.nextPos;
  2590. return cachedResult.result;
  2591. }
  2592. var savedPos0 = pos;
  2593. var savedPos1 = pos;
  2594. if (input.substr(pos, 1) === "[") {
  2595. var result3 = "[";
  2596. pos += 1;
  2597. } else {
  2598. var result3 = null;
  2599. if (reportMatchFailures) {
  2600. matchFailed("\"[\"");
  2601. }
  2602. }
  2603. if (result3 !== null) {
  2604. var result4 = parse_ws();
  2605. if (result4 !== null) {
  2606. var result11 = parse_blockParamList();
  2607. var result5 = result11 !== null ? result11 : '';
  2608. if (result5 !== null) {
  2609. var result6 = parse_ws();
  2610. if (result6 !== null) {
  2611. var result10 = parse_sequence();
  2612. var result7 = result10 !== null ? result10 : '';
  2613. if (result7 !== null) {
  2614. var result8 = parse_ws();
  2615. if (result8 !== null) {
  2616. if (input.substr(pos, 1) === "]") {
  2617. var result9 = "]";
  2618. pos += 1;
  2619. } else {
  2620. var result9 = null;
  2621. if (reportMatchFailures) {
  2622. matchFailed("\"]\"");
  2623. }
  2624. }
  2625. if (result9 !== null) {
  2626. var result1 = [result3, result4, result5, result6, result7, result8, result9];
  2627. } else {
  2628. var result1 = null;
  2629. pos = savedPos1;
  2630. }
  2631. } else {
  2632. var result1 = null;
  2633. pos = savedPos1;
  2634. }
  2635. } else {
  2636. var result1 = null;
  2637. pos = savedPos1;
  2638. }
  2639. } else {
  2640. var result1 = null;
  2641. pos = savedPos1;
  2642. }
  2643. } else {
  2644. var result1 = null;
  2645. pos = savedPos1;
  2646. }
  2647. } else {
  2648. var result1 = null;
  2649. pos = savedPos1;
  2650. }
  2651. } else {
  2652. var result1 = null;
  2653. pos = savedPos1;
  2654. }
  2655. var result2 = result1 !== null
  2656. ? (function(params, sequence) {
  2657. return smalltalk.BlockNode._new()
  2658. ._parameters_(params || [])
  2659. ._nodes_([sequence._asBlockSequenceNode()])
  2660. })(result1[2], result1[4])
  2661. : null;
  2662. if (result2 !== null) {
  2663. var result0 = result2;
  2664. } else {
  2665. var result0 = null;
  2666. pos = savedPos0;
  2667. }
  2668. cache[cacheKey] = {
  2669. nextPos: pos,
  2670. result: result0
  2671. };
  2672. return result0;
  2673. }
  2674. function parse_operand() {
  2675. var cacheKey = 'operand@' + pos;
  2676. var cachedResult = cache[cacheKey];
  2677. if (cachedResult) {
  2678. pos = cachedResult.nextPos;
  2679. return cachedResult.result;
  2680. }
  2681. var result3 = parse_literal();
  2682. if (result3 !== null) {
  2683. var result0 = result3;
  2684. } else {
  2685. var result2 = parse_reference();
  2686. if (result2 !== null) {
  2687. var result0 = result2;
  2688. } else {
  2689. var result1 = parse_subexpression();
  2690. if (result1 !== null) {
  2691. var result0 = result1;
  2692. } else {
  2693. var result0 = null;;
  2694. };
  2695. };
  2696. }
  2697. cache[cacheKey] = {
  2698. nextPos: pos,
  2699. result: result0
  2700. };
  2701. return result0;
  2702. }
  2703. function parse_unaryMessage() {
  2704. var cacheKey = 'unaryMessage@' + pos;
  2705. var cachedResult = cache[cacheKey];
  2706. if (cachedResult) {
  2707. pos = cachedResult.nextPos;
  2708. return cachedResult.result;
  2709. }
  2710. var savedPos0 = pos;
  2711. var savedPos1 = pos;
  2712. var result3 = parse_ws();
  2713. if (result3 !== null) {
  2714. var result4 = parse_identifier();
  2715. if (result4 !== null) {
  2716. var savedPos2 = pos;
  2717. var savedReportMatchFailuresVar0 = reportMatchFailures;
  2718. reportMatchFailures = false;
  2719. if (input.substr(pos).match(/^[:]/) !== null) {
  2720. var result6 = input.charAt(pos);
  2721. pos++;
  2722. } else {
  2723. var result6 = null;
  2724. if (reportMatchFailures) {
  2725. matchFailed("[:]");
  2726. }
  2727. }
  2728. reportMatchFailures = savedReportMatchFailuresVar0;
  2729. if (result6 === null) {
  2730. var result5 = '';
  2731. } else {
  2732. var result5 = null;
  2733. pos = savedPos2;
  2734. }
  2735. if (result5 !== null) {
  2736. var result1 = [result3, result4, result5];
  2737. } else {
  2738. var result1 = null;
  2739. pos = savedPos1;
  2740. }
  2741. } else {
  2742. var result1 = null;
  2743. pos = savedPos1;
  2744. }
  2745. } else {
  2746. var result1 = null;
  2747. pos = savedPos1;
  2748. }
  2749. var result2 = result1 !== null
  2750. ? (function(selector) {
  2751. return smalltalk.SendNode._new()
  2752. ._selector_(selector)
  2753. })(result1[1])
  2754. : null;
  2755. if (result2 !== null) {
  2756. var result0 = result2;
  2757. } else {
  2758. var result0 = null;
  2759. pos = savedPos0;
  2760. }
  2761. cache[cacheKey] = {
  2762. nextPos: pos,
  2763. result: result0
  2764. };
  2765. return result0;
  2766. }
  2767. function parse_unaryTail() {
  2768. var cacheKey = 'unaryTail@' + pos;
  2769. var cachedResult = cache[cacheKey];
  2770. if (cachedResult) {
  2771. pos = cachedResult.nextPos;
  2772. return cachedResult.result;
  2773. }
  2774. var savedPos0 = pos;
  2775. var savedPos1 = pos;
  2776. var result3 = parse_unaryMessage();
  2777. if (result3 !== null) {
  2778. var result4 = parse_ws();
  2779. if (result4 !== null) {
  2780. var result7 = parse_unaryTail();
  2781. var result5 = result7 !== null ? result7 : '';
  2782. if (result5 !== null) {
  2783. var result6 = parse_ws();
  2784. if (result6 !== null) {
  2785. var result1 = [result3, result4, result5, result6];
  2786. } else {
  2787. var result1 = null;
  2788. pos = savedPos1;
  2789. }
  2790. } else {
  2791. var result1 = null;
  2792. pos = savedPos1;
  2793. }
  2794. } else {
  2795. var result1 = null;
  2796. pos = savedPos1;
  2797. }
  2798. } else {
  2799. var result1 = null;
  2800. pos = savedPos1;
  2801. }
  2802. var result2 = result1 !== null
  2803. ? (function(message, tail) {
  2804. if(tail) {
  2805. return tail._valueForReceiver_(message);
  2806. }
  2807. else {
  2808. return message;
  2809. }
  2810. })(result1[0], result1[2])
  2811. : null;
  2812. if (result2 !== null) {
  2813. var result0 = result2;
  2814. } else {
  2815. var result0 = null;
  2816. pos = savedPos0;
  2817. }
  2818. cache[cacheKey] = {
  2819. nextPos: pos,
  2820. result: result0
  2821. };
  2822. return result0;
  2823. }
  2824. function parse_unarySend() {
  2825. var cacheKey = 'unarySend@' + pos;
  2826. var cachedResult = cache[cacheKey];
  2827. if (cachedResult) {
  2828. pos = cachedResult.nextPos;
  2829. return cachedResult.result;
  2830. }
  2831. var savedPos0 = pos;
  2832. var savedPos1 = pos;
  2833. var result3 = parse_operand();
  2834. if (result3 !== null) {
  2835. var result4 = parse_ws();
  2836. if (result4 !== null) {
  2837. var result6 = parse_unaryTail();
  2838. var result5 = result6 !== null ? result6 : '';
  2839. if (result5 !== null) {
  2840. var result1 = [result3, result4, result5];
  2841. } else {
  2842. var result1 = null;
  2843. pos = savedPos1;
  2844. }
  2845. } else {
  2846. var result1 = null;
  2847. pos = savedPos1;
  2848. }
  2849. } else {
  2850. var result1 = null;
  2851. pos = savedPos1;
  2852. }
  2853. var result2 = result1 !== null
  2854. ? (function(receiver, tail) {
  2855. if(tail) {
  2856. return tail._valueForReceiver_(receiver);
  2857. }
  2858. else {
  2859. return receiver;
  2860. }
  2861. })(result1[0], result1[2])
  2862. : null;
  2863. if (result2 !== null) {
  2864. var result0 = result2;
  2865. } else {
  2866. var result0 = null;
  2867. pos = savedPos0;
  2868. }
  2869. cache[cacheKey] = {
  2870. nextPos: pos,
  2871. result: result0
  2872. };
  2873. return result0;
  2874. }
  2875. function parse_binaryMessage() {
  2876. var cacheKey = 'binaryMessage@' + pos;
  2877. var cachedResult = cache[cacheKey];
  2878. if (cachedResult) {
  2879. pos = cachedResult.nextPos;
  2880. return cachedResult.result;
  2881. }
  2882. var savedPos0 = pos;
  2883. var savedPos1 = pos;
  2884. var result3 = parse_ws();
  2885. if (result3 !== null) {
  2886. var result4 = parse_binarySelector();
  2887. if (result4 !== null) {
  2888. var result5 = parse_ws();
  2889. if (result5 !== null) {
  2890. var result8 = parse_unarySend();
  2891. if (result8 !== null) {
  2892. var result6 = result8;
  2893. } else {
  2894. var result7 = parse_operand();
  2895. if (result7 !== null) {
  2896. var result6 = result7;
  2897. } else {
  2898. var result6 = null;;
  2899. };
  2900. }
  2901. if (result6 !== null) {
  2902. var result1 = [result3, result4, result5, result6];
  2903. } else {
  2904. var result1 = null;
  2905. pos = savedPos1;
  2906. }
  2907. } else {
  2908. var result1 = null;
  2909. pos = savedPos1;
  2910. }
  2911. } else {
  2912. var result1 = null;
  2913. pos = savedPos1;
  2914. }
  2915. } else {
  2916. var result1 = null;
  2917. pos = savedPos1;
  2918. }
  2919. var result2 = result1 !== null
  2920. ? (function(selector, arg) {
  2921. return smalltalk.SendNode._new()
  2922. ._selector_(selector)
  2923. ._arguments_([arg])
  2924. })(result1[1], result1[3])
  2925. : null;
  2926. if (result2 !== null) {
  2927. var result0 = result2;
  2928. } else {
  2929. var result0 = null;
  2930. pos = savedPos0;
  2931. }
  2932. cache[cacheKey] = {
  2933. nextPos: pos,
  2934. result: result0
  2935. };
  2936. return result0;
  2937. }
  2938. function parse_binaryTail() {
  2939. var cacheKey = 'binaryTail@' + pos;
  2940. var cachedResult = cache[cacheKey];
  2941. if (cachedResult) {
  2942. pos = cachedResult.nextPos;
  2943. return cachedResult.result;
  2944. }
  2945. var savedPos0 = pos;
  2946. var savedPos1 = pos;
  2947. var result3 = parse_binaryMessage();
  2948. if (result3 !== null) {
  2949. var result5 = parse_binaryTail();
  2950. var result4 = result5 !== null ? result5 : '';
  2951. if (result4 !== null) {
  2952. var result1 = [result3, result4];
  2953. } else {
  2954. var result1 = null;
  2955. pos = savedPos1;
  2956. }
  2957. } else {
  2958. var result1 = null;
  2959. pos = savedPos1;
  2960. }
  2961. var result2 = result1 !== null
  2962. ? (function(message, tail) {
  2963. if(tail) {
  2964. return tail._valueForReceiver_(message);
  2965. }
  2966. else {
  2967. return message;
  2968. }
  2969. })(result1[0], result1[1])
  2970. : null;
  2971. if (result2 !== null) {
  2972. var result0 = result2;
  2973. } else {
  2974. var result0 = null;
  2975. pos = savedPos0;
  2976. }
  2977. cache[cacheKey] = {
  2978. nextPos: pos,
  2979. result: result0
  2980. };
  2981. return result0;
  2982. }
  2983. function parse_binarySend() {
  2984. var cacheKey = 'binarySend@' + pos;
  2985. var cachedResult = cache[cacheKey];
  2986. if (cachedResult) {
  2987. pos = cachedResult.nextPos;
  2988. return cachedResult.result;
  2989. }
  2990. var savedPos0 = pos;
  2991. var savedPos1 = pos;
  2992. var result3 = parse_unarySend();
  2993. if (result3 !== null) {
  2994. var result5 = parse_binaryTail();
  2995. var result4 = result5 !== null ? result5 : '';
  2996. if (result4 !== null) {
  2997. var result1 = [result3, result4];
  2998. } else {
  2999. var result1 = null;
  3000. pos = savedPos1;
  3001. }
  3002. } else {
  3003. var result1 = null;
  3004. pos = savedPos1;
  3005. }
  3006. var result2 = result1 !== null
  3007. ? (function(receiver, tail) {
  3008. if(tail) {
  3009. return tail._valueForReceiver_(receiver);
  3010. }
  3011. else {
  3012. return receiver;
  3013. }
  3014. })(result1[0], result1[1])
  3015. : null;
  3016. if (result2 !== null) {
  3017. var result0 = result2;
  3018. } else {
  3019. var result0 = null;
  3020. pos = savedPos0;
  3021. }
  3022. cache[cacheKey] = {
  3023. nextPos: pos,
  3024. result: result0
  3025. };
  3026. return result0;
  3027. }
  3028. function parse_keywordMessage() {
  3029. var cacheKey = 'keywordMessage@' + pos;
  3030. var cachedResult = cache[cacheKey];
  3031. if (cachedResult) {
  3032. pos = cachedResult.nextPos;
  3033. return cachedResult.result;
  3034. }
  3035. var savedPos0 = pos;
  3036. var savedPos1 = pos;
  3037. var result3 = parse_ws();
  3038. if (result3 !== null) {
  3039. var savedPos2 = pos;
  3040. var savedPos3 = pos;
  3041. var result8 = parse_keywordPair();
  3042. if (result8 !== null) {
  3043. var result9 = parse_ws();
  3044. if (result9 !== null) {
  3045. var result6 = [result8, result9];
  3046. } else {
  3047. var result6 = null;
  3048. pos = savedPos3;
  3049. }
  3050. } else {
  3051. var result6 = null;
  3052. pos = savedPos3;
  3053. }
  3054. var result7 = result6 !== null
  3055. ? (function(pair) {return pair})(result6[0])
  3056. : null;
  3057. if (result7 !== null) {
  3058. var result5 = result7;
  3059. } else {
  3060. var result5 = null;
  3061. pos = savedPos2;
  3062. }
  3063. if (result5 !== null) {
  3064. var result4 = [];
  3065. while (result5 !== null) {
  3066. result4.push(result5);
  3067. var savedPos2 = pos;
  3068. var savedPos3 = pos;
  3069. var result8 = parse_keywordPair();
  3070. if (result8 !== null) {
  3071. var result9 = parse_ws();
  3072. if (result9 !== null) {
  3073. var result6 = [result8, result9];
  3074. } else {
  3075. var result6 = null;
  3076. pos = savedPos3;
  3077. }
  3078. } else {
  3079. var result6 = null;
  3080. pos = savedPos3;
  3081. }
  3082. var result7 = result6 !== null
  3083. ? (function(pair) {return pair})(result6[0])
  3084. : null;
  3085. if (result7 !== null) {
  3086. var result5 = result7;
  3087. } else {
  3088. var result5 = null;
  3089. pos = savedPos2;
  3090. }
  3091. }
  3092. } else {
  3093. var result4 = null;
  3094. }
  3095. if (result4 !== null) {
  3096. var result1 = [result3, result4];
  3097. } else {
  3098. var result1 = null;
  3099. pos = savedPos1;
  3100. }
  3101. } else {
  3102. var result1 = null;
  3103. pos = savedPos1;
  3104. }
  3105. var result2 = result1 !== null
  3106. ? (function(pairs) {
  3107. var selector = [];
  3108. var args = [];
  3109. for(var i=0;i<pairs.length;i++) {
  3110. selector.push(pairs[i].key);
  3111. args.push(pairs[i].arg);
  3112. }
  3113. return smalltalk.SendNode._new()
  3114. ._selector_(selector.join(""))
  3115. ._arguments_(args)
  3116. })(result1[1])
  3117. : null;
  3118. if (result2 !== null) {
  3119. var result0 = result2;
  3120. } else {
  3121. var result0 = null;
  3122. pos = savedPos0;
  3123. }
  3124. cache[cacheKey] = {
  3125. nextPos: pos,
  3126. result: result0
  3127. };
  3128. return result0;
  3129. }
  3130. function parse_keywordSend() {
  3131. var cacheKey = 'keywordSend@' + pos;
  3132. var cachedResult = cache[cacheKey];
  3133. if (cachedResult) {
  3134. pos = cachedResult.nextPos;
  3135. return cachedResult.result;
  3136. }
  3137. var savedPos0 = pos;
  3138. var savedPos1 = pos;
  3139. var result3 = parse_binarySend();
  3140. if (result3 !== null) {
  3141. var result4 = parse_keywordMessage();
  3142. if (result4 !== null) {
  3143. var result1 = [result3, result4];
  3144. } else {
  3145. var result1 = null;
  3146. pos = savedPos1;
  3147. }
  3148. } else {
  3149. var result1 = null;
  3150. pos = savedPos1;
  3151. }
  3152. var result2 = result1 !== null
  3153. ? (function(receiver, tail) {
  3154. return tail._valueForReceiver_(receiver);
  3155. })(result1[0], result1[1])
  3156. : null;
  3157. if (result2 !== null) {
  3158. var result0 = result2;
  3159. } else {
  3160. var result0 = null;
  3161. pos = savedPos0;
  3162. }
  3163. cache[cacheKey] = {
  3164. nextPos: pos,
  3165. result: result0
  3166. };
  3167. return result0;
  3168. }
  3169. function parse_message() {
  3170. var cacheKey = 'message@' + pos;
  3171. var cachedResult = cache[cacheKey];
  3172. if (cachedResult) {
  3173. pos = cachedResult.nextPos;
  3174. return cachedResult.result;
  3175. }
  3176. var result3 = parse_binaryMessage();
  3177. if (result3 !== null) {
  3178. var result0 = result3;
  3179. } else {
  3180. var result2 = parse_unaryMessage();
  3181. if (result2 !== null) {
  3182. var result0 = result2;
  3183. } else {
  3184. var result1 = parse_keywordMessage();
  3185. if (result1 !== null) {
  3186. var result0 = result1;
  3187. } else {
  3188. var result0 = null;;
  3189. };
  3190. };
  3191. }
  3192. cache[cacheKey] = {
  3193. nextPos: pos,
  3194. result: result0
  3195. };
  3196. return result0;
  3197. }
  3198. function parse_cascade() {
  3199. var cacheKey = 'cascade@' + pos;
  3200. var cachedResult = cache[cacheKey];
  3201. if (cachedResult) {
  3202. pos = cachedResult.nextPos;
  3203. return cachedResult.result;
  3204. }
  3205. var savedPos0 = pos;
  3206. var savedPos1 = pos;
  3207. var result3 = parse_ws();
  3208. if (result3 !== null) {
  3209. var result15 = parse_keywordSend();
  3210. if (result15 !== null) {
  3211. var result4 = result15;
  3212. } else {
  3213. var result14 = parse_binarySend();
  3214. if (result14 !== null) {
  3215. var result4 = result14;
  3216. } else {
  3217. var result4 = null;;
  3218. };
  3219. }
  3220. if (result4 !== null) {
  3221. var savedPos2 = pos;
  3222. var savedPos3 = pos;
  3223. var result9 = parse_ws();
  3224. if (result9 !== null) {
  3225. if (input.substr(pos, 1) === ";") {
  3226. var result10 = ";";
  3227. pos += 1;
  3228. } else {
  3229. var result10 = null;
  3230. if (reportMatchFailures) {
  3231. matchFailed("\";\"");
  3232. }
  3233. }
  3234. if (result10 !== null) {
  3235. var result11 = parse_ws();
  3236. if (result11 !== null) {
  3237. var result12 = parse_message();
  3238. if (result12 !== null) {
  3239. var result13 = parse_ws();
  3240. if (result13 !== null) {
  3241. var result7 = [result9, result10, result11, result12, result13];
  3242. } else {
  3243. var result7 = null;
  3244. pos = savedPos3;
  3245. }
  3246. } else {
  3247. var result7 = null;
  3248. pos = savedPos3;
  3249. }
  3250. } else {
  3251. var result7 = null;
  3252. pos = savedPos3;
  3253. }
  3254. } else {
  3255. var result7 = null;
  3256. pos = savedPos3;
  3257. }
  3258. } else {
  3259. var result7 = null;
  3260. pos = savedPos3;
  3261. }
  3262. var result8 = result7 !== null
  3263. ? (function(mess) {return mess})(result7[3])
  3264. : null;
  3265. if (result8 !== null) {
  3266. var result6 = result8;
  3267. } else {
  3268. var result6 = null;
  3269. pos = savedPos2;
  3270. }
  3271. if (result6 !== null) {
  3272. var result5 = [];
  3273. while (result6 !== null) {
  3274. result5.push(result6);
  3275. var savedPos2 = pos;
  3276. var savedPos3 = pos;
  3277. var result9 = parse_ws();
  3278. if (result9 !== null) {
  3279. if (input.substr(pos, 1) === ";") {
  3280. var result10 = ";";
  3281. pos += 1;
  3282. } else {
  3283. var result10 = null;
  3284. if (reportMatchFailures) {
  3285. matchFailed("\";\"");
  3286. }
  3287. }
  3288. if (result10 !== null) {
  3289. var result11 = parse_ws();
  3290. if (result11 !== null) {
  3291. var result12 = parse_message();
  3292. if (result12 !== null) {
  3293. var result13 = parse_ws();
  3294. if (result13 !== null) {
  3295. var result7 = [result9, result10, result11, result12, result13];
  3296. } else {
  3297. var result7 = null;
  3298. pos = savedPos3;
  3299. }
  3300. } else {
  3301. var result7 = null;
  3302. pos = savedPos3;
  3303. }
  3304. } else {
  3305. var result7 = null;
  3306. pos = savedPos3;
  3307. }
  3308. } else {
  3309. var result7 = null;
  3310. pos = savedPos3;
  3311. }
  3312. } else {
  3313. var result7 = null;
  3314. pos = savedPos3;
  3315. }
  3316. var result8 = result7 !== null
  3317. ? (function(mess) {return mess})(result7[3])
  3318. : null;
  3319. if (result8 !== null) {
  3320. var result6 = result8;
  3321. } else {
  3322. var result6 = null;
  3323. pos = savedPos2;
  3324. }
  3325. }
  3326. } else {
  3327. var result5 = null;
  3328. }
  3329. if (result5 !== null) {
  3330. var result1 = [result3, result4, result5];
  3331. } else {
  3332. var result1 = null;
  3333. pos = savedPos1;
  3334. }
  3335. } else {
  3336. var result1 = null;
  3337. pos = savedPos1;
  3338. }
  3339. } else {
  3340. var result1 = null;
  3341. pos = savedPos1;
  3342. }
  3343. var result2 = result1 !== null
  3344. ? (function(send, messages) {
  3345. var cascade = [];
  3346. cascade.push(send);
  3347. for(var i=0;i<messages.length;i++) {
  3348. cascade.push(messages[i]);
  3349. }
  3350. return smalltalk.CascadeNode._new()
  3351. ._receiver_(send._receiver())
  3352. ._nodes_(cascade)
  3353. })(result1[1], result1[2])
  3354. : null;
  3355. if (result2 !== null) {
  3356. var result0 = result2;
  3357. } else {
  3358. var result0 = null;
  3359. pos = savedPos0;
  3360. }
  3361. cache[cacheKey] = {
  3362. nextPos: pos,
  3363. result: result0
  3364. };
  3365. return result0;
  3366. }
  3367. function parse_jsStatement() {
  3368. var cacheKey = 'jsStatement@' + pos;
  3369. var cachedResult = cache[cacheKey];
  3370. if (cachedResult) {
  3371. pos = cachedResult.nextPos;
  3372. return cachedResult.result;
  3373. }
  3374. var savedPos0 = pos;
  3375. var savedPos1 = pos;
  3376. if (input.substr(pos, 1) === "<") {
  3377. var result3 = "<";
  3378. pos += 1;
  3379. } else {
  3380. var result3 = null;
  3381. if (reportMatchFailures) {
  3382. matchFailed("\"<\"");
  3383. }
  3384. }
  3385. if (result3 !== null) {
  3386. var result4 = [];
  3387. var savedPos2 = pos;
  3388. if (input.substr(pos, 2) === ">>") {
  3389. var result9 = ">>";
  3390. pos += 2;
  3391. } else {
  3392. var result9 = null;
  3393. if (reportMatchFailures) {
  3394. matchFailed("\">>\"");
  3395. }
  3396. }
  3397. var result10 = result9 !== null
  3398. ? (function() {return ">"})()
  3399. : null;
  3400. if (result10 !== null) {
  3401. var result8 = result10;
  3402. } else {
  3403. var result8 = null;
  3404. pos = savedPos2;
  3405. }
  3406. if (result8 !== null) {
  3407. var result6 = result8;
  3408. } else {
  3409. if (input.substr(pos).match(/^[^>]/) !== null) {
  3410. var result7 = input.charAt(pos);
  3411. pos++;
  3412. } else {
  3413. var result7 = null;
  3414. if (reportMatchFailures) {
  3415. matchFailed("[^>]");
  3416. }
  3417. }
  3418. if (result7 !== null) {
  3419. var result6 = result7;
  3420. } else {
  3421. var result6 = null;;
  3422. };
  3423. }
  3424. while (result6 !== null) {
  3425. result4.push(result6);
  3426. var savedPos2 = pos;
  3427. if (input.substr(pos, 2) === ">>") {
  3428. var result9 = ">>";
  3429. pos += 2;
  3430. } else {
  3431. var result9 = null;
  3432. if (reportMatchFailures) {
  3433. matchFailed("\">>\"");
  3434. }
  3435. }
  3436. var result10 = result9 !== null
  3437. ? (function() {return ">"})()
  3438. : null;
  3439. if (result10 !== null) {
  3440. var result8 = result10;
  3441. } else {
  3442. var result8 = null;
  3443. pos = savedPos2;
  3444. }
  3445. if (result8 !== null) {
  3446. var result6 = result8;
  3447. } else {
  3448. if (input.substr(pos).match(/^[^>]/) !== null) {
  3449. var result7 = input.charAt(pos);
  3450. pos++;
  3451. } else {
  3452. var result7 = null;
  3453. if (reportMatchFailures) {
  3454. matchFailed("[^>]");
  3455. }
  3456. }
  3457. if (result7 !== null) {
  3458. var result6 = result7;
  3459. } else {
  3460. var result6 = null;;
  3461. };
  3462. }
  3463. }
  3464. if (result4 !== null) {
  3465. if (input.substr(pos, 1) === ">") {
  3466. var result5 = ">";
  3467. pos += 1;
  3468. } else {
  3469. var result5 = null;
  3470. if (reportMatchFailures) {
  3471. matchFailed("\">\"");
  3472. }
  3473. }
  3474. if (result5 !== null) {
  3475. var result1 = [result3, result4, result5];
  3476. } else {
  3477. var result1 = null;
  3478. pos = savedPos1;
  3479. }
  3480. } else {
  3481. var result1 = null;
  3482. pos = savedPos1;
  3483. }
  3484. } else {
  3485. var result1 = null;
  3486. pos = savedPos1;
  3487. }
  3488. var result2 = result1 !== null
  3489. ? (function(val) {
  3490. return smalltalk.JSStatementNode._new()
  3491. ._source_(val.join(""))
  3492. })(result1[1])
  3493. : null;
  3494. if (result2 !== null) {
  3495. var result0 = result2;
  3496. } else {
  3497. var result0 = null;
  3498. pos = savedPos0;
  3499. }
  3500. cache[cacheKey] = {
  3501. nextPos: pos,
  3502. result: result0
  3503. };
  3504. return result0;
  3505. }
  3506. function parse_method() {
  3507. var cacheKey = 'method@' + pos;
  3508. var cachedResult = cache[cacheKey];
  3509. if (cachedResult) {
  3510. pos = cachedResult.nextPos;
  3511. return cachedResult.result;
  3512. }
  3513. var savedPos0 = pos;
  3514. var savedPos1 = pos;
  3515. var result3 = parse_ws();
  3516. if (result3 !== null) {
  3517. var result11 = parse_keywordPattern();
  3518. if (result11 !== null) {
  3519. var result4 = result11;
  3520. } else {
  3521. var result10 = parse_binaryPattern();
  3522. if (result10 !== null) {
  3523. var result4 = result10;
  3524. } else {
  3525. var result9 = parse_unaryPattern();
  3526. if (result9 !== null) {
  3527. var result4 = result9;
  3528. } else {
  3529. var result4 = null;;
  3530. };
  3531. };
  3532. }
  3533. if (result4 !== null) {
  3534. var result5 = parse_ws();
  3535. if (result5 !== null) {
  3536. var result8 = parse_sequence();
  3537. var result6 = result8 !== null ? result8 : '';
  3538. if (result6 !== null) {
  3539. var result7 = parse_ws();
  3540. if (result7 !== null) {
  3541. var result1 = [result3, result4, result5, result6, result7];
  3542. } else {
  3543. var result1 = null;
  3544. pos = savedPos1;
  3545. }
  3546. } else {
  3547. var result1 = null;
  3548. pos = savedPos1;
  3549. }
  3550. } else {
  3551. var result1 = null;
  3552. pos = savedPos1;
  3553. }
  3554. } else {
  3555. var result1 = null;
  3556. pos = savedPos1;
  3557. }
  3558. } else {
  3559. var result1 = null;
  3560. pos = savedPos1;
  3561. }
  3562. var result2 = result1 !== null
  3563. ? (function(pattern, sequence) {
  3564. return smalltalk.MethodNode._new()
  3565. ._selector_(pattern[0])
  3566. ._arguments_(pattern[1])
  3567. ._nodes_([sequence])
  3568. })(result1[1], result1[3])
  3569. : null;
  3570. if (result2 !== null) {
  3571. var result0 = result2;
  3572. } else {
  3573. var result0 = null;
  3574. pos = savedPos0;
  3575. }
  3576. cache[cacheKey] = {
  3577. nextPos: pos,
  3578. result: result0
  3579. };
  3580. return result0;
  3581. }
  3582. function buildErrorMessage() {
  3583. function buildExpected(failuresExpected) {
  3584. failuresExpected.sort();
  3585. var lastFailure = null;
  3586. var failuresExpectedUnique = [];
  3587. for (var i = 0; i < failuresExpected.length; i++) {
  3588. if (failuresExpected[i] !== lastFailure) {
  3589. failuresExpectedUnique.push(failuresExpected[i]);
  3590. lastFailure = failuresExpected[i];
  3591. }
  3592. }
  3593. switch (failuresExpectedUnique.length) {
  3594. case 0:
  3595. return 'end of input';
  3596. case 1:
  3597. return failuresExpectedUnique[0];
  3598. default:
  3599. return failuresExpectedUnique.slice(0, failuresExpectedUnique.length - 1).join(', ')
  3600. + ' or '
  3601. + failuresExpectedUnique[failuresExpectedUnique.length - 1];
  3602. }
  3603. }
  3604. var expected = buildExpected(rightmostMatchFailuresExpected);
  3605. var actualPos = Math.max(pos, rightmostMatchFailuresPos);
  3606. var actual = actualPos < input.length
  3607. ? quote(input.charAt(actualPos))
  3608. : 'end of input';
  3609. return 'Expected ' + expected + ' but ' + actual + ' found.';
  3610. }
  3611. function computeErrorPosition() {
  3612. /*
  3613. * The first idea was to use |String.split| to break the input up to the
  3614. * error position along newlines and derive the line and column from
  3615. * there. However IE's |split| implementation is so broken that it was
  3616. * enough to prevent it.
  3617. */
  3618. var line = 1;
  3619. var column = 1;
  3620. var seenCR = false;
  3621. for (var i = 0; i < rightmostMatchFailuresPos; i++) {
  3622. var ch = input.charAt(i);
  3623. if (ch === '\n') {
  3624. if (!seenCR) { line++; }
  3625. column = 1;
  3626. seenCR = false;
  3627. } else if (ch === '\r' | ch === '\u2028' || ch === '\u2029') {
  3628. line++;
  3629. column = 1;
  3630. seenCR = true;
  3631. } else {
  3632. column++;
  3633. seenCR = false;
  3634. }
  3635. }
  3636. return { line: line, column: column };
  3637. }
  3638. var result = parseFunctions[startRule]();
  3639. /*
  3640. * The parser is now in one of the following three states:
  3641. *
  3642. * 1. The parser successfully parsed the whole input.
  3643. *
  3644. * - |result !== null|
  3645. * - |pos === input.length|
  3646. * - |rightmostMatchFailuresExpected| may or may not contain something
  3647. *
  3648. * 2. The parser successfully parsed only a part of the input.
  3649. *
  3650. * - |result !== null|
  3651. * - |pos < input.length|
  3652. * - |rightmostMatchFailuresExpected| may or may not contain something
  3653. *
  3654. * 3. The parser did not successfully parse any part of the input.
  3655. *
  3656. * - |result === null|
  3657. * - |pos === 0|
  3658. * - |rightmostMatchFailuresExpected| contains at least one failure
  3659. *
  3660. * All code following this comment (including called functions) must
  3661. * handle these states.
  3662. */
  3663. if (result === null || pos !== input.length) {
  3664. var errorPosition = computeErrorPosition();
  3665. throw new this.SyntaxError(
  3666. buildErrorMessage(),
  3667. errorPosition.line,
  3668. errorPosition.column
  3669. );
  3670. }
  3671. return result;
  3672. },
  3673. /* Returns the parser source code. */
  3674. toSource: function() { return this._source; }
  3675. };
  3676. /* Thrown when a parser encounters a syntax error. */
  3677. result.SyntaxError = function(message, line, column) {
  3678. this.name = 'SyntaxError';
  3679. this.message = message;
  3680. this.line = line;
  3681. this.column = column;
  3682. };
  3683. result.SyntaxError.prototype = Error.prototype;
  3684. return result;
  3685. })();