2
0

parser.js 111 KB

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