parser.js 121 KB

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