parser.js 127 KB

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