1
0

parser.js 121 KB

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