1
0

parser.js 125 KB

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