2
0

parser.js 114 KB

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