1
0

parser.js 126 KB

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