2
0

parser.js~ 106 KB

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