2
0

parser.js 127 KB

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