parser.js 122 KB

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