parser.c 1.4 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930
  1. // @generated by pegen from python.gram
  2. #include "pegen.h"
  3. #if defined(Py_DEBUG) && defined(Py_BUILD_CORE)
  4. # define D(x) if (p->debug) { x; }
  5. #else
  6. # define D(x)
  7. #endif
  8. #ifdef __wasi__
  9. # define MAXSTACK 4000
  10. #else
  11. # define MAXSTACK 6000
  12. #endif
  13. static const int n_keyword_lists = 9;
  14. static KeywordToken *reserved_keywords[] = {
  15. (KeywordToken[]) {{NULL, -1}},
  16. (KeywordToken[]) {{NULL, -1}},
  17. (KeywordToken[]) {
  18. {"if", 642},
  19. {"as", 640},
  20. {"in", 651},
  21. {"or", 574},
  22. {"is", 582},
  23. {NULL, -1},
  24. },
  25. (KeywordToken[]) {
  26. {"del", 604},
  27. {"def", 652},
  28. {"for", 650},
  29. {"try", 624},
  30. {"and", 575},
  31. {"not", 581},
  32. {NULL, -1},
  33. },
  34. (KeywordToken[]) {
  35. {"from", 608},
  36. {"pass", 504},
  37. {"with", 615},
  38. {"elif", 644},
  39. {"else", 645},
  40. {"None", 602},
  41. {"True", 601},
  42. {NULL, -1},
  43. },
  44. (KeywordToken[]) {
  45. {"raise", 522},
  46. {"yield", 573},
  47. {"break", 508},
  48. {"class", 654},
  49. {"while", 647},
  50. {"False", 603},
  51. {NULL, -1},
  52. },
  53. (KeywordToken[]) {
  54. {"return", 519},
  55. {"import", 607},
  56. {"assert", 526},
  57. {"global", 523},
  58. {"except", 637},
  59. {"lambda", 600},
  60. {NULL, -1},
  61. },
  62. (KeywordToken[]) {
  63. {"finally", 633},
  64. {NULL, -1},
  65. },
  66. (KeywordToken[]) {
  67. {"continue", 509},
  68. {"nonlocal", 524},
  69. {NULL, -1},
  70. },
  71. };
  72. static char *soft_keywords[] = {
  73. "_",
  74. "case",
  75. "match",
  76. "type",
  77. NULL,
  78. };
  79. #define file_type 1000
  80. #define interactive_type 1001
  81. #define eval_type 1002
  82. #define func_type_type 1003
  83. #define statements_type 1004
  84. #define statement_type 1005
  85. #define statement_newline_type 1006
  86. #define simple_stmts_type 1007
  87. #define simple_stmt_type 1008
  88. #define compound_stmt_type 1009
  89. #define assignment_type 1010
  90. #define annotated_rhs_type 1011
  91. #define augassign_type 1012
  92. #define return_stmt_type 1013
  93. #define raise_stmt_type 1014
  94. #define global_stmt_type 1015
  95. #define nonlocal_stmt_type 1016
  96. #define del_stmt_type 1017
  97. #define yield_stmt_type 1018
  98. #define assert_stmt_type 1019
  99. #define import_stmt_type 1020
  100. #define import_name_type 1021
  101. #define import_from_type 1022
  102. #define import_from_targets_type 1023
  103. #define import_from_as_names_type 1024
  104. #define import_from_as_name_type 1025
  105. #define dotted_as_names_type 1026
  106. #define dotted_as_name_type 1027
  107. #define dotted_name_type 1028 // Left-recursive
  108. #define block_type 1029
  109. #define decorators_type 1030
  110. #define class_def_type 1031
  111. #define class_def_raw_type 1032
  112. #define function_def_type 1033
  113. #define function_def_raw_type 1034
  114. #define params_type 1035
  115. #define parameters_type 1036
  116. #define slash_no_default_type 1037
  117. #define slash_with_default_type 1038
  118. #define star_etc_type 1039
  119. #define kwds_type 1040
  120. #define param_no_default_type 1041
  121. #define param_no_default_star_annotation_type 1042
  122. #define param_with_default_type 1043
  123. #define param_maybe_default_type 1044
  124. #define param_type 1045
  125. #define param_star_annotation_type 1046
  126. #define annotation_type 1047
  127. #define star_annotation_type 1048
  128. #define default_type 1049
  129. #define if_stmt_type 1050
  130. #define elif_stmt_type 1051
  131. #define else_block_type 1052
  132. #define while_stmt_type 1053
  133. #define for_stmt_type 1054
  134. #define with_stmt_type 1055
  135. #define with_item_type 1056
  136. #define try_stmt_type 1057
  137. #define except_block_type 1058
  138. #define except_star_block_type 1059
  139. #define finally_block_type 1060
  140. #define match_stmt_type 1061
  141. #define subject_expr_type 1062
  142. #define case_block_type 1063
  143. #define guard_type 1064
  144. #define patterns_type 1065
  145. #define pattern_type 1066
  146. #define as_pattern_type 1067
  147. #define or_pattern_type 1068
  148. #define closed_pattern_type 1069
  149. #define literal_pattern_type 1070
  150. #define literal_expr_type 1071
  151. #define complex_number_type 1072
  152. #define signed_number_type 1073
  153. #define signed_real_number_type 1074
  154. #define real_number_type 1075
  155. #define imaginary_number_type 1076
  156. #define capture_pattern_type 1077
  157. #define pattern_capture_target_type 1078
  158. #define wildcard_pattern_type 1079
  159. #define value_pattern_type 1080
  160. #define attr_type 1081 // Left-recursive
  161. #define name_or_attr_type 1082 // Left-recursive
  162. #define group_pattern_type 1083
  163. #define sequence_pattern_type 1084
  164. #define open_sequence_pattern_type 1085
  165. #define maybe_sequence_pattern_type 1086
  166. #define maybe_star_pattern_type 1087
  167. #define star_pattern_type 1088
  168. #define mapping_pattern_type 1089
  169. #define items_pattern_type 1090
  170. #define key_value_pattern_type 1091
  171. #define double_star_pattern_type 1092
  172. #define class_pattern_type 1093
  173. #define positional_patterns_type 1094
  174. #define keyword_patterns_type 1095
  175. #define keyword_pattern_type 1096
  176. #define type_alias_type 1097
  177. #define type_params_type 1098
  178. #define type_param_seq_type 1099
  179. #define type_param_type 1100
  180. #define type_param_bound_type 1101
  181. #define expressions_type 1102
  182. #define expression_type 1103
  183. #define yield_expr_type 1104
  184. #define star_expressions_type 1105
  185. #define star_expression_type 1106
  186. #define star_named_expressions_type 1107
  187. #define star_named_expression_type 1108
  188. #define assignment_expression_type 1109
  189. #define named_expression_type 1110
  190. #define disjunction_type 1111
  191. #define conjunction_type 1112
  192. #define inversion_type 1113
  193. #define comparison_type 1114
  194. #define compare_op_bitwise_or_pair_type 1115
  195. #define eq_bitwise_or_type 1116
  196. #define noteq_bitwise_or_type 1117
  197. #define lte_bitwise_or_type 1118
  198. #define lt_bitwise_or_type 1119
  199. #define gte_bitwise_or_type 1120
  200. #define gt_bitwise_or_type 1121
  201. #define notin_bitwise_or_type 1122
  202. #define in_bitwise_or_type 1123
  203. #define isnot_bitwise_or_type 1124
  204. #define is_bitwise_or_type 1125
  205. #define bitwise_or_type 1126 // Left-recursive
  206. #define bitwise_xor_type 1127 // Left-recursive
  207. #define bitwise_and_type 1128 // Left-recursive
  208. #define shift_expr_type 1129 // Left-recursive
  209. #define sum_type 1130 // Left-recursive
  210. #define term_type 1131 // Left-recursive
  211. #define factor_type 1132
  212. #define power_type 1133
  213. #define await_primary_type 1134
  214. #define primary_type 1135 // Left-recursive
  215. #define slices_type 1136
  216. #define slice_type 1137
  217. #define atom_type 1138
  218. #define group_type 1139
  219. #define lambdef_type 1140
  220. #define lambda_params_type 1141
  221. #define lambda_parameters_type 1142
  222. #define lambda_slash_no_default_type 1143
  223. #define lambda_slash_with_default_type 1144
  224. #define lambda_star_etc_type 1145
  225. #define lambda_kwds_type 1146
  226. #define lambda_param_no_default_type 1147
  227. #define lambda_param_with_default_type 1148
  228. #define lambda_param_maybe_default_type 1149
  229. #define lambda_param_type 1150
  230. #define fstring_middle_type 1151
  231. #define fstring_replacement_field_type 1152
  232. #define fstring_conversion_type 1153
  233. #define fstring_full_format_spec_type 1154
  234. #define fstring_format_spec_type 1155
  235. #define fstring_type 1156
  236. #define string_type 1157
  237. #define strings_type 1158
  238. #define list_type 1159
  239. #define tuple_type 1160
  240. #define set_type 1161
  241. #define dict_type 1162
  242. #define double_starred_kvpairs_type 1163
  243. #define double_starred_kvpair_type 1164
  244. #define kvpair_type 1165
  245. #define for_if_clauses_type 1166
  246. #define for_if_clause_type 1167
  247. #define listcomp_type 1168
  248. #define setcomp_type 1169
  249. #define genexp_type 1170
  250. #define dictcomp_type 1171
  251. #define arguments_type 1172
  252. #define args_type 1173
  253. #define kwargs_type 1174
  254. #define starred_expression_type 1175
  255. #define kwarg_or_starred_type 1176
  256. #define kwarg_or_double_starred_type 1177
  257. #define star_targets_type 1178
  258. #define star_targets_list_seq_type 1179
  259. #define star_targets_tuple_seq_type 1180
  260. #define star_target_type 1181
  261. #define target_with_star_atom_type 1182
  262. #define star_atom_type 1183
  263. #define single_target_type 1184
  264. #define single_subscript_attribute_target_type 1185
  265. #define t_primary_type 1186 // Left-recursive
  266. #define t_lookahead_type 1187
  267. #define del_targets_type 1188
  268. #define del_target_type 1189
  269. #define del_t_atom_type 1190
  270. #define type_expressions_type 1191
  271. #define func_type_comment_type 1192
  272. #define invalid_arguments_type 1193
  273. #define invalid_kwarg_type 1194
  274. #define expression_without_invalid_type 1195
  275. #define invalid_legacy_expression_type 1196
  276. #define invalid_expression_type 1197
  277. #define invalid_named_expression_type 1198
  278. #define invalid_assignment_type 1199
  279. #define invalid_ann_assign_target_type 1200
  280. #define invalid_del_stmt_type 1201
  281. #define invalid_block_type 1202
  282. #define invalid_comprehension_type 1203
  283. #define invalid_dict_comprehension_type 1204
  284. #define invalid_parameters_type 1205
  285. #define invalid_default_type 1206
  286. #define invalid_star_etc_type 1207
  287. #define invalid_kwds_type 1208
  288. #define invalid_parameters_helper_type 1209
  289. #define invalid_lambda_parameters_type 1210
  290. #define invalid_lambda_parameters_helper_type 1211
  291. #define invalid_lambda_star_etc_type 1212
  292. #define invalid_lambda_kwds_type 1213
  293. #define invalid_double_type_comments_type 1214
  294. #define invalid_with_item_type 1215
  295. #define invalid_for_target_type 1216
  296. #define invalid_group_type 1217
  297. #define invalid_import_type 1218
  298. #define invalid_import_from_targets_type 1219
  299. #define invalid_with_stmt_type 1220
  300. #define invalid_with_stmt_indent_type 1221
  301. #define invalid_try_stmt_type 1222
  302. #define invalid_except_stmt_type 1223
  303. #define invalid_finally_stmt_type 1224
  304. #define invalid_except_stmt_indent_type 1225
  305. #define invalid_except_star_stmt_indent_type 1226
  306. #define invalid_match_stmt_type 1227
  307. #define invalid_case_block_type 1228
  308. #define invalid_as_pattern_type 1229
  309. #define invalid_class_pattern_type 1230
  310. #define invalid_class_argument_pattern_type 1231
  311. #define invalid_if_stmt_type 1232
  312. #define invalid_elif_stmt_type 1233
  313. #define invalid_else_stmt_type 1234
  314. #define invalid_while_stmt_type 1235
  315. #define invalid_for_stmt_type 1236
  316. #define invalid_def_raw_type 1237
  317. #define invalid_class_def_raw_type 1238
  318. #define invalid_double_starred_kvpairs_type 1239
  319. #define invalid_kvpair_type 1240
  320. #define invalid_starred_expression_type 1241
  321. #define invalid_replacement_field_type 1242
  322. #define invalid_conversion_character_type 1243
  323. #define _loop0_1_type 1244
  324. #define _loop0_2_type 1245
  325. #define _loop1_3_type 1246
  326. #define _loop0_5_type 1247
  327. #define _gather_4_type 1248
  328. #define _tmp_6_type 1249
  329. #define _tmp_7_type 1250
  330. #define _tmp_8_type 1251
  331. #define _tmp_9_type 1252
  332. #define _tmp_10_type 1253
  333. #define _tmp_11_type 1254
  334. #define _tmp_12_type 1255
  335. #define _tmp_13_type 1256
  336. #define _loop1_14_type 1257
  337. #define _tmp_15_type 1258
  338. #define _tmp_16_type 1259
  339. #define _tmp_17_type 1260
  340. #define _loop0_19_type 1261
  341. #define _gather_18_type 1262
  342. #define _loop0_21_type 1263
  343. #define _gather_20_type 1264
  344. #define _tmp_22_type 1265
  345. #define _tmp_23_type 1266
  346. #define _loop0_24_type 1267
  347. #define _loop1_25_type 1268
  348. #define _loop0_27_type 1269
  349. #define _gather_26_type 1270
  350. #define _tmp_28_type 1271
  351. #define _loop0_30_type 1272
  352. #define _gather_29_type 1273
  353. #define _tmp_31_type 1274
  354. #define _loop1_32_type 1275
  355. #define _tmp_33_type 1276
  356. #define _tmp_34_type 1277
  357. #define _tmp_35_type 1278
  358. #define _loop0_36_type 1279
  359. #define _loop0_37_type 1280
  360. #define _loop0_38_type 1281
  361. #define _loop1_39_type 1282
  362. #define _loop0_40_type 1283
  363. #define _loop1_41_type 1284
  364. #define _loop1_42_type 1285
  365. #define _loop1_43_type 1286
  366. #define _loop0_44_type 1287
  367. #define _loop1_45_type 1288
  368. #define _loop0_46_type 1289
  369. #define _loop1_47_type 1290
  370. #define _loop0_48_type 1291
  371. #define _loop0_49_type 1292
  372. #define _loop1_50_type 1293
  373. #define _loop0_52_type 1294
  374. #define _gather_51_type 1295
  375. #define _loop0_54_type 1296
  376. #define _gather_53_type 1297
  377. #define _loop0_56_type 1298
  378. #define _gather_55_type 1299
  379. #define _loop0_58_type 1300
  380. #define _gather_57_type 1301
  381. #define _tmp_59_type 1302
  382. #define _loop1_60_type 1303
  383. #define _loop1_61_type 1304
  384. #define _tmp_62_type 1305
  385. #define _tmp_63_type 1306
  386. #define _loop1_64_type 1307
  387. #define _loop0_66_type 1308
  388. #define _gather_65_type 1309
  389. #define _tmp_67_type 1310
  390. #define _tmp_68_type 1311
  391. #define _tmp_69_type 1312
  392. #define _tmp_70_type 1313
  393. #define _loop0_72_type 1314
  394. #define _gather_71_type 1315
  395. #define _loop0_74_type 1316
  396. #define _gather_73_type 1317
  397. #define _tmp_75_type 1318
  398. #define _loop0_77_type 1319
  399. #define _gather_76_type 1320
  400. #define _loop0_79_type 1321
  401. #define _gather_78_type 1322
  402. #define _loop0_81_type 1323
  403. #define _gather_80_type 1324
  404. #define _loop1_82_type 1325
  405. #define _loop1_83_type 1326
  406. #define _loop0_85_type 1327
  407. #define _gather_84_type 1328
  408. #define _loop1_86_type 1329
  409. #define _loop1_87_type 1330
  410. #define _loop1_88_type 1331
  411. #define _tmp_89_type 1332
  412. #define _loop0_91_type 1333
  413. #define _gather_90_type 1334
  414. #define _tmp_92_type 1335
  415. #define _tmp_93_type 1336
  416. #define _tmp_94_type 1337
  417. #define _tmp_95_type 1338
  418. #define _tmp_96_type 1339
  419. #define _tmp_97_type 1340
  420. #define _loop0_98_type 1341
  421. #define _loop0_99_type 1342
  422. #define _loop0_100_type 1343
  423. #define _loop1_101_type 1344
  424. #define _loop0_102_type 1345
  425. #define _loop1_103_type 1346
  426. #define _loop1_104_type 1347
  427. #define _loop1_105_type 1348
  428. #define _loop0_106_type 1349
  429. #define _loop1_107_type 1350
  430. #define _loop0_108_type 1351
  431. #define _loop1_109_type 1352
  432. #define _loop0_110_type 1353
  433. #define _loop1_111_type 1354
  434. #define _tmp_112_type 1355
  435. #define _loop0_113_type 1356
  436. #define _loop0_114_type 1357
  437. #define _loop1_115_type 1358
  438. #define _tmp_116_type 1359
  439. #define _loop0_118_type 1360
  440. #define _gather_117_type 1361
  441. #define _loop1_119_type 1362
  442. #define _loop0_120_type 1363
  443. #define _loop0_121_type 1364
  444. #define _tmp_122_type 1365
  445. #define _loop0_124_type 1366
  446. #define _gather_123_type 1367
  447. #define _tmp_125_type 1368
  448. #define _loop0_127_type 1369
  449. #define _gather_126_type 1370
  450. #define _loop0_129_type 1371
  451. #define _gather_128_type 1372
  452. #define _loop0_131_type 1373
  453. #define _gather_130_type 1374
  454. #define _loop0_133_type 1375
  455. #define _gather_132_type 1376
  456. #define _loop0_134_type 1377
  457. #define _loop0_136_type 1378
  458. #define _gather_135_type 1379
  459. #define _loop1_137_type 1380
  460. #define _tmp_138_type 1381
  461. #define _loop0_140_type 1382
  462. #define _gather_139_type 1383
  463. #define _loop0_142_type 1384
  464. #define _gather_141_type 1385
  465. #define _loop0_144_type 1386
  466. #define _gather_143_type 1387
  467. #define _loop0_146_type 1388
  468. #define _gather_145_type 1389
  469. #define _loop0_148_type 1390
  470. #define _gather_147_type 1391
  471. #define _tmp_149_type 1392
  472. #define _tmp_150_type 1393
  473. #define _loop0_152_type 1394
  474. #define _gather_151_type 1395
  475. #define _tmp_153_type 1396
  476. #define _tmp_154_type 1397
  477. #define _tmp_155_type 1398
  478. #define _tmp_156_type 1399
  479. #define _tmp_157_type 1400
  480. #define _tmp_158_type 1401
  481. #define _tmp_159_type 1402
  482. #define _tmp_160_type 1403
  483. #define _tmp_161_type 1404
  484. #define _tmp_162_type 1405
  485. #define _loop0_163_type 1406
  486. #define _loop0_164_type 1407
  487. #define _loop0_165_type 1408
  488. #define _tmp_166_type 1409
  489. #define _tmp_167_type 1410
  490. #define _tmp_168_type 1411
  491. #define _tmp_169_type 1412
  492. #define _tmp_170_type 1413
  493. #define _loop0_171_type 1414
  494. #define _loop0_172_type 1415
  495. #define _loop0_173_type 1416
  496. #define _loop1_174_type 1417
  497. #define _tmp_175_type 1418
  498. #define _loop0_176_type 1419
  499. #define _tmp_177_type 1420
  500. #define _loop0_178_type 1421
  501. #define _loop1_179_type 1422
  502. #define _tmp_180_type 1423
  503. #define _tmp_181_type 1424
  504. #define _tmp_182_type 1425
  505. #define _loop0_183_type 1426
  506. #define _tmp_184_type 1427
  507. #define _tmp_185_type 1428
  508. #define _loop1_186_type 1429
  509. #define _tmp_187_type 1430
  510. #define _loop0_188_type 1431
  511. #define _loop0_189_type 1432
  512. #define _loop0_190_type 1433
  513. #define _loop0_192_type 1434
  514. #define _gather_191_type 1435
  515. #define _tmp_193_type 1436
  516. #define _loop0_194_type 1437
  517. #define _tmp_195_type 1438
  518. #define _loop0_196_type 1439
  519. #define _loop1_197_type 1440
  520. #define _loop1_198_type 1441
  521. #define _tmp_199_type 1442
  522. #define _tmp_200_type 1443
  523. #define _loop0_201_type 1444
  524. #define _tmp_202_type 1445
  525. #define _tmp_203_type 1446
  526. #define _tmp_204_type 1447
  527. #define _loop0_206_type 1448
  528. #define _gather_205_type 1449
  529. #define _loop0_208_type 1450
  530. #define _gather_207_type 1451
  531. #define _loop0_210_type 1452
  532. #define _gather_209_type 1453
  533. #define _loop0_212_type 1454
  534. #define _gather_211_type 1455
  535. #define _loop0_214_type 1456
  536. #define _gather_213_type 1457
  537. #define _tmp_215_type 1458
  538. #define _loop0_216_type 1459
  539. #define _loop1_217_type 1460
  540. #define _tmp_218_type 1461
  541. #define _loop0_219_type 1462
  542. #define _loop1_220_type 1463
  543. #define _tmp_221_type 1464
  544. #define _tmp_222_type 1465
  545. #define _tmp_223_type 1466
  546. #define _tmp_224_type 1467
  547. #define _tmp_225_type 1468
  548. #define _tmp_226_type 1469
  549. #define _tmp_227_type 1470
  550. #define _tmp_228_type 1471
  551. #define _tmp_229_type 1472
  552. #define _tmp_230_type 1473
  553. #define _loop0_232_type 1474
  554. #define _gather_231_type 1475
  555. #define _tmp_233_type 1476
  556. #define _tmp_234_type 1477
  557. #define _tmp_235_type 1478
  558. #define _tmp_236_type 1479
  559. #define _tmp_237_type 1480
  560. #define _tmp_238_type 1481
  561. #define _tmp_239_type 1482
  562. #define _tmp_240_type 1483
  563. #define _tmp_241_type 1484
  564. #define _tmp_242_type 1485
  565. #define _tmp_243_type 1486
  566. #define _tmp_244_type 1487
  567. #define _tmp_245_type 1488
  568. #define _loop0_246_type 1489
  569. #define _tmp_247_type 1490
  570. #define _tmp_248_type 1491
  571. #define _tmp_249_type 1492
  572. #define _tmp_250_type 1493
  573. #define _tmp_251_type 1494
  574. #define _tmp_252_type 1495
  575. #define _tmp_253_type 1496
  576. #define _tmp_254_type 1497
  577. #define _tmp_255_type 1498
  578. #define _tmp_256_type 1499
  579. #define _tmp_257_type 1500
  580. #define _tmp_258_type 1501
  581. #define _tmp_259_type 1502
  582. #define _tmp_260_type 1503
  583. #define _tmp_261_type 1504
  584. #define _tmp_262_type 1505
  585. #define _tmp_263_type 1506
  586. #define _tmp_264_type 1507
  587. #define _tmp_265_type 1508
  588. #define _tmp_266_type 1509
  589. #define _tmp_267_type 1510
  590. #define _tmp_268_type 1511
  591. #define _tmp_269_type 1512
  592. #define _tmp_270_type 1513
  593. #define _tmp_271_type 1514
  594. #define _tmp_272_type 1515
  595. #define _tmp_273_type 1516
  596. #define _tmp_274_type 1517
  597. #define _tmp_275_type 1518
  598. #define _tmp_276_type 1519
  599. #define _loop0_278_type 1520
  600. #define _gather_277_type 1521
  601. #define _tmp_279_type 1522
  602. #define _tmp_280_type 1523
  603. #define _tmp_281_type 1524
  604. #define _tmp_282_type 1525
  605. #define _tmp_283_type 1526
  606. #define _tmp_284_type 1527
  607. static mod_ty file_rule(Parser *p);
  608. static mod_ty interactive_rule(Parser *p);
  609. static mod_ty eval_rule(Parser *p);
  610. static mod_ty func_type_rule(Parser *p);
  611. static asdl_stmt_seq* statements_rule(Parser *p);
  612. static asdl_stmt_seq* statement_rule(Parser *p);
  613. static asdl_stmt_seq* statement_newline_rule(Parser *p);
  614. static asdl_stmt_seq* simple_stmts_rule(Parser *p);
  615. static stmt_ty simple_stmt_rule(Parser *p);
  616. static stmt_ty compound_stmt_rule(Parser *p);
  617. static stmt_ty assignment_rule(Parser *p);
  618. static expr_ty annotated_rhs_rule(Parser *p);
  619. static AugOperator* augassign_rule(Parser *p);
  620. static stmt_ty return_stmt_rule(Parser *p);
  621. static stmt_ty raise_stmt_rule(Parser *p);
  622. static stmt_ty global_stmt_rule(Parser *p);
  623. static stmt_ty nonlocal_stmt_rule(Parser *p);
  624. static stmt_ty del_stmt_rule(Parser *p);
  625. static stmt_ty yield_stmt_rule(Parser *p);
  626. static stmt_ty assert_stmt_rule(Parser *p);
  627. static stmt_ty import_stmt_rule(Parser *p);
  628. static stmt_ty import_name_rule(Parser *p);
  629. static stmt_ty import_from_rule(Parser *p);
  630. static asdl_alias_seq* import_from_targets_rule(Parser *p);
  631. static asdl_alias_seq* import_from_as_names_rule(Parser *p);
  632. static alias_ty import_from_as_name_rule(Parser *p);
  633. static asdl_alias_seq* dotted_as_names_rule(Parser *p);
  634. static alias_ty dotted_as_name_rule(Parser *p);
  635. static expr_ty dotted_name_rule(Parser *p);
  636. static asdl_stmt_seq* block_rule(Parser *p);
  637. static asdl_expr_seq* decorators_rule(Parser *p);
  638. static stmt_ty class_def_rule(Parser *p);
  639. static stmt_ty class_def_raw_rule(Parser *p);
  640. static stmt_ty function_def_rule(Parser *p);
  641. static stmt_ty function_def_raw_rule(Parser *p);
  642. static arguments_ty params_rule(Parser *p);
  643. static arguments_ty parameters_rule(Parser *p);
  644. static asdl_arg_seq* slash_no_default_rule(Parser *p);
  645. static SlashWithDefault* slash_with_default_rule(Parser *p);
  646. static StarEtc* star_etc_rule(Parser *p);
  647. static arg_ty kwds_rule(Parser *p);
  648. static arg_ty param_no_default_rule(Parser *p);
  649. static arg_ty param_no_default_star_annotation_rule(Parser *p);
  650. static NameDefaultPair* param_with_default_rule(Parser *p);
  651. static NameDefaultPair* param_maybe_default_rule(Parser *p);
  652. static arg_ty param_rule(Parser *p);
  653. static arg_ty param_star_annotation_rule(Parser *p);
  654. static expr_ty annotation_rule(Parser *p);
  655. static expr_ty star_annotation_rule(Parser *p);
  656. static expr_ty default_rule(Parser *p);
  657. static stmt_ty if_stmt_rule(Parser *p);
  658. static stmt_ty elif_stmt_rule(Parser *p);
  659. static asdl_stmt_seq* else_block_rule(Parser *p);
  660. static stmt_ty while_stmt_rule(Parser *p);
  661. static stmt_ty for_stmt_rule(Parser *p);
  662. static stmt_ty with_stmt_rule(Parser *p);
  663. static withitem_ty with_item_rule(Parser *p);
  664. static stmt_ty try_stmt_rule(Parser *p);
  665. static excepthandler_ty except_block_rule(Parser *p);
  666. static excepthandler_ty except_star_block_rule(Parser *p);
  667. static asdl_stmt_seq* finally_block_rule(Parser *p);
  668. static stmt_ty match_stmt_rule(Parser *p);
  669. static expr_ty subject_expr_rule(Parser *p);
  670. static match_case_ty case_block_rule(Parser *p);
  671. static expr_ty guard_rule(Parser *p);
  672. static pattern_ty patterns_rule(Parser *p);
  673. static pattern_ty pattern_rule(Parser *p);
  674. static pattern_ty as_pattern_rule(Parser *p);
  675. static pattern_ty or_pattern_rule(Parser *p);
  676. static pattern_ty closed_pattern_rule(Parser *p);
  677. static pattern_ty literal_pattern_rule(Parser *p);
  678. static expr_ty literal_expr_rule(Parser *p);
  679. static expr_ty complex_number_rule(Parser *p);
  680. static expr_ty signed_number_rule(Parser *p);
  681. static expr_ty signed_real_number_rule(Parser *p);
  682. static expr_ty real_number_rule(Parser *p);
  683. static expr_ty imaginary_number_rule(Parser *p);
  684. static pattern_ty capture_pattern_rule(Parser *p);
  685. static expr_ty pattern_capture_target_rule(Parser *p);
  686. static pattern_ty wildcard_pattern_rule(Parser *p);
  687. static pattern_ty value_pattern_rule(Parser *p);
  688. static expr_ty attr_rule(Parser *p);
  689. static expr_ty name_or_attr_rule(Parser *p);
  690. static pattern_ty group_pattern_rule(Parser *p);
  691. static pattern_ty sequence_pattern_rule(Parser *p);
  692. static asdl_seq* open_sequence_pattern_rule(Parser *p);
  693. static asdl_seq* maybe_sequence_pattern_rule(Parser *p);
  694. static pattern_ty maybe_star_pattern_rule(Parser *p);
  695. static pattern_ty star_pattern_rule(Parser *p);
  696. static pattern_ty mapping_pattern_rule(Parser *p);
  697. static asdl_seq* items_pattern_rule(Parser *p);
  698. static KeyPatternPair* key_value_pattern_rule(Parser *p);
  699. static expr_ty double_star_pattern_rule(Parser *p);
  700. static pattern_ty class_pattern_rule(Parser *p);
  701. static asdl_pattern_seq* positional_patterns_rule(Parser *p);
  702. static asdl_seq* keyword_patterns_rule(Parser *p);
  703. static KeyPatternPair* keyword_pattern_rule(Parser *p);
  704. static stmt_ty type_alias_rule(Parser *p);
  705. static asdl_type_param_seq* type_params_rule(Parser *p);
  706. static asdl_type_param_seq* type_param_seq_rule(Parser *p);
  707. static type_param_ty type_param_rule(Parser *p);
  708. static expr_ty type_param_bound_rule(Parser *p);
  709. static expr_ty expressions_rule(Parser *p);
  710. static expr_ty expression_rule(Parser *p);
  711. static expr_ty yield_expr_rule(Parser *p);
  712. static expr_ty star_expressions_rule(Parser *p);
  713. static expr_ty star_expression_rule(Parser *p);
  714. static asdl_expr_seq* star_named_expressions_rule(Parser *p);
  715. static expr_ty star_named_expression_rule(Parser *p);
  716. static expr_ty assignment_expression_rule(Parser *p);
  717. static expr_ty named_expression_rule(Parser *p);
  718. static expr_ty disjunction_rule(Parser *p);
  719. static expr_ty conjunction_rule(Parser *p);
  720. static expr_ty inversion_rule(Parser *p);
  721. static expr_ty comparison_rule(Parser *p);
  722. static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p);
  723. static CmpopExprPair* eq_bitwise_or_rule(Parser *p);
  724. static CmpopExprPair* noteq_bitwise_or_rule(Parser *p);
  725. static CmpopExprPair* lte_bitwise_or_rule(Parser *p);
  726. static CmpopExprPair* lt_bitwise_or_rule(Parser *p);
  727. static CmpopExprPair* gte_bitwise_or_rule(Parser *p);
  728. static CmpopExprPair* gt_bitwise_or_rule(Parser *p);
  729. static CmpopExprPair* notin_bitwise_or_rule(Parser *p);
  730. static CmpopExprPair* in_bitwise_or_rule(Parser *p);
  731. static CmpopExprPair* isnot_bitwise_or_rule(Parser *p);
  732. static CmpopExprPair* is_bitwise_or_rule(Parser *p);
  733. static expr_ty bitwise_or_rule(Parser *p);
  734. static expr_ty bitwise_xor_rule(Parser *p);
  735. static expr_ty bitwise_and_rule(Parser *p);
  736. static expr_ty shift_expr_rule(Parser *p);
  737. static expr_ty sum_rule(Parser *p);
  738. static expr_ty term_rule(Parser *p);
  739. static expr_ty factor_rule(Parser *p);
  740. static expr_ty power_rule(Parser *p);
  741. static expr_ty await_primary_rule(Parser *p);
  742. static expr_ty primary_rule(Parser *p);
  743. static expr_ty slices_rule(Parser *p);
  744. static expr_ty slice_rule(Parser *p);
  745. static expr_ty atom_rule(Parser *p);
  746. static expr_ty group_rule(Parser *p);
  747. static expr_ty lambdef_rule(Parser *p);
  748. static arguments_ty lambda_params_rule(Parser *p);
  749. static arguments_ty lambda_parameters_rule(Parser *p);
  750. static asdl_arg_seq* lambda_slash_no_default_rule(Parser *p);
  751. static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
  752. static StarEtc* lambda_star_etc_rule(Parser *p);
  753. static arg_ty lambda_kwds_rule(Parser *p);
  754. static arg_ty lambda_param_no_default_rule(Parser *p);
  755. static NameDefaultPair* lambda_param_with_default_rule(Parser *p);
  756. static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p);
  757. static arg_ty lambda_param_rule(Parser *p);
  758. static expr_ty fstring_middle_rule(Parser *p);
  759. static expr_ty fstring_replacement_field_rule(Parser *p);
  760. static ResultTokenWithMetadata* fstring_conversion_rule(Parser *p);
  761. static ResultTokenWithMetadata* fstring_full_format_spec_rule(Parser *p);
  762. static expr_ty fstring_format_spec_rule(Parser *p);
  763. static expr_ty fstring_rule(Parser *p);
  764. static expr_ty string_rule(Parser *p);
  765. static expr_ty strings_rule(Parser *p);
  766. static expr_ty list_rule(Parser *p);
  767. static expr_ty tuple_rule(Parser *p);
  768. static expr_ty set_rule(Parser *p);
  769. static expr_ty dict_rule(Parser *p);
  770. static asdl_seq* double_starred_kvpairs_rule(Parser *p);
  771. static KeyValuePair* double_starred_kvpair_rule(Parser *p);
  772. static KeyValuePair* kvpair_rule(Parser *p);
  773. static asdl_comprehension_seq* for_if_clauses_rule(Parser *p);
  774. static comprehension_ty for_if_clause_rule(Parser *p);
  775. static expr_ty listcomp_rule(Parser *p);
  776. static expr_ty setcomp_rule(Parser *p);
  777. static expr_ty genexp_rule(Parser *p);
  778. static expr_ty dictcomp_rule(Parser *p);
  779. static expr_ty arguments_rule(Parser *p);
  780. static expr_ty args_rule(Parser *p);
  781. static asdl_seq* kwargs_rule(Parser *p);
  782. static expr_ty starred_expression_rule(Parser *p);
  783. static KeywordOrStarred* kwarg_or_starred_rule(Parser *p);
  784. static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p);
  785. static expr_ty star_targets_rule(Parser *p);
  786. static asdl_expr_seq* star_targets_list_seq_rule(Parser *p);
  787. static asdl_expr_seq* star_targets_tuple_seq_rule(Parser *p);
  788. static expr_ty star_target_rule(Parser *p);
  789. static expr_ty target_with_star_atom_rule(Parser *p);
  790. static expr_ty star_atom_rule(Parser *p);
  791. static expr_ty single_target_rule(Parser *p);
  792. static expr_ty single_subscript_attribute_target_rule(Parser *p);
  793. static expr_ty t_primary_rule(Parser *p);
  794. static void *t_lookahead_rule(Parser *p);
  795. static asdl_expr_seq* del_targets_rule(Parser *p);
  796. static expr_ty del_target_rule(Parser *p);
  797. static expr_ty del_t_atom_rule(Parser *p);
  798. static asdl_expr_seq* type_expressions_rule(Parser *p);
  799. static Token* func_type_comment_rule(Parser *p);
  800. static void *invalid_arguments_rule(Parser *p);
  801. static void *invalid_kwarg_rule(Parser *p);
  802. static expr_ty expression_without_invalid_rule(Parser *p);
  803. static void *invalid_legacy_expression_rule(Parser *p);
  804. static void *invalid_expression_rule(Parser *p);
  805. static void *invalid_named_expression_rule(Parser *p);
  806. static void *invalid_assignment_rule(Parser *p);
  807. static expr_ty invalid_ann_assign_target_rule(Parser *p);
  808. static void *invalid_del_stmt_rule(Parser *p);
  809. static void *invalid_block_rule(Parser *p);
  810. static void *invalid_comprehension_rule(Parser *p);
  811. static void *invalid_dict_comprehension_rule(Parser *p);
  812. static void *invalid_parameters_rule(Parser *p);
  813. static void *invalid_default_rule(Parser *p);
  814. static void *invalid_star_etc_rule(Parser *p);
  815. static void *invalid_kwds_rule(Parser *p);
  816. static void *invalid_parameters_helper_rule(Parser *p);
  817. static void *invalid_lambda_parameters_rule(Parser *p);
  818. static void *invalid_lambda_parameters_helper_rule(Parser *p);
  819. static void *invalid_lambda_star_etc_rule(Parser *p);
  820. static void *invalid_lambda_kwds_rule(Parser *p);
  821. static void *invalid_double_type_comments_rule(Parser *p);
  822. static void *invalid_with_item_rule(Parser *p);
  823. static void *invalid_for_target_rule(Parser *p);
  824. static void *invalid_group_rule(Parser *p);
  825. static void *invalid_import_rule(Parser *p);
  826. static void *invalid_import_from_targets_rule(Parser *p);
  827. static void *invalid_with_stmt_rule(Parser *p);
  828. static void *invalid_with_stmt_indent_rule(Parser *p);
  829. static void *invalid_try_stmt_rule(Parser *p);
  830. static void *invalid_except_stmt_rule(Parser *p);
  831. static void *invalid_finally_stmt_rule(Parser *p);
  832. static void *invalid_except_stmt_indent_rule(Parser *p);
  833. static void *invalid_except_star_stmt_indent_rule(Parser *p);
  834. static void *invalid_match_stmt_rule(Parser *p);
  835. static void *invalid_case_block_rule(Parser *p);
  836. static void *invalid_as_pattern_rule(Parser *p);
  837. static void *invalid_class_pattern_rule(Parser *p);
  838. static asdl_pattern_seq* invalid_class_argument_pattern_rule(Parser *p);
  839. static void *invalid_if_stmt_rule(Parser *p);
  840. static void *invalid_elif_stmt_rule(Parser *p);
  841. static void *invalid_else_stmt_rule(Parser *p);
  842. static void *invalid_while_stmt_rule(Parser *p);
  843. static void *invalid_for_stmt_rule(Parser *p);
  844. static void *invalid_def_raw_rule(Parser *p);
  845. static void *invalid_class_def_raw_rule(Parser *p);
  846. static void *invalid_double_starred_kvpairs_rule(Parser *p);
  847. static void *invalid_kvpair_rule(Parser *p);
  848. static void *invalid_starred_expression_rule(Parser *p);
  849. static void *invalid_replacement_field_rule(Parser *p);
  850. static void *invalid_conversion_character_rule(Parser *p);
  851. static asdl_seq *_loop0_1_rule(Parser *p);
  852. static asdl_seq *_loop0_2_rule(Parser *p);
  853. static asdl_seq *_loop1_3_rule(Parser *p);
  854. static asdl_seq *_loop0_5_rule(Parser *p);
  855. static asdl_seq *_gather_4_rule(Parser *p);
  856. static void *_tmp_6_rule(Parser *p);
  857. static void *_tmp_7_rule(Parser *p);
  858. static void *_tmp_8_rule(Parser *p);
  859. static void *_tmp_9_rule(Parser *p);
  860. static void *_tmp_10_rule(Parser *p);
  861. static void *_tmp_11_rule(Parser *p);
  862. static void *_tmp_12_rule(Parser *p);
  863. static void *_tmp_13_rule(Parser *p);
  864. static asdl_seq *_loop1_14_rule(Parser *p);
  865. static void *_tmp_15_rule(Parser *p);
  866. static void *_tmp_16_rule(Parser *p);
  867. static void *_tmp_17_rule(Parser *p);
  868. static asdl_seq *_loop0_19_rule(Parser *p);
  869. static asdl_seq *_gather_18_rule(Parser *p);
  870. static asdl_seq *_loop0_21_rule(Parser *p);
  871. static asdl_seq *_gather_20_rule(Parser *p);
  872. static void *_tmp_22_rule(Parser *p);
  873. static void *_tmp_23_rule(Parser *p);
  874. static asdl_seq *_loop0_24_rule(Parser *p);
  875. static asdl_seq *_loop1_25_rule(Parser *p);
  876. static asdl_seq *_loop0_27_rule(Parser *p);
  877. static asdl_seq *_gather_26_rule(Parser *p);
  878. static void *_tmp_28_rule(Parser *p);
  879. static asdl_seq *_loop0_30_rule(Parser *p);
  880. static asdl_seq *_gather_29_rule(Parser *p);
  881. static void *_tmp_31_rule(Parser *p);
  882. static asdl_seq *_loop1_32_rule(Parser *p);
  883. static void *_tmp_33_rule(Parser *p);
  884. static void *_tmp_34_rule(Parser *p);
  885. static void *_tmp_35_rule(Parser *p);
  886. static asdl_seq *_loop0_36_rule(Parser *p);
  887. static asdl_seq *_loop0_37_rule(Parser *p);
  888. static asdl_seq *_loop0_38_rule(Parser *p);
  889. static asdl_seq *_loop1_39_rule(Parser *p);
  890. static asdl_seq *_loop0_40_rule(Parser *p);
  891. static asdl_seq *_loop1_41_rule(Parser *p);
  892. static asdl_seq *_loop1_42_rule(Parser *p);
  893. static asdl_seq *_loop1_43_rule(Parser *p);
  894. static asdl_seq *_loop0_44_rule(Parser *p);
  895. static asdl_seq *_loop1_45_rule(Parser *p);
  896. static asdl_seq *_loop0_46_rule(Parser *p);
  897. static asdl_seq *_loop1_47_rule(Parser *p);
  898. static asdl_seq *_loop0_48_rule(Parser *p);
  899. static asdl_seq *_loop0_49_rule(Parser *p);
  900. static asdl_seq *_loop1_50_rule(Parser *p);
  901. static asdl_seq *_loop0_52_rule(Parser *p);
  902. static asdl_seq *_gather_51_rule(Parser *p);
  903. static asdl_seq *_loop0_54_rule(Parser *p);
  904. static asdl_seq *_gather_53_rule(Parser *p);
  905. static asdl_seq *_loop0_56_rule(Parser *p);
  906. static asdl_seq *_gather_55_rule(Parser *p);
  907. static asdl_seq *_loop0_58_rule(Parser *p);
  908. static asdl_seq *_gather_57_rule(Parser *p);
  909. static void *_tmp_59_rule(Parser *p);
  910. static asdl_seq *_loop1_60_rule(Parser *p);
  911. static asdl_seq *_loop1_61_rule(Parser *p);
  912. static void *_tmp_62_rule(Parser *p);
  913. static void *_tmp_63_rule(Parser *p);
  914. static asdl_seq *_loop1_64_rule(Parser *p);
  915. static asdl_seq *_loop0_66_rule(Parser *p);
  916. static asdl_seq *_gather_65_rule(Parser *p);
  917. static void *_tmp_67_rule(Parser *p);
  918. static void *_tmp_68_rule(Parser *p);
  919. static void *_tmp_69_rule(Parser *p);
  920. static void *_tmp_70_rule(Parser *p);
  921. static asdl_seq *_loop0_72_rule(Parser *p);
  922. static asdl_seq *_gather_71_rule(Parser *p);
  923. static asdl_seq *_loop0_74_rule(Parser *p);
  924. static asdl_seq *_gather_73_rule(Parser *p);
  925. static void *_tmp_75_rule(Parser *p);
  926. static asdl_seq *_loop0_77_rule(Parser *p);
  927. static asdl_seq *_gather_76_rule(Parser *p);
  928. static asdl_seq *_loop0_79_rule(Parser *p);
  929. static asdl_seq *_gather_78_rule(Parser *p);
  930. static asdl_seq *_loop0_81_rule(Parser *p);
  931. static asdl_seq *_gather_80_rule(Parser *p);
  932. static asdl_seq *_loop1_82_rule(Parser *p);
  933. static asdl_seq *_loop1_83_rule(Parser *p);
  934. static asdl_seq *_loop0_85_rule(Parser *p);
  935. static asdl_seq *_gather_84_rule(Parser *p);
  936. static asdl_seq *_loop1_86_rule(Parser *p);
  937. static asdl_seq *_loop1_87_rule(Parser *p);
  938. static asdl_seq *_loop1_88_rule(Parser *p);
  939. static void *_tmp_89_rule(Parser *p);
  940. static asdl_seq *_loop0_91_rule(Parser *p);
  941. static asdl_seq *_gather_90_rule(Parser *p);
  942. static void *_tmp_92_rule(Parser *p);
  943. static void *_tmp_93_rule(Parser *p);
  944. static void *_tmp_94_rule(Parser *p);
  945. static void *_tmp_95_rule(Parser *p);
  946. static void *_tmp_96_rule(Parser *p);
  947. static void *_tmp_97_rule(Parser *p);
  948. static asdl_seq *_loop0_98_rule(Parser *p);
  949. static asdl_seq *_loop0_99_rule(Parser *p);
  950. static asdl_seq *_loop0_100_rule(Parser *p);
  951. static asdl_seq *_loop1_101_rule(Parser *p);
  952. static asdl_seq *_loop0_102_rule(Parser *p);
  953. static asdl_seq *_loop1_103_rule(Parser *p);
  954. static asdl_seq *_loop1_104_rule(Parser *p);
  955. static asdl_seq *_loop1_105_rule(Parser *p);
  956. static asdl_seq *_loop0_106_rule(Parser *p);
  957. static asdl_seq *_loop1_107_rule(Parser *p);
  958. static asdl_seq *_loop0_108_rule(Parser *p);
  959. static asdl_seq *_loop1_109_rule(Parser *p);
  960. static asdl_seq *_loop0_110_rule(Parser *p);
  961. static asdl_seq *_loop1_111_rule(Parser *p);
  962. static void *_tmp_112_rule(Parser *p);
  963. static asdl_seq *_loop0_113_rule(Parser *p);
  964. static asdl_seq *_loop0_114_rule(Parser *p);
  965. static asdl_seq *_loop1_115_rule(Parser *p);
  966. static void *_tmp_116_rule(Parser *p);
  967. static asdl_seq *_loop0_118_rule(Parser *p);
  968. static asdl_seq *_gather_117_rule(Parser *p);
  969. static asdl_seq *_loop1_119_rule(Parser *p);
  970. static asdl_seq *_loop0_120_rule(Parser *p);
  971. static asdl_seq *_loop0_121_rule(Parser *p);
  972. static void *_tmp_122_rule(Parser *p);
  973. static asdl_seq *_loop0_124_rule(Parser *p);
  974. static asdl_seq *_gather_123_rule(Parser *p);
  975. static void *_tmp_125_rule(Parser *p);
  976. static asdl_seq *_loop0_127_rule(Parser *p);
  977. static asdl_seq *_gather_126_rule(Parser *p);
  978. static asdl_seq *_loop0_129_rule(Parser *p);
  979. static asdl_seq *_gather_128_rule(Parser *p);
  980. static asdl_seq *_loop0_131_rule(Parser *p);
  981. static asdl_seq *_gather_130_rule(Parser *p);
  982. static asdl_seq *_loop0_133_rule(Parser *p);
  983. static asdl_seq *_gather_132_rule(Parser *p);
  984. static asdl_seq *_loop0_134_rule(Parser *p);
  985. static asdl_seq *_loop0_136_rule(Parser *p);
  986. static asdl_seq *_gather_135_rule(Parser *p);
  987. static asdl_seq *_loop1_137_rule(Parser *p);
  988. static void *_tmp_138_rule(Parser *p);
  989. static asdl_seq *_loop0_140_rule(Parser *p);
  990. static asdl_seq *_gather_139_rule(Parser *p);
  991. static asdl_seq *_loop0_142_rule(Parser *p);
  992. static asdl_seq *_gather_141_rule(Parser *p);
  993. static asdl_seq *_loop0_144_rule(Parser *p);
  994. static asdl_seq *_gather_143_rule(Parser *p);
  995. static asdl_seq *_loop0_146_rule(Parser *p);
  996. static asdl_seq *_gather_145_rule(Parser *p);
  997. static asdl_seq *_loop0_148_rule(Parser *p);
  998. static asdl_seq *_gather_147_rule(Parser *p);
  999. static void *_tmp_149_rule(Parser *p);
  1000. static void *_tmp_150_rule(Parser *p);
  1001. static asdl_seq *_loop0_152_rule(Parser *p);
  1002. static asdl_seq *_gather_151_rule(Parser *p);
  1003. static void *_tmp_153_rule(Parser *p);
  1004. static void *_tmp_154_rule(Parser *p);
  1005. static void *_tmp_155_rule(Parser *p);
  1006. static void *_tmp_156_rule(Parser *p);
  1007. static void *_tmp_157_rule(Parser *p);
  1008. static void *_tmp_158_rule(Parser *p);
  1009. static void *_tmp_159_rule(Parser *p);
  1010. static void *_tmp_160_rule(Parser *p);
  1011. static void *_tmp_161_rule(Parser *p);
  1012. static void *_tmp_162_rule(Parser *p);
  1013. static asdl_seq *_loop0_163_rule(Parser *p);
  1014. static asdl_seq *_loop0_164_rule(Parser *p);
  1015. static asdl_seq *_loop0_165_rule(Parser *p);
  1016. static void *_tmp_166_rule(Parser *p);
  1017. static void *_tmp_167_rule(Parser *p);
  1018. static void *_tmp_168_rule(Parser *p);
  1019. static void *_tmp_169_rule(Parser *p);
  1020. static void *_tmp_170_rule(Parser *p);
  1021. static asdl_seq *_loop0_171_rule(Parser *p);
  1022. static asdl_seq *_loop0_172_rule(Parser *p);
  1023. static asdl_seq *_loop0_173_rule(Parser *p);
  1024. static asdl_seq *_loop1_174_rule(Parser *p);
  1025. static void *_tmp_175_rule(Parser *p);
  1026. static asdl_seq *_loop0_176_rule(Parser *p);
  1027. static void *_tmp_177_rule(Parser *p);
  1028. static asdl_seq *_loop0_178_rule(Parser *p);
  1029. static asdl_seq *_loop1_179_rule(Parser *p);
  1030. static void *_tmp_180_rule(Parser *p);
  1031. static void *_tmp_181_rule(Parser *p);
  1032. static void *_tmp_182_rule(Parser *p);
  1033. static asdl_seq *_loop0_183_rule(Parser *p);
  1034. static void *_tmp_184_rule(Parser *p);
  1035. static void *_tmp_185_rule(Parser *p);
  1036. static asdl_seq *_loop1_186_rule(Parser *p);
  1037. static void *_tmp_187_rule(Parser *p);
  1038. static asdl_seq *_loop0_188_rule(Parser *p);
  1039. static asdl_seq *_loop0_189_rule(Parser *p);
  1040. static asdl_seq *_loop0_190_rule(Parser *p);
  1041. static asdl_seq *_loop0_192_rule(Parser *p);
  1042. static asdl_seq *_gather_191_rule(Parser *p);
  1043. static void *_tmp_193_rule(Parser *p);
  1044. static asdl_seq *_loop0_194_rule(Parser *p);
  1045. static void *_tmp_195_rule(Parser *p);
  1046. static asdl_seq *_loop0_196_rule(Parser *p);
  1047. static asdl_seq *_loop1_197_rule(Parser *p);
  1048. static asdl_seq *_loop1_198_rule(Parser *p);
  1049. static void *_tmp_199_rule(Parser *p);
  1050. static void *_tmp_200_rule(Parser *p);
  1051. static asdl_seq *_loop0_201_rule(Parser *p);
  1052. static void *_tmp_202_rule(Parser *p);
  1053. static void *_tmp_203_rule(Parser *p);
  1054. static void *_tmp_204_rule(Parser *p);
  1055. static asdl_seq *_loop0_206_rule(Parser *p);
  1056. static asdl_seq *_gather_205_rule(Parser *p);
  1057. static asdl_seq *_loop0_208_rule(Parser *p);
  1058. static asdl_seq *_gather_207_rule(Parser *p);
  1059. static asdl_seq *_loop0_210_rule(Parser *p);
  1060. static asdl_seq *_gather_209_rule(Parser *p);
  1061. static asdl_seq *_loop0_212_rule(Parser *p);
  1062. static asdl_seq *_gather_211_rule(Parser *p);
  1063. static asdl_seq *_loop0_214_rule(Parser *p);
  1064. static asdl_seq *_gather_213_rule(Parser *p);
  1065. static void *_tmp_215_rule(Parser *p);
  1066. static asdl_seq *_loop0_216_rule(Parser *p);
  1067. static asdl_seq *_loop1_217_rule(Parser *p);
  1068. static void *_tmp_218_rule(Parser *p);
  1069. static asdl_seq *_loop0_219_rule(Parser *p);
  1070. static asdl_seq *_loop1_220_rule(Parser *p);
  1071. static void *_tmp_221_rule(Parser *p);
  1072. static void *_tmp_222_rule(Parser *p);
  1073. static void *_tmp_223_rule(Parser *p);
  1074. static void *_tmp_224_rule(Parser *p);
  1075. static void *_tmp_225_rule(Parser *p);
  1076. static void *_tmp_226_rule(Parser *p);
  1077. static void *_tmp_227_rule(Parser *p);
  1078. static void *_tmp_228_rule(Parser *p);
  1079. static void *_tmp_229_rule(Parser *p);
  1080. static void *_tmp_230_rule(Parser *p);
  1081. static asdl_seq *_loop0_232_rule(Parser *p);
  1082. static asdl_seq *_gather_231_rule(Parser *p);
  1083. static void *_tmp_233_rule(Parser *p);
  1084. static void *_tmp_234_rule(Parser *p);
  1085. static void *_tmp_235_rule(Parser *p);
  1086. static void *_tmp_236_rule(Parser *p);
  1087. static void *_tmp_237_rule(Parser *p);
  1088. static void *_tmp_238_rule(Parser *p);
  1089. static void *_tmp_239_rule(Parser *p);
  1090. static void *_tmp_240_rule(Parser *p);
  1091. static void *_tmp_241_rule(Parser *p);
  1092. static void *_tmp_242_rule(Parser *p);
  1093. static void *_tmp_243_rule(Parser *p);
  1094. static void *_tmp_244_rule(Parser *p);
  1095. static void *_tmp_245_rule(Parser *p);
  1096. static asdl_seq *_loop0_246_rule(Parser *p);
  1097. static void *_tmp_247_rule(Parser *p);
  1098. static void *_tmp_248_rule(Parser *p);
  1099. static void *_tmp_249_rule(Parser *p);
  1100. static void *_tmp_250_rule(Parser *p);
  1101. static void *_tmp_251_rule(Parser *p);
  1102. static void *_tmp_252_rule(Parser *p);
  1103. static void *_tmp_253_rule(Parser *p);
  1104. static void *_tmp_254_rule(Parser *p);
  1105. static void *_tmp_255_rule(Parser *p);
  1106. static void *_tmp_256_rule(Parser *p);
  1107. static void *_tmp_257_rule(Parser *p);
  1108. static void *_tmp_258_rule(Parser *p);
  1109. static void *_tmp_259_rule(Parser *p);
  1110. static void *_tmp_260_rule(Parser *p);
  1111. static void *_tmp_261_rule(Parser *p);
  1112. static void *_tmp_262_rule(Parser *p);
  1113. static void *_tmp_263_rule(Parser *p);
  1114. static void *_tmp_264_rule(Parser *p);
  1115. static void *_tmp_265_rule(Parser *p);
  1116. static void *_tmp_266_rule(Parser *p);
  1117. static void *_tmp_267_rule(Parser *p);
  1118. static void *_tmp_268_rule(Parser *p);
  1119. static void *_tmp_269_rule(Parser *p);
  1120. static void *_tmp_270_rule(Parser *p);
  1121. static void *_tmp_271_rule(Parser *p);
  1122. static void *_tmp_272_rule(Parser *p);
  1123. static void *_tmp_273_rule(Parser *p);
  1124. static void *_tmp_274_rule(Parser *p);
  1125. static void *_tmp_275_rule(Parser *p);
  1126. static void *_tmp_276_rule(Parser *p);
  1127. static asdl_seq *_loop0_278_rule(Parser *p);
  1128. static asdl_seq *_gather_277_rule(Parser *p);
  1129. static void *_tmp_279_rule(Parser *p);
  1130. static void *_tmp_280_rule(Parser *p);
  1131. static void *_tmp_281_rule(Parser *p);
  1132. static void *_tmp_282_rule(Parser *p);
  1133. static void *_tmp_283_rule(Parser *p);
  1134. static void *_tmp_284_rule(Parser *p);
  1135. // file: statements? $
  1136. static mod_ty
  1137. file_rule(Parser *p)
  1138. {
  1139. if (p->level++ == MAXSTACK) {
  1140. _Pypegen_stack_overflow(p);
  1141. }
  1142. if (p->error_indicator) {
  1143. p->level--;
  1144. return NULL;
  1145. }
  1146. mod_ty _res = NULL;
  1147. int _mark = p->mark;
  1148. { // statements? $
  1149. if (p->error_indicator) {
  1150. p->level--;
  1151. return NULL;
  1152. }
  1153. D(fprintf(stderr, "%*c> file[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statements? $"));
  1154. void *a;
  1155. Token * endmarker_var;
  1156. if (
  1157. (a = statements_rule(p), !p->error_indicator) // statements?
  1158. &&
  1159. (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
  1160. )
  1161. {
  1162. D(fprintf(stderr, "%*c+ file[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statements? $"));
  1163. _res = _PyPegen_make_module ( p , a );
  1164. if (_res == NULL && PyErr_Occurred()) {
  1165. p->error_indicator = 1;
  1166. p->level--;
  1167. return NULL;
  1168. }
  1169. goto done;
  1170. }
  1171. p->mark = _mark;
  1172. D(fprintf(stderr, "%*c%s file[%d-%d]: %s failed!\n", p->level, ' ',
  1173. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statements? $"));
  1174. }
  1175. _res = NULL;
  1176. done:
  1177. p->level--;
  1178. return _res;
  1179. }
  1180. // interactive: statement_newline
  1181. static mod_ty
  1182. interactive_rule(Parser *p)
  1183. {
  1184. if (p->level++ == MAXSTACK) {
  1185. _Pypegen_stack_overflow(p);
  1186. }
  1187. if (p->error_indicator) {
  1188. p->level--;
  1189. return NULL;
  1190. }
  1191. mod_ty _res = NULL;
  1192. int _mark = p->mark;
  1193. { // statement_newline
  1194. if (p->error_indicator) {
  1195. p->level--;
  1196. return NULL;
  1197. }
  1198. D(fprintf(stderr, "%*c> interactive[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement_newline"));
  1199. asdl_stmt_seq* a;
  1200. if (
  1201. (a = statement_newline_rule(p)) // statement_newline
  1202. )
  1203. {
  1204. D(fprintf(stderr, "%*c+ interactive[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement_newline"));
  1205. _res = _PyAST_Interactive ( a , p -> arena );
  1206. if (_res == NULL && PyErr_Occurred()) {
  1207. p->error_indicator = 1;
  1208. p->level--;
  1209. return NULL;
  1210. }
  1211. goto done;
  1212. }
  1213. p->mark = _mark;
  1214. D(fprintf(stderr, "%*c%s interactive[%d-%d]: %s failed!\n", p->level, ' ',
  1215. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement_newline"));
  1216. }
  1217. _res = NULL;
  1218. done:
  1219. p->level--;
  1220. return _res;
  1221. }
  1222. // eval: expressions NEWLINE* $
  1223. static mod_ty
  1224. eval_rule(Parser *p)
  1225. {
  1226. if (p->level++ == MAXSTACK) {
  1227. _Pypegen_stack_overflow(p);
  1228. }
  1229. if (p->error_indicator) {
  1230. p->level--;
  1231. return NULL;
  1232. }
  1233. mod_ty _res = NULL;
  1234. int _mark = p->mark;
  1235. { // expressions NEWLINE* $
  1236. if (p->error_indicator) {
  1237. p->level--;
  1238. return NULL;
  1239. }
  1240. D(fprintf(stderr, "%*c> eval[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
  1241. asdl_seq * _loop0_1_var;
  1242. expr_ty a;
  1243. Token * endmarker_var;
  1244. if (
  1245. (a = expressions_rule(p)) // expressions
  1246. &&
  1247. (_loop0_1_var = _loop0_1_rule(p)) // NEWLINE*
  1248. &&
  1249. (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
  1250. )
  1251. {
  1252. D(fprintf(stderr, "%*c+ eval[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
  1253. _res = _PyAST_Expression ( a , p -> arena );
  1254. if (_res == NULL && PyErr_Occurred()) {
  1255. p->error_indicator = 1;
  1256. p->level--;
  1257. return NULL;
  1258. }
  1259. goto done;
  1260. }
  1261. p->mark = _mark;
  1262. D(fprintf(stderr, "%*c%s eval[%d-%d]: %s failed!\n", p->level, ' ',
  1263. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions NEWLINE* $"));
  1264. }
  1265. _res = NULL;
  1266. done:
  1267. p->level--;
  1268. return _res;
  1269. }
  1270. // func_type: '(' type_expressions? ')' '->' expression NEWLINE* $
  1271. static mod_ty
  1272. func_type_rule(Parser *p)
  1273. {
  1274. if (p->level++ == MAXSTACK) {
  1275. _Pypegen_stack_overflow(p);
  1276. }
  1277. if (p->error_indicator) {
  1278. p->level--;
  1279. return NULL;
  1280. }
  1281. mod_ty _res = NULL;
  1282. int _mark = p->mark;
  1283. { // '(' type_expressions? ')' '->' expression NEWLINE* $
  1284. if (p->error_indicator) {
  1285. p->level--;
  1286. return NULL;
  1287. }
  1288. D(fprintf(stderr, "%*c> func_type[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
  1289. Token * _literal;
  1290. Token * _literal_1;
  1291. Token * _literal_2;
  1292. asdl_seq * _loop0_2_var;
  1293. void *a;
  1294. expr_ty b;
  1295. Token * endmarker_var;
  1296. if (
  1297. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  1298. &&
  1299. (a = type_expressions_rule(p), !p->error_indicator) // type_expressions?
  1300. &&
  1301. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  1302. &&
  1303. (_literal_2 = _PyPegen_expect_token(p, 51)) // token='->'
  1304. &&
  1305. (b = expression_rule(p)) // expression
  1306. &&
  1307. (_loop0_2_var = _loop0_2_rule(p)) // NEWLINE*
  1308. &&
  1309. (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
  1310. )
  1311. {
  1312. D(fprintf(stderr, "%*c+ func_type[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
  1313. _res = _PyAST_FunctionType ( a , b , p -> arena );
  1314. if (_res == NULL && PyErr_Occurred()) {
  1315. p->error_indicator = 1;
  1316. p->level--;
  1317. return NULL;
  1318. }
  1319. goto done;
  1320. }
  1321. p->mark = _mark;
  1322. D(fprintf(stderr, "%*c%s func_type[%d-%d]: %s failed!\n", p->level, ' ',
  1323. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
  1324. }
  1325. _res = NULL;
  1326. done:
  1327. p->level--;
  1328. return _res;
  1329. }
  1330. // statements: statement+
  1331. static asdl_stmt_seq*
  1332. statements_rule(Parser *p)
  1333. {
  1334. if (p->level++ == MAXSTACK) {
  1335. _Pypegen_stack_overflow(p);
  1336. }
  1337. if (p->error_indicator) {
  1338. p->level--;
  1339. return NULL;
  1340. }
  1341. asdl_stmt_seq* _res = NULL;
  1342. int _mark = p->mark;
  1343. { // statement+
  1344. if (p->error_indicator) {
  1345. p->level--;
  1346. return NULL;
  1347. }
  1348. D(fprintf(stderr, "%*c> statements[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement+"));
  1349. asdl_seq * a;
  1350. if (
  1351. (a = _loop1_3_rule(p)) // statement+
  1352. )
  1353. {
  1354. D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement+"));
  1355. _res = ( asdl_stmt_seq* ) _PyPegen_seq_flatten ( p , a );
  1356. if (_res == NULL && PyErr_Occurred()) {
  1357. p->error_indicator = 1;
  1358. p->level--;
  1359. return NULL;
  1360. }
  1361. goto done;
  1362. }
  1363. p->mark = _mark;
  1364. D(fprintf(stderr, "%*c%s statements[%d-%d]: %s failed!\n", p->level, ' ',
  1365. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement+"));
  1366. }
  1367. _res = NULL;
  1368. done:
  1369. p->level--;
  1370. return _res;
  1371. }
  1372. // statement: compound_stmt | simple_stmts
  1373. static asdl_stmt_seq*
  1374. statement_rule(Parser *p)
  1375. {
  1376. if (p->level++ == MAXSTACK) {
  1377. _Pypegen_stack_overflow(p);
  1378. }
  1379. if (p->error_indicator) {
  1380. p->level--;
  1381. return NULL;
  1382. }
  1383. asdl_stmt_seq* _res = NULL;
  1384. int _mark = p->mark;
  1385. { // compound_stmt
  1386. if (p->error_indicator) {
  1387. p->level--;
  1388. return NULL;
  1389. }
  1390. D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
  1391. stmt_ty a;
  1392. if (
  1393. (a = compound_stmt_rule(p)) // compound_stmt
  1394. )
  1395. {
  1396. D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
  1397. _res = ( asdl_stmt_seq* ) _PyPegen_singleton_seq ( p , a );
  1398. if (_res == NULL && PyErr_Occurred()) {
  1399. p->error_indicator = 1;
  1400. p->level--;
  1401. return NULL;
  1402. }
  1403. goto done;
  1404. }
  1405. p->mark = _mark;
  1406. D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
  1407. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt"));
  1408. }
  1409. { // simple_stmts
  1410. if (p->error_indicator) {
  1411. p->level--;
  1412. return NULL;
  1413. }
  1414. D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
  1415. asdl_stmt_seq* a;
  1416. if (
  1417. (a = (asdl_stmt_seq*)simple_stmts_rule(p)) // simple_stmts
  1418. )
  1419. {
  1420. D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
  1421. _res = a;
  1422. if (_res == NULL && PyErr_Occurred()) {
  1423. p->error_indicator = 1;
  1424. p->level--;
  1425. return NULL;
  1426. }
  1427. goto done;
  1428. }
  1429. p->mark = _mark;
  1430. D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
  1431. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts"));
  1432. }
  1433. _res = NULL;
  1434. done:
  1435. p->level--;
  1436. return _res;
  1437. }
  1438. // statement_newline: compound_stmt NEWLINE | simple_stmts | NEWLINE | $
  1439. static asdl_stmt_seq*
  1440. statement_newline_rule(Parser *p)
  1441. {
  1442. if (p->level++ == MAXSTACK) {
  1443. _Pypegen_stack_overflow(p);
  1444. }
  1445. if (p->error_indicator) {
  1446. p->level--;
  1447. return NULL;
  1448. }
  1449. asdl_stmt_seq* _res = NULL;
  1450. int _mark = p->mark;
  1451. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  1452. p->error_indicator = 1;
  1453. p->level--;
  1454. return NULL;
  1455. }
  1456. int _start_lineno = p->tokens[_mark]->lineno;
  1457. UNUSED(_start_lineno); // Only used by EXTRA macro
  1458. int _start_col_offset = p->tokens[_mark]->col_offset;
  1459. UNUSED(_start_col_offset); // Only used by EXTRA macro
  1460. { // compound_stmt NEWLINE
  1461. if (p->error_indicator) {
  1462. p->level--;
  1463. return NULL;
  1464. }
  1465. D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
  1466. stmt_ty a;
  1467. Token * newline_var;
  1468. if (
  1469. (a = compound_stmt_rule(p)) // compound_stmt
  1470. &&
  1471. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  1472. )
  1473. {
  1474. D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
  1475. _res = ( asdl_stmt_seq* ) _PyPegen_singleton_seq ( p , a );
  1476. if (_res == NULL && PyErr_Occurred()) {
  1477. p->error_indicator = 1;
  1478. p->level--;
  1479. return NULL;
  1480. }
  1481. goto done;
  1482. }
  1483. p->mark = _mark;
  1484. D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
  1485. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt NEWLINE"));
  1486. }
  1487. { // simple_stmts
  1488. if (p->error_indicator) {
  1489. p->level--;
  1490. return NULL;
  1491. }
  1492. D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
  1493. asdl_stmt_seq* simple_stmts_var;
  1494. if (
  1495. (simple_stmts_var = simple_stmts_rule(p)) // simple_stmts
  1496. )
  1497. {
  1498. D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
  1499. _res = simple_stmts_var;
  1500. goto done;
  1501. }
  1502. p->mark = _mark;
  1503. D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
  1504. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts"));
  1505. }
  1506. { // NEWLINE
  1507. if (p->error_indicator) {
  1508. p->level--;
  1509. return NULL;
  1510. }
  1511. D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
  1512. Token * newline_var;
  1513. if (
  1514. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  1515. )
  1516. {
  1517. D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
  1518. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  1519. if (_token == NULL) {
  1520. p->level--;
  1521. return NULL;
  1522. }
  1523. int _end_lineno = _token->end_lineno;
  1524. UNUSED(_end_lineno); // Only used by EXTRA macro
  1525. int _end_col_offset = _token->end_col_offset;
  1526. UNUSED(_end_col_offset); // Only used by EXTRA macro
  1527. _res = ( asdl_stmt_seq* ) _PyPegen_singleton_seq ( p , CHECK ( stmt_ty , _PyAST_Pass ( EXTRA ) ) );
  1528. if (_res == NULL && PyErr_Occurred()) {
  1529. p->error_indicator = 1;
  1530. p->level--;
  1531. return NULL;
  1532. }
  1533. goto done;
  1534. }
  1535. p->mark = _mark;
  1536. D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
  1537. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
  1538. }
  1539. { // $
  1540. if (p->error_indicator) {
  1541. p->level--;
  1542. return NULL;
  1543. }
  1544. D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "$"));
  1545. Token * endmarker_var;
  1546. if (
  1547. (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
  1548. )
  1549. {
  1550. D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "$"));
  1551. _res = _PyPegen_interactive_exit ( p );
  1552. if (_res == NULL && PyErr_Occurred()) {
  1553. p->error_indicator = 1;
  1554. p->level--;
  1555. return NULL;
  1556. }
  1557. goto done;
  1558. }
  1559. p->mark = _mark;
  1560. D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
  1561. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "$"));
  1562. }
  1563. _res = NULL;
  1564. done:
  1565. p->level--;
  1566. return _res;
  1567. }
  1568. // simple_stmts: simple_stmt !';' NEWLINE | ';'.simple_stmt+ ';'? NEWLINE
  1569. static asdl_stmt_seq*
  1570. simple_stmts_rule(Parser *p)
  1571. {
  1572. if (p->level++ == MAXSTACK) {
  1573. _Pypegen_stack_overflow(p);
  1574. }
  1575. if (p->error_indicator) {
  1576. p->level--;
  1577. return NULL;
  1578. }
  1579. asdl_stmt_seq* _res = NULL;
  1580. int _mark = p->mark;
  1581. { // simple_stmt !';' NEWLINE
  1582. if (p->error_indicator) {
  1583. p->level--;
  1584. return NULL;
  1585. }
  1586. D(fprintf(stderr, "%*c> simple_stmts[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt !';' NEWLINE"));
  1587. stmt_ty a;
  1588. Token * newline_var;
  1589. if (
  1590. (a = simple_stmt_rule(p)) // simple_stmt
  1591. &&
  1592. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) // token=';'
  1593. &&
  1594. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  1595. )
  1596. {
  1597. D(fprintf(stderr, "%*c+ simple_stmts[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt !';' NEWLINE"));
  1598. _res = ( asdl_stmt_seq* ) _PyPegen_singleton_seq ( p , a );
  1599. if (_res == NULL && PyErr_Occurred()) {
  1600. p->error_indicator = 1;
  1601. p->level--;
  1602. return NULL;
  1603. }
  1604. goto done;
  1605. }
  1606. p->mark = _mark;
  1607. D(fprintf(stderr, "%*c%s simple_stmts[%d-%d]: %s failed!\n", p->level, ' ',
  1608. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt !';' NEWLINE"));
  1609. }
  1610. { // ';'.simple_stmt+ ';'? NEWLINE
  1611. if (p->error_indicator) {
  1612. p->level--;
  1613. return NULL;
  1614. }
  1615. D(fprintf(stderr, "%*c> simple_stmts[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE"));
  1616. void *_opt_var;
  1617. UNUSED(_opt_var); // Silence compiler warnings
  1618. asdl_stmt_seq* a;
  1619. Token * newline_var;
  1620. if (
  1621. (a = (asdl_stmt_seq*)_gather_4_rule(p)) // ';'.simple_stmt+
  1622. &&
  1623. (_opt_var = _PyPegen_expect_token(p, 13), !p->error_indicator) // ';'?
  1624. &&
  1625. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  1626. )
  1627. {
  1628. D(fprintf(stderr, "%*c+ simple_stmts[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE"));
  1629. _res = a;
  1630. if (_res == NULL && PyErr_Occurred()) {
  1631. p->error_indicator = 1;
  1632. p->level--;
  1633. return NULL;
  1634. }
  1635. goto done;
  1636. }
  1637. p->mark = _mark;
  1638. D(fprintf(stderr, "%*c%s simple_stmts[%d-%d]: %s failed!\n", p->level, ' ',
  1639. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE"));
  1640. }
  1641. _res = NULL;
  1642. done:
  1643. p->level--;
  1644. return _res;
  1645. }
  1646. // simple_stmt:
  1647. // | assignment
  1648. // | &"type" type_alias
  1649. // | star_expressions
  1650. // | &'return' return_stmt
  1651. // | &('import' | 'from') import_stmt
  1652. // | &'raise' raise_stmt
  1653. // | 'pass'
  1654. // | &'del' del_stmt
  1655. // | &'yield' yield_stmt
  1656. // | &'assert' assert_stmt
  1657. // | 'break'
  1658. // | 'continue'
  1659. // | &'global' global_stmt
  1660. // | &'nonlocal' nonlocal_stmt
  1661. static stmt_ty
  1662. simple_stmt_rule(Parser *p)
  1663. {
  1664. if (p->level++ == MAXSTACK) {
  1665. _Pypegen_stack_overflow(p);
  1666. }
  1667. if (p->error_indicator) {
  1668. p->level--;
  1669. return NULL;
  1670. }
  1671. stmt_ty _res = NULL;
  1672. if (_PyPegen_is_memoized(p, simple_stmt_type, &_res)) {
  1673. p->level--;
  1674. return _res;
  1675. }
  1676. int _mark = p->mark;
  1677. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  1678. p->error_indicator = 1;
  1679. p->level--;
  1680. return NULL;
  1681. }
  1682. int _start_lineno = p->tokens[_mark]->lineno;
  1683. UNUSED(_start_lineno); // Only used by EXTRA macro
  1684. int _start_col_offset = p->tokens[_mark]->col_offset;
  1685. UNUSED(_start_col_offset); // Only used by EXTRA macro
  1686. { // assignment
  1687. if (p->error_indicator) {
  1688. p->level--;
  1689. return NULL;
  1690. }
  1691. D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment"));
  1692. stmt_ty assignment_var;
  1693. if (
  1694. (assignment_var = assignment_rule(p)) // assignment
  1695. )
  1696. {
  1697. D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment"));
  1698. _res = assignment_var;
  1699. goto done;
  1700. }
  1701. p->mark = _mark;
  1702. D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  1703. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment"));
  1704. }
  1705. { // &"type" type_alias
  1706. if (p->error_indicator) {
  1707. p->level--;
  1708. return NULL;
  1709. }
  1710. D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&\"type\" type_alias"));
  1711. stmt_ty type_alias_var;
  1712. if (
  1713. _PyPegen_lookahead_with_string(1, _PyPegen_expect_soft_keyword, p, "type")
  1714. &&
  1715. (type_alias_var = type_alias_rule(p)) // type_alias
  1716. )
  1717. {
  1718. D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&\"type\" type_alias"));
  1719. _res = type_alias_var;
  1720. goto done;
  1721. }
  1722. p->mark = _mark;
  1723. D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  1724. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&\"type\" type_alias"));
  1725. }
  1726. { // star_expressions
  1727. if (p->error_indicator) {
  1728. p->level--;
  1729. return NULL;
  1730. }
  1731. D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  1732. expr_ty e;
  1733. if (
  1734. (e = star_expressions_rule(p)) // star_expressions
  1735. )
  1736. {
  1737. D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  1738. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  1739. if (_token == NULL) {
  1740. p->level--;
  1741. return NULL;
  1742. }
  1743. int _end_lineno = _token->end_lineno;
  1744. UNUSED(_end_lineno); // Only used by EXTRA macro
  1745. int _end_col_offset = _token->end_col_offset;
  1746. UNUSED(_end_col_offset); // Only used by EXTRA macro
  1747. _res = _PyAST_Expr ( e , EXTRA );
  1748. if (_res == NULL && PyErr_Occurred()) {
  1749. p->error_indicator = 1;
  1750. p->level--;
  1751. return NULL;
  1752. }
  1753. goto done;
  1754. }
  1755. p->mark = _mark;
  1756. D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  1757. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
  1758. }
  1759. { // &'return' return_stmt
  1760. if (p->error_indicator) {
  1761. p->level--;
  1762. return NULL;
  1763. }
  1764. D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
  1765. stmt_ty return_stmt_var;
  1766. if (
  1767. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 519) // token='return'
  1768. &&
  1769. (return_stmt_var = return_stmt_rule(p)) // return_stmt
  1770. )
  1771. {
  1772. D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
  1773. _res = return_stmt_var;
  1774. goto done;
  1775. }
  1776. p->mark = _mark;
  1777. D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  1778. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'return' return_stmt"));
  1779. }
  1780. { // &('import' | 'from') import_stmt
  1781. if (p->error_indicator) {
  1782. p->level--;
  1783. return NULL;
  1784. }
  1785. D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
  1786. stmt_ty import_stmt_var;
  1787. if (
  1788. _PyPegen_lookahead(1, _tmp_6_rule, p)
  1789. &&
  1790. (import_stmt_var = import_stmt_rule(p)) // import_stmt
  1791. )
  1792. {
  1793. D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
  1794. _res = import_stmt_var;
  1795. goto done;
  1796. }
  1797. p->mark = _mark;
  1798. D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  1799. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('import' | 'from') import_stmt"));
  1800. }
  1801. { // &'raise' raise_stmt
  1802. if (p->error_indicator) {
  1803. p->level--;
  1804. return NULL;
  1805. }
  1806. D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
  1807. stmt_ty raise_stmt_var;
  1808. if (
  1809. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 522) // token='raise'
  1810. &&
  1811. (raise_stmt_var = raise_stmt_rule(p)) // raise_stmt
  1812. )
  1813. {
  1814. D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
  1815. _res = raise_stmt_var;
  1816. goto done;
  1817. }
  1818. p->mark = _mark;
  1819. D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  1820. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'raise' raise_stmt"));
  1821. }
  1822. { // 'pass'
  1823. if (p->error_indicator) {
  1824. p->level--;
  1825. return NULL;
  1826. }
  1827. D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'pass'"));
  1828. Token * _keyword;
  1829. if (
  1830. (_keyword = _PyPegen_expect_token(p, 504)) // token='pass'
  1831. )
  1832. {
  1833. D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'pass'"));
  1834. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  1835. if (_token == NULL) {
  1836. p->level--;
  1837. return NULL;
  1838. }
  1839. int _end_lineno = _token->end_lineno;
  1840. UNUSED(_end_lineno); // Only used by EXTRA macro
  1841. int _end_col_offset = _token->end_col_offset;
  1842. UNUSED(_end_col_offset); // Only used by EXTRA macro
  1843. _res = _PyAST_Pass ( EXTRA );
  1844. if (_res == NULL && PyErr_Occurred()) {
  1845. p->error_indicator = 1;
  1846. p->level--;
  1847. return NULL;
  1848. }
  1849. goto done;
  1850. }
  1851. p->mark = _mark;
  1852. D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  1853. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'pass'"));
  1854. }
  1855. { // &'del' del_stmt
  1856. if (p->error_indicator) {
  1857. p->level--;
  1858. return NULL;
  1859. }
  1860. D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
  1861. stmt_ty del_stmt_var;
  1862. if (
  1863. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 604) // token='del'
  1864. &&
  1865. (del_stmt_var = del_stmt_rule(p)) // del_stmt
  1866. )
  1867. {
  1868. D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
  1869. _res = del_stmt_var;
  1870. goto done;
  1871. }
  1872. p->mark = _mark;
  1873. D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  1874. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'del' del_stmt"));
  1875. }
  1876. { // &'yield' yield_stmt
  1877. if (p->error_indicator) {
  1878. p->level--;
  1879. return NULL;
  1880. }
  1881. D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
  1882. stmt_ty yield_stmt_var;
  1883. if (
  1884. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 573) // token='yield'
  1885. &&
  1886. (yield_stmt_var = yield_stmt_rule(p)) // yield_stmt
  1887. )
  1888. {
  1889. D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
  1890. _res = yield_stmt_var;
  1891. goto done;
  1892. }
  1893. p->mark = _mark;
  1894. D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  1895. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'yield' yield_stmt"));
  1896. }
  1897. { // &'assert' assert_stmt
  1898. if (p->error_indicator) {
  1899. p->level--;
  1900. return NULL;
  1901. }
  1902. D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
  1903. stmt_ty assert_stmt_var;
  1904. if (
  1905. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 526) // token='assert'
  1906. &&
  1907. (assert_stmt_var = assert_stmt_rule(p)) // assert_stmt
  1908. )
  1909. {
  1910. D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
  1911. _res = assert_stmt_var;
  1912. goto done;
  1913. }
  1914. p->mark = _mark;
  1915. D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  1916. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'assert' assert_stmt"));
  1917. }
  1918. { // 'break'
  1919. if (p->error_indicator) {
  1920. p->level--;
  1921. return NULL;
  1922. }
  1923. D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'break'"));
  1924. Token * _keyword;
  1925. if (
  1926. (_keyword = _PyPegen_expect_token(p, 508)) // token='break'
  1927. )
  1928. {
  1929. D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'break'"));
  1930. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  1931. if (_token == NULL) {
  1932. p->level--;
  1933. return NULL;
  1934. }
  1935. int _end_lineno = _token->end_lineno;
  1936. UNUSED(_end_lineno); // Only used by EXTRA macro
  1937. int _end_col_offset = _token->end_col_offset;
  1938. UNUSED(_end_col_offset); // Only used by EXTRA macro
  1939. _res = _PyAST_Break ( EXTRA );
  1940. if (_res == NULL && PyErr_Occurred()) {
  1941. p->error_indicator = 1;
  1942. p->level--;
  1943. return NULL;
  1944. }
  1945. goto done;
  1946. }
  1947. p->mark = _mark;
  1948. D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  1949. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'break'"));
  1950. }
  1951. { // 'continue'
  1952. if (p->error_indicator) {
  1953. p->level--;
  1954. return NULL;
  1955. }
  1956. D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'continue'"));
  1957. Token * _keyword;
  1958. if (
  1959. (_keyword = _PyPegen_expect_token(p, 509)) // token='continue'
  1960. )
  1961. {
  1962. D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'continue'"));
  1963. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  1964. if (_token == NULL) {
  1965. p->level--;
  1966. return NULL;
  1967. }
  1968. int _end_lineno = _token->end_lineno;
  1969. UNUSED(_end_lineno); // Only used by EXTRA macro
  1970. int _end_col_offset = _token->end_col_offset;
  1971. UNUSED(_end_col_offset); // Only used by EXTRA macro
  1972. _res = _PyAST_Continue ( EXTRA );
  1973. if (_res == NULL && PyErr_Occurred()) {
  1974. p->error_indicator = 1;
  1975. p->level--;
  1976. return NULL;
  1977. }
  1978. goto done;
  1979. }
  1980. p->mark = _mark;
  1981. D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  1982. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'continue'"));
  1983. }
  1984. { // &'global' global_stmt
  1985. if (p->error_indicator) {
  1986. p->level--;
  1987. return NULL;
  1988. }
  1989. D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
  1990. stmt_ty global_stmt_var;
  1991. if (
  1992. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 523) // token='global'
  1993. &&
  1994. (global_stmt_var = global_stmt_rule(p)) // global_stmt
  1995. )
  1996. {
  1997. D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
  1998. _res = global_stmt_var;
  1999. goto done;
  2000. }
  2001. p->mark = _mark;
  2002. D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  2003. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'global' global_stmt"));
  2004. }
  2005. { // &'nonlocal' nonlocal_stmt
  2006. if (p->error_indicator) {
  2007. p->level--;
  2008. return NULL;
  2009. }
  2010. D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
  2011. stmt_ty nonlocal_stmt_var;
  2012. if (
  2013. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 524) // token='nonlocal'
  2014. &&
  2015. (nonlocal_stmt_var = nonlocal_stmt_rule(p)) // nonlocal_stmt
  2016. )
  2017. {
  2018. D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
  2019. _res = nonlocal_stmt_var;
  2020. goto done;
  2021. }
  2022. p->mark = _mark;
  2023. D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  2024. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
  2025. }
  2026. _res = NULL;
  2027. done:
  2028. _PyPegen_insert_memo(p, _mark, simple_stmt_type, _res);
  2029. p->level--;
  2030. return _res;
  2031. }
  2032. // compound_stmt:
  2033. // | &('def' | '@' | ASYNC) function_def
  2034. // | &'if' if_stmt
  2035. // | &('class' | '@') class_def
  2036. // | &('with' | ASYNC) with_stmt
  2037. // | &('for' | ASYNC) for_stmt
  2038. // | &'try' try_stmt
  2039. // | &'while' while_stmt
  2040. // | match_stmt
  2041. static stmt_ty
  2042. compound_stmt_rule(Parser *p)
  2043. {
  2044. if (p->level++ == MAXSTACK) {
  2045. _Pypegen_stack_overflow(p);
  2046. }
  2047. if (p->error_indicator) {
  2048. p->level--;
  2049. return NULL;
  2050. }
  2051. stmt_ty _res = NULL;
  2052. int _mark = p->mark;
  2053. { // &('def' | '@' | ASYNC) function_def
  2054. if (p->error_indicator) {
  2055. p->level--;
  2056. return NULL;
  2057. }
  2058. D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
  2059. stmt_ty function_def_var;
  2060. if (
  2061. _PyPegen_lookahead(1, _tmp_7_rule, p)
  2062. &&
  2063. (function_def_var = function_def_rule(p)) // function_def
  2064. )
  2065. {
  2066. D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
  2067. _res = function_def_var;
  2068. goto done;
  2069. }
  2070. p->mark = _mark;
  2071. D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  2072. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
  2073. }
  2074. { // &'if' if_stmt
  2075. if (p->error_indicator) {
  2076. p->level--;
  2077. return NULL;
  2078. }
  2079. D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
  2080. stmt_ty if_stmt_var;
  2081. if (
  2082. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 642) // token='if'
  2083. &&
  2084. (if_stmt_var = if_stmt_rule(p)) // if_stmt
  2085. )
  2086. {
  2087. D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
  2088. _res = if_stmt_var;
  2089. goto done;
  2090. }
  2091. p->mark = _mark;
  2092. D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  2093. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'if' if_stmt"));
  2094. }
  2095. { // &('class' | '@') class_def
  2096. if (p->error_indicator) {
  2097. p->level--;
  2098. return NULL;
  2099. }
  2100. D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
  2101. stmt_ty class_def_var;
  2102. if (
  2103. _PyPegen_lookahead(1, _tmp_8_rule, p)
  2104. &&
  2105. (class_def_var = class_def_rule(p)) // class_def
  2106. )
  2107. {
  2108. D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
  2109. _res = class_def_var;
  2110. goto done;
  2111. }
  2112. p->mark = _mark;
  2113. D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  2114. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('class' | '@') class_def"));
  2115. }
  2116. { // &('with' | ASYNC) with_stmt
  2117. if (p->error_indicator) {
  2118. p->level--;
  2119. return NULL;
  2120. }
  2121. D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
  2122. stmt_ty with_stmt_var;
  2123. if (
  2124. _PyPegen_lookahead(1, _tmp_9_rule, p)
  2125. &&
  2126. (with_stmt_var = with_stmt_rule(p)) // with_stmt
  2127. )
  2128. {
  2129. D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
  2130. _res = with_stmt_var;
  2131. goto done;
  2132. }
  2133. p->mark = _mark;
  2134. D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  2135. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('with' | ASYNC) with_stmt"));
  2136. }
  2137. { // &('for' | ASYNC) for_stmt
  2138. if (p->error_indicator) {
  2139. p->level--;
  2140. return NULL;
  2141. }
  2142. D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
  2143. stmt_ty for_stmt_var;
  2144. if (
  2145. _PyPegen_lookahead(1, _tmp_10_rule, p)
  2146. &&
  2147. (for_stmt_var = for_stmt_rule(p)) // for_stmt
  2148. )
  2149. {
  2150. D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
  2151. _res = for_stmt_var;
  2152. goto done;
  2153. }
  2154. p->mark = _mark;
  2155. D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  2156. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('for' | ASYNC) for_stmt"));
  2157. }
  2158. { // &'try' try_stmt
  2159. if (p->error_indicator) {
  2160. p->level--;
  2161. return NULL;
  2162. }
  2163. D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
  2164. stmt_ty try_stmt_var;
  2165. if (
  2166. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 624) // token='try'
  2167. &&
  2168. (try_stmt_var = try_stmt_rule(p)) // try_stmt
  2169. )
  2170. {
  2171. D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
  2172. _res = try_stmt_var;
  2173. goto done;
  2174. }
  2175. p->mark = _mark;
  2176. D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  2177. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'try' try_stmt"));
  2178. }
  2179. { // &'while' while_stmt
  2180. if (p->error_indicator) {
  2181. p->level--;
  2182. return NULL;
  2183. }
  2184. D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
  2185. stmt_ty while_stmt_var;
  2186. if (
  2187. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 647) // token='while'
  2188. &&
  2189. (while_stmt_var = while_stmt_rule(p)) // while_stmt
  2190. )
  2191. {
  2192. D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
  2193. _res = while_stmt_var;
  2194. goto done;
  2195. }
  2196. p->mark = _mark;
  2197. D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  2198. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'while' while_stmt"));
  2199. }
  2200. { // match_stmt
  2201. if (p->error_indicator) {
  2202. p->level--;
  2203. return NULL;
  2204. }
  2205. D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "match_stmt"));
  2206. stmt_ty match_stmt_var;
  2207. if (
  2208. (match_stmt_var = match_stmt_rule(p)) // match_stmt
  2209. )
  2210. {
  2211. D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "match_stmt"));
  2212. _res = match_stmt_var;
  2213. goto done;
  2214. }
  2215. p->mark = _mark;
  2216. D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  2217. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "match_stmt"));
  2218. }
  2219. _res = NULL;
  2220. done:
  2221. p->level--;
  2222. return _res;
  2223. }
  2224. // assignment:
  2225. // | NAME ':' expression ['=' annotated_rhs]
  2226. // | ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
  2227. // | ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
  2228. // | single_target augassign ~ (yield_expr | star_expressions)
  2229. // | invalid_assignment
  2230. static stmt_ty
  2231. assignment_rule(Parser *p)
  2232. {
  2233. if (p->level++ == MAXSTACK) {
  2234. _Pypegen_stack_overflow(p);
  2235. }
  2236. if (p->error_indicator) {
  2237. p->level--;
  2238. return NULL;
  2239. }
  2240. stmt_ty _res = NULL;
  2241. int _mark = p->mark;
  2242. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  2243. p->error_indicator = 1;
  2244. p->level--;
  2245. return NULL;
  2246. }
  2247. int _start_lineno = p->tokens[_mark]->lineno;
  2248. UNUSED(_start_lineno); // Only used by EXTRA macro
  2249. int _start_col_offset = p->tokens[_mark]->col_offset;
  2250. UNUSED(_start_col_offset); // Only used by EXTRA macro
  2251. { // NAME ':' expression ['=' annotated_rhs]
  2252. if (p->error_indicator) {
  2253. p->level--;
  2254. return NULL;
  2255. }
  2256. D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
  2257. Token * _literal;
  2258. expr_ty a;
  2259. expr_ty b;
  2260. void *c;
  2261. if (
  2262. (a = _PyPegen_name_token(p)) // NAME
  2263. &&
  2264. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  2265. &&
  2266. (b = expression_rule(p)) // expression
  2267. &&
  2268. (c = _tmp_11_rule(p), !p->error_indicator) // ['=' annotated_rhs]
  2269. )
  2270. {
  2271. D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
  2272. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  2273. if (_token == NULL) {
  2274. p->level--;
  2275. return NULL;
  2276. }
  2277. int _end_lineno = _token->end_lineno;
  2278. UNUSED(_end_lineno); // Only used by EXTRA macro
  2279. int _end_col_offset = _token->end_col_offset;
  2280. UNUSED(_end_col_offset); // Only used by EXTRA macro
  2281. _res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotation syntax is" , _PyAST_AnnAssign ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA ) );
  2282. if (_res == NULL && PyErr_Occurred()) {
  2283. p->error_indicator = 1;
  2284. p->level--;
  2285. return NULL;
  2286. }
  2287. goto done;
  2288. }
  2289. p->mark = _mark;
  2290. D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
  2291. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
  2292. }
  2293. { // ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
  2294. if (p->error_indicator) {
  2295. p->level--;
  2296. return NULL;
  2297. }
  2298. D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
  2299. Token * _literal;
  2300. void *a;
  2301. expr_ty b;
  2302. void *c;
  2303. if (
  2304. (a = _tmp_12_rule(p)) // '(' single_target ')' | single_subscript_attribute_target
  2305. &&
  2306. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  2307. &&
  2308. (b = expression_rule(p)) // expression
  2309. &&
  2310. (c = _tmp_13_rule(p), !p->error_indicator) // ['=' annotated_rhs]
  2311. )
  2312. {
  2313. D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
  2314. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  2315. if (_token == NULL) {
  2316. p->level--;
  2317. return NULL;
  2318. }
  2319. int _end_lineno = _token->end_lineno;
  2320. UNUSED(_end_lineno); // Only used by EXTRA macro
  2321. int _end_col_offset = _token->end_col_offset;
  2322. UNUSED(_end_col_offset); // Only used by EXTRA macro
  2323. _res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotations syntax is" , _PyAST_AnnAssign ( a , b , c , 0 , EXTRA ) );
  2324. if (_res == NULL && PyErr_Occurred()) {
  2325. p->error_indicator = 1;
  2326. p->level--;
  2327. return NULL;
  2328. }
  2329. goto done;
  2330. }
  2331. p->mark = _mark;
  2332. D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
  2333. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
  2334. }
  2335. { // ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
  2336. if (p->error_indicator) {
  2337. p->level--;
  2338. return NULL;
  2339. }
  2340. D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
  2341. asdl_expr_seq* a;
  2342. void *b;
  2343. void *tc;
  2344. if (
  2345. (a = (asdl_expr_seq*)_loop1_14_rule(p)) // ((star_targets '='))+
  2346. &&
  2347. (b = _tmp_15_rule(p)) // yield_expr | star_expressions
  2348. &&
  2349. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
  2350. &&
  2351. (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
  2352. )
  2353. {
  2354. D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
  2355. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  2356. if (_token == NULL) {
  2357. p->level--;
  2358. return NULL;
  2359. }
  2360. int _end_lineno = _token->end_lineno;
  2361. UNUSED(_end_lineno); // Only used by EXTRA macro
  2362. int _end_col_offset = _token->end_col_offset;
  2363. UNUSED(_end_col_offset); // Only used by EXTRA macro
  2364. _res = _PyAST_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
  2365. if (_res == NULL && PyErr_Occurred()) {
  2366. p->error_indicator = 1;
  2367. p->level--;
  2368. return NULL;
  2369. }
  2370. goto done;
  2371. }
  2372. p->mark = _mark;
  2373. D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
  2374. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
  2375. }
  2376. { // single_target augassign ~ (yield_expr | star_expressions)
  2377. if (p->error_indicator) {
  2378. p->level--;
  2379. return NULL;
  2380. }
  2381. D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
  2382. int _cut_var = 0;
  2383. expr_ty a;
  2384. AugOperator* b;
  2385. void *c;
  2386. if (
  2387. (a = single_target_rule(p)) // single_target
  2388. &&
  2389. (b = augassign_rule(p)) // augassign
  2390. &&
  2391. (_cut_var = 1)
  2392. &&
  2393. (c = _tmp_16_rule(p)) // yield_expr | star_expressions
  2394. )
  2395. {
  2396. D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
  2397. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  2398. if (_token == NULL) {
  2399. p->level--;
  2400. return NULL;
  2401. }
  2402. int _end_lineno = _token->end_lineno;
  2403. UNUSED(_end_lineno); // Only used by EXTRA macro
  2404. int _end_col_offset = _token->end_col_offset;
  2405. UNUSED(_end_col_offset); // Only used by EXTRA macro
  2406. _res = _PyAST_AugAssign ( a , b -> kind , c , EXTRA );
  2407. if (_res == NULL && PyErr_Occurred()) {
  2408. p->error_indicator = 1;
  2409. p->level--;
  2410. return NULL;
  2411. }
  2412. goto done;
  2413. }
  2414. p->mark = _mark;
  2415. D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
  2416. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
  2417. if (_cut_var) {
  2418. p->level--;
  2419. return NULL;
  2420. }
  2421. }
  2422. if (p->call_invalid_rules) { // invalid_assignment
  2423. if (p->error_indicator) {
  2424. p->level--;
  2425. return NULL;
  2426. }
  2427. D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
  2428. void *invalid_assignment_var;
  2429. if (
  2430. (invalid_assignment_var = invalid_assignment_rule(p)) // invalid_assignment
  2431. )
  2432. {
  2433. D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
  2434. _res = invalid_assignment_var;
  2435. goto done;
  2436. }
  2437. p->mark = _mark;
  2438. D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
  2439. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_assignment"));
  2440. }
  2441. _res = NULL;
  2442. done:
  2443. p->level--;
  2444. return _res;
  2445. }
  2446. // annotated_rhs: yield_expr | star_expressions
  2447. static expr_ty
  2448. annotated_rhs_rule(Parser *p)
  2449. {
  2450. if (p->level++ == MAXSTACK) {
  2451. _Pypegen_stack_overflow(p);
  2452. }
  2453. if (p->error_indicator) {
  2454. p->level--;
  2455. return NULL;
  2456. }
  2457. expr_ty _res = NULL;
  2458. int _mark = p->mark;
  2459. { // yield_expr
  2460. if (p->error_indicator) {
  2461. p->level--;
  2462. return NULL;
  2463. }
  2464. D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  2465. expr_ty yield_expr_var;
  2466. if (
  2467. (yield_expr_var = yield_expr_rule(p)) // yield_expr
  2468. )
  2469. {
  2470. D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  2471. _res = yield_expr_var;
  2472. goto done;
  2473. }
  2474. p->mark = _mark;
  2475. D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
  2476. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
  2477. }
  2478. { // star_expressions
  2479. if (p->error_indicator) {
  2480. p->level--;
  2481. return NULL;
  2482. }
  2483. D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  2484. expr_ty star_expressions_var;
  2485. if (
  2486. (star_expressions_var = star_expressions_rule(p)) // star_expressions
  2487. )
  2488. {
  2489. D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  2490. _res = star_expressions_var;
  2491. goto done;
  2492. }
  2493. p->mark = _mark;
  2494. D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
  2495. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
  2496. }
  2497. _res = NULL;
  2498. done:
  2499. p->level--;
  2500. return _res;
  2501. }
  2502. // augassign:
  2503. // | '+='
  2504. // | '-='
  2505. // | '*='
  2506. // | '@='
  2507. // | '/='
  2508. // | '%='
  2509. // | '&='
  2510. // | '|='
  2511. // | '^='
  2512. // | '<<='
  2513. // | '>>='
  2514. // | '**='
  2515. // | '//='
  2516. static AugOperator*
  2517. augassign_rule(Parser *p)
  2518. {
  2519. if (p->level++ == MAXSTACK) {
  2520. _Pypegen_stack_overflow(p);
  2521. }
  2522. if (p->error_indicator) {
  2523. p->level--;
  2524. return NULL;
  2525. }
  2526. AugOperator* _res = NULL;
  2527. int _mark = p->mark;
  2528. { // '+='
  2529. if (p->error_indicator) {
  2530. p->level--;
  2531. return NULL;
  2532. }
  2533. D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+='"));
  2534. Token * _literal;
  2535. if (
  2536. (_literal = _PyPegen_expect_token(p, 36)) // token='+='
  2537. )
  2538. {
  2539. D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+='"));
  2540. _res = _PyPegen_augoperator ( p , Add );
  2541. if (_res == NULL && PyErr_Occurred()) {
  2542. p->error_indicator = 1;
  2543. p->level--;
  2544. return NULL;
  2545. }
  2546. goto done;
  2547. }
  2548. p->mark = _mark;
  2549. D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
  2550. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+='"));
  2551. }
  2552. { // '-='
  2553. if (p->error_indicator) {
  2554. p->level--;
  2555. return NULL;
  2556. }
  2557. D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-='"));
  2558. Token * _literal;
  2559. if (
  2560. (_literal = _PyPegen_expect_token(p, 37)) // token='-='
  2561. )
  2562. {
  2563. D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-='"));
  2564. _res = _PyPegen_augoperator ( p , Sub );
  2565. if (_res == NULL && PyErr_Occurred()) {
  2566. p->error_indicator = 1;
  2567. p->level--;
  2568. return NULL;
  2569. }
  2570. goto done;
  2571. }
  2572. p->mark = _mark;
  2573. D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
  2574. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-='"));
  2575. }
  2576. { // '*='
  2577. if (p->error_indicator) {
  2578. p->level--;
  2579. return NULL;
  2580. }
  2581. D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*='"));
  2582. Token * _literal;
  2583. if (
  2584. (_literal = _PyPegen_expect_token(p, 38)) // token='*='
  2585. )
  2586. {
  2587. D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*='"));
  2588. _res = _PyPegen_augoperator ( p , Mult );
  2589. if (_res == NULL && PyErr_Occurred()) {
  2590. p->error_indicator = 1;
  2591. p->level--;
  2592. return NULL;
  2593. }
  2594. goto done;
  2595. }
  2596. p->mark = _mark;
  2597. D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
  2598. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*='"));
  2599. }
  2600. { // '@='
  2601. if (p->error_indicator) {
  2602. p->level--;
  2603. return NULL;
  2604. }
  2605. D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@='"));
  2606. Token * _literal;
  2607. if (
  2608. (_literal = _PyPegen_expect_token(p, 50)) // token='@='
  2609. )
  2610. {
  2611. D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@='"));
  2612. _res = CHECK_VERSION ( AugOperator* , 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) );
  2613. if (_res == NULL && PyErr_Occurred()) {
  2614. p->error_indicator = 1;
  2615. p->level--;
  2616. return NULL;
  2617. }
  2618. goto done;
  2619. }
  2620. p->mark = _mark;
  2621. D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
  2622. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@='"));
  2623. }
  2624. { // '/='
  2625. if (p->error_indicator) {
  2626. p->level--;
  2627. return NULL;
  2628. }
  2629. D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/='"));
  2630. Token * _literal;
  2631. if (
  2632. (_literal = _PyPegen_expect_token(p, 39)) // token='/='
  2633. )
  2634. {
  2635. D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/='"));
  2636. _res = _PyPegen_augoperator ( p , Div );
  2637. if (_res == NULL && PyErr_Occurred()) {
  2638. p->error_indicator = 1;
  2639. p->level--;
  2640. return NULL;
  2641. }
  2642. goto done;
  2643. }
  2644. p->mark = _mark;
  2645. D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
  2646. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/='"));
  2647. }
  2648. { // '%='
  2649. if (p->error_indicator) {
  2650. p->level--;
  2651. return NULL;
  2652. }
  2653. D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'%='"));
  2654. Token * _literal;
  2655. if (
  2656. (_literal = _PyPegen_expect_token(p, 40)) // token='%='
  2657. )
  2658. {
  2659. D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%='"));
  2660. _res = _PyPegen_augoperator ( p , Mod );
  2661. if (_res == NULL && PyErr_Occurred()) {
  2662. p->error_indicator = 1;
  2663. p->level--;
  2664. return NULL;
  2665. }
  2666. goto done;
  2667. }
  2668. p->mark = _mark;
  2669. D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
  2670. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%='"));
  2671. }
  2672. { // '&='
  2673. if (p->error_indicator) {
  2674. p->level--;
  2675. return NULL;
  2676. }
  2677. D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'&='"));
  2678. Token * _literal;
  2679. if (
  2680. (_literal = _PyPegen_expect_token(p, 41)) // token='&='
  2681. )
  2682. {
  2683. D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'&='"));
  2684. _res = _PyPegen_augoperator ( p , BitAnd );
  2685. if (_res == NULL && PyErr_Occurred()) {
  2686. p->error_indicator = 1;
  2687. p->level--;
  2688. return NULL;
  2689. }
  2690. goto done;
  2691. }
  2692. p->mark = _mark;
  2693. D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
  2694. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'&='"));
  2695. }
  2696. { // '|='
  2697. if (p->error_indicator) {
  2698. p->level--;
  2699. return NULL;
  2700. }
  2701. D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|='"));
  2702. Token * _literal;
  2703. if (
  2704. (_literal = _PyPegen_expect_token(p, 42)) // token='|='
  2705. )
  2706. {
  2707. D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|='"));
  2708. _res = _PyPegen_augoperator ( p , BitOr );
  2709. if (_res == NULL && PyErr_Occurred()) {
  2710. p->error_indicator = 1;
  2711. p->level--;
  2712. return NULL;
  2713. }
  2714. goto done;
  2715. }
  2716. p->mark = _mark;
  2717. D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
  2718. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|='"));
  2719. }
  2720. { // '^='
  2721. if (p->error_indicator) {
  2722. p->level--;
  2723. return NULL;
  2724. }
  2725. D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'^='"));
  2726. Token * _literal;
  2727. if (
  2728. (_literal = _PyPegen_expect_token(p, 43)) // token='^='
  2729. )
  2730. {
  2731. D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'^='"));
  2732. _res = _PyPegen_augoperator ( p , BitXor );
  2733. if (_res == NULL && PyErr_Occurred()) {
  2734. p->error_indicator = 1;
  2735. p->level--;
  2736. return NULL;
  2737. }
  2738. goto done;
  2739. }
  2740. p->mark = _mark;
  2741. D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
  2742. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'^='"));
  2743. }
  2744. { // '<<='
  2745. if (p->error_indicator) {
  2746. p->level--;
  2747. return NULL;
  2748. }
  2749. D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<<='"));
  2750. Token * _literal;
  2751. if (
  2752. (_literal = _PyPegen_expect_token(p, 44)) // token='<<='
  2753. )
  2754. {
  2755. D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<<='"));
  2756. _res = _PyPegen_augoperator ( p , LShift );
  2757. if (_res == NULL && PyErr_Occurred()) {
  2758. p->error_indicator = 1;
  2759. p->level--;
  2760. return NULL;
  2761. }
  2762. goto done;
  2763. }
  2764. p->mark = _mark;
  2765. D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
  2766. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<<='"));
  2767. }
  2768. { // '>>='
  2769. if (p->error_indicator) {
  2770. p->level--;
  2771. return NULL;
  2772. }
  2773. D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>>='"));
  2774. Token * _literal;
  2775. if (
  2776. (_literal = _PyPegen_expect_token(p, 45)) // token='>>='
  2777. )
  2778. {
  2779. D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>>='"));
  2780. _res = _PyPegen_augoperator ( p , RShift );
  2781. if (_res == NULL && PyErr_Occurred()) {
  2782. p->error_indicator = 1;
  2783. p->level--;
  2784. return NULL;
  2785. }
  2786. goto done;
  2787. }
  2788. p->mark = _mark;
  2789. D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
  2790. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>>='"));
  2791. }
  2792. { // '**='
  2793. if (p->error_indicator) {
  2794. p->level--;
  2795. return NULL;
  2796. }
  2797. D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**='"));
  2798. Token * _literal;
  2799. if (
  2800. (_literal = _PyPegen_expect_token(p, 46)) // token='**='
  2801. )
  2802. {
  2803. D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**='"));
  2804. _res = _PyPegen_augoperator ( p , Pow );
  2805. if (_res == NULL && PyErr_Occurred()) {
  2806. p->error_indicator = 1;
  2807. p->level--;
  2808. return NULL;
  2809. }
  2810. goto done;
  2811. }
  2812. p->mark = _mark;
  2813. D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
  2814. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**='"));
  2815. }
  2816. { // '//='
  2817. if (p->error_indicator) {
  2818. p->level--;
  2819. return NULL;
  2820. }
  2821. D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'//='"));
  2822. Token * _literal;
  2823. if (
  2824. (_literal = _PyPegen_expect_token(p, 48)) // token='//='
  2825. )
  2826. {
  2827. D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//='"));
  2828. _res = _PyPegen_augoperator ( p , FloorDiv );
  2829. if (_res == NULL && PyErr_Occurred()) {
  2830. p->error_indicator = 1;
  2831. p->level--;
  2832. return NULL;
  2833. }
  2834. goto done;
  2835. }
  2836. p->mark = _mark;
  2837. D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
  2838. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//='"));
  2839. }
  2840. _res = NULL;
  2841. done:
  2842. p->level--;
  2843. return _res;
  2844. }
  2845. // return_stmt: 'return' star_expressions?
  2846. static stmt_ty
  2847. return_stmt_rule(Parser *p)
  2848. {
  2849. if (p->level++ == MAXSTACK) {
  2850. _Pypegen_stack_overflow(p);
  2851. }
  2852. if (p->error_indicator) {
  2853. p->level--;
  2854. return NULL;
  2855. }
  2856. stmt_ty _res = NULL;
  2857. int _mark = p->mark;
  2858. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  2859. p->error_indicator = 1;
  2860. p->level--;
  2861. return NULL;
  2862. }
  2863. int _start_lineno = p->tokens[_mark]->lineno;
  2864. UNUSED(_start_lineno); // Only used by EXTRA macro
  2865. int _start_col_offset = p->tokens[_mark]->col_offset;
  2866. UNUSED(_start_col_offset); // Only used by EXTRA macro
  2867. { // 'return' star_expressions?
  2868. if (p->error_indicator) {
  2869. p->level--;
  2870. return NULL;
  2871. }
  2872. D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
  2873. Token * _keyword;
  2874. void *a;
  2875. if (
  2876. (_keyword = _PyPegen_expect_token(p, 519)) // token='return'
  2877. &&
  2878. (a = star_expressions_rule(p), !p->error_indicator) // star_expressions?
  2879. )
  2880. {
  2881. D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
  2882. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  2883. if (_token == NULL) {
  2884. p->level--;
  2885. return NULL;
  2886. }
  2887. int _end_lineno = _token->end_lineno;
  2888. UNUSED(_end_lineno); // Only used by EXTRA macro
  2889. int _end_col_offset = _token->end_col_offset;
  2890. UNUSED(_end_col_offset); // Only used by EXTRA macro
  2891. _res = _PyAST_Return ( a , EXTRA );
  2892. if (_res == NULL && PyErr_Occurred()) {
  2893. p->error_indicator = 1;
  2894. p->level--;
  2895. return NULL;
  2896. }
  2897. goto done;
  2898. }
  2899. p->mark = _mark;
  2900. D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  2901. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?"));
  2902. }
  2903. _res = NULL;
  2904. done:
  2905. p->level--;
  2906. return _res;
  2907. }
  2908. // raise_stmt: 'raise' expression ['from' expression] | 'raise'
  2909. static stmt_ty
  2910. raise_stmt_rule(Parser *p)
  2911. {
  2912. if (p->level++ == MAXSTACK) {
  2913. _Pypegen_stack_overflow(p);
  2914. }
  2915. if (p->error_indicator) {
  2916. p->level--;
  2917. return NULL;
  2918. }
  2919. stmt_ty _res = NULL;
  2920. int _mark = p->mark;
  2921. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  2922. p->error_indicator = 1;
  2923. p->level--;
  2924. return NULL;
  2925. }
  2926. int _start_lineno = p->tokens[_mark]->lineno;
  2927. UNUSED(_start_lineno); // Only used by EXTRA macro
  2928. int _start_col_offset = p->tokens[_mark]->col_offset;
  2929. UNUSED(_start_col_offset); // Only used by EXTRA macro
  2930. { // 'raise' expression ['from' expression]
  2931. if (p->error_indicator) {
  2932. p->level--;
  2933. return NULL;
  2934. }
  2935. D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
  2936. Token * _keyword;
  2937. expr_ty a;
  2938. void *b;
  2939. if (
  2940. (_keyword = _PyPegen_expect_token(p, 522)) // token='raise'
  2941. &&
  2942. (a = expression_rule(p)) // expression
  2943. &&
  2944. (b = _tmp_17_rule(p), !p->error_indicator) // ['from' expression]
  2945. )
  2946. {
  2947. D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
  2948. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  2949. if (_token == NULL) {
  2950. p->level--;
  2951. return NULL;
  2952. }
  2953. int _end_lineno = _token->end_lineno;
  2954. UNUSED(_end_lineno); // Only used by EXTRA macro
  2955. int _end_col_offset = _token->end_col_offset;
  2956. UNUSED(_end_col_offset); // Only used by EXTRA macro
  2957. _res = _PyAST_Raise ( a , b , EXTRA );
  2958. if (_res == NULL && PyErr_Occurred()) {
  2959. p->error_indicator = 1;
  2960. p->level--;
  2961. return NULL;
  2962. }
  2963. goto done;
  2964. }
  2965. p->mark = _mark;
  2966. D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  2967. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]"));
  2968. }
  2969. { // 'raise'
  2970. if (p->error_indicator) {
  2971. p->level--;
  2972. return NULL;
  2973. }
  2974. D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'"));
  2975. Token * _keyword;
  2976. if (
  2977. (_keyword = _PyPegen_expect_token(p, 522)) // token='raise'
  2978. )
  2979. {
  2980. D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'"));
  2981. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  2982. if (_token == NULL) {
  2983. p->level--;
  2984. return NULL;
  2985. }
  2986. int _end_lineno = _token->end_lineno;
  2987. UNUSED(_end_lineno); // Only used by EXTRA macro
  2988. int _end_col_offset = _token->end_col_offset;
  2989. UNUSED(_end_col_offset); // Only used by EXTRA macro
  2990. _res = _PyAST_Raise ( NULL , NULL , EXTRA );
  2991. if (_res == NULL && PyErr_Occurred()) {
  2992. p->error_indicator = 1;
  2993. p->level--;
  2994. return NULL;
  2995. }
  2996. goto done;
  2997. }
  2998. p->mark = _mark;
  2999. D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  3000. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'"));
  3001. }
  3002. _res = NULL;
  3003. done:
  3004. p->level--;
  3005. return _res;
  3006. }
  3007. // global_stmt: 'global' ','.NAME+
  3008. static stmt_ty
  3009. global_stmt_rule(Parser *p)
  3010. {
  3011. if (p->level++ == MAXSTACK) {
  3012. _Pypegen_stack_overflow(p);
  3013. }
  3014. if (p->error_indicator) {
  3015. p->level--;
  3016. return NULL;
  3017. }
  3018. stmt_ty _res = NULL;
  3019. int _mark = p->mark;
  3020. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  3021. p->error_indicator = 1;
  3022. p->level--;
  3023. return NULL;
  3024. }
  3025. int _start_lineno = p->tokens[_mark]->lineno;
  3026. UNUSED(_start_lineno); // Only used by EXTRA macro
  3027. int _start_col_offset = p->tokens[_mark]->col_offset;
  3028. UNUSED(_start_col_offset); // Only used by EXTRA macro
  3029. { // 'global' ','.NAME+
  3030. if (p->error_indicator) {
  3031. p->level--;
  3032. return NULL;
  3033. }
  3034. D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
  3035. Token * _keyword;
  3036. asdl_expr_seq* a;
  3037. if (
  3038. (_keyword = _PyPegen_expect_token(p, 523)) // token='global'
  3039. &&
  3040. (a = (asdl_expr_seq*)_gather_18_rule(p)) // ','.NAME+
  3041. )
  3042. {
  3043. D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
  3044. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  3045. if (_token == NULL) {
  3046. p->level--;
  3047. return NULL;
  3048. }
  3049. int _end_lineno = _token->end_lineno;
  3050. UNUSED(_end_lineno); // Only used by EXTRA macro
  3051. int _end_col_offset = _token->end_col_offset;
  3052. UNUSED(_end_col_offset); // Only used by EXTRA macro
  3053. _res = _PyAST_Global ( CHECK ( asdl_identifier_seq* , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
  3054. if (_res == NULL && PyErr_Occurred()) {
  3055. p->error_indicator = 1;
  3056. p->level--;
  3057. return NULL;
  3058. }
  3059. goto done;
  3060. }
  3061. p->mark = _mark;
  3062. D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  3063. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+"));
  3064. }
  3065. _res = NULL;
  3066. done:
  3067. p->level--;
  3068. return _res;
  3069. }
  3070. // nonlocal_stmt: 'nonlocal' ','.NAME+
  3071. static stmt_ty
  3072. nonlocal_stmt_rule(Parser *p)
  3073. {
  3074. if (p->level++ == MAXSTACK) {
  3075. _Pypegen_stack_overflow(p);
  3076. }
  3077. if (p->error_indicator) {
  3078. p->level--;
  3079. return NULL;
  3080. }
  3081. stmt_ty _res = NULL;
  3082. int _mark = p->mark;
  3083. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  3084. p->error_indicator = 1;
  3085. p->level--;
  3086. return NULL;
  3087. }
  3088. int _start_lineno = p->tokens[_mark]->lineno;
  3089. UNUSED(_start_lineno); // Only used by EXTRA macro
  3090. int _start_col_offset = p->tokens[_mark]->col_offset;
  3091. UNUSED(_start_col_offset); // Only used by EXTRA macro
  3092. { // 'nonlocal' ','.NAME+
  3093. if (p->error_indicator) {
  3094. p->level--;
  3095. return NULL;
  3096. }
  3097. D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
  3098. Token * _keyword;
  3099. asdl_expr_seq* a;
  3100. if (
  3101. (_keyword = _PyPegen_expect_token(p, 524)) // token='nonlocal'
  3102. &&
  3103. (a = (asdl_expr_seq*)_gather_20_rule(p)) // ','.NAME+
  3104. )
  3105. {
  3106. D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
  3107. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  3108. if (_token == NULL) {
  3109. p->level--;
  3110. return NULL;
  3111. }
  3112. int _end_lineno = _token->end_lineno;
  3113. UNUSED(_end_lineno); // Only used by EXTRA macro
  3114. int _end_col_offset = _token->end_col_offset;
  3115. UNUSED(_end_col_offset); // Only used by EXTRA macro
  3116. _res = _PyAST_Nonlocal ( CHECK ( asdl_identifier_seq* , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
  3117. if (_res == NULL && PyErr_Occurred()) {
  3118. p->error_indicator = 1;
  3119. p->level--;
  3120. return NULL;
  3121. }
  3122. goto done;
  3123. }
  3124. p->mark = _mark;
  3125. D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  3126. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+"));
  3127. }
  3128. _res = NULL;
  3129. done:
  3130. p->level--;
  3131. return _res;
  3132. }
  3133. // del_stmt: 'del' del_targets &(';' | NEWLINE) | invalid_del_stmt
  3134. static stmt_ty
  3135. del_stmt_rule(Parser *p)
  3136. {
  3137. if (p->level++ == MAXSTACK) {
  3138. _Pypegen_stack_overflow(p);
  3139. }
  3140. if (p->error_indicator) {
  3141. p->level--;
  3142. return NULL;
  3143. }
  3144. stmt_ty _res = NULL;
  3145. int _mark = p->mark;
  3146. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  3147. p->error_indicator = 1;
  3148. p->level--;
  3149. return NULL;
  3150. }
  3151. int _start_lineno = p->tokens[_mark]->lineno;
  3152. UNUSED(_start_lineno); // Only used by EXTRA macro
  3153. int _start_col_offset = p->tokens[_mark]->col_offset;
  3154. UNUSED(_start_col_offset); // Only used by EXTRA macro
  3155. { // 'del' del_targets &(';' | NEWLINE)
  3156. if (p->error_indicator) {
  3157. p->level--;
  3158. return NULL;
  3159. }
  3160. D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
  3161. Token * _keyword;
  3162. asdl_expr_seq* a;
  3163. if (
  3164. (_keyword = _PyPegen_expect_token(p, 604)) // token='del'
  3165. &&
  3166. (a = del_targets_rule(p)) // del_targets
  3167. &&
  3168. _PyPegen_lookahead(1, _tmp_22_rule, p)
  3169. )
  3170. {
  3171. D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
  3172. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  3173. if (_token == NULL) {
  3174. p->level--;
  3175. return NULL;
  3176. }
  3177. int _end_lineno = _token->end_lineno;
  3178. UNUSED(_end_lineno); // Only used by EXTRA macro
  3179. int _end_col_offset = _token->end_col_offset;
  3180. UNUSED(_end_col_offset); // Only used by EXTRA macro
  3181. _res = _PyAST_Delete ( a , EXTRA );
  3182. if (_res == NULL && PyErr_Occurred()) {
  3183. p->error_indicator = 1;
  3184. p->level--;
  3185. return NULL;
  3186. }
  3187. goto done;
  3188. }
  3189. p->mark = _mark;
  3190. D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  3191. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
  3192. }
  3193. if (p->call_invalid_rules) { // invalid_del_stmt
  3194. if (p->error_indicator) {
  3195. p->level--;
  3196. return NULL;
  3197. }
  3198. D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
  3199. void *invalid_del_stmt_var;
  3200. if (
  3201. (invalid_del_stmt_var = invalid_del_stmt_rule(p)) // invalid_del_stmt
  3202. )
  3203. {
  3204. D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
  3205. _res = invalid_del_stmt_var;
  3206. goto done;
  3207. }
  3208. p->mark = _mark;
  3209. D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  3210. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_stmt"));
  3211. }
  3212. _res = NULL;
  3213. done:
  3214. p->level--;
  3215. return _res;
  3216. }
  3217. // yield_stmt: yield_expr
  3218. static stmt_ty
  3219. yield_stmt_rule(Parser *p)
  3220. {
  3221. if (p->level++ == MAXSTACK) {
  3222. _Pypegen_stack_overflow(p);
  3223. }
  3224. if (p->error_indicator) {
  3225. p->level--;
  3226. return NULL;
  3227. }
  3228. stmt_ty _res = NULL;
  3229. int _mark = p->mark;
  3230. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  3231. p->error_indicator = 1;
  3232. p->level--;
  3233. return NULL;
  3234. }
  3235. int _start_lineno = p->tokens[_mark]->lineno;
  3236. UNUSED(_start_lineno); // Only used by EXTRA macro
  3237. int _start_col_offset = p->tokens[_mark]->col_offset;
  3238. UNUSED(_start_col_offset); // Only used by EXTRA macro
  3239. { // yield_expr
  3240. if (p->error_indicator) {
  3241. p->level--;
  3242. return NULL;
  3243. }
  3244. D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  3245. expr_ty y;
  3246. if (
  3247. (y = yield_expr_rule(p)) // yield_expr
  3248. )
  3249. {
  3250. D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  3251. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  3252. if (_token == NULL) {
  3253. p->level--;
  3254. return NULL;
  3255. }
  3256. int _end_lineno = _token->end_lineno;
  3257. UNUSED(_end_lineno); // Only used by EXTRA macro
  3258. int _end_col_offset = _token->end_col_offset;
  3259. UNUSED(_end_col_offset); // Only used by EXTRA macro
  3260. _res = _PyAST_Expr ( y , EXTRA );
  3261. if (_res == NULL && PyErr_Occurred()) {
  3262. p->error_indicator = 1;
  3263. p->level--;
  3264. return NULL;
  3265. }
  3266. goto done;
  3267. }
  3268. p->mark = _mark;
  3269. D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  3270. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
  3271. }
  3272. _res = NULL;
  3273. done:
  3274. p->level--;
  3275. return _res;
  3276. }
  3277. // assert_stmt: 'assert' expression [',' expression]
  3278. static stmt_ty
  3279. assert_stmt_rule(Parser *p)
  3280. {
  3281. if (p->level++ == MAXSTACK) {
  3282. _Pypegen_stack_overflow(p);
  3283. }
  3284. if (p->error_indicator) {
  3285. p->level--;
  3286. return NULL;
  3287. }
  3288. stmt_ty _res = NULL;
  3289. int _mark = p->mark;
  3290. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  3291. p->error_indicator = 1;
  3292. p->level--;
  3293. return NULL;
  3294. }
  3295. int _start_lineno = p->tokens[_mark]->lineno;
  3296. UNUSED(_start_lineno); // Only used by EXTRA macro
  3297. int _start_col_offset = p->tokens[_mark]->col_offset;
  3298. UNUSED(_start_col_offset); // Only used by EXTRA macro
  3299. { // 'assert' expression [',' expression]
  3300. if (p->error_indicator) {
  3301. p->level--;
  3302. return NULL;
  3303. }
  3304. D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
  3305. Token * _keyword;
  3306. expr_ty a;
  3307. void *b;
  3308. if (
  3309. (_keyword = _PyPegen_expect_token(p, 526)) // token='assert'
  3310. &&
  3311. (a = expression_rule(p)) // expression
  3312. &&
  3313. (b = _tmp_23_rule(p), !p->error_indicator) // [',' expression]
  3314. )
  3315. {
  3316. D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
  3317. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  3318. if (_token == NULL) {
  3319. p->level--;
  3320. return NULL;
  3321. }
  3322. int _end_lineno = _token->end_lineno;
  3323. UNUSED(_end_lineno); // Only used by EXTRA macro
  3324. int _end_col_offset = _token->end_col_offset;
  3325. UNUSED(_end_col_offset); // Only used by EXTRA macro
  3326. _res = _PyAST_Assert ( a , b , EXTRA );
  3327. if (_res == NULL && PyErr_Occurred()) {
  3328. p->error_indicator = 1;
  3329. p->level--;
  3330. return NULL;
  3331. }
  3332. goto done;
  3333. }
  3334. p->mark = _mark;
  3335. D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  3336. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]"));
  3337. }
  3338. _res = NULL;
  3339. done:
  3340. p->level--;
  3341. return _res;
  3342. }
  3343. // import_stmt: invalid_import | import_name | import_from
  3344. static stmt_ty
  3345. import_stmt_rule(Parser *p)
  3346. {
  3347. if (p->level++ == MAXSTACK) {
  3348. _Pypegen_stack_overflow(p);
  3349. }
  3350. if (p->error_indicator) {
  3351. p->level--;
  3352. return NULL;
  3353. }
  3354. stmt_ty _res = NULL;
  3355. int _mark = p->mark;
  3356. if (p->call_invalid_rules) { // invalid_import
  3357. if (p->error_indicator) {
  3358. p->level--;
  3359. return NULL;
  3360. }
  3361. D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import"));
  3362. void *invalid_import_var;
  3363. if (
  3364. (invalid_import_var = invalid_import_rule(p)) // invalid_import
  3365. )
  3366. {
  3367. D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import"));
  3368. _res = invalid_import_var;
  3369. goto done;
  3370. }
  3371. p->mark = _mark;
  3372. D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  3373. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import"));
  3374. }
  3375. { // import_name
  3376. if (p->error_indicator) {
  3377. p->level--;
  3378. return NULL;
  3379. }
  3380. D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_name"));
  3381. stmt_ty import_name_var;
  3382. if (
  3383. (import_name_var = import_name_rule(p)) // import_name
  3384. )
  3385. {
  3386. D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_name"));
  3387. _res = import_name_var;
  3388. goto done;
  3389. }
  3390. p->mark = _mark;
  3391. D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  3392. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_name"));
  3393. }
  3394. { // import_from
  3395. if (p->error_indicator) {
  3396. p->level--;
  3397. return NULL;
  3398. }
  3399. D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from"));
  3400. stmt_ty import_from_var;
  3401. if (
  3402. (import_from_var = import_from_rule(p)) // import_from
  3403. )
  3404. {
  3405. D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from"));
  3406. _res = import_from_var;
  3407. goto done;
  3408. }
  3409. p->mark = _mark;
  3410. D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  3411. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from"));
  3412. }
  3413. _res = NULL;
  3414. done:
  3415. p->level--;
  3416. return _res;
  3417. }
  3418. // import_name: 'import' dotted_as_names
  3419. static stmt_ty
  3420. import_name_rule(Parser *p)
  3421. {
  3422. if (p->level++ == MAXSTACK) {
  3423. _Pypegen_stack_overflow(p);
  3424. }
  3425. if (p->error_indicator) {
  3426. p->level--;
  3427. return NULL;
  3428. }
  3429. stmt_ty _res = NULL;
  3430. int _mark = p->mark;
  3431. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  3432. p->error_indicator = 1;
  3433. p->level--;
  3434. return NULL;
  3435. }
  3436. int _start_lineno = p->tokens[_mark]->lineno;
  3437. UNUSED(_start_lineno); // Only used by EXTRA macro
  3438. int _start_col_offset = p->tokens[_mark]->col_offset;
  3439. UNUSED(_start_col_offset); // Only used by EXTRA macro
  3440. { // 'import' dotted_as_names
  3441. if (p->error_indicator) {
  3442. p->level--;
  3443. return NULL;
  3444. }
  3445. D(fprintf(stderr, "%*c> import_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
  3446. Token * _keyword;
  3447. asdl_alias_seq* a;
  3448. if (
  3449. (_keyword = _PyPegen_expect_token(p, 607)) // token='import'
  3450. &&
  3451. (a = dotted_as_names_rule(p)) // dotted_as_names
  3452. )
  3453. {
  3454. D(fprintf(stderr, "%*c+ import_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
  3455. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  3456. if (_token == NULL) {
  3457. p->level--;
  3458. return NULL;
  3459. }
  3460. int _end_lineno = _token->end_lineno;
  3461. UNUSED(_end_lineno); // Only used by EXTRA macro
  3462. int _end_col_offset = _token->end_col_offset;
  3463. UNUSED(_end_col_offset); // Only used by EXTRA macro
  3464. _res = _PyAST_Import ( a , EXTRA );
  3465. if (_res == NULL && PyErr_Occurred()) {
  3466. p->error_indicator = 1;
  3467. p->level--;
  3468. return NULL;
  3469. }
  3470. goto done;
  3471. }
  3472. p->mark = _mark;
  3473. D(fprintf(stderr, "%*c%s import_name[%d-%d]: %s failed!\n", p->level, ' ',
  3474. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' dotted_as_names"));
  3475. }
  3476. _res = NULL;
  3477. done:
  3478. p->level--;
  3479. return _res;
  3480. }
  3481. // import_from:
  3482. // | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
  3483. // | 'from' (('.' | '...'))+ 'import' import_from_targets
  3484. static stmt_ty
  3485. import_from_rule(Parser *p)
  3486. {
  3487. if (p->level++ == MAXSTACK) {
  3488. _Pypegen_stack_overflow(p);
  3489. }
  3490. if (p->error_indicator) {
  3491. p->level--;
  3492. return NULL;
  3493. }
  3494. stmt_ty _res = NULL;
  3495. int _mark = p->mark;
  3496. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  3497. p->error_indicator = 1;
  3498. p->level--;
  3499. return NULL;
  3500. }
  3501. int _start_lineno = p->tokens[_mark]->lineno;
  3502. UNUSED(_start_lineno); // Only used by EXTRA macro
  3503. int _start_col_offset = p->tokens[_mark]->col_offset;
  3504. UNUSED(_start_col_offset); // Only used by EXTRA macro
  3505. { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
  3506. if (p->error_indicator) {
  3507. p->level--;
  3508. return NULL;
  3509. }
  3510. D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
  3511. Token * _keyword;
  3512. Token * _keyword_1;
  3513. asdl_seq * a;
  3514. expr_ty b;
  3515. asdl_alias_seq* c;
  3516. if (
  3517. (_keyword = _PyPegen_expect_token(p, 608)) // token='from'
  3518. &&
  3519. (a = _loop0_24_rule(p)) // (('.' | '...'))*
  3520. &&
  3521. (b = dotted_name_rule(p)) // dotted_name
  3522. &&
  3523. (_keyword_1 = _PyPegen_expect_token(p, 607)) // token='import'
  3524. &&
  3525. (c = import_from_targets_rule(p)) // import_from_targets
  3526. )
  3527. {
  3528. D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
  3529. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  3530. if (_token == NULL) {
  3531. p->level--;
  3532. return NULL;
  3533. }
  3534. int _end_lineno = _token->end_lineno;
  3535. UNUSED(_end_lineno); // Only used by EXTRA macro
  3536. int _end_col_offset = _token->end_col_offset;
  3537. UNUSED(_end_col_offset); // Only used by EXTRA macro
  3538. _res = _PyAST_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA );
  3539. if (_res == NULL && PyErr_Occurred()) {
  3540. p->error_indicator = 1;
  3541. p->level--;
  3542. return NULL;
  3543. }
  3544. goto done;
  3545. }
  3546. p->mark = _mark;
  3547. D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
  3548. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
  3549. }
  3550. { // 'from' (('.' | '...'))+ 'import' import_from_targets
  3551. if (p->error_indicator) {
  3552. p->level--;
  3553. return NULL;
  3554. }
  3555. D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
  3556. Token * _keyword;
  3557. Token * _keyword_1;
  3558. asdl_seq * a;
  3559. asdl_alias_seq* b;
  3560. if (
  3561. (_keyword = _PyPegen_expect_token(p, 608)) // token='from'
  3562. &&
  3563. (a = _loop1_25_rule(p)) // (('.' | '...'))+
  3564. &&
  3565. (_keyword_1 = _PyPegen_expect_token(p, 607)) // token='import'
  3566. &&
  3567. (b = import_from_targets_rule(p)) // import_from_targets
  3568. )
  3569. {
  3570. D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
  3571. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  3572. if (_token == NULL) {
  3573. p->level--;
  3574. return NULL;
  3575. }
  3576. int _end_lineno = _token->end_lineno;
  3577. UNUSED(_end_lineno); // Only used by EXTRA macro
  3578. int _end_col_offset = _token->end_col_offset;
  3579. UNUSED(_end_col_offset); // Only used by EXTRA macro
  3580. _res = _PyAST_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA );
  3581. if (_res == NULL && PyErr_Occurred()) {
  3582. p->error_indicator = 1;
  3583. p->level--;
  3584. return NULL;
  3585. }
  3586. goto done;
  3587. }
  3588. p->mark = _mark;
  3589. D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
  3590. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
  3591. }
  3592. _res = NULL;
  3593. done:
  3594. p->level--;
  3595. return _res;
  3596. }
  3597. // import_from_targets:
  3598. // | '(' import_from_as_names ','? ')'
  3599. // | import_from_as_names !','
  3600. // | '*'
  3601. // | invalid_import_from_targets
  3602. static asdl_alias_seq*
  3603. import_from_targets_rule(Parser *p)
  3604. {
  3605. if (p->level++ == MAXSTACK) {
  3606. _Pypegen_stack_overflow(p);
  3607. }
  3608. if (p->error_indicator) {
  3609. p->level--;
  3610. return NULL;
  3611. }
  3612. asdl_alias_seq* _res = NULL;
  3613. int _mark = p->mark;
  3614. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  3615. p->error_indicator = 1;
  3616. p->level--;
  3617. return NULL;
  3618. }
  3619. int _start_lineno = p->tokens[_mark]->lineno;
  3620. UNUSED(_start_lineno); // Only used by EXTRA macro
  3621. int _start_col_offset = p->tokens[_mark]->col_offset;
  3622. UNUSED(_start_col_offset); // Only used by EXTRA macro
  3623. { // '(' import_from_as_names ','? ')'
  3624. if (p->error_indicator) {
  3625. p->level--;
  3626. return NULL;
  3627. }
  3628. D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
  3629. Token * _literal;
  3630. Token * _literal_1;
  3631. void *_opt_var;
  3632. UNUSED(_opt_var); // Silence compiler warnings
  3633. asdl_alias_seq* a;
  3634. if (
  3635. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  3636. &&
  3637. (a = import_from_as_names_rule(p)) // import_from_as_names
  3638. &&
  3639. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  3640. &&
  3641. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  3642. )
  3643. {
  3644. D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
  3645. _res = a;
  3646. if (_res == NULL && PyErr_Occurred()) {
  3647. p->error_indicator = 1;
  3648. p->level--;
  3649. return NULL;
  3650. }
  3651. goto done;
  3652. }
  3653. p->mark = _mark;
  3654. D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
  3655. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' import_from_as_names ','? ')'"));
  3656. }
  3657. { // import_from_as_names !','
  3658. if (p->error_indicator) {
  3659. p->level--;
  3660. return NULL;
  3661. }
  3662. D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
  3663. asdl_alias_seq* import_from_as_names_var;
  3664. if (
  3665. (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
  3666. &&
  3667. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
  3668. )
  3669. {
  3670. D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
  3671. _res = import_from_as_names_var;
  3672. goto done;
  3673. }
  3674. p->mark = _mark;
  3675. D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
  3676. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names !','"));
  3677. }
  3678. { // '*'
  3679. if (p->error_indicator) {
  3680. p->level--;
  3681. return NULL;
  3682. }
  3683. D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'"));
  3684. Token * _literal;
  3685. if (
  3686. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  3687. )
  3688. {
  3689. D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
  3690. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  3691. if (_token == NULL) {
  3692. p->level--;
  3693. return NULL;
  3694. }
  3695. int _end_lineno = _token->end_lineno;
  3696. UNUSED(_end_lineno); // Only used by EXTRA macro
  3697. int _end_col_offset = _token->end_col_offset;
  3698. UNUSED(_end_col_offset); // Only used by EXTRA macro
  3699. _res = ( asdl_alias_seq* ) _PyPegen_singleton_seq ( p , CHECK ( alias_ty , _PyPegen_alias_for_star ( p , EXTRA ) ) );
  3700. if (_res == NULL && PyErr_Occurred()) {
  3701. p->error_indicator = 1;
  3702. p->level--;
  3703. return NULL;
  3704. }
  3705. goto done;
  3706. }
  3707. p->mark = _mark;
  3708. D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
  3709. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'"));
  3710. }
  3711. if (p->call_invalid_rules) { // invalid_import_from_targets
  3712. if (p->error_indicator) {
  3713. p->level--;
  3714. return NULL;
  3715. }
  3716. D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
  3717. void *invalid_import_from_targets_var;
  3718. if (
  3719. (invalid_import_from_targets_var = invalid_import_from_targets_rule(p)) // invalid_import_from_targets
  3720. )
  3721. {
  3722. D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
  3723. _res = invalid_import_from_targets_var;
  3724. goto done;
  3725. }
  3726. p->mark = _mark;
  3727. D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
  3728. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import_from_targets"));
  3729. }
  3730. _res = NULL;
  3731. done:
  3732. p->level--;
  3733. return _res;
  3734. }
  3735. // import_from_as_names: ','.import_from_as_name+
  3736. static asdl_alias_seq*
  3737. import_from_as_names_rule(Parser *p)
  3738. {
  3739. if (p->level++ == MAXSTACK) {
  3740. _Pypegen_stack_overflow(p);
  3741. }
  3742. if (p->error_indicator) {
  3743. p->level--;
  3744. return NULL;
  3745. }
  3746. asdl_alias_seq* _res = NULL;
  3747. int _mark = p->mark;
  3748. { // ','.import_from_as_name+
  3749. if (p->error_indicator) {
  3750. p->level--;
  3751. return NULL;
  3752. }
  3753. D(fprintf(stderr, "%*c> import_from_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
  3754. asdl_alias_seq* a;
  3755. if (
  3756. (a = (asdl_alias_seq*)_gather_26_rule(p)) // ','.import_from_as_name+
  3757. )
  3758. {
  3759. D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
  3760. _res = a;
  3761. if (_res == NULL && PyErr_Occurred()) {
  3762. p->error_indicator = 1;
  3763. p->level--;
  3764. return NULL;
  3765. }
  3766. goto done;
  3767. }
  3768. p->mark = _mark;
  3769. D(fprintf(stderr, "%*c%s import_from_as_names[%d-%d]: %s failed!\n", p->level, ' ',
  3770. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.import_from_as_name+"));
  3771. }
  3772. _res = NULL;
  3773. done:
  3774. p->level--;
  3775. return _res;
  3776. }
  3777. // import_from_as_name: NAME ['as' NAME]
  3778. static alias_ty
  3779. import_from_as_name_rule(Parser *p)
  3780. {
  3781. if (p->level++ == MAXSTACK) {
  3782. _Pypegen_stack_overflow(p);
  3783. }
  3784. if (p->error_indicator) {
  3785. p->level--;
  3786. return NULL;
  3787. }
  3788. alias_ty _res = NULL;
  3789. int _mark = p->mark;
  3790. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  3791. p->error_indicator = 1;
  3792. p->level--;
  3793. return NULL;
  3794. }
  3795. int _start_lineno = p->tokens[_mark]->lineno;
  3796. UNUSED(_start_lineno); // Only used by EXTRA macro
  3797. int _start_col_offset = p->tokens[_mark]->col_offset;
  3798. UNUSED(_start_col_offset); // Only used by EXTRA macro
  3799. { // NAME ['as' NAME]
  3800. if (p->error_indicator) {
  3801. p->level--;
  3802. return NULL;
  3803. }
  3804. D(fprintf(stderr, "%*c> import_from_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
  3805. expr_ty a;
  3806. void *b;
  3807. if (
  3808. (a = _PyPegen_name_token(p)) // NAME
  3809. &&
  3810. (b = _tmp_28_rule(p), !p->error_indicator) // ['as' NAME]
  3811. )
  3812. {
  3813. D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
  3814. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  3815. if (_token == NULL) {
  3816. p->level--;
  3817. return NULL;
  3818. }
  3819. int _end_lineno = _token->end_lineno;
  3820. UNUSED(_end_lineno); // Only used by EXTRA macro
  3821. int _end_col_offset = _token->end_col_offset;
  3822. UNUSED(_end_col_offset); // Only used by EXTRA macro
  3823. _res = _PyAST_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , EXTRA );
  3824. if (_res == NULL && PyErr_Occurred()) {
  3825. p->error_indicator = 1;
  3826. p->level--;
  3827. return NULL;
  3828. }
  3829. goto done;
  3830. }
  3831. p->mark = _mark;
  3832. D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ',
  3833. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ['as' NAME]"));
  3834. }
  3835. _res = NULL;
  3836. done:
  3837. p->level--;
  3838. return _res;
  3839. }
  3840. // dotted_as_names: ','.dotted_as_name+
  3841. static asdl_alias_seq*
  3842. dotted_as_names_rule(Parser *p)
  3843. {
  3844. if (p->level++ == MAXSTACK) {
  3845. _Pypegen_stack_overflow(p);
  3846. }
  3847. if (p->error_indicator) {
  3848. p->level--;
  3849. return NULL;
  3850. }
  3851. asdl_alias_seq* _res = NULL;
  3852. int _mark = p->mark;
  3853. { // ','.dotted_as_name+
  3854. if (p->error_indicator) {
  3855. p->level--;
  3856. return NULL;
  3857. }
  3858. D(fprintf(stderr, "%*c> dotted_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
  3859. asdl_alias_seq* a;
  3860. if (
  3861. (a = (asdl_alias_seq*)_gather_29_rule(p)) // ','.dotted_as_name+
  3862. )
  3863. {
  3864. D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
  3865. _res = a;
  3866. if (_res == NULL && PyErr_Occurred()) {
  3867. p->error_indicator = 1;
  3868. p->level--;
  3869. return NULL;
  3870. }
  3871. goto done;
  3872. }
  3873. p->mark = _mark;
  3874. D(fprintf(stderr, "%*c%s dotted_as_names[%d-%d]: %s failed!\n", p->level, ' ',
  3875. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.dotted_as_name+"));
  3876. }
  3877. _res = NULL;
  3878. done:
  3879. p->level--;
  3880. return _res;
  3881. }
  3882. // dotted_as_name: dotted_name ['as' NAME]
  3883. static alias_ty
  3884. dotted_as_name_rule(Parser *p)
  3885. {
  3886. if (p->level++ == MAXSTACK) {
  3887. _Pypegen_stack_overflow(p);
  3888. }
  3889. if (p->error_indicator) {
  3890. p->level--;
  3891. return NULL;
  3892. }
  3893. alias_ty _res = NULL;
  3894. int _mark = p->mark;
  3895. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  3896. p->error_indicator = 1;
  3897. p->level--;
  3898. return NULL;
  3899. }
  3900. int _start_lineno = p->tokens[_mark]->lineno;
  3901. UNUSED(_start_lineno); // Only used by EXTRA macro
  3902. int _start_col_offset = p->tokens[_mark]->col_offset;
  3903. UNUSED(_start_col_offset); // Only used by EXTRA macro
  3904. { // dotted_name ['as' NAME]
  3905. if (p->error_indicator) {
  3906. p->level--;
  3907. return NULL;
  3908. }
  3909. D(fprintf(stderr, "%*c> dotted_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
  3910. expr_ty a;
  3911. void *b;
  3912. if (
  3913. (a = dotted_name_rule(p)) // dotted_name
  3914. &&
  3915. (b = _tmp_31_rule(p), !p->error_indicator) // ['as' NAME]
  3916. )
  3917. {
  3918. D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
  3919. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  3920. if (_token == NULL) {
  3921. p->level--;
  3922. return NULL;
  3923. }
  3924. int _end_lineno = _token->end_lineno;
  3925. UNUSED(_end_lineno); // Only used by EXTRA macro
  3926. int _end_col_offset = _token->end_col_offset;
  3927. UNUSED(_end_col_offset); // Only used by EXTRA macro
  3928. _res = _PyAST_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , EXTRA );
  3929. if (_res == NULL && PyErr_Occurred()) {
  3930. p->error_indicator = 1;
  3931. p->level--;
  3932. return NULL;
  3933. }
  3934. goto done;
  3935. }
  3936. p->mark = _mark;
  3937. D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ',
  3938. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name ['as' NAME]"));
  3939. }
  3940. _res = NULL;
  3941. done:
  3942. p->level--;
  3943. return _res;
  3944. }
  3945. // Left-recursive
  3946. // dotted_name: dotted_name '.' NAME | NAME
  3947. static expr_ty dotted_name_raw(Parser *);
  3948. static expr_ty
  3949. dotted_name_rule(Parser *p)
  3950. {
  3951. if (p->level++ == MAXSTACK) {
  3952. _Pypegen_stack_overflow(p);
  3953. }
  3954. expr_ty _res = NULL;
  3955. if (_PyPegen_is_memoized(p, dotted_name_type, &_res)) {
  3956. p->level--;
  3957. return _res;
  3958. }
  3959. int _mark = p->mark;
  3960. int _resmark = p->mark;
  3961. while (1) {
  3962. int tmpvar_0 = _PyPegen_update_memo(p, _mark, dotted_name_type, _res);
  3963. if (tmpvar_0) {
  3964. p->level--;
  3965. return _res;
  3966. }
  3967. p->mark = _mark;
  3968. void *_raw = dotted_name_raw(p);
  3969. if (p->error_indicator) {
  3970. p->level--;
  3971. return NULL;
  3972. }
  3973. if (_raw == NULL || p->mark <= _resmark)
  3974. break;
  3975. _resmark = p->mark;
  3976. _res = _raw;
  3977. }
  3978. p->mark = _resmark;
  3979. p->level--;
  3980. return _res;
  3981. }
  3982. static expr_ty
  3983. dotted_name_raw(Parser *p)
  3984. {
  3985. if (p->level++ == MAXSTACK) {
  3986. _Pypegen_stack_overflow(p);
  3987. }
  3988. if (p->error_indicator) {
  3989. p->level--;
  3990. return NULL;
  3991. }
  3992. expr_ty _res = NULL;
  3993. int _mark = p->mark;
  3994. { // dotted_name '.' NAME
  3995. if (p->error_indicator) {
  3996. p->level--;
  3997. return NULL;
  3998. }
  3999. D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
  4000. Token * _literal;
  4001. expr_ty a;
  4002. expr_ty b;
  4003. if (
  4004. (a = dotted_name_rule(p)) // dotted_name
  4005. &&
  4006. (_literal = _PyPegen_expect_token(p, 23)) // token='.'
  4007. &&
  4008. (b = _PyPegen_name_token(p)) // NAME
  4009. )
  4010. {
  4011. D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
  4012. _res = _PyPegen_join_names_with_dot ( p , a , b );
  4013. if (_res == NULL && PyErr_Occurred()) {
  4014. p->error_indicator = 1;
  4015. p->level--;
  4016. return NULL;
  4017. }
  4018. goto done;
  4019. }
  4020. p->mark = _mark;
  4021. D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
  4022. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name '.' NAME"));
  4023. }
  4024. { // NAME
  4025. if (p->error_indicator) {
  4026. p->level--;
  4027. return NULL;
  4028. }
  4029. D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
  4030. expr_ty name_var;
  4031. if (
  4032. (name_var = _PyPegen_name_token(p)) // NAME
  4033. )
  4034. {
  4035. D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
  4036. _res = name_var;
  4037. goto done;
  4038. }
  4039. p->mark = _mark;
  4040. D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
  4041. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
  4042. }
  4043. _res = NULL;
  4044. done:
  4045. p->level--;
  4046. return _res;
  4047. }
  4048. // block: NEWLINE INDENT statements DEDENT | simple_stmts | invalid_block
  4049. static asdl_stmt_seq*
  4050. block_rule(Parser *p)
  4051. {
  4052. if (p->level++ == MAXSTACK) {
  4053. _Pypegen_stack_overflow(p);
  4054. }
  4055. if (p->error_indicator) {
  4056. p->level--;
  4057. return NULL;
  4058. }
  4059. asdl_stmt_seq* _res = NULL;
  4060. if (_PyPegen_is_memoized(p, block_type, &_res)) {
  4061. p->level--;
  4062. return _res;
  4063. }
  4064. int _mark = p->mark;
  4065. { // NEWLINE INDENT statements DEDENT
  4066. if (p->error_indicator) {
  4067. p->level--;
  4068. return NULL;
  4069. }
  4070. D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
  4071. asdl_stmt_seq* a;
  4072. Token * dedent_var;
  4073. Token * indent_var;
  4074. Token * newline_var;
  4075. if (
  4076. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  4077. &&
  4078. (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
  4079. &&
  4080. (a = statements_rule(p)) // statements
  4081. &&
  4082. (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT'
  4083. )
  4084. {
  4085. D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
  4086. _res = a;
  4087. if (_res == NULL && PyErr_Occurred()) {
  4088. p->error_indicator = 1;
  4089. p->level--;
  4090. return NULL;
  4091. }
  4092. goto done;
  4093. }
  4094. p->mark = _mark;
  4095. D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
  4096. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
  4097. }
  4098. { // simple_stmts
  4099. if (p->error_indicator) {
  4100. p->level--;
  4101. return NULL;
  4102. }
  4103. D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
  4104. asdl_stmt_seq* simple_stmts_var;
  4105. if (
  4106. (simple_stmts_var = simple_stmts_rule(p)) // simple_stmts
  4107. )
  4108. {
  4109. D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
  4110. _res = simple_stmts_var;
  4111. goto done;
  4112. }
  4113. p->mark = _mark;
  4114. D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
  4115. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts"));
  4116. }
  4117. if (p->call_invalid_rules) { // invalid_block
  4118. if (p->error_indicator) {
  4119. p->level--;
  4120. return NULL;
  4121. }
  4122. D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block"));
  4123. void *invalid_block_var;
  4124. if (
  4125. (invalid_block_var = invalid_block_rule(p)) // invalid_block
  4126. )
  4127. {
  4128. D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block"));
  4129. _res = invalid_block_var;
  4130. goto done;
  4131. }
  4132. p->mark = _mark;
  4133. D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
  4134. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block"));
  4135. }
  4136. _res = NULL;
  4137. done:
  4138. _PyPegen_insert_memo(p, _mark, block_type, _res);
  4139. p->level--;
  4140. return _res;
  4141. }
  4142. // decorators: (('@' named_expression NEWLINE))+
  4143. static asdl_expr_seq*
  4144. decorators_rule(Parser *p)
  4145. {
  4146. if (p->level++ == MAXSTACK) {
  4147. _Pypegen_stack_overflow(p);
  4148. }
  4149. if (p->error_indicator) {
  4150. p->level--;
  4151. return NULL;
  4152. }
  4153. asdl_expr_seq* _res = NULL;
  4154. int _mark = p->mark;
  4155. { // (('@' named_expression NEWLINE))+
  4156. if (p->error_indicator) {
  4157. p->level--;
  4158. return NULL;
  4159. }
  4160. D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
  4161. asdl_expr_seq* a;
  4162. if (
  4163. (a = (asdl_expr_seq*)_loop1_32_rule(p)) // (('@' named_expression NEWLINE))+
  4164. )
  4165. {
  4166. D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
  4167. _res = a;
  4168. if (_res == NULL && PyErr_Occurred()) {
  4169. p->error_indicator = 1;
  4170. p->level--;
  4171. return NULL;
  4172. }
  4173. goto done;
  4174. }
  4175. p->mark = _mark;
  4176. D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ',
  4177. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+"));
  4178. }
  4179. _res = NULL;
  4180. done:
  4181. p->level--;
  4182. return _res;
  4183. }
  4184. // class_def: decorators class_def_raw | class_def_raw
  4185. static stmt_ty
  4186. class_def_rule(Parser *p)
  4187. {
  4188. if (p->level++ == MAXSTACK) {
  4189. _Pypegen_stack_overflow(p);
  4190. }
  4191. if (p->error_indicator) {
  4192. p->level--;
  4193. return NULL;
  4194. }
  4195. stmt_ty _res = NULL;
  4196. int _mark = p->mark;
  4197. { // decorators class_def_raw
  4198. if (p->error_indicator) {
  4199. p->level--;
  4200. return NULL;
  4201. }
  4202. D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
  4203. asdl_expr_seq* a;
  4204. stmt_ty b;
  4205. if (
  4206. (a = decorators_rule(p)) // decorators
  4207. &&
  4208. (b = class_def_raw_rule(p)) // class_def_raw
  4209. )
  4210. {
  4211. D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
  4212. _res = _PyPegen_class_def_decorators ( p , a , b );
  4213. if (_res == NULL && PyErr_Occurred()) {
  4214. p->error_indicator = 1;
  4215. p->level--;
  4216. return NULL;
  4217. }
  4218. goto done;
  4219. }
  4220. p->mark = _mark;
  4221. D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
  4222. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw"));
  4223. }
  4224. { // class_def_raw
  4225. if (p->error_indicator) {
  4226. p->level--;
  4227. return NULL;
  4228. }
  4229. D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
  4230. stmt_ty class_def_raw_var;
  4231. if (
  4232. (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw
  4233. )
  4234. {
  4235. D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
  4236. _res = class_def_raw_var;
  4237. goto done;
  4238. }
  4239. p->mark = _mark;
  4240. D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
  4241. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw"));
  4242. }
  4243. _res = NULL;
  4244. done:
  4245. p->level--;
  4246. return _res;
  4247. }
  4248. // class_def_raw:
  4249. // | invalid_class_def_raw
  4250. // | 'class' NAME type_params? ['(' arguments? ')'] ':' block
  4251. static stmt_ty
  4252. class_def_raw_rule(Parser *p)
  4253. {
  4254. if (p->level++ == MAXSTACK) {
  4255. _Pypegen_stack_overflow(p);
  4256. }
  4257. if (p->error_indicator) {
  4258. p->level--;
  4259. return NULL;
  4260. }
  4261. stmt_ty _res = NULL;
  4262. int _mark = p->mark;
  4263. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  4264. p->error_indicator = 1;
  4265. p->level--;
  4266. return NULL;
  4267. }
  4268. int _start_lineno = p->tokens[_mark]->lineno;
  4269. UNUSED(_start_lineno); // Only used by EXTRA macro
  4270. int _start_col_offset = p->tokens[_mark]->col_offset;
  4271. UNUSED(_start_col_offset); // Only used by EXTRA macro
  4272. if (p->call_invalid_rules) { // invalid_class_def_raw
  4273. if (p->error_indicator) {
  4274. p->level--;
  4275. return NULL;
  4276. }
  4277. D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_class_def_raw"));
  4278. void *invalid_class_def_raw_var;
  4279. if (
  4280. (invalid_class_def_raw_var = invalid_class_def_raw_rule(p)) // invalid_class_def_raw
  4281. )
  4282. {
  4283. D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_class_def_raw"));
  4284. _res = invalid_class_def_raw_var;
  4285. goto done;
  4286. }
  4287. p->mark = _mark;
  4288. D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
  4289. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_class_def_raw"));
  4290. }
  4291. { // 'class' NAME type_params? ['(' arguments? ')'] ':' block
  4292. if (p->error_indicator) {
  4293. p->level--;
  4294. return NULL;
  4295. }
  4296. D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' block"));
  4297. Token * _keyword;
  4298. Token * _literal;
  4299. expr_ty a;
  4300. void *b;
  4301. asdl_stmt_seq* c;
  4302. void *t;
  4303. if (
  4304. (_keyword = _PyPegen_expect_token(p, 654)) // token='class'
  4305. &&
  4306. (a = _PyPegen_name_token(p)) // NAME
  4307. &&
  4308. (t = type_params_rule(p), !p->error_indicator) // type_params?
  4309. &&
  4310. (b = _tmp_33_rule(p), !p->error_indicator) // ['(' arguments? ')']
  4311. &&
  4312. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  4313. &&
  4314. (c = block_rule(p)) // block
  4315. )
  4316. {
  4317. D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' block"));
  4318. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  4319. if (_token == NULL) {
  4320. p->level--;
  4321. return NULL;
  4322. }
  4323. int _end_lineno = _token->end_lineno;
  4324. UNUSED(_end_lineno); // Only used by EXTRA macro
  4325. int _end_col_offset = _token->end_col_offset;
  4326. UNUSED(_end_col_offset); // Only used by EXTRA macro
  4327. _res = _PyAST_ClassDef ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , c , NULL , t , EXTRA );
  4328. if (_res == NULL && PyErr_Occurred()) {
  4329. p->error_indicator = 1;
  4330. p->level--;
  4331. return NULL;
  4332. }
  4333. goto done;
  4334. }
  4335. p->mark = _mark;
  4336. D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
  4337. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' block"));
  4338. }
  4339. _res = NULL;
  4340. done:
  4341. p->level--;
  4342. return _res;
  4343. }
  4344. // function_def: decorators function_def_raw | function_def_raw
  4345. static stmt_ty
  4346. function_def_rule(Parser *p)
  4347. {
  4348. if (p->level++ == MAXSTACK) {
  4349. _Pypegen_stack_overflow(p);
  4350. }
  4351. if (p->error_indicator) {
  4352. p->level--;
  4353. return NULL;
  4354. }
  4355. stmt_ty _res = NULL;
  4356. int _mark = p->mark;
  4357. { // decorators function_def_raw
  4358. if (p->error_indicator) {
  4359. p->level--;
  4360. return NULL;
  4361. }
  4362. D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
  4363. asdl_expr_seq* d;
  4364. stmt_ty f;
  4365. if (
  4366. (d = decorators_rule(p)) // decorators
  4367. &&
  4368. (f = function_def_raw_rule(p)) // function_def_raw
  4369. )
  4370. {
  4371. D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
  4372. _res = _PyPegen_function_def_decorators ( p , d , f );
  4373. if (_res == NULL && PyErr_Occurred()) {
  4374. p->error_indicator = 1;
  4375. p->level--;
  4376. return NULL;
  4377. }
  4378. goto done;
  4379. }
  4380. p->mark = _mark;
  4381. D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
  4382. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw"));
  4383. }
  4384. { // function_def_raw
  4385. if (p->error_indicator) {
  4386. p->level--;
  4387. return NULL;
  4388. }
  4389. D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
  4390. stmt_ty function_def_raw_var;
  4391. if (
  4392. (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw
  4393. )
  4394. {
  4395. D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
  4396. _res = function_def_raw_var;
  4397. goto done;
  4398. }
  4399. p->mark = _mark;
  4400. D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
  4401. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw"));
  4402. }
  4403. _res = NULL;
  4404. done:
  4405. p->level--;
  4406. return _res;
  4407. }
  4408. // function_def_raw:
  4409. // | invalid_def_raw
  4410. // | 'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block
  4411. // | ASYNC 'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block
  4412. static stmt_ty
  4413. function_def_raw_rule(Parser *p)
  4414. {
  4415. if (p->level++ == MAXSTACK) {
  4416. _Pypegen_stack_overflow(p);
  4417. }
  4418. if (p->error_indicator) {
  4419. p->level--;
  4420. return NULL;
  4421. }
  4422. stmt_ty _res = NULL;
  4423. int _mark = p->mark;
  4424. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  4425. p->error_indicator = 1;
  4426. p->level--;
  4427. return NULL;
  4428. }
  4429. int _start_lineno = p->tokens[_mark]->lineno;
  4430. UNUSED(_start_lineno); // Only used by EXTRA macro
  4431. int _start_col_offset = p->tokens[_mark]->col_offset;
  4432. UNUSED(_start_col_offset); // Only used by EXTRA macro
  4433. if (p->call_invalid_rules) { // invalid_def_raw
  4434. if (p->error_indicator) {
  4435. p->level--;
  4436. return NULL;
  4437. }
  4438. D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_def_raw"));
  4439. void *invalid_def_raw_var;
  4440. if (
  4441. (invalid_def_raw_var = invalid_def_raw_rule(p)) // invalid_def_raw
  4442. )
  4443. {
  4444. D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_def_raw"));
  4445. _res = invalid_def_raw_var;
  4446. goto done;
  4447. }
  4448. p->mark = _mark;
  4449. D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
  4450. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_def_raw"));
  4451. }
  4452. { // 'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block
  4453. if (p->error_indicator) {
  4454. p->level--;
  4455. return NULL;
  4456. }
  4457. D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block"));
  4458. Token * _keyword;
  4459. Token * _literal;
  4460. Token * _literal_1;
  4461. Token * _literal_2;
  4462. void *a;
  4463. asdl_stmt_seq* b;
  4464. expr_ty n;
  4465. void *params;
  4466. void *t;
  4467. void *tc;
  4468. if (
  4469. (_keyword = _PyPegen_expect_token(p, 652)) // token='def'
  4470. &&
  4471. (n = _PyPegen_name_token(p)) // NAME
  4472. &&
  4473. (t = type_params_rule(p), !p->error_indicator) // type_params?
  4474. &&
  4475. (_literal = _PyPegen_expect_forced_token(p, 7, "(")) // forced_token='('
  4476. &&
  4477. (params = params_rule(p), !p->error_indicator) // params?
  4478. &&
  4479. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  4480. &&
  4481. (a = _tmp_34_rule(p), !p->error_indicator) // ['->' expression]
  4482. &&
  4483. (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
  4484. &&
  4485. (tc = func_type_comment_rule(p), !p->error_indicator) // func_type_comment?
  4486. &&
  4487. (b = block_rule(p)) // block
  4488. )
  4489. {
  4490. D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block"));
  4491. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  4492. if (_token == NULL) {
  4493. p->level--;
  4494. return NULL;
  4495. }
  4496. int _end_lineno = _token->end_lineno;
  4497. UNUSED(_end_lineno); // Only used by EXTRA macro
  4498. int _end_col_offset = _token->end_col_offset;
  4499. UNUSED(_end_col_offset); // Only used by EXTRA macro
  4500. _res = _PyAST_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , t , EXTRA );
  4501. if (_res == NULL && PyErr_Occurred()) {
  4502. p->error_indicator = 1;
  4503. p->level--;
  4504. return NULL;
  4505. }
  4506. goto done;
  4507. }
  4508. p->mark = _mark;
  4509. D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
  4510. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block"));
  4511. }
  4512. { // ASYNC 'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block
  4513. if (p->error_indicator) {
  4514. p->level--;
  4515. return NULL;
  4516. }
  4517. D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block"));
  4518. Token * _keyword;
  4519. Token * _literal;
  4520. Token * _literal_1;
  4521. Token * _literal_2;
  4522. void *a;
  4523. Token * async_var;
  4524. asdl_stmt_seq* b;
  4525. expr_ty n;
  4526. void *params;
  4527. void *t;
  4528. void *tc;
  4529. if (
  4530. (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
  4531. &&
  4532. (_keyword = _PyPegen_expect_token(p, 652)) // token='def'
  4533. &&
  4534. (n = _PyPegen_name_token(p)) // NAME
  4535. &&
  4536. (t = type_params_rule(p), !p->error_indicator) // type_params?
  4537. &&
  4538. (_literal = _PyPegen_expect_forced_token(p, 7, "(")) // forced_token='('
  4539. &&
  4540. (params = params_rule(p), !p->error_indicator) // params?
  4541. &&
  4542. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  4543. &&
  4544. (a = _tmp_35_rule(p), !p->error_indicator) // ['->' expression]
  4545. &&
  4546. (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
  4547. &&
  4548. (tc = func_type_comment_rule(p), !p->error_indicator) // func_type_comment?
  4549. &&
  4550. (b = block_rule(p)) // block
  4551. )
  4552. {
  4553. D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block"));
  4554. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  4555. if (_token == NULL) {
  4556. p->level--;
  4557. return NULL;
  4558. }
  4559. int _end_lineno = _token->end_lineno;
  4560. UNUSED(_end_lineno); // Only used by EXTRA macro
  4561. int _end_col_offset = _token->end_col_offset;
  4562. UNUSED(_end_col_offset); // Only used by EXTRA macro
  4563. _res = CHECK_VERSION ( stmt_ty , 5 , "Async functions are" , _PyAST_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , t , EXTRA ) );
  4564. if (_res == NULL && PyErr_Occurred()) {
  4565. p->error_indicator = 1;
  4566. p->level--;
  4567. return NULL;
  4568. }
  4569. goto done;
  4570. }
  4571. p->mark = _mark;
  4572. D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
  4573. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block"));
  4574. }
  4575. _res = NULL;
  4576. done:
  4577. p->level--;
  4578. return _res;
  4579. }
  4580. // params: invalid_parameters | parameters
  4581. static arguments_ty
  4582. params_rule(Parser *p)
  4583. {
  4584. if (p->level++ == MAXSTACK) {
  4585. _Pypegen_stack_overflow(p);
  4586. }
  4587. if (p->error_indicator) {
  4588. p->level--;
  4589. return NULL;
  4590. }
  4591. arguments_ty _res = NULL;
  4592. int _mark = p->mark;
  4593. if (p->call_invalid_rules) { // invalid_parameters
  4594. if (p->error_indicator) {
  4595. p->level--;
  4596. return NULL;
  4597. }
  4598. D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
  4599. void *invalid_parameters_var;
  4600. if (
  4601. (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters
  4602. )
  4603. {
  4604. D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
  4605. _res = invalid_parameters_var;
  4606. goto done;
  4607. }
  4608. p->mark = _mark;
  4609. D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
  4610. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters"));
  4611. }
  4612. { // parameters
  4613. if (p->error_indicator) {
  4614. p->level--;
  4615. return NULL;
  4616. }
  4617. D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters"));
  4618. arguments_ty parameters_var;
  4619. if (
  4620. (parameters_var = parameters_rule(p)) // parameters
  4621. )
  4622. {
  4623. D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters"));
  4624. _res = parameters_var;
  4625. goto done;
  4626. }
  4627. p->mark = _mark;
  4628. D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
  4629. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters"));
  4630. }
  4631. _res = NULL;
  4632. done:
  4633. p->level--;
  4634. return _res;
  4635. }
  4636. // parameters:
  4637. // | slash_no_default param_no_default* param_with_default* star_etc?
  4638. // | slash_with_default param_with_default* star_etc?
  4639. // | param_no_default+ param_with_default* star_etc?
  4640. // | param_with_default+ star_etc?
  4641. // | star_etc
  4642. static arguments_ty
  4643. parameters_rule(Parser *p)
  4644. {
  4645. if (p->level++ == MAXSTACK) {
  4646. _Pypegen_stack_overflow(p);
  4647. }
  4648. if (p->error_indicator) {
  4649. p->level--;
  4650. return NULL;
  4651. }
  4652. arguments_ty _res = NULL;
  4653. int _mark = p->mark;
  4654. { // slash_no_default param_no_default* param_with_default* star_etc?
  4655. if (p->error_indicator) {
  4656. p->level--;
  4657. return NULL;
  4658. }
  4659. D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
  4660. asdl_arg_seq* a;
  4661. asdl_arg_seq* b;
  4662. asdl_seq * c;
  4663. void *d;
  4664. if (
  4665. (a = slash_no_default_rule(p)) // slash_no_default
  4666. &&
  4667. (b = (asdl_arg_seq*)_loop0_36_rule(p)) // param_no_default*
  4668. &&
  4669. (c = _loop0_37_rule(p)) // param_with_default*
  4670. &&
  4671. (d = star_etc_rule(p), !p->error_indicator) // star_etc?
  4672. )
  4673. {
  4674. D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
  4675. _res = CHECK_VERSION ( arguments_ty , 8 , "Positional-only parameters are" , _PyPegen_make_arguments ( p , a , NULL , b , c , d ) );
  4676. if (_res == NULL && PyErr_Occurred()) {
  4677. p->error_indicator = 1;
  4678. p->level--;
  4679. return NULL;
  4680. }
  4681. goto done;
  4682. }
  4683. p->mark = _mark;
  4684. D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
  4685. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
  4686. }
  4687. { // slash_with_default param_with_default* star_etc?
  4688. if (p->error_indicator) {
  4689. p->level--;
  4690. return NULL;
  4691. }
  4692. D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
  4693. SlashWithDefault* a;
  4694. asdl_seq * b;
  4695. void *c;
  4696. if (
  4697. (a = slash_with_default_rule(p)) // slash_with_default
  4698. &&
  4699. (b = _loop0_38_rule(p)) // param_with_default*
  4700. &&
  4701. (c = star_etc_rule(p), !p->error_indicator) // star_etc?
  4702. )
  4703. {
  4704. D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
  4705. _res = CHECK_VERSION ( arguments_ty , 8 , "Positional-only parameters are" , _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ) );
  4706. if (_res == NULL && PyErr_Occurred()) {
  4707. p->error_indicator = 1;
  4708. p->level--;
  4709. return NULL;
  4710. }
  4711. goto done;
  4712. }
  4713. p->mark = _mark;
  4714. D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
  4715. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
  4716. }
  4717. { // param_no_default+ param_with_default* star_etc?
  4718. if (p->error_indicator) {
  4719. p->level--;
  4720. return NULL;
  4721. }
  4722. D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
  4723. asdl_arg_seq* a;
  4724. asdl_seq * b;
  4725. void *c;
  4726. if (
  4727. (a = (asdl_arg_seq*)_loop1_39_rule(p)) // param_no_default+
  4728. &&
  4729. (b = _loop0_40_rule(p)) // param_with_default*
  4730. &&
  4731. (c = star_etc_rule(p), !p->error_indicator) // star_etc?
  4732. )
  4733. {
  4734. D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
  4735. _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
  4736. if (_res == NULL && PyErr_Occurred()) {
  4737. p->error_indicator = 1;
  4738. p->level--;
  4739. return NULL;
  4740. }
  4741. goto done;
  4742. }
  4743. p->mark = _mark;
  4744. D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
  4745. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
  4746. }
  4747. { // param_with_default+ star_etc?
  4748. if (p->error_indicator) {
  4749. p->level--;
  4750. return NULL;
  4751. }
  4752. D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
  4753. asdl_seq * a;
  4754. void *b;
  4755. if (
  4756. (a = _loop1_41_rule(p)) // param_with_default+
  4757. &&
  4758. (b = star_etc_rule(p), !p->error_indicator) // star_etc?
  4759. )
  4760. {
  4761. D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
  4762. _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
  4763. if (_res == NULL && PyErr_Occurred()) {
  4764. p->error_indicator = 1;
  4765. p->level--;
  4766. return NULL;
  4767. }
  4768. goto done;
  4769. }
  4770. p->mark = _mark;
  4771. D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
  4772. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?"));
  4773. }
  4774. { // star_etc
  4775. if (p->error_indicator) {
  4776. p->level--;
  4777. return NULL;
  4778. }
  4779. D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc"));
  4780. StarEtc* a;
  4781. if (
  4782. (a = star_etc_rule(p)) // star_etc
  4783. )
  4784. {
  4785. D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc"));
  4786. _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
  4787. if (_res == NULL && PyErr_Occurred()) {
  4788. p->error_indicator = 1;
  4789. p->level--;
  4790. return NULL;
  4791. }
  4792. goto done;
  4793. }
  4794. p->mark = _mark;
  4795. D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
  4796. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc"));
  4797. }
  4798. _res = NULL;
  4799. done:
  4800. p->level--;
  4801. return _res;
  4802. }
  4803. // slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
  4804. static asdl_arg_seq*
  4805. slash_no_default_rule(Parser *p)
  4806. {
  4807. if (p->level++ == MAXSTACK) {
  4808. _Pypegen_stack_overflow(p);
  4809. }
  4810. if (p->error_indicator) {
  4811. p->level--;
  4812. return NULL;
  4813. }
  4814. asdl_arg_seq* _res = NULL;
  4815. int _mark = p->mark;
  4816. { // param_no_default+ '/' ','
  4817. if (p->error_indicator) {
  4818. p->level--;
  4819. return NULL;
  4820. }
  4821. D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
  4822. Token * _literal;
  4823. Token * _literal_1;
  4824. asdl_arg_seq* a;
  4825. if (
  4826. (a = (asdl_arg_seq*)_loop1_42_rule(p)) // param_no_default+
  4827. &&
  4828. (_literal = _PyPegen_expect_token(p, 17)) // token='/'
  4829. &&
  4830. (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
  4831. )
  4832. {
  4833. D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
  4834. _res = a;
  4835. if (_res == NULL && PyErr_Occurred()) {
  4836. p->error_indicator = 1;
  4837. p->level--;
  4838. return NULL;
  4839. }
  4840. goto done;
  4841. }
  4842. p->mark = _mark;
  4843. D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
  4844. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','"));
  4845. }
  4846. { // param_no_default+ '/' &')'
  4847. if (p->error_indicator) {
  4848. p->level--;
  4849. return NULL;
  4850. }
  4851. D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
  4852. Token * _literal;
  4853. asdl_arg_seq* a;
  4854. if (
  4855. (a = (asdl_arg_seq*)_loop1_43_rule(p)) // param_no_default+
  4856. &&
  4857. (_literal = _PyPegen_expect_token(p, 17)) // token='/'
  4858. &&
  4859. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
  4860. )
  4861. {
  4862. D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
  4863. _res = a;
  4864. if (_res == NULL && PyErr_Occurred()) {
  4865. p->error_indicator = 1;
  4866. p->level--;
  4867. return NULL;
  4868. }
  4869. goto done;
  4870. }
  4871. p->mark = _mark;
  4872. D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
  4873. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'"));
  4874. }
  4875. _res = NULL;
  4876. done:
  4877. p->level--;
  4878. return _res;
  4879. }
  4880. // slash_with_default:
  4881. // | param_no_default* param_with_default+ '/' ','
  4882. // | param_no_default* param_with_default+ '/' &')'
  4883. static SlashWithDefault*
  4884. slash_with_default_rule(Parser *p)
  4885. {
  4886. if (p->level++ == MAXSTACK) {
  4887. _Pypegen_stack_overflow(p);
  4888. }
  4889. if (p->error_indicator) {
  4890. p->level--;
  4891. return NULL;
  4892. }
  4893. SlashWithDefault* _res = NULL;
  4894. int _mark = p->mark;
  4895. { // param_no_default* param_with_default+ '/' ','
  4896. if (p->error_indicator) {
  4897. p->level--;
  4898. return NULL;
  4899. }
  4900. D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
  4901. Token * _literal;
  4902. Token * _literal_1;
  4903. asdl_seq * a;
  4904. asdl_seq * b;
  4905. if (
  4906. (a = _loop0_44_rule(p)) // param_no_default*
  4907. &&
  4908. (b = _loop1_45_rule(p)) // param_with_default+
  4909. &&
  4910. (_literal = _PyPegen_expect_token(p, 17)) // token='/'
  4911. &&
  4912. (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
  4913. )
  4914. {
  4915. D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
  4916. _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq* ) a , b );
  4917. if (_res == NULL && PyErr_Occurred()) {
  4918. p->error_indicator = 1;
  4919. p->level--;
  4920. return NULL;
  4921. }
  4922. goto done;
  4923. }
  4924. p->mark = _mark;
  4925. D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
  4926. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
  4927. }
  4928. { // param_no_default* param_with_default+ '/' &')'
  4929. if (p->error_indicator) {
  4930. p->level--;
  4931. return NULL;
  4932. }
  4933. D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
  4934. Token * _literal;
  4935. asdl_seq * a;
  4936. asdl_seq * b;
  4937. if (
  4938. (a = _loop0_46_rule(p)) // param_no_default*
  4939. &&
  4940. (b = _loop1_47_rule(p)) // param_with_default+
  4941. &&
  4942. (_literal = _PyPegen_expect_token(p, 17)) // token='/'
  4943. &&
  4944. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
  4945. )
  4946. {
  4947. D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
  4948. _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq* ) a , b );
  4949. if (_res == NULL && PyErr_Occurred()) {
  4950. p->error_indicator = 1;
  4951. p->level--;
  4952. return NULL;
  4953. }
  4954. goto done;
  4955. }
  4956. p->mark = _mark;
  4957. D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
  4958. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
  4959. }
  4960. _res = NULL;
  4961. done:
  4962. p->level--;
  4963. return _res;
  4964. }
  4965. // star_etc:
  4966. // | invalid_star_etc
  4967. // | '*' param_no_default param_maybe_default* kwds?
  4968. // | '*' param_no_default_star_annotation param_maybe_default* kwds?
  4969. // | '*' ',' param_maybe_default+ kwds?
  4970. // | kwds
  4971. static StarEtc*
  4972. star_etc_rule(Parser *p)
  4973. {
  4974. if (p->level++ == MAXSTACK) {
  4975. _Pypegen_stack_overflow(p);
  4976. }
  4977. if (p->error_indicator) {
  4978. p->level--;
  4979. return NULL;
  4980. }
  4981. StarEtc* _res = NULL;
  4982. int _mark = p->mark;
  4983. if (p->call_invalid_rules) { // invalid_star_etc
  4984. if (p->error_indicator) {
  4985. p->level--;
  4986. return NULL;
  4987. }
  4988. D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
  4989. void *invalid_star_etc_var;
  4990. if (
  4991. (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc
  4992. )
  4993. {
  4994. D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
  4995. _res = invalid_star_etc_var;
  4996. goto done;
  4997. }
  4998. p->mark = _mark;
  4999. D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
  5000. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc"));
  5001. }
  5002. { // '*' param_no_default param_maybe_default* kwds?
  5003. if (p->error_indicator) {
  5004. p->level--;
  5005. return NULL;
  5006. }
  5007. D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
  5008. Token * _literal;
  5009. arg_ty a;
  5010. asdl_seq * b;
  5011. void *c;
  5012. if (
  5013. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  5014. &&
  5015. (a = param_no_default_rule(p)) // param_no_default
  5016. &&
  5017. (b = _loop0_48_rule(p)) // param_maybe_default*
  5018. &&
  5019. (c = kwds_rule(p), !p->error_indicator) // kwds?
  5020. )
  5021. {
  5022. D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
  5023. _res = _PyPegen_star_etc ( p , a , b , c );
  5024. if (_res == NULL && PyErr_Occurred()) {
  5025. p->error_indicator = 1;
  5026. p->level--;
  5027. return NULL;
  5028. }
  5029. goto done;
  5030. }
  5031. p->mark = _mark;
  5032. D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
  5033. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
  5034. }
  5035. { // '*' param_no_default_star_annotation param_maybe_default* kwds?
  5036. if (p->error_indicator) {
  5037. p->level--;
  5038. return NULL;
  5039. }
  5040. D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default_star_annotation param_maybe_default* kwds?"));
  5041. Token * _literal;
  5042. arg_ty a;
  5043. asdl_seq * b;
  5044. void *c;
  5045. if (
  5046. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  5047. &&
  5048. (a = param_no_default_star_annotation_rule(p)) // param_no_default_star_annotation
  5049. &&
  5050. (b = _loop0_49_rule(p)) // param_maybe_default*
  5051. &&
  5052. (c = kwds_rule(p), !p->error_indicator) // kwds?
  5053. )
  5054. {
  5055. D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default_star_annotation param_maybe_default* kwds?"));
  5056. _res = _PyPegen_star_etc ( p , a , b , c );
  5057. if (_res == NULL && PyErr_Occurred()) {
  5058. p->error_indicator = 1;
  5059. p->level--;
  5060. return NULL;
  5061. }
  5062. goto done;
  5063. }
  5064. p->mark = _mark;
  5065. D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
  5066. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default_star_annotation param_maybe_default* kwds?"));
  5067. }
  5068. { // '*' ',' param_maybe_default+ kwds?
  5069. if (p->error_indicator) {
  5070. p->level--;
  5071. return NULL;
  5072. }
  5073. D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
  5074. Token * _literal;
  5075. Token * _literal_1;
  5076. asdl_seq * b;
  5077. void *c;
  5078. if (
  5079. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  5080. &&
  5081. (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
  5082. &&
  5083. (b = _loop1_50_rule(p)) // param_maybe_default+
  5084. &&
  5085. (c = kwds_rule(p), !p->error_indicator) // kwds?
  5086. )
  5087. {
  5088. D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
  5089. _res = _PyPegen_star_etc ( p , NULL , b , c );
  5090. if (_res == NULL && PyErr_Occurred()) {
  5091. p->error_indicator = 1;
  5092. p->level--;
  5093. return NULL;
  5094. }
  5095. goto done;
  5096. }
  5097. p->mark = _mark;
  5098. D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
  5099. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
  5100. }
  5101. { // kwds
  5102. if (p->error_indicator) {
  5103. p->level--;
  5104. return NULL;
  5105. }
  5106. D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds"));
  5107. arg_ty a;
  5108. if (
  5109. (a = kwds_rule(p)) // kwds
  5110. )
  5111. {
  5112. D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds"));
  5113. _res = _PyPegen_star_etc ( p , NULL , NULL , a );
  5114. if (_res == NULL && PyErr_Occurred()) {
  5115. p->error_indicator = 1;
  5116. p->level--;
  5117. return NULL;
  5118. }
  5119. goto done;
  5120. }
  5121. p->mark = _mark;
  5122. D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
  5123. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds"));
  5124. }
  5125. _res = NULL;
  5126. done:
  5127. p->level--;
  5128. return _res;
  5129. }
  5130. // kwds: invalid_kwds | '**' param_no_default
  5131. static arg_ty
  5132. kwds_rule(Parser *p)
  5133. {
  5134. if (p->level++ == MAXSTACK) {
  5135. _Pypegen_stack_overflow(p);
  5136. }
  5137. if (p->error_indicator) {
  5138. p->level--;
  5139. return NULL;
  5140. }
  5141. arg_ty _res = NULL;
  5142. int _mark = p->mark;
  5143. if (p->call_invalid_rules) { // invalid_kwds
  5144. if (p->error_indicator) {
  5145. p->level--;
  5146. return NULL;
  5147. }
  5148. D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwds"));
  5149. void *invalid_kwds_var;
  5150. if (
  5151. (invalid_kwds_var = invalid_kwds_rule(p)) // invalid_kwds
  5152. )
  5153. {
  5154. D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwds"));
  5155. _res = invalid_kwds_var;
  5156. goto done;
  5157. }
  5158. p->mark = _mark;
  5159. D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ',
  5160. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwds"));
  5161. }
  5162. { // '**' param_no_default
  5163. if (p->error_indicator) {
  5164. p->level--;
  5165. return NULL;
  5166. }
  5167. D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
  5168. Token * _literal;
  5169. arg_ty a;
  5170. if (
  5171. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  5172. &&
  5173. (a = param_no_default_rule(p)) // param_no_default
  5174. )
  5175. {
  5176. D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
  5177. _res = a;
  5178. if (_res == NULL && PyErr_Occurred()) {
  5179. p->error_indicator = 1;
  5180. p->level--;
  5181. return NULL;
  5182. }
  5183. goto done;
  5184. }
  5185. p->mark = _mark;
  5186. D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ',
  5187. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default"));
  5188. }
  5189. _res = NULL;
  5190. done:
  5191. p->level--;
  5192. return _res;
  5193. }
  5194. // param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
  5195. static arg_ty
  5196. param_no_default_rule(Parser *p)
  5197. {
  5198. if (p->level++ == MAXSTACK) {
  5199. _Pypegen_stack_overflow(p);
  5200. }
  5201. if (p->error_indicator) {
  5202. p->level--;
  5203. return NULL;
  5204. }
  5205. arg_ty _res = NULL;
  5206. int _mark = p->mark;
  5207. { // param ',' TYPE_COMMENT?
  5208. if (p->error_indicator) {
  5209. p->level--;
  5210. return NULL;
  5211. }
  5212. D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
  5213. Token * _literal;
  5214. arg_ty a;
  5215. void *tc;
  5216. if (
  5217. (a = param_rule(p)) // param
  5218. &&
  5219. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  5220. &&
  5221. (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
  5222. )
  5223. {
  5224. D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
  5225. _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
  5226. if (_res == NULL && PyErr_Occurred()) {
  5227. p->error_indicator = 1;
  5228. p->level--;
  5229. return NULL;
  5230. }
  5231. goto done;
  5232. }
  5233. p->mark = _mark;
  5234. D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
  5235. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?"));
  5236. }
  5237. { // param TYPE_COMMENT? &')'
  5238. if (p->error_indicator) {
  5239. p->level--;
  5240. return NULL;
  5241. }
  5242. D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
  5243. arg_ty a;
  5244. void *tc;
  5245. if (
  5246. (a = param_rule(p)) // param
  5247. &&
  5248. (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
  5249. &&
  5250. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
  5251. )
  5252. {
  5253. D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
  5254. _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
  5255. if (_res == NULL && PyErr_Occurred()) {
  5256. p->error_indicator = 1;
  5257. p->level--;
  5258. return NULL;
  5259. }
  5260. goto done;
  5261. }
  5262. p->mark = _mark;
  5263. D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
  5264. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'"));
  5265. }
  5266. _res = NULL;
  5267. done:
  5268. p->level--;
  5269. return _res;
  5270. }
  5271. // param_no_default_star_annotation:
  5272. // | param_star_annotation ',' TYPE_COMMENT?
  5273. // | param_star_annotation TYPE_COMMENT? &')'
  5274. static arg_ty
  5275. param_no_default_star_annotation_rule(Parser *p)
  5276. {
  5277. if (p->level++ == MAXSTACK) {
  5278. _Pypegen_stack_overflow(p);
  5279. }
  5280. if (p->error_indicator) {
  5281. p->level--;
  5282. return NULL;
  5283. }
  5284. arg_ty _res = NULL;
  5285. int _mark = p->mark;
  5286. { // param_star_annotation ',' TYPE_COMMENT?
  5287. if (p->error_indicator) {
  5288. p->level--;
  5289. return NULL;
  5290. }
  5291. D(fprintf(stderr, "%*c> param_no_default_star_annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_star_annotation ',' TYPE_COMMENT?"));
  5292. Token * _literal;
  5293. arg_ty a;
  5294. void *tc;
  5295. if (
  5296. (a = param_star_annotation_rule(p)) // param_star_annotation
  5297. &&
  5298. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  5299. &&
  5300. (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
  5301. )
  5302. {
  5303. D(fprintf(stderr, "%*c+ param_no_default_star_annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_star_annotation ',' TYPE_COMMENT?"));
  5304. _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
  5305. if (_res == NULL && PyErr_Occurred()) {
  5306. p->error_indicator = 1;
  5307. p->level--;
  5308. return NULL;
  5309. }
  5310. goto done;
  5311. }
  5312. p->mark = _mark;
  5313. D(fprintf(stderr, "%*c%s param_no_default_star_annotation[%d-%d]: %s failed!\n", p->level, ' ',
  5314. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_star_annotation ',' TYPE_COMMENT?"));
  5315. }
  5316. { // param_star_annotation TYPE_COMMENT? &')'
  5317. if (p->error_indicator) {
  5318. p->level--;
  5319. return NULL;
  5320. }
  5321. D(fprintf(stderr, "%*c> param_no_default_star_annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_star_annotation TYPE_COMMENT? &')'"));
  5322. arg_ty a;
  5323. void *tc;
  5324. if (
  5325. (a = param_star_annotation_rule(p)) // param_star_annotation
  5326. &&
  5327. (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
  5328. &&
  5329. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
  5330. )
  5331. {
  5332. D(fprintf(stderr, "%*c+ param_no_default_star_annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_star_annotation TYPE_COMMENT? &')'"));
  5333. _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
  5334. if (_res == NULL && PyErr_Occurred()) {
  5335. p->error_indicator = 1;
  5336. p->level--;
  5337. return NULL;
  5338. }
  5339. goto done;
  5340. }
  5341. p->mark = _mark;
  5342. D(fprintf(stderr, "%*c%s param_no_default_star_annotation[%d-%d]: %s failed!\n", p->level, ' ',
  5343. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_star_annotation TYPE_COMMENT? &')'"));
  5344. }
  5345. _res = NULL;
  5346. done:
  5347. p->level--;
  5348. return _res;
  5349. }
  5350. // param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
  5351. static NameDefaultPair*
  5352. param_with_default_rule(Parser *p)
  5353. {
  5354. if (p->level++ == MAXSTACK) {
  5355. _Pypegen_stack_overflow(p);
  5356. }
  5357. if (p->error_indicator) {
  5358. p->level--;
  5359. return NULL;
  5360. }
  5361. NameDefaultPair* _res = NULL;
  5362. int _mark = p->mark;
  5363. { // param default ',' TYPE_COMMENT?
  5364. if (p->error_indicator) {
  5365. p->level--;
  5366. return NULL;
  5367. }
  5368. D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
  5369. Token * _literal;
  5370. arg_ty a;
  5371. expr_ty c;
  5372. void *tc;
  5373. if (
  5374. (a = param_rule(p)) // param
  5375. &&
  5376. (c = default_rule(p)) // default
  5377. &&
  5378. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  5379. &&
  5380. (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
  5381. )
  5382. {
  5383. D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
  5384. _res = _PyPegen_name_default_pair ( p , a , c , tc );
  5385. if (_res == NULL && PyErr_Occurred()) {
  5386. p->error_indicator = 1;
  5387. p->level--;
  5388. return NULL;
  5389. }
  5390. goto done;
  5391. }
  5392. p->mark = _mark;
  5393. D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
  5394. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?"));
  5395. }
  5396. { // param default TYPE_COMMENT? &')'
  5397. if (p->error_indicator) {
  5398. p->level--;
  5399. return NULL;
  5400. }
  5401. D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
  5402. arg_ty a;
  5403. expr_ty c;
  5404. void *tc;
  5405. if (
  5406. (a = param_rule(p)) // param
  5407. &&
  5408. (c = default_rule(p)) // default
  5409. &&
  5410. (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
  5411. &&
  5412. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
  5413. )
  5414. {
  5415. D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
  5416. _res = _PyPegen_name_default_pair ( p , a , c , tc );
  5417. if (_res == NULL && PyErr_Occurred()) {
  5418. p->error_indicator = 1;
  5419. p->level--;
  5420. return NULL;
  5421. }
  5422. goto done;
  5423. }
  5424. p->mark = _mark;
  5425. D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
  5426. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'"));
  5427. }
  5428. _res = NULL;
  5429. done:
  5430. p->level--;
  5431. return _res;
  5432. }
  5433. // param_maybe_default:
  5434. // | param default? ',' TYPE_COMMENT?
  5435. // | param default? TYPE_COMMENT? &')'
  5436. static NameDefaultPair*
  5437. param_maybe_default_rule(Parser *p)
  5438. {
  5439. if (p->level++ == MAXSTACK) {
  5440. _Pypegen_stack_overflow(p);
  5441. }
  5442. if (p->error_indicator) {
  5443. p->level--;
  5444. return NULL;
  5445. }
  5446. NameDefaultPair* _res = NULL;
  5447. int _mark = p->mark;
  5448. { // param default? ',' TYPE_COMMENT?
  5449. if (p->error_indicator) {
  5450. p->level--;
  5451. return NULL;
  5452. }
  5453. D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
  5454. Token * _literal;
  5455. arg_ty a;
  5456. void *c;
  5457. void *tc;
  5458. if (
  5459. (a = param_rule(p)) // param
  5460. &&
  5461. (c = default_rule(p), !p->error_indicator) // default?
  5462. &&
  5463. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  5464. &&
  5465. (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
  5466. )
  5467. {
  5468. D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
  5469. _res = _PyPegen_name_default_pair ( p , a , c , tc );
  5470. if (_res == NULL && PyErr_Occurred()) {
  5471. p->error_indicator = 1;
  5472. p->level--;
  5473. return NULL;
  5474. }
  5475. goto done;
  5476. }
  5477. p->mark = _mark;
  5478. D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
  5479. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
  5480. }
  5481. { // param default? TYPE_COMMENT? &')'
  5482. if (p->error_indicator) {
  5483. p->level--;
  5484. return NULL;
  5485. }
  5486. D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
  5487. arg_ty a;
  5488. void *c;
  5489. void *tc;
  5490. if (
  5491. (a = param_rule(p)) // param
  5492. &&
  5493. (c = default_rule(p), !p->error_indicator) // default?
  5494. &&
  5495. (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
  5496. &&
  5497. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
  5498. )
  5499. {
  5500. D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
  5501. _res = _PyPegen_name_default_pair ( p , a , c , tc );
  5502. if (_res == NULL && PyErr_Occurred()) {
  5503. p->error_indicator = 1;
  5504. p->level--;
  5505. return NULL;
  5506. }
  5507. goto done;
  5508. }
  5509. p->mark = _mark;
  5510. D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
  5511. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
  5512. }
  5513. _res = NULL;
  5514. done:
  5515. p->level--;
  5516. return _res;
  5517. }
  5518. // param: NAME annotation?
  5519. static arg_ty
  5520. param_rule(Parser *p)
  5521. {
  5522. if (p->level++ == MAXSTACK) {
  5523. _Pypegen_stack_overflow(p);
  5524. }
  5525. if (p->error_indicator) {
  5526. p->level--;
  5527. return NULL;
  5528. }
  5529. arg_ty _res = NULL;
  5530. int _mark = p->mark;
  5531. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  5532. p->error_indicator = 1;
  5533. p->level--;
  5534. return NULL;
  5535. }
  5536. int _start_lineno = p->tokens[_mark]->lineno;
  5537. UNUSED(_start_lineno); // Only used by EXTRA macro
  5538. int _start_col_offset = p->tokens[_mark]->col_offset;
  5539. UNUSED(_start_col_offset); // Only used by EXTRA macro
  5540. { // NAME annotation?
  5541. if (p->error_indicator) {
  5542. p->level--;
  5543. return NULL;
  5544. }
  5545. D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
  5546. expr_ty a;
  5547. void *b;
  5548. if (
  5549. (a = _PyPegen_name_token(p)) // NAME
  5550. &&
  5551. (b = annotation_rule(p), !p->error_indicator) // annotation?
  5552. )
  5553. {
  5554. D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
  5555. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  5556. if (_token == NULL) {
  5557. p->level--;
  5558. return NULL;
  5559. }
  5560. int _end_lineno = _token->end_lineno;
  5561. UNUSED(_end_lineno); // Only used by EXTRA macro
  5562. int _end_col_offset = _token->end_col_offset;
  5563. UNUSED(_end_col_offset); // Only used by EXTRA macro
  5564. _res = _PyAST_arg ( a -> v . Name . id , b , NULL , EXTRA );
  5565. if (_res == NULL && PyErr_Occurred()) {
  5566. p->error_indicator = 1;
  5567. p->level--;
  5568. return NULL;
  5569. }
  5570. goto done;
  5571. }
  5572. p->mark = _mark;
  5573. D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ',
  5574. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?"));
  5575. }
  5576. _res = NULL;
  5577. done:
  5578. p->level--;
  5579. return _res;
  5580. }
  5581. // param_star_annotation: NAME star_annotation
  5582. static arg_ty
  5583. param_star_annotation_rule(Parser *p)
  5584. {
  5585. if (p->level++ == MAXSTACK) {
  5586. _Pypegen_stack_overflow(p);
  5587. }
  5588. if (p->error_indicator) {
  5589. p->level--;
  5590. return NULL;
  5591. }
  5592. arg_ty _res = NULL;
  5593. int _mark = p->mark;
  5594. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  5595. p->error_indicator = 1;
  5596. p->level--;
  5597. return NULL;
  5598. }
  5599. int _start_lineno = p->tokens[_mark]->lineno;
  5600. UNUSED(_start_lineno); // Only used by EXTRA macro
  5601. int _start_col_offset = p->tokens[_mark]->col_offset;
  5602. UNUSED(_start_col_offset); // Only used by EXTRA macro
  5603. { // NAME star_annotation
  5604. if (p->error_indicator) {
  5605. p->level--;
  5606. return NULL;
  5607. }
  5608. D(fprintf(stderr, "%*c> param_star_annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME star_annotation"));
  5609. expr_ty a;
  5610. expr_ty b;
  5611. if (
  5612. (a = _PyPegen_name_token(p)) // NAME
  5613. &&
  5614. (b = star_annotation_rule(p)) // star_annotation
  5615. )
  5616. {
  5617. D(fprintf(stderr, "%*c+ param_star_annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME star_annotation"));
  5618. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  5619. if (_token == NULL) {
  5620. p->level--;
  5621. return NULL;
  5622. }
  5623. int _end_lineno = _token->end_lineno;
  5624. UNUSED(_end_lineno); // Only used by EXTRA macro
  5625. int _end_col_offset = _token->end_col_offset;
  5626. UNUSED(_end_col_offset); // Only used by EXTRA macro
  5627. _res = _PyAST_arg ( a -> v . Name . id , b , NULL , EXTRA );
  5628. if (_res == NULL && PyErr_Occurred()) {
  5629. p->error_indicator = 1;
  5630. p->level--;
  5631. return NULL;
  5632. }
  5633. goto done;
  5634. }
  5635. p->mark = _mark;
  5636. D(fprintf(stderr, "%*c%s param_star_annotation[%d-%d]: %s failed!\n", p->level, ' ',
  5637. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME star_annotation"));
  5638. }
  5639. _res = NULL;
  5640. done:
  5641. p->level--;
  5642. return _res;
  5643. }
  5644. // annotation: ':' expression
  5645. static expr_ty
  5646. annotation_rule(Parser *p)
  5647. {
  5648. if (p->level++ == MAXSTACK) {
  5649. _Pypegen_stack_overflow(p);
  5650. }
  5651. if (p->error_indicator) {
  5652. p->level--;
  5653. return NULL;
  5654. }
  5655. expr_ty _res = NULL;
  5656. int _mark = p->mark;
  5657. { // ':' expression
  5658. if (p->error_indicator) {
  5659. p->level--;
  5660. return NULL;
  5661. }
  5662. D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression"));
  5663. Token * _literal;
  5664. expr_ty a;
  5665. if (
  5666. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  5667. &&
  5668. (a = expression_rule(p)) // expression
  5669. )
  5670. {
  5671. D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
  5672. _res = a;
  5673. if (_res == NULL && PyErr_Occurred()) {
  5674. p->error_indicator = 1;
  5675. p->level--;
  5676. return NULL;
  5677. }
  5678. goto done;
  5679. }
  5680. p->mark = _mark;
  5681. D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ',
  5682. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression"));
  5683. }
  5684. _res = NULL;
  5685. done:
  5686. p->level--;
  5687. return _res;
  5688. }
  5689. // star_annotation: ':' star_expression
  5690. static expr_ty
  5691. star_annotation_rule(Parser *p)
  5692. {
  5693. if (p->level++ == MAXSTACK) {
  5694. _Pypegen_stack_overflow(p);
  5695. }
  5696. if (p->error_indicator) {
  5697. p->level--;
  5698. return NULL;
  5699. }
  5700. expr_ty _res = NULL;
  5701. int _mark = p->mark;
  5702. { // ':' star_expression
  5703. if (p->error_indicator) {
  5704. p->level--;
  5705. return NULL;
  5706. }
  5707. D(fprintf(stderr, "%*c> star_annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' star_expression"));
  5708. Token * _literal;
  5709. expr_ty a;
  5710. if (
  5711. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  5712. &&
  5713. (a = star_expression_rule(p)) // star_expression
  5714. )
  5715. {
  5716. D(fprintf(stderr, "%*c+ star_annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' star_expression"));
  5717. _res = a;
  5718. if (_res == NULL && PyErr_Occurred()) {
  5719. p->error_indicator = 1;
  5720. p->level--;
  5721. return NULL;
  5722. }
  5723. goto done;
  5724. }
  5725. p->mark = _mark;
  5726. D(fprintf(stderr, "%*c%s star_annotation[%d-%d]: %s failed!\n", p->level, ' ',
  5727. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' star_expression"));
  5728. }
  5729. _res = NULL;
  5730. done:
  5731. p->level--;
  5732. return _res;
  5733. }
  5734. // default: '=' expression | invalid_default
  5735. static expr_ty
  5736. default_rule(Parser *p)
  5737. {
  5738. if (p->level++ == MAXSTACK) {
  5739. _Pypegen_stack_overflow(p);
  5740. }
  5741. if (p->error_indicator) {
  5742. p->level--;
  5743. return NULL;
  5744. }
  5745. expr_ty _res = NULL;
  5746. int _mark = p->mark;
  5747. { // '=' expression
  5748. if (p->error_indicator) {
  5749. p->level--;
  5750. return NULL;
  5751. }
  5752. D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression"));
  5753. Token * _literal;
  5754. expr_ty a;
  5755. if (
  5756. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  5757. &&
  5758. (a = expression_rule(p)) // expression
  5759. )
  5760. {
  5761. D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression"));
  5762. _res = a;
  5763. if (_res == NULL && PyErr_Occurred()) {
  5764. p->error_indicator = 1;
  5765. p->level--;
  5766. return NULL;
  5767. }
  5768. goto done;
  5769. }
  5770. p->mark = _mark;
  5771. D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ',
  5772. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression"));
  5773. }
  5774. if (p->call_invalid_rules) { // invalid_default
  5775. if (p->error_indicator) {
  5776. p->level--;
  5777. return NULL;
  5778. }
  5779. D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_default"));
  5780. void *invalid_default_var;
  5781. if (
  5782. (invalid_default_var = invalid_default_rule(p)) // invalid_default
  5783. )
  5784. {
  5785. D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_default"));
  5786. _res = invalid_default_var;
  5787. goto done;
  5788. }
  5789. p->mark = _mark;
  5790. D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ',
  5791. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_default"));
  5792. }
  5793. _res = NULL;
  5794. done:
  5795. p->level--;
  5796. return _res;
  5797. }
  5798. // if_stmt:
  5799. // | invalid_if_stmt
  5800. // | 'if' named_expression ':' block elif_stmt
  5801. // | 'if' named_expression ':' block else_block?
  5802. static stmt_ty
  5803. if_stmt_rule(Parser *p)
  5804. {
  5805. if (p->level++ == MAXSTACK) {
  5806. _Pypegen_stack_overflow(p);
  5807. }
  5808. if (p->error_indicator) {
  5809. p->level--;
  5810. return NULL;
  5811. }
  5812. stmt_ty _res = NULL;
  5813. int _mark = p->mark;
  5814. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  5815. p->error_indicator = 1;
  5816. p->level--;
  5817. return NULL;
  5818. }
  5819. int _start_lineno = p->tokens[_mark]->lineno;
  5820. UNUSED(_start_lineno); // Only used by EXTRA macro
  5821. int _start_col_offset = p->tokens[_mark]->col_offset;
  5822. UNUSED(_start_col_offset); // Only used by EXTRA macro
  5823. if (p->call_invalid_rules) { // invalid_if_stmt
  5824. if (p->error_indicator) {
  5825. p->level--;
  5826. return NULL;
  5827. }
  5828. D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_if_stmt"));
  5829. void *invalid_if_stmt_var;
  5830. if (
  5831. (invalid_if_stmt_var = invalid_if_stmt_rule(p)) // invalid_if_stmt
  5832. )
  5833. {
  5834. D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_if_stmt"));
  5835. _res = invalid_if_stmt_var;
  5836. goto done;
  5837. }
  5838. p->mark = _mark;
  5839. D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  5840. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_if_stmt"));
  5841. }
  5842. { // 'if' named_expression ':' block elif_stmt
  5843. if (p->error_indicator) {
  5844. p->level--;
  5845. return NULL;
  5846. }
  5847. D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
  5848. Token * _keyword;
  5849. Token * _literal;
  5850. expr_ty a;
  5851. asdl_stmt_seq* b;
  5852. stmt_ty c;
  5853. if (
  5854. (_keyword = _PyPegen_expect_token(p, 642)) // token='if'
  5855. &&
  5856. (a = named_expression_rule(p)) // named_expression
  5857. &&
  5858. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  5859. &&
  5860. (b = block_rule(p)) // block
  5861. &&
  5862. (c = elif_stmt_rule(p)) // elif_stmt
  5863. )
  5864. {
  5865. D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
  5866. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  5867. if (_token == NULL) {
  5868. p->level--;
  5869. return NULL;
  5870. }
  5871. int _end_lineno = _token->end_lineno;
  5872. UNUSED(_end_lineno); // Only used by EXTRA macro
  5873. int _end_col_offset = _token->end_col_offset;
  5874. UNUSED(_end_col_offset); // Only used by EXTRA macro
  5875. _res = _PyAST_If ( a , b , CHECK ( asdl_stmt_seq* , _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
  5876. if (_res == NULL && PyErr_Occurred()) {
  5877. p->error_indicator = 1;
  5878. p->level--;
  5879. return NULL;
  5880. }
  5881. goto done;
  5882. }
  5883. p->mark = _mark;
  5884. D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  5885. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
  5886. }
  5887. { // 'if' named_expression ':' block else_block?
  5888. if (p->error_indicator) {
  5889. p->level--;
  5890. return NULL;
  5891. }
  5892. D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
  5893. Token * _keyword;
  5894. Token * _literal;
  5895. expr_ty a;
  5896. asdl_stmt_seq* b;
  5897. void *c;
  5898. if (
  5899. (_keyword = _PyPegen_expect_token(p, 642)) // token='if'
  5900. &&
  5901. (a = named_expression_rule(p)) // named_expression
  5902. &&
  5903. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  5904. &&
  5905. (b = block_rule(p)) // block
  5906. &&
  5907. (c = else_block_rule(p), !p->error_indicator) // else_block?
  5908. )
  5909. {
  5910. D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
  5911. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  5912. if (_token == NULL) {
  5913. p->level--;
  5914. return NULL;
  5915. }
  5916. int _end_lineno = _token->end_lineno;
  5917. UNUSED(_end_lineno); // Only used by EXTRA macro
  5918. int _end_col_offset = _token->end_col_offset;
  5919. UNUSED(_end_col_offset); // Only used by EXTRA macro
  5920. _res = _PyAST_If ( a , b , c , EXTRA );
  5921. if (_res == NULL && PyErr_Occurred()) {
  5922. p->error_indicator = 1;
  5923. p->level--;
  5924. return NULL;
  5925. }
  5926. goto done;
  5927. }
  5928. p->mark = _mark;
  5929. D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  5930. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block else_block?"));
  5931. }
  5932. _res = NULL;
  5933. done:
  5934. p->level--;
  5935. return _res;
  5936. }
  5937. // elif_stmt:
  5938. // | invalid_elif_stmt
  5939. // | 'elif' named_expression ':' block elif_stmt
  5940. // | 'elif' named_expression ':' block else_block?
  5941. static stmt_ty
  5942. elif_stmt_rule(Parser *p)
  5943. {
  5944. if (p->level++ == MAXSTACK) {
  5945. _Pypegen_stack_overflow(p);
  5946. }
  5947. if (p->error_indicator) {
  5948. p->level--;
  5949. return NULL;
  5950. }
  5951. stmt_ty _res = NULL;
  5952. int _mark = p->mark;
  5953. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  5954. p->error_indicator = 1;
  5955. p->level--;
  5956. return NULL;
  5957. }
  5958. int _start_lineno = p->tokens[_mark]->lineno;
  5959. UNUSED(_start_lineno); // Only used by EXTRA macro
  5960. int _start_col_offset = p->tokens[_mark]->col_offset;
  5961. UNUSED(_start_col_offset); // Only used by EXTRA macro
  5962. if (p->call_invalid_rules) { // invalid_elif_stmt
  5963. if (p->error_indicator) {
  5964. p->level--;
  5965. return NULL;
  5966. }
  5967. D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_elif_stmt"));
  5968. void *invalid_elif_stmt_var;
  5969. if (
  5970. (invalid_elif_stmt_var = invalid_elif_stmt_rule(p)) // invalid_elif_stmt
  5971. )
  5972. {
  5973. D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_elif_stmt"));
  5974. _res = invalid_elif_stmt_var;
  5975. goto done;
  5976. }
  5977. p->mark = _mark;
  5978. D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  5979. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_elif_stmt"));
  5980. }
  5981. { // 'elif' named_expression ':' block elif_stmt
  5982. if (p->error_indicator) {
  5983. p->level--;
  5984. return NULL;
  5985. }
  5986. D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
  5987. Token * _keyword;
  5988. Token * _literal;
  5989. expr_ty a;
  5990. asdl_stmt_seq* b;
  5991. stmt_ty c;
  5992. if (
  5993. (_keyword = _PyPegen_expect_token(p, 644)) // token='elif'
  5994. &&
  5995. (a = named_expression_rule(p)) // named_expression
  5996. &&
  5997. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  5998. &&
  5999. (b = block_rule(p)) // block
  6000. &&
  6001. (c = elif_stmt_rule(p)) // elif_stmt
  6002. )
  6003. {
  6004. D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
  6005. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  6006. if (_token == NULL) {
  6007. p->level--;
  6008. return NULL;
  6009. }
  6010. int _end_lineno = _token->end_lineno;
  6011. UNUSED(_end_lineno); // Only used by EXTRA macro
  6012. int _end_col_offset = _token->end_col_offset;
  6013. UNUSED(_end_col_offset); // Only used by EXTRA macro
  6014. _res = _PyAST_If ( a , b , CHECK ( asdl_stmt_seq* , _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
  6015. if (_res == NULL && PyErr_Occurred()) {
  6016. p->error_indicator = 1;
  6017. p->level--;
  6018. return NULL;
  6019. }
  6020. goto done;
  6021. }
  6022. p->mark = _mark;
  6023. D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6024. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
  6025. }
  6026. { // 'elif' named_expression ':' block else_block?
  6027. if (p->error_indicator) {
  6028. p->level--;
  6029. return NULL;
  6030. }
  6031. D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
  6032. Token * _keyword;
  6033. Token * _literal;
  6034. expr_ty a;
  6035. asdl_stmt_seq* b;
  6036. void *c;
  6037. if (
  6038. (_keyword = _PyPegen_expect_token(p, 644)) // token='elif'
  6039. &&
  6040. (a = named_expression_rule(p)) // named_expression
  6041. &&
  6042. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  6043. &&
  6044. (b = block_rule(p)) // block
  6045. &&
  6046. (c = else_block_rule(p), !p->error_indicator) // else_block?
  6047. )
  6048. {
  6049. D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
  6050. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  6051. if (_token == NULL) {
  6052. p->level--;
  6053. return NULL;
  6054. }
  6055. int _end_lineno = _token->end_lineno;
  6056. UNUSED(_end_lineno); // Only used by EXTRA macro
  6057. int _end_col_offset = _token->end_col_offset;
  6058. UNUSED(_end_col_offset); // Only used by EXTRA macro
  6059. _res = _PyAST_If ( a , b , c , EXTRA );
  6060. if (_res == NULL && PyErr_Occurred()) {
  6061. p->error_indicator = 1;
  6062. p->level--;
  6063. return NULL;
  6064. }
  6065. goto done;
  6066. }
  6067. p->mark = _mark;
  6068. D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6069. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block else_block?"));
  6070. }
  6071. _res = NULL;
  6072. done:
  6073. p->level--;
  6074. return _res;
  6075. }
  6076. // else_block: invalid_else_stmt | 'else' &&':' block
  6077. static asdl_stmt_seq*
  6078. else_block_rule(Parser *p)
  6079. {
  6080. if (p->level++ == MAXSTACK) {
  6081. _Pypegen_stack_overflow(p);
  6082. }
  6083. if (p->error_indicator) {
  6084. p->level--;
  6085. return NULL;
  6086. }
  6087. asdl_stmt_seq* _res = NULL;
  6088. int _mark = p->mark;
  6089. if (p->call_invalid_rules) { // invalid_else_stmt
  6090. if (p->error_indicator) {
  6091. p->level--;
  6092. return NULL;
  6093. }
  6094. D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_else_stmt"));
  6095. void *invalid_else_stmt_var;
  6096. if (
  6097. (invalid_else_stmt_var = invalid_else_stmt_rule(p)) // invalid_else_stmt
  6098. )
  6099. {
  6100. D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_else_stmt"));
  6101. _res = invalid_else_stmt_var;
  6102. goto done;
  6103. }
  6104. p->mark = _mark;
  6105. D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ',
  6106. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_else_stmt"));
  6107. }
  6108. { // 'else' &&':' block
  6109. if (p->error_indicator) {
  6110. p->level--;
  6111. return NULL;
  6112. }
  6113. D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' &&':' block"));
  6114. Token * _keyword;
  6115. Token * _literal;
  6116. asdl_stmt_seq* b;
  6117. if (
  6118. (_keyword = _PyPegen_expect_token(p, 645)) // token='else'
  6119. &&
  6120. (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
  6121. &&
  6122. (b = block_rule(p)) // block
  6123. )
  6124. {
  6125. D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' &&':' block"));
  6126. _res = b;
  6127. if (_res == NULL && PyErr_Occurred()) {
  6128. p->error_indicator = 1;
  6129. p->level--;
  6130. return NULL;
  6131. }
  6132. goto done;
  6133. }
  6134. p->mark = _mark;
  6135. D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ',
  6136. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' &&':' block"));
  6137. }
  6138. _res = NULL;
  6139. done:
  6140. p->level--;
  6141. return _res;
  6142. }
  6143. // while_stmt: invalid_while_stmt | 'while' named_expression ':' block else_block?
  6144. static stmt_ty
  6145. while_stmt_rule(Parser *p)
  6146. {
  6147. if (p->level++ == MAXSTACK) {
  6148. _Pypegen_stack_overflow(p);
  6149. }
  6150. if (p->error_indicator) {
  6151. p->level--;
  6152. return NULL;
  6153. }
  6154. stmt_ty _res = NULL;
  6155. int _mark = p->mark;
  6156. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  6157. p->error_indicator = 1;
  6158. p->level--;
  6159. return NULL;
  6160. }
  6161. int _start_lineno = p->tokens[_mark]->lineno;
  6162. UNUSED(_start_lineno); // Only used by EXTRA macro
  6163. int _start_col_offset = p->tokens[_mark]->col_offset;
  6164. UNUSED(_start_col_offset); // Only used by EXTRA macro
  6165. if (p->call_invalid_rules) { // invalid_while_stmt
  6166. if (p->error_indicator) {
  6167. p->level--;
  6168. return NULL;
  6169. }
  6170. D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_while_stmt"));
  6171. void *invalid_while_stmt_var;
  6172. if (
  6173. (invalid_while_stmt_var = invalid_while_stmt_rule(p)) // invalid_while_stmt
  6174. )
  6175. {
  6176. D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_while_stmt"));
  6177. _res = invalid_while_stmt_var;
  6178. goto done;
  6179. }
  6180. p->mark = _mark;
  6181. D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6182. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_while_stmt"));
  6183. }
  6184. { // 'while' named_expression ':' block else_block?
  6185. if (p->error_indicator) {
  6186. p->level--;
  6187. return NULL;
  6188. }
  6189. D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
  6190. Token * _keyword;
  6191. Token * _literal;
  6192. expr_ty a;
  6193. asdl_stmt_seq* b;
  6194. void *c;
  6195. if (
  6196. (_keyword = _PyPegen_expect_token(p, 647)) // token='while'
  6197. &&
  6198. (a = named_expression_rule(p)) // named_expression
  6199. &&
  6200. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  6201. &&
  6202. (b = block_rule(p)) // block
  6203. &&
  6204. (c = else_block_rule(p), !p->error_indicator) // else_block?
  6205. )
  6206. {
  6207. D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
  6208. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  6209. if (_token == NULL) {
  6210. p->level--;
  6211. return NULL;
  6212. }
  6213. int _end_lineno = _token->end_lineno;
  6214. UNUSED(_end_lineno); // Only used by EXTRA macro
  6215. int _end_col_offset = _token->end_col_offset;
  6216. UNUSED(_end_col_offset); // Only used by EXTRA macro
  6217. _res = _PyAST_While ( a , b , c , EXTRA );
  6218. if (_res == NULL && PyErr_Occurred()) {
  6219. p->error_indicator = 1;
  6220. p->level--;
  6221. return NULL;
  6222. }
  6223. goto done;
  6224. }
  6225. p->mark = _mark;
  6226. D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6227. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression ':' block else_block?"));
  6228. }
  6229. _res = NULL;
  6230. done:
  6231. p->level--;
  6232. return _res;
  6233. }
  6234. // for_stmt:
  6235. // | invalid_for_stmt
  6236. // | 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
  6237. // | ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
  6238. // | invalid_for_target
  6239. static stmt_ty
  6240. for_stmt_rule(Parser *p)
  6241. {
  6242. if (p->level++ == MAXSTACK) {
  6243. _Pypegen_stack_overflow(p);
  6244. }
  6245. if (p->error_indicator) {
  6246. p->level--;
  6247. return NULL;
  6248. }
  6249. stmt_ty _res = NULL;
  6250. int _mark = p->mark;
  6251. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  6252. p->error_indicator = 1;
  6253. p->level--;
  6254. return NULL;
  6255. }
  6256. int _start_lineno = p->tokens[_mark]->lineno;
  6257. UNUSED(_start_lineno); // Only used by EXTRA macro
  6258. int _start_col_offset = p->tokens[_mark]->col_offset;
  6259. UNUSED(_start_col_offset); // Only used by EXTRA macro
  6260. if (p->call_invalid_rules) { // invalid_for_stmt
  6261. if (p->error_indicator) {
  6262. p->level--;
  6263. return NULL;
  6264. }
  6265. D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_stmt"));
  6266. void *invalid_for_stmt_var;
  6267. if (
  6268. (invalid_for_stmt_var = invalid_for_stmt_rule(p)) // invalid_for_stmt
  6269. )
  6270. {
  6271. D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_stmt"));
  6272. _res = invalid_for_stmt_var;
  6273. goto done;
  6274. }
  6275. p->mark = _mark;
  6276. D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6277. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_stmt"));
  6278. }
  6279. { // 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
  6280. if (p->error_indicator) {
  6281. p->level--;
  6282. return NULL;
  6283. }
  6284. D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
  6285. int _cut_var = 0;
  6286. Token * _keyword;
  6287. Token * _keyword_1;
  6288. Token * _literal;
  6289. asdl_stmt_seq* b;
  6290. void *el;
  6291. expr_ty ex;
  6292. expr_ty t;
  6293. void *tc;
  6294. if (
  6295. (_keyword = _PyPegen_expect_token(p, 650)) // token='for'
  6296. &&
  6297. (t = star_targets_rule(p)) // star_targets
  6298. &&
  6299. (_keyword_1 = _PyPegen_expect_token(p, 651)) // token='in'
  6300. &&
  6301. (_cut_var = 1)
  6302. &&
  6303. (ex = star_expressions_rule(p)) // star_expressions
  6304. &&
  6305. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  6306. &&
  6307. (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
  6308. &&
  6309. (b = block_rule(p)) // block
  6310. &&
  6311. (el = else_block_rule(p), !p->error_indicator) // else_block?
  6312. )
  6313. {
  6314. D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
  6315. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  6316. if (_token == NULL) {
  6317. p->level--;
  6318. return NULL;
  6319. }
  6320. int _end_lineno = _token->end_lineno;
  6321. UNUSED(_end_lineno); // Only used by EXTRA macro
  6322. int _end_col_offset = _token->end_col_offset;
  6323. UNUSED(_end_col_offset); // Only used by EXTRA macro
  6324. _res = _PyAST_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
  6325. if (_res == NULL && PyErr_Occurred()) {
  6326. p->error_indicator = 1;
  6327. p->level--;
  6328. return NULL;
  6329. }
  6330. goto done;
  6331. }
  6332. p->mark = _mark;
  6333. D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6334. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
  6335. if (_cut_var) {
  6336. p->level--;
  6337. return NULL;
  6338. }
  6339. }
  6340. { // ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
  6341. if (p->error_indicator) {
  6342. p->level--;
  6343. return NULL;
  6344. }
  6345. D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
  6346. int _cut_var = 0;
  6347. Token * _keyword;
  6348. Token * _keyword_1;
  6349. Token * _literal;
  6350. Token * async_var;
  6351. asdl_stmt_seq* b;
  6352. void *el;
  6353. expr_ty ex;
  6354. expr_ty t;
  6355. void *tc;
  6356. if (
  6357. (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
  6358. &&
  6359. (_keyword = _PyPegen_expect_token(p, 650)) // token='for'
  6360. &&
  6361. (t = star_targets_rule(p)) // star_targets
  6362. &&
  6363. (_keyword_1 = _PyPegen_expect_token(p, 651)) // token='in'
  6364. &&
  6365. (_cut_var = 1)
  6366. &&
  6367. (ex = star_expressions_rule(p)) // star_expressions
  6368. &&
  6369. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  6370. &&
  6371. (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
  6372. &&
  6373. (b = block_rule(p)) // block
  6374. &&
  6375. (el = else_block_rule(p), !p->error_indicator) // else_block?
  6376. )
  6377. {
  6378. D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
  6379. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  6380. if (_token == NULL) {
  6381. p->level--;
  6382. return NULL;
  6383. }
  6384. int _end_lineno = _token->end_lineno;
  6385. UNUSED(_end_lineno); // Only used by EXTRA macro
  6386. int _end_col_offset = _token->end_col_offset;
  6387. UNUSED(_end_col_offset); // Only used by EXTRA macro
  6388. _res = CHECK_VERSION ( stmt_ty , 5 , "Async for loops are" , _PyAST_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
  6389. if (_res == NULL && PyErr_Occurred()) {
  6390. p->error_indicator = 1;
  6391. p->level--;
  6392. return NULL;
  6393. }
  6394. goto done;
  6395. }
  6396. p->mark = _mark;
  6397. D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6398. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
  6399. if (_cut_var) {
  6400. p->level--;
  6401. return NULL;
  6402. }
  6403. }
  6404. if (p->call_invalid_rules) { // invalid_for_target
  6405. if (p->error_indicator) {
  6406. p->level--;
  6407. return NULL;
  6408. }
  6409. D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
  6410. void *invalid_for_target_var;
  6411. if (
  6412. (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
  6413. )
  6414. {
  6415. D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
  6416. _res = invalid_for_target_var;
  6417. goto done;
  6418. }
  6419. p->mark = _mark;
  6420. D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6421. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
  6422. }
  6423. _res = NULL;
  6424. done:
  6425. p->level--;
  6426. return _res;
  6427. }
  6428. // with_stmt:
  6429. // | invalid_with_stmt_indent
  6430. // | 'with' '(' ','.with_item+ ','? ')' ':' block
  6431. // | 'with' ','.with_item+ ':' TYPE_COMMENT? block
  6432. // | ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
  6433. // | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
  6434. // | invalid_with_stmt
  6435. static stmt_ty
  6436. with_stmt_rule(Parser *p)
  6437. {
  6438. if (p->level++ == MAXSTACK) {
  6439. _Pypegen_stack_overflow(p);
  6440. }
  6441. if (p->error_indicator) {
  6442. p->level--;
  6443. return NULL;
  6444. }
  6445. stmt_ty _res = NULL;
  6446. int _mark = p->mark;
  6447. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  6448. p->error_indicator = 1;
  6449. p->level--;
  6450. return NULL;
  6451. }
  6452. int _start_lineno = p->tokens[_mark]->lineno;
  6453. UNUSED(_start_lineno); // Only used by EXTRA macro
  6454. int _start_col_offset = p->tokens[_mark]->col_offset;
  6455. UNUSED(_start_col_offset); // Only used by EXTRA macro
  6456. if (p->call_invalid_rules) { // invalid_with_stmt_indent
  6457. if (p->error_indicator) {
  6458. p->level--;
  6459. return NULL;
  6460. }
  6461. D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt_indent"));
  6462. void *invalid_with_stmt_indent_var;
  6463. if (
  6464. (invalid_with_stmt_indent_var = invalid_with_stmt_indent_rule(p)) // invalid_with_stmt_indent
  6465. )
  6466. {
  6467. D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt_indent"));
  6468. _res = invalid_with_stmt_indent_var;
  6469. goto done;
  6470. }
  6471. p->mark = _mark;
  6472. D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6473. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_stmt_indent"));
  6474. }
  6475. { // 'with' '(' ','.with_item+ ','? ')' ':' block
  6476. if (p->error_indicator) {
  6477. p->level--;
  6478. return NULL;
  6479. }
  6480. D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
  6481. Token * _keyword;
  6482. Token * _literal;
  6483. Token * _literal_1;
  6484. Token * _literal_2;
  6485. void *_opt_var;
  6486. UNUSED(_opt_var); // Silence compiler warnings
  6487. asdl_withitem_seq* a;
  6488. asdl_stmt_seq* b;
  6489. if (
  6490. (_keyword = _PyPegen_expect_token(p, 615)) // token='with'
  6491. &&
  6492. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  6493. &&
  6494. (a = (asdl_withitem_seq*)_gather_51_rule(p)) // ','.with_item+
  6495. &&
  6496. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  6497. &&
  6498. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  6499. &&
  6500. (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
  6501. &&
  6502. (b = block_rule(p)) // block
  6503. )
  6504. {
  6505. D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
  6506. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  6507. if (_token == NULL) {
  6508. p->level--;
  6509. return NULL;
  6510. }
  6511. int _end_lineno = _token->end_lineno;
  6512. UNUSED(_end_lineno); // Only used by EXTRA macro
  6513. int _end_col_offset = _token->end_col_offset;
  6514. UNUSED(_end_col_offset); // Only used by EXTRA macro
  6515. _res = _PyAST_With ( a , b , NULL , EXTRA );
  6516. if (_res == NULL && PyErr_Occurred()) {
  6517. p->error_indicator = 1;
  6518. p->level--;
  6519. return NULL;
  6520. }
  6521. goto done;
  6522. }
  6523. p->mark = _mark;
  6524. D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6525. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
  6526. }
  6527. { // 'with' ','.with_item+ ':' TYPE_COMMENT? block
  6528. if (p->error_indicator) {
  6529. p->level--;
  6530. return NULL;
  6531. }
  6532. D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
  6533. Token * _keyword;
  6534. Token * _literal;
  6535. asdl_withitem_seq* a;
  6536. asdl_stmt_seq* b;
  6537. void *tc;
  6538. if (
  6539. (_keyword = _PyPegen_expect_token(p, 615)) // token='with'
  6540. &&
  6541. (a = (asdl_withitem_seq*)_gather_53_rule(p)) // ','.with_item+
  6542. &&
  6543. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  6544. &&
  6545. (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
  6546. &&
  6547. (b = block_rule(p)) // block
  6548. )
  6549. {
  6550. D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
  6551. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  6552. if (_token == NULL) {
  6553. p->level--;
  6554. return NULL;
  6555. }
  6556. int _end_lineno = _token->end_lineno;
  6557. UNUSED(_end_lineno); // Only used by EXTRA macro
  6558. int _end_col_offset = _token->end_col_offset;
  6559. UNUSED(_end_col_offset); // Only used by EXTRA macro
  6560. _res = _PyAST_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
  6561. if (_res == NULL && PyErr_Occurred()) {
  6562. p->error_indicator = 1;
  6563. p->level--;
  6564. return NULL;
  6565. }
  6566. goto done;
  6567. }
  6568. p->mark = _mark;
  6569. D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6570. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
  6571. }
  6572. { // ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
  6573. if (p->error_indicator) {
  6574. p->level--;
  6575. return NULL;
  6576. }
  6577. D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
  6578. Token * _keyword;
  6579. Token * _literal;
  6580. Token * _literal_1;
  6581. Token * _literal_2;
  6582. void *_opt_var;
  6583. UNUSED(_opt_var); // Silence compiler warnings
  6584. asdl_withitem_seq* a;
  6585. Token * async_var;
  6586. asdl_stmt_seq* b;
  6587. if (
  6588. (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
  6589. &&
  6590. (_keyword = _PyPegen_expect_token(p, 615)) // token='with'
  6591. &&
  6592. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  6593. &&
  6594. (a = (asdl_withitem_seq*)_gather_55_rule(p)) // ','.with_item+
  6595. &&
  6596. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  6597. &&
  6598. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  6599. &&
  6600. (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
  6601. &&
  6602. (b = block_rule(p)) // block
  6603. )
  6604. {
  6605. D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
  6606. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  6607. if (_token == NULL) {
  6608. p->level--;
  6609. return NULL;
  6610. }
  6611. int _end_lineno = _token->end_lineno;
  6612. UNUSED(_end_lineno); // Only used by EXTRA macro
  6613. int _end_col_offset = _token->end_col_offset;
  6614. UNUSED(_end_col_offset); // Only used by EXTRA macro
  6615. _res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _PyAST_AsyncWith ( a , b , NULL , EXTRA ) );
  6616. if (_res == NULL && PyErr_Occurred()) {
  6617. p->error_indicator = 1;
  6618. p->level--;
  6619. return NULL;
  6620. }
  6621. goto done;
  6622. }
  6623. p->mark = _mark;
  6624. D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6625. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
  6626. }
  6627. { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
  6628. if (p->error_indicator) {
  6629. p->level--;
  6630. return NULL;
  6631. }
  6632. D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
  6633. Token * _keyword;
  6634. Token * _literal;
  6635. asdl_withitem_seq* a;
  6636. Token * async_var;
  6637. asdl_stmt_seq* b;
  6638. void *tc;
  6639. if (
  6640. (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
  6641. &&
  6642. (_keyword = _PyPegen_expect_token(p, 615)) // token='with'
  6643. &&
  6644. (a = (asdl_withitem_seq*)_gather_57_rule(p)) // ','.with_item+
  6645. &&
  6646. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  6647. &&
  6648. (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
  6649. &&
  6650. (b = block_rule(p)) // block
  6651. )
  6652. {
  6653. D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
  6654. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  6655. if (_token == NULL) {
  6656. p->level--;
  6657. return NULL;
  6658. }
  6659. int _end_lineno = _token->end_lineno;
  6660. UNUSED(_end_lineno); // Only used by EXTRA macro
  6661. int _end_col_offset = _token->end_col_offset;
  6662. UNUSED(_end_col_offset); // Only used by EXTRA macro
  6663. _res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _PyAST_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
  6664. if (_res == NULL && PyErr_Occurred()) {
  6665. p->error_indicator = 1;
  6666. p->level--;
  6667. return NULL;
  6668. }
  6669. goto done;
  6670. }
  6671. p->mark = _mark;
  6672. D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6673. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
  6674. }
  6675. if (p->call_invalid_rules) { // invalid_with_stmt
  6676. if (p->error_indicator) {
  6677. p->level--;
  6678. return NULL;
  6679. }
  6680. D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt"));
  6681. void *invalid_with_stmt_var;
  6682. if (
  6683. (invalid_with_stmt_var = invalid_with_stmt_rule(p)) // invalid_with_stmt
  6684. )
  6685. {
  6686. D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt"));
  6687. _res = invalid_with_stmt_var;
  6688. goto done;
  6689. }
  6690. p->mark = _mark;
  6691. D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6692. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_stmt"));
  6693. }
  6694. _res = NULL;
  6695. done:
  6696. p->level--;
  6697. return _res;
  6698. }
  6699. // with_item:
  6700. // | expression 'as' star_target &(',' | ')' | ':')
  6701. // | invalid_with_item
  6702. // | expression
  6703. static withitem_ty
  6704. with_item_rule(Parser *p)
  6705. {
  6706. if (p->level++ == MAXSTACK) {
  6707. _Pypegen_stack_overflow(p);
  6708. }
  6709. if (p->error_indicator) {
  6710. p->level--;
  6711. return NULL;
  6712. }
  6713. withitem_ty _res = NULL;
  6714. int _mark = p->mark;
  6715. { // expression 'as' star_target &(',' | ')' | ':')
  6716. if (p->error_indicator) {
  6717. p->level--;
  6718. return NULL;
  6719. }
  6720. D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
  6721. Token * _keyword;
  6722. expr_ty e;
  6723. expr_ty t;
  6724. if (
  6725. (e = expression_rule(p)) // expression
  6726. &&
  6727. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  6728. &&
  6729. (t = star_target_rule(p)) // star_target
  6730. &&
  6731. _PyPegen_lookahead(1, _tmp_59_rule, p)
  6732. )
  6733. {
  6734. D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
  6735. _res = _PyAST_withitem ( e , t , p -> arena );
  6736. if (_res == NULL && PyErr_Occurred()) {
  6737. p->error_indicator = 1;
  6738. p->level--;
  6739. return NULL;
  6740. }
  6741. goto done;
  6742. }
  6743. p->mark = _mark;
  6744. D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
  6745. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
  6746. }
  6747. if (p->call_invalid_rules) { // invalid_with_item
  6748. if (p->error_indicator) {
  6749. p->level--;
  6750. return NULL;
  6751. }
  6752. D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
  6753. void *invalid_with_item_var;
  6754. if (
  6755. (invalid_with_item_var = invalid_with_item_rule(p)) // invalid_with_item
  6756. )
  6757. {
  6758. D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
  6759. _res = invalid_with_item_var;
  6760. goto done;
  6761. }
  6762. p->mark = _mark;
  6763. D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
  6764. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_item"));
  6765. }
  6766. { // expression
  6767. if (p->error_indicator) {
  6768. p->level--;
  6769. return NULL;
  6770. }
  6771. D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
  6772. expr_ty e;
  6773. if (
  6774. (e = expression_rule(p)) // expression
  6775. )
  6776. {
  6777. D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
  6778. _res = _PyAST_withitem ( e , NULL , p -> arena );
  6779. if (_res == NULL && PyErr_Occurred()) {
  6780. p->error_indicator = 1;
  6781. p->level--;
  6782. return NULL;
  6783. }
  6784. goto done;
  6785. }
  6786. p->mark = _mark;
  6787. D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
  6788. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
  6789. }
  6790. _res = NULL;
  6791. done:
  6792. p->level--;
  6793. return _res;
  6794. }
  6795. // try_stmt:
  6796. // | invalid_try_stmt
  6797. // | 'try' &&':' block finally_block
  6798. // | 'try' &&':' block except_block+ else_block? finally_block?
  6799. // | 'try' &&':' block except_star_block+ else_block? finally_block?
  6800. static stmt_ty
  6801. try_stmt_rule(Parser *p)
  6802. {
  6803. if (p->level++ == MAXSTACK) {
  6804. _Pypegen_stack_overflow(p);
  6805. }
  6806. if (p->error_indicator) {
  6807. p->level--;
  6808. return NULL;
  6809. }
  6810. stmt_ty _res = NULL;
  6811. int _mark = p->mark;
  6812. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  6813. p->error_indicator = 1;
  6814. p->level--;
  6815. return NULL;
  6816. }
  6817. int _start_lineno = p->tokens[_mark]->lineno;
  6818. UNUSED(_start_lineno); // Only used by EXTRA macro
  6819. int _start_col_offset = p->tokens[_mark]->col_offset;
  6820. UNUSED(_start_col_offset); // Only used by EXTRA macro
  6821. if (p->call_invalid_rules) { // invalid_try_stmt
  6822. if (p->error_indicator) {
  6823. p->level--;
  6824. return NULL;
  6825. }
  6826. D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_try_stmt"));
  6827. void *invalid_try_stmt_var;
  6828. if (
  6829. (invalid_try_stmt_var = invalid_try_stmt_rule(p)) // invalid_try_stmt
  6830. )
  6831. {
  6832. D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_try_stmt"));
  6833. _res = invalid_try_stmt_var;
  6834. goto done;
  6835. }
  6836. p->mark = _mark;
  6837. D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6838. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_try_stmt"));
  6839. }
  6840. { // 'try' &&':' block finally_block
  6841. if (p->error_indicator) {
  6842. p->level--;
  6843. return NULL;
  6844. }
  6845. D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' &&':' block finally_block"));
  6846. Token * _keyword;
  6847. Token * _literal;
  6848. asdl_stmt_seq* b;
  6849. asdl_stmt_seq* f;
  6850. if (
  6851. (_keyword = _PyPegen_expect_token(p, 624)) // token='try'
  6852. &&
  6853. (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
  6854. &&
  6855. (b = block_rule(p)) // block
  6856. &&
  6857. (f = finally_block_rule(p)) // finally_block
  6858. )
  6859. {
  6860. D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' &&':' block finally_block"));
  6861. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  6862. if (_token == NULL) {
  6863. p->level--;
  6864. return NULL;
  6865. }
  6866. int _end_lineno = _token->end_lineno;
  6867. UNUSED(_end_lineno); // Only used by EXTRA macro
  6868. int _end_col_offset = _token->end_col_offset;
  6869. UNUSED(_end_col_offset); // Only used by EXTRA macro
  6870. _res = _PyAST_Try ( b , NULL , NULL , f , EXTRA );
  6871. if (_res == NULL && PyErr_Occurred()) {
  6872. p->error_indicator = 1;
  6873. p->level--;
  6874. return NULL;
  6875. }
  6876. goto done;
  6877. }
  6878. p->mark = _mark;
  6879. D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6880. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' &&':' block finally_block"));
  6881. }
  6882. { // 'try' &&':' block except_block+ else_block? finally_block?
  6883. if (p->error_indicator) {
  6884. p->level--;
  6885. return NULL;
  6886. }
  6887. D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?"));
  6888. Token * _keyword;
  6889. Token * _literal;
  6890. asdl_stmt_seq* b;
  6891. void *el;
  6892. asdl_excepthandler_seq* ex;
  6893. void *f;
  6894. if (
  6895. (_keyword = _PyPegen_expect_token(p, 624)) // token='try'
  6896. &&
  6897. (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
  6898. &&
  6899. (b = block_rule(p)) // block
  6900. &&
  6901. (ex = (asdl_excepthandler_seq*)_loop1_60_rule(p)) // except_block+
  6902. &&
  6903. (el = else_block_rule(p), !p->error_indicator) // else_block?
  6904. &&
  6905. (f = finally_block_rule(p), !p->error_indicator) // finally_block?
  6906. )
  6907. {
  6908. D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?"));
  6909. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  6910. if (_token == NULL) {
  6911. p->level--;
  6912. return NULL;
  6913. }
  6914. int _end_lineno = _token->end_lineno;
  6915. UNUSED(_end_lineno); // Only used by EXTRA macro
  6916. int _end_col_offset = _token->end_col_offset;
  6917. UNUSED(_end_col_offset); // Only used by EXTRA macro
  6918. _res = _PyAST_Try ( b , ex , el , f , EXTRA );
  6919. if (_res == NULL && PyErr_Occurred()) {
  6920. p->error_indicator = 1;
  6921. p->level--;
  6922. return NULL;
  6923. }
  6924. goto done;
  6925. }
  6926. p->mark = _mark;
  6927. D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6928. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?"));
  6929. }
  6930. { // 'try' &&':' block except_star_block+ else_block? finally_block?
  6931. if (p->error_indicator) {
  6932. p->level--;
  6933. return NULL;
  6934. }
  6935. D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_star_block+ else_block? finally_block?"));
  6936. Token * _keyword;
  6937. Token * _literal;
  6938. asdl_stmt_seq* b;
  6939. void *el;
  6940. asdl_excepthandler_seq* ex;
  6941. void *f;
  6942. if (
  6943. (_keyword = _PyPegen_expect_token(p, 624)) // token='try'
  6944. &&
  6945. (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
  6946. &&
  6947. (b = block_rule(p)) // block
  6948. &&
  6949. (ex = (asdl_excepthandler_seq*)_loop1_61_rule(p)) // except_star_block+
  6950. &&
  6951. (el = else_block_rule(p), !p->error_indicator) // else_block?
  6952. &&
  6953. (f = finally_block_rule(p), !p->error_indicator) // finally_block?
  6954. )
  6955. {
  6956. D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_star_block+ else_block? finally_block?"));
  6957. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  6958. if (_token == NULL) {
  6959. p->level--;
  6960. return NULL;
  6961. }
  6962. int _end_lineno = _token->end_lineno;
  6963. UNUSED(_end_lineno); // Only used by EXTRA macro
  6964. int _end_col_offset = _token->end_col_offset;
  6965. UNUSED(_end_col_offset); // Only used by EXTRA macro
  6966. _res = CHECK_VERSION ( stmt_ty , 11 , "Exception groups are" , _PyAST_TryStar ( b , ex , el , f , EXTRA ) );
  6967. if (_res == NULL && PyErr_Occurred()) {
  6968. p->error_indicator = 1;
  6969. p->level--;
  6970. return NULL;
  6971. }
  6972. goto done;
  6973. }
  6974. p->mark = _mark;
  6975. D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  6976. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' &&':' block except_star_block+ else_block? finally_block?"));
  6977. }
  6978. _res = NULL;
  6979. done:
  6980. p->level--;
  6981. return _res;
  6982. }
  6983. // except_block:
  6984. // | invalid_except_stmt_indent
  6985. // | 'except' expression ['as' NAME] ':' block
  6986. // | 'except' ':' block
  6987. // | invalid_except_stmt
  6988. static excepthandler_ty
  6989. except_block_rule(Parser *p)
  6990. {
  6991. if (p->level++ == MAXSTACK) {
  6992. _Pypegen_stack_overflow(p);
  6993. }
  6994. if (p->error_indicator) {
  6995. p->level--;
  6996. return NULL;
  6997. }
  6998. excepthandler_ty _res = NULL;
  6999. int _mark = p->mark;
  7000. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  7001. p->error_indicator = 1;
  7002. p->level--;
  7003. return NULL;
  7004. }
  7005. int _start_lineno = p->tokens[_mark]->lineno;
  7006. UNUSED(_start_lineno); // Only used by EXTRA macro
  7007. int _start_col_offset = p->tokens[_mark]->col_offset;
  7008. UNUSED(_start_col_offset); // Only used by EXTRA macro
  7009. if (p->call_invalid_rules) { // invalid_except_stmt_indent
  7010. if (p->error_indicator) {
  7011. p->level--;
  7012. return NULL;
  7013. }
  7014. D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt_indent"));
  7015. void *invalid_except_stmt_indent_var;
  7016. if (
  7017. (invalid_except_stmt_indent_var = invalid_except_stmt_indent_rule(p)) // invalid_except_stmt_indent
  7018. )
  7019. {
  7020. D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt_indent"));
  7021. _res = invalid_except_stmt_indent_var;
  7022. goto done;
  7023. }
  7024. p->mark = _mark;
  7025. D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
  7026. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_stmt_indent"));
  7027. }
  7028. { // 'except' expression ['as' NAME] ':' block
  7029. if (p->error_indicator) {
  7030. p->level--;
  7031. return NULL;
  7032. }
  7033. D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
  7034. Token * _keyword;
  7035. Token * _literal;
  7036. asdl_stmt_seq* b;
  7037. expr_ty e;
  7038. void *t;
  7039. if (
  7040. (_keyword = _PyPegen_expect_token(p, 637)) // token='except'
  7041. &&
  7042. (e = expression_rule(p)) // expression
  7043. &&
  7044. (t = _tmp_62_rule(p), !p->error_indicator) // ['as' NAME]
  7045. &&
  7046. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  7047. &&
  7048. (b = block_rule(p)) // block
  7049. )
  7050. {
  7051. D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
  7052. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  7053. if (_token == NULL) {
  7054. p->level--;
  7055. return NULL;
  7056. }
  7057. int _end_lineno = _token->end_lineno;
  7058. UNUSED(_end_lineno); // Only used by EXTRA macro
  7059. int _end_col_offset = _token->end_col_offset;
  7060. UNUSED(_end_col_offset); // Only used by EXTRA macro
  7061. _res = _PyAST_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
  7062. if (_res == NULL && PyErr_Occurred()) {
  7063. p->error_indicator = 1;
  7064. p->level--;
  7065. return NULL;
  7066. }
  7067. goto done;
  7068. }
  7069. p->mark = _mark;
  7070. D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
  7071. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
  7072. }
  7073. { // 'except' ':' block
  7074. if (p->error_indicator) {
  7075. p->level--;
  7076. return NULL;
  7077. }
  7078. D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
  7079. Token * _keyword;
  7080. Token * _literal;
  7081. asdl_stmt_seq* b;
  7082. if (
  7083. (_keyword = _PyPegen_expect_token(p, 637)) // token='except'
  7084. &&
  7085. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  7086. &&
  7087. (b = block_rule(p)) // block
  7088. )
  7089. {
  7090. D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
  7091. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  7092. if (_token == NULL) {
  7093. p->level--;
  7094. return NULL;
  7095. }
  7096. int _end_lineno = _token->end_lineno;
  7097. UNUSED(_end_lineno); // Only used by EXTRA macro
  7098. int _end_col_offset = _token->end_col_offset;
  7099. UNUSED(_end_col_offset); // Only used by EXTRA macro
  7100. _res = _PyAST_ExceptHandler ( NULL , NULL , b , EXTRA );
  7101. if (_res == NULL && PyErr_Occurred()) {
  7102. p->error_indicator = 1;
  7103. p->level--;
  7104. return NULL;
  7105. }
  7106. goto done;
  7107. }
  7108. p->mark = _mark;
  7109. D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
  7110. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block"));
  7111. }
  7112. if (p->call_invalid_rules) { // invalid_except_stmt
  7113. if (p->error_indicator) {
  7114. p->level--;
  7115. return NULL;
  7116. }
  7117. D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt"));
  7118. void *invalid_except_stmt_var;
  7119. if (
  7120. (invalid_except_stmt_var = invalid_except_stmt_rule(p)) // invalid_except_stmt
  7121. )
  7122. {
  7123. D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt"));
  7124. _res = invalid_except_stmt_var;
  7125. goto done;
  7126. }
  7127. p->mark = _mark;
  7128. D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
  7129. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_stmt"));
  7130. }
  7131. _res = NULL;
  7132. done:
  7133. p->level--;
  7134. return _res;
  7135. }
  7136. // except_star_block:
  7137. // | invalid_except_star_stmt_indent
  7138. // | 'except' '*' expression ['as' NAME] ':' block
  7139. // | invalid_except_stmt
  7140. static excepthandler_ty
  7141. except_star_block_rule(Parser *p)
  7142. {
  7143. if (p->level++ == MAXSTACK) {
  7144. _Pypegen_stack_overflow(p);
  7145. }
  7146. if (p->error_indicator) {
  7147. p->level--;
  7148. return NULL;
  7149. }
  7150. excepthandler_ty _res = NULL;
  7151. int _mark = p->mark;
  7152. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  7153. p->error_indicator = 1;
  7154. p->level--;
  7155. return NULL;
  7156. }
  7157. int _start_lineno = p->tokens[_mark]->lineno;
  7158. UNUSED(_start_lineno); // Only used by EXTRA macro
  7159. int _start_col_offset = p->tokens[_mark]->col_offset;
  7160. UNUSED(_start_col_offset); // Only used by EXTRA macro
  7161. if (p->call_invalid_rules) { // invalid_except_star_stmt_indent
  7162. if (p->error_indicator) {
  7163. p->level--;
  7164. return NULL;
  7165. }
  7166. D(fprintf(stderr, "%*c> except_star_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_star_stmt_indent"));
  7167. void *invalid_except_star_stmt_indent_var;
  7168. if (
  7169. (invalid_except_star_stmt_indent_var = invalid_except_star_stmt_indent_rule(p)) // invalid_except_star_stmt_indent
  7170. )
  7171. {
  7172. D(fprintf(stderr, "%*c+ except_star_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_star_stmt_indent"));
  7173. _res = invalid_except_star_stmt_indent_var;
  7174. goto done;
  7175. }
  7176. p->mark = _mark;
  7177. D(fprintf(stderr, "%*c%s except_star_block[%d-%d]: %s failed!\n", p->level, ' ',
  7178. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_star_stmt_indent"));
  7179. }
  7180. { // 'except' '*' expression ['as' NAME] ':' block
  7181. if (p->error_indicator) {
  7182. p->level--;
  7183. return NULL;
  7184. }
  7185. D(fprintf(stderr, "%*c> except_star_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] ':' block"));
  7186. Token * _keyword;
  7187. Token * _literal;
  7188. Token * _literal_1;
  7189. asdl_stmt_seq* b;
  7190. expr_ty e;
  7191. void *t;
  7192. if (
  7193. (_keyword = _PyPegen_expect_token(p, 637)) // token='except'
  7194. &&
  7195. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  7196. &&
  7197. (e = expression_rule(p)) // expression
  7198. &&
  7199. (t = _tmp_63_rule(p), !p->error_indicator) // ['as' NAME]
  7200. &&
  7201. (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
  7202. &&
  7203. (b = block_rule(p)) // block
  7204. )
  7205. {
  7206. D(fprintf(stderr, "%*c+ except_star_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] ':' block"));
  7207. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  7208. if (_token == NULL) {
  7209. p->level--;
  7210. return NULL;
  7211. }
  7212. int _end_lineno = _token->end_lineno;
  7213. UNUSED(_end_lineno); // Only used by EXTRA macro
  7214. int _end_col_offset = _token->end_col_offset;
  7215. UNUSED(_end_col_offset); // Only used by EXTRA macro
  7216. _res = _PyAST_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
  7217. if (_res == NULL && PyErr_Occurred()) {
  7218. p->error_indicator = 1;
  7219. p->level--;
  7220. return NULL;
  7221. }
  7222. goto done;
  7223. }
  7224. p->mark = _mark;
  7225. D(fprintf(stderr, "%*c%s except_star_block[%d-%d]: %s failed!\n", p->level, ' ',
  7226. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression ['as' NAME] ':' block"));
  7227. }
  7228. if (p->call_invalid_rules) { // invalid_except_stmt
  7229. if (p->error_indicator) {
  7230. p->level--;
  7231. return NULL;
  7232. }
  7233. D(fprintf(stderr, "%*c> except_star_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt"));
  7234. void *invalid_except_stmt_var;
  7235. if (
  7236. (invalid_except_stmt_var = invalid_except_stmt_rule(p)) // invalid_except_stmt
  7237. )
  7238. {
  7239. D(fprintf(stderr, "%*c+ except_star_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt"));
  7240. _res = invalid_except_stmt_var;
  7241. goto done;
  7242. }
  7243. p->mark = _mark;
  7244. D(fprintf(stderr, "%*c%s except_star_block[%d-%d]: %s failed!\n", p->level, ' ',
  7245. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_stmt"));
  7246. }
  7247. _res = NULL;
  7248. done:
  7249. p->level--;
  7250. return _res;
  7251. }
  7252. // finally_block: invalid_finally_stmt | 'finally' &&':' block
  7253. static asdl_stmt_seq*
  7254. finally_block_rule(Parser *p)
  7255. {
  7256. if (p->level++ == MAXSTACK) {
  7257. _Pypegen_stack_overflow(p);
  7258. }
  7259. if (p->error_indicator) {
  7260. p->level--;
  7261. return NULL;
  7262. }
  7263. asdl_stmt_seq* _res = NULL;
  7264. int _mark = p->mark;
  7265. if (p->call_invalid_rules) { // invalid_finally_stmt
  7266. if (p->error_indicator) {
  7267. p->level--;
  7268. return NULL;
  7269. }
  7270. D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_finally_stmt"));
  7271. void *invalid_finally_stmt_var;
  7272. if (
  7273. (invalid_finally_stmt_var = invalid_finally_stmt_rule(p)) // invalid_finally_stmt
  7274. )
  7275. {
  7276. D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_finally_stmt"));
  7277. _res = invalid_finally_stmt_var;
  7278. goto done;
  7279. }
  7280. p->mark = _mark;
  7281. D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ',
  7282. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_finally_stmt"));
  7283. }
  7284. { // 'finally' &&':' block
  7285. if (p->error_indicator) {
  7286. p->level--;
  7287. return NULL;
  7288. }
  7289. D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' &&':' block"));
  7290. Token * _keyword;
  7291. Token * _literal;
  7292. asdl_stmt_seq* a;
  7293. if (
  7294. (_keyword = _PyPegen_expect_token(p, 633)) // token='finally'
  7295. &&
  7296. (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
  7297. &&
  7298. (a = block_rule(p)) // block
  7299. )
  7300. {
  7301. D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' &&':' block"));
  7302. _res = a;
  7303. if (_res == NULL && PyErr_Occurred()) {
  7304. p->error_indicator = 1;
  7305. p->level--;
  7306. return NULL;
  7307. }
  7308. goto done;
  7309. }
  7310. p->mark = _mark;
  7311. D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ',
  7312. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' &&':' block"));
  7313. }
  7314. _res = NULL;
  7315. done:
  7316. p->level--;
  7317. return _res;
  7318. }
  7319. // match_stmt:
  7320. // | "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT
  7321. // | invalid_match_stmt
  7322. static stmt_ty
  7323. match_stmt_rule(Parser *p)
  7324. {
  7325. if (p->level++ == MAXSTACK) {
  7326. _Pypegen_stack_overflow(p);
  7327. }
  7328. if (p->error_indicator) {
  7329. p->level--;
  7330. return NULL;
  7331. }
  7332. stmt_ty _res = NULL;
  7333. int _mark = p->mark;
  7334. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  7335. p->error_indicator = 1;
  7336. p->level--;
  7337. return NULL;
  7338. }
  7339. int _start_lineno = p->tokens[_mark]->lineno;
  7340. UNUSED(_start_lineno); // Only used by EXTRA macro
  7341. int _start_col_offset = p->tokens[_mark]->col_offset;
  7342. UNUSED(_start_col_offset); // Only used by EXTRA macro
  7343. { // "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT
  7344. if (p->error_indicator) {
  7345. p->level--;
  7346. return NULL;
  7347. }
  7348. D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT"));
  7349. expr_ty _keyword;
  7350. Token * _literal;
  7351. asdl_match_case_seq* cases;
  7352. Token * dedent_var;
  7353. Token * indent_var;
  7354. Token * newline_var;
  7355. expr_ty subject;
  7356. if (
  7357. (_keyword = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"'
  7358. &&
  7359. (subject = subject_expr_rule(p)) // subject_expr
  7360. &&
  7361. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  7362. &&
  7363. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  7364. &&
  7365. (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
  7366. &&
  7367. (cases = (asdl_match_case_seq*)_loop1_64_rule(p)) // case_block+
  7368. &&
  7369. (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT'
  7370. )
  7371. {
  7372. D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT"));
  7373. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  7374. if (_token == NULL) {
  7375. p->level--;
  7376. return NULL;
  7377. }
  7378. int _end_lineno = _token->end_lineno;
  7379. UNUSED(_end_lineno); // Only used by EXTRA macro
  7380. int _end_col_offset = _token->end_col_offset;
  7381. UNUSED(_end_col_offset); // Only used by EXTRA macro
  7382. _res = CHECK_VERSION ( stmt_ty , 10 , "Pattern matching is" , _PyAST_Match ( subject , cases , EXTRA ) );
  7383. if (_res == NULL && PyErr_Occurred()) {
  7384. p->error_indicator = 1;
  7385. p->level--;
  7386. return NULL;
  7387. }
  7388. goto done;
  7389. }
  7390. p->mark = _mark;
  7391. D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  7392. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT"));
  7393. }
  7394. if (p->call_invalid_rules) { // invalid_match_stmt
  7395. if (p->error_indicator) {
  7396. p->level--;
  7397. return NULL;
  7398. }
  7399. D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_match_stmt"));
  7400. void *invalid_match_stmt_var;
  7401. if (
  7402. (invalid_match_stmt_var = invalid_match_stmt_rule(p)) // invalid_match_stmt
  7403. )
  7404. {
  7405. D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_match_stmt"));
  7406. _res = invalid_match_stmt_var;
  7407. goto done;
  7408. }
  7409. p->mark = _mark;
  7410. D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  7411. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_match_stmt"));
  7412. }
  7413. _res = NULL;
  7414. done:
  7415. p->level--;
  7416. return _res;
  7417. }
  7418. // subject_expr: star_named_expression ',' star_named_expressions? | named_expression
  7419. static expr_ty
  7420. subject_expr_rule(Parser *p)
  7421. {
  7422. if (p->level++ == MAXSTACK) {
  7423. _Pypegen_stack_overflow(p);
  7424. }
  7425. if (p->error_indicator) {
  7426. p->level--;
  7427. return NULL;
  7428. }
  7429. expr_ty _res = NULL;
  7430. int _mark = p->mark;
  7431. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  7432. p->error_indicator = 1;
  7433. p->level--;
  7434. return NULL;
  7435. }
  7436. int _start_lineno = p->tokens[_mark]->lineno;
  7437. UNUSED(_start_lineno); // Only used by EXTRA macro
  7438. int _start_col_offset = p->tokens[_mark]->col_offset;
  7439. UNUSED(_start_col_offset); // Only used by EXTRA macro
  7440. { // star_named_expression ',' star_named_expressions?
  7441. if (p->error_indicator) {
  7442. p->level--;
  7443. return NULL;
  7444. }
  7445. D(fprintf(stderr, "%*c> subject_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
  7446. Token * _literal;
  7447. expr_ty value;
  7448. void *values;
  7449. if (
  7450. (value = star_named_expression_rule(p)) // star_named_expression
  7451. &&
  7452. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  7453. &&
  7454. (values = star_named_expressions_rule(p), !p->error_indicator) // star_named_expressions?
  7455. )
  7456. {
  7457. D(fprintf(stderr, "%*c+ subject_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
  7458. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  7459. if (_token == NULL) {
  7460. p->level--;
  7461. return NULL;
  7462. }
  7463. int _end_lineno = _token->end_lineno;
  7464. UNUSED(_end_lineno); // Only used by EXTRA macro
  7465. int _end_col_offset = _token->end_col_offset;
  7466. UNUSED(_end_col_offset); // Only used by EXTRA macro
  7467. _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , value , values ) ) , Load , EXTRA );
  7468. if (_res == NULL && PyErr_Occurred()) {
  7469. p->error_indicator = 1;
  7470. p->level--;
  7471. return NULL;
  7472. }
  7473. goto done;
  7474. }
  7475. p->mark = _mark;
  7476. D(fprintf(stderr, "%*c%s subject_expr[%d-%d]: %s failed!\n", p->level, ' ',
  7477. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
  7478. }
  7479. { // named_expression
  7480. if (p->error_indicator) {
  7481. p->level--;
  7482. return NULL;
  7483. }
  7484. D(fprintf(stderr, "%*c> subject_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
  7485. expr_ty named_expression_var;
  7486. if (
  7487. (named_expression_var = named_expression_rule(p)) // named_expression
  7488. )
  7489. {
  7490. D(fprintf(stderr, "%*c+ subject_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
  7491. _res = named_expression_var;
  7492. goto done;
  7493. }
  7494. p->mark = _mark;
  7495. D(fprintf(stderr, "%*c%s subject_expr[%d-%d]: %s failed!\n", p->level, ' ',
  7496. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
  7497. }
  7498. _res = NULL;
  7499. done:
  7500. p->level--;
  7501. return _res;
  7502. }
  7503. // case_block: invalid_case_block | "case" patterns guard? ':' block
  7504. static match_case_ty
  7505. case_block_rule(Parser *p)
  7506. {
  7507. if (p->level++ == MAXSTACK) {
  7508. _Pypegen_stack_overflow(p);
  7509. }
  7510. if (p->error_indicator) {
  7511. p->level--;
  7512. return NULL;
  7513. }
  7514. match_case_ty _res = NULL;
  7515. int _mark = p->mark;
  7516. if (p->call_invalid_rules) { // invalid_case_block
  7517. if (p->error_indicator) {
  7518. p->level--;
  7519. return NULL;
  7520. }
  7521. D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_case_block"));
  7522. void *invalid_case_block_var;
  7523. if (
  7524. (invalid_case_block_var = invalid_case_block_rule(p)) // invalid_case_block
  7525. )
  7526. {
  7527. D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_case_block"));
  7528. _res = invalid_case_block_var;
  7529. goto done;
  7530. }
  7531. p->mark = _mark;
  7532. D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n", p->level, ' ',
  7533. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_case_block"));
  7534. }
  7535. { // "case" patterns guard? ':' block
  7536. if (p->error_indicator) {
  7537. p->level--;
  7538. return NULL;
  7539. }
  7540. D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block"));
  7541. expr_ty _keyword;
  7542. Token * _literal;
  7543. asdl_stmt_seq* body;
  7544. void *guard;
  7545. pattern_ty pattern;
  7546. if (
  7547. (_keyword = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"'
  7548. &&
  7549. (pattern = patterns_rule(p)) // patterns
  7550. &&
  7551. (guard = guard_rule(p), !p->error_indicator) // guard?
  7552. &&
  7553. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  7554. &&
  7555. (body = block_rule(p)) // block
  7556. )
  7557. {
  7558. D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block"));
  7559. _res = _PyAST_match_case ( pattern , guard , body , p -> arena );
  7560. if (_res == NULL && PyErr_Occurred()) {
  7561. p->error_indicator = 1;
  7562. p->level--;
  7563. return NULL;
  7564. }
  7565. goto done;
  7566. }
  7567. p->mark = _mark;
  7568. D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n", p->level, ' ',
  7569. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? ':' block"));
  7570. }
  7571. _res = NULL;
  7572. done:
  7573. p->level--;
  7574. return _res;
  7575. }
  7576. // guard: 'if' named_expression
  7577. static expr_ty
  7578. guard_rule(Parser *p)
  7579. {
  7580. if (p->level++ == MAXSTACK) {
  7581. _Pypegen_stack_overflow(p);
  7582. }
  7583. if (p->error_indicator) {
  7584. p->level--;
  7585. return NULL;
  7586. }
  7587. expr_ty _res = NULL;
  7588. int _mark = p->mark;
  7589. { // 'if' named_expression
  7590. if (p->error_indicator) {
  7591. p->level--;
  7592. return NULL;
  7593. }
  7594. D(fprintf(stderr, "%*c> guard[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression"));
  7595. Token * _keyword;
  7596. expr_ty guard;
  7597. if (
  7598. (_keyword = _PyPegen_expect_token(p, 642)) // token='if'
  7599. &&
  7600. (guard = named_expression_rule(p)) // named_expression
  7601. )
  7602. {
  7603. D(fprintf(stderr, "%*c+ guard[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression"));
  7604. _res = guard;
  7605. if (_res == NULL && PyErr_Occurred()) {
  7606. p->error_indicator = 1;
  7607. p->level--;
  7608. return NULL;
  7609. }
  7610. goto done;
  7611. }
  7612. p->mark = _mark;
  7613. D(fprintf(stderr, "%*c%s guard[%d-%d]: %s failed!\n", p->level, ' ',
  7614. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression"));
  7615. }
  7616. _res = NULL;
  7617. done:
  7618. p->level--;
  7619. return _res;
  7620. }
  7621. // patterns: open_sequence_pattern | pattern
  7622. static pattern_ty
  7623. patterns_rule(Parser *p)
  7624. {
  7625. if (p->level++ == MAXSTACK) {
  7626. _Pypegen_stack_overflow(p);
  7627. }
  7628. if (p->error_indicator) {
  7629. p->level--;
  7630. return NULL;
  7631. }
  7632. pattern_ty _res = NULL;
  7633. int _mark = p->mark;
  7634. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  7635. p->error_indicator = 1;
  7636. p->level--;
  7637. return NULL;
  7638. }
  7639. int _start_lineno = p->tokens[_mark]->lineno;
  7640. UNUSED(_start_lineno); // Only used by EXTRA macro
  7641. int _start_col_offset = p->tokens[_mark]->col_offset;
  7642. UNUSED(_start_col_offset); // Only used by EXTRA macro
  7643. { // open_sequence_pattern
  7644. if (p->error_indicator) {
  7645. p->level--;
  7646. return NULL;
  7647. }
  7648. D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "open_sequence_pattern"));
  7649. asdl_pattern_seq* patterns;
  7650. if (
  7651. (patterns = (asdl_pattern_seq*)open_sequence_pattern_rule(p)) // open_sequence_pattern
  7652. )
  7653. {
  7654. D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "open_sequence_pattern"));
  7655. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  7656. if (_token == NULL) {
  7657. p->level--;
  7658. return NULL;
  7659. }
  7660. int _end_lineno = _token->end_lineno;
  7661. UNUSED(_end_lineno); // Only used by EXTRA macro
  7662. int _end_col_offset = _token->end_col_offset;
  7663. UNUSED(_end_col_offset); // Only used by EXTRA macro
  7664. _res = _PyAST_MatchSequence ( patterns , EXTRA );
  7665. if (_res == NULL && PyErr_Occurred()) {
  7666. p->error_indicator = 1;
  7667. p->level--;
  7668. return NULL;
  7669. }
  7670. goto done;
  7671. }
  7672. p->mark = _mark;
  7673. D(fprintf(stderr, "%*c%s patterns[%d-%d]: %s failed!\n", p->level, ' ',
  7674. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "open_sequence_pattern"));
  7675. }
  7676. { // pattern
  7677. if (p->error_indicator) {
  7678. p->level--;
  7679. return NULL;
  7680. }
  7681. D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern"));
  7682. pattern_ty pattern_var;
  7683. if (
  7684. (pattern_var = pattern_rule(p)) // pattern
  7685. )
  7686. {
  7687. D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern"));
  7688. _res = pattern_var;
  7689. goto done;
  7690. }
  7691. p->mark = _mark;
  7692. D(fprintf(stderr, "%*c%s patterns[%d-%d]: %s failed!\n", p->level, ' ',
  7693. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern"));
  7694. }
  7695. _res = NULL;
  7696. done:
  7697. p->level--;
  7698. return _res;
  7699. }
  7700. // pattern: as_pattern | or_pattern
  7701. static pattern_ty
  7702. pattern_rule(Parser *p)
  7703. {
  7704. if (p->level++ == MAXSTACK) {
  7705. _Pypegen_stack_overflow(p);
  7706. }
  7707. if (p->error_indicator) {
  7708. p->level--;
  7709. return NULL;
  7710. }
  7711. pattern_ty _res = NULL;
  7712. int _mark = p->mark;
  7713. { // as_pattern
  7714. if (p->error_indicator) {
  7715. p->level--;
  7716. return NULL;
  7717. }
  7718. D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "as_pattern"));
  7719. pattern_ty as_pattern_var;
  7720. if (
  7721. (as_pattern_var = as_pattern_rule(p)) // as_pattern
  7722. )
  7723. {
  7724. D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "as_pattern"));
  7725. _res = as_pattern_var;
  7726. goto done;
  7727. }
  7728. p->mark = _mark;
  7729. D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ',
  7730. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "as_pattern"));
  7731. }
  7732. { // or_pattern
  7733. if (p->error_indicator) {
  7734. p->level--;
  7735. return NULL;
  7736. }
  7737. D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern"));
  7738. pattern_ty or_pattern_var;
  7739. if (
  7740. (or_pattern_var = or_pattern_rule(p)) // or_pattern
  7741. )
  7742. {
  7743. D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern"));
  7744. _res = or_pattern_var;
  7745. goto done;
  7746. }
  7747. p->mark = _mark;
  7748. D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ',
  7749. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern"));
  7750. }
  7751. _res = NULL;
  7752. done:
  7753. p->level--;
  7754. return _res;
  7755. }
  7756. // as_pattern: or_pattern 'as' pattern_capture_target | invalid_as_pattern
  7757. static pattern_ty
  7758. as_pattern_rule(Parser *p)
  7759. {
  7760. if (p->level++ == MAXSTACK) {
  7761. _Pypegen_stack_overflow(p);
  7762. }
  7763. if (p->error_indicator) {
  7764. p->level--;
  7765. return NULL;
  7766. }
  7767. pattern_ty _res = NULL;
  7768. int _mark = p->mark;
  7769. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  7770. p->error_indicator = 1;
  7771. p->level--;
  7772. return NULL;
  7773. }
  7774. int _start_lineno = p->tokens[_mark]->lineno;
  7775. UNUSED(_start_lineno); // Only used by EXTRA macro
  7776. int _start_col_offset = p->tokens[_mark]->col_offset;
  7777. UNUSED(_start_col_offset); // Only used by EXTRA macro
  7778. { // or_pattern 'as' pattern_capture_target
  7779. if (p->error_indicator) {
  7780. p->level--;
  7781. return NULL;
  7782. }
  7783. D(fprintf(stderr, "%*c> as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' pattern_capture_target"));
  7784. Token * _keyword;
  7785. pattern_ty pattern;
  7786. expr_ty target;
  7787. if (
  7788. (pattern = or_pattern_rule(p)) // or_pattern
  7789. &&
  7790. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  7791. &&
  7792. (target = pattern_capture_target_rule(p)) // pattern_capture_target
  7793. )
  7794. {
  7795. D(fprintf(stderr, "%*c+ as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' pattern_capture_target"));
  7796. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  7797. if (_token == NULL) {
  7798. p->level--;
  7799. return NULL;
  7800. }
  7801. int _end_lineno = _token->end_lineno;
  7802. UNUSED(_end_lineno); // Only used by EXTRA macro
  7803. int _end_col_offset = _token->end_col_offset;
  7804. UNUSED(_end_col_offset); // Only used by EXTRA macro
  7805. _res = _PyAST_MatchAs ( pattern , target -> v . Name . id , EXTRA );
  7806. if (_res == NULL && PyErr_Occurred()) {
  7807. p->error_indicator = 1;
  7808. p->level--;
  7809. return NULL;
  7810. }
  7811. goto done;
  7812. }
  7813. p->mark = _mark;
  7814. D(fprintf(stderr, "%*c%s as_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  7815. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern 'as' pattern_capture_target"));
  7816. }
  7817. if (p->call_invalid_rules) { // invalid_as_pattern
  7818. if (p->error_indicator) {
  7819. p->level--;
  7820. return NULL;
  7821. }
  7822. D(fprintf(stderr, "%*c> as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_as_pattern"));
  7823. void *invalid_as_pattern_var;
  7824. if (
  7825. (invalid_as_pattern_var = invalid_as_pattern_rule(p)) // invalid_as_pattern
  7826. )
  7827. {
  7828. D(fprintf(stderr, "%*c+ as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_as_pattern"));
  7829. _res = invalid_as_pattern_var;
  7830. goto done;
  7831. }
  7832. p->mark = _mark;
  7833. D(fprintf(stderr, "%*c%s as_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  7834. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_as_pattern"));
  7835. }
  7836. _res = NULL;
  7837. done:
  7838. p->level--;
  7839. return _res;
  7840. }
  7841. // or_pattern: '|'.closed_pattern+
  7842. static pattern_ty
  7843. or_pattern_rule(Parser *p)
  7844. {
  7845. if (p->level++ == MAXSTACK) {
  7846. _Pypegen_stack_overflow(p);
  7847. }
  7848. if (p->error_indicator) {
  7849. p->level--;
  7850. return NULL;
  7851. }
  7852. pattern_ty _res = NULL;
  7853. int _mark = p->mark;
  7854. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  7855. p->error_indicator = 1;
  7856. p->level--;
  7857. return NULL;
  7858. }
  7859. int _start_lineno = p->tokens[_mark]->lineno;
  7860. UNUSED(_start_lineno); // Only used by EXTRA macro
  7861. int _start_col_offset = p->tokens[_mark]->col_offset;
  7862. UNUSED(_start_col_offset); // Only used by EXTRA macro
  7863. { // '|'.closed_pattern+
  7864. if (p->error_indicator) {
  7865. p->level--;
  7866. return NULL;
  7867. }
  7868. D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+"));
  7869. asdl_pattern_seq* patterns;
  7870. if (
  7871. (patterns = (asdl_pattern_seq*)_gather_65_rule(p)) // '|'.closed_pattern+
  7872. )
  7873. {
  7874. D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+"));
  7875. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  7876. if (_token == NULL) {
  7877. p->level--;
  7878. return NULL;
  7879. }
  7880. int _end_lineno = _token->end_lineno;
  7881. UNUSED(_end_lineno); // Only used by EXTRA macro
  7882. int _end_col_offset = _token->end_col_offset;
  7883. UNUSED(_end_col_offset); // Only used by EXTRA macro
  7884. _res = asdl_seq_LEN ( patterns ) == 1 ? asdl_seq_GET ( patterns , 0 ) : _PyAST_MatchOr ( patterns , EXTRA );
  7885. if (_res == NULL && PyErr_Occurred()) {
  7886. p->error_indicator = 1;
  7887. p->level--;
  7888. return NULL;
  7889. }
  7890. goto done;
  7891. }
  7892. p->mark = _mark;
  7893. D(fprintf(stderr, "%*c%s or_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  7894. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|'.closed_pattern+"));
  7895. }
  7896. _res = NULL;
  7897. done:
  7898. p->level--;
  7899. return _res;
  7900. }
  7901. // closed_pattern:
  7902. // | literal_pattern
  7903. // | capture_pattern
  7904. // | wildcard_pattern
  7905. // | value_pattern
  7906. // | group_pattern
  7907. // | sequence_pattern
  7908. // | mapping_pattern
  7909. // | class_pattern
  7910. static pattern_ty
  7911. closed_pattern_rule(Parser *p)
  7912. {
  7913. if (p->level++ == MAXSTACK) {
  7914. _Pypegen_stack_overflow(p);
  7915. }
  7916. if (p->error_indicator) {
  7917. p->level--;
  7918. return NULL;
  7919. }
  7920. pattern_ty _res = NULL;
  7921. if (_PyPegen_is_memoized(p, closed_pattern_type, &_res)) {
  7922. p->level--;
  7923. return _res;
  7924. }
  7925. int _mark = p->mark;
  7926. { // literal_pattern
  7927. if (p->error_indicator) {
  7928. p->level--;
  7929. return NULL;
  7930. }
  7931. D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern"));
  7932. pattern_ty literal_pattern_var;
  7933. if (
  7934. (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern
  7935. )
  7936. {
  7937. D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern"));
  7938. _res = literal_pattern_var;
  7939. goto done;
  7940. }
  7941. p->mark = _mark;
  7942. D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  7943. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern"));
  7944. }
  7945. { // capture_pattern
  7946. if (p->error_indicator) {
  7947. p->level--;
  7948. return NULL;
  7949. }
  7950. D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "capture_pattern"));
  7951. pattern_ty capture_pattern_var;
  7952. if (
  7953. (capture_pattern_var = capture_pattern_rule(p)) // capture_pattern
  7954. )
  7955. {
  7956. D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "capture_pattern"));
  7957. _res = capture_pattern_var;
  7958. goto done;
  7959. }
  7960. p->mark = _mark;
  7961. D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  7962. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "capture_pattern"));
  7963. }
  7964. { // wildcard_pattern
  7965. if (p->error_indicator) {
  7966. p->level--;
  7967. return NULL;
  7968. }
  7969. D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "wildcard_pattern"));
  7970. pattern_ty wildcard_pattern_var;
  7971. if (
  7972. (wildcard_pattern_var = wildcard_pattern_rule(p)) // wildcard_pattern
  7973. )
  7974. {
  7975. D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "wildcard_pattern"));
  7976. _res = wildcard_pattern_var;
  7977. goto done;
  7978. }
  7979. p->mark = _mark;
  7980. D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  7981. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "wildcard_pattern"));
  7982. }
  7983. { // value_pattern
  7984. if (p->error_indicator) {
  7985. p->level--;
  7986. return NULL;
  7987. }
  7988. D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern"));
  7989. pattern_ty value_pattern_var;
  7990. if (
  7991. (value_pattern_var = value_pattern_rule(p)) // value_pattern
  7992. )
  7993. {
  7994. D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern"));
  7995. _res = value_pattern_var;
  7996. goto done;
  7997. }
  7998. p->mark = _mark;
  7999. D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  8000. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern"));
  8001. }
  8002. { // group_pattern
  8003. if (p->error_indicator) {
  8004. p->level--;
  8005. return NULL;
  8006. }
  8007. D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group_pattern"));
  8008. pattern_ty group_pattern_var;
  8009. if (
  8010. (group_pattern_var = group_pattern_rule(p)) // group_pattern
  8011. )
  8012. {
  8013. D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group_pattern"));
  8014. _res = group_pattern_var;
  8015. goto done;
  8016. }
  8017. p->mark = _mark;
  8018. D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  8019. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group_pattern"));
  8020. }
  8021. { // sequence_pattern
  8022. if (p->error_indicator) {
  8023. p->level--;
  8024. return NULL;
  8025. }
  8026. D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sequence_pattern"));
  8027. pattern_ty sequence_pattern_var;
  8028. if (
  8029. (sequence_pattern_var = sequence_pattern_rule(p)) // sequence_pattern
  8030. )
  8031. {
  8032. D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sequence_pattern"));
  8033. _res = sequence_pattern_var;
  8034. goto done;
  8035. }
  8036. p->mark = _mark;
  8037. D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  8038. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sequence_pattern"));
  8039. }
  8040. { // mapping_pattern
  8041. if (p->error_indicator) {
  8042. p->level--;
  8043. return NULL;
  8044. }
  8045. D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "mapping_pattern"));
  8046. pattern_ty mapping_pattern_var;
  8047. if (
  8048. (mapping_pattern_var = mapping_pattern_rule(p)) // mapping_pattern
  8049. )
  8050. {
  8051. D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "mapping_pattern"));
  8052. _res = mapping_pattern_var;
  8053. goto done;
  8054. }
  8055. p->mark = _mark;
  8056. D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  8057. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "mapping_pattern"));
  8058. }
  8059. { // class_pattern
  8060. if (p->error_indicator) {
  8061. p->level--;
  8062. return NULL;
  8063. }
  8064. D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_pattern"));
  8065. pattern_ty class_pattern_var;
  8066. if (
  8067. (class_pattern_var = class_pattern_rule(p)) // class_pattern
  8068. )
  8069. {
  8070. D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_pattern"));
  8071. _res = class_pattern_var;
  8072. goto done;
  8073. }
  8074. p->mark = _mark;
  8075. D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  8076. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_pattern"));
  8077. }
  8078. _res = NULL;
  8079. done:
  8080. _PyPegen_insert_memo(p, _mark, closed_pattern_type, _res);
  8081. p->level--;
  8082. return _res;
  8083. }
  8084. // literal_pattern:
  8085. // | signed_number !('+' | '-')
  8086. // | complex_number
  8087. // | strings
  8088. // | 'None'
  8089. // | 'True'
  8090. // | 'False'
  8091. static pattern_ty
  8092. literal_pattern_rule(Parser *p)
  8093. {
  8094. if (p->level++ == MAXSTACK) {
  8095. _Pypegen_stack_overflow(p);
  8096. }
  8097. if (p->error_indicator) {
  8098. p->level--;
  8099. return NULL;
  8100. }
  8101. pattern_ty _res = NULL;
  8102. int _mark = p->mark;
  8103. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  8104. p->error_indicator = 1;
  8105. p->level--;
  8106. return NULL;
  8107. }
  8108. int _start_lineno = p->tokens[_mark]->lineno;
  8109. UNUSED(_start_lineno); // Only used by EXTRA macro
  8110. int _start_col_offset = p->tokens[_mark]->col_offset;
  8111. UNUSED(_start_col_offset); // Only used by EXTRA macro
  8112. { // signed_number !('+' | '-')
  8113. if (p->error_indicator) {
  8114. p->level--;
  8115. return NULL;
  8116. }
  8117. D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')"));
  8118. expr_ty value;
  8119. if (
  8120. (value = signed_number_rule(p)) // signed_number
  8121. &&
  8122. _PyPegen_lookahead(0, _tmp_67_rule, p)
  8123. )
  8124. {
  8125. D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')"));
  8126. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  8127. if (_token == NULL) {
  8128. p->level--;
  8129. return NULL;
  8130. }
  8131. int _end_lineno = _token->end_lineno;
  8132. UNUSED(_end_lineno); // Only used by EXTRA macro
  8133. int _end_col_offset = _token->end_col_offset;
  8134. UNUSED(_end_col_offset); // Only used by EXTRA macro
  8135. _res = _PyAST_MatchValue ( value , EXTRA );
  8136. if (_res == NULL && PyErr_Occurred()) {
  8137. p->error_indicator = 1;
  8138. p->level--;
  8139. return NULL;
  8140. }
  8141. goto done;
  8142. }
  8143. p->mark = _mark;
  8144. D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  8145. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_number !('+' | '-')"));
  8146. }
  8147. { // complex_number
  8148. if (p->error_indicator) {
  8149. p->level--;
  8150. return NULL;
  8151. }
  8152. D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "complex_number"));
  8153. expr_ty value;
  8154. if (
  8155. (value = complex_number_rule(p)) // complex_number
  8156. )
  8157. {
  8158. D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "complex_number"));
  8159. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  8160. if (_token == NULL) {
  8161. p->level--;
  8162. return NULL;
  8163. }
  8164. int _end_lineno = _token->end_lineno;
  8165. UNUSED(_end_lineno); // Only used by EXTRA macro
  8166. int _end_col_offset = _token->end_col_offset;
  8167. UNUSED(_end_col_offset); // Only used by EXTRA macro
  8168. _res = _PyAST_MatchValue ( value , EXTRA );
  8169. if (_res == NULL && PyErr_Occurred()) {
  8170. p->error_indicator = 1;
  8171. p->level--;
  8172. return NULL;
  8173. }
  8174. goto done;
  8175. }
  8176. p->mark = _mark;
  8177. D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  8178. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "complex_number"));
  8179. }
  8180. { // strings
  8181. if (p->error_indicator) {
  8182. p->level--;
  8183. return NULL;
  8184. }
  8185. D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "strings"));
  8186. expr_ty value;
  8187. if (
  8188. (value = strings_rule(p)) // strings
  8189. )
  8190. {
  8191. D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "strings"));
  8192. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  8193. if (_token == NULL) {
  8194. p->level--;
  8195. return NULL;
  8196. }
  8197. int _end_lineno = _token->end_lineno;
  8198. UNUSED(_end_lineno); // Only used by EXTRA macro
  8199. int _end_col_offset = _token->end_col_offset;
  8200. UNUSED(_end_col_offset); // Only used by EXTRA macro
  8201. _res = _PyAST_MatchValue ( value , EXTRA );
  8202. if (_res == NULL && PyErr_Occurred()) {
  8203. p->error_indicator = 1;
  8204. p->level--;
  8205. return NULL;
  8206. }
  8207. goto done;
  8208. }
  8209. p->mark = _mark;
  8210. D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  8211. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "strings"));
  8212. }
  8213. { // 'None'
  8214. if (p->error_indicator) {
  8215. p->level--;
  8216. return NULL;
  8217. }
  8218. D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
  8219. Token * _keyword;
  8220. if (
  8221. (_keyword = _PyPegen_expect_token(p, 602)) // token='None'
  8222. )
  8223. {
  8224. D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
  8225. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  8226. if (_token == NULL) {
  8227. p->level--;
  8228. return NULL;
  8229. }
  8230. int _end_lineno = _token->end_lineno;
  8231. UNUSED(_end_lineno); // Only used by EXTRA macro
  8232. int _end_col_offset = _token->end_col_offset;
  8233. UNUSED(_end_col_offset); // Only used by EXTRA macro
  8234. _res = _PyAST_MatchSingleton ( Py_None , EXTRA );
  8235. if (_res == NULL && PyErr_Occurred()) {
  8236. p->error_indicator = 1;
  8237. p->level--;
  8238. return NULL;
  8239. }
  8240. goto done;
  8241. }
  8242. p->mark = _mark;
  8243. D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  8244. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
  8245. }
  8246. { // 'True'
  8247. if (p->error_indicator) {
  8248. p->level--;
  8249. return NULL;
  8250. }
  8251. D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
  8252. Token * _keyword;
  8253. if (
  8254. (_keyword = _PyPegen_expect_token(p, 601)) // token='True'
  8255. )
  8256. {
  8257. D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
  8258. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  8259. if (_token == NULL) {
  8260. p->level--;
  8261. return NULL;
  8262. }
  8263. int _end_lineno = _token->end_lineno;
  8264. UNUSED(_end_lineno); // Only used by EXTRA macro
  8265. int _end_col_offset = _token->end_col_offset;
  8266. UNUSED(_end_col_offset); // Only used by EXTRA macro
  8267. _res = _PyAST_MatchSingleton ( Py_True , EXTRA );
  8268. if (_res == NULL && PyErr_Occurred()) {
  8269. p->error_indicator = 1;
  8270. p->level--;
  8271. return NULL;
  8272. }
  8273. goto done;
  8274. }
  8275. p->mark = _mark;
  8276. D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  8277. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
  8278. }
  8279. { // 'False'
  8280. if (p->error_indicator) {
  8281. p->level--;
  8282. return NULL;
  8283. }
  8284. D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
  8285. Token * _keyword;
  8286. if (
  8287. (_keyword = _PyPegen_expect_token(p, 603)) // token='False'
  8288. )
  8289. {
  8290. D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
  8291. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  8292. if (_token == NULL) {
  8293. p->level--;
  8294. return NULL;
  8295. }
  8296. int _end_lineno = _token->end_lineno;
  8297. UNUSED(_end_lineno); // Only used by EXTRA macro
  8298. int _end_col_offset = _token->end_col_offset;
  8299. UNUSED(_end_col_offset); // Only used by EXTRA macro
  8300. _res = _PyAST_MatchSingleton ( Py_False , EXTRA );
  8301. if (_res == NULL && PyErr_Occurred()) {
  8302. p->error_indicator = 1;
  8303. p->level--;
  8304. return NULL;
  8305. }
  8306. goto done;
  8307. }
  8308. p->mark = _mark;
  8309. D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  8310. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
  8311. }
  8312. _res = NULL;
  8313. done:
  8314. p->level--;
  8315. return _res;
  8316. }
  8317. // literal_expr:
  8318. // | signed_number !('+' | '-')
  8319. // | complex_number
  8320. // | strings
  8321. // | 'None'
  8322. // | 'True'
  8323. // | 'False'
  8324. static expr_ty
  8325. literal_expr_rule(Parser *p)
  8326. {
  8327. if (p->level++ == MAXSTACK) {
  8328. _Pypegen_stack_overflow(p);
  8329. }
  8330. if (p->error_indicator) {
  8331. p->level--;
  8332. return NULL;
  8333. }
  8334. expr_ty _res = NULL;
  8335. int _mark = p->mark;
  8336. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  8337. p->error_indicator = 1;
  8338. p->level--;
  8339. return NULL;
  8340. }
  8341. int _start_lineno = p->tokens[_mark]->lineno;
  8342. UNUSED(_start_lineno); // Only used by EXTRA macro
  8343. int _start_col_offset = p->tokens[_mark]->col_offset;
  8344. UNUSED(_start_col_offset); // Only used by EXTRA macro
  8345. { // signed_number !('+' | '-')
  8346. if (p->error_indicator) {
  8347. p->level--;
  8348. return NULL;
  8349. }
  8350. D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')"));
  8351. expr_ty signed_number_var;
  8352. if (
  8353. (signed_number_var = signed_number_rule(p)) // signed_number
  8354. &&
  8355. _PyPegen_lookahead(0, _tmp_68_rule, p)
  8356. )
  8357. {
  8358. D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')"));
  8359. _res = signed_number_var;
  8360. goto done;
  8361. }
  8362. p->mark = _mark;
  8363. D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
  8364. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_number !('+' | '-')"));
  8365. }
  8366. { // complex_number
  8367. if (p->error_indicator) {
  8368. p->level--;
  8369. return NULL;
  8370. }
  8371. D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "complex_number"));
  8372. expr_ty complex_number_var;
  8373. if (
  8374. (complex_number_var = complex_number_rule(p)) // complex_number
  8375. )
  8376. {
  8377. D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "complex_number"));
  8378. _res = complex_number_var;
  8379. goto done;
  8380. }
  8381. p->mark = _mark;
  8382. D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
  8383. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "complex_number"));
  8384. }
  8385. { // strings
  8386. if (p->error_indicator) {
  8387. p->level--;
  8388. return NULL;
  8389. }
  8390. D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "strings"));
  8391. expr_ty strings_var;
  8392. if (
  8393. (strings_var = strings_rule(p)) // strings
  8394. )
  8395. {
  8396. D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "strings"));
  8397. _res = strings_var;
  8398. goto done;
  8399. }
  8400. p->mark = _mark;
  8401. D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
  8402. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "strings"));
  8403. }
  8404. { // 'None'
  8405. if (p->error_indicator) {
  8406. p->level--;
  8407. return NULL;
  8408. }
  8409. D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
  8410. Token * _keyword;
  8411. if (
  8412. (_keyword = _PyPegen_expect_token(p, 602)) // token='None'
  8413. )
  8414. {
  8415. D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
  8416. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  8417. if (_token == NULL) {
  8418. p->level--;
  8419. return NULL;
  8420. }
  8421. int _end_lineno = _token->end_lineno;
  8422. UNUSED(_end_lineno); // Only used by EXTRA macro
  8423. int _end_col_offset = _token->end_col_offset;
  8424. UNUSED(_end_col_offset); // Only used by EXTRA macro
  8425. _res = _PyAST_Constant ( Py_None , NULL , EXTRA );
  8426. if (_res == NULL && PyErr_Occurred()) {
  8427. p->error_indicator = 1;
  8428. p->level--;
  8429. return NULL;
  8430. }
  8431. goto done;
  8432. }
  8433. p->mark = _mark;
  8434. D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
  8435. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
  8436. }
  8437. { // 'True'
  8438. if (p->error_indicator) {
  8439. p->level--;
  8440. return NULL;
  8441. }
  8442. D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
  8443. Token * _keyword;
  8444. if (
  8445. (_keyword = _PyPegen_expect_token(p, 601)) // token='True'
  8446. )
  8447. {
  8448. D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
  8449. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  8450. if (_token == NULL) {
  8451. p->level--;
  8452. return NULL;
  8453. }
  8454. int _end_lineno = _token->end_lineno;
  8455. UNUSED(_end_lineno); // Only used by EXTRA macro
  8456. int _end_col_offset = _token->end_col_offset;
  8457. UNUSED(_end_col_offset); // Only used by EXTRA macro
  8458. _res = _PyAST_Constant ( Py_True , NULL , EXTRA );
  8459. if (_res == NULL && PyErr_Occurred()) {
  8460. p->error_indicator = 1;
  8461. p->level--;
  8462. return NULL;
  8463. }
  8464. goto done;
  8465. }
  8466. p->mark = _mark;
  8467. D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
  8468. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
  8469. }
  8470. { // 'False'
  8471. if (p->error_indicator) {
  8472. p->level--;
  8473. return NULL;
  8474. }
  8475. D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
  8476. Token * _keyword;
  8477. if (
  8478. (_keyword = _PyPegen_expect_token(p, 603)) // token='False'
  8479. )
  8480. {
  8481. D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
  8482. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  8483. if (_token == NULL) {
  8484. p->level--;
  8485. return NULL;
  8486. }
  8487. int _end_lineno = _token->end_lineno;
  8488. UNUSED(_end_lineno); // Only used by EXTRA macro
  8489. int _end_col_offset = _token->end_col_offset;
  8490. UNUSED(_end_col_offset); // Only used by EXTRA macro
  8491. _res = _PyAST_Constant ( Py_False , NULL , EXTRA );
  8492. if (_res == NULL && PyErr_Occurred()) {
  8493. p->error_indicator = 1;
  8494. p->level--;
  8495. return NULL;
  8496. }
  8497. goto done;
  8498. }
  8499. p->mark = _mark;
  8500. D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
  8501. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
  8502. }
  8503. _res = NULL;
  8504. done:
  8505. p->level--;
  8506. return _res;
  8507. }
  8508. // complex_number:
  8509. // | signed_real_number '+' imaginary_number
  8510. // | signed_real_number '-' imaginary_number
  8511. static expr_ty
  8512. complex_number_rule(Parser *p)
  8513. {
  8514. if (p->level++ == MAXSTACK) {
  8515. _Pypegen_stack_overflow(p);
  8516. }
  8517. if (p->error_indicator) {
  8518. p->level--;
  8519. return NULL;
  8520. }
  8521. expr_ty _res = NULL;
  8522. int _mark = p->mark;
  8523. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  8524. p->error_indicator = 1;
  8525. p->level--;
  8526. return NULL;
  8527. }
  8528. int _start_lineno = p->tokens[_mark]->lineno;
  8529. UNUSED(_start_lineno); // Only used by EXTRA macro
  8530. int _start_col_offset = p->tokens[_mark]->col_offset;
  8531. UNUSED(_start_col_offset); // Only used by EXTRA macro
  8532. { // signed_real_number '+' imaginary_number
  8533. if (p->error_indicator) {
  8534. p->level--;
  8535. return NULL;
  8536. }
  8537. D(fprintf(stderr, "%*c> complex_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_real_number '+' imaginary_number"));
  8538. Token * _literal;
  8539. expr_ty imag;
  8540. expr_ty real;
  8541. if (
  8542. (real = signed_real_number_rule(p)) // signed_real_number
  8543. &&
  8544. (_literal = _PyPegen_expect_token(p, 14)) // token='+'
  8545. &&
  8546. (imag = imaginary_number_rule(p)) // imaginary_number
  8547. )
  8548. {
  8549. D(fprintf(stderr, "%*c+ complex_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_real_number '+' imaginary_number"));
  8550. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  8551. if (_token == NULL) {
  8552. p->level--;
  8553. return NULL;
  8554. }
  8555. int _end_lineno = _token->end_lineno;
  8556. UNUSED(_end_lineno); // Only used by EXTRA macro
  8557. int _end_col_offset = _token->end_col_offset;
  8558. UNUSED(_end_col_offset); // Only used by EXTRA macro
  8559. _res = _PyAST_BinOp ( real , Add , imag , EXTRA );
  8560. if (_res == NULL && PyErr_Occurred()) {
  8561. p->error_indicator = 1;
  8562. p->level--;
  8563. return NULL;
  8564. }
  8565. goto done;
  8566. }
  8567. p->mark = _mark;
  8568. D(fprintf(stderr, "%*c%s complex_number[%d-%d]: %s failed!\n", p->level, ' ',
  8569. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_real_number '+' imaginary_number"));
  8570. }
  8571. { // signed_real_number '-' imaginary_number
  8572. if (p->error_indicator) {
  8573. p->level--;
  8574. return NULL;
  8575. }
  8576. D(fprintf(stderr, "%*c> complex_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_real_number '-' imaginary_number"));
  8577. Token * _literal;
  8578. expr_ty imag;
  8579. expr_ty real;
  8580. if (
  8581. (real = signed_real_number_rule(p)) // signed_real_number
  8582. &&
  8583. (_literal = _PyPegen_expect_token(p, 15)) // token='-'
  8584. &&
  8585. (imag = imaginary_number_rule(p)) // imaginary_number
  8586. )
  8587. {
  8588. D(fprintf(stderr, "%*c+ complex_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_real_number '-' imaginary_number"));
  8589. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  8590. if (_token == NULL) {
  8591. p->level--;
  8592. return NULL;
  8593. }
  8594. int _end_lineno = _token->end_lineno;
  8595. UNUSED(_end_lineno); // Only used by EXTRA macro
  8596. int _end_col_offset = _token->end_col_offset;
  8597. UNUSED(_end_col_offset); // Only used by EXTRA macro
  8598. _res = _PyAST_BinOp ( real , Sub , imag , EXTRA );
  8599. if (_res == NULL && PyErr_Occurred()) {
  8600. p->error_indicator = 1;
  8601. p->level--;
  8602. return NULL;
  8603. }
  8604. goto done;
  8605. }
  8606. p->mark = _mark;
  8607. D(fprintf(stderr, "%*c%s complex_number[%d-%d]: %s failed!\n", p->level, ' ',
  8608. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_real_number '-' imaginary_number"));
  8609. }
  8610. _res = NULL;
  8611. done:
  8612. p->level--;
  8613. return _res;
  8614. }
  8615. // signed_number: NUMBER | '-' NUMBER
  8616. static expr_ty
  8617. signed_number_rule(Parser *p)
  8618. {
  8619. if (p->level++ == MAXSTACK) {
  8620. _Pypegen_stack_overflow(p);
  8621. }
  8622. if (p->error_indicator) {
  8623. p->level--;
  8624. return NULL;
  8625. }
  8626. expr_ty _res = NULL;
  8627. int _mark = p->mark;
  8628. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  8629. p->error_indicator = 1;
  8630. p->level--;
  8631. return NULL;
  8632. }
  8633. int _start_lineno = p->tokens[_mark]->lineno;
  8634. UNUSED(_start_lineno); // Only used by EXTRA macro
  8635. int _start_col_offset = p->tokens[_mark]->col_offset;
  8636. UNUSED(_start_col_offset); // Only used by EXTRA macro
  8637. { // NUMBER
  8638. if (p->error_indicator) {
  8639. p->level--;
  8640. return NULL;
  8641. }
  8642. D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
  8643. expr_ty number_var;
  8644. if (
  8645. (number_var = _PyPegen_number_token(p)) // NUMBER
  8646. )
  8647. {
  8648. D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
  8649. _res = number_var;
  8650. goto done;
  8651. }
  8652. p->mark = _mark;
  8653. D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ',
  8654. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
  8655. }
  8656. { // '-' NUMBER
  8657. if (p->error_indicator) {
  8658. p->level--;
  8659. return NULL;
  8660. }
  8661. D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' NUMBER"));
  8662. Token * _literal;
  8663. expr_ty number;
  8664. if (
  8665. (_literal = _PyPegen_expect_token(p, 15)) // token='-'
  8666. &&
  8667. (number = _PyPegen_number_token(p)) // NUMBER
  8668. )
  8669. {
  8670. D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' NUMBER"));
  8671. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  8672. if (_token == NULL) {
  8673. p->level--;
  8674. return NULL;
  8675. }
  8676. int _end_lineno = _token->end_lineno;
  8677. UNUSED(_end_lineno); // Only used by EXTRA macro
  8678. int _end_col_offset = _token->end_col_offset;
  8679. UNUSED(_end_col_offset); // Only used by EXTRA macro
  8680. _res = _PyAST_UnaryOp ( USub , number , EXTRA );
  8681. if (_res == NULL && PyErr_Occurred()) {
  8682. p->error_indicator = 1;
  8683. p->level--;
  8684. return NULL;
  8685. }
  8686. goto done;
  8687. }
  8688. p->mark = _mark;
  8689. D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ',
  8690. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' NUMBER"));
  8691. }
  8692. _res = NULL;
  8693. done:
  8694. p->level--;
  8695. return _res;
  8696. }
  8697. // signed_real_number: real_number | '-' real_number
  8698. static expr_ty
  8699. signed_real_number_rule(Parser *p)
  8700. {
  8701. if (p->level++ == MAXSTACK) {
  8702. _Pypegen_stack_overflow(p);
  8703. }
  8704. if (p->error_indicator) {
  8705. p->level--;
  8706. return NULL;
  8707. }
  8708. expr_ty _res = NULL;
  8709. int _mark = p->mark;
  8710. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  8711. p->error_indicator = 1;
  8712. p->level--;
  8713. return NULL;
  8714. }
  8715. int _start_lineno = p->tokens[_mark]->lineno;
  8716. UNUSED(_start_lineno); // Only used by EXTRA macro
  8717. int _start_col_offset = p->tokens[_mark]->col_offset;
  8718. UNUSED(_start_col_offset); // Only used by EXTRA macro
  8719. { // real_number
  8720. if (p->error_indicator) {
  8721. p->level--;
  8722. return NULL;
  8723. }
  8724. D(fprintf(stderr, "%*c> signed_real_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "real_number"));
  8725. expr_ty real_number_var;
  8726. if (
  8727. (real_number_var = real_number_rule(p)) // real_number
  8728. )
  8729. {
  8730. D(fprintf(stderr, "%*c+ signed_real_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "real_number"));
  8731. _res = real_number_var;
  8732. goto done;
  8733. }
  8734. p->mark = _mark;
  8735. D(fprintf(stderr, "%*c%s signed_real_number[%d-%d]: %s failed!\n", p->level, ' ',
  8736. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "real_number"));
  8737. }
  8738. { // '-' real_number
  8739. if (p->error_indicator) {
  8740. p->level--;
  8741. return NULL;
  8742. }
  8743. D(fprintf(stderr, "%*c> signed_real_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' real_number"));
  8744. Token * _literal;
  8745. expr_ty real;
  8746. if (
  8747. (_literal = _PyPegen_expect_token(p, 15)) // token='-'
  8748. &&
  8749. (real = real_number_rule(p)) // real_number
  8750. )
  8751. {
  8752. D(fprintf(stderr, "%*c+ signed_real_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' real_number"));
  8753. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  8754. if (_token == NULL) {
  8755. p->level--;
  8756. return NULL;
  8757. }
  8758. int _end_lineno = _token->end_lineno;
  8759. UNUSED(_end_lineno); // Only used by EXTRA macro
  8760. int _end_col_offset = _token->end_col_offset;
  8761. UNUSED(_end_col_offset); // Only used by EXTRA macro
  8762. _res = _PyAST_UnaryOp ( USub , real , EXTRA );
  8763. if (_res == NULL && PyErr_Occurred()) {
  8764. p->error_indicator = 1;
  8765. p->level--;
  8766. return NULL;
  8767. }
  8768. goto done;
  8769. }
  8770. p->mark = _mark;
  8771. D(fprintf(stderr, "%*c%s signed_real_number[%d-%d]: %s failed!\n", p->level, ' ',
  8772. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' real_number"));
  8773. }
  8774. _res = NULL;
  8775. done:
  8776. p->level--;
  8777. return _res;
  8778. }
  8779. // real_number: NUMBER
  8780. static expr_ty
  8781. real_number_rule(Parser *p)
  8782. {
  8783. if (p->level++ == MAXSTACK) {
  8784. _Pypegen_stack_overflow(p);
  8785. }
  8786. if (p->error_indicator) {
  8787. p->level--;
  8788. return NULL;
  8789. }
  8790. expr_ty _res = NULL;
  8791. int _mark = p->mark;
  8792. { // NUMBER
  8793. if (p->error_indicator) {
  8794. p->level--;
  8795. return NULL;
  8796. }
  8797. D(fprintf(stderr, "%*c> real_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
  8798. expr_ty real;
  8799. if (
  8800. (real = _PyPegen_number_token(p)) // NUMBER
  8801. )
  8802. {
  8803. D(fprintf(stderr, "%*c+ real_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
  8804. _res = _PyPegen_ensure_real ( p , real );
  8805. if (_res == NULL && PyErr_Occurred()) {
  8806. p->error_indicator = 1;
  8807. p->level--;
  8808. return NULL;
  8809. }
  8810. goto done;
  8811. }
  8812. p->mark = _mark;
  8813. D(fprintf(stderr, "%*c%s real_number[%d-%d]: %s failed!\n", p->level, ' ',
  8814. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
  8815. }
  8816. _res = NULL;
  8817. done:
  8818. p->level--;
  8819. return _res;
  8820. }
  8821. // imaginary_number: NUMBER
  8822. static expr_ty
  8823. imaginary_number_rule(Parser *p)
  8824. {
  8825. if (p->level++ == MAXSTACK) {
  8826. _Pypegen_stack_overflow(p);
  8827. }
  8828. if (p->error_indicator) {
  8829. p->level--;
  8830. return NULL;
  8831. }
  8832. expr_ty _res = NULL;
  8833. int _mark = p->mark;
  8834. { // NUMBER
  8835. if (p->error_indicator) {
  8836. p->level--;
  8837. return NULL;
  8838. }
  8839. D(fprintf(stderr, "%*c> imaginary_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
  8840. expr_ty imag;
  8841. if (
  8842. (imag = _PyPegen_number_token(p)) // NUMBER
  8843. )
  8844. {
  8845. D(fprintf(stderr, "%*c+ imaginary_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
  8846. _res = _PyPegen_ensure_imaginary ( p , imag );
  8847. if (_res == NULL && PyErr_Occurred()) {
  8848. p->error_indicator = 1;
  8849. p->level--;
  8850. return NULL;
  8851. }
  8852. goto done;
  8853. }
  8854. p->mark = _mark;
  8855. D(fprintf(stderr, "%*c%s imaginary_number[%d-%d]: %s failed!\n", p->level, ' ',
  8856. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
  8857. }
  8858. _res = NULL;
  8859. done:
  8860. p->level--;
  8861. return _res;
  8862. }
  8863. // capture_pattern: pattern_capture_target
  8864. static pattern_ty
  8865. capture_pattern_rule(Parser *p)
  8866. {
  8867. if (p->level++ == MAXSTACK) {
  8868. _Pypegen_stack_overflow(p);
  8869. }
  8870. if (p->error_indicator) {
  8871. p->level--;
  8872. return NULL;
  8873. }
  8874. pattern_ty _res = NULL;
  8875. int _mark = p->mark;
  8876. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  8877. p->error_indicator = 1;
  8878. p->level--;
  8879. return NULL;
  8880. }
  8881. int _start_lineno = p->tokens[_mark]->lineno;
  8882. UNUSED(_start_lineno); // Only used by EXTRA macro
  8883. int _start_col_offset = p->tokens[_mark]->col_offset;
  8884. UNUSED(_start_col_offset); // Only used by EXTRA macro
  8885. { // pattern_capture_target
  8886. if (p->error_indicator) {
  8887. p->level--;
  8888. return NULL;
  8889. }
  8890. D(fprintf(stderr, "%*c> capture_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern_capture_target"));
  8891. expr_ty target;
  8892. if (
  8893. (target = pattern_capture_target_rule(p)) // pattern_capture_target
  8894. )
  8895. {
  8896. D(fprintf(stderr, "%*c+ capture_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern_capture_target"));
  8897. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  8898. if (_token == NULL) {
  8899. p->level--;
  8900. return NULL;
  8901. }
  8902. int _end_lineno = _token->end_lineno;
  8903. UNUSED(_end_lineno); // Only used by EXTRA macro
  8904. int _end_col_offset = _token->end_col_offset;
  8905. UNUSED(_end_col_offset); // Only used by EXTRA macro
  8906. _res = _PyAST_MatchAs ( NULL , target -> v . Name . id , EXTRA );
  8907. if (_res == NULL && PyErr_Occurred()) {
  8908. p->error_indicator = 1;
  8909. p->level--;
  8910. return NULL;
  8911. }
  8912. goto done;
  8913. }
  8914. p->mark = _mark;
  8915. D(fprintf(stderr, "%*c%s capture_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  8916. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern_capture_target"));
  8917. }
  8918. _res = NULL;
  8919. done:
  8920. p->level--;
  8921. return _res;
  8922. }
  8923. // pattern_capture_target: !"_" NAME !('.' | '(' | '=')
  8924. static expr_ty
  8925. pattern_capture_target_rule(Parser *p)
  8926. {
  8927. if (p->level++ == MAXSTACK) {
  8928. _Pypegen_stack_overflow(p);
  8929. }
  8930. if (p->error_indicator) {
  8931. p->level--;
  8932. return NULL;
  8933. }
  8934. expr_ty _res = NULL;
  8935. int _mark = p->mark;
  8936. { // !"_" NAME !('.' | '(' | '=')
  8937. if (p->error_indicator) {
  8938. p->level--;
  8939. return NULL;
  8940. }
  8941. D(fprintf(stderr, "%*c> pattern_capture_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')"));
  8942. expr_ty name;
  8943. if (
  8944. _PyPegen_lookahead_with_string(0, _PyPegen_expect_soft_keyword, p, "_")
  8945. &&
  8946. (name = _PyPegen_name_token(p)) // NAME
  8947. &&
  8948. _PyPegen_lookahead(0, _tmp_69_rule, p)
  8949. )
  8950. {
  8951. D(fprintf(stderr, "%*c+ pattern_capture_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')"));
  8952. _res = _PyPegen_set_expr_context ( p , name , Store );
  8953. if (_res == NULL && PyErr_Occurred()) {
  8954. p->error_indicator = 1;
  8955. p->level--;
  8956. return NULL;
  8957. }
  8958. goto done;
  8959. }
  8960. p->mark = _mark;
  8961. D(fprintf(stderr, "%*c%s pattern_capture_target[%d-%d]: %s failed!\n", p->level, ' ',
  8962. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')"));
  8963. }
  8964. _res = NULL;
  8965. done:
  8966. p->level--;
  8967. return _res;
  8968. }
  8969. // wildcard_pattern: "_"
  8970. static pattern_ty
  8971. wildcard_pattern_rule(Parser *p)
  8972. {
  8973. if (p->level++ == MAXSTACK) {
  8974. _Pypegen_stack_overflow(p);
  8975. }
  8976. if (p->error_indicator) {
  8977. p->level--;
  8978. return NULL;
  8979. }
  8980. pattern_ty _res = NULL;
  8981. int _mark = p->mark;
  8982. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  8983. p->error_indicator = 1;
  8984. p->level--;
  8985. return NULL;
  8986. }
  8987. int _start_lineno = p->tokens[_mark]->lineno;
  8988. UNUSED(_start_lineno); // Only used by EXTRA macro
  8989. int _start_col_offset = p->tokens[_mark]->col_offset;
  8990. UNUSED(_start_col_offset); // Only used by EXTRA macro
  8991. { // "_"
  8992. if (p->error_indicator) {
  8993. p->level--;
  8994. return NULL;
  8995. }
  8996. D(fprintf(stderr, "%*c> wildcard_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"_\""));
  8997. expr_ty _keyword;
  8998. if (
  8999. (_keyword = _PyPegen_expect_soft_keyword(p, "_")) // soft_keyword='"_"'
  9000. )
  9001. {
  9002. D(fprintf(stderr, "%*c+ wildcard_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"_\""));
  9003. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  9004. if (_token == NULL) {
  9005. p->level--;
  9006. return NULL;
  9007. }
  9008. int _end_lineno = _token->end_lineno;
  9009. UNUSED(_end_lineno); // Only used by EXTRA macro
  9010. int _end_col_offset = _token->end_col_offset;
  9011. UNUSED(_end_col_offset); // Only used by EXTRA macro
  9012. _res = _PyAST_MatchAs ( NULL , NULL , EXTRA );
  9013. if (_res == NULL && PyErr_Occurred()) {
  9014. p->error_indicator = 1;
  9015. p->level--;
  9016. return NULL;
  9017. }
  9018. goto done;
  9019. }
  9020. p->mark = _mark;
  9021. D(fprintf(stderr, "%*c%s wildcard_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9022. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"_\""));
  9023. }
  9024. _res = NULL;
  9025. done:
  9026. p->level--;
  9027. return _res;
  9028. }
  9029. // value_pattern: attr !('.' | '(' | '=')
  9030. static pattern_ty
  9031. value_pattern_rule(Parser *p)
  9032. {
  9033. if (p->level++ == MAXSTACK) {
  9034. _Pypegen_stack_overflow(p);
  9035. }
  9036. if (p->error_indicator) {
  9037. p->level--;
  9038. return NULL;
  9039. }
  9040. pattern_ty _res = NULL;
  9041. int _mark = p->mark;
  9042. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  9043. p->error_indicator = 1;
  9044. p->level--;
  9045. return NULL;
  9046. }
  9047. int _start_lineno = p->tokens[_mark]->lineno;
  9048. UNUSED(_start_lineno); // Only used by EXTRA macro
  9049. int _start_col_offset = p->tokens[_mark]->col_offset;
  9050. UNUSED(_start_col_offset); // Only used by EXTRA macro
  9051. { // attr !('.' | '(' | '=')
  9052. if (p->error_indicator) {
  9053. p->level--;
  9054. return NULL;
  9055. }
  9056. D(fprintf(stderr, "%*c> value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')"));
  9057. expr_ty attr;
  9058. if (
  9059. (attr = attr_rule(p)) // attr
  9060. &&
  9061. _PyPegen_lookahead(0, _tmp_70_rule, p)
  9062. )
  9063. {
  9064. D(fprintf(stderr, "%*c+ value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')"));
  9065. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  9066. if (_token == NULL) {
  9067. p->level--;
  9068. return NULL;
  9069. }
  9070. int _end_lineno = _token->end_lineno;
  9071. UNUSED(_end_lineno); // Only used by EXTRA macro
  9072. int _end_col_offset = _token->end_col_offset;
  9073. UNUSED(_end_col_offset); // Only used by EXTRA macro
  9074. _res = _PyAST_MatchValue ( attr , EXTRA );
  9075. if (_res == NULL && PyErr_Occurred()) {
  9076. p->error_indicator = 1;
  9077. p->level--;
  9078. return NULL;
  9079. }
  9080. goto done;
  9081. }
  9082. p->mark = _mark;
  9083. D(fprintf(stderr, "%*c%s value_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9084. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr !('.' | '(' | '=')"));
  9085. }
  9086. _res = NULL;
  9087. done:
  9088. p->level--;
  9089. return _res;
  9090. }
  9091. // Left-recursive
  9092. // attr: name_or_attr '.' NAME
  9093. static expr_ty attr_raw(Parser *);
  9094. static expr_ty
  9095. attr_rule(Parser *p)
  9096. {
  9097. if (p->level++ == MAXSTACK) {
  9098. _Pypegen_stack_overflow(p);
  9099. }
  9100. expr_ty _res = NULL;
  9101. if (_PyPegen_is_memoized(p, attr_type, &_res)) {
  9102. p->level--;
  9103. return _res;
  9104. }
  9105. int _mark = p->mark;
  9106. int _resmark = p->mark;
  9107. while (1) {
  9108. int tmpvar_1 = _PyPegen_update_memo(p, _mark, attr_type, _res);
  9109. if (tmpvar_1) {
  9110. p->level--;
  9111. return _res;
  9112. }
  9113. p->mark = _mark;
  9114. void *_raw = attr_raw(p);
  9115. if (p->error_indicator) {
  9116. p->level--;
  9117. return NULL;
  9118. }
  9119. if (_raw == NULL || p->mark <= _resmark)
  9120. break;
  9121. _resmark = p->mark;
  9122. _res = _raw;
  9123. }
  9124. p->mark = _resmark;
  9125. p->level--;
  9126. return _res;
  9127. }
  9128. static expr_ty
  9129. attr_raw(Parser *p)
  9130. {
  9131. if (p->level++ == MAXSTACK) {
  9132. _Pypegen_stack_overflow(p);
  9133. }
  9134. if (p->error_indicator) {
  9135. p->level--;
  9136. return NULL;
  9137. }
  9138. expr_ty _res = NULL;
  9139. int _mark = p->mark;
  9140. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  9141. p->error_indicator = 1;
  9142. p->level--;
  9143. return NULL;
  9144. }
  9145. int _start_lineno = p->tokens[_mark]->lineno;
  9146. UNUSED(_start_lineno); // Only used by EXTRA macro
  9147. int _start_col_offset = p->tokens[_mark]->col_offset;
  9148. UNUSED(_start_col_offset); // Only used by EXTRA macro
  9149. { // name_or_attr '.' NAME
  9150. if (p->error_indicator) {
  9151. p->level--;
  9152. return NULL;
  9153. }
  9154. D(fprintf(stderr, "%*c> attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME"));
  9155. Token * _literal;
  9156. expr_ty attr;
  9157. expr_ty value;
  9158. if (
  9159. (value = name_or_attr_rule(p)) // name_or_attr
  9160. &&
  9161. (_literal = _PyPegen_expect_token(p, 23)) // token='.'
  9162. &&
  9163. (attr = _PyPegen_name_token(p)) // NAME
  9164. )
  9165. {
  9166. D(fprintf(stderr, "%*c+ attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME"));
  9167. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  9168. if (_token == NULL) {
  9169. p->level--;
  9170. return NULL;
  9171. }
  9172. int _end_lineno = _token->end_lineno;
  9173. UNUSED(_end_lineno); // Only used by EXTRA macro
  9174. int _end_col_offset = _token->end_col_offset;
  9175. UNUSED(_end_col_offset); // Only used by EXTRA macro
  9176. _res = _PyAST_Attribute ( value , attr -> v . Name . id , Load , EXTRA );
  9177. if (_res == NULL && PyErr_Occurred()) {
  9178. p->error_indicator = 1;
  9179. p->level--;
  9180. return NULL;
  9181. }
  9182. goto done;
  9183. }
  9184. p->mark = _mark;
  9185. D(fprintf(stderr, "%*c%s attr[%d-%d]: %s failed!\n", p->level, ' ',
  9186. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '.' NAME"));
  9187. }
  9188. _res = NULL;
  9189. done:
  9190. p->level--;
  9191. return _res;
  9192. }
  9193. // Left-recursive
  9194. // name_or_attr: attr | NAME
  9195. static expr_ty
  9196. name_or_attr_rule(Parser *p)
  9197. {
  9198. if (p->level++ == MAXSTACK) {
  9199. _Pypegen_stack_overflow(p);
  9200. }
  9201. if (p->error_indicator) {
  9202. p->level--;
  9203. return NULL;
  9204. }
  9205. expr_ty _res = NULL;
  9206. int _mark = p->mark;
  9207. { // attr
  9208. if (p->error_indicator) {
  9209. p->level--;
  9210. return NULL;
  9211. }
  9212. D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr"));
  9213. expr_ty attr_var;
  9214. if (
  9215. (attr_var = attr_rule(p)) // attr
  9216. )
  9217. {
  9218. D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr"));
  9219. _res = attr_var;
  9220. goto done;
  9221. }
  9222. p->mark = _mark;
  9223. D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ',
  9224. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr"));
  9225. }
  9226. { // NAME
  9227. if (p->error_indicator) {
  9228. p->level--;
  9229. return NULL;
  9230. }
  9231. D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
  9232. expr_ty name_var;
  9233. if (
  9234. (name_var = _PyPegen_name_token(p)) // NAME
  9235. )
  9236. {
  9237. D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
  9238. _res = name_var;
  9239. goto done;
  9240. }
  9241. p->mark = _mark;
  9242. D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ',
  9243. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
  9244. }
  9245. _res = NULL;
  9246. done:
  9247. p->level--;
  9248. return _res;
  9249. }
  9250. // group_pattern: '(' pattern ')'
  9251. static pattern_ty
  9252. group_pattern_rule(Parser *p)
  9253. {
  9254. if (p->level++ == MAXSTACK) {
  9255. _Pypegen_stack_overflow(p);
  9256. }
  9257. if (p->error_indicator) {
  9258. p->level--;
  9259. return NULL;
  9260. }
  9261. pattern_ty _res = NULL;
  9262. int _mark = p->mark;
  9263. { // '(' pattern ')'
  9264. if (p->error_indicator) {
  9265. p->level--;
  9266. return NULL;
  9267. }
  9268. D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'"));
  9269. Token * _literal;
  9270. Token * _literal_1;
  9271. pattern_ty pattern;
  9272. if (
  9273. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  9274. &&
  9275. (pattern = pattern_rule(p)) // pattern
  9276. &&
  9277. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  9278. )
  9279. {
  9280. D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'"));
  9281. _res = pattern;
  9282. if (_res == NULL && PyErr_Occurred()) {
  9283. p->error_indicator = 1;
  9284. p->level--;
  9285. return NULL;
  9286. }
  9287. goto done;
  9288. }
  9289. p->mark = _mark;
  9290. D(fprintf(stderr, "%*c%s group_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9291. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' pattern ')'"));
  9292. }
  9293. _res = NULL;
  9294. done:
  9295. p->level--;
  9296. return _res;
  9297. }
  9298. // sequence_pattern: '[' maybe_sequence_pattern? ']' | '(' open_sequence_pattern? ')'
  9299. static pattern_ty
  9300. sequence_pattern_rule(Parser *p)
  9301. {
  9302. if (p->level++ == MAXSTACK) {
  9303. _Pypegen_stack_overflow(p);
  9304. }
  9305. if (p->error_indicator) {
  9306. p->level--;
  9307. return NULL;
  9308. }
  9309. pattern_ty _res = NULL;
  9310. int _mark = p->mark;
  9311. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  9312. p->error_indicator = 1;
  9313. p->level--;
  9314. return NULL;
  9315. }
  9316. int _start_lineno = p->tokens[_mark]->lineno;
  9317. UNUSED(_start_lineno); // Only used by EXTRA macro
  9318. int _start_col_offset = p->tokens[_mark]->col_offset;
  9319. UNUSED(_start_col_offset); // Only used by EXTRA macro
  9320. { // '[' maybe_sequence_pattern? ']'
  9321. if (p->error_indicator) {
  9322. p->level--;
  9323. return NULL;
  9324. }
  9325. D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' maybe_sequence_pattern? ']'"));
  9326. Token * _literal;
  9327. Token * _literal_1;
  9328. void *patterns;
  9329. if (
  9330. (_literal = _PyPegen_expect_token(p, 9)) // token='['
  9331. &&
  9332. (patterns = maybe_sequence_pattern_rule(p), !p->error_indicator) // maybe_sequence_pattern?
  9333. &&
  9334. (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
  9335. )
  9336. {
  9337. D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' maybe_sequence_pattern? ']'"));
  9338. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  9339. if (_token == NULL) {
  9340. p->level--;
  9341. return NULL;
  9342. }
  9343. int _end_lineno = _token->end_lineno;
  9344. UNUSED(_end_lineno); // Only used by EXTRA macro
  9345. int _end_col_offset = _token->end_col_offset;
  9346. UNUSED(_end_col_offset); // Only used by EXTRA macro
  9347. _res = _PyAST_MatchSequence ( patterns , EXTRA );
  9348. if (_res == NULL && PyErr_Occurred()) {
  9349. p->error_indicator = 1;
  9350. p->level--;
  9351. return NULL;
  9352. }
  9353. goto done;
  9354. }
  9355. p->mark = _mark;
  9356. D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9357. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' maybe_sequence_pattern? ']'"));
  9358. }
  9359. { // '(' open_sequence_pattern? ')'
  9360. if (p->error_indicator) {
  9361. p->level--;
  9362. return NULL;
  9363. }
  9364. D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' open_sequence_pattern? ')'"));
  9365. Token * _literal;
  9366. Token * _literal_1;
  9367. void *patterns;
  9368. if (
  9369. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  9370. &&
  9371. (patterns = open_sequence_pattern_rule(p), !p->error_indicator) // open_sequence_pattern?
  9372. &&
  9373. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  9374. )
  9375. {
  9376. D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' open_sequence_pattern? ')'"));
  9377. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  9378. if (_token == NULL) {
  9379. p->level--;
  9380. return NULL;
  9381. }
  9382. int _end_lineno = _token->end_lineno;
  9383. UNUSED(_end_lineno); // Only used by EXTRA macro
  9384. int _end_col_offset = _token->end_col_offset;
  9385. UNUSED(_end_col_offset); // Only used by EXTRA macro
  9386. _res = _PyAST_MatchSequence ( patterns , EXTRA );
  9387. if (_res == NULL && PyErr_Occurred()) {
  9388. p->error_indicator = 1;
  9389. p->level--;
  9390. return NULL;
  9391. }
  9392. goto done;
  9393. }
  9394. p->mark = _mark;
  9395. D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9396. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' open_sequence_pattern? ')'"));
  9397. }
  9398. _res = NULL;
  9399. done:
  9400. p->level--;
  9401. return _res;
  9402. }
  9403. // open_sequence_pattern: maybe_star_pattern ',' maybe_sequence_pattern?
  9404. static asdl_seq*
  9405. open_sequence_pattern_rule(Parser *p)
  9406. {
  9407. if (p->level++ == MAXSTACK) {
  9408. _Pypegen_stack_overflow(p);
  9409. }
  9410. if (p->error_indicator) {
  9411. p->level--;
  9412. return NULL;
  9413. }
  9414. asdl_seq* _res = NULL;
  9415. int _mark = p->mark;
  9416. { // maybe_star_pattern ',' maybe_sequence_pattern?
  9417. if (p->error_indicator) {
  9418. p->level--;
  9419. return NULL;
  9420. }
  9421. D(fprintf(stderr, "%*c> open_sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?"));
  9422. Token * _literal;
  9423. pattern_ty pattern;
  9424. void *patterns;
  9425. if (
  9426. (pattern = maybe_star_pattern_rule(p)) // maybe_star_pattern
  9427. &&
  9428. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  9429. &&
  9430. (patterns = maybe_sequence_pattern_rule(p), !p->error_indicator) // maybe_sequence_pattern?
  9431. )
  9432. {
  9433. D(fprintf(stderr, "%*c+ open_sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?"));
  9434. _res = _PyPegen_seq_insert_in_front ( p , pattern , patterns );
  9435. if (_res == NULL && PyErr_Occurred()) {
  9436. p->error_indicator = 1;
  9437. p->level--;
  9438. return NULL;
  9439. }
  9440. goto done;
  9441. }
  9442. p->mark = _mark;
  9443. D(fprintf(stderr, "%*c%s open_sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9444. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?"));
  9445. }
  9446. _res = NULL;
  9447. done:
  9448. p->level--;
  9449. return _res;
  9450. }
  9451. // maybe_sequence_pattern: ','.maybe_star_pattern+ ','?
  9452. static asdl_seq*
  9453. maybe_sequence_pattern_rule(Parser *p)
  9454. {
  9455. if (p->level++ == MAXSTACK) {
  9456. _Pypegen_stack_overflow(p);
  9457. }
  9458. if (p->error_indicator) {
  9459. p->level--;
  9460. return NULL;
  9461. }
  9462. asdl_seq* _res = NULL;
  9463. int _mark = p->mark;
  9464. { // ','.maybe_star_pattern+ ','?
  9465. if (p->error_indicator) {
  9466. p->level--;
  9467. return NULL;
  9468. }
  9469. D(fprintf(stderr, "%*c> maybe_sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.maybe_star_pattern+ ','?"));
  9470. void *_opt_var;
  9471. UNUSED(_opt_var); // Silence compiler warnings
  9472. asdl_seq * patterns;
  9473. if (
  9474. (patterns = _gather_71_rule(p)) // ','.maybe_star_pattern+
  9475. &&
  9476. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  9477. )
  9478. {
  9479. D(fprintf(stderr, "%*c+ maybe_sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.maybe_star_pattern+ ','?"));
  9480. _res = patterns;
  9481. if (_res == NULL && PyErr_Occurred()) {
  9482. p->error_indicator = 1;
  9483. p->level--;
  9484. return NULL;
  9485. }
  9486. goto done;
  9487. }
  9488. p->mark = _mark;
  9489. D(fprintf(stderr, "%*c%s maybe_sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9490. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.maybe_star_pattern+ ','?"));
  9491. }
  9492. _res = NULL;
  9493. done:
  9494. p->level--;
  9495. return _res;
  9496. }
  9497. // maybe_star_pattern: star_pattern | pattern
  9498. static pattern_ty
  9499. maybe_star_pattern_rule(Parser *p)
  9500. {
  9501. if (p->level++ == MAXSTACK) {
  9502. _Pypegen_stack_overflow(p);
  9503. }
  9504. if (p->error_indicator) {
  9505. p->level--;
  9506. return NULL;
  9507. }
  9508. pattern_ty _res = NULL;
  9509. int _mark = p->mark;
  9510. { // star_pattern
  9511. if (p->error_indicator) {
  9512. p->level--;
  9513. return NULL;
  9514. }
  9515. D(fprintf(stderr, "%*c> maybe_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_pattern"));
  9516. pattern_ty star_pattern_var;
  9517. if (
  9518. (star_pattern_var = star_pattern_rule(p)) // star_pattern
  9519. )
  9520. {
  9521. D(fprintf(stderr, "%*c+ maybe_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_pattern"));
  9522. _res = star_pattern_var;
  9523. goto done;
  9524. }
  9525. p->mark = _mark;
  9526. D(fprintf(stderr, "%*c%s maybe_star_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9527. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_pattern"));
  9528. }
  9529. { // pattern
  9530. if (p->error_indicator) {
  9531. p->level--;
  9532. return NULL;
  9533. }
  9534. D(fprintf(stderr, "%*c> maybe_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern"));
  9535. pattern_ty pattern_var;
  9536. if (
  9537. (pattern_var = pattern_rule(p)) // pattern
  9538. )
  9539. {
  9540. D(fprintf(stderr, "%*c+ maybe_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern"));
  9541. _res = pattern_var;
  9542. goto done;
  9543. }
  9544. p->mark = _mark;
  9545. D(fprintf(stderr, "%*c%s maybe_star_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9546. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern"));
  9547. }
  9548. _res = NULL;
  9549. done:
  9550. p->level--;
  9551. return _res;
  9552. }
  9553. // star_pattern: '*' pattern_capture_target | '*' wildcard_pattern
  9554. static pattern_ty
  9555. star_pattern_rule(Parser *p)
  9556. {
  9557. if (p->level++ == MAXSTACK) {
  9558. _Pypegen_stack_overflow(p);
  9559. }
  9560. if (p->error_indicator) {
  9561. p->level--;
  9562. return NULL;
  9563. }
  9564. pattern_ty _res = NULL;
  9565. if (_PyPegen_is_memoized(p, star_pattern_type, &_res)) {
  9566. p->level--;
  9567. return _res;
  9568. }
  9569. int _mark = p->mark;
  9570. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  9571. p->error_indicator = 1;
  9572. p->level--;
  9573. return NULL;
  9574. }
  9575. int _start_lineno = p->tokens[_mark]->lineno;
  9576. UNUSED(_start_lineno); // Only used by EXTRA macro
  9577. int _start_col_offset = p->tokens[_mark]->col_offset;
  9578. UNUSED(_start_col_offset); // Only used by EXTRA macro
  9579. { // '*' pattern_capture_target
  9580. if (p->error_indicator) {
  9581. p->level--;
  9582. return NULL;
  9583. }
  9584. D(fprintf(stderr, "%*c> star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' pattern_capture_target"));
  9585. Token * _literal;
  9586. expr_ty target;
  9587. if (
  9588. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  9589. &&
  9590. (target = pattern_capture_target_rule(p)) // pattern_capture_target
  9591. )
  9592. {
  9593. D(fprintf(stderr, "%*c+ star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' pattern_capture_target"));
  9594. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  9595. if (_token == NULL) {
  9596. p->level--;
  9597. return NULL;
  9598. }
  9599. int _end_lineno = _token->end_lineno;
  9600. UNUSED(_end_lineno); // Only used by EXTRA macro
  9601. int _end_col_offset = _token->end_col_offset;
  9602. UNUSED(_end_col_offset); // Only used by EXTRA macro
  9603. _res = _PyAST_MatchStar ( target -> v . Name . id , EXTRA );
  9604. if (_res == NULL && PyErr_Occurred()) {
  9605. p->error_indicator = 1;
  9606. p->level--;
  9607. return NULL;
  9608. }
  9609. goto done;
  9610. }
  9611. p->mark = _mark;
  9612. D(fprintf(stderr, "%*c%s star_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9613. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' pattern_capture_target"));
  9614. }
  9615. { // '*' wildcard_pattern
  9616. if (p->error_indicator) {
  9617. p->level--;
  9618. return NULL;
  9619. }
  9620. D(fprintf(stderr, "%*c> star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' wildcard_pattern"));
  9621. Token * _literal;
  9622. pattern_ty wildcard_pattern_var;
  9623. if (
  9624. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  9625. &&
  9626. (wildcard_pattern_var = wildcard_pattern_rule(p)) // wildcard_pattern
  9627. )
  9628. {
  9629. D(fprintf(stderr, "%*c+ star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' wildcard_pattern"));
  9630. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  9631. if (_token == NULL) {
  9632. p->level--;
  9633. return NULL;
  9634. }
  9635. int _end_lineno = _token->end_lineno;
  9636. UNUSED(_end_lineno); // Only used by EXTRA macro
  9637. int _end_col_offset = _token->end_col_offset;
  9638. UNUSED(_end_col_offset); // Only used by EXTRA macro
  9639. _res = _PyAST_MatchStar ( NULL , EXTRA );
  9640. if (_res == NULL && PyErr_Occurred()) {
  9641. p->error_indicator = 1;
  9642. p->level--;
  9643. return NULL;
  9644. }
  9645. goto done;
  9646. }
  9647. p->mark = _mark;
  9648. D(fprintf(stderr, "%*c%s star_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9649. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' wildcard_pattern"));
  9650. }
  9651. _res = NULL;
  9652. done:
  9653. _PyPegen_insert_memo(p, _mark, star_pattern_type, _res);
  9654. p->level--;
  9655. return _res;
  9656. }
  9657. // mapping_pattern:
  9658. // | '{' '}'
  9659. // | '{' double_star_pattern ','? '}'
  9660. // | '{' items_pattern ',' double_star_pattern ','? '}'
  9661. // | '{' items_pattern ','? '}'
  9662. static pattern_ty
  9663. mapping_pattern_rule(Parser *p)
  9664. {
  9665. if (p->level++ == MAXSTACK) {
  9666. _Pypegen_stack_overflow(p);
  9667. }
  9668. if (p->error_indicator) {
  9669. p->level--;
  9670. return NULL;
  9671. }
  9672. pattern_ty _res = NULL;
  9673. int _mark = p->mark;
  9674. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  9675. p->error_indicator = 1;
  9676. p->level--;
  9677. return NULL;
  9678. }
  9679. int _start_lineno = p->tokens[_mark]->lineno;
  9680. UNUSED(_start_lineno); // Only used by EXTRA macro
  9681. int _start_col_offset = p->tokens[_mark]->col_offset;
  9682. UNUSED(_start_col_offset); // Only used by EXTRA macro
  9683. { // '{' '}'
  9684. if (p->error_indicator) {
  9685. p->level--;
  9686. return NULL;
  9687. }
  9688. D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '}'"));
  9689. Token * _literal;
  9690. Token * _literal_1;
  9691. if (
  9692. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  9693. &&
  9694. (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
  9695. )
  9696. {
  9697. D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '}'"));
  9698. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  9699. if (_token == NULL) {
  9700. p->level--;
  9701. return NULL;
  9702. }
  9703. int _end_lineno = _token->end_lineno;
  9704. UNUSED(_end_lineno); // Only used by EXTRA macro
  9705. int _end_col_offset = _token->end_col_offset;
  9706. UNUSED(_end_col_offset); // Only used by EXTRA macro
  9707. _res = _PyAST_MatchMapping ( NULL , NULL , NULL , EXTRA );
  9708. if (_res == NULL && PyErr_Occurred()) {
  9709. p->error_indicator = 1;
  9710. p->level--;
  9711. return NULL;
  9712. }
  9713. goto done;
  9714. }
  9715. p->mark = _mark;
  9716. D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9717. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '}'"));
  9718. }
  9719. { // '{' double_star_pattern ','? '}'
  9720. if (p->error_indicator) {
  9721. p->level--;
  9722. return NULL;
  9723. }
  9724. D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_star_pattern ','? '}'"));
  9725. Token * _literal;
  9726. Token * _literal_1;
  9727. void *_opt_var;
  9728. UNUSED(_opt_var); // Silence compiler warnings
  9729. expr_ty rest;
  9730. if (
  9731. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  9732. &&
  9733. (rest = double_star_pattern_rule(p)) // double_star_pattern
  9734. &&
  9735. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  9736. &&
  9737. (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
  9738. )
  9739. {
  9740. D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_star_pattern ','? '}'"));
  9741. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  9742. if (_token == NULL) {
  9743. p->level--;
  9744. return NULL;
  9745. }
  9746. int _end_lineno = _token->end_lineno;
  9747. UNUSED(_end_lineno); // Only used by EXTRA macro
  9748. int _end_col_offset = _token->end_col_offset;
  9749. UNUSED(_end_col_offset); // Only used by EXTRA macro
  9750. _res = _PyAST_MatchMapping ( NULL , NULL , rest -> v . Name . id , EXTRA );
  9751. if (_res == NULL && PyErr_Occurred()) {
  9752. p->error_indicator = 1;
  9753. p->level--;
  9754. return NULL;
  9755. }
  9756. goto done;
  9757. }
  9758. p->mark = _mark;
  9759. D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9760. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_star_pattern ','? '}'"));
  9761. }
  9762. { // '{' items_pattern ',' double_star_pattern ','? '}'
  9763. if (p->error_indicator) {
  9764. p->level--;
  9765. return NULL;
  9766. }
  9767. D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' items_pattern ',' double_star_pattern ','? '}'"));
  9768. Token * _literal;
  9769. Token * _literal_1;
  9770. Token * _literal_2;
  9771. void *_opt_var;
  9772. UNUSED(_opt_var); // Silence compiler warnings
  9773. asdl_seq* items;
  9774. expr_ty rest;
  9775. if (
  9776. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  9777. &&
  9778. (items = items_pattern_rule(p)) // items_pattern
  9779. &&
  9780. (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
  9781. &&
  9782. (rest = double_star_pattern_rule(p)) // double_star_pattern
  9783. &&
  9784. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  9785. &&
  9786. (_literal_2 = _PyPegen_expect_token(p, 26)) // token='}'
  9787. )
  9788. {
  9789. D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' items_pattern ',' double_star_pattern ','? '}'"));
  9790. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  9791. if (_token == NULL) {
  9792. p->level--;
  9793. return NULL;
  9794. }
  9795. int _end_lineno = _token->end_lineno;
  9796. UNUSED(_end_lineno); // Only used by EXTRA macro
  9797. int _end_col_offset = _token->end_col_offset;
  9798. UNUSED(_end_col_offset); // Only used by EXTRA macro
  9799. _res = _PyAST_MatchMapping ( CHECK ( asdl_expr_seq* , _PyPegen_get_pattern_keys ( p , items ) ) , CHECK ( asdl_pattern_seq* , _PyPegen_get_patterns ( p , items ) ) , rest -> v . Name . id , EXTRA );
  9800. if (_res == NULL && PyErr_Occurred()) {
  9801. p->error_indicator = 1;
  9802. p->level--;
  9803. return NULL;
  9804. }
  9805. goto done;
  9806. }
  9807. p->mark = _mark;
  9808. D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9809. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' items_pattern ',' double_star_pattern ','? '}'"));
  9810. }
  9811. { // '{' items_pattern ','? '}'
  9812. if (p->error_indicator) {
  9813. p->level--;
  9814. return NULL;
  9815. }
  9816. D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' items_pattern ','? '}'"));
  9817. Token * _literal;
  9818. Token * _literal_1;
  9819. void *_opt_var;
  9820. UNUSED(_opt_var); // Silence compiler warnings
  9821. asdl_seq* items;
  9822. if (
  9823. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  9824. &&
  9825. (items = items_pattern_rule(p)) // items_pattern
  9826. &&
  9827. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  9828. &&
  9829. (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
  9830. )
  9831. {
  9832. D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' items_pattern ','? '}'"));
  9833. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  9834. if (_token == NULL) {
  9835. p->level--;
  9836. return NULL;
  9837. }
  9838. int _end_lineno = _token->end_lineno;
  9839. UNUSED(_end_lineno); // Only used by EXTRA macro
  9840. int _end_col_offset = _token->end_col_offset;
  9841. UNUSED(_end_col_offset); // Only used by EXTRA macro
  9842. _res = _PyAST_MatchMapping ( CHECK ( asdl_expr_seq* , _PyPegen_get_pattern_keys ( p , items ) ) , CHECK ( asdl_pattern_seq* , _PyPegen_get_patterns ( p , items ) ) , NULL , EXTRA );
  9843. if (_res == NULL && PyErr_Occurred()) {
  9844. p->error_indicator = 1;
  9845. p->level--;
  9846. return NULL;
  9847. }
  9848. goto done;
  9849. }
  9850. p->mark = _mark;
  9851. D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9852. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' items_pattern ','? '}'"));
  9853. }
  9854. _res = NULL;
  9855. done:
  9856. p->level--;
  9857. return _res;
  9858. }
  9859. // items_pattern: ','.key_value_pattern+
  9860. static asdl_seq*
  9861. items_pattern_rule(Parser *p)
  9862. {
  9863. if (p->level++ == MAXSTACK) {
  9864. _Pypegen_stack_overflow(p);
  9865. }
  9866. if (p->error_indicator) {
  9867. p->level--;
  9868. return NULL;
  9869. }
  9870. asdl_seq* _res = NULL;
  9871. int _mark = p->mark;
  9872. { // ','.key_value_pattern+
  9873. if (p->error_indicator) {
  9874. p->level--;
  9875. return NULL;
  9876. }
  9877. D(fprintf(stderr, "%*c> items_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.key_value_pattern+"));
  9878. asdl_seq * _gather_73_var;
  9879. if (
  9880. (_gather_73_var = _gather_73_rule(p)) // ','.key_value_pattern+
  9881. )
  9882. {
  9883. D(fprintf(stderr, "%*c+ items_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.key_value_pattern+"));
  9884. _res = _gather_73_var;
  9885. goto done;
  9886. }
  9887. p->mark = _mark;
  9888. D(fprintf(stderr, "%*c%s items_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9889. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.key_value_pattern+"));
  9890. }
  9891. _res = NULL;
  9892. done:
  9893. p->level--;
  9894. return _res;
  9895. }
  9896. // key_value_pattern: (literal_expr | attr) ':' pattern
  9897. static KeyPatternPair*
  9898. key_value_pattern_rule(Parser *p)
  9899. {
  9900. if (p->level++ == MAXSTACK) {
  9901. _Pypegen_stack_overflow(p);
  9902. }
  9903. if (p->error_indicator) {
  9904. p->level--;
  9905. return NULL;
  9906. }
  9907. KeyPatternPair* _res = NULL;
  9908. int _mark = p->mark;
  9909. { // (literal_expr | attr) ':' pattern
  9910. if (p->error_indicator) {
  9911. p->level--;
  9912. return NULL;
  9913. }
  9914. D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(literal_expr | attr) ':' pattern"));
  9915. Token * _literal;
  9916. void *key;
  9917. pattern_ty pattern;
  9918. if (
  9919. (key = _tmp_75_rule(p)) // literal_expr | attr
  9920. &&
  9921. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  9922. &&
  9923. (pattern = pattern_rule(p)) // pattern
  9924. )
  9925. {
  9926. D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(literal_expr | attr) ':' pattern"));
  9927. _res = _PyPegen_key_pattern_pair ( p , key , pattern );
  9928. if (_res == NULL && PyErr_Occurred()) {
  9929. p->error_indicator = 1;
  9930. p->level--;
  9931. return NULL;
  9932. }
  9933. goto done;
  9934. }
  9935. p->mark = _mark;
  9936. D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9937. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(literal_expr | attr) ':' pattern"));
  9938. }
  9939. _res = NULL;
  9940. done:
  9941. p->level--;
  9942. return _res;
  9943. }
  9944. // double_star_pattern: '**' pattern_capture_target
  9945. static expr_ty
  9946. double_star_pattern_rule(Parser *p)
  9947. {
  9948. if (p->level++ == MAXSTACK) {
  9949. _Pypegen_stack_overflow(p);
  9950. }
  9951. if (p->error_indicator) {
  9952. p->level--;
  9953. return NULL;
  9954. }
  9955. expr_ty _res = NULL;
  9956. int _mark = p->mark;
  9957. { // '**' pattern_capture_target
  9958. if (p->error_indicator) {
  9959. p->level--;
  9960. return NULL;
  9961. }
  9962. D(fprintf(stderr, "%*c> double_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' pattern_capture_target"));
  9963. Token * _literal;
  9964. expr_ty target;
  9965. if (
  9966. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  9967. &&
  9968. (target = pattern_capture_target_rule(p)) // pattern_capture_target
  9969. )
  9970. {
  9971. D(fprintf(stderr, "%*c+ double_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' pattern_capture_target"));
  9972. _res = target;
  9973. if (_res == NULL && PyErr_Occurred()) {
  9974. p->error_indicator = 1;
  9975. p->level--;
  9976. return NULL;
  9977. }
  9978. goto done;
  9979. }
  9980. p->mark = _mark;
  9981. D(fprintf(stderr, "%*c%s double_star_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  9982. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' pattern_capture_target"));
  9983. }
  9984. _res = NULL;
  9985. done:
  9986. p->level--;
  9987. return _res;
  9988. }
  9989. // class_pattern:
  9990. // | name_or_attr '(' ')'
  9991. // | name_or_attr '(' positional_patterns ','? ')'
  9992. // | name_or_attr '(' keyword_patterns ','? ')'
  9993. // | name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'
  9994. // | invalid_class_pattern
  9995. static pattern_ty
  9996. class_pattern_rule(Parser *p)
  9997. {
  9998. if (p->level++ == MAXSTACK) {
  9999. _Pypegen_stack_overflow(p);
  10000. }
  10001. if (p->error_indicator) {
  10002. p->level--;
  10003. return NULL;
  10004. }
  10005. pattern_ty _res = NULL;
  10006. int _mark = p->mark;
  10007. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  10008. p->error_indicator = 1;
  10009. p->level--;
  10010. return NULL;
  10011. }
  10012. int _start_lineno = p->tokens[_mark]->lineno;
  10013. UNUSED(_start_lineno); // Only used by EXTRA macro
  10014. int _start_col_offset = p->tokens[_mark]->col_offset;
  10015. UNUSED(_start_col_offset); // Only used by EXTRA macro
  10016. { // name_or_attr '(' ')'
  10017. if (p->error_indicator) {
  10018. p->level--;
  10019. return NULL;
  10020. }
  10021. D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'"));
  10022. Token * _literal;
  10023. Token * _literal_1;
  10024. expr_ty cls;
  10025. if (
  10026. (cls = name_or_attr_rule(p)) // name_or_attr
  10027. &&
  10028. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  10029. &&
  10030. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  10031. )
  10032. {
  10033. D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'"));
  10034. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  10035. if (_token == NULL) {
  10036. p->level--;
  10037. return NULL;
  10038. }
  10039. int _end_lineno = _token->end_lineno;
  10040. UNUSED(_end_lineno); // Only used by EXTRA macro
  10041. int _end_col_offset = _token->end_col_offset;
  10042. UNUSED(_end_col_offset); // Only used by EXTRA macro
  10043. _res = _PyAST_MatchClass ( cls , NULL , NULL , NULL , EXTRA );
  10044. if (_res == NULL && PyErr_Occurred()) {
  10045. p->error_indicator = 1;
  10046. p->level--;
  10047. return NULL;
  10048. }
  10049. goto done;
  10050. }
  10051. p->mark = _mark;
  10052. D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  10053. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ')'"));
  10054. }
  10055. { // name_or_attr '(' positional_patterns ','? ')'
  10056. if (p->error_indicator) {
  10057. p->level--;
  10058. return NULL;
  10059. }
  10060. D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'"));
  10061. Token * _literal;
  10062. Token * _literal_1;
  10063. void *_opt_var;
  10064. UNUSED(_opt_var); // Silence compiler warnings
  10065. expr_ty cls;
  10066. asdl_pattern_seq* patterns;
  10067. if (
  10068. (cls = name_or_attr_rule(p)) // name_or_attr
  10069. &&
  10070. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  10071. &&
  10072. (patterns = positional_patterns_rule(p)) // positional_patterns
  10073. &&
  10074. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  10075. &&
  10076. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  10077. )
  10078. {
  10079. D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'"));
  10080. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  10081. if (_token == NULL) {
  10082. p->level--;
  10083. return NULL;
  10084. }
  10085. int _end_lineno = _token->end_lineno;
  10086. UNUSED(_end_lineno); // Only used by EXTRA macro
  10087. int _end_col_offset = _token->end_col_offset;
  10088. UNUSED(_end_col_offset); // Only used by EXTRA macro
  10089. _res = _PyAST_MatchClass ( cls , patterns , NULL , NULL , EXTRA );
  10090. if (_res == NULL && PyErr_Occurred()) {
  10091. p->error_indicator = 1;
  10092. p->level--;
  10093. return NULL;
  10094. }
  10095. goto done;
  10096. }
  10097. p->mark = _mark;
  10098. D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  10099. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'"));
  10100. }
  10101. { // name_or_attr '(' keyword_patterns ','? ')'
  10102. if (p->error_indicator) {
  10103. p->level--;
  10104. return NULL;
  10105. }
  10106. D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'"));
  10107. Token * _literal;
  10108. Token * _literal_1;
  10109. void *_opt_var;
  10110. UNUSED(_opt_var); // Silence compiler warnings
  10111. expr_ty cls;
  10112. asdl_seq* keywords;
  10113. if (
  10114. (cls = name_or_attr_rule(p)) // name_or_attr
  10115. &&
  10116. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  10117. &&
  10118. (keywords = keyword_patterns_rule(p)) // keyword_patterns
  10119. &&
  10120. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  10121. &&
  10122. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  10123. )
  10124. {
  10125. D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'"));
  10126. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  10127. if (_token == NULL) {
  10128. p->level--;
  10129. return NULL;
  10130. }
  10131. int _end_lineno = _token->end_lineno;
  10132. UNUSED(_end_lineno); // Only used by EXTRA macro
  10133. int _end_col_offset = _token->end_col_offset;
  10134. UNUSED(_end_col_offset); // Only used by EXTRA macro
  10135. _res = _PyAST_MatchClass ( cls , NULL , CHECK ( asdl_identifier_seq* , _PyPegen_map_names_to_ids ( p , CHECK ( asdl_expr_seq* , _PyPegen_get_pattern_keys ( p , keywords ) ) ) ) , CHECK ( asdl_pattern_seq* , _PyPegen_get_patterns ( p , keywords ) ) , EXTRA );
  10136. if (_res == NULL && PyErr_Occurred()) {
  10137. p->error_indicator = 1;
  10138. p->level--;
  10139. return NULL;
  10140. }
  10141. goto done;
  10142. }
  10143. p->mark = _mark;
  10144. D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  10145. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'"));
  10146. }
  10147. { // name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'
  10148. if (p->error_indicator) {
  10149. p->level--;
  10150. return NULL;
  10151. }
  10152. D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'"));
  10153. Token * _literal;
  10154. Token * _literal_1;
  10155. Token * _literal_2;
  10156. void *_opt_var;
  10157. UNUSED(_opt_var); // Silence compiler warnings
  10158. expr_ty cls;
  10159. asdl_seq* keywords;
  10160. asdl_pattern_seq* patterns;
  10161. if (
  10162. (cls = name_or_attr_rule(p)) // name_or_attr
  10163. &&
  10164. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  10165. &&
  10166. (patterns = positional_patterns_rule(p)) // positional_patterns
  10167. &&
  10168. (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
  10169. &&
  10170. (keywords = keyword_patterns_rule(p)) // keyword_patterns
  10171. &&
  10172. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  10173. &&
  10174. (_literal_2 = _PyPegen_expect_token(p, 8)) // token=')'
  10175. )
  10176. {
  10177. D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'"));
  10178. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  10179. if (_token == NULL) {
  10180. p->level--;
  10181. return NULL;
  10182. }
  10183. int _end_lineno = _token->end_lineno;
  10184. UNUSED(_end_lineno); // Only used by EXTRA macro
  10185. int _end_col_offset = _token->end_col_offset;
  10186. UNUSED(_end_col_offset); // Only used by EXTRA macro
  10187. _res = _PyAST_MatchClass ( cls , patterns , CHECK ( asdl_identifier_seq* , _PyPegen_map_names_to_ids ( p , CHECK ( asdl_expr_seq* , _PyPegen_get_pattern_keys ( p , keywords ) ) ) ) , CHECK ( asdl_pattern_seq* , _PyPegen_get_patterns ( p , keywords ) ) , EXTRA );
  10188. if (_res == NULL && PyErr_Occurred()) {
  10189. p->error_indicator = 1;
  10190. p->level--;
  10191. return NULL;
  10192. }
  10193. goto done;
  10194. }
  10195. p->mark = _mark;
  10196. D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  10197. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'"));
  10198. }
  10199. if (p->call_invalid_rules) { // invalid_class_pattern
  10200. if (p->error_indicator) {
  10201. p->level--;
  10202. return NULL;
  10203. }
  10204. D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_class_pattern"));
  10205. void *invalid_class_pattern_var;
  10206. if (
  10207. (invalid_class_pattern_var = invalid_class_pattern_rule(p)) // invalid_class_pattern
  10208. )
  10209. {
  10210. D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_class_pattern"));
  10211. _res = invalid_class_pattern_var;
  10212. goto done;
  10213. }
  10214. p->mark = _mark;
  10215. D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  10216. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_class_pattern"));
  10217. }
  10218. _res = NULL;
  10219. done:
  10220. p->level--;
  10221. return _res;
  10222. }
  10223. // positional_patterns: ','.pattern+
  10224. static asdl_pattern_seq*
  10225. positional_patterns_rule(Parser *p)
  10226. {
  10227. if (p->level++ == MAXSTACK) {
  10228. _Pypegen_stack_overflow(p);
  10229. }
  10230. if (p->error_indicator) {
  10231. p->level--;
  10232. return NULL;
  10233. }
  10234. asdl_pattern_seq* _res = NULL;
  10235. int _mark = p->mark;
  10236. { // ','.pattern+
  10237. if (p->error_indicator) {
  10238. p->level--;
  10239. return NULL;
  10240. }
  10241. D(fprintf(stderr, "%*c> positional_patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+"));
  10242. asdl_pattern_seq* args;
  10243. if (
  10244. (args = (asdl_pattern_seq*)_gather_76_rule(p)) // ','.pattern+
  10245. )
  10246. {
  10247. D(fprintf(stderr, "%*c+ positional_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+"));
  10248. _res = args;
  10249. if (_res == NULL && PyErr_Occurred()) {
  10250. p->error_indicator = 1;
  10251. p->level--;
  10252. return NULL;
  10253. }
  10254. goto done;
  10255. }
  10256. p->mark = _mark;
  10257. D(fprintf(stderr, "%*c%s positional_patterns[%d-%d]: %s failed!\n", p->level, ' ',
  10258. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.pattern+"));
  10259. }
  10260. _res = NULL;
  10261. done:
  10262. p->level--;
  10263. return _res;
  10264. }
  10265. // keyword_patterns: ','.keyword_pattern+
  10266. static asdl_seq*
  10267. keyword_patterns_rule(Parser *p)
  10268. {
  10269. if (p->level++ == MAXSTACK) {
  10270. _Pypegen_stack_overflow(p);
  10271. }
  10272. if (p->error_indicator) {
  10273. p->level--;
  10274. return NULL;
  10275. }
  10276. asdl_seq* _res = NULL;
  10277. int _mark = p->mark;
  10278. { // ','.keyword_pattern+
  10279. if (p->error_indicator) {
  10280. p->level--;
  10281. return NULL;
  10282. }
  10283. D(fprintf(stderr, "%*c> keyword_patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.keyword_pattern+"));
  10284. asdl_seq * _gather_78_var;
  10285. if (
  10286. (_gather_78_var = _gather_78_rule(p)) // ','.keyword_pattern+
  10287. )
  10288. {
  10289. D(fprintf(stderr, "%*c+ keyword_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.keyword_pattern+"));
  10290. _res = _gather_78_var;
  10291. goto done;
  10292. }
  10293. p->mark = _mark;
  10294. D(fprintf(stderr, "%*c%s keyword_patterns[%d-%d]: %s failed!\n", p->level, ' ',
  10295. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.keyword_pattern+"));
  10296. }
  10297. _res = NULL;
  10298. done:
  10299. p->level--;
  10300. return _res;
  10301. }
  10302. // keyword_pattern: NAME '=' pattern
  10303. static KeyPatternPair*
  10304. keyword_pattern_rule(Parser *p)
  10305. {
  10306. if (p->level++ == MAXSTACK) {
  10307. _Pypegen_stack_overflow(p);
  10308. }
  10309. if (p->error_indicator) {
  10310. p->level--;
  10311. return NULL;
  10312. }
  10313. KeyPatternPair* _res = NULL;
  10314. int _mark = p->mark;
  10315. { // NAME '=' pattern
  10316. if (p->error_indicator) {
  10317. p->level--;
  10318. return NULL;
  10319. }
  10320. D(fprintf(stderr, "%*c> keyword_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern"));
  10321. Token * _literal;
  10322. expr_ty arg;
  10323. pattern_ty value;
  10324. if (
  10325. (arg = _PyPegen_name_token(p)) // NAME
  10326. &&
  10327. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  10328. &&
  10329. (value = pattern_rule(p)) // pattern
  10330. )
  10331. {
  10332. D(fprintf(stderr, "%*c+ keyword_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern"));
  10333. _res = _PyPegen_key_pattern_pair ( p , arg , value );
  10334. if (_res == NULL && PyErr_Occurred()) {
  10335. p->error_indicator = 1;
  10336. p->level--;
  10337. return NULL;
  10338. }
  10339. goto done;
  10340. }
  10341. p->mark = _mark;
  10342. D(fprintf(stderr, "%*c%s keyword_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  10343. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' pattern"));
  10344. }
  10345. _res = NULL;
  10346. done:
  10347. p->level--;
  10348. return _res;
  10349. }
  10350. // type_alias: "type" NAME type_params? '=' expression
  10351. static stmt_ty
  10352. type_alias_rule(Parser *p)
  10353. {
  10354. if (p->level++ == MAXSTACK) {
  10355. _Pypegen_stack_overflow(p);
  10356. }
  10357. if (p->error_indicator) {
  10358. p->level--;
  10359. return NULL;
  10360. }
  10361. stmt_ty _res = NULL;
  10362. int _mark = p->mark;
  10363. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  10364. p->error_indicator = 1;
  10365. p->level--;
  10366. return NULL;
  10367. }
  10368. int _start_lineno = p->tokens[_mark]->lineno;
  10369. UNUSED(_start_lineno); // Only used by EXTRA macro
  10370. int _start_col_offset = p->tokens[_mark]->col_offset;
  10371. UNUSED(_start_col_offset); // Only used by EXTRA macro
  10372. { // "type" NAME type_params? '=' expression
  10373. if (p->error_indicator) {
  10374. p->level--;
  10375. return NULL;
  10376. }
  10377. D(fprintf(stderr, "%*c> type_alias[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"type\" NAME type_params? '=' expression"));
  10378. expr_ty _keyword;
  10379. Token * _literal;
  10380. expr_ty b;
  10381. expr_ty n;
  10382. void *t;
  10383. if (
  10384. (_keyword = _PyPegen_expect_soft_keyword(p, "type")) // soft_keyword='"type"'
  10385. &&
  10386. (n = _PyPegen_name_token(p)) // NAME
  10387. &&
  10388. (t = type_params_rule(p), !p->error_indicator) // type_params?
  10389. &&
  10390. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  10391. &&
  10392. (b = expression_rule(p)) // expression
  10393. )
  10394. {
  10395. D(fprintf(stderr, "%*c+ type_alias[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"type\" NAME type_params? '=' expression"));
  10396. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  10397. if (_token == NULL) {
  10398. p->level--;
  10399. return NULL;
  10400. }
  10401. int _end_lineno = _token->end_lineno;
  10402. UNUSED(_end_lineno); // Only used by EXTRA macro
  10403. int _end_col_offset = _token->end_col_offset;
  10404. UNUSED(_end_col_offset); // Only used by EXTRA macro
  10405. _res = CHECK_VERSION ( stmt_ty , 12 , "Type statement is" , _PyAST_TypeAlias ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , n , Store ) ) , t , b , EXTRA ) );
  10406. if (_res == NULL && PyErr_Occurred()) {
  10407. p->error_indicator = 1;
  10408. p->level--;
  10409. return NULL;
  10410. }
  10411. goto done;
  10412. }
  10413. p->mark = _mark;
  10414. D(fprintf(stderr, "%*c%s type_alias[%d-%d]: %s failed!\n", p->level, ' ',
  10415. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"type\" NAME type_params? '=' expression"));
  10416. }
  10417. _res = NULL;
  10418. done:
  10419. p->level--;
  10420. return _res;
  10421. }
  10422. // type_params: '[' type_param_seq ']'
  10423. static asdl_type_param_seq*
  10424. type_params_rule(Parser *p)
  10425. {
  10426. if (p->level++ == MAXSTACK) {
  10427. _Pypegen_stack_overflow(p);
  10428. }
  10429. if (p->error_indicator) {
  10430. p->level--;
  10431. return NULL;
  10432. }
  10433. asdl_type_param_seq* _res = NULL;
  10434. int _mark = p->mark;
  10435. { // '[' type_param_seq ']'
  10436. if (p->error_indicator) {
  10437. p->level--;
  10438. return NULL;
  10439. }
  10440. D(fprintf(stderr, "%*c> type_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' type_param_seq ']'"));
  10441. Token * _literal;
  10442. Token * _literal_1;
  10443. asdl_type_param_seq* t;
  10444. if (
  10445. (_literal = _PyPegen_expect_token(p, 9)) // token='['
  10446. &&
  10447. (t = type_param_seq_rule(p)) // type_param_seq
  10448. &&
  10449. (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
  10450. )
  10451. {
  10452. D(fprintf(stderr, "%*c+ type_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' type_param_seq ']'"));
  10453. _res = CHECK_VERSION ( asdl_type_param_seq* , 12 , "Type parameter lists are" , t );
  10454. if (_res == NULL && PyErr_Occurred()) {
  10455. p->error_indicator = 1;
  10456. p->level--;
  10457. return NULL;
  10458. }
  10459. goto done;
  10460. }
  10461. p->mark = _mark;
  10462. D(fprintf(stderr, "%*c%s type_params[%d-%d]: %s failed!\n", p->level, ' ',
  10463. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' type_param_seq ']'"));
  10464. }
  10465. _res = NULL;
  10466. done:
  10467. p->level--;
  10468. return _res;
  10469. }
  10470. // type_param_seq: ','.type_param+ ','?
  10471. static asdl_type_param_seq*
  10472. type_param_seq_rule(Parser *p)
  10473. {
  10474. if (p->level++ == MAXSTACK) {
  10475. _Pypegen_stack_overflow(p);
  10476. }
  10477. if (p->error_indicator) {
  10478. p->level--;
  10479. return NULL;
  10480. }
  10481. asdl_type_param_seq* _res = NULL;
  10482. int _mark = p->mark;
  10483. { // ','.type_param+ ','?
  10484. if (p->error_indicator) {
  10485. p->level--;
  10486. return NULL;
  10487. }
  10488. D(fprintf(stderr, "%*c> type_param_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.type_param+ ','?"));
  10489. void *_opt_var;
  10490. UNUSED(_opt_var); // Silence compiler warnings
  10491. asdl_type_param_seq* a;
  10492. if (
  10493. (a = (asdl_type_param_seq*)_gather_80_rule(p)) // ','.type_param+
  10494. &&
  10495. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  10496. )
  10497. {
  10498. D(fprintf(stderr, "%*c+ type_param_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.type_param+ ','?"));
  10499. _res = a;
  10500. if (_res == NULL && PyErr_Occurred()) {
  10501. p->error_indicator = 1;
  10502. p->level--;
  10503. return NULL;
  10504. }
  10505. goto done;
  10506. }
  10507. p->mark = _mark;
  10508. D(fprintf(stderr, "%*c%s type_param_seq[%d-%d]: %s failed!\n", p->level, ' ',
  10509. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.type_param+ ','?"));
  10510. }
  10511. _res = NULL;
  10512. done:
  10513. p->level--;
  10514. return _res;
  10515. }
  10516. // type_param:
  10517. // | NAME type_param_bound?
  10518. // | '*' NAME ':' expression
  10519. // | '*' NAME
  10520. // | '**' NAME ':' expression
  10521. // | '**' NAME
  10522. static type_param_ty
  10523. type_param_rule(Parser *p)
  10524. {
  10525. if (p->level++ == MAXSTACK) {
  10526. _Pypegen_stack_overflow(p);
  10527. }
  10528. if (p->error_indicator) {
  10529. p->level--;
  10530. return NULL;
  10531. }
  10532. type_param_ty _res = NULL;
  10533. if (_PyPegen_is_memoized(p, type_param_type, &_res)) {
  10534. p->level--;
  10535. return _res;
  10536. }
  10537. int _mark = p->mark;
  10538. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  10539. p->error_indicator = 1;
  10540. p->level--;
  10541. return NULL;
  10542. }
  10543. int _start_lineno = p->tokens[_mark]->lineno;
  10544. UNUSED(_start_lineno); // Only used by EXTRA macro
  10545. int _start_col_offset = p->tokens[_mark]->col_offset;
  10546. UNUSED(_start_col_offset); // Only used by EXTRA macro
  10547. { // NAME type_param_bound?
  10548. if (p->error_indicator) {
  10549. p->level--;
  10550. return NULL;
  10551. }
  10552. D(fprintf(stderr, "%*c> type_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME type_param_bound?"));
  10553. expr_ty a;
  10554. void *b;
  10555. if (
  10556. (a = _PyPegen_name_token(p)) // NAME
  10557. &&
  10558. (b = type_param_bound_rule(p), !p->error_indicator) // type_param_bound?
  10559. )
  10560. {
  10561. D(fprintf(stderr, "%*c+ type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME type_param_bound?"));
  10562. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  10563. if (_token == NULL) {
  10564. p->level--;
  10565. return NULL;
  10566. }
  10567. int _end_lineno = _token->end_lineno;
  10568. UNUSED(_end_lineno); // Only used by EXTRA macro
  10569. int _end_col_offset = _token->end_col_offset;
  10570. UNUSED(_end_col_offset); // Only used by EXTRA macro
  10571. _res = _PyAST_TypeVar ( a -> v . Name . id , b , EXTRA );
  10572. if (_res == NULL && PyErr_Occurred()) {
  10573. p->error_indicator = 1;
  10574. p->level--;
  10575. return NULL;
  10576. }
  10577. goto done;
  10578. }
  10579. p->mark = _mark;
  10580. D(fprintf(stderr, "%*c%s type_param[%d-%d]: %s failed!\n", p->level, ' ',
  10581. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME type_param_bound?"));
  10582. }
  10583. { // '*' NAME ':' expression
  10584. if (p->error_indicator) {
  10585. p->level--;
  10586. return NULL;
  10587. }
  10588. D(fprintf(stderr, "%*c> type_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' NAME ':' expression"));
  10589. Token * _literal;
  10590. expr_ty a;
  10591. Token * colon;
  10592. expr_ty e;
  10593. if (
  10594. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  10595. &&
  10596. (a = _PyPegen_name_token(p)) // NAME
  10597. &&
  10598. (colon = _PyPegen_expect_token(p, 11)) // token=':'
  10599. &&
  10600. (e = expression_rule(p)) // expression
  10601. )
  10602. {
  10603. D(fprintf(stderr, "%*c+ type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' NAME ':' expression"));
  10604. _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( colon , e -> kind == Tuple_kind ? "cannot use constraints with TypeVarTuple" : "cannot use bound with TypeVarTuple" );
  10605. if (_res == NULL && PyErr_Occurred()) {
  10606. p->error_indicator = 1;
  10607. p->level--;
  10608. return NULL;
  10609. }
  10610. goto done;
  10611. }
  10612. p->mark = _mark;
  10613. D(fprintf(stderr, "%*c%s type_param[%d-%d]: %s failed!\n", p->level, ' ',
  10614. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' NAME ':' expression"));
  10615. }
  10616. { // '*' NAME
  10617. if (p->error_indicator) {
  10618. p->level--;
  10619. return NULL;
  10620. }
  10621. D(fprintf(stderr, "%*c> type_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' NAME"));
  10622. Token * _literal;
  10623. expr_ty a;
  10624. if (
  10625. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  10626. &&
  10627. (a = _PyPegen_name_token(p)) // NAME
  10628. )
  10629. {
  10630. D(fprintf(stderr, "%*c+ type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' NAME"));
  10631. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  10632. if (_token == NULL) {
  10633. p->level--;
  10634. return NULL;
  10635. }
  10636. int _end_lineno = _token->end_lineno;
  10637. UNUSED(_end_lineno); // Only used by EXTRA macro
  10638. int _end_col_offset = _token->end_col_offset;
  10639. UNUSED(_end_col_offset); // Only used by EXTRA macro
  10640. _res = _PyAST_TypeVarTuple ( a -> v . Name . id , EXTRA );
  10641. if (_res == NULL && PyErr_Occurred()) {
  10642. p->error_indicator = 1;
  10643. p->level--;
  10644. return NULL;
  10645. }
  10646. goto done;
  10647. }
  10648. p->mark = _mark;
  10649. D(fprintf(stderr, "%*c%s type_param[%d-%d]: %s failed!\n", p->level, ' ',
  10650. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' NAME"));
  10651. }
  10652. { // '**' NAME ':' expression
  10653. if (p->error_indicator) {
  10654. p->level--;
  10655. return NULL;
  10656. }
  10657. D(fprintf(stderr, "%*c> type_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' NAME ':' expression"));
  10658. Token * _literal;
  10659. expr_ty a;
  10660. Token * colon;
  10661. expr_ty e;
  10662. if (
  10663. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  10664. &&
  10665. (a = _PyPegen_name_token(p)) // NAME
  10666. &&
  10667. (colon = _PyPegen_expect_token(p, 11)) // token=':'
  10668. &&
  10669. (e = expression_rule(p)) // expression
  10670. )
  10671. {
  10672. D(fprintf(stderr, "%*c+ type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' NAME ':' expression"));
  10673. _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( colon , e -> kind == Tuple_kind ? "cannot use constraints with ParamSpec" : "cannot use bound with ParamSpec" );
  10674. if (_res == NULL && PyErr_Occurred()) {
  10675. p->error_indicator = 1;
  10676. p->level--;
  10677. return NULL;
  10678. }
  10679. goto done;
  10680. }
  10681. p->mark = _mark;
  10682. D(fprintf(stderr, "%*c%s type_param[%d-%d]: %s failed!\n", p->level, ' ',
  10683. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' NAME ':' expression"));
  10684. }
  10685. { // '**' NAME
  10686. if (p->error_indicator) {
  10687. p->level--;
  10688. return NULL;
  10689. }
  10690. D(fprintf(stderr, "%*c> type_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' NAME"));
  10691. Token * _literal;
  10692. expr_ty a;
  10693. if (
  10694. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  10695. &&
  10696. (a = _PyPegen_name_token(p)) // NAME
  10697. )
  10698. {
  10699. D(fprintf(stderr, "%*c+ type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' NAME"));
  10700. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  10701. if (_token == NULL) {
  10702. p->level--;
  10703. return NULL;
  10704. }
  10705. int _end_lineno = _token->end_lineno;
  10706. UNUSED(_end_lineno); // Only used by EXTRA macro
  10707. int _end_col_offset = _token->end_col_offset;
  10708. UNUSED(_end_col_offset); // Only used by EXTRA macro
  10709. _res = _PyAST_ParamSpec ( a -> v . Name . id , EXTRA );
  10710. if (_res == NULL && PyErr_Occurred()) {
  10711. p->error_indicator = 1;
  10712. p->level--;
  10713. return NULL;
  10714. }
  10715. goto done;
  10716. }
  10717. p->mark = _mark;
  10718. D(fprintf(stderr, "%*c%s type_param[%d-%d]: %s failed!\n", p->level, ' ',
  10719. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' NAME"));
  10720. }
  10721. _res = NULL;
  10722. done:
  10723. _PyPegen_insert_memo(p, _mark, type_param_type, _res);
  10724. p->level--;
  10725. return _res;
  10726. }
  10727. // type_param_bound: ':' expression
  10728. static expr_ty
  10729. type_param_bound_rule(Parser *p)
  10730. {
  10731. if (p->level++ == MAXSTACK) {
  10732. _Pypegen_stack_overflow(p);
  10733. }
  10734. if (p->error_indicator) {
  10735. p->level--;
  10736. return NULL;
  10737. }
  10738. expr_ty _res = NULL;
  10739. int _mark = p->mark;
  10740. { // ':' expression
  10741. if (p->error_indicator) {
  10742. p->level--;
  10743. return NULL;
  10744. }
  10745. D(fprintf(stderr, "%*c> type_param_bound[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression"));
  10746. Token * _literal;
  10747. expr_ty e;
  10748. if (
  10749. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  10750. &&
  10751. (e = expression_rule(p)) // expression
  10752. )
  10753. {
  10754. D(fprintf(stderr, "%*c+ type_param_bound[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
  10755. _res = e;
  10756. if (_res == NULL && PyErr_Occurred()) {
  10757. p->error_indicator = 1;
  10758. p->level--;
  10759. return NULL;
  10760. }
  10761. goto done;
  10762. }
  10763. p->mark = _mark;
  10764. D(fprintf(stderr, "%*c%s type_param_bound[%d-%d]: %s failed!\n", p->level, ' ',
  10765. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression"));
  10766. }
  10767. _res = NULL;
  10768. done:
  10769. p->level--;
  10770. return _res;
  10771. }
  10772. // expressions: expression ((',' expression))+ ','? | expression ',' | expression
  10773. static expr_ty
  10774. expressions_rule(Parser *p)
  10775. {
  10776. if (p->level++ == MAXSTACK) {
  10777. _Pypegen_stack_overflow(p);
  10778. }
  10779. if (p->error_indicator) {
  10780. p->level--;
  10781. return NULL;
  10782. }
  10783. expr_ty _res = NULL;
  10784. int _mark = p->mark;
  10785. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  10786. p->error_indicator = 1;
  10787. p->level--;
  10788. return NULL;
  10789. }
  10790. int _start_lineno = p->tokens[_mark]->lineno;
  10791. UNUSED(_start_lineno); // Only used by EXTRA macro
  10792. int _start_col_offset = p->tokens[_mark]->col_offset;
  10793. UNUSED(_start_col_offset); // Only used by EXTRA macro
  10794. { // expression ((',' expression))+ ','?
  10795. if (p->error_indicator) {
  10796. p->level--;
  10797. return NULL;
  10798. }
  10799. D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
  10800. void *_opt_var;
  10801. UNUSED(_opt_var); // Silence compiler warnings
  10802. expr_ty a;
  10803. asdl_seq * b;
  10804. if (
  10805. (a = expression_rule(p)) // expression
  10806. &&
  10807. (b = _loop1_82_rule(p)) // ((',' expression))+
  10808. &&
  10809. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  10810. )
  10811. {
  10812. D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
  10813. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  10814. if (_token == NULL) {
  10815. p->level--;
  10816. return NULL;
  10817. }
  10818. int _end_lineno = _token->end_lineno;
  10819. UNUSED(_end_lineno); // Only used by EXTRA macro
  10820. int _end_col_offset = _token->end_col_offset;
  10821. UNUSED(_end_col_offset); // Only used by EXTRA macro
  10822. _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
  10823. if (_res == NULL && PyErr_Occurred()) {
  10824. p->error_indicator = 1;
  10825. p->level--;
  10826. return NULL;
  10827. }
  10828. goto done;
  10829. }
  10830. p->mark = _mark;
  10831. D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
  10832. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?"));
  10833. }
  10834. { // expression ','
  10835. if (p->error_indicator) {
  10836. p->level--;
  10837. return NULL;
  10838. }
  10839. D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','"));
  10840. Token * _literal;
  10841. expr_ty a;
  10842. if (
  10843. (a = expression_rule(p)) // expression
  10844. &&
  10845. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  10846. )
  10847. {
  10848. D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','"));
  10849. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  10850. if (_token == NULL) {
  10851. p->level--;
  10852. return NULL;
  10853. }
  10854. int _end_lineno = _token->end_lineno;
  10855. UNUSED(_end_lineno); // Only used by EXTRA macro
  10856. int _end_col_offset = _token->end_col_offset;
  10857. UNUSED(_end_col_offset); // Only used by EXTRA macro
  10858. _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
  10859. if (_res == NULL && PyErr_Occurred()) {
  10860. p->error_indicator = 1;
  10861. p->level--;
  10862. return NULL;
  10863. }
  10864. goto done;
  10865. }
  10866. p->mark = _mark;
  10867. D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
  10868. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','"));
  10869. }
  10870. { // expression
  10871. if (p->error_indicator) {
  10872. p->level--;
  10873. return NULL;
  10874. }
  10875. D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
  10876. expr_ty expression_var;
  10877. if (
  10878. (expression_var = expression_rule(p)) // expression
  10879. )
  10880. {
  10881. D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
  10882. _res = expression_var;
  10883. goto done;
  10884. }
  10885. p->mark = _mark;
  10886. D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
  10887. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
  10888. }
  10889. _res = NULL;
  10890. done:
  10891. p->level--;
  10892. return _res;
  10893. }
  10894. // expression:
  10895. // | invalid_expression
  10896. // | invalid_legacy_expression
  10897. // | disjunction 'if' disjunction 'else' expression
  10898. // | disjunction
  10899. // | lambdef
  10900. static expr_ty
  10901. expression_rule(Parser *p)
  10902. {
  10903. if (p->level++ == MAXSTACK) {
  10904. _Pypegen_stack_overflow(p);
  10905. }
  10906. if (p->error_indicator) {
  10907. p->level--;
  10908. return NULL;
  10909. }
  10910. expr_ty _res = NULL;
  10911. if (_PyPegen_is_memoized(p, expression_type, &_res)) {
  10912. p->level--;
  10913. return _res;
  10914. }
  10915. int _mark = p->mark;
  10916. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  10917. p->error_indicator = 1;
  10918. p->level--;
  10919. return NULL;
  10920. }
  10921. int _start_lineno = p->tokens[_mark]->lineno;
  10922. UNUSED(_start_lineno); // Only used by EXTRA macro
  10923. int _start_col_offset = p->tokens[_mark]->col_offset;
  10924. UNUSED(_start_col_offset); // Only used by EXTRA macro
  10925. if (p->call_invalid_rules) { // invalid_expression
  10926. if (p->error_indicator) {
  10927. p->level--;
  10928. return NULL;
  10929. }
  10930. D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_expression"));
  10931. void *invalid_expression_var;
  10932. if (
  10933. (invalid_expression_var = invalid_expression_rule(p)) // invalid_expression
  10934. )
  10935. {
  10936. D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_expression"));
  10937. _res = invalid_expression_var;
  10938. goto done;
  10939. }
  10940. p->mark = _mark;
  10941. D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
  10942. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_expression"));
  10943. }
  10944. if (p->call_invalid_rules) { // invalid_legacy_expression
  10945. if (p->error_indicator) {
  10946. p->level--;
  10947. return NULL;
  10948. }
  10949. D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_legacy_expression"));
  10950. void *invalid_legacy_expression_var;
  10951. if (
  10952. (invalid_legacy_expression_var = invalid_legacy_expression_rule(p)) // invalid_legacy_expression
  10953. )
  10954. {
  10955. D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_legacy_expression"));
  10956. _res = invalid_legacy_expression_var;
  10957. goto done;
  10958. }
  10959. p->mark = _mark;
  10960. D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
  10961. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_legacy_expression"));
  10962. }
  10963. { // disjunction 'if' disjunction 'else' expression
  10964. if (p->error_indicator) {
  10965. p->level--;
  10966. return NULL;
  10967. }
  10968. D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
  10969. Token * _keyword;
  10970. Token * _keyword_1;
  10971. expr_ty a;
  10972. expr_ty b;
  10973. expr_ty c;
  10974. if (
  10975. (a = disjunction_rule(p)) // disjunction
  10976. &&
  10977. (_keyword = _PyPegen_expect_token(p, 642)) // token='if'
  10978. &&
  10979. (b = disjunction_rule(p)) // disjunction
  10980. &&
  10981. (_keyword_1 = _PyPegen_expect_token(p, 645)) // token='else'
  10982. &&
  10983. (c = expression_rule(p)) // expression
  10984. )
  10985. {
  10986. D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
  10987. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  10988. if (_token == NULL) {
  10989. p->level--;
  10990. return NULL;
  10991. }
  10992. int _end_lineno = _token->end_lineno;
  10993. UNUSED(_end_lineno); // Only used by EXTRA macro
  10994. int _end_col_offset = _token->end_col_offset;
  10995. UNUSED(_end_col_offset); // Only used by EXTRA macro
  10996. _res = _PyAST_IfExp ( b , a , c , EXTRA );
  10997. if (_res == NULL && PyErr_Occurred()) {
  10998. p->error_indicator = 1;
  10999. p->level--;
  11000. return NULL;
  11001. }
  11002. goto done;
  11003. }
  11004. p->mark = _mark;
  11005. D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
  11006. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
  11007. }
  11008. { // disjunction
  11009. if (p->error_indicator) {
  11010. p->level--;
  11011. return NULL;
  11012. }
  11013. D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction"));
  11014. expr_ty disjunction_var;
  11015. if (
  11016. (disjunction_var = disjunction_rule(p)) // disjunction
  11017. )
  11018. {
  11019. D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction"));
  11020. _res = disjunction_var;
  11021. goto done;
  11022. }
  11023. p->mark = _mark;
  11024. D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
  11025. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction"));
  11026. }
  11027. { // lambdef
  11028. if (p->error_indicator) {
  11029. p->level--;
  11030. return NULL;
  11031. }
  11032. D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef"));
  11033. expr_ty lambdef_var;
  11034. if (
  11035. (lambdef_var = lambdef_rule(p)) // lambdef
  11036. )
  11037. {
  11038. D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef"));
  11039. _res = lambdef_var;
  11040. goto done;
  11041. }
  11042. p->mark = _mark;
  11043. D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
  11044. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef"));
  11045. }
  11046. _res = NULL;
  11047. done:
  11048. _PyPegen_insert_memo(p, _mark, expression_type, _res);
  11049. p->level--;
  11050. return _res;
  11051. }
  11052. // yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
  11053. static expr_ty
  11054. yield_expr_rule(Parser *p)
  11055. {
  11056. if (p->level++ == MAXSTACK) {
  11057. _Pypegen_stack_overflow(p);
  11058. }
  11059. if (p->error_indicator) {
  11060. p->level--;
  11061. return NULL;
  11062. }
  11063. expr_ty _res = NULL;
  11064. int _mark = p->mark;
  11065. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  11066. p->error_indicator = 1;
  11067. p->level--;
  11068. return NULL;
  11069. }
  11070. int _start_lineno = p->tokens[_mark]->lineno;
  11071. UNUSED(_start_lineno); // Only used by EXTRA macro
  11072. int _start_col_offset = p->tokens[_mark]->col_offset;
  11073. UNUSED(_start_col_offset); // Only used by EXTRA macro
  11074. { // 'yield' 'from' expression
  11075. if (p->error_indicator) {
  11076. p->level--;
  11077. return NULL;
  11078. }
  11079. D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
  11080. Token * _keyword;
  11081. Token * _keyword_1;
  11082. expr_ty a;
  11083. if (
  11084. (_keyword = _PyPegen_expect_token(p, 573)) // token='yield'
  11085. &&
  11086. (_keyword_1 = _PyPegen_expect_token(p, 608)) // token='from'
  11087. &&
  11088. (a = expression_rule(p)) // expression
  11089. )
  11090. {
  11091. D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
  11092. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  11093. if (_token == NULL) {
  11094. p->level--;
  11095. return NULL;
  11096. }
  11097. int _end_lineno = _token->end_lineno;
  11098. UNUSED(_end_lineno); // Only used by EXTRA macro
  11099. int _end_col_offset = _token->end_col_offset;
  11100. UNUSED(_end_col_offset); // Only used by EXTRA macro
  11101. _res = _PyAST_YieldFrom ( a , EXTRA );
  11102. if (_res == NULL && PyErr_Occurred()) {
  11103. p->error_indicator = 1;
  11104. p->level--;
  11105. return NULL;
  11106. }
  11107. goto done;
  11108. }
  11109. p->mark = _mark;
  11110. D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
  11111. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression"));
  11112. }
  11113. { // 'yield' star_expressions?
  11114. if (p->error_indicator) {
  11115. p->level--;
  11116. return NULL;
  11117. }
  11118. D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
  11119. Token * _keyword;
  11120. void *a;
  11121. if (
  11122. (_keyword = _PyPegen_expect_token(p, 573)) // token='yield'
  11123. &&
  11124. (a = star_expressions_rule(p), !p->error_indicator) // star_expressions?
  11125. )
  11126. {
  11127. D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
  11128. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  11129. if (_token == NULL) {
  11130. p->level--;
  11131. return NULL;
  11132. }
  11133. int _end_lineno = _token->end_lineno;
  11134. UNUSED(_end_lineno); // Only used by EXTRA macro
  11135. int _end_col_offset = _token->end_col_offset;
  11136. UNUSED(_end_col_offset); // Only used by EXTRA macro
  11137. _res = _PyAST_Yield ( a , EXTRA );
  11138. if (_res == NULL && PyErr_Occurred()) {
  11139. p->error_indicator = 1;
  11140. p->level--;
  11141. return NULL;
  11142. }
  11143. goto done;
  11144. }
  11145. p->mark = _mark;
  11146. D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
  11147. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?"));
  11148. }
  11149. _res = NULL;
  11150. done:
  11151. p->level--;
  11152. return _res;
  11153. }
  11154. // star_expressions:
  11155. // | star_expression ((',' star_expression))+ ','?
  11156. // | star_expression ','
  11157. // | star_expression
  11158. static expr_ty
  11159. star_expressions_rule(Parser *p)
  11160. {
  11161. if (p->level++ == MAXSTACK) {
  11162. _Pypegen_stack_overflow(p);
  11163. }
  11164. if (p->error_indicator) {
  11165. p->level--;
  11166. return NULL;
  11167. }
  11168. expr_ty _res = NULL;
  11169. int _mark = p->mark;
  11170. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  11171. p->error_indicator = 1;
  11172. p->level--;
  11173. return NULL;
  11174. }
  11175. int _start_lineno = p->tokens[_mark]->lineno;
  11176. UNUSED(_start_lineno); // Only used by EXTRA macro
  11177. int _start_col_offset = p->tokens[_mark]->col_offset;
  11178. UNUSED(_start_col_offset); // Only used by EXTRA macro
  11179. { // star_expression ((',' star_expression))+ ','?
  11180. if (p->error_indicator) {
  11181. p->level--;
  11182. return NULL;
  11183. }
  11184. D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
  11185. void *_opt_var;
  11186. UNUSED(_opt_var); // Silence compiler warnings
  11187. expr_ty a;
  11188. asdl_seq * b;
  11189. if (
  11190. (a = star_expression_rule(p)) // star_expression
  11191. &&
  11192. (b = _loop1_83_rule(p)) // ((',' star_expression))+
  11193. &&
  11194. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  11195. )
  11196. {
  11197. D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
  11198. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  11199. if (_token == NULL) {
  11200. p->level--;
  11201. return NULL;
  11202. }
  11203. int _end_lineno = _token->end_lineno;
  11204. UNUSED(_end_lineno); // Only used by EXTRA macro
  11205. int _end_col_offset = _token->end_col_offset;
  11206. UNUSED(_end_col_offset); // Only used by EXTRA macro
  11207. _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
  11208. if (_res == NULL && PyErr_Occurred()) {
  11209. p->error_indicator = 1;
  11210. p->level--;
  11211. return NULL;
  11212. }
  11213. goto done;
  11214. }
  11215. p->mark = _mark;
  11216. D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
  11217. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
  11218. }
  11219. { // star_expression ','
  11220. if (p->error_indicator) {
  11221. p->level--;
  11222. return NULL;
  11223. }
  11224. D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
  11225. Token * _literal;
  11226. expr_ty a;
  11227. if (
  11228. (a = star_expression_rule(p)) // star_expression
  11229. &&
  11230. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  11231. )
  11232. {
  11233. D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
  11234. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  11235. if (_token == NULL) {
  11236. p->level--;
  11237. return NULL;
  11238. }
  11239. int _end_lineno = _token->end_lineno;
  11240. UNUSED(_end_lineno); // Only used by EXTRA macro
  11241. int _end_col_offset = _token->end_col_offset;
  11242. UNUSED(_end_col_offset); // Only used by EXTRA macro
  11243. _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
  11244. if (_res == NULL && PyErr_Occurred()) {
  11245. p->error_indicator = 1;
  11246. p->level--;
  11247. return NULL;
  11248. }
  11249. goto done;
  11250. }
  11251. p->mark = _mark;
  11252. D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
  11253. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','"));
  11254. }
  11255. { // star_expression
  11256. if (p->error_indicator) {
  11257. p->level--;
  11258. return NULL;
  11259. }
  11260. D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression"));
  11261. expr_ty star_expression_var;
  11262. if (
  11263. (star_expression_var = star_expression_rule(p)) // star_expression
  11264. )
  11265. {
  11266. D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression"));
  11267. _res = star_expression_var;
  11268. goto done;
  11269. }
  11270. p->mark = _mark;
  11271. D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
  11272. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression"));
  11273. }
  11274. _res = NULL;
  11275. done:
  11276. p->level--;
  11277. return _res;
  11278. }
  11279. // star_expression: '*' bitwise_or | expression
  11280. static expr_ty
  11281. star_expression_rule(Parser *p)
  11282. {
  11283. if (p->level++ == MAXSTACK) {
  11284. _Pypegen_stack_overflow(p);
  11285. }
  11286. if (p->error_indicator) {
  11287. p->level--;
  11288. return NULL;
  11289. }
  11290. expr_ty _res = NULL;
  11291. if (_PyPegen_is_memoized(p, star_expression_type, &_res)) {
  11292. p->level--;
  11293. return _res;
  11294. }
  11295. int _mark = p->mark;
  11296. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  11297. p->error_indicator = 1;
  11298. p->level--;
  11299. return NULL;
  11300. }
  11301. int _start_lineno = p->tokens[_mark]->lineno;
  11302. UNUSED(_start_lineno); // Only used by EXTRA macro
  11303. int _start_col_offset = p->tokens[_mark]->col_offset;
  11304. UNUSED(_start_col_offset); // Only used by EXTRA macro
  11305. { // '*' bitwise_or
  11306. if (p->error_indicator) {
  11307. p->level--;
  11308. return NULL;
  11309. }
  11310. D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
  11311. Token * _literal;
  11312. expr_ty a;
  11313. if (
  11314. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  11315. &&
  11316. (a = bitwise_or_rule(p)) // bitwise_or
  11317. )
  11318. {
  11319. D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
  11320. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  11321. if (_token == NULL) {
  11322. p->level--;
  11323. return NULL;
  11324. }
  11325. int _end_lineno = _token->end_lineno;
  11326. UNUSED(_end_lineno); // Only used by EXTRA macro
  11327. int _end_col_offset = _token->end_col_offset;
  11328. UNUSED(_end_col_offset); // Only used by EXTRA macro
  11329. _res = _PyAST_Starred ( a , Load , EXTRA );
  11330. if (_res == NULL && PyErr_Occurred()) {
  11331. p->error_indicator = 1;
  11332. p->level--;
  11333. return NULL;
  11334. }
  11335. goto done;
  11336. }
  11337. p->mark = _mark;
  11338. D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
  11339. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
  11340. }
  11341. { // expression
  11342. if (p->error_indicator) {
  11343. p->level--;
  11344. return NULL;
  11345. }
  11346. D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
  11347. expr_ty expression_var;
  11348. if (
  11349. (expression_var = expression_rule(p)) // expression
  11350. )
  11351. {
  11352. D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
  11353. _res = expression_var;
  11354. goto done;
  11355. }
  11356. p->mark = _mark;
  11357. D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
  11358. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
  11359. }
  11360. _res = NULL;
  11361. done:
  11362. _PyPegen_insert_memo(p, _mark, star_expression_type, _res);
  11363. p->level--;
  11364. return _res;
  11365. }
  11366. // star_named_expressions: ','.star_named_expression+ ','?
  11367. static asdl_expr_seq*
  11368. star_named_expressions_rule(Parser *p)
  11369. {
  11370. if (p->level++ == MAXSTACK) {
  11371. _Pypegen_stack_overflow(p);
  11372. }
  11373. if (p->error_indicator) {
  11374. p->level--;
  11375. return NULL;
  11376. }
  11377. asdl_expr_seq* _res = NULL;
  11378. int _mark = p->mark;
  11379. { // ','.star_named_expression+ ','?
  11380. if (p->error_indicator) {
  11381. p->level--;
  11382. return NULL;
  11383. }
  11384. D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
  11385. void *_opt_var;
  11386. UNUSED(_opt_var); // Silence compiler warnings
  11387. asdl_expr_seq* a;
  11388. if (
  11389. (a = (asdl_expr_seq*)_gather_84_rule(p)) // ','.star_named_expression+
  11390. &&
  11391. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  11392. )
  11393. {
  11394. D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
  11395. _res = a;
  11396. if (_res == NULL && PyErr_Occurred()) {
  11397. p->error_indicator = 1;
  11398. p->level--;
  11399. return NULL;
  11400. }
  11401. goto done;
  11402. }
  11403. p->mark = _mark;
  11404. D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ',
  11405. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?"));
  11406. }
  11407. _res = NULL;
  11408. done:
  11409. p->level--;
  11410. return _res;
  11411. }
  11412. // star_named_expression: '*' bitwise_or | named_expression
  11413. static expr_ty
  11414. star_named_expression_rule(Parser *p)
  11415. {
  11416. if (p->level++ == MAXSTACK) {
  11417. _Pypegen_stack_overflow(p);
  11418. }
  11419. if (p->error_indicator) {
  11420. p->level--;
  11421. return NULL;
  11422. }
  11423. expr_ty _res = NULL;
  11424. int _mark = p->mark;
  11425. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  11426. p->error_indicator = 1;
  11427. p->level--;
  11428. return NULL;
  11429. }
  11430. int _start_lineno = p->tokens[_mark]->lineno;
  11431. UNUSED(_start_lineno); // Only used by EXTRA macro
  11432. int _start_col_offset = p->tokens[_mark]->col_offset;
  11433. UNUSED(_start_col_offset); // Only used by EXTRA macro
  11434. { // '*' bitwise_or
  11435. if (p->error_indicator) {
  11436. p->level--;
  11437. return NULL;
  11438. }
  11439. D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
  11440. Token * _literal;
  11441. expr_ty a;
  11442. if (
  11443. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  11444. &&
  11445. (a = bitwise_or_rule(p)) // bitwise_or
  11446. )
  11447. {
  11448. D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
  11449. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  11450. if (_token == NULL) {
  11451. p->level--;
  11452. return NULL;
  11453. }
  11454. int _end_lineno = _token->end_lineno;
  11455. UNUSED(_end_lineno); // Only used by EXTRA macro
  11456. int _end_col_offset = _token->end_col_offset;
  11457. UNUSED(_end_col_offset); // Only used by EXTRA macro
  11458. _res = _PyAST_Starred ( a , Load , EXTRA );
  11459. if (_res == NULL && PyErr_Occurred()) {
  11460. p->error_indicator = 1;
  11461. p->level--;
  11462. return NULL;
  11463. }
  11464. goto done;
  11465. }
  11466. p->mark = _mark;
  11467. D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
  11468. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
  11469. }
  11470. { // named_expression
  11471. if (p->error_indicator) {
  11472. p->level--;
  11473. return NULL;
  11474. }
  11475. D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
  11476. expr_ty named_expression_var;
  11477. if (
  11478. (named_expression_var = named_expression_rule(p)) // named_expression
  11479. )
  11480. {
  11481. D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
  11482. _res = named_expression_var;
  11483. goto done;
  11484. }
  11485. p->mark = _mark;
  11486. D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
  11487. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
  11488. }
  11489. _res = NULL;
  11490. done:
  11491. p->level--;
  11492. return _res;
  11493. }
  11494. // assignment_expression: NAME ':=' ~ expression
  11495. static expr_ty
  11496. assignment_expression_rule(Parser *p)
  11497. {
  11498. if (p->level++ == MAXSTACK) {
  11499. _Pypegen_stack_overflow(p);
  11500. }
  11501. if (p->error_indicator) {
  11502. p->level--;
  11503. return NULL;
  11504. }
  11505. expr_ty _res = NULL;
  11506. int _mark = p->mark;
  11507. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  11508. p->error_indicator = 1;
  11509. p->level--;
  11510. return NULL;
  11511. }
  11512. int _start_lineno = p->tokens[_mark]->lineno;
  11513. UNUSED(_start_lineno); // Only used by EXTRA macro
  11514. int _start_col_offset = p->tokens[_mark]->col_offset;
  11515. UNUSED(_start_col_offset); // Only used by EXTRA macro
  11516. { // NAME ':=' ~ expression
  11517. if (p->error_indicator) {
  11518. p->level--;
  11519. return NULL;
  11520. }
  11521. D(fprintf(stderr, "%*c> assignment_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
  11522. int _cut_var = 0;
  11523. Token * _literal;
  11524. expr_ty a;
  11525. expr_ty b;
  11526. if (
  11527. (a = _PyPegen_name_token(p)) // NAME
  11528. &&
  11529. (_literal = _PyPegen_expect_token(p, 53)) // token=':='
  11530. &&
  11531. (_cut_var = 1)
  11532. &&
  11533. (b = expression_rule(p)) // expression
  11534. )
  11535. {
  11536. D(fprintf(stderr, "%*c+ assignment_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
  11537. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  11538. if (_token == NULL) {
  11539. p->level--;
  11540. return NULL;
  11541. }
  11542. int _end_lineno = _token->end_lineno;
  11543. UNUSED(_end_lineno); // Only used by EXTRA macro
  11544. int _end_col_offset = _token->end_col_offset;
  11545. UNUSED(_end_col_offset); // Only used by EXTRA macro
  11546. _res = CHECK_VERSION ( expr_ty , 8 , "Assignment expressions are" , _PyAST_NamedExpr ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA ) );
  11547. if (_res == NULL && PyErr_Occurred()) {
  11548. p->error_indicator = 1;
  11549. p->level--;
  11550. return NULL;
  11551. }
  11552. goto done;
  11553. }
  11554. p->mark = _mark;
  11555. D(fprintf(stderr, "%*c%s assignment_expression[%d-%d]: %s failed!\n", p->level, ' ',
  11556. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' ~ expression"));
  11557. if (_cut_var) {
  11558. p->level--;
  11559. return NULL;
  11560. }
  11561. }
  11562. _res = NULL;
  11563. done:
  11564. p->level--;
  11565. return _res;
  11566. }
  11567. // named_expression: assignment_expression | invalid_named_expression | expression !':='
  11568. static expr_ty
  11569. named_expression_rule(Parser *p)
  11570. {
  11571. if (p->level++ == MAXSTACK) {
  11572. _Pypegen_stack_overflow(p);
  11573. }
  11574. if (p->error_indicator) {
  11575. p->level--;
  11576. return NULL;
  11577. }
  11578. expr_ty _res = NULL;
  11579. int _mark = p->mark;
  11580. { // assignment_expression
  11581. if (p->error_indicator) {
  11582. p->level--;
  11583. return NULL;
  11584. }
  11585. D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
  11586. expr_ty assignment_expression_var;
  11587. if (
  11588. (assignment_expression_var = assignment_expression_rule(p)) // assignment_expression
  11589. )
  11590. {
  11591. D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
  11592. _res = assignment_expression_var;
  11593. goto done;
  11594. }
  11595. p->mark = _mark;
  11596. D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
  11597. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment_expression"));
  11598. }
  11599. if (p->call_invalid_rules) { // invalid_named_expression
  11600. if (p->error_indicator) {
  11601. p->level--;
  11602. return NULL;
  11603. }
  11604. D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
  11605. void *invalid_named_expression_var;
  11606. if (
  11607. (invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression
  11608. )
  11609. {
  11610. D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
  11611. _res = invalid_named_expression_var;
  11612. goto done;
  11613. }
  11614. p->mark = _mark;
  11615. D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
  11616. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression"));
  11617. }
  11618. { // expression !':='
  11619. if (p->error_indicator) {
  11620. p->level--;
  11621. return NULL;
  11622. }
  11623. D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
  11624. expr_ty expression_var;
  11625. if (
  11626. (expression_var = expression_rule(p)) // expression
  11627. &&
  11628. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':='
  11629. )
  11630. {
  11631. D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
  11632. _res = expression_var;
  11633. goto done;
  11634. }
  11635. p->mark = _mark;
  11636. D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
  11637. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
  11638. }
  11639. _res = NULL;
  11640. done:
  11641. p->level--;
  11642. return _res;
  11643. }
  11644. // disjunction: conjunction (('or' conjunction))+ | conjunction
  11645. static expr_ty
  11646. disjunction_rule(Parser *p)
  11647. {
  11648. if (p->level++ == MAXSTACK) {
  11649. _Pypegen_stack_overflow(p);
  11650. }
  11651. if (p->error_indicator) {
  11652. p->level--;
  11653. return NULL;
  11654. }
  11655. expr_ty _res = NULL;
  11656. if (_PyPegen_is_memoized(p, disjunction_type, &_res)) {
  11657. p->level--;
  11658. return _res;
  11659. }
  11660. int _mark = p->mark;
  11661. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  11662. p->error_indicator = 1;
  11663. p->level--;
  11664. return NULL;
  11665. }
  11666. int _start_lineno = p->tokens[_mark]->lineno;
  11667. UNUSED(_start_lineno); // Only used by EXTRA macro
  11668. int _start_col_offset = p->tokens[_mark]->col_offset;
  11669. UNUSED(_start_col_offset); // Only used by EXTRA macro
  11670. { // conjunction (('or' conjunction))+
  11671. if (p->error_indicator) {
  11672. p->level--;
  11673. return NULL;
  11674. }
  11675. D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
  11676. expr_ty a;
  11677. asdl_seq * b;
  11678. if (
  11679. (a = conjunction_rule(p)) // conjunction
  11680. &&
  11681. (b = _loop1_86_rule(p)) // (('or' conjunction))+
  11682. )
  11683. {
  11684. D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
  11685. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  11686. if (_token == NULL) {
  11687. p->level--;
  11688. return NULL;
  11689. }
  11690. int _end_lineno = _token->end_lineno;
  11691. UNUSED(_end_lineno); // Only used by EXTRA macro
  11692. int _end_col_offset = _token->end_col_offset;
  11693. UNUSED(_end_col_offset); // Only used by EXTRA macro
  11694. _res = _PyAST_BoolOp ( Or , CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
  11695. if (_res == NULL && PyErr_Occurred()) {
  11696. p->error_indicator = 1;
  11697. p->level--;
  11698. return NULL;
  11699. }
  11700. goto done;
  11701. }
  11702. p->mark = _mark;
  11703. D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
  11704. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+"));
  11705. }
  11706. { // conjunction
  11707. if (p->error_indicator) {
  11708. p->level--;
  11709. return NULL;
  11710. }
  11711. D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction"));
  11712. expr_ty conjunction_var;
  11713. if (
  11714. (conjunction_var = conjunction_rule(p)) // conjunction
  11715. )
  11716. {
  11717. D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction"));
  11718. _res = conjunction_var;
  11719. goto done;
  11720. }
  11721. p->mark = _mark;
  11722. D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
  11723. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction"));
  11724. }
  11725. _res = NULL;
  11726. done:
  11727. _PyPegen_insert_memo(p, _mark, disjunction_type, _res);
  11728. p->level--;
  11729. return _res;
  11730. }
  11731. // conjunction: inversion (('and' inversion))+ | inversion
  11732. static expr_ty
  11733. conjunction_rule(Parser *p)
  11734. {
  11735. if (p->level++ == MAXSTACK) {
  11736. _Pypegen_stack_overflow(p);
  11737. }
  11738. if (p->error_indicator) {
  11739. p->level--;
  11740. return NULL;
  11741. }
  11742. expr_ty _res = NULL;
  11743. if (_PyPegen_is_memoized(p, conjunction_type, &_res)) {
  11744. p->level--;
  11745. return _res;
  11746. }
  11747. int _mark = p->mark;
  11748. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  11749. p->error_indicator = 1;
  11750. p->level--;
  11751. return NULL;
  11752. }
  11753. int _start_lineno = p->tokens[_mark]->lineno;
  11754. UNUSED(_start_lineno); // Only used by EXTRA macro
  11755. int _start_col_offset = p->tokens[_mark]->col_offset;
  11756. UNUSED(_start_col_offset); // Only used by EXTRA macro
  11757. { // inversion (('and' inversion))+
  11758. if (p->error_indicator) {
  11759. p->level--;
  11760. return NULL;
  11761. }
  11762. D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
  11763. expr_ty a;
  11764. asdl_seq * b;
  11765. if (
  11766. (a = inversion_rule(p)) // inversion
  11767. &&
  11768. (b = _loop1_87_rule(p)) // (('and' inversion))+
  11769. )
  11770. {
  11771. D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
  11772. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  11773. if (_token == NULL) {
  11774. p->level--;
  11775. return NULL;
  11776. }
  11777. int _end_lineno = _token->end_lineno;
  11778. UNUSED(_end_lineno); // Only used by EXTRA macro
  11779. int _end_col_offset = _token->end_col_offset;
  11780. UNUSED(_end_col_offset); // Only used by EXTRA macro
  11781. _res = _PyAST_BoolOp ( And , CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
  11782. if (_res == NULL && PyErr_Occurred()) {
  11783. p->error_indicator = 1;
  11784. p->level--;
  11785. return NULL;
  11786. }
  11787. goto done;
  11788. }
  11789. p->mark = _mark;
  11790. D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
  11791. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+"));
  11792. }
  11793. { // inversion
  11794. if (p->error_indicator) {
  11795. p->level--;
  11796. return NULL;
  11797. }
  11798. D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion"));
  11799. expr_ty inversion_var;
  11800. if (
  11801. (inversion_var = inversion_rule(p)) // inversion
  11802. )
  11803. {
  11804. D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion"));
  11805. _res = inversion_var;
  11806. goto done;
  11807. }
  11808. p->mark = _mark;
  11809. D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
  11810. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion"));
  11811. }
  11812. _res = NULL;
  11813. done:
  11814. _PyPegen_insert_memo(p, _mark, conjunction_type, _res);
  11815. p->level--;
  11816. return _res;
  11817. }
  11818. // inversion: 'not' inversion | comparison
  11819. static expr_ty
  11820. inversion_rule(Parser *p)
  11821. {
  11822. if (p->level++ == MAXSTACK) {
  11823. _Pypegen_stack_overflow(p);
  11824. }
  11825. if (p->error_indicator) {
  11826. p->level--;
  11827. return NULL;
  11828. }
  11829. expr_ty _res = NULL;
  11830. if (_PyPegen_is_memoized(p, inversion_type, &_res)) {
  11831. p->level--;
  11832. return _res;
  11833. }
  11834. int _mark = p->mark;
  11835. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  11836. p->error_indicator = 1;
  11837. p->level--;
  11838. return NULL;
  11839. }
  11840. int _start_lineno = p->tokens[_mark]->lineno;
  11841. UNUSED(_start_lineno); // Only used by EXTRA macro
  11842. int _start_col_offset = p->tokens[_mark]->col_offset;
  11843. UNUSED(_start_col_offset); // Only used by EXTRA macro
  11844. { // 'not' inversion
  11845. if (p->error_indicator) {
  11846. p->level--;
  11847. return NULL;
  11848. }
  11849. D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
  11850. Token * _keyword;
  11851. expr_ty a;
  11852. if (
  11853. (_keyword = _PyPegen_expect_token(p, 581)) // token='not'
  11854. &&
  11855. (a = inversion_rule(p)) // inversion
  11856. )
  11857. {
  11858. D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
  11859. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  11860. if (_token == NULL) {
  11861. p->level--;
  11862. return NULL;
  11863. }
  11864. int _end_lineno = _token->end_lineno;
  11865. UNUSED(_end_lineno); // Only used by EXTRA macro
  11866. int _end_col_offset = _token->end_col_offset;
  11867. UNUSED(_end_col_offset); // Only used by EXTRA macro
  11868. _res = _PyAST_UnaryOp ( Not , a , EXTRA );
  11869. if (_res == NULL && PyErr_Occurred()) {
  11870. p->error_indicator = 1;
  11871. p->level--;
  11872. return NULL;
  11873. }
  11874. goto done;
  11875. }
  11876. p->mark = _mark;
  11877. D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
  11878. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion"));
  11879. }
  11880. { // comparison
  11881. if (p->error_indicator) {
  11882. p->level--;
  11883. return NULL;
  11884. }
  11885. D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison"));
  11886. expr_ty comparison_var;
  11887. if (
  11888. (comparison_var = comparison_rule(p)) // comparison
  11889. )
  11890. {
  11891. D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison"));
  11892. _res = comparison_var;
  11893. goto done;
  11894. }
  11895. p->mark = _mark;
  11896. D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
  11897. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison"));
  11898. }
  11899. _res = NULL;
  11900. done:
  11901. _PyPegen_insert_memo(p, _mark, inversion_type, _res);
  11902. p->level--;
  11903. return _res;
  11904. }
  11905. // comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or
  11906. static expr_ty
  11907. comparison_rule(Parser *p)
  11908. {
  11909. if (p->level++ == MAXSTACK) {
  11910. _Pypegen_stack_overflow(p);
  11911. }
  11912. if (p->error_indicator) {
  11913. p->level--;
  11914. return NULL;
  11915. }
  11916. expr_ty _res = NULL;
  11917. int _mark = p->mark;
  11918. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  11919. p->error_indicator = 1;
  11920. p->level--;
  11921. return NULL;
  11922. }
  11923. int _start_lineno = p->tokens[_mark]->lineno;
  11924. UNUSED(_start_lineno); // Only used by EXTRA macro
  11925. int _start_col_offset = p->tokens[_mark]->col_offset;
  11926. UNUSED(_start_col_offset); // Only used by EXTRA macro
  11927. { // bitwise_or compare_op_bitwise_or_pair+
  11928. if (p->error_indicator) {
  11929. p->level--;
  11930. return NULL;
  11931. }
  11932. D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
  11933. expr_ty a;
  11934. asdl_seq * b;
  11935. if (
  11936. (a = bitwise_or_rule(p)) // bitwise_or
  11937. &&
  11938. (b = _loop1_88_rule(p)) // compare_op_bitwise_or_pair+
  11939. )
  11940. {
  11941. D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
  11942. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  11943. if (_token == NULL) {
  11944. p->level--;
  11945. return NULL;
  11946. }
  11947. int _end_lineno = _token->end_lineno;
  11948. UNUSED(_end_lineno); // Only used by EXTRA macro
  11949. int _end_col_offset = _token->end_col_offset;
  11950. UNUSED(_end_col_offset); // Only used by EXTRA macro
  11951. _res = _PyAST_Compare ( a , CHECK ( asdl_int_seq* , _PyPegen_get_cmpops ( p , b ) ) , CHECK ( asdl_expr_seq* , _PyPegen_get_exprs ( p , b ) ) , EXTRA );
  11952. if (_res == NULL && PyErr_Occurred()) {
  11953. p->error_indicator = 1;
  11954. p->level--;
  11955. return NULL;
  11956. }
  11957. goto done;
  11958. }
  11959. p->mark = _mark;
  11960. D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
  11961. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
  11962. }
  11963. { // bitwise_or
  11964. if (p->error_indicator) {
  11965. p->level--;
  11966. return NULL;
  11967. }
  11968. D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
  11969. expr_ty bitwise_or_var;
  11970. if (
  11971. (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
  11972. )
  11973. {
  11974. D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
  11975. _res = bitwise_or_var;
  11976. goto done;
  11977. }
  11978. p->mark = _mark;
  11979. D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
  11980. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or"));
  11981. }
  11982. _res = NULL;
  11983. done:
  11984. p->level--;
  11985. return _res;
  11986. }
  11987. // compare_op_bitwise_or_pair:
  11988. // | eq_bitwise_or
  11989. // | noteq_bitwise_or
  11990. // | lte_bitwise_or
  11991. // | lt_bitwise_or
  11992. // | gte_bitwise_or
  11993. // | gt_bitwise_or
  11994. // | notin_bitwise_or
  11995. // | in_bitwise_or
  11996. // | isnot_bitwise_or
  11997. // | is_bitwise_or
  11998. static CmpopExprPair*
  11999. compare_op_bitwise_or_pair_rule(Parser *p)
  12000. {
  12001. if (p->level++ == MAXSTACK) {
  12002. _Pypegen_stack_overflow(p);
  12003. }
  12004. if (p->error_indicator) {
  12005. p->level--;
  12006. return NULL;
  12007. }
  12008. CmpopExprPair* _res = NULL;
  12009. int _mark = p->mark;
  12010. { // eq_bitwise_or
  12011. if (p->error_indicator) {
  12012. p->level--;
  12013. return NULL;
  12014. }
  12015. D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
  12016. CmpopExprPair* eq_bitwise_or_var;
  12017. if (
  12018. (eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or
  12019. )
  12020. {
  12021. D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
  12022. _res = eq_bitwise_or_var;
  12023. goto done;
  12024. }
  12025. p->mark = _mark;
  12026. D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
  12027. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or"));
  12028. }
  12029. { // noteq_bitwise_or
  12030. if (p->error_indicator) {
  12031. p->level--;
  12032. return NULL;
  12033. }
  12034. D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
  12035. CmpopExprPair* noteq_bitwise_or_var;
  12036. if (
  12037. (noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or
  12038. )
  12039. {
  12040. D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
  12041. _res = noteq_bitwise_or_var;
  12042. goto done;
  12043. }
  12044. p->mark = _mark;
  12045. D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
  12046. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or"));
  12047. }
  12048. { // lte_bitwise_or
  12049. if (p->error_indicator) {
  12050. p->level--;
  12051. return NULL;
  12052. }
  12053. D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
  12054. CmpopExprPair* lte_bitwise_or_var;
  12055. if (
  12056. (lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or
  12057. )
  12058. {
  12059. D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
  12060. _res = lte_bitwise_or_var;
  12061. goto done;
  12062. }
  12063. p->mark = _mark;
  12064. D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
  12065. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or"));
  12066. }
  12067. { // lt_bitwise_or
  12068. if (p->error_indicator) {
  12069. p->level--;
  12070. return NULL;
  12071. }
  12072. D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
  12073. CmpopExprPair* lt_bitwise_or_var;
  12074. if (
  12075. (lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or
  12076. )
  12077. {
  12078. D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
  12079. _res = lt_bitwise_or_var;
  12080. goto done;
  12081. }
  12082. p->mark = _mark;
  12083. D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
  12084. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or"));
  12085. }
  12086. { // gte_bitwise_or
  12087. if (p->error_indicator) {
  12088. p->level--;
  12089. return NULL;
  12090. }
  12091. D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
  12092. CmpopExprPair* gte_bitwise_or_var;
  12093. if (
  12094. (gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or
  12095. )
  12096. {
  12097. D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
  12098. _res = gte_bitwise_or_var;
  12099. goto done;
  12100. }
  12101. p->mark = _mark;
  12102. D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
  12103. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or"));
  12104. }
  12105. { // gt_bitwise_or
  12106. if (p->error_indicator) {
  12107. p->level--;
  12108. return NULL;
  12109. }
  12110. D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
  12111. CmpopExprPair* gt_bitwise_or_var;
  12112. if (
  12113. (gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or
  12114. )
  12115. {
  12116. D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
  12117. _res = gt_bitwise_or_var;
  12118. goto done;
  12119. }
  12120. p->mark = _mark;
  12121. D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
  12122. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or"));
  12123. }
  12124. { // notin_bitwise_or
  12125. if (p->error_indicator) {
  12126. p->level--;
  12127. return NULL;
  12128. }
  12129. D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
  12130. CmpopExprPair* notin_bitwise_or_var;
  12131. if (
  12132. (notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or
  12133. )
  12134. {
  12135. D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
  12136. _res = notin_bitwise_or_var;
  12137. goto done;
  12138. }
  12139. p->mark = _mark;
  12140. D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
  12141. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or"));
  12142. }
  12143. { // in_bitwise_or
  12144. if (p->error_indicator) {
  12145. p->level--;
  12146. return NULL;
  12147. }
  12148. D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
  12149. CmpopExprPair* in_bitwise_or_var;
  12150. if (
  12151. (in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or
  12152. )
  12153. {
  12154. D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
  12155. _res = in_bitwise_or_var;
  12156. goto done;
  12157. }
  12158. p->mark = _mark;
  12159. D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
  12160. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or"));
  12161. }
  12162. { // isnot_bitwise_or
  12163. if (p->error_indicator) {
  12164. p->level--;
  12165. return NULL;
  12166. }
  12167. D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
  12168. CmpopExprPair* isnot_bitwise_or_var;
  12169. if (
  12170. (isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or
  12171. )
  12172. {
  12173. D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
  12174. _res = isnot_bitwise_or_var;
  12175. goto done;
  12176. }
  12177. p->mark = _mark;
  12178. D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
  12179. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or"));
  12180. }
  12181. { // is_bitwise_or
  12182. if (p->error_indicator) {
  12183. p->level--;
  12184. return NULL;
  12185. }
  12186. D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
  12187. CmpopExprPair* is_bitwise_or_var;
  12188. if (
  12189. (is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or
  12190. )
  12191. {
  12192. D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
  12193. _res = is_bitwise_or_var;
  12194. goto done;
  12195. }
  12196. p->mark = _mark;
  12197. D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
  12198. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or"));
  12199. }
  12200. _res = NULL;
  12201. done:
  12202. p->level--;
  12203. return _res;
  12204. }
  12205. // eq_bitwise_or: '==' bitwise_or
  12206. static CmpopExprPair*
  12207. eq_bitwise_or_rule(Parser *p)
  12208. {
  12209. if (p->level++ == MAXSTACK) {
  12210. _Pypegen_stack_overflow(p);
  12211. }
  12212. if (p->error_indicator) {
  12213. p->level--;
  12214. return NULL;
  12215. }
  12216. CmpopExprPair* _res = NULL;
  12217. int _mark = p->mark;
  12218. { // '==' bitwise_or
  12219. if (p->error_indicator) {
  12220. p->level--;
  12221. return NULL;
  12222. }
  12223. D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
  12224. Token * _literal;
  12225. expr_ty a;
  12226. if (
  12227. (_literal = _PyPegen_expect_token(p, 27)) // token='=='
  12228. &&
  12229. (a = bitwise_or_rule(p)) // bitwise_or
  12230. )
  12231. {
  12232. D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
  12233. _res = _PyPegen_cmpop_expr_pair ( p , Eq , a );
  12234. if (_res == NULL && PyErr_Occurred()) {
  12235. p->error_indicator = 1;
  12236. p->level--;
  12237. return NULL;
  12238. }
  12239. goto done;
  12240. }
  12241. p->mark = _mark;
  12242. D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
  12243. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or"));
  12244. }
  12245. _res = NULL;
  12246. done:
  12247. p->level--;
  12248. return _res;
  12249. }
  12250. // noteq_bitwise_or: ('!=') bitwise_or
  12251. static CmpopExprPair*
  12252. noteq_bitwise_or_rule(Parser *p)
  12253. {
  12254. if (p->level++ == MAXSTACK) {
  12255. _Pypegen_stack_overflow(p);
  12256. }
  12257. if (p->error_indicator) {
  12258. p->level--;
  12259. return NULL;
  12260. }
  12261. CmpopExprPair* _res = NULL;
  12262. int _mark = p->mark;
  12263. { // ('!=') bitwise_or
  12264. if (p->error_indicator) {
  12265. p->level--;
  12266. return NULL;
  12267. }
  12268. D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
  12269. void *_tmp_89_var;
  12270. expr_ty a;
  12271. if (
  12272. (_tmp_89_var = _tmp_89_rule(p)) // '!='
  12273. &&
  12274. (a = bitwise_or_rule(p)) // bitwise_or
  12275. )
  12276. {
  12277. D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
  12278. _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a );
  12279. if (_res == NULL && PyErr_Occurred()) {
  12280. p->error_indicator = 1;
  12281. p->level--;
  12282. return NULL;
  12283. }
  12284. goto done;
  12285. }
  12286. p->mark = _mark;
  12287. D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
  12288. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or"));
  12289. }
  12290. _res = NULL;
  12291. done:
  12292. p->level--;
  12293. return _res;
  12294. }
  12295. // lte_bitwise_or: '<=' bitwise_or
  12296. static CmpopExprPair*
  12297. lte_bitwise_or_rule(Parser *p)
  12298. {
  12299. if (p->level++ == MAXSTACK) {
  12300. _Pypegen_stack_overflow(p);
  12301. }
  12302. if (p->error_indicator) {
  12303. p->level--;
  12304. return NULL;
  12305. }
  12306. CmpopExprPair* _res = NULL;
  12307. int _mark = p->mark;
  12308. { // '<=' bitwise_or
  12309. if (p->error_indicator) {
  12310. p->level--;
  12311. return NULL;
  12312. }
  12313. D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
  12314. Token * _literal;
  12315. expr_ty a;
  12316. if (
  12317. (_literal = _PyPegen_expect_token(p, 29)) // token='<='
  12318. &&
  12319. (a = bitwise_or_rule(p)) // bitwise_or
  12320. )
  12321. {
  12322. D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
  12323. _res = _PyPegen_cmpop_expr_pair ( p , LtE , a );
  12324. if (_res == NULL && PyErr_Occurred()) {
  12325. p->error_indicator = 1;
  12326. p->level--;
  12327. return NULL;
  12328. }
  12329. goto done;
  12330. }
  12331. p->mark = _mark;
  12332. D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
  12333. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or"));
  12334. }
  12335. _res = NULL;
  12336. done:
  12337. p->level--;
  12338. return _res;
  12339. }
  12340. // lt_bitwise_or: '<' bitwise_or
  12341. static CmpopExprPair*
  12342. lt_bitwise_or_rule(Parser *p)
  12343. {
  12344. if (p->level++ == MAXSTACK) {
  12345. _Pypegen_stack_overflow(p);
  12346. }
  12347. if (p->error_indicator) {
  12348. p->level--;
  12349. return NULL;
  12350. }
  12351. CmpopExprPair* _res = NULL;
  12352. int _mark = p->mark;
  12353. { // '<' bitwise_or
  12354. if (p->error_indicator) {
  12355. p->level--;
  12356. return NULL;
  12357. }
  12358. D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
  12359. Token * _literal;
  12360. expr_ty a;
  12361. if (
  12362. (_literal = _PyPegen_expect_token(p, 20)) // token='<'
  12363. &&
  12364. (a = bitwise_or_rule(p)) // bitwise_or
  12365. )
  12366. {
  12367. D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
  12368. _res = _PyPegen_cmpop_expr_pair ( p , Lt , a );
  12369. if (_res == NULL && PyErr_Occurred()) {
  12370. p->error_indicator = 1;
  12371. p->level--;
  12372. return NULL;
  12373. }
  12374. goto done;
  12375. }
  12376. p->mark = _mark;
  12377. D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
  12378. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or"));
  12379. }
  12380. _res = NULL;
  12381. done:
  12382. p->level--;
  12383. return _res;
  12384. }
  12385. // gte_bitwise_or: '>=' bitwise_or
  12386. static CmpopExprPair*
  12387. gte_bitwise_or_rule(Parser *p)
  12388. {
  12389. if (p->level++ == MAXSTACK) {
  12390. _Pypegen_stack_overflow(p);
  12391. }
  12392. if (p->error_indicator) {
  12393. p->level--;
  12394. return NULL;
  12395. }
  12396. CmpopExprPair* _res = NULL;
  12397. int _mark = p->mark;
  12398. { // '>=' bitwise_or
  12399. if (p->error_indicator) {
  12400. p->level--;
  12401. return NULL;
  12402. }
  12403. D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
  12404. Token * _literal;
  12405. expr_ty a;
  12406. if (
  12407. (_literal = _PyPegen_expect_token(p, 30)) // token='>='
  12408. &&
  12409. (a = bitwise_or_rule(p)) // bitwise_or
  12410. )
  12411. {
  12412. D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
  12413. _res = _PyPegen_cmpop_expr_pair ( p , GtE , a );
  12414. if (_res == NULL && PyErr_Occurred()) {
  12415. p->error_indicator = 1;
  12416. p->level--;
  12417. return NULL;
  12418. }
  12419. goto done;
  12420. }
  12421. p->mark = _mark;
  12422. D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
  12423. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or"));
  12424. }
  12425. _res = NULL;
  12426. done:
  12427. p->level--;
  12428. return _res;
  12429. }
  12430. // gt_bitwise_or: '>' bitwise_or
  12431. static CmpopExprPair*
  12432. gt_bitwise_or_rule(Parser *p)
  12433. {
  12434. if (p->level++ == MAXSTACK) {
  12435. _Pypegen_stack_overflow(p);
  12436. }
  12437. if (p->error_indicator) {
  12438. p->level--;
  12439. return NULL;
  12440. }
  12441. CmpopExprPair* _res = NULL;
  12442. int _mark = p->mark;
  12443. { // '>' bitwise_or
  12444. if (p->error_indicator) {
  12445. p->level--;
  12446. return NULL;
  12447. }
  12448. D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
  12449. Token * _literal;
  12450. expr_ty a;
  12451. if (
  12452. (_literal = _PyPegen_expect_token(p, 21)) // token='>'
  12453. &&
  12454. (a = bitwise_or_rule(p)) // bitwise_or
  12455. )
  12456. {
  12457. D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
  12458. _res = _PyPegen_cmpop_expr_pair ( p , Gt , a );
  12459. if (_res == NULL && PyErr_Occurred()) {
  12460. p->error_indicator = 1;
  12461. p->level--;
  12462. return NULL;
  12463. }
  12464. goto done;
  12465. }
  12466. p->mark = _mark;
  12467. D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
  12468. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or"));
  12469. }
  12470. _res = NULL;
  12471. done:
  12472. p->level--;
  12473. return _res;
  12474. }
  12475. // notin_bitwise_or: 'not' 'in' bitwise_or
  12476. static CmpopExprPair*
  12477. notin_bitwise_or_rule(Parser *p)
  12478. {
  12479. if (p->level++ == MAXSTACK) {
  12480. _Pypegen_stack_overflow(p);
  12481. }
  12482. if (p->error_indicator) {
  12483. p->level--;
  12484. return NULL;
  12485. }
  12486. CmpopExprPair* _res = NULL;
  12487. int _mark = p->mark;
  12488. { // 'not' 'in' bitwise_or
  12489. if (p->error_indicator) {
  12490. p->level--;
  12491. return NULL;
  12492. }
  12493. D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
  12494. Token * _keyword;
  12495. Token * _keyword_1;
  12496. expr_ty a;
  12497. if (
  12498. (_keyword = _PyPegen_expect_token(p, 581)) // token='not'
  12499. &&
  12500. (_keyword_1 = _PyPegen_expect_token(p, 651)) // token='in'
  12501. &&
  12502. (a = bitwise_or_rule(p)) // bitwise_or
  12503. )
  12504. {
  12505. D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
  12506. _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a );
  12507. if (_res == NULL && PyErr_Occurred()) {
  12508. p->error_indicator = 1;
  12509. p->level--;
  12510. return NULL;
  12511. }
  12512. goto done;
  12513. }
  12514. p->mark = _mark;
  12515. D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
  12516. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or"));
  12517. }
  12518. _res = NULL;
  12519. done:
  12520. p->level--;
  12521. return _res;
  12522. }
  12523. // in_bitwise_or: 'in' bitwise_or
  12524. static CmpopExprPair*
  12525. in_bitwise_or_rule(Parser *p)
  12526. {
  12527. if (p->level++ == MAXSTACK) {
  12528. _Pypegen_stack_overflow(p);
  12529. }
  12530. if (p->error_indicator) {
  12531. p->level--;
  12532. return NULL;
  12533. }
  12534. CmpopExprPair* _res = NULL;
  12535. int _mark = p->mark;
  12536. { // 'in' bitwise_or
  12537. if (p->error_indicator) {
  12538. p->level--;
  12539. return NULL;
  12540. }
  12541. D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
  12542. Token * _keyword;
  12543. expr_ty a;
  12544. if (
  12545. (_keyword = _PyPegen_expect_token(p, 651)) // token='in'
  12546. &&
  12547. (a = bitwise_or_rule(p)) // bitwise_or
  12548. )
  12549. {
  12550. D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
  12551. _res = _PyPegen_cmpop_expr_pair ( p , In , a );
  12552. if (_res == NULL && PyErr_Occurred()) {
  12553. p->error_indicator = 1;
  12554. p->level--;
  12555. return NULL;
  12556. }
  12557. goto done;
  12558. }
  12559. p->mark = _mark;
  12560. D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
  12561. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or"));
  12562. }
  12563. _res = NULL;
  12564. done:
  12565. p->level--;
  12566. return _res;
  12567. }
  12568. // isnot_bitwise_or: 'is' 'not' bitwise_or
  12569. static CmpopExprPair*
  12570. isnot_bitwise_or_rule(Parser *p)
  12571. {
  12572. if (p->level++ == MAXSTACK) {
  12573. _Pypegen_stack_overflow(p);
  12574. }
  12575. if (p->error_indicator) {
  12576. p->level--;
  12577. return NULL;
  12578. }
  12579. CmpopExprPair* _res = NULL;
  12580. int _mark = p->mark;
  12581. { // 'is' 'not' bitwise_or
  12582. if (p->error_indicator) {
  12583. p->level--;
  12584. return NULL;
  12585. }
  12586. D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
  12587. Token * _keyword;
  12588. Token * _keyword_1;
  12589. expr_ty a;
  12590. if (
  12591. (_keyword = _PyPegen_expect_token(p, 582)) // token='is'
  12592. &&
  12593. (_keyword_1 = _PyPegen_expect_token(p, 581)) // token='not'
  12594. &&
  12595. (a = bitwise_or_rule(p)) // bitwise_or
  12596. )
  12597. {
  12598. D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
  12599. _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a );
  12600. if (_res == NULL && PyErr_Occurred()) {
  12601. p->error_indicator = 1;
  12602. p->level--;
  12603. return NULL;
  12604. }
  12605. goto done;
  12606. }
  12607. p->mark = _mark;
  12608. D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
  12609. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or"));
  12610. }
  12611. _res = NULL;
  12612. done:
  12613. p->level--;
  12614. return _res;
  12615. }
  12616. // is_bitwise_or: 'is' bitwise_or
  12617. static CmpopExprPair*
  12618. is_bitwise_or_rule(Parser *p)
  12619. {
  12620. if (p->level++ == MAXSTACK) {
  12621. _Pypegen_stack_overflow(p);
  12622. }
  12623. if (p->error_indicator) {
  12624. p->level--;
  12625. return NULL;
  12626. }
  12627. CmpopExprPair* _res = NULL;
  12628. int _mark = p->mark;
  12629. { // 'is' bitwise_or
  12630. if (p->error_indicator) {
  12631. p->level--;
  12632. return NULL;
  12633. }
  12634. D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
  12635. Token * _keyword;
  12636. expr_ty a;
  12637. if (
  12638. (_keyword = _PyPegen_expect_token(p, 582)) // token='is'
  12639. &&
  12640. (a = bitwise_or_rule(p)) // bitwise_or
  12641. )
  12642. {
  12643. D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
  12644. _res = _PyPegen_cmpop_expr_pair ( p , Is , a );
  12645. if (_res == NULL && PyErr_Occurred()) {
  12646. p->error_indicator = 1;
  12647. p->level--;
  12648. return NULL;
  12649. }
  12650. goto done;
  12651. }
  12652. p->mark = _mark;
  12653. D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
  12654. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or"));
  12655. }
  12656. _res = NULL;
  12657. done:
  12658. p->level--;
  12659. return _res;
  12660. }
  12661. // Left-recursive
  12662. // bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor
  12663. static expr_ty bitwise_or_raw(Parser *);
  12664. static expr_ty
  12665. bitwise_or_rule(Parser *p)
  12666. {
  12667. if (p->level++ == MAXSTACK) {
  12668. _Pypegen_stack_overflow(p);
  12669. }
  12670. expr_ty _res = NULL;
  12671. if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) {
  12672. p->level--;
  12673. return _res;
  12674. }
  12675. int _mark = p->mark;
  12676. int _resmark = p->mark;
  12677. while (1) {
  12678. int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res);
  12679. if (tmpvar_2) {
  12680. p->level--;
  12681. return _res;
  12682. }
  12683. p->mark = _mark;
  12684. void *_raw = bitwise_or_raw(p);
  12685. if (p->error_indicator) {
  12686. p->level--;
  12687. return NULL;
  12688. }
  12689. if (_raw == NULL || p->mark <= _resmark)
  12690. break;
  12691. _resmark = p->mark;
  12692. _res = _raw;
  12693. }
  12694. p->mark = _resmark;
  12695. p->level--;
  12696. return _res;
  12697. }
  12698. static expr_ty
  12699. bitwise_or_raw(Parser *p)
  12700. {
  12701. if (p->level++ == MAXSTACK) {
  12702. _Pypegen_stack_overflow(p);
  12703. }
  12704. if (p->error_indicator) {
  12705. p->level--;
  12706. return NULL;
  12707. }
  12708. expr_ty _res = NULL;
  12709. int _mark = p->mark;
  12710. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  12711. p->error_indicator = 1;
  12712. p->level--;
  12713. return NULL;
  12714. }
  12715. int _start_lineno = p->tokens[_mark]->lineno;
  12716. UNUSED(_start_lineno); // Only used by EXTRA macro
  12717. int _start_col_offset = p->tokens[_mark]->col_offset;
  12718. UNUSED(_start_col_offset); // Only used by EXTRA macro
  12719. { // bitwise_or '|' bitwise_xor
  12720. if (p->error_indicator) {
  12721. p->level--;
  12722. return NULL;
  12723. }
  12724. D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
  12725. Token * _literal;
  12726. expr_ty a;
  12727. expr_ty b;
  12728. if (
  12729. (a = bitwise_or_rule(p)) // bitwise_or
  12730. &&
  12731. (_literal = _PyPegen_expect_token(p, 18)) // token='|'
  12732. &&
  12733. (b = bitwise_xor_rule(p)) // bitwise_xor
  12734. )
  12735. {
  12736. D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
  12737. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  12738. if (_token == NULL) {
  12739. p->level--;
  12740. return NULL;
  12741. }
  12742. int _end_lineno = _token->end_lineno;
  12743. UNUSED(_end_lineno); // Only used by EXTRA macro
  12744. int _end_col_offset = _token->end_col_offset;
  12745. UNUSED(_end_col_offset); // Only used by EXTRA macro
  12746. _res = _PyAST_BinOp ( a , BitOr , b , EXTRA );
  12747. if (_res == NULL && PyErr_Occurred()) {
  12748. p->error_indicator = 1;
  12749. p->level--;
  12750. return NULL;
  12751. }
  12752. goto done;
  12753. }
  12754. p->mark = _mark;
  12755. D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
  12756. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor"));
  12757. }
  12758. { // bitwise_xor
  12759. if (p->error_indicator) {
  12760. p->level--;
  12761. return NULL;
  12762. }
  12763. D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
  12764. expr_ty bitwise_xor_var;
  12765. if (
  12766. (bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor
  12767. )
  12768. {
  12769. D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
  12770. _res = bitwise_xor_var;
  12771. goto done;
  12772. }
  12773. p->mark = _mark;
  12774. D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
  12775. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor"));
  12776. }
  12777. _res = NULL;
  12778. done:
  12779. p->level--;
  12780. return _res;
  12781. }
  12782. // Left-recursive
  12783. // bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and
  12784. static expr_ty bitwise_xor_raw(Parser *);
  12785. static expr_ty
  12786. bitwise_xor_rule(Parser *p)
  12787. {
  12788. if (p->level++ == MAXSTACK) {
  12789. _Pypegen_stack_overflow(p);
  12790. }
  12791. expr_ty _res = NULL;
  12792. if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) {
  12793. p->level--;
  12794. return _res;
  12795. }
  12796. int _mark = p->mark;
  12797. int _resmark = p->mark;
  12798. while (1) {
  12799. int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res);
  12800. if (tmpvar_3) {
  12801. p->level--;
  12802. return _res;
  12803. }
  12804. p->mark = _mark;
  12805. void *_raw = bitwise_xor_raw(p);
  12806. if (p->error_indicator) {
  12807. p->level--;
  12808. return NULL;
  12809. }
  12810. if (_raw == NULL || p->mark <= _resmark)
  12811. break;
  12812. _resmark = p->mark;
  12813. _res = _raw;
  12814. }
  12815. p->mark = _resmark;
  12816. p->level--;
  12817. return _res;
  12818. }
  12819. static expr_ty
  12820. bitwise_xor_raw(Parser *p)
  12821. {
  12822. if (p->level++ == MAXSTACK) {
  12823. _Pypegen_stack_overflow(p);
  12824. }
  12825. if (p->error_indicator) {
  12826. p->level--;
  12827. return NULL;
  12828. }
  12829. expr_ty _res = NULL;
  12830. int _mark = p->mark;
  12831. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  12832. p->error_indicator = 1;
  12833. p->level--;
  12834. return NULL;
  12835. }
  12836. int _start_lineno = p->tokens[_mark]->lineno;
  12837. UNUSED(_start_lineno); // Only used by EXTRA macro
  12838. int _start_col_offset = p->tokens[_mark]->col_offset;
  12839. UNUSED(_start_col_offset); // Only used by EXTRA macro
  12840. { // bitwise_xor '^' bitwise_and
  12841. if (p->error_indicator) {
  12842. p->level--;
  12843. return NULL;
  12844. }
  12845. D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
  12846. Token * _literal;
  12847. expr_ty a;
  12848. expr_ty b;
  12849. if (
  12850. (a = bitwise_xor_rule(p)) // bitwise_xor
  12851. &&
  12852. (_literal = _PyPegen_expect_token(p, 32)) // token='^'
  12853. &&
  12854. (b = bitwise_and_rule(p)) // bitwise_and
  12855. )
  12856. {
  12857. D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
  12858. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  12859. if (_token == NULL) {
  12860. p->level--;
  12861. return NULL;
  12862. }
  12863. int _end_lineno = _token->end_lineno;
  12864. UNUSED(_end_lineno); // Only used by EXTRA macro
  12865. int _end_col_offset = _token->end_col_offset;
  12866. UNUSED(_end_col_offset); // Only used by EXTRA macro
  12867. _res = _PyAST_BinOp ( a , BitXor , b , EXTRA );
  12868. if (_res == NULL && PyErr_Occurred()) {
  12869. p->error_indicator = 1;
  12870. p->level--;
  12871. return NULL;
  12872. }
  12873. goto done;
  12874. }
  12875. p->mark = _mark;
  12876. D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
  12877. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and"));
  12878. }
  12879. { // bitwise_and
  12880. if (p->error_indicator) {
  12881. p->level--;
  12882. return NULL;
  12883. }
  12884. D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
  12885. expr_ty bitwise_and_var;
  12886. if (
  12887. (bitwise_and_var = bitwise_and_rule(p)) // bitwise_and
  12888. )
  12889. {
  12890. D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
  12891. _res = bitwise_and_var;
  12892. goto done;
  12893. }
  12894. p->mark = _mark;
  12895. D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
  12896. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and"));
  12897. }
  12898. _res = NULL;
  12899. done:
  12900. p->level--;
  12901. return _res;
  12902. }
  12903. // Left-recursive
  12904. // bitwise_and: bitwise_and '&' shift_expr | shift_expr
  12905. static expr_ty bitwise_and_raw(Parser *);
  12906. static expr_ty
  12907. bitwise_and_rule(Parser *p)
  12908. {
  12909. if (p->level++ == MAXSTACK) {
  12910. _Pypegen_stack_overflow(p);
  12911. }
  12912. expr_ty _res = NULL;
  12913. if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) {
  12914. p->level--;
  12915. return _res;
  12916. }
  12917. int _mark = p->mark;
  12918. int _resmark = p->mark;
  12919. while (1) {
  12920. int tmpvar_4 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res);
  12921. if (tmpvar_4) {
  12922. p->level--;
  12923. return _res;
  12924. }
  12925. p->mark = _mark;
  12926. void *_raw = bitwise_and_raw(p);
  12927. if (p->error_indicator) {
  12928. p->level--;
  12929. return NULL;
  12930. }
  12931. if (_raw == NULL || p->mark <= _resmark)
  12932. break;
  12933. _resmark = p->mark;
  12934. _res = _raw;
  12935. }
  12936. p->mark = _resmark;
  12937. p->level--;
  12938. return _res;
  12939. }
  12940. static expr_ty
  12941. bitwise_and_raw(Parser *p)
  12942. {
  12943. if (p->level++ == MAXSTACK) {
  12944. _Pypegen_stack_overflow(p);
  12945. }
  12946. if (p->error_indicator) {
  12947. p->level--;
  12948. return NULL;
  12949. }
  12950. expr_ty _res = NULL;
  12951. int _mark = p->mark;
  12952. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  12953. p->error_indicator = 1;
  12954. p->level--;
  12955. return NULL;
  12956. }
  12957. int _start_lineno = p->tokens[_mark]->lineno;
  12958. UNUSED(_start_lineno); // Only used by EXTRA macro
  12959. int _start_col_offset = p->tokens[_mark]->col_offset;
  12960. UNUSED(_start_col_offset); // Only used by EXTRA macro
  12961. { // bitwise_and '&' shift_expr
  12962. if (p->error_indicator) {
  12963. p->level--;
  12964. return NULL;
  12965. }
  12966. D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
  12967. Token * _literal;
  12968. expr_ty a;
  12969. expr_ty b;
  12970. if (
  12971. (a = bitwise_and_rule(p)) // bitwise_and
  12972. &&
  12973. (_literal = _PyPegen_expect_token(p, 19)) // token='&'
  12974. &&
  12975. (b = shift_expr_rule(p)) // shift_expr
  12976. )
  12977. {
  12978. D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
  12979. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  12980. if (_token == NULL) {
  12981. p->level--;
  12982. return NULL;
  12983. }
  12984. int _end_lineno = _token->end_lineno;
  12985. UNUSED(_end_lineno); // Only used by EXTRA macro
  12986. int _end_col_offset = _token->end_col_offset;
  12987. UNUSED(_end_col_offset); // Only used by EXTRA macro
  12988. _res = _PyAST_BinOp ( a , BitAnd , b , EXTRA );
  12989. if (_res == NULL && PyErr_Occurred()) {
  12990. p->error_indicator = 1;
  12991. p->level--;
  12992. return NULL;
  12993. }
  12994. goto done;
  12995. }
  12996. p->mark = _mark;
  12997. D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
  12998. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr"));
  12999. }
  13000. { // shift_expr
  13001. if (p->error_indicator) {
  13002. p->level--;
  13003. return NULL;
  13004. }
  13005. D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr"));
  13006. expr_ty shift_expr_var;
  13007. if (
  13008. (shift_expr_var = shift_expr_rule(p)) // shift_expr
  13009. )
  13010. {
  13011. D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr"));
  13012. _res = shift_expr_var;
  13013. goto done;
  13014. }
  13015. p->mark = _mark;
  13016. D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
  13017. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr"));
  13018. }
  13019. _res = NULL;
  13020. done:
  13021. p->level--;
  13022. return _res;
  13023. }
  13024. // Left-recursive
  13025. // shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum
  13026. static expr_ty shift_expr_raw(Parser *);
  13027. static expr_ty
  13028. shift_expr_rule(Parser *p)
  13029. {
  13030. if (p->level++ == MAXSTACK) {
  13031. _Pypegen_stack_overflow(p);
  13032. }
  13033. expr_ty _res = NULL;
  13034. if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) {
  13035. p->level--;
  13036. return _res;
  13037. }
  13038. int _mark = p->mark;
  13039. int _resmark = p->mark;
  13040. while (1) {
  13041. int tmpvar_5 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res);
  13042. if (tmpvar_5) {
  13043. p->level--;
  13044. return _res;
  13045. }
  13046. p->mark = _mark;
  13047. void *_raw = shift_expr_raw(p);
  13048. if (p->error_indicator) {
  13049. p->level--;
  13050. return NULL;
  13051. }
  13052. if (_raw == NULL || p->mark <= _resmark)
  13053. break;
  13054. _resmark = p->mark;
  13055. _res = _raw;
  13056. }
  13057. p->mark = _resmark;
  13058. p->level--;
  13059. return _res;
  13060. }
  13061. static expr_ty
  13062. shift_expr_raw(Parser *p)
  13063. {
  13064. if (p->level++ == MAXSTACK) {
  13065. _Pypegen_stack_overflow(p);
  13066. }
  13067. if (p->error_indicator) {
  13068. p->level--;
  13069. return NULL;
  13070. }
  13071. expr_ty _res = NULL;
  13072. int _mark = p->mark;
  13073. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  13074. p->error_indicator = 1;
  13075. p->level--;
  13076. return NULL;
  13077. }
  13078. int _start_lineno = p->tokens[_mark]->lineno;
  13079. UNUSED(_start_lineno); // Only used by EXTRA macro
  13080. int _start_col_offset = p->tokens[_mark]->col_offset;
  13081. UNUSED(_start_col_offset); // Only used by EXTRA macro
  13082. { // shift_expr '<<' sum
  13083. if (p->error_indicator) {
  13084. p->level--;
  13085. return NULL;
  13086. }
  13087. D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
  13088. Token * _literal;
  13089. expr_ty a;
  13090. expr_ty b;
  13091. if (
  13092. (a = shift_expr_rule(p)) // shift_expr
  13093. &&
  13094. (_literal = _PyPegen_expect_token(p, 33)) // token='<<'
  13095. &&
  13096. (b = sum_rule(p)) // sum
  13097. )
  13098. {
  13099. D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
  13100. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  13101. if (_token == NULL) {
  13102. p->level--;
  13103. return NULL;
  13104. }
  13105. int _end_lineno = _token->end_lineno;
  13106. UNUSED(_end_lineno); // Only used by EXTRA macro
  13107. int _end_col_offset = _token->end_col_offset;
  13108. UNUSED(_end_col_offset); // Only used by EXTRA macro
  13109. _res = _PyAST_BinOp ( a , LShift , b , EXTRA );
  13110. if (_res == NULL && PyErr_Occurred()) {
  13111. p->error_indicator = 1;
  13112. p->level--;
  13113. return NULL;
  13114. }
  13115. goto done;
  13116. }
  13117. p->mark = _mark;
  13118. D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
  13119. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum"));
  13120. }
  13121. { // shift_expr '>>' sum
  13122. if (p->error_indicator) {
  13123. p->level--;
  13124. return NULL;
  13125. }
  13126. D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
  13127. Token * _literal;
  13128. expr_ty a;
  13129. expr_ty b;
  13130. if (
  13131. (a = shift_expr_rule(p)) // shift_expr
  13132. &&
  13133. (_literal = _PyPegen_expect_token(p, 34)) // token='>>'
  13134. &&
  13135. (b = sum_rule(p)) // sum
  13136. )
  13137. {
  13138. D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
  13139. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  13140. if (_token == NULL) {
  13141. p->level--;
  13142. return NULL;
  13143. }
  13144. int _end_lineno = _token->end_lineno;
  13145. UNUSED(_end_lineno); // Only used by EXTRA macro
  13146. int _end_col_offset = _token->end_col_offset;
  13147. UNUSED(_end_col_offset); // Only used by EXTRA macro
  13148. _res = _PyAST_BinOp ( a , RShift , b , EXTRA );
  13149. if (_res == NULL && PyErr_Occurred()) {
  13150. p->error_indicator = 1;
  13151. p->level--;
  13152. return NULL;
  13153. }
  13154. goto done;
  13155. }
  13156. p->mark = _mark;
  13157. D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
  13158. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum"));
  13159. }
  13160. { // sum
  13161. if (p->error_indicator) {
  13162. p->level--;
  13163. return NULL;
  13164. }
  13165. D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum"));
  13166. expr_ty sum_var;
  13167. if (
  13168. (sum_var = sum_rule(p)) // sum
  13169. )
  13170. {
  13171. D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum"));
  13172. _res = sum_var;
  13173. goto done;
  13174. }
  13175. p->mark = _mark;
  13176. D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
  13177. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum"));
  13178. }
  13179. _res = NULL;
  13180. done:
  13181. p->level--;
  13182. return _res;
  13183. }
  13184. // Left-recursive
  13185. // sum: sum '+' term | sum '-' term | term
  13186. static expr_ty sum_raw(Parser *);
  13187. static expr_ty
  13188. sum_rule(Parser *p)
  13189. {
  13190. if (p->level++ == MAXSTACK) {
  13191. _Pypegen_stack_overflow(p);
  13192. }
  13193. expr_ty _res = NULL;
  13194. if (_PyPegen_is_memoized(p, sum_type, &_res)) {
  13195. p->level--;
  13196. return _res;
  13197. }
  13198. int _mark = p->mark;
  13199. int _resmark = p->mark;
  13200. while (1) {
  13201. int tmpvar_6 = _PyPegen_update_memo(p, _mark, sum_type, _res);
  13202. if (tmpvar_6) {
  13203. p->level--;
  13204. return _res;
  13205. }
  13206. p->mark = _mark;
  13207. void *_raw = sum_raw(p);
  13208. if (p->error_indicator) {
  13209. p->level--;
  13210. return NULL;
  13211. }
  13212. if (_raw == NULL || p->mark <= _resmark)
  13213. break;
  13214. _resmark = p->mark;
  13215. _res = _raw;
  13216. }
  13217. p->mark = _resmark;
  13218. p->level--;
  13219. return _res;
  13220. }
  13221. static expr_ty
  13222. sum_raw(Parser *p)
  13223. {
  13224. if (p->level++ == MAXSTACK) {
  13225. _Pypegen_stack_overflow(p);
  13226. }
  13227. if (p->error_indicator) {
  13228. p->level--;
  13229. return NULL;
  13230. }
  13231. expr_ty _res = NULL;
  13232. int _mark = p->mark;
  13233. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  13234. p->error_indicator = 1;
  13235. p->level--;
  13236. return NULL;
  13237. }
  13238. int _start_lineno = p->tokens[_mark]->lineno;
  13239. UNUSED(_start_lineno); // Only used by EXTRA macro
  13240. int _start_col_offset = p->tokens[_mark]->col_offset;
  13241. UNUSED(_start_col_offset); // Only used by EXTRA macro
  13242. { // sum '+' term
  13243. if (p->error_indicator) {
  13244. p->level--;
  13245. return NULL;
  13246. }
  13247. D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
  13248. Token * _literal;
  13249. expr_ty a;
  13250. expr_ty b;
  13251. if (
  13252. (a = sum_rule(p)) // sum
  13253. &&
  13254. (_literal = _PyPegen_expect_token(p, 14)) // token='+'
  13255. &&
  13256. (b = term_rule(p)) // term
  13257. )
  13258. {
  13259. D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
  13260. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  13261. if (_token == NULL) {
  13262. p->level--;
  13263. return NULL;
  13264. }
  13265. int _end_lineno = _token->end_lineno;
  13266. UNUSED(_end_lineno); // Only used by EXTRA macro
  13267. int _end_col_offset = _token->end_col_offset;
  13268. UNUSED(_end_col_offset); // Only used by EXTRA macro
  13269. _res = _PyAST_BinOp ( a , Add , b , EXTRA );
  13270. if (_res == NULL && PyErr_Occurred()) {
  13271. p->error_indicator = 1;
  13272. p->level--;
  13273. return NULL;
  13274. }
  13275. goto done;
  13276. }
  13277. p->mark = _mark;
  13278. D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
  13279. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term"));
  13280. }
  13281. { // sum '-' term
  13282. if (p->error_indicator) {
  13283. p->level--;
  13284. return NULL;
  13285. }
  13286. D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
  13287. Token * _literal;
  13288. expr_ty a;
  13289. expr_ty b;
  13290. if (
  13291. (a = sum_rule(p)) // sum
  13292. &&
  13293. (_literal = _PyPegen_expect_token(p, 15)) // token='-'
  13294. &&
  13295. (b = term_rule(p)) // term
  13296. )
  13297. {
  13298. D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
  13299. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  13300. if (_token == NULL) {
  13301. p->level--;
  13302. return NULL;
  13303. }
  13304. int _end_lineno = _token->end_lineno;
  13305. UNUSED(_end_lineno); // Only used by EXTRA macro
  13306. int _end_col_offset = _token->end_col_offset;
  13307. UNUSED(_end_col_offset); // Only used by EXTRA macro
  13308. _res = _PyAST_BinOp ( a , Sub , b , EXTRA );
  13309. if (_res == NULL && PyErr_Occurred()) {
  13310. p->error_indicator = 1;
  13311. p->level--;
  13312. return NULL;
  13313. }
  13314. goto done;
  13315. }
  13316. p->mark = _mark;
  13317. D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
  13318. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term"));
  13319. }
  13320. { // term
  13321. if (p->error_indicator) {
  13322. p->level--;
  13323. return NULL;
  13324. }
  13325. D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term"));
  13326. expr_ty term_var;
  13327. if (
  13328. (term_var = term_rule(p)) // term
  13329. )
  13330. {
  13331. D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term"));
  13332. _res = term_var;
  13333. goto done;
  13334. }
  13335. p->mark = _mark;
  13336. D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
  13337. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term"));
  13338. }
  13339. _res = NULL;
  13340. done:
  13341. p->level--;
  13342. return _res;
  13343. }
  13344. // Left-recursive
  13345. // term:
  13346. // | term '*' factor
  13347. // | term '/' factor
  13348. // | term '//' factor
  13349. // | term '%' factor
  13350. // | term '@' factor
  13351. // | factor
  13352. static expr_ty term_raw(Parser *);
  13353. static expr_ty
  13354. term_rule(Parser *p)
  13355. {
  13356. if (p->level++ == MAXSTACK) {
  13357. _Pypegen_stack_overflow(p);
  13358. }
  13359. expr_ty _res = NULL;
  13360. if (_PyPegen_is_memoized(p, term_type, &_res)) {
  13361. p->level--;
  13362. return _res;
  13363. }
  13364. int _mark = p->mark;
  13365. int _resmark = p->mark;
  13366. while (1) {
  13367. int tmpvar_7 = _PyPegen_update_memo(p, _mark, term_type, _res);
  13368. if (tmpvar_7) {
  13369. p->level--;
  13370. return _res;
  13371. }
  13372. p->mark = _mark;
  13373. void *_raw = term_raw(p);
  13374. if (p->error_indicator) {
  13375. p->level--;
  13376. return NULL;
  13377. }
  13378. if (_raw == NULL || p->mark <= _resmark)
  13379. break;
  13380. _resmark = p->mark;
  13381. _res = _raw;
  13382. }
  13383. p->mark = _resmark;
  13384. p->level--;
  13385. return _res;
  13386. }
  13387. static expr_ty
  13388. term_raw(Parser *p)
  13389. {
  13390. if (p->level++ == MAXSTACK) {
  13391. _Pypegen_stack_overflow(p);
  13392. }
  13393. if (p->error_indicator) {
  13394. p->level--;
  13395. return NULL;
  13396. }
  13397. expr_ty _res = NULL;
  13398. int _mark = p->mark;
  13399. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  13400. p->error_indicator = 1;
  13401. p->level--;
  13402. return NULL;
  13403. }
  13404. int _start_lineno = p->tokens[_mark]->lineno;
  13405. UNUSED(_start_lineno); // Only used by EXTRA macro
  13406. int _start_col_offset = p->tokens[_mark]->col_offset;
  13407. UNUSED(_start_col_offset); // Only used by EXTRA macro
  13408. { // term '*' factor
  13409. if (p->error_indicator) {
  13410. p->level--;
  13411. return NULL;
  13412. }
  13413. D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
  13414. Token * _literal;
  13415. expr_ty a;
  13416. expr_ty b;
  13417. if (
  13418. (a = term_rule(p)) // term
  13419. &&
  13420. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  13421. &&
  13422. (b = factor_rule(p)) // factor
  13423. )
  13424. {
  13425. D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
  13426. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  13427. if (_token == NULL) {
  13428. p->level--;
  13429. return NULL;
  13430. }
  13431. int _end_lineno = _token->end_lineno;
  13432. UNUSED(_end_lineno); // Only used by EXTRA macro
  13433. int _end_col_offset = _token->end_col_offset;
  13434. UNUSED(_end_col_offset); // Only used by EXTRA macro
  13435. _res = _PyAST_BinOp ( a , Mult , b , EXTRA );
  13436. if (_res == NULL && PyErr_Occurred()) {
  13437. p->error_indicator = 1;
  13438. p->level--;
  13439. return NULL;
  13440. }
  13441. goto done;
  13442. }
  13443. p->mark = _mark;
  13444. D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
  13445. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor"));
  13446. }
  13447. { // term '/' factor
  13448. if (p->error_indicator) {
  13449. p->level--;
  13450. return NULL;
  13451. }
  13452. D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
  13453. Token * _literal;
  13454. expr_ty a;
  13455. expr_ty b;
  13456. if (
  13457. (a = term_rule(p)) // term
  13458. &&
  13459. (_literal = _PyPegen_expect_token(p, 17)) // token='/'
  13460. &&
  13461. (b = factor_rule(p)) // factor
  13462. )
  13463. {
  13464. D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
  13465. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  13466. if (_token == NULL) {
  13467. p->level--;
  13468. return NULL;
  13469. }
  13470. int _end_lineno = _token->end_lineno;
  13471. UNUSED(_end_lineno); // Only used by EXTRA macro
  13472. int _end_col_offset = _token->end_col_offset;
  13473. UNUSED(_end_col_offset); // Only used by EXTRA macro
  13474. _res = _PyAST_BinOp ( a , Div , b , EXTRA );
  13475. if (_res == NULL && PyErr_Occurred()) {
  13476. p->error_indicator = 1;
  13477. p->level--;
  13478. return NULL;
  13479. }
  13480. goto done;
  13481. }
  13482. p->mark = _mark;
  13483. D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
  13484. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor"));
  13485. }
  13486. { // term '//' factor
  13487. if (p->error_indicator) {
  13488. p->level--;
  13489. return NULL;
  13490. }
  13491. D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
  13492. Token * _literal;
  13493. expr_ty a;
  13494. expr_ty b;
  13495. if (
  13496. (a = term_rule(p)) // term
  13497. &&
  13498. (_literal = _PyPegen_expect_token(p, 47)) // token='//'
  13499. &&
  13500. (b = factor_rule(p)) // factor
  13501. )
  13502. {
  13503. D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
  13504. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  13505. if (_token == NULL) {
  13506. p->level--;
  13507. return NULL;
  13508. }
  13509. int _end_lineno = _token->end_lineno;
  13510. UNUSED(_end_lineno); // Only used by EXTRA macro
  13511. int _end_col_offset = _token->end_col_offset;
  13512. UNUSED(_end_col_offset); // Only used by EXTRA macro
  13513. _res = _PyAST_BinOp ( a , FloorDiv , b , EXTRA );
  13514. if (_res == NULL && PyErr_Occurred()) {
  13515. p->error_indicator = 1;
  13516. p->level--;
  13517. return NULL;
  13518. }
  13519. goto done;
  13520. }
  13521. p->mark = _mark;
  13522. D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
  13523. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor"));
  13524. }
  13525. { // term '%' factor
  13526. if (p->error_indicator) {
  13527. p->level--;
  13528. return NULL;
  13529. }
  13530. D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
  13531. Token * _literal;
  13532. expr_ty a;
  13533. expr_ty b;
  13534. if (
  13535. (a = term_rule(p)) // term
  13536. &&
  13537. (_literal = _PyPegen_expect_token(p, 24)) // token='%'
  13538. &&
  13539. (b = factor_rule(p)) // factor
  13540. )
  13541. {
  13542. D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
  13543. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  13544. if (_token == NULL) {
  13545. p->level--;
  13546. return NULL;
  13547. }
  13548. int _end_lineno = _token->end_lineno;
  13549. UNUSED(_end_lineno); // Only used by EXTRA macro
  13550. int _end_col_offset = _token->end_col_offset;
  13551. UNUSED(_end_col_offset); // Only used by EXTRA macro
  13552. _res = _PyAST_BinOp ( a , Mod , b , EXTRA );
  13553. if (_res == NULL && PyErr_Occurred()) {
  13554. p->error_indicator = 1;
  13555. p->level--;
  13556. return NULL;
  13557. }
  13558. goto done;
  13559. }
  13560. p->mark = _mark;
  13561. D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
  13562. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor"));
  13563. }
  13564. { // term '@' factor
  13565. if (p->error_indicator) {
  13566. p->level--;
  13567. return NULL;
  13568. }
  13569. D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
  13570. Token * _literal;
  13571. expr_ty a;
  13572. expr_ty b;
  13573. if (
  13574. (a = term_rule(p)) // term
  13575. &&
  13576. (_literal = _PyPegen_expect_token(p, 49)) // token='@'
  13577. &&
  13578. (b = factor_rule(p)) // factor
  13579. )
  13580. {
  13581. D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
  13582. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  13583. if (_token == NULL) {
  13584. p->level--;
  13585. return NULL;
  13586. }
  13587. int _end_lineno = _token->end_lineno;
  13588. UNUSED(_end_lineno); // Only used by EXTRA macro
  13589. int _end_col_offset = _token->end_col_offset;
  13590. UNUSED(_end_col_offset); // Only used by EXTRA macro
  13591. _res = CHECK_VERSION ( expr_ty , 5 , "The '@' operator is" , _PyAST_BinOp ( a , MatMult , b , EXTRA ) );
  13592. if (_res == NULL && PyErr_Occurred()) {
  13593. p->error_indicator = 1;
  13594. p->level--;
  13595. return NULL;
  13596. }
  13597. goto done;
  13598. }
  13599. p->mark = _mark;
  13600. D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
  13601. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor"));
  13602. }
  13603. { // factor
  13604. if (p->error_indicator) {
  13605. p->level--;
  13606. return NULL;
  13607. }
  13608. D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor"));
  13609. expr_ty factor_var;
  13610. if (
  13611. (factor_var = factor_rule(p)) // factor
  13612. )
  13613. {
  13614. D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor"));
  13615. _res = factor_var;
  13616. goto done;
  13617. }
  13618. p->mark = _mark;
  13619. D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
  13620. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor"));
  13621. }
  13622. _res = NULL;
  13623. done:
  13624. p->level--;
  13625. return _res;
  13626. }
  13627. // factor: '+' factor | '-' factor | '~' factor | power
  13628. static expr_ty
  13629. factor_rule(Parser *p)
  13630. {
  13631. if (p->level++ == MAXSTACK) {
  13632. _Pypegen_stack_overflow(p);
  13633. }
  13634. if (p->error_indicator) {
  13635. p->level--;
  13636. return NULL;
  13637. }
  13638. expr_ty _res = NULL;
  13639. if (_PyPegen_is_memoized(p, factor_type, &_res)) {
  13640. p->level--;
  13641. return _res;
  13642. }
  13643. int _mark = p->mark;
  13644. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  13645. p->error_indicator = 1;
  13646. p->level--;
  13647. return NULL;
  13648. }
  13649. int _start_lineno = p->tokens[_mark]->lineno;
  13650. UNUSED(_start_lineno); // Only used by EXTRA macro
  13651. int _start_col_offset = p->tokens[_mark]->col_offset;
  13652. UNUSED(_start_col_offset); // Only used by EXTRA macro
  13653. { // '+' factor
  13654. if (p->error_indicator) {
  13655. p->level--;
  13656. return NULL;
  13657. }
  13658. D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor"));
  13659. Token * _literal;
  13660. expr_ty a;
  13661. if (
  13662. (_literal = _PyPegen_expect_token(p, 14)) // token='+'
  13663. &&
  13664. (a = factor_rule(p)) // factor
  13665. )
  13666. {
  13667. D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor"));
  13668. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  13669. if (_token == NULL) {
  13670. p->level--;
  13671. return NULL;
  13672. }
  13673. int _end_lineno = _token->end_lineno;
  13674. UNUSED(_end_lineno); // Only used by EXTRA macro
  13675. int _end_col_offset = _token->end_col_offset;
  13676. UNUSED(_end_col_offset); // Only used by EXTRA macro
  13677. _res = _PyAST_UnaryOp ( UAdd , a , EXTRA );
  13678. if (_res == NULL && PyErr_Occurred()) {
  13679. p->error_indicator = 1;
  13680. p->level--;
  13681. return NULL;
  13682. }
  13683. goto done;
  13684. }
  13685. p->mark = _mark;
  13686. D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
  13687. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor"));
  13688. }
  13689. { // '-' factor
  13690. if (p->error_indicator) {
  13691. p->level--;
  13692. return NULL;
  13693. }
  13694. D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor"));
  13695. Token * _literal;
  13696. expr_ty a;
  13697. if (
  13698. (_literal = _PyPegen_expect_token(p, 15)) // token='-'
  13699. &&
  13700. (a = factor_rule(p)) // factor
  13701. )
  13702. {
  13703. D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor"));
  13704. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  13705. if (_token == NULL) {
  13706. p->level--;
  13707. return NULL;
  13708. }
  13709. int _end_lineno = _token->end_lineno;
  13710. UNUSED(_end_lineno); // Only used by EXTRA macro
  13711. int _end_col_offset = _token->end_col_offset;
  13712. UNUSED(_end_col_offset); // Only used by EXTRA macro
  13713. _res = _PyAST_UnaryOp ( USub , a , EXTRA );
  13714. if (_res == NULL && PyErr_Occurred()) {
  13715. p->error_indicator = 1;
  13716. p->level--;
  13717. return NULL;
  13718. }
  13719. goto done;
  13720. }
  13721. p->mark = _mark;
  13722. D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
  13723. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor"));
  13724. }
  13725. { // '~' factor
  13726. if (p->error_indicator) {
  13727. p->level--;
  13728. return NULL;
  13729. }
  13730. D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor"));
  13731. Token * _literal;
  13732. expr_ty a;
  13733. if (
  13734. (_literal = _PyPegen_expect_token(p, 31)) // token='~'
  13735. &&
  13736. (a = factor_rule(p)) // factor
  13737. )
  13738. {
  13739. D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor"));
  13740. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  13741. if (_token == NULL) {
  13742. p->level--;
  13743. return NULL;
  13744. }
  13745. int _end_lineno = _token->end_lineno;
  13746. UNUSED(_end_lineno); // Only used by EXTRA macro
  13747. int _end_col_offset = _token->end_col_offset;
  13748. UNUSED(_end_col_offset); // Only used by EXTRA macro
  13749. _res = _PyAST_UnaryOp ( Invert , a , EXTRA );
  13750. if (_res == NULL && PyErr_Occurred()) {
  13751. p->error_indicator = 1;
  13752. p->level--;
  13753. return NULL;
  13754. }
  13755. goto done;
  13756. }
  13757. p->mark = _mark;
  13758. D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
  13759. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor"));
  13760. }
  13761. { // power
  13762. if (p->error_indicator) {
  13763. p->level--;
  13764. return NULL;
  13765. }
  13766. D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power"));
  13767. expr_ty power_var;
  13768. if (
  13769. (power_var = power_rule(p)) // power
  13770. )
  13771. {
  13772. D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power"));
  13773. _res = power_var;
  13774. goto done;
  13775. }
  13776. p->mark = _mark;
  13777. D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
  13778. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power"));
  13779. }
  13780. _res = NULL;
  13781. done:
  13782. _PyPegen_insert_memo(p, _mark, factor_type, _res);
  13783. p->level--;
  13784. return _res;
  13785. }
  13786. // power: await_primary '**' factor | await_primary
  13787. static expr_ty
  13788. power_rule(Parser *p)
  13789. {
  13790. if (p->level++ == MAXSTACK) {
  13791. _Pypegen_stack_overflow(p);
  13792. }
  13793. if (p->error_indicator) {
  13794. p->level--;
  13795. return NULL;
  13796. }
  13797. expr_ty _res = NULL;
  13798. int _mark = p->mark;
  13799. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  13800. p->error_indicator = 1;
  13801. p->level--;
  13802. return NULL;
  13803. }
  13804. int _start_lineno = p->tokens[_mark]->lineno;
  13805. UNUSED(_start_lineno); // Only used by EXTRA macro
  13806. int _start_col_offset = p->tokens[_mark]->col_offset;
  13807. UNUSED(_start_col_offset); // Only used by EXTRA macro
  13808. { // await_primary '**' factor
  13809. if (p->error_indicator) {
  13810. p->level--;
  13811. return NULL;
  13812. }
  13813. D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
  13814. Token * _literal;
  13815. expr_ty a;
  13816. expr_ty b;
  13817. if (
  13818. (a = await_primary_rule(p)) // await_primary
  13819. &&
  13820. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  13821. &&
  13822. (b = factor_rule(p)) // factor
  13823. )
  13824. {
  13825. D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
  13826. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  13827. if (_token == NULL) {
  13828. p->level--;
  13829. return NULL;
  13830. }
  13831. int _end_lineno = _token->end_lineno;
  13832. UNUSED(_end_lineno); // Only used by EXTRA macro
  13833. int _end_col_offset = _token->end_col_offset;
  13834. UNUSED(_end_col_offset); // Only used by EXTRA macro
  13835. _res = _PyAST_BinOp ( a , Pow , b , EXTRA );
  13836. if (_res == NULL && PyErr_Occurred()) {
  13837. p->error_indicator = 1;
  13838. p->level--;
  13839. return NULL;
  13840. }
  13841. goto done;
  13842. }
  13843. p->mark = _mark;
  13844. D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
  13845. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor"));
  13846. }
  13847. { // await_primary
  13848. if (p->error_indicator) {
  13849. p->level--;
  13850. return NULL;
  13851. }
  13852. D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary"));
  13853. expr_ty await_primary_var;
  13854. if (
  13855. (await_primary_var = await_primary_rule(p)) // await_primary
  13856. )
  13857. {
  13858. D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary"));
  13859. _res = await_primary_var;
  13860. goto done;
  13861. }
  13862. p->mark = _mark;
  13863. D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
  13864. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary"));
  13865. }
  13866. _res = NULL;
  13867. done:
  13868. p->level--;
  13869. return _res;
  13870. }
  13871. // await_primary: AWAIT primary | primary
  13872. static expr_ty
  13873. await_primary_rule(Parser *p)
  13874. {
  13875. if (p->level++ == MAXSTACK) {
  13876. _Pypegen_stack_overflow(p);
  13877. }
  13878. if (p->error_indicator) {
  13879. p->level--;
  13880. return NULL;
  13881. }
  13882. expr_ty _res = NULL;
  13883. if (_PyPegen_is_memoized(p, await_primary_type, &_res)) {
  13884. p->level--;
  13885. return _res;
  13886. }
  13887. int _mark = p->mark;
  13888. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  13889. p->error_indicator = 1;
  13890. p->level--;
  13891. return NULL;
  13892. }
  13893. int _start_lineno = p->tokens[_mark]->lineno;
  13894. UNUSED(_start_lineno); // Only used by EXTRA macro
  13895. int _start_col_offset = p->tokens[_mark]->col_offset;
  13896. UNUSED(_start_col_offset); // Only used by EXTRA macro
  13897. { // AWAIT primary
  13898. if (p->error_indicator) {
  13899. p->level--;
  13900. return NULL;
  13901. }
  13902. D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
  13903. expr_ty a;
  13904. Token * await_var;
  13905. if (
  13906. (await_var = _PyPegen_expect_token(p, AWAIT)) // token='AWAIT'
  13907. &&
  13908. (a = primary_rule(p)) // primary
  13909. )
  13910. {
  13911. D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
  13912. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  13913. if (_token == NULL) {
  13914. p->level--;
  13915. return NULL;
  13916. }
  13917. int _end_lineno = _token->end_lineno;
  13918. UNUSED(_end_lineno); // Only used by EXTRA macro
  13919. int _end_col_offset = _token->end_col_offset;
  13920. UNUSED(_end_col_offset); // Only used by EXTRA macro
  13921. _res = CHECK_VERSION ( expr_ty , 5 , "Await expressions are" , _PyAST_Await ( a , EXTRA ) );
  13922. if (_res == NULL && PyErr_Occurred()) {
  13923. p->error_indicator = 1;
  13924. p->level--;
  13925. return NULL;
  13926. }
  13927. goto done;
  13928. }
  13929. p->mark = _mark;
  13930. D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
  13931. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "AWAIT primary"));
  13932. }
  13933. { // primary
  13934. if (p->error_indicator) {
  13935. p->level--;
  13936. return NULL;
  13937. }
  13938. D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary"));
  13939. expr_ty primary_var;
  13940. if (
  13941. (primary_var = primary_rule(p)) // primary
  13942. )
  13943. {
  13944. D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary"));
  13945. _res = primary_var;
  13946. goto done;
  13947. }
  13948. p->mark = _mark;
  13949. D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
  13950. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary"));
  13951. }
  13952. _res = NULL;
  13953. done:
  13954. _PyPegen_insert_memo(p, _mark, await_primary_type, _res);
  13955. p->level--;
  13956. return _res;
  13957. }
  13958. // Left-recursive
  13959. // primary:
  13960. // | primary '.' NAME
  13961. // | primary genexp
  13962. // | primary '(' arguments? ')'
  13963. // | primary '[' slices ']'
  13964. // | atom
  13965. static expr_ty primary_raw(Parser *);
  13966. static expr_ty
  13967. primary_rule(Parser *p)
  13968. {
  13969. if (p->level++ == MAXSTACK) {
  13970. _Pypegen_stack_overflow(p);
  13971. }
  13972. expr_ty _res = NULL;
  13973. if (_PyPegen_is_memoized(p, primary_type, &_res)) {
  13974. p->level--;
  13975. return _res;
  13976. }
  13977. int _mark = p->mark;
  13978. int _resmark = p->mark;
  13979. while (1) {
  13980. int tmpvar_8 = _PyPegen_update_memo(p, _mark, primary_type, _res);
  13981. if (tmpvar_8) {
  13982. p->level--;
  13983. return _res;
  13984. }
  13985. p->mark = _mark;
  13986. void *_raw = primary_raw(p);
  13987. if (p->error_indicator) {
  13988. p->level--;
  13989. return NULL;
  13990. }
  13991. if (_raw == NULL || p->mark <= _resmark)
  13992. break;
  13993. _resmark = p->mark;
  13994. _res = _raw;
  13995. }
  13996. p->mark = _resmark;
  13997. p->level--;
  13998. return _res;
  13999. }
  14000. static expr_ty
  14001. primary_raw(Parser *p)
  14002. {
  14003. if (p->level++ == MAXSTACK) {
  14004. _Pypegen_stack_overflow(p);
  14005. }
  14006. if (p->error_indicator) {
  14007. p->level--;
  14008. return NULL;
  14009. }
  14010. expr_ty _res = NULL;
  14011. int _mark = p->mark;
  14012. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  14013. p->error_indicator = 1;
  14014. p->level--;
  14015. return NULL;
  14016. }
  14017. int _start_lineno = p->tokens[_mark]->lineno;
  14018. UNUSED(_start_lineno); // Only used by EXTRA macro
  14019. int _start_col_offset = p->tokens[_mark]->col_offset;
  14020. UNUSED(_start_col_offset); // Only used by EXTRA macro
  14021. { // primary '.' NAME
  14022. if (p->error_indicator) {
  14023. p->level--;
  14024. return NULL;
  14025. }
  14026. D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
  14027. Token * _literal;
  14028. expr_ty a;
  14029. expr_ty b;
  14030. if (
  14031. (a = primary_rule(p)) // primary
  14032. &&
  14033. (_literal = _PyPegen_expect_token(p, 23)) // token='.'
  14034. &&
  14035. (b = _PyPegen_name_token(p)) // NAME
  14036. )
  14037. {
  14038. D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
  14039. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  14040. if (_token == NULL) {
  14041. p->level--;
  14042. return NULL;
  14043. }
  14044. int _end_lineno = _token->end_lineno;
  14045. UNUSED(_end_lineno); // Only used by EXTRA macro
  14046. int _end_col_offset = _token->end_col_offset;
  14047. UNUSED(_end_col_offset); // Only used by EXTRA macro
  14048. _res = _PyAST_Attribute ( a , b -> v . Name . id , Load , EXTRA );
  14049. if (_res == NULL && PyErr_Occurred()) {
  14050. p->error_indicator = 1;
  14051. p->level--;
  14052. return NULL;
  14053. }
  14054. goto done;
  14055. }
  14056. p->mark = _mark;
  14057. D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
  14058. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME"));
  14059. }
  14060. { // primary genexp
  14061. if (p->error_indicator) {
  14062. p->level--;
  14063. return NULL;
  14064. }
  14065. D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp"));
  14066. expr_ty a;
  14067. expr_ty b;
  14068. if (
  14069. (a = primary_rule(p)) // primary
  14070. &&
  14071. (b = genexp_rule(p)) // genexp
  14072. )
  14073. {
  14074. D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp"));
  14075. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  14076. if (_token == NULL) {
  14077. p->level--;
  14078. return NULL;
  14079. }
  14080. int _end_lineno = _token->end_lineno;
  14081. UNUSED(_end_lineno); // Only used by EXTRA macro
  14082. int _end_col_offset = _token->end_col_offset;
  14083. UNUSED(_end_col_offset); // Only used by EXTRA macro
  14084. _res = _PyAST_Call ( a , CHECK ( asdl_expr_seq* , ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
  14085. if (_res == NULL && PyErr_Occurred()) {
  14086. p->error_indicator = 1;
  14087. p->level--;
  14088. return NULL;
  14089. }
  14090. goto done;
  14091. }
  14092. p->mark = _mark;
  14093. D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
  14094. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp"));
  14095. }
  14096. { // primary '(' arguments? ')'
  14097. if (p->error_indicator) {
  14098. p->level--;
  14099. return NULL;
  14100. }
  14101. D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
  14102. Token * _literal;
  14103. Token * _literal_1;
  14104. expr_ty a;
  14105. void *b;
  14106. if (
  14107. (a = primary_rule(p)) // primary
  14108. &&
  14109. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  14110. &&
  14111. (b = arguments_rule(p), !p->error_indicator) // arguments?
  14112. &&
  14113. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  14114. )
  14115. {
  14116. D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
  14117. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  14118. if (_token == NULL) {
  14119. p->level--;
  14120. return NULL;
  14121. }
  14122. int _end_lineno = _token->end_lineno;
  14123. UNUSED(_end_lineno); // Only used by EXTRA macro
  14124. int _end_col_offset = _token->end_col_offset;
  14125. UNUSED(_end_col_offset); // Only used by EXTRA macro
  14126. _res = _PyAST_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
  14127. if (_res == NULL && PyErr_Occurred()) {
  14128. p->error_indicator = 1;
  14129. p->level--;
  14130. return NULL;
  14131. }
  14132. goto done;
  14133. }
  14134. p->mark = _mark;
  14135. D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
  14136. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'"));
  14137. }
  14138. { // primary '[' slices ']'
  14139. if (p->error_indicator) {
  14140. p->level--;
  14141. return NULL;
  14142. }
  14143. D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
  14144. Token * _literal;
  14145. Token * _literal_1;
  14146. expr_ty a;
  14147. expr_ty b;
  14148. if (
  14149. (a = primary_rule(p)) // primary
  14150. &&
  14151. (_literal = _PyPegen_expect_token(p, 9)) // token='['
  14152. &&
  14153. (b = slices_rule(p)) // slices
  14154. &&
  14155. (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
  14156. )
  14157. {
  14158. D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
  14159. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  14160. if (_token == NULL) {
  14161. p->level--;
  14162. return NULL;
  14163. }
  14164. int _end_lineno = _token->end_lineno;
  14165. UNUSED(_end_lineno); // Only used by EXTRA macro
  14166. int _end_col_offset = _token->end_col_offset;
  14167. UNUSED(_end_col_offset); // Only used by EXTRA macro
  14168. _res = _PyAST_Subscript ( a , b , Load , EXTRA );
  14169. if (_res == NULL && PyErr_Occurred()) {
  14170. p->error_indicator = 1;
  14171. p->level--;
  14172. return NULL;
  14173. }
  14174. goto done;
  14175. }
  14176. p->mark = _mark;
  14177. D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
  14178. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'"));
  14179. }
  14180. { // atom
  14181. if (p->error_indicator) {
  14182. p->level--;
  14183. return NULL;
  14184. }
  14185. D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom"));
  14186. expr_ty atom_var;
  14187. if (
  14188. (atom_var = atom_rule(p)) // atom
  14189. )
  14190. {
  14191. D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom"));
  14192. _res = atom_var;
  14193. goto done;
  14194. }
  14195. p->mark = _mark;
  14196. D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
  14197. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom"));
  14198. }
  14199. _res = NULL;
  14200. done:
  14201. p->level--;
  14202. return _res;
  14203. }
  14204. // slices: slice !',' | ','.(slice | starred_expression)+ ','?
  14205. static expr_ty
  14206. slices_rule(Parser *p)
  14207. {
  14208. if (p->level++ == MAXSTACK) {
  14209. _Pypegen_stack_overflow(p);
  14210. }
  14211. if (p->error_indicator) {
  14212. p->level--;
  14213. return NULL;
  14214. }
  14215. expr_ty _res = NULL;
  14216. int _mark = p->mark;
  14217. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  14218. p->error_indicator = 1;
  14219. p->level--;
  14220. return NULL;
  14221. }
  14222. int _start_lineno = p->tokens[_mark]->lineno;
  14223. UNUSED(_start_lineno); // Only used by EXTRA macro
  14224. int _start_col_offset = p->tokens[_mark]->col_offset;
  14225. UNUSED(_start_col_offset); // Only used by EXTRA macro
  14226. { // slice !','
  14227. if (p->error_indicator) {
  14228. p->level--;
  14229. return NULL;
  14230. }
  14231. D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','"));
  14232. expr_ty a;
  14233. if (
  14234. (a = slice_rule(p)) // slice
  14235. &&
  14236. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
  14237. )
  14238. {
  14239. D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','"));
  14240. _res = a;
  14241. if (_res == NULL && PyErr_Occurred()) {
  14242. p->error_indicator = 1;
  14243. p->level--;
  14244. return NULL;
  14245. }
  14246. goto done;
  14247. }
  14248. p->mark = _mark;
  14249. D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
  14250. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','"));
  14251. }
  14252. { // ','.(slice | starred_expression)+ ','?
  14253. if (p->error_indicator) {
  14254. p->level--;
  14255. return NULL;
  14256. }
  14257. D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(slice | starred_expression)+ ','?"));
  14258. void *_opt_var;
  14259. UNUSED(_opt_var); // Silence compiler warnings
  14260. asdl_expr_seq* a;
  14261. if (
  14262. (a = (asdl_expr_seq*)_gather_90_rule(p)) // ','.(slice | starred_expression)+
  14263. &&
  14264. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  14265. )
  14266. {
  14267. D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(slice | starred_expression)+ ','?"));
  14268. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  14269. if (_token == NULL) {
  14270. p->level--;
  14271. return NULL;
  14272. }
  14273. int _end_lineno = _token->end_lineno;
  14274. UNUSED(_end_lineno); // Only used by EXTRA macro
  14275. int _end_col_offset = _token->end_col_offset;
  14276. UNUSED(_end_col_offset); // Only used by EXTRA macro
  14277. _res = _PyAST_Tuple ( a , Load , EXTRA );
  14278. if (_res == NULL && PyErr_Occurred()) {
  14279. p->error_indicator = 1;
  14280. p->level--;
  14281. return NULL;
  14282. }
  14283. goto done;
  14284. }
  14285. p->mark = _mark;
  14286. D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
  14287. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(slice | starred_expression)+ ','?"));
  14288. }
  14289. _res = NULL;
  14290. done:
  14291. p->level--;
  14292. return _res;
  14293. }
  14294. // slice: expression? ':' expression? [':' expression?] | named_expression
  14295. static expr_ty
  14296. slice_rule(Parser *p)
  14297. {
  14298. if (p->level++ == MAXSTACK) {
  14299. _Pypegen_stack_overflow(p);
  14300. }
  14301. if (p->error_indicator) {
  14302. p->level--;
  14303. return NULL;
  14304. }
  14305. expr_ty _res = NULL;
  14306. int _mark = p->mark;
  14307. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  14308. p->error_indicator = 1;
  14309. p->level--;
  14310. return NULL;
  14311. }
  14312. int _start_lineno = p->tokens[_mark]->lineno;
  14313. UNUSED(_start_lineno); // Only used by EXTRA macro
  14314. int _start_col_offset = p->tokens[_mark]->col_offset;
  14315. UNUSED(_start_col_offset); // Only used by EXTRA macro
  14316. { // expression? ':' expression? [':' expression?]
  14317. if (p->error_indicator) {
  14318. p->level--;
  14319. return NULL;
  14320. }
  14321. D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
  14322. Token * _literal;
  14323. void *a;
  14324. void *b;
  14325. void *c;
  14326. if (
  14327. (a = expression_rule(p), !p->error_indicator) // expression?
  14328. &&
  14329. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  14330. &&
  14331. (b = expression_rule(p), !p->error_indicator) // expression?
  14332. &&
  14333. (c = _tmp_92_rule(p), !p->error_indicator) // [':' expression?]
  14334. )
  14335. {
  14336. D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
  14337. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  14338. if (_token == NULL) {
  14339. p->level--;
  14340. return NULL;
  14341. }
  14342. int _end_lineno = _token->end_lineno;
  14343. UNUSED(_end_lineno); // Only used by EXTRA macro
  14344. int _end_col_offset = _token->end_col_offset;
  14345. UNUSED(_end_col_offset); // Only used by EXTRA macro
  14346. _res = _PyAST_Slice ( a , b , c , EXTRA );
  14347. if (_res == NULL && PyErr_Occurred()) {
  14348. p->error_indicator = 1;
  14349. p->level--;
  14350. return NULL;
  14351. }
  14352. goto done;
  14353. }
  14354. p->mark = _mark;
  14355. D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
  14356. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]"));
  14357. }
  14358. { // named_expression
  14359. if (p->error_indicator) {
  14360. p->level--;
  14361. return NULL;
  14362. }
  14363. D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
  14364. expr_ty a;
  14365. if (
  14366. (a = named_expression_rule(p)) // named_expression
  14367. )
  14368. {
  14369. D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
  14370. _res = a;
  14371. if (_res == NULL && PyErr_Occurred()) {
  14372. p->error_indicator = 1;
  14373. p->level--;
  14374. return NULL;
  14375. }
  14376. goto done;
  14377. }
  14378. p->mark = _mark;
  14379. D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
  14380. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
  14381. }
  14382. _res = NULL;
  14383. done:
  14384. p->level--;
  14385. return _res;
  14386. }
  14387. // atom:
  14388. // | NAME
  14389. // | 'True'
  14390. // | 'False'
  14391. // | 'None'
  14392. // | &(STRING | FSTRING_START) strings
  14393. // | NUMBER
  14394. // | &'(' (tuple | group | genexp)
  14395. // | &'[' (list | listcomp)
  14396. // | &'{' (dict | set | dictcomp | setcomp)
  14397. // | '...'
  14398. static expr_ty
  14399. atom_rule(Parser *p)
  14400. {
  14401. if (p->level++ == MAXSTACK) {
  14402. _Pypegen_stack_overflow(p);
  14403. }
  14404. if (p->error_indicator) {
  14405. p->level--;
  14406. return NULL;
  14407. }
  14408. expr_ty _res = NULL;
  14409. int _mark = p->mark;
  14410. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  14411. p->error_indicator = 1;
  14412. p->level--;
  14413. return NULL;
  14414. }
  14415. int _start_lineno = p->tokens[_mark]->lineno;
  14416. UNUSED(_start_lineno); // Only used by EXTRA macro
  14417. int _start_col_offset = p->tokens[_mark]->col_offset;
  14418. UNUSED(_start_col_offset); // Only used by EXTRA macro
  14419. { // NAME
  14420. if (p->error_indicator) {
  14421. p->level--;
  14422. return NULL;
  14423. }
  14424. D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
  14425. expr_ty name_var;
  14426. if (
  14427. (name_var = _PyPegen_name_token(p)) // NAME
  14428. )
  14429. {
  14430. D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
  14431. _res = name_var;
  14432. goto done;
  14433. }
  14434. p->mark = _mark;
  14435. D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
  14436. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
  14437. }
  14438. { // 'True'
  14439. if (p->error_indicator) {
  14440. p->level--;
  14441. return NULL;
  14442. }
  14443. D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
  14444. Token * _keyword;
  14445. if (
  14446. (_keyword = _PyPegen_expect_token(p, 601)) // token='True'
  14447. )
  14448. {
  14449. D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
  14450. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  14451. if (_token == NULL) {
  14452. p->level--;
  14453. return NULL;
  14454. }
  14455. int _end_lineno = _token->end_lineno;
  14456. UNUSED(_end_lineno); // Only used by EXTRA macro
  14457. int _end_col_offset = _token->end_col_offset;
  14458. UNUSED(_end_col_offset); // Only used by EXTRA macro
  14459. _res = _PyAST_Constant ( Py_True , NULL , EXTRA );
  14460. if (_res == NULL && PyErr_Occurred()) {
  14461. p->error_indicator = 1;
  14462. p->level--;
  14463. return NULL;
  14464. }
  14465. goto done;
  14466. }
  14467. p->mark = _mark;
  14468. D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
  14469. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
  14470. }
  14471. { // 'False'
  14472. if (p->error_indicator) {
  14473. p->level--;
  14474. return NULL;
  14475. }
  14476. D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
  14477. Token * _keyword;
  14478. if (
  14479. (_keyword = _PyPegen_expect_token(p, 603)) // token='False'
  14480. )
  14481. {
  14482. D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
  14483. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  14484. if (_token == NULL) {
  14485. p->level--;
  14486. return NULL;
  14487. }
  14488. int _end_lineno = _token->end_lineno;
  14489. UNUSED(_end_lineno); // Only used by EXTRA macro
  14490. int _end_col_offset = _token->end_col_offset;
  14491. UNUSED(_end_col_offset); // Only used by EXTRA macro
  14492. _res = _PyAST_Constant ( Py_False , NULL , EXTRA );
  14493. if (_res == NULL && PyErr_Occurred()) {
  14494. p->error_indicator = 1;
  14495. p->level--;
  14496. return NULL;
  14497. }
  14498. goto done;
  14499. }
  14500. p->mark = _mark;
  14501. D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
  14502. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
  14503. }
  14504. { // 'None'
  14505. if (p->error_indicator) {
  14506. p->level--;
  14507. return NULL;
  14508. }
  14509. D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
  14510. Token * _keyword;
  14511. if (
  14512. (_keyword = _PyPegen_expect_token(p, 602)) // token='None'
  14513. )
  14514. {
  14515. D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
  14516. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  14517. if (_token == NULL) {
  14518. p->level--;
  14519. return NULL;
  14520. }
  14521. int _end_lineno = _token->end_lineno;
  14522. UNUSED(_end_lineno); // Only used by EXTRA macro
  14523. int _end_col_offset = _token->end_col_offset;
  14524. UNUSED(_end_col_offset); // Only used by EXTRA macro
  14525. _res = _PyAST_Constant ( Py_None , NULL , EXTRA );
  14526. if (_res == NULL && PyErr_Occurred()) {
  14527. p->error_indicator = 1;
  14528. p->level--;
  14529. return NULL;
  14530. }
  14531. goto done;
  14532. }
  14533. p->mark = _mark;
  14534. D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
  14535. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
  14536. }
  14537. { // &(STRING | FSTRING_START) strings
  14538. if (p->error_indicator) {
  14539. p->level--;
  14540. return NULL;
  14541. }
  14542. D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&(STRING | FSTRING_START) strings"));
  14543. expr_ty strings_var;
  14544. if (
  14545. _PyPegen_lookahead(1, _tmp_93_rule, p)
  14546. &&
  14547. (strings_var = strings_rule(p)) // strings
  14548. )
  14549. {
  14550. D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&(STRING | FSTRING_START) strings"));
  14551. _res = strings_var;
  14552. goto done;
  14553. }
  14554. p->mark = _mark;
  14555. D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
  14556. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&(STRING | FSTRING_START) strings"));
  14557. }
  14558. { // NUMBER
  14559. if (p->error_indicator) {
  14560. p->level--;
  14561. return NULL;
  14562. }
  14563. D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
  14564. expr_ty number_var;
  14565. if (
  14566. (number_var = _PyPegen_number_token(p)) // NUMBER
  14567. )
  14568. {
  14569. D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
  14570. _res = number_var;
  14571. goto done;
  14572. }
  14573. p->mark = _mark;
  14574. D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
  14575. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
  14576. }
  14577. { // &'(' (tuple | group | genexp)
  14578. if (p->error_indicator) {
  14579. p->level--;
  14580. return NULL;
  14581. }
  14582. D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
  14583. void *_tmp_94_var;
  14584. if (
  14585. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='('
  14586. &&
  14587. (_tmp_94_var = _tmp_94_rule(p)) // tuple | group | genexp
  14588. )
  14589. {
  14590. D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
  14591. _res = _tmp_94_var;
  14592. goto done;
  14593. }
  14594. p->mark = _mark;
  14595. D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
  14596. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)"));
  14597. }
  14598. { // &'[' (list | listcomp)
  14599. if (p->error_indicator) {
  14600. p->level--;
  14601. return NULL;
  14602. }
  14603. D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
  14604. void *_tmp_95_var;
  14605. if (
  14606. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='['
  14607. &&
  14608. (_tmp_95_var = _tmp_95_rule(p)) // list | listcomp
  14609. )
  14610. {
  14611. D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
  14612. _res = _tmp_95_var;
  14613. goto done;
  14614. }
  14615. p->mark = _mark;
  14616. D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
  14617. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)"));
  14618. }
  14619. { // &'{' (dict | set | dictcomp | setcomp)
  14620. if (p->error_indicator) {
  14621. p->level--;
  14622. return NULL;
  14623. }
  14624. D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
  14625. void *_tmp_96_var;
  14626. if (
  14627. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{'
  14628. &&
  14629. (_tmp_96_var = _tmp_96_rule(p)) // dict | set | dictcomp | setcomp
  14630. )
  14631. {
  14632. D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
  14633. _res = _tmp_96_var;
  14634. goto done;
  14635. }
  14636. p->mark = _mark;
  14637. D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
  14638. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
  14639. }
  14640. { // '...'
  14641. if (p->error_indicator) {
  14642. p->level--;
  14643. return NULL;
  14644. }
  14645. D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
  14646. Token * _literal;
  14647. if (
  14648. (_literal = _PyPegen_expect_token(p, 52)) // token='...'
  14649. )
  14650. {
  14651. D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
  14652. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  14653. if (_token == NULL) {
  14654. p->level--;
  14655. return NULL;
  14656. }
  14657. int _end_lineno = _token->end_lineno;
  14658. UNUSED(_end_lineno); // Only used by EXTRA macro
  14659. int _end_col_offset = _token->end_col_offset;
  14660. UNUSED(_end_col_offset); // Only used by EXTRA macro
  14661. _res = _PyAST_Constant ( Py_Ellipsis , NULL , EXTRA );
  14662. if (_res == NULL && PyErr_Occurred()) {
  14663. p->error_indicator = 1;
  14664. p->level--;
  14665. return NULL;
  14666. }
  14667. goto done;
  14668. }
  14669. p->mark = _mark;
  14670. D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
  14671. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
  14672. }
  14673. _res = NULL;
  14674. done:
  14675. p->level--;
  14676. return _res;
  14677. }
  14678. // group: '(' (yield_expr | named_expression) ')' | invalid_group
  14679. static expr_ty
  14680. group_rule(Parser *p)
  14681. {
  14682. if (p->level++ == MAXSTACK) {
  14683. _Pypegen_stack_overflow(p);
  14684. }
  14685. if (p->error_indicator) {
  14686. p->level--;
  14687. return NULL;
  14688. }
  14689. expr_ty _res = NULL;
  14690. int _mark = p->mark;
  14691. { // '(' (yield_expr | named_expression) ')'
  14692. if (p->error_indicator) {
  14693. p->level--;
  14694. return NULL;
  14695. }
  14696. D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
  14697. Token * _literal;
  14698. Token * _literal_1;
  14699. void *a;
  14700. if (
  14701. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  14702. &&
  14703. (a = _tmp_97_rule(p)) // yield_expr | named_expression
  14704. &&
  14705. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  14706. )
  14707. {
  14708. D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
  14709. _res = a;
  14710. if (_res == NULL && PyErr_Occurred()) {
  14711. p->error_indicator = 1;
  14712. p->level--;
  14713. return NULL;
  14714. }
  14715. goto done;
  14716. }
  14717. p->mark = _mark;
  14718. D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
  14719. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
  14720. }
  14721. if (p->call_invalid_rules) { // invalid_group
  14722. if (p->error_indicator) {
  14723. p->level--;
  14724. return NULL;
  14725. }
  14726. D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_group"));
  14727. void *invalid_group_var;
  14728. if (
  14729. (invalid_group_var = invalid_group_rule(p)) // invalid_group
  14730. )
  14731. {
  14732. D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_group"));
  14733. _res = invalid_group_var;
  14734. goto done;
  14735. }
  14736. p->mark = _mark;
  14737. D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
  14738. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_group"));
  14739. }
  14740. _res = NULL;
  14741. done:
  14742. p->level--;
  14743. return _res;
  14744. }
  14745. // lambdef: 'lambda' lambda_params? ':' expression
  14746. static expr_ty
  14747. lambdef_rule(Parser *p)
  14748. {
  14749. if (p->level++ == MAXSTACK) {
  14750. _Pypegen_stack_overflow(p);
  14751. }
  14752. if (p->error_indicator) {
  14753. p->level--;
  14754. return NULL;
  14755. }
  14756. expr_ty _res = NULL;
  14757. int _mark = p->mark;
  14758. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  14759. p->error_indicator = 1;
  14760. p->level--;
  14761. return NULL;
  14762. }
  14763. int _start_lineno = p->tokens[_mark]->lineno;
  14764. UNUSED(_start_lineno); // Only used by EXTRA macro
  14765. int _start_col_offset = p->tokens[_mark]->col_offset;
  14766. UNUSED(_start_col_offset); // Only used by EXTRA macro
  14767. { // 'lambda' lambda_params? ':' expression
  14768. if (p->error_indicator) {
  14769. p->level--;
  14770. return NULL;
  14771. }
  14772. D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
  14773. Token * _keyword;
  14774. Token * _literal;
  14775. void *a;
  14776. expr_ty b;
  14777. if (
  14778. (_keyword = _PyPegen_expect_token(p, 600)) // token='lambda'
  14779. &&
  14780. (a = lambda_params_rule(p), !p->error_indicator) // lambda_params?
  14781. &&
  14782. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  14783. &&
  14784. (b = expression_rule(p)) // expression
  14785. )
  14786. {
  14787. D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
  14788. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  14789. if (_token == NULL) {
  14790. p->level--;
  14791. return NULL;
  14792. }
  14793. int _end_lineno = _token->end_lineno;
  14794. UNUSED(_end_lineno); // Only used by EXTRA macro
  14795. int _end_col_offset = _token->end_col_offset;
  14796. UNUSED(_end_col_offset); // Only used by EXTRA macro
  14797. _res = _PyAST_Lambda ( ( a ) ? a : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
  14798. if (_res == NULL && PyErr_Occurred()) {
  14799. p->error_indicator = 1;
  14800. p->level--;
  14801. return NULL;
  14802. }
  14803. goto done;
  14804. }
  14805. p->mark = _mark;
  14806. D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ',
  14807. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression"));
  14808. }
  14809. _res = NULL;
  14810. done:
  14811. p->level--;
  14812. return _res;
  14813. }
  14814. // lambda_params: invalid_lambda_parameters | lambda_parameters
  14815. static arguments_ty
  14816. lambda_params_rule(Parser *p)
  14817. {
  14818. if (p->level++ == MAXSTACK) {
  14819. _Pypegen_stack_overflow(p);
  14820. }
  14821. if (p->error_indicator) {
  14822. p->level--;
  14823. return NULL;
  14824. }
  14825. arguments_ty _res = NULL;
  14826. int _mark = p->mark;
  14827. if (p->call_invalid_rules) { // invalid_lambda_parameters
  14828. if (p->error_indicator) {
  14829. p->level--;
  14830. return NULL;
  14831. }
  14832. D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
  14833. void *invalid_lambda_parameters_var;
  14834. if (
  14835. (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p)) // invalid_lambda_parameters
  14836. )
  14837. {
  14838. D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
  14839. _res = invalid_lambda_parameters_var;
  14840. goto done;
  14841. }
  14842. p->mark = _mark;
  14843. D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
  14844. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_parameters"));
  14845. }
  14846. { // lambda_parameters
  14847. if (p->error_indicator) {
  14848. p->level--;
  14849. return NULL;
  14850. }
  14851. D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
  14852. arguments_ty lambda_parameters_var;
  14853. if (
  14854. (lambda_parameters_var = lambda_parameters_rule(p)) // lambda_parameters
  14855. )
  14856. {
  14857. D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
  14858. _res = lambda_parameters_var;
  14859. goto done;
  14860. }
  14861. p->mark = _mark;
  14862. D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
  14863. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters"));
  14864. }
  14865. _res = NULL;
  14866. done:
  14867. p->level--;
  14868. return _res;
  14869. }
  14870. // lambda_parameters:
  14871. // | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
  14872. // | lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
  14873. // | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
  14874. // | lambda_param_with_default+ lambda_star_etc?
  14875. // | lambda_star_etc
  14876. static arguments_ty
  14877. lambda_parameters_rule(Parser *p)
  14878. {
  14879. if (p->level++ == MAXSTACK) {
  14880. _Pypegen_stack_overflow(p);
  14881. }
  14882. if (p->error_indicator) {
  14883. p->level--;
  14884. return NULL;
  14885. }
  14886. arguments_ty _res = NULL;
  14887. int _mark = p->mark;
  14888. { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
  14889. if (p->error_indicator) {
  14890. p->level--;
  14891. return NULL;
  14892. }
  14893. D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
  14894. asdl_arg_seq* a;
  14895. asdl_arg_seq* b;
  14896. asdl_seq * c;
  14897. void *d;
  14898. if (
  14899. (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default
  14900. &&
  14901. (b = (asdl_arg_seq*)_loop0_98_rule(p)) // lambda_param_no_default*
  14902. &&
  14903. (c = _loop0_99_rule(p)) // lambda_param_with_default*
  14904. &&
  14905. (d = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc?
  14906. )
  14907. {
  14908. D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
  14909. _res = CHECK_VERSION ( arguments_ty , 8 , "Positional-only parameters are" , _PyPegen_make_arguments ( p , a , NULL , b , c , d ) );
  14910. if (_res == NULL && PyErr_Occurred()) {
  14911. p->error_indicator = 1;
  14912. p->level--;
  14913. return NULL;
  14914. }
  14915. goto done;
  14916. }
  14917. p->mark = _mark;
  14918. D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
  14919. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
  14920. }
  14921. { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
  14922. if (p->error_indicator) {
  14923. p->level--;
  14924. return NULL;
  14925. }
  14926. D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
  14927. SlashWithDefault* a;
  14928. asdl_seq * b;
  14929. void *c;
  14930. if (
  14931. (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
  14932. &&
  14933. (b = _loop0_100_rule(p)) // lambda_param_with_default*
  14934. &&
  14935. (c = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc?
  14936. )
  14937. {
  14938. D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
  14939. _res = CHECK_VERSION ( arguments_ty , 8 , "Positional-only parameters are" , _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ) );
  14940. if (_res == NULL && PyErr_Occurred()) {
  14941. p->error_indicator = 1;
  14942. p->level--;
  14943. return NULL;
  14944. }
  14945. goto done;
  14946. }
  14947. p->mark = _mark;
  14948. D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
  14949. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
  14950. }
  14951. { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
  14952. if (p->error_indicator) {
  14953. p->level--;
  14954. return NULL;
  14955. }
  14956. D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
  14957. asdl_arg_seq* a;
  14958. asdl_seq * b;
  14959. void *c;
  14960. if (
  14961. (a = (asdl_arg_seq*)_loop1_101_rule(p)) // lambda_param_no_default+
  14962. &&
  14963. (b = _loop0_102_rule(p)) // lambda_param_with_default*
  14964. &&
  14965. (c = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc?
  14966. )
  14967. {
  14968. D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
  14969. _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
  14970. if (_res == NULL && PyErr_Occurred()) {
  14971. p->error_indicator = 1;
  14972. p->level--;
  14973. return NULL;
  14974. }
  14975. goto done;
  14976. }
  14977. p->mark = _mark;
  14978. D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
  14979. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
  14980. }
  14981. { // lambda_param_with_default+ lambda_star_etc?
  14982. if (p->error_indicator) {
  14983. p->level--;
  14984. return NULL;
  14985. }
  14986. D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
  14987. asdl_seq * a;
  14988. void *b;
  14989. if (
  14990. (a = _loop1_103_rule(p)) // lambda_param_with_default+
  14991. &&
  14992. (b = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc?
  14993. )
  14994. {
  14995. D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
  14996. _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
  14997. if (_res == NULL && PyErr_Occurred()) {
  14998. p->error_indicator = 1;
  14999. p->level--;
  15000. return NULL;
  15001. }
  15002. goto done;
  15003. }
  15004. p->mark = _mark;
  15005. D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
  15006. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
  15007. }
  15008. { // lambda_star_etc
  15009. if (p->error_indicator) {
  15010. p->level--;
  15011. return NULL;
  15012. }
  15013. D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
  15014. StarEtc* a;
  15015. if (
  15016. (a = lambda_star_etc_rule(p)) // lambda_star_etc
  15017. )
  15018. {
  15019. D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
  15020. _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
  15021. if (_res == NULL && PyErr_Occurred()) {
  15022. p->error_indicator = 1;
  15023. p->level--;
  15024. return NULL;
  15025. }
  15026. goto done;
  15027. }
  15028. p->mark = _mark;
  15029. D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
  15030. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc"));
  15031. }
  15032. _res = NULL;
  15033. done:
  15034. p->level--;
  15035. return _res;
  15036. }
  15037. // lambda_slash_no_default:
  15038. // | lambda_param_no_default+ '/' ','
  15039. // | lambda_param_no_default+ '/' &':'
  15040. static asdl_arg_seq*
  15041. lambda_slash_no_default_rule(Parser *p)
  15042. {
  15043. if (p->level++ == MAXSTACK) {
  15044. _Pypegen_stack_overflow(p);
  15045. }
  15046. if (p->error_indicator) {
  15047. p->level--;
  15048. return NULL;
  15049. }
  15050. asdl_arg_seq* _res = NULL;
  15051. int _mark = p->mark;
  15052. { // lambda_param_no_default+ '/' ','
  15053. if (p->error_indicator) {
  15054. p->level--;
  15055. return NULL;
  15056. }
  15057. D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
  15058. Token * _literal;
  15059. Token * _literal_1;
  15060. asdl_arg_seq* a;
  15061. if (
  15062. (a = (asdl_arg_seq*)_loop1_104_rule(p)) // lambda_param_no_default+
  15063. &&
  15064. (_literal = _PyPegen_expect_token(p, 17)) // token='/'
  15065. &&
  15066. (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
  15067. )
  15068. {
  15069. D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
  15070. _res = a;
  15071. if (_res == NULL && PyErr_Occurred()) {
  15072. p->error_indicator = 1;
  15073. p->level--;
  15074. return NULL;
  15075. }
  15076. goto done;
  15077. }
  15078. p->mark = _mark;
  15079. D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
  15080. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','"));
  15081. }
  15082. { // lambda_param_no_default+ '/' &':'
  15083. if (p->error_indicator) {
  15084. p->level--;
  15085. return NULL;
  15086. }
  15087. D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
  15088. Token * _literal;
  15089. asdl_arg_seq* a;
  15090. if (
  15091. (a = (asdl_arg_seq*)_loop1_105_rule(p)) // lambda_param_no_default+
  15092. &&
  15093. (_literal = _PyPegen_expect_token(p, 17)) // token='/'
  15094. &&
  15095. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
  15096. )
  15097. {
  15098. D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
  15099. _res = a;
  15100. if (_res == NULL && PyErr_Occurred()) {
  15101. p->error_indicator = 1;
  15102. p->level--;
  15103. return NULL;
  15104. }
  15105. goto done;
  15106. }
  15107. p->mark = _mark;
  15108. D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
  15109. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
  15110. }
  15111. _res = NULL;
  15112. done:
  15113. p->level--;
  15114. return _res;
  15115. }
  15116. // lambda_slash_with_default:
  15117. // | lambda_param_no_default* lambda_param_with_default+ '/' ','
  15118. // | lambda_param_no_default* lambda_param_with_default+ '/' &':'
  15119. static SlashWithDefault*
  15120. lambda_slash_with_default_rule(Parser *p)
  15121. {
  15122. if (p->level++ == MAXSTACK) {
  15123. _Pypegen_stack_overflow(p);
  15124. }
  15125. if (p->error_indicator) {
  15126. p->level--;
  15127. return NULL;
  15128. }
  15129. SlashWithDefault* _res = NULL;
  15130. int _mark = p->mark;
  15131. { // lambda_param_no_default* lambda_param_with_default+ '/' ','
  15132. if (p->error_indicator) {
  15133. p->level--;
  15134. return NULL;
  15135. }
  15136. D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
  15137. Token * _literal;
  15138. Token * _literal_1;
  15139. asdl_seq * a;
  15140. asdl_seq * b;
  15141. if (
  15142. (a = _loop0_106_rule(p)) // lambda_param_no_default*
  15143. &&
  15144. (b = _loop1_107_rule(p)) // lambda_param_with_default+
  15145. &&
  15146. (_literal = _PyPegen_expect_token(p, 17)) // token='/'
  15147. &&
  15148. (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
  15149. )
  15150. {
  15151. D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
  15152. _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq* ) a , b );
  15153. if (_res == NULL && PyErr_Occurred()) {
  15154. p->error_indicator = 1;
  15155. p->level--;
  15156. return NULL;
  15157. }
  15158. goto done;
  15159. }
  15160. p->mark = _mark;
  15161. D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
  15162. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
  15163. }
  15164. { // lambda_param_no_default* lambda_param_with_default+ '/' &':'
  15165. if (p->error_indicator) {
  15166. p->level--;
  15167. return NULL;
  15168. }
  15169. D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
  15170. Token * _literal;
  15171. asdl_seq * a;
  15172. asdl_seq * b;
  15173. if (
  15174. (a = _loop0_108_rule(p)) // lambda_param_no_default*
  15175. &&
  15176. (b = _loop1_109_rule(p)) // lambda_param_with_default+
  15177. &&
  15178. (_literal = _PyPegen_expect_token(p, 17)) // token='/'
  15179. &&
  15180. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
  15181. )
  15182. {
  15183. D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
  15184. _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq* ) a , b );
  15185. if (_res == NULL && PyErr_Occurred()) {
  15186. p->error_indicator = 1;
  15187. p->level--;
  15188. return NULL;
  15189. }
  15190. goto done;
  15191. }
  15192. p->mark = _mark;
  15193. D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
  15194. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
  15195. }
  15196. _res = NULL;
  15197. done:
  15198. p->level--;
  15199. return _res;
  15200. }
  15201. // lambda_star_etc:
  15202. // | invalid_lambda_star_etc
  15203. // | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
  15204. // | '*' ',' lambda_param_maybe_default+ lambda_kwds?
  15205. // | lambda_kwds
  15206. static StarEtc*
  15207. lambda_star_etc_rule(Parser *p)
  15208. {
  15209. if (p->level++ == MAXSTACK) {
  15210. _Pypegen_stack_overflow(p);
  15211. }
  15212. if (p->error_indicator) {
  15213. p->level--;
  15214. return NULL;
  15215. }
  15216. StarEtc* _res = NULL;
  15217. int _mark = p->mark;
  15218. if (p->call_invalid_rules) { // invalid_lambda_star_etc
  15219. if (p->error_indicator) {
  15220. p->level--;
  15221. return NULL;
  15222. }
  15223. D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
  15224. void *invalid_lambda_star_etc_var;
  15225. if (
  15226. (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc
  15227. )
  15228. {
  15229. D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
  15230. _res = invalid_lambda_star_etc_var;
  15231. goto done;
  15232. }
  15233. p->mark = _mark;
  15234. D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
  15235. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc"));
  15236. }
  15237. { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
  15238. if (p->error_indicator) {
  15239. p->level--;
  15240. return NULL;
  15241. }
  15242. D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
  15243. Token * _literal;
  15244. arg_ty a;
  15245. asdl_seq * b;
  15246. void *c;
  15247. if (
  15248. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  15249. &&
  15250. (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
  15251. &&
  15252. (b = _loop0_110_rule(p)) // lambda_param_maybe_default*
  15253. &&
  15254. (c = lambda_kwds_rule(p), !p->error_indicator) // lambda_kwds?
  15255. )
  15256. {
  15257. D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
  15258. _res = _PyPegen_star_etc ( p , a , b , c );
  15259. if (_res == NULL && PyErr_Occurred()) {
  15260. p->error_indicator = 1;
  15261. p->level--;
  15262. return NULL;
  15263. }
  15264. goto done;
  15265. }
  15266. p->mark = _mark;
  15267. D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
  15268. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
  15269. }
  15270. { // '*' ',' lambda_param_maybe_default+ lambda_kwds?
  15271. if (p->error_indicator) {
  15272. p->level--;
  15273. return NULL;
  15274. }
  15275. D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
  15276. Token * _literal;
  15277. Token * _literal_1;
  15278. asdl_seq * b;
  15279. void *c;
  15280. if (
  15281. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  15282. &&
  15283. (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
  15284. &&
  15285. (b = _loop1_111_rule(p)) // lambda_param_maybe_default+
  15286. &&
  15287. (c = lambda_kwds_rule(p), !p->error_indicator) // lambda_kwds?
  15288. )
  15289. {
  15290. D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
  15291. _res = _PyPegen_star_etc ( p , NULL , b , c );
  15292. if (_res == NULL && PyErr_Occurred()) {
  15293. p->error_indicator = 1;
  15294. p->level--;
  15295. return NULL;
  15296. }
  15297. goto done;
  15298. }
  15299. p->mark = _mark;
  15300. D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
  15301. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
  15302. }
  15303. { // lambda_kwds
  15304. if (p->error_indicator) {
  15305. p->level--;
  15306. return NULL;
  15307. }
  15308. D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
  15309. arg_ty a;
  15310. if (
  15311. (a = lambda_kwds_rule(p)) // lambda_kwds
  15312. )
  15313. {
  15314. D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
  15315. _res = _PyPegen_star_etc ( p , NULL , NULL , a );
  15316. if (_res == NULL && PyErr_Occurred()) {
  15317. p->error_indicator = 1;
  15318. p->level--;
  15319. return NULL;
  15320. }
  15321. goto done;
  15322. }
  15323. p->mark = _mark;
  15324. D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
  15325. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds"));
  15326. }
  15327. _res = NULL;
  15328. done:
  15329. p->level--;
  15330. return _res;
  15331. }
  15332. // lambda_kwds: invalid_lambda_kwds | '**' lambda_param_no_default
  15333. static arg_ty
  15334. lambda_kwds_rule(Parser *p)
  15335. {
  15336. if (p->level++ == MAXSTACK) {
  15337. _Pypegen_stack_overflow(p);
  15338. }
  15339. if (p->error_indicator) {
  15340. p->level--;
  15341. return NULL;
  15342. }
  15343. arg_ty _res = NULL;
  15344. int _mark = p->mark;
  15345. if (p->call_invalid_rules) { // invalid_lambda_kwds
  15346. if (p->error_indicator) {
  15347. p->level--;
  15348. return NULL;
  15349. }
  15350. D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_kwds"));
  15351. void *invalid_lambda_kwds_var;
  15352. if (
  15353. (invalid_lambda_kwds_var = invalid_lambda_kwds_rule(p)) // invalid_lambda_kwds
  15354. )
  15355. {
  15356. D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_kwds"));
  15357. _res = invalid_lambda_kwds_var;
  15358. goto done;
  15359. }
  15360. p->mark = _mark;
  15361. D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
  15362. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_kwds"));
  15363. }
  15364. { // '**' lambda_param_no_default
  15365. if (p->error_indicator) {
  15366. p->level--;
  15367. return NULL;
  15368. }
  15369. D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
  15370. Token * _literal;
  15371. arg_ty a;
  15372. if (
  15373. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  15374. &&
  15375. (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
  15376. )
  15377. {
  15378. D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
  15379. _res = a;
  15380. if (_res == NULL && PyErr_Occurred()) {
  15381. p->error_indicator = 1;
  15382. p->level--;
  15383. return NULL;
  15384. }
  15385. goto done;
  15386. }
  15387. p->mark = _mark;
  15388. D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
  15389. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default"));
  15390. }
  15391. _res = NULL;
  15392. done:
  15393. p->level--;
  15394. return _res;
  15395. }
  15396. // lambda_param_no_default: lambda_param ',' | lambda_param &':'
  15397. static arg_ty
  15398. lambda_param_no_default_rule(Parser *p)
  15399. {
  15400. if (p->level++ == MAXSTACK) {
  15401. _Pypegen_stack_overflow(p);
  15402. }
  15403. if (p->error_indicator) {
  15404. p->level--;
  15405. return NULL;
  15406. }
  15407. arg_ty _res = NULL;
  15408. int _mark = p->mark;
  15409. { // lambda_param ','
  15410. if (p->error_indicator) {
  15411. p->level--;
  15412. return NULL;
  15413. }
  15414. D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
  15415. Token * _literal;
  15416. arg_ty a;
  15417. if (
  15418. (a = lambda_param_rule(p)) // lambda_param
  15419. &&
  15420. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  15421. )
  15422. {
  15423. D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
  15424. _res = a;
  15425. if (_res == NULL && PyErr_Occurred()) {
  15426. p->error_indicator = 1;
  15427. p->level--;
  15428. return NULL;
  15429. }
  15430. goto done;
  15431. }
  15432. p->mark = _mark;
  15433. D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
  15434. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','"));
  15435. }
  15436. { // lambda_param &':'
  15437. if (p->error_indicator) {
  15438. p->level--;
  15439. return NULL;
  15440. }
  15441. D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
  15442. arg_ty a;
  15443. if (
  15444. (a = lambda_param_rule(p)) // lambda_param
  15445. &&
  15446. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
  15447. )
  15448. {
  15449. D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
  15450. _res = a;
  15451. if (_res == NULL && PyErr_Occurred()) {
  15452. p->error_indicator = 1;
  15453. p->level--;
  15454. return NULL;
  15455. }
  15456. goto done;
  15457. }
  15458. p->mark = _mark;
  15459. D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
  15460. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'"));
  15461. }
  15462. _res = NULL;
  15463. done:
  15464. p->level--;
  15465. return _res;
  15466. }
  15467. // lambda_param_with_default: lambda_param default ',' | lambda_param default &':'
  15468. static NameDefaultPair*
  15469. lambda_param_with_default_rule(Parser *p)
  15470. {
  15471. if (p->level++ == MAXSTACK) {
  15472. _Pypegen_stack_overflow(p);
  15473. }
  15474. if (p->error_indicator) {
  15475. p->level--;
  15476. return NULL;
  15477. }
  15478. NameDefaultPair* _res = NULL;
  15479. int _mark = p->mark;
  15480. { // lambda_param default ','
  15481. if (p->error_indicator) {
  15482. p->level--;
  15483. return NULL;
  15484. }
  15485. D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
  15486. Token * _literal;
  15487. arg_ty a;
  15488. expr_ty c;
  15489. if (
  15490. (a = lambda_param_rule(p)) // lambda_param
  15491. &&
  15492. (c = default_rule(p)) // default
  15493. &&
  15494. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  15495. )
  15496. {
  15497. D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
  15498. _res = _PyPegen_name_default_pair ( p , a , c , NULL );
  15499. if (_res == NULL && PyErr_Occurred()) {
  15500. p->error_indicator = 1;
  15501. p->level--;
  15502. return NULL;
  15503. }
  15504. goto done;
  15505. }
  15506. p->mark = _mark;
  15507. D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
  15508. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','"));
  15509. }
  15510. { // lambda_param default &':'
  15511. if (p->error_indicator) {
  15512. p->level--;
  15513. return NULL;
  15514. }
  15515. D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
  15516. arg_ty a;
  15517. expr_ty c;
  15518. if (
  15519. (a = lambda_param_rule(p)) // lambda_param
  15520. &&
  15521. (c = default_rule(p)) // default
  15522. &&
  15523. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
  15524. )
  15525. {
  15526. D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
  15527. _res = _PyPegen_name_default_pair ( p , a , c , NULL );
  15528. if (_res == NULL && PyErr_Occurred()) {
  15529. p->error_indicator = 1;
  15530. p->level--;
  15531. return NULL;
  15532. }
  15533. goto done;
  15534. }
  15535. p->mark = _mark;
  15536. D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
  15537. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'"));
  15538. }
  15539. _res = NULL;
  15540. done:
  15541. p->level--;
  15542. return _res;
  15543. }
  15544. // lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':'
  15545. static NameDefaultPair*
  15546. lambda_param_maybe_default_rule(Parser *p)
  15547. {
  15548. if (p->level++ == MAXSTACK) {
  15549. _Pypegen_stack_overflow(p);
  15550. }
  15551. if (p->error_indicator) {
  15552. p->level--;
  15553. return NULL;
  15554. }
  15555. NameDefaultPair* _res = NULL;
  15556. int _mark = p->mark;
  15557. { // lambda_param default? ','
  15558. if (p->error_indicator) {
  15559. p->level--;
  15560. return NULL;
  15561. }
  15562. D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
  15563. Token * _literal;
  15564. arg_ty a;
  15565. void *c;
  15566. if (
  15567. (a = lambda_param_rule(p)) // lambda_param
  15568. &&
  15569. (c = default_rule(p), !p->error_indicator) // default?
  15570. &&
  15571. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  15572. )
  15573. {
  15574. D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
  15575. _res = _PyPegen_name_default_pair ( p , a , c , NULL );
  15576. if (_res == NULL && PyErr_Occurred()) {
  15577. p->error_indicator = 1;
  15578. p->level--;
  15579. return NULL;
  15580. }
  15581. goto done;
  15582. }
  15583. p->mark = _mark;
  15584. D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
  15585. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','"));
  15586. }
  15587. { // lambda_param default? &':'
  15588. if (p->error_indicator) {
  15589. p->level--;
  15590. return NULL;
  15591. }
  15592. D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
  15593. arg_ty a;
  15594. void *c;
  15595. if (
  15596. (a = lambda_param_rule(p)) // lambda_param
  15597. &&
  15598. (c = default_rule(p), !p->error_indicator) // default?
  15599. &&
  15600. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
  15601. )
  15602. {
  15603. D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
  15604. _res = _PyPegen_name_default_pair ( p , a , c , NULL );
  15605. if (_res == NULL && PyErr_Occurred()) {
  15606. p->error_indicator = 1;
  15607. p->level--;
  15608. return NULL;
  15609. }
  15610. goto done;
  15611. }
  15612. p->mark = _mark;
  15613. D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
  15614. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'"));
  15615. }
  15616. _res = NULL;
  15617. done:
  15618. p->level--;
  15619. return _res;
  15620. }
  15621. // lambda_param: NAME
  15622. static arg_ty
  15623. lambda_param_rule(Parser *p)
  15624. {
  15625. if (p->level++ == MAXSTACK) {
  15626. _Pypegen_stack_overflow(p);
  15627. }
  15628. if (p->error_indicator) {
  15629. p->level--;
  15630. return NULL;
  15631. }
  15632. arg_ty _res = NULL;
  15633. int _mark = p->mark;
  15634. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  15635. p->error_indicator = 1;
  15636. p->level--;
  15637. return NULL;
  15638. }
  15639. int _start_lineno = p->tokens[_mark]->lineno;
  15640. UNUSED(_start_lineno); // Only used by EXTRA macro
  15641. int _start_col_offset = p->tokens[_mark]->col_offset;
  15642. UNUSED(_start_col_offset); // Only used by EXTRA macro
  15643. { // NAME
  15644. if (p->error_indicator) {
  15645. p->level--;
  15646. return NULL;
  15647. }
  15648. D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
  15649. expr_ty a;
  15650. if (
  15651. (a = _PyPegen_name_token(p)) // NAME
  15652. )
  15653. {
  15654. D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
  15655. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  15656. if (_token == NULL) {
  15657. p->level--;
  15658. return NULL;
  15659. }
  15660. int _end_lineno = _token->end_lineno;
  15661. UNUSED(_end_lineno); // Only used by EXTRA macro
  15662. int _end_col_offset = _token->end_col_offset;
  15663. UNUSED(_end_col_offset); // Only used by EXTRA macro
  15664. _res = _PyAST_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
  15665. if (_res == NULL && PyErr_Occurred()) {
  15666. p->error_indicator = 1;
  15667. p->level--;
  15668. return NULL;
  15669. }
  15670. goto done;
  15671. }
  15672. p->mark = _mark;
  15673. D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ',
  15674. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
  15675. }
  15676. _res = NULL;
  15677. done:
  15678. p->level--;
  15679. return _res;
  15680. }
  15681. // fstring_middle: fstring_replacement_field | FSTRING_MIDDLE
  15682. static expr_ty
  15683. fstring_middle_rule(Parser *p)
  15684. {
  15685. if (p->level++ == MAXSTACK) {
  15686. _Pypegen_stack_overflow(p);
  15687. }
  15688. if (p->error_indicator) {
  15689. p->level--;
  15690. return NULL;
  15691. }
  15692. expr_ty _res = NULL;
  15693. int _mark = p->mark;
  15694. { // fstring_replacement_field
  15695. if (p->error_indicator) {
  15696. p->level--;
  15697. return NULL;
  15698. }
  15699. D(fprintf(stderr, "%*c> fstring_middle[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "fstring_replacement_field"));
  15700. expr_ty fstring_replacement_field_var;
  15701. if (
  15702. (fstring_replacement_field_var = fstring_replacement_field_rule(p)) // fstring_replacement_field
  15703. )
  15704. {
  15705. D(fprintf(stderr, "%*c+ fstring_middle[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "fstring_replacement_field"));
  15706. _res = fstring_replacement_field_var;
  15707. goto done;
  15708. }
  15709. p->mark = _mark;
  15710. D(fprintf(stderr, "%*c%s fstring_middle[%d-%d]: %s failed!\n", p->level, ' ',
  15711. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "fstring_replacement_field"));
  15712. }
  15713. { // FSTRING_MIDDLE
  15714. if (p->error_indicator) {
  15715. p->level--;
  15716. return NULL;
  15717. }
  15718. D(fprintf(stderr, "%*c> fstring_middle[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "FSTRING_MIDDLE"));
  15719. Token * t;
  15720. if (
  15721. (t = _PyPegen_expect_token(p, FSTRING_MIDDLE)) // token='FSTRING_MIDDLE'
  15722. )
  15723. {
  15724. D(fprintf(stderr, "%*c+ fstring_middle[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "FSTRING_MIDDLE"));
  15725. _res = _PyPegen_constant_from_token ( p , t );
  15726. if (_res == NULL && PyErr_Occurred()) {
  15727. p->error_indicator = 1;
  15728. p->level--;
  15729. return NULL;
  15730. }
  15731. goto done;
  15732. }
  15733. p->mark = _mark;
  15734. D(fprintf(stderr, "%*c%s fstring_middle[%d-%d]: %s failed!\n", p->level, ' ',
  15735. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "FSTRING_MIDDLE"));
  15736. }
  15737. _res = NULL;
  15738. done:
  15739. p->level--;
  15740. return _res;
  15741. }
  15742. // fstring_replacement_field:
  15743. // | '{' (yield_expr | star_expressions) '='? fstring_conversion? fstring_full_format_spec? '}'
  15744. // | invalid_replacement_field
  15745. static expr_ty
  15746. fstring_replacement_field_rule(Parser *p)
  15747. {
  15748. if (p->level++ == MAXSTACK) {
  15749. _Pypegen_stack_overflow(p);
  15750. }
  15751. if (p->error_indicator) {
  15752. p->level--;
  15753. return NULL;
  15754. }
  15755. expr_ty _res = NULL;
  15756. int _mark = p->mark;
  15757. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  15758. p->error_indicator = 1;
  15759. p->level--;
  15760. return NULL;
  15761. }
  15762. int _start_lineno = p->tokens[_mark]->lineno;
  15763. UNUSED(_start_lineno); // Only used by EXTRA macro
  15764. int _start_col_offset = p->tokens[_mark]->col_offset;
  15765. UNUSED(_start_col_offset); // Only used by EXTRA macro
  15766. { // '{' (yield_expr | star_expressions) '='? fstring_conversion? fstring_full_format_spec? '}'
  15767. if (p->error_indicator) {
  15768. p->level--;
  15769. return NULL;
  15770. }
  15771. D(fprintf(stderr, "%*c> fstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' (yield_expr | star_expressions) '='? fstring_conversion? fstring_full_format_spec? '}'"));
  15772. Token * _literal;
  15773. void *a;
  15774. void *conversion;
  15775. void *debug_expr;
  15776. void *format;
  15777. Token * rbrace;
  15778. if (
  15779. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  15780. &&
  15781. (a = _tmp_112_rule(p)) // yield_expr | star_expressions
  15782. &&
  15783. (debug_expr = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='?
  15784. &&
  15785. (conversion = fstring_conversion_rule(p), !p->error_indicator) // fstring_conversion?
  15786. &&
  15787. (format = fstring_full_format_spec_rule(p), !p->error_indicator) // fstring_full_format_spec?
  15788. &&
  15789. (rbrace = _PyPegen_expect_token(p, 26)) // token='}'
  15790. )
  15791. {
  15792. D(fprintf(stderr, "%*c+ fstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' (yield_expr | star_expressions) '='? fstring_conversion? fstring_full_format_spec? '}'"));
  15793. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  15794. if (_token == NULL) {
  15795. p->level--;
  15796. return NULL;
  15797. }
  15798. int _end_lineno = _token->end_lineno;
  15799. UNUSED(_end_lineno); // Only used by EXTRA macro
  15800. int _end_col_offset = _token->end_col_offset;
  15801. UNUSED(_end_col_offset); // Only used by EXTRA macro
  15802. _res = _PyPegen_formatted_value ( p , a , debug_expr , conversion , format , rbrace , EXTRA );
  15803. if (_res == NULL && PyErr_Occurred()) {
  15804. p->error_indicator = 1;
  15805. p->level--;
  15806. return NULL;
  15807. }
  15808. goto done;
  15809. }
  15810. p->mark = _mark;
  15811. D(fprintf(stderr, "%*c%s fstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
  15812. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' (yield_expr | star_expressions) '='? fstring_conversion? fstring_full_format_spec? '}'"));
  15813. }
  15814. if (p->call_invalid_rules) { // invalid_replacement_field
  15815. if (p->error_indicator) {
  15816. p->level--;
  15817. return NULL;
  15818. }
  15819. D(fprintf(stderr, "%*c> fstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_replacement_field"));
  15820. void *invalid_replacement_field_var;
  15821. if (
  15822. (invalid_replacement_field_var = invalid_replacement_field_rule(p)) // invalid_replacement_field
  15823. )
  15824. {
  15825. D(fprintf(stderr, "%*c+ fstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_replacement_field"));
  15826. _res = invalid_replacement_field_var;
  15827. goto done;
  15828. }
  15829. p->mark = _mark;
  15830. D(fprintf(stderr, "%*c%s fstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
  15831. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_replacement_field"));
  15832. }
  15833. _res = NULL;
  15834. done:
  15835. p->level--;
  15836. return _res;
  15837. }
  15838. // fstring_conversion: "!" NAME
  15839. static ResultTokenWithMetadata*
  15840. fstring_conversion_rule(Parser *p)
  15841. {
  15842. if (p->level++ == MAXSTACK) {
  15843. _Pypegen_stack_overflow(p);
  15844. }
  15845. if (p->error_indicator) {
  15846. p->level--;
  15847. return NULL;
  15848. }
  15849. ResultTokenWithMetadata* _res = NULL;
  15850. int _mark = p->mark;
  15851. { // "!" NAME
  15852. if (p->error_indicator) {
  15853. p->level--;
  15854. return NULL;
  15855. }
  15856. D(fprintf(stderr, "%*c> fstring_conversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"!\" NAME"));
  15857. expr_ty conv;
  15858. Token * conv_token;
  15859. if (
  15860. (conv_token = _PyPegen_expect_token(p, 54)) // token='!'
  15861. &&
  15862. (conv = _PyPegen_name_token(p)) // NAME
  15863. )
  15864. {
  15865. D(fprintf(stderr, "%*c+ fstring_conversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"!\" NAME"));
  15866. _res = _PyPegen_check_fstring_conversion ( p , conv_token , conv );
  15867. if (_res == NULL && PyErr_Occurred()) {
  15868. p->error_indicator = 1;
  15869. p->level--;
  15870. return NULL;
  15871. }
  15872. goto done;
  15873. }
  15874. p->mark = _mark;
  15875. D(fprintf(stderr, "%*c%s fstring_conversion[%d-%d]: %s failed!\n", p->level, ' ',
  15876. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"!\" NAME"));
  15877. }
  15878. _res = NULL;
  15879. done:
  15880. p->level--;
  15881. return _res;
  15882. }
  15883. // fstring_full_format_spec: ':' fstring_format_spec*
  15884. static ResultTokenWithMetadata*
  15885. fstring_full_format_spec_rule(Parser *p)
  15886. {
  15887. if (p->level++ == MAXSTACK) {
  15888. _Pypegen_stack_overflow(p);
  15889. }
  15890. if (p->error_indicator) {
  15891. p->level--;
  15892. return NULL;
  15893. }
  15894. ResultTokenWithMetadata* _res = NULL;
  15895. int _mark = p->mark;
  15896. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  15897. p->error_indicator = 1;
  15898. p->level--;
  15899. return NULL;
  15900. }
  15901. int _start_lineno = p->tokens[_mark]->lineno;
  15902. UNUSED(_start_lineno); // Only used by EXTRA macro
  15903. int _start_col_offset = p->tokens[_mark]->col_offset;
  15904. UNUSED(_start_col_offset); // Only used by EXTRA macro
  15905. { // ':' fstring_format_spec*
  15906. if (p->error_indicator) {
  15907. p->level--;
  15908. return NULL;
  15909. }
  15910. D(fprintf(stderr, "%*c> fstring_full_format_spec[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' fstring_format_spec*"));
  15911. Token * colon;
  15912. asdl_seq * spec;
  15913. if (
  15914. (colon = _PyPegen_expect_token(p, 11)) // token=':'
  15915. &&
  15916. (spec = _loop0_113_rule(p)) // fstring_format_spec*
  15917. )
  15918. {
  15919. D(fprintf(stderr, "%*c+ fstring_full_format_spec[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' fstring_format_spec*"));
  15920. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  15921. if (_token == NULL) {
  15922. p->level--;
  15923. return NULL;
  15924. }
  15925. int _end_lineno = _token->end_lineno;
  15926. UNUSED(_end_lineno); // Only used by EXTRA macro
  15927. int _end_col_offset = _token->end_col_offset;
  15928. UNUSED(_end_col_offset); // Only used by EXTRA macro
  15929. _res = _PyPegen_setup_full_format_spec ( p , colon , ( asdl_expr_seq* ) spec , EXTRA );
  15930. if (_res == NULL && PyErr_Occurred()) {
  15931. p->error_indicator = 1;
  15932. p->level--;
  15933. return NULL;
  15934. }
  15935. goto done;
  15936. }
  15937. p->mark = _mark;
  15938. D(fprintf(stderr, "%*c%s fstring_full_format_spec[%d-%d]: %s failed!\n", p->level, ' ',
  15939. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' fstring_format_spec*"));
  15940. }
  15941. _res = NULL;
  15942. done:
  15943. p->level--;
  15944. return _res;
  15945. }
  15946. // fstring_format_spec: FSTRING_MIDDLE | fstring_replacement_field
  15947. static expr_ty
  15948. fstring_format_spec_rule(Parser *p)
  15949. {
  15950. if (p->level++ == MAXSTACK) {
  15951. _Pypegen_stack_overflow(p);
  15952. }
  15953. if (p->error_indicator) {
  15954. p->level--;
  15955. return NULL;
  15956. }
  15957. expr_ty _res = NULL;
  15958. int _mark = p->mark;
  15959. { // FSTRING_MIDDLE
  15960. if (p->error_indicator) {
  15961. p->level--;
  15962. return NULL;
  15963. }
  15964. D(fprintf(stderr, "%*c> fstring_format_spec[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "FSTRING_MIDDLE"));
  15965. Token * t;
  15966. if (
  15967. (t = _PyPegen_expect_token(p, FSTRING_MIDDLE)) // token='FSTRING_MIDDLE'
  15968. )
  15969. {
  15970. D(fprintf(stderr, "%*c+ fstring_format_spec[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "FSTRING_MIDDLE"));
  15971. _res = _PyPegen_decoded_constant_from_token ( p , t );
  15972. if (_res == NULL && PyErr_Occurred()) {
  15973. p->error_indicator = 1;
  15974. p->level--;
  15975. return NULL;
  15976. }
  15977. goto done;
  15978. }
  15979. p->mark = _mark;
  15980. D(fprintf(stderr, "%*c%s fstring_format_spec[%d-%d]: %s failed!\n", p->level, ' ',
  15981. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "FSTRING_MIDDLE"));
  15982. }
  15983. { // fstring_replacement_field
  15984. if (p->error_indicator) {
  15985. p->level--;
  15986. return NULL;
  15987. }
  15988. D(fprintf(stderr, "%*c> fstring_format_spec[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "fstring_replacement_field"));
  15989. expr_ty fstring_replacement_field_var;
  15990. if (
  15991. (fstring_replacement_field_var = fstring_replacement_field_rule(p)) // fstring_replacement_field
  15992. )
  15993. {
  15994. D(fprintf(stderr, "%*c+ fstring_format_spec[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "fstring_replacement_field"));
  15995. _res = fstring_replacement_field_var;
  15996. goto done;
  15997. }
  15998. p->mark = _mark;
  15999. D(fprintf(stderr, "%*c%s fstring_format_spec[%d-%d]: %s failed!\n", p->level, ' ',
  16000. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "fstring_replacement_field"));
  16001. }
  16002. _res = NULL;
  16003. done:
  16004. p->level--;
  16005. return _res;
  16006. }
  16007. // fstring: FSTRING_START fstring_middle* FSTRING_END
  16008. static expr_ty
  16009. fstring_rule(Parser *p)
  16010. {
  16011. if (p->level++ == MAXSTACK) {
  16012. _Pypegen_stack_overflow(p);
  16013. }
  16014. if (p->error_indicator) {
  16015. p->level--;
  16016. return NULL;
  16017. }
  16018. expr_ty _res = NULL;
  16019. int _mark = p->mark;
  16020. { // FSTRING_START fstring_middle* FSTRING_END
  16021. if (p->error_indicator) {
  16022. p->level--;
  16023. return NULL;
  16024. }
  16025. D(fprintf(stderr, "%*c> fstring[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "FSTRING_START fstring_middle* FSTRING_END"));
  16026. Token * a;
  16027. asdl_seq * b;
  16028. Token * c;
  16029. if (
  16030. (a = _PyPegen_expect_token(p, FSTRING_START)) // token='FSTRING_START'
  16031. &&
  16032. (b = _loop0_114_rule(p)) // fstring_middle*
  16033. &&
  16034. (c = _PyPegen_expect_token(p, FSTRING_END)) // token='FSTRING_END'
  16035. )
  16036. {
  16037. D(fprintf(stderr, "%*c+ fstring[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "FSTRING_START fstring_middle* FSTRING_END"));
  16038. _res = _PyPegen_joined_str ( p , a , ( asdl_expr_seq* ) b , c );
  16039. if (_res == NULL && PyErr_Occurred()) {
  16040. p->error_indicator = 1;
  16041. p->level--;
  16042. return NULL;
  16043. }
  16044. goto done;
  16045. }
  16046. p->mark = _mark;
  16047. D(fprintf(stderr, "%*c%s fstring[%d-%d]: %s failed!\n", p->level, ' ',
  16048. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "FSTRING_START fstring_middle* FSTRING_END"));
  16049. }
  16050. _res = NULL;
  16051. done:
  16052. p->level--;
  16053. return _res;
  16054. }
  16055. // string: STRING
  16056. static expr_ty
  16057. string_rule(Parser *p)
  16058. {
  16059. if (p->level++ == MAXSTACK) {
  16060. _Pypegen_stack_overflow(p);
  16061. }
  16062. if (p->error_indicator) {
  16063. p->level--;
  16064. return NULL;
  16065. }
  16066. expr_ty _res = NULL;
  16067. int _mark = p->mark;
  16068. { // STRING
  16069. if (p->error_indicator) {
  16070. p->level--;
  16071. return NULL;
  16072. }
  16073. D(fprintf(stderr, "%*c> string[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING"));
  16074. Token* s;
  16075. if (
  16076. (s = (Token*)_PyPegen_string_token(p)) // STRING
  16077. )
  16078. {
  16079. D(fprintf(stderr, "%*c+ string[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING"));
  16080. _res = _PyPegen_constant_from_string ( p , s );
  16081. if (_res == NULL && PyErr_Occurred()) {
  16082. p->error_indicator = 1;
  16083. p->level--;
  16084. return NULL;
  16085. }
  16086. goto done;
  16087. }
  16088. p->mark = _mark;
  16089. D(fprintf(stderr, "%*c%s string[%d-%d]: %s failed!\n", p->level, ' ',
  16090. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING"));
  16091. }
  16092. _res = NULL;
  16093. done:
  16094. p->level--;
  16095. return _res;
  16096. }
  16097. // strings: ((fstring | string))+
  16098. static expr_ty
  16099. strings_rule(Parser *p)
  16100. {
  16101. if (p->level++ == MAXSTACK) {
  16102. _Pypegen_stack_overflow(p);
  16103. }
  16104. if (p->error_indicator) {
  16105. p->level--;
  16106. return NULL;
  16107. }
  16108. expr_ty _res = NULL;
  16109. if (_PyPegen_is_memoized(p, strings_type, &_res)) {
  16110. p->level--;
  16111. return _res;
  16112. }
  16113. int _mark = p->mark;
  16114. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  16115. p->error_indicator = 1;
  16116. p->level--;
  16117. return NULL;
  16118. }
  16119. int _start_lineno = p->tokens[_mark]->lineno;
  16120. UNUSED(_start_lineno); // Only used by EXTRA macro
  16121. int _start_col_offset = p->tokens[_mark]->col_offset;
  16122. UNUSED(_start_col_offset); // Only used by EXTRA macro
  16123. { // ((fstring | string))+
  16124. if (p->error_indicator) {
  16125. p->level--;
  16126. return NULL;
  16127. }
  16128. D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((fstring | string))+"));
  16129. asdl_expr_seq* a;
  16130. if (
  16131. (a = (asdl_expr_seq*)_loop1_115_rule(p)) // ((fstring | string))+
  16132. )
  16133. {
  16134. D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((fstring | string))+"));
  16135. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  16136. if (_token == NULL) {
  16137. p->level--;
  16138. return NULL;
  16139. }
  16140. int _end_lineno = _token->end_lineno;
  16141. UNUSED(_end_lineno); // Only used by EXTRA macro
  16142. int _end_col_offset = _token->end_col_offset;
  16143. UNUSED(_end_col_offset); // Only used by EXTRA macro
  16144. _res = _PyPegen_concatenate_strings ( p , a , EXTRA );
  16145. if (_res == NULL && PyErr_Occurred()) {
  16146. p->error_indicator = 1;
  16147. p->level--;
  16148. return NULL;
  16149. }
  16150. goto done;
  16151. }
  16152. p->mark = _mark;
  16153. D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ',
  16154. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((fstring | string))+"));
  16155. }
  16156. _res = NULL;
  16157. done:
  16158. _PyPegen_insert_memo(p, _mark, strings_type, _res);
  16159. p->level--;
  16160. return _res;
  16161. }
  16162. // list: '[' star_named_expressions? ']'
  16163. static expr_ty
  16164. list_rule(Parser *p)
  16165. {
  16166. if (p->level++ == MAXSTACK) {
  16167. _Pypegen_stack_overflow(p);
  16168. }
  16169. if (p->error_indicator) {
  16170. p->level--;
  16171. return NULL;
  16172. }
  16173. expr_ty _res = NULL;
  16174. int _mark = p->mark;
  16175. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  16176. p->error_indicator = 1;
  16177. p->level--;
  16178. return NULL;
  16179. }
  16180. int _start_lineno = p->tokens[_mark]->lineno;
  16181. UNUSED(_start_lineno); // Only used by EXTRA macro
  16182. int _start_col_offset = p->tokens[_mark]->col_offset;
  16183. UNUSED(_start_col_offset); // Only used by EXTRA macro
  16184. { // '[' star_named_expressions? ']'
  16185. if (p->error_indicator) {
  16186. p->level--;
  16187. return NULL;
  16188. }
  16189. D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
  16190. Token * _literal;
  16191. Token * _literal_1;
  16192. void *a;
  16193. if (
  16194. (_literal = _PyPegen_expect_token(p, 9)) // token='['
  16195. &&
  16196. (a = star_named_expressions_rule(p), !p->error_indicator) // star_named_expressions?
  16197. &&
  16198. (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
  16199. )
  16200. {
  16201. D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
  16202. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  16203. if (_token == NULL) {
  16204. p->level--;
  16205. return NULL;
  16206. }
  16207. int _end_lineno = _token->end_lineno;
  16208. UNUSED(_end_lineno); // Only used by EXTRA macro
  16209. int _end_col_offset = _token->end_col_offset;
  16210. UNUSED(_end_col_offset); // Only used by EXTRA macro
  16211. _res = _PyAST_List ( a , Load , EXTRA );
  16212. if (_res == NULL && PyErr_Occurred()) {
  16213. p->error_indicator = 1;
  16214. p->level--;
  16215. return NULL;
  16216. }
  16217. goto done;
  16218. }
  16219. p->mark = _mark;
  16220. D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ',
  16221. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'"));
  16222. }
  16223. _res = NULL;
  16224. done:
  16225. p->level--;
  16226. return _res;
  16227. }
  16228. // tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
  16229. static expr_ty
  16230. tuple_rule(Parser *p)
  16231. {
  16232. if (p->level++ == MAXSTACK) {
  16233. _Pypegen_stack_overflow(p);
  16234. }
  16235. if (p->error_indicator) {
  16236. p->level--;
  16237. return NULL;
  16238. }
  16239. expr_ty _res = NULL;
  16240. int _mark = p->mark;
  16241. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  16242. p->error_indicator = 1;
  16243. p->level--;
  16244. return NULL;
  16245. }
  16246. int _start_lineno = p->tokens[_mark]->lineno;
  16247. UNUSED(_start_lineno); // Only used by EXTRA macro
  16248. int _start_col_offset = p->tokens[_mark]->col_offset;
  16249. UNUSED(_start_col_offset); // Only used by EXTRA macro
  16250. { // '(' [star_named_expression ',' star_named_expressions?] ')'
  16251. if (p->error_indicator) {
  16252. p->level--;
  16253. return NULL;
  16254. }
  16255. D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
  16256. Token * _literal;
  16257. Token * _literal_1;
  16258. void *a;
  16259. if (
  16260. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  16261. &&
  16262. (a = _tmp_116_rule(p), !p->error_indicator) // [star_named_expression ',' star_named_expressions?]
  16263. &&
  16264. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  16265. )
  16266. {
  16267. D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
  16268. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  16269. if (_token == NULL) {
  16270. p->level--;
  16271. return NULL;
  16272. }
  16273. int _end_lineno = _token->end_lineno;
  16274. UNUSED(_end_lineno); // Only used by EXTRA macro
  16275. int _end_col_offset = _token->end_col_offset;
  16276. UNUSED(_end_col_offset); // Only used by EXTRA macro
  16277. _res = _PyAST_Tuple ( a , Load , EXTRA );
  16278. if (_res == NULL && PyErr_Occurred()) {
  16279. p->error_indicator = 1;
  16280. p->level--;
  16281. return NULL;
  16282. }
  16283. goto done;
  16284. }
  16285. p->mark = _mark;
  16286. D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ',
  16287. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
  16288. }
  16289. _res = NULL;
  16290. done:
  16291. p->level--;
  16292. return _res;
  16293. }
  16294. // set: '{' star_named_expressions '}'
  16295. static expr_ty
  16296. set_rule(Parser *p)
  16297. {
  16298. if (p->level++ == MAXSTACK) {
  16299. _Pypegen_stack_overflow(p);
  16300. }
  16301. if (p->error_indicator) {
  16302. p->level--;
  16303. return NULL;
  16304. }
  16305. expr_ty _res = NULL;
  16306. int _mark = p->mark;
  16307. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  16308. p->error_indicator = 1;
  16309. p->level--;
  16310. return NULL;
  16311. }
  16312. int _start_lineno = p->tokens[_mark]->lineno;
  16313. UNUSED(_start_lineno); // Only used by EXTRA macro
  16314. int _start_col_offset = p->tokens[_mark]->col_offset;
  16315. UNUSED(_start_col_offset); // Only used by EXTRA macro
  16316. { // '{' star_named_expressions '}'
  16317. if (p->error_indicator) {
  16318. p->level--;
  16319. return NULL;
  16320. }
  16321. D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'"));
  16322. Token * _literal;
  16323. Token * _literal_1;
  16324. asdl_expr_seq* a;
  16325. if (
  16326. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  16327. &&
  16328. (a = star_named_expressions_rule(p)) // star_named_expressions
  16329. &&
  16330. (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
  16331. )
  16332. {
  16333. D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'"));
  16334. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  16335. if (_token == NULL) {
  16336. p->level--;
  16337. return NULL;
  16338. }
  16339. int _end_lineno = _token->end_lineno;
  16340. UNUSED(_end_lineno); // Only used by EXTRA macro
  16341. int _end_col_offset = _token->end_col_offset;
  16342. UNUSED(_end_col_offset); // Only used by EXTRA macro
  16343. _res = _PyAST_Set ( a , EXTRA );
  16344. if (_res == NULL && PyErr_Occurred()) {
  16345. p->error_indicator = 1;
  16346. p->level--;
  16347. return NULL;
  16348. }
  16349. goto done;
  16350. }
  16351. p->mark = _mark;
  16352. D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ',
  16353. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' star_named_expressions '}'"));
  16354. }
  16355. _res = NULL;
  16356. done:
  16357. p->level--;
  16358. return _res;
  16359. }
  16360. // dict: '{' double_starred_kvpairs? '}' | '{' invalid_double_starred_kvpairs '}'
  16361. static expr_ty
  16362. dict_rule(Parser *p)
  16363. {
  16364. if (p->level++ == MAXSTACK) {
  16365. _Pypegen_stack_overflow(p);
  16366. }
  16367. if (p->error_indicator) {
  16368. p->level--;
  16369. return NULL;
  16370. }
  16371. expr_ty _res = NULL;
  16372. int _mark = p->mark;
  16373. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  16374. p->error_indicator = 1;
  16375. p->level--;
  16376. return NULL;
  16377. }
  16378. int _start_lineno = p->tokens[_mark]->lineno;
  16379. UNUSED(_start_lineno); // Only used by EXTRA macro
  16380. int _start_col_offset = p->tokens[_mark]->col_offset;
  16381. UNUSED(_start_col_offset); // Only used by EXTRA macro
  16382. { // '{' double_starred_kvpairs? '}'
  16383. if (p->error_indicator) {
  16384. p->level--;
  16385. return NULL;
  16386. }
  16387. D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
  16388. Token * _literal;
  16389. Token * _literal_1;
  16390. void *a;
  16391. if (
  16392. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  16393. &&
  16394. (a = double_starred_kvpairs_rule(p), !p->error_indicator) // double_starred_kvpairs?
  16395. &&
  16396. (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
  16397. )
  16398. {
  16399. D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
  16400. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  16401. if (_token == NULL) {
  16402. p->level--;
  16403. return NULL;
  16404. }
  16405. int _end_lineno = _token->end_lineno;
  16406. UNUSED(_end_lineno); // Only used by EXTRA macro
  16407. int _end_col_offset = _token->end_col_offset;
  16408. UNUSED(_end_col_offset); // Only used by EXTRA macro
  16409. _res = _PyAST_Dict ( CHECK ( asdl_expr_seq* , _PyPegen_get_keys ( p , a ) ) , CHECK ( asdl_expr_seq* , _PyPegen_get_values ( p , a ) ) , EXTRA );
  16410. if (_res == NULL && PyErr_Occurred()) {
  16411. p->error_indicator = 1;
  16412. p->level--;
  16413. return NULL;
  16414. }
  16415. goto done;
  16416. }
  16417. p->mark = _mark;
  16418. D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
  16419. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
  16420. }
  16421. { // '{' invalid_double_starred_kvpairs '}'
  16422. if (p->error_indicator) {
  16423. p->level--;
  16424. return NULL;
  16425. }
  16426. D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'"));
  16427. Token * _literal;
  16428. Token * _literal_1;
  16429. void *invalid_double_starred_kvpairs_var;
  16430. if (
  16431. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  16432. &&
  16433. (invalid_double_starred_kvpairs_var = invalid_double_starred_kvpairs_rule(p)) // invalid_double_starred_kvpairs
  16434. &&
  16435. (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
  16436. )
  16437. {
  16438. D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'"));
  16439. _res = _PyPegen_dummy_name(p, _literal, invalid_double_starred_kvpairs_var, _literal_1);
  16440. goto done;
  16441. }
  16442. p->mark = _mark;
  16443. D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
  16444. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'"));
  16445. }
  16446. _res = NULL;
  16447. done:
  16448. p->level--;
  16449. return _res;
  16450. }
  16451. // double_starred_kvpairs: ','.double_starred_kvpair+ ','?
  16452. static asdl_seq*
  16453. double_starred_kvpairs_rule(Parser *p)
  16454. {
  16455. if (p->level++ == MAXSTACK) {
  16456. _Pypegen_stack_overflow(p);
  16457. }
  16458. if (p->error_indicator) {
  16459. p->level--;
  16460. return NULL;
  16461. }
  16462. asdl_seq* _res = NULL;
  16463. int _mark = p->mark;
  16464. { // ','.double_starred_kvpair+ ','?
  16465. if (p->error_indicator) {
  16466. p->level--;
  16467. return NULL;
  16468. }
  16469. D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
  16470. void *_opt_var;
  16471. UNUSED(_opt_var); // Silence compiler warnings
  16472. asdl_seq * a;
  16473. if (
  16474. (a = _gather_117_rule(p)) // ','.double_starred_kvpair+
  16475. &&
  16476. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  16477. )
  16478. {
  16479. D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
  16480. _res = a;
  16481. if (_res == NULL && PyErr_Occurred()) {
  16482. p->error_indicator = 1;
  16483. p->level--;
  16484. return NULL;
  16485. }
  16486. goto done;
  16487. }
  16488. p->mark = _mark;
  16489. D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
  16490. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?"));
  16491. }
  16492. _res = NULL;
  16493. done:
  16494. p->level--;
  16495. return _res;
  16496. }
  16497. // double_starred_kvpair: '**' bitwise_or | kvpair
  16498. static KeyValuePair*
  16499. double_starred_kvpair_rule(Parser *p)
  16500. {
  16501. if (p->level++ == MAXSTACK) {
  16502. _Pypegen_stack_overflow(p);
  16503. }
  16504. if (p->error_indicator) {
  16505. p->level--;
  16506. return NULL;
  16507. }
  16508. KeyValuePair* _res = NULL;
  16509. int _mark = p->mark;
  16510. { // '**' bitwise_or
  16511. if (p->error_indicator) {
  16512. p->level--;
  16513. return NULL;
  16514. }
  16515. D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
  16516. Token * _literal;
  16517. expr_ty a;
  16518. if (
  16519. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  16520. &&
  16521. (a = bitwise_or_rule(p)) // bitwise_or
  16522. )
  16523. {
  16524. D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
  16525. _res = _PyPegen_key_value_pair ( p , NULL , a );
  16526. if (_res == NULL && PyErr_Occurred()) {
  16527. p->error_indicator = 1;
  16528. p->level--;
  16529. return NULL;
  16530. }
  16531. goto done;
  16532. }
  16533. p->mark = _mark;
  16534. D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
  16535. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or"));
  16536. }
  16537. { // kvpair
  16538. if (p->error_indicator) {
  16539. p->level--;
  16540. return NULL;
  16541. }
  16542. D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair"));
  16543. KeyValuePair* kvpair_var;
  16544. if (
  16545. (kvpair_var = kvpair_rule(p)) // kvpair
  16546. )
  16547. {
  16548. D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair"));
  16549. _res = kvpair_var;
  16550. goto done;
  16551. }
  16552. p->mark = _mark;
  16553. D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
  16554. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair"));
  16555. }
  16556. _res = NULL;
  16557. done:
  16558. p->level--;
  16559. return _res;
  16560. }
  16561. // kvpair: expression ':' expression
  16562. static KeyValuePair*
  16563. kvpair_rule(Parser *p)
  16564. {
  16565. if (p->level++ == MAXSTACK) {
  16566. _Pypegen_stack_overflow(p);
  16567. }
  16568. if (p->error_indicator) {
  16569. p->level--;
  16570. return NULL;
  16571. }
  16572. KeyValuePair* _res = NULL;
  16573. int _mark = p->mark;
  16574. { // expression ':' expression
  16575. if (p->error_indicator) {
  16576. p->level--;
  16577. return NULL;
  16578. }
  16579. D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
  16580. Token * _literal;
  16581. expr_ty a;
  16582. expr_ty b;
  16583. if (
  16584. (a = expression_rule(p)) // expression
  16585. &&
  16586. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  16587. &&
  16588. (b = expression_rule(p)) // expression
  16589. )
  16590. {
  16591. D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
  16592. _res = _PyPegen_key_value_pair ( p , a , b );
  16593. if (_res == NULL && PyErr_Occurred()) {
  16594. p->error_indicator = 1;
  16595. p->level--;
  16596. return NULL;
  16597. }
  16598. goto done;
  16599. }
  16600. p->mark = _mark;
  16601. D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ',
  16602. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
  16603. }
  16604. _res = NULL;
  16605. done:
  16606. p->level--;
  16607. return _res;
  16608. }
  16609. // for_if_clauses: for_if_clause+
  16610. static asdl_comprehension_seq*
  16611. for_if_clauses_rule(Parser *p)
  16612. {
  16613. if (p->level++ == MAXSTACK) {
  16614. _Pypegen_stack_overflow(p);
  16615. }
  16616. if (p->error_indicator) {
  16617. p->level--;
  16618. return NULL;
  16619. }
  16620. asdl_comprehension_seq* _res = NULL;
  16621. int _mark = p->mark;
  16622. { // for_if_clause+
  16623. if (p->error_indicator) {
  16624. p->level--;
  16625. return NULL;
  16626. }
  16627. D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
  16628. asdl_comprehension_seq* a;
  16629. if (
  16630. (a = (asdl_comprehension_seq*)_loop1_119_rule(p)) // for_if_clause+
  16631. )
  16632. {
  16633. D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
  16634. _res = a;
  16635. if (_res == NULL && PyErr_Occurred()) {
  16636. p->error_indicator = 1;
  16637. p->level--;
  16638. return NULL;
  16639. }
  16640. goto done;
  16641. }
  16642. p->mark = _mark;
  16643. D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ',
  16644. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+"));
  16645. }
  16646. _res = NULL;
  16647. done:
  16648. p->level--;
  16649. return _res;
  16650. }
  16651. // for_if_clause:
  16652. // | ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
  16653. // | 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
  16654. // | invalid_for_target
  16655. static comprehension_ty
  16656. for_if_clause_rule(Parser *p)
  16657. {
  16658. if (p->level++ == MAXSTACK) {
  16659. _Pypegen_stack_overflow(p);
  16660. }
  16661. if (p->error_indicator) {
  16662. p->level--;
  16663. return NULL;
  16664. }
  16665. comprehension_ty _res = NULL;
  16666. int _mark = p->mark;
  16667. { // ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
  16668. if (p->error_indicator) {
  16669. p->level--;
  16670. return NULL;
  16671. }
  16672. D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
  16673. int _cut_var = 0;
  16674. Token * _keyword;
  16675. Token * _keyword_1;
  16676. expr_ty a;
  16677. Token * async_var;
  16678. expr_ty b;
  16679. asdl_expr_seq* c;
  16680. if (
  16681. (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
  16682. &&
  16683. (_keyword = _PyPegen_expect_token(p, 650)) // token='for'
  16684. &&
  16685. (a = star_targets_rule(p)) // star_targets
  16686. &&
  16687. (_keyword_1 = _PyPegen_expect_token(p, 651)) // token='in'
  16688. &&
  16689. (_cut_var = 1)
  16690. &&
  16691. (b = disjunction_rule(p)) // disjunction
  16692. &&
  16693. (c = (asdl_expr_seq*)_loop0_120_rule(p)) // (('if' disjunction))*
  16694. )
  16695. {
  16696. D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
  16697. _res = CHECK_VERSION ( comprehension_ty , 6 , "Async comprehensions are" , _PyAST_comprehension ( a , b , c , 1 , p -> arena ) );
  16698. if (_res == NULL && PyErr_Occurred()) {
  16699. p->error_indicator = 1;
  16700. p->level--;
  16701. return NULL;
  16702. }
  16703. goto done;
  16704. }
  16705. p->mark = _mark;
  16706. D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
  16707. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
  16708. if (_cut_var) {
  16709. p->level--;
  16710. return NULL;
  16711. }
  16712. }
  16713. { // 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
  16714. if (p->error_indicator) {
  16715. p->level--;
  16716. return NULL;
  16717. }
  16718. D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
  16719. int _cut_var = 0;
  16720. Token * _keyword;
  16721. Token * _keyword_1;
  16722. expr_ty a;
  16723. expr_ty b;
  16724. asdl_expr_seq* c;
  16725. if (
  16726. (_keyword = _PyPegen_expect_token(p, 650)) // token='for'
  16727. &&
  16728. (a = star_targets_rule(p)) // star_targets
  16729. &&
  16730. (_keyword_1 = _PyPegen_expect_token(p, 651)) // token='in'
  16731. &&
  16732. (_cut_var = 1)
  16733. &&
  16734. (b = disjunction_rule(p)) // disjunction
  16735. &&
  16736. (c = (asdl_expr_seq*)_loop0_121_rule(p)) // (('if' disjunction))*
  16737. )
  16738. {
  16739. D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
  16740. _res = _PyAST_comprehension ( a , b , c , 0 , p -> arena );
  16741. if (_res == NULL && PyErr_Occurred()) {
  16742. p->error_indicator = 1;
  16743. p->level--;
  16744. return NULL;
  16745. }
  16746. goto done;
  16747. }
  16748. p->mark = _mark;
  16749. D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
  16750. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
  16751. if (_cut_var) {
  16752. p->level--;
  16753. return NULL;
  16754. }
  16755. }
  16756. if (p->call_invalid_rules) { // invalid_for_target
  16757. if (p->error_indicator) {
  16758. p->level--;
  16759. return NULL;
  16760. }
  16761. D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
  16762. void *invalid_for_target_var;
  16763. if (
  16764. (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
  16765. )
  16766. {
  16767. D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
  16768. _res = invalid_for_target_var;
  16769. goto done;
  16770. }
  16771. p->mark = _mark;
  16772. D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
  16773. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
  16774. }
  16775. _res = NULL;
  16776. done:
  16777. p->level--;
  16778. return _res;
  16779. }
  16780. // listcomp: '[' named_expression for_if_clauses ']' | invalid_comprehension
  16781. static expr_ty
  16782. listcomp_rule(Parser *p)
  16783. {
  16784. if (p->level++ == MAXSTACK) {
  16785. _Pypegen_stack_overflow(p);
  16786. }
  16787. if (p->error_indicator) {
  16788. p->level--;
  16789. return NULL;
  16790. }
  16791. expr_ty _res = NULL;
  16792. int _mark = p->mark;
  16793. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  16794. p->error_indicator = 1;
  16795. p->level--;
  16796. return NULL;
  16797. }
  16798. int _start_lineno = p->tokens[_mark]->lineno;
  16799. UNUSED(_start_lineno); // Only used by EXTRA macro
  16800. int _start_col_offset = p->tokens[_mark]->col_offset;
  16801. UNUSED(_start_col_offset); // Only used by EXTRA macro
  16802. { // '[' named_expression for_if_clauses ']'
  16803. if (p->error_indicator) {
  16804. p->level--;
  16805. return NULL;
  16806. }
  16807. D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'"));
  16808. Token * _literal;
  16809. Token * _literal_1;
  16810. expr_ty a;
  16811. asdl_comprehension_seq* b;
  16812. if (
  16813. (_literal = _PyPegen_expect_token(p, 9)) // token='['
  16814. &&
  16815. (a = named_expression_rule(p)) // named_expression
  16816. &&
  16817. (b = for_if_clauses_rule(p)) // for_if_clauses
  16818. &&
  16819. (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
  16820. )
  16821. {
  16822. D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'"));
  16823. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  16824. if (_token == NULL) {
  16825. p->level--;
  16826. return NULL;
  16827. }
  16828. int _end_lineno = _token->end_lineno;
  16829. UNUSED(_end_lineno); // Only used by EXTRA macro
  16830. int _end_col_offset = _token->end_col_offset;
  16831. UNUSED(_end_col_offset); // Only used by EXTRA macro
  16832. _res = _PyAST_ListComp ( a , b , EXTRA );
  16833. if (_res == NULL && PyErr_Occurred()) {
  16834. p->error_indicator = 1;
  16835. p->level--;
  16836. return NULL;
  16837. }
  16838. goto done;
  16839. }
  16840. p->mark = _mark;
  16841. D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
  16842. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression for_if_clauses ']'"));
  16843. }
  16844. if (p->call_invalid_rules) { // invalid_comprehension
  16845. if (p->error_indicator) {
  16846. p->level--;
  16847. return NULL;
  16848. }
  16849. D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
  16850. void *invalid_comprehension_var;
  16851. if (
  16852. (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
  16853. )
  16854. {
  16855. D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
  16856. _res = invalid_comprehension_var;
  16857. goto done;
  16858. }
  16859. p->mark = _mark;
  16860. D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
  16861. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
  16862. }
  16863. _res = NULL;
  16864. done:
  16865. p->level--;
  16866. return _res;
  16867. }
  16868. // setcomp: '{' named_expression for_if_clauses '}' | invalid_comprehension
  16869. static expr_ty
  16870. setcomp_rule(Parser *p)
  16871. {
  16872. if (p->level++ == MAXSTACK) {
  16873. _Pypegen_stack_overflow(p);
  16874. }
  16875. if (p->error_indicator) {
  16876. p->level--;
  16877. return NULL;
  16878. }
  16879. expr_ty _res = NULL;
  16880. int _mark = p->mark;
  16881. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  16882. p->error_indicator = 1;
  16883. p->level--;
  16884. return NULL;
  16885. }
  16886. int _start_lineno = p->tokens[_mark]->lineno;
  16887. UNUSED(_start_lineno); // Only used by EXTRA macro
  16888. int _start_col_offset = p->tokens[_mark]->col_offset;
  16889. UNUSED(_start_col_offset); // Only used by EXTRA macro
  16890. { // '{' named_expression for_if_clauses '}'
  16891. if (p->error_indicator) {
  16892. p->level--;
  16893. return NULL;
  16894. }
  16895. D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' named_expression for_if_clauses '}'"));
  16896. Token * _literal;
  16897. Token * _literal_1;
  16898. expr_ty a;
  16899. asdl_comprehension_seq* b;
  16900. if (
  16901. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  16902. &&
  16903. (a = named_expression_rule(p)) // named_expression
  16904. &&
  16905. (b = for_if_clauses_rule(p)) // for_if_clauses
  16906. &&
  16907. (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
  16908. )
  16909. {
  16910. D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' named_expression for_if_clauses '}'"));
  16911. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  16912. if (_token == NULL) {
  16913. p->level--;
  16914. return NULL;
  16915. }
  16916. int _end_lineno = _token->end_lineno;
  16917. UNUSED(_end_lineno); // Only used by EXTRA macro
  16918. int _end_col_offset = _token->end_col_offset;
  16919. UNUSED(_end_col_offset); // Only used by EXTRA macro
  16920. _res = _PyAST_SetComp ( a , b , EXTRA );
  16921. if (_res == NULL && PyErr_Occurred()) {
  16922. p->error_indicator = 1;
  16923. p->level--;
  16924. return NULL;
  16925. }
  16926. goto done;
  16927. }
  16928. p->mark = _mark;
  16929. D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
  16930. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' named_expression for_if_clauses '}'"));
  16931. }
  16932. if (p->call_invalid_rules) { // invalid_comprehension
  16933. if (p->error_indicator) {
  16934. p->level--;
  16935. return NULL;
  16936. }
  16937. D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
  16938. void *invalid_comprehension_var;
  16939. if (
  16940. (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
  16941. )
  16942. {
  16943. D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
  16944. _res = invalid_comprehension_var;
  16945. goto done;
  16946. }
  16947. p->mark = _mark;
  16948. D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
  16949. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
  16950. }
  16951. _res = NULL;
  16952. done:
  16953. p->level--;
  16954. return _res;
  16955. }
  16956. // genexp:
  16957. // | '(' (assignment_expression | expression !':=') for_if_clauses ')'
  16958. // | invalid_comprehension
  16959. static expr_ty
  16960. genexp_rule(Parser *p)
  16961. {
  16962. if (p->level++ == MAXSTACK) {
  16963. _Pypegen_stack_overflow(p);
  16964. }
  16965. if (p->error_indicator) {
  16966. p->level--;
  16967. return NULL;
  16968. }
  16969. expr_ty _res = NULL;
  16970. int _mark = p->mark;
  16971. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  16972. p->error_indicator = 1;
  16973. p->level--;
  16974. return NULL;
  16975. }
  16976. int _start_lineno = p->tokens[_mark]->lineno;
  16977. UNUSED(_start_lineno); // Only used by EXTRA macro
  16978. int _start_col_offset = p->tokens[_mark]->col_offset;
  16979. UNUSED(_start_col_offset); // Only used by EXTRA macro
  16980. { // '(' (assignment_expression | expression !':=') for_if_clauses ')'
  16981. if (p->error_indicator) {
  16982. p->level--;
  16983. return NULL;
  16984. }
  16985. D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (assignment_expression | expression !':=') for_if_clauses ')'"));
  16986. Token * _literal;
  16987. Token * _literal_1;
  16988. void *a;
  16989. asdl_comprehension_seq* b;
  16990. if (
  16991. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  16992. &&
  16993. (a = _tmp_122_rule(p)) // assignment_expression | expression !':='
  16994. &&
  16995. (b = for_if_clauses_rule(p)) // for_if_clauses
  16996. &&
  16997. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  16998. )
  16999. {
  17000. D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (assignment_expression | expression !':=') for_if_clauses ')'"));
  17001. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  17002. if (_token == NULL) {
  17003. p->level--;
  17004. return NULL;
  17005. }
  17006. int _end_lineno = _token->end_lineno;
  17007. UNUSED(_end_lineno); // Only used by EXTRA macro
  17008. int _end_col_offset = _token->end_col_offset;
  17009. UNUSED(_end_col_offset); // Only used by EXTRA macro
  17010. _res = _PyAST_GeneratorExp ( a , b , EXTRA );
  17011. if (_res == NULL && PyErr_Occurred()) {
  17012. p->error_indicator = 1;
  17013. p->level--;
  17014. return NULL;
  17015. }
  17016. goto done;
  17017. }
  17018. p->mark = _mark;
  17019. D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
  17020. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (assignment_expression | expression !':=') for_if_clauses ')'"));
  17021. }
  17022. if (p->call_invalid_rules) { // invalid_comprehension
  17023. if (p->error_indicator) {
  17024. p->level--;
  17025. return NULL;
  17026. }
  17027. D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
  17028. void *invalid_comprehension_var;
  17029. if (
  17030. (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
  17031. )
  17032. {
  17033. D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
  17034. _res = invalid_comprehension_var;
  17035. goto done;
  17036. }
  17037. p->mark = _mark;
  17038. D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
  17039. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
  17040. }
  17041. _res = NULL;
  17042. done:
  17043. p->level--;
  17044. return _res;
  17045. }
  17046. // dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension
  17047. static expr_ty
  17048. dictcomp_rule(Parser *p)
  17049. {
  17050. if (p->level++ == MAXSTACK) {
  17051. _Pypegen_stack_overflow(p);
  17052. }
  17053. if (p->error_indicator) {
  17054. p->level--;
  17055. return NULL;
  17056. }
  17057. expr_ty _res = NULL;
  17058. int _mark = p->mark;
  17059. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  17060. p->error_indicator = 1;
  17061. p->level--;
  17062. return NULL;
  17063. }
  17064. int _start_lineno = p->tokens[_mark]->lineno;
  17065. UNUSED(_start_lineno); // Only used by EXTRA macro
  17066. int _start_col_offset = p->tokens[_mark]->col_offset;
  17067. UNUSED(_start_col_offset); // Only used by EXTRA macro
  17068. { // '{' kvpair for_if_clauses '}'
  17069. if (p->error_indicator) {
  17070. p->level--;
  17071. return NULL;
  17072. }
  17073. D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
  17074. Token * _literal;
  17075. Token * _literal_1;
  17076. KeyValuePair* a;
  17077. asdl_comprehension_seq* b;
  17078. if (
  17079. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  17080. &&
  17081. (a = kvpair_rule(p)) // kvpair
  17082. &&
  17083. (b = for_if_clauses_rule(p)) // for_if_clauses
  17084. &&
  17085. (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
  17086. )
  17087. {
  17088. D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
  17089. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  17090. if (_token == NULL) {
  17091. p->level--;
  17092. return NULL;
  17093. }
  17094. int _end_lineno = _token->end_lineno;
  17095. UNUSED(_end_lineno); // Only used by EXTRA macro
  17096. int _end_col_offset = _token->end_col_offset;
  17097. UNUSED(_end_col_offset); // Only used by EXTRA macro
  17098. _res = _PyAST_DictComp ( a -> key , a -> value , b , EXTRA );
  17099. if (_res == NULL && PyErr_Occurred()) {
  17100. p->error_indicator = 1;
  17101. p->level--;
  17102. return NULL;
  17103. }
  17104. goto done;
  17105. }
  17106. p->mark = _mark;
  17107. D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
  17108. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
  17109. }
  17110. if (p->call_invalid_rules) { // invalid_dict_comprehension
  17111. if (p->error_indicator) {
  17112. p->level--;
  17113. return NULL;
  17114. }
  17115. D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
  17116. void *invalid_dict_comprehension_var;
  17117. if (
  17118. (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension
  17119. )
  17120. {
  17121. D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
  17122. _res = invalid_dict_comprehension_var;
  17123. goto done;
  17124. }
  17125. p->mark = _mark;
  17126. D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
  17127. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension"));
  17128. }
  17129. _res = NULL;
  17130. done:
  17131. p->level--;
  17132. return _res;
  17133. }
  17134. // arguments: args ','? &')' | invalid_arguments
  17135. static expr_ty
  17136. arguments_rule(Parser *p)
  17137. {
  17138. if (p->level++ == MAXSTACK) {
  17139. _Pypegen_stack_overflow(p);
  17140. }
  17141. if (p->error_indicator) {
  17142. p->level--;
  17143. return NULL;
  17144. }
  17145. expr_ty _res = NULL;
  17146. if (_PyPegen_is_memoized(p, arguments_type, &_res)) {
  17147. p->level--;
  17148. return _res;
  17149. }
  17150. int _mark = p->mark;
  17151. { // args ','? &')'
  17152. if (p->error_indicator) {
  17153. p->level--;
  17154. return NULL;
  17155. }
  17156. D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
  17157. void *_opt_var;
  17158. UNUSED(_opt_var); // Silence compiler warnings
  17159. expr_ty a;
  17160. if (
  17161. (a = args_rule(p)) // args
  17162. &&
  17163. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  17164. &&
  17165. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
  17166. )
  17167. {
  17168. D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
  17169. _res = a;
  17170. if (_res == NULL && PyErr_Occurred()) {
  17171. p->error_indicator = 1;
  17172. p->level--;
  17173. return NULL;
  17174. }
  17175. goto done;
  17176. }
  17177. p->mark = _mark;
  17178. D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
  17179. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'"));
  17180. }
  17181. if (p->call_invalid_rules) { // invalid_arguments
  17182. if (p->error_indicator) {
  17183. p->level--;
  17184. return NULL;
  17185. }
  17186. D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_arguments"));
  17187. void *invalid_arguments_var;
  17188. if (
  17189. (invalid_arguments_var = invalid_arguments_rule(p)) // invalid_arguments
  17190. )
  17191. {
  17192. D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_arguments"));
  17193. _res = invalid_arguments_var;
  17194. goto done;
  17195. }
  17196. p->mark = _mark;
  17197. D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
  17198. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_arguments"));
  17199. }
  17200. _res = NULL;
  17201. done:
  17202. _PyPegen_insert_memo(p, _mark, arguments_type, _res);
  17203. p->level--;
  17204. return _res;
  17205. }
  17206. // args:
  17207. // | ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]
  17208. // | kwargs
  17209. static expr_ty
  17210. args_rule(Parser *p)
  17211. {
  17212. if (p->level++ == MAXSTACK) {
  17213. _Pypegen_stack_overflow(p);
  17214. }
  17215. if (p->error_indicator) {
  17216. p->level--;
  17217. return NULL;
  17218. }
  17219. expr_ty _res = NULL;
  17220. int _mark = p->mark;
  17221. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  17222. p->error_indicator = 1;
  17223. p->level--;
  17224. return NULL;
  17225. }
  17226. int _start_lineno = p->tokens[_mark]->lineno;
  17227. UNUSED(_start_lineno); // Only used by EXTRA macro
  17228. int _start_col_offset = p->tokens[_mark]->col_offset;
  17229. UNUSED(_start_col_offset); // Only used by EXTRA macro
  17230. { // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]
  17231. if (p->error_indicator) {
  17232. p->level--;
  17233. return NULL;
  17234. }
  17235. D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]"));
  17236. asdl_expr_seq* a;
  17237. void *b;
  17238. if (
  17239. (a = (asdl_expr_seq*)_gather_123_rule(p)) // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+
  17240. &&
  17241. (b = _tmp_125_rule(p), !p->error_indicator) // [',' kwargs]
  17242. )
  17243. {
  17244. D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]"));
  17245. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  17246. if (_token == NULL) {
  17247. p->level--;
  17248. return NULL;
  17249. }
  17250. int _end_lineno = _token->end_lineno;
  17251. UNUSED(_end_lineno); // Only used by EXTRA macro
  17252. int _end_col_offset = _token->end_col_offset;
  17253. UNUSED(_end_col_offset); // Only used by EXTRA macro
  17254. _res = _PyPegen_collect_call_seqs ( p , a , b , EXTRA );
  17255. if (_res == NULL && PyErr_Occurred()) {
  17256. p->error_indicator = 1;
  17257. p->level--;
  17258. return NULL;
  17259. }
  17260. goto done;
  17261. }
  17262. p->mark = _mark;
  17263. D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
  17264. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]"));
  17265. }
  17266. { // kwargs
  17267. if (p->error_indicator) {
  17268. p->level--;
  17269. return NULL;
  17270. }
  17271. D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs"));
  17272. asdl_seq* a;
  17273. if (
  17274. (a = kwargs_rule(p)) // kwargs
  17275. )
  17276. {
  17277. D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs"));
  17278. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  17279. if (_token == NULL) {
  17280. p->level--;
  17281. return NULL;
  17282. }
  17283. int _end_lineno = _token->end_lineno;
  17284. UNUSED(_end_lineno); // Only used by EXTRA macro
  17285. int _end_col_offset = _token->end_col_offset;
  17286. UNUSED(_end_col_offset); // Only used by EXTRA macro
  17287. _res = _PyAST_Call ( _PyPegen_dummy_name ( p ) , CHECK_NULL_ALLOWED ( asdl_expr_seq* , _PyPegen_seq_extract_starred_exprs ( p , a ) ) , CHECK_NULL_ALLOWED ( asdl_keyword_seq* , _PyPegen_seq_delete_starred_exprs ( p , a ) ) , EXTRA );
  17288. if (_res == NULL && PyErr_Occurred()) {
  17289. p->error_indicator = 1;
  17290. p->level--;
  17291. return NULL;
  17292. }
  17293. goto done;
  17294. }
  17295. p->mark = _mark;
  17296. D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
  17297. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs"));
  17298. }
  17299. _res = NULL;
  17300. done:
  17301. p->level--;
  17302. return _res;
  17303. }
  17304. // kwargs:
  17305. // | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
  17306. // | ','.kwarg_or_starred+
  17307. // | ','.kwarg_or_double_starred+
  17308. static asdl_seq*
  17309. kwargs_rule(Parser *p)
  17310. {
  17311. if (p->level++ == MAXSTACK) {
  17312. _Pypegen_stack_overflow(p);
  17313. }
  17314. if (p->error_indicator) {
  17315. p->level--;
  17316. return NULL;
  17317. }
  17318. asdl_seq* _res = NULL;
  17319. int _mark = p->mark;
  17320. { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
  17321. if (p->error_indicator) {
  17322. p->level--;
  17323. return NULL;
  17324. }
  17325. D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
  17326. Token * _literal;
  17327. asdl_seq * a;
  17328. asdl_seq * b;
  17329. if (
  17330. (a = _gather_126_rule(p)) // ','.kwarg_or_starred+
  17331. &&
  17332. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  17333. &&
  17334. (b = _gather_128_rule(p)) // ','.kwarg_or_double_starred+
  17335. )
  17336. {
  17337. D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
  17338. _res = _PyPegen_join_sequences ( p , a , b );
  17339. if (_res == NULL && PyErr_Occurred()) {
  17340. p->error_indicator = 1;
  17341. p->level--;
  17342. return NULL;
  17343. }
  17344. goto done;
  17345. }
  17346. p->mark = _mark;
  17347. D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
  17348. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
  17349. }
  17350. { // ','.kwarg_or_starred+
  17351. if (p->error_indicator) {
  17352. p->level--;
  17353. return NULL;
  17354. }
  17355. D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
  17356. asdl_seq * _gather_130_var;
  17357. if (
  17358. (_gather_130_var = _gather_130_rule(p)) // ','.kwarg_or_starred+
  17359. )
  17360. {
  17361. D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
  17362. _res = _gather_130_var;
  17363. goto done;
  17364. }
  17365. p->mark = _mark;
  17366. D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
  17367. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+"));
  17368. }
  17369. { // ','.kwarg_or_double_starred+
  17370. if (p->error_indicator) {
  17371. p->level--;
  17372. return NULL;
  17373. }
  17374. D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
  17375. asdl_seq * _gather_132_var;
  17376. if (
  17377. (_gather_132_var = _gather_132_rule(p)) // ','.kwarg_or_double_starred+
  17378. )
  17379. {
  17380. D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
  17381. _res = _gather_132_var;
  17382. goto done;
  17383. }
  17384. p->mark = _mark;
  17385. D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
  17386. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+"));
  17387. }
  17388. _res = NULL;
  17389. done:
  17390. p->level--;
  17391. return _res;
  17392. }
  17393. // starred_expression: invalid_starred_expression | '*' expression | '*'
  17394. static expr_ty
  17395. starred_expression_rule(Parser *p)
  17396. {
  17397. if (p->level++ == MAXSTACK) {
  17398. _Pypegen_stack_overflow(p);
  17399. }
  17400. if (p->error_indicator) {
  17401. p->level--;
  17402. return NULL;
  17403. }
  17404. expr_ty _res = NULL;
  17405. int _mark = p->mark;
  17406. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  17407. p->error_indicator = 1;
  17408. p->level--;
  17409. return NULL;
  17410. }
  17411. int _start_lineno = p->tokens[_mark]->lineno;
  17412. UNUSED(_start_lineno); // Only used by EXTRA macro
  17413. int _start_col_offset = p->tokens[_mark]->col_offset;
  17414. UNUSED(_start_col_offset); // Only used by EXTRA macro
  17415. if (p->call_invalid_rules) { // invalid_starred_expression
  17416. if (p->error_indicator) {
  17417. p->level--;
  17418. return NULL;
  17419. }
  17420. D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_starred_expression"));
  17421. void *invalid_starred_expression_var;
  17422. if (
  17423. (invalid_starred_expression_var = invalid_starred_expression_rule(p)) // invalid_starred_expression
  17424. )
  17425. {
  17426. D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_starred_expression"));
  17427. _res = invalid_starred_expression_var;
  17428. goto done;
  17429. }
  17430. p->mark = _mark;
  17431. D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
  17432. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_starred_expression"));
  17433. }
  17434. { // '*' expression
  17435. if (p->error_indicator) {
  17436. p->level--;
  17437. return NULL;
  17438. }
  17439. D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
  17440. Token * _literal;
  17441. expr_ty a;
  17442. if (
  17443. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  17444. &&
  17445. (a = expression_rule(p)) // expression
  17446. )
  17447. {
  17448. D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
  17449. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  17450. if (_token == NULL) {
  17451. p->level--;
  17452. return NULL;
  17453. }
  17454. int _end_lineno = _token->end_lineno;
  17455. UNUSED(_end_lineno); // Only used by EXTRA macro
  17456. int _end_col_offset = _token->end_col_offset;
  17457. UNUSED(_end_col_offset); // Only used by EXTRA macro
  17458. _res = _PyAST_Starred ( a , Load , EXTRA );
  17459. if (_res == NULL && PyErr_Occurred()) {
  17460. p->error_indicator = 1;
  17461. p->level--;
  17462. return NULL;
  17463. }
  17464. goto done;
  17465. }
  17466. p->mark = _mark;
  17467. D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
  17468. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
  17469. }
  17470. { // '*'
  17471. if (p->error_indicator) {
  17472. p->level--;
  17473. return NULL;
  17474. }
  17475. D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'"));
  17476. Token * _literal;
  17477. if (
  17478. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  17479. )
  17480. {
  17481. D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
  17482. _res = RAISE_SYNTAX_ERROR ( "Invalid star expression" );
  17483. if (_res == NULL && PyErr_Occurred()) {
  17484. p->error_indicator = 1;
  17485. p->level--;
  17486. return NULL;
  17487. }
  17488. goto done;
  17489. }
  17490. p->mark = _mark;
  17491. D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
  17492. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'"));
  17493. }
  17494. _res = NULL;
  17495. done:
  17496. p->level--;
  17497. return _res;
  17498. }
  17499. // kwarg_or_starred: invalid_kwarg | NAME '=' expression | starred_expression
  17500. static KeywordOrStarred*
  17501. kwarg_or_starred_rule(Parser *p)
  17502. {
  17503. if (p->level++ == MAXSTACK) {
  17504. _Pypegen_stack_overflow(p);
  17505. }
  17506. if (p->error_indicator) {
  17507. p->level--;
  17508. return NULL;
  17509. }
  17510. KeywordOrStarred* _res = NULL;
  17511. int _mark = p->mark;
  17512. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  17513. p->error_indicator = 1;
  17514. p->level--;
  17515. return NULL;
  17516. }
  17517. int _start_lineno = p->tokens[_mark]->lineno;
  17518. UNUSED(_start_lineno); // Only used by EXTRA macro
  17519. int _start_col_offset = p->tokens[_mark]->col_offset;
  17520. UNUSED(_start_col_offset); // Only used by EXTRA macro
  17521. if (p->call_invalid_rules) { // invalid_kwarg
  17522. if (p->error_indicator) {
  17523. p->level--;
  17524. return NULL;
  17525. }
  17526. D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
  17527. void *invalid_kwarg_var;
  17528. if (
  17529. (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
  17530. )
  17531. {
  17532. D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
  17533. _res = invalid_kwarg_var;
  17534. goto done;
  17535. }
  17536. p->mark = _mark;
  17537. D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
  17538. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
  17539. }
  17540. { // NAME '=' expression
  17541. if (p->error_indicator) {
  17542. p->level--;
  17543. return NULL;
  17544. }
  17545. D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
  17546. Token * _literal;
  17547. expr_ty a;
  17548. expr_ty b;
  17549. if (
  17550. (a = _PyPegen_name_token(p)) // NAME
  17551. &&
  17552. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  17553. &&
  17554. (b = expression_rule(p)) // expression
  17555. )
  17556. {
  17557. D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
  17558. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  17559. if (_token == NULL) {
  17560. p->level--;
  17561. return NULL;
  17562. }
  17563. int _end_lineno = _token->end_lineno;
  17564. UNUSED(_end_lineno); // Only used by EXTRA macro
  17565. int _end_col_offset = _token->end_col_offset;
  17566. UNUSED(_end_col_offset); // Only used by EXTRA macro
  17567. _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
  17568. if (_res == NULL && PyErr_Occurred()) {
  17569. p->error_indicator = 1;
  17570. p->level--;
  17571. return NULL;
  17572. }
  17573. goto done;
  17574. }
  17575. p->mark = _mark;
  17576. D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
  17577. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
  17578. }
  17579. { // starred_expression
  17580. if (p->error_indicator) {
  17581. p->level--;
  17582. return NULL;
  17583. }
  17584. D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
  17585. expr_ty a;
  17586. if (
  17587. (a = starred_expression_rule(p)) // starred_expression
  17588. )
  17589. {
  17590. D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
  17591. _res = _PyPegen_keyword_or_starred ( p , a , 0 );
  17592. if (_res == NULL && PyErr_Occurred()) {
  17593. p->error_indicator = 1;
  17594. p->level--;
  17595. return NULL;
  17596. }
  17597. goto done;
  17598. }
  17599. p->mark = _mark;
  17600. D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
  17601. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
  17602. }
  17603. _res = NULL;
  17604. done:
  17605. p->level--;
  17606. return _res;
  17607. }
  17608. // kwarg_or_double_starred: invalid_kwarg | NAME '=' expression | '**' expression
  17609. static KeywordOrStarred*
  17610. kwarg_or_double_starred_rule(Parser *p)
  17611. {
  17612. if (p->level++ == MAXSTACK) {
  17613. _Pypegen_stack_overflow(p);
  17614. }
  17615. if (p->error_indicator) {
  17616. p->level--;
  17617. return NULL;
  17618. }
  17619. KeywordOrStarred* _res = NULL;
  17620. int _mark = p->mark;
  17621. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  17622. p->error_indicator = 1;
  17623. p->level--;
  17624. return NULL;
  17625. }
  17626. int _start_lineno = p->tokens[_mark]->lineno;
  17627. UNUSED(_start_lineno); // Only used by EXTRA macro
  17628. int _start_col_offset = p->tokens[_mark]->col_offset;
  17629. UNUSED(_start_col_offset); // Only used by EXTRA macro
  17630. if (p->call_invalid_rules) { // invalid_kwarg
  17631. if (p->error_indicator) {
  17632. p->level--;
  17633. return NULL;
  17634. }
  17635. D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
  17636. void *invalid_kwarg_var;
  17637. if (
  17638. (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
  17639. )
  17640. {
  17641. D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
  17642. _res = invalid_kwarg_var;
  17643. goto done;
  17644. }
  17645. p->mark = _mark;
  17646. D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
  17647. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
  17648. }
  17649. { // NAME '=' expression
  17650. if (p->error_indicator) {
  17651. p->level--;
  17652. return NULL;
  17653. }
  17654. D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
  17655. Token * _literal;
  17656. expr_ty a;
  17657. expr_ty b;
  17658. if (
  17659. (a = _PyPegen_name_token(p)) // NAME
  17660. &&
  17661. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  17662. &&
  17663. (b = expression_rule(p)) // expression
  17664. )
  17665. {
  17666. D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
  17667. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  17668. if (_token == NULL) {
  17669. p->level--;
  17670. return NULL;
  17671. }
  17672. int _end_lineno = _token->end_lineno;
  17673. UNUSED(_end_lineno); // Only used by EXTRA macro
  17674. int _end_col_offset = _token->end_col_offset;
  17675. UNUSED(_end_col_offset); // Only used by EXTRA macro
  17676. _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
  17677. if (_res == NULL && PyErr_Occurred()) {
  17678. p->error_indicator = 1;
  17679. p->level--;
  17680. return NULL;
  17681. }
  17682. goto done;
  17683. }
  17684. p->mark = _mark;
  17685. D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
  17686. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
  17687. }
  17688. { // '**' expression
  17689. if (p->error_indicator) {
  17690. p->level--;
  17691. return NULL;
  17692. }
  17693. D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
  17694. Token * _literal;
  17695. expr_ty a;
  17696. if (
  17697. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  17698. &&
  17699. (a = expression_rule(p)) // expression
  17700. )
  17701. {
  17702. D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
  17703. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  17704. if (_token == NULL) {
  17705. p->level--;
  17706. return NULL;
  17707. }
  17708. int _end_lineno = _token->end_lineno;
  17709. UNUSED(_end_lineno); // Only used by EXTRA macro
  17710. int _end_col_offset = _token->end_col_offset;
  17711. UNUSED(_end_col_offset); // Only used by EXTRA macro
  17712. _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( NULL , a , EXTRA ) ) , 1 );
  17713. if (_res == NULL && PyErr_Occurred()) {
  17714. p->error_indicator = 1;
  17715. p->level--;
  17716. return NULL;
  17717. }
  17718. goto done;
  17719. }
  17720. p->mark = _mark;
  17721. D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
  17722. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
  17723. }
  17724. _res = NULL;
  17725. done:
  17726. p->level--;
  17727. return _res;
  17728. }
  17729. // star_targets: star_target !',' | star_target ((',' star_target))* ','?
  17730. static expr_ty
  17731. star_targets_rule(Parser *p)
  17732. {
  17733. if (p->level++ == MAXSTACK) {
  17734. _Pypegen_stack_overflow(p);
  17735. }
  17736. if (p->error_indicator) {
  17737. p->level--;
  17738. return NULL;
  17739. }
  17740. expr_ty _res = NULL;
  17741. int _mark = p->mark;
  17742. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  17743. p->error_indicator = 1;
  17744. p->level--;
  17745. return NULL;
  17746. }
  17747. int _start_lineno = p->tokens[_mark]->lineno;
  17748. UNUSED(_start_lineno); // Only used by EXTRA macro
  17749. int _start_col_offset = p->tokens[_mark]->col_offset;
  17750. UNUSED(_start_col_offset); // Only used by EXTRA macro
  17751. { // star_target !','
  17752. if (p->error_indicator) {
  17753. p->level--;
  17754. return NULL;
  17755. }
  17756. D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','"));
  17757. expr_ty a;
  17758. if (
  17759. (a = star_target_rule(p)) // star_target
  17760. &&
  17761. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
  17762. )
  17763. {
  17764. D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','"));
  17765. _res = a;
  17766. if (_res == NULL && PyErr_Occurred()) {
  17767. p->error_indicator = 1;
  17768. p->level--;
  17769. return NULL;
  17770. }
  17771. goto done;
  17772. }
  17773. p->mark = _mark;
  17774. D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
  17775. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','"));
  17776. }
  17777. { // star_target ((',' star_target))* ','?
  17778. if (p->error_indicator) {
  17779. p->level--;
  17780. return NULL;
  17781. }
  17782. D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
  17783. void *_opt_var;
  17784. UNUSED(_opt_var); // Silence compiler warnings
  17785. expr_ty a;
  17786. asdl_seq * b;
  17787. if (
  17788. (a = star_target_rule(p)) // star_target
  17789. &&
  17790. (b = _loop0_134_rule(p)) // ((',' star_target))*
  17791. &&
  17792. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  17793. )
  17794. {
  17795. D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
  17796. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  17797. if (_token == NULL) {
  17798. p->level--;
  17799. return NULL;
  17800. }
  17801. int _end_lineno = _token->end_lineno;
  17802. UNUSED(_end_lineno); // Only used by EXTRA macro
  17803. int _end_col_offset = _token->end_col_offset;
  17804. UNUSED(_end_col_offset); // Only used by EXTRA macro
  17805. _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA );
  17806. if (_res == NULL && PyErr_Occurred()) {
  17807. p->error_indicator = 1;
  17808. p->level--;
  17809. return NULL;
  17810. }
  17811. goto done;
  17812. }
  17813. p->mark = _mark;
  17814. D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
  17815. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?"));
  17816. }
  17817. _res = NULL;
  17818. done:
  17819. p->level--;
  17820. return _res;
  17821. }
  17822. // star_targets_list_seq: ','.star_target+ ','?
  17823. static asdl_expr_seq*
  17824. star_targets_list_seq_rule(Parser *p)
  17825. {
  17826. if (p->level++ == MAXSTACK) {
  17827. _Pypegen_stack_overflow(p);
  17828. }
  17829. if (p->error_indicator) {
  17830. p->level--;
  17831. return NULL;
  17832. }
  17833. asdl_expr_seq* _res = NULL;
  17834. int _mark = p->mark;
  17835. { // ','.star_target+ ','?
  17836. if (p->error_indicator) {
  17837. p->level--;
  17838. return NULL;
  17839. }
  17840. D(fprintf(stderr, "%*c> star_targets_list_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
  17841. void *_opt_var;
  17842. UNUSED(_opt_var); // Silence compiler warnings
  17843. asdl_expr_seq* a;
  17844. if (
  17845. (a = (asdl_expr_seq*)_gather_135_rule(p)) // ','.star_target+
  17846. &&
  17847. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  17848. )
  17849. {
  17850. D(fprintf(stderr, "%*c+ star_targets_list_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
  17851. _res = a;
  17852. if (_res == NULL && PyErr_Occurred()) {
  17853. p->error_indicator = 1;
  17854. p->level--;
  17855. return NULL;
  17856. }
  17857. goto done;
  17858. }
  17859. p->mark = _mark;
  17860. D(fprintf(stderr, "%*c%s star_targets_list_seq[%d-%d]: %s failed!\n", p->level, ' ',
  17861. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?"));
  17862. }
  17863. _res = NULL;
  17864. done:
  17865. p->level--;
  17866. return _res;
  17867. }
  17868. // star_targets_tuple_seq: star_target ((',' star_target))+ ','? | star_target ','
  17869. static asdl_expr_seq*
  17870. star_targets_tuple_seq_rule(Parser *p)
  17871. {
  17872. if (p->level++ == MAXSTACK) {
  17873. _Pypegen_stack_overflow(p);
  17874. }
  17875. if (p->error_indicator) {
  17876. p->level--;
  17877. return NULL;
  17878. }
  17879. asdl_expr_seq* _res = NULL;
  17880. int _mark = p->mark;
  17881. { // star_target ((',' star_target))+ ','?
  17882. if (p->error_indicator) {
  17883. p->level--;
  17884. return NULL;
  17885. }
  17886. D(fprintf(stderr, "%*c> star_targets_tuple_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))+ ','?"));
  17887. void *_opt_var;
  17888. UNUSED(_opt_var); // Silence compiler warnings
  17889. expr_ty a;
  17890. asdl_seq * b;
  17891. if (
  17892. (a = star_target_rule(p)) // star_target
  17893. &&
  17894. (b = _loop1_137_rule(p)) // ((',' star_target))+
  17895. &&
  17896. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  17897. )
  17898. {
  17899. D(fprintf(stderr, "%*c+ star_targets_tuple_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))+ ','?"));
  17900. _res = ( asdl_expr_seq* ) _PyPegen_seq_insert_in_front ( p , a , b );
  17901. if (_res == NULL && PyErr_Occurred()) {
  17902. p->error_indicator = 1;
  17903. p->level--;
  17904. return NULL;
  17905. }
  17906. goto done;
  17907. }
  17908. p->mark = _mark;
  17909. D(fprintf(stderr, "%*c%s star_targets_tuple_seq[%d-%d]: %s failed!\n", p->level, ' ',
  17910. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))+ ','?"));
  17911. }
  17912. { // star_target ','
  17913. if (p->error_indicator) {
  17914. p->level--;
  17915. return NULL;
  17916. }
  17917. D(fprintf(stderr, "%*c> star_targets_tuple_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ','"));
  17918. Token * _literal;
  17919. expr_ty a;
  17920. if (
  17921. (a = star_target_rule(p)) // star_target
  17922. &&
  17923. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  17924. )
  17925. {
  17926. D(fprintf(stderr, "%*c+ star_targets_tuple_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ','"));
  17927. _res = ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , a );
  17928. if (_res == NULL && PyErr_Occurred()) {
  17929. p->error_indicator = 1;
  17930. p->level--;
  17931. return NULL;
  17932. }
  17933. goto done;
  17934. }
  17935. p->mark = _mark;
  17936. D(fprintf(stderr, "%*c%s star_targets_tuple_seq[%d-%d]: %s failed!\n", p->level, ' ',
  17937. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ','"));
  17938. }
  17939. _res = NULL;
  17940. done:
  17941. p->level--;
  17942. return _res;
  17943. }
  17944. // star_target: '*' (!'*' star_target) | target_with_star_atom
  17945. static expr_ty
  17946. star_target_rule(Parser *p)
  17947. {
  17948. if (p->level++ == MAXSTACK) {
  17949. _Pypegen_stack_overflow(p);
  17950. }
  17951. if (p->error_indicator) {
  17952. p->level--;
  17953. return NULL;
  17954. }
  17955. expr_ty _res = NULL;
  17956. if (_PyPegen_is_memoized(p, star_target_type, &_res)) {
  17957. p->level--;
  17958. return _res;
  17959. }
  17960. int _mark = p->mark;
  17961. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  17962. p->error_indicator = 1;
  17963. p->level--;
  17964. return NULL;
  17965. }
  17966. int _start_lineno = p->tokens[_mark]->lineno;
  17967. UNUSED(_start_lineno); // Only used by EXTRA macro
  17968. int _start_col_offset = p->tokens[_mark]->col_offset;
  17969. UNUSED(_start_col_offset); // Only used by EXTRA macro
  17970. { // '*' (!'*' star_target)
  17971. if (p->error_indicator) {
  17972. p->level--;
  17973. return NULL;
  17974. }
  17975. D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
  17976. Token * _literal;
  17977. void *a;
  17978. if (
  17979. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  17980. &&
  17981. (a = _tmp_138_rule(p)) // !'*' star_target
  17982. )
  17983. {
  17984. D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
  17985. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  17986. if (_token == NULL) {
  17987. p->level--;
  17988. return NULL;
  17989. }
  17990. int _end_lineno = _token->end_lineno;
  17991. UNUSED(_end_lineno); // Only used by EXTRA macro
  17992. int _end_col_offset = _token->end_col_offset;
  17993. UNUSED(_end_col_offset); // Only used by EXTRA macro
  17994. _res = _PyAST_Starred ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA );
  17995. if (_res == NULL && PyErr_Occurred()) {
  17996. p->error_indicator = 1;
  17997. p->level--;
  17998. return NULL;
  17999. }
  18000. goto done;
  18001. }
  18002. p->mark = _mark;
  18003. D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
  18004. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)"));
  18005. }
  18006. { // target_with_star_atom
  18007. if (p->error_indicator) {
  18008. p->level--;
  18009. return NULL;
  18010. }
  18011. D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target_with_star_atom"));
  18012. expr_ty target_with_star_atom_var;
  18013. if (
  18014. (target_with_star_atom_var = target_with_star_atom_rule(p)) // target_with_star_atom
  18015. )
  18016. {
  18017. D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target_with_star_atom"));
  18018. _res = target_with_star_atom_var;
  18019. goto done;
  18020. }
  18021. p->mark = _mark;
  18022. D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
  18023. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target_with_star_atom"));
  18024. }
  18025. _res = NULL;
  18026. done:
  18027. _PyPegen_insert_memo(p, _mark, star_target_type, _res);
  18028. p->level--;
  18029. return _res;
  18030. }
  18031. // target_with_star_atom:
  18032. // | t_primary '.' NAME !t_lookahead
  18033. // | t_primary '[' slices ']' !t_lookahead
  18034. // | star_atom
  18035. static expr_ty
  18036. target_with_star_atom_rule(Parser *p)
  18037. {
  18038. if (p->level++ == MAXSTACK) {
  18039. _Pypegen_stack_overflow(p);
  18040. }
  18041. if (p->error_indicator) {
  18042. p->level--;
  18043. return NULL;
  18044. }
  18045. expr_ty _res = NULL;
  18046. if (_PyPegen_is_memoized(p, target_with_star_atom_type, &_res)) {
  18047. p->level--;
  18048. return _res;
  18049. }
  18050. int _mark = p->mark;
  18051. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  18052. p->error_indicator = 1;
  18053. p->level--;
  18054. return NULL;
  18055. }
  18056. int _start_lineno = p->tokens[_mark]->lineno;
  18057. UNUSED(_start_lineno); // Only used by EXTRA macro
  18058. int _start_col_offset = p->tokens[_mark]->col_offset;
  18059. UNUSED(_start_col_offset); // Only used by EXTRA macro
  18060. { // t_primary '.' NAME !t_lookahead
  18061. if (p->error_indicator) {
  18062. p->level--;
  18063. return NULL;
  18064. }
  18065. D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
  18066. Token * _literal;
  18067. expr_ty a;
  18068. expr_ty b;
  18069. if (
  18070. (a = t_primary_rule(p)) // t_primary
  18071. &&
  18072. (_literal = _PyPegen_expect_token(p, 23)) // token='.'
  18073. &&
  18074. (b = _PyPegen_name_token(p)) // NAME
  18075. &&
  18076. _PyPegen_lookahead(0, t_lookahead_rule, p)
  18077. )
  18078. {
  18079. D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
  18080. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  18081. if (_token == NULL) {
  18082. p->level--;
  18083. return NULL;
  18084. }
  18085. int _end_lineno = _token->end_lineno;
  18086. UNUSED(_end_lineno); // Only used by EXTRA macro
  18087. int _end_col_offset = _token->end_col_offset;
  18088. UNUSED(_end_col_offset); // Only used by EXTRA macro
  18089. _res = _PyAST_Attribute ( a , b -> v . Name . id , Store , EXTRA );
  18090. if (_res == NULL && PyErr_Occurred()) {
  18091. p->error_indicator = 1;
  18092. p->level--;
  18093. return NULL;
  18094. }
  18095. goto done;
  18096. }
  18097. p->mark = _mark;
  18098. D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n", p->level, ' ',
  18099. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
  18100. }
  18101. { // t_primary '[' slices ']' !t_lookahead
  18102. if (p->error_indicator) {
  18103. p->level--;
  18104. return NULL;
  18105. }
  18106. D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
  18107. Token * _literal;
  18108. Token * _literal_1;
  18109. expr_ty a;
  18110. expr_ty b;
  18111. if (
  18112. (a = t_primary_rule(p)) // t_primary
  18113. &&
  18114. (_literal = _PyPegen_expect_token(p, 9)) // token='['
  18115. &&
  18116. (b = slices_rule(p)) // slices
  18117. &&
  18118. (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
  18119. &&
  18120. _PyPegen_lookahead(0, t_lookahead_rule, p)
  18121. )
  18122. {
  18123. D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
  18124. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  18125. if (_token == NULL) {
  18126. p->level--;
  18127. return NULL;
  18128. }
  18129. int _end_lineno = _token->end_lineno;
  18130. UNUSED(_end_lineno); // Only used by EXTRA macro
  18131. int _end_col_offset = _token->end_col_offset;
  18132. UNUSED(_end_col_offset); // Only used by EXTRA macro
  18133. _res = _PyAST_Subscript ( a , b , Store , EXTRA );
  18134. if (_res == NULL && PyErr_Occurred()) {
  18135. p->error_indicator = 1;
  18136. p->level--;
  18137. return NULL;
  18138. }
  18139. goto done;
  18140. }
  18141. p->mark = _mark;
  18142. D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n", p->level, ' ',
  18143. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
  18144. }
  18145. { // star_atom
  18146. if (p->error_indicator) {
  18147. p->level--;
  18148. return NULL;
  18149. }
  18150. D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_atom"));
  18151. expr_ty star_atom_var;
  18152. if (
  18153. (star_atom_var = star_atom_rule(p)) // star_atom
  18154. )
  18155. {
  18156. D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_atom"));
  18157. _res = star_atom_var;
  18158. goto done;
  18159. }
  18160. p->mark = _mark;
  18161. D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n", p->level, ' ',
  18162. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom"));
  18163. }
  18164. _res = NULL;
  18165. done:
  18166. _PyPegen_insert_memo(p, _mark, target_with_star_atom_type, _res);
  18167. p->level--;
  18168. return _res;
  18169. }
  18170. // star_atom:
  18171. // | NAME
  18172. // | '(' target_with_star_atom ')'
  18173. // | '(' star_targets_tuple_seq? ')'
  18174. // | '[' star_targets_list_seq? ']'
  18175. static expr_ty
  18176. star_atom_rule(Parser *p)
  18177. {
  18178. if (p->level++ == MAXSTACK) {
  18179. _Pypegen_stack_overflow(p);
  18180. }
  18181. if (p->error_indicator) {
  18182. p->level--;
  18183. return NULL;
  18184. }
  18185. expr_ty _res = NULL;
  18186. int _mark = p->mark;
  18187. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  18188. p->error_indicator = 1;
  18189. p->level--;
  18190. return NULL;
  18191. }
  18192. int _start_lineno = p->tokens[_mark]->lineno;
  18193. UNUSED(_start_lineno); // Only used by EXTRA macro
  18194. int _start_col_offset = p->tokens[_mark]->col_offset;
  18195. UNUSED(_start_col_offset); // Only used by EXTRA macro
  18196. { // NAME
  18197. if (p->error_indicator) {
  18198. p->level--;
  18199. return NULL;
  18200. }
  18201. D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
  18202. expr_ty a;
  18203. if (
  18204. (a = _PyPegen_name_token(p)) // NAME
  18205. )
  18206. {
  18207. D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
  18208. _res = _PyPegen_set_expr_context ( p , a , Store );
  18209. if (_res == NULL && PyErr_Occurred()) {
  18210. p->error_indicator = 1;
  18211. p->level--;
  18212. return NULL;
  18213. }
  18214. goto done;
  18215. }
  18216. p->mark = _mark;
  18217. D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
  18218. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
  18219. }
  18220. { // '(' target_with_star_atom ')'
  18221. if (p->error_indicator) {
  18222. p->level--;
  18223. return NULL;
  18224. }
  18225. D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target_with_star_atom ')'"));
  18226. Token * _literal;
  18227. Token * _literal_1;
  18228. expr_ty a;
  18229. if (
  18230. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  18231. &&
  18232. (a = target_with_star_atom_rule(p)) // target_with_star_atom
  18233. &&
  18234. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  18235. )
  18236. {
  18237. D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target_with_star_atom ')'"));
  18238. _res = _PyPegen_set_expr_context ( p , a , Store );
  18239. if (_res == NULL && PyErr_Occurred()) {
  18240. p->error_indicator = 1;
  18241. p->level--;
  18242. return NULL;
  18243. }
  18244. goto done;
  18245. }
  18246. p->mark = _mark;
  18247. D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
  18248. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target_with_star_atom ')'"));
  18249. }
  18250. { // '(' star_targets_tuple_seq? ')'
  18251. if (p->error_indicator) {
  18252. p->level--;
  18253. return NULL;
  18254. }
  18255. D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_targets_tuple_seq? ')'"));
  18256. Token * _literal;
  18257. Token * _literal_1;
  18258. void *a;
  18259. if (
  18260. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  18261. &&
  18262. (a = star_targets_tuple_seq_rule(p), !p->error_indicator) // star_targets_tuple_seq?
  18263. &&
  18264. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  18265. )
  18266. {
  18267. D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_targets_tuple_seq? ')'"));
  18268. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  18269. if (_token == NULL) {
  18270. p->level--;
  18271. return NULL;
  18272. }
  18273. int _end_lineno = _token->end_lineno;
  18274. UNUSED(_end_lineno); // Only used by EXTRA macro
  18275. int _end_col_offset = _token->end_col_offset;
  18276. UNUSED(_end_col_offset); // Only used by EXTRA macro
  18277. _res = _PyAST_Tuple ( a , Store , EXTRA );
  18278. if (_res == NULL && PyErr_Occurred()) {
  18279. p->error_indicator = 1;
  18280. p->level--;
  18281. return NULL;
  18282. }
  18283. goto done;
  18284. }
  18285. p->mark = _mark;
  18286. D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
  18287. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_tuple_seq? ')'"));
  18288. }
  18289. { // '[' star_targets_list_seq? ']'
  18290. if (p->error_indicator) {
  18291. p->level--;
  18292. return NULL;
  18293. }
  18294. D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_targets_list_seq? ']'"));
  18295. Token * _literal;
  18296. Token * _literal_1;
  18297. void *a;
  18298. if (
  18299. (_literal = _PyPegen_expect_token(p, 9)) // token='['
  18300. &&
  18301. (a = star_targets_list_seq_rule(p), !p->error_indicator) // star_targets_list_seq?
  18302. &&
  18303. (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
  18304. )
  18305. {
  18306. D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_targets_list_seq? ']'"));
  18307. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  18308. if (_token == NULL) {
  18309. p->level--;
  18310. return NULL;
  18311. }
  18312. int _end_lineno = _token->end_lineno;
  18313. UNUSED(_end_lineno); // Only used by EXTRA macro
  18314. int _end_col_offset = _token->end_col_offset;
  18315. UNUSED(_end_col_offset); // Only used by EXTRA macro
  18316. _res = _PyAST_List ( a , Store , EXTRA );
  18317. if (_res == NULL && PyErr_Occurred()) {
  18318. p->error_indicator = 1;
  18319. p->level--;
  18320. return NULL;
  18321. }
  18322. goto done;
  18323. }
  18324. p->mark = _mark;
  18325. D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
  18326. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_list_seq? ']'"));
  18327. }
  18328. _res = NULL;
  18329. done:
  18330. p->level--;
  18331. return _res;
  18332. }
  18333. // single_target: single_subscript_attribute_target | NAME | '(' single_target ')'
  18334. static expr_ty
  18335. single_target_rule(Parser *p)
  18336. {
  18337. if (p->level++ == MAXSTACK) {
  18338. _Pypegen_stack_overflow(p);
  18339. }
  18340. if (p->error_indicator) {
  18341. p->level--;
  18342. return NULL;
  18343. }
  18344. expr_ty _res = NULL;
  18345. int _mark = p->mark;
  18346. { // single_subscript_attribute_target
  18347. if (p->error_indicator) {
  18348. p->level--;
  18349. return NULL;
  18350. }
  18351. D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
  18352. expr_ty single_subscript_attribute_target_var;
  18353. if (
  18354. (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
  18355. )
  18356. {
  18357. D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
  18358. _res = single_subscript_attribute_target_var;
  18359. goto done;
  18360. }
  18361. p->mark = _mark;
  18362. D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
  18363. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
  18364. }
  18365. { // NAME
  18366. if (p->error_indicator) {
  18367. p->level--;
  18368. return NULL;
  18369. }
  18370. D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
  18371. expr_ty a;
  18372. if (
  18373. (a = _PyPegen_name_token(p)) // NAME
  18374. )
  18375. {
  18376. D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
  18377. _res = _PyPegen_set_expr_context ( p , a , Store );
  18378. if (_res == NULL && PyErr_Occurred()) {
  18379. p->error_indicator = 1;
  18380. p->level--;
  18381. return NULL;
  18382. }
  18383. goto done;
  18384. }
  18385. p->mark = _mark;
  18386. D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
  18387. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
  18388. }
  18389. { // '(' single_target ')'
  18390. if (p->error_indicator) {
  18391. p->level--;
  18392. return NULL;
  18393. }
  18394. D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
  18395. Token * _literal;
  18396. Token * _literal_1;
  18397. expr_ty a;
  18398. if (
  18399. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  18400. &&
  18401. (a = single_target_rule(p)) // single_target
  18402. &&
  18403. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  18404. )
  18405. {
  18406. D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
  18407. _res = a;
  18408. if (_res == NULL && PyErr_Occurred()) {
  18409. p->error_indicator = 1;
  18410. p->level--;
  18411. return NULL;
  18412. }
  18413. goto done;
  18414. }
  18415. p->mark = _mark;
  18416. D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
  18417. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
  18418. }
  18419. _res = NULL;
  18420. done:
  18421. p->level--;
  18422. return _res;
  18423. }
  18424. // single_subscript_attribute_target:
  18425. // | t_primary '.' NAME !t_lookahead
  18426. // | t_primary '[' slices ']' !t_lookahead
  18427. static expr_ty
  18428. single_subscript_attribute_target_rule(Parser *p)
  18429. {
  18430. if (p->level++ == MAXSTACK) {
  18431. _Pypegen_stack_overflow(p);
  18432. }
  18433. if (p->error_indicator) {
  18434. p->level--;
  18435. return NULL;
  18436. }
  18437. expr_ty _res = NULL;
  18438. int _mark = p->mark;
  18439. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  18440. p->error_indicator = 1;
  18441. p->level--;
  18442. return NULL;
  18443. }
  18444. int _start_lineno = p->tokens[_mark]->lineno;
  18445. UNUSED(_start_lineno); // Only used by EXTRA macro
  18446. int _start_col_offset = p->tokens[_mark]->col_offset;
  18447. UNUSED(_start_col_offset); // Only used by EXTRA macro
  18448. { // t_primary '.' NAME !t_lookahead
  18449. if (p->error_indicator) {
  18450. p->level--;
  18451. return NULL;
  18452. }
  18453. D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
  18454. Token * _literal;
  18455. expr_ty a;
  18456. expr_ty b;
  18457. if (
  18458. (a = t_primary_rule(p)) // t_primary
  18459. &&
  18460. (_literal = _PyPegen_expect_token(p, 23)) // token='.'
  18461. &&
  18462. (b = _PyPegen_name_token(p)) // NAME
  18463. &&
  18464. _PyPegen_lookahead(0, t_lookahead_rule, p)
  18465. )
  18466. {
  18467. D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
  18468. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  18469. if (_token == NULL) {
  18470. p->level--;
  18471. return NULL;
  18472. }
  18473. int _end_lineno = _token->end_lineno;
  18474. UNUSED(_end_lineno); // Only used by EXTRA macro
  18475. int _end_col_offset = _token->end_col_offset;
  18476. UNUSED(_end_col_offset); // Only used by EXTRA macro
  18477. _res = _PyAST_Attribute ( a , b -> v . Name . id , Store , EXTRA );
  18478. if (_res == NULL && PyErr_Occurred()) {
  18479. p->error_indicator = 1;
  18480. p->level--;
  18481. return NULL;
  18482. }
  18483. goto done;
  18484. }
  18485. p->mark = _mark;
  18486. D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
  18487. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
  18488. }
  18489. { // t_primary '[' slices ']' !t_lookahead
  18490. if (p->error_indicator) {
  18491. p->level--;
  18492. return NULL;
  18493. }
  18494. D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
  18495. Token * _literal;
  18496. Token * _literal_1;
  18497. expr_ty a;
  18498. expr_ty b;
  18499. if (
  18500. (a = t_primary_rule(p)) // t_primary
  18501. &&
  18502. (_literal = _PyPegen_expect_token(p, 9)) // token='['
  18503. &&
  18504. (b = slices_rule(p)) // slices
  18505. &&
  18506. (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
  18507. &&
  18508. _PyPegen_lookahead(0, t_lookahead_rule, p)
  18509. )
  18510. {
  18511. D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
  18512. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  18513. if (_token == NULL) {
  18514. p->level--;
  18515. return NULL;
  18516. }
  18517. int _end_lineno = _token->end_lineno;
  18518. UNUSED(_end_lineno); // Only used by EXTRA macro
  18519. int _end_col_offset = _token->end_col_offset;
  18520. UNUSED(_end_col_offset); // Only used by EXTRA macro
  18521. _res = _PyAST_Subscript ( a , b , Store , EXTRA );
  18522. if (_res == NULL && PyErr_Occurred()) {
  18523. p->error_indicator = 1;
  18524. p->level--;
  18525. return NULL;
  18526. }
  18527. goto done;
  18528. }
  18529. p->mark = _mark;
  18530. D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
  18531. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
  18532. }
  18533. _res = NULL;
  18534. done:
  18535. p->level--;
  18536. return _res;
  18537. }
  18538. // Left-recursive
  18539. // t_primary:
  18540. // | t_primary '.' NAME &t_lookahead
  18541. // | t_primary '[' slices ']' &t_lookahead
  18542. // | t_primary genexp &t_lookahead
  18543. // | t_primary '(' arguments? ')' &t_lookahead
  18544. // | atom &t_lookahead
  18545. static expr_ty t_primary_raw(Parser *);
  18546. static expr_ty
  18547. t_primary_rule(Parser *p)
  18548. {
  18549. if (p->level++ == MAXSTACK) {
  18550. _Pypegen_stack_overflow(p);
  18551. }
  18552. expr_ty _res = NULL;
  18553. if (_PyPegen_is_memoized(p, t_primary_type, &_res)) {
  18554. p->level--;
  18555. return _res;
  18556. }
  18557. int _mark = p->mark;
  18558. int _resmark = p->mark;
  18559. while (1) {
  18560. int tmpvar_9 = _PyPegen_update_memo(p, _mark, t_primary_type, _res);
  18561. if (tmpvar_9) {
  18562. p->level--;
  18563. return _res;
  18564. }
  18565. p->mark = _mark;
  18566. void *_raw = t_primary_raw(p);
  18567. if (p->error_indicator) {
  18568. p->level--;
  18569. return NULL;
  18570. }
  18571. if (_raw == NULL || p->mark <= _resmark)
  18572. break;
  18573. _resmark = p->mark;
  18574. _res = _raw;
  18575. }
  18576. p->mark = _resmark;
  18577. p->level--;
  18578. return _res;
  18579. }
  18580. static expr_ty
  18581. t_primary_raw(Parser *p)
  18582. {
  18583. if (p->level++ == MAXSTACK) {
  18584. _Pypegen_stack_overflow(p);
  18585. }
  18586. if (p->error_indicator) {
  18587. p->level--;
  18588. return NULL;
  18589. }
  18590. expr_ty _res = NULL;
  18591. int _mark = p->mark;
  18592. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  18593. p->error_indicator = 1;
  18594. p->level--;
  18595. return NULL;
  18596. }
  18597. int _start_lineno = p->tokens[_mark]->lineno;
  18598. UNUSED(_start_lineno); // Only used by EXTRA macro
  18599. int _start_col_offset = p->tokens[_mark]->col_offset;
  18600. UNUSED(_start_col_offset); // Only used by EXTRA macro
  18601. { // t_primary '.' NAME &t_lookahead
  18602. if (p->error_indicator) {
  18603. p->level--;
  18604. return NULL;
  18605. }
  18606. D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
  18607. Token * _literal;
  18608. expr_ty a;
  18609. expr_ty b;
  18610. if (
  18611. (a = t_primary_rule(p)) // t_primary
  18612. &&
  18613. (_literal = _PyPegen_expect_token(p, 23)) // token='.'
  18614. &&
  18615. (b = _PyPegen_name_token(p)) // NAME
  18616. &&
  18617. _PyPegen_lookahead(1, t_lookahead_rule, p)
  18618. )
  18619. {
  18620. D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
  18621. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  18622. if (_token == NULL) {
  18623. p->level--;
  18624. return NULL;
  18625. }
  18626. int _end_lineno = _token->end_lineno;
  18627. UNUSED(_end_lineno); // Only used by EXTRA macro
  18628. int _end_col_offset = _token->end_col_offset;
  18629. UNUSED(_end_col_offset); // Only used by EXTRA macro
  18630. _res = _PyAST_Attribute ( a , b -> v . Name . id , Load , EXTRA );
  18631. if (_res == NULL && PyErr_Occurred()) {
  18632. p->error_indicator = 1;
  18633. p->level--;
  18634. return NULL;
  18635. }
  18636. goto done;
  18637. }
  18638. p->mark = _mark;
  18639. D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
  18640. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
  18641. }
  18642. { // t_primary '[' slices ']' &t_lookahead
  18643. if (p->error_indicator) {
  18644. p->level--;
  18645. return NULL;
  18646. }
  18647. D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
  18648. Token * _literal;
  18649. Token * _literal_1;
  18650. expr_ty a;
  18651. expr_ty b;
  18652. if (
  18653. (a = t_primary_rule(p)) // t_primary
  18654. &&
  18655. (_literal = _PyPegen_expect_token(p, 9)) // token='['
  18656. &&
  18657. (b = slices_rule(p)) // slices
  18658. &&
  18659. (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
  18660. &&
  18661. _PyPegen_lookahead(1, t_lookahead_rule, p)
  18662. )
  18663. {
  18664. D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
  18665. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  18666. if (_token == NULL) {
  18667. p->level--;
  18668. return NULL;
  18669. }
  18670. int _end_lineno = _token->end_lineno;
  18671. UNUSED(_end_lineno); // Only used by EXTRA macro
  18672. int _end_col_offset = _token->end_col_offset;
  18673. UNUSED(_end_col_offset); // Only used by EXTRA macro
  18674. _res = _PyAST_Subscript ( a , b , Load , EXTRA );
  18675. if (_res == NULL && PyErr_Occurred()) {
  18676. p->error_indicator = 1;
  18677. p->level--;
  18678. return NULL;
  18679. }
  18680. goto done;
  18681. }
  18682. p->mark = _mark;
  18683. D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
  18684. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
  18685. }
  18686. { // t_primary genexp &t_lookahead
  18687. if (p->error_indicator) {
  18688. p->level--;
  18689. return NULL;
  18690. }
  18691. D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
  18692. expr_ty a;
  18693. expr_ty b;
  18694. if (
  18695. (a = t_primary_rule(p)) // t_primary
  18696. &&
  18697. (b = genexp_rule(p)) // genexp
  18698. &&
  18699. _PyPegen_lookahead(1, t_lookahead_rule, p)
  18700. )
  18701. {
  18702. D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
  18703. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  18704. if (_token == NULL) {
  18705. p->level--;
  18706. return NULL;
  18707. }
  18708. int _end_lineno = _token->end_lineno;
  18709. UNUSED(_end_lineno); // Only used by EXTRA macro
  18710. int _end_col_offset = _token->end_col_offset;
  18711. UNUSED(_end_col_offset); // Only used by EXTRA macro
  18712. _res = _PyAST_Call ( a , CHECK ( asdl_expr_seq* , ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
  18713. if (_res == NULL && PyErr_Occurred()) {
  18714. p->error_indicator = 1;
  18715. p->level--;
  18716. return NULL;
  18717. }
  18718. goto done;
  18719. }
  18720. p->mark = _mark;
  18721. D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
  18722. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead"));
  18723. }
  18724. { // t_primary '(' arguments? ')' &t_lookahead
  18725. if (p->error_indicator) {
  18726. p->level--;
  18727. return NULL;
  18728. }
  18729. D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
  18730. Token * _literal;
  18731. Token * _literal_1;
  18732. expr_ty a;
  18733. void *b;
  18734. if (
  18735. (a = t_primary_rule(p)) // t_primary
  18736. &&
  18737. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  18738. &&
  18739. (b = arguments_rule(p), !p->error_indicator) // arguments?
  18740. &&
  18741. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  18742. &&
  18743. _PyPegen_lookahead(1, t_lookahead_rule, p)
  18744. )
  18745. {
  18746. D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
  18747. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  18748. if (_token == NULL) {
  18749. p->level--;
  18750. return NULL;
  18751. }
  18752. int _end_lineno = _token->end_lineno;
  18753. UNUSED(_end_lineno); // Only used by EXTRA macro
  18754. int _end_col_offset = _token->end_col_offset;
  18755. UNUSED(_end_col_offset); // Only used by EXTRA macro
  18756. _res = _PyAST_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
  18757. if (_res == NULL && PyErr_Occurred()) {
  18758. p->error_indicator = 1;
  18759. p->level--;
  18760. return NULL;
  18761. }
  18762. goto done;
  18763. }
  18764. p->mark = _mark;
  18765. D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
  18766. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
  18767. }
  18768. { // atom &t_lookahead
  18769. if (p->error_indicator) {
  18770. p->level--;
  18771. return NULL;
  18772. }
  18773. D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
  18774. expr_ty a;
  18775. if (
  18776. (a = atom_rule(p)) // atom
  18777. &&
  18778. _PyPegen_lookahead(1, t_lookahead_rule, p)
  18779. )
  18780. {
  18781. D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
  18782. _res = a;
  18783. if (_res == NULL && PyErr_Occurred()) {
  18784. p->error_indicator = 1;
  18785. p->level--;
  18786. return NULL;
  18787. }
  18788. goto done;
  18789. }
  18790. p->mark = _mark;
  18791. D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
  18792. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead"));
  18793. }
  18794. _res = NULL;
  18795. done:
  18796. p->level--;
  18797. return _res;
  18798. }
  18799. // t_lookahead: '(' | '[' | '.'
  18800. static void *
  18801. t_lookahead_rule(Parser *p)
  18802. {
  18803. if (p->level++ == MAXSTACK) {
  18804. _Pypegen_stack_overflow(p);
  18805. }
  18806. if (p->error_indicator) {
  18807. p->level--;
  18808. return NULL;
  18809. }
  18810. void * _res = NULL;
  18811. int _mark = p->mark;
  18812. { // '('
  18813. if (p->error_indicator) {
  18814. p->level--;
  18815. return NULL;
  18816. }
  18817. D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
  18818. Token * _literal;
  18819. if (
  18820. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  18821. )
  18822. {
  18823. D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
  18824. _res = _literal;
  18825. goto done;
  18826. }
  18827. p->mark = _mark;
  18828. D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
  18829. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
  18830. }
  18831. { // '['
  18832. if (p->error_indicator) {
  18833. p->level--;
  18834. return NULL;
  18835. }
  18836. D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
  18837. Token * _literal;
  18838. if (
  18839. (_literal = _PyPegen_expect_token(p, 9)) // token='['
  18840. )
  18841. {
  18842. D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
  18843. _res = _literal;
  18844. goto done;
  18845. }
  18846. p->mark = _mark;
  18847. D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
  18848. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
  18849. }
  18850. { // '.'
  18851. if (p->error_indicator) {
  18852. p->level--;
  18853. return NULL;
  18854. }
  18855. D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
  18856. Token * _literal;
  18857. if (
  18858. (_literal = _PyPegen_expect_token(p, 23)) // token='.'
  18859. )
  18860. {
  18861. D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
  18862. _res = _literal;
  18863. goto done;
  18864. }
  18865. p->mark = _mark;
  18866. D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
  18867. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
  18868. }
  18869. _res = NULL;
  18870. done:
  18871. p->level--;
  18872. return _res;
  18873. }
  18874. // del_targets: ','.del_target+ ','?
  18875. static asdl_expr_seq*
  18876. del_targets_rule(Parser *p)
  18877. {
  18878. if (p->level++ == MAXSTACK) {
  18879. _Pypegen_stack_overflow(p);
  18880. }
  18881. if (p->error_indicator) {
  18882. p->level--;
  18883. return NULL;
  18884. }
  18885. asdl_expr_seq* _res = NULL;
  18886. int _mark = p->mark;
  18887. { // ','.del_target+ ','?
  18888. if (p->error_indicator) {
  18889. p->level--;
  18890. return NULL;
  18891. }
  18892. D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
  18893. void *_opt_var;
  18894. UNUSED(_opt_var); // Silence compiler warnings
  18895. asdl_expr_seq* a;
  18896. if (
  18897. (a = (asdl_expr_seq*)_gather_139_rule(p)) // ','.del_target+
  18898. &&
  18899. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  18900. )
  18901. {
  18902. D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
  18903. _res = a;
  18904. if (_res == NULL && PyErr_Occurred()) {
  18905. p->error_indicator = 1;
  18906. p->level--;
  18907. return NULL;
  18908. }
  18909. goto done;
  18910. }
  18911. p->mark = _mark;
  18912. D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ',
  18913. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?"));
  18914. }
  18915. _res = NULL;
  18916. done:
  18917. p->level--;
  18918. return _res;
  18919. }
  18920. // del_target:
  18921. // | t_primary '.' NAME !t_lookahead
  18922. // | t_primary '[' slices ']' !t_lookahead
  18923. // | del_t_atom
  18924. static expr_ty
  18925. del_target_rule(Parser *p)
  18926. {
  18927. if (p->level++ == MAXSTACK) {
  18928. _Pypegen_stack_overflow(p);
  18929. }
  18930. if (p->error_indicator) {
  18931. p->level--;
  18932. return NULL;
  18933. }
  18934. expr_ty _res = NULL;
  18935. if (_PyPegen_is_memoized(p, del_target_type, &_res)) {
  18936. p->level--;
  18937. return _res;
  18938. }
  18939. int _mark = p->mark;
  18940. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  18941. p->error_indicator = 1;
  18942. p->level--;
  18943. return NULL;
  18944. }
  18945. int _start_lineno = p->tokens[_mark]->lineno;
  18946. UNUSED(_start_lineno); // Only used by EXTRA macro
  18947. int _start_col_offset = p->tokens[_mark]->col_offset;
  18948. UNUSED(_start_col_offset); // Only used by EXTRA macro
  18949. { // t_primary '.' NAME !t_lookahead
  18950. if (p->error_indicator) {
  18951. p->level--;
  18952. return NULL;
  18953. }
  18954. D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
  18955. Token * _literal;
  18956. expr_ty a;
  18957. expr_ty b;
  18958. if (
  18959. (a = t_primary_rule(p)) // t_primary
  18960. &&
  18961. (_literal = _PyPegen_expect_token(p, 23)) // token='.'
  18962. &&
  18963. (b = _PyPegen_name_token(p)) // NAME
  18964. &&
  18965. _PyPegen_lookahead(0, t_lookahead_rule, p)
  18966. )
  18967. {
  18968. D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
  18969. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  18970. if (_token == NULL) {
  18971. p->level--;
  18972. return NULL;
  18973. }
  18974. int _end_lineno = _token->end_lineno;
  18975. UNUSED(_end_lineno); // Only used by EXTRA macro
  18976. int _end_col_offset = _token->end_col_offset;
  18977. UNUSED(_end_col_offset); // Only used by EXTRA macro
  18978. _res = _PyAST_Attribute ( a , b -> v . Name . id , Del , EXTRA );
  18979. if (_res == NULL && PyErr_Occurred()) {
  18980. p->error_indicator = 1;
  18981. p->level--;
  18982. return NULL;
  18983. }
  18984. goto done;
  18985. }
  18986. p->mark = _mark;
  18987. D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
  18988. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
  18989. }
  18990. { // t_primary '[' slices ']' !t_lookahead
  18991. if (p->error_indicator) {
  18992. p->level--;
  18993. return NULL;
  18994. }
  18995. D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
  18996. Token * _literal;
  18997. Token * _literal_1;
  18998. expr_ty a;
  18999. expr_ty b;
  19000. if (
  19001. (a = t_primary_rule(p)) // t_primary
  19002. &&
  19003. (_literal = _PyPegen_expect_token(p, 9)) // token='['
  19004. &&
  19005. (b = slices_rule(p)) // slices
  19006. &&
  19007. (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
  19008. &&
  19009. _PyPegen_lookahead(0, t_lookahead_rule, p)
  19010. )
  19011. {
  19012. D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
  19013. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  19014. if (_token == NULL) {
  19015. p->level--;
  19016. return NULL;
  19017. }
  19018. int _end_lineno = _token->end_lineno;
  19019. UNUSED(_end_lineno); // Only used by EXTRA macro
  19020. int _end_col_offset = _token->end_col_offset;
  19021. UNUSED(_end_col_offset); // Only used by EXTRA macro
  19022. _res = _PyAST_Subscript ( a , b , Del , EXTRA );
  19023. if (_res == NULL && PyErr_Occurred()) {
  19024. p->error_indicator = 1;
  19025. p->level--;
  19026. return NULL;
  19027. }
  19028. goto done;
  19029. }
  19030. p->mark = _mark;
  19031. D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
  19032. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
  19033. }
  19034. { // del_t_atom
  19035. if (p->error_indicator) {
  19036. p->level--;
  19037. return NULL;
  19038. }
  19039. D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
  19040. expr_ty del_t_atom_var;
  19041. if (
  19042. (del_t_atom_var = del_t_atom_rule(p)) // del_t_atom
  19043. )
  19044. {
  19045. D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
  19046. _res = del_t_atom_var;
  19047. goto done;
  19048. }
  19049. p->mark = _mark;
  19050. D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
  19051. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom"));
  19052. }
  19053. _res = NULL;
  19054. done:
  19055. _PyPegen_insert_memo(p, _mark, del_target_type, _res);
  19056. p->level--;
  19057. return _res;
  19058. }
  19059. // del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']'
  19060. static expr_ty
  19061. del_t_atom_rule(Parser *p)
  19062. {
  19063. if (p->level++ == MAXSTACK) {
  19064. _Pypegen_stack_overflow(p);
  19065. }
  19066. if (p->error_indicator) {
  19067. p->level--;
  19068. return NULL;
  19069. }
  19070. expr_ty _res = NULL;
  19071. int _mark = p->mark;
  19072. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  19073. p->error_indicator = 1;
  19074. p->level--;
  19075. return NULL;
  19076. }
  19077. int _start_lineno = p->tokens[_mark]->lineno;
  19078. UNUSED(_start_lineno); // Only used by EXTRA macro
  19079. int _start_col_offset = p->tokens[_mark]->col_offset;
  19080. UNUSED(_start_col_offset); // Only used by EXTRA macro
  19081. { // NAME
  19082. if (p->error_indicator) {
  19083. p->level--;
  19084. return NULL;
  19085. }
  19086. D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
  19087. expr_ty a;
  19088. if (
  19089. (a = _PyPegen_name_token(p)) // NAME
  19090. )
  19091. {
  19092. D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
  19093. _res = _PyPegen_set_expr_context ( p , a , Del );
  19094. if (_res == NULL && PyErr_Occurred()) {
  19095. p->error_indicator = 1;
  19096. p->level--;
  19097. return NULL;
  19098. }
  19099. goto done;
  19100. }
  19101. p->mark = _mark;
  19102. D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
  19103. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
  19104. }
  19105. { // '(' del_target ')'
  19106. if (p->error_indicator) {
  19107. p->level--;
  19108. return NULL;
  19109. }
  19110. D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
  19111. Token * _literal;
  19112. Token * _literal_1;
  19113. expr_ty a;
  19114. if (
  19115. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  19116. &&
  19117. (a = del_target_rule(p)) // del_target
  19118. &&
  19119. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  19120. )
  19121. {
  19122. D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
  19123. _res = _PyPegen_set_expr_context ( p , a , Del );
  19124. if (_res == NULL && PyErr_Occurred()) {
  19125. p->error_indicator = 1;
  19126. p->level--;
  19127. return NULL;
  19128. }
  19129. goto done;
  19130. }
  19131. p->mark = _mark;
  19132. D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
  19133. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'"));
  19134. }
  19135. { // '(' del_targets? ')'
  19136. if (p->error_indicator) {
  19137. p->level--;
  19138. return NULL;
  19139. }
  19140. D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
  19141. Token * _literal;
  19142. Token * _literal_1;
  19143. void *a;
  19144. if (
  19145. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  19146. &&
  19147. (a = del_targets_rule(p), !p->error_indicator) // del_targets?
  19148. &&
  19149. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  19150. )
  19151. {
  19152. D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
  19153. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  19154. if (_token == NULL) {
  19155. p->level--;
  19156. return NULL;
  19157. }
  19158. int _end_lineno = _token->end_lineno;
  19159. UNUSED(_end_lineno); // Only used by EXTRA macro
  19160. int _end_col_offset = _token->end_col_offset;
  19161. UNUSED(_end_col_offset); // Only used by EXTRA macro
  19162. _res = _PyAST_Tuple ( a , Del , EXTRA );
  19163. if (_res == NULL && PyErr_Occurred()) {
  19164. p->error_indicator = 1;
  19165. p->level--;
  19166. return NULL;
  19167. }
  19168. goto done;
  19169. }
  19170. p->mark = _mark;
  19171. D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
  19172. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'"));
  19173. }
  19174. { // '[' del_targets? ']'
  19175. if (p->error_indicator) {
  19176. p->level--;
  19177. return NULL;
  19178. }
  19179. D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
  19180. Token * _literal;
  19181. Token * _literal_1;
  19182. void *a;
  19183. if (
  19184. (_literal = _PyPegen_expect_token(p, 9)) // token='['
  19185. &&
  19186. (a = del_targets_rule(p), !p->error_indicator) // del_targets?
  19187. &&
  19188. (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
  19189. )
  19190. {
  19191. D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
  19192. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  19193. if (_token == NULL) {
  19194. p->level--;
  19195. return NULL;
  19196. }
  19197. int _end_lineno = _token->end_lineno;
  19198. UNUSED(_end_lineno); // Only used by EXTRA macro
  19199. int _end_col_offset = _token->end_col_offset;
  19200. UNUSED(_end_col_offset); // Only used by EXTRA macro
  19201. _res = _PyAST_List ( a , Del , EXTRA );
  19202. if (_res == NULL && PyErr_Occurred()) {
  19203. p->error_indicator = 1;
  19204. p->level--;
  19205. return NULL;
  19206. }
  19207. goto done;
  19208. }
  19209. p->mark = _mark;
  19210. D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
  19211. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'"));
  19212. }
  19213. _res = NULL;
  19214. done:
  19215. p->level--;
  19216. return _res;
  19217. }
  19218. // type_expressions:
  19219. // | ','.expression+ ',' '*' expression ',' '**' expression
  19220. // | ','.expression+ ',' '*' expression
  19221. // | ','.expression+ ',' '**' expression
  19222. // | '*' expression ',' '**' expression
  19223. // | '*' expression
  19224. // | '**' expression
  19225. // | ','.expression+
  19226. static asdl_expr_seq*
  19227. type_expressions_rule(Parser *p)
  19228. {
  19229. if (p->level++ == MAXSTACK) {
  19230. _Pypegen_stack_overflow(p);
  19231. }
  19232. if (p->error_indicator) {
  19233. p->level--;
  19234. return NULL;
  19235. }
  19236. asdl_expr_seq* _res = NULL;
  19237. int _mark = p->mark;
  19238. { // ','.expression+ ',' '*' expression ',' '**' expression
  19239. if (p->error_indicator) {
  19240. p->level--;
  19241. return NULL;
  19242. }
  19243. D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
  19244. Token * _literal;
  19245. Token * _literal_1;
  19246. Token * _literal_2;
  19247. Token * _literal_3;
  19248. asdl_seq * a;
  19249. expr_ty b;
  19250. expr_ty c;
  19251. if (
  19252. (a = _gather_141_rule(p)) // ','.expression+
  19253. &&
  19254. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  19255. &&
  19256. (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
  19257. &&
  19258. (b = expression_rule(p)) // expression
  19259. &&
  19260. (_literal_2 = _PyPegen_expect_token(p, 12)) // token=','
  19261. &&
  19262. (_literal_3 = _PyPegen_expect_token(p, 35)) // token='**'
  19263. &&
  19264. (c = expression_rule(p)) // expression
  19265. )
  19266. {
  19267. D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
  19268. _res = ( asdl_expr_seq* ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq* , _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
  19269. if (_res == NULL && PyErr_Occurred()) {
  19270. p->error_indicator = 1;
  19271. p->level--;
  19272. return NULL;
  19273. }
  19274. goto done;
  19275. }
  19276. p->mark = _mark;
  19277. D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
  19278. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
  19279. }
  19280. { // ','.expression+ ',' '*' expression
  19281. if (p->error_indicator) {
  19282. p->level--;
  19283. return NULL;
  19284. }
  19285. D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
  19286. Token * _literal;
  19287. Token * _literal_1;
  19288. asdl_seq * a;
  19289. expr_ty b;
  19290. if (
  19291. (a = _gather_143_rule(p)) // ','.expression+
  19292. &&
  19293. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  19294. &&
  19295. (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
  19296. &&
  19297. (b = expression_rule(p)) // expression
  19298. )
  19299. {
  19300. D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
  19301. _res = ( asdl_expr_seq* ) _PyPegen_seq_append_to_end ( p , a , b );
  19302. if (_res == NULL && PyErr_Occurred()) {
  19303. p->error_indicator = 1;
  19304. p->level--;
  19305. return NULL;
  19306. }
  19307. goto done;
  19308. }
  19309. p->mark = _mark;
  19310. D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
  19311. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression"));
  19312. }
  19313. { // ','.expression+ ',' '**' expression
  19314. if (p->error_indicator) {
  19315. p->level--;
  19316. return NULL;
  19317. }
  19318. D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
  19319. Token * _literal;
  19320. Token * _literal_1;
  19321. asdl_seq * a;
  19322. expr_ty b;
  19323. if (
  19324. (a = _gather_145_rule(p)) // ','.expression+
  19325. &&
  19326. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  19327. &&
  19328. (_literal_1 = _PyPegen_expect_token(p, 35)) // token='**'
  19329. &&
  19330. (b = expression_rule(p)) // expression
  19331. )
  19332. {
  19333. D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
  19334. _res = ( asdl_expr_seq* ) _PyPegen_seq_append_to_end ( p , a , b );
  19335. if (_res == NULL && PyErr_Occurred()) {
  19336. p->error_indicator = 1;
  19337. p->level--;
  19338. return NULL;
  19339. }
  19340. goto done;
  19341. }
  19342. p->mark = _mark;
  19343. D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
  19344. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '**' expression"));
  19345. }
  19346. { // '*' expression ',' '**' expression
  19347. if (p->error_indicator) {
  19348. p->level--;
  19349. return NULL;
  19350. }
  19351. D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
  19352. Token * _literal;
  19353. Token * _literal_1;
  19354. Token * _literal_2;
  19355. expr_ty a;
  19356. expr_ty b;
  19357. if (
  19358. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  19359. &&
  19360. (a = expression_rule(p)) // expression
  19361. &&
  19362. (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
  19363. &&
  19364. (_literal_2 = _PyPegen_expect_token(p, 35)) // token='**'
  19365. &&
  19366. (b = expression_rule(p)) // expression
  19367. )
  19368. {
  19369. D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
  19370. _res = ( asdl_expr_seq* ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq* , _PyPegen_singleton_seq ( p , a ) ) , b );
  19371. if (_res == NULL && PyErr_Occurred()) {
  19372. p->error_indicator = 1;
  19373. p->level--;
  19374. return NULL;
  19375. }
  19376. goto done;
  19377. }
  19378. p->mark = _mark;
  19379. D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
  19380. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression ',' '**' expression"));
  19381. }
  19382. { // '*' expression
  19383. if (p->error_indicator) {
  19384. p->level--;
  19385. return NULL;
  19386. }
  19387. D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
  19388. Token * _literal;
  19389. expr_ty a;
  19390. if (
  19391. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  19392. &&
  19393. (a = expression_rule(p)) // expression
  19394. )
  19395. {
  19396. D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
  19397. _res = ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , a );
  19398. if (_res == NULL && PyErr_Occurred()) {
  19399. p->error_indicator = 1;
  19400. p->level--;
  19401. return NULL;
  19402. }
  19403. goto done;
  19404. }
  19405. p->mark = _mark;
  19406. D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
  19407. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
  19408. }
  19409. { // '**' expression
  19410. if (p->error_indicator) {
  19411. p->level--;
  19412. return NULL;
  19413. }
  19414. D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
  19415. Token * _literal;
  19416. expr_ty a;
  19417. if (
  19418. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  19419. &&
  19420. (a = expression_rule(p)) // expression
  19421. )
  19422. {
  19423. D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
  19424. _res = ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , a );
  19425. if (_res == NULL && PyErr_Occurred()) {
  19426. p->error_indicator = 1;
  19427. p->level--;
  19428. return NULL;
  19429. }
  19430. goto done;
  19431. }
  19432. p->mark = _mark;
  19433. D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
  19434. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
  19435. }
  19436. { // ','.expression+
  19437. if (p->error_indicator) {
  19438. p->level--;
  19439. return NULL;
  19440. }
  19441. D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+"));
  19442. asdl_expr_seq* a;
  19443. if (
  19444. (a = (asdl_expr_seq*)_gather_147_rule(p)) // ','.expression+
  19445. )
  19446. {
  19447. D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+"));
  19448. _res = a;
  19449. if (_res == NULL && PyErr_Occurred()) {
  19450. p->error_indicator = 1;
  19451. p->level--;
  19452. return NULL;
  19453. }
  19454. goto done;
  19455. }
  19456. p->mark = _mark;
  19457. D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
  19458. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+"));
  19459. }
  19460. _res = NULL;
  19461. done:
  19462. p->level--;
  19463. return _res;
  19464. }
  19465. // func_type_comment:
  19466. // | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
  19467. // | invalid_double_type_comments
  19468. // | TYPE_COMMENT
  19469. static Token*
  19470. func_type_comment_rule(Parser *p)
  19471. {
  19472. if (p->level++ == MAXSTACK) {
  19473. _Pypegen_stack_overflow(p);
  19474. }
  19475. if (p->error_indicator) {
  19476. p->level--;
  19477. return NULL;
  19478. }
  19479. Token* _res = NULL;
  19480. int _mark = p->mark;
  19481. { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
  19482. if (p->error_indicator) {
  19483. p->level--;
  19484. return NULL;
  19485. }
  19486. D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
  19487. Token * newline_var;
  19488. Token * t;
  19489. if (
  19490. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  19491. &&
  19492. (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
  19493. &&
  19494. _PyPegen_lookahead(1, _tmp_149_rule, p)
  19495. )
  19496. {
  19497. D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
  19498. _res = t;
  19499. if (_res == NULL && PyErr_Occurred()) {
  19500. p->error_indicator = 1;
  19501. p->level--;
  19502. return NULL;
  19503. }
  19504. goto done;
  19505. }
  19506. p->mark = _mark;
  19507. D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
  19508. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
  19509. }
  19510. if (p->call_invalid_rules) { // invalid_double_type_comments
  19511. if (p->error_indicator) {
  19512. p->level--;
  19513. return NULL;
  19514. }
  19515. D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
  19516. void *invalid_double_type_comments_var;
  19517. if (
  19518. (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments
  19519. )
  19520. {
  19521. D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
  19522. _res = invalid_double_type_comments_var;
  19523. goto done;
  19524. }
  19525. p->mark = _mark;
  19526. D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
  19527. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments"));
  19528. }
  19529. { // TYPE_COMMENT
  19530. if (p->error_indicator) {
  19531. p->level--;
  19532. return NULL;
  19533. }
  19534. D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
  19535. Token * type_comment_var;
  19536. if (
  19537. (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
  19538. )
  19539. {
  19540. D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
  19541. _res = type_comment_var;
  19542. goto done;
  19543. }
  19544. p->mark = _mark;
  19545. D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
  19546. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT"));
  19547. }
  19548. _res = NULL;
  19549. done:
  19550. p->level--;
  19551. return _res;
  19552. }
  19553. // invalid_arguments:
  19554. // | ((','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' ','.(starred_expression !'=')+
  19555. // | expression for_if_clauses ',' [args | expression for_if_clauses]
  19556. // | NAME '=' expression for_if_clauses
  19557. // | [(args ',')] NAME '=' &(',' | ')')
  19558. // | args for_if_clauses
  19559. // | args ',' expression for_if_clauses
  19560. // | args ',' args
  19561. static void *
  19562. invalid_arguments_rule(Parser *p)
  19563. {
  19564. if (p->level++ == MAXSTACK) {
  19565. _Pypegen_stack_overflow(p);
  19566. }
  19567. if (p->error_indicator) {
  19568. p->level--;
  19569. return NULL;
  19570. }
  19571. void * _res = NULL;
  19572. int _mark = p->mark;
  19573. { // ((','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' ','.(starred_expression !'=')+
  19574. if (p->error_indicator) {
  19575. p->level--;
  19576. return NULL;
  19577. }
  19578. D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' ','.(starred_expression !'=')+"));
  19579. asdl_seq * _gather_151_var;
  19580. void *_tmp_150_var;
  19581. Token * a;
  19582. if (
  19583. (_tmp_150_var = _tmp_150_rule(p)) // (','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs
  19584. &&
  19585. (a = _PyPegen_expect_token(p, 12)) // token=','
  19586. &&
  19587. (_gather_151_var = _gather_151_rule(p)) // ','.(starred_expression !'=')+
  19588. )
  19589. {
  19590. D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' ','.(starred_expression !'=')+"));
  19591. _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "iterable argument unpacking follows keyword argument unpacking" );
  19592. if (_res == NULL && PyErr_Occurred()) {
  19593. p->error_indicator = 1;
  19594. p->level--;
  19595. return NULL;
  19596. }
  19597. goto done;
  19598. }
  19599. p->mark = _mark;
  19600. D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
  19601. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' ','.(starred_expression !'=')+"));
  19602. }
  19603. { // expression for_if_clauses ',' [args | expression for_if_clauses]
  19604. if (p->error_indicator) {
  19605. p->level--;
  19606. return NULL;
  19607. }
  19608. D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
  19609. Token * _literal;
  19610. void *_opt_var;
  19611. UNUSED(_opt_var); // Silence compiler warnings
  19612. expr_ty a;
  19613. asdl_comprehension_seq* b;
  19614. if (
  19615. (a = expression_rule(p)) // expression
  19616. &&
  19617. (b = for_if_clauses_rule(p)) // for_if_clauses
  19618. &&
  19619. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  19620. &&
  19621. (_opt_var = _tmp_153_rule(p), !p->error_indicator) // [args | expression for_if_clauses]
  19622. )
  19623. {
  19624. D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
  19625. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , _PyPegen_get_last_comprehension_item ( PyPegen_last_item ( b , comprehension_ty ) ) , "Generator expression must be parenthesized" );
  19626. if (_res == NULL && PyErr_Occurred()) {
  19627. p->error_indicator = 1;
  19628. p->level--;
  19629. return NULL;
  19630. }
  19631. goto done;
  19632. }
  19633. p->mark = _mark;
  19634. D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
  19635. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
  19636. }
  19637. { // NAME '=' expression for_if_clauses
  19638. if (p->error_indicator) {
  19639. p->level--;
  19640. return NULL;
  19641. }
  19642. D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses"));
  19643. expr_ty a;
  19644. Token * b;
  19645. expr_ty expression_var;
  19646. asdl_comprehension_seq* for_if_clauses_var;
  19647. if (
  19648. (a = _PyPegen_name_token(p)) // NAME
  19649. &&
  19650. (b = _PyPegen_expect_token(p, 22)) // token='='
  19651. &&
  19652. (expression_var = expression_rule(p)) // expression
  19653. &&
  19654. (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
  19655. )
  19656. {
  19657. D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses"));
  19658. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" );
  19659. if (_res == NULL && PyErr_Occurred()) {
  19660. p->error_indicator = 1;
  19661. p->level--;
  19662. return NULL;
  19663. }
  19664. goto done;
  19665. }
  19666. p->mark = _mark;
  19667. D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
  19668. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression for_if_clauses"));
  19669. }
  19670. { // [(args ',')] NAME '=' &(',' | ')')
  19671. if (p->error_indicator) {
  19672. p->level--;
  19673. return NULL;
  19674. }
  19675. D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "[(args ',')] NAME '=' &(',' | ')')"));
  19676. void *_opt_var;
  19677. UNUSED(_opt_var); // Silence compiler warnings
  19678. expr_ty a;
  19679. Token * b;
  19680. if (
  19681. (_opt_var = _tmp_154_rule(p), !p->error_indicator) // [(args ',')]
  19682. &&
  19683. (a = _PyPegen_name_token(p)) // NAME
  19684. &&
  19685. (b = _PyPegen_expect_token(p, 22)) // token='='
  19686. &&
  19687. _PyPegen_lookahead(1, _tmp_155_rule, p)
  19688. )
  19689. {
  19690. D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "[(args ',')] NAME '=' &(',' | ')')"));
  19691. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "expected argument value expression" );
  19692. if (_res == NULL && PyErr_Occurred()) {
  19693. p->error_indicator = 1;
  19694. p->level--;
  19695. return NULL;
  19696. }
  19697. goto done;
  19698. }
  19699. p->mark = _mark;
  19700. D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
  19701. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "[(args ',')] NAME '=' &(',' | ')')"));
  19702. }
  19703. { // args for_if_clauses
  19704. if (p->error_indicator) {
  19705. p->level--;
  19706. return NULL;
  19707. }
  19708. D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
  19709. expr_ty a;
  19710. asdl_comprehension_seq* b;
  19711. if (
  19712. (a = args_rule(p)) // args
  19713. &&
  19714. (b = for_if_clauses_rule(p)) // for_if_clauses
  19715. )
  19716. {
  19717. D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
  19718. _res = _PyPegen_nonparen_genexp_in_call ( p , a , b );
  19719. if (_res == NULL && PyErr_Occurred()) {
  19720. p->error_indicator = 1;
  19721. p->level--;
  19722. return NULL;
  19723. }
  19724. goto done;
  19725. }
  19726. p->mark = _mark;
  19727. D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
  19728. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses"));
  19729. }
  19730. { // args ',' expression for_if_clauses
  19731. if (p->error_indicator) {
  19732. p->level--;
  19733. return NULL;
  19734. }
  19735. D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
  19736. Token * _literal;
  19737. expr_ty a;
  19738. expr_ty args_var;
  19739. asdl_comprehension_seq* b;
  19740. if (
  19741. (args_var = args_rule(p)) // args
  19742. &&
  19743. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  19744. &&
  19745. (a = expression_rule(p)) // expression
  19746. &&
  19747. (b = for_if_clauses_rule(p)) // for_if_clauses
  19748. )
  19749. {
  19750. D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
  19751. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , _PyPegen_get_last_comprehension_item ( PyPegen_last_item ( b , comprehension_ty ) ) , "Generator expression must be parenthesized" );
  19752. if (_res == NULL && PyErr_Occurred()) {
  19753. p->error_indicator = 1;
  19754. p->level--;
  19755. return NULL;
  19756. }
  19757. goto done;
  19758. }
  19759. p->mark = _mark;
  19760. D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
  19761. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses"));
  19762. }
  19763. { // args ',' args
  19764. if (p->error_indicator) {
  19765. p->level--;
  19766. return NULL;
  19767. }
  19768. D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' args"));
  19769. Token * _literal;
  19770. expr_ty a;
  19771. expr_ty args_var;
  19772. if (
  19773. (a = args_rule(p)) // args
  19774. &&
  19775. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  19776. &&
  19777. (args_var = args_rule(p)) // args
  19778. )
  19779. {
  19780. D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' args"));
  19781. _res = _PyPegen_arguments_parsing_error ( p , a );
  19782. if (_res == NULL && PyErr_Occurred()) {
  19783. p->error_indicator = 1;
  19784. p->level--;
  19785. return NULL;
  19786. }
  19787. goto done;
  19788. }
  19789. p->mark = _mark;
  19790. D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
  19791. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args"));
  19792. }
  19793. _res = NULL;
  19794. done:
  19795. p->level--;
  19796. return _res;
  19797. }
  19798. // invalid_kwarg:
  19799. // | ('True' | 'False' | 'None') '='
  19800. // | NAME '=' expression for_if_clauses
  19801. // | !(NAME '=') expression '='
  19802. // | '**' expression '=' expression
  19803. static void *
  19804. invalid_kwarg_rule(Parser *p)
  19805. {
  19806. if (p->level++ == MAXSTACK) {
  19807. _Pypegen_stack_overflow(p);
  19808. }
  19809. if (p->error_indicator) {
  19810. p->level--;
  19811. return NULL;
  19812. }
  19813. void * _res = NULL;
  19814. int _mark = p->mark;
  19815. { // ('True' | 'False' | 'None') '='
  19816. if (p->error_indicator) {
  19817. p->level--;
  19818. return NULL;
  19819. }
  19820. D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('True' | 'False' | 'None') '='"));
  19821. Token* a;
  19822. Token * b;
  19823. if (
  19824. (a = (Token*)_tmp_156_rule(p)) // 'True' | 'False' | 'None'
  19825. &&
  19826. (b = _PyPegen_expect_token(p, 22)) // token='='
  19827. )
  19828. {
  19829. D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('True' | 'False' | 'None') '='"));
  19830. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot assign to %s" , PyBytes_AS_STRING ( a -> bytes ) );
  19831. if (_res == NULL && PyErr_Occurred()) {
  19832. p->error_indicator = 1;
  19833. p->level--;
  19834. return NULL;
  19835. }
  19836. goto done;
  19837. }
  19838. p->mark = _mark;
  19839. D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
  19840. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('True' | 'False' | 'None') '='"));
  19841. }
  19842. { // NAME '=' expression for_if_clauses
  19843. if (p->error_indicator) {
  19844. p->level--;
  19845. return NULL;
  19846. }
  19847. D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses"));
  19848. expr_ty a;
  19849. Token * b;
  19850. expr_ty expression_var;
  19851. asdl_comprehension_seq* for_if_clauses_var;
  19852. if (
  19853. (a = _PyPegen_name_token(p)) // NAME
  19854. &&
  19855. (b = _PyPegen_expect_token(p, 22)) // token='='
  19856. &&
  19857. (expression_var = expression_rule(p)) // expression
  19858. &&
  19859. (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
  19860. )
  19861. {
  19862. D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses"));
  19863. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" );
  19864. if (_res == NULL && PyErr_Occurred()) {
  19865. p->error_indicator = 1;
  19866. p->level--;
  19867. return NULL;
  19868. }
  19869. goto done;
  19870. }
  19871. p->mark = _mark;
  19872. D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
  19873. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression for_if_clauses"));
  19874. }
  19875. { // !(NAME '=') expression '='
  19876. if (p->error_indicator) {
  19877. p->level--;
  19878. return NULL;
  19879. }
  19880. D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!(NAME '=') expression '='"));
  19881. expr_ty a;
  19882. Token * b;
  19883. if (
  19884. _PyPegen_lookahead(0, _tmp_157_rule, p)
  19885. &&
  19886. (a = expression_rule(p)) // expression
  19887. &&
  19888. (b = _PyPegen_expect_token(p, 22)) // token='='
  19889. )
  19890. {
  19891. D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(NAME '=') expression '='"));
  19892. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "expression cannot contain assignment, perhaps you meant \"==\"?" );
  19893. if (_res == NULL && PyErr_Occurred()) {
  19894. p->error_indicator = 1;
  19895. p->level--;
  19896. return NULL;
  19897. }
  19898. goto done;
  19899. }
  19900. p->mark = _mark;
  19901. D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
  19902. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!(NAME '=') expression '='"));
  19903. }
  19904. { // '**' expression '=' expression
  19905. if (p->error_indicator) {
  19906. p->level--;
  19907. return NULL;
  19908. }
  19909. D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression '=' expression"));
  19910. Token * _literal;
  19911. Token * a;
  19912. expr_ty b;
  19913. expr_ty expression_var;
  19914. if (
  19915. (a = _PyPegen_expect_token(p, 35)) // token='**'
  19916. &&
  19917. (expression_var = expression_rule(p)) // expression
  19918. &&
  19919. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  19920. &&
  19921. (b = expression_rule(p)) // expression
  19922. )
  19923. {
  19924. D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression '=' expression"));
  19925. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot assign to keyword argument unpacking" );
  19926. if (_res == NULL && PyErr_Occurred()) {
  19927. p->error_indicator = 1;
  19928. p->level--;
  19929. return NULL;
  19930. }
  19931. goto done;
  19932. }
  19933. p->mark = _mark;
  19934. D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
  19935. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression '=' expression"));
  19936. }
  19937. _res = NULL;
  19938. done:
  19939. p->level--;
  19940. return _res;
  19941. }
  19942. // expression_without_invalid:
  19943. // | disjunction 'if' disjunction 'else' expression
  19944. // | disjunction
  19945. // | lambdef
  19946. static expr_ty
  19947. expression_without_invalid_rule(Parser *p)
  19948. {
  19949. int _prev_call_invalid = p->call_invalid_rules;
  19950. p->call_invalid_rules = 0;
  19951. if (p->level++ == MAXSTACK) {
  19952. _Pypegen_stack_overflow(p);
  19953. }
  19954. if (p->error_indicator) {
  19955. p->call_invalid_rules = _prev_call_invalid;
  19956. p->level--;
  19957. return NULL;
  19958. }
  19959. expr_ty _res = NULL;
  19960. int _mark = p->mark;
  19961. if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
  19962. p->error_indicator = 1;
  19963. p->call_invalid_rules = _prev_call_invalid;
  19964. p->level--;
  19965. return NULL;
  19966. }
  19967. int _start_lineno = p->tokens[_mark]->lineno;
  19968. UNUSED(_start_lineno); // Only used by EXTRA macro
  19969. int _start_col_offset = p->tokens[_mark]->col_offset;
  19970. UNUSED(_start_col_offset); // Only used by EXTRA macro
  19971. { // disjunction 'if' disjunction 'else' expression
  19972. if (p->error_indicator) {
  19973. p->call_invalid_rules = _prev_call_invalid;
  19974. p->level--;
  19975. return NULL;
  19976. }
  19977. D(fprintf(stderr, "%*c> expression_without_invalid[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
  19978. Token * _keyword;
  19979. Token * _keyword_1;
  19980. expr_ty a;
  19981. expr_ty b;
  19982. expr_ty c;
  19983. if (
  19984. (a = disjunction_rule(p)) // disjunction
  19985. &&
  19986. (_keyword = _PyPegen_expect_token(p, 642)) // token='if'
  19987. &&
  19988. (b = disjunction_rule(p)) // disjunction
  19989. &&
  19990. (_keyword_1 = _PyPegen_expect_token(p, 645)) // token='else'
  19991. &&
  19992. (c = expression_rule(p)) // expression
  19993. )
  19994. {
  19995. D(fprintf(stderr, "%*c+ expression_without_invalid[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
  19996. Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
  19997. if (_token == NULL) {
  19998. p->call_invalid_rules = _prev_call_invalid;
  19999. p->level--;
  20000. return NULL;
  20001. }
  20002. int _end_lineno = _token->end_lineno;
  20003. UNUSED(_end_lineno); // Only used by EXTRA macro
  20004. int _end_col_offset = _token->end_col_offset;
  20005. UNUSED(_end_col_offset); // Only used by EXTRA macro
  20006. _res = _PyAST_IfExp ( b , a , c , EXTRA );
  20007. if (_res == NULL && PyErr_Occurred()) {
  20008. p->error_indicator = 1;
  20009. p->call_invalid_rules = _prev_call_invalid;
  20010. p->level--;
  20011. return NULL;
  20012. }
  20013. goto done;
  20014. }
  20015. p->mark = _mark;
  20016. D(fprintf(stderr, "%*c%s expression_without_invalid[%d-%d]: %s failed!\n", p->level, ' ',
  20017. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
  20018. }
  20019. { // disjunction
  20020. if (p->error_indicator) {
  20021. p->call_invalid_rules = _prev_call_invalid;
  20022. p->level--;
  20023. return NULL;
  20024. }
  20025. D(fprintf(stderr, "%*c> expression_without_invalid[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction"));
  20026. expr_ty disjunction_var;
  20027. if (
  20028. (disjunction_var = disjunction_rule(p)) // disjunction
  20029. )
  20030. {
  20031. D(fprintf(stderr, "%*c+ expression_without_invalid[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction"));
  20032. _res = disjunction_var;
  20033. goto done;
  20034. }
  20035. p->mark = _mark;
  20036. D(fprintf(stderr, "%*c%s expression_without_invalid[%d-%d]: %s failed!\n", p->level, ' ',
  20037. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction"));
  20038. }
  20039. { // lambdef
  20040. if (p->error_indicator) {
  20041. p->call_invalid_rules = _prev_call_invalid;
  20042. p->level--;
  20043. return NULL;
  20044. }
  20045. D(fprintf(stderr, "%*c> expression_without_invalid[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef"));
  20046. expr_ty lambdef_var;
  20047. if (
  20048. (lambdef_var = lambdef_rule(p)) // lambdef
  20049. )
  20050. {
  20051. D(fprintf(stderr, "%*c+ expression_without_invalid[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef"));
  20052. _res = lambdef_var;
  20053. goto done;
  20054. }
  20055. p->mark = _mark;
  20056. D(fprintf(stderr, "%*c%s expression_without_invalid[%d-%d]: %s failed!\n", p->level, ' ',
  20057. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef"));
  20058. }
  20059. _res = NULL;
  20060. done:
  20061. p->call_invalid_rules = _prev_call_invalid;
  20062. p->level--;
  20063. return _res;
  20064. }
  20065. // invalid_legacy_expression: NAME !'(' star_expressions
  20066. static void *
  20067. invalid_legacy_expression_rule(Parser *p)
  20068. {
  20069. if (p->level++ == MAXSTACK) {
  20070. _Pypegen_stack_overflow(p);
  20071. }
  20072. if (p->error_indicator) {
  20073. p->level--;
  20074. return NULL;
  20075. }
  20076. void * _res = NULL;
  20077. int _mark = p->mark;
  20078. { // NAME !'(' star_expressions
  20079. if (p->error_indicator) {
  20080. p->level--;
  20081. return NULL;
  20082. }
  20083. D(fprintf(stderr, "%*c> invalid_legacy_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME !'(' star_expressions"));
  20084. expr_ty a;
  20085. expr_ty b;
  20086. if (
  20087. (a = _PyPegen_name_token(p)) // NAME
  20088. &&
  20089. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 7) // token='('
  20090. &&
  20091. (b = star_expressions_rule(p)) // star_expressions
  20092. )
  20093. {
  20094. D(fprintf(stderr, "%*c+ invalid_legacy_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME !'(' star_expressions"));
  20095. _res = _PyPegen_check_legacy_stmt ( p , a ) ? RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "Missing parentheses in call to '%U'. Did you mean %U(...)?" , a -> v . Name . id , a -> v . Name . id ) : NULL;
  20096. if (_res == NULL && PyErr_Occurred()) {
  20097. p->error_indicator = 1;
  20098. p->level--;
  20099. return NULL;
  20100. }
  20101. goto done;
  20102. }
  20103. p->mark = _mark;
  20104. D(fprintf(stderr, "%*c%s invalid_legacy_expression[%d-%d]: %s failed!\n", p->level, ' ',
  20105. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME !'(' star_expressions"));
  20106. }
  20107. _res = NULL;
  20108. done:
  20109. p->level--;
  20110. return _res;
  20111. }
  20112. // invalid_expression:
  20113. // | !(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid
  20114. // | disjunction 'if' disjunction !('else' | ':')
  20115. // | 'lambda' lambda_params? ':' &FSTRING_MIDDLE
  20116. static void *
  20117. invalid_expression_rule(Parser *p)
  20118. {
  20119. if (p->level++ == MAXSTACK) {
  20120. _Pypegen_stack_overflow(p);
  20121. }
  20122. if (p->error_indicator) {
  20123. p->level--;
  20124. return NULL;
  20125. }
  20126. void * _res = NULL;
  20127. int _mark = p->mark;
  20128. { // !(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid
  20129. if (p->error_indicator) {
  20130. p->level--;
  20131. return NULL;
  20132. }
  20133. D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid"));
  20134. expr_ty a;
  20135. expr_ty b;
  20136. if (
  20137. _PyPegen_lookahead(0, _tmp_158_rule, p)
  20138. &&
  20139. (a = disjunction_rule(p)) // disjunction
  20140. &&
  20141. (b = expression_without_invalid_rule(p)) // expression_without_invalid
  20142. )
  20143. {
  20144. D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid"));
  20145. _res = _PyPegen_check_legacy_stmt ( p , a ) ? NULL : p -> tokens [p -> mark - 1] -> level == 0 ? NULL : RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Perhaps you forgot a comma?" );
  20146. if (_res == NULL && PyErr_Occurred()) {
  20147. p->error_indicator = 1;
  20148. p->level--;
  20149. return NULL;
  20150. }
  20151. goto done;
  20152. }
  20153. p->mark = _mark;
  20154. D(fprintf(stderr, "%*c%s invalid_expression[%d-%d]: %s failed!\n", p->level, ' ',
  20155. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid"));
  20156. }
  20157. { // disjunction 'if' disjunction !('else' | ':')
  20158. if (p->error_indicator) {
  20159. p->level--;
  20160. return NULL;
  20161. }
  20162. D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction !('else' | ':')"));
  20163. Token * _keyword;
  20164. expr_ty a;
  20165. expr_ty b;
  20166. if (
  20167. (a = disjunction_rule(p)) // disjunction
  20168. &&
  20169. (_keyword = _PyPegen_expect_token(p, 642)) // token='if'
  20170. &&
  20171. (b = disjunction_rule(p)) // disjunction
  20172. &&
  20173. _PyPegen_lookahead(0, _tmp_159_rule, p)
  20174. )
  20175. {
  20176. D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction !('else' | ':')"));
  20177. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "expected 'else' after 'if' expression" );
  20178. if (_res == NULL && PyErr_Occurred()) {
  20179. p->error_indicator = 1;
  20180. p->level--;
  20181. return NULL;
  20182. }
  20183. goto done;
  20184. }
  20185. p->mark = _mark;
  20186. D(fprintf(stderr, "%*c%s invalid_expression[%d-%d]: %s failed!\n", p->level, ' ',
  20187. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction !('else' | ':')"));
  20188. }
  20189. { // 'lambda' lambda_params? ':' &FSTRING_MIDDLE
  20190. if (p->error_indicator) {
  20191. p->level--;
  20192. return NULL;
  20193. }
  20194. D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' &FSTRING_MIDDLE"));
  20195. void *_opt_var;
  20196. UNUSED(_opt_var); // Silence compiler warnings
  20197. Token * a;
  20198. Token * b;
  20199. if (
  20200. (a = _PyPegen_expect_token(p, 600)) // token='lambda'
  20201. &&
  20202. (_opt_var = lambda_params_rule(p), !p->error_indicator) // lambda_params?
  20203. &&
  20204. (b = _PyPegen_expect_token(p, 11)) // token=':'
  20205. &&
  20206. _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, FSTRING_MIDDLE) // token=FSTRING_MIDDLE
  20207. )
  20208. {
  20209. D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' &FSTRING_MIDDLE"));
  20210. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "f-string: lambda expressions are not allowed without parentheses" );
  20211. if (_res == NULL && PyErr_Occurred()) {
  20212. p->error_indicator = 1;
  20213. p->level--;
  20214. return NULL;
  20215. }
  20216. goto done;
  20217. }
  20218. p->mark = _mark;
  20219. D(fprintf(stderr, "%*c%s invalid_expression[%d-%d]: %s failed!\n", p->level, ' ',
  20220. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' &FSTRING_MIDDLE"));
  20221. }
  20222. _res = NULL;
  20223. done:
  20224. p->level--;
  20225. return _res;
  20226. }
  20227. // invalid_named_expression:
  20228. // | expression ':=' expression
  20229. // | NAME '=' bitwise_or !('=' | ':=')
  20230. // | !(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')
  20231. static void *
  20232. invalid_named_expression_rule(Parser *p)
  20233. {
  20234. if (p->level++ == MAXSTACK) {
  20235. _Pypegen_stack_overflow(p);
  20236. }
  20237. if (p->error_indicator) {
  20238. p->level--;
  20239. return NULL;
  20240. }
  20241. void * _res = NULL;
  20242. if (_PyPegen_is_memoized(p, invalid_named_expression_type, &_res)) {
  20243. p->level--;
  20244. return _res;
  20245. }
  20246. int _mark = p->mark;
  20247. { // expression ':=' expression
  20248. if (p->error_indicator) {
  20249. p->level--;
  20250. return NULL;
  20251. }
  20252. D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
  20253. Token * _literal;
  20254. expr_ty a;
  20255. expr_ty expression_var;
  20256. if (
  20257. (a = expression_rule(p)) // expression
  20258. &&
  20259. (_literal = _PyPegen_expect_token(p, 53)) // token=':='
  20260. &&
  20261. (expression_var = expression_rule(p)) // expression
  20262. )
  20263. {
  20264. D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
  20265. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) );
  20266. if (_res == NULL && PyErr_Occurred()) {
  20267. p->error_indicator = 1;
  20268. p->level--;
  20269. return NULL;
  20270. }
  20271. goto done;
  20272. }
  20273. p->mark = _mark;
  20274. D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
  20275. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression"));
  20276. }
  20277. { // NAME '=' bitwise_or !('=' | ':=')
  20278. if (p->error_indicator) {
  20279. p->level--;
  20280. return NULL;
  20281. }
  20282. D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=')"));
  20283. Token * _literal;
  20284. expr_ty a;
  20285. expr_ty b;
  20286. if (
  20287. (a = _PyPegen_name_token(p)) // NAME
  20288. &&
  20289. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  20290. &&
  20291. (b = bitwise_or_rule(p)) // bitwise_or
  20292. &&
  20293. _PyPegen_lookahead(0, _tmp_160_rule, p)
  20294. )
  20295. {
  20296. D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=')"));
  20297. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" );
  20298. if (_res == NULL && PyErr_Occurred()) {
  20299. p->error_indicator = 1;
  20300. p->level--;
  20301. return NULL;
  20302. }
  20303. goto done;
  20304. }
  20305. p->mark = _mark;
  20306. D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
  20307. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=')"));
  20308. }
  20309. { // !(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')
  20310. if (p->error_indicator) {
  20311. p->level--;
  20312. return NULL;
  20313. }
  20314. D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')"));
  20315. expr_ty a;
  20316. Token * b;
  20317. expr_ty bitwise_or_var;
  20318. if (
  20319. _PyPegen_lookahead(0, _tmp_161_rule, p)
  20320. &&
  20321. (a = bitwise_or_rule(p)) // bitwise_or
  20322. &&
  20323. (b = _PyPegen_expect_token(p, 22)) // token='='
  20324. &&
  20325. (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
  20326. &&
  20327. _PyPegen_lookahead(0, _tmp_162_rule, p)
  20328. )
  20329. {
  20330. D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')"));
  20331. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot assign to %s here. Maybe you meant '==' instead of '='?" , _PyPegen_get_expr_name ( a ) );
  20332. if (_res == NULL && PyErr_Occurred()) {
  20333. p->error_indicator = 1;
  20334. p->level--;
  20335. return NULL;
  20336. }
  20337. goto done;
  20338. }
  20339. p->mark = _mark;
  20340. D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
  20341. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')"));
  20342. }
  20343. _res = NULL;
  20344. done:
  20345. _PyPegen_insert_memo(p, _mark, invalid_named_expression_type, _res);
  20346. p->level--;
  20347. return _res;
  20348. }
  20349. // invalid_assignment:
  20350. // | invalid_ann_assign_target ':' expression
  20351. // | star_named_expression ',' star_named_expressions* ':' expression
  20352. // | expression ':' expression
  20353. // | ((star_targets '='))* star_expressions '='
  20354. // | ((star_targets '='))* yield_expr '='
  20355. // | star_expressions augassign (yield_expr | star_expressions)
  20356. static void *
  20357. invalid_assignment_rule(Parser *p)
  20358. {
  20359. if (p->level++ == MAXSTACK) {
  20360. _Pypegen_stack_overflow(p);
  20361. }
  20362. if (p->error_indicator) {
  20363. p->level--;
  20364. return NULL;
  20365. }
  20366. void * _res = NULL;
  20367. int _mark = p->mark;
  20368. { // invalid_ann_assign_target ':' expression
  20369. if (p->error_indicator) {
  20370. p->level--;
  20371. return NULL;
  20372. }
  20373. D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression"));
  20374. Token * _literal;
  20375. expr_ty a;
  20376. expr_ty expression_var;
  20377. if (
  20378. (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
  20379. &&
  20380. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  20381. &&
  20382. (expression_var = expression_rule(p)) // expression
  20383. )
  20384. {
  20385. D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression"));
  20386. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not %s) can be annotated" , _PyPegen_get_expr_name ( a ) );
  20387. if (_res == NULL && PyErr_Occurred()) {
  20388. p->error_indicator = 1;
  20389. p->level--;
  20390. return NULL;
  20391. }
  20392. goto done;
  20393. }
  20394. p->mark = _mark;
  20395. D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
  20396. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_ann_assign_target ':' expression"));
  20397. }
  20398. { // star_named_expression ',' star_named_expressions* ':' expression
  20399. if (p->error_indicator) {
  20400. p->level--;
  20401. return NULL;
  20402. }
  20403. D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
  20404. Token * _literal;
  20405. Token * _literal_1;
  20406. asdl_seq * _loop0_163_var;
  20407. expr_ty a;
  20408. expr_ty expression_var;
  20409. if (
  20410. (a = star_named_expression_rule(p)) // star_named_expression
  20411. &&
  20412. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  20413. &&
  20414. (_loop0_163_var = _loop0_163_rule(p)) // star_named_expressions*
  20415. &&
  20416. (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
  20417. &&
  20418. (expression_var = expression_rule(p)) // expression
  20419. )
  20420. {
  20421. D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
  20422. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" );
  20423. if (_res == NULL && PyErr_Occurred()) {
  20424. p->error_indicator = 1;
  20425. p->level--;
  20426. return NULL;
  20427. }
  20428. goto done;
  20429. }
  20430. p->mark = _mark;
  20431. D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
  20432. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
  20433. }
  20434. { // expression ':' expression
  20435. if (p->error_indicator) {
  20436. p->level--;
  20437. return NULL;
  20438. }
  20439. D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
  20440. Token * _literal;
  20441. expr_ty a;
  20442. expr_ty expression_var;
  20443. if (
  20444. (a = expression_rule(p)) // expression
  20445. &&
  20446. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  20447. &&
  20448. (expression_var = expression_rule(p)) // expression
  20449. )
  20450. {
  20451. D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
  20452. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" );
  20453. if (_res == NULL && PyErr_Occurred()) {
  20454. p->error_indicator = 1;
  20455. p->level--;
  20456. return NULL;
  20457. }
  20458. goto done;
  20459. }
  20460. p->mark = _mark;
  20461. D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
  20462. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
  20463. }
  20464. { // ((star_targets '='))* star_expressions '='
  20465. if (p->error_indicator) {
  20466. p->level--;
  20467. return NULL;
  20468. }
  20469. D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
  20470. Token * _literal;
  20471. asdl_seq * _loop0_164_var;
  20472. expr_ty a;
  20473. if (
  20474. (_loop0_164_var = _loop0_164_rule(p)) // ((star_targets '='))*
  20475. &&
  20476. (a = star_expressions_rule(p)) // star_expressions
  20477. &&
  20478. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  20479. )
  20480. {
  20481. D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
  20482. _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
  20483. if (_res == NULL && PyErr_Occurred()) {
  20484. p->error_indicator = 1;
  20485. p->level--;
  20486. return NULL;
  20487. }
  20488. goto done;
  20489. }
  20490. p->mark = _mark;
  20491. D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
  20492. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* star_expressions '='"));
  20493. }
  20494. { // ((star_targets '='))* yield_expr '='
  20495. if (p->error_indicator) {
  20496. p->level--;
  20497. return NULL;
  20498. }
  20499. D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
  20500. Token * _literal;
  20501. asdl_seq * _loop0_165_var;
  20502. expr_ty a;
  20503. if (
  20504. (_loop0_165_var = _loop0_165_rule(p)) // ((star_targets '='))*
  20505. &&
  20506. (a = yield_expr_rule(p)) // yield_expr
  20507. &&
  20508. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  20509. )
  20510. {
  20511. D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
  20512. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" );
  20513. if (_res == NULL && PyErr_Occurred()) {
  20514. p->error_indicator = 1;
  20515. p->level--;
  20516. return NULL;
  20517. }
  20518. goto done;
  20519. }
  20520. p->mark = _mark;
  20521. D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
  20522. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* yield_expr '='"));
  20523. }
  20524. { // star_expressions augassign (yield_expr | star_expressions)
  20525. if (p->error_indicator) {
  20526. p->level--;
  20527. return NULL;
  20528. }
  20529. D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
  20530. void *_tmp_166_var;
  20531. expr_ty a;
  20532. AugOperator* augassign_var;
  20533. if (
  20534. (a = star_expressions_rule(p)) // star_expressions
  20535. &&
  20536. (augassign_var = augassign_rule(p)) // augassign
  20537. &&
  20538. (_tmp_166_var = _tmp_166_rule(p)) // yield_expr | star_expressions
  20539. )
  20540. {
  20541. D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
  20542. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) );
  20543. if (_res == NULL && PyErr_Occurred()) {
  20544. p->error_indicator = 1;
  20545. p->level--;
  20546. return NULL;
  20547. }
  20548. goto done;
  20549. }
  20550. p->mark = _mark;
  20551. D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
  20552. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
  20553. }
  20554. _res = NULL;
  20555. done:
  20556. p->level--;
  20557. return _res;
  20558. }
  20559. // invalid_ann_assign_target: list | tuple | '(' invalid_ann_assign_target ')'
  20560. static expr_ty
  20561. invalid_ann_assign_target_rule(Parser *p)
  20562. {
  20563. if (p->level++ == MAXSTACK) {
  20564. _Pypegen_stack_overflow(p);
  20565. }
  20566. if (p->error_indicator) {
  20567. p->level--;
  20568. return NULL;
  20569. }
  20570. expr_ty _res = NULL;
  20571. int _mark = p->mark;
  20572. { // list
  20573. if (p->error_indicator) {
  20574. p->level--;
  20575. return NULL;
  20576. }
  20577. D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
  20578. expr_ty list_var;
  20579. if (
  20580. (list_var = list_rule(p)) // list
  20581. )
  20582. {
  20583. D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
  20584. _res = list_var;
  20585. goto done;
  20586. }
  20587. p->mark = _mark;
  20588. D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
  20589. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
  20590. }
  20591. { // tuple
  20592. if (p->error_indicator) {
  20593. p->level--;
  20594. return NULL;
  20595. }
  20596. D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
  20597. expr_ty tuple_var;
  20598. if (
  20599. (tuple_var = tuple_rule(p)) // tuple
  20600. )
  20601. {
  20602. D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
  20603. _res = tuple_var;
  20604. goto done;
  20605. }
  20606. p->mark = _mark;
  20607. D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
  20608. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
  20609. }
  20610. { // '(' invalid_ann_assign_target ')'
  20611. if (p->error_indicator) {
  20612. p->level--;
  20613. return NULL;
  20614. }
  20615. D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
  20616. Token * _literal;
  20617. Token * _literal_1;
  20618. expr_ty a;
  20619. if (
  20620. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  20621. &&
  20622. (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
  20623. &&
  20624. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  20625. )
  20626. {
  20627. D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
  20628. _res = a;
  20629. if (_res == NULL && PyErr_Occurred()) {
  20630. p->error_indicator = 1;
  20631. p->level--;
  20632. return NULL;
  20633. }
  20634. goto done;
  20635. }
  20636. p->mark = _mark;
  20637. D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
  20638. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
  20639. }
  20640. _res = NULL;
  20641. done:
  20642. p->level--;
  20643. return _res;
  20644. }
  20645. // invalid_del_stmt: 'del' star_expressions
  20646. static void *
  20647. invalid_del_stmt_rule(Parser *p)
  20648. {
  20649. if (p->level++ == MAXSTACK) {
  20650. _Pypegen_stack_overflow(p);
  20651. }
  20652. if (p->error_indicator) {
  20653. p->level--;
  20654. return NULL;
  20655. }
  20656. void * _res = NULL;
  20657. int _mark = p->mark;
  20658. { // 'del' star_expressions
  20659. if (p->error_indicator) {
  20660. p->level--;
  20661. return NULL;
  20662. }
  20663. D(fprintf(stderr, "%*c> invalid_del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
  20664. Token * _keyword;
  20665. expr_ty a;
  20666. if (
  20667. (_keyword = _PyPegen_expect_token(p, 604)) // token='del'
  20668. &&
  20669. (a = star_expressions_rule(p)) // star_expressions
  20670. )
  20671. {
  20672. D(fprintf(stderr, "%*c+ invalid_del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
  20673. _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( DEL_TARGETS , a );
  20674. if (_res == NULL && PyErr_Occurred()) {
  20675. p->error_indicator = 1;
  20676. p->level--;
  20677. return NULL;
  20678. }
  20679. goto done;
  20680. }
  20681. p->mark = _mark;
  20682. D(fprintf(stderr, "%*c%s invalid_del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  20683. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' star_expressions"));
  20684. }
  20685. _res = NULL;
  20686. done:
  20687. p->level--;
  20688. return _res;
  20689. }
  20690. // invalid_block: NEWLINE !INDENT
  20691. static void *
  20692. invalid_block_rule(Parser *p)
  20693. {
  20694. if (p->level++ == MAXSTACK) {
  20695. _Pypegen_stack_overflow(p);
  20696. }
  20697. if (p->error_indicator) {
  20698. p->level--;
  20699. return NULL;
  20700. }
  20701. void * _res = NULL;
  20702. int _mark = p->mark;
  20703. { // NEWLINE !INDENT
  20704. if (p->error_indicator) {
  20705. p->level--;
  20706. return NULL;
  20707. }
  20708. D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
  20709. Token * newline_var;
  20710. if (
  20711. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  20712. &&
  20713. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
  20714. )
  20715. {
  20716. D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
  20717. _res = RAISE_INDENTATION_ERROR ( "expected an indented block" );
  20718. if (_res == NULL && PyErr_Occurred()) {
  20719. p->error_indicator = 1;
  20720. p->level--;
  20721. return NULL;
  20722. }
  20723. goto done;
  20724. }
  20725. p->mark = _mark;
  20726. D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ',
  20727. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT"));
  20728. }
  20729. _res = NULL;
  20730. done:
  20731. p->level--;
  20732. return _res;
  20733. }
  20734. // invalid_comprehension:
  20735. // | ('[' | '(' | '{') starred_expression for_if_clauses
  20736. // | ('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses
  20737. // | ('[' | '{') star_named_expression ',' for_if_clauses
  20738. static void *
  20739. invalid_comprehension_rule(Parser *p)
  20740. {
  20741. if (p->level++ == MAXSTACK) {
  20742. _Pypegen_stack_overflow(p);
  20743. }
  20744. if (p->error_indicator) {
  20745. p->level--;
  20746. return NULL;
  20747. }
  20748. void * _res = NULL;
  20749. int _mark = p->mark;
  20750. { // ('[' | '(' | '{') starred_expression for_if_clauses
  20751. if (p->error_indicator) {
  20752. p->level--;
  20753. return NULL;
  20754. }
  20755. D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
  20756. void *_tmp_167_var;
  20757. expr_ty a;
  20758. asdl_comprehension_seq* for_if_clauses_var;
  20759. if (
  20760. (_tmp_167_var = _tmp_167_rule(p)) // '[' | '(' | '{'
  20761. &&
  20762. (a = starred_expression_rule(p)) // starred_expression
  20763. &&
  20764. (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
  20765. )
  20766. {
  20767. D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
  20768. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" );
  20769. if (_res == NULL && PyErr_Occurred()) {
  20770. p->error_indicator = 1;
  20771. p->level--;
  20772. return NULL;
  20773. }
  20774. goto done;
  20775. }
  20776. p->mark = _mark;
  20777. D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
  20778. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
  20779. }
  20780. { // ('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses
  20781. if (p->error_indicator) {
  20782. p->level--;
  20783. return NULL;
  20784. }
  20785. D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses"));
  20786. Token * _literal;
  20787. void *_tmp_168_var;
  20788. expr_ty a;
  20789. asdl_expr_seq* b;
  20790. asdl_comprehension_seq* for_if_clauses_var;
  20791. if (
  20792. (_tmp_168_var = _tmp_168_rule(p)) // '[' | '{'
  20793. &&
  20794. (a = star_named_expression_rule(p)) // star_named_expression
  20795. &&
  20796. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  20797. &&
  20798. (b = star_named_expressions_rule(p)) // star_named_expressions
  20799. &&
  20800. (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
  20801. )
  20802. {
  20803. D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses"));
  20804. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , PyPegen_last_item ( b , expr_ty ) , "did you forget parentheses around the comprehension target?" );
  20805. if (_res == NULL && PyErr_Occurred()) {
  20806. p->error_indicator = 1;
  20807. p->level--;
  20808. return NULL;
  20809. }
  20810. goto done;
  20811. }
  20812. p->mark = _mark;
  20813. D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
  20814. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses"));
  20815. }
  20816. { // ('[' | '{') star_named_expression ',' for_if_clauses
  20817. if (p->error_indicator) {
  20818. p->level--;
  20819. return NULL;
  20820. }
  20821. D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' for_if_clauses"));
  20822. void *_tmp_169_var;
  20823. expr_ty a;
  20824. Token * b;
  20825. asdl_comprehension_seq* for_if_clauses_var;
  20826. if (
  20827. (_tmp_169_var = _tmp_169_rule(p)) // '[' | '{'
  20828. &&
  20829. (a = star_named_expression_rule(p)) // star_named_expression
  20830. &&
  20831. (b = _PyPegen_expect_token(p, 12)) // token=','
  20832. &&
  20833. (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
  20834. )
  20835. {
  20836. D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' for_if_clauses"));
  20837. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "did you forget parentheses around the comprehension target?" );
  20838. if (_res == NULL && PyErr_Occurred()) {
  20839. p->error_indicator = 1;
  20840. p->level--;
  20841. return NULL;
  20842. }
  20843. goto done;
  20844. }
  20845. p->mark = _mark;
  20846. D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
  20847. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '{') star_named_expression ',' for_if_clauses"));
  20848. }
  20849. _res = NULL;
  20850. done:
  20851. p->level--;
  20852. return _res;
  20853. }
  20854. // invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}'
  20855. static void *
  20856. invalid_dict_comprehension_rule(Parser *p)
  20857. {
  20858. if (p->level++ == MAXSTACK) {
  20859. _Pypegen_stack_overflow(p);
  20860. }
  20861. if (p->error_indicator) {
  20862. p->level--;
  20863. return NULL;
  20864. }
  20865. void * _res = NULL;
  20866. int _mark = p->mark;
  20867. { // '{' '**' bitwise_or for_if_clauses '}'
  20868. if (p->error_indicator) {
  20869. p->level--;
  20870. return NULL;
  20871. }
  20872. D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
  20873. Token * _literal;
  20874. Token * _literal_1;
  20875. Token * a;
  20876. expr_ty bitwise_or_var;
  20877. asdl_comprehension_seq* for_if_clauses_var;
  20878. if (
  20879. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  20880. &&
  20881. (a = _PyPegen_expect_token(p, 35)) // token='**'
  20882. &&
  20883. (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
  20884. &&
  20885. (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
  20886. &&
  20887. (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
  20888. )
  20889. {
  20890. D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
  20891. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" );
  20892. if (_res == NULL && PyErr_Occurred()) {
  20893. p->error_indicator = 1;
  20894. p->level--;
  20895. return NULL;
  20896. }
  20897. goto done;
  20898. }
  20899. p->mark = _mark;
  20900. D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
  20901. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
  20902. }
  20903. _res = NULL;
  20904. done:
  20905. p->level--;
  20906. return _res;
  20907. }
  20908. // invalid_parameters:
  20909. // | "/" ','
  20910. // | (slash_no_default | slash_with_default) param_maybe_default* '/'
  20911. // | slash_no_default? param_no_default* invalid_parameters_helper param_no_default
  20912. // | param_no_default* '(' param_no_default+ ','? ')'
  20913. // | [(slash_no_default | slash_with_default)] param_maybe_default* '*' (',' | param_no_default) param_maybe_default* '/'
  20914. // | param_maybe_default+ '/' '*'
  20915. static void *
  20916. invalid_parameters_rule(Parser *p)
  20917. {
  20918. if (p->level++ == MAXSTACK) {
  20919. _Pypegen_stack_overflow(p);
  20920. }
  20921. if (p->error_indicator) {
  20922. p->level--;
  20923. return NULL;
  20924. }
  20925. void * _res = NULL;
  20926. int _mark = p->mark;
  20927. { // "/" ','
  20928. if (p->error_indicator) {
  20929. p->level--;
  20930. return NULL;
  20931. }
  20932. D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"/\" ','"));
  20933. Token * _literal;
  20934. Token * a;
  20935. if (
  20936. (a = _PyPegen_expect_token(p, 17)) // token='/'
  20937. &&
  20938. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  20939. )
  20940. {
  20941. D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"/\" ','"));
  20942. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "at least one argument must precede /" );
  20943. if (_res == NULL && PyErr_Occurred()) {
  20944. p->error_indicator = 1;
  20945. p->level--;
  20946. return NULL;
  20947. }
  20948. goto done;
  20949. }
  20950. p->mark = _mark;
  20951. D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
  20952. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"/\" ','"));
  20953. }
  20954. { // (slash_no_default | slash_with_default) param_maybe_default* '/'
  20955. if (p->error_indicator) {
  20956. p->level--;
  20957. return NULL;
  20958. }
  20959. D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(slash_no_default | slash_with_default) param_maybe_default* '/'"));
  20960. asdl_seq * _loop0_171_var;
  20961. void *_tmp_170_var;
  20962. Token * a;
  20963. if (
  20964. (_tmp_170_var = _tmp_170_rule(p)) // slash_no_default | slash_with_default
  20965. &&
  20966. (_loop0_171_var = _loop0_171_rule(p)) // param_maybe_default*
  20967. &&
  20968. (a = _PyPegen_expect_token(p, 17)) // token='/'
  20969. )
  20970. {
  20971. D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(slash_no_default | slash_with_default) param_maybe_default* '/'"));
  20972. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "/ may appear only once" );
  20973. if (_res == NULL && PyErr_Occurred()) {
  20974. p->error_indicator = 1;
  20975. p->level--;
  20976. return NULL;
  20977. }
  20978. goto done;
  20979. }
  20980. p->mark = _mark;
  20981. D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
  20982. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(slash_no_default | slash_with_default) param_maybe_default* '/'"));
  20983. }
  20984. { // slash_no_default? param_no_default* invalid_parameters_helper param_no_default
  20985. if (p->error_indicator) {
  20986. p->level--;
  20987. return NULL;
  20988. }
  20989. D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default? param_no_default* invalid_parameters_helper param_no_default"));
  20990. asdl_seq * _loop0_172_var;
  20991. void *_opt_var;
  20992. UNUSED(_opt_var); // Silence compiler warnings
  20993. arg_ty a;
  20994. void *invalid_parameters_helper_var;
  20995. if (
  20996. (_opt_var = slash_no_default_rule(p), !p->error_indicator) // slash_no_default?
  20997. &&
  20998. (_loop0_172_var = _loop0_172_rule(p)) // param_no_default*
  20999. &&
  21000. (invalid_parameters_helper_var = invalid_parameters_helper_rule(p)) // invalid_parameters_helper
  21001. &&
  21002. (a = param_no_default_rule(p)) // param_no_default
  21003. )
  21004. {
  21005. D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default? param_no_default* invalid_parameters_helper param_no_default"));
  21006. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "parameter without a default follows parameter with a default" );
  21007. if (_res == NULL && PyErr_Occurred()) {
  21008. p->error_indicator = 1;
  21009. p->level--;
  21010. return NULL;
  21011. }
  21012. goto done;
  21013. }
  21014. p->mark = _mark;
  21015. D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
  21016. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default? param_no_default* invalid_parameters_helper param_no_default"));
  21017. }
  21018. { // param_no_default* '(' param_no_default+ ','? ')'
  21019. if (p->error_indicator) {
  21020. p->level--;
  21021. return NULL;
  21022. }
  21023. D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* '(' param_no_default+ ','? ')'"));
  21024. asdl_seq * _loop0_173_var;
  21025. asdl_seq * _loop1_174_var;
  21026. void *_opt_var;
  21027. UNUSED(_opt_var); // Silence compiler warnings
  21028. Token * a;
  21029. Token * b;
  21030. if (
  21031. (_loop0_173_var = _loop0_173_rule(p)) // param_no_default*
  21032. &&
  21033. (a = _PyPegen_expect_token(p, 7)) // token='('
  21034. &&
  21035. (_loop1_174_var = _loop1_174_rule(p)) // param_no_default+
  21036. &&
  21037. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  21038. &&
  21039. (b = _PyPegen_expect_token(p, 8)) // token=')'
  21040. )
  21041. {
  21042. D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* '(' param_no_default+ ','? ')'"));
  21043. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "Function parameters cannot be parenthesized" );
  21044. if (_res == NULL && PyErr_Occurred()) {
  21045. p->error_indicator = 1;
  21046. p->level--;
  21047. return NULL;
  21048. }
  21049. goto done;
  21050. }
  21051. p->mark = _mark;
  21052. D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
  21053. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* '(' param_no_default+ ','? ')'"));
  21054. }
  21055. { // [(slash_no_default | slash_with_default)] param_maybe_default* '*' (',' | param_no_default) param_maybe_default* '/'
  21056. if (p->error_indicator) {
  21057. p->level--;
  21058. return NULL;
  21059. }
  21060. D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "[(slash_no_default | slash_with_default)] param_maybe_default* '*' (',' | param_no_default) param_maybe_default* '/'"));
  21061. Token * _literal;
  21062. asdl_seq * _loop0_176_var;
  21063. asdl_seq * _loop0_178_var;
  21064. void *_opt_var;
  21065. UNUSED(_opt_var); // Silence compiler warnings
  21066. void *_tmp_177_var;
  21067. Token * a;
  21068. if (
  21069. (_opt_var = _tmp_175_rule(p), !p->error_indicator) // [(slash_no_default | slash_with_default)]
  21070. &&
  21071. (_loop0_176_var = _loop0_176_rule(p)) // param_maybe_default*
  21072. &&
  21073. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  21074. &&
  21075. (_tmp_177_var = _tmp_177_rule(p)) // ',' | param_no_default
  21076. &&
  21077. (_loop0_178_var = _loop0_178_rule(p)) // param_maybe_default*
  21078. &&
  21079. (a = _PyPegen_expect_token(p, 17)) // token='/'
  21080. )
  21081. {
  21082. D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "[(slash_no_default | slash_with_default)] param_maybe_default* '*' (',' | param_no_default) param_maybe_default* '/'"));
  21083. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "/ must be ahead of *" );
  21084. if (_res == NULL && PyErr_Occurred()) {
  21085. p->error_indicator = 1;
  21086. p->level--;
  21087. return NULL;
  21088. }
  21089. goto done;
  21090. }
  21091. p->mark = _mark;
  21092. D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
  21093. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "[(slash_no_default | slash_with_default)] param_maybe_default* '*' (',' | param_no_default) param_maybe_default* '/'"));
  21094. }
  21095. { // param_maybe_default+ '/' '*'
  21096. if (p->error_indicator) {
  21097. p->level--;
  21098. return NULL;
  21099. }
  21100. D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default+ '/' '*'"));
  21101. Token * _literal;
  21102. asdl_seq * _loop1_179_var;
  21103. Token * a;
  21104. if (
  21105. (_loop1_179_var = _loop1_179_rule(p)) // param_maybe_default+
  21106. &&
  21107. (_literal = _PyPegen_expect_token(p, 17)) // token='/'
  21108. &&
  21109. (a = _PyPegen_expect_token(p, 16)) // token='*'
  21110. )
  21111. {
  21112. D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_maybe_default+ '/' '*'"));
  21113. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expected comma between / and *" );
  21114. if (_res == NULL && PyErr_Occurred()) {
  21115. p->error_indicator = 1;
  21116. p->level--;
  21117. return NULL;
  21118. }
  21119. goto done;
  21120. }
  21121. p->mark = _mark;
  21122. D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
  21123. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default+ '/' '*'"));
  21124. }
  21125. _res = NULL;
  21126. done:
  21127. p->level--;
  21128. return _res;
  21129. }
  21130. // invalid_default: '=' &(')' | ',')
  21131. static void *
  21132. invalid_default_rule(Parser *p)
  21133. {
  21134. if (p->level++ == MAXSTACK) {
  21135. _Pypegen_stack_overflow(p);
  21136. }
  21137. if (p->error_indicator) {
  21138. p->level--;
  21139. return NULL;
  21140. }
  21141. void * _res = NULL;
  21142. int _mark = p->mark;
  21143. { // '=' &(')' | ',')
  21144. if (p->error_indicator) {
  21145. p->level--;
  21146. return NULL;
  21147. }
  21148. D(fprintf(stderr, "%*c> invalid_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' &(')' | ',')"));
  21149. Token * a;
  21150. if (
  21151. (a = _PyPegen_expect_token(p, 22)) // token='='
  21152. &&
  21153. _PyPegen_lookahead(1, _tmp_180_rule, p)
  21154. )
  21155. {
  21156. D(fprintf(stderr, "%*c+ invalid_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' &(')' | ',')"));
  21157. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expected default value expression" );
  21158. if (_res == NULL && PyErr_Occurred()) {
  21159. p->error_indicator = 1;
  21160. p->level--;
  21161. return NULL;
  21162. }
  21163. goto done;
  21164. }
  21165. p->mark = _mark;
  21166. D(fprintf(stderr, "%*c%s invalid_default[%d-%d]: %s failed!\n", p->level, ' ',
  21167. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' &(')' | ',')"));
  21168. }
  21169. _res = NULL;
  21170. done:
  21171. p->level--;
  21172. return _res;
  21173. }
  21174. // invalid_star_etc:
  21175. // | '*' (')' | ',' (')' | '**'))
  21176. // | '*' ',' TYPE_COMMENT
  21177. // | '*' param '='
  21178. // | '*' (param_no_default | ',') param_maybe_default* '*' (param_no_default | ',')
  21179. static void *
  21180. invalid_star_etc_rule(Parser *p)
  21181. {
  21182. if (p->level++ == MAXSTACK) {
  21183. _Pypegen_stack_overflow(p);
  21184. }
  21185. if (p->error_indicator) {
  21186. p->level--;
  21187. return NULL;
  21188. }
  21189. void * _res = NULL;
  21190. int _mark = p->mark;
  21191. { // '*' (')' | ',' (')' | '**'))
  21192. if (p->error_indicator) {
  21193. p->level--;
  21194. return NULL;
  21195. }
  21196. D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
  21197. void *_tmp_181_var;
  21198. Token * a;
  21199. if (
  21200. (a = _PyPegen_expect_token(p, 16)) // token='*'
  21201. &&
  21202. (_tmp_181_var = _tmp_181_rule(p)) // ')' | ',' (')' | '**')
  21203. )
  21204. {
  21205. D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
  21206. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "named arguments must follow bare *" );
  21207. if (_res == NULL && PyErr_Occurred()) {
  21208. p->error_indicator = 1;
  21209. p->level--;
  21210. return NULL;
  21211. }
  21212. goto done;
  21213. }
  21214. p->mark = _mark;
  21215. D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
  21216. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
  21217. }
  21218. { // '*' ',' TYPE_COMMENT
  21219. if (p->error_indicator) {
  21220. p->level--;
  21221. return NULL;
  21222. }
  21223. D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
  21224. Token * _literal;
  21225. Token * _literal_1;
  21226. Token * type_comment_var;
  21227. if (
  21228. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  21229. &&
  21230. (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
  21231. &&
  21232. (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
  21233. )
  21234. {
  21235. D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
  21236. _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" );
  21237. if (_res == NULL && PyErr_Occurred()) {
  21238. p->error_indicator = 1;
  21239. p->level--;
  21240. return NULL;
  21241. }
  21242. goto done;
  21243. }
  21244. p->mark = _mark;
  21245. D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
  21246. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT"));
  21247. }
  21248. { // '*' param '='
  21249. if (p->error_indicator) {
  21250. p->level--;
  21251. return NULL;
  21252. }
  21253. D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param '='"));
  21254. Token * _literal;
  21255. Token * a;
  21256. arg_ty param_var;
  21257. if (
  21258. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  21259. &&
  21260. (param_var = param_rule(p)) // param
  21261. &&
  21262. (a = _PyPegen_expect_token(p, 22)) // token='='
  21263. )
  21264. {
  21265. D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param '='"));
  21266. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "var-positional argument cannot have default value" );
  21267. if (_res == NULL && PyErr_Occurred()) {
  21268. p->error_indicator = 1;
  21269. p->level--;
  21270. return NULL;
  21271. }
  21272. goto done;
  21273. }
  21274. p->mark = _mark;
  21275. D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
  21276. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param '='"));
  21277. }
  21278. { // '*' (param_no_default | ',') param_maybe_default* '*' (param_no_default | ',')
  21279. if (p->error_indicator) {
  21280. p->level--;
  21281. return NULL;
  21282. }
  21283. D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (param_no_default | ',') param_maybe_default* '*' (param_no_default | ',')"));
  21284. Token * _literal;
  21285. asdl_seq * _loop0_183_var;
  21286. void *_tmp_182_var;
  21287. void *_tmp_184_var;
  21288. Token * a;
  21289. if (
  21290. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  21291. &&
  21292. (_tmp_182_var = _tmp_182_rule(p)) // param_no_default | ','
  21293. &&
  21294. (_loop0_183_var = _loop0_183_rule(p)) // param_maybe_default*
  21295. &&
  21296. (a = _PyPegen_expect_token(p, 16)) // token='*'
  21297. &&
  21298. (_tmp_184_var = _tmp_184_rule(p)) // param_no_default | ','
  21299. )
  21300. {
  21301. D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (param_no_default | ',') param_maybe_default* '*' (param_no_default | ',')"));
  21302. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "* argument may appear only once" );
  21303. if (_res == NULL && PyErr_Occurred()) {
  21304. p->error_indicator = 1;
  21305. p->level--;
  21306. return NULL;
  21307. }
  21308. goto done;
  21309. }
  21310. p->mark = _mark;
  21311. D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
  21312. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (param_no_default | ',') param_maybe_default* '*' (param_no_default | ',')"));
  21313. }
  21314. _res = NULL;
  21315. done:
  21316. p->level--;
  21317. return _res;
  21318. }
  21319. // invalid_kwds: '**' param '=' | '**' param ',' param | '**' param ',' ('*' | '**' | '/')
  21320. static void *
  21321. invalid_kwds_rule(Parser *p)
  21322. {
  21323. if (p->level++ == MAXSTACK) {
  21324. _Pypegen_stack_overflow(p);
  21325. }
  21326. if (p->error_indicator) {
  21327. p->level--;
  21328. return NULL;
  21329. }
  21330. void * _res = NULL;
  21331. int _mark = p->mark;
  21332. { // '**' param '='
  21333. if (p->error_indicator) {
  21334. p->level--;
  21335. return NULL;
  21336. }
  21337. D(fprintf(stderr, "%*c> invalid_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param '='"));
  21338. Token * _literal;
  21339. Token * a;
  21340. arg_ty param_var;
  21341. if (
  21342. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  21343. &&
  21344. (param_var = param_rule(p)) // param
  21345. &&
  21346. (a = _PyPegen_expect_token(p, 22)) // token='='
  21347. )
  21348. {
  21349. D(fprintf(stderr, "%*c+ invalid_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param '='"));
  21350. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "var-keyword argument cannot have default value" );
  21351. if (_res == NULL && PyErr_Occurred()) {
  21352. p->error_indicator = 1;
  21353. p->level--;
  21354. return NULL;
  21355. }
  21356. goto done;
  21357. }
  21358. p->mark = _mark;
  21359. D(fprintf(stderr, "%*c%s invalid_kwds[%d-%d]: %s failed!\n", p->level, ' ',
  21360. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param '='"));
  21361. }
  21362. { // '**' param ',' param
  21363. if (p->error_indicator) {
  21364. p->level--;
  21365. return NULL;
  21366. }
  21367. D(fprintf(stderr, "%*c> invalid_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param ',' param"));
  21368. Token * _literal;
  21369. Token * _literal_1;
  21370. arg_ty a;
  21371. arg_ty param_var;
  21372. if (
  21373. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  21374. &&
  21375. (param_var = param_rule(p)) // param
  21376. &&
  21377. (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
  21378. &&
  21379. (a = param_rule(p)) // param
  21380. )
  21381. {
  21382. D(fprintf(stderr, "%*c+ invalid_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param ',' param"));
  21383. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "arguments cannot follow var-keyword argument" );
  21384. if (_res == NULL && PyErr_Occurred()) {
  21385. p->error_indicator = 1;
  21386. p->level--;
  21387. return NULL;
  21388. }
  21389. goto done;
  21390. }
  21391. p->mark = _mark;
  21392. D(fprintf(stderr, "%*c%s invalid_kwds[%d-%d]: %s failed!\n", p->level, ' ',
  21393. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param ',' param"));
  21394. }
  21395. { // '**' param ',' ('*' | '**' | '/')
  21396. if (p->error_indicator) {
  21397. p->level--;
  21398. return NULL;
  21399. }
  21400. D(fprintf(stderr, "%*c> invalid_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param ',' ('*' | '**' | '/')"));
  21401. Token * _literal;
  21402. Token * _literal_1;
  21403. Token* a;
  21404. arg_ty param_var;
  21405. if (
  21406. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  21407. &&
  21408. (param_var = param_rule(p)) // param
  21409. &&
  21410. (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
  21411. &&
  21412. (a = (Token*)_tmp_185_rule(p)) // '*' | '**' | '/'
  21413. )
  21414. {
  21415. D(fprintf(stderr, "%*c+ invalid_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param ',' ('*' | '**' | '/')"));
  21416. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "arguments cannot follow var-keyword argument" );
  21417. if (_res == NULL && PyErr_Occurred()) {
  21418. p->error_indicator = 1;
  21419. p->level--;
  21420. return NULL;
  21421. }
  21422. goto done;
  21423. }
  21424. p->mark = _mark;
  21425. D(fprintf(stderr, "%*c%s invalid_kwds[%d-%d]: %s failed!\n", p->level, ' ',
  21426. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param ',' ('*' | '**' | '/')"));
  21427. }
  21428. _res = NULL;
  21429. done:
  21430. p->level--;
  21431. return _res;
  21432. }
  21433. // invalid_parameters_helper: slash_with_default | param_with_default+
  21434. static void *
  21435. invalid_parameters_helper_rule(Parser *p)
  21436. {
  21437. if (p->level++ == MAXSTACK) {
  21438. _Pypegen_stack_overflow(p);
  21439. }
  21440. if (p->error_indicator) {
  21441. p->level--;
  21442. return NULL;
  21443. }
  21444. void * _res = NULL;
  21445. int _mark = p->mark;
  21446. { // slash_with_default
  21447. if (p->error_indicator) {
  21448. p->level--;
  21449. return NULL;
  21450. }
  21451. D(fprintf(stderr, "%*c> invalid_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
  21452. SlashWithDefault* a;
  21453. if (
  21454. (a = slash_with_default_rule(p)) // slash_with_default
  21455. )
  21456. {
  21457. D(fprintf(stderr, "%*c+ invalid_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
  21458. _res = _PyPegen_singleton_seq ( p , a );
  21459. if (_res == NULL && PyErr_Occurred()) {
  21460. p->error_indicator = 1;
  21461. p->level--;
  21462. return NULL;
  21463. }
  21464. goto done;
  21465. }
  21466. p->mark = _mark;
  21467. D(fprintf(stderr, "%*c%s invalid_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ',
  21468. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default"));
  21469. }
  21470. { // param_with_default+
  21471. if (p->error_indicator) {
  21472. p->level--;
  21473. return NULL;
  21474. }
  21475. D(fprintf(stderr, "%*c> invalid_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
  21476. asdl_seq * _loop1_186_var;
  21477. if (
  21478. (_loop1_186_var = _loop1_186_rule(p)) // param_with_default+
  21479. )
  21480. {
  21481. D(fprintf(stderr, "%*c+ invalid_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
  21482. _res = _loop1_186_var;
  21483. goto done;
  21484. }
  21485. p->mark = _mark;
  21486. D(fprintf(stderr, "%*c%s invalid_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ',
  21487. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+"));
  21488. }
  21489. _res = NULL;
  21490. done:
  21491. p->level--;
  21492. return _res;
  21493. }
  21494. // invalid_lambda_parameters:
  21495. // | "/" ','
  21496. // | (lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* '/'
  21497. // | lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default
  21498. // | lambda_param_no_default* '(' ','.lambda_param+ ','? ')'
  21499. // | [(lambda_slash_no_default | lambda_slash_with_default)] lambda_param_maybe_default* '*' (',' | lambda_param_no_default) lambda_param_maybe_default* '/'
  21500. // | lambda_param_maybe_default+ '/' '*'
  21501. static void *
  21502. invalid_lambda_parameters_rule(Parser *p)
  21503. {
  21504. if (p->level++ == MAXSTACK) {
  21505. _Pypegen_stack_overflow(p);
  21506. }
  21507. if (p->error_indicator) {
  21508. p->level--;
  21509. return NULL;
  21510. }
  21511. void * _res = NULL;
  21512. int _mark = p->mark;
  21513. { // "/" ','
  21514. if (p->error_indicator) {
  21515. p->level--;
  21516. return NULL;
  21517. }
  21518. D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"/\" ','"));
  21519. Token * _literal;
  21520. Token * a;
  21521. if (
  21522. (a = _PyPegen_expect_token(p, 17)) // token='/'
  21523. &&
  21524. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  21525. )
  21526. {
  21527. D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"/\" ','"));
  21528. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "at least one argument must precede /" );
  21529. if (_res == NULL && PyErr_Occurred()) {
  21530. p->error_indicator = 1;
  21531. p->level--;
  21532. return NULL;
  21533. }
  21534. goto done;
  21535. }
  21536. p->mark = _mark;
  21537. D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
  21538. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"/\" ','"));
  21539. }
  21540. { // (lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* '/'
  21541. if (p->error_indicator) {
  21542. p->level--;
  21543. return NULL;
  21544. }
  21545. D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* '/'"));
  21546. asdl_seq * _loop0_188_var;
  21547. void *_tmp_187_var;
  21548. Token * a;
  21549. if (
  21550. (_tmp_187_var = _tmp_187_rule(p)) // lambda_slash_no_default | lambda_slash_with_default
  21551. &&
  21552. (_loop0_188_var = _loop0_188_rule(p)) // lambda_param_maybe_default*
  21553. &&
  21554. (a = _PyPegen_expect_token(p, 17)) // token='/'
  21555. )
  21556. {
  21557. D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* '/'"));
  21558. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "/ may appear only once" );
  21559. if (_res == NULL && PyErr_Occurred()) {
  21560. p->error_indicator = 1;
  21561. p->level--;
  21562. return NULL;
  21563. }
  21564. goto done;
  21565. }
  21566. p->mark = _mark;
  21567. D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
  21568. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* '/'"));
  21569. }
  21570. { // lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default
  21571. if (p->error_indicator) {
  21572. p->level--;
  21573. return NULL;
  21574. }
  21575. D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default"));
  21576. asdl_seq * _loop0_189_var;
  21577. void *_opt_var;
  21578. UNUSED(_opt_var); // Silence compiler warnings
  21579. arg_ty a;
  21580. void *invalid_lambda_parameters_helper_var;
  21581. if (
  21582. (_opt_var = lambda_slash_no_default_rule(p), !p->error_indicator) // lambda_slash_no_default?
  21583. &&
  21584. (_loop0_189_var = _loop0_189_rule(p)) // lambda_param_no_default*
  21585. &&
  21586. (invalid_lambda_parameters_helper_var = invalid_lambda_parameters_helper_rule(p)) // invalid_lambda_parameters_helper
  21587. &&
  21588. (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
  21589. )
  21590. {
  21591. D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default"));
  21592. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "parameter without a default follows parameter with a default" );
  21593. if (_res == NULL && PyErr_Occurred()) {
  21594. p->error_indicator = 1;
  21595. p->level--;
  21596. return NULL;
  21597. }
  21598. goto done;
  21599. }
  21600. p->mark = _mark;
  21601. D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
  21602. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default"));
  21603. }
  21604. { // lambda_param_no_default* '(' ','.lambda_param+ ','? ')'
  21605. if (p->error_indicator) {
  21606. p->level--;
  21607. return NULL;
  21608. }
  21609. D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* '(' ','.lambda_param+ ','? ')'"));
  21610. asdl_seq * _gather_191_var;
  21611. asdl_seq * _loop0_190_var;
  21612. void *_opt_var;
  21613. UNUSED(_opt_var); // Silence compiler warnings
  21614. Token * a;
  21615. Token * b;
  21616. if (
  21617. (_loop0_190_var = _loop0_190_rule(p)) // lambda_param_no_default*
  21618. &&
  21619. (a = _PyPegen_expect_token(p, 7)) // token='('
  21620. &&
  21621. (_gather_191_var = _gather_191_rule(p)) // ','.lambda_param+
  21622. &&
  21623. (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  21624. &&
  21625. (b = _PyPegen_expect_token(p, 8)) // token=')'
  21626. )
  21627. {
  21628. D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* '(' ','.lambda_param+ ','? ')'"));
  21629. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "Lambda expression parameters cannot be parenthesized" );
  21630. if (_res == NULL && PyErr_Occurred()) {
  21631. p->error_indicator = 1;
  21632. p->level--;
  21633. return NULL;
  21634. }
  21635. goto done;
  21636. }
  21637. p->mark = _mark;
  21638. D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
  21639. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* '(' ','.lambda_param+ ','? ')'"));
  21640. }
  21641. { // [(lambda_slash_no_default | lambda_slash_with_default)] lambda_param_maybe_default* '*' (',' | lambda_param_no_default) lambda_param_maybe_default* '/'
  21642. if (p->error_indicator) {
  21643. p->level--;
  21644. return NULL;
  21645. }
  21646. D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "[(lambda_slash_no_default | lambda_slash_with_default)] lambda_param_maybe_default* '*' (',' | lambda_param_no_default) lambda_param_maybe_default* '/'"));
  21647. Token * _literal;
  21648. asdl_seq * _loop0_194_var;
  21649. asdl_seq * _loop0_196_var;
  21650. void *_opt_var;
  21651. UNUSED(_opt_var); // Silence compiler warnings
  21652. void *_tmp_195_var;
  21653. Token * a;
  21654. if (
  21655. (_opt_var = _tmp_193_rule(p), !p->error_indicator) // [(lambda_slash_no_default | lambda_slash_with_default)]
  21656. &&
  21657. (_loop0_194_var = _loop0_194_rule(p)) // lambda_param_maybe_default*
  21658. &&
  21659. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  21660. &&
  21661. (_tmp_195_var = _tmp_195_rule(p)) // ',' | lambda_param_no_default
  21662. &&
  21663. (_loop0_196_var = _loop0_196_rule(p)) // lambda_param_maybe_default*
  21664. &&
  21665. (a = _PyPegen_expect_token(p, 17)) // token='/'
  21666. )
  21667. {
  21668. D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "[(lambda_slash_no_default | lambda_slash_with_default)] lambda_param_maybe_default* '*' (',' | lambda_param_no_default) lambda_param_maybe_default* '/'"));
  21669. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "/ must be ahead of *" );
  21670. if (_res == NULL && PyErr_Occurred()) {
  21671. p->error_indicator = 1;
  21672. p->level--;
  21673. return NULL;
  21674. }
  21675. goto done;
  21676. }
  21677. p->mark = _mark;
  21678. D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
  21679. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "[(lambda_slash_no_default | lambda_slash_with_default)] lambda_param_maybe_default* '*' (',' | lambda_param_no_default) lambda_param_maybe_default* '/'"));
  21680. }
  21681. { // lambda_param_maybe_default+ '/' '*'
  21682. if (p->error_indicator) {
  21683. p->level--;
  21684. return NULL;
  21685. }
  21686. D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default+ '/' '*'"));
  21687. Token * _literal;
  21688. asdl_seq * _loop1_197_var;
  21689. Token * a;
  21690. if (
  21691. (_loop1_197_var = _loop1_197_rule(p)) // lambda_param_maybe_default+
  21692. &&
  21693. (_literal = _PyPegen_expect_token(p, 17)) // token='/'
  21694. &&
  21695. (a = _PyPegen_expect_token(p, 16)) // token='*'
  21696. )
  21697. {
  21698. D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default+ '/' '*'"));
  21699. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expected comma between / and *" );
  21700. if (_res == NULL && PyErr_Occurred()) {
  21701. p->error_indicator = 1;
  21702. p->level--;
  21703. return NULL;
  21704. }
  21705. goto done;
  21706. }
  21707. p->mark = _mark;
  21708. D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
  21709. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default+ '/' '*'"));
  21710. }
  21711. _res = NULL;
  21712. done:
  21713. p->level--;
  21714. return _res;
  21715. }
  21716. // invalid_lambda_parameters_helper:
  21717. // | lambda_slash_with_default
  21718. // | lambda_param_with_default+
  21719. static void *
  21720. invalid_lambda_parameters_helper_rule(Parser *p)
  21721. {
  21722. if (p->level++ == MAXSTACK) {
  21723. _Pypegen_stack_overflow(p);
  21724. }
  21725. if (p->error_indicator) {
  21726. p->level--;
  21727. return NULL;
  21728. }
  21729. void * _res = NULL;
  21730. int _mark = p->mark;
  21731. { // lambda_slash_with_default
  21732. if (p->error_indicator) {
  21733. p->level--;
  21734. return NULL;
  21735. }
  21736. D(fprintf(stderr, "%*c> invalid_lambda_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
  21737. SlashWithDefault* a;
  21738. if (
  21739. (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
  21740. )
  21741. {
  21742. D(fprintf(stderr, "%*c+ invalid_lambda_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
  21743. _res = _PyPegen_singleton_seq ( p , a );
  21744. if (_res == NULL && PyErr_Occurred()) {
  21745. p->error_indicator = 1;
  21746. p->level--;
  21747. return NULL;
  21748. }
  21749. goto done;
  21750. }
  21751. p->mark = _mark;
  21752. D(fprintf(stderr, "%*c%s invalid_lambda_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ',
  21753. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default"));
  21754. }
  21755. { // lambda_param_with_default+
  21756. if (p->error_indicator) {
  21757. p->level--;
  21758. return NULL;
  21759. }
  21760. D(fprintf(stderr, "%*c> invalid_lambda_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
  21761. asdl_seq * _loop1_198_var;
  21762. if (
  21763. (_loop1_198_var = _loop1_198_rule(p)) // lambda_param_with_default+
  21764. )
  21765. {
  21766. D(fprintf(stderr, "%*c+ invalid_lambda_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
  21767. _res = _loop1_198_var;
  21768. goto done;
  21769. }
  21770. p->mark = _mark;
  21771. D(fprintf(stderr, "%*c%s invalid_lambda_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ',
  21772. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+"));
  21773. }
  21774. _res = NULL;
  21775. done:
  21776. p->level--;
  21777. return _res;
  21778. }
  21779. // invalid_lambda_star_etc:
  21780. // | '*' (':' | ',' (':' | '**'))
  21781. // | '*' lambda_param '='
  21782. // | '*' (lambda_param_no_default | ',') lambda_param_maybe_default* '*' (lambda_param_no_default | ',')
  21783. static void *
  21784. invalid_lambda_star_etc_rule(Parser *p)
  21785. {
  21786. if (p->level++ == MAXSTACK) {
  21787. _Pypegen_stack_overflow(p);
  21788. }
  21789. if (p->error_indicator) {
  21790. p->level--;
  21791. return NULL;
  21792. }
  21793. void * _res = NULL;
  21794. int _mark = p->mark;
  21795. { // '*' (':' | ',' (':' | '**'))
  21796. if (p->error_indicator) {
  21797. p->level--;
  21798. return NULL;
  21799. }
  21800. D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
  21801. Token * _literal;
  21802. void *_tmp_199_var;
  21803. if (
  21804. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  21805. &&
  21806. (_tmp_199_var = _tmp_199_rule(p)) // ':' | ',' (':' | '**')
  21807. )
  21808. {
  21809. D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
  21810. _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
  21811. if (_res == NULL && PyErr_Occurred()) {
  21812. p->error_indicator = 1;
  21813. p->level--;
  21814. return NULL;
  21815. }
  21816. goto done;
  21817. }
  21818. p->mark = _mark;
  21819. D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
  21820. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
  21821. }
  21822. { // '*' lambda_param '='
  21823. if (p->error_indicator) {
  21824. p->level--;
  21825. return NULL;
  21826. }
  21827. D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' lambda_param '='"));
  21828. Token * _literal;
  21829. Token * a;
  21830. arg_ty lambda_param_var;
  21831. if (
  21832. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  21833. &&
  21834. (lambda_param_var = lambda_param_rule(p)) // lambda_param
  21835. &&
  21836. (a = _PyPegen_expect_token(p, 22)) // token='='
  21837. )
  21838. {
  21839. D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' lambda_param '='"));
  21840. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "var-positional argument cannot have default value" );
  21841. if (_res == NULL && PyErr_Occurred()) {
  21842. p->error_indicator = 1;
  21843. p->level--;
  21844. return NULL;
  21845. }
  21846. goto done;
  21847. }
  21848. p->mark = _mark;
  21849. D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
  21850. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param '='"));
  21851. }
  21852. { // '*' (lambda_param_no_default | ',') lambda_param_maybe_default* '*' (lambda_param_no_default | ',')
  21853. if (p->error_indicator) {
  21854. p->level--;
  21855. return NULL;
  21856. }
  21857. D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (lambda_param_no_default | ',') lambda_param_maybe_default* '*' (lambda_param_no_default | ',')"));
  21858. Token * _literal;
  21859. asdl_seq * _loop0_201_var;
  21860. void *_tmp_200_var;
  21861. void *_tmp_202_var;
  21862. Token * a;
  21863. if (
  21864. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  21865. &&
  21866. (_tmp_200_var = _tmp_200_rule(p)) // lambda_param_no_default | ','
  21867. &&
  21868. (_loop0_201_var = _loop0_201_rule(p)) // lambda_param_maybe_default*
  21869. &&
  21870. (a = _PyPegen_expect_token(p, 16)) // token='*'
  21871. &&
  21872. (_tmp_202_var = _tmp_202_rule(p)) // lambda_param_no_default | ','
  21873. )
  21874. {
  21875. D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (lambda_param_no_default | ',') lambda_param_maybe_default* '*' (lambda_param_no_default | ',')"));
  21876. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "* argument may appear only once" );
  21877. if (_res == NULL && PyErr_Occurred()) {
  21878. p->error_indicator = 1;
  21879. p->level--;
  21880. return NULL;
  21881. }
  21882. goto done;
  21883. }
  21884. p->mark = _mark;
  21885. D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
  21886. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (lambda_param_no_default | ',') lambda_param_maybe_default* '*' (lambda_param_no_default | ',')"));
  21887. }
  21888. _res = NULL;
  21889. done:
  21890. p->level--;
  21891. return _res;
  21892. }
  21893. // invalid_lambda_kwds:
  21894. // | '**' lambda_param '='
  21895. // | '**' lambda_param ',' lambda_param
  21896. // | '**' lambda_param ',' ('*' | '**' | '/')
  21897. static void *
  21898. invalid_lambda_kwds_rule(Parser *p)
  21899. {
  21900. if (p->level++ == MAXSTACK) {
  21901. _Pypegen_stack_overflow(p);
  21902. }
  21903. if (p->error_indicator) {
  21904. p->level--;
  21905. return NULL;
  21906. }
  21907. void * _res = NULL;
  21908. int _mark = p->mark;
  21909. { // '**' lambda_param '='
  21910. if (p->error_indicator) {
  21911. p->level--;
  21912. return NULL;
  21913. }
  21914. D(fprintf(stderr, "%*c> invalid_lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param '='"));
  21915. Token * _literal;
  21916. Token * a;
  21917. arg_ty lambda_param_var;
  21918. if (
  21919. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  21920. &&
  21921. (lambda_param_var = lambda_param_rule(p)) // lambda_param
  21922. &&
  21923. (a = _PyPegen_expect_token(p, 22)) // token='='
  21924. )
  21925. {
  21926. D(fprintf(stderr, "%*c+ invalid_lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param '='"));
  21927. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "var-keyword argument cannot have default value" );
  21928. if (_res == NULL && PyErr_Occurred()) {
  21929. p->error_indicator = 1;
  21930. p->level--;
  21931. return NULL;
  21932. }
  21933. goto done;
  21934. }
  21935. p->mark = _mark;
  21936. D(fprintf(stderr, "%*c%s invalid_lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
  21937. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param '='"));
  21938. }
  21939. { // '**' lambda_param ',' lambda_param
  21940. if (p->error_indicator) {
  21941. p->level--;
  21942. return NULL;
  21943. }
  21944. D(fprintf(stderr, "%*c> invalid_lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param ',' lambda_param"));
  21945. Token * _literal;
  21946. Token * _literal_1;
  21947. arg_ty a;
  21948. arg_ty lambda_param_var;
  21949. if (
  21950. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  21951. &&
  21952. (lambda_param_var = lambda_param_rule(p)) // lambda_param
  21953. &&
  21954. (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
  21955. &&
  21956. (a = lambda_param_rule(p)) // lambda_param
  21957. )
  21958. {
  21959. D(fprintf(stderr, "%*c+ invalid_lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param ',' lambda_param"));
  21960. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "arguments cannot follow var-keyword argument" );
  21961. if (_res == NULL && PyErr_Occurred()) {
  21962. p->error_indicator = 1;
  21963. p->level--;
  21964. return NULL;
  21965. }
  21966. goto done;
  21967. }
  21968. p->mark = _mark;
  21969. D(fprintf(stderr, "%*c%s invalid_lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
  21970. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param ',' lambda_param"));
  21971. }
  21972. { // '**' lambda_param ',' ('*' | '**' | '/')
  21973. if (p->error_indicator) {
  21974. p->level--;
  21975. return NULL;
  21976. }
  21977. D(fprintf(stderr, "%*c> invalid_lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param ',' ('*' | '**' | '/')"));
  21978. Token * _literal;
  21979. Token * _literal_1;
  21980. Token* a;
  21981. arg_ty lambda_param_var;
  21982. if (
  21983. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  21984. &&
  21985. (lambda_param_var = lambda_param_rule(p)) // lambda_param
  21986. &&
  21987. (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
  21988. &&
  21989. (a = (Token*)_tmp_203_rule(p)) // '*' | '**' | '/'
  21990. )
  21991. {
  21992. D(fprintf(stderr, "%*c+ invalid_lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param ',' ('*' | '**' | '/')"));
  21993. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "arguments cannot follow var-keyword argument" );
  21994. if (_res == NULL && PyErr_Occurred()) {
  21995. p->error_indicator = 1;
  21996. p->level--;
  21997. return NULL;
  21998. }
  21999. goto done;
  22000. }
  22001. p->mark = _mark;
  22002. D(fprintf(stderr, "%*c%s invalid_lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
  22003. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param ',' ('*' | '**' | '/')"));
  22004. }
  22005. _res = NULL;
  22006. done:
  22007. p->level--;
  22008. return _res;
  22009. }
  22010. // invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
  22011. static void *
  22012. invalid_double_type_comments_rule(Parser *p)
  22013. {
  22014. if (p->level++ == MAXSTACK) {
  22015. _Pypegen_stack_overflow(p);
  22016. }
  22017. if (p->error_indicator) {
  22018. p->level--;
  22019. return NULL;
  22020. }
  22021. void * _res = NULL;
  22022. int _mark = p->mark;
  22023. { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
  22024. if (p->error_indicator) {
  22025. p->level--;
  22026. return NULL;
  22027. }
  22028. D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
  22029. Token * indent_var;
  22030. Token * newline_var;
  22031. Token * newline_var_1;
  22032. Token * type_comment_var;
  22033. Token * type_comment_var_1;
  22034. if (
  22035. (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
  22036. &&
  22037. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  22038. &&
  22039. (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
  22040. &&
  22041. (newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  22042. &&
  22043. (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
  22044. )
  22045. {
  22046. D(fprintf(stderr, "%*c+ invalid_double_type_comments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
  22047. _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" );
  22048. if (_res == NULL && PyErr_Occurred()) {
  22049. p->error_indicator = 1;
  22050. p->level--;
  22051. return NULL;
  22052. }
  22053. goto done;
  22054. }
  22055. p->mark = _mark;
  22056. D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ',
  22057. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
  22058. }
  22059. _res = NULL;
  22060. done:
  22061. p->level--;
  22062. return _res;
  22063. }
  22064. // invalid_with_item: expression 'as' expression &(',' | ')' | ':')
  22065. static void *
  22066. invalid_with_item_rule(Parser *p)
  22067. {
  22068. if (p->level++ == MAXSTACK) {
  22069. _Pypegen_stack_overflow(p);
  22070. }
  22071. if (p->error_indicator) {
  22072. p->level--;
  22073. return NULL;
  22074. }
  22075. void * _res = NULL;
  22076. int _mark = p->mark;
  22077. { // expression 'as' expression &(',' | ')' | ':')
  22078. if (p->error_indicator) {
  22079. p->level--;
  22080. return NULL;
  22081. }
  22082. D(fprintf(stderr, "%*c> invalid_with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')"));
  22083. Token * _keyword;
  22084. expr_ty a;
  22085. expr_ty expression_var;
  22086. if (
  22087. (expression_var = expression_rule(p)) // expression
  22088. &&
  22089. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  22090. &&
  22091. (a = expression_rule(p)) // expression
  22092. &&
  22093. _PyPegen_lookahead(1, _tmp_204_rule, p)
  22094. )
  22095. {
  22096. D(fprintf(stderr, "%*c+ invalid_with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')"));
  22097. _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
  22098. if (_res == NULL && PyErr_Occurred()) {
  22099. p->error_indicator = 1;
  22100. p->level--;
  22101. return NULL;
  22102. }
  22103. goto done;
  22104. }
  22105. p->mark = _mark;
  22106. D(fprintf(stderr, "%*c%s invalid_with_item[%d-%d]: %s failed!\n", p->level, ' ',
  22107. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')"));
  22108. }
  22109. _res = NULL;
  22110. done:
  22111. p->level--;
  22112. return _res;
  22113. }
  22114. // invalid_for_target: ASYNC? 'for' star_expressions
  22115. static void *
  22116. invalid_for_target_rule(Parser *p)
  22117. {
  22118. if (p->level++ == MAXSTACK) {
  22119. _Pypegen_stack_overflow(p);
  22120. }
  22121. if (p->error_indicator) {
  22122. p->level--;
  22123. return NULL;
  22124. }
  22125. void * _res = NULL;
  22126. int _mark = p->mark;
  22127. { // ASYNC? 'for' star_expressions
  22128. if (p->error_indicator) {
  22129. p->level--;
  22130. return NULL;
  22131. }
  22132. D(fprintf(stderr, "%*c> invalid_for_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions"));
  22133. Token * _keyword;
  22134. void *_opt_var;
  22135. UNUSED(_opt_var); // Silence compiler warnings
  22136. expr_ty a;
  22137. if (
  22138. (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC?
  22139. &&
  22140. (_keyword = _PyPegen_expect_token(p, 650)) // token='for'
  22141. &&
  22142. (a = star_expressions_rule(p)) // star_expressions
  22143. )
  22144. {
  22145. D(fprintf(stderr, "%*c+ invalid_for_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions"));
  22146. _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( FOR_TARGETS , a );
  22147. if (_res == NULL && PyErr_Occurred()) {
  22148. p->error_indicator = 1;
  22149. p->level--;
  22150. return NULL;
  22151. }
  22152. goto done;
  22153. }
  22154. p->mark = _mark;
  22155. D(fprintf(stderr, "%*c%s invalid_for_target[%d-%d]: %s failed!\n", p->level, ' ',
  22156. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'for' star_expressions"));
  22157. }
  22158. _res = NULL;
  22159. done:
  22160. p->level--;
  22161. return _res;
  22162. }
  22163. // invalid_group: '(' starred_expression ')' | '(' '**' expression ')'
  22164. static void *
  22165. invalid_group_rule(Parser *p)
  22166. {
  22167. if (p->level++ == MAXSTACK) {
  22168. _Pypegen_stack_overflow(p);
  22169. }
  22170. if (p->error_indicator) {
  22171. p->level--;
  22172. return NULL;
  22173. }
  22174. void * _res = NULL;
  22175. int _mark = p->mark;
  22176. { // '(' starred_expression ')'
  22177. if (p->error_indicator) {
  22178. p->level--;
  22179. return NULL;
  22180. }
  22181. D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
  22182. Token * _literal;
  22183. Token * _literal_1;
  22184. expr_ty a;
  22185. if (
  22186. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  22187. &&
  22188. (a = starred_expression_rule(p)) // starred_expression
  22189. &&
  22190. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  22191. )
  22192. {
  22193. D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
  22194. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use starred expression here" );
  22195. if (_res == NULL && PyErr_Occurred()) {
  22196. p->error_indicator = 1;
  22197. p->level--;
  22198. return NULL;
  22199. }
  22200. goto done;
  22201. }
  22202. p->mark = _mark;
  22203. D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ',
  22204. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' starred_expression ')'"));
  22205. }
  22206. { // '(' '**' expression ')'
  22207. if (p->error_indicator) {
  22208. p->level--;
  22209. return NULL;
  22210. }
  22211. D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' '**' expression ')'"));
  22212. Token * _literal;
  22213. Token * _literal_1;
  22214. Token * a;
  22215. expr_ty expression_var;
  22216. if (
  22217. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  22218. &&
  22219. (a = _PyPegen_expect_token(p, 35)) // token='**'
  22220. &&
  22221. (expression_var = expression_rule(p)) // expression
  22222. &&
  22223. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  22224. )
  22225. {
  22226. D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' '**' expression ')'"));
  22227. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use double starred expression here" );
  22228. if (_res == NULL && PyErr_Occurred()) {
  22229. p->error_indicator = 1;
  22230. p->level--;
  22231. return NULL;
  22232. }
  22233. goto done;
  22234. }
  22235. p->mark = _mark;
  22236. D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ',
  22237. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' '**' expression ')'"));
  22238. }
  22239. _res = NULL;
  22240. done:
  22241. p->level--;
  22242. return _res;
  22243. }
  22244. // invalid_import: 'import' ','.dotted_name+ 'from' dotted_name
  22245. static void *
  22246. invalid_import_rule(Parser *p)
  22247. {
  22248. if (p->level++ == MAXSTACK) {
  22249. _Pypegen_stack_overflow(p);
  22250. }
  22251. if (p->error_indicator) {
  22252. p->level--;
  22253. return NULL;
  22254. }
  22255. void * _res = NULL;
  22256. int _mark = p->mark;
  22257. { // 'import' ','.dotted_name+ 'from' dotted_name
  22258. if (p->error_indicator) {
  22259. p->level--;
  22260. return NULL;
  22261. }
  22262. D(fprintf(stderr, "%*c> invalid_import[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' ','.dotted_name+ 'from' dotted_name"));
  22263. asdl_seq * _gather_205_var;
  22264. Token * _keyword;
  22265. Token * a;
  22266. expr_ty dotted_name_var;
  22267. if (
  22268. (a = _PyPegen_expect_token(p, 607)) // token='import'
  22269. &&
  22270. (_gather_205_var = _gather_205_rule(p)) // ','.dotted_name+
  22271. &&
  22272. (_keyword = _PyPegen_expect_token(p, 608)) // token='from'
  22273. &&
  22274. (dotted_name_var = dotted_name_rule(p)) // dotted_name
  22275. )
  22276. {
  22277. D(fprintf(stderr, "%*c+ invalid_import[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' ','.dotted_name+ 'from' dotted_name"));
  22278. _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "Did you mean to use 'from ... import ...' instead?" );
  22279. if (_res == NULL && PyErr_Occurred()) {
  22280. p->error_indicator = 1;
  22281. p->level--;
  22282. return NULL;
  22283. }
  22284. goto done;
  22285. }
  22286. p->mark = _mark;
  22287. D(fprintf(stderr, "%*c%s invalid_import[%d-%d]: %s failed!\n", p->level, ' ',
  22288. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' ','.dotted_name+ 'from' dotted_name"));
  22289. }
  22290. _res = NULL;
  22291. done:
  22292. p->level--;
  22293. return _res;
  22294. }
  22295. // invalid_import_from_targets: import_from_as_names ',' NEWLINE
  22296. static void *
  22297. invalid_import_from_targets_rule(Parser *p)
  22298. {
  22299. if (p->level++ == MAXSTACK) {
  22300. _Pypegen_stack_overflow(p);
  22301. }
  22302. if (p->error_indicator) {
  22303. p->level--;
  22304. return NULL;
  22305. }
  22306. void * _res = NULL;
  22307. int _mark = p->mark;
  22308. { // import_from_as_names ',' NEWLINE
  22309. if (p->error_indicator) {
  22310. p->level--;
  22311. return NULL;
  22312. }
  22313. D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ',' NEWLINE"));
  22314. Token * _literal;
  22315. asdl_alias_seq* import_from_as_names_var;
  22316. Token * newline_var;
  22317. if (
  22318. (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
  22319. &&
  22320. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  22321. &&
  22322. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  22323. )
  22324. {
  22325. D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ',' NEWLINE"));
  22326. _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" );
  22327. if (_res == NULL && PyErr_Occurred()) {
  22328. p->error_indicator = 1;
  22329. p->level--;
  22330. return NULL;
  22331. }
  22332. goto done;
  22333. }
  22334. p->mark = _mark;
  22335. D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
  22336. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ',' NEWLINE"));
  22337. }
  22338. _res = NULL;
  22339. done:
  22340. p->level--;
  22341. return _res;
  22342. }
  22343. // invalid_with_stmt:
  22344. // | ASYNC? 'with' ','.(expression ['as' star_target])+ NEWLINE
  22345. // | ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE
  22346. static void *
  22347. invalid_with_stmt_rule(Parser *p)
  22348. {
  22349. if (p->level++ == MAXSTACK) {
  22350. _Pypegen_stack_overflow(p);
  22351. }
  22352. if (p->error_indicator) {
  22353. p->level--;
  22354. return NULL;
  22355. }
  22356. void * _res = NULL;
  22357. int _mark = p->mark;
  22358. { // ASYNC? 'with' ','.(expression ['as' star_target])+ NEWLINE
  22359. if (p->error_indicator) {
  22360. p->level--;
  22361. return NULL;
  22362. }
  22363. D(fprintf(stderr, "%*c> invalid_with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ NEWLINE"));
  22364. asdl_seq * _gather_207_var;
  22365. Token * _keyword;
  22366. void *_opt_var;
  22367. UNUSED(_opt_var); // Silence compiler warnings
  22368. Token * newline_var;
  22369. if (
  22370. (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC?
  22371. &&
  22372. (_keyword = _PyPegen_expect_token(p, 615)) // token='with'
  22373. &&
  22374. (_gather_207_var = _gather_207_rule(p)) // ','.(expression ['as' star_target])+
  22375. &&
  22376. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  22377. )
  22378. {
  22379. D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ NEWLINE"));
  22380. _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
  22381. if (_res == NULL && PyErr_Occurred()) {
  22382. p->error_indicator = 1;
  22383. p->level--;
  22384. return NULL;
  22385. }
  22386. goto done;
  22387. }
  22388. p->mark = _mark;
  22389. D(fprintf(stderr, "%*c%s invalid_with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  22390. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ NEWLINE"));
  22391. }
  22392. { // ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE
  22393. if (p->error_indicator) {
  22394. p->level--;
  22395. return NULL;
  22396. }
  22397. D(fprintf(stderr, "%*c> invalid_with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE"));
  22398. asdl_seq * _gather_209_var;
  22399. Token * _keyword;
  22400. Token * _literal;
  22401. Token * _literal_1;
  22402. void *_opt_var;
  22403. UNUSED(_opt_var); // Silence compiler warnings
  22404. void *_opt_var_1;
  22405. UNUSED(_opt_var_1); // Silence compiler warnings
  22406. Token * newline_var;
  22407. if (
  22408. (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC?
  22409. &&
  22410. (_keyword = _PyPegen_expect_token(p, 615)) // token='with'
  22411. &&
  22412. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  22413. &&
  22414. (_gather_209_var = _gather_209_rule(p)) // ','.(expressions ['as' star_target])+
  22415. &&
  22416. (_opt_var_1 = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  22417. &&
  22418. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  22419. &&
  22420. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  22421. )
  22422. {
  22423. D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE"));
  22424. _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
  22425. if (_res == NULL && PyErr_Occurred()) {
  22426. p->error_indicator = 1;
  22427. p->level--;
  22428. return NULL;
  22429. }
  22430. goto done;
  22431. }
  22432. p->mark = _mark;
  22433. D(fprintf(stderr, "%*c%s invalid_with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  22434. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE"));
  22435. }
  22436. _res = NULL;
  22437. done:
  22438. p->level--;
  22439. return _res;
  22440. }
  22441. // invalid_with_stmt_indent:
  22442. // | ASYNC? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT
  22443. // | ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT
  22444. static void *
  22445. invalid_with_stmt_indent_rule(Parser *p)
  22446. {
  22447. if (p->level++ == MAXSTACK) {
  22448. _Pypegen_stack_overflow(p);
  22449. }
  22450. if (p->error_indicator) {
  22451. p->level--;
  22452. return NULL;
  22453. }
  22454. void * _res = NULL;
  22455. int _mark = p->mark;
  22456. { // ASYNC? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT
  22457. if (p->error_indicator) {
  22458. p->level--;
  22459. return NULL;
  22460. }
  22461. D(fprintf(stderr, "%*c> invalid_with_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT"));
  22462. asdl_seq * _gather_211_var;
  22463. Token * _literal;
  22464. void *_opt_var;
  22465. UNUSED(_opt_var); // Silence compiler warnings
  22466. Token * a;
  22467. Token * newline_var;
  22468. if (
  22469. (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC?
  22470. &&
  22471. (a = _PyPegen_expect_token(p, 615)) // token='with'
  22472. &&
  22473. (_gather_211_var = _gather_211_rule(p)) // ','.(expression ['as' star_target])+
  22474. &&
  22475. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  22476. &&
  22477. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  22478. &&
  22479. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
  22480. )
  22481. {
  22482. D(fprintf(stderr, "%*c+ invalid_with_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT"));
  22483. _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'with' statement on line %d" , a -> lineno );
  22484. if (_res == NULL && PyErr_Occurred()) {
  22485. p->error_indicator = 1;
  22486. p->level--;
  22487. return NULL;
  22488. }
  22489. goto done;
  22490. }
  22491. p->mark = _mark;
  22492. D(fprintf(stderr, "%*c%s invalid_with_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ',
  22493. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT"));
  22494. }
  22495. { // ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT
  22496. if (p->error_indicator) {
  22497. p->level--;
  22498. return NULL;
  22499. }
  22500. D(fprintf(stderr, "%*c> invalid_with_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT"));
  22501. asdl_seq * _gather_213_var;
  22502. Token * _literal;
  22503. Token * _literal_1;
  22504. Token * _literal_2;
  22505. void *_opt_var;
  22506. UNUSED(_opt_var); // Silence compiler warnings
  22507. void *_opt_var_1;
  22508. UNUSED(_opt_var_1); // Silence compiler warnings
  22509. Token * a;
  22510. Token * newline_var;
  22511. if (
  22512. (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC?
  22513. &&
  22514. (a = _PyPegen_expect_token(p, 615)) // token='with'
  22515. &&
  22516. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  22517. &&
  22518. (_gather_213_var = _gather_213_rule(p)) // ','.(expressions ['as' star_target])+
  22519. &&
  22520. (_opt_var_1 = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
  22521. &&
  22522. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  22523. &&
  22524. (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
  22525. &&
  22526. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  22527. &&
  22528. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
  22529. )
  22530. {
  22531. D(fprintf(stderr, "%*c+ invalid_with_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT"));
  22532. _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'with' statement on line %d" , a -> lineno );
  22533. if (_res == NULL && PyErr_Occurred()) {
  22534. p->error_indicator = 1;
  22535. p->level--;
  22536. return NULL;
  22537. }
  22538. goto done;
  22539. }
  22540. p->mark = _mark;
  22541. D(fprintf(stderr, "%*c%s invalid_with_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ',
  22542. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT"));
  22543. }
  22544. _res = NULL;
  22545. done:
  22546. p->level--;
  22547. return _res;
  22548. }
  22549. // invalid_try_stmt:
  22550. // | 'try' ':' NEWLINE !INDENT
  22551. // | 'try' ':' block !('except' | 'finally')
  22552. // | 'try' ':' block* except_block+ 'except' '*' expression ['as' NAME] ':'
  22553. // | 'try' ':' block* except_star_block+ 'except' [expression ['as' NAME]] ':'
  22554. static void *
  22555. invalid_try_stmt_rule(Parser *p)
  22556. {
  22557. if (p->level++ == MAXSTACK) {
  22558. _Pypegen_stack_overflow(p);
  22559. }
  22560. if (p->error_indicator) {
  22561. p->level--;
  22562. return NULL;
  22563. }
  22564. void * _res = NULL;
  22565. int _mark = p->mark;
  22566. { // 'try' ':' NEWLINE !INDENT
  22567. if (p->error_indicator) {
  22568. p->level--;
  22569. return NULL;
  22570. }
  22571. D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' NEWLINE !INDENT"));
  22572. Token * _literal;
  22573. Token * a;
  22574. Token * newline_var;
  22575. if (
  22576. (a = _PyPegen_expect_token(p, 624)) // token='try'
  22577. &&
  22578. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  22579. &&
  22580. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  22581. &&
  22582. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
  22583. )
  22584. {
  22585. D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' NEWLINE !INDENT"));
  22586. _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'try' statement on line %d" , a -> lineno );
  22587. if (_res == NULL && PyErr_Occurred()) {
  22588. p->error_indicator = 1;
  22589. p->level--;
  22590. return NULL;
  22591. }
  22592. goto done;
  22593. }
  22594. p->mark = _mark;
  22595. D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  22596. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' NEWLINE !INDENT"));
  22597. }
  22598. { // 'try' ':' block !('except' | 'finally')
  22599. if (p->error_indicator) {
  22600. p->level--;
  22601. return NULL;
  22602. }
  22603. D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block !('except' | 'finally')"));
  22604. Token * _keyword;
  22605. Token * _literal;
  22606. asdl_stmt_seq* block_var;
  22607. if (
  22608. (_keyword = _PyPegen_expect_token(p, 624)) // token='try'
  22609. &&
  22610. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  22611. &&
  22612. (block_var = block_rule(p)) // block
  22613. &&
  22614. _PyPegen_lookahead(0, _tmp_215_rule, p)
  22615. )
  22616. {
  22617. D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block !('except' | 'finally')"));
  22618. _res = RAISE_SYNTAX_ERROR ( "expected 'except' or 'finally' block" );
  22619. if (_res == NULL && PyErr_Occurred()) {
  22620. p->error_indicator = 1;
  22621. p->level--;
  22622. return NULL;
  22623. }
  22624. goto done;
  22625. }
  22626. p->mark = _mark;
  22627. D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  22628. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block !('except' | 'finally')"));
  22629. }
  22630. { // 'try' ':' block* except_block+ 'except' '*' expression ['as' NAME] ':'
  22631. if (p->error_indicator) {
  22632. p->level--;
  22633. return NULL;
  22634. }
  22635. D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block* except_block+ 'except' '*' expression ['as' NAME] ':'"));
  22636. Token * _keyword;
  22637. Token * _literal;
  22638. Token * _literal_1;
  22639. asdl_seq * _loop0_216_var;
  22640. asdl_seq * _loop1_217_var;
  22641. void *_opt_var;
  22642. UNUSED(_opt_var); // Silence compiler warnings
  22643. Token * a;
  22644. Token * b;
  22645. expr_ty expression_var;
  22646. if (
  22647. (_keyword = _PyPegen_expect_token(p, 624)) // token='try'
  22648. &&
  22649. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  22650. &&
  22651. (_loop0_216_var = _loop0_216_rule(p)) // block*
  22652. &&
  22653. (_loop1_217_var = _loop1_217_rule(p)) // except_block+
  22654. &&
  22655. (a = _PyPegen_expect_token(p, 637)) // token='except'
  22656. &&
  22657. (b = _PyPegen_expect_token(p, 16)) // token='*'
  22658. &&
  22659. (expression_var = expression_rule(p)) // expression
  22660. &&
  22661. (_opt_var = _tmp_218_rule(p), !p->error_indicator) // ['as' NAME]
  22662. &&
  22663. (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
  22664. )
  22665. {
  22666. D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block* except_block+ 'except' '*' expression ['as' NAME] ':'"));
  22667. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot have both 'except' and 'except*' on the same 'try'" );
  22668. if (_res == NULL && PyErr_Occurred()) {
  22669. p->error_indicator = 1;
  22670. p->level--;
  22671. return NULL;
  22672. }
  22673. goto done;
  22674. }
  22675. p->mark = _mark;
  22676. D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  22677. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block* except_block+ 'except' '*' expression ['as' NAME] ':'"));
  22678. }
  22679. { // 'try' ':' block* except_star_block+ 'except' [expression ['as' NAME]] ':'
  22680. if (p->error_indicator) {
  22681. p->level--;
  22682. return NULL;
  22683. }
  22684. D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block* except_star_block+ 'except' [expression ['as' NAME]] ':'"));
  22685. Token * _keyword;
  22686. Token * _literal;
  22687. Token * _literal_1;
  22688. asdl_seq * _loop0_219_var;
  22689. asdl_seq * _loop1_220_var;
  22690. void *_opt_var;
  22691. UNUSED(_opt_var); // Silence compiler warnings
  22692. Token * a;
  22693. if (
  22694. (_keyword = _PyPegen_expect_token(p, 624)) // token='try'
  22695. &&
  22696. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  22697. &&
  22698. (_loop0_219_var = _loop0_219_rule(p)) // block*
  22699. &&
  22700. (_loop1_220_var = _loop1_220_rule(p)) // except_star_block+
  22701. &&
  22702. (a = _PyPegen_expect_token(p, 637)) // token='except'
  22703. &&
  22704. (_opt_var = _tmp_221_rule(p), !p->error_indicator) // [expression ['as' NAME]]
  22705. &&
  22706. (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
  22707. )
  22708. {
  22709. D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block* except_star_block+ 'except' [expression ['as' NAME]] ':'"));
  22710. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot have both 'except' and 'except*' on the same 'try'" );
  22711. if (_res == NULL && PyErr_Occurred()) {
  22712. p->error_indicator = 1;
  22713. p->level--;
  22714. return NULL;
  22715. }
  22716. goto done;
  22717. }
  22718. p->mark = _mark;
  22719. D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  22720. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block* except_star_block+ 'except' [expression ['as' NAME]] ':'"));
  22721. }
  22722. _res = NULL;
  22723. done:
  22724. p->level--;
  22725. return _res;
  22726. }
  22727. // invalid_except_stmt:
  22728. // | 'except' '*'? expression ',' expressions ['as' NAME] ':'
  22729. // | 'except' '*'? expression ['as' NAME] NEWLINE
  22730. // | 'except' NEWLINE
  22731. // | 'except' '*' (NEWLINE | ':')
  22732. static void *
  22733. invalid_except_stmt_rule(Parser *p)
  22734. {
  22735. if (p->level++ == MAXSTACK) {
  22736. _Pypegen_stack_overflow(p);
  22737. }
  22738. if (p->error_indicator) {
  22739. p->level--;
  22740. return NULL;
  22741. }
  22742. void * _res = NULL;
  22743. int _mark = p->mark;
  22744. { // 'except' '*'? expression ',' expressions ['as' NAME] ':'
  22745. if (p->error_indicator) {
  22746. p->level--;
  22747. return NULL;
  22748. }
  22749. D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*'? expression ',' expressions ['as' NAME] ':'"));
  22750. Token * _keyword;
  22751. Token * _literal;
  22752. Token * _literal_1;
  22753. void *_opt_var;
  22754. UNUSED(_opt_var); // Silence compiler warnings
  22755. void *_opt_var_1;
  22756. UNUSED(_opt_var_1); // Silence compiler warnings
  22757. expr_ty a;
  22758. expr_ty expressions_var;
  22759. if (
  22760. (_keyword = _PyPegen_expect_token(p, 637)) // token='except'
  22761. &&
  22762. (_opt_var = _PyPegen_expect_token(p, 16), !p->error_indicator) // '*'?
  22763. &&
  22764. (a = expression_rule(p)) // expression
  22765. &&
  22766. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  22767. &&
  22768. (expressions_var = expressions_rule(p)) // expressions
  22769. &&
  22770. (_opt_var_1 = _tmp_222_rule(p), !p->error_indicator) // ['as' NAME]
  22771. &&
  22772. (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
  22773. )
  22774. {
  22775. D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*'? expression ',' expressions ['as' NAME] ':'"));
  22776. _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "multiple exception types must be parenthesized" );
  22777. if (_res == NULL && PyErr_Occurred()) {
  22778. p->error_indicator = 1;
  22779. p->level--;
  22780. return NULL;
  22781. }
  22782. goto done;
  22783. }
  22784. p->mark = _mark;
  22785. D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  22786. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*'? expression ',' expressions ['as' NAME] ':'"));
  22787. }
  22788. { // 'except' '*'? expression ['as' NAME] NEWLINE
  22789. if (p->error_indicator) {
  22790. p->level--;
  22791. return NULL;
  22792. }
  22793. D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*'? expression ['as' NAME] NEWLINE"));
  22794. void *_opt_var;
  22795. UNUSED(_opt_var); // Silence compiler warnings
  22796. void *_opt_var_1;
  22797. UNUSED(_opt_var_1); // Silence compiler warnings
  22798. Token * a;
  22799. expr_ty expression_var;
  22800. Token * newline_var;
  22801. if (
  22802. (a = _PyPegen_expect_token(p, 637)) // token='except'
  22803. &&
  22804. (_opt_var = _PyPegen_expect_token(p, 16), !p->error_indicator) // '*'?
  22805. &&
  22806. (expression_var = expression_rule(p)) // expression
  22807. &&
  22808. (_opt_var_1 = _tmp_223_rule(p), !p->error_indicator) // ['as' NAME]
  22809. &&
  22810. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  22811. )
  22812. {
  22813. D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*'? expression ['as' NAME] NEWLINE"));
  22814. _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
  22815. if (_res == NULL && PyErr_Occurred()) {
  22816. p->error_indicator = 1;
  22817. p->level--;
  22818. return NULL;
  22819. }
  22820. goto done;
  22821. }
  22822. p->mark = _mark;
  22823. D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  22824. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*'? expression ['as' NAME] NEWLINE"));
  22825. }
  22826. { // 'except' NEWLINE
  22827. if (p->error_indicator) {
  22828. p->level--;
  22829. return NULL;
  22830. }
  22831. D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' NEWLINE"));
  22832. Token * a;
  22833. Token * newline_var;
  22834. if (
  22835. (a = _PyPegen_expect_token(p, 637)) // token='except'
  22836. &&
  22837. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  22838. )
  22839. {
  22840. D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' NEWLINE"));
  22841. _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
  22842. if (_res == NULL && PyErr_Occurred()) {
  22843. p->error_indicator = 1;
  22844. p->level--;
  22845. return NULL;
  22846. }
  22847. goto done;
  22848. }
  22849. p->mark = _mark;
  22850. D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  22851. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' NEWLINE"));
  22852. }
  22853. { // 'except' '*' (NEWLINE | ':')
  22854. if (p->error_indicator) {
  22855. p->level--;
  22856. return NULL;
  22857. }
  22858. D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' (NEWLINE | ':')"));
  22859. Token * _literal;
  22860. void *_tmp_224_var;
  22861. Token * a;
  22862. if (
  22863. (a = _PyPegen_expect_token(p, 637)) // token='except'
  22864. &&
  22865. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  22866. &&
  22867. (_tmp_224_var = _tmp_224_rule(p)) // NEWLINE | ':'
  22868. )
  22869. {
  22870. D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' (NEWLINE | ':')"));
  22871. _res = RAISE_SYNTAX_ERROR ( "expected one or more exception types" );
  22872. if (_res == NULL && PyErr_Occurred()) {
  22873. p->error_indicator = 1;
  22874. p->level--;
  22875. return NULL;
  22876. }
  22877. goto done;
  22878. }
  22879. p->mark = _mark;
  22880. D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  22881. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' (NEWLINE | ':')"));
  22882. }
  22883. _res = NULL;
  22884. done:
  22885. p->level--;
  22886. return _res;
  22887. }
  22888. // invalid_finally_stmt: 'finally' ':' NEWLINE !INDENT
  22889. static void *
  22890. invalid_finally_stmt_rule(Parser *p)
  22891. {
  22892. if (p->level++ == MAXSTACK) {
  22893. _Pypegen_stack_overflow(p);
  22894. }
  22895. if (p->error_indicator) {
  22896. p->level--;
  22897. return NULL;
  22898. }
  22899. void * _res = NULL;
  22900. int _mark = p->mark;
  22901. { // 'finally' ':' NEWLINE !INDENT
  22902. if (p->error_indicator) {
  22903. p->level--;
  22904. return NULL;
  22905. }
  22906. D(fprintf(stderr, "%*c> invalid_finally_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' NEWLINE !INDENT"));
  22907. Token * _literal;
  22908. Token * a;
  22909. Token * newline_var;
  22910. if (
  22911. (a = _PyPegen_expect_token(p, 633)) // token='finally'
  22912. &&
  22913. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  22914. &&
  22915. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  22916. &&
  22917. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
  22918. )
  22919. {
  22920. D(fprintf(stderr, "%*c+ invalid_finally_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' NEWLINE !INDENT"));
  22921. _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'finally' statement on line %d" , a -> lineno );
  22922. if (_res == NULL && PyErr_Occurred()) {
  22923. p->error_indicator = 1;
  22924. p->level--;
  22925. return NULL;
  22926. }
  22927. goto done;
  22928. }
  22929. p->mark = _mark;
  22930. D(fprintf(stderr, "%*c%s invalid_finally_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  22931. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' NEWLINE !INDENT"));
  22932. }
  22933. _res = NULL;
  22934. done:
  22935. p->level--;
  22936. return _res;
  22937. }
  22938. // invalid_except_stmt_indent:
  22939. // | 'except' expression ['as' NAME] ':' NEWLINE !INDENT
  22940. // | 'except' ':' NEWLINE !INDENT
  22941. static void *
  22942. invalid_except_stmt_indent_rule(Parser *p)
  22943. {
  22944. if (p->level++ == MAXSTACK) {
  22945. _Pypegen_stack_overflow(p);
  22946. }
  22947. if (p->error_indicator) {
  22948. p->level--;
  22949. return NULL;
  22950. }
  22951. void * _res = NULL;
  22952. int _mark = p->mark;
  22953. { // 'except' expression ['as' NAME] ':' NEWLINE !INDENT
  22954. if (p->error_indicator) {
  22955. p->level--;
  22956. return NULL;
  22957. }
  22958. D(fprintf(stderr, "%*c> invalid_except_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT"));
  22959. Token * _literal;
  22960. void *_opt_var;
  22961. UNUSED(_opt_var); // Silence compiler warnings
  22962. Token * a;
  22963. expr_ty expression_var;
  22964. Token * newline_var;
  22965. if (
  22966. (a = _PyPegen_expect_token(p, 637)) // token='except'
  22967. &&
  22968. (expression_var = expression_rule(p)) // expression
  22969. &&
  22970. (_opt_var = _tmp_225_rule(p), !p->error_indicator) // ['as' NAME]
  22971. &&
  22972. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  22973. &&
  22974. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  22975. &&
  22976. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
  22977. )
  22978. {
  22979. D(fprintf(stderr, "%*c+ invalid_except_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT"));
  22980. _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except' statement on line %d" , a -> lineno );
  22981. if (_res == NULL && PyErr_Occurred()) {
  22982. p->error_indicator = 1;
  22983. p->level--;
  22984. return NULL;
  22985. }
  22986. goto done;
  22987. }
  22988. p->mark = _mark;
  22989. D(fprintf(stderr, "%*c%s invalid_except_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ',
  22990. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT"));
  22991. }
  22992. { // 'except' ':' NEWLINE !INDENT
  22993. if (p->error_indicator) {
  22994. p->level--;
  22995. return NULL;
  22996. }
  22997. D(fprintf(stderr, "%*c> invalid_except_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' NEWLINE !INDENT"));
  22998. Token * _literal;
  22999. Token * a;
  23000. Token * newline_var;
  23001. if (
  23002. (a = _PyPegen_expect_token(p, 637)) // token='except'
  23003. &&
  23004. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  23005. &&
  23006. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  23007. &&
  23008. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
  23009. )
  23010. {
  23011. D(fprintf(stderr, "%*c+ invalid_except_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' NEWLINE !INDENT"));
  23012. _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except' statement on line %d" , a -> lineno );
  23013. if (_res == NULL && PyErr_Occurred()) {
  23014. p->error_indicator = 1;
  23015. p->level--;
  23016. return NULL;
  23017. }
  23018. goto done;
  23019. }
  23020. p->mark = _mark;
  23021. D(fprintf(stderr, "%*c%s invalid_except_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ',
  23022. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' NEWLINE !INDENT"));
  23023. }
  23024. _res = NULL;
  23025. done:
  23026. p->level--;
  23027. return _res;
  23028. }
  23029. // invalid_except_star_stmt_indent:
  23030. // | 'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT
  23031. static void *
  23032. invalid_except_star_stmt_indent_rule(Parser *p)
  23033. {
  23034. if (p->level++ == MAXSTACK) {
  23035. _Pypegen_stack_overflow(p);
  23036. }
  23037. if (p->error_indicator) {
  23038. p->level--;
  23039. return NULL;
  23040. }
  23041. void * _res = NULL;
  23042. int _mark = p->mark;
  23043. { // 'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT
  23044. if (p->error_indicator) {
  23045. p->level--;
  23046. return NULL;
  23047. }
  23048. D(fprintf(stderr, "%*c> invalid_except_star_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT"));
  23049. Token * _literal;
  23050. Token * _literal_1;
  23051. void *_opt_var;
  23052. UNUSED(_opt_var); // Silence compiler warnings
  23053. Token * a;
  23054. expr_ty expression_var;
  23055. Token * newline_var;
  23056. if (
  23057. (a = _PyPegen_expect_token(p, 637)) // token='except'
  23058. &&
  23059. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  23060. &&
  23061. (expression_var = expression_rule(p)) // expression
  23062. &&
  23063. (_opt_var = _tmp_226_rule(p), !p->error_indicator) // ['as' NAME]
  23064. &&
  23065. (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
  23066. &&
  23067. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  23068. &&
  23069. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
  23070. )
  23071. {
  23072. D(fprintf(stderr, "%*c+ invalid_except_star_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT"));
  23073. _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except*' statement on line %d" , a -> lineno );
  23074. if (_res == NULL && PyErr_Occurred()) {
  23075. p->error_indicator = 1;
  23076. p->level--;
  23077. return NULL;
  23078. }
  23079. goto done;
  23080. }
  23081. p->mark = _mark;
  23082. D(fprintf(stderr, "%*c%s invalid_except_star_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ',
  23083. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT"));
  23084. }
  23085. _res = NULL;
  23086. done:
  23087. p->level--;
  23088. return _res;
  23089. }
  23090. // invalid_match_stmt:
  23091. // | "match" subject_expr NEWLINE
  23092. // | "match" subject_expr ':' NEWLINE !INDENT
  23093. static void *
  23094. invalid_match_stmt_rule(Parser *p)
  23095. {
  23096. if (p->level++ == MAXSTACK) {
  23097. _Pypegen_stack_overflow(p);
  23098. }
  23099. if (p->error_indicator) {
  23100. p->level--;
  23101. return NULL;
  23102. }
  23103. void * _res = NULL;
  23104. int _mark = p->mark;
  23105. { // "match" subject_expr NEWLINE
  23106. if (p->error_indicator) {
  23107. p->level--;
  23108. return NULL;
  23109. }
  23110. D(fprintf(stderr, "%*c> invalid_match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr NEWLINE"));
  23111. expr_ty _keyword;
  23112. Token * newline_var;
  23113. expr_ty subject_expr_var;
  23114. if (
  23115. (_keyword = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"'
  23116. &&
  23117. (subject_expr_var = subject_expr_rule(p)) // subject_expr
  23118. &&
  23119. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  23120. )
  23121. {
  23122. D(fprintf(stderr, "%*c+ invalid_match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr NEWLINE"));
  23123. _res = CHECK_VERSION ( void* , 10 , "Pattern matching is" , RAISE_SYNTAX_ERROR ( "expected ':'" ) );
  23124. if (_res == NULL && PyErr_Occurred()) {
  23125. p->error_indicator = 1;
  23126. p->level--;
  23127. return NULL;
  23128. }
  23129. goto done;
  23130. }
  23131. p->mark = _mark;
  23132. D(fprintf(stderr, "%*c%s invalid_match_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  23133. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" subject_expr NEWLINE"));
  23134. }
  23135. { // "match" subject_expr ':' NEWLINE !INDENT
  23136. if (p->error_indicator) {
  23137. p->level--;
  23138. return NULL;
  23139. }
  23140. D(fprintf(stderr, "%*c> invalid_match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE !INDENT"));
  23141. Token * _literal;
  23142. expr_ty a;
  23143. Token * newline_var;
  23144. expr_ty subject;
  23145. if (
  23146. (a = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"'
  23147. &&
  23148. (subject = subject_expr_rule(p)) // subject_expr
  23149. &&
  23150. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  23151. &&
  23152. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  23153. &&
  23154. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
  23155. )
  23156. {
  23157. D(fprintf(stderr, "%*c+ invalid_match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE !INDENT"));
  23158. _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'match' statement on line %d" , a -> lineno );
  23159. if (_res == NULL && PyErr_Occurred()) {
  23160. p->error_indicator = 1;
  23161. p->level--;
  23162. return NULL;
  23163. }
  23164. goto done;
  23165. }
  23166. p->mark = _mark;
  23167. D(fprintf(stderr, "%*c%s invalid_match_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  23168. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" subject_expr ':' NEWLINE !INDENT"));
  23169. }
  23170. _res = NULL;
  23171. done:
  23172. p->level--;
  23173. return _res;
  23174. }
  23175. // invalid_case_block:
  23176. // | "case" patterns guard? NEWLINE
  23177. // | "case" patterns guard? ':' NEWLINE !INDENT
  23178. static void *
  23179. invalid_case_block_rule(Parser *p)
  23180. {
  23181. if (p->level++ == MAXSTACK) {
  23182. _Pypegen_stack_overflow(p);
  23183. }
  23184. if (p->error_indicator) {
  23185. p->level--;
  23186. return NULL;
  23187. }
  23188. void * _res = NULL;
  23189. int _mark = p->mark;
  23190. { // "case" patterns guard? NEWLINE
  23191. if (p->error_indicator) {
  23192. p->level--;
  23193. return NULL;
  23194. }
  23195. D(fprintf(stderr, "%*c> invalid_case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? NEWLINE"));
  23196. expr_ty _keyword;
  23197. void *_opt_var;
  23198. UNUSED(_opt_var); // Silence compiler warnings
  23199. Token * newline_var;
  23200. pattern_ty patterns_var;
  23201. if (
  23202. (_keyword = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"'
  23203. &&
  23204. (patterns_var = patterns_rule(p)) // patterns
  23205. &&
  23206. (_opt_var = guard_rule(p), !p->error_indicator) // guard?
  23207. &&
  23208. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  23209. )
  23210. {
  23211. D(fprintf(stderr, "%*c+ invalid_case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? NEWLINE"));
  23212. _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
  23213. if (_res == NULL && PyErr_Occurred()) {
  23214. p->error_indicator = 1;
  23215. p->level--;
  23216. return NULL;
  23217. }
  23218. goto done;
  23219. }
  23220. p->mark = _mark;
  23221. D(fprintf(stderr, "%*c%s invalid_case_block[%d-%d]: %s failed!\n", p->level, ' ',
  23222. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? NEWLINE"));
  23223. }
  23224. { // "case" patterns guard? ':' NEWLINE !INDENT
  23225. if (p->error_indicator) {
  23226. p->level--;
  23227. return NULL;
  23228. }
  23229. D(fprintf(stderr, "%*c> invalid_case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' NEWLINE !INDENT"));
  23230. Token * _literal;
  23231. void *_opt_var;
  23232. UNUSED(_opt_var); // Silence compiler warnings
  23233. expr_ty a;
  23234. Token * newline_var;
  23235. pattern_ty patterns_var;
  23236. if (
  23237. (a = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"'
  23238. &&
  23239. (patterns_var = patterns_rule(p)) // patterns
  23240. &&
  23241. (_opt_var = guard_rule(p), !p->error_indicator) // guard?
  23242. &&
  23243. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  23244. &&
  23245. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  23246. &&
  23247. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
  23248. )
  23249. {
  23250. D(fprintf(stderr, "%*c+ invalid_case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' NEWLINE !INDENT"));
  23251. _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'case' statement on line %d" , a -> lineno );
  23252. if (_res == NULL && PyErr_Occurred()) {
  23253. p->error_indicator = 1;
  23254. p->level--;
  23255. return NULL;
  23256. }
  23257. goto done;
  23258. }
  23259. p->mark = _mark;
  23260. D(fprintf(stderr, "%*c%s invalid_case_block[%d-%d]: %s failed!\n", p->level, ' ',
  23261. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? ':' NEWLINE !INDENT"));
  23262. }
  23263. _res = NULL;
  23264. done:
  23265. p->level--;
  23266. return _res;
  23267. }
  23268. // invalid_as_pattern: or_pattern 'as' "_" | or_pattern 'as' !NAME expression
  23269. static void *
  23270. invalid_as_pattern_rule(Parser *p)
  23271. {
  23272. if (p->level++ == MAXSTACK) {
  23273. _Pypegen_stack_overflow(p);
  23274. }
  23275. if (p->error_indicator) {
  23276. p->level--;
  23277. return NULL;
  23278. }
  23279. void * _res = NULL;
  23280. int _mark = p->mark;
  23281. { // or_pattern 'as' "_"
  23282. if (p->error_indicator) {
  23283. p->level--;
  23284. return NULL;
  23285. }
  23286. D(fprintf(stderr, "%*c> invalid_as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' \"_\""));
  23287. Token * _keyword;
  23288. expr_ty a;
  23289. pattern_ty or_pattern_var;
  23290. if (
  23291. (or_pattern_var = or_pattern_rule(p)) // or_pattern
  23292. &&
  23293. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  23294. &&
  23295. (a = _PyPegen_expect_soft_keyword(p, "_")) // soft_keyword='"_"'
  23296. )
  23297. {
  23298. D(fprintf(stderr, "%*c+ invalid_as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' \"_\""));
  23299. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use '_' as a target" );
  23300. if (_res == NULL && PyErr_Occurred()) {
  23301. p->error_indicator = 1;
  23302. p->level--;
  23303. return NULL;
  23304. }
  23305. goto done;
  23306. }
  23307. p->mark = _mark;
  23308. D(fprintf(stderr, "%*c%s invalid_as_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  23309. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern 'as' \"_\""));
  23310. }
  23311. { // or_pattern 'as' !NAME expression
  23312. if (p->error_indicator) {
  23313. p->level--;
  23314. return NULL;
  23315. }
  23316. D(fprintf(stderr, "%*c> invalid_as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' !NAME expression"));
  23317. Token * _keyword;
  23318. expr_ty a;
  23319. pattern_ty or_pattern_var;
  23320. if (
  23321. (or_pattern_var = or_pattern_rule(p)) // or_pattern
  23322. &&
  23323. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  23324. &&
  23325. _PyPegen_lookahead_with_name(0, _PyPegen_name_token, p)
  23326. &&
  23327. (a = expression_rule(p)) // expression
  23328. )
  23329. {
  23330. D(fprintf(stderr, "%*c+ invalid_as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' !NAME expression"));
  23331. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "invalid pattern target" );
  23332. if (_res == NULL && PyErr_Occurred()) {
  23333. p->error_indicator = 1;
  23334. p->level--;
  23335. return NULL;
  23336. }
  23337. goto done;
  23338. }
  23339. p->mark = _mark;
  23340. D(fprintf(stderr, "%*c%s invalid_as_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  23341. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern 'as' !NAME expression"));
  23342. }
  23343. _res = NULL;
  23344. done:
  23345. p->level--;
  23346. return _res;
  23347. }
  23348. // invalid_class_pattern: name_or_attr '(' invalid_class_argument_pattern
  23349. static void *
  23350. invalid_class_pattern_rule(Parser *p)
  23351. {
  23352. if (p->level++ == MAXSTACK) {
  23353. _Pypegen_stack_overflow(p);
  23354. }
  23355. if (p->error_indicator) {
  23356. p->level--;
  23357. return NULL;
  23358. }
  23359. void * _res = NULL;
  23360. int _mark = p->mark;
  23361. { // name_or_attr '(' invalid_class_argument_pattern
  23362. if (p->error_indicator) {
  23363. p->level--;
  23364. return NULL;
  23365. }
  23366. D(fprintf(stderr, "%*c> invalid_class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' invalid_class_argument_pattern"));
  23367. Token * _literal;
  23368. asdl_pattern_seq* a;
  23369. expr_ty name_or_attr_var;
  23370. if (
  23371. (name_or_attr_var = name_or_attr_rule(p)) // name_or_attr
  23372. &&
  23373. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  23374. &&
  23375. (a = invalid_class_argument_pattern_rule(p)) // invalid_class_argument_pattern
  23376. )
  23377. {
  23378. D(fprintf(stderr, "%*c+ invalid_class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' invalid_class_argument_pattern"));
  23379. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( PyPegen_first_item ( a , pattern_ty ) , PyPegen_last_item ( a , pattern_ty ) , "positional patterns follow keyword patterns" );
  23380. if (_res == NULL && PyErr_Occurred()) {
  23381. p->error_indicator = 1;
  23382. p->level--;
  23383. return NULL;
  23384. }
  23385. goto done;
  23386. }
  23387. p->mark = _mark;
  23388. D(fprintf(stderr, "%*c%s invalid_class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  23389. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' invalid_class_argument_pattern"));
  23390. }
  23391. _res = NULL;
  23392. done:
  23393. p->level--;
  23394. return _res;
  23395. }
  23396. // invalid_class_argument_pattern:
  23397. // | [positional_patterns ','] keyword_patterns ',' positional_patterns
  23398. static asdl_pattern_seq*
  23399. invalid_class_argument_pattern_rule(Parser *p)
  23400. {
  23401. if (p->level++ == MAXSTACK) {
  23402. _Pypegen_stack_overflow(p);
  23403. }
  23404. if (p->error_indicator) {
  23405. p->level--;
  23406. return NULL;
  23407. }
  23408. asdl_pattern_seq* _res = NULL;
  23409. int _mark = p->mark;
  23410. { // [positional_patterns ','] keyword_patterns ',' positional_patterns
  23411. if (p->error_indicator) {
  23412. p->level--;
  23413. return NULL;
  23414. }
  23415. D(fprintf(stderr, "%*c> invalid_class_argument_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "[positional_patterns ','] keyword_patterns ',' positional_patterns"));
  23416. Token * _literal;
  23417. void *_opt_var;
  23418. UNUSED(_opt_var); // Silence compiler warnings
  23419. asdl_pattern_seq* a;
  23420. asdl_seq* keyword_patterns_var;
  23421. if (
  23422. (_opt_var = _tmp_227_rule(p), !p->error_indicator) // [positional_patterns ',']
  23423. &&
  23424. (keyword_patterns_var = keyword_patterns_rule(p)) // keyword_patterns
  23425. &&
  23426. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  23427. &&
  23428. (a = positional_patterns_rule(p)) // positional_patterns
  23429. )
  23430. {
  23431. D(fprintf(stderr, "%*c+ invalid_class_argument_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "[positional_patterns ','] keyword_patterns ',' positional_patterns"));
  23432. _res = a;
  23433. if (_res == NULL && PyErr_Occurred()) {
  23434. p->error_indicator = 1;
  23435. p->level--;
  23436. return NULL;
  23437. }
  23438. goto done;
  23439. }
  23440. p->mark = _mark;
  23441. D(fprintf(stderr, "%*c%s invalid_class_argument_pattern[%d-%d]: %s failed!\n", p->level, ' ',
  23442. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "[positional_patterns ','] keyword_patterns ',' positional_patterns"));
  23443. }
  23444. _res = NULL;
  23445. done:
  23446. p->level--;
  23447. return _res;
  23448. }
  23449. // invalid_if_stmt:
  23450. // | 'if' named_expression NEWLINE
  23451. // | 'if' named_expression ':' NEWLINE !INDENT
  23452. static void *
  23453. invalid_if_stmt_rule(Parser *p)
  23454. {
  23455. if (p->level++ == MAXSTACK) {
  23456. _Pypegen_stack_overflow(p);
  23457. }
  23458. if (p->error_indicator) {
  23459. p->level--;
  23460. return NULL;
  23461. }
  23462. void * _res = NULL;
  23463. int _mark = p->mark;
  23464. { // 'if' named_expression NEWLINE
  23465. if (p->error_indicator) {
  23466. p->level--;
  23467. return NULL;
  23468. }
  23469. D(fprintf(stderr, "%*c> invalid_if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression NEWLINE"));
  23470. Token * _keyword;
  23471. expr_ty named_expression_var;
  23472. Token * newline_var;
  23473. if (
  23474. (_keyword = _PyPegen_expect_token(p, 642)) // token='if'
  23475. &&
  23476. (named_expression_var = named_expression_rule(p)) // named_expression
  23477. &&
  23478. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  23479. )
  23480. {
  23481. D(fprintf(stderr, "%*c+ invalid_if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression NEWLINE"));
  23482. _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
  23483. if (_res == NULL && PyErr_Occurred()) {
  23484. p->error_indicator = 1;
  23485. p->level--;
  23486. return NULL;
  23487. }
  23488. goto done;
  23489. }
  23490. p->mark = _mark;
  23491. D(fprintf(stderr, "%*c%s invalid_if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  23492. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression NEWLINE"));
  23493. }
  23494. { // 'if' named_expression ':' NEWLINE !INDENT
  23495. if (p->error_indicator) {
  23496. p->level--;
  23497. return NULL;
  23498. }
  23499. D(fprintf(stderr, "%*c> invalid_if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' NEWLINE !INDENT"));
  23500. Token * _literal;
  23501. Token * a;
  23502. expr_ty a_1;
  23503. Token * newline_var;
  23504. if (
  23505. (a = _PyPegen_expect_token(p, 642)) // token='if'
  23506. &&
  23507. (a_1 = named_expression_rule(p)) // named_expression
  23508. &&
  23509. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  23510. &&
  23511. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  23512. &&
  23513. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
  23514. )
  23515. {
  23516. D(fprintf(stderr, "%*c+ invalid_if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' NEWLINE !INDENT"));
  23517. _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'if' statement on line %d" , a -> lineno );
  23518. if (_res == NULL && PyErr_Occurred()) {
  23519. p->error_indicator = 1;
  23520. p->level--;
  23521. return NULL;
  23522. }
  23523. goto done;
  23524. }
  23525. p->mark = _mark;
  23526. D(fprintf(stderr, "%*c%s invalid_if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  23527. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' NEWLINE !INDENT"));
  23528. }
  23529. _res = NULL;
  23530. done:
  23531. p->level--;
  23532. return _res;
  23533. }
  23534. // invalid_elif_stmt:
  23535. // | 'elif' named_expression NEWLINE
  23536. // | 'elif' named_expression ':' NEWLINE !INDENT
  23537. static void *
  23538. invalid_elif_stmt_rule(Parser *p)
  23539. {
  23540. if (p->level++ == MAXSTACK) {
  23541. _Pypegen_stack_overflow(p);
  23542. }
  23543. if (p->error_indicator) {
  23544. p->level--;
  23545. return NULL;
  23546. }
  23547. void * _res = NULL;
  23548. int _mark = p->mark;
  23549. { // 'elif' named_expression NEWLINE
  23550. if (p->error_indicator) {
  23551. p->level--;
  23552. return NULL;
  23553. }
  23554. D(fprintf(stderr, "%*c> invalid_elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression NEWLINE"));
  23555. Token * _keyword;
  23556. expr_ty named_expression_var;
  23557. Token * newline_var;
  23558. if (
  23559. (_keyword = _PyPegen_expect_token(p, 644)) // token='elif'
  23560. &&
  23561. (named_expression_var = named_expression_rule(p)) // named_expression
  23562. &&
  23563. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  23564. )
  23565. {
  23566. D(fprintf(stderr, "%*c+ invalid_elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression NEWLINE"));
  23567. _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
  23568. if (_res == NULL && PyErr_Occurred()) {
  23569. p->error_indicator = 1;
  23570. p->level--;
  23571. return NULL;
  23572. }
  23573. goto done;
  23574. }
  23575. p->mark = _mark;
  23576. D(fprintf(stderr, "%*c%s invalid_elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  23577. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression NEWLINE"));
  23578. }
  23579. { // 'elif' named_expression ':' NEWLINE !INDENT
  23580. if (p->error_indicator) {
  23581. p->level--;
  23582. return NULL;
  23583. }
  23584. D(fprintf(stderr, "%*c> invalid_elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' NEWLINE !INDENT"));
  23585. Token * _literal;
  23586. Token * a;
  23587. expr_ty named_expression_var;
  23588. Token * newline_var;
  23589. if (
  23590. (a = _PyPegen_expect_token(p, 644)) // token='elif'
  23591. &&
  23592. (named_expression_var = named_expression_rule(p)) // named_expression
  23593. &&
  23594. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  23595. &&
  23596. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  23597. &&
  23598. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
  23599. )
  23600. {
  23601. D(fprintf(stderr, "%*c+ invalid_elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' NEWLINE !INDENT"));
  23602. _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'elif' statement on line %d" , a -> lineno );
  23603. if (_res == NULL && PyErr_Occurred()) {
  23604. p->error_indicator = 1;
  23605. p->level--;
  23606. return NULL;
  23607. }
  23608. goto done;
  23609. }
  23610. p->mark = _mark;
  23611. D(fprintf(stderr, "%*c%s invalid_elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  23612. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' NEWLINE !INDENT"));
  23613. }
  23614. _res = NULL;
  23615. done:
  23616. p->level--;
  23617. return _res;
  23618. }
  23619. // invalid_else_stmt: 'else' ':' NEWLINE !INDENT
  23620. static void *
  23621. invalid_else_stmt_rule(Parser *p)
  23622. {
  23623. if (p->level++ == MAXSTACK) {
  23624. _Pypegen_stack_overflow(p);
  23625. }
  23626. if (p->error_indicator) {
  23627. p->level--;
  23628. return NULL;
  23629. }
  23630. void * _res = NULL;
  23631. int _mark = p->mark;
  23632. { // 'else' ':' NEWLINE !INDENT
  23633. if (p->error_indicator) {
  23634. p->level--;
  23635. return NULL;
  23636. }
  23637. D(fprintf(stderr, "%*c> invalid_else_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' ':' NEWLINE !INDENT"));
  23638. Token * _literal;
  23639. Token * a;
  23640. Token * newline_var;
  23641. if (
  23642. (a = _PyPegen_expect_token(p, 645)) // token='else'
  23643. &&
  23644. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  23645. &&
  23646. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  23647. &&
  23648. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
  23649. )
  23650. {
  23651. D(fprintf(stderr, "%*c+ invalid_else_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' ':' NEWLINE !INDENT"));
  23652. _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'else' statement on line %d" , a -> lineno );
  23653. if (_res == NULL && PyErr_Occurred()) {
  23654. p->error_indicator = 1;
  23655. p->level--;
  23656. return NULL;
  23657. }
  23658. goto done;
  23659. }
  23660. p->mark = _mark;
  23661. D(fprintf(stderr, "%*c%s invalid_else_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  23662. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' ':' NEWLINE !INDENT"));
  23663. }
  23664. _res = NULL;
  23665. done:
  23666. p->level--;
  23667. return _res;
  23668. }
  23669. // invalid_while_stmt:
  23670. // | 'while' named_expression NEWLINE
  23671. // | 'while' named_expression ':' NEWLINE !INDENT
  23672. static void *
  23673. invalid_while_stmt_rule(Parser *p)
  23674. {
  23675. if (p->level++ == MAXSTACK) {
  23676. _Pypegen_stack_overflow(p);
  23677. }
  23678. if (p->error_indicator) {
  23679. p->level--;
  23680. return NULL;
  23681. }
  23682. void * _res = NULL;
  23683. int _mark = p->mark;
  23684. { // 'while' named_expression NEWLINE
  23685. if (p->error_indicator) {
  23686. p->level--;
  23687. return NULL;
  23688. }
  23689. D(fprintf(stderr, "%*c> invalid_while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression NEWLINE"));
  23690. Token * _keyword;
  23691. expr_ty named_expression_var;
  23692. Token * newline_var;
  23693. if (
  23694. (_keyword = _PyPegen_expect_token(p, 647)) // token='while'
  23695. &&
  23696. (named_expression_var = named_expression_rule(p)) // named_expression
  23697. &&
  23698. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  23699. )
  23700. {
  23701. D(fprintf(stderr, "%*c+ invalid_while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression NEWLINE"));
  23702. _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
  23703. if (_res == NULL && PyErr_Occurred()) {
  23704. p->error_indicator = 1;
  23705. p->level--;
  23706. return NULL;
  23707. }
  23708. goto done;
  23709. }
  23710. p->mark = _mark;
  23711. D(fprintf(stderr, "%*c%s invalid_while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  23712. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression NEWLINE"));
  23713. }
  23714. { // 'while' named_expression ':' NEWLINE !INDENT
  23715. if (p->error_indicator) {
  23716. p->level--;
  23717. return NULL;
  23718. }
  23719. D(fprintf(stderr, "%*c> invalid_while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' NEWLINE !INDENT"));
  23720. Token * _literal;
  23721. Token * a;
  23722. expr_ty named_expression_var;
  23723. Token * newline_var;
  23724. if (
  23725. (a = _PyPegen_expect_token(p, 647)) // token='while'
  23726. &&
  23727. (named_expression_var = named_expression_rule(p)) // named_expression
  23728. &&
  23729. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  23730. &&
  23731. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  23732. &&
  23733. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
  23734. )
  23735. {
  23736. D(fprintf(stderr, "%*c+ invalid_while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' NEWLINE !INDENT"));
  23737. _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'while' statement on line %d" , a -> lineno );
  23738. if (_res == NULL && PyErr_Occurred()) {
  23739. p->error_indicator = 1;
  23740. p->level--;
  23741. return NULL;
  23742. }
  23743. goto done;
  23744. }
  23745. p->mark = _mark;
  23746. D(fprintf(stderr, "%*c%s invalid_while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  23747. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression ':' NEWLINE !INDENT"));
  23748. }
  23749. _res = NULL;
  23750. done:
  23751. p->level--;
  23752. return _res;
  23753. }
  23754. // invalid_for_stmt:
  23755. // | ASYNC? 'for' star_targets 'in' star_expressions NEWLINE
  23756. // | ASYNC? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT
  23757. static void *
  23758. invalid_for_stmt_rule(Parser *p)
  23759. {
  23760. if (p->level++ == MAXSTACK) {
  23761. _Pypegen_stack_overflow(p);
  23762. }
  23763. if (p->error_indicator) {
  23764. p->level--;
  23765. return NULL;
  23766. }
  23767. void * _res = NULL;
  23768. int _mark = p->mark;
  23769. { // ASYNC? 'for' star_targets 'in' star_expressions NEWLINE
  23770. if (p->error_indicator) {
  23771. p->level--;
  23772. return NULL;
  23773. }
  23774. D(fprintf(stderr, "%*c> invalid_for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_targets 'in' star_expressions NEWLINE"));
  23775. Token * _keyword;
  23776. Token * _keyword_1;
  23777. void *_opt_var;
  23778. UNUSED(_opt_var); // Silence compiler warnings
  23779. Token * newline_var;
  23780. expr_ty star_expressions_var;
  23781. expr_ty star_targets_var;
  23782. if (
  23783. (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC?
  23784. &&
  23785. (_keyword = _PyPegen_expect_token(p, 650)) // token='for'
  23786. &&
  23787. (star_targets_var = star_targets_rule(p)) // star_targets
  23788. &&
  23789. (_keyword_1 = _PyPegen_expect_token(p, 651)) // token='in'
  23790. &&
  23791. (star_expressions_var = star_expressions_rule(p)) // star_expressions
  23792. &&
  23793. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  23794. )
  23795. {
  23796. D(fprintf(stderr, "%*c+ invalid_for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_targets 'in' star_expressions NEWLINE"));
  23797. _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
  23798. if (_res == NULL && PyErr_Occurred()) {
  23799. p->error_indicator = 1;
  23800. p->level--;
  23801. return NULL;
  23802. }
  23803. goto done;
  23804. }
  23805. p->mark = _mark;
  23806. D(fprintf(stderr, "%*c%s invalid_for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  23807. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'for' star_targets 'in' star_expressions NEWLINE"));
  23808. }
  23809. { // ASYNC? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT
  23810. if (p->error_indicator) {
  23811. p->level--;
  23812. return NULL;
  23813. }
  23814. D(fprintf(stderr, "%*c> invalid_for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT"));
  23815. Token * _keyword;
  23816. Token * _literal;
  23817. void *_opt_var;
  23818. UNUSED(_opt_var); // Silence compiler warnings
  23819. Token * a;
  23820. Token * newline_var;
  23821. expr_ty star_expressions_var;
  23822. expr_ty star_targets_var;
  23823. if (
  23824. (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC?
  23825. &&
  23826. (a = _PyPegen_expect_token(p, 650)) // token='for'
  23827. &&
  23828. (star_targets_var = star_targets_rule(p)) // star_targets
  23829. &&
  23830. (_keyword = _PyPegen_expect_token(p, 651)) // token='in'
  23831. &&
  23832. (star_expressions_var = star_expressions_rule(p)) // star_expressions
  23833. &&
  23834. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  23835. &&
  23836. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  23837. &&
  23838. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
  23839. )
  23840. {
  23841. D(fprintf(stderr, "%*c+ invalid_for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT"));
  23842. _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'for' statement on line %d" , a -> lineno );
  23843. if (_res == NULL && PyErr_Occurred()) {
  23844. p->error_indicator = 1;
  23845. p->level--;
  23846. return NULL;
  23847. }
  23848. goto done;
  23849. }
  23850. p->mark = _mark;
  23851. D(fprintf(stderr, "%*c%s invalid_for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
  23852. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT"));
  23853. }
  23854. _res = NULL;
  23855. done:
  23856. p->level--;
  23857. return _res;
  23858. }
  23859. // invalid_def_raw:
  23860. // | ASYNC? 'def' NAME type_params? '(' params? ')' ['->' expression] ':' NEWLINE !INDENT
  23861. static void *
  23862. invalid_def_raw_rule(Parser *p)
  23863. {
  23864. if (p->level++ == MAXSTACK) {
  23865. _Pypegen_stack_overflow(p);
  23866. }
  23867. if (p->error_indicator) {
  23868. p->level--;
  23869. return NULL;
  23870. }
  23871. void * _res = NULL;
  23872. int _mark = p->mark;
  23873. { // ASYNC? 'def' NAME type_params? '(' params? ')' ['->' expression] ':' NEWLINE !INDENT
  23874. if (p->error_indicator) {
  23875. p->level--;
  23876. return NULL;
  23877. }
  23878. D(fprintf(stderr, "%*c> invalid_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'def' NAME type_params? '(' params? ')' ['->' expression] ':' NEWLINE !INDENT"));
  23879. Token * _literal;
  23880. Token * _literal_1;
  23881. Token * _literal_2;
  23882. void *_opt_var;
  23883. UNUSED(_opt_var); // Silence compiler warnings
  23884. void *_opt_var_1;
  23885. UNUSED(_opt_var_1); // Silence compiler warnings
  23886. void *_opt_var_2;
  23887. UNUSED(_opt_var_2); // Silence compiler warnings
  23888. void *_opt_var_3;
  23889. UNUSED(_opt_var_3); // Silence compiler warnings
  23890. Token * a;
  23891. expr_ty name_var;
  23892. Token * newline_var;
  23893. if (
  23894. (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC?
  23895. &&
  23896. (a = _PyPegen_expect_token(p, 652)) // token='def'
  23897. &&
  23898. (name_var = _PyPegen_name_token(p)) // NAME
  23899. &&
  23900. (_opt_var_1 = type_params_rule(p), !p->error_indicator) // type_params?
  23901. &&
  23902. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  23903. &&
  23904. (_opt_var_2 = params_rule(p), !p->error_indicator) // params?
  23905. &&
  23906. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  23907. &&
  23908. (_opt_var_3 = _tmp_228_rule(p), !p->error_indicator) // ['->' expression]
  23909. &&
  23910. (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
  23911. &&
  23912. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  23913. &&
  23914. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
  23915. )
  23916. {
  23917. D(fprintf(stderr, "%*c+ invalid_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'def' NAME type_params? '(' params? ')' ['->' expression] ':' NEWLINE !INDENT"));
  23918. _res = RAISE_INDENTATION_ERROR ( "expected an indented block after function definition on line %d" , a -> lineno );
  23919. if (_res == NULL && PyErr_Occurred()) {
  23920. p->error_indicator = 1;
  23921. p->level--;
  23922. return NULL;
  23923. }
  23924. goto done;
  23925. }
  23926. p->mark = _mark;
  23927. D(fprintf(stderr, "%*c%s invalid_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
  23928. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'def' NAME type_params? '(' params? ')' ['->' expression] ':' NEWLINE !INDENT"));
  23929. }
  23930. _res = NULL;
  23931. done:
  23932. p->level--;
  23933. return _res;
  23934. }
  23935. // invalid_class_def_raw:
  23936. // | 'class' NAME type_params? ['(' arguments? ')'] NEWLINE
  23937. // | 'class' NAME type_params? ['(' arguments? ')'] ':' NEWLINE !INDENT
  23938. static void *
  23939. invalid_class_def_raw_rule(Parser *p)
  23940. {
  23941. if (p->level++ == MAXSTACK) {
  23942. _Pypegen_stack_overflow(p);
  23943. }
  23944. if (p->error_indicator) {
  23945. p->level--;
  23946. return NULL;
  23947. }
  23948. void * _res = NULL;
  23949. int _mark = p->mark;
  23950. { // 'class' NAME type_params? ['(' arguments? ')'] NEWLINE
  23951. if (p->error_indicator) {
  23952. p->level--;
  23953. return NULL;
  23954. }
  23955. D(fprintf(stderr, "%*c> invalid_class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] NEWLINE"));
  23956. Token * _keyword;
  23957. void *_opt_var;
  23958. UNUSED(_opt_var); // Silence compiler warnings
  23959. void *_opt_var_1;
  23960. UNUSED(_opt_var_1); // Silence compiler warnings
  23961. expr_ty name_var;
  23962. Token * newline_var;
  23963. if (
  23964. (_keyword = _PyPegen_expect_token(p, 654)) // token='class'
  23965. &&
  23966. (name_var = _PyPegen_name_token(p)) // NAME
  23967. &&
  23968. (_opt_var = type_params_rule(p), !p->error_indicator) // type_params?
  23969. &&
  23970. (_opt_var_1 = _tmp_229_rule(p), !p->error_indicator) // ['(' arguments? ')']
  23971. &&
  23972. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  23973. )
  23974. {
  23975. D(fprintf(stderr, "%*c+ invalid_class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] NEWLINE"));
  23976. _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
  23977. if (_res == NULL && PyErr_Occurred()) {
  23978. p->error_indicator = 1;
  23979. p->level--;
  23980. return NULL;
  23981. }
  23982. goto done;
  23983. }
  23984. p->mark = _mark;
  23985. D(fprintf(stderr, "%*c%s invalid_class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
  23986. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] NEWLINE"));
  23987. }
  23988. { // 'class' NAME type_params? ['(' arguments? ')'] ':' NEWLINE !INDENT
  23989. if (p->error_indicator) {
  23990. p->level--;
  23991. return NULL;
  23992. }
  23993. D(fprintf(stderr, "%*c> invalid_class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' NEWLINE !INDENT"));
  23994. Token * _literal;
  23995. void *_opt_var;
  23996. UNUSED(_opt_var); // Silence compiler warnings
  23997. void *_opt_var_1;
  23998. UNUSED(_opt_var_1); // Silence compiler warnings
  23999. Token * a;
  24000. expr_ty name_var;
  24001. Token * newline_var;
  24002. if (
  24003. (a = _PyPegen_expect_token(p, 654)) // token='class'
  24004. &&
  24005. (name_var = _PyPegen_name_token(p)) // NAME
  24006. &&
  24007. (_opt_var = type_params_rule(p), !p->error_indicator) // type_params?
  24008. &&
  24009. (_opt_var_1 = _tmp_230_rule(p), !p->error_indicator) // ['(' arguments? ')']
  24010. &&
  24011. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  24012. &&
  24013. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  24014. &&
  24015. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
  24016. )
  24017. {
  24018. D(fprintf(stderr, "%*c+ invalid_class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' NEWLINE !INDENT"));
  24019. _res = RAISE_INDENTATION_ERROR ( "expected an indented block after class definition on line %d" , a -> lineno );
  24020. if (_res == NULL && PyErr_Occurred()) {
  24021. p->error_indicator = 1;
  24022. p->level--;
  24023. return NULL;
  24024. }
  24025. goto done;
  24026. }
  24027. p->mark = _mark;
  24028. D(fprintf(stderr, "%*c%s invalid_class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
  24029. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' NEWLINE !INDENT"));
  24030. }
  24031. _res = NULL;
  24032. done:
  24033. p->level--;
  24034. return _res;
  24035. }
  24036. // invalid_double_starred_kvpairs:
  24037. // | ','.double_starred_kvpair+ ',' invalid_kvpair
  24038. // | expression ':' '*' bitwise_or
  24039. // | expression ':' &('}' | ',')
  24040. static void *
  24041. invalid_double_starred_kvpairs_rule(Parser *p)
  24042. {
  24043. if (p->level++ == MAXSTACK) {
  24044. _Pypegen_stack_overflow(p);
  24045. }
  24046. if (p->error_indicator) {
  24047. p->level--;
  24048. return NULL;
  24049. }
  24050. void * _res = NULL;
  24051. int _mark = p->mark;
  24052. { // ','.double_starred_kvpair+ ',' invalid_kvpair
  24053. if (p->error_indicator) {
  24054. p->level--;
  24055. return NULL;
  24056. }
  24057. D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair"));
  24058. asdl_seq * _gather_231_var;
  24059. Token * _literal;
  24060. void *invalid_kvpair_var;
  24061. if (
  24062. (_gather_231_var = _gather_231_rule(p)) // ','.double_starred_kvpair+
  24063. &&
  24064. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  24065. &&
  24066. (invalid_kvpair_var = invalid_kvpair_rule(p)) // invalid_kvpair
  24067. )
  24068. {
  24069. D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair"));
  24070. _res = _PyPegen_dummy_name(p, _gather_231_var, _literal, invalid_kvpair_var);
  24071. goto done;
  24072. }
  24073. p->mark = _mark;
  24074. D(fprintf(stderr, "%*c%s invalid_double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
  24075. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair"));
  24076. }
  24077. { // expression ':' '*' bitwise_or
  24078. if (p->error_indicator) {
  24079. p->level--;
  24080. return NULL;
  24081. }
  24082. D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or"));
  24083. Token * _literal;
  24084. Token * a;
  24085. expr_ty bitwise_or_var;
  24086. expr_ty expression_var;
  24087. if (
  24088. (expression_var = expression_rule(p)) // expression
  24089. &&
  24090. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  24091. &&
  24092. (a = _PyPegen_expect_token(p, 16)) // token='*'
  24093. &&
  24094. (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
  24095. )
  24096. {
  24097. D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or"));
  24098. _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "cannot use a starred expression in a dictionary value" );
  24099. if (_res == NULL && PyErr_Occurred()) {
  24100. p->error_indicator = 1;
  24101. p->level--;
  24102. return NULL;
  24103. }
  24104. goto done;
  24105. }
  24106. p->mark = _mark;
  24107. D(fprintf(stderr, "%*c%s invalid_double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
  24108. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' '*' bitwise_or"));
  24109. }
  24110. { // expression ':' &('}' | ',')
  24111. if (p->error_indicator) {
  24112. p->level--;
  24113. return NULL;
  24114. }
  24115. D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')"));
  24116. Token * a;
  24117. expr_ty expression_var;
  24118. if (
  24119. (expression_var = expression_rule(p)) // expression
  24120. &&
  24121. (a = _PyPegen_expect_token(p, 11)) // token=':'
  24122. &&
  24123. _PyPegen_lookahead(1, _tmp_233_rule, p)
  24124. )
  24125. {
  24126. D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')"));
  24127. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression expected after dictionary key and ':'" );
  24128. if (_res == NULL && PyErr_Occurred()) {
  24129. p->error_indicator = 1;
  24130. p->level--;
  24131. return NULL;
  24132. }
  24133. goto done;
  24134. }
  24135. p->mark = _mark;
  24136. D(fprintf(stderr, "%*c%s invalid_double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
  24137. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' &('}' | ',')"));
  24138. }
  24139. _res = NULL;
  24140. done:
  24141. p->level--;
  24142. return _res;
  24143. }
  24144. // invalid_kvpair:
  24145. // | expression !(':')
  24146. // | expression ':' '*' bitwise_or
  24147. // | expression ':' &('}' | ',')
  24148. static void *
  24149. invalid_kvpair_rule(Parser *p)
  24150. {
  24151. if (p->level++ == MAXSTACK) {
  24152. _Pypegen_stack_overflow(p);
  24153. }
  24154. if (p->error_indicator) {
  24155. p->level--;
  24156. return NULL;
  24157. }
  24158. void * _res = NULL;
  24159. int _mark = p->mark;
  24160. { // expression !(':')
  24161. if (p->error_indicator) {
  24162. p->level--;
  24163. return NULL;
  24164. }
  24165. D(fprintf(stderr, "%*c> invalid_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !(':')"));
  24166. expr_ty a;
  24167. if (
  24168. (a = expression_rule(p)) // expression
  24169. &&
  24170. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 11) // token=(':')
  24171. )
  24172. {
  24173. D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !(':')"));
  24174. _res = RAISE_ERROR_KNOWN_LOCATION ( p , PyExc_SyntaxError , a -> lineno , a -> end_col_offset - 1 , a -> end_lineno , - 1 , "':' expected after dictionary key" );
  24175. if (_res == NULL && PyErr_Occurred()) {
  24176. p->error_indicator = 1;
  24177. p->level--;
  24178. return NULL;
  24179. }
  24180. goto done;
  24181. }
  24182. p->mark = _mark;
  24183. D(fprintf(stderr, "%*c%s invalid_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
  24184. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !(':')"));
  24185. }
  24186. { // expression ':' '*' bitwise_or
  24187. if (p->error_indicator) {
  24188. p->level--;
  24189. return NULL;
  24190. }
  24191. D(fprintf(stderr, "%*c> invalid_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or"));
  24192. Token * _literal;
  24193. Token * a;
  24194. expr_ty bitwise_or_var;
  24195. expr_ty expression_var;
  24196. if (
  24197. (expression_var = expression_rule(p)) // expression
  24198. &&
  24199. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  24200. &&
  24201. (a = _PyPegen_expect_token(p, 16)) // token='*'
  24202. &&
  24203. (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
  24204. )
  24205. {
  24206. D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or"));
  24207. _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "cannot use a starred expression in a dictionary value" );
  24208. if (_res == NULL && PyErr_Occurred()) {
  24209. p->error_indicator = 1;
  24210. p->level--;
  24211. return NULL;
  24212. }
  24213. goto done;
  24214. }
  24215. p->mark = _mark;
  24216. D(fprintf(stderr, "%*c%s invalid_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
  24217. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' '*' bitwise_or"));
  24218. }
  24219. { // expression ':' &('}' | ',')
  24220. if (p->error_indicator) {
  24221. p->level--;
  24222. return NULL;
  24223. }
  24224. D(fprintf(stderr, "%*c> invalid_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')"));
  24225. Token * a;
  24226. expr_ty expression_var;
  24227. if (
  24228. (expression_var = expression_rule(p)) // expression
  24229. &&
  24230. (a = _PyPegen_expect_token(p, 11)) // token=':'
  24231. &&
  24232. _PyPegen_lookahead(1, _tmp_234_rule, p)
  24233. )
  24234. {
  24235. D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')"));
  24236. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression expected after dictionary key and ':'" );
  24237. if (_res == NULL && PyErr_Occurred()) {
  24238. p->error_indicator = 1;
  24239. p->level--;
  24240. return NULL;
  24241. }
  24242. goto done;
  24243. }
  24244. p->mark = _mark;
  24245. D(fprintf(stderr, "%*c%s invalid_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
  24246. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' &('}' | ',')"));
  24247. }
  24248. _res = NULL;
  24249. done:
  24250. p->level--;
  24251. return _res;
  24252. }
  24253. // invalid_starred_expression: '*' expression '=' expression
  24254. static void *
  24255. invalid_starred_expression_rule(Parser *p)
  24256. {
  24257. if (p->level++ == MAXSTACK) {
  24258. _Pypegen_stack_overflow(p);
  24259. }
  24260. if (p->error_indicator) {
  24261. p->level--;
  24262. return NULL;
  24263. }
  24264. void * _res = NULL;
  24265. int _mark = p->mark;
  24266. { // '*' expression '=' expression
  24267. if (p->error_indicator) {
  24268. p->level--;
  24269. return NULL;
  24270. }
  24271. D(fprintf(stderr, "%*c> invalid_starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression '=' expression"));
  24272. Token * _literal;
  24273. Token * a;
  24274. expr_ty b;
  24275. expr_ty expression_var;
  24276. if (
  24277. (a = _PyPegen_expect_token(p, 16)) // token='*'
  24278. &&
  24279. (expression_var = expression_rule(p)) // expression
  24280. &&
  24281. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  24282. &&
  24283. (b = expression_rule(p)) // expression
  24284. )
  24285. {
  24286. D(fprintf(stderr, "%*c+ invalid_starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression '=' expression"));
  24287. _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot assign to iterable argument unpacking" );
  24288. if (_res == NULL && PyErr_Occurred()) {
  24289. p->error_indicator = 1;
  24290. p->level--;
  24291. return NULL;
  24292. }
  24293. goto done;
  24294. }
  24295. p->mark = _mark;
  24296. D(fprintf(stderr, "%*c%s invalid_starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
  24297. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression '=' expression"));
  24298. }
  24299. _res = NULL;
  24300. done:
  24301. p->level--;
  24302. return _res;
  24303. }
  24304. // invalid_replacement_field:
  24305. // | '{' '='
  24306. // | '{' '!'
  24307. // | '{' ':'
  24308. // | '{' '}'
  24309. // | '{' !(yield_expr | star_expressions)
  24310. // | '{' (yield_expr | star_expressions) !('=' | '!' | ':' | '}')
  24311. // | '{' (yield_expr | star_expressions) '=' !('!' | ':' | '}')
  24312. // | '{' (yield_expr | star_expressions) '='? invalid_conversion_character
  24313. // | '{' (yield_expr | star_expressions) '='? ['!' NAME] !(':' | '}')
  24314. // | '{' (yield_expr | star_expressions) '='? ['!' NAME] ':' fstring_format_spec* !'}'
  24315. // | '{' (yield_expr | star_expressions) '='? ['!' NAME] !'}'
  24316. static void *
  24317. invalid_replacement_field_rule(Parser *p)
  24318. {
  24319. if (p->level++ == MAXSTACK) {
  24320. _Pypegen_stack_overflow(p);
  24321. }
  24322. if (p->error_indicator) {
  24323. p->level--;
  24324. return NULL;
  24325. }
  24326. void * _res = NULL;
  24327. int _mark = p->mark;
  24328. { // '{' '='
  24329. if (p->error_indicator) {
  24330. p->level--;
  24331. return NULL;
  24332. }
  24333. D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '='"));
  24334. Token * _literal;
  24335. Token * a;
  24336. if (
  24337. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  24338. &&
  24339. (a = _PyPegen_expect_token(p, 22)) // token='='
  24340. )
  24341. {
  24342. D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '='"));
  24343. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "f-string: valid expression required before '='" );
  24344. if (_res == NULL && PyErr_Occurred()) {
  24345. p->error_indicator = 1;
  24346. p->level--;
  24347. return NULL;
  24348. }
  24349. goto done;
  24350. }
  24351. p->mark = _mark;
  24352. D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
  24353. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '='"));
  24354. }
  24355. { // '{' '!'
  24356. if (p->error_indicator) {
  24357. p->level--;
  24358. return NULL;
  24359. }
  24360. D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '!'"));
  24361. Token * _literal;
  24362. Token * a;
  24363. if (
  24364. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  24365. &&
  24366. (a = _PyPegen_expect_token(p, 54)) // token='!'
  24367. )
  24368. {
  24369. D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '!'"));
  24370. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "f-string: valid expression required before '!'" );
  24371. if (_res == NULL && PyErr_Occurred()) {
  24372. p->error_indicator = 1;
  24373. p->level--;
  24374. return NULL;
  24375. }
  24376. goto done;
  24377. }
  24378. p->mark = _mark;
  24379. D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
  24380. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '!'"));
  24381. }
  24382. { // '{' ':'
  24383. if (p->error_indicator) {
  24384. p->level--;
  24385. return NULL;
  24386. }
  24387. D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' ':'"));
  24388. Token * _literal;
  24389. Token * a;
  24390. if (
  24391. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  24392. &&
  24393. (a = _PyPegen_expect_token(p, 11)) // token=':'
  24394. )
  24395. {
  24396. D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' ':'"));
  24397. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "f-string: valid expression required before ':'" );
  24398. if (_res == NULL && PyErr_Occurred()) {
  24399. p->error_indicator = 1;
  24400. p->level--;
  24401. return NULL;
  24402. }
  24403. goto done;
  24404. }
  24405. p->mark = _mark;
  24406. D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
  24407. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' ':'"));
  24408. }
  24409. { // '{' '}'
  24410. if (p->error_indicator) {
  24411. p->level--;
  24412. return NULL;
  24413. }
  24414. D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '}'"));
  24415. Token * _literal;
  24416. Token * a;
  24417. if (
  24418. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  24419. &&
  24420. (a = _PyPegen_expect_token(p, 26)) // token='}'
  24421. )
  24422. {
  24423. D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '}'"));
  24424. _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "f-string: valid expression required before '}'" );
  24425. if (_res == NULL && PyErr_Occurred()) {
  24426. p->error_indicator = 1;
  24427. p->level--;
  24428. return NULL;
  24429. }
  24430. goto done;
  24431. }
  24432. p->mark = _mark;
  24433. D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
  24434. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '}'"));
  24435. }
  24436. { // '{' !(yield_expr | star_expressions)
  24437. if (p->error_indicator) {
  24438. p->level--;
  24439. return NULL;
  24440. }
  24441. D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' !(yield_expr | star_expressions)"));
  24442. Token * _literal;
  24443. if (
  24444. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  24445. &&
  24446. _PyPegen_lookahead(0, _tmp_235_rule, p)
  24447. )
  24448. {
  24449. D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' !(yield_expr | star_expressions)"));
  24450. _res = RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting a valid expression after '{'" );
  24451. if (_res == NULL && PyErr_Occurred()) {
  24452. p->error_indicator = 1;
  24453. p->level--;
  24454. return NULL;
  24455. }
  24456. goto done;
  24457. }
  24458. p->mark = _mark;
  24459. D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
  24460. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' !(yield_expr | star_expressions)"));
  24461. }
  24462. { // '{' (yield_expr | star_expressions) !('=' | '!' | ':' | '}')
  24463. if (p->error_indicator) {
  24464. p->level--;
  24465. return NULL;
  24466. }
  24467. D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' (yield_expr | star_expressions) !('=' | '!' | ':' | '}')"));
  24468. Token * _literal;
  24469. void *_tmp_236_var;
  24470. if (
  24471. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  24472. &&
  24473. (_tmp_236_var = _tmp_236_rule(p)) // yield_expr | star_expressions
  24474. &&
  24475. _PyPegen_lookahead(0, _tmp_237_rule, p)
  24476. )
  24477. {
  24478. D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' (yield_expr | star_expressions) !('=' | '!' | ':' | '}')"));
  24479. _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting '=', or '!', or ':', or '}'" );
  24480. if (_res == NULL && PyErr_Occurred()) {
  24481. p->error_indicator = 1;
  24482. p->level--;
  24483. return NULL;
  24484. }
  24485. goto done;
  24486. }
  24487. p->mark = _mark;
  24488. D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
  24489. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' (yield_expr | star_expressions) !('=' | '!' | ':' | '}')"));
  24490. }
  24491. { // '{' (yield_expr | star_expressions) '=' !('!' | ':' | '}')
  24492. if (p->error_indicator) {
  24493. p->level--;
  24494. return NULL;
  24495. }
  24496. D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' (yield_expr | star_expressions) '=' !('!' | ':' | '}')"));
  24497. Token * _literal;
  24498. Token * _literal_1;
  24499. void *_tmp_238_var;
  24500. if (
  24501. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  24502. &&
  24503. (_tmp_238_var = _tmp_238_rule(p)) // yield_expr | star_expressions
  24504. &&
  24505. (_literal_1 = _PyPegen_expect_token(p, 22)) // token='='
  24506. &&
  24507. _PyPegen_lookahead(0, _tmp_239_rule, p)
  24508. )
  24509. {
  24510. D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' (yield_expr | star_expressions) '=' !('!' | ':' | '}')"));
  24511. _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting '!', or ':', or '}'" );
  24512. if (_res == NULL && PyErr_Occurred()) {
  24513. p->error_indicator = 1;
  24514. p->level--;
  24515. return NULL;
  24516. }
  24517. goto done;
  24518. }
  24519. p->mark = _mark;
  24520. D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
  24521. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' (yield_expr | star_expressions) '=' !('!' | ':' | '}')"));
  24522. }
  24523. { // '{' (yield_expr | star_expressions) '='? invalid_conversion_character
  24524. if (p->error_indicator) {
  24525. p->level--;
  24526. return NULL;
  24527. }
  24528. D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' (yield_expr | star_expressions) '='? invalid_conversion_character"));
  24529. Token * _literal;
  24530. void *_opt_var;
  24531. UNUSED(_opt_var); // Silence compiler warnings
  24532. void *_tmp_240_var;
  24533. void *invalid_conversion_character_var;
  24534. if (
  24535. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  24536. &&
  24537. (_tmp_240_var = _tmp_240_rule(p)) // yield_expr | star_expressions
  24538. &&
  24539. (_opt_var = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='?
  24540. &&
  24541. (invalid_conversion_character_var = invalid_conversion_character_rule(p)) // invalid_conversion_character
  24542. )
  24543. {
  24544. D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' (yield_expr | star_expressions) '='? invalid_conversion_character"));
  24545. _res = _PyPegen_dummy_name(p, _literal, _tmp_240_var, _opt_var, invalid_conversion_character_var);
  24546. goto done;
  24547. }
  24548. p->mark = _mark;
  24549. D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
  24550. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' (yield_expr | star_expressions) '='? invalid_conversion_character"));
  24551. }
  24552. { // '{' (yield_expr | star_expressions) '='? ['!' NAME] !(':' | '}')
  24553. if (p->error_indicator) {
  24554. p->level--;
  24555. return NULL;
  24556. }
  24557. D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' (yield_expr | star_expressions) '='? ['!' NAME] !(':' | '}')"));
  24558. Token * _literal;
  24559. void *_opt_var;
  24560. UNUSED(_opt_var); // Silence compiler warnings
  24561. void *_opt_var_1;
  24562. UNUSED(_opt_var_1); // Silence compiler warnings
  24563. void *_tmp_241_var;
  24564. if (
  24565. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  24566. &&
  24567. (_tmp_241_var = _tmp_241_rule(p)) // yield_expr | star_expressions
  24568. &&
  24569. (_opt_var = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='?
  24570. &&
  24571. (_opt_var_1 = _tmp_242_rule(p), !p->error_indicator) // ['!' NAME]
  24572. &&
  24573. _PyPegen_lookahead(0, _tmp_243_rule, p)
  24574. )
  24575. {
  24576. D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' (yield_expr | star_expressions) '='? ['!' NAME] !(':' | '}')"));
  24577. _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting ':' or '}'" );
  24578. if (_res == NULL && PyErr_Occurred()) {
  24579. p->error_indicator = 1;
  24580. p->level--;
  24581. return NULL;
  24582. }
  24583. goto done;
  24584. }
  24585. p->mark = _mark;
  24586. D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
  24587. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' (yield_expr | star_expressions) '='? ['!' NAME] !(':' | '}')"));
  24588. }
  24589. { // '{' (yield_expr | star_expressions) '='? ['!' NAME] ':' fstring_format_spec* !'}'
  24590. if (p->error_indicator) {
  24591. p->level--;
  24592. return NULL;
  24593. }
  24594. D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' (yield_expr | star_expressions) '='? ['!' NAME] ':' fstring_format_spec* !'}'"));
  24595. Token * _literal;
  24596. Token * _literal_1;
  24597. asdl_seq * _loop0_246_var;
  24598. void *_opt_var;
  24599. UNUSED(_opt_var); // Silence compiler warnings
  24600. void *_opt_var_1;
  24601. UNUSED(_opt_var_1); // Silence compiler warnings
  24602. void *_tmp_244_var;
  24603. if (
  24604. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  24605. &&
  24606. (_tmp_244_var = _tmp_244_rule(p)) // yield_expr | star_expressions
  24607. &&
  24608. (_opt_var = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='?
  24609. &&
  24610. (_opt_var_1 = _tmp_245_rule(p), !p->error_indicator) // ['!' NAME]
  24611. &&
  24612. (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
  24613. &&
  24614. (_loop0_246_var = _loop0_246_rule(p)) // fstring_format_spec*
  24615. &&
  24616. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 26) // token='}'
  24617. )
  24618. {
  24619. D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' (yield_expr | star_expressions) '='? ['!' NAME] ':' fstring_format_spec* !'}'"));
  24620. _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting '}', or format specs" );
  24621. if (_res == NULL && PyErr_Occurred()) {
  24622. p->error_indicator = 1;
  24623. p->level--;
  24624. return NULL;
  24625. }
  24626. goto done;
  24627. }
  24628. p->mark = _mark;
  24629. D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
  24630. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' (yield_expr | star_expressions) '='? ['!' NAME] ':' fstring_format_spec* !'}'"));
  24631. }
  24632. { // '{' (yield_expr | star_expressions) '='? ['!' NAME] !'}'
  24633. if (p->error_indicator) {
  24634. p->level--;
  24635. return NULL;
  24636. }
  24637. D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' (yield_expr | star_expressions) '='? ['!' NAME] !'}'"));
  24638. Token * _literal;
  24639. void *_opt_var;
  24640. UNUSED(_opt_var); // Silence compiler warnings
  24641. void *_opt_var_1;
  24642. UNUSED(_opt_var_1); // Silence compiler warnings
  24643. void *_tmp_247_var;
  24644. if (
  24645. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  24646. &&
  24647. (_tmp_247_var = _tmp_247_rule(p)) // yield_expr | star_expressions
  24648. &&
  24649. (_opt_var = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='?
  24650. &&
  24651. (_opt_var_1 = _tmp_248_rule(p), !p->error_indicator) // ['!' NAME]
  24652. &&
  24653. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 26) // token='}'
  24654. )
  24655. {
  24656. D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' (yield_expr | star_expressions) '='? ['!' NAME] !'}'"));
  24657. _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting '}'" );
  24658. if (_res == NULL && PyErr_Occurred()) {
  24659. p->error_indicator = 1;
  24660. p->level--;
  24661. return NULL;
  24662. }
  24663. goto done;
  24664. }
  24665. p->mark = _mark;
  24666. D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
  24667. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' (yield_expr | star_expressions) '='? ['!' NAME] !'}'"));
  24668. }
  24669. _res = NULL;
  24670. done:
  24671. p->level--;
  24672. return _res;
  24673. }
  24674. // invalid_conversion_character: '!' &(':' | '}') | '!' !NAME
  24675. static void *
  24676. invalid_conversion_character_rule(Parser *p)
  24677. {
  24678. if (p->level++ == MAXSTACK) {
  24679. _Pypegen_stack_overflow(p);
  24680. }
  24681. if (p->error_indicator) {
  24682. p->level--;
  24683. return NULL;
  24684. }
  24685. void * _res = NULL;
  24686. int _mark = p->mark;
  24687. { // '!' &(':' | '}')
  24688. if (p->error_indicator) {
  24689. p->level--;
  24690. return NULL;
  24691. }
  24692. D(fprintf(stderr, "%*c> invalid_conversion_character[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!' &(':' | '}')"));
  24693. Token * _literal;
  24694. if (
  24695. (_literal = _PyPegen_expect_token(p, 54)) // token='!'
  24696. &&
  24697. _PyPegen_lookahead(1, _tmp_249_rule, p)
  24698. )
  24699. {
  24700. D(fprintf(stderr, "%*c+ invalid_conversion_character[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!' &(':' | '}')"));
  24701. _res = RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: missing conversion character" );
  24702. if (_res == NULL && PyErr_Occurred()) {
  24703. p->error_indicator = 1;
  24704. p->level--;
  24705. return NULL;
  24706. }
  24707. goto done;
  24708. }
  24709. p->mark = _mark;
  24710. D(fprintf(stderr, "%*c%s invalid_conversion_character[%d-%d]: %s failed!\n", p->level, ' ',
  24711. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!' &(':' | '}')"));
  24712. }
  24713. { // '!' !NAME
  24714. if (p->error_indicator) {
  24715. p->level--;
  24716. return NULL;
  24717. }
  24718. D(fprintf(stderr, "%*c> invalid_conversion_character[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!' !NAME"));
  24719. Token * _literal;
  24720. if (
  24721. (_literal = _PyPegen_expect_token(p, 54)) // token='!'
  24722. &&
  24723. _PyPegen_lookahead_with_name(0, _PyPegen_name_token, p)
  24724. )
  24725. {
  24726. D(fprintf(stderr, "%*c+ invalid_conversion_character[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!' !NAME"));
  24727. _res = RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: invalid conversion character" );
  24728. if (_res == NULL && PyErr_Occurred()) {
  24729. p->error_indicator = 1;
  24730. p->level--;
  24731. return NULL;
  24732. }
  24733. goto done;
  24734. }
  24735. p->mark = _mark;
  24736. D(fprintf(stderr, "%*c%s invalid_conversion_character[%d-%d]: %s failed!\n", p->level, ' ',
  24737. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!' !NAME"));
  24738. }
  24739. _res = NULL;
  24740. done:
  24741. p->level--;
  24742. return _res;
  24743. }
  24744. // _loop0_1: NEWLINE
  24745. static asdl_seq *
  24746. _loop0_1_rule(Parser *p)
  24747. {
  24748. if (p->level++ == MAXSTACK) {
  24749. _Pypegen_stack_overflow(p);
  24750. }
  24751. if (p->error_indicator) {
  24752. p->level--;
  24753. return NULL;
  24754. }
  24755. void *_res = NULL;
  24756. int _mark = p->mark;
  24757. void **_children = PyMem_Malloc(sizeof(void *));
  24758. if (!_children) {
  24759. p->error_indicator = 1;
  24760. PyErr_NoMemory();
  24761. p->level--;
  24762. return NULL;
  24763. }
  24764. Py_ssize_t _children_capacity = 1;
  24765. Py_ssize_t _n = 0;
  24766. { // NEWLINE
  24767. if (p->error_indicator) {
  24768. p->level--;
  24769. return NULL;
  24770. }
  24771. D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
  24772. Token * newline_var;
  24773. while (
  24774. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  24775. )
  24776. {
  24777. _res = newline_var;
  24778. if (_n == _children_capacity) {
  24779. _children_capacity *= 2;
  24780. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  24781. if (!_new_children) {
  24782. PyMem_Free(_children);
  24783. p->error_indicator = 1;
  24784. PyErr_NoMemory();
  24785. p->level--;
  24786. return NULL;
  24787. }
  24788. _children = _new_children;
  24789. }
  24790. _children[_n++] = _res;
  24791. _mark = p->mark;
  24792. }
  24793. p->mark = _mark;
  24794. D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ',
  24795. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
  24796. }
  24797. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  24798. if (!_seq) {
  24799. PyMem_Free(_children);
  24800. p->error_indicator = 1;
  24801. PyErr_NoMemory();
  24802. p->level--;
  24803. return NULL;
  24804. }
  24805. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  24806. PyMem_Free(_children);
  24807. p->level--;
  24808. return _seq;
  24809. }
  24810. // _loop0_2: NEWLINE
  24811. static asdl_seq *
  24812. _loop0_2_rule(Parser *p)
  24813. {
  24814. if (p->level++ == MAXSTACK) {
  24815. _Pypegen_stack_overflow(p);
  24816. }
  24817. if (p->error_indicator) {
  24818. p->level--;
  24819. return NULL;
  24820. }
  24821. void *_res = NULL;
  24822. int _mark = p->mark;
  24823. void **_children = PyMem_Malloc(sizeof(void *));
  24824. if (!_children) {
  24825. p->error_indicator = 1;
  24826. PyErr_NoMemory();
  24827. p->level--;
  24828. return NULL;
  24829. }
  24830. Py_ssize_t _children_capacity = 1;
  24831. Py_ssize_t _n = 0;
  24832. { // NEWLINE
  24833. if (p->error_indicator) {
  24834. p->level--;
  24835. return NULL;
  24836. }
  24837. D(fprintf(stderr, "%*c> _loop0_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
  24838. Token * newline_var;
  24839. while (
  24840. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  24841. )
  24842. {
  24843. _res = newline_var;
  24844. if (_n == _children_capacity) {
  24845. _children_capacity *= 2;
  24846. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  24847. if (!_new_children) {
  24848. PyMem_Free(_children);
  24849. p->error_indicator = 1;
  24850. PyErr_NoMemory();
  24851. p->level--;
  24852. return NULL;
  24853. }
  24854. _children = _new_children;
  24855. }
  24856. _children[_n++] = _res;
  24857. _mark = p->mark;
  24858. }
  24859. p->mark = _mark;
  24860. D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ',
  24861. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
  24862. }
  24863. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  24864. if (!_seq) {
  24865. PyMem_Free(_children);
  24866. p->error_indicator = 1;
  24867. PyErr_NoMemory();
  24868. p->level--;
  24869. return NULL;
  24870. }
  24871. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  24872. PyMem_Free(_children);
  24873. p->level--;
  24874. return _seq;
  24875. }
  24876. // _loop1_3: statement
  24877. static asdl_seq *
  24878. _loop1_3_rule(Parser *p)
  24879. {
  24880. if (p->level++ == MAXSTACK) {
  24881. _Pypegen_stack_overflow(p);
  24882. }
  24883. if (p->error_indicator) {
  24884. p->level--;
  24885. return NULL;
  24886. }
  24887. void *_res = NULL;
  24888. int _mark = p->mark;
  24889. void **_children = PyMem_Malloc(sizeof(void *));
  24890. if (!_children) {
  24891. p->error_indicator = 1;
  24892. PyErr_NoMemory();
  24893. p->level--;
  24894. return NULL;
  24895. }
  24896. Py_ssize_t _children_capacity = 1;
  24897. Py_ssize_t _n = 0;
  24898. { // statement
  24899. if (p->error_indicator) {
  24900. p->level--;
  24901. return NULL;
  24902. }
  24903. D(fprintf(stderr, "%*c> _loop1_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement"));
  24904. asdl_stmt_seq* statement_var;
  24905. while (
  24906. (statement_var = statement_rule(p)) // statement
  24907. )
  24908. {
  24909. _res = statement_var;
  24910. if (_n == _children_capacity) {
  24911. _children_capacity *= 2;
  24912. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  24913. if (!_new_children) {
  24914. PyMem_Free(_children);
  24915. p->error_indicator = 1;
  24916. PyErr_NoMemory();
  24917. p->level--;
  24918. return NULL;
  24919. }
  24920. _children = _new_children;
  24921. }
  24922. _children[_n++] = _res;
  24923. _mark = p->mark;
  24924. }
  24925. p->mark = _mark;
  24926. D(fprintf(stderr, "%*c%s _loop1_3[%d-%d]: %s failed!\n", p->level, ' ',
  24927. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement"));
  24928. }
  24929. if (_n == 0 || p->error_indicator) {
  24930. PyMem_Free(_children);
  24931. p->level--;
  24932. return NULL;
  24933. }
  24934. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  24935. if (!_seq) {
  24936. PyMem_Free(_children);
  24937. p->error_indicator = 1;
  24938. PyErr_NoMemory();
  24939. p->level--;
  24940. return NULL;
  24941. }
  24942. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  24943. PyMem_Free(_children);
  24944. p->level--;
  24945. return _seq;
  24946. }
  24947. // _loop0_5: ';' simple_stmt
  24948. static asdl_seq *
  24949. _loop0_5_rule(Parser *p)
  24950. {
  24951. if (p->level++ == MAXSTACK) {
  24952. _Pypegen_stack_overflow(p);
  24953. }
  24954. if (p->error_indicator) {
  24955. p->level--;
  24956. return NULL;
  24957. }
  24958. void *_res = NULL;
  24959. int _mark = p->mark;
  24960. void **_children = PyMem_Malloc(sizeof(void *));
  24961. if (!_children) {
  24962. p->error_indicator = 1;
  24963. PyErr_NoMemory();
  24964. p->level--;
  24965. return NULL;
  24966. }
  24967. Py_ssize_t _children_capacity = 1;
  24968. Py_ssize_t _n = 0;
  24969. { // ';' simple_stmt
  24970. if (p->error_indicator) {
  24971. p->level--;
  24972. return NULL;
  24973. }
  24974. D(fprintf(stderr, "%*c> _loop0_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' simple_stmt"));
  24975. Token * _literal;
  24976. stmt_ty elem;
  24977. while (
  24978. (_literal = _PyPegen_expect_token(p, 13)) // token=';'
  24979. &&
  24980. (elem = simple_stmt_rule(p)) // simple_stmt
  24981. )
  24982. {
  24983. _res = elem;
  24984. if (_res == NULL && PyErr_Occurred()) {
  24985. p->error_indicator = 1;
  24986. PyMem_Free(_children);
  24987. p->level--;
  24988. return NULL;
  24989. }
  24990. if (_n == _children_capacity) {
  24991. _children_capacity *= 2;
  24992. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  24993. if (!_new_children) {
  24994. PyMem_Free(_children);
  24995. p->error_indicator = 1;
  24996. PyErr_NoMemory();
  24997. p->level--;
  24998. return NULL;
  24999. }
  25000. _children = _new_children;
  25001. }
  25002. _children[_n++] = _res;
  25003. _mark = p->mark;
  25004. }
  25005. p->mark = _mark;
  25006. D(fprintf(stderr, "%*c%s _loop0_5[%d-%d]: %s failed!\n", p->level, ' ',
  25007. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' simple_stmt"));
  25008. }
  25009. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  25010. if (!_seq) {
  25011. PyMem_Free(_children);
  25012. p->error_indicator = 1;
  25013. PyErr_NoMemory();
  25014. p->level--;
  25015. return NULL;
  25016. }
  25017. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  25018. PyMem_Free(_children);
  25019. p->level--;
  25020. return _seq;
  25021. }
  25022. // _gather_4: simple_stmt _loop0_5
  25023. static asdl_seq *
  25024. _gather_4_rule(Parser *p)
  25025. {
  25026. if (p->level++ == MAXSTACK) {
  25027. _Pypegen_stack_overflow(p);
  25028. }
  25029. if (p->error_indicator) {
  25030. p->level--;
  25031. return NULL;
  25032. }
  25033. asdl_seq * _res = NULL;
  25034. int _mark = p->mark;
  25035. { // simple_stmt _loop0_5
  25036. if (p->error_indicator) {
  25037. p->level--;
  25038. return NULL;
  25039. }
  25040. D(fprintf(stderr, "%*c> _gather_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt _loop0_5"));
  25041. stmt_ty elem;
  25042. asdl_seq * seq;
  25043. if (
  25044. (elem = simple_stmt_rule(p)) // simple_stmt
  25045. &&
  25046. (seq = _loop0_5_rule(p)) // _loop0_5
  25047. )
  25048. {
  25049. D(fprintf(stderr, "%*c+ _gather_4[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt _loop0_5"));
  25050. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  25051. goto done;
  25052. }
  25053. p->mark = _mark;
  25054. D(fprintf(stderr, "%*c%s _gather_4[%d-%d]: %s failed!\n", p->level, ' ',
  25055. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt _loop0_5"));
  25056. }
  25057. _res = NULL;
  25058. done:
  25059. p->level--;
  25060. return _res;
  25061. }
  25062. // _tmp_6: 'import' | 'from'
  25063. static void *
  25064. _tmp_6_rule(Parser *p)
  25065. {
  25066. if (p->level++ == MAXSTACK) {
  25067. _Pypegen_stack_overflow(p);
  25068. }
  25069. if (p->error_indicator) {
  25070. p->level--;
  25071. return NULL;
  25072. }
  25073. void * _res = NULL;
  25074. int _mark = p->mark;
  25075. { // 'import'
  25076. if (p->error_indicator) {
  25077. p->level--;
  25078. return NULL;
  25079. }
  25080. D(fprintf(stderr, "%*c> _tmp_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'"));
  25081. Token * _keyword;
  25082. if (
  25083. (_keyword = _PyPegen_expect_token(p, 607)) // token='import'
  25084. )
  25085. {
  25086. D(fprintf(stderr, "%*c+ _tmp_6[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'"));
  25087. _res = _keyword;
  25088. goto done;
  25089. }
  25090. p->mark = _mark;
  25091. D(fprintf(stderr, "%*c%s _tmp_6[%d-%d]: %s failed!\n", p->level, ' ',
  25092. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'"));
  25093. }
  25094. { // 'from'
  25095. if (p->error_indicator) {
  25096. p->level--;
  25097. return NULL;
  25098. }
  25099. D(fprintf(stderr, "%*c> _tmp_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'"));
  25100. Token * _keyword;
  25101. if (
  25102. (_keyword = _PyPegen_expect_token(p, 608)) // token='from'
  25103. )
  25104. {
  25105. D(fprintf(stderr, "%*c+ _tmp_6[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'"));
  25106. _res = _keyword;
  25107. goto done;
  25108. }
  25109. p->mark = _mark;
  25110. D(fprintf(stderr, "%*c%s _tmp_6[%d-%d]: %s failed!\n", p->level, ' ',
  25111. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'"));
  25112. }
  25113. _res = NULL;
  25114. done:
  25115. p->level--;
  25116. return _res;
  25117. }
  25118. // _tmp_7: 'def' | '@' | ASYNC
  25119. static void *
  25120. _tmp_7_rule(Parser *p)
  25121. {
  25122. if (p->level++ == MAXSTACK) {
  25123. _Pypegen_stack_overflow(p);
  25124. }
  25125. if (p->error_indicator) {
  25126. p->level--;
  25127. return NULL;
  25128. }
  25129. void * _res = NULL;
  25130. int _mark = p->mark;
  25131. { // 'def'
  25132. if (p->error_indicator) {
  25133. p->level--;
  25134. return NULL;
  25135. }
  25136. D(fprintf(stderr, "%*c> _tmp_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'"));
  25137. Token * _keyword;
  25138. if (
  25139. (_keyword = _PyPegen_expect_token(p, 652)) // token='def'
  25140. )
  25141. {
  25142. D(fprintf(stderr, "%*c+ _tmp_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'"));
  25143. _res = _keyword;
  25144. goto done;
  25145. }
  25146. p->mark = _mark;
  25147. D(fprintf(stderr, "%*c%s _tmp_7[%d-%d]: %s failed!\n", p->level, ' ',
  25148. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'"));
  25149. }
  25150. { // '@'
  25151. if (p->error_indicator) {
  25152. p->level--;
  25153. return NULL;
  25154. }
  25155. D(fprintf(stderr, "%*c> _tmp_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
  25156. Token * _literal;
  25157. if (
  25158. (_literal = _PyPegen_expect_token(p, 49)) // token='@'
  25159. )
  25160. {
  25161. D(fprintf(stderr, "%*c+ _tmp_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
  25162. _res = _literal;
  25163. goto done;
  25164. }
  25165. p->mark = _mark;
  25166. D(fprintf(stderr, "%*c%s _tmp_7[%d-%d]: %s failed!\n", p->level, ' ',
  25167. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
  25168. }
  25169. { // ASYNC
  25170. if (p->error_indicator) {
  25171. p->level--;
  25172. return NULL;
  25173. }
  25174. D(fprintf(stderr, "%*c> _tmp_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
  25175. Token * async_var;
  25176. if (
  25177. (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
  25178. )
  25179. {
  25180. D(fprintf(stderr, "%*c+ _tmp_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
  25181. _res = async_var;
  25182. goto done;
  25183. }
  25184. p->mark = _mark;
  25185. D(fprintf(stderr, "%*c%s _tmp_7[%d-%d]: %s failed!\n", p->level, ' ',
  25186. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
  25187. }
  25188. _res = NULL;
  25189. done:
  25190. p->level--;
  25191. return _res;
  25192. }
  25193. // _tmp_8: 'class' | '@'
  25194. static void *
  25195. _tmp_8_rule(Parser *p)
  25196. {
  25197. if (p->level++ == MAXSTACK) {
  25198. _Pypegen_stack_overflow(p);
  25199. }
  25200. if (p->error_indicator) {
  25201. p->level--;
  25202. return NULL;
  25203. }
  25204. void * _res = NULL;
  25205. int _mark = p->mark;
  25206. { // 'class'
  25207. if (p->error_indicator) {
  25208. p->level--;
  25209. return NULL;
  25210. }
  25211. D(fprintf(stderr, "%*c> _tmp_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'"));
  25212. Token * _keyword;
  25213. if (
  25214. (_keyword = _PyPegen_expect_token(p, 654)) // token='class'
  25215. )
  25216. {
  25217. D(fprintf(stderr, "%*c+ _tmp_8[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'"));
  25218. _res = _keyword;
  25219. goto done;
  25220. }
  25221. p->mark = _mark;
  25222. D(fprintf(stderr, "%*c%s _tmp_8[%d-%d]: %s failed!\n", p->level, ' ',
  25223. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'"));
  25224. }
  25225. { // '@'
  25226. if (p->error_indicator) {
  25227. p->level--;
  25228. return NULL;
  25229. }
  25230. D(fprintf(stderr, "%*c> _tmp_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
  25231. Token * _literal;
  25232. if (
  25233. (_literal = _PyPegen_expect_token(p, 49)) // token='@'
  25234. )
  25235. {
  25236. D(fprintf(stderr, "%*c+ _tmp_8[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
  25237. _res = _literal;
  25238. goto done;
  25239. }
  25240. p->mark = _mark;
  25241. D(fprintf(stderr, "%*c%s _tmp_8[%d-%d]: %s failed!\n", p->level, ' ',
  25242. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
  25243. }
  25244. _res = NULL;
  25245. done:
  25246. p->level--;
  25247. return _res;
  25248. }
  25249. // _tmp_9: 'with' | ASYNC
  25250. static void *
  25251. _tmp_9_rule(Parser *p)
  25252. {
  25253. if (p->level++ == MAXSTACK) {
  25254. _Pypegen_stack_overflow(p);
  25255. }
  25256. if (p->error_indicator) {
  25257. p->level--;
  25258. return NULL;
  25259. }
  25260. void * _res = NULL;
  25261. int _mark = p->mark;
  25262. { // 'with'
  25263. if (p->error_indicator) {
  25264. p->level--;
  25265. return NULL;
  25266. }
  25267. D(fprintf(stderr, "%*c> _tmp_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'"));
  25268. Token * _keyword;
  25269. if (
  25270. (_keyword = _PyPegen_expect_token(p, 615)) // token='with'
  25271. )
  25272. {
  25273. D(fprintf(stderr, "%*c+ _tmp_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'"));
  25274. _res = _keyword;
  25275. goto done;
  25276. }
  25277. p->mark = _mark;
  25278. D(fprintf(stderr, "%*c%s _tmp_9[%d-%d]: %s failed!\n", p->level, ' ',
  25279. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'"));
  25280. }
  25281. { // ASYNC
  25282. if (p->error_indicator) {
  25283. p->level--;
  25284. return NULL;
  25285. }
  25286. D(fprintf(stderr, "%*c> _tmp_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
  25287. Token * async_var;
  25288. if (
  25289. (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
  25290. )
  25291. {
  25292. D(fprintf(stderr, "%*c+ _tmp_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
  25293. _res = async_var;
  25294. goto done;
  25295. }
  25296. p->mark = _mark;
  25297. D(fprintf(stderr, "%*c%s _tmp_9[%d-%d]: %s failed!\n", p->level, ' ',
  25298. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
  25299. }
  25300. _res = NULL;
  25301. done:
  25302. p->level--;
  25303. return _res;
  25304. }
  25305. // _tmp_10: 'for' | ASYNC
  25306. static void *
  25307. _tmp_10_rule(Parser *p)
  25308. {
  25309. if (p->level++ == MAXSTACK) {
  25310. _Pypegen_stack_overflow(p);
  25311. }
  25312. if (p->error_indicator) {
  25313. p->level--;
  25314. return NULL;
  25315. }
  25316. void * _res = NULL;
  25317. int _mark = p->mark;
  25318. { // 'for'
  25319. if (p->error_indicator) {
  25320. p->level--;
  25321. return NULL;
  25322. }
  25323. D(fprintf(stderr, "%*c> _tmp_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'"));
  25324. Token * _keyword;
  25325. if (
  25326. (_keyword = _PyPegen_expect_token(p, 650)) // token='for'
  25327. )
  25328. {
  25329. D(fprintf(stderr, "%*c+ _tmp_10[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'"));
  25330. _res = _keyword;
  25331. goto done;
  25332. }
  25333. p->mark = _mark;
  25334. D(fprintf(stderr, "%*c%s _tmp_10[%d-%d]: %s failed!\n", p->level, ' ',
  25335. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'"));
  25336. }
  25337. { // ASYNC
  25338. if (p->error_indicator) {
  25339. p->level--;
  25340. return NULL;
  25341. }
  25342. D(fprintf(stderr, "%*c> _tmp_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
  25343. Token * async_var;
  25344. if (
  25345. (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
  25346. )
  25347. {
  25348. D(fprintf(stderr, "%*c+ _tmp_10[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
  25349. _res = async_var;
  25350. goto done;
  25351. }
  25352. p->mark = _mark;
  25353. D(fprintf(stderr, "%*c%s _tmp_10[%d-%d]: %s failed!\n", p->level, ' ',
  25354. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
  25355. }
  25356. _res = NULL;
  25357. done:
  25358. p->level--;
  25359. return _res;
  25360. }
  25361. // _tmp_11: '=' annotated_rhs
  25362. static void *
  25363. _tmp_11_rule(Parser *p)
  25364. {
  25365. if (p->level++ == MAXSTACK) {
  25366. _Pypegen_stack_overflow(p);
  25367. }
  25368. if (p->error_indicator) {
  25369. p->level--;
  25370. return NULL;
  25371. }
  25372. void * _res = NULL;
  25373. int _mark = p->mark;
  25374. { // '=' annotated_rhs
  25375. if (p->error_indicator) {
  25376. p->level--;
  25377. return NULL;
  25378. }
  25379. D(fprintf(stderr, "%*c> _tmp_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
  25380. Token * _literal;
  25381. expr_ty d;
  25382. if (
  25383. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  25384. &&
  25385. (d = annotated_rhs_rule(p)) // annotated_rhs
  25386. )
  25387. {
  25388. D(fprintf(stderr, "%*c+ _tmp_11[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
  25389. _res = d;
  25390. if (_res == NULL && PyErr_Occurred()) {
  25391. p->error_indicator = 1;
  25392. p->level--;
  25393. return NULL;
  25394. }
  25395. goto done;
  25396. }
  25397. p->mark = _mark;
  25398. D(fprintf(stderr, "%*c%s _tmp_11[%d-%d]: %s failed!\n", p->level, ' ',
  25399. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
  25400. }
  25401. _res = NULL;
  25402. done:
  25403. p->level--;
  25404. return _res;
  25405. }
  25406. // _tmp_12: '(' single_target ')' | single_subscript_attribute_target
  25407. static void *
  25408. _tmp_12_rule(Parser *p)
  25409. {
  25410. if (p->level++ == MAXSTACK) {
  25411. _Pypegen_stack_overflow(p);
  25412. }
  25413. if (p->error_indicator) {
  25414. p->level--;
  25415. return NULL;
  25416. }
  25417. void * _res = NULL;
  25418. int _mark = p->mark;
  25419. { // '(' single_target ')'
  25420. if (p->error_indicator) {
  25421. p->level--;
  25422. return NULL;
  25423. }
  25424. D(fprintf(stderr, "%*c> _tmp_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
  25425. Token * _literal;
  25426. Token * _literal_1;
  25427. expr_ty b;
  25428. if (
  25429. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  25430. &&
  25431. (b = single_target_rule(p)) // single_target
  25432. &&
  25433. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  25434. )
  25435. {
  25436. D(fprintf(stderr, "%*c+ _tmp_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
  25437. _res = b;
  25438. if (_res == NULL && PyErr_Occurred()) {
  25439. p->error_indicator = 1;
  25440. p->level--;
  25441. return NULL;
  25442. }
  25443. goto done;
  25444. }
  25445. p->mark = _mark;
  25446. D(fprintf(stderr, "%*c%s _tmp_12[%d-%d]: %s failed!\n", p->level, ' ',
  25447. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
  25448. }
  25449. { // single_subscript_attribute_target
  25450. if (p->error_indicator) {
  25451. p->level--;
  25452. return NULL;
  25453. }
  25454. D(fprintf(stderr, "%*c> _tmp_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
  25455. expr_ty single_subscript_attribute_target_var;
  25456. if (
  25457. (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
  25458. )
  25459. {
  25460. D(fprintf(stderr, "%*c+ _tmp_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
  25461. _res = single_subscript_attribute_target_var;
  25462. goto done;
  25463. }
  25464. p->mark = _mark;
  25465. D(fprintf(stderr, "%*c%s _tmp_12[%d-%d]: %s failed!\n", p->level, ' ',
  25466. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
  25467. }
  25468. _res = NULL;
  25469. done:
  25470. p->level--;
  25471. return _res;
  25472. }
  25473. // _tmp_13: '=' annotated_rhs
  25474. static void *
  25475. _tmp_13_rule(Parser *p)
  25476. {
  25477. if (p->level++ == MAXSTACK) {
  25478. _Pypegen_stack_overflow(p);
  25479. }
  25480. if (p->error_indicator) {
  25481. p->level--;
  25482. return NULL;
  25483. }
  25484. void * _res = NULL;
  25485. int _mark = p->mark;
  25486. { // '=' annotated_rhs
  25487. if (p->error_indicator) {
  25488. p->level--;
  25489. return NULL;
  25490. }
  25491. D(fprintf(stderr, "%*c> _tmp_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
  25492. Token * _literal;
  25493. expr_ty d;
  25494. if (
  25495. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  25496. &&
  25497. (d = annotated_rhs_rule(p)) // annotated_rhs
  25498. )
  25499. {
  25500. D(fprintf(stderr, "%*c+ _tmp_13[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
  25501. _res = d;
  25502. if (_res == NULL && PyErr_Occurred()) {
  25503. p->error_indicator = 1;
  25504. p->level--;
  25505. return NULL;
  25506. }
  25507. goto done;
  25508. }
  25509. p->mark = _mark;
  25510. D(fprintf(stderr, "%*c%s _tmp_13[%d-%d]: %s failed!\n", p->level, ' ',
  25511. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
  25512. }
  25513. _res = NULL;
  25514. done:
  25515. p->level--;
  25516. return _res;
  25517. }
  25518. // _loop1_14: (star_targets '=')
  25519. static asdl_seq *
  25520. _loop1_14_rule(Parser *p)
  25521. {
  25522. if (p->level++ == MAXSTACK) {
  25523. _Pypegen_stack_overflow(p);
  25524. }
  25525. if (p->error_indicator) {
  25526. p->level--;
  25527. return NULL;
  25528. }
  25529. void *_res = NULL;
  25530. int _mark = p->mark;
  25531. void **_children = PyMem_Malloc(sizeof(void *));
  25532. if (!_children) {
  25533. p->error_indicator = 1;
  25534. PyErr_NoMemory();
  25535. p->level--;
  25536. return NULL;
  25537. }
  25538. Py_ssize_t _children_capacity = 1;
  25539. Py_ssize_t _n = 0;
  25540. { // (star_targets '=')
  25541. if (p->error_indicator) {
  25542. p->level--;
  25543. return NULL;
  25544. }
  25545. D(fprintf(stderr, "%*c> _loop1_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
  25546. void *_tmp_250_var;
  25547. while (
  25548. (_tmp_250_var = _tmp_250_rule(p)) // star_targets '='
  25549. )
  25550. {
  25551. _res = _tmp_250_var;
  25552. if (_n == _children_capacity) {
  25553. _children_capacity *= 2;
  25554. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  25555. if (!_new_children) {
  25556. PyMem_Free(_children);
  25557. p->error_indicator = 1;
  25558. PyErr_NoMemory();
  25559. p->level--;
  25560. return NULL;
  25561. }
  25562. _children = _new_children;
  25563. }
  25564. _children[_n++] = _res;
  25565. _mark = p->mark;
  25566. }
  25567. p->mark = _mark;
  25568. D(fprintf(stderr, "%*c%s _loop1_14[%d-%d]: %s failed!\n", p->level, ' ',
  25569. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
  25570. }
  25571. if (_n == 0 || p->error_indicator) {
  25572. PyMem_Free(_children);
  25573. p->level--;
  25574. return NULL;
  25575. }
  25576. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  25577. if (!_seq) {
  25578. PyMem_Free(_children);
  25579. p->error_indicator = 1;
  25580. PyErr_NoMemory();
  25581. p->level--;
  25582. return NULL;
  25583. }
  25584. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  25585. PyMem_Free(_children);
  25586. p->level--;
  25587. return _seq;
  25588. }
  25589. // _tmp_15: yield_expr | star_expressions
  25590. static void *
  25591. _tmp_15_rule(Parser *p)
  25592. {
  25593. if (p->level++ == MAXSTACK) {
  25594. _Pypegen_stack_overflow(p);
  25595. }
  25596. if (p->error_indicator) {
  25597. p->level--;
  25598. return NULL;
  25599. }
  25600. void * _res = NULL;
  25601. int _mark = p->mark;
  25602. { // yield_expr
  25603. if (p->error_indicator) {
  25604. p->level--;
  25605. return NULL;
  25606. }
  25607. D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  25608. expr_ty yield_expr_var;
  25609. if (
  25610. (yield_expr_var = yield_expr_rule(p)) // yield_expr
  25611. )
  25612. {
  25613. D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  25614. _res = yield_expr_var;
  25615. goto done;
  25616. }
  25617. p->mark = _mark;
  25618. D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
  25619. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
  25620. }
  25621. { // star_expressions
  25622. if (p->error_indicator) {
  25623. p->level--;
  25624. return NULL;
  25625. }
  25626. D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  25627. expr_ty star_expressions_var;
  25628. if (
  25629. (star_expressions_var = star_expressions_rule(p)) // star_expressions
  25630. )
  25631. {
  25632. D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  25633. _res = star_expressions_var;
  25634. goto done;
  25635. }
  25636. p->mark = _mark;
  25637. D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
  25638. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
  25639. }
  25640. _res = NULL;
  25641. done:
  25642. p->level--;
  25643. return _res;
  25644. }
  25645. // _tmp_16: yield_expr | star_expressions
  25646. static void *
  25647. _tmp_16_rule(Parser *p)
  25648. {
  25649. if (p->level++ == MAXSTACK) {
  25650. _Pypegen_stack_overflow(p);
  25651. }
  25652. if (p->error_indicator) {
  25653. p->level--;
  25654. return NULL;
  25655. }
  25656. void * _res = NULL;
  25657. int _mark = p->mark;
  25658. { // yield_expr
  25659. if (p->error_indicator) {
  25660. p->level--;
  25661. return NULL;
  25662. }
  25663. D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  25664. expr_ty yield_expr_var;
  25665. if (
  25666. (yield_expr_var = yield_expr_rule(p)) // yield_expr
  25667. )
  25668. {
  25669. D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  25670. _res = yield_expr_var;
  25671. goto done;
  25672. }
  25673. p->mark = _mark;
  25674. D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
  25675. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
  25676. }
  25677. { // star_expressions
  25678. if (p->error_indicator) {
  25679. p->level--;
  25680. return NULL;
  25681. }
  25682. D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  25683. expr_ty star_expressions_var;
  25684. if (
  25685. (star_expressions_var = star_expressions_rule(p)) // star_expressions
  25686. )
  25687. {
  25688. D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  25689. _res = star_expressions_var;
  25690. goto done;
  25691. }
  25692. p->mark = _mark;
  25693. D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
  25694. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
  25695. }
  25696. _res = NULL;
  25697. done:
  25698. p->level--;
  25699. return _res;
  25700. }
  25701. // _tmp_17: 'from' expression
  25702. static void *
  25703. _tmp_17_rule(Parser *p)
  25704. {
  25705. if (p->level++ == MAXSTACK) {
  25706. _Pypegen_stack_overflow(p);
  25707. }
  25708. if (p->error_indicator) {
  25709. p->level--;
  25710. return NULL;
  25711. }
  25712. void * _res = NULL;
  25713. int _mark = p->mark;
  25714. { // 'from' expression
  25715. if (p->error_indicator) {
  25716. p->level--;
  25717. return NULL;
  25718. }
  25719. D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression"));
  25720. Token * _keyword;
  25721. expr_ty z;
  25722. if (
  25723. (_keyword = _PyPegen_expect_token(p, 608)) // token='from'
  25724. &&
  25725. (z = expression_rule(p)) // expression
  25726. )
  25727. {
  25728. D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression"));
  25729. _res = z;
  25730. if (_res == NULL && PyErr_Occurred()) {
  25731. p->error_indicator = 1;
  25732. p->level--;
  25733. return NULL;
  25734. }
  25735. goto done;
  25736. }
  25737. p->mark = _mark;
  25738. D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
  25739. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression"));
  25740. }
  25741. _res = NULL;
  25742. done:
  25743. p->level--;
  25744. return _res;
  25745. }
  25746. // _loop0_19: ',' NAME
  25747. static asdl_seq *
  25748. _loop0_19_rule(Parser *p)
  25749. {
  25750. if (p->level++ == MAXSTACK) {
  25751. _Pypegen_stack_overflow(p);
  25752. }
  25753. if (p->error_indicator) {
  25754. p->level--;
  25755. return NULL;
  25756. }
  25757. void *_res = NULL;
  25758. int _mark = p->mark;
  25759. void **_children = PyMem_Malloc(sizeof(void *));
  25760. if (!_children) {
  25761. p->error_indicator = 1;
  25762. PyErr_NoMemory();
  25763. p->level--;
  25764. return NULL;
  25765. }
  25766. Py_ssize_t _children_capacity = 1;
  25767. Py_ssize_t _n = 0;
  25768. { // ',' NAME
  25769. if (p->error_indicator) {
  25770. p->level--;
  25771. return NULL;
  25772. }
  25773. D(fprintf(stderr, "%*c> _loop0_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
  25774. Token * _literal;
  25775. expr_ty elem;
  25776. while (
  25777. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  25778. &&
  25779. (elem = _PyPegen_name_token(p)) // NAME
  25780. )
  25781. {
  25782. _res = elem;
  25783. if (_res == NULL && PyErr_Occurred()) {
  25784. p->error_indicator = 1;
  25785. PyMem_Free(_children);
  25786. p->level--;
  25787. return NULL;
  25788. }
  25789. if (_n == _children_capacity) {
  25790. _children_capacity *= 2;
  25791. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  25792. if (!_new_children) {
  25793. PyMem_Free(_children);
  25794. p->error_indicator = 1;
  25795. PyErr_NoMemory();
  25796. p->level--;
  25797. return NULL;
  25798. }
  25799. _children = _new_children;
  25800. }
  25801. _children[_n++] = _res;
  25802. _mark = p->mark;
  25803. }
  25804. p->mark = _mark;
  25805. D(fprintf(stderr, "%*c%s _loop0_19[%d-%d]: %s failed!\n", p->level, ' ',
  25806. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
  25807. }
  25808. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  25809. if (!_seq) {
  25810. PyMem_Free(_children);
  25811. p->error_indicator = 1;
  25812. PyErr_NoMemory();
  25813. p->level--;
  25814. return NULL;
  25815. }
  25816. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  25817. PyMem_Free(_children);
  25818. p->level--;
  25819. return _seq;
  25820. }
  25821. // _gather_18: NAME _loop0_19
  25822. static asdl_seq *
  25823. _gather_18_rule(Parser *p)
  25824. {
  25825. if (p->level++ == MAXSTACK) {
  25826. _Pypegen_stack_overflow(p);
  25827. }
  25828. if (p->error_indicator) {
  25829. p->level--;
  25830. return NULL;
  25831. }
  25832. asdl_seq * _res = NULL;
  25833. int _mark = p->mark;
  25834. { // NAME _loop0_19
  25835. if (p->error_indicator) {
  25836. p->level--;
  25837. return NULL;
  25838. }
  25839. D(fprintf(stderr, "%*c> _gather_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_19"));
  25840. expr_ty elem;
  25841. asdl_seq * seq;
  25842. if (
  25843. (elem = _PyPegen_name_token(p)) // NAME
  25844. &&
  25845. (seq = _loop0_19_rule(p)) // _loop0_19
  25846. )
  25847. {
  25848. D(fprintf(stderr, "%*c+ _gather_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_19"));
  25849. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  25850. goto done;
  25851. }
  25852. p->mark = _mark;
  25853. D(fprintf(stderr, "%*c%s _gather_18[%d-%d]: %s failed!\n", p->level, ' ',
  25854. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_19"));
  25855. }
  25856. _res = NULL;
  25857. done:
  25858. p->level--;
  25859. return _res;
  25860. }
  25861. // _loop0_21: ',' NAME
  25862. static asdl_seq *
  25863. _loop0_21_rule(Parser *p)
  25864. {
  25865. if (p->level++ == MAXSTACK) {
  25866. _Pypegen_stack_overflow(p);
  25867. }
  25868. if (p->error_indicator) {
  25869. p->level--;
  25870. return NULL;
  25871. }
  25872. void *_res = NULL;
  25873. int _mark = p->mark;
  25874. void **_children = PyMem_Malloc(sizeof(void *));
  25875. if (!_children) {
  25876. p->error_indicator = 1;
  25877. PyErr_NoMemory();
  25878. p->level--;
  25879. return NULL;
  25880. }
  25881. Py_ssize_t _children_capacity = 1;
  25882. Py_ssize_t _n = 0;
  25883. { // ',' NAME
  25884. if (p->error_indicator) {
  25885. p->level--;
  25886. return NULL;
  25887. }
  25888. D(fprintf(stderr, "%*c> _loop0_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
  25889. Token * _literal;
  25890. expr_ty elem;
  25891. while (
  25892. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  25893. &&
  25894. (elem = _PyPegen_name_token(p)) // NAME
  25895. )
  25896. {
  25897. _res = elem;
  25898. if (_res == NULL && PyErr_Occurred()) {
  25899. p->error_indicator = 1;
  25900. PyMem_Free(_children);
  25901. p->level--;
  25902. return NULL;
  25903. }
  25904. if (_n == _children_capacity) {
  25905. _children_capacity *= 2;
  25906. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  25907. if (!_new_children) {
  25908. PyMem_Free(_children);
  25909. p->error_indicator = 1;
  25910. PyErr_NoMemory();
  25911. p->level--;
  25912. return NULL;
  25913. }
  25914. _children = _new_children;
  25915. }
  25916. _children[_n++] = _res;
  25917. _mark = p->mark;
  25918. }
  25919. p->mark = _mark;
  25920. D(fprintf(stderr, "%*c%s _loop0_21[%d-%d]: %s failed!\n", p->level, ' ',
  25921. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
  25922. }
  25923. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  25924. if (!_seq) {
  25925. PyMem_Free(_children);
  25926. p->error_indicator = 1;
  25927. PyErr_NoMemory();
  25928. p->level--;
  25929. return NULL;
  25930. }
  25931. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  25932. PyMem_Free(_children);
  25933. p->level--;
  25934. return _seq;
  25935. }
  25936. // _gather_20: NAME _loop0_21
  25937. static asdl_seq *
  25938. _gather_20_rule(Parser *p)
  25939. {
  25940. if (p->level++ == MAXSTACK) {
  25941. _Pypegen_stack_overflow(p);
  25942. }
  25943. if (p->error_indicator) {
  25944. p->level--;
  25945. return NULL;
  25946. }
  25947. asdl_seq * _res = NULL;
  25948. int _mark = p->mark;
  25949. { // NAME _loop0_21
  25950. if (p->error_indicator) {
  25951. p->level--;
  25952. return NULL;
  25953. }
  25954. D(fprintf(stderr, "%*c> _gather_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_21"));
  25955. expr_ty elem;
  25956. asdl_seq * seq;
  25957. if (
  25958. (elem = _PyPegen_name_token(p)) // NAME
  25959. &&
  25960. (seq = _loop0_21_rule(p)) // _loop0_21
  25961. )
  25962. {
  25963. D(fprintf(stderr, "%*c+ _gather_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_21"));
  25964. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  25965. goto done;
  25966. }
  25967. p->mark = _mark;
  25968. D(fprintf(stderr, "%*c%s _gather_20[%d-%d]: %s failed!\n", p->level, ' ',
  25969. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_21"));
  25970. }
  25971. _res = NULL;
  25972. done:
  25973. p->level--;
  25974. return _res;
  25975. }
  25976. // _tmp_22: ';' | NEWLINE
  25977. static void *
  25978. _tmp_22_rule(Parser *p)
  25979. {
  25980. if (p->level++ == MAXSTACK) {
  25981. _Pypegen_stack_overflow(p);
  25982. }
  25983. if (p->error_indicator) {
  25984. p->level--;
  25985. return NULL;
  25986. }
  25987. void * _res = NULL;
  25988. int _mark = p->mark;
  25989. { // ';'
  25990. if (p->error_indicator) {
  25991. p->level--;
  25992. return NULL;
  25993. }
  25994. D(fprintf(stderr, "%*c> _tmp_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'"));
  25995. Token * _literal;
  25996. if (
  25997. (_literal = _PyPegen_expect_token(p, 13)) // token=';'
  25998. )
  25999. {
  26000. D(fprintf(stderr, "%*c+ _tmp_22[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'"));
  26001. _res = _literal;
  26002. goto done;
  26003. }
  26004. p->mark = _mark;
  26005. D(fprintf(stderr, "%*c%s _tmp_22[%d-%d]: %s failed!\n", p->level, ' ',
  26006. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'"));
  26007. }
  26008. { // NEWLINE
  26009. if (p->error_indicator) {
  26010. p->level--;
  26011. return NULL;
  26012. }
  26013. D(fprintf(stderr, "%*c> _tmp_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
  26014. Token * newline_var;
  26015. if (
  26016. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  26017. )
  26018. {
  26019. D(fprintf(stderr, "%*c+ _tmp_22[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
  26020. _res = newline_var;
  26021. goto done;
  26022. }
  26023. p->mark = _mark;
  26024. D(fprintf(stderr, "%*c%s _tmp_22[%d-%d]: %s failed!\n", p->level, ' ',
  26025. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
  26026. }
  26027. _res = NULL;
  26028. done:
  26029. p->level--;
  26030. return _res;
  26031. }
  26032. // _tmp_23: ',' expression
  26033. static void *
  26034. _tmp_23_rule(Parser *p)
  26035. {
  26036. if (p->level++ == MAXSTACK) {
  26037. _Pypegen_stack_overflow(p);
  26038. }
  26039. if (p->error_indicator) {
  26040. p->level--;
  26041. return NULL;
  26042. }
  26043. void * _res = NULL;
  26044. int _mark = p->mark;
  26045. { // ',' expression
  26046. if (p->error_indicator) {
  26047. p->level--;
  26048. return NULL;
  26049. }
  26050. D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
  26051. Token * _literal;
  26052. expr_ty z;
  26053. if (
  26054. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  26055. &&
  26056. (z = expression_rule(p)) // expression
  26057. )
  26058. {
  26059. D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
  26060. _res = z;
  26061. if (_res == NULL && PyErr_Occurred()) {
  26062. p->error_indicator = 1;
  26063. p->level--;
  26064. return NULL;
  26065. }
  26066. goto done;
  26067. }
  26068. p->mark = _mark;
  26069. D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
  26070. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
  26071. }
  26072. _res = NULL;
  26073. done:
  26074. p->level--;
  26075. return _res;
  26076. }
  26077. // _loop0_24: ('.' | '...')
  26078. static asdl_seq *
  26079. _loop0_24_rule(Parser *p)
  26080. {
  26081. if (p->level++ == MAXSTACK) {
  26082. _Pypegen_stack_overflow(p);
  26083. }
  26084. if (p->error_indicator) {
  26085. p->level--;
  26086. return NULL;
  26087. }
  26088. void *_res = NULL;
  26089. int _mark = p->mark;
  26090. void **_children = PyMem_Malloc(sizeof(void *));
  26091. if (!_children) {
  26092. p->error_indicator = 1;
  26093. PyErr_NoMemory();
  26094. p->level--;
  26095. return NULL;
  26096. }
  26097. Py_ssize_t _children_capacity = 1;
  26098. Py_ssize_t _n = 0;
  26099. { // ('.' | '...')
  26100. if (p->error_indicator) {
  26101. p->level--;
  26102. return NULL;
  26103. }
  26104. D(fprintf(stderr, "%*c> _loop0_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
  26105. void *_tmp_251_var;
  26106. while (
  26107. (_tmp_251_var = _tmp_251_rule(p)) // '.' | '...'
  26108. )
  26109. {
  26110. _res = _tmp_251_var;
  26111. if (_n == _children_capacity) {
  26112. _children_capacity *= 2;
  26113. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  26114. if (!_new_children) {
  26115. PyMem_Free(_children);
  26116. p->error_indicator = 1;
  26117. PyErr_NoMemory();
  26118. p->level--;
  26119. return NULL;
  26120. }
  26121. _children = _new_children;
  26122. }
  26123. _children[_n++] = _res;
  26124. _mark = p->mark;
  26125. }
  26126. p->mark = _mark;
  26127. D(fprintf(stderr, "%*c%s _loop0_24[%d-%d]: %s failed!\n", p->level, ' ',
  26128. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
  26129. }
  26130. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  26131. if (!_seq) {
  26132. PyMem_Free(_children);
  26133. p->error_indicator = 1;
  26134. PyErr_NoMemory();
  26135. p->level--;
  26136. return NULL;
  26137. }
  26138. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  26139. PyMem_Free(_children);
  26140. p->level--;
  26141. return _seq;
  26142. }
  26143. // _loop1_25: ('.' | '...')
  26144. static asdl_seq *
  26145. _loop1_25_rule(Parser *p)
  26146. {
  26147. if (p->level++ == MAXSTACK) {
  26148. _Pypegen_stack_overflow(p);
  26149. }
  26150. if (p->error_indicator) {
  26151. p->level--;
  26152. return NULL;
  26153. }
  26154. void *_res = NULL;
  26155. int _mark = p->mark;
  26156. void **_children = PyMem_Malloc(sizeof(void *));
  26157. if (!_children) {
  26158. p->error_indicator = 1;
  26159. PyErr_NoMemory();
  26160. p->level--;
  26161. return NULL;
  26162. }
  26163. Py_ssize_t _children_capacity = 1;
  26164. Py_ssize_t _n = 0;
  26165. { // ('.' | '...')
  26166. if (p->error_indicator) {
  26167. p->level--;
  26168. return NULL;
  26169. }
  26170. D(fprintf(stderr, "%*c> _loop1_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
  26171. void *_tmp_252_var;
  26172. while (
  26173. (_tmp_252_var = _tmp_252_rule(p)) // '.' | '...'
  26174. )
  26175. {
  26176. _res = _tmp_252_var;
  26177. if (_n == _children_capacity) {
  26178. _children_capacity *= 2;
  26179. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  26180. if (!_new_children) {
  26181. PyMem_Free(_children);
  26182. p->error_indicator = 1;
  26183. PyErr_NoMemory();
  26184. p->level--;
  26185. return NULL;
  26186. }
  26187. _children = _new_children;
  26188. }
  26189. _children[_n++] = _res;
  26190. _mark = p->mark;
  26191. }
  26192. p->mark = _mark;
  26193. D(fprintf(stderr, "%*c%s _loop1_25[%d-%d]: %s failed!\n", p->level, ' ',
  26194. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
  26195. }
  26196. if (_n == 0 || p->error_indicator) {
  26197. PyMem_Free(_children);
  26198. p->level--;
  26199. return NULL;
  26200. }
  26201. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  26202. if (!_seq) {
  26203. PyMem_Free(_children);
  26204. p->error_indicator = 1;
  26205. PyErr_NoMemory();
  26206. p->level--;
  26207. return NULL;
  26208. }
  26209. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  26210. PyMem_Free(_children);
  26211. p->level--;
  26212. return _seq;
  26213. }
  26214. // _loop0_27: ',' import_from_as_name
  26215. static asdl_seq *
  26216. _loop0_27_rule(Parser *p)
  26217. {
  26218. if (p->level++ == MAXSTACK) {
  26219. _Pypegen_stack_overflow(p);
  26220. }
  26221. if (p->error_indicator) {
  26222. p->level--;
  26223. return NULL;
  26224. }
  26225. void *_res = NULL;
  26226. int _mark = p->mark;
  26227. void **_children = PyMem_Malloc(sizeof(void *));
  26228. if (!_children) {
  26229. p->error_indicator = 1;
  26230. PyErr_NoMemory();
  26231. p->level--;
  26232. return NULL;
  26233. }
  26234. Py_ssize_t _children_capacity = 1;
  26235. Py_ssize_t _n = 0;
  26236. { // ',' import_from_as_name
  26237. if (p->error_indicator) {
  26238. p->level--;
  26239. return NULL;
  26240. }
  26241. D(fprintf(stderr, "%*c> _loop0_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' import_from_as_name"));
  26242. Token * _literal;
  26243. alias_ty elem;
  26244. while (
  26245. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  26246. &&
  26247. (elem = import_from_as_name_rule(p)) // import_from_as_name
  26248. )
  26249. {
  26250. _res = elem;
  26251. if (_res == NULL && PyErr_Occurred()) {
  26252. p->error_indicator = 1;
  26253. PyMem_Free(_children);
  26254. p->level--;
  26255. return NULL;
  26256. }
  26257. if (_n == _children_capacity) {
  26258. _children_capacity *= 2;
  26259. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  26260. if (!_new_children) {
  26261. PyMem_Free(_children);
  26262. p->error_indicator = 1;
  26263. PyErr_NoMemory();
  26264. p->level--;
  26265. return NULL;
  26266. }
  26267. _children = _new_children;
  26268. }
  26269. _children[_n++] = _res;
  26270. _mark = p->mark;
  26271. }
  26272. p->mark = _mark;
  26273. D(fprintf(stderr, "%*c%s _loop0_27[%d-%d]: %s failed!\n", p->level, ' ',
  26274. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name"));
  26275. }
  26276. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  26277. if (!_seq) {
  26278. PyMem_Free(_children);
  26279. p->error_indicator = 1;
  26280. PyErr_NoMemory();
  26281. p->level--;
  26282. return NULL;
  26283. }
  26284. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  26285. PyMem_Free(_children);
  26286. p->level--;
  26287. return _seq;
  26288. }
  26289. // _gather_26: import_from_as_name _loop0_27
  26290. static asdl_seq *
  26291. _gather_26_rule(Parser *p)
  26292. {
  26293. if (p->level++ == MAXSTACK) {
  26294. _Pypegen_stack_overflow(p);
  26295. }
  26296. if (p->error_indicator) {
  26297. p->level--;
  26298. return NULL;
  26299. }
  26300. asdl_seq * _res = NULL;
  26301. int _mark = p->mark;
  26302. { // import_from_as_name _loop0_27
  26303. if (p->error_indicator) {
  26304. p->level--;
  26305. return NULL;
  26306. }
  26307. D(fprintf(stderr, "%*c> _gather_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_27"));
  26308. alias_ty elem;
  26309. asdl_seq * seq;
  26310. if (
  26311. (elem = import_from_as_name_rule(p)) // import_from_as_name
  26312. &&
  26313. (seq = _loop0_27_rule(p)) // _loop0_27
  26314. )
  26315. {
  26316. D(fprintf(stderr, "%*c+ _gather_26[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_27"));
  26317. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  26318. goto done;
  26319. }
  26320. p->mark = _mark;
  26321. D(fprintf(stderr, "%*c%s _gather_26[%d-%d]: %s failed!\n", p->level, ' ',
  26322. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_27"));
  26323. }
  26324. _res = NULL;
  26325. done:
  26326. p->level--;
  26327. return _res;
  26328. }
  26329. // _tmp_28: 'as' NAME
  26330. static void *
  26331. _tmp_28_rule(Parser *p)
  26332. {
  26333. if (p->level++ == MAXSTACK) {
  26334. _Pypegen_stack_overflow(p);
  26335. }
  26336. if (p->error_indicator) {
  26337. p->level--;
  26338. return NULL;
  26339. }
  26340. void * _res = NULL;
  26341. int _mark = p->mark;
  26342. { // 'as' NAME
  26343. if (p->error_indicator) {
  26344. p->level--;
  26345. return NULL;
  26346. }
  26347. D(fprintf(stderr, "%*c> _tmp_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  26348. Token * _keyword;
  26349. expr_ty z;
  26350. if (
  26351. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  26352. &&
  26353. (z = _PyPegen_name_token(p)) // NAME
  26354. )
  26355. {
  26356. D(fprintf(stderr, "%*c+ _tmp_28[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  26357. _res = z;
  26358. if (_res == NULL && PyErr_Occurred()) {
  26359. p->error_indicator = 1;
  26360. p->level--;
  26361. return NULL;
  26362. }
  26363. goto done;
  26364. }
  26365. p->mark = _mark;
  26366. D(fprintf(stderr, "%*c%s _tmp_28[%d-%d]: %s failed!\n", p->level, ' ',
  26367. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
  26368. }
  26369. _res = NULL;
  26370. done:
  26371. p->level--;
  26372. return _res;
  26373. }
  26374. // _loop0_30: ',' dotted_as_name
  26375. static asdl_seq *
  26376. _loop0_30_rule(Parser *p)
  26377. {
  26378. if (p->level++ == MAXSTACK) {
  26379. _Pypegen_stack_overflow(p);
  26380. }
  26381. if (p->error_indicator) {
  26382. p->level--;
  26383. return NULL;
  26384. }
  26385. void *_res = NULL;
  26386. int _mark = p->mark;
  26387. void **_children = PyMem_Malloc(sizeof(void *));
  26388. if (!_children) {
  26389. p->error_indicator = 1;
  26390. PyErr_NoMemory();
  26391. p->level--;
  26392. return NULL;
  26393. }
  26394. Py_ssize_t _children_capacity = 1;
  26395. Py_ssize_t _n = 0;
  26396. { // ',' dotted_as_name
  26397. if (p->error_indicator) {
  26398. p->level--;
  26399. return NULL;
  26400. }
  26401. D(fprintf(stderr, "%*c> _loop0_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' dotted_as_name"));
  26402. Token * _literal;
  26403. alias_ty elem;
  26404. while (
  26405. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  26406. &&
  26407. (elem = dotted_as_name_rule(p)) // dotted_as_name
  26408. )
  26409. {
  26410. _res = elem;
  26411. if (_res == NULL && PyErr_Occurred()) {
  26412. p->error_indicator = 1;
  26413. PyMem_Free(_children);
  26414. p->level--;
  26415. return NULL;
  26416. }
  26417. if (_n == _children_capacity) {
  26418. _children_capacity *= 2;
  26419. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  26420. if (!_new_children) {
  26421. PyMem_Free(_children);
  26422. p->error_indicator = 1;
  26423. PyErr_NoMemory();
  26424. p->level--;
  26425. return NULL;
  26426. }
  26427. _children = _new_children;
  26428. }
  26429. _children[_n++] = _res;
  26430. _mark = p->mark;
  26431. }
  26432. p->mark = _mark;
  26433. D(fprintf(stderr, "%*c%s _loop0_30[%d-%d]: %s failed!\n", p->level, ' ',
  26434. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name"));
  26435. }
  26436. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  26437. if (!_seq) {
  26438. PyMem_Free(_children);
  26439. p->error_indicator = 1;
  26440. PyErr_NoMemory();
  26441. p->level--;
  26442. return NULL;
  26443. }
  26444. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  26445. PyMem_Free(_children);
  26446. p->level--;
  26447. return _seq;
  26448. }
  26449. // _gather_29: dotted_as_name _loop0_30
  26450. static asdl_seq *
  26451. _gather_29_rule(Parser *p)
  26452. {
  26453. if (p->level++ == MAXSTACK) {
  26454. _Pypegen_stack_overflow(p);
  26455. }
  26456. if (p->error_indicator) {
  26457. p->level--;
  26458. return NULL;
  26459. }
  26460. asdl_seq * _res = NULL;
  26461. int _mark = p->mark;
  26462. { // dotted_as_name _loop0_30
  26463. if (p->error_indicator) {
  26464. p->level--;
  26465. return NULL;
  26466. }
  26467. D(fprintf(stderr, "%*c> _gather_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_30"));
  26468. alias_ty elem;
  26469. asdl_seq * seq;
  26470. if (
  26471. (elem = dotted_as_name_rule(p)) // dotted_as_name
  26472. &&
  26473. (seq = _loop0_30_rule(p)) // _loop0_30
  26474. )
  26475. {
  26476. D(fprintf(stderr, "%*c+ _gather_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_30"));
  26477. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  26478. goto done;
  26479. }
  26480. p->mark = _mark;
  26481. D(fprintf(stderr, "%*c%s _gather_29[%d-%d]: %s failed!\n", p->level, ' ',
  26482. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_30"));
  26483. }
  26484. _res = NULL;
  26485. done:
  26486. p->level--;
  26487. return _res;
  26488. }
  26489. // _tmp_31: 'as' NAME
  26490. static void *
  26491. _tmp_31_rule(Parser *p)
  26492. {
  26493. if (p->level++ == MAXSTACK) {
  26494. _Pypegen_stack_overflow(p);
  26495. }
  26496. if (p->error_indicator) {
  26497. p->level--;
  26498. return NULL;
  26499. }
  26500. void * _res = NULL;
  26501. int _mark = p->mark;
  26502. { // 'as' NAME
  26503. if (p->error_indicator) {
  26504. p->level--;
  26505. return NULL;
  26506. }
  26507. D(fprintf(stderr, "%*c> _tmp_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  26508. Token * _keyword;
  26509. expr_ty z;
  26510. if (
  26511. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  26512. &&
  26513. (z = _PyPegen_name_token(p)) // NAME
  26514. )
  26515. {
  26516. D(fprintf(stderr, "%*c+ _tmp_31[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  26517. _res = z;
  26518. if (_res == NULL && PyErr_Occurred()) {
  26519. p->error_indicator = 1;
  26520. p->level--;
  26521. return NULL;
  26522. }
  26523. goto done;
  26524. }
  26525. p->mark = _mark;
  26526. D(fprintf(stderr, "%*c%s _tmp_31[%d-%d]: %s failed!\n", p->level, ' ',
  26527. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
  26528. }
  26529. _res = NULL;
  26530. done:
  26531. p->level--;
  26532. return _res;
  26533. }
  26534. // _loop1_32: ('@' named_expression NEWLINE)
  26535. static asdl_seq *
  26536. _loop1_32_rule(Parser *p)
  26537. {
  26538. if (p->level++ == MAXSTACK) {
  26539. _Pypegen_stack_overflow(p);
  26540. }
  26541. if (p->error_indicator) {
  26542. p->level--;
  26543. return NULL;
  26544. }
  26545. void *_res = NULL;
  26546. int _mark = p->mark;
  26547. void **_children = PyMem_Malloc(sizeof(void *));
  26548. if (!_children) {
  26549. p->error_indicator = 1;
  26550. PyErr_NoMemory();
  26551. p->level--;
  26552. return NULL;
  26553. }
  26554. Py_ssize_t _children_capacity = 1;
  26555. Py_ssize_t _n = 0;
  26556. { // ('@' named_expression NEWLINE)
  26557. if (p->error_indicator) {
  26558. p->level--;
  26559. return NULL;
  26560. }
  26561. D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)"));
  26562. void *_tmp_253_var;
  26563. while (
  26564. (_tmp_253_var = _tmp_253_rule(p)) // '@' named_expression NEWLINE
  26565. )
  26566. {
  26567. _res = _tmp_253_var;
  26568. if (_n == _children_capacity) {
  26569. _children_capacity *= 2;
  26570. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  26571. if (!_new_children) {
  26572. PyMem_Free(_children);
  26573. p->error_indicator = 1;
  26574. PyErr_NoMemory();
  26575. p->level--;
  26576. return NULL;
  26577. }
  26578. _children = _new_children;
  26579. }
  26580. _children[_n++] = _res;
  26581. _mark = p->mark;
  26582. }
  26583. p->mark = _mark;
  26584. D(fprintf(stderr, "%*c%s _loop1_32[%d-%d]: %s failed!\n", p->level, ' ',
  26585. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)"));
  26586. }
  26587. if (_n == 0 || p->error_indicator) {
  26588. PyMem_Free(_children);
  26589. p->level--;
  26590. return NULL;
  26591. }
  26592. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  26593. if (!_seq) {
  26594. PyMem_Free(_children);
  26595. p->error_indicator = 1;
  26596. PyErr_NoMemory();
  26597. p->level--;
  26598. return NULL;
  26599. }
  26600. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  26601. PyMem_Free(_children);
  26602. p->level--;
  26603. return _seq;
  26604. }
  26605. // _tmp_33: '(' arguments? ')'
  26606. static void *
  26607. _tmp_33_rule(Parser *p)
  26608. {
  26609. if (p->level++ == MAXSTACK) {
  26610. _Pypegen_stack_overflow(p);
  26611. }
  26612. if (p->error_indicator) {
  26613. p->level--;
  26614. return NULL;
  26615. }
  26616. void * _res = NULL;
  26617. int _mark = p->mark;
  26618. { // '(' arguments? ')'
  26619. if (p->error_indicator) {
  26620. p->level--;
  26621. return NULL;
  26622. }
  26623. D(fprintf(stderr, "%*c> _tmp_33[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
  26624. Token * _literal;
  26625. Token * _literal_1;
  26626. void *z;
  26627. if (
  26628. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  26629. &&
  26630. (z = arguments_rule(p), !p->error_indicator) // arguments?
  26631. &&
  26632. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  26633. )
  26634. {
  26635. D(fprintf(stderr, "%*c+ _tmp_33[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
  26636. _res = z;
  26637. if (_res == NULL && PyErr_Occurred()) {
  26638. p->error_indicator = 1;
  26639. p->level--;
  26640. return NULL;
  26641. }
  26642. goto done;
  26643. }
  26644. p->mark = _mark;
  26645. D(fprintf(stderr, "%*c%s _tmp_33[%d-%d]: %s failed!\n", p->level, ' ',
  26646. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'"));
  26647. }
  26648. _res = NULL;
  26649. done:
  26650. p->level--;
  26651. return _res;
  26652. }
  26653. // _tmp_34: '->' expression
  26654. static void *
  26655. _tmp_34_rule(Parser *p)
  26656. {
  26657. if (p->level++ == MAXSTACK) {
  26658. _Pypegen_stack_overflow(p);
  26659. }
  26660. if (p->error_indicator) {
  26661. p->level--;
  26662. return NULL;
  26663. }
  26664. void * _res = NULL;
  26665. int _mark = p->mark;
  26666. { // '->' expression
  26667. if (p->error_indicator) {
  26668. p->level--;
  26669. return NULL;
  26670. }
  26671. D(fprintf(stderr, "%*c> _tmp_34[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
  26672. Token * _literal;
  26673. expr_ty z;
  26674. if (
  26675. (_literal = _PyPegen_expect_token(p, 51)) // token='->'
  26676. &&
  26677. (z = expression_rule(p)) // expression
  26678. )
  26679. {
  26680. D(fprintf(stderr, "%*c+ _tmp_34[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
  26681. _res = z;
  26682. if (_res == NULL && PyErr_Occurred()) {
  26683. p->error_indicator = 1;
  26684. p->level--;
  26685. return NULL;
  26686. }
  26687. goto done;
  26688. }
  26689. p->mark = _mark;
  26690. D(fprintf(stderr, "%*c%s _tmp_34[%d-%d]: %s failed!\n", p->level, ' ',
  26691. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
  26692. }
  26693. _res = NULL;
  26694. done:
  26695. p->level--;
  26696. return _res;
  26697. }
  26698. // _tmp_35: '->' expression
  26699. static void *
  26700. _tmp_35_rule(Parser *p)
  26701. {
  26702. if (p->level++ == MAXSTACK) {
  26703. _Pypegen_stack_overflow(p);
  26704. }
  26705. if (p->error_indicator) {
  26706. p->level--;
  26707. return NULL;
  26708. }
  26709. void * _res = NULL;
  26710. int _mark = p->mark;
  26711. { // '->' expression
  26712. if (p->error_indicator) {
  26713. p->level--;
  26714. return NULL;
  26715. }
  26716. D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
  26717. Token * _literal;
  26718. expr_ty z;
  26719. if (
  26720. (_literal = _PyPegen_expect_token(p, 51)) // token='->'
  26721. &&
  26722. (z = expression_rule(p)) // expression
  26723. )
  26724. {
  26725. D(fprintf(stderr, "%*c+ _tmp_35[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
  26726. _res = z;
  26727. if (_res == NULL && PyErr_Occurred()) {
  26728. p->error_indicator = 1;
  26729. p->level--;
  26730. return NULL;
  26731. }
  26732. goto done;
  26733. }
  26734. p->mark = _mark;
  26735. D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n", p->level, ' ',
  26736. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
  26737. }
  26738. _res = NULL;
  26739. done:
  26740. p->level--;
  26741. return _res;
  26742. }
  26743. // _loop0_36: param_no_default
  26744. static asdl_seq *
  26745. _loop0_36_rule(Parser *p)
  26746. {
  26747. if (p->level++ == MAXSTACK) {
  26748. _Pypegen_stack_overflow(p);
  26749. }
  26750. if (p->error_indicator) {
  26751. p->level--;
  26752. return NULL;
  26753. }
  26754. void *_res = NULL;
  26755. int _mark = p->mark;
  26756. void **_children = PyMem_Malloc(sizeof(void *));
  26757. if (!_children) {
  26758. p->error_indicator = 1;
  26759. PyErr_NoMemory();
  26760. p->level--;
  26761. return NULL;
  26762. }
  26763. Py_ssize_t _children_capacity = 1;
  26764. Py_ssize_t _n = 0;
  26765. { // param_no_default
  26766. if (p->error_indicator) {
  26767. p->level--;
  26768. return NULL;
  26769. }
  26770. D(fprintf(stderr, "%*c> _loop0_36[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
  26771. arg_ty param_no_default_var;
  26772. while (
  26773. (param_no_default_var = param_no_default_rule(p)) // param_no_default
  26774. )
  26775. {
  26776. _res = param_no_default_var;
  26777. if (_n == _children_capacity) {
  26778. _children_capacity *= 2;
  26779. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  26780. if (!_new_children) {
  26781. PyMem_Free(_children);
  26782. p->error_indicator = 1;
  26783. PyErr_NoMemory();
  26784. p->level--;
  26785. return NULL;
  26786. }
  26787. _children = _new_children;
  26788. }
  26789. _children[_n++] = _res;
  26790. _mark = p->mark;
  26791. }
  26792. p->mark = _mark;
  26793. D(fprintf(stderr, "%*c%s _loop0_36[%d-%d]: %s failed!\n", p->level, ' ',
  26794. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
  26795. }
  26796. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  26797. if (!_seq) {
  26798. PyMem_Free(_children);
  26799. p->error_indicator = 1;
  26800. PyErr_NoMemory();
  26801. p->level--;
  26802. return NULL;
  26803. }
  26804. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  26805. PyMem_Free(_children);
  26806. p->level--;
  26807. return _seq;
  26808. }
  26809. // _loop0_37: param_with_default
  26810. static asdl_seq *
  26811. _loop0_37_rule(Parser *p)
  26812. {
  26813. if (p->level++ == MAXSTACK) {
  26814. _Pypegen_stack_overflow(p);
  26815. }
  26816. if (p->error_indicator) {
  26817. p->level--;
  26818. return NULL;
  26819. }
  26820. void *_res = NULL;
  26821. int _mark = p->mark;
  26822. void **_children = PyMem_Malloc(sizeof(void *));
  26823. if (!_children) {
  26824. p->error_indicator = 1;
  26825. PyErr_NoMemory();
  26826. p->level--;
  26827. return NULL;
  26828. }
  26829. Py_ssize_t _children_capacity = 1;
  26830. Py_ssize_t _n = 0;
  26831. { // param_with_default
  26832. if (p->error_indicator) {
  26833. p->level--;
  26834. return NULL;
  26835. }
  26836. D(fprintf(stderr, "%*c> _loop0_37[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
  26837. NameDefaultPair* param_with_default_var;
  26838. while (
  26839. (param_with_default_var = param_with_default_rule(p)) // param_with_default
  26840. )
  26841. {
  26842. _res = param_with_default_var;
  26843. if (_n == _children_capacity) {
  26844. _children_capacity *= 2;
  26845. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  26846. if (!_new_children) {
  26847. PyMem_Free(_children);
  26848. p->error_indicator = 1;
  26849. PyErr_NoMemory();
  26850. p->level--;
  26851. return NULL;
  26852. }
  26853. _children = _new_children;
  26854. }
  26855. _children[_n++] = _res;
  26856. _mark = p->mark;
  26857. }
  26858. p->mark = _mark;
  26859. D(fprintf(stderr, "%*c%s _loop0_37[%d-%d]: %s failed!\n", p->level, ' ',
  26860. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
  26861. }
  26862. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  26863. if (!_seq) {
  26864. PyMem_Free(_children);
  26865. p->error_indicator = 1;
  26866. PyErr_NoMemory();
  26867. p->level--;
  26868. return NULL;
  26869. }
  26870. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  26871. PyMem_Free(_children);
  26872. p->level--;
  26873. return _seq;
  26874. }
  26875. // _loop0_38: param_with_default
  26876. static asdl_seq *
  26877. _loop0_38_rule(Parser *p)
  26878. {
  26879. if (p->level++ == MAXSTACK) {
  26880. _Pypegen_stack_overflow(p);
  26881. }
  26882. if (p->error_indicator) {
  26883. p->level--;
  26884. return NULL;
  26885. }
  26886. void *_res = NULL;
  26887. int _mark = p->mark;
  26888. void **_children = PyMem_Malloc(sizeof(void *));
  26889. if (!_children) {
  26890. p->error_indicator = 1;
  26891. PyErr_NoMemory();
  26892. p->level--;
  26893. return NULL;
  26894. }
  26895. Py_ssize_t _children_capacity = 1;
  26896. Py_ssize_t _n = 0;
  26897. { // param_with_default
  26898. if (p->error_indicator) {
  26899. p->level--;
  26900. return NULL;
  26901. }
  26902. D(fprintf(stderr, "%*c> _loop0_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
  26903. NameDefaultPair* param_with_default_var;
  26904. while (
  26905. (param_with_default_var = param_with_default_rule(p)) // param_with_default
  26906. )
  26907. {
  26908. _res = param_with_default_var;
  26909. if (_n == _children_capacity) {
  26910. _children_capacity *= 2;
  26911. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  26912. if (!_new_children) {
  26913. PyMem_Free(_children);
  26914. p->error_indicator = 1;
  26915. PyErr_NoMemory();
  26916. p->level--;
  26917. return NULL;
  26918. }
  26919. _children = _new_children;
  26920. }
  26921. _children[_n++] = _res;
  26922. _mark = p->mark;
  26923. }
  26924. p->mark = _mark;
  26925. D(fprintf(stderr, "%*c%s _loop0_38[%d-%d]: %s failed!\n", p->level, ' ',
  26926. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
  26927. }
  26928. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  26929. if (!_seq) {
  26930. PyMem_Free(_children);
  26931. p->error_indicator = 1;
  26932. PyErr_NoMemory();
  26933. p->level--;
  26934. return NULL;
  26935. }
  26936. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  26937. PyMem_Free(_children);
  26938. p->level--;
  26939. return _seq;
  26940. }
  26941. // _loop1_39: param_no_default
  26942. static asdl_seq *
  26943. _loop1_39_rule(Parser *p)
  26944. {
  26945. if (p->level++ == MAXSTACK) {
  26946. _Pypegen_stack_overflow(p);
  26947. }
  26948. if (p->error_indicator) {
  26949. p->level--;
  26950. return NULL;
  26951. }
  26952. void *_res = NULL;
  26953. int _mark = p->mark;
  26954. void **_children = PyMem_Malloc(sizeof(void *));
  26955. if (!_children) {
  26956. p->error_indicator = 1;
  26957. PyErr_NoMemory();
  26958. p->level--;
  26959. return NULL;
  26960. }
  26961. Py_ssize_t _children_capacity = 1;
  26962. Py_ssize_t _n = 0;
  26963. { // param_no_default
  26964. if (p->error_indicator) {
  26965. p->level--;
  26966. return NULL;
  26967. }
  26968. D(fprintf(stderr, "%*c> _loop1_39[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
  26969. arg_ty param_no_default_var;
  26970. while (
  26971. (param_no_default_var = param_no_default_rule(p)) // param_no_default
  26972. )
  26973. {
  26974. _res = param_no_default_var;
  26975. if (_n == _children_capacity) {
  26976. _children_capacity *= 2;
  26977. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  26978. if (!_new_children) {
  26979. PyMem_Free(_children);
  26980. p->error_indicator = 1;
  26981. PyErr_NoMemory();
  26982. p->level--;
  26983. return NULL;
  26984. }
  26985. _children = _new_children;
  26986. }
  26987. _children[_n++] = _res;
  26988. _mark = p->mark;
  26989. }
  26990. p->mark = _mark;
  26991. D(fprintf(stderr, "%*c%s _loop1_39[%d-%d]: %s failed!\n", p->level, ' ',
  26992. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
  26993. }
  26994. if (_n == 0 || p->error_indicator) {
  26995. PyMem_Free(_children);
  26996. p->level--;
  26997. return NULL;
  26998. }
  26999. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  27000. if (!_seq) {
  27001. PyMem_Free(_children);
  27002. p->error_indicator = 1;
  27003. PyErr_NoMemory();
  27004. p->level--;
  27005. return NULL;
  27006. }
  27007. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  27008. PyMem_Free(_children);
  27009. p->level--;
  27010. return _seq;
  27011. }
  27012. // _loop0_40: param_with_default
  27013. static asdl_seq *
  27014. _loop0_40_rule(Parser *p)
  27015. {
  27016. if (p->level++ == MAXSTACK) {
  27017. _Pypegen_stack_overflow(p);
  27018. }
  27019. if (p->error_indicator) {
  27020. p->level--;
  27021. return NULL;
  27022. }
  27023. void *_res = NULL;
  27024. int _mark = p->mark;
  27025. void **_children = PyMem_Malloc(sizeof(void *));
  27026. if (!_children) {
  27027. p->error_indicator = 1;
  27028. PyErr_NoMemory();
  27029. p->level--;
  27030. return NULL;
  27031. }
  27032. Py_ssize_t _children_capacity = 1;
  27033. Py_ssize_t _n = 0;
  27034. { // param_with_default
  27035. if (p->error_indicator) {
  27036. p->level--;
  27037. return NULL;
  27038. }
  27039. D(fprintf(stderr, "%*c> _loop0_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
  27040. NameDefaultPair* param_with_default_var;
  27041. while (
  27042. (param_with_default_var = param_with_default_rule(p)) // param_with_default
  27043. )
  27044. {
  27045. _res = param_with_default_var;
  27046. if (_n == _children_capacity) {
  27047. _children_capacity *= 2;
  27048. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  27049. if (!_new_children) {
  27050. PyMem_Free(_children);
  27051. p->error_indicator = 1;
  27052. PyErr_NoMemory();
  27053. p->level--;
  27054. return NULL;
  27055. }
  27056. _children = _new_children;
  27057. }
  27058. _children[_n++] = _res;
  27059. _mark = p->mark;
  27060. }
  27061. p->mark = _mark;
  27062. D(fprintf(stderr, "%*c%s _loop0_40[%d-%d]: %s failed!\n", p->level, ' ',
  27063. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
  27064. }
  27065. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  27066. if (!_seq) {
  27067. PyMem_Free(_children);
  27068. p->error_indicator = 1;
  27069. PyErr_NoMemory();
  27070. p->level--;
  27071. return NULL;
  27072. }
  27073. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  27074. PyMem_Free(_children);
  27075. p->level--;
  27076. return _seq;
  27077. }
  27078. // _loop1_41: param_with_default
  27079. static asdl_seq *
  27080. _loop1_41_rule(Parser *p)
  27081. {
  27082. if (p->level++ == MAXSTACK) {
  27083. _Pypegen_stack_overflow(p);
  27084. }
  27085. if (p->error_indicator) {
  27086. p->level--;
  27087. return NULL;
  27088. }
  27089. void *_res = NULL;
  27090. int _mark = p->mark;
  27091. void **_children = PyMem_Malloc(sizeof(void *));
  27092. if (!_children) {
  27093. p->error_indicator = 1;
  27094. PyErr_NoMemory();
  27095. p->level--;
  27096. return NULL;
  27097. }
  27098. Py_ssize_t _children_capacity = 1;
  27099. Py_ssize_t _n = 0;
  27100. { // param_with_default
  27101. if (p->error_indicator) {
  27102. p->level--;
  27103. return NULL;
  27104. }
  27105. D(fprintf(stderr, "%*c> _loop1_41[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
  27106. NameDefaultPair* param_with_default_var;
  27107. while (
  27108. (param_with_default_var = param_with_default_rule(p)) // param_with_default
  27109. )
  27110. {
  27111. _res = param_with_default_var;
  27112. if (_n == _children_capacity) {
  27113. _children_capacity *= 2;
  27114. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  27115. if (!_new_children) {
  27116. PyMem_Free(_children);
  27117. p->error_indicator = 1;
  27118. PyErr_NoMemory();
  27119. p->level--;
  27120. return NULL;
  27121. }
  27122. _children = _new_children;
  27123. }
  27124. _children[_n++] = _res;
  27125. _mark = p->mark;
  27126. }
  27127. p->mark = _mark;
  27128. D(fprintf(stderr, "%*c%s _loop1_41[%d-%d]: %s failed!\n", p->level, ' ',
  27129. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
  27130. }
  27131. if (_n == 0 || p->error_indicator) {
  27132. PyMem_Free(_children);
  27133. p->level--;
  27134. return NULL;
  27135. }
  27136. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  27137. if (!_seq) {
  27138. PyMem_Free(_children);
  27139. p->error_indicator = 1;
  27140. PyErr_NoMemory();
  27141. p->level--;
  27142. return NULL;
  27143. }
  27144. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  27145. PyMem_Free(_children);
  27146. p->level--;
  27147. return _seq;
  27148. }
  27149. // _loop1_42: param_no_default
  27150. static asdl_seq *
  27151. _loop1_42_rule(Parser *p)
  27152. {
  27153. if (p->level++ == MAXSTACK) {
  27154. _Pypegen_stack_overflow(p);
  27155. }
  27156. if (p->error_indicator) {
  27157. p->level--;
  27158. return NULL;
  27159. }
  27160. void *_res = NULL;
  27161. int _mark = p->mark;
  27162. void **_children = PyMem_Malloc(sizeof(void *));
  27163. if (!_children) {
  27164. p->error_indicator = 1;
  27165. PyErr_NoMemory();
  27166. p->level--;
  27167. return NULL;
  27168. }
  27169. Py_ssize_t _children_capacity = 1;
  27170. Py_ssize_t _n = 0;
  27171. { // param_no_default
  27172. if (p->error_indicator) {
  27173. p->level--;
  27174. return NULL;
  27175. }
  27176. D(fprintf(stderr, "%*c> _loop1_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
  27177. arg_ty param_no_default_var;
  27178. while (
  27179. (param_no_default_var = param_no_default_rule(p)) // param_no_default
  27180. )
  27181. {
  27182. _res = param_no_default_var;
  27183. if (_n == _children_capacity) {
  27184. _children_capacity *= 2;
  27185. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  27186. if (!_new_children) {
  27187. PyMem_Free(_children);
  27188. p->error_indicator = 1;
  27189. PyErr_NoMemory();
  27190. p->level--;
  27191. return NULL;
  27192. }
  27193. _children = _new_children;
  27194. }
  27195. _children[_n++] = _res;
  27196. _mark = p->mark;
  27197. }
  27198. p->mark = _mark;
  27199. D(fprintf(stderr, "%*c%s _loop1_42[%d-%d]: %s failed!\n", p->level, ' ',
  27200. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
  27201. }
  27202. if (_n == 0 || p->error_indicator) {
  27203. PyMem_Free(_children);
  27204. p->level--;
  27205. return NULL;
  27206. }
  27207. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  27208. if (!_seq) {
  27209. PyMem_Free(_children);
  27210. p->error_indicator = 1;
  27211. PyErr_NoMemory();
  27212. p->level--;
  27213. return NULL;
  27214. }
  27215. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  27216. PyMem_Free(_children);
  27217. p->level--;
  27218. return _seq;
  27219. }
  27220. // _loop1_43: param_no_default
  27221. static asdl_seq *
  27222. _loop1_43_rule(Parser *p)
  27223. {
  27224. if (p->level++ == MAXSTACK) {
  27225. _Pypegen_stack_overflow(p);
  27226. }
  27227. if (p->error_indicator) {
  27228. p->level--;
  27229. return NULL;
  27230. }
  27231. void *_res = NULL;
  27232. int _mark = p->mark;
  27233. void **_children = PyMem_Malloc(sizeof(void *));
  27234. if (!_children) {
  27235. p->error_indicator = 1;
  27236. PyErr_NoMemory();
  27237. p->level--;
  27238. return NULL;
  27239. }
  27240. Py_ssize_t _children_capacity = 1;
  27241. Py_ssize_t _n = 0;
  27242. { // param_no_default
  27243. if (p->error_indicator) {
  27244. p->level--;
  27245. return NULL;
  27246. }
  27247. D(fprintf(stderr, "%*c> _loop1_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
  27248. arg_ty param_no_default_var;
  27249. while (
  27250. (param_no_default_var = param_no_default_rule(p)) // param_no_default
  27251. )
  27252. {
  27253. _res = param_no_default_var;
  27254. if (_n == _children_capacity) {
  27255. _children_capacity *= 2;
  27256. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  27257. if (!_new_children) {
  27258. PyMem_Free(_children);
  27259. p->error_indicator = 1;
  27260. PyErr_NoMemory();
  27261. p->level--;
  27262. return NULL;
  27263. }
  27264. _children = _new_children;
  27265. }
  27266. _children[_n++] = _res;
  27267. _mark = p->mark;
  27268. }
  27269. p->mark = _mark;
  27270. D(fprintf(stderr, "%*c%s _loop1_43[%d-%d]: %s failed!\n", p->level, ' ',
  27271. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
  27272. }
  27273. if (_n == 0 || p->error_indicator) {
  27274. PyMem_Free(_children);
  27275. p->level--;
  27276. return NULL;
  27277. }
  27278. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  27279. if (!_seq) {
  27280. PyMem_Free(_children);
  27281. p->error_indicator = 1;
  27282. PyErr_NoMemory();
  27283. p->level--;
  27284. return NULL;
  27285. }
  27286. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  27287. PyMem_Free(_children);
  27288. p->level--;
  27289. return _seq;
  27290. }
  27291. // _loop0_44: param_no_default
  27292. static asdl_seq *
  27293. _loop0_44_rule(Parser *p)
  27294. {
  27295. if (p->level++ == MAXSTACK) {
  27296. _Pypegen_stack_overflow(p);
  27297. }
  27298. if (p->error_indicator) {
  27299. p->level--;
  27300. return NULL;
  27301. }
  27302. void *_res = NULL;
  27303. int _mark = p->mark;
  27304. void **_children = PyMem_Malloc(sizeof(void *));
  27305. if (!_children) {
  27306. p->error_indicator = 1;
  27307. PyErr_NoMemory();
  27308. p->level--;
  27309. return NULL;
  27310. }
  27311. Py_ssize_t _children_capacity = 1;
  27312. Py_ssize_t _n = 0;
  27313. { // param_no_default
  27314. if (p->error_indicator) {
  27315. p->level--;
  27316. return NULL;
  27317. }
  27318. D(fprintf(stderr, "%*c> _loop0_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
  27319. arg_ty param_no_default_var;
  27320. while (
  27321. (param_no_default_var = param_no_default_rule(p)) // param_no_default
  27322. )
  27323. {
  27324. _res = param_no_default_var;
  27325. if (_n == _children_capacity) {
  27326. _children_capacity *= 2;
  27327. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  27328. if (!_new_children) {
  27329. PyMem_Free(_children);
  27330. p->error_indicator = 1;
  27331. PyErr_NoMemory();
  27332. p->level--;
  27333. return NULL;
  27334. }
  27335. _children = _new_children;
  27336. }
  27337. _children[_n++] = _res;
  27338. _mark = p->mark;
  27339. }
  27340. p->mark = _mark;
  27341. D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n", p->level, ' ',
  27342. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
  27343. }
  27344. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  27345. if (!_seq) {
  27346. PyMem_Free(_children);
  27347. p->error_indicator = 1;
  27348. PyErr_NoMemory();
  27349. p->level--;
  27350. return NULL;
  27351. }
  27352. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  27353. PyMem_Free(_children);
  27354. p->level--;
  27355. return _seq;
  27356. }
  27357. // _loop1_45: param_with_default
  27358. static asdl_seq *
  27359. _loop1_45_rule(Parser *p)
  27360. {
  27361. if (p->level++ == MAXSTACK) {
  27362. _Pypegen_stack_overflow(p);
  27363. }
  27364. if (p->error_indicator) {
  27365. p->level--;
  27366. return NULL;
  27367. }
  27368. void *_res = NULL;
  27369. int _mark = p->mark;
  27370. void **_children = PyMem_Malloc(sizeof(void *));
  27371. if (!_children) {
  27372. p->error_indicator = 1;
  27373. PyErr_NoMemory();
  27374. p->level--;
  27375. return NULL;
  27376. }
  27377. Py_ssize_t _children_capacity = 1;
  27378. Py_ssize_t _n = 0;
  27379. { // param_with_default
  27380. if (p->error_indicator) {
  27381. p->level--;
  27382. return NULL;
  27383. }
  27384. D(fprintf(stderr, "%*c> _loop1_45[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
  27385. NameDefaultPair* param_with_default_var;
  27386. while (
  27387. (param_with_default_var = param_with_default_rule(p)) // param_with_default
  27388. )
  27389. {
  27390. _res = param_with_default_var;
  27391. if (_n == _children_capacity) {
  27392. _children_capacity *= 2;
  27393. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  27394. if (!_new_children) {
  27395. PyMem_Free(_children);
  27396. p->error_indicator = 1;
  27397. PyErr_NoMemory();
  27398. p->level--;
  27399. return NULL;
  27400. }
  27401. _children = _new_children;
  27402. }
  27403. _children[_n++] = _res;
  27404. _mark = p->mark;
  27405. }
  27406. p->mark = _mark;
  27407. D(fprintf(stderr, "%*c%s _loop1_45[%d-%d]: %s failed!\n", p->level, ' ',
  27408. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
  27409. }
  27410. if (_n == 0 || p->error_indicator) {
  27411. PyMem_Free(_children);
  27412. p->level--;
  27413. return NULL;
  27414. }
  27415. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  27416. if (!_seq) {
  27417. PyMem_Free(_children);
  27418. p->error_indicator = 1;
  27419. PyErr_NoMemory();
  27420. p->level--;
  27421. return NULL;
  27422. }
  27423. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  27424. PyMem_Free(_children);
  27425. p->level--;
  27426. return _seq;
  27427. }
  27428. // _loop0_46: param_no_default
  27429. static asdl_seq *
  27430. _loop0_46_rule(Parser *p)
  27431. {
  27432. if (p->level++ == MAXSTACK) {
  27433. _Pypegen_stack_overflow(p);
  27434. }
  27435. if (p->error_indicator) {
  27436. p->level--;
  27437. return NULL;
  27438. }
  27439. void *_res = NULL;
  27440. int _mark = p->mark;
  27441. void **_children = PyMem_Malloc(sizeof(void *));
  27442. if (!_children) {
  27443. p->error_indicator = 1;
  27444. PyErr_NoMemory();
  27445. p->level--;
  27446. return NULL;
  27447. }
  27448. Py_ssize_t _children_capacity = 1;
  27449. Py_ssize_t _n = 0;
  27450. { // param_no_default
  27451. if (p->error_indicator) {
  27452. p->level--;
  27453. return NULL;
  27454. }
  27455. D(fprintf(stderr, "%*c> _loop0_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
  27456. arg_ty param_no_default_var;
  27457. while (
  27458. (param_no_default_var = param_no_default_rule(p)) // param_no_default
  27459. )
  27460. {
  27461. _res = param_no_default_var;
  27462. if (_n == _children_capacity) {
  27463. _children_capacity *= 2;
  27464. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  27465. if (!_new_children) {
  27466. PyMem_Free(_children);
  27467. p->error_indicator = 1;
  27468. PyErr_NoMemory();
  27469. p->level--;
  27470. return NULL;
  27471. }
  27472. _children = _new_children;
  27473. }
  27474. _children[_n++] = _res;
  27475. _mark = p->mark;
  27476. }
  27477. p->mark = _mark;
  27478. D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n", p->level, ' ',
  27479. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
  27480. }
  27481. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  27482. if (!_seq) {
  27483. PyMem_Free(_children);
  27484. p->error_indicator = 1;
  27485. PyErr_NoMemory();
  27486. p->level--;
  27487. return NULL;
  27488. }
  27489. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  27490. PyMem_Free(_children);
  27491. p->level--;
  27492. return _seq;
  27493. }
  27494. // _loop1_47: param_with_default
  27495. static asdl_seq *
  27496. _loop1_47_rule(Parser *p)
  27497. {
  27498. if (p->level++ == MAXSTACK) {
  27499. _Pypegen_stack_overflow(p);
  27500. }
  27501. if (p->error_indicator) {
  27502. p->level--;
  27503. return NULL;
  27504. }
  27505. void *_res = NULL;
  27506. int _mark = p->mark;
  27507. void **_children = PyMem_Malloc(sizeof(void *));
  27508. if (!_children) {
  27509. p->error_indicator = 1;
  27510. PyErr_NoMemory();
  27511. p->level--;
  27512. return NULL;
  27513. }
  27514. Py_ssize_t _children_capacity = 1;
  27515. Py_ssize_t _n = 0;
  27516. { // param_with_default
  27517. if (p->error_indicator) {
  27518. p->level--;
  27519. return NULL;
  27520. }
  27521. D(fprintf(stderr, "%*c> _loop1_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
  27522. NameDefaultPair* param_with_default_var;
  27523. while (
  27524. (param_with_default_var = param_with_default_rule(p)) // param_with_default
  27525. )
  27526. {
  27527. _res = param_with_default_var;
  27528. if (_n == _children_capacity) {
  27529. _children_capacity *= 2;
  27530. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  27531. if (!_new_children) {
  27532. PyMem_Free(_children);
  27533. p->error_indicator = 1;
  27534. PyErr_NoMemory();
  27535. p->level--;
  27536. return NULL;
  27537. }
  27538. _children = _new_children;
  27539. }
  27540. _children[_n++] = _res;
  27541. _mark = p->mark;
  27542. }
  27543. p->mark = _mark;
  27544. D(fprintf(stderr, "%*c%s _loop1_47[%d-%d]: %s failed!\n", p->level, ' ',
  27545. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
  27546. }
  27547. if (_n == 0 || p->error_indicator) {
  27548. PyMem_Free(_children);
  27549. p->level--;
  27550. return NULL;
  27551. }
  27552. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  27553. if (!_seq) {
  27554. PyMem_Free(_children);
  27555. p->error_indicator = 1;
  27556. PyErr_NoMemory();
  27557. p->level--;
  27558. return NULL;
  27559. }
  27560. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  27561. PyMem_Free(_children);
  27562. p->level--;
  27563. return _seq;
  27564. }
  27565. // _loop0_48: param_maybe_default
  27566. static asdl_seq *
  27567. _loop0_48_rule(Parser *p)
  27568. {
  27569. if (p->level++ == MAXSTACK) {
  27570. _Pypegen_stack_overflow(p);
  27571. }
  27572. if (p->error_indicator) {
  27573. p->level--;
  27574. return NULL;
  27575. }
  27576. void *_res = NULL;
  27577. int _mark = p->mark;
  27578. void **_children = PyMem_Malloc(sizeof(void *));
  27579. if (!_children) {
  27580. p->error_indicator = 1;
  27581. PyErr_NoMemory();
  27582. p->level--;
  27583. return NULL;
  27584. }
  27585. Py_ssize_t _children_capacity = 1;
  27586. Py_ssize_t _n = 0;
  27587. { // param_maybe_default
  27588. if (p->error_indicator) {
  27589. p->level--;
  27590. return NULL;
  27591. }
  27592. D(fprintf(stderr, "%*c> _loop0_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
  27593. NameDefaultPair* param_maybe_default_var;
  27594. while (
  27595. (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
  27596. )
  27597. {
  27598. _res = param_maybe_default_var;
  27599. if (_n == _children_capacity) {
  27600. _children_capacity *= 2;
  27601. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  27602. if (!_new_children) {
  27603. PyMem_Free(_children);
  27604. p->error_indicator = 1;
  27605. PyErr_NoMemory();
  27606. p->level--;
  27607. return NULL;
  27608. }
  27609. _children = _new_children;
  27610. }
  27611. _children[_n++] = _res;
  27612. _mark = p->mark;
  27613. }
  27614. p->mark = _mark;
  27615. D(fprintf(stderr, "%*c%s _loop0_48[%d-%d]: %s failed!\n", p->level, ' ',
  27616. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
  27617. }
  27618. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  27619. if (!_seq) {
  27620. PyMem_Free(_children);
  27621. p->error_indicator = 1;
  27622. PyErr_NoMemory();
  27623. p->level--;
  27624. return NULL;
  27625. }
  27626. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  27627. PyMem_Free(_children);
  27628. p->level--;
  27629. return _seq;
  27630. }
  27631. // _loop0_49: param_maybe_default
  27632. static asdl_seq *
  27633. _loop0_49_rule(Parser *p)
  27634. {
  27635. if (p->level++ == MAXSTACK) {
  27636. _Pypegen_stack_overflow(p);
  27637. }
  27638. if (p->error_indicator) {
  27639. p->level--;
  27640. return NULL;
  27641. }
  27642. void *_res = NULL;
  27643. int _mark = p->mark;
  27644. void **_children = PyMem_Malloc(sizeof(void *));
  27645. if (!_children) {
  27646. p->error_indicator = 1;
  27647. PyErr_NoMemory();
  27648. p->level--;
  27649. return NULL;
  27650. }
  27651. Py_ssize_t _children_capacity = 1;
  27652. Py_ssize_t _n = 0;
  27653. { // param_maybe_default
  27654. if (p->error_indicator) {
  27655. p->level--;
  27656. return NULL;
  27657. }
  27658. D(fprintf(stderr, "%*c> _loop0_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
  27659. NameDefaultPair* param_maybe_default_var;
  27660. while (
  27661. (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
  27662. )
  27663. {
  27664. _res = param_maybe_default_var;
  27665. if (_n == _children_capacity) {
  27666. _children_capacity *= 2;
  27667. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  27668. if (!_new_children) {
  27669. PyMem_Free(_children);
  27670. p->error_indicator = 1;
  27671. PyErr_NoMemory();
  27672. p->level--;
  27673. return NULL;
  27674. }
  27675. _children = _new_children;
  27676. }
  27677. _children[_n++] = _res;
  27678. _mark = p->mark;
  27679. }
  27680. p->mark = _mark;
  27681. D(fprintf(stderr, "%*c%s _loop0_49[%d-%d]: %s failed!\n", p->level, ' ',
  27682. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
  27683. }
  27684. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  27685. if (!_seq) {
  27686. PyMem_Free(_children);
  27687. p->error_indicator = 1;
  27688. PyErr_NoMemory();
  27689. p->level--;
  27690. return NULL;
  27691. }
  27692. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  27693. PyMem_Free(_children);
  27694. p->level--;
  27695. return _seq;
  27696. }
  27697. // _loop1_50: param_maybe_default
  27698. static asdl_seq *
  27699. _loop1_50_rule(Parser *p)
  27700. {
  27701. if (p->level++ == MAXSTACK) {
  27702. _Pypegen_stack_overflow(p);
  27703. }
  27704. if (p->error_indicator) {
  27705. p->level--;
  27706. return NULL;
  27707. }
  27708. void *_res = NULL;
  27709. int _mark = p->mark;
  27710. void **_children = PyMem_Malloc(sizeof(void *));
  27711. if (!_children) {
  27712. p->error_indicator = 1;
  27713. PyErr_NoMemory();
  27714. p->level--;
  27715. return NULL;
  27716. }
  27717. Py_ssize_t _children_capacity = 1;
  27718. Py_ssize_t _n = 0;
  27719. { // param_maybe_default
  27720. if (p->error_indicator) {
  27721. p->level--;
  27722. return NULL;
  27723. }
  27724. D(fprintf(stderr, "%*c> _loop1_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
  27725. NameDefaultPair* param_maybe_default_var;
  27726. while (
  27727. (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
  27728. )
  27729. {
  27730. _res = param_maybe_default_var;
  27731. if (_n == _children_capacity) {
  27732. _children_capacity *= 2;
  27733. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  27734. if (!_new_children) {
  27735. PyMem_Free(_children);
  27736. p->error_indicator = 1;
  27737. PyErr_NoMemory();
  27738. p->level--;
  27739. return NULL;
  27740. }
  27741. _children = _new_children;
  27742. }
  27743. _children[_n++] = _res;
  27744. _mark = p->mark;
  27745. }
  27746. p->mark = _mark;
  27747. D(fprintf(stderr, "%*c%s _loop1_50[%d-%d]: %s failed!\n", p->level, ' ',
  27748. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
  27749. }
  27750. if (_n == 0 || p->error_indicator) {
  27751. PyMem_Free(_children);
  27752. p->level--;
  27753. return NULL;
  27754. }
  27755. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  27756. if (!_seq) {
  27757. PyMem_Free(_children);
  27758. p->error_indicator = 1;
  27759. PyErr_NoMemory();
  27760. p->level--;
  27761. return NULL;
  27762. }
  27763. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  27764. PyMem_Free(_children);
  27765. p->level--;
  27766. return _seq;
  27767. }
  27768. // _loop0_52: ',' with_item
  27769. static asdl_seq *
  27770. _loop0_52_rule(Parser *p)
  27771. {
  27772. if (p->level++ == MAXSTACK) {
  27773. _Pypegen_stack_overflow(p);
  27774. }
  27775. if (p->error_indicator) {
  27776. p->level--;
  27777. return NULL;
  27778. }
  27779. void *_res = NULL;
  27780. int _mark = p->mark;
  27781. void **_children = PyMem_Malloc(sizeof(void *));
  27782. if (!_children) {
  27783. p->error_indicator = 1;
  27784. PyErr_NoMemory();
  27785. p->level--;
  27786. return NULL;
  27787. }
  27788. Py_ssize_t _children_capacity = 1;
  27789. Py_ssize_t _n = 0;
  27790. { // ',' with_item
  27791. if (p->error_indicator) {
  27792. p->level--;
  27793. return NULL;
  27794. }
  27795. D(fprintf(stderr, "%*c> _loop0_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
  27796. Token * _literal;
  27797. withitem_ty elem;
  27798. while (
  27799. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  27800. &&
  27801. (elem = with_item_rule(p)) // with_item
  27802. )
  27803. {
  27804. _res = elem;
  27805. if (_res == NULL && PyErr_Occurred()) {
  27806. p->error_indicator = 1;
  27807. PyMem_Free(_children);
  27808. p->level--;
  27809. return NULL;
  27810. }
  27811. if (_n == _children_capacity) {
  27812. _children_capacity *= 2;
  27813. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  27814. if (!_new_children) {
  27815. PyMem_Free(_children);
  27816. p->error_indicator = 1;
  27817. PyErr_NoMemory();
  27818. p->level--;
  27819. return NULL;
  27820. }
  27821. _children = _new_children;
  27822. }
  27823. _children[_n++] = _res;
  27824. _mark = p->mark;
  27825. }
  27826. p->mark = _mark;
  27827. D(fprintf(stderr, "%*c%s _loop0_52[%d-%d]: %s failed!\n", p->level, ' ',
  27828. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
  27829. }
  27830. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  27831. if (!_seq) {
  27832. PyMem_Free(_children);
  27833. p->error_indicator = 1;
  27834. PyErr_NoMemory();
  27835. p->level--;
  27836. return NULL;
  27837. }
  27838. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  27839. PyMem_Free(_children);
  27840. p->level--;
  27841. return _seq;
  27842. }
  27843. // _gather_51: with_item _loop0_52
  27844. static asdl_seq *
  27845. _gather_51_rule(Parser *p)
  27846. {
  27847. if (p->level++ == MAXSTACK) {
  27848. _Pypegen_stack_overflow(p);
  27849. }
  27850. if (p->error_indicator) {
  27851. p->level--;
  27852. return NULL;
  27853. }
  27854. asdl_seq * _res = NULL;
  27855. int _mark = p->mark;
  27856. { // with_item _loop0_52
  27857. if (p->error_indicator) {
  27858. p->level--;
  27859. return NULL;
  27860. }
  27861. D(fprintf(stderr, "%*c> _gather_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_52"));
  27862. withitem_ty elem;
  27863. asdl_seq * seq;
  27864. if (
  27865. (elem = with_item_rule(p)) // with_item
  27866. &&
  27867. (seq = _loop0_52_rule(p)) // _loop0_52
  27868. )
  27869. {
  27870. D(fprintf(stderr, "%*c+ _gather_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_52"));
  27871. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  27872. goto done;
  27873. }
  27874. p->mark = _mark;
  27875. D(fprintf(stderr, "%*c%s _gather_51[%d-%d]: %s failed!\n", p->level, ' ',
  27876. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_52"));
  27877. }
  27878. _res = NULL;
  27879. done:
  27880. p->level--;
  27881. return _res;
  27882. }
  27883. // _loop0_54: ',' with_item
  27884. static asdl_seq *
  27885. _loop0_54_rule(Parser *p)
  27886. {
  27887. if (p->level++ == MAXSTACK) {
  27888. _Pypegen_stack_overflow(p);
  27889. }
  27890. if (p->error_indicator) {
  27891. p->level--;
  27892. return NULL;
  27893. }
  27894. void *_res = NULL;
  27895. int _mark = p->mark;
  27896. void **_children = PyMem_Malloc(sizeof(void *));
  27897. if (!_children) {
  27898. p->error_indicator = 1;
  27899. PyErr_NoMemory();
  27900. p->level--;
  27901. return NULL;
  27902. }
  27903. Py_ssize_t _children_capacity = 1;
  27904. Py_ssize_t _n = 0;
  27905. { // ',' with_item
  27906. if (p->error_indicator) {
  27907. p->level--;
  27908. return NULL;
  27909. }
  27910. D(fprintf(stderr, "%*c> _loop0_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
  27911. Token * _literal;
  27912. withitem_ty elem;
  27913. while (
  27914. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  27915. &&
  27916. (elem = with_item_rule(p)) // with_item
  27917. )
  27918. {
  27919. _res = elem;
  27920. if (_res == NULL && PyErr_Occurred()) {
  27921. p->error_indicator = 1;
  27922. PyMem_Free(_children);
  27923. p->level--;
  27924. return NULL;
  27925. }
  27926. if (_n == _children_capacity) {
  27927. _children_capacity *= 2;
  27928. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  27929. if (!_new_children) {
  27930. PyMem_Free(_children);
  27931. p->error_indicator = 1;
  27932. PyErr_NoMemory();
  27933. p->level--;
  27934. return NULL;
  27935. }
  27936. _children = _new_children;
  27937. }
  27938. _children[_n++] = _res;
  27939. _mark = p->mark;
  27940. }
  27941. p->mark = _mark;
  27942. D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ',
  27943. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
  27944. }
  27945. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  27946. if (!_seq) {
  27947. PyMem_Free(_children);
  27948. p->error_indicator = 1;
  27949. PyErr_NoMemory();
  27950. p->level--;
  27951. return NULL;
  27952. }
  27953. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  27954. PyMem_Free(_children);
  27955. p->level--;
  27956. return _seq;
  27957. }
  27958. // _gather_53: with_item _loop0_54
  27959. static asdl_seq *
  27960. _gather_53_rule(Parser *p)
  27961. {
  27962. if (p->level++ == MAXSTACK) {
  27963. _Pypegen_stack_overflow(p);
  27964. }
  27965. if (p->error_indicator) {
  27966. p->level--;
  27967. return NULL;
  27968. }
  27969. asdl_seq * _res = NULL;
  27970. int _mark = p->mark;
  27971. { // with_item _loop0_54
  27972. if (p->error_indicator) {
  27973. p->level--;
  27974. return NULL;
  27975. }
  27976. D(fprintf(stderr, "%*c> _gather_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_54"));
  27977. withitem_ty elem;
  27978. asdl_seq * seq;
  27979. if (
  27980. (elem = with_item_rule(p)) // with_item
  27981. &&
  27982. (seq = _loop0_54_rule(p)) // _loop0_54
  27983. )
  27984. {
  27985. D(fprintf(stderr, "%*c+ _gather_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_54"));
  27986. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  27987. goto done;
  27988. }
  27989. p->mark = _mark;
  27990. D(fprintf(stderr, "%*c%s _gather_53[%d-%d]: %s failed!\n", p->level, ' ',
  27991. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_54"));
  27992. }
  27993. _res = NULL;
  27994. done:
  27995. p->level--;
  27996. return _res;
  27997. }
  27998. // _loop0_56: ',' with_item
  27999. static asdl_seq *
  28000. _loop0_56_rule(Parser *p)
  28001. {
  28002. if (p->level++ == MAXSTACK) {
  28003. _Pypegen_stack_overflow(p);
  28004. }
  28005. if (p->error_indicator) {
  28006. p->level--;
  28007. return NULL;
  28008. }
  28009. void *_res = NULL;
  28010. int _mark = p->mark;
  28011. void **_children = PyMem_Malloc(sizeof(void *));
  28012. if (!_children) {
  28013. p->error_indicator = 1;
  28014. PyErr_NoMemory();
  28015. p->level--;
  28016. return NULL;
  28017. }
  28018. Py_ssize_t _children_capacity = 1;
  28019. Py_ssize_t _n = 0;
  28020. { // ',' with_item
  28021. if (p->error_indicator) {
  28022. p->level--;
  28023. return NULL;
  28024. }
  28025. D(fprintf(stderr, "%*c> _loop0_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
  28026. Token * _literal;
  28027. withitem_ty elem;
  28028. while (
  28029. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  28030. &&
  28031. (elem = with_item_rule(p)) // with_item
  28032. )
  28033. {
  28034. _res = elem;
  28035. if (_res == NULL && PyErr_Occurred()) {
  28036. p->error_indicator = 1;
  28037. PyMem_Free(_children);
  28038. p->level--;
  28039. return NULL;
  28040. }
  28041. if (_n == _children_capacity) {
  28042. _children_capacity *= 2;
  28043. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  28044. if (!_new_children) {
  28045. PyMem_Free(_children);
  28046. p->error_indicator = 1;
  28047. PyErr_NoMemory();
  28048. p->level--;
  28049. return NULL;
  28050. }
  28051. _children = _new_children;
  28052. }
  28053. _children[_n++] = _res;
  28054. _mark = p->mark;
  28055. }
  28056. p->mark = _mark;
  28057. D(fprintf(stderr, "%*c%s _loop0_56[%d-%d]: %s failed!\n", p->level, ' ',
  28058. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
  28059. }
  28060. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  28061. if (!_seq) {
  28062. PyMem_Free(_children);
  28063. p->error_indicator = 1;
  28064. PyErr_NoMemory();
  28065. p->level--;
  28066. return NULL;
  28067. }
  28068. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  28069. PyMem_Free(_children);
  28070. p->level--;
  28071. return _seq;
  28072. }
  28073. // _gather_55: with_item _loop0_56
  28074. static asdl_seq *
  28075. _gather_55_rule(Parser *p)
  28076. {
  28077. if (p->level++ == MAXSTACK) {
  28078. _Pypegen_stack_overflow(p);
  28079. }
  28080. if (p->error_indicator) {
  28081. p->level--;
  28082. return NULL;
  28083. }
  28084. asdl_seq * _res = NULL;
  28085. int _mark = p->mark;
  28086. { // with_item _loop0_56
  28087. if (p->error_indicator) {
  28088. p->level--;
  28089. return NULL;
  28090. }
  28091. D(fprintf(stderr, "%*c> _gather_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_56"));
  28092. withitem_ty elem;
  28093. asdl_seq * seq;
  28094. if (
  28095. (elem = with_item_rule(p)) // with_item
  28096. &&
  28097. (seq = _loop0_56_rule(p)) // _loop0_56
  28098. )
  28099. {
  28100. D(fprintf(stderr, "%*c+ _gather_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_56"));
  28101. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  28102. goto done;
  28103. }
  28104. p->mark = _mark;
  28105. D(fprintf(stderr, "%*c%s _gather_55[%d-%d]: %s failed!\n", p->level, ' ',
  28106. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_56"));
  28107. }
  28108. _res = NULL;
  28109. done:
  28110. p->level--;
  28111. return _res;
  28112. }
  28113. // _loop0_58: ',' with_item
  28114. static asdl_seq *
  28115. _loop0_58_rule(Parser *p)
  28116. {
  28117. if (p->level++ == MAXSTACK) {
  28118. _Pypegen_stack_overflow(p);
  28119. }
  28120. if (p->error_indicator) {
  28121. p->level--;
  28122. return NULL;
  28123. }
  28124. void *_res = NULL;
  28125. int _mark = p->mark;
  28126. void **_children = PyMem_Malloc(sizeof(void *));
  28127. if (!_children) {
  28128. p->error_indicator = 1;
  28129. PyErr_NoMemory();
  28130. p->level--;
  28131. return NULL;
  28132. }
  28133. Py_ssize_t _children_capacity = 1;
  28134. Py_ssize_t _n = 0;
  28135. { // ',' with_item
  28136. if (p->error_indicator) {
  28137. p->level--;
  28138. return NULL;
  28139. }
  28140. D(fprintf(stderr, "%*c> _loop0_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
  28141. Token * _literal;
  28142. withitem_ty elem;
  28143. while (
  28144. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  28145. &&
  28146. (elem = with_item_rule(p)) // with_item
  28147. )
  28148. {
  28149. _res = elem;
  28150. if (_res == NULL && PyErr_Occurred()) {
  28151. p->error_indicator = 1;
  28152. PyMem_Free(_children);
  28153. p->level--;
  28154. return NULL;
  28155. }
  28156. if (_n == _children_capacity) {
  28157. _children_capacity *= 2;
  28158. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  28159. if (!_new_children) {
  28160. PyMem_Free(_children);
  28161. p->error_indicator = 1;
  28162. PyErr_NoMemory();
  28163. p->level--;
  28164. return NULL;
  28165. }
  28166. _children = _new_children;
  28167. }
  28168. _children[_n++] = _res;
  28169. _mark = p->mark;
  28170. }
  28171. p->mark = _mark;
  28172. D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ',
  28173. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
  28174. }
  28175. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  28176. if (!_seq) {
  28177. PyMem_Free(_children);
  28178. p->error_indicator = 1;
  28179. PyErr_NoMemory();
  28180. p->level--;
  28181. return NULL;
  28182. }
  28183. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  28184. PyMem_Free(_children);
  28185. p->level--;
  28186. return _seq;
  28187. }
  28188. // _gather_57: with_item _loop0_58
  28189. static asdl_seq *
  28190. _gather_57_rule(Parser *p)
  28191. {
  28192. if (p->level++ == MAXSTACK) {
  28193. _Pypegen_stack_overflow(p);
  28194. }
  28195. if (p->error_indicator) {
  28196. p->level--;
  28197. return NULL;
  28198. }
  28199. asdl_seq * _res = NULL;
  28200. int _mark = p->mark;
  28201. { // with_item _loop0_58
  28202. if (p->error_indicator) {
  28203. p->level--;
  28204. return NULL;
  28205. }
  28206. D(fprintf(stderr, "%*c> _gather_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_58"));
  28207. withitem_ty elem;
  28208. asdl_seq * seq;
  28209. if (
  28210. (elem = with_item_rule(p)) // with_item
  28211. &&
  28212. (seq = _loop0_58_rule(p)) // _loop0_58
  28213. )
  28214. {
  28215. D(fprintf(stderr, "%*c+ _gather_57[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_58"));
  28216. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  28217. goto done;
  28218. }
  28219. p->mark = _mark;
  28220. D(fprintf(stderr, "%*c%s _gather_57[%d-%d]: %s failed!\n", p->level, ' ',
  28221. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_58"));
  28222. }
  28223. _res = NULL;
  28224. done:
  28225. p->level--;
  28226. return _res;
  28227. }
  28228. // _tmp_59: ',' | ')' | ':'
  28229. static void *
  28230. _tmp_59_rule(Parser *p)
  28231. {
  28232. if (p->level++ == MAXSTACK) {
  28233. _Pypegen_stack_overflow(p);
  28234. }
  28235. if (p->error_indicator) {
  28236. p->level--;
  28237. return NULL;
  28238. }
  28239. void * _res = NULL;
  28240. int _mark = p->mark;
  28241. { // ','
  28242. if (p->error_indicator) {
  28243. p->level--;
  28244. return NULL;
  28245. }
  28246. D(fprintf(stderr, "%*c> _tmp_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
  28247. Token * _literal;
  28248. if (
  28249. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  28250. )
  28251. {
  28252. D(fprintf(stderr, "%*c+ _tmp_59[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
  28253. _res = _literal;
  28254. goto done;
  28255. }
  28256. p->mark = _mark;
  28257. D(fprintf(stderr, "%*c%s _tmp_59[%d-%d]: %s failed!\n", p->level, ' ',
  28258. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
  28259. }
  28260. { // ')'
  28261. if (p->error_indicator) {
  28262. p->level--;
  28263. return NULL;
  28264. }
  28265. D(fprintf(stderr, "%*c> _tmp_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
  28266. Token * _literal;
  28267. if (
  28268. (_literal = _PyPegen_expect_token(p, 8)) // token=')'
  28269. )
  28270. {
  28271. D(fprintf(stderr, "%*c+ _tmp_59[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
  28272. _res = _literal;
  28273. goto done;
  28274. }
  28275. p->mark = _mark;
  28276. D(fprintf(stderr, "%*c%s _tmp_59[%d-%d]: %s failed!\n", p->level, ' ',
  28277. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
  28278. }
  28279. { // ':'
  28280. if (p->error_indicator) {
  28281. p->level--;
  28282. return NULL;
  28283. }
  28284. D(fprintf(stderr, "%*c> _tmp_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
  28285. Token * _literal;
  28286. if (
  28287. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  28288. )
  28289. {
  28290. D(fprintf(stderr, "%*c+ _tmp_59[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
  28291. _res = _literal;
  28292. goto done;
  28293. }
  28294. p->mark = _mark;
  28295. D(fprintf(stderr, "%*c%s _tmp_59[%d-%d]: %s failed!\n", p->level, ' ',
  28296. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
  28297. }
  28298. _res = NULL;
  28299. done:
  28300. p->level--;
  28301. return _res;
  28302. }
  28303. // _loop1_60: except_block
  28304. static asdl_seq *
  28305. _loop1_60_rule(Parser *p)
  28306. {
  28307. if (p->level++ == MAXSTACK) {
  28308. _Pypegen_stack_overflow(p);
  28309. }
  28310. if (p->error_indicator) {
  28311. p->level--;
  28312. return NULL;
  28313. }
  28314. void *_res = NULL;
  28315. int _mark = p->mark;
  28316. void **_children = PyMem_Malloc(sizeof(void *));
  28317. if (!_children) {
  28318. p->error_indicator = 1;
  28319. PyErr_NoMemory();
  28320. p->level--;
  28321. return NULL;
  28322. }
  28323. Py_ssize_t _children_capacity = 1;
  28324. Py_ssize_t _n = 0;
  28325. { // except_block
  28326. if (p->error_indicator) {
  28327. p->level--;
  28328. return NULL;
  28329. }
  28330. D(fprintf(stderr, "%*c> _loop1_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block"));
  28331. excepthandler_ty except_block_var;
  28332. while (
  28333. (except_block_var = except_block_rule(p)) // except_block
  28334. )
  28335. {
  28336. _res = except_block_var;
  28337. if (_n == _children_capacity) {
  28338. _children_capacity *= 2;
  28339. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  28340. if (!_new_children) {
  28341. PyMem_Free(_children);
  28342. p->error_indicator = 1;
  28343. PyErr_NoMemory();
  28344. p->level--;
  28345. return NULL;
  28346. }
  28347. _children = _new_children;
  28348. }
  28349. _children[_n++] = _res;
  28350. _mark = p->mark;
  28351. }
  28352. p->mark = _mark;
  28353. D(fprintf(stderr, "%*c%s _loop1_60[%d-%d]: %s failed!\n", p->level, ' ',
  28354. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block"));
  28355. }
  28356. if (_n == 0 || p->error_indicator) {
  28357. PyMem_Free(_children);
  28358. p->level--;
  28359. return NULL;
  28360. }
  28361. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  28362. if (!_seq) {
  28363. PyMem_Free(_children);
  28364. p->error_indicator = 1;
  28365. PyErr_NoMemory();
  28366. p->level--;
  28367. return NULL;
  28368. }
  28369. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  28370. PyMem_Free(_children);
  28371. p->level--;
  28372. return _seq;
  28373. }
  28374. // _loop1_61: except_star_block
  28375. static asdl_seq *
  28376. _loop1_61_rule(Parser *p)
  28377. {
  28378. if (p->level++ == MAXSTACK) {
  28379. _Pypegen_stack_overflow(p);
  28380. }
  28381. if (p->error_indicator) {
  28382. p->level--;
  28383. return NULL;
  28384. }
  28385. void *_res = NULL;
  28386. int _mark = p->mark;
  28387. void **_children = PyMem_Malloc(sizeof(void *));
  28388. if (!_children) {
  28389. p->error_indicator = 1;
  28390. PyErr_NoMemory();
  28391. p->level--;
  28392. return NULL;
  28393. }
  28394. Py_ssize_t _children_capacity = 1;
  28395. Py_ssize_t _n = 0;
  28396. { // except_star_block
  28397. if (p->error_indicator) {
  28398. p->level--;
  28399. return NULL;
  28400. }
  28401. D(fprintf(stderr, "%*c> _loop1_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_star_block"));
  28402. excepthandler_ty except_star_block_var;
  28403. while (
  28404. (except_star_block_var = except_star_block_rule(p)) // except_star_block
  28405. )
  28406. {
  28407. _res = except_star_block_var;
  28408. if (_n == _children_capacity) {
  28409. _children_capacity *= 2;
  28410. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  28411. if (!_new_children) {
  28412. PyMem_Free(_children);
  28413. p->error_indicator = 1;
  28414. PyErr_NoMemory();
  28415. p->level--;
  28416. return NULL;
  28417. }
  28418. _children = _new_children;
  28419. }
  28420. _children[_n++] = _res;
  28421. _mark = p->mark;
  28422. }
  28423. p->mark = _mark;
  28424. D(fprintf(stderr, "%*c%s _loop1_61[%d-%d]: %s failed!\n", p->level, ' ',
  28425. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_star_block"));
  28426. }
  28427. if (_n == 0 || p->error_indicator) {
  28428. PyMem_Free(_children);
  28429. p->level--;
  28430. return NULL;
  28431. }
  28432. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  28433. if (!_seq) {
  28434. PyMem_Free(_children);
  28435. p->error_indicator = 1;
  28436. PyErr_NoMemory();
  28437. p->level--;
  28438. return NULL;
  28439. }
  28440. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  28441. PyMem_Free(_children);
  28442. p->level--;
  28443. return _seq;
  28444. }
  28445. // _tmp_62: 'as' NAME
  28446. static void *
  28447. _tmp_62_rule(Parser *p)
  28448. {
  28449. if (p->level++ == MAXSTACK) {
  28450. _Pypegen_stack_overflow(p);
  28451. }
  28452. if (p->error_indicator) {
  28453. p->level--;
  28454. return NULL;
  28455. }
  28456. void * _res = NULL;
  28457. int _mark = p->mark;
  28458. { // 'as' NAME
  28459. if (p->error_indicator) {
  28460. p->level--;
  28461. return NULL;
  28462. }
  28463. D(fprintf(stderr, "%*c> _tmp_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  28464. Token * _keyword;
  28465. expr_ty z;
  28466. if (
  28467. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  28468. &&
  28469. (z = _PyPegen_name_token(p)) // NAME
  28470. )
  28471. {
  28472. D(fprintf(stderr, "%*c+ _tmp_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  28473. _res = z;
  28474. if (_res == NULL && PyErr_Occurred()) {
  28475. p->error_indicator = 1;
  28476. p->level--;
  28477. return NULL;
  28478. }
  28479. goto done;
  28480. }
  28481. p->mark = _mark;
  28482. D(fprintf(stderr, "%*c%s _tmp_62[%d-%d]: %s failed!\n", p->level, ' ',
  28483. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
  28484. }
  28485. _res = NULL;
  28486. done:
  28487. p->level--;
  28488. return _res;
  28489. }
  28490. // _tmp_63: 'as' NAME
  28491. static void *
  28492. _tmp_63_rule(Parser *p)
  28493. {
  28494. if (p->level++ == MAXSTACK) {
  28495. _Pypegen_stack_overflow(p);
  28496. }
  28497. if (p->error_indicator) {
  28498. p->level--;
  28499. return NULL;
  28500. }
  28501. void * _res = NULL;
  28502. int _mark = p->mark;
  28503. { // 'as' NAME
  28504. if (p->error_indicator) {
  28505. p->level--;
  28506. return NULL;
  28507. }
  28508. D(fprintf(stderr, "%*c> _tmp_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  28509. Token * _keyword;
  28510. expr_ty z;
  28511. if (
  28512. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  28513. &&
  28514. (z = _PyPegen_name_token(p)) // NAME
  28515. )
  28516. {
  28517. D(fprintf(stderr, "%*c+ _tmp_63[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  28518. _res = z;
  28519. if (_res == NULL && PyErr_Occurred()) {
  28520. p->error_indicator = 1;
  28521. p->level--;
  28522. return NULL;
  28523. }
  28524. goto done;
  28525. }
  28526. p->mark = _mark;
  28527. D(fprintf(stderr, "%*c%s _tmp_63[%d-%d]: %s failed!\n", p->level, ' ',
  28528. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
  28529. }
  28530. _res = NULL;
  28531. done:
  28532. p->level--;
  28533. return _res;
  28534. }
  28535. // _loop1_64: case_block
  28536. static asdl_seq *
  28537. _loop1_64_rule(Parser *p)
  28538. {
  28539. if (p->level++ == MAXSTACK) {
  28540. _Pypegen_stack_overflow(p);
  28541. }
  28542. if (p->error_indicator) {
  28543. p->level--;
  28544. return NULL;
  28545. }
  28546. void *_res = NULL;
  28547. int _mark = p->mark;
  28548. void **_children = PyMem_Malloc(sizeof(void *));
  28549. if (!_children) {
  28550. p->error_indicator = 1;
  28551. PyErr_NoMemory();
  28552. p->level--;
  28553. return NULL;
  28554. }
  28555. Py_ssize_t _children_capacity = 1;
  28556. Py_ssize_t _n = 0;
  28557. { // case_block
  28558. if (p->error_indicator) {
  28559. p->level--;
  28560. return NULL;
  28561. }
  28562. D(fprintf(stderr, "%*c> _loop1_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "case_block"));
  28563. match_case_ty case_block_var;
  28564. while (
  28565. (case_block_var = case_block_rule(p)) // case_block
  28566. )
  28567. {
  28568. _res = case_block_var;
  28569. if (_n == _children_capacity) {
  28570. _children_capacity *= 2;
  28571. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  28572. if (!_new_children) {
  28573. PyMem_Free(_children);
  28574. p->error_indicator = 1;
  28575. PyErr_NoMemory();
  28576. p->level--;
  28577. return NULL;
  28578. }
  28579. _children = _new_children;
  28580. }
  28581. _children[_n++] = _res;
  28582. _mark = p->mark;
  28583. }
  28584. p->mark = _mark;
  28585. D(fprintf(stderr, "%*c%s _loop1_64[%d-%d]: %s failed!\n", p->level, ' ',
  28586. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "case_block"));
  28587. }
  28588. if (_n == 0 || p->error_indicator) {
  28589. PyMem_Free(_children);
  28590. p->level--;
  28591. return NULL;
  28592. }
  28593. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  28594. if (!_seq) {
  28595. PyMem_Free(_children);
  28596. p->error_indicator = 1;
  28597. PyErr_NoMemory();
  28598. p->level--;
  28599. return NULL;
  28600. }
  28601. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  28602. PyMem_Free(_children);
  28603. p->level--;
  28604. return _seq;
  28605. }
  28606. // _loop0_66: '|' closed_pattern
  28607. static asdl_seq *
  28608. _loop0_66_rule(Parser *p)
  28609. {
  28610. if (p->level++ == MAXSTACK) {
  28611. _Pypegen_stack_overflow(p);
  28612. }
  28613. if (p->error_indicator) {
  28614. p->level--;
  28615. return NULL;
  28616. }
  28617. void *_res = NULL;
  28618. int _mark = p->mark;
  28619. void **_children = PyMem_Malloc(sizeof(void *));
  28620. if (!_children) {
  28621. p->error_indicator = 1;
  28622. PyErr_NoMemory();
  28623. p->level--;
  28624. return NULL;
  28625. }
  28626. Py_ssize_t _children_capacity = 1;
  28627. Py_ssize_t _n = 0;
  28628. { // '|' closed_pattern
  28629. if (p->error_indicator) {
  28630. p->level--;
  28631. return NULL;
  28632. }
  28633. D(fprintf(stderr, "%*c> _loop0_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|' closed_pattern"));
  28634. Token * _literal;
  28635. pattern_ty elem;
  28636. while (
  28637. (_literal = _PyPegen_expect_token(p, 18)) // token='|'
  28638. &&
  28639. (elem = closed_pattern_rule(p)) // closed_pattern
  28640. )
  28641. {
  28642. _res = elem;
  28643. if (_res == NULL && PyErr_Occurred()) {
  28644. p->error_indicator = 1;
  28645. PyMem_Free(_children);
  28646. p->level--;
  28647. return NULL;
  28648. }
  28649. if (_n == _children_capacity) {
  28650. _children_capacity *= 2;
  28651. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  28652. if (!_new_children) {
  28653. PyMem_Free(_children);
  28654. p->error_indicator = 1;
  28655. PyErr_NoMemory();
  28656. p->level--;
  28657. return NULL;
  28658. }
  28659. _children = _new_children;
  28660. }
  28661. _children[_n++] = _res;
  28662. _mark = p->mark;
  28663. }
  28664. p->mark = _mark;
  28665. D(fprintf(stderr, "%*c%s _loop0_66[%d-%d]: %s failed!\n", p->level, ' ',
  28666. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|' closed_pattern"));
  28667. }
  28668. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  28669. if (!_seq) {
  28670. PyMem_Free(_children);
  28671. p->error_indicator = 1;
  28672. PyErr_NoMemory();
  28673. p->level--;
  28674. return NULL;
  28675. }
  28676. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  28677. PyMem_Free(_children);
  28678. p->level--;
  28679. return _seq;
  28680. }
  28681. // _gather_65: closed_pattern _loop0_66
  28682. static asdl_seq *
  28683. _gather_65_rule(Parser *p)
  28684. {
  28685. if (p->level++ == MAXSTACK) {
  28686. _Pypegen_stack_overflow(p);
  28687. }
  28688. if (p->error_indicator) {
  28689. p->level--;
  28690. return NULL;
  28691. }
  28692. asdl_seq * _res = NULL;
  28693. int _mark = p->mark;
  28694. { // closed_pattern _loop0_66
  28695. if (p->error_indicator) {
  28696. p->level--;
  28697. return NULL;
  28698. }
  28699. D(fprintf(stderr, "%*c> _gather_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_66"));
  28700. pattern_ty elem;
  28701. asdl_seq * seq;
  28702. if (
  28703. (elem = closed_pattern_rule(p)) // closed_pattern
  28704. &&
  28705. (seq = _loop0_66_rule(p)) // _loop0_66
  28706. )
  28707. {
  28708. D(fprintf(stderr, "%*c+ _gather_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_66"));
  28709. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  28710. goto done;
  28711. }
  28712. p->mark = _mark;
  28713. D(fprintf(stderr, "%*c%s _gather_65[%d-%d]: %s failed!\n", p->level, ' ',
  28714. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "closed_pattern _loop0_66"));
  28715. }
  28716. _res = NULL;
  28717. done:
  28718. p->level--;
  28719. return _res;
  28720. }
  28721. // _tmp_67: '+' | '-'
  28722. static void *
  28723. _tmp_67_rule(Parser *p)
  28724. {
  28725. if (p->level++ == MAXSTACK) {
  28726. _Pypegen_stack_overflow(p);
  28727. }
  28728. if (p->error_indicator) {
  28729. p->level--;
  28730. return NULL;
  28731. }
  28732. void * _res = NULL;
  28733. int _mark = p->mark;
  28734. { // '+'
  28735. if (p->error_indicator) {
  28736. p->level--;
  28737. return NULL;
  28738. }
  28739. D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'"));
  28740. Token * _literal;
  28741. if (
  28742. (_literal = _PyPegen_expect_token(p, 14)) // token='+'
  28743. )
  28744. {
  28745. D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'"));
  28746. _res = _literal;
  28747. goto done;
  28748. }
  28749. p->mark = _mark;
  28750. D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ',
  28751. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'"));
  28752. }
  28753. { // '-'
  28754. if (p->error_indicator) {
  28755. p->level--;
  28756. return NULL;
  28757. }
  28758. D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'"));
  28759. Token * _literal;
  28760. if (
  28761. (_literal = _PyPegen_expect_token(p, 15)) // token='-'
  28762. )
  28763. {
  28764. D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'"));
  28765. _res = _literal;
  28766. goto done;
  28767. }
  28768. p->mark = _mark;
  28769. D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ',
  28770. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'"));
  28771. }
  28772. _res = NULL;
  28773. done:
  28774. p->level--;
  28775. return _res;
  28776. }
  28777. // _tmp_68: '+' | '-'
  28778. static void *
  28779. _tmp_68_rule(Parser *p)
  28780. {
  28781. if (p->level++ == MAXSTACK) {
  28782. _Pypegen_stack_overflow(p);
  28783. }
  28784. if (p->error_indicator) {
  28785. p->level--;
  28786. return NULL;
  28787. }
  28788. void * _res = NULL;
  28789. int _mark = p->mark;
  28790. { // '+'
  28791. if (p->error_indicator) {
  28792. p->level--;
  28793. return NULL;
  28794. }
  28795. D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'"));
  28796. Token * _literal;
  28797. if (
  28798. (_literal = _PyPegen_expect_token(p, 14)) // token='+'
  28799. )
  28800. {
  28801. D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'"));
  28802. _res = _literal;
  28803. goto done;
  28804. }
  28805. p->mark = _mark;
  28806. D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ',
  28807. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'"));
  28808. }
  28809. { // '-'
  28810. if (p->error_indicator) {
  28811. p->level--;
  28812. return NULL;
  28813. }
  28814. D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'"));
  28815. Token * _literal;
  28816. if (
  28817. (_literal = _PyPegen_expect_token(p, 15)) // token='-'
  28818. )
  28819. {
  28820. D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'"));
  28821. _res = _literal;
  28822. goto done;
  28823. }
  28824. p->mark = _mark;
  28825. D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ',
  28826. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'"));
  28827. }
  28828. _res = NULL;
  28829. done:
  28830. p->level--;
  28831. return _res;
  28832. }
  28833. // _tmp_69: '.' | '(' | '='
  28834. static void *
  28835. _tmp_69_rule(Parser *p)
  28836. {
  28837. if (p->level++ == MAXSTACK) {
  28838. _Pypegen_stack_overflow(p);
  28839. }
  28840. if (p->error_indicator) {
  28841. p->level--;
  28842. return NULL;
  28843. }
  28844. void * _res = NULL;
  28845. int _mark = p->mark;
  28846. { // '.'
  28847. if (p->error_indicator) {
  28848. p->level--;
  28849. return NULL;
  28850. }
  28851. D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
  28852. Token * _literal;
  28853. if (
  28854. (_literal = _PyPegen_expect_token(p, 23)) // token='.'
  28855. )
  28856. {
  28857. D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
  28858. _res = _literal;
  28859. goto done;
  28860. }
  28861. p->mark = _mark;
  28862. D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
  28863. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
  28864. }
  28865. { // '('
  28866. if (p->error_indicator) {
  28867. p->level--;
  28868. return NULL;
  28869. }
  28870. D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
  28871. Token * _literal;
  28872. if (
  28873. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  28874. )
  28875. {
  28876. D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
  28877. _res = _literal;
  28878. goto done;
  28879. }
  28880. p->mark = _mark;
  28881. D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
  28882. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
  28883. }
  28884. { // '='
  28885. if (p->error_indicator) {
  28886. p->level--;
  28887. return NULL;
  28888. }
  28889. D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='"));
  28890. Token * _literal;
  28891. if (
  28892. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  28893. )
  28894. {
  28895. D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='"));
  28896. _res = _literal;
  28897. goto done;
  28898. }
  28899. p->mark = _mark;
  28900. D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
  28901. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='"));
  28902. }
  28903. _res = NULL;
  28904. done:
  28905. p->level--;
  28906. return _res;
  28907. }
  28908. // _tmp_70: '.' | '(' | '='
  28909. static void *
  28910. _tmp_70_rule(Parser *p)
  28911. {
  28912. if (p->level++ == MAXSTACK) {
  28913. _Pypegen_stack_overflow(p);
  28914. }
  28915. if (p->error_indicator) {
  28916. p->level--;
  28917. return NULL;
  28918. }
  28919. void * _res = NULL;
  28920. int _mark = p->mark;
  28921. { // '.'
  28922. if (p->error_indicator) {
  28923. p->level--;
  28924. return NULL;
  28925. }
  28926. D(fprintf(stderr, "%*c> _tmp_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
  28927. Token * _literal;
  28928. if (
  28929. (_literal = _PyPegen_expect_token(p, 23)) // token='.'
  28930. )
  28931. {
  28932. D(fprintf(stderr, "%*c+ _tmp_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
  28933. _res = _literal;
  28934. goto done;
  28935. }
  28936. p->mark = _mark;
  28937. D(fprintf(stderr, "%*c%s _tmp_70[%d-%d]: %s failed!\n", p->level, ' ',
  28938. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
  28939. }
  28940. { // '('
  28941. if (p->error_indicator) {
  28942. p->level--;
  28943. return NULL;
  28944. }
  28945. D(fprintf(stderr, "%*c> _tmp_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
  28946. Token * _literal;
  28947. if (
  28948. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  28949. )
  28950. {
  28951. D(fprintf(stderr, "%*c+ _tmp_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
  28952. _res = _literal;
  28953. goto done;
  28954. }
  28955. p->mark = _mark;
  28956. D(fprintf(stderr, "%*c%s _tmp_70[%d-%d]: %s failed!\n", p->level, ' ',
  28957. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
  28958. }
  28959. { // '='
  28960. if (p->error_indicator) {
  28961. p->level--;
  28962. return NULL;
  28963. }
  28964. D(fprintf(stderr, "%*c> _tmp_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='"));
  28965. Token * _literal;
  28966. if (
  28967. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  28968. )
  28969. {
  28970. D(fprintf(stderr, "%*c+ _tmp_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='"));
  28971. _res = _literal;
  28972. goto done;
  28973. }
  28974. p->mark = _mark;
  28975. D(fprintf(stderr, "%*c%s _tmp_70[%d-%d]: %s failed!\n", p->level, ' ',
  28976. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='"));
  28977. }
  28978. _res = NULL;
  28979. done:
  28980. p->level--;
  28981. return _res;
  28982. }
  28983. // _loop0_72: ',' maybe_star_pattern
  28984. static asdl_seq *
  28985. _loop0_72_rule(Parser *p)
  28986. {
  28987. if (p->level++ == MAXSTACK) {
  28988. _Pypegen_stack_overflow(p);
  28989. }
  28990. if (p->error_indicator) {
  28991. p->level--;
  28992. return NULL;
  28993. }
  28994. void *_res = NULL;
  28995. int _mark = p->mark;
  28996. void **_children = PyMem_Malloc(sizeof(void *));
  28997. if (!_children) {
  28998. p->error_indicator = 1;
  28999. PyErr_NoMemory();
  29000. p->level--;
  29001. return NULL;
  29002. }
  29003. Py_ssize_t _children_capacity = 1;
  29004. Py_ssize_t _n = 0;
  29005. { // ',' maybe_star_pattern
  29006. if (p->error_indicator) {
  29007. p->level--;
  29008. return NULL;
  29009. }
  29010. D(fprintf(stderr, "%*c> _loop0_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' maybe_star_pattern"));
  29011. Token * _literal;
  29012. pattern_ty elem;
  29013. while (
  29014. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  29015. &&
  29016. (elem = maybe_star_pattern_rule(p)) // maybe_star_pattern
  29017. )
  29018. {
  29019. _res = elem;
  29020. if (_res == NULL && PyErr_Occurred()) {
  29021. p->error_indicator = 1;
  29022. PyMem_Free(_children);
  29023. p->level--;
  29024. return NULL;
  29025. }
  29026. if (_n == _children_capacity) {
  29027. _children_capacity *= 2;
  29028. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  29029. if (!_new_children) {
  29030. PyMem_Free(_children);
  29031. p->error_indicator = 1;
  29032. PyErr_NoMemory();
  29033. p->level--;
  29034. return NULL;
  29035. }
  29036. _children = _new_children;
  29037. }
  29038. _children[_n++] = _res;
  29039. _mark = p->mark;
  29040. }
  29041. p->mark = _mark;
  29042. D(fprintf(stderr, "%*c%s _loop0_72[%d-%d]: %s failed!\n", p->level, ' ',
  29043. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' maybe_star_pattern"));
  29044. }
  29045. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  29046. if (!_seq) {
  29047. PyMem_Free(_children);
  29048. p->error_indicator = 1;
  29049. PyErr_NoMemory();
  29050. p->level--;
  29051. return NULL;
  29052. }
  29053. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  29054. PyMem_Free(_children);
  29055. p->level--;
  29056. return _seq;
  29057. }
  29058. // _gather_71: maybe_star_pattern _loop0_72
  29059. static asdl_seq *
  29060. _gather_71_rule(Parser *p)
  29061. {
  29062. if (p->level++ == MAXSTACK) {
  29063. _Pypegen_stack_overflow(p);
  29064. }
  29065. if (p->error_indicator) {
  29066. p->level--;
  29067. return NULL;
  29068. }
  29069. asdl_seq * _res = NULL;
  29070. int _mark = p->mark;
  29071. { // maybe_star_pattern _loop0_72
  29072. if (p->error_indicator) {
  29073. p->level--;
  29074. return NULL;
  29075. }
  29076. D(fprintf(stderr, "%*c> _gather_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_72"));
  29077. pattern_ty elem;
  29078. asdl_seq * seq;
  29079. if (
  29080. (elem = maybe_star_pattern_rule(p)) // maybe_star_pattern
  29081. &&
  29082. (seq = _loop0_72_rule(p)) // _loop0_72
  29083. )
  29084. {
  29085. D(fprintf(stderr, "%*c+ _gather_71[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_72"));
  29086. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  29087. goto done;
  29088. }
  29089. p->mark = _mark;
  29090. D(fprintf(stderr, "%*c%s _gather_71[%d-%d]: %s failed!\n", p->level, ' ',
  29091. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "maybe_star_pattern _loop0_72"));
  29092. }
  29093. _res = NULL;
  29094. done:
  29095. p->level--;
  29096. return _res;
  29097. }
  29098. // _loop0_74: ',' key_value_pattern
  29099. static asdl_seq *
  29100. _loop0_74_rule(Parser *p)
  29101. {
  29102. if (p->level++ == MAXSTACK) {
  29103. _Pypegen_stack_overflow(p);
  29104. }
  29105. if (p->error_indicator) {
  29106. p->level--;
  29107. return NULL;
  29108. }
  29109. void *_res = NULL;
  29110. int _mark = p->mark;
  29111. void **_children = PyMem_Malloc(sizeof(void *));
  29112. if (!_children) {
  29113. p->error_indicator = 1;
  29114. PyErr_NoMemory();
  29115. p->level--;
  29116. return NULL;
  29117. }
  29118. Py_ssize_t _children_capacity = 1;
  29119. Py_ssize_t _n = 0;
  29120. { // ',' key_value_pattern
  29121. if (p->error_indicator) {
  29122. p->level--;
  29123. return NULL;
  29124. }
  29125. D(fprintf(stderr, "%*c> _loop0_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern"));
  29126. Token * _literal;
  29127. KeyPatternPair* elem;
  29128. while (
  29129. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  29130. &&
  29131. (elem = key_value_pattern_rule(p)) // key_value_pattern
  29132. )
  29133. {
  29134. _res = elem;
  29135. if (_res == NULL && PyErr_Occurred()) {
  29136. p->error_indicator = 1;
  29137. PyMem_Free(_children);
  29138. p->level--;
  29139. return NULL;
  29140. }
  29141. if (_n == _children_capacity) {
  29142. _children_capacity *= 2;
  29143. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  29144. if (!_new_children) {
  29145. PyMem_Free(_children);
  29146. p->error_indicator = 1;
  29147. PyErr_NoMemory();
  29148. p->level--;
  29149. return NULL;
  29150. }
  29151. _children = _new_children;
  29152. }
  29153. _children[_n++] = _res;
  29154. _mark = p->mark;
  29155. }
  29156. p->mark = _mark;
  29157. D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ',
  29158. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' key_value_pattern"));
  29159. }
  29160. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  29161. if (!_seq) {
  29162. PyMem_Free(_children);
  29163. p->error_indicator = 1;
  29164. PyErr_NoMemory();
  29165. p->level--;
  29166. return NULL;
  29167. }
  29168. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  29169. PyMem_Free(_children);
  29170. p->level--;
  29171. return _seq;
  29172. }
  29173. // _gather_73: key_value_pattern _loop0_74
  29174. static asdl_seq *
  29175. _gather_73_rule(Parser *p)
  29176. {
  29177. if (p->level++ == MAXSTACK) {
  29178. _Pypegen_stack_overflow(p);
  29179. }
  29180. if (p->error_indicator) {
  29181. p->level--;
  29182. return NULL;
  29183. }
  29184. asdl_seq * _res = NULL;
  29185. int _mark = p->mark;
  29186. { // key_value_pattern _loop0_74
  29187. if (p->error_indicator) {
  29188. p->level--;
  29189. return NULL;
  29190. }
  29191. D(fprintf(stderr, "%*c> _gather_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_74"));
  29192. KeyPatternPair* elem;
  29193. asdl_seq * seq;
  29194. if (
  29195. (elem = key_value_pattern_rule(p)) // key_value_pattern
  29196. &&
  29197. (seq = _loop0_74_rule(p)) // _loop0_74
  29198. )
  29199. {
  29200. D(fprintf(stderr, "%*c+ _gather_73[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_74"));
  29201. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  29202. goto done;
  29203. }
  29204. p->mark = _mark;
  29205. D(fprintf(stderr, "%*c%s _gather_73[%d-%d]: %s failed!\n", p->level, ' ',
  29206. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_74"));
  29207. }
  29208. _res = NULL;
  29209. done:
  29210. p->level--;
  29211. return _res;
  29212. }
  29213. // _tmp_75: literal_expr | attr
  29214. static void *
  29215. _tmp_75_rule(Parser *p)
  29216. {
  29217. if (p->level++ == MAXSTACK) {
  29218. _Pypegen_stack_overflow(p);
  29219. }
  29220. if (p->error_indicator) {
  29221. p->level--;
  29222. return NULL;
  29223. }
  29224. void * _res = NULL;
  29225. int _mark = p->mark;
  29226. { // literal_expr
  29227. if (p->error_indicator) {
  29228. p->level--;
  29229. return NULL;
  29230. }
  29231. D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_expr"));
  29232. expr_ty literal_expr_var;
  29233. if (
  29234. (literal_expr_var = literal_expr_rule(p)) // literal_expr
  29235. )
  29236. {
  29237. D(fprintf(stderr, "%*c+ _tmp_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_expr"));
  29238. _res = literal_expr_var;
  29239. goto done;
  29240. }
  29241. p->mark = _mark;
  29242. D(fprintf(stderr, "%*c%s _tmp_75[%d-%d]: %s failed!\n", p->level, ' ',
  29243. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_expr"));
  29244. }
  29245. { // attr
  29246. if (p->error_indicator) {
  29247. p->level--;
  29248. return NULL;
  29249. }
  29250. D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr"));
  29251. expr_ty attr_var;
  29252. if (
  29253. (attr_var = attr_rule(p)) // attr
  29254. )
  29255. {
  29256. D(fprintf(stderr, "%*c+ _tmp_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr"));
  29257. _res = attr_var;
  29258. goto done;
  29259. }
  29260. p->mark = _mark;
  29261. D(fprintf(stderr, "%*c%s _tmp_75[%d-%d]: %s failed!\n", p->level, ' ',
  29262. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr"));
  29263. }
  29264. _res = NULL;
  29265. done:
  29266. p->level--;
  29267. return _res;
  29268. }
  29269. // _loop0_77: ',' pattern
  29270. static asdl_seq *
  29271. _loop0_77_rule(Parser *p)
  29272. {
  29273. if (p->level++ == MAXSTACK) {
  29274. _Pypegen_stack_overflow(p);
  29275. }
  29276. if (p->error_indicator) {
  29277. p->level--;
  29278. return NULL;
  29279. }
  29280. void *_res = NULL;
  29281. int _mark = p->mark;
  29282. void **_children = PyMem_Malloc(sizeof(void *));
  29283. if (!_children) {
  29284. p->error_indicator = 1;
  29285. PyErr_NoMemory();
  29286. p->level--;
  29287. return NULL;
  29288. }
  29289. Py_ssize_t _children_capacity = 1;
  29290. Py_ssize_t _n = 0;
  29291. { // ',' pattern
  29292. if (p->error_indicator) {
  29293. p->level--;
  29294. return NULL;
  29295. }
  29296. D(fprintf(stderr, "%*c> _loop0_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern"));
  29297. Token * _literal;
  29298. pattern_ty elem;
  29299. while (
  29300. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  29301. &&
  29302. (elem = pattern_rule(p)) // pattern
  29303. )
  29304. {
  29305. _res = elem;
  29306. if (_res == NULL && PyErr_Occurred()) {
  29307. p->error_indicator = 1;
  29308. PyMem_Free(_children);
  29309. p->level--;
  29310. return NULL;
  29311. }
  29312. if (_n == _children_capacity) {
  29313. _children_capacity *= 2;
  29314. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  29315. if (!_new_children) {
  29316. PyMem_Free(_children);
  29317. p->error_indicator = 1;
  29318. PyErr_NoMemory();
  29319. p->level--;
  29320. return NULL;
  29321. }
  29322. _children = _new_children;
  29323. }
  29324. _children[_n++] = _res;
  29325. _mark = p->mark;
  29326. }
  29327. p->mark = _mark;
  29328. D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ',
  29329. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern"));
  29330. }
  29331. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  29332. if (!_seq) {
  29333. PyMem_Free(_children);
  29334. p->error_indicator = 1;
  29335. PyErr_NoMemory();
  29336. p->level--;
  29337. return NULL;
  29338. }
  29339. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  29340. PyMem_Free(_children);
  29341. p->level--;
  29342. return _seq;
  29343. }
  29344. // _gather_76: pattern _loop0_77
  29345. static asdl_seq *
  29346. _gather_76_rule(Parser *p)
  29347. {
  29348. if (p->level++ == MAXSTACK) {
  29349. _Pypegen_stack_overflow(p);
  29350. }
  29351. if (p->error_indicator) {
  29352. p->level--;
  29353. return NULL;
  29354. }
  29355. asdl_seq * _res = NULL;
  29356. int _mark = p->mark;
  29357. { // pattern _loop0_77
  29358. if (p->error_indicator) {
  29359. p->level--;
  29360. return NULL;
  29361. }
  29362. D(fprintf(stderr, "%*c> _gather_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_77"));
  29363. pattern_ty elem;
  29364. asdl_seq * seq;
  29365. if (
  29366. (elem = pattern_rule(p)) // pattern
  29367. &&
  29368. (seq = _loop0_77_rule(p)) // _loop0_77
  29369. )
  29370. {
  29371. D(fprintf(stderr, "%*c+ _gather_76[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_77"));
  29372. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  29373. goto done;
  29374. }
  29375. p->mark = _mark;
  29376. D(fprintf(stderr, "%*c%s _gather_76[%d-%d]: %s failed!\n", p->level, ' ',
  29377. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_77"));
  29378. }
  29379. _res = NULL;
  29380. done:
  29381. p->level--;
  29382. return _res;
  29383. }
  29384. // _loop0_79: ',' keyword_pattern
  29385. static asdl_seq *
  29386. _loop0_79_rule(Parser *p)
  29387. {
  29388. if (p->level++ == MAXSTACK) {
  29389. _Pypegen_stack_overflow(p);
  29390. }
  29391. if (p->error_indicator) {
  29392. p->level--;
  29393. return NULL;
  29394. }
  29395. void *_res = NULL;
  29396. int _mark = p->mark;
  29397. void **_children = PyMem_Malloc(sizeof(void *));
  29398. if (!_children) {
  29399. p->error_indicator = 1;
  29400. PyErr_NoMemory();
  29401. p->level--;
  29402. return NULL;
  29403. }
  29404. Py_ssize_t _children_capacity = 1;
  29405. Py_ssize_t _n = 0;
  29406. { // ',' keyword_pattern
  29407. if (p->error_indicator) {
  29408. p->level--;
  29409. return NULL;
  29410. }
  29411. D(fprintf(stderr, "%*c> _loop0_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern"));
  29412. Token * _literal;
  29413. KeyPatternPair* elem;
  29414. while (
  29415. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  29416. &&
  29417. (elem = keyword_pattern_rule(p)) // keyword_pattern
  29418. )
  29419. {
  29420. _res = elem;
  29421. if (_res == NULL && PyErr_Occurred()) {
  29422. p->error_indicator = 1;
  29423. PyMem_Free(_children);
  29424. p->level--;
  29425. return NULL;
  29426. }
  29427. if (_n == _children_capacity) {
  29428. _children_capacity *= 2;
  29429. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  29430. if (!_new_children) {
  29431. PyMem_Free(_children);
  29432. p->error_indicator = 1;
  29433. PyErr_NoMemory();
  29434. p->level--;
  29435. return NULL;
  29436. }
  29437. _children = _new_children;
  29438. }
  29439. _children[_n++] = _res;
  29440. _mark = p->mark;
  29441. }
  29442. p->mark = _mark;
  29443. D(fprintf(stderr, "%*c%s _loop0_79[%d-%d]: %s failed!\n", p->level, ' ',
  29444. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern"));
  29445. }
  29446. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  29447. if (!_seq) {
  29448. PyMem_Free(_children);
  29449. p->error_indicator = 1;
  29450. PyErr_NoMemory();
  29451. p->level--;
  29452. return NULL;
  29453. }
  29454. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  29455. PyMem_Free(_children);
  29456. p->level--;
  29457. return _seq;
  29458. }
  29459. // _gather_78: keyword_pattern _loop0_79
  29460. static asdl_seq *
  29461. _gather_78_rule(Parser *p)
  29462. {
  29463. if (p->level++ == MAXSTACK) {
  29464. _Pypegen_stack_overflow(p);
  29465. }
  29466. if (p->error_indicator) {
  29467. p->level--;
  29468. return NULL;
  29469. }
  29470. asdl_seq * _res = NULL;
  29471. int _mark = p->mark;
  29472. { // keyword_pattern _loop0_79
  29473. if (p->error_indicator) {
  29474. p->level--;
  29475. return NULL;
  29476. }
  29477. D(fprintf(stderr, "%*c> _gather_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_79"));
  29478. KeyPatternPair* elem;
  29479. asdl_seq * seq;
  29480. if (
  29481. (elem = keyword_pattern_rule(p)) // keyword_pattern
  29482. &&
  29483. (seq = _loop0_79_rule(p)) // _loop0_79
  29484. )
  29485. {
  29486. D(fprintf(stderr, "%*c+ _gather_78[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_79"));
  29487. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  29488. goto done;
  29489. }
  29490. p->mark = _mark;
  29491. D(fprintf(stderr, "%*c%s _gather_78[%d-%d]: %s failed!\n", p->level, ' ',
  29492. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_79"));
  29493. }
  29494. _res = NULL;
  29495. done:
  29496. p->level--;
  29497. return _res;
  29498. }
  29499. // _loop0_81: ',' type_param
  29500. static asdl_seq *
  29501. _loop0_81_rule(Parser *p)
  29502. {
  29503. if (p->level++ == MAXSTACK) {
  29504. _Pypegen_stack_overflow(p);
  29505. }
  29506. if (p->error_indicator) {
  29507. p->level--;
  29508. return NULL;
  29509. }
  29510. void *_res = NULL;
  29511. int _mark = p->mark;
  29512. void **_children = PyMem_Malloc(sizeof(void *));
  29513. if (!_children) {
  29514. p->error_indicator = 1;
  29515. PyErr_NoMemory();
  29516. p->level--;
  29517. return NULL;
  29518. }
  29519. Py_ssize_t _children_capacity = 1;
  29520. Py_ssize_t _n = 0;
  29521. { // ',' type_param
  29522. if (p->error_indicator) {
  29523. p->level--;
  29524. return NULL;
  29525. }
  29526. D(fprintf(stderr, "%*c> _loop0_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' type_param"));
  29527. Token * _literal;
  29528. type_param_ty elem;
  29529. while (
  29530. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  29531. &&
  29532. (elem = type_param_rule(p)) // type_param
  29533. )
  29534. {
  29535. _res = elem;
  29536. if (_res == NULL && PyErr_Occurred()) {
  29537. p->error_indicator = 1;
  29538. PyMem_Free(_children);
  29539. p->level--;
  29540. return NULL;
  29541. }
  29542. if (_n == _children_capacity) {
  29543. _children_capacity *= 2;
  29544. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  29545. if (!_new_children) {
  29546. PyMem_Free(_children);
  29547. p->error_indicator = 1;
  29548. PyErr_NoMemory();
  29549. p->level--;
  29550. return NULL;
  29551. }
  29552. _children = _new_children;
  29553. }
  29554. _children[_n++] = _res;
  29555. _mark = p->mark;
  29556. }
  29557. p->mark = _mark;
  29558. D(fprintf(stderr, "%*c%s _loop0_81[%d-%d]: %s failed!\n", p->level, ' ',
  29559. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' type_param"));
  29560. }
  29561. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  29562. if (!_seq) {
  29563. PyMem_Free(_children);
  29564. p->error_indicator = 1;
  29565. PyErr_NoMemory();
  29566. p->level--;
  29567. return NULL;
  29568. }
  29569. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  29570. PyMem_Free(_children);
  29571. p->level--;
  29572. return _seq;
  29573. }
  29574. // _gather_80: type_param _loop0_81
  29575. static asdl_seq *
  29576. _gather_80_rule(Parser *p)
  29577. {
  29578. if (p->level++ == MAXSTACK) {
  29579. _Pypegen_stack_overflow(p);
  29580. }
  29581. if (p->error_indicator) {
  29582. p->level--;
  29583. return NULL;
  29584. }
  29585. asdl_seq * _res = NULL;
  29586. int _mark = p->mark;
  29587. { // type_param _loop0_81
  29588. if (p->error_indicator) {
  29589. p->level--;
  29590. return NULL;
  29591. }
  29592. D(fprintf(stderr, "%*c> _gather_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "type_param _loop0_81"));
  29593. type_param_ty elem;
  29594. asdl_seq * seq;
  29595. if (
  29596. (elem = type_param_rule(p)) // type_param
  29597. &&
  29598. (seq = _loop0_81_rule(p)) // _loop0_81
  29599. )
  29600. {
  29601. D(fprintf(stderr, "%*c+ _gather_80[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "type_param _loop0_81"));
  29602. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  29603. goto done;
  29604. }
  29605. p->mark = _mark;
  29606. D(fprintf(stderr, "%*c%s _gather_80[%d-%d]: %s failed!\n", p->level, ' ',
  29607. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "type_param _loop0_81"));
  29608. }
  29609. _res = NULL;
  29610. done:
  29611. p->level--;
  29612. return _res;
  29613. }
  29614. // _loop1_82: (',' expression)
  29615. static asdl_seq *
  29616. _loop1_82_rule(Parser *p)
  29617. {
  29618. if (p->level++ == MAXSTACK) {
  29619. _Pypegen_stack_overflow(p);
  29620. }
  29621. if (p->error_indicator) {
  29622. p->level--;
  29623. return NULL;
  29624. }
  29625. void *_res = NULL;
  29626. int _mark = p->mark;
  29627. void **_children = PyMem_Malloc(sizeof(void *));
  29628. if (!_children) {
  29629. p->error_indicator = 1;
  29630. PyErr_NoMemory();
  29631. p->level--;
  29632. return NULL;
  29633. }
  29634. Py_ssize_t _children_capacity = 1;
  29635. Py_ssize_t _n = 0;
  29636. { // (',' expression)
  29637. if (p->error_indicator) {
  29638. p->level--;
  29639. return NULL;
  29640. }
  29641. D(fprintf(stderr, "%*c> _loop1_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)"));
  29642. void *_tmp_254_var;
  29643. while (
  29644. (_tmp_254_var = _tmp_254_rule(p)) // ',' expression
  29645. )
  29646. {
  29647. _res = _tmp_254_var;
  29648. if (_n == _children_capacity) {
  29649. _children_capacity *= 2;
  29650. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  29651. if (!_new_children) {
  29652. PyMem_Free(_children);
  29653. p->error_indicator = 1;
  29654. PyErr_NoMemory();
  29655. p->level--;
  29656. return NULL;
  29657. }
  29658. _children = _new_children;
  29659. }
  29660. _children[_n++] = _res;
  29661. _mark = p->mark;
  29662. }
  29663. p->mark = _mark;
  29664. D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ',
  29665. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)"));
  29666. }
  29667. if (_n == 0 || p->error_indicator) {
  29668. PyMem_Free(_children);
  29669. p->level--;
  29670. return NULL;
  29671. }
  29672. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  29673. if (!_seq) {
  29674. PyMem_Free(_children);
  29675. p->error_indicator = 1;
  29676. PyErr_NoMemory();
  29677. p->level--;
  29678. return NULL;
  29679. }
  29680. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  29681. PyMem_Free(_children);
  29682. p->level--;
  29683. return _seq;
  29684. }
  29685. // _loop1_83: (',' star_expression)
  29686. static asdl_seq *
  29687. _loop1_83_rule(Parser *p)
  29688. {
  29689. if (p->level++ == MAXSTACK) {
  29690. _Pypegen_stack_overflow(p);
  29691. }
  29692. if (p->error_indicator) {
  29693. p->level--;
  29694. return NULL;
  29695. }
  29696. void *_res = NULL;
  29697. int _mark = p->mark;
  29698. void **_children = PyMem_Malloc(sizeof(void *));
  29699. if (!_children) {
  29700. p->error_indicator = 1;
  29701. PyErr_NoMemory();
  29702. p->level--;
  29703. return NULL;
  29704. }
  29705. Py_ssize_t _children_capacity = 1;
  29706. Py_ssize_t _n = 0;
  29707. { // (',' star_expression)
  29708. if (p->error_indicator) {
  29709. p->level--;
  29710. return NULL;
  29711. }
  29712. D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)"));
  29713. void *_tmp_255_var;
  29714. while (
  29715. (_tmp_255_var = _tmp_255_rule(p)) // ',' star_expression
  29716. )
  29717. {
  29718. _res = _tmp_255_var;
  29719. if (_n == _children_capacity) {
  29720. _children_capacity *= 2;
  29721. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  29722. if (!_new_children) {
  29723. PyMem_Free(_children);
  29724. p->error_indicator = 1;
  29725. PyErr_NoMemory();
  29726. p->level--;
  29727. return NULL;
  29728. }
  29729. _children = _new_children;
  29730. }
  29731. _children[_n++] = _res;
  29732. _mark = p->mark;
  29733. }
  29734. p->mark = _mark;
  29735. D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ',
  29736. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)"));
  29737. }
  29738. if (_n == 0 || p->error_indicator) {
  29739. PyMem_Free(_children);
  29740. p->level--;
  29741. return NULL;
  29742. }
  29743. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  29744. if (!_seq) {
  29745. PyMem_Free(_children);
  29746. p->error_indicator = 1;
  29747. PyErr_NoMemory();
  29748. p->level--;
  29749. return NULL;
  29750. }
  29751. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  29752. PyMem_Free(_children);
  29753. p->level--;
  29754. return _seq;
  29755. }
  29756. // _loop0_85: ',' star_named_expression
  29757. static asdl_seq *
  29758. _loop0_85_rule(Parser *p)
  29759. {
  29760. if (p->level++ == MAXSTACK) {
  29761. _Pypegen_stack_overflow(p);
  29762. }
  29763. if (p->error_indicator) {
  29764. p->level--;
  29765. return NULL;
  29766. }
  29767. void *_res = NULL;
  29768. int _mark = p->mark;
  29769. void **_children = PyMem_Malloc(sizeof(void *));
  29770. if (!_children) {
  29771. p->error_indicator = 1;
  29772. PyErr_NoMemory();
  29773. p->level--;
  29774. return NULL;
  29775. }
  29776. Py_ssize_t _children_capacity = 1;
  29777. Py_ssize_t _n = 0;
  29778. { // ',' star_named_expression
  29779. if (p->error_indicator) {
  29780. p->level--;
  29781. return NULL;
  29782. }
  29783. D(fprintf(stderr, "%*c> _loop0_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression"));
  29784. Token * _literal;
  29785. expr_ty elem;
  29786. while (
  29787. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  29788. &&
  29789. (elem = star_named_expression_rule(p)) // star_named_expression
  29790. )
  29791. {
  29792. _res = elem;
  29793. if (_res == NULL && PyErr_Occurred()) {
  29794. p->error_indicator = 1;
  29795. PyMem_Free(_children);
  29796. p->level--;
  29797. return NULL;
  29798. }
  29799. if (_n == _children_capacity) {
  29800. _children_capacity *= 2;
  29801. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  29802. if (!_new_children) {
  29803. PyMem_Free(_children);
  29804. p->error_indicator = 1;
  29805. PyErr_NoMemory();
  29806. p->level--;
  29807. return NULL;
  29808. }
  29809. _children = _new_children;
  29810. }
  29811. _children[_n++] = _res;
  29812. _mark = p->mark;
  29813. }
  29814. p->mark = _mark;
  29815. D(fprintf(stderr, "%*c%s _loop0_85[%d-%d]: %s failed!\n", p->level, ' ',
  29816. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression"));
  29817. }
  29818. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  29819. if (!_seq) {
  29820. PyMem_Free(_children);
  29821. p->error_indicator = 1;
  29822. PyErr_NoMemory();
  29823. p->level--;
  29824. return NULL;
  29825. }
  29826. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  29827. PyMem_Free(_children);
  29828. p->level--;
  29829. return _seq;
  29830. }
  29831. // _gather_84: star_named_expression _loop0_85
  29832. static asdl_seq *
  29833. _gather_84_rule(Parser *p)
  29834. {
  29835. if (p->level++ == MAXSTACK) {
  29836. _Pypegen_stack_overflow(p);
  29837. }
  29838. if (p->error_indicator) {
  29839. p->level--;
  29840. return NULL;
  29841. }
  29842. asdl_seq * _res = NULL;
  29843. int _mark = p->mark;
  29844. { // star_named_expression _loop0_85
  29845. if (p->error_indicator) {
  29846. p->level--;
  29847. return NULL;
  29848. }
  29849. D(fprintf(stderr, "%*c> _gather_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_85"));
  29850. expr_ty elem;
  29851. asdl_seq * seq;
  29852. if (
  29853. (elem = star_named_expression_rule(p)) // star_named_expression
  29854. &&
  29855. (seq = _loop0_85_rule(p)) // _loop0_85
  29856. )
  29857. {
  29858. D(fprintf(stderr, "%*c+ _gather_84[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_85"));
  29859. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  29860. goto done;
  29861. }
  29862. p->mark = _mark;
  29863. D(fprintf(stderr, "%*c%s _gather_84[%d-%d]: %s failed!\n", p->level, ' ',
  29864. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_85"));
  29865. }
  29866. _res = NULL;
  29867. done:
  29868. p->level--;
  29869. return _res;
  29870. }
  29871. // _loop1_86: ('or' conjunction)
  29872. static asdl_seq *
  29873. _loop1_86_rule(Parser *p)
  29874. {
  29875. if (p->level++ == MAXSTACK) {
  29876. _Pypegen_stack_overflow(p);
  29877. }
  29878. if (p->error_indicator) {
  29879. p->level--;
  29880. return NULL;
  29881. }
  29882. void *_res = NULL;
  29883. int _mark = p->mark;
  29884. void **_children = PyMem_Malloc(sizeof(void *));
  29885. if (!_children) {
  29886. p->error_indicator = 1;
  29887. PyErr_NoMemory();
  29888. p->level--;
  29889. return NULL;
  29890. }
  29891. Py_ssize_t _children_capacity = 1;
  29892. Py_ssize_t _n = 0;
  29893. { // ('or' conjunction)
  29894. if (p->error_indicator) {
  29895. p->level--;
  29896. return NULL;
  29897. }
  29898. D(fprintf(stderr, "%*c> _loop1_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)"));
  29899. void *_tmp_256_var;
  29900. while (
  29901. (_tmp_256_var = _tmp_256_rule(p)) // 'or' conjunction
  29902. )
  29903. {
  29904. _res = _tmp_256_var;
  29905. if (_n == _children_capacity) {
  29906. _children_capacity *= 2;
  29907. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  29908. if (!_new_children) {
  29909. PyMem_Free(_children);
  29910. p->error_indicator = 1;
  29911. PyErr_NoMemory();
  29912. p->level--;
  29913. return NULL;
  29914. }
  29915. _children = _new_children;
  29916. }
  29917. _children[_n++] = _res;
  29918. _mark = p->mark;
  29919. }
  29920. p->mark = _mark;
  29921. D(fprintf(stderr, "%*c%s _loop1_86[%d-%d]: %s failed!\n", p->level, ' ',
  29922. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)"));
  29923. }
  29924. if (_n == 0 || p->error_indicator) {
  29925. PyMem_Free(_children);
  29926. p->level--;
  29927. return NULL;
  29928. }
  29929. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  29930. if (!_seq) {
  29931. PyMem_Free(_children);
  29932. p->error_indicator = 1;
  29933. PyErr_NoMemory();
  29934. p->level--;
  29935. return NULL;
  29936. }
  29937. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  29938. PyMem_Free(_children);
  29939. p->level--;
  29940. return _seq;
  29941. }
  29942. // _loop1_87: ('and' inversion)
  29943. static asdl_seq *
  29944. _loop1_87_rule(Parser *p)
  29945. {
  29946. if (p->level++ == MAXSTACK) {
  29947. _Pypegen_stack_overflow(p);
  29948. }
  29949. if (p->error_indicator) {
  29950. p->level--;
  29951. return NULL;
  29952. }
  29953. void *_res = NULL;
  29954. int _mark = p->mark;
  29955. void **_children = PyMem_Malloc(sizeof(void *));
  29956. if (!_children) {
  29957. p->error_indicator = 1;
  29958. PyErr_NoMemory();
  29959. p->level--;
  29960. return NULL;
  29961. }
  29962. Py_ssize_t _children_capacity = 1;
  29963. Py_ssize_t _n = 0;
  29964. { // ('and' inversion)
  29965. if (p->error_indicator) {
  29966. p->level--;
  29967. return NULL;
  29968. }
  29969. D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)"));
  29970. void *_tmp_257_var;
  29971. while (
  29972. (_tmp_257_var = _tmp_257_rule(p)) // 'and' inversion
  29973. )
  29974. {
  29975. _res = _tmp_257_var;
  29976. if (_n == _children_capacity) {
  29977. _children_capacity *= 2;
  29978. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  29979. if (!_new_children) {
  29980. PyMem_Free(_children);
  29981. p->error_indicator = 1;
  29982. PyErr_NoMemory();
  29983. p->level--;
  29984. return NULL;
  29985. }
  29986. _children = _new_children;
  29987. }
  29988. _children[_n++] = _res;
  29989. _mark = p->mark;
  29990. }
  29991. p->mark = _mark;
  29992. D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ',
  29993. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)"));
  29994. }
  29995. if (_n == 0 || p->error_indicator) {
  29996. PyMem_Free(_children);
  29997. p->level--;
  29998. return NULL;
  29999. }
  30000. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  30001. if (!_seq) {
  30002. PyMem_Free(_children);
  30003. p->error_indicator = 1;
  30004. PyErr_NoMemory();
  30005. p->level--;
  30006. return NULL;
  30007. }
  30008. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  30009. PyMem_Free(_children);
  30010. p->level--;
  30011. return _seq;
  30012. }
  30013. // _loop1_88: compare_op_bitwise_or_pair
  30014. static asdl_seq *
  30015. _loop1_88_rule(Parser *p)
  30016. {
  30017. if (p->level++ == MAXSTACK) {
  30018. _Pypegen_stack_overflow(p);
  30019. }
  30020. if (p->error_indicator) {
  30021. p->level--;
  30022. return NULL;
  30023. }
  30024. void *_res = NULL;
  30025. int _mark = p->mark;
  30026. void **_children = PyMem_Malloc(sizeof(void *));
  30027. if (!_children) {
  30028. p->error_indicator = 1;
  30029. PyErr_NoMemory();
  30030. p->level--;
  30031. return NULL;
  30032. }
  30033. Py_ssize_t _children_capacity = 1;
  30034. Py_ssize_t _n = 0;
  30035. { // compare_op_bitwise_or_pair
  30036. if (p->error_indicator) {
  30037. p->level--;
  30038. return NULL;
  30039. }
  30040. D(fprintf(stderr, "%*c> _loop1_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair"));
  30041. CmpopExprPair* compare_op_bitwise_or_pair_var;
  30042. while (
  30043. (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair
  30044. )
  30045. {
  30046. _res = compare_op_bitwise_or_pair_var;
  30047. if (_n == _children_capacity) {
  30048. _children_capacity *= 2;
  30049. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  30050. if (!_new_children) {
  30051. PyMem_Free(_children);
  30052. p->error_indicator = 1;
  30053. PyErr_NoMemory();
  30054. p->level--;
  30055. return NULL;
  30056. }
  30057. _children = _new_children;
  30058. }
  30059. _children[_n++] = _res;
  30060. _mark = p->mark;
  30061. }
  30062. p->mark = _mark;
  30063. D(fprintf(stderr, "%*c%s _loop1_88[%d-%d]: %s failed!\n", p->level, ' ',
  30064. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair"));
  30065. }
  30066. if (_n == 0 || p->error_indicator) {
  30067. PyMem_Free(_children);
  30068. p->level--;
  30069. return NULL;
  30070. }
  30071. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  30072. if (!_seq) {
  30073. PyMem_Free(_children);
  30074. p->error_indicator = 1;
  30075. PyErr_NoMemory();
  30076. p->level--;
  30077. return NULL;
  30078. }
  30079. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  30080. PyMem_Free(_children);
  30081. p->level--;
  30082. return _seq;
  30083. }
  30084. // _tmp_89: '!='
  30085. static void *
  30086. _tmp_89_rule(Parser *p)
  30087. {
  30088. if (p->level++ == MAXSTACK) {
  30089. _Pypegen_stack_overflow(p);
  30090. }
  30091. if (p->error_indicator) {
  30092. p->level--;
  30093. return NULL;
  30094. }
  30095. void * _res = NULL;
  30096. int _mark = p->mark;
  30097. { // '!='
  30098. if (p->error_indicator) {
  30099. p->level--;
  30100. return NULL;
  30101. }
  30102. D(fprintf(stderr, "%*c> _tmp_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='"));
  30103. Token * tok;
  30104. if (
  30105. (tok = _PyPegen_expect_token(p, 28)) // token='!='
  30106. )
  30107. {
  30108. D(fprintf(stderr, "%*c+ _tmp_89[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='"));
  30109. _res = _PyPegen_check_barry_as_flufl ( p , tok ) ? NULL : tok;
  30110. if (_res == NULL && PyErr_Occurred()) {
  30111. p->error_indicator = 1;
  30112. p->level--;
  30113. return NULL;
  30114. }
  30115. goto done;
  30116. }
  30117. p->mark = _mark;
  30118. D(fprintf(stderr, "%*c%s _tmp_89[%d-%d]: %s failed!\n", p->level, ' ',
  30119. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='"));
  30120. }
  30121. _res = NULL;
  30122. done:
  30123. p->level--;
  30124. return _res;
  30125. }
  30126. // _loop0_91: ',' (slice | starred_expression)
  30127. static asdl_seq *
  30128. _loop0_91_rule(Parser *p)
  30129. {
  30130. if (p->level++ == MAXSTACK) {
  30131. _Pypegen_stack_overflow(p);
  30132. }
  30133. if (p->error_indicator) {
  30134. p->level--;
  30135. return NULL;
  30136. }
  30137. void *_res = NULL;
  30138. int _mark = p->mark;
  30139. void **_children = PyMem_Malloc(sizeof(void *));
  30140. if (!_children) {
  30141. p->error_indicator = 1;
  30142. PyErr_NoMemory();
  30143. p->level--;
  30144. return NULL;
  30145. }
  30146. Py_ssize_t _children_capacity = 1;
  30147. Py_ssize_t _n = 0;
  30148. { // ',' (slice | starred_expression)
  30149. if (p->error_indicator) {
  30150. p->level--;
  30151. return NULL;
  30152. }
  30153. D(fprintf(stderr, "%*c> _loop0_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (slice | starred_expression)"));
  30154. Token * _literal;
  30155. void *elem;
  30156. while (
  30157. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  30158. &&
  30159. (elem = _tmp_258_rule(p)) // slice | starred_expression
  30160. )
  30161. {
  30162. _res = elem;
  30163. if (_res == NULL && PyErr_Occurred()) {
  30164. p->error_indicator = 1;
  30165. PyMem_Free(_children);
  30166. p->level--;
  30167. return NULL;
  30168. }
  30169. if (_n == _children_capacity) {
  30170. _children_capacity *= 2;
  30171. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  30172. if (!_new_children) {
  30173. PyMem_Free(_children);
  30174. p->error_indicator = 1;
  30175. PyErr_NoMemory();
  30176. p->level--;
  30177. return NULL;
  30178. }
  30179. _children = _new_children;
  30180. }
  30181. _children[_n++] = _res;
  30182. _mark = p->mark;
  30183. }
  30184. p->mark = _mark;
  30185. D(fprintf(stderr, "%*c%s _loop0_91[%d-%d]: %s failed!\n", p->level, ' ',
  30186. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (slice | starred_expression)"));
  30187. }
  30188. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  30189. if (!_seq) {
  30190. PyMem_Free(_children);
  30191. p->error_indicator = 1;
  30192. PyErr_NoMemory();
  30193. p->level--;
  30194. return NULL;
  30195. }
  30196. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  30197. PyMem_Free(_children);
  30198. p->level--;
  30199. return _seq;
  30200. }
  30201. // _gather_90: (slice | starred_expression) _loop0_91
  30202. static asdl_seq *
  30203. _gather_90_rule(Parser *p)
  30204. {
  30205. if (p->level++ == MAXSTACK) {
  30206. _Pypegen_stack_overflow(p);
  30207. }
  30208. if (p->error_indicator) {
  30209. p->level--;
  30210. return NULL;
  30211. }
  30212. asdl_seq * _res = NULL;
  30213. int _mark = p->mark;
  30214. { // (slice | starred_expression) _loop0_91
  30215. if (p->error_indicator) {
  30216. p->level--;
  30217. return NULL;
  30218. }
  30219. D(fprintf(stderr, "%*c> _gather_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(slice | starred_expression) _loop0_91"));
  30220. void *elem;
  30221. asdl_seq * seq;
  30222. if (
  30223. (elem = _tmp_258_rule(p)) // slice | starred_expression
  30224. &&
  30225. (seq = _loop0_91_rule(p)) // _loop0_91
  30226. )
  30227. {
  30228. D(fprintf(stderr, "%*c+ _gather_90[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(slice | starred_expression) _loop0_91"));
  30229. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  30230. goto done;
  30231. }
  30232. p->mark = _mark;
  30233. D(fprintf(stderr, "%*c%s _gather_90[%d-%d]: %s failed!\n", p->level, ' ',
  30234. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(slice | starred_expression) _loop0_91"));
  30235. }
  30236. _res = NULL;
  30237. done:
  30238. p->level--;
  30239. return _res;
  30240. }
  30241. // _tmp_92: ':' expression?
  30242. static void *
  30243. _tmp_92_rule(Parser *p)
  30244. {
  30245. if (p->level++ == MAXSTACK) {
  30246. _Pypegen_stack_overflow(p);
  30247. }
  30248. if (p->error_indicator) {
  30249. p->level--;
  30250. return NULL;
  30251. }
  30252. void * _res = NULL;
  30253. int _mark = p->mark;
  30254. { // ':' expression?
  30255. if (p->error_indicator) {
  30256. p->level--;
  30257. return NULL;
  30258. }
  30259. D(fprintf(stderr, "%*c> _tmp_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?"));
  30260. Token * _literal;
  30261. void *d;
  30262. if (
  30263. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  30264. &&
  30265. (d = expression_rule(p), !p->error_indicator) // expression?
  30266. )
  30267. {
  30268. D(fprintf(stderr, "%*c+ _tmp_92[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?"));
  30269. _res = d;
  30270. if (_res == NULL && PyErr_Occurred()) {
  30271. p->error_indicator = 1;
  30272. p->level--;
  30273. return NULL;
  30274. }
  30275. goto done;
  30276. }
  30277. p->mark = _mark;
  30278. D(fprintf(stderr, "%*c%s _tmp_92[%d-%d]: %s failed!\n", p->level, ' ',
  30279. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?"));
  30280. }
  30281. _res = NULL;
  30282. done:
  30283. p->level--;
  30284. return _res;
  30285. }
  30286. // _tmp_93: STRING | FSTRING_START
  30287. static void *
  30288. _tmp_93_rule(Parser *p)
  30289. {
  30290. if (p->level++ == MAXSTACK) {
  30291. _Pypegen_stack_overflow(p);
  30292. }
  30293. if (p->error_indicator) {
  30294. p->level--;
  30295. return NULL;
  30296. }
  30297. void * _res = NULL;
  30298. int _mark = p->mark;
  30299. { // STRING
  30300. if (p->error_indicator) {
  30301. p->level--;
  30302. return NULL;
  30303. }
  30304. D(fprintf(stderr, "%*c> _tmp_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING"));
  30305. expr_ty string_var;
  30306. if (
  30307. (string_var = _PyPegen_string_token(p)) // STRING
  30308. )
  30309. {
  30310. D(fprintf(stderr, "%*c+ _tmp_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING"));
  30311. _res = string_var;
  30312. goto done;
  30313. }
  30314. p->mark = _mark;
  30315. D(fprintf(stderr, "%*c%s _tmp_93[%d-%d]: %s failed!\n", p->level, ' ',
  30316. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING"));
  30317. }
  30318. { // FSTRING_START
  30319. if (p->error_indicator) {
  30320. p->level--;
  30321. return NULL;
  30322. }
  30323. D(fprintf(stderr, "%*c> _tmp_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "FSTRING_START"));
  30324. Token * fstring_start_var;
  30325. if (
  30326. (fstring_start_var = _PyPegen_expect_token(p, FSTRING_START)) // token='FSTRING_START'
  30327. )
  30328. {
  30329. D(fprintf(stderr, "%*c+ _tmp_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "FSTRING_START"));
  30330. _res = fstring_start_var;
  30331. goto done;
  30332. }
  30333. p->mark = _mark;
  30334. D(fprintf(stderr, "%*c%s _tmp_93[%d-%d]: %s failed!\n", p->level, ' ',
  30335. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "FSTRING_START"));
  30336. }
  30337. _res = NULL;
  30338. done:
  30339. p->level--;
  30340. return _res;
  30341. }
  30342. // _tmp_94: tuple | group | genexp
  30343. static void *
  30344. _tmp_94_rule(Parser *p)
  30345. {
  30346. if (p->level++ == MAXSTACK) {
  30347. _Pypegen_stack_overflow(p);
  30348. }
  30349. if (p->error_indicator) {
  30350. p->level--;
  30351. return NULL;
  30352. }
  30353. void * _res = NULL;
  30354. int _mark = p->mark;
  30355. { // tuple
  30356. if (p->error_indicator) {
  30357. p->level--;
  30358. return NULL;
  30359. }
  30360. D(fprintf(stderr, "%*c> _tmp_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
  30361. expr_ty tuple_var;
  30362. if (
  30363. (tuple_var = tuple_rule(p)) // tuple
  30364. )
  30365. {
  30366. D(fprintf(stderr, "%*c+ _tmp_94[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
  30367. _res = tuple_var;
  30368. goto done;
  30369. }
  30370. p->mark = _mark;
  30371. D(fprintf(stderr, "%*c%s _tmp_94[%d-%d]: %s failed!\n", p->level, ' ',
  30372. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
  30373. }
  30374. { // group
  30375. if (p->error_indicator) {
  30376. p->level--;
  30377. return NULL;
  30378. }
  30379. D(fprintf(stderr, "%*c> _tmp_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group"));
  30380. expr_ty group_var;
  30381. if (
  30382. (group_var = group_rule(p)) // group
  30383. )
  30384. {
  30385. D(fprintf(stderr, "%*c+ _tmp_94[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group"));
  30386. _res = group_var;
  30387. goto done;
  30388. }
  30389. p->mark = _mark;
  30390. D(fprintf(stderr, "%*c%s _tmp_94[%d-%d]: %s failed!\n", p->level, ' ',
  30391. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group"));
  30392. }
  30393. { // genexp
  30394. if (p->error_indicator) {
  30395. p->level--;
  30396. return NULL;
  30397. }
  30398. D(fprintf(stderr, "%*c> _tmp_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp"));
  30399. expr_ty genexp_var;
  30400. if (
  30401. (genexp_var = genexp_rule(p)) // genexp
  30402. )
  30403. {
  30404. D(fprintf(stderr, "%*c+ _tmp_94[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp"));
  30405. _res = genexp_var;
  30406. goto done;
  30407. }
  30408. p->mark = _mark;
  30409. D(fprintf(stderr, "%*c%s _tmp_94[%d-%d]: %s failed!\n", p->level, ' ',
  30410. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp"));
  30411. }
  30412. _res = NULL;
  30413. done:
  30414. p->level--;
  30415. return _res;
  30416. }
  30417. // _tmp_95: list | listcomp
  30418. static void *
  30419. _tmp_95_rule(Parser *p)
  30420. {
  30421. if (p->level++ == MAXSTACK) {
  30422. _Pypegen_stack_overflow(p);
  30423. }
  30424. if (p->error_indicator) {
  30425. p->level--;
  30426. return NULL;
  30427. }
  30428. void * _res = NULL;
  30429. int _mark = p->mark;
  30430. { // list
  30431. if (p->error_indicator) {
  30432. p->level--;
  30433. return NULL;
  30434. }
  30435. D(fprintf(stderr, "%*c> _tmp_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
  30436. expr_ty list_var;
  30437. if (
  30438. (list_var = list_rule(p)) // list
  30439. )
  30440. {
  30441. D(fprintf(stderr, "%*c+ _tmp_95[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
  30442. _res = list_var;
  30443. goto done;
  30444. }
  30445. p->mark = _mark;
  30446. D(fprintf(stderr, "%*c%s _tmp_95[%d-%d]: %s failed!\n", p->level, ' ',
  30447. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
  30448. }
  30449. { // listcomp
  30450. if (p->error_indicator) {
  30451. p->level--;
  30452. return NULL;
  30453. }
  30454. D(fprintf(stderr, "%*c> _tmp_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp"));
  30455. expr_ty listcomp_var;
  30456. if (
  30457. (listcomp_var = listcomp_rule(p)) // listcomp
  30458. )
  30459. {
  30460. D(fprintf(stderr, "%*c+ _tmp_95[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp"));
  30461. _res = listcomp_var;
  30462. goto done;
  30463. }
  30464. p->mark = _mark;
  30465. D(fprintf(stderr, "%*c%s _tmp_95[%d-%d]: %s failed!\n", p->level, ' ',
  30466. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp"));
  30467. }
  30468. _res = NULL;
  30469. done:
  30470. p->level--;
  30471. return _res;
  30472. }
  30473. // _tmp_96: dict | set | dictcomp | setcomp
  30474. static void *
  30475. _tmp_96_rule(Parser *p)
  30476. {
  30477. if (p->level++ == MAXSTACK) {
  30478. _Pypegen_stack_overflow(p);
  30479. }
  30480. if (p->error_indicator) {
  30481. p->level--;
  30482. return NULL;
  30483. }
  30484. void * _res = NULL;
  30485. int _mark = p->mark;
  30486. { // dict
  30487. if (p->error_indicator) {
  30488. p->level--;
  30489. return NULL;
  30490. }
  30491. D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict"));
  30492. expr_ty dict_var;
  30493. if (
  30494. (dict_var = dict_rule(p)) // dict
  30495. )
  30496. {
  30497. D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict"));
  30498. _res = dict_var;
  30499. goto done;
  30500. }
  30501. p->mark = _mark;
  30502. D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ',
  30503. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict"));
  30504. }
  30505. { // set
  30506. if (p->error_indicator) {
  30507. p->level--;
  30508. return NULL;
  30509. }
  30510. D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set"));
  30511. expr_ty set_var;
  30512. if (
  30513. (set_var = set_rule(p)) // set
  30514. )
  30515. {
  30516. D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set"));
  30517. _res = set_var;
  30518. goto done;
  30519. }
  30520. p->mark = _mark;
  30521. D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ',
  30522. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set"));
  30523. }
  30524. { // dictcomp
  30525. if (p->error_indicator) {
  30526. p->level--;
  30527. return NULL;
  30528. }
  30529. D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp"));
  30530. expr_ty dictcomp_var;
  30531. if (
  30532. (dictcomp_var = dictcomp_rule(p)) // dictcomp
  30533. )
  30534. {
  30535. D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp"));
  30536. _res = dictcomp_var;
  30537. goto done;
  30538. }
  30539. p->mark = _mark;
  30540. D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ',
  30541. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp"));
  30542. }
  30543. { // setcomp
  30544. if (p->error_indicator) {
  30545. p->level--;
  30546. return NULL;
  30547. }
  30548. D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp"));
  30549. expr_ty setcomp_var;
  30550. if (
  30551. (setcomp_var = setcomp_rule(p)) // setcomp
  30552. )
  30553. {
  30554. D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp"));
  30555. _res = setcomp_var;
  30556. goto done;
  30557. }
  30558. p->mark = _mark;
  30559. D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ',
  30560. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp"));
  30561. }
  30562. _res = NULL;
  30563. done:
  30564. p->level--;
  30565. return _res;
  30566. }
  30567. // _tmp_97: yield_expr | named_expression
  30568. static void *
  30569. _tmp_97_rule(Parser *p)
  30570. {
  30571. if (p->level++ == MAXSTACK) {
  30572. _Pypegen_stack_overflow(p);
  30573. }
  30574. if (p->error_indicator) {
  30575. p->level--;
  30576. return NULL;
  30577. }
  30578. void * _res = NULL;
  30579. int _mark = p->mark;
  30580. { // yield_expr
  30581. if (p->error_indicator) {
  30582. p->level--;
  30583. return NULL;
  30584. }
  30585. D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  30586. expr_ty yield_expr_var;
  30587. if (
  30588. (yield_expr_var = yield_expr_rule(p)) // yield_expr
  30589. )
  30590. {
  30591. D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  30592. _res = yield_expr_var;
  30593. goto done;
  30594. }
  30595. p->mark = _mark;
  30596. D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
  30597. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
  30598. }
  30599. { // named_expression
  30600. if (p->error_indicator) {
  30601. p->level--;
  30602. return NULL;
  30603. }
  30604. D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
  30605. expr_ty named_expression_var;
  30606. if (
  30607. (named_expression_var = named_expression_rule(p)) // named_expression
  30608. )
  30609. {
  30610. D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
  30611. _res = named_expression_var;
  30612. goto done;
  30613. }
  30614. p->mark = _mark;
  30615. D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
  30616. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
  30617. }
  30618. _res = NULL;
  30619. done:
  30620. p->level--;
  30621. return _res;
  30622. }
  30623. // _loop0_98: lambda_param_no_default
  30624. static asdl_seq *
  30625. _loop0_98_rule(Parser *p)
  30626. {
  30627. if (p->level++ == MAXSTACK) {
  30628. _Pypegen_stack_overflow(p);
  30629. }
  30630. if (p->error_indicator) {
  30631. p->level--;
  30632. return NULL;
  30633. }
  30634. void *_res = NULL;
  30635. int _mark = p->mark;
  30636. void **_children = PyMem_Malloc(sizeof(void *));
  30637. if (!_children) {
  30638. p->error_indicator = 1;
  30639. PyErr_NoMemory();
  30640. p->level--;
  30641. return NULL;
  30642. }
  30643. Py_ssize_t _children_capacity = 1;
  30644. Py_ssize_t _n = 0;
  30645. { // lambda_param_no_default
  30646. if (p->error_indicator) {
  30647. p->level--;
  30648. return NULL;
  30649. }
  30650. D(fprintf(stderr, "%*c> _loop0_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
  30651. arg_ty lambda_param_no_default_var;
  30652. while (
  30653. (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
  30654. )
  30655. {
  30656. _res = lambda_param_no_default_var;
  30657. if (_n == _children_capacity) {
  30658. _children_capacity *= 2;
  30659. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  30660. if (!_new_children) {
  30661. PyMem_Free(_children);
  30662. p->error_indicator = 1;
  30663. PyErr_NoMemory();
  30664. p->level--;
  30665. return NULL;
  30666. }
  30667. _children = _new_children;
  30668. }
  30669. _children[_n++] = _res;
  30670. _mark = p->mark;
  30671. }
  30672. p->mark = _mark;
  30673. D(fprintf(stderr, "%*c%s _loop0_98[%d-%d]: %s failed!\n", p->level, ' ',
  30674. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
  30675. }
  30676. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  30677. if (!_seq) {
  30678. PyMem_Free(_children);
  30679. p->error_indicator = 1;
  30680. PyErr_NoMemory();
  30681. p->level--;
  30682. return NULL;
  30683. }
  30684. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  30685. PyMem_Free(_children);
  30686. p->level--;
  30687. return _seq;
  30688. }
  30689. // _loop0_99: lambda_param_with_default
  30690. static asdl_seq *
  30691. _loop0_99_rule(Parser *p)
  30692. {
  30693. if (p->level++ == MAXSTACK) {
  30694. _Pypegen_stack_overflow(p);
  30695. }
  30696. if (p->error_indicator) {
  30697. p->level--;
  30698. return NULL;
  30699. }
  30700. void *_res = NULL;
  30701. int _mark = p->mark;
  30702. void **_children = PyMem_Malloc(sizeof(void *));
  30703. if (!_children) {
  30704. p->error_indicator = 1;
  30705. PyErr_NoMemory();
  30706. p->level--;
  30707. return NULL;
  30708. }
  30709. Py_ssize_t _children_capacity = 1;
  30710. Py_ssize_t _n = 0;
  30711. { // lambda_param_with_default
  30712. if (p->error_indicator) {
  30713. p->level--;
  30714. return NULL;
  30715. }
  30716. D(fprintf(stderr, "%*c> _loop0_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
  30717. NameDefaultPair* lambda_param_with_default_var;
  30718. while (
  30719. (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
  30720. )
  30721. {
  30722. _res = lambda_param_with_default_var;
  30723. if (_n == _children_capacity) {
  30724. _children_capacity *= 2;
  30725. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  30726. if (!_new_children) {
  30727. PyMem_Free(_children);
  30728. p->error_indicator = 1;
  30729. PyErr_NoMemory();
  30730. p->level--;
  30731. return NULL;
  30732. }
  30733. _children = _new_children;
  30734. }
  30735. _children[_n++] = _res;
  30736. _mark = p->mark;
  30737. }
  30738. p->mark = _mark;
  30739. D(fprintf(stderr, "%*c%s _loop0_99[%d-%d]: %s failed!\n", p->level, ' ',
  30740. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
  30741. }
  30742. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  30743. if (!_seq) {
  30744. PyMem_Free(_children);
  30745. p->error_indicator = 1;
  30746. PyErr_NoMemory();
  30747. p->level--;
  30748. return NULL;
  30749. }
  30750. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  30751. PyMem_Free(_children);
  30752. p->level--;
  30753. return _seq;
  30754. }
  30755. // _loop0_100: lambda_param_with_default
  30756. static asdl_seq *
  30757. _loop0_100_rule(Parser *p)
  30758. {
  30759. if (p->level++ == MAXSTACK) {
  30760. _Pypegen_stack_overflow(p);
  30761. }
  30762. if (p->error_indicator) {
  30763. p->level--;
  30764. return NULL;
  30765. }
  30766. void *_res = NULL;
  30767. int _mark = p->mark;
  30768. void **_children = PyMem_Malloc(sizeof(void *));
  30769. if (!_children) {
  30770. p->error_indicator = 1;
  30771. PyErr_NoMemory();
  30772. p->level--;
  30773. return NULL;
  30774. }
  30775. Py_ssize_t _children_capacity = 1;
  30776. Py_ssize_t _n = 0;
  30777. { // lambda_param_with_default
  30778. if (p->error_indicator) {
  30779. p->level--;
  30780. return NULL;
  30781. }
  30782. D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
  30783. NameDefaultPair* lambda_param_with_default_var;
  30784. while (
  30785. (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
  30786. )
  30787. {
  30788. _res = lambda_param_with_default_var;
  30789. if (_n == _children_capacity) {
  30790. _children_capacity *= 2;
  30791. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  30792. if (!_new_children) {
  30793. PyMem_Free(_children);
  30794. p->error_indicator = 1;
  30795. PyErr_NoMemory();
  30796. p->level--;
  30797. return NULL;
  30798. }
  30799. _children = _new_children;
  30800. }
  30801. _children[_n++] = _res;
  30802. _mark = p->mark;
  30803. }
  30804. p->mark = _mark;
  30805. D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ',
  30806. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
  30807. }
  30808. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  30809. if (!_seq) {
  30810. PyMem_Free(_children);
  30811. p->error_indicator = 1;
  30812. PyErr_NoMemory();
  30813. p->level--;
  30814. return NULL;
  30815. }
  30816. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  30817. PyMem_Free(_children);
  30818. p->level--;
  30819. return _seq;
  30820. }
  30821. // _loop1_101: lambda_param_no_default
  30822. static asdl_seq *
  30823. _loop1_101_rule(Parser *p)
  30824. {
  30825. if (p->level++ == MAXSTACK) {
  30826. _Pypegen_stack_overflow(p);
  30827. }
  30828. if (p->error_indicator) {
  30829. p->level--;
  30830. return NULL;
  30831. }
  30832. void *_res = NULL;
  30833. int _mark = p->mark;
  30834. void **_children = PyMem_Malloc(sizeof(void *));
  30835. if (!_children) {
  30836. p->error_indicator = 1;
  30837. PyErr_NoMemory();
  30838. p->level--;
  30839. return NULL;
  30840. }
  30841. Py_ssize_t _children_capacity = 1;
  30842. Py_ssize_t _n = 0;
  30843. { // lambda_param_no_default
  30844. if (p->error_indicator) {
  30845. p->level--;
  30846. return NULL;
  30847. }
  30848. D(fprintf(stderr, "%*c> _loop1_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
  30849. arg_ty lambda_param_no_default_var;
  30850. while (
  30851. (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
  30852. )
  30853. {
  30854. _res = lambda_param_no_default_var;
  30855. if (_n == _children_capacity) {
  30856. _children_capacity *= 2;
  30857. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  30858. if (!_new_children) {
  30859. PyMem_Free(_children);
  30860. p->error_indicator = 1;
  30861. PyErr_NoMemory();
  30862. p->level--;
  30863. return NULL;
  30864. }
  30865. _children = _new_children;
  30866. }
  30867. _children[_n++] = _res;
  30868. _mark = p->mark;
  30869. }
  30870. p->mark = _mark;
  30871. D(fprintf(stderr, "%*c%s _loop1_101[%d-%d]: %s failed!\n", p->level, ' ',
  30872. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
  30873. }
  30874. if (_n == 0 || p->error_indicator) {
  30875. PyMem_Free(_children);
  30876. p->level--;
  30877. return NULL;
  30878. }
  30879. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  30880. if (!_seq) {
  30881. PyMem_Free(_children);
  30882. p->error_indicator = 1;
  30883. PyErr_NoMemory();
  30884. p->level--;
  30885. return NULL;
  30886. }
  30887. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  30888. PyMem_Free(_children);
  30889. p->level--;
  30890. return _seq;
  30891. }
  30892. // _loop0_102: lambda_param_with_default
  30893. static asdl_seq *
  30894. _loop0_102_rule(Parser *p)
  30895. {
  30896. if (p->level++ == MAXSTACK) {
  30897. _Pypegen_stack_overflow(p);
  30898. }
  30899. if (p->error_indicator) {
  30900. p->level--;
  30901. return NULL;
  30902. }
  30903. void *_res = NULL;
  30904. int _mark = p->mark;
  30905. void **_children = PyMem_Malloc(sizeof(void *));
  30906. if (!_children) {
  30907. p->error_indicator = 1;
  30908. PyErr_NoMemory();
  30909. p->level--;
  30910. return NULL;
  30911. }
  30912. Py_ssize_t _children_capacity = 1;
  30913. Py_ssize_t _n = 0;
  30914. { // lambda_param_with_default
  30915. if (p->error_indicator) {
  30916. p->level--;
  30917. return NULL;
  30918. }
  30919. D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
  30920. NameDefaultPair* lambda_param_with_default_var;
  30921. while (
  30922. (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
  30923. )
  30924. {
  30925. _res = lambda_param_with_default_var;
  30926. if (_n == _children_capacity) {
  30927. _children_capacity *= 2;
  30928. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  30929. if (!_new_children) {
  30930. PyMem_Free(_children);
  30931. p->error_indicator = 1;
  30932. PyErr_NoMemory();
  30933. p->level--;
  30934. return NULL;
  30935. }
  30936. _children = _new_children;
  30937. }
  30938. _children[_n++] = _res;
  30939. _mark = p->mark;
  30940. }
  30941. p->mark = _mark;
  30942. D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ',
  30943. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
  30944. }
  30945. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  30946. if (!_seq) {
  30947. PyMem_Free(_children);
  30948. p->error_indicator = 1;
  30949. PyErr_NoMemory();
  30950. p->level--;
  30951. return NULL;
  30952. }
  30953. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  30954. PyMem_Free(_children);
  30955. p->level--;
  30956. return _seq;
  30957. }
  30958. // _loop1_103: lambda_param_with_default
  30959. static asdl_seq *
  30960. _loop1_103_rule(Parser *p)
  30961. {
  30962. if (p->level++ == MAXSTACK) {
  30963. _Pypegen_stack_overflow(p);
  30964. }
  30965. if (p->error_indicator) {
  30966. p->level--;
  30967. return NULL;
  30968. }
  30969. void *_res = NULL;
  30970. int _mark = p->mark;
  30971. void **_children = PyMem_Malloc(sizeof(void *));
  30972. if (!_children) {
  30973. p->error_indicator = 1;
  30974. PyErr_NoMemory();
  30975. p->level--;
  30976. return NULL;
  30977. }
  30978. Py_ssize_t _children_capacity = 1;
  30979. Py_ssize_t _n = 0;
  30980. { // lambda_param_with_default
  30981. if (p->error_indicator) {
  30982. p->level--;
  30983. return NULL;
  30984. }
  30985. D(fprintf(stderr, "%*c> _loop1_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
  30986. NameDefaultPair* lambda_param_with_default_var;
  30987. while (
  30988. (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
  30989. )
  30990. {
  30991. _res = lambda_param_with_default_var;
  30992. if (_n == _children_capacity) {
  30993. _children_capacity *= 2;
  30994. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  30995. if (!_new_children) {
  30996. PyMem_Free(_children);
  30997. p->error_indicator = 1;
  30998. PyErr_NoMemory();
  30999. p->level--;
  31000. return NULL;
  31001. }
  31002. _children = _new_children;
  31003. }
  31004. _children[_n++] = _res;
  31005. _mark = p->mark;
  31006. }
  31007. p->mark = _mark;
  31008. D(fprintf(stderr, "%*c%s _loop1_103[%d-%d]: %s failed!\n", p->level, ' ',
  31009. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
  31010. }
  31011. if (_n == 0 || p->error_indicator) {
  31012. PyMem_Free(_children);
  31013. p->level--;
  31014. return NULL;
  31015. }
  31016. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  31017. if (!_seq) {
  31018. PyMem_Free(_children);
  31019. p->error_indicator = 1;
  31020. PyErr_NoMemory();
  31021. p->level--;
  31022. return NULL;
  31023. }
  31024. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  31025. PyMem_Free(_children);
  31026. p->level--;
  31027. return _seq;
  31028. }
  31029. // _loop1_104: lambda_param_no_default
  31030. static asdl_seq *
  31031. _loop1_104_rule(Parser *p)
  31032. {
  31033. if (p->level++ == MAXSTACK) {
  31034. _Pypegen_stack_overflow(p);
  31035. }
  31036. if (p->error_indicator) {
  31037. p->level--;
  31038. return NULL;
  31039. }
  31040. void *_res = NULL;
  31041. int _mark = p->mark;
  31042. void **_children = PyMem_Malloc(sizeof(void *));
  31043. if (!_children) {
  31044. p->error_indicator = 1;
  31045. PyErr_NoMemory();
  31046. p->level--;
  31047. return NULL;
  31048. }
  31049. Py_ssize_t _children_capacity = 1;
  31050. Py_ssize_t _n = 0;
  31051. { // lambda_param_no_default
  31052. if (p->error_indicator) {
  31053. p->level--;
  31054. return NULL;
  31055. }
  31056. D(fprintf(stderr, "%*c> _loop1_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
  31057. arg_ty lambda_param_no_default_var;
  31058. while (
  31059. (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
  31060. )
  31061. {
  31062. _res = lambda_param_no_default_var;
  31063. if (_n == _children_capacity) {
  31064. _children_capacity *= 2;
  31065. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  31066. if (!_new_children) {
  31067. PyMem_Free(_children);
  31068. p->error_indicator = 1;
  31069. PyErr_NoMemory();
  31070. p->level--;
  31071. return NULL;
  31072. }
  31073. _children = _new_children;
  31074. }
  31075. _children[_n++] = _res;
  31076. _mark = p->mark;
  31077. }
  31078. p->mark = _mark;
  31079. D(fprintf(stderr, "%*c%s _loop1_104[%d-%d]: %s failed!\n", p->level, ' ',
  31080. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
  31081. }
  31082. if (_n == 0 || p->error_indicator) {
  31083. PyMem_Free(_children);
  31084. p->level--;
  31085. return NULL;
  31086. }
  31087. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  31088. if (!_seq) {
  31089. PyMem_Free(_children);
  31090. p->error_indicator = 1;
  31091. PyErr_NoMemory();
  31092. p->level--;
  31093. return NULL;
  31094. }
  31095. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  31096. PyMem_Free(_children);
  31097. p->level--;
  31098. return _seq;
  31099. }
  31100. // _loop1_105: lambda_param_no_default
  31101. static asdl_seq *
  31102. _loop1_105_rule(Parser *p)
  31103. {
  31104. if (p->level++ == MAXSTACK) {
  31105. _Pypegen_stack_overflow(p);
  31106. }
  31107. if (p->error_indicator) {
  31108. p->level--;
  31109. return NULL;
  31110. }
  31111. void *_res = NULL;
  31112. int _mark = p->mark;
  31113. void **_children = PyMem_Malloc(sizeof(void *));
  31114. if (!_children) {
  31115. p->error_indicator = 1;
  31116. PyErr_NoMemory();
  31117. p->level--;
  31118. return NULL;
  31119. }
  31120. Py_ssize_t _children_capacity = 1;
  31121. Py_ssize_t _n = 0;
  31122. { // lambda_param_no_default
  31123. if (p->error_indicator) {
  31124. p->level--;
  31125. return NULL;
  31126. }
  31127. D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
  31128. arg_ty lambda_param_no_default_var;
  31129. while (
  31130. (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
  31131. )
  31132. {
  31133. _res = lambda_param_no_default_var;
  31134. if (_n == _children_capacity) {
  31135. _children_capacity *= 2;
  31136. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  31137. if (!_new_children) {
  31138. PyMem_Free(_children);
  31139. p->error_indicator = 1;
  31140. PyErr_NoMemory();
  31141. p->level--;
  31142. return NULL;
  31143. }
  31144. _children = _new_children;
  31145. }
  31146. _children[_n++] = _res;
  31147. _mark = p->mark;
  31148. }
  31149. p->mark = _mark;
  31150. D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ',
  31151. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
  31152. }
  31153. if (_n == 0 || p->error_indicator) {
  31154. PyMem_Free(_children);
  31155. p->level--;
  31156. return NULL;
  31157. }
  31158. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  31159. if (!_seq) {
  31160. PyMem_Free(_children);
  31161. p->error_indicator = 1;
  31162. PyErr_NoMemory();
  31163. p->level--;
  31164. return NULL;
  31165. }
  31166. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  31167. PyMem_Free(_children);
  31168. p->level--;
  31169. return _seq;
  31170. }
  31171. // _loop0_106: lambda_param_no_default
  31172. static asdl_seq *
  31173. _loop0_106_rule(Parser *p)
  31174. {
  31175. if (p->level++ == MAXSTACK) {
  31176. _Pypegen_stack_overflow(p);
  31177. }
  31178. if (p->error_indicator) {
  31179. p->level--;
  31180. return NULL;
  31181. }
  31182. void *_res = NULL;
  31183. int _mark = p->mark;
  31184. void **_children = PyMem_Malloc(sizeof(void *));
  31185. if (!_children) {
  31186. p->error_indicator = 1;
  31187. PyErr_NoMemory();
  31188. p->level--;
  31189. return NULL;
  31190. }
  31191. Py_ssize_t _children_capacity = 1;
  31192. Py_ssize_t _n = 0;
  31193. { // lambda_param_no_default
  31194. if (p->error_indicator) {
  31195. p->level--;
  31196. return NULL;
  31197. }
  31198. D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
  31199. arg_ty lambda_param_no_default_var;
  31200. while (
  31201. (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
  31202. )
  31203. {
  31204. _res = lambda_param_no_default_var;
  31205. if (_n == _children_capacity) {
  31206. _children_capacity *= 2;
  31207. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  31208. if (!_new_children) {
  31209. PyMem_Free(_children);
  31210. p->error_indicator = 1;
  31211. PyErr_NoMemory();
  31212. p->level--;
  31213. return NULL;
  31214. }
  31215. _children = _new_children;
  31216. }
  31217. _children[_n++] = _res;
  31218. _mark = p->mark;
  31219. }
  31220. p->mark = _mark;
  31221. D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ',
  31222. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
  31223. }
  31224. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  31225. if (!_seq) {
  31226. PyMem_Free(_children);
  31227. p->error_indicator = 1;
  31228. PyErr_NoMemory();
  31229. p->level--;
  31230. return NULL;
  31231. }
  31232. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  31233. PyMem_Free(_children);
  31234. p->level--;
  31235. return _seq;
  31236. }
  31237. // _loop1_107: lambda_param_with_default
  31238. static asdl_seq *
  31239. _loop1_107_rule(Parser *p)
  31240. {
  31241. if (p->level++ == MAXSTACK) {
  31242. _Pypegen_stack_overflow(p);
  31243. }
  31244. if (p->error_indicator) {
  31245. p->level--;
  31246. return NULL;
  31247. }
  31248. void *_res = NULL;
  31249. int _mark = p->mark;
  31250. void **_children = PyMem_Malloc(sizeof(void *));
  31251. if (!_children) {
  31252. p->error_indicator = 1;
  31253. PyErr_NoMemory();
  31254. p->level--;
  31255. return NULL;
  31256. }
  31257. Py_ssize_t _children_capacity = 1;
  31258. Py_ssize_t _n = 0;
  31259. { // lambda_param_with_default
  31260. if (p->error_indicator) {
  31261. p->level--;
  31262. return NULL;
  31263. }
  31264. D(fprintf(stderr, "%*c> _loop1_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
  31265. NameDefaultPair* lambda_param_with_default_var;
  31266. while (
  31267. (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
  31268. )
  31269. {
  31270. _res = lambda_param_with_default_var;
  31271. if (_n == _children_capacity) {
  31272. _children_capacity *= 2;
  31273. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  31274. if (!_new_children) {
  31275. PyMem_Free(_children);
  31276. p->error_indicator = 1;
  31277. PyErr_NoMemory();
  31278. p->level--;
  31279. return NULL;
  31280. }
  31281. _children = _new_children;
  31282. }
  31283. _children[_n++] = _res;
  31284. _mark = p->mark;
  31285. }
  31286. p->mark = _mark;
  31287. D(fprintf(stderr, "%*c%s _loop1_107[%d-%d]: %s failed!\n", p->level, ' ',
  31288. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
  31289. }
  31290. if (_n == 0 || p->error_indicator) {
  31291. PyMem_Free(_children);
  31292. p->level--;
  31293. return NULL;
  31294. }
  31295. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  31296. if (!_seq) {
  31297. PyMem_Free(_children);
  31298. p->error_indicator = 1;
  31299. PyErr_NoMemory();
  31300. p->level--;
  31301. return NULL;
  31302. }
  31303. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  31304. PyMem_Free(_children);
  31305. p->level--;
  31306. return _seq;
  31307. }
  31308. // _loop0_108: lambda_param_no_default
  31309. static asdl_seq *
  31310. _loop0_108_rule(Parser *p)
  31311. {
  31312. if (p->level++ == MAXSTACK) {
  31313. _Pypegen_stack_overflow(p);
  31314. }
  31315. if (p->error_indicator) {
  31316. p->level--;
  31317. return NULL;
  31318. }
  31319. void *_res = NULL;
  31320. int _mark = p->mark;
  31321. void **_children = PyMem_Malloc(sizeof(void *));
  31322. if (!_children) {
  31323. p->error_indicator = 1;
  31324. PyErr_NoMemory();
  31325. p->level--;
  31326. return NULL;
  31327. }
  31328. Py_ssize_t _children_capacity = 1;
  31329. Py_ssize_t _n = 0;
  31330. { // lambda_param_no_default
  31331. if (p->error_indicator) {
  31332. p->level--;
  31333. return NULL;
  31334. }
  31335. D(fprintf(stderr, "%*c> _loop0_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
  31336. arg_ty lambda_param_no_default_var;
  31337. while (
  31338. (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
  31339. )
  31340. {
  31341. _res = lambda_param_no_default_var;
  31342. if (_n == _children_capacity) {
  31343. _children_capacity *= 2;
  31344. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  31345. if (!_new_children) {
  31346. PyMem_Free(_children);
  31347. p->error_indicator = 1;
  31348. PyErr_NoMemory();
  31349. p->level--;
  31350. return NULL;
  31351. }
  31352. _children = _new_children;
  31353. }
  31354. _children[_n++] = _res;
  31355. _mark = p->mark;
  31356. }
  31357. p->mark = _mark;
  31358. D(fprintf(stderr, "%*c%s _loop0_108[%d-%d]: %s failed!\n", p->level, ' ',
  31359. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
  31360. }
  31361. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  31362. if (!_seq) {
  31363. PyMem_Free(_children);
  31364. p->error_indicator = 1;
  31365. PyErr_NoMemory();
  31366. p->level--;
  31367. return NULL;
  31368. }
  31369. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  31370. PyMem_Free(_children);
  31371. p->level--;
  31372. return _seq;
  31373. }
  31374. // _loop1_109: lambda_param_with_default
  31375. static asdl_seq *
  31376. _loop1_109_rule(Parser *p)
  31377. {
  31378. if (p->level++ == MAXSTACK) {
  31379. _Pypegen_stack_overflow(p);
  31380. }
  31381. if (p->error_indicator) {
  31382. p->level--;
  31383. return NULL;
  31384. }
  31385. void *_res = NULL;
  31386. int _mark = p->mark;
  31387. void **_children = PyMem_Malloc(sizeof(void *));
  31388. if (!_children) {
  31389. p->error_indicator = 1;
  31390. PyErr_NoMemory();
  31391. p->level--;
  31392. return NULL;
  31393. }
  31394. Py_ssize_t _children_capacity = 1;
  31395. Py_ssize_t _n = 0;
  31396. { // lambda_param_with_default
  31397. if (p->error_indicator) {
  31398. p->level--;
  31399. return NULL;
  31400. }
  31401. D(fprintf(stderr, "%*c> _loop1_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
  31402. NameDefaultPair* lambda_param_with_default_var;
  31403. while (
  31404. (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
  31405. )
  31406. {
  31407. _res = lambda_param_with_default_var;
  31408. if (_n == _children_capacity) {
  31409. _children_capacity *= 2;
  31410. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  31411. if (!_new_children) {
  31412. PyMem_Free(_children);
  31413. p->error_indicator = 1;
  31414. PyErr_NoMemory();
  31415. p->level--;
  31416. return NULL;
  31417. }
  31418. _children = _new_children;
  31419. }
  31420. _children[_n++] = _res;
  31421. _mark = p->mark;
  31422. }
  31423. p->mark = _mark;
  31424. D(fprintf(stderr, "%*c%s _loop1_109[%d-%d]: %s failed!\n", p->level, ' ',
  31425. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
  31426. }
  31427. if (_n == 0 || p->error_indicator) {
  31428. PyMem_Free(_children);
  31429. p->level--;
  31430. return NULL;
  31431. }
  31432. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  31433. if (!_seq) {
  31434. PyMem_Free(_children);
  31435. p->error_indicator = 1;
  31436. PyErr_NoMemory();
  31437. p->level--;
  31438. return NULL;
  31439. }
  31440. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  31441. PyMem_Free(_children);
  31442. p->level--;
  31443. return _seq;
  31444. }
  31445. // _loop0_110: lambda_param_maybe_default
  31446. static asdl_seq *
  31447. _loop0_110_rule(Parser *p)
  31448. {
  31449. if (p->level++ == MAXSTACK) {
  31450. _Pypegen_stack_overflow(p);
  31451. }
  31452. if (p->error_indicator) {
  31453. p->level--;
  31454. return NULL;
  31455. }
  31456. void *_res = NULL;
  31457. int _mark = p->mark;
  31458. void **_children = PyMem_Malloc(sizeof(void *));
  31459. if (!_children) {
  31460. p->error_indicator = 1;
  31461. PyErr_NoMemory();
  31462. p->level--;
  31463. return NULL;
  31464. }
  31465. Py_ssize_t _children_capacity = 1;
  31466. Py_ssize_t _n = 0;
  31467. { // lambda_param_maybe_default
  31468. if (p->error_indicator) {
  31469. p->level--;
  31470. return NULL;
  31471. }
  31472. D(fprintf(stderr, "%*c> _loop0_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
  31473. NameDefaultPair* lambda_param_maybe_default_var;
  31474. while (
  31475. (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
  31476. )
  31477. {
  31478. _res = lambda_param_maybe_default_var;
  31479. if (_n == _children_capacity) {
  31480. _children_capacity *= 2;
  31481. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  31482. if (!_new_children) {
  31483. PyMem_Free(_children);
  31484. p->error_indicator = 1;
  31485. PyErr_NoMemory();
  31486. p->level--;
  31487. return NULL;
  31488. }
  31489. _children = _new_children;
  31490. }
  31491. _children[_n++] = _res;
  31492. _mark = p->mark;
  31493. }
  31494. p->mark = _mark;
  31495. D(fprintf(stderr, "%*c%s _loop0_110[%d-%d]: %s failed!\n", p->level, ' ',
  31496. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
  31497. }
  31498. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  31499. if (!_seq) {
  31500. PyMem_Free(_children);
  31501. p->error_indicator = 1;
  31502. PyErr_NoMemory();
  31503. p->level--;
  31504. return NULL;
  31505. }
  31506. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  31507. PyMem_Free(_children);
  31508. p->level--;
  31509. return _seq;
  31510. }
  31511. // _loop1_111: lambda_param_maybe_default
  31512. static asdl_seq *
  31513. _loop1_111_rule(Parser *p)
  31514. {
  31515. if (p->level++ == MAXSTACK) {
  31516. _Pypegen_stack_overflow(p);
  31517. }
  31518. if (p->error_indicator) {
  31519. p->level--;
  31520. return NULL;
  31521. }
  31522. void *_res = NULL;
  31523. int _mark = p->mark;
  31524. void **_children = PyMem_Malloc(sizeof(void *));
  31525. if (!_children) {
  31526. p->error_indicator = 1;
  31527. PyErr_NoMemory();
  31528. p->level--;
  31529. return NULL;
  31530. }
  31531. Py_ssize_t _children_capacity = 1;
  31532. Py_ssize_t _n = 0;
  31533. { // lambda_param_maybe_default
  31534. if (p->error_indicator) {
  31535. p->level--;
  31536. return NULL;
  31537. }
  31538. D(fprintf(stderr, "%*c> _loop1_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
  31539. NameDefaultPair* lambda_param_maybe_default_var;
  31540. while (
  31541. (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
  31542. )
  31543. {
  31544. _res = lambda_param_maybe_default_var;
  31545. if (_n == _children_capacity) {
  31546. _children_capacity *= 2;
  31547. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  31548. if (!_new_children) {
  31549. PyMem_Free(_children);
  31550. p->error_indicator = 1;
  31551. PyErr_NoMemory();
  31552. p->level--;
  31553. return NULL;
  31554. }
  31555. _children = _new_children;
  31556. }
  31557. _children[_n++] = _res;
  31558. _mark = p->mark;
  31559. }
  31560. p->mark = _mark;
  31561. D(fprintf(stderr, "%*c%s _loop1_111[%d-%d]: %s failed!\n", p->level, ' ',
  31562. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
  31563. }
  31564. if (_n == 0 || p->error_indicator) {
  31565. PyMem_Free(_children);
  31566. p->level--;
  31567. return NULL;
  31568. }
  31569. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  31570. if (!_seq) {
  31571. PyMem_Free(_children);
  31572. p->error_indicator = 1;
  31573. PyErr_NoMemory();
  31574. p->level--;
  31575. return NULL;
  31576. }
  31577. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  31578. PyMem_Free(_children);
  31579. p->level--;
  31580. return _seq;
  31581. }
  31582. // _tmp_112: yield_expr | star_expressions
  31583. static void *
  31584. _tmp_112_rule(Parser *p)
  31585. {
  31586. if (p->level++ == MAXSTACK) {
  31587. _Pypegen_stack_overflow(p);
  31588. }
  31589. if (p->error_indicator) {
  31590. p->level--;
  31591. return NULL;
  31592. }
  31593. void * _res = NULL;
  31594. int _mark = p->mark;
  31595. { // yield_expr
  31596. if (p->error_indicator) {
  31597. p->level--;
  31598. return NULL;
  31599. }
  31600. D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  31601. expr_ty yield_expr_var;
  31602. if (
  31603. (yield_expr_var = yield_expr_rule(p)) // yield_expr
  31604. )
  31605. {
  31606. D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  31607. _res = yield_expr_var;
  31608. goto done;
  31609. }
  31610. p->mark = _mark;
  31611. D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ',
  31612. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
  31613. }
  31614. { // star_expressions
  31615. if (p->error_indicator) {
  31616. p->level--;
  31617. return NULL;
  31618. }
  31619. D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  31620. expr_ty star_expressions_var;
  31621. if (
  31622. (star_expressions_var = star_expressions_rule(p)) // star_expressions
  31623. )
  31624. {
  31625. D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  31626. _res = star_expressions_var;
  31627. goto done;
  31628. }
  31629. p->mark = _mark;
  31630. D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ',
  31631. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
  31632. }
  31633. _res = NULL;
  31634. done:
  31635. p->level--;
  31636. return _res;
  31637. }
  31638. // _loop0_113: fstring_format_spec
  31639. static asdl_seq *
  31640. _loop0_113_rule(Parser *p)
  31641. {
  31642. if (p->level++ == MAXSTACK) {
  31643. _Pypegen_stack_overflow(p);
  31644. }
  31645. if (p->error_indicator) {
  31646. p->level--;
  31647. return NULL;
  31648. }
  31649. void *_res = NULL;
  31650. int _mark = p->mark;
  31651. void **_children = PyMem_Malloc(sizeof(void *));
  31652. if (!_children) {
  31653. p->error_indicator = 1;
  31654. PyErr_NoMemory();
  31655. p->level--;
  31656. return NULL;
  31657. }
  31658. Py_ssize_t _children_capacity = 1;
  31659. Py_ssize_t _n = 0;
  31660. { // fstring_format_spec
  31661. if (p->error_indicator) {
  31662. p->level--;
  31663. return NULL;
  31664. }
  31665. D(fprintf(stderr, "%*c> _loop0_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "fstring_format_spec"));
  31666. expr_ty fstring_format_spec_var;
  31667. while (
  31668. (fstring_format_spec_var = fstring_format_spec_rule(p)) // fstring_format_spec
  31669. )
  31670. {
  31671. _res = fstring_format_spec_var;
  31672. if (_n == _children_capacity) {
  31673. _children_capacity *= 2;
  31674. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  31675. if (!_new_children) {
  31676. PyMem_Free(_children);
  31677. p->error_indicator = 1;
  31678. PyErr_NoMemory();
  31679. p->level--;
  31680. return NULL;
  31681. }
  31682. _children = _new_children;
  31683. }
  31684. _children[_n++] = _res;
  31685. _mark = p->mark;
  31686. }
  31687. p->mark = _mark;
  31688. D(fprintf(stderr, "%*c%s _loop0_113[%d-%d]: %s failed!\n", p->level, ' ',
  31689. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "fstring_format_spec"));
  31690. }
  31691. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  31692. if (!_seq) {
  31693. PyMem_Free(_children);
  31694. p->error_indicator = 1;
  31695. PyErr_NoMemory();
  31696. p->level--;
  31697. return NULL;
  31698. }
  31699. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  31700. PyMem_Free(_children);
  31701. p->level--;
  31702. return _seq;
  31703. }
  31704. // _loop0_114: fstring_middle
  31705. static asdl_seq *
  31706. _loop0_114_rule(Parser *p)
  31707. {
  31708. if (p->level++ == MAXSTACK) {
  31709. _Pypegen_stack_overflow(p);
  31710. }
  31711. if (p->error_indicator) {
  31712. p->level--;
  31713. return NULL;
  31714. }
  31715. void *_res = NULL;
  31716. int _mark = p->mark;
  31717. void **_children = PyMem_Malloc(sizeof(void *));
  31718. if (!_children) {
  31719. p->error_indicator = 1;
  31720. PyErr_NoMemory();
  31721. p->level--;
  31722. return NULL;
  31723. }
  31724. Py_ssize_t _children_capacity = 1;
  31725. Py_ssize_t _n = 0;
  31726. { // fstring_middle
  31727. if (p->error_indicator) {
  31728. p->level--;
  31729. return NULL;
  31730. }
  31731. D(fprintf(stderr, "%*c> _loop0_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "fstring_middle"));
  31732. expr_ty fstring_middle_var;
  31733. while (
  31734. (fstring_middle_var = fstring_middle_rule(p)) // fstring_middle
  31735. )
  31736. {
  31737. _res = fstring_middle_var;
  31738. if (_n == _children_capacity) {
  31739. _children_capacity *= 2;
  31740. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  31741. if (!_new_children) {
  31742. PyMem_Free(_children);
  31743. p->error_indicator = 1;
  31744. PyErr_NoMemory();
  31745. p->level--;
  31746. return NULL;
  31747. }
  31748. _children = _new_children;
  31749. }
  31750. _children[_n++] = _res;
  31751. _mark = p->mark;
  31752. }
  31753. p->mark = _mark;
  31754. D(fprintf(stderr, "%*c%s _loop0_114[%d-%d]: %s failed!\n", p->level, ' ',
  31755. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "fstring_middle"));
  31756. }
  31757. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  31758. if (!_seq) {
  31759. PyMem_Free(_children);
  31760. p->error_indicator = 1;
  31761. PyErr_NoMemory();
  31762. p->level--;
  31763. return NULL;
  31764. }
  31765. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  31766. PyMem_Free(_children);
  31767. p->level--;
  31768. return _seq;
  31769. }
  31770. // _loop1_115: (fstring | string)
  31771. static asdl_seq *
  31772. _loop1_115_rule(Parser *p)
  31773. {
  31774. if (p->level++ == MAXSTACK) {
  31775. _Pypegen_stack_overflow(p);
  31776. }
  31777. if (p->error_indicator) {
  31778. p->level--;
  31779. return NULL;
  31780. }
  31781. void *_res = NULL;
  31782. int _mark = p->mark;
  31783. void **_children = PyMem_Malloc(sizeof(void *));
  31784. if (!_children) {
  31785. p->error_indicator = 1;
  31786. PyErr_NoMemory();
  31787. p->level--;
  31788. return NULL;
  31789. }
  31790. Py_ssize_t _children_capacity = 1;
  31791. Py_ssize_t _n = 0;
  31792. { // (fstring | string)
  31793. if (p->error_indicator) {
  31794. p->level--;
  31795. return NULL;
  31796. }
  31797. D(fprintf(stderr, "%*c> _loop1_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(fstring | string)"));
  31798. void *_tmp_259_var;
  31799. while (
  31800. (_tmp_259_var = _tmp_259_rule(p)) // fstring | string
  31801. )
  31802. {
  31803. _res = _tmp_259_var;
  31804. if (_n == _children_capacity) {
  31805. _children_capacity *= 2;
  31806. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  31807. if (!_new_children) {
  31808. PyMem_Free(_children);
  31809. p->error_indicator = 1;
  31810. PyErr_NoMemory();
  31811. p->level--;
  31812. return NULL;
  31813. }
  31814. _children = _new_children;
  31815. }
  31816. _children[_n++] = _res;
  31817. _mark = p->mark;
  31818. }
  31819. p->mark = _mark;
  31820. D(fprintf(stderr, "%*c%s _loop1_115[%d-%d]: %s failed!\n", p->level, ' ',
  31821. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(fstring | string)"));
  31822. }
  31823. if (_n == 0 || p->error_indicator) {
  31824. PyMem_Free(_children);
  31825. p->level--;
  31826. return NULL;
  31827. }
  31828. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  31829. if (!_seq) {
  31830. PyMem_Free(_children);
  31831. p->error_indicator = 1;
  31832. PyErr_NoMemory();
  31833. p->level--;
  31834. return NULL;
  31835. }
  31836. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  31837. PyMem_Free(_children);
  31838. p->level--;
  31839. return _seq;
  31840. }
  31841. // _tmp_116: star_named_expression ',' star_named_expressions?
  31842. static void *
  31843. _tmp_116_rule(Parser *p)
  31844. {
  31845. if (p->level++ == MAXSTACK) {
  31846. _Pypegen_stack_overflow(p);
  31847. }
  31848. if (p->error_indicator) {
  31849. p->level--;
  31850. return NULL;
  31851. }
  31852. void * _res = NULL;
  31853. int _mark = p->mark;
  31854. { // star_named_expression ',' star_named_expressions?
  31855. if (p->error_indicator) {
  31856. p->level--;
  31857. return NULL;
  31858. }
  31859. D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
  31860. Token * _literal;
  31861. expr_ty y;
  31862. void *z;
  31863. if (
  31864. (y = star_named_expression_rule(p)) // star_named_expression
  31865. &&
  31866. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  31867. &&
  31868. (z = star_named_expressions_rule(p), !p->error_indicator) // star_named_expressions?
  31869. )
  31870. {
  31871. D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
  31872. _res = _PyPegen_seq_insert_in_front ( p , y , z );
  31873. if (_res == NULL && PyErr_Occurred()) {
  31874. p->error_indicator = 1;
  31875. p->level--;
  31876. return NULL;
  31877. }
  31878. goto done;
  31879. }
  31880. p->mark = _mark;
  31881. D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ',
  31882. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
  31883. }
  31884. _res = NULL;
  31885. done:
  31886. p->level--;
  31887. return _res;
  31888. }
  31889. // _loop0_118: ',' double_starred_kvpair
  31890. static asdl_seq *
  31891. _loop0_118_rule(Parser *p)
  31892. {
  31893. if (p->level++ == MAXSTACK) {
  31894. _Pypegen_stack_overflow(p);
  31895. }
  31896. if (p->error_indicator) {
  31897. p->level--;
  31898. return NULL;
  31899. }
  31900. void *_res = NULL;
  31901. int _mark = p->mark;
  31902. void **_children = PyMem_Malloc(sizeof(void *));
  31903. if (!_children) {
  31904. p->error_indicator = 1;
  31905. PyErr_NoMemory();
  31906. p->level--;
  31907. return NULL;
  31908. }
  31909. Py_ssize_t _children_capacity = 1;
  31910. Py_ssize_t _n = 0;
  31911. { // ',' double_starred_kvpair
  31912. if (p->error_indicator) {
  31913. p->level--;
  31914. return NULL;
  31915. }
  31916. D(fprintf(stderr, "%*c> _loop0_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair"));
  31917. Token * _literal;
  31918. KeyValuePair* elem;
  31919. while (
  31920. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  31921. &&
  31922. (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
  31923. )
  31924. {
  31925. _res = elem;
  31926. if (_res == NULL && PyErr_Occurred()) {
  31927. p->error_indicator = 1;
  31928. PyMem_Free(_children);
  31929. p->level--;
  31930. return NULL;
  31931. }
  31932. if (_n == _children_capacity) {
  31933. _children_capacity *= 2;
  31934. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  31935. if (!_new_children) {
  31936. PyMem_Free(_children);
  31937. p->error_indicator = 1;
  31938. PyErr_NoMemory();
  31939. p->level--;
  31940. return NULL;
  31941. }
  31942. _children = _new_children;
  31943. }
  31944. _children[_n++] = _res;
  31945. _mark = p->mark;
  31946. }
  31947. p->mark = _mark;
  31948. D(fprintf(stderr, "%*c%s _loop0_118[%d-%d]: %s failed!\n", p->level, ' ',
  31949. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair"));
  31950. }
  31951. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  31952. if (!_seq) {
  31953. PyMem_Free(_children);
  31954. p->error_indicator = 1;
  31955. PyErr_NoMemory();
  31956. p->level--;
  31957. return NULL;
  31958. }
  31959. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  31960. PyMem_Free(_children);
  31961. p->level--;
  31962. return _seq;
  31963. }
  31964. // _gather_117: double_starred_kvpair _loop0_118
  31965. static asdl_seq *
  31966. _gather_117_rule(Parser *p)
  31967. {
  31968. if (p->level++ == MAXSTACK) {
  31969. _Pypegen_stack_overflow(p);
  31970. }
  31971. if (p->error_indicator) {
  31972. p->level--;
  31973. return NULL;
  31974. }
  31975. asdl_seq * _res = NULL;
  31976. int _mark = p->mark;
  31977. { // double_starred_kvpair _loop0_118
  31978. if (p->error_indicator) {
  31979. p->level--;
  31980. return NULL;
  31981. }
  31982. D(fprintf(stderr, "%*c> _gather_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_118"));
  31983. KeyValuePair* elem;
  31984. asdl_seq * seq;
  31985. if (
  31986. (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
  31987. &&
  31988. (seq = _loop0_118_rule(p)) // _loop0_118
  31989. )
  31990. {
  31991. D(fprintf(stderr, "%*c+ _gather_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_118"));
  31992. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  31993. goto done;
  31994. }
  31995. p->mark = _mark;
  31996. D(fprintf(stderr, "%*c%s _gather_117[%d-%d]: %s failed!\n", p->level, ' ',
  31997. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_118"));
  31998. }
  31999. _res = NULL;
  32000. done:
  32001. p->level--;
  32002. return _res;
  32003. }
  32004. // _loop1_119: for_if_clause
  32005. static asdl_seq *
  32006. _loop1_119_rule(Parser *p)
  32007. {
  32008. if (p->level++ == MAXSTACK) {
  32009. _Pypegen_stack_overflow(p);
  32010. }
  32011. if (p->error_indicator) {
  32012. p->level--;
  32013. return NULL;
  32014. }
  32015. void *_res = NULL;
  32016. int _mark = p->mark;
  32017. void **_children = PyMem_Malloc(sizeof(void *));
  32018. if (!_children) {
  32019. p->error_indicator = 1;
  32020. PyErr_NoMemory();
  32021. p->level--;
  32022. return NULL;
  32023. }
  32024. Py_ssize_t _children_capacity = 1;
  32025. Py_ssize_t _n = 0;
  32026. { // for_if_clause
  32027. if (p->error_indicator) {
  32028. p->level--;
  32029. return NULL;
  32030. }
  32031. D(fprintf(stderr, "%*c> _loop1_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause"));
  32032. comprehension_ty for_if_clause_var;
  32033. while (
  32034. (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause
  32035. )
  32036. {
  32037. _res = for_if_clause_var;
  32038. if (_n == _children_capacity) {
  32039. _children_capacity *= 2;
  32040. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  32041. if (!_new_children) {
  32042. PyMem_Free(_children);
  32043. p->error_indicator = 1;
  32044. PyErr_NoMemory();
  32045. p->level--;
  32046. return NULL;
  32047. }
  32048. _children = _new_children;
  32049. }
  32050. _children[_n++] = _res;
  32051. _mark = p->mark;
  32052. }
  32053. p->mark = _mark;
  32054. D(fprintf(stderr, "%*c%s _loop1_119[%d-%d]: %s failed!\n", p->level, ' ',
  32055. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause"));
  32056. }
  32057. if (_n == 0 || p->error_indicator) {
  32058. PyMem_Free(_children);
  32059. p->level--;
  32060. return NULL;
  32061. }
  32062. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  32063. if (!_seq) {
  32064. PyMem_Free(_children);
  32065. p->error_indicator = 1;
  32066. PyErr_NoMemory();
  32067. p->level--;
  32068. return NULL;
  32069. }
  32070. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  32071. PyMem_Free(_children);
  32072. p->level--;
  32073. return _seq;
  32074. }
  32075. // _loop0_120: ('if' disjunction)
  32076. static asdl_seq *
  32077. _loop0_120_rule(Parser *p)
  32078. {
  32079. if (p->level++ == MAXSTACK) {
  32080. _Pypegen_stack_overflow(p);
  32081. }
  32082. if (p->error_indicator) {
  32083. p->level--;
  32084. return NULL;
  32085. }
  32086. void *_res = NULL;
  32087. int _mark = p->mark;
  32088. void **_children = PyMem_Malloc(sizeof(void *));
  32089. if (!_children) {
  32090. p->error_indicator = 1;
  32091. PyErr_NoMemory();
  32092. p->level--;
  32093. return NULL;
  32094. }
  32095. Py_ssize_t _children_capacity = 1;
  32096. Py_ssize_t _n = 0;
  32097. { // ('if' disjunction)
  32098. if (p->error_indicator) {
  32099. p->level--;
  32100. return NULL;
  32101. }
  32102. D(fprintf(stderr, "%*c> _loop0_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
  32103. void *_tmp_260_var;
  32104. while (
  32105. (_tmp_260_var = _tmp_260_rule(p)) // 'if' disjunction
  32106. )
  32107. {
  32108. _res = _tmp_260_var;
  32109. if (_n == _children_capacity) {
  32110. _children_capacity *= 2;
  32111. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  32112. if (!_new_children) {
  32113. PyMem_Free(_children);
  32114. p->error_indicator = 1;
  32115. PyErr_NoMemory();
  32116. p->level--;
  32117. return NULL;
  32118. }
  32119. _children = _new_children;
  32120. }
  32121. _children[_n++] = _res;
  32122. _mark = p->mark;
  32123. }
  32124. p->mark = _mark;
  32125. D(fprintf(stderr, "%*c%s _loop0_120[%d-%d]: %s failed!\n", p->level, ' ',
  32126. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
  32127. }
  32128. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  32129. if (!_seq) {
  32130. PyMem_Free(_children);
  32131. p->error_indicator = 1;
  32132. PyErr_NoMemory();
  32133. p->level--;
  32134. return NULL;
  32135. }
  32136. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  32137. PyMem_Free(_children);
  32138. p->level--;
  32139. return _seq;
  32140. }
  32141. // _loop0_121: ('if' disjunction)
  32142. static asdl_seq *
  32143. _loop0_121_rule(Parser *p)
  32144. {
  32145. if (p->level++ == MAXSTACK) {
  32146. _Pypegen_stack_overflow(p);
  32147. }
  32148. if (p->error_indicator) {
  32149. p->level--;
  32150. return NULL;
  32151. }
  32152. void *_res = NULL;
  32153. int _mark = p->mark;
  32154. void **_children = PyMem_Malloc(sizeof(void *));
  32155. if (!_children) {
  32156. p->error_indicator = 1;
  32157. PyErr_NoMemory();
  32158. p->level--;
  32159. return NULL;
  32160. }
  32161. Py_ssize_t _children_capacity = 1;
  32162. Py_ssize_t _n = 0;
  32163. { // ('if' disjunction)
  32164. if (p->error_indicator) {
  32165. p->level--;
  32166. return NULL;
  32167. }
  32168. D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
  32169. void *_tmp_261_var;
  32170. while (
  32171. (_tmp_261_var = _tmp_261_rule(p)) // 'if' disjunction
  32172. )
  32173. {
  32174. _res = _tmp_261_var;
  32175. if (_n == _children_capacity) {
  32176. _children_capacity *= 2;
  32177. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  32178. if (!_new_children) {
  32179. PyMem_Free(_children);
  32180. p->error_indicator = 1;
  32181. PyErr_NoMemory();
  32182. p->level--;
  32183. return NULL;
  32184. }
  32185. _children = _new_children;
  32186. }
  32187. _children[_n++] = _res;
  32188. _mark = p->mark;
  32189. }
  32190. p->mark = _mark;
  32191. D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n", p->level, ' ',
  32192. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
  32193. }
  32194. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  32195. if (!_seq) {
  32196. PyMem_Free(_children);
  32197. p->error_indicator = 1;
  32198. PyErr_NoMemory();
  32199. p->level--;
  32200. return NULL;
  32201. }
  32202. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  32203. PyMem_Free(_children);
  32204. p->level--;
  32205. return _seq;
  32206. }
  32207. // _tmp_122: assignment_expression | expression !':='
  32208. static void *
  32209. _tmp_122_rule(Parser *p)
  32210. {
  32211. if (p->level++ == MAXSTACK) {
  32212. _Pypegen_stack_overflow(p);
  32213. }
  32214. if (p->error_indicator) {
  32215. p->level--;
  32216. return NULL;
  32217. }
  32218. void * _res = NULL;
  32219. int _mark = p->mark;
  32220. { // assignment_expression
  32221. if (p->error_indicator) {
  32222. p->level--;
  32223. return NULL;
  32224. }
  32225. D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
  32226. expr_ty assignment_expression_var;
  32227. if (
  32228. (assignment_expression_var = assignment_expression_rule(p)) // assignment_expression
  32229. )
  32230. {
  32231. D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
  32232. _res = assignment_expression_var;
  32233. goto done;
  32234. }
  32235. p->mark = _mark;
  32236. D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ',
  32237. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment_expression"));
  32238. }
  32239. { // expression !':='
  32240. if (p->error_indicator) {
  32241. p->level--;
  32242. return NULL;
  32243. }
  32244. D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
  32245. expr_ty expression_var;
  32246. if (
  32247. (expression_var = expression_rule(p)) // expression
  32248. &&
  32249. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':='
  32250. )
  32251. {
  32252. D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
  32253. _res = expression_var;
  32254. goto done;
  32255. }
  32256. p->mark = _mark;
  32257. D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ',
  32258. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
  32259. }
  32260. _res = NULL;
  32261. done:
  32262. p->level--;
  32263. return _res;
  32264. }
  32265. // _loop0_124: ',' (starred_expression | (assignment_expression | expression !':=') !'=')
  32266. static asdl_seq *
  32267. _loop0_124_rule(Parser *p)
  32268. {
  32269. if (p->level++ == MAXSTACK) {
  32270. _Pypegen_stack_overflow(p);
  32271. }
  32272. if (p->error_indicator) {
  32273. p->level--;
  32274. return NULL;
  32275. }
  32276. void *_res = NULL;
  32277. int _mark = p->mark;
  32278. void **_children = PyMem_Malloc(sizeof(void *));
  32279. if (!_children) {
  32280. p->error_indicator = 1;
  32281. PyErr_NoMemory();
  32282. p->level--;
  32283. return NULL;
  32284. }
  32285. Py_ssize_t _children_capacity = 1;
  32286. Py_ssize_t _n = 0;
  32287. { // ',' (starred_expression | (assignment_expression | expression !':=') !'=')
  32288. if (p->error_indicator) {
  32289. p->level--;
  32290. return NULL;
  32291. }
  32292. D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | (assignment_expression | expression !':=') !'=')"));
  32293. Token * _literal;
  32294. void *elem;
  32295. while (
  32296. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  32297. &&
  32298. (elem = _tmp_262_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'='
  32299. )
  32300. {
  32301. _res = elem;
  32302. if (_res == NULL && PyErr_Occurred()) {
  32303. p->error_indicator = 1;
  32304. PyMem_Free(_children);
  32305. p->level--;
  32306. return NULL;
  32307. }
  32308. if (_n == _children_capacity) {
  32309. _children_capacity *= 2;
  32310. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  32311. if (!_new_children) {
  32312. PyMem_Free(_children);
  32313. p->error_indicator = 1;
  32314. PyErr_NoMemory();
  32315. p->level--;
  32316. return NULL;
  32317. }
  32318. _children = _new_children;
  32319. }
  32320. _children[_n++] = _res;
  32321. _mark = p->mark;
  32322. }
  32323. p->mark = _mark;
  32324. D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n", p->level, ' ',
  32325. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | (assignment_expression | expression !':=') !'=')"));
  32326. }
  32327. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  32328. if (!_seq) {
  32329. PyMem_Free(_children);
  32330. p->error_indicator = 1;
  32331. PyErr_NoMemory();
  32332. p->level--;
  32333. return NULL;
  32334. }
  32335. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  32336. PyMem_Free(_children);
  32337. p->level--;
  32338. return _seq;
  32339. }
  32340. // _gather_123:
  32341. // | (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_124
  32342. static asdl_seq *
  32343. _gather_123_rule(Parser *p)
  32344. {
  32345. if (p->level++ == MAXSTACK) {
  32346. _Pypegen_stack_overflow(p);
  32347. }
  32348. if (p->error_indicator) {
  32349. p->level--;
  32350. return NULL;
  32351. }
  32352. asdl_seq * _res = NULL;
  32353. int _mark = p->mark;
  32354. { // (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_124
  32355. if (p->error_indicator) {
  32356. p->level--;
  32357. return NULL;
  32358. }
  32359. D(fprintf(stderr, "%*c> _gather_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_124"));
  32360. void *elem;
  32361. asdl_seq * seq;
  32362. if (
  32363. (elem = _tmp_262_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'='
  32364. &&
  32365. (seq = _loop0_124_rule(p)) // _loop0_124
  32366. )
  32367. {
  32368. D(fprintf(stderr, "%*c+ _gather_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_124"));
  32369. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  32370. goto done;
  32371. }
  32372. p->mark = _mark;
  32373. D(fprintf(stderr, "%*c%s _gather_123[%d-%d]: %s failed!\n", p->level, ' ',
  32374. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_124"));
  32375. }
  32376. _res = NULL;
  32377. done:
  32378. p->level--;
  32379. return _res;
  32380. }
  32381. // _tmp_125: ',' kwargs
  32382. static void *
  32383. _tmp_125_rule(Parser *p)
  32384. {
  32385. if (p->level++ == MAXSTACK) {
  32386. _Pypegen_stack_overflow(p);
  32387. }
  32388. if (p->error_indicator) {
  32389. p->level--;
  32390. return NULL;
  32391. }
  32392. void * _res = NULL;
  32393. int _mark = p->mark;
  32394. { // ',' kwargs
  32395. if (p->error_indicator) {
  32396. p->level--;
  32397. return NULL;
  32398. }
  32399. D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
  32400. Token * _literal;
  32401. asdl_seq* k;
  32402. if (
  32403. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  32404. &&
  32405. (k = kwargs_rule(p)) // kwargs
  32406. )
  32407. {
  32408. D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
  32409. _res = k;
  32410. if (_res == NULL && PyErr_Occurred()) {
  32411. p->error_indicator = 1;
  32412. p->level--;
  32413. return NULL;
  32414. }
  32415. goto done;
  32416. }
  32417. p->mark = _mark;
  32418. D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ',
  32419. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs"));
  32420. }
  32421. _res = NULL;
  32422. done:
  32423. p->level--;
  32424. return _res;
  32425. }
  32426. // _loop0_127: ',' kwarg_or_starred
  32427. static asdl_seq *
  32428. _loop0_127_rule(Parser *p)
  32429. {
  32430. if (p->level++ == MAXSTACK) {
  32431. _Pypegen_stack_overflow(p);
  32432. }
  32433. if (p->error_indicator) {
  32434. p->level--;
  32435. return NULL;
  32436. }
  32437. void *_res = NULL;
  32438. int _mark = p->mark;
  32439. void **_children = PyMem_Malloc(sizeof(void *));
  32440. if (!_children) {
  32441. p->error_indicator = 1;
  32442. PyErr_NoMemory();
  32443. p->level--;
  32444. return NULL;
  32445. }
  32446. Py_ssize_t _children_capacity = 1;
  32447. Py_ssize_t _n = 0;
  32448. { // ',' kwarg_or_starred
  32449. if (p->error_indicator) {
  32450. p->level--;
  32451. return NULL;
  32452. }
  32453. D(fprintf(stderr, "%*c> _loop0_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
  32454. Token * _literal;
  32455. KeywordOrStarred* elem;
  32456. while (
  32457. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  32458. &&
  32459. (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
  32460. )
  32461. {
  32462. _res = elem;
  32463. if (_res == NULL && PyErr_Occurred()) {
  32464. p->error_indicator = 1;
  32465. PyMem_Free(_children);
  32466. p->level--;
  32467. return NULL;
  32468. }
  32469. if (_n == _children_capacity) {
  32470. _children_capacity *= 2;
  32471. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  32472. if (!_new_children) {
  32473. PyMem_Free(_children);
  32474. p->error_indicator = 1;
  32475. PyErr_NoMemory();
  32476. p->level--;
  32477. return NULL;
  32478. }
  32479. _children = _new_children;
  32480. }
  32481. _children[_n++] = _res;
  32482. _mark = p->mark;
  32483. }
  32484. p->mark = _mark;
  32485. D(fprintf(stderr, "%*c%s _loop0_127[%d-%d]: %s failed!\n", p->level, ' ',
  32486. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
  32487. }
  32488. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  32489. if (!_seq) {
  32490. PyMem_Free(_children);
  32491. p->error_indicator = 1;
  32492. PyErr_NoMemory();
  32493. p->level--;
  32494. return NULL;
  32495. }
  32496. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  32497. PyMem_Free(_children);
  32498. p->level--;
  32499. return _seq;
  32500. }
  32501. // _gather_126: kwarg_or_starred _loop0_127
  32502. static asdl_seq *
  32503. _gather_126_rule(Parser *p)
  32504. {
  32505. if (p->level++ == MAXSTACK) {
  32506. _Pypegen_stack_overflow(p);
  32507. }
  32508. if (p->error_indicator) {
  32509. p->level--;
  32510. return NULL;
  32511. }
  32512. asdl_seq * _res = NULL;
  32513. int _mark = p->mark;
  32514. { // kwarg_or_starred _loop0_127
  32515. if (p->error_indicator) {
  32516. p->level--;
  32517. return NULL;
  32518. }
  32519. D(fprintf(stderr, "%*c> _gather_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_127"));
  32520. KeywordOrStarred* elem;
  32521. asdl_seq * seq;
  32522. if (
  32523. (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
  32524. &&
  32525. (seq = _loop0_127_rule(p)) // _loop0_127
  32526. )
  32527. {
  32528. D(fprintf(stderr, "%*c+ _gather_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_127"));
  32529. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  32530. goto done;
  32531. }
  32532. p->mark = _mark;
  32533. D(fprintf(stderr, "%*c%s _gather_126[%d-%d]: %s failed!\n", p->level, ' ',
  32534. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_127"));
  32535. }
  32536. _res = NULL;
  32537. done:
  32538. p->level--;
  32539. return _res;
  32540. }
  32541. // _loop0_129: ',' kwarg_or_double_starred
  32542. static asdl_seq *
  32543. _loop0_129_rule(Parser *p)
  32544. {
  32545. if (p->level++ == MAXSTACK) {
  32546. _Pypegen_stack_overflow(p);
  32547. }
  32548. if (p->error_indicator) {
  32549. p->level--;
  32550. return NULL;
  32551. }
  32552. void *_res = NULL;
  32553. int _mark = p->mark;
  32554. void **_children = PyMem_Malloc(sizeof(void *));
  32555. if (!_children) {
  32556. p->error_indicator = 1;
  32557. PyErr_NoMemory();
  32558. p->level--;
  32559. return NULL;
  32560. }
  32561. Py_ssize_t _children_capacity = 1;
  32562. Py_ssize_t _n = 0;
  32563. { // ',' kwarg_or_double_starred
  32564. if (p->error_indicator) {
  32565. p->level--;
  32566. return NULL;
  32567. }
  32568. D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
  32569. Token * _literal;
  32570. KeywordOrStarred* elem;
  32571. while (
  32572. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  32573. &&
  32574. (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
  32575. )
  32576. {
  32577. _res = elem;
  32578. if (_res == NULL && PyErr_Occurred()) {
  32579. p->error_indicator = 1;
  32580. PyMem_Free(_children);
  32581. p->level--;
  32582. return NULL;
  32583. }
  32584. if (_n == _children_capacity) {
  32585. _children_capacity *= 2;
  32586. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  32587. if (!_new_children) {
  32588. PyMem_Free(_children);
  32589. p->error_indicator = 1;
  32590. PyErr_NoMemory();
  32591. p->level--;
  32592. return NULL;
  32593. }
  32594. _children = _new_children;
  32595. }
  32596. _children[_n++] = _res;
  32597. _mark = p->mark;
  32598. }
  32599. p->mark = _mark;
  32600. D(fprintf(stderr, "%*c%s _loop0_129[%d-%d]: %s failed!\n", p->level, ' ',
  32601. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
  32602. }
  32603. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  32604. if (!_seq) {
  32605. PyMem_Free(_children);
  32606. p->error_indicator = 1;
  32607. PyErr_NoMemory();
  32608. p->level--;
  32609. return NULL;
  32610. }
  32611. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  32612. PyMem_Free(_children);
  32613. p->level--;
  32614. return _seq;
  32615. }
  32616. // _gather_128: kwarg_or_double_starred _loop0_129
  32617. static asdl_seq *
  32618. _gather_128_rule(Parser *p)
  32619. {
  32620. if (p->level++ == MAXSTACK) {
  32621. _Pypegen_stack_overflow(p);
  32622. }
  32623. if (p->error_indicator) {
  32624. p->level--;
  32625. return NULL;
  32626. }
  32627. asdl_seq * _res = NULL;
  32628. int _mark = p->mark;
  32629. { // kwarg_or_double_starred _loop0_129
  32630. if (p->error_indicator) {
  32631. p->level--;
  32632. return NULL;
  32633. }
  32634. D(fprintf(stderr, "%*c> _gather_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_129"));
  32635. KeywordOrStarred* elem;
  32636. asdl_seq * seq;
  32637. if (
  32638. (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
  32639. &&
  32640. (seq = _loop0_129_rule(p)) // _loop0_129
  32641. )
  32642. {
  32643. D(fprintf(stderr, "%*c+ _gather_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_129"));
  32644. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  32645. goto done;
  32646. }
  32647. p->mark = _mark;
  32648. D(fprintf(stderr, "%*c%s _gather_128[%d-%d]: %s failed!\n", p->level, ' ',
  32649. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_129"));
  32650. }
  32651. _res = NULL;
  32652. done:
  32653. p->level--;
  32654. return _res;
  32655. }
  32656. // _loop0_131: ',' kwarg_or_starred
  32657. static asdl_seq *
  32658. _loop0_131_rule(Parser *p)
  32659. {
  32660. if (p->level++ == MAXSTACK) {
  32661. _Pypegen_stack_overflow(p);
  32662. }
  32663. if (p->error_indicator) {
  32664. p->level--;
  32665. return NULL;
  32666. }
  32667. void *_res = NULL;
  32668. int _mark = p->mark;
  32669. void **_children = PyMem_Malloc(sizeof(void *));
  32670. if (!_children) {
  32671. p->error_indicator = 1;
  32672. PyErr_NoMemory();
  32673. p->level--;
  32674. return NULL;
  32675. }
  32676. Py_ssize_t _children_capacity = 1;
  32677. Py_ssize_t _n = 0;
  32678. { // ',' kwarg_or_starred
  32679. if (p->error_indicator) {
  32680. p->level--;
  32681. return NULL;
  32682. }
  32683. D(fprintf(stderr, "%*c> _loop0_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
  32684. Token * _literal;
  32685. KeywordOrStarred* elem;
  32686. while (
  32687. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  32688. &&
  32689. (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
  32690. )
  32691. {
  32692. _res = elem;
  32693. if (_res == NULL && PyErr_Occurred()) {
  32694. p->error_indicator = 1;
  32695. PyMem_Free(_children);
  32696. p->level--;
  32697. return NULL;
  32698. }
  32699. if (_n == _children_capacity) {
  32700. _children_capacity *= 2;
  32701. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  32702. if (!_new_children) {
  32703. PyMem_Free(_children);
  32704. p->error_indicator = 1;
  32705. PyErr_NoMemory();
  32706. p->level--;
  32707. return NULL;
  32708. }
  32709. _children = _new_children;
  32710. }
  32711. _children[_n++] = _res;
  32712. _mark = p->mark;
  32713. }
  32714. p->mark = _mark;
  32715. D(fprintf(stderr, "%*c%s _loop0_131[%d-%d]: %s failed!\n", p->level, ' ',
  32716. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
  32717. }
  32718. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  32719. if (!_seq) {
  32720. PyMem_Free(_children);
  32721. p->error_indicator = 1;
  32722. PyErr_NoMemory();
  32723. p->level--;
  32724. return NULL;
  32725. }
  32726. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  32727. PyMem_Free(_children);
  32728. p->level--;
  32729. return _seq;
  32730. }
  32731. // _gather_130: kwarg_or_starred _loop0_131
  32732. static asdl_seq *
  32733. _gather_130_rule(Parser *p)
  32734. {
  32735. if (p->level++ == MAXSTACK) {
  32736. _Pypegen_stack_overflow(p);
  32737. }
  32738. if (p->error_indicator) {
  32739. p->level--;
  32740. return NULL;
  32741. }
  32742. asdl_seq * _res = NULL;
  32743. int _mark = p->mark;
  32744. { // kwarg_or_starred _loop0_131
  32745. if (p->error_indicator) {
  32746. p->level--;
  32747. return NULL;
  32748. }
  32749. D(fprintf(stderr, "%*c> _gather_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_131"));
  32750. KeywordOrStarred* elem;
  32751. asdl_seq * seq;
  32752. if (
  32753. (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
  32754. &&
  32755. (seq = _loop0_131_rule(p)) // _loop0_131
  32756. )
  32757. {
  32758. D(fprintf(stderr, "%*c+ _gather_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_131"));
  32759. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  32760. goto done;
  32761. }
  32762. p->mark = _mark;
  32763. D(fprintf(stderr, "%*c%s _gather_130[%d-%d]: %s failed!\n", p->level, ' ',
  32764. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_131"));
  32765. }
  32766. _res = NULL;
  32767. done:
  32768. p->level--;
  32769. return _res;
  32770. }
  32771. // _loop0_133: ',' kwarg_or_double_starred
  32772. static asdl_seq *
  32773. _loop0_133_rule(Parser *p)
  32774. {
  32775. if (p->level++ == MAXSTACK) {
  32776. _Pypegen_stack_overflow(p);
  32777. }
  32778. if (p->error_indicator) {
  32779. p->level--;
  32780. return NULL;
  32781. }
  32782. void *_res = NULL;
  32783. int _mark = p->mark;
  32784. void **_children = PyMem_Malloc(sizeof(void *));
  32785. if (!_children) {
  32786. p->error_indicator = 1;
  32787. PyErr_NoMemory();
  32788. p->level--;
  32789. return NULL;
  32790. }
  32791. Py_ssize_t _children_capacity = 1;
  32792. Py_ssize_t _n = 0;
  32793. { // ',' kwarg_or_double_starred
  32794. if (p->error_indicator) {
  32795. p->level--;
  32796. return NULL;
  32797. }
  32798. D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
  32799. Token * _literal;
  32800. KeywordOrStarred* elem;
  32801. while (
  32802. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  32803. &&
  32804. (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
  32805. )
  32806. {
  32807. _res = elem;
  32808. if (_res == NULL && PyErr_Occurred()) {
  32809. p->error_indicator = 1;
  32810. PyMem_Free(_children);
  32811. p->level--;
  32812. return NULL;
  32813. }
  32814. if (_n == _children_capacity) {
  32815. _children_capacity *= 2;
  32816. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  32817. if (!_new_children) {
  32818. PyMem_Free(_children);
  32819. p->error_indicator = 1;
  32820. PyErr_NoMemory();
  32821. p->level--;
  32822. return NULL;
  32823. }
  32824. _children = _new_children;
  32825. }
  32826. _children[_n++] = _res;
  32827. _mark = p->mark;
  32828. }
  32829. p->mark = _mark;
  32830. D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ',
  32831. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
  32832. }
  32833. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  32834. if (!_seq) {
  32835. PyMem_Free(_children);
  32836. p->error_indicator = 1;
  32837. PyErr_NoMemory();
  32838. p->level--;
  32839. return NULL;
  32840. }
  32841. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  32842. PyMem_Free(_children);
  32843. p->level--;
  32844. return _seq;
  32845. }
  32846. // _gather_132: kwarg_or_double_starred _loop0_133
  32847. static asdl_seq *
  32848. _gather_132_rule(Parser *p)
  32849. {
  32850. if (p->level++ == MAXSTACK) {
  32851. _Pypegen_stack_overflow(p);
  32852. }
  32853. if (p->error_indicator) {
  32854. p->level--;
  32855. return NULL;
  32856. }
  32857. asdl_seq * _res = NULL;
  32858. int _mark = p->mark;
  32859. { // kwarg_or_double_starred _loop0_133
  32860. if (p->error_indicator) {
  32861. p->level--;
  32862. return NULL;
  32863. }
  32864. D(fprintf(stderr, "%*c> _gather_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_133"));
  32865. KeywordOrStarred* elem;
  32866. asdl_seq * seq;
  32867. if (
  32868. (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
  32869. &&
  32870. (seq = _loop0_133_rule(p)) // _loop0_133
  32871. )
  32872. {
  32873. D(fprintf(stderr, "%*c+ _gather_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_133"));
  32874. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  32875. goto done;
  32876. }
  32877. p->mark = _mark;
  32878. D(fprintf(stderr, "%*c%s _gather_132[%d-%d]: %s failed!\n", p->level, ' ',
  32879. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_133"));
  32880. }
  32881. _res = NULL;
  32882. done:
  32883. p->level--;
  32884. return _res;
  32885. }
  32886. // _loop0_134: (',' star_target)
  32887. static asdl_seq *
  32888. _loop0_134_rule(Parser *p)
  32889. {
  32890. if (p->level++ == MAXSTACK) {
  32891. _Pypegen_stack_overflow(p);
  32892. }
  32893. if (p->error_indicator) {
  32894. p->level--;
  32895. return NULL;
  32896. }
  32897. void *_res = NULL;
  32898. int _mark = p->mark;
  32899. void **_children = PyMem_Malloc(sizeof(void *));
  32900. if (!_children) {
  32901. p->error_indicator = 1;
  32902. PyErr_NoMemory();
  32903. p->level--;
  32904. return NULL;
  32905. }
  32906. Py_ssize_t _children_capacity = 1;
  32907. Py_ssize_t _n = 0;
  32908. { // (',' star_target)
  32909. if (p->error_indicator) {
  32910. p->level--;
  32911. return NULL;
  32912. }
  32913. D(fprintf(stderr, "%*c> _loop0_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
  32914. void *_tmp_263_var;
  32915. while (
  32916. (_tmp_263_var = _tmp_263_rule(p)) // ',' star_target
  32917. )
  32918. {
  32919. _res = _tmp_263_var;
  32920. if (_n == _children_capacity) {
  32921. _children_capacity *= 2;
  32922. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  32923. if (!_new_children) {
  32924. PyMem_Free(_children);
  32925. p->error_indicator = 1;
  32926. PyErr_NoMemory();
  32927. p->level--;
  32928. return NULL;
  32929. }
  32930. _children = _new_children;
  32931. }
  32932. _children[_n++] = _res;
  32933. _mark = p->mark;
  32934. }
  32935. p->mark = _mark;
  32936. D(fprintf(stderr, "%*c%s _loop0_134[%d-%d]: %s failed!\n", p->level, ' ',
  32937. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
  32938. }
  32939. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  32940. if (!_seq) {
  32941. PyMem_Free(_children);
  32942. p->error_indicator = 1;
  32943. PyErr_NoMemory();
  32944. p->level--;
  32945. return NULL;
  32946. }
  32947. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  32948. PyMem_Free(_children);
  32949. p->level--;
  32950. return _seq;
  32951. }
  32952. // _loop0_136: ',' star_target
  32953. static asdl_seq *
  32954. _loop0_136_rule(Parser *p)
  32955. {
  32956. if (p->level++ == MAXSTACK) {
  32957. _Pypegen_stack_overflow(p);
  32958. }
  32959. if (p->error_indicator) {
  32960. p->level--;
  32961. return NULL;
  32962. }
  32963. void *_res = NULL;
  32964. int _mark = p->mark;
  32965. void **_children = PyMem_Malloc(sizeof(void *));
  32966. if (!_children) {
  32967. p->error_indicator = 1;
  32968. PyErr_NoMemory();
  32969. p->level--;
  32970. return NULL;
  32971. }
  32972. Py_ssize_t _children_capacity = 1;
  32973. Py_ssize_t _n = 0;
  32974. { // ',' star_target
  32975. if (p->error_indicator) {
  32976. p->level--;
  32977. return NULL;
  32978. }
  32979. D(fprintf(stderr, "%*c> _loop0_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
  32980. Token * _literal;
  32981. expr_ty elem;
  32982. while (
  32983. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  32984. &&
  32985. (elem = star_target_rule(p)) // star_target
  32986. )
  32987. {
  32988. _res = elem;
  32989. if (_res == NULL && PyErr_Occurred()) {
  32990. p->error_indicator = 1;
  32991. PyMem_Free(_children);
  32992. p->level--;
  32993. return NULL;
  32994. }
  32995. if (_n == _children_capacity) {
  32996. _children_capacity *= 2;
  32997. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  32998. if (!_new_children) {
  32999. PyMem_Free(_children);
  33000. p->error_indicator = 1;
  33001. PyErr_NoMemory();
  33002. p->level--;
  33003. return NULL;
  33004. }
  33005. _children = _new_children;
  33006. }
  33007. _children[_n++] = _res;
  33008. _mark = p->mark;
  33009. }
  33010. p->mark = _mark;
  33011. D(fprintf(stderr, "%*c%s _loop0_136[%d-%d]: %s failed!\n", p->level, ' ',
  33012. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
  33013. }
  33014. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  33015. if (!_seq) {
  33016. PyMem_Free(_children);
  33017. p->error_indicator = 1;
  33018. PyErr_NoMemory();
  33019. p->level--;
  33020. return NULL;
  33021. }
  33022. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  33023. PyMem_Free(_children);
  33024. p->level--;
  33025. return _seq;
  33026. }
  33027. // _gather_135: star_target _loop0_136
  33028. static asdl_seq *
  33029. _gather_135_rule(Parser *p)
  33030. {
  33031. if (p->level++ == MAXSTACK) {
  33032. _Pypegen_stack_overflow(p);
  33033. }
  33034. if (p->error_indicator) {
  33035. p->level--;
  33036. return NULL;
  33037. }
  33038. asdl_seq * _res = NULL;
  33039. int _mark = p->mark;
  33040. { // star_target _loop0_136
  33041. if (p->error_indicator) {
  33042. p->level--;
  33043. return NULL;
  33044. }
  33045. D(fprintf(stderr, "%*c> _gather_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_136"));
  33046. expr_ty elem;
  33047. asdl_seq * seq;
  33048. if (
  33049. (elem = star_target_rule(p)) // star_target
  33050. &&
  33051. (seq = _loop0_136_rule(p)) // _loop0_136
  33052. )
  33053. {
  33054. D(fprintf(stderr, "%*c+ _gather_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_136"));
  33055. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  33056. goto done;
  33057. }
  33058. p->mark = _mark;
  33059. D(fprintf(stderr, "%*c%s _gather_135[%d-%d]: %s failed!\n", p->level, ' ',
  33060. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_136"));
  33061. }
  33062. _res = NULL;
  33063. done:
  33064. p->level--;
  33065. return _res;
  33066. }
  33067. // _loop1_137: (',' star_target)
  33068. static asdl_seq *
  33069. _loop1_137_rule(Parser *p)
  33070. {
  33071. if (p->level++ == MAXSTACK) {
  33072. _Pypegen_stack_overflow(p);
  33073. }
  33074. if (p->error_indicator) {
  33075. p->level--;
  33076. return NULL;
  33077. }
  33078. void *_res = NULL;
  33079. int _mark = p->mark;
  33080. void **_children = PyMem_Malloc(sizeof(void *));
  33081. if (!_children) {
  33082. p->error_indicator = 1;
  33083. PyErr_NoMemory();
  33084. p->level--;
  33085. return NULL;
  33086. }
  33087. Py_ssize_t _children_capacity = 1;
  33088. Py_ssize_t _n = 0;
  33089. { // (',' star_target)
  33090. if (p->error_indicator) {
  33091. p->level--;
  33092. return NULL;
  33093. }
  33094. D(fprintf(stderr, "%*c> _loop1_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
  33095. void *_tmp_264_var;
  33096. while (
  33097. (_tmp_264_var = _tmp_264_rule(p)) // ',' star_target
  33098. )
  33099. {
  33100. _res = _tmp_264_var;
  33101. if (_n == _children_capacity) {
  33102. _children_capacity *= 2;
  33103. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  33104. if (!_new_children) {
  33105. PyMem_Free(_children);
  33106. p->error_indicator = 1;
  33107. PyErr_NoMemory();
  33108. p->level--;
  33109. return NULL;
  33110. }
  33111. _children = _new_children;
  33112. }
  33113. _children[_n++] = _res;
  33114. _mark = p->mark;
  33115. }
  33116. p->mark = _mark;
  33117. D(fprintf(stderr, "%*c%s _loop1_137[%d-%d]: %s failed!\n", p->level, ' ',
  33118. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
  33119. }
  33120. if (_n == 0 || p->error_indicator) {
  33121. PyMem_Free(_children);
  33122. p->level--;
  33123. return NULL;
  33124. }
  33125. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  33126. if (!_seq) {
  33127. PyMem_Free(_children);
  33128. p->error_indicator = 1;
  33129. PyErr_NoMemory();
  33130. p->level--;
  33131. return NULL;
  33132. }
  33133. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  33134. PyMem_Free(_children);
  33135. p->level--;
  33136. return _seq;
  33137. }
  33138. // _tmp_138: !'*' star_target
  33139. static void *
  33140. _tmp_138_rule(Parser *p)
  33141. {
  33142. if (p->level++ == MAXSTACK) {
  33143. _Pypegen_stack_overflow(p);
  33144. }
  33145. if (p->error_indicator) {
  33146. p->level--;
  33147. return NULL;
  33148. }
  33149. void * _res = NULL;
  33150. int _mark = p->mark;
  33151. { // !'*' star_target
  33152. if (p->error_indicator) {
  33153. p->level--;
  33154. return NULL;
  33155. }
  33156. D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
  33157. expr_ty star_target_var;
  33158. if (
  33159. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*'
  33160. &&
  33161. (star_target_var = star_target_rule(p)) // star_target
  33162. )
  33163. {
  33164. D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
  33165. _res = star_target_var;
  33166. goto done;
  33167. }
  33168. p->mark = _mark;
  33169. D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
  33170. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target"));
  33171. }
  33172. _res = NULL;
  33173. done:
  33174. p->level--;
  33175. return _res;
  33176. }
  33177. // _loop0_140: ',' del_target
  33178. static asdl_seq *
  33179. _loop0_140_rule(Parser *p)
  33180. {
  33181. if (p->level++ == MAXSTACK) {
  33182. _Pypegen_stack_overflow(p);
  33183. }
  33184. if (p->error_indicator) {
  33185. p->level--;
  33186. return NULL;
  33187. }
  33188. void *_res = NULL;
  33189. int _mark = p->mark;
  33190. void **_children = PyMem_Malloc(sizeof(void *));
  33191. if (!_children) {
  33192. p->error_indicator = 1;
  33193. PyErr_NoMemory();
  33194. p->level--;
  33195. return NULL;
  33196. }
  33197. Py_ssize_t _children_capacity = 1;
  33198. Py_ssize_t _n = 0;
  33199. { // ',' del_target
  33200. if (p->error_indicator) {
  33201. p->level--;
  33202. return NULL;
  33203. }
  33204. D(fprintf(stderr, "%*c> _loop0_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target"));
  33205. Token * _literal;
  33206. expr_ty elem;
  33207. while (
  33208. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  33209. &&
  33210. (elem = del_target_rule(p)) // del_target
  33211. )
  33212. {
  33213. _res = elem;
  33214. if (_res == NULL && PyErr_Occurred()) {
  33215. p->error_indicator = 1;
  33216. PyMem_Free(_children);
  33217. p->level--;
  33218. return NULL;
  33219. }
  33220. if (_n == _children_capacity) {
  33221. _children_capacity *= 2;
  33222. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  33223. if (!_new_children) {
  33224. PyMem_Free(_children);
  33225. p->error_indicator = 1;
  33226. PyErr_NoMemory();
  33227. p->level--;
  33228. return NULL;
  33229. }
  33230. _children = _new_children;
  33231. }
  33232. _children[_n++] = _res;
  33233. _mark = p->mark;
  33234. }
  33235. p->mark = _mark;
  33236. D(fprintf(stderr, "%*c%s _loop0_140[%d-%d]: %s failed!\n", p->level, ' ',
  33237. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target"));
  33238. }
  33239. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  33240. if (!_seq) {
  33241. PyMem_Free(_children);
  33242. p->error_indicator = 1;
  33243. PyErr_NoMemory();
  33244. p->level--;
  33245. return NULL;
  33246. }
  33247. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  33248. PyMem_Free(_children);
  33249. p->level--;
  33250. return _seq;
  33251. }
  33252. // _gather_139: del_target _loop0_140
  33253. static asdl_seq *
  33254. _gather_139_rule(Parser *p)
  33255. {
  33256. if (p->level++ == MAXSTACK) {
  33257. _Pypegen_stack_overflow(p);
  33258. }
  33259. if (p->error_indicator) {
  33260. p->level--;
  33261. return NULL;
  33262. }
  33263. asdl_seq * _res = NULL;
  33264. int _mark = p->mark;
  33265. { // del_target _loop0_140
  33266. if (p->error_indicator) {
  33267. p->level--;
  33268. return NULL;
  33269. }
  33270. D(fprintf(stderr, "%*c> _gather_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_140"));
  33271. expr_ty elem;
  33272. asdl_seq * seq;
  33273. if (
  33274. (elem = del_target_rule(p)) // del_target
  33275. &&
  33276. (seq = _loop0_140_rule(p)) // _loop0_140
  33277. )
  33278. {
  33279. D(fprintf(stderr, "%*c+ _gather_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_140"));
  33280. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  33281. goto done;
  33282. }
  33283. p->mark = _mark;
  33284. D(fprintf(stderr, "%*c%s _gather_139[%d-%d]: %s failed!\n", p->level, ' ',
  33285. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_140"));
  33286. }
  33287. _res = NULL;
  33288. done:
  33289. p->level--;
  33290. return _res;
  33291. }
  33292. // _loop0_142: ',' expression
  33293. static asdl_seq *
  33294. _loop0_142_rule(Parser *p)
  33295. {
  33296. if (p->level++ == MAXSTACK) {
  33297. _Pypegen_stack_overflow(p);
  33298. }
  33299. if (p->error_indicator) {
  33300. p->level--;
  33301. return NULL;
  33302. }
  33303. void *_res = NULL;
  33304. int _mark = p->mark;
  33305. void **_children = PyMem_Malloc(sizeof(void *));
  33306. if (!_children) {
  33307. p->error_indicator = 1;
  33308. PyErr_NoMemory();
  33309. p->level--;
  33310. return NULL;
  33311. }
  33312. Py_ssize_t _children_capacity = 1;
  33313. Py_ssize_t _n = 0;
  33314. { // ',' expression
  33315. if (p->error_indicator) {
  33316. p->level--;
  33317. return NULL;
  33318. }
  33319. D(fprintf(stderr, "%*c> _loop0_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
  33320. Token * _literal;
  33321. expr_ty elem;
  33322. while (
  33323. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  33324. &&
  33325. (elem = expression_rule(p)) // expression
  33326. )
  33327. {
  33328. _res = elem;
  33329. if (_res == NULL && PyErr_Occurred()) {
  33330. p->error_indicator = 1;
  33331. PyMem_Free(_children);
  33332. p->level--;
  33333. return NULL;
  33334. }
  33335. if (_n == _children_capacity) {
  33336. _children_capacity *= 2;
  33337. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  33338. if (!_new_children) {
  33339. PyMem_Free(_children);
  33340. p->error_indicator = 1;
  33341. PyErr_NoMemory();
  33342. p->level--;
  33343. return NULL;
  33344. }
  33345. _children = _new_children;
  33346. }
  33347. _children[_n++] = _res;
  33348. _mark = p->mark;
  33349. }
  33350. p->mark = _mark;
  33351. D(fprintf(stderr, "%*c%s _loop0_142[%d-%d]: %s failed!\n", p->level, ' ',
  33352. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
  33353. }
  33354. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  33355. if (!_seq) {
  33356. PyMem_Free(_children);
  33357. p->error_indicator = 1;
  33358. PyErr_NoMemory();
  33359. p->level--;
  33360. return NULL;
  33361. }
  33362. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  33363. PyMem_Free(_children);
  33364. p->level--;
  33365. return _seq;
  33366. }
  33367. // _gather_141: expression _loop0_142
  33368. static asdl_seq *
  33369. _gather_141_rule(Parser *p)
  33370. {
  33371. if (p->level++ == MAXSTACK) {
  33372. _Pypegen_stack_overflow(p);
  33373. }
  33374. if (p->error_indicator) {
  33375. p->level--;
  33376. return NULL;
  33377. }
  33378. asdl_seq * _res = NULL;
  33379. int _mark = p->mark;
  33380. { // expression _loop0_142
  33381. if (p->error_indicator) {
  33382. p->level--;
  33383. return NULL;
  33384. }
  33385. D(fprintf(stderr, "%*c> _gather_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_142"));
  33386. expr_ty elem;
  33387. asdl_seq * seq;
  33388. if (
  33389. (elem = expression_rule(p)) // expression
  33390. &&
  33391. (seq = _loop0_142_rule(p)) // _loop0_142
  33392. )
  33393. {
  33394. D(fprintf(stderr, "%*c+ _gather_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_142"));
  33395. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  33396. goto done;
  33397. }
  33398. p->mark = _mark;
  33399. D(fprintf(stderr, "%*c%s _gather_141[%d-%d]: %s failed!\n", p->level, ' ',
  33400. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_142"));
  33401. }
  33402. _res = NULL;
  33403. done:
  33404. p->level--;
  33405. return _res;
  33406. }
  33407. // _loop0_144: ',' expression
  33408. static asdl_seq *
  33409. _loop0_144_rule(Parser *p)
  33410. {
  33411. if (p->level++ == MAXSTACK) {
  33412. _Pypegen_stack_overflow(p);
  33413. }
  33414. if (p->error_indicator) {
  33415. p->level--;
  33416. return NULL;
  33417. }
  33418. void *_res = NULL;
  33419. int _mark = p->mark;
  33420. void **_children = PyMem_Malloc(sizeof(void *));
  33421. if (!_children) {
  33422. p->error_indicator = 1;
  33423. PyErr_NoMemory();
  33424. p->level--;
  33425. return NULL;
  33426. }
  33427. Py_ssize_t _children_capacity = 1;
  33428. Py_ssize_t _n = 0;
  33429. { // ',' expression
  33430. if (p->error_indicator) {
  33431. p->level--;
  33432. return NULL;
  33433. }
  33434. D(fprintf(stderr, "%*c> _loop0_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
  33435. Token * _literal;
  33436. expr_ty elem;
  33437. while (
  33438. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  33439. &&
  33440. (elem = expression_rule(p)) // expression
  33441. )
  33442. {
  33443. _res = elem;
  33444. if (_res == NULL && PyErr_Occurred()) {
  33445. p->error_indicator = 1;
  33446. PyMem_Free(_children);
  33447. p->level--;
  33448. return NULL;
  33449. }
  33450. if (_n == _children_capacity) {
  33451. _children_capacity *= 2;
  33452. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  33453. if (!_new_children) {
  33454. PyMem_Free(_children);
  33455. p->error_indicator = 1;
  33456. PyErr_NoMemory();
  33457. p->level--;
  33458. return NULL;
  33459. }
  33460. _children = _new_children;
  33461. }
  33462. _children[_n++] = _res;
  33463. _mark = p->mark;
  33464. }
  33465. p->mark = _mark;
  33466. D(fprintf(stderr, "%*c%s _loop0_144[%d-%d]: %s failed!\n", p->level, ' ',
  33467. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
  33468. }
  33469. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  33470. if (!_seq) {
  33471. PyMem_Free(_children);
  33472. p->error_indicator = 1;
  33473. PyErr_NoMemory();
  33474. p->level--;
  33475. return NULL;
  33476. }
  33477. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  33478. PyMem_Free(_children);
  33479. p->level--;
  33480. return _seq;
  33481. }
  33482. // _gather_143: expression _loop0_144
  33483. static asdl_seq *
  33484. _gather_143_rule(Parser *p)
  33485. {
  33486. if (p->level++ == MAXSTACK) {
  33487. _Pypegen_stack_overflow(p);
  33488. }
  33489. if (p->error_indicator) {
  33490. p->level--;
  33491. return NULL;
  33492. }
  33493. asdl_seq * _res = NULL;
  33494. int _mark = p->mark;
  33495. { // expression _loop0_144
  33496. if (p->error_indicator) {
  33497. p->level--;
  33498. return NULL;
  33499. }
  33500. D(fprintf(stderr, "%*c> _gather_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_144"));
  33501. expr_ty elem;
  33502. asdl_seq * seq;
  33503. if (
  33504. (elem = expression_rule(p)) // expression
  33505. &&
  33506. (seq = _loop0_144_rule(p)) // _loop0_144
  33507. )
  33508. {
  33509. D(fprintf(stderr, "%*c+ _gather_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_144"));
  33510. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  33511. goto done;
  33512. }
  33513. p->mark = _mark;
  33514. D(fprintf(stderr, "%*c%s _gather_143[%d-%d]: %s failed!\n", p->level, ' ',
  33515. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_144"));
  33516. }
  33517. _res = NULL;
  33518. done:
  33519. p->level--;
  33520. return _res;
  33521. }
  33522. // _loop0_146: ',' expression
  33523. static asdl_seq *
  33524. _loop0_146_rule(Parser *p)
  33525. {
  33526. if (p->level++ == MAXSTACK) {
  33527. _Pypegen_stack_overflow(p);
  33528. }
  33529. if (p->error_indicator) {
  33530. p->level--;
  33531. return NULL;
  33532. }
  33533. void *_res = NULL;
  33534. int _mark = p->mark;
  33535. void **_children = PyMem_Malloc(sizeof(void *));
  33536. if (!_children) {
  33537. p->error_indicator = 1;
  33538. PyErr_NoMemory();
  33539. p->level--;
  33540. return NULL;
  33541. }
  33542. Py_ssize_t _children_capacity = 1;
  33543. Py_ssize_t _n = 0;
  33544. { // ',' expression
  33545. if (p->error_indicator) {
  33546. p->level--;
  33547. return NULL;
  33548. }
  33549. D(fprintf(stderr, "%*c> _loop0_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
  33550. Token * _literal;
  33551. expr_ty elem;
  33552. while (
  33553. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  33554. &&
  33555. (elem = expression_rule(p)) // expression
  33556. )
  33557. {
  33558. _res = elem;
  33559. if (_res == NULL && PyErr_Occurred()) {
  33560. p->error_indicator = 1;
  33561. PyMem_Free(_children);
  33562. p->level--;
  33563. return NULL;
  33564. }
  33565. if (_n == _children_capacity) {
  33566. _children_capacity *= 2;
  33567. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  33568. if (!_new_children) {
  33569. PyMem_Free(_children);
  33570. p->error_indicator = 1;
  33571. PyErr_NoMemory();
  33572. p->level--;
  33573. return NULL;
  33574. }
  33575. _children = _new_children;
  33576. }
  33577. _children[_n++] = _res;
  33578. _mark = p->mark;
  33579. }
  33580. p->mark = _mark;
  33581. D(fprintf(stderr, "%*c%s _loop0_146[%d-%d]: %s failed!\n", p->level, ' ',
  33582. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
  33583. }
  33584. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  33585. if (!_seq) {
  33586. PyMem_Free(_children);
  33587. p->error_indicator = 1;
  33588. PyErr_NoMemory();
  33589. p->level--;
  33590. return NULL;
  33591. }
  33592. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  33593. PyMem_Free(_children);
  33594. p->level--;
  33595. return _seq;
  33596. }
  33597. // _gather_145: expression _loop0_146
  33598. static asdl_seq *
  33599. _gather_145_rule(Parser *p)
  33600. {
  33601. if (p->level++ == MAXSTACK) {
  33602. _Pypegen_stack_overflow(p);
  33603. }
  33604. if (p->error_indicator) {
  33605. p->level--;
  33606. return NULL;
  33607. }
  33608. asdl_seq * _res = NULL;
  33609. int _mark = p->mark;
  33610. { // expression _loop0_146
  33611. if (p->error_indicator) {
  33612. p->level--;
  33613. return NULL;
  33614. }
  33615. D(fprintf(stderr, "%*c> _gather_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_146"));
  33616. expr_ty elem;
  33617. asdl_seq * seq;
  33618. if (
  33619. (elem = expression_rule(p)) // expression
  33620. &&
  33621. (seq = _loop0_146_rule(p)) // _loop0_146
  33622. )
  33623. {
  33624. D(fprintf(stderr, "%*c+ _gather_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_146"));
  33625. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  33626. goto done;
  33627. }
  33628. p->mark = _mark;
  33629. D(fprintf(stderr, "%*c%s _gather_145[%d-%d]: %s failed!\n", p->level, ' ',
  33630. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_146"));
  33631. }
  33632. _res = NULL;
  33633. done:
  33634. p->level--;
  33635. return _res;
  33636. }
  33637. // _loop0_148: ',' expression
  33638. static asdl_seq *
  33639. _loop0_148_rule(Parser *p)
  33640. {
  33641. if (p->level++ == MAXSTACK) {
  33642. _Pypegen_stack_overflow(p);
  33643. }
  33644. if (p->error_indicator) {
  33645. p->level--;
  33646. return NULL;
  33647. }
  33648. void *_res = NULL;
  33649. int _mark = p->mark;
  33650. void **_children = PyMem_Malloc(sizeof(void *));
  33651. if (!_children) {
  33652. p->error_indicator = 1;
  33653. PyErr_NoMemory();
  33654. p->level--;
  33655. return NULL;
  33656. }
  33657. Py_ssize_t _children_capacity = 1;
  33658. Py_ssize_t _n = 0;
  33659. { // ',' expression
  33660. if (p->error_indicator) {
  33661. p->level--;
  33662. return NULL;
  33663. }
  33664. D(fprintf(stderr, "%*c> _loop0_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
  33665. Token * _literal;
  33666. expr_ty elem;
  33667. while (
  33668. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  33669. &&
  33670. (elem = expression_rule(p)) // expression
  33671. )
  33672. {
  33673. _res = elem;
  33674. if (_res == NULL && PyErr_Occurred()) {
  33675. p->error_indicator = 1;
  33676. PyMem_Free(_children);
  33677. p->level--;
  33678. return NULL;
  33679. }
  33680. if (_n == _children_capacity) {
  33681. _children_capacity *= 2;
  33682. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  33683. if (!_new_children) {
  33684. PyMem_Free(_children);
  33685. p->error_indicator = 1;
  33686. PyErr_NoMemory();
  33687. p->level--;
  33688. return NULL;
  33689. }
  33690. _children = _new_children;
  33691. }
  33692. _children[_n++] = _res;
  33693. _mark = p->mark;
  33694. }
  33695. p->mark = _mark;
  33696. D(fprintf(stderr, "%*c%s _loop0_148[%d-%d]: %s failed!\n", p->level, ' ',
  33697. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
  33698. }
  33699. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  33700. if (!_seq) {
  33701. PyMem_Free(_children);
  33702. p->error_indicator = 1;
  33703. PyErr_NoMemory();
  33704. p->level--;
  33705. return NULL;
  33706. }
  33707. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  33708. PyMem_Free(_children);
  33709. p->level--;
  33710. return _seq;
  33711. }
  33712. // _gather_147: expression _loop0_148
  33713. static asdl_seq *
  33714. _gather_147_rule(Parser *p)
  33715. {
  33716. if (p->level++ == MAXSTACK) {
  33717. _Pypegen_stack_overflow(p);
  33718. }
  33719. if (p->error_indicator) {
  33720. p->level--;
  33721. return NULL;
  33722. }
  33723. asdl_seq * _res = NULL;
  33724. int _mark = p->mark;
  33725. { // expression _loop0_148
  33726. if (p->error_indicator) {
  33727. p->level--;
  33728. return NULL;
  33729. }
  33730. D(fprintf(stderr, "%*c> _gather_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_148"));
  33731. expr_ty elem;
  33732. asdl_seq * seq;
  33733. if (
  33734. (elem = expression_rule(p)) // expression
  33735. &&
  33736. (seq = _loop0_148_rule(p)) // _loop0_148
  33737. )
  33738. {
  33739. D(fprintf(stderr, "%*c+ _gather_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_148"));
  33740. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  33741. goto done;
  33742. }
  33743. p->mark = _mark;
  33744. D(fprintf(stderr, "%*c%s _gather_147[%d-%d]: %s failed!\n", p->level, ' ',
  33745. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_148"));
  33746. }
  33747. _res = NULL;
  33748. done:
  33749. p->level--;
  33750. return _res;
  33751. }
  33752. // _tmp_149: NEWLINE INDENT
  33753. static void *
  33754. _tmp_149_rule(Parser *p)
  33755. {
  33756. if (p->level++ == MAXSTACK) {
  33757. _Pypegen_stack_overflow(p);
  33758. }
  33759. if (p->error_indicator) {
  33760. p->level--;
  33761. return NULL;
  33762. }
  33763. void * _res = NULL;
  33764. int _mark = p->mark;
  33765. { // NEWLINE INDENT
  33766. if (p->error_indicator) {
  33767. p->level--;
  33768. return NULL;
  33769. }
  33770. D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
  33771. Token * indent_var;
  33772. Token * newline_var;
  33773. if (
  33774. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  33775. &&
  33776. (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
  33777. )
  33778. {
  33779. D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
  33780. _res = _PyPegen_dummy_name(p, newline_var, indent_var);
  33781. goto done;
  33782. }
  33783. p->mark = _mark;
  33784. D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
  33785. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT"));
  33786. }
  33787. _res = NULL;
  33788. done:
  33789. p->level--;
  33790. return _res;
  33791. }
  33792. // _tmp_150:
  33793. // | (','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs)
  33794. // | kwargs
  33795. static void *
  33796. _tmp_150_rule(Parser *p)
  33797. {
  33798. if (p->level++ == MAXSTACK) {
  33799. _Pypegen_stack_overflow(p);
  33800. }
  33801. if (p->error_indicator) {
  33802. p->level--;
  33803. return NULL;
  33804. }
  33805. void * _res = NULL;
  33806. int _mark = p->mark;
  33807. { // (','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs)
  33808. if (p->error_indicator) {
  33809. p->level--;
  33810. return NULL;
  33811. }
  33812. D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs)"));
  33813. void *_tmp_265_var;
  33814. if (
  33815. (_tmp_265_var = _tmp_265_rule(p)) // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs
  33816. )
  33817. {
  33818. D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs)"));
  33819. _res = _tmp_265_var;
  33820. goto done;
  33821. }
  33822. p->mark = _mark;
  33823. D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ',
  33824. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs)"));
  33825. }
  33826. { // kwargs
  33827. if (p->error_indicator) {
  33828. p->level--;
  33829. return NULL;
  33830. }
  33831. D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs"));
  33832. asdl_seq* kwargs_var;
  33833. if (
  33834. (kwargs_var = kwargs_rule(p)) // kwargs
  33835. )
  33836. {
  33837. D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs"));
  33838. _res = kwargs_var;
  33839. goto done;
  33840. }
  33841. p->mark = _mark;
  33842. D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ',
  33843. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs"));
  33844. }
  33845. _res = NULL;
  33846. done:
  33847. p->level--;
  33848. return _res;
  33849. }
  33850. // _loop0_152: ',' (starred_expression !'=')
  33851. static asdl_seq *
  33852. _loop0_152_rule(Parser *p)
  33853. {
  33854. if (p->level++ == MAXSTACK) {
  33855. _Pypegen_stack_overflow(p);
  33856. }
  33857. if (p->error_indicator) {
  33858. p->level--;
  33859. return NULL;
  33860. }
  33861. void *_res = NULL;
  33862. int _mark = p->mark;
  33863. void **_children = PyMem_Malloc(sizeof(void *));
  33864. if (!_children) {
  33865. p->error_indicator = 1;
  33866. PyErr_NoMemory();
  33867. p->level--;
  33868. return NULL;
  33869. }
  33870. Py_ssize_t _children_capacity = 1;
  33871. Py_ssize_t _n = 0;
  33872. { // ',' (starred_expression !'=')
  33873. if (p->error_indicator) {
  33874. p->level--;
  33875. return NULL;
  33876. }
  33877. D(fprintf(stderr, "%*c> _loop0_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression !'=')"));
  33878. Token * _literal;
  33879. void *elem;
  33880. while (
  33881. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  33882. &&
  33883. (elem = _tmp_266_rule(p)) // starred_expression !'='
  33884. )
  33885. {
  33886. _res = elem;
  33887. if (_res == NULL && PyErr_Occurred()) {
  33888. p->error_indicator = 1;
  33889. PyMem_Free(_children);
  33890. p->level--;
  33891. return NULL;
  33892. }
  33893. if (_n == _children_capacity) {
  33894. _children_capacity *= 2;
  33895. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  33896. if (!_new_children) {
  33897. PyMem_Free(_children);
  33898. p->error_indicator = 1;
  33899. PyErr_NoMemory();
  33900. p->level--;
  33901. return NULL;
  33902. }
  33903. _children = _new_children;
  33904. }
  33905. _children[_n++] = _res;
  33906. _mark = p->mark;
  33907. }
  33908. p->mark = _mark;
  33909. D(fprintf(stderr, "%*c%s _loop0_152[%d-%d]: %s failed!\n", p->level, ' ',
  33910. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression !'=')"));
  33911. }
  33912. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  33913. if (!_seq) {
  33914. PyMem_Free(_children);
  33915. p->error_indicator = 1;
  33916. PyErr_NoMemory();
  33917. p->level--;
  33918. return NULL;
  33919. }
  33920. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  33921. PyMem_Free(_children);
  33922. p->level--;
  33923. return _seq;
  33924. }
  33925. // _gather_151: (starred_expression !'=') _loop0_152
  33926. static asdl_seq *
  33927. _gather_151_rule(Parser *p)
  33928. {
  33929. if (p->level++ == MAXSTACK) {
  33930. _Pypegen_stack_overflow(p);
  33931. }
  33932. if (p->error_indicator) {
  33933. p->level--;
  33934. return NULL;
  33935. }
  33936. asdl_seq * _res = NULL;
  33937. int _mark = p->mark;
  33938. { // (starred_expression !'=') _loop0_152
  33939. if (p->error_indicator) {
  33940. p->level--;
  33941. return NULL;
  33942. }
  33943. D(fprintf(stderr, "%*c> _gather_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression !'=') _loop0_152"));
  33944. void *elem;
  33945. asdl_seq * seq;
  33946. if (
  33947. (elem = _tmp_266_rule(p)) // starred_expression !'='
  33948. &&
  33949. (seq = _loop0_152_rule(p)) // _loop0_152
  33950. )
  33951. {
  33952. D(fprintf(stderr, "%*c+ _gather_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression !'=') _loop0_152"));
  33953. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  33954. goto done;
  33955. }
  33956. p->mark = _mark;
  33957. D(fprintf(stderr, "%*c%s _gather_151[%d-%d]: %s failed!\n", p->level, ' ',
  33958. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression !'=') _loop0_152"));
  33959. }
  33960. _res = NULL;
  33961. done:
  33962. p->level--;
  33963. return _res;
  33964. }
  33965. // _tmp_153: args | expression for_if_clauses
  33966. static void *
  33967. _tmp_153_rule(Parser *p)
  33968. {
  33969. if (p->level++ == MAXSTACK) {
  33970. _Pypegen_stack_overflow(p);
  33971. }
  33972. if (p->error_indicator) {
  33973. p->level--;
  33974. return NULL;
  33975. }
  33976. void * _res = NULL;
  33977. int _mark = p->mark;
  33978. { // args
  33979. if (p->error_indicator) {
  33980. p->level--;
  33981. return NULL;
  33982. }
  33983. D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args"));
  33984. expr_ty args_var;
  33985. if (
  33986. (args_var = args_rule(p)) // args
  33987. )
  33988. {
  33989. D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args"));
  33990. _res = args_var;
  33991. goto done;
  33992. }
  33993. p->mark = _mark;
  33994. D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ',
  33995. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args"));
  33996. }
  33997. { // expression for_if_clauses
  33998. if (p->error_indicator) {
  33999. p->level--;
  34000. return NULL;
  34001. }
  34002. D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses"));
  34003. expr_ty expression_var;
  34004. asdl_comprehension_seq* for_if_clauses_var;
  34005. if (
  34006. (expression_var = expression_rule(p)) // expression
  34007. &&
  34008. (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
  34009. )
  34010. {
  34011. D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses"));
  34012. _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var);
  34013. goto done;
  34014. }
  34015. p->mark = _mark;
  34016. D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ',
  34017. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses"));
  34018. }
  34019. _res = NULL;
  34020. done:
  34021. p->level--;
  34022. return _res;
  34023. }
  34024. // _tmp_154: args ','
  34025. static void *
  34026. _tmp_154_rule(Parser *p)
  34027. {
  34028. if (p->level++ == MAXSTACK) {
  34029. _Pypegen_stack_overflow(p);
  34030. }
  34031. if (p->error_indicator) {
  34032. p->level--;
  34033. return NULL;
  34034. }
  34035. void * _res = NULL;
  34036. int _mark = p->mark;
  34037. { // args ','
  34038. if (p->error_indicator) {
  34039. p->level--;
  34040. return NULL;
  34041. }
  34042. D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','"));
  34043. Token * _literal;
  34044. expr_ty args_var;
  34045. if (
  34046. (args_var = args_rule(p)) // args
  34047. &&
  34048. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  34049. )
  34050. {
  34051. D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','"));
  34052. _res = _PyPegen_dummy_name(p, args_var, _literal);
  34053. goto done;
  34054. }
  34055. p->mark = _mark;
  34056. D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ',
  34057. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','"));
  34058. }
  34059. _res = NULL;
  34060. done:
  34061. p->level--;
  34062. return _res;
  34063. }
  34064. // _tmp_155: ',' | ')'
  34065. static void *
  34066. _tmp_155_rule(Parser *p)
  34067. {
  34068. if (p->level++ == MAXSTACK) {
  34069. _Pypegen_stack_overflow(p);
  34070. }
  34071. if (p->error_indicator) {
  34072. p->level--;
  34073. return NULL;
  34074. }
  34075. void * _res = NULL;
  34076. int _mark = p->mark;
  34077. { // ','
  34078. if (p->error_indicator) {
  34079. p->level--;
  34080. return NULL;
  34081. }
  34082. D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
  34083. Token * _literal;
  34084. if (
  34085. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  34086. )
  34087. {
  34088. D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
  34089. _res = _literal;
  34090. goto done;
  34091. }
  34092. p->mark = _mark;
  34093. D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ',
  34094. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
  34095. }
  34096. { // ')'
  34097. if (p->error_indicator) {
  34098. p->level--;
  34099. return NULL;
  34100. }
  34101. D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
  34102. Token * _literal;
  34103. if (
  34104. (_literal = _PyPegen_expect_token(p, 8)) // token=')'
  34105. )
  34106. {
  34107. D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
  34108. _res = _literal;
  34109. goto done;
  34110. }
  34111. p->mark = _mark;
  34112. D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ',
  34113. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
  34114. }
  34115. _res = NULL;
  34116. done:
  34117. p->level--;
  34118. return _res;
  34119. }
  34120. // _tmp_156: 'True' | 'False' | 'None'
  34121. static void *
  34122. _tmp_156_rule(Parser *p)
  34123. {
  34124. if (p->level++ == MAXSTACK) {
  34125. _Pypegen_stack_overflow(p);
  34126. }
  34127. if (p->error_indicator) {
  34128. p->level--;
  34129. return NULL;
  34130. }
  34131. void * _res = NULL;
  34132. int _mark = p->mark;
  34133. { // 'True'
  34134. if (p->error_indicator) {
  34135. p->level--;
  34136. return NULL;
  34137. }
  34138. D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
  34139. Token * _keyword;
  34140. if (
  34141. (_keyword = _PyPegen_expect_token(p, 601)) // token='True'
  34142. )
  34143. {
  34144. D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
  34145. _res = _keyword;
  34146. goto done;
  34147. }
  34148. p->mark = _mark;
  34149. D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ',
  34150. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
  34151. }
  34152. { // 'False'
  34153. if (p->error_indicator) {
  34154. p->level--;
  34155. return NULL;
  34156. }
  34157. D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
  34158. Token * _keyword;
  34159. if (
  34160. (_keyword = _PyPegen_expect_token(p, 603)) // token='False'
  34161. )
  34162. {
  34163. D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
  34164. _res = _keyword;
  34165. goto done;
  34166. }
  34167. p->mark = _mark;
  34168. D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ',
  34169. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
  34170. }
  34171. { // 'None'
  34172. if (p->error_indicator) {
  34173. p->level--;
  34174. return NULL;
  34175. }
  34176. D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
  34177. Token * _keyword;
  34178. if (
  34179. (_keyword = _PyPegen_expect_token(p, 602)) // token='None'
  34180. )
  34181. {
  34182. D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
  34183. _res = _keyword;
  34184. goto done;
  34185. }
  34186. p->mark = _mark;
  34187. D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ',
  34188. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
  34189. }
  34190. _res = NULL;
  34191. done:
  34192. p->level--;
  34193. return _res;
  34194. }
  34195. // _tmp_157: NAME '='
  34196. static void *
  34197. _tmp_157_rule(Parser *p)
  34198. {
  34199. if (p->level++ == MAXSTACK) {
  34200. _Pypegen_stack_overflow(p);
  34201. }
  34202. if (p->error_indicator) {
  34203. p->level--;
  34204. return NULL;
  34205. }
  34206. void * _res = NULL;
  34207. int _mark = p->mark;
  34208. { // NAME '='
  34209. if (p->error_indicator) {
  34210. p->level--;
  34211. return NULL;
  34212. }
  34213. D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '='"));
  34214. Token * _literal;
  34215. expr_ty name_var;
  34216. if (
  34217. (name_var = _PyPegen_name_token(p)) // NAME
  34218. &&
  34219. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  34220. )
  34221. {
  34222. D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '='"));
  34223. _res = _PyPegen_dummy_name(p, name_var, _literal);
  34224. goto done;
  34225. }
  34226. p->mark = _mark;
  34227. D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ',
  34228. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '='"));
  34229. }
  34230. _res = NULL;
  34231. done:
  34232. p->level--;
  34233. return _res;
  34234. }
  34235. // _tmp_158: NAME STRING | SOFT_KEYWORD
  34236. static void *
  34237. _tmp_158_rule(Parser *p)
  34238. {
  34239. if (p->level++ == MAXSTACK) {
  34240. _Pypegen_stack_overflow(p);
  34241. }
  34242. if (p->error_indicator) {
  34243. p->level--;
  34244. return NULL;
  34245. }
  34246. void * _res = NULL;
  34247. int _mark = p->mark;
  34248. { // NAME STRING
  34249. if (p->error_indicator) {
  34250. p->level--;
  34251. return NULL;
  34252. }
  34253. D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME STRING"));
  34254. expr_ty name_var;
  34255. expr_ty string_var;
  34256. if (
  34257. (name_var = _PyPegen_name_token(p)) // NAME
  34258. &&
  34259. (string_var = _PyPegen_string_token(p)) // STRING
  34260. )
  34261. {
  34262. D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME STRING"));
  34263. _res = _PyPegen_dummy_name(p, name_var, string_var);
  34264. goto done;
  34265. }
  34266. p->mark = _mark;
  34267. D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ',
  34268. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME STRING"));
  34269. }
  34270. { // SOFT_KEYWORD
  34271. if (p->error_indicator) {
  34272. p->level--;
  34273. return NULL;
  34274. }
  34275. D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "SOFT_KEYWORD"));
  34276. expr_ty soft_keyword_var;
  34277. if (
  34278. (soft_keyword_var = _PyPegen_soft_keyword_token(p)) // SOFT_KEYWORD
  34279. )
  34280. {
  34281. D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "SOFT_KEYWORD"));
  34282. _res = soft_keyword_var;
  34283. goto done;
  34284. }
  34285. p->mark = _mark;
  34286. D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ',
  34287. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "SOFT_KEYWORD"));
  34288. }
  34289. _res = NULL;
  34290. done:
  34291. p->level--;
  34292. return _res;
  34293. }
  34294. // _tmp_159: 'else' | ':'
  34295. static void *
  34296. _tmp_159_rule(Parser *p)
  34297. {
  34298. if (p->level++ == MAXSTACK) {
  34299. _Pypegen_stack_overflow(p);
  34300. }
  34301. if (p->error_indicator) {
  34302. p->level--;
  34303. return NULL;
  34304. }
  34305. void * _res = NULL;
  34306. int _mark = p->mark;
  34307. { // 'else'
  34308. if (p->error_indicator) {
  34309. p->level--;
  34310. return NULL;
  34311. }
  34312. D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else'"));
  34313. Token * _keyword;
  34314. if (
  34315. (_keyword = _PyPegen_expect_token(p, 645)) // token='else'
  34316. )
  34317. {
  34318. D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else'"));
  34319. _res = _keyword;
  34320. goto done;
  34321. }
  34322. p->mark = _mark;
  34323. D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ',
  34324. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else'"));
  34325. }
  34326. { // ':'
  34327. if (p->error_indicator) {
  34328. p->level--;
  34329. return NULL;
  34330. }
  34331. D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
  34332. Token * _literal;
  34333. if (
  34334. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  34335. )
  34336. {
  34337. D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
  34338. _res = _literal;
  34339. goto done;
  34340. }
  34341. p->mark = _mark;
  34342. D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ',
  34343. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
  34344. }
  34345. _res = NULL;
  34346. done:
  34347. p->level--;
  34348. return _res;
  34349. }
  34350. // _tmp_160: '=' | ':='
  34351. static void *
  34352. _tmp_160_rule(Parser *p)
  34353. {
  34354. if (p->level++ == MAXSTACK) {
  34355. _Pypegen_stack_overflow(p);
  34356. }
  34357. if (p->error_indicator) {
  34358. p->level--;
  34359. return NULL;
  34360. }
  34361. void * _res = NULL;
  34362. int _mark = p->mark;
  34363. { // '='
  34364. if (p->error_indicator) {
  34365. p->level--;
  34366. return NULL;
  34367. }
  34368. D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='"));
  34369. Token * _literal;
  34370. if (
  34371. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  34372. )
  34373. {
  34374. D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='"));
  34375. _res = _literal;
  34376. goto done;
  34377. }
  34378. p->mark = _mark;
  34379. D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ',
  34380. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='"));
  34381. }
  34382. { // ':='
  34383. if (p->error_indicator) {
  34384. p->level--;
  34385. return NULL;
  34386. }
  34387. D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':='"));
  34388. Token * _literal;
  34389. if (
  34390. (_literal = _PyPegen_expect_token(p, 53)) // token=':='
  34391. )
  34392. {
  34393. D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':='"));
  34394. _res = _literal;
  34395. goto done;
  34396. }
  34397. p->mark = _mark;
  34398. D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ',
  34399. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':='"));
  34400. }
  34401. _res = NULL;
  34402. done:
  34403. p->level--;
  34404. return _res;
  34405. }
  34406. // _tmp_161: list | tuple | genexp | 'True' | 'None' | 'False'
  34407. static void *
  34408. _tmp_161_rule(Parser *p)
  34409. {
  34410. if (p->level++ == MAXSTACK) {
  34411. _Pypegen_stack_overflow(p);
  34412. }
  34413. if (p->error_indicator) {
  34414. p->level--;
  34415. return NULL;
  34416. }
  34417. void * _res = NULL;
  34418. int _mark = p->mark;
  34419. { // list
  34420. if (p->error_indicator) {
  34421. p->level--;
  34422. return NULL;
  34423. }
  34424. D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
  34425. expr_ty list_var;
  34426. if (
  34427. (list_var = list_rule(p)) // list
  34428. )
  34429. {
  34430. D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
  34431. _res = list_var;
  34432. goto done;
  34433. }
  34434. p->mark = _mark;
  34435. D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ',
  34436. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
  34437. }
  34438. { // tuple
  34439. if (p->error_indicator) {
  34440. p->level--;
  34441. return NULL;
  34442. }
  34443. D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
  34444. expr_ty tuple_var;
  34445. if (
  34446. (tuple_var = tuple_rule(p)) // tuple
  34447. )
  34448. {
  34449. D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
  34450. _res = tuple_var;
  34451. goto done;
  34452. }
  34453. p->mark = _mark;
  34454. D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ',
  34455. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
  34456. }
  34457. { // genexp
  34458. if (p->error_indicator) {
  34459. p->level--;
  34460. return NULL;
  34461. }
  34462. D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp"));
  34463. expr_ty genexp_var;
  34464. if (
  34465. (genexp_var = genexp_rule(p)) // genexp
  34466. )
  34467. {
  34468. D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp"));
  34469. _res = genexp_var;
  34470. goto done;
  34471. }
  34472. p->mark = _mark;
  34473. D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ',
  34474. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp"));
  34475. }
  34476. { // 'True'
  34477. if (p->error_indicator) {
  34478. p->level--;
  34479. return NULL;
  34480. }
  34481. D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
  34482. Token * _keyword;
  34483. if (
  34484. (_keyword = _PyPegen_expect_token(p, 601)) // token='True'
  34485. )
  34486. {
  34487. D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
  34488. _res = _keyword;
  34489. goto done;
  34490. }
  34491. p->mark = _mark;
  34492. D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ',
  34493. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
  34494. }
  34495. { // 'None'
  34496. if (p->error_indicator) {
  34497. p->level--;
  34498. return NULL;
  34499. }
  34500. D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
  34501. Token * _keyword;
  34502. if (
  34503. (_keyword = _PyPegen_expect_token(p, 602)) // token='None'
  34504. )
  34505. {
  34506. D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
  34507. _res = _keyword;
  34508. goto done;
  34509. }
  34510. p->mark = _mark;
  34511. D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ',
  34512. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
  34513. }
  34514. { // 'False'
  34515. if (p->error_indicator) {
  34516. p->level--;
  34517. return NULL;
  34518. }
  34519. D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
  34520. Token * _keyword;
  34521. if (
  34522. (_keyword = _PyPegen_expect_token(p, 603)) // token='False'
  34523. )
  34524. {
  34525. D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
  34526. _res = _keyword;
  34527. goto done;
  34528. }
  34529. p->mark = _mark;
  34530. D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ',
  34531. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
  34532. }
  34533. _res = NULL;
  34534. done:
  34535. p->level--;
  34536. return _res;
  34537. }
  34538. // _tmp_162: '=' | ':='
  34539. static void *
  34540. _tmp_162_rule(Parser *p)
  34541. {
  34542. if (p->level++ == MAXSTACK) {
  34543. _Pypegen_stack_overflow(p);
  34544. }
  34545. if (p->error_indicator) {
  34546. p->level--;
  34547. return NULL;
  34548. }
  34549. void * _res = NULL;
  34550. int _mark = p->mark;
  34551. { // '='
  34552. if (p->error_indicator) {
  34553. p->level--;
  34554. return NULL;
  34555. }
  34556. D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='"));
  34557. Token * _literal;
  34558. if (
  34559. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  34560. )
  34561. {
  34562. D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='"));
  34563. _res = _literal;
  34564. goto done;
  34565. }
  34566. p->mark = _mark;
  34567. D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ',
  34568. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='"));
  34569. }
  34570. { // ':='
  34571. if (p->error_indicator) {
  34572. p->level--;
  34573. return NULL;
  34574. }
  34575. D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':='"));
  34576. Token * _literal;
  34577. if (
  34578. (_literal = _PyPegen_expect_token(p, 53)) // token=':='
  34579. )
  34580. {
  34581. D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':='"));
  34582. _res = _literal;
  34583. goto done;
  34584. }
  34585. p->mark = _mark;
  34586. D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ',
  34587. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':='"));
  34588. }
  34589. _res = NULL;
  34590. done:
  34591. p->level--;
  34592. return _res;
  34593. }
  34594. // _loop0_163: star_named_expressions
  34595. static asdl_seq *
  34596. _loop0_163_rule(Parser *p)
  34597. {
  34598. if (p->level++ == MAXSTACK) {
  34599. _Pypegen_stack_overflow(p);
  34600. }
  34601. if (p->error_indicator) {
  34602. p->level--;
  34603. return NULL;
  34604. }
  34605. void *_res = NULL;
  34606. int _mark = p->mark;
  34607. void **_children = PyMem_Malloc(sizeof(void *));
  34608. if (!_children) {
  34609. p->error_indicator = 1;
  34610. PyErr_NoMemory();
  34611. p->level--;
  34612. return NULL;
  34613. }
  34614. Py_ssize_t _children_capacity = 1;
  34615. Py_ssize_t _n = 0;
  34616. { // star_named_expressions
  34617. if (p->error_indicator) {
  34618. p->level--;
  34619. return NULL;
  34620. }
  34621. D(fprintf(stderr, "%*c> _loop0_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions"));
  34622. asdl_expr_seq* star_named_expressions_var;
  34623. while (
  34624. (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions
  34625. )
  34626. {
  34627. _res = star_named_expressions_var;
  34628. if (_n == _children_capacity) {
  34629. _children_capacity *= 2;
  34630. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  34631. if (!_new_children) {
  34632. PyMem_Free(_children);
  34633. p->error_indicator = 1;
  34634. PyErr_NoMemory();
  34635. p->level--;
  34636. return NULL;
  34637. }
  34638. _children = _new_children;
  34639. }
  34640. _children[_n++] = _res;
  34641. _mark = p->mark;
  34642. }
  34643. p->mark = _mark;
  34644. D(fprintf(stderr, "%*c%s _loop0_163[%d-%d]: %s failed!\n", p->level, ' ',
  34645. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions"));
  34646. }
  34647. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  34648. if (!_seq) {
  34649. PyMem_Free(_children);
  34650. p->error_indicator = 1;
  34651. PyErr_NoMemory();
  34652. p->level--;
  34653. return NULL;
  34654. }
  34655. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  34656. PyMem_Free(_children);
  34657. p->level--;
  34658. return _seq;
  34659. }
  34660. // _loop0_164: (star_targets '=')
  34661. static asdl_seq *
  34662. _loop0_164_rule(Parser *p)
  34663. {
  34664. if (p->level++ == MAXSTACK) {
  34665. _Pypegen_stack_overflow(p);
  34666. }
  34667. if (p->error_indicator) {
  34668. p->level--;
  34669. return NULL;
  34670. }
  34671. void *_res = NULL;
  34672. int _mark = p->mark;
  34673. void **_children = PyMem_Malloc(sizeof(void *));
  34674. if (!_children) {
  34675. p->error_indicator = 1;
  34676. PyErr_NoMemory();
  34677. p->level--;
  34678. return NULL;
  34679. }
  34680. Py_ssize_t _children_capacity = 1;
  34681. Py_ssize_t _n = 0;
  34682. { // (star_targets '=')
  34683. if (p->error_indicator) {
  34684. p->level--;
  34685. return NULL;
  34686. }
  34687. D(fprintf(stderr, "%*c> _loop0_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
  34688. void *_tmp_267_var;
  34689. while (
  34690. (_tmp_267_var = _tmp_267_rule(p)) // star_targets '='
  34691. )
  34692. {
  34693. _res = _tmp_267_var;
  34694. if (_n == _children_capacity) {
  34695. _children_capacity *= 2;
  34696. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  34697. if (!_new_children) {
  34698. PyMem_Free(_children);
  34699. p->error_indicator = 1;
  34700. PyErr_NoMemory();
  34701. p->level--;
  34702. return NULL;
  34703. }
  34704. _children = _new_children;
  34705. }
  34706. _children[_n++] = _res;
  34707. _mark = p->mark;
  34708. }
  34709. p->mark = _mark;
  34710. D(fprintf(stderr, "%*c%s _loop0_164[%d-%d]: %s failed!\n", p->level, ' ',
  34711. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
  34712. }
  34713. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  34714. if (!_seq) {
  34715. PyMem_Free(_children);
  34716. p->error_indicator = 1;
  34717. PyErr_NoMemory();
  34718. p->level--;
  34719. return NULL;
  34720. }
  34721. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  34722. PyMem_Free(_children);
  34723. p->level--;
  34724. return _seq;
  34725. }
  34726. // _loop0_165: (star_targets '=')
  34727. static asdl_seq *
  34728. _loop0_165_rule(Parser *p)
  34729. {
  34730. if (p->level++ == MAXSTACK) {
  34731. _Pypegen_stack_overflow(p);
  34732. }
  34733. if (p->error_indicator) {
  34734. p->level--;
  34735. return NULL;
  34736. }
  34737. void *_res = NULL;
  34738. int _mark = p->mark;
  34739. void **_children = PyMem_Malloc(sizeof(void *));
  34740. if (!_children) {
  34741. p->error_indicator = 1;
  34742. PyErr_NoMemory();
  34743. p->level--;
  34744. return NULL;
  34745. }
  34746. Py_ssize_t _children_capacity = 1;
  34747. Py_ssize_t _n = 0;
  34748. { // (star_targets '=')
  34749. if (p->error_indicator) {
  34750. p->level--;
  34751. return NULL;
  34752. }
  34753. D(fprintf(stderr, "%*c> _loop0_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
  34754. void *_tmp_268_var;
  34755. while (
  34756. (_tmp_268_var = _tmp_268_rule(p)) // star_targets '='
  34757. )
  34758. {
  34759. _res = _tmp_268_var;
  34760. if (_n == _children_capacity) {
  34761. _children_capacity *= 2;
  34762. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  34763. if (!_new_children) {
  34764. PyMem_Free(_children);
  34765. p->error_indicator = 1;
  34766. PyErr_NoMemory();
  34767. p->level--;
  34768. return NULL;
  34769. }
  34770. _children = _new_children;
  34771. }
  34772. _children[_n++] = _res;
  34773. _mark = p->mark;
  34774. }
  34775. p->mark = _mark;
  34776. D(fprintf(stderr, "%*c%s _loop0_165[%d-%d]: %s failed!\n", p->level, ' ',
  34777. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
  34778. }
  34779. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  34780. if (!_seq) {
  34781. PyMem_Free(_children);
  34782. p->error_indicator = 1;
  34783. PyErr_NoMemory();
  34784. p->level--;
  34785. return NULL;
  34786. }
  34787. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  34788. PyMem_Free(_children);
  34789. p->level--;
  34790. return _seq;
  34791. }
  34792. // _tmp_166: yield_expr | star_expressions
  34793. static void *
  34794. _tmp_166_rule(Parser *p)
  34795. {
  34796. if (p->level++ == MAXSTACK) {
  34797. _Pypegen_stack_overflow(p);
  34798. }
  34799. if (p->error_indicator) {
  34800. p->level--;
  34801. return NULL;
  34802. }
  34803. void * _res = NULL;
  34804. int _mark = p->mark;
  34805. { // yield_expr
  34806. if (p->error_indicator) {
  34807. p->level--;
  34808. return NULL;
  34809. }
  34810. D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  34811. expr_ty yield_expr_var;
  34812. if (
  34813. (yield_expr_var = yield_expr_rule(p)) // yield_expr
  34814. )
  34815. {
  34816. D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  34817. _res = yield_expr_var;
  34818. goto done;
  34819. }
  34820. p->mark = _mark;
  34821. D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ',
  34822. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
  34823. }
  34824. { // star_expressions
  34825. if (p->error_indicator) {
  34826. p->level--;
  34827. return NULL;
  34828. }
  34829. D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  34830. expr_ty star_expressions_var;
  34831. if (
  34832. (star_expressions_var = star_expressions_rule(p)) // star_expressions
  34833. )
  34834. {
  34835. D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  34836. _res = star_expressions_var;
  34837. goto done;
  34838. }
  34839. p->mark = _mark;
  34840. D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ',
  34841. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
  34842. }
  34843. _res = NULL;
  34844. done:
  34845. p->level--;
  34846. return _res;
  34847. }
  34848. // _tmp_167: '[' | '(' | '{'
  34849. static void *
  34850. _tmp_167_rule(Parser *p)
  34851. {
  34852. if (p->level++ == MAXSTACK) {
  34853. _Pypegen_stack_overflow(p);
  34854. }
  34855. if (p->error_indicator) {
  34856. p->level--;
  34857. return NULL;
  34858. }
  34859. void * _res = NULL;
  34860. int _mark = p->mark;
  34861. { // '['
  34862. if (p->error_indicator) {
  34863. p->level--;
  34864. return NULL;
  34865. }
  34866. D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
  34867. Token * _literal;
  34868. if (
  34869. (_literal = _PyPegen_expect_token(p, 9)) // token='['
  34870. )
  34871. {
  34872. D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
  34873. _res = _literal;
  34874. goto done;
  34875. }
  34876. p->mark = _mark;
  34877. D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ',
  34878. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
  34879. }
  34880. { // '('
  34881. if (p->error_indicator) {
  34882. p->level--;
  34883. return NULL;
  34884. }
  34885. D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
  34886. Token * _literal;
  34887. if (
  34888. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  34889. )
  34890. {
  34891. D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
  34892. _res = _literal;
  34893. goto done;
  34894. }
  34895. p->mark = _mark;
  34896. D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ',
  34897. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
  34898. }
  34899. { // '{'
  34900. if (p->error_indicator) {
  34901. p->level--;
  34902. return NULL;
  34903. }
  34904. D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'"));
  34905. Token * _literal;
  34906. if (
  34907. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  34908. )
  34909. {
  34910. D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'"));
  34911. _res = _literal;
  34912. goto done;
  34913. }
  34914. p->mark = _mark;
  34915. D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ',
  34916. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'"));
  34917. }
  34918. _res = NULL;
  34919. done:
  34920. p->level--;
  34921. return _res;
  34922. }
  34923. // _tmp_168: '[' | '{'
  34924. static void *
  34925. _tmp_168_rule(Parser *p)
  34926. {
  34927. if (p->level++ == MAXSTACK) {
  34928. _Pypegen_stack_overflow(p);
  34929. }
  34930. if (p->error_indicator) {
  34931. p->level--;
  34932. return NULL;
  34933. }
  34934. void * _res = NULL;
  34935. int _mark = p->mark;
  34936. { // '['
  34937. if (p->error_indicator) {
  34938. p->level--;
  34939. return NULL;
  34940. }
  34941. D(fprintf(stderr, "%*c> _tmp_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
  34942. Token * _literal;
  34943. if (
  34944. (_literal = _PyPegen_expect_token(p, 9)) // token='['
  34945. )
  34946. {
  34947. D(fprintf(stderr, "%*c+ _tmp_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
  34948. _res = _literal;
  34949. goto done;
  34950. }
  34951. p->mark = _mark;
  34952. D(fprintf(stderr, "%*c%s _tmp_168[%d-%d]: %s failed!\n", p->level, ' ',
  34953. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
  34954. }
  34955. { // '{'
  34956. if (p->error_indicator) {
  34957. p->level--;
  34958. return NULL;
  34959. }
  34960. D(fprintf(stderr, "%*c> _tmp_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'"));
  34961. Token * _literal;
  34962. if (
  34963. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  34964. )
  34965. {
  34966. D(fprintf(stderr, "%*c+ _tmp_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'"));
  34967. _res = _literal;
  34968. goto done;
  34969. }
  34970. p->mark = _mark;
  34971. D(fprintf(stderr, "%*c%s _tmp_168[%d-%d]: %s failed!\n", p->level, ' ',
  34972. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'"));
  34973. }
  34974. _res = NULL;
  34975. done:
  34976. p->level--;
  34977. return _res;
  34978. }
  34979. // _tmp_169: '[' | '{'
  34980. static void *
  34981. _tmp_169_rule(Parser *p)
  34982. {
  34983. if (p->level++ == MAXSTACK) {
  34984. _Pypegen_stack_overflow(p);
  34985. }
  34986. if (p->error_indicator) {
  34987. p->level--;
  34988. return NULL;
  34989. }
  34990. void * _res = NULL;
  34991. int _mark = p->mark;
  34992. { // '['
  34993. if (p->error_indicator) {
  34994. p->level--;
  34995. return NULL;
  34996. }
  34997. D(fprintf(stderr, "%*c> _tmp_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
  34998. Token * _literal;
  34999. if (
  35000. (_literal = _PyPegen_expect_token(p, 9)) // token='['
  35001. )
  35002. {
  35003. D(fprintf(stderr, "%*c+ _tmp_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
  35004. _res = _literal;
  35005. goto done;
  35006. }
  35007. p->mark = _mark;
  35008. D(fprintf(stderr, "%*c%s _tmp_169[%d-%d]: %s failed!\n", p->level, ' ',
  35009. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
  35010. }
  35011. { // '{'
  35012. if (p->error_indicator) {
  35013. p->level--;
  35014. return NULL;
  35015. }
  35016. D(fprintf(stderr, "%*c> _tmp_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'"));
  35017. Token * _literal;
  35018. if (
  35019. (_literal = _PyPegen_expect_token(p, 25)) // token='{'
  35020. )
  35021. {
  35022. D(fprintf(stderr, "%*c+ _tmp_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'"));
  35023. _res = _literal;
  35024. goto done;
  35025. }
  35026. p->mark = _mark;
  35027. D(fprintf(stderr, "%*c%s _tmp_169[%d-%d]: %s failed!\n", p->level, ' ',
  35028. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'"));
  35029. }
  35030. _res = NULL;
  35031. done:
  35032. p->level--;
  35033. return _res;
  35034. }
  35035. // _tmp_170: slash_no_default | slash_with_default
  35036. static void *
  35037. _tmp_170_rule(Parser *p)
  35038. {
  35039. if (p->level++ == MAXSTACK) {
  35040. _Pypegen_stack_overflow(p);
  35041. }
  35042. if (p->error_indicator) {
  35043. p->level--;
  35044. return NULL;
  35045. }
  35046. void * _res = NULL;
  35047. int _mark = p->mark;
  35048. { // slash_no_default
  35049. if (p->error_indicator) {
  35050. p->level--;
  35051. return NULL;
  35052. }
  35053. D(fprintf(stderr, "%*c> _tmp_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default"));
  35054. asdl_arg_seq* slash_no_default_var;
  35055. if (
  35056. (slash_no_default_var = slash_no_default_rule(p)) // slash_no_default
  35057. )
  35058. {
  35059. D(fprintf(stderr, "%*c+ _tmp_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default"));
  35060. _res = slash_no_default_var;
  35061. goto done;
  35062. }
  35063. p->mark = _mark;
  35064. D(fprintf(stderr, "%*c%s _tmp_170[%d-%d]: %s failed!\n", p->level, ' ',
  35065. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default"));
  35066. }
  35067. { // slash_with_default
  35068. if (p->error_indicator) {
  35069. p->level--;
  35070. return NULL;
  35071. }
  35072. D(fprintf(stderr, "%*c> _tmp_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
  35073. SlashWithDefault* slash_with_default_var;
  35074. if (
  35075. (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default
  35076. )
  35077. {
  35078. D(fprintf(stderr, "%*c+ _tmp_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
  35079. _res = slash_with_default_var;
  35080. goto done;
  35081. }
  35082. p->mark = _mark;
  35083. D(fprintf(stderr, "%*c%s _tmp_170[%d-%d]: %s failed!\n", p->level, ' ',
  35084. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default"));
  35085. }
  35086. _res = NULL;
  35087. done:
  35088. p->level--;
  35089. return _res;
  35090. }
  35091. // _loop0_171: param_maybe_default
  35092. static asdl_seq *
  35093. _loop0_171_rule(Parser *p)
  35094. {
  35095. if (p->level++ == MAXSTACK) {
  35096. _Pypegen_stack_overflow(p);
  35097. }
  35098. if (p->error_indicator) {
  35099. p->level--;
  35100. return NULL;
  35101. }
  35102. void *_res = NULL;
  35103. int _mark = p->mark;
  35104. void **_children = PyMem_Malloc(sizeof(void *));
  35105. if (!_children) {
  35106. p->error_indicator = 1;
  35107. PyErr_NoMemory();
  35108. p->level--;
  35109. return NULL;
  35110. }
  35111. Py_ssize_t _children_capacity = 1;
  35112. Py_ssize_t _n = 0;
  35113. { // param_maybe_default
  35114. if (p->error_indicator) {
  35115. p->level--;
  35116. return NULL;
  35117. }
  35118. D(fprintf(stderr, "%*c> _loop0_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
  35119. NameDefaultPair* param_maybe_default_var;
  35120. while (
  35121. (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
  35122. )
  35123. {
  35124. _res = param_maybe_default_var;
  35125. if (_n == _children_capacity) {
  35126. _children_capacity *= 2;
  35127. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  35128. if (!_new_children) {
  35129. PyMem_Free(_children);
  35130. p->error_indicator = 1;
  35131. PyErr_NoMemory();
  35132. p->level--;
  35133. return NULL;
  35134. }
  35135. _children = _new_children;
  35136. }
  35137. _children[_n++] = _res;
  35138. _mark = p->mark;
  35139. }
  35140. p->mark = _mark;
  35141. D(fprintf(stderr, "%*c%s _loop0_171[%d-%d]: %s failed!\n", p->level, ' ',
  35142. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
  35143. }
  35144. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  35145. if (!_seq) {
  35146. PyMem_Free(_children);
  35147. p->error_indicator = 1;
  35148. PyErr_NoMemory();
  35149. p->level--;
  35150. return NULL;
  35151. }
  35152. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  35153. PyMem_Free(_children);
  35154. p->level--;
  35155. return _seq;
  35156. }
  35157. // _loop0_172: param_no_default
  35158. static asdl_seq *
  35159. _loop0_172_rule(Parser *p)
  35160. {
  35161. if (p->level++ == MAXSTACK) {
  35162. _Pypegen_stack_overflow(p);
  35163. }
  35164. if (p->error_indicator) {
  35165. p->level--;
  35166. return NULL;
  35167. }
  35168. void *_res = NULL;
  35169. int _mark = p->mark;
  35170. void **_children = PyMem_Malloc(sizeof(void *));
  35171. if (!_children) {
  35172. p->error_indicator = 1;
  35173. PyErr_NoMemory();
  35174. p->level--;
  35175. return NULL;
  35176. }
  35177. Py_ssize_t _children_capacity = 1;
  35178. Py_ssize_t _n = 0;
  35179. { // param_no_default
  35180. if (p->error_indicator) {
  35181. p->level--;
  35182. return NULL;
  35183. }
  35184. D(fprintf(stderr, "%*c> _loop0_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
  35185. arg_ty param_no_default_var;
  35186. while (
  35187. (param_no_default_var = param_no_default_rule(p)) // param_no_default
  35188. )
  35189. {
  35190. _res = param_no_default_var;
  35191. if (_n == _children_capacity) {
  35192. _children_capacity *= 2;
  35193. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  35194. if (!_new_children) {
  35195. PyMem_Free(_children);
  35196. p->error_indicator = 1;
  35197. PyErr_NoMemory();
  35198. p->level--;
  35199. return NULL;
  35200. }
  35201. _children = _new_children;
  35202. }
  35203. _children[_n++] = _res;
  35204. _mark = p->mark;
  35205. }
  35206. p->mark = _mark;
  35207. D(fprintf(stderr, "%*c%s _loop0_172[%d-%d]: %s failed!\n", p->level, ' ',
  35208. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
  35209. }
  35210. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  35211. if (!_seq) {
  35212. PyMem_Free(_children);
  35213. p->error_indicator = 1;
  35214. PyErr_NoMemory();
  35215. p->level--;
  35216. return NULL;
  35217. }
  35218. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  35219. PyMem_Free(_children);
  35220. p->level--;
  35221. return _seq;
  35222. }
  35223. // _loop0_173: param_no_default
  35224. static asdl_seq *
  35225. _loop0_173_rule(Parser *p)
  35226. {
  35227. if (p->level++ == MAXSTACK) {
  35228. _Pypegen_stack_overflow(p);
  35229. }
  35230. if (p->error_indicator) {
  35231. p->level--;
  35232. return NULL;
  35233. }
  35234. void *_res = NULL;
  35235. int _mark = p->mark;
  35236. void **_children = PyMem_Malloc(sizeof(void *));
  35237. if (!_children) {
  35238. p->error_indicator = 1;
  35239. PyErr_NoMemory();
  35240. p->level--;
  35241. return NULL;
  35242. }
  35243. Py_ssize_t _children_capacity = 1;
  35244. Py_ssize_t _n = 0;
  35245. { // param_no_default
  35246. if (p->error_indicator) {
  35247. p->level--;
  35248. return NULL;
  35249. }
  35250. D(fprintf(stderr, "%*c> _loop0_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
  35251. arg_ty param_no_default_var;
  35252. while (
  35253. (param_no_default_var = param_no_default_rule(p)) // param_no_default
  35254. )
  35255. {
  35256. _res = param_no_default_var;
  35257. if (_n == _children_capacity) {
  35258. _children_capacity *= 2;
  35259. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  35260. if (!_new_children) {
  35261. PyMem_Free(_children);
  35262. p->error_indicator = 1;
  35263. PyErr_NoMemory();
  35264. p->level--;
  35265. return NULL;
  35266. }
  35267. _children = _new_children;
  35268. }
  35269. _children[_n++] = _res;
  35270. _mark = p->mark;
  35271. }
  35272. p->mark = _mark;
  35273. D(fprintf(stderr, "%*c%s _loop0_173[%d-%d]: %s failed!\n", p->level, ' ',
  35274. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
  35275. }
  35276. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  35277. if (!_seq) {
  35278. PyMem_Free(_children);
  35279. p->error_indicator = 1;
  35280. PyErr_NoMemory();
  35281. p->level--;
  35282. return NULL;
  35283. }
  35284. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  35285. PyMem_Free(_children);
  35286. p->level--;
  35287. return _seq;
  35288. }
  35289. // _loop1_174: param_no_default
  35290. static asdl_seq *
  35291. _loop1_174_rule(Parser *p)
  35292. {
  35293. if (p->level++ == MAXSTACK) {
  35294. _Pypegen_stack_overflow(p);
  35295. }
  35296. if (p->error_indicator) {
  35297. p->level--;
  35298. return NULL;
  35299. }
  35300. void *_res = NULL;
  35301. int _mark = p->mark;
  35302. void **_children = PyMem_Malloc(sizeof(void *));
  35303. if (!_children) {
  35304. p->error_indicator = 1;
  35305. PyErr_NoMemory();
  35306. p->level--;
  35307. return NULL;
  35308. }
  35309. Py_ssize_t _children_capacity = 1;
  35310. Py_ssize_t _n = 0;
  35311. { // param_no_default
  35312. if (p->error_indicator) {
  35313. p->level--;
  35314. return NULL;
  35315. }
  35316. D(fprintf(stderr, "%*c> _loop1_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
  35317. arg_ty param_no_default_var;
  35318. while (
  35319. (param_no_default_var = param_no_default_rule(p)) // param_no_default
  35320. )
  35321. {
  35322. _res = param_no_default_var;
  35323. if (_n == _children_capacity) {
  35324. _children_capacity *= 2;
  35325. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  35326. if (!_new_children) {
  35327. PyMem_Free(_children);
  35328. p->error_indicator = 1;
  35329. PyErr_NoMemory();
  35330. p->level--;
  35331. return NULL;
  35332. }
  35333. _children = _new_children;
  35334. }
  35335. _children[_n++] = _res;
  35336. _mark = p->mark;
  35337. }
  35338. p->mark = _mark;
  35339. D(fprintf(stderr, "%*c%s _loop1_174[%d-%d]: %s failed!\n", p->level, ' ',
  35340. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
  35341. }
  35342. if (_n == 0 || p->error_indicator) {
  35343. PyMem_Free(_children);
  35344. p->level--;
  35345. return NULL;
  35346. }
  35347. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  35348. if (!_seq) {
  35349. PyMem_Free(_children);
  35350. p->error_indicator = 1;
  35351. PyErr_NoMemory();
  35352. p->level--;
  35353. return NULL;
  35354. }
  35355. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  35356. PyMem_Free(_children);
  35357. p->level--;
  35358. return _seq;
  35359. }
  35360. // _tmp_175: slash_no_default | slash_with_default
  35361. static void *
  35362. _tmp_175_rule(Parser *p)
  35363. {
  35364. if (p->level++ == MAXSTACK) {
  35365. _Pypegen_stack_overflow(p);
  35366. }
  35367. if (p->error_indicator) {
  35368. p->level--;
  35369. return NULL;
  35370. }
  35371. void * _res = NULL;
  35372. int _mark = p->mark;
  35373. { // slash_no_default
  35374. if (p->error_indicator) {
  35375. p->level--;
  35376. return NULL;
  35377. }
  35378. D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default"));
  35379. asdl_arg_seq* slash_no_default_var;
  35380. if (
  35381. (slash_no_default_var = slash_no_default_rule(p)) // slash_no_default
  35382. )
  35383. {
  35384. D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default"));
  35385. _res = slash_no_default_var;
  35386. goto done;
  35387. }
  35388. p->mark = _mark;
  35389. D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ',
  35390. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default"));
  35391. }
  35392. { // slash_with_default
  35393. if (p->error_indicator) {
  35394. p->level--;
  35395. return NULL;
  35396. }
  35397. D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
  35398. SlashWithDefault* slash_with_default_var;
  35399. if (
  35400. (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default
  35401. )
  35402. {
  35403. D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
  35404. _res = slash_with_default_var;
  35405. goto done;
  35406. }
  35407. p->mark = _mark;
  35408. D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ',
  35409. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default"));
  35410. }
  35411. _res = NULL;
  35412. done:
  35413. p->level--;
  35414. return _res;
  35415. }
  35416. // _loop0_176: param_maybe_default
  35417. static asdl_seq *
  35418. _loop0_176_rule(Parser *p)
  35419. {
  35420. if (p->level++ == MAXSTACK) {
  35421. _Pypegen_stack_overflow(p);
  35422. }
  35423. if (p->error_indicator) {
  35424. p->level--;
  35425. return NULL;
  35426. }
  35427. void *_res = NULL;
  35428. int _mark = p->mark;
  35429. void **_children = PyMem_Malloc(sizeof(void *));
  35430. if (!_children) {
  35431. p->error_indicator = 1;
  35432. PyErr_NoMemory();
  35433. p->level--;
  35434. return NULL;
  35435. }
  35436. Py_ssize_t _children_capacity = 1;
  35437. Py_ssize_t _n = 0;
  35438. { // param_maybe_default
  35439. if (p->error_indicator) {
  35440. p->level--;
  35441. return NULL;
  35442. }
  35443. D(fprintf(stderr, "%*c> _loop0_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
  35444. NameDefaultPair* param_maybe_default_var;
  35445. while (
  35446. (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
  35447. )
  35448. {
  35449. _res = param_maybe_default_var;
  35450. if (_n == _children_capacity) {
  35451. _children_capacity *= 2;
  35452. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  35453. if (!_new_children) {
  35454. PyMem_Free(_children);
  35455. p->error_indicator = 1;
  35456. PyErr_NoMemory();
  35457. p->level--;
  35458. return NULL;
  35459. }
  35460. _children = _new_children;
  35461. }
  35462. _children[_n++] = _res;
  35463. _mark = p->mark;
  35464. }
  35465. p->mark = _mark;
  35466. D(fprintf(stderr, "%*c%s _loop0_176[%d-%d]: %s failed!\n", p->level, ' ',
  35467. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
  35468. }
  35469. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  35470. if (!_seq) {
  35471. PyMem_Free(_children);
  35472. p->error_indicator = 1;
  35473. PyErr_NoMemory();
  35474. p->level--;
  35475. return NULL;
  35476. }
  35477. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  35478. PyMem_Free(_children);
  35479. p->level--;
  35480. return _seq;
  35481. }
  35482. // _tmp_177: ',' | param_no_default
  35483. static void *
  35484. _tmp_177_rule(Parser *p)
  35485. {
  35486. if (p->level++ == MAXSTACK) {
  35487. _Pypegen_stack_overflow(p);
  35488. }
  35489. if (p->error_indicator) {
  35490. p->level--;
  35491. return NULL;
  35492. }
  35493. void * _res = NULL;
  35494. int _mark = p->mark;
  35495. { // ','
  35496. if (p->error_indicator) {
  35497. p->level--;
  35498. return NULL;
  35499. }
  35500. D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
  35501. Token * _literal;
  35502. if (
  35503. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  35504. )
  35505. {
  35506. D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
  35507. _res = _literal;
  35508. goto done;
  35509. }
  35510. p->mark = _mark;
  35511. D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ',
  35512. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
  35513. }
  35514. { // param_no_default
  35515. if (p->error_indicator) {
  35516. p->level--;
  35517. return NULL;
  35518. }
  35519. D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
  35520. arg_ty param_no_default_var;
  35521. if (
  35522. (param_no_default_var = param_no_default_rule(p)) // param_no_default
  35523. )
  35524. {
  35525. D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default"));
  35526. _res = param_no_default_var;
  35527. goto done;
  35528. }
  35529. p->mark = _mark;
  35530. D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ',
  35531. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
  35532. }
  35533. _res = NULL;
  35534. done:
  35535. p->level--;
  35536. return _res;
  35537. }
  35538. // _loop0_178: param_maybe_default
  35539. static asdl_seq *
  35540. _loop0_178_rule(Parser *p)
  35541. {
  35542. if (p->level++ == MAXSTACK) {
  35543. _Pypegen_stack_overflow(p);
  35544. }
  35545. if (p->error_indicator) {
  35546. p->level--;
  35547. return NULL;
  35548. }
  35549. void *_res = NULL;
  35550. int _mark = p->mark;
  35551. void **_children = PyMem_Malloc(sizeof(void *));
  35552. if (!_children) {
  35553. p->error_indicator = 1;
  35554. PyErr_NoMemory();
  35555. p->level--;
  35556. return NULL;
  35557. }
  35558. Py_ssize_t _children_capacity = 1;
  35559. Py_ssize_t _n = 0;
  35560. { // param_maybe_default
  35561. if (p->error_indicator) {
  35562. p->level--;
  35563. return NULL;
  35564. }
  35565. D(fprintf(stderr, "%*c> _loop0_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
  35566. NameDefaultPair* param_maybe_default_var;
  35567. while (
  35568. (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
  35569. )
  35570. {
  35571. _res = param_maybe_default_var;
  35572. if (_n == _children_capacity) {
  35573. _children_capacity *= 2;
  35574. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  35575. if (!_new_children) {
  35576. PyMem_Free(_children);
  35577. p->error_indicator = 1;
  35578. PyErr_NoMemory();
  35579. p->level--;
  35580. return NULL;
  35581. }
  35582. _children = _new_children;
  35583. }
  35584. _children[_n++] = _res;
  35585. _mark = p->mark;
  35586. }
  35587. p->mark = _mark;
  35588. D(fprintf(stderr, "%*c%s _loop0_178[%d-%d]: %s failed!\n", p->level, ' ',
  35589. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
  35590. }
  35591. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  35592. if (!_seq) {
  35593. PyMem_Free(_children);
  35594. p->error_indicator = 1;
  35595. PyErr_NoMemory();
  35596. p->level--;
  35597. return NULL;
  35598. }
  35599. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  35600. PyMem_Free(_children);
  35601. p->level--;
  35602. return _seq;
  35603. }
  35604. // _loop1_179: param_maybe_default
  35605. static asdl_seq *
  35606. _loop1_179_rule(Parser *p)
  35607. {
  35608. if (p->level++ == MAXSTACK) {
  35609. _Pypegen_stack_overflow(p);
  35610. }
  35611. if (p->error_indicator) {
  35612. p->level--;
  35613. return NULL;
  35614. }
  35615. void *_res = NULL;
  35616. int _mark = p->mark;
  35617. void **_children = PyMem_Malloc(sizeof(void *));
  35618. if (!_children) {
  35619. p->error_indicator = 1;
  35620. PyErr_NoMemory();
  35621. p->level--;
  35622. return NULL;
  35623. }
  35624. Py_ssize_t _children_capacity = 1;
  35625. Py_ssize_t _n = 0;
  35626. { // param_maybe_default
  35627. if (p->error_indicator) {
  35628. p->level--;
  35629. return NULL;
  35630. }
  35631. D(fprintf(stderr, "%*c> _loop1_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
  35632. NameDefaultPair* param_maybe_default_var;
  35633. while (
  35634. (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
  35635. )
  35636. {
  35637. _res = param_maybe_default_var;
  35638. if (_n == _children_capacity) {
  35639. _children_capacity *= 2;
  35640. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  35641. if (!_new_children) {
  35642. PyMem_Free(_children);
  35643. p->error_indicator = 1;
  35644. PyErr_NoMemory();
  35645. p->level--;
  35646. return NULL;
  35647. }
  35648. _children = _new_children;
  35649. }
  35650. _children[_n++] = _res;
  35651. _mark = p->mark;
  35652. }
  35653. p->mark = _mark;
  35654. D(fprintf(stderr, "%*c%s _loop1_179[%d-%d]: %s failed!\n", p->level, ' ',
  35655. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
  35656. }
  35657. if (_n == 0 || p->error_indicator) {
  35658. PyMem_Free(_children);
  35659. p->level--;
  35660. return NULL;
  35661. }
  35662. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  35663. if (!_seq) {
  35664. PyMem_Free(_children);
  35665. p->error_indicator = 1;
  35666. PyErr_NoMemory();
  35667. p->level--;
  35668. return NULL;
  35669. }
  35670. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  35671. PyMem_Free(_children);
  35672. p->level--;
  35673. return _seq;
  35674. }
  35675. // _tmp_180: ')' | ','
  35676. static void *
  35677. _tmp_180_rule(Parser *p)
  35678. {
  35679. if (p->level++ == MAXSTACK) {
  35680. _Pypegen_stack_overflow(p);
  35681. }
  35682. if (p->error_indicator) {
  35683. p->level--;
  35684. return NULL;
  35685. }
  35686. void * _res = NULL;
  35687. int _mark = p->mark;
  35688. { // ')'
  35689. if (p->error_indicator) {
  35690. p->level--;
  35691. return NULL;
  35692. }
  35693. D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
  35694. Token * _literal;
  35695. if (
  35696. (_literal = _PyPegen_expect_token(p, 8)) // token=')'
  35697. )
  35698. {
  35699. D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
  35700. _res = _literal;
  35701. goto done;
  35702. }
  35703. p->mark = _mark;
  35704. D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ',
  35705. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
  35706. }
  35707. { // ','
  35708. if (p->error_indicator) {
  35709. p->level--;
  35710. return NULL;
  35711. }
  35712. D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
  35713. Token * _literal;
  35714. if (
  35715. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  35716. )
  35717. {
  35718. D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
  35719. _res = _literal;
  35720. goto done;
  35721. }
  35722. p->mark = _mark;
  35723. D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ',
  35724. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
  35725. }
  35726. _res = NULL;
  35727. done:
  35728. p->level--;
  35729. return _res;
  35730. }
  35731. // _tmp_181: ')' | ',' (')' | '**')
  35732. static void *
  35733. _tmp_181_rule(Parser *p)
  35734. {
  35735. if (p->level++ == MAXSTACK) {
  35736. _Pypegen_stack_overflow(p);
  35737. }
  35738. if (p->error_indicator) {
  35739. p->level--;
  35740. return NULL;
  35741. }
  35742. void * _res = NULL;
  35743. int _mark = p->mark;
  35744. { // ')'
  35745. if (p->error_indicator) {
  35746. p->level--;
  35747. return NULL;
  35748. }
  35749. D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
  35750. Token * _literal;
  35751. if (
  35752. (_literal = _PyPegen_expect_token(p, 8)) // token=')'
  35753. )
  35754. {
  35755. D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
  35756. _res = _literal;
  35757. goto done;
  35758. }
  35759. p->mark = _mark;
  35760. D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ',
  35761. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
  35762. }
  35763. { // ',' (')' | '**')
  35764. if (p->error_indicator) {
  35765. p->level--;
  35766. return NULL;
  35767. }
  35768. D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
  35769. Token * _literal;
  35770. void *_tmp_269_var;
  35771. if (
  35772. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  35773. &&
  35774. (_tmp_269_var = _tmp_269_rule(p)) // ')' | '**'
  35775. )
  35776. {
  35777. D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
  35778. _res = _PyPegen_dummy_name(p, _literal, _tmp_269_var);
  35779. goto done;
  35780. }
  35781. p->mark = _mark;
  35782. D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ',
  35783. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')"));
  35784. }
  35785. _res = NULL;
  35786. done:
  35787. p->level--;
  35788. return _res;
  35789. }
  35790. // _tmp_182: param_no_default | ','
  35791. static void *
  35792. _tmp_182_rule(Parser *p)
  35793. {
  35794. if (p->level++ == MAXSTACK) {
  35795. _Pypegen_stack_overflow(p);
  35796. }
  35797. if (p->error_indicator) {
  35798. p->level--;
  35799. return NULL;
  35800. }
  35801. void * _res = NULL;
  35802. int _mark = p->mark;
  35803. { // param_no_default
  35804. if (p->error_indicator) {
  35805. p->level--;
  35806. return NULL;
  35807. }
  35808. D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
  35809. arg_ty param_no_default_var;
  35810. if (
  35811. (param_no_default_var = param_no_default_rule(p)) // param_no_default
  35812. )
  35813. {
  35814. D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default"));
  35815. _res = param_no_default_var;
  35816. goto done;
  35817. }
  35818. p->mark = _mark;
  35819. D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ',
  35820. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
  35821. }
  35822. { // ','
  35823. if (p->error_indicator) {
  35824. p->level--;
  35825. return NULL;
  35826. }
  35827. D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
  35828. Token * _literal;
  35829. if (
  35830. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  35831. )
  35832. {
  35833. D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
  35834. _res = _literal;
  35835. goto done;
  35836. }
  35837. p->mark = _mark;
  35838. D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ',
  35839. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
  35840. }
  35841. _res = NULL;
  35842. done:
  35843. p->level--;
  35844. return _res;
  35845. }
  35846. // _loop0_183: param_maybe_default
  35847. static asdl_seq *
  35848. _loop0_183_rule(Parser *p)
  35849. {
  35850. if (p->level++ == MAXSTACK) {
  35851. _Pypegen_stack_overflow(p);
  35852. }
  35853. if (p->error_indicator) {
  35854. p->level--;
  35855. return NULL;
  35856. }
  35857. void *_res = NULL;
  35858. int _mark = p->mark;
  35859. void **_children = PyMem_Malloc(sizeof(void *));
  35860. if (!_children) {
  35861. p->error_indicator = 1;
  35862. PyErr_NoMemory();
  35863. p->level--;
  35864. return NULL;
  35865. }
  35866. Py_ssize_t _children_capacity = 1;
  35867. Py_ssize_t _n = 0;
  35868. { // param_maybe_default
  35869. if (p->error_indicator) {
  35870. p->level--;
  35871. return NULL;
  35872. }
  35873. D(fprintf(stderr, "%*c> _loop0_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
  35874. NameDefaultPair* param_maybe_default_var;
  35875. while (
  35876. (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
  35877. )
  35878. {
  35879. _res = param_maybe_default_var;
  35880. if (_n == _children_capacity) {
  35881. _children_capacity *= 2;
  35882. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  35883. if (!_new_children) {
  35884. PyMem_Free(_children);
  35885. p->error_indicator = 1;
  35886. PyErr_NoMemory();
  35887. p->level--;
  35888. return NULL;
  35889. }
  35890. _children = _new_children;
  35891. }
  35892. _children[_n++] = _res;
  35893. _mark = p->mark;
  35894. }
  35895. p->mark = _mark;
  35896. D(fprintf(stderr, "%*c%s _loop0_183[%d-%d]: %s failed!\n", p->level, ' ',
  35897. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
  35898. }
  35899. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  35900. if (!_seq) {
  35901. PyMem_Free(_children);
  35902. p->error_indicator = 1;
  35903. PyErr_NoMemory();
  35904. p->level--;
  35905. return NULL;
  35906. }
  35907. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  35908. PyMem_Free(_children);
  35909. p->level--;
  35910. return _seq;
  35911. }
  35912. // _tmp_184: param_no_default | ','
  35913. static void *
  35914. _tmp_184_rule(Parser *p)
  35915. {
  35916. if (p->level++ == MAXSTACK) {
  35917. _Pypegen_stack_overflow(p);
  35918. }
  35919. if (p->error_indicator) {
  35920. p->level--;
  35921. return NULL;
  35922. }
  35923. void * _res = NULL;
  35924. int _mark = p->mark;
  35925. { // param_no_default
  35926. if (p->error_indicator) {
  35927. p->level--;
  35928. return NULL;
  35929. }
  35930. D(fprintf(stderr, "%*c> _tmp_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
  35931. arg_ty param_no_default_var;
  35932. if (
  35933. (param_no_default_var = param_no_default_rule(p)) // param_no_default
  35934. )
  35935. {
  35936. D(fprintf(stderr, "%*c+ _tmp_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default"));
  35937. _res = param_no_default_var;
  35938. goto done;
  35939. }
  35940. p->mark = _mark;
  35941. D(fprintf(stderr, "%*c%s _tmp_184[%d-%d]: %s failed!\n", p->level, ' ',
  35942. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
  35943. }
  35944. { // ','
  35945. if (p->error_indicator) {
  35946. p->level--;
  35947. return NULL;
  35948. }
  35949. D(fprintf(stderr, "%*c> _tmp_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
  35950. Token * _literal;
  35951. if (
  35952. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  35953. )
  35954. {
  35955. D(fprintf(stderr, "%*c+ _tmp_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
  35956. _res = _literal;
  35957. goto done;
  35958. }
  35959. p->mark = _mark;
  35960. D(fprintf(stderr, "%*c%s _tmp_184[%d-%d]: %s failed!\n", p->level, ' ',
  35961. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
  35962. }
  35963. _res = NULL;
  35964. done:
  35965. p->level--;
  35966. return _res;
  35967. }
  35968. // _tmp_185: '*' | '**' | '/'
  35969. static void *
  35970. _tmp_185_rule(Parser *p)
  35971. {
  35972. if (p->level++ == MAXSTACK) {
  35973. _Pypegen_stack_overflow(p);
  35974. }
  35975. if (p->error_indicator) {
  35976. p->level--;
  35977. return NULL;
  35978. }
  35979. void * _res = NULL;
  35980. int _mark = p->mark;
  35981. { // '*'
  35982. if (p->error_indicator) {
  35983. p->level--;
  35984. return NULL;
  35985. }
  35986. D(fprintf(stderr, "%*c> _tmp_185[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'"));
  35987. Token * _literal;
  35988. if (
  35989. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  35990. )
  35991. {
  35992. D(fprintf(stderr, "%*c+ _tmp_185[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
  35993. _res = _literal;
  35994. goto done;
  35995. }
  35996. p->mark = _mark;
  35997. D(fprintf(stderr, "%*c%s _tmp_185[%d-%d]: %s failed!\n", p->level, ' ',
  35998. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'"));
  35999. }
  36000. { // '**'
  36001. if (p->error_indicator) {
  36002. p->level--;
  36003. return NULL;
  36004. }
  36005. D(fprintf(stderr, "%*c> _tmp_185[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
  36006. Token * _literal;
  36007. if (
  36008. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  36009. )
  36010. {
  36011. D(fprintf(stderr, "%*c+ _tmp_185[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
  36012. _res = _literal;
  36013. goto done;
  36014. }
  36015. p->mark = _mark;
  36016. D(fprintf(stderr, "%*c%s _tmp_185[%d-%d]: %s failed!\n", p->level, ' ',
  36017. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
  36018. }
  36019. { // '/'
  36020. if (p->error_indicator) {
  36021. p->level--;
  36022. return NULL;
  36023. }
  36024. D(fprintf(stderr, "%*c> _tmp_185[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/'"));
  36025. Token * _literal;
  36026. if (
  36027. (_literal = _PyPegen_expect_token(p, 17)) // token='/'
  36028. )
  36029. {
  36030. D(fprintf(stderr, "%*c+ _tmp_185[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/'"));
  36031. _res = _literal;
  36032. goto done;
  36033. }
  36034. p->mark = _mark;
  36035. D(fprintf(stderr, "%*c%s _tmp_185[%d-%d]: %s failed!\n", p->level, ' ',
  36036. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/'"));
  36037. }
  36038. _res = NULL;
  36039. done:
  36040. p->level--;
  36041. return _res;
  36042. }
  36043. // _loop1_186: param_with_default
  36044. static asdl_seq *
  36045. _loop1_186_rule(Parser *p)
  36046. {
  36047. if (p->level++ == MAXSTACK) {
  36048. _Pypegen_stack_overflow(p);
  36049. }
  36050. if (p->error_indicator) {
  36051. p->level--;
  36052. return NULL;
  36053. }
  36054. void *_res = NULL;
  36055. int _mark = p->mark;
  36056. void **_children = PyMem_Malloc(sizeof(void *));
  36057. if (!_children) {
  36058. p->error_indicator = 1;
  36059. PyErr_NoMemory();
  36060. p->level--;
  36061. return NULL;
  36062. }
  36063. Py_ssize_t _children_capacity = 1;
  36064. Py_ssize_t _n = 0;
  36065. { // param_with_default
  36066. if (p->error_indicator) {
  36067. p->level--;
  36068. return NULL;
  36069. }
  36070. D(fprintf(stderr, "%*c> _loop1_186[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
  36071. NameDefaultPair* param_with_default_var;
  36072. while (
  36073. (param_with_default_var = param_with_default_rule(p)) // param_with_default
  36074. )
  36075. {
  36076. _res = param_with_default_var;
  36077. if (_n == _children_capacity) {
  36078. _children_capacity *= 2;
  36079. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  36080. if (!_new_children) {
  36081. PyMem_Free(_children);
  36082. p->error_indicator = 1;
  36083. PyErr_NoMemory();
  36084. p->level--;
  36085. return NULL;
  36086. }
  36087. _children = _new_children;
  36088. }
  36089. _children[_n++] = _res;
  36090. _mark = p->mark;
  36091. }
  36092. p->mark = _mark;
  36093. D(fprintf(stderr, "%*c%s _loop1_186[%d-%d]: %s failed!\n", p->level, ' ',
  36094. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
  36095. }
  36096. if (_n == 0 || p->error_indicator) {
  36097. PyMem_Free(_children);
  36098. p->level--;
  36099. return NULL;
  36100. }
  36101. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  36102. if (!_seq) {
  36103. PyMem_Free(_children);
  36104. p->error_indicator = 1;
  36105. PyErr_NoMemory();
  36106. p->level--;
  36107. return NULL;
  36108. }
  36109. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  36110. PyMem_Free(_children);
  36111. p->level--;
  36112. return _seq;
  36113. }
  36114. // _tmp_187: lambda_slash_no_default | lambda_slash_with_default
  36115. static void *
  36116. _tmp_187_rule(Parser *p)
  36117. {
  36118. if (p->level++ == MAXSTACK) {
  36119. _Pypegen_stack_overflow(p);
  36120. }
  36121. if (p->error_indicator) {
  36122. p->level--;
  36123. return NULL;
  36124. }
  36125. void * _res = NULL;
  36126. int _mark = p->mark;
  36127. { // lambda_slash_no_default
  36128. if (p->error_indicator) {
  36129. p->level--;
  36130. return NULL;
  36131. }
  36132. D(fprintf(stderr, "%*c> _tmp_187[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default"));
  36133. asdl_arg_seq* lambda_slash_no_default_var;
  36134. if (
  36135. (lambda_slash_no_default_var = lambda_slash_no_default_rule(p)) // lambda_slash_no_default
  36136. )
  36137. {
  36138. D(fprintf(stderr, "%*c+ _tmp_187[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default"));
  36139. _res = lambda_slash_no_default_var;
  36140. goto done;
  36141. }
  36142. p->mark = _mark;
  36143. D(fprintf(stderr, "%*c%s _tmp_187[%d-%d]: %s failed!\n", p->level, ' ',
  36144. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default"));
  36145. }
  36146. { // lambda_slash_with_default
  36147. if (p->error_indicator) {
  36148. p->level--;
  36149. return NULL;
  36150. }
  36151. D(fprintf(stderr, "%*c> _tmp_187[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
  36152. SlashWithDefault* lambda_slash_with_default_var;
  36153. if (
  36154. (lambda_slash_with_default_var = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
  36155. )
  36156. {
  36157. D(fprintf(stderr, "%*c+ _tmp_187[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
  36158. _res = lambda_slash_with_default_var;
  36159. goto done;
  36160. }
  36161. p->mark = _mark;
  36162. D(fprintf(stderr, "%*c%s _tmp_187[%d-%d]: %s failed!\n", p->level, ' ',
  36163. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default"));
  36164. }
  36165. _res = NULL;
  36166. done:
  36167. p->level--;
  36168. return _res;
  36169. }
  36170. // _loop0_188: lambda_param_maybe_default
  36171. static asdl_seq *
  36172. _loop0_188_rule(Parser *p)
  36173. {
  36174. if (p->level++ == MAXSTACK) {
  36175. _Pypegen_stack_overflow(p);
  36176. }
  36177. if (p->error_indicator) {
  36178. p->level--;
  36179. return NULL;
  36180. }
  36181. void *_res = NULL;
  36182. int _mark = p->mark;
  36183. void **_children = PyMem_Malloc(sizeof(void *));
  36184. if (!_children) {
  36185. p->error_indicator = 1;
  36186. PyErr_NoMemory();
  36187. p->level--;
  36188. return NULL;
  36189. }
  36190. Py_ssize_t _children_capacity = 1;
  36191. Py_ssize_t _n = 0;
  36192. { // lambda_param_maybe_default
  36193. if (p->error_indicator) {
  36194. p->level--;
  36195. return NULL;
  36196. }
  36197. D(fprintf(stderr, "%*c> _loop0_188[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
  36198. NameDefaultPair* lambda_param_maybe_default_var;
  36199. while (
  36200. (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
  36201. )
  36202. {
  36203. _res = lambda_param_maybe_default_var;
  36204. if (_n == _children_capacity) {
  36205. _children_capacity *= 2;
  36206. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  36207. if (!_new_children) {
  36208. PyMem_Free(_children);
  36209. p->error_indicator = 1;
  36210. PyErr_NoMemory();
  36211. p->level--;
  36212. return NULL;
  36213. }
  36214. _children = _new_children;
  36215. }
  36216. _children[_n++] = _res;
  36217. _mark = p->mark;
  36218. }
  36219. p->mark = _mark;
  36220. D(fprintf(stderr, "%*c%s _loop0_188[%d-%d]: %s failed!\n", p->level, ' ',
  36221. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
  36222. }
  36223. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  36224. if (!_seq) {
  36225. PyMem_Free(_children);
  36226. p->error_indicator = 1;
  36227. PyErr_NoMemory();
  36228. p->level--;
  36229. return NULL;
  36230. }
  36231. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  36232. PyMem_Free(_children);
  36233. p->level--;
  36234. return _seq;
  36235. }
  36236. // _loop0_189: lambda_param_no_default
  36237. static asdl_seq *
  36238. _loop0_189_rule(Parser *p)
  36239. {
  36240. if (p->level++ == MAXSTACK) {
  36241. _Pypegen_stack_overflow(p);
  36242. }
  36243. if (p->error_indicator) {
  36244. p->level--;
  36245. return NULL;
  36246. }
  36247. void *_res = NULL;
  36248. int _mark = p->mark;
  36249. void **_children = PyMem_Malloc(sizeof(void *));
  36250. if (!_children) {
  36251. p->error_indicator = 1;
  36252. PyErr_NoMemory();
  36253. p->level--;
  36254. return NULL;
  36255. }
  36256. Py_ssize_t _children_capacity = 1;
  36257. Py_ssize_t _n = 0;
  36258. { // lambda_param_no_default
  36259. if (p->error_indicator) {
  36260. p->level--;
  36261. return NULL;
  36262. }
  36263. D(fprintf(stderr, "%*c> _loop0_189[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
  36264. arg_ty lambda_param_no_default_var;
  36265. while (
  36266. (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
  36267. )
  36268. {
  36269. _res = lambda_param_no_default_var;
  36270. if (_n == _children_capacity) {
  36271. _children_capacity *= 2;
  36272. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  36273. if (!_new_children) {
  36274. PyMem_Free(_children);
  36275. p->error_indicator = 1;
  36276. PyErr_NoMemory();
  36277. p->level--;
  36278. return NULL;
  36279. }
  36280. _children = _new_children;
  36281. }
  36282. _children[_n++] = _res;
  36283. _mark = p->mark;
  36284. }
  36285. p->mark = _mark;
  36286. D(fprintf(stderr, "%*c%s _loop0_189[%d-%d]: %s failed!\n", p->level, ' ',
  36287. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
  36288. }
  36289. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  36290. if (!_seq) {
  36291. PyMem_Free(_children);
  36292. p->error_indicator = 1;
  36293. PyErr_NoMemory();
  36294. p->level--;
  36295. return NULL;
  36296. }
  36297. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  36298. PyMem_Free(_children);
  36299. p->level--;
  36300. return _seq;
  36301. }
  36302. // _loop0_190: lambda_param_no_default
  36303. static asdl_seq *
  36304. _loop0_190_rule(Parser *p)
  36305. {
  36306. if (p->level++ == MAXSTACK) {
  36307. _Pypegen_stack_overflow(p);
  36308. }
  36309. if (p->error_indicator) {
  36310. p->level--;
  36311. return NULL;
  36312. }
  36313. void *_res = NULL;
  36314. int _mark = p->mark;
  36315. void **_children = PyMem_Malloc(sizeof(void *));
  36316. if (!_children) {
  36317. p->error_indicator = 1;
  36318. PyErr_NoMemory();
  36319. p->level--;
  36320. return NULL;
  36321. }
  36322. Py_ssize_t _children_capacity = 1;
  36323. Py_ssize_t _n = 0;
  36324. { // lambda_param_no_default
  36325. if (p->error_indicator) {
  36326. p->level--;
  36327. return NULL;
  36328. }
  36329. D(fprintf(stderr, "%*c> _loop0_190[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
  36330. arg_ty lambda_param_no_default_var;
  36331. while (
  36332. (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
  36333. )
  36334. {
  36335. _res = lambda_param_no_default_var;
  36336. if (_n == _children_capacity) {
  36337. _children_capacity *= 2;
  36338. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  36339. if (!_new_children) {
  36340. PyMem_Free(_children);
  36341. p->error_indicator = 1;
  36342. PyErr_NoMemory();
  36343. p->level--;
  36344. return NULL;
  36345. }
  36346. _children = _new_children;
  36347. }
  36348. _children[_n++] = _res;
  36349. _mark = p->mark;
  36350. }
  36351. p->mark = _mark;
  36352. D(fprintf(stderr, "%*c%s _loop0_190[%d-%d]: %s failed!\n", p->level, ' ',
  36353. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
  36354. }
  36355. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  36356. if (!_seq) {
  36357. PyMem_Free(_children);
  36358. p->error_indicator = 1;
  36359. PyErr_NoMemory();
  36360. p->level--;
  36361. return NULL;
  36362. }
  36363. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  36364. PyMem_Free(_children);
  36365. p->level--;
  36366. return _seq;
  36367. }
  36368. // _loop0_192: ',' lambda_param
  36369. static asdl_seq *
  36370. _loop0_192_rule(Parser *p)
  36371. {
  36372. if (p->level++ == MAXSTACK) {
  36373. _Pypegen_stack_overflow(p);
  36374. }
  36375. if (p->error_indicator) {
  36376. p->level--;
  36377. return NULL;
  36378. }
  36379. void *_res = NULL;
  36380. int _mark = p->mark;
  36381. void **_children = PyMem_Malloc(sizeof(void *));
  36382. if (!_children) {
  36383. p->error_indicator = 1;
  36384. PyErr_NoMemory();
  36385. p->level--;
  36386. return NULL;
  36387. }
  36388. Py_ssize_t _children_capacity = 1;
  36389. Py_ssize_t _n = 0;
  36390. { // ',' lambda_param
  36391. if (p->error_indicator) {
  36392. p->level--;
  36393. return NULL;
  36394. }
  36395. D(fprintf(stderr, "%*c> _loop0_192[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' lambda_param"));
  36396. Token * _literal;
  36397. arg_ty elem;
  36398. while (
  36399. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  36400. &&
  36401. (elem = lambda_param_rule(p)) // lambda_param
  36402. )
  36403. {
  36404. _res = elem;
  36405. if (_res == NULL && PyErr_Occurred()) {
  36406. p->error_indicator = 1;
  36407. PyMem_Free(_children);
  36408. p->level--;
  36409. return NULL;
  36410. }
  36411. if (_n == _children_capacity) {
  36412. _children_capacity *= 2;
  36413. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  36414. if (!_new_children) {
  36415. PyMem_Free(_children);
  36416. p->error_indicator = 1;
  36417. PyErr_NoMemory();
  36418. p->level--;
  36419. return NULL;
  36420. }
  36421. _children = _new_children;
  36422. }
  36423. _children[_n++] = _res;
  36424. _mark = p->mark;
  36425. }
  36426. p->mark = _mark;
  36427. D(fprintf(stderr, "%*c%s _loop0_192[%d-%d]: %s failed!\n", p->level, ' ',
  36428. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' lambda_param"));
  36429. }
  36430. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  36431. if (!_seq) {
  36432. PyMem_Free(_children);
  36433. p->error_indicator = 1;
  36434. PyErr_NoMemory();
  36435. p->level--;
  36436. return NULL;
  36437. }
  36438. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  36439. PyMem_Free(_children);
  36440. p->level--;
  36441. return _seq;
  36442. }
  36443. // _gather_191: lambda_param _loop0_192
  36444. static asdl_seq *
  36445. _gather_191_rule(Parser *p)
  36446. {
  36447. if (p->level++ == MAXSTACK) {
  36448. _Pypegen_stack_overflow(p);
  36449. }
  36450. if (p->error_indicator) {
  36451. p->level--;
  36452. return NULL;
  36453. }
  36454. asdl_seq * _res = NULL;
  36455. int _mark = p->mark;
  36456. { // lambda_param _loop0_192
  36457. if (p->error_indicator) {
  36458. p->level--;
  36459. return NULL;
  36460. }
  36461. D(fprintf(stderr, "%*c> _gather_191[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param _loop0_192"));
  36462. arg_ty elem;
  36463. asdl_seq * seq;
  36464. if (
  36465. (elem = lambda_param_rule(p)) // lambda_param
  36466. &&
  36467. (seq = _loop0_192_rule(p)) // _loop0_192
  36468. )
  36469. {
  36470. D(fprintf(stderr, "%*c+ _gather_191[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param _loop0_192"));
  36471. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  36472. goto done;
  36473. }
  36474. p->mark = _mark;
  36475. D(fprintf(stderr, "%*c%s _gather_191[%d-%d]: %s failed!\n", p->level, ' ',
  36476. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param _loop0_192"));
  36477. }
  36478. _res = NULL;
  36479. done:
  36480. p->level--;
  36481. return _res;
  36482. }
  36483. // _tmp_193: lambda_slash_no_default | lambda_slash_with_default
  36484. static void *
  36485. _tmp_193_rule(Parser *p)
  36486. {
  36487. if (p->level++ == MAXSTACK) {
  36488. _Pypegen_stack_overflow(p);
  36489. }
  36490. if (p->error_indicator) {
  36491. p->level--;
  36492. return NULL;
  36493. }
  36494. void * _res = NULL;
  36495. int _mark = p->mark;
  36496. { // lambda_slash_no_default
  36497. if (p->error_indicator) {
  36498. p->level--;
  36499. return NULL;
  36500. }
  36501. D(fprintf(stderr, "%*c> _tmp_193[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default"));
  36502. asdl_arg_seq* lambda_slash_no_default_var;
  36503. if (
  36504. (lambda_slash_no_default_var = lambda_slash_no_default_rule(p)) // lambda_slash_no_default
  36505. )
  36506. {
  36507. D(fprintf(stderr, "%*c+ _tmp_193[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default"));
  36508. _res = lambda_slash_no_default_var;
  36509. goto done;
  36510. }
  36511. p->mark = _mark;
  36512. D(fprintf(stderr, "%*c%s _tmp_193[%d-%d]: %s failed!\n", p->level, ' ',
  36513. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default"));
  36514. }
  36515. { // lambda_slash_with_default
  36516. if (p->error_indicator) {
  36517. p->level--;
  36518. return NULL;
  36519. }
  36520. D(fprintf(stderr, "%*c> _tmp_193[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
  36521. SlashWithDefault* lambda_slash_with_default_var;
  36522. if (
  36523. (lambda_slash_with_default_var = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
  36524. )
  36525. {
  36526. D(fprintf(stderr, "%*c+ _tmp_193[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
  36527. _res = lambda_slash_with_default_var;
  36528. goto done;
  36529. }
  36530. p->mark = _mark;
  36531. D(fprintf(stderr, "%*c%s _tmp_193[%d-%d]: %s failed!\n", p->level, ' ',
  36532. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default"));
  36533. }
  36534. _res = NULL;
  36535. done:
  36536. p->level--;
  36537. return _res;
  36538. }
  36539. // _loop0_194: lambda_param_maybe_default
  36540. static asdl_seq *
  36541. _loop0_194_rule(Parser *p)
  36542. {
  36543. if (p->level++ == MAXSTACK) {
  36544. _Pypegen_stack_overflow(p);
  36545. }
  36546. if (p->error_indicator) {
  36547. p->level--;
  36548. return NULL;
  36549. }
  36550. void *_res = NULL;
  36551. int _mark = p->mark;
  36552. void **_children = PyMem_Malloc(sizeof(void *));
  36553. if (!_children) {
  36554. p->error_indicator = 1;
  36555. PyErr_NoMemory();
  36556. p->level--;
  36557. return NULL;
  36558. }
  36559. Py_ssize_t _children_capacity = 1;
  36560. Py_ssize_t _n = 0;
  36561. { // lambda_param_maybe_default
  36562. if (p->error_indicator) {
  36563. p->level--;
  36564. return NULL;
  36565. }
  36566. D(fprintf(stderr, "%*c> _loop0_194[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
  36567. NameDefaultPair* lambda_param_maybe_default_var;
  36568. while (
  36569. (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
  36570. )
  36571. {
  36572. _res = lambda_param_maybe_default_var;
  36573. if (_n == _children_capacity) {
  36574. _children_capacity *= 2;
  36575. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  36576. if (!_new_children) {
  36577. PyMem_Free(_children);
  36578. p->error_indicator = 1;
  36579. PyErr_NoMemory();
  36580. p->level--;
  36581. return NULL;
  36582. }
  36583. _children = _new_children;
  36584. }
  36585. _children[_n++] = _res;
  36586. _mark = p->mark;
  36587. }
  36588. p->mark = _mark;
  36589. D(fprintf(stderr, "%*c%s _loop0_194[%d-%d]: %s failed!\n", p->level, ' ',
  36590. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
  36591. }
  36592. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  36593. if (!_seq) {
  36594. PyMem_Free(_children);
  36595. p->error_indicator = 1;
  36596. PyErr_NoMemory();
  36597. p->level--;
  36598. return NULL;
  36599. }
  36600. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  36601. PyMem_Free(_children);
  36602. p->level--;
  36603. return _seq;
  36604. }
  36605. // _tmp_195: ',' | lambda_param_no_default
  36606. static void *
  36607. _tmp_195_rule(Parser *p)
  36608. {
  36609. if (p->level++ == MAXSTACK) {
  36610. _Pypegen_stack_overflow(p);
  36611. }
  36612. if (p->error_indicator) {
  36613. p->level--;
  36614. return NULL;
  36615. }
  36616. void * _res = NULL;
  36617. int _mark = p->mark;
  36618. { // ','
  36619. if (p->error_indicator) {
  36620. p->level--;
  36621. return NULL;
  36622. }
  36623. D(fprintf(stderr, "%*c> _tmp_195[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
  36624. Token * _literal;
  36625. if (
  36626. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  36627. )
  36628. {
  36629. D(fprintf(stderr, "%*c+ _tmp_195[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
  36630. _res = _literal;
  36631. goto done;
  36632. }
  36633. p->mark = _mark;
  36634. D(fprintf(stderr, "%*c%s _tmp_195[%d-%d]: %s failed!\n", p->level, ' ',
  36635. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
  36636. }
  36637. { // lambda_param_no_default
  36638. if (p->error_indicator) {
  36639. p->level--;
  36640. return NULL;
  36641. }
  36642. D(fprintf(stderr, "%*c> _tmp_195[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
  36643. arg_ty lambda_param_no_default_var;
  36644. if (
  36645. (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
  36646. )
  36647. {
  36648. D(fprintf(stderr, "%*c+ _tmp_195[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
  36649. _res = lambda_param_no_default_var;
  36650. goto done;
  36651. }
  36652. p->mark = _mark;
  36653. D(fprintf(stderr, "%*c%s _tmp_195[%d-%d]: %s failed!\n", p->level, ' ',
  36654. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
  36655. }
  36656. _res = NULL;
  36657. done:
  36658. p->level--;
  36659. return _res;
  36660. }
  36661. // _loop0_196: lambda_param_maybe_default
  36662. static asdl_seq *
  36663. _loop0_196_rule(Parser *p)
  36664. {
  36665. if (p->level++ == MAXSTACK) {
  36666. _Pypegen_stack_overflow(p);
  36667. }
  36668. if (p->error_indicator) {
  36669. p->level--;
  36670. return NULL;
  36671. }
  36672. void *_res = NULL;
  36673. int _mark = p->mark;
  36674. void **_children = PyMem_Malloc(sizeof(void *));
  36675. if (!_children) {
  36676. p->error_indicator = 1;
  36677. PyErr_NoMemory();
  36678. p->level--;
  36679. return NULL;
  36680. }
  36681. Py_ssize_t _children_capacity = 1;
  36682. Py_ssize_t _n = 0;
  36683. { // lambda_param_maybe_default
  36684. if (p->error_indicator) {
  36685. p->level--;
  36686. return NULL;
  36687. }
  36688. D(fprintf(stderr, "%*c> _loop0_196[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
  36689. NameDefaultPair* lambda_param_maybe_default_var;
  36690. while (
  36691. (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
  36692. )
  36693. {
  36694. _res = lambda_param_maybe_default_var;
  36695. if (_n == _children_capacity) {
  36696. _children_capacity *= 2;
  36697. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  36698. if (!_new_children) {
  36699. PyMem_Free(_children);
  36700. p->error_indicator = 1;
  36701. PyErr_NoMemory();
  36702. p->level--;
  36703. return NULL;
  36704. }
  36705. _children = _new_children;
  36706. }
  36707. _children[_n++] = _res;
  36708. _mark = p->mark;
  36709. }
  36710. p->mark = _mark;
  36711. D(fprintf(stderr, "%*c%s _loop0_196[%d-%d]: %s failed!\n", p->level, ' ',
  36712. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
  36713. }
  36714. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  36715. if (!_seq) {
  36716. PyMem_Free(_children);
  36717. p->error_indicator = 1;
  36718. PyErr_NoMemory();
  36719. p->level--;
  36720. return NULL;
  36721. }
  36722. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  36723. PyMem_Free(_children);
  36724. p->level--;
  36725. return _seq;
  36726. }
  36727. // _loop1_197: lambda_param_maybe_default
  36728. static asdl_seq *
  36729. _loop1_197_rule(Parser *p)
  36730. {
  36731. if (p->level++ == MAXSTACK) {
  36732. _Pypegen_stack_overflow(p);
  36733. }
  36734. if (p->error_indicator) {
  36735. p->level--;
  36736. return NULL;
  36737. }
  36738. void *_res = NULL;
  36739. int _mark = p->mark;
  36740. void **_children = PyMem_Malloc(sizeof(void *));
  36741. if (!_children) {
  36742. p->error_indicator = 1;
  36743. PyErr_NoMemory();
  36744. p->level--;
  36745. return NULL;
  36746. }
  36747. Py_ssize_t _children_capacity = 1;
  36748. Py_ssize_t _n = 0;
  36749. { // lambda_param_maybe_default
  36750. if (p->error_indicator) {
  36751. p->level--;
  36752. return NULL;
  36753. }
  36754. D(fprintf(stderr, "%*c> _loop1_197[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
  36755. NameDefaultPair* lambda_param_maybe_default_var;
  36756. while (
  36757. (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
  36758. )
  36759. {
  36760. _res = lambda_param_maybe_default_var;
  36761. if (_n == _children_capacity) {
  36762. _children_capacity *= 2;
  36763. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  36764. if (!_new_children) {
  36765. PyMem_Free(_children);
  36766. p->error_indicator = 1;
  36767. PyErr_NoMemory();
  36768. p->level--;
  36769. return NULL;
  36770. }
  36771. _children = _new_children;
  36772. }
  36773. _children[_n++] = _res;
  36774. _mark = p->mark;
  36775. }
  36776. p->mark = _mark;
  36777. D(fprintf(stderr, "%*c%s _loop1_197[%d-%d]: %s failed!\n", p->level, ' ',
  36778. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
  36779. }
  36780. if (_n == 0 || p->error_indicator) {
  36781. PyMem_Free(_children);
  36782. p->level--;
  36783. return NULL;
  36784. }
  36785. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  36786. if (!_seq) {
  36787. PyMem_Free(_children);
  36788. p->error_indicator = 1;
  36789. PyErr_NoMemory();
  36790. p->level--;
  36791. return NULL;
  36792. }
  36793. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  36794. PyMem_Free(_children);
  36795. p->level--;
  36796. return _seq;
  36797. }
  36798. // _loop1_198: lambda_param_with_default
  36799. static asdl_seq *
  36800. _loop1_198_rule(Parser *p)
  36801. {
  36802. if (p->level++ == MAXSTACK) {
  36803. _Pypegen_stack_overflow(p);
  36804. }
  36805. if (p->error_indicator) {
  36806. p->level--;
  36807. return NULL;
  36808. }
  36809. void *_res = NULL;
  36810. int _mark = p->mark;
  36811. void **_children = PyMem_Malloc(sizeof(void *));
  36812. if (!_children) {
  36813. p->error_indicator = 1;
  36814. PyErr_NoMemory();
  36815. p->level--;
  36816. return NULL;
  36817. }
  36818. Py_ssize_t _children_capacity = 1;
  36819. Py_ssize_t _n = 0;
  36820. { // lambda_param_with_default
  36821. if (p->error_indicator) {
  36822. p->level--;
  36823. return NULL;
  36824. }
  36825. D(fprintf(stderr, "%*c> _loop1_198[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
  36826. NameDefaultPair* lambda_param_with_default_var;
  36827. while (
  36828. (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
  36829. )
  36830. {
  36831. _res = lambda_param_with_default_var;
  36832. if (_n == _children_capacity) {
  36833. _children_capacity *= 2;
  36834. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  36835. if (!_new_children) {
  36836. PyMem_Free(_children);
  36837. p->error_indicator = 1;
  36838. PyErr_NoMemory();
  36839. p->level--;
  36840. return NULL;
  36841. }
  36842. _children = _new_children;
  36843. }
  36844. _children[_n++] = _res;
  36845. _mark = p->mark;
  36846. }
  36847. p->mark = _mark;
  36848. D(fprintf(stderr, "%*c%s _loop1_198[%d-%d]: %s failed!\n", p->level, ' ',
  36849. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
  36850. }
  36851. if (_n == 0 || p->error_indicator) {
  36852. PyMem_Free(_children);
  36853. p->level--;
  36854. return NULL;
  36855. }
  36856. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  36857. if (!_seq) {
  36858. PyMem_Free(_children);
  36859. p->error_indicator = 1;
  36860. PyErr_NoMemory();
  36861. p->level--;
  36862. return NULL;
  36863. }
  36864. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  36865. PyMem_Free(_children);
  36866. p->level--;
  36867. return _seq;
  36868. }
  36869. // _tmp_199: ':' | ',' (':' | '**')
  36870. static void *
  36871. _tmp_199_rule(Parser *p)
  36872. {
  36873. if (p->level++ == MAXSTACK) {
  36874. _Pypegen_stack_overflow(p);
  36875. }
  36876. if (p->error_indicator) {
  36877. p->level--;
  36878. return NULL;
  36879. }
  36880. void * _res = NULL;
  36881. int _mark = p->mark;
  36882. { // ':'
  36883. if (p->error_indicator) {
  36884. p->level--;
  36885. return NULL;
  36886. }
  36887. D(fprintf(stderr, "%*c> _tmp_199[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
  36888. Token * _literal;
  36889. if (
  36890. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  36891. )
  36892. {
  36893. D(fprintf(stderr, "%*c+ _tmp_199[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
  36894. _res = _literal;
  36895. goto done;
  36896. }
  36897. p->mark = _mark;
  36898. D(fprintf(stderr, "%*c%s _tmp_199[%d-%d]: %s failed!\n", p->level, ' ',
  36899. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
  36900. }
  36901. { // ',' (':' | '**')
  36902. if (p->error_indicator) {
  36903. p->level--;
  36904. return NULL;
  36905. }
  36906. D(fprintf(stderr, "%*c> _tmp_199[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
  36907. Token * _literal;
  36908. void *_tmp_270_var;
  36909. if (
  36910. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  36911. &&
  36912. (_tmp_270_var = _tmp_270_rule(p)) // ':' | '**'
  36913. )
  36914. {
  36915. D(fprintf(stderr, "%*c+ _tmp_199[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
  36916. _res = _PyPegen_dummy_name(p, _literal, _tmp_270_var);
  36917. goto done;
  36918. }
  36919. p->mark = _mark;
  36920. D(fprintf(stderr, "%*c%s _tmp_199[%d-%d]: %s failed!\n", p->level, ' ',
  36921. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')"));
  36922. }
  36923. _res = NULL;
  36924. done:
  36925. p->level--;
  36926. return _res;
  36927. }
  36928. // _tmp_200: lambda_param_no_default | ','
  36929. static void *
  36930. _tmp_200_rule(Parser *p)
  36931. {
  36932. if (p->level++ == MAXSTACK) {
  36933. _Pypegen_stack_overflow(p);
  36934. }
  36935. if (p->error_indicator) {
  36936. p->level--;
  36937. return NULL;
  36938. }
  36939. void * _res = NULL;
  36940. int _mark = p->mark;
  36941. { // lambda_param_no_default
  36942. if (p->error_indicator) {
  36943. p->level--;
  36944. return NULL;
  36945. }
  36946. D(fprintf(stderr, "%*c> _tmp_200[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
  36947. arg_ty lambda_param_no_default_var;
  36948. if (
  36949. (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
  36950. )
  36951. {
  36952. D(fprintf(stderr, "%*c+ _tmp_200[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
  36953. _res = lambda_param_no_default_var;
  36954. goto done;
  36955. }
  36956. p->mark = _mark;
  36957. D(fprintf(stderr, "%*c%s _tmp_200[%d-%d]: %s failed!\n", p->level, ' ',
  36958. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
  36959. }
  36960. { // ','
  36961. if (p->error_indicator) {
  36962. p->level--;
  36963. return NULL;
  36964. }
  36965. D(fprintf(stderr, "%*c> _tmp_200[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
  36966. Token * _literal;
  36967. if (
  36968. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  36969. )
  36970. {
  36971. D(fprintf(stderr, "%*c+ _tmp_200[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
  36972. _res = _literal;
  36973. goto done;
  36974. }
  36975. p->mark = _mark;
  36976. D(fprintf(stderr, "%*c%s _tmp_200[%d-%d]: %s failed!\n", p->level, ' ',
  36977. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
  36978. }
  36979. _res = NULL;
  36980. done:
  36981. p->level--;
  36982. return _res;
  36983. }
  36984. // _loop0_201: lambda_param_maybe_default
  36985. static asdl_seq *
  36986. _loop0_201_rule(Parser *p)
  36987. {
  36988. if (p->level++ == MAXSTACK) {
  36989. _Pypegen_stack_overflow(p);
  36990. }
  36991. if (p->error_indicator) {
  36992. p->level--;
  36993. return NULL;
  36994. }
  36995. void *_res = NULL;
  36996. int _mark = p->mark;
  36997. void **_children = PyMem_Malloc(sizeof(void *));
  36998. if (!_children) {
  36999. p->error_indicator = 1;
  37000. PyErr_NoMemory();
  37001. p->level--;
  37002. return NULL;
  37003. }
  37004. Py_ssize_t _children_capacity = 1;
  37005. Py_ssize_t _n = 0;
  37006. { // lambda_param_maybe_default
  37007. if (p->error_indicator) {
  37008. p->level--;
  37009. return NULL;
  37010. }
  37011. D(fprintf(stderr, "%*c> _loop0_201[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
  37012. NameDefaultPair* lambda_param_maybe_default_var;
  37013. while (
  37014. (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
  37015. )
  37016. {
  37017. _res = lambda_param_maybe_default_var;
  37018. if (_n == _children_capacity) {
  37019. _children_capacity *= 2;
  37020. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  37021. if (!_new_children) {
  37022. PyMem_Free(_children);
  37023. p->error_indicator = 1;
  37024. PyErr_NoMemory();
  37025. p->level--;
  37026. return NULL;
  37027. }
  37028. _children = _new_children;
  37029. }
  37030. _children[_n++] = _res;
  37031. _mark = p->mark;
  37032. }
  37033. p->mark = _mark;
  37034. D(fprintf(stderr, "%*c%s _loop0_201[%d-%d]: %s failed!\n", p->level, ' ',
  37035. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
  37036. }
  37037. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  37038. if (!_seq) {
  37039. PyMem_Free(_children);
  37040. p->error_indicator = 1;
  37041. PyErr_NoMemory();
  37042. p->level--;
  37043. return NULL;
  37044. }
  37045. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  37046. PyMem_Free(_children);
  37047. p->level--;
  37048. return _seq;
  37049. }
  37050. // _tmp_202: lambda_param_no_default | ','
  37051. static void *
  37052. _tmp_202_rule(Parser *p)
  37053. {
  37054. if (p->level++ == MAXSTACK) {
  37055. _Pypegen_stack_overflow(p);
  37056. }
  37057. if (p->error_indicator) {
  37058. p->level--;
  37059. return NULL;
  37060. }
  37061. void * _res = NULL;
  37062. int _mark = p->mark;
  37063. { // lambda_param_no_default
  37064. if (p->error_indicator) {
  37065. p->level--;
  37066. return NULL;
  37067. }
  37068. D(fprintf(stderr, "%*c> _tmp_202[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
  37069. arg_ty lambda_param_no_default_var;
  37070. if (
  37071. (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
  37072. )
  37073. {
  37074. D(fprintf(stderr, "%*c+ _tmp_202[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
  37075. _res = lambda_param_no_default_var;
  37076. goto done;
  37077. }
  37078. p->mark = _mark;
  37079. D(fprintf(stderr, "%*c%s _tmp_202[%d-%d]: %s failed!\n", p->level, ' ',
  37080. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
  37081. }
  37082. { // ','
  37083. if (p->error_indicator) {
  37084. p->level--;
  37085. return NULL;
  37086. }
  37087. D(fprintf(stderr, "%*c> _tmp_202[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
  37088. Token * _literal;
  37089. if (
  37090. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  37091. )
  37092. {
  37093. D(fprintf(stderr, "%*c+ _tmp_202[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
  37094. _res = _literal;
  37095. goto done;
  37096. }
  37097. p->mark = _mark;
  37098. D(fprintf(stderr, "%*c%s _tmp_202[%d-%d]: %s failed!\n", p->level, ' ',
  37099. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
  37100. }
  37101. _res = NULL;
  37102. done:
  37103. p->level--;
  37104. return _res;
  37105. }
  37106. // _tmp_203: '*' | '**' | '/'
  37107. static void *
  37108. _tmp_203_rule(Parser *p)
  37109. {
  37110. if (p->level++ == MAXSTACK) {
  37111. _Pypegen_stack_overflow(p);
  37112. }
  37113. if (p->error_indicator) {
  37114. p->level--;
  37115. return NULL;
  37116. }
  37117. void * _res = NULL;
  37118. int _mark = p->mark;
  37119. { // '*'
  37120. if (p->error_indicator) {
  37121. p->level--;
  37122. return NULL;
  37123. }
  37124. D(fprintf(stderr, "%*c> _tmp_203[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'"));
  37125. Token * _literal;
  37126. if (
  37127. (_literal = _PyPegen_expect_token(p, 16)) // token='*'
  37128. )
  37129. {
  37130. D(fprintf(stderr, "%*c+ _tmp_203[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
  37131. _res = _literal;
  37132. goto done;
  37133. }
  37134. p->mark = _mark;
  37135. D(fprintf(stderr, "%*c%s _tmp_203[%d-%d]: %s failed!\n", p->level, ' ',
  37136. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'"));
  37137. }
  37138. { // '**'
  37139. if (p->error_indicator) {
  37140. p->level--;
  37141. return NULL;
  37142. }
  37143. D(fprintf(stderr, "%*c> _tmp_203[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
  37144. Token * _literal;
  37145. if (
  37146. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  37147. )
  37148. {
  37149. D(fprintf(stderr, "%*c+ _tmp_203[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
  37150. _res = _literal;
  37151. goto done;
  37152. }
  37153. p->mark = _mark;
  37154. D(fprintf(stderr, "%*c%s _tmp_203[%d-%d]: %s failed!\n", p->level, ' ',
  37155. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
  37156. }
  37157. { // '/'
  37158. if (p->error_indicator) {
  37159. p->level--;
  37160. return NULL;
  37161. }
  37162. D(fprintf(stderr, "%*c> _tmp_203[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/'"));
  37163. Token * _literal;
  37164. if (
  37165. (_literal = _PyPegen_expect_token(p, 17)) // token='/'
  37166. )
  37167. {
  37168. D(fprintf(stderr, "%*c+ _tmp_203[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/'"));
  37169. _res = _literal;
  37170. goto done;
  37171. }
  37172. p->mark = _mark;
  37173. D(fprintf(stderr, "%*c%s _tmp_203[%d-%d]: %s failed!\n", p->level, ' ',
  37174. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/'"));
  37175. }
  37176. _res = NULL;
  37177. done:
  37178. p->level--;
  37179. return _res;
  37180. }
  37181. // _tmp_204: ',' | ')' | ':'
  37182. static void *
  37183. _tmp_204_rule(Parser *p)
  37184. {
  37185. if (p->level++ == MAXSTACK) {
  37186. _Pypegen_stack_overflow(p);
  37187. }
  37188. if (p->error_indicator) {
  37189. p->level--;
  37190. return NULL;
  37191. }
  37192. void * _res = NULL;
  37193. int _mark = p->mark;
  37194. { // ','
  37195. if (p->error_indicator) {
  37196. p->level--;
  37197. return NULL;
  37198. }
  37199. D(fprintf(stderr, "%*c> _tmp_204[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
  37200. Token * _literal;
  37201. if (
  37202. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  37203. )
  37204. {
  37205. D(fprintf(stderr, "%*c+ _tmp_204[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
  37206. _res = _literal;
  37207. goto done;
  37208. }
  37209. p->mark = _mark;
  37210. D(fprintf(stderr, "%*c%s _tmp_204[%d-%d]: %s failed!\n", p->level, ' ',
  37211. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
  37212. }
  37213. { // ')'
  37214. if (p->error_indicator) {
  37215. p->level--;
  37216. return NULL;
  37217. }
  37218. D(fprintf(stderr, "%*c> _tmp_204[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
  37219. Token * _literal;
  37220. if (
  37221. (_literal = _PyPegen_expect_token(p, 8)) // token=')'
  37222. )
  37223. {
  37224. D(fprintf(stderr, "%*c+ _tmp_204[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
  37225. _res = _literal;
  37226. goto done;
  37227. }
  37228. p->mark = _mark;
  37229. D(fprintf(stderr, "%*c%s _tmp_204[%d-%d]: %s failed!\n", p->level, ' ',
  37230. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
  37231. }
  37232. { // ':'
  37233. if (p->error_indicator) {
  37234. p->level--;
  37235. return NULL;
  37236. }
  37237. D(fprintf(stderr, "%*c> _tmp_204[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
  37238. Token * _literal;
  37239. if (
  37240. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  37241. )
  37242. {
  37243. D(fprintf(stderr, "%*c+ _tmp_204[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
  37244. _res = _literal;
  37245. goto done;
  37246. }
  37247. p->mark = _mark;
  37248. D(fprintf(stderr, "%*c%s _tmp_204[%d-%d]: %s failed!\n", p->level, ' ',
  37249. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
  37250. }
  37251. _res = NULL;
  37252. done:
  37253. p->level--;
  37254. return _res;
  37255. }
  37256. // _loop0_206: ',' dotted_name
  37257. static asdl_seq *
  37258. _loop0_206_rule(Parser *p)
  37259. {
  37260. if (p->level++ == MAXSTACK) {
  37261. _Pypegen_stack_overflow(p);
  37262. }
  37263. if (p->error_indicator) {
  37264. p->level--;
  37265. return NULL;
  37266. }
  37267. void *_res = NULL;
  37268. int _mark = p->mark;
  37269. void **_children = PyMem_Malloc(sizeof(void *));
  37270. if (!_children) {
  37271. p->error_indicator = 1;
  37272. PyErr_NoMemory();
  37273. p->level--;
  37274. return NULL;
  37275. }
  37276. Py_ssize_t _children_capacity = 1;
  37277. Py_ssize_t _n = 0;
  37278. { // ',' dotted_name
  37279. if (p->error_indicator) {
  37280. p->level--;
  37281. return NULL;
  37282. }
  37283. D(fprintf(stderr, "%*c> _loop0_206[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' dotted_name"));
  37284. Token * _literal;
  37285. expr_ty elem;
  37286. while (
  37287. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  37288. &&
  37289. (elem = dotted_name_rule(p)) // dotted_name
  37290. )
  37291. {
  37292. _res = elem;
  37293. if (_res == NULL && PyErr_Occurred()) {
  37294. p->error_indicator = 1;
  37295. PyMem_Free(_children);
  37296. p->level--;
  37297. return NULL;
  37298. }
  37299. if (_n == _children_capacity) {
  37300. _children_capacity *= 2;
  37301. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  37302. if (!_new_children) {
  37303. PyMem_Free(_children);
  37304. p->error_indicator = 1;
  37305. PyErr_NoMemory();
  37306. p->level--;
  37307. return NULL;
  37308. }
  37309. _children = _new_children;
  37310. }
  37311. _children[_n++] = _res;
  37312. _mark = p->mark;
  37313. }
  37314. p->mark = _mark;
  37315. D(fprintf(stderr, "%*c%s _loop0_206[%d-%d]: %s failed!\n", p->level, ' ',
  37316. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_name"));
  37317. }
  37318. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  37319. if (!_seq) {
  37320. PyMem_Free(_children);
  37321. p->error_indicator = 1;
  37322. PyErr_NoMemory();
  37323. p->level--;
  37324. return NULL;
  37325. }
  37326. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  37327. PyMem_Free(_children);
  37328. p->level--;
  37329. return _seq;
  37330. }
  37331. // _gather_205: dotted_name _loop0_206
  37332. static asdl_seq *
  37333. _gather_205_rule(Parser *p)
  37334. {
  37335. if (p->level++ == MAXSTACK) {
  37336. _Pypegen_stack_overflow(p);
  37337. }
  37338. if (p->error_indicator) {
  37339. p->level--;
  37340. return NULL;
  37341. }
  37342. asdl_seq * _res = NULL;
  37343. int _mark = p->mark;
  37344. { // dotted_name _loop0_206
  37345. if (p->error_indicator) {
  37346. p->level--;
  37347. return NULL;
  37348. }
  37349. D(fprintf(stderr, "%*c> _gather_205[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name _loop0_206"));
  37350. expr_ty elem;
  37351. asdl_seq * seq;
  37352. if (
  37353. (elem = dotted_name_rule(p)) // dotted_name
  37354. &&
  37355. (seq = _loop0_206_rule(p)) // _loop0_206
  37356. )
  37357. {
  37358. D(fprintf(stderr, "%*c+ _gather_205[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name _loop0_206"));
  37359. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  37360. goto done;
  37361. }
  37362. p->mark = _mark;
  37363. D(fprintf(stderr, "%*c%s _gather_205[%d-%d]: %s failed!\n", p->level, ' ',
  37364. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name _loop0_206"));
  37365. }
  37366. _res = NULL;
  37367. done:
  37368. p->level--;
  37369. return _res;
  37370. }
  37371. // _loop0_208: ',' (expression ['as' star_target])
  37372. static asdl_seq *
  37373. _loop0_208_rule(Parser *p)
  37374. {
  37375. if (p->level++ == MAXSTACK) {
  37376. _Pypegen_stack_overflow(p);
  37377. }
  37378. if (p->error_indicator) {
  37379. p->level--;
  37380. return NULL;
  37381. }
  37382. void *_res = NULL;
  37383. int _mark = p->mark;
  37384. void **_children = PyMem_Malloc(sizeof(void *));
  37385. if (!_children) {
  37386. p->error_indicator = 1;
  37387. PyErr_NoMemory();
  37388. p->level--;
  37389. return NULL;
  37390. }
  37391. Py_ssize_t _children_capacity = 1;
  37392. Py_ssize_t _n = 0;
  37393. { // ',' (expression ['as' star_target])
  37394. if (p->error_indicator) {
  37395. p->level--;
  37396. return NULL;
  37397. }
  37398. D(fprintf(stderr, "%*c> _loop0_208[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expression ['as' star_target])"));
  37399. Token * _literal;
  37400. void *elem;
  37401. while (
  37402. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  37403. &&
  37404. (elem = _tmp_271_rule(p)) // expression ['as' star_target]
  37405. )
  37406. {
  37407. _res = elem;
  37408. if (_res == NULL && PyErr_Occurred()) {
  37409. p->error_indicator = 1;
  37410. PyMem_Free(_children);
  37411. p->level--;
  37412. return NULL;
  37413. }
  37414. if (_n == _children_capacity) {
  37415. _children_capacity *= 2;
  37416. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  37417. if (!_new_children) {
  37418. PyMem_Free(_children);
  37419. p->error_indicator = 1;
  37420. PyErr_NoMemory();
  37421. p->level--;
  37422. return NULL;
  37423. }
  37424. _children = _new_children;
  37425. }
  37426. _children[_n++] = _res;
  37427. _mark = p->mark;
  37428. }
  37429. p->mark = _mark;
  37430. D(fprintf(stderr, "%*c%s _loop0_208[%d-%d]: %s failed!\n", p->level, ' ',
  37431. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expression ['as' star_target])"));
  37432. }
  37433. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  37434. if (!_seq) {
  37435. PyMem_Free(_children);
  37436. p->error_indicator = 1;
  37437. PyErr_NoMemory();
  37438. p->level--;
  37439. return NULL;
  37440. }
  37441. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  37442. PyMem_Free(_children);
  37443. p->level--;
  37444. return _seq;
  37445. }
  37446. // _gather_207: (expression ['as' star_target]) _loop0_208
  37447. static asdl_seq *
  37448. _gather_207_rule(Parser *p)
  37449. {
  37450. if (p->level++ == MAXSTACK) {
  37451. _Pypegen_stack_overflow(p);
  37452. }
  37453. if (p->error_indicator) {
  37454. p->level--;
  37455. return NULL;
  37456. }
  37457. asdl_seq * _res = NULL;
  37458. int _mark = p->mark;
  37459. { // (expression ['as' star_target]) _loop0_208
  37460. if (p->error_indicator) {
  37461. p->level--;
  37462. return NULL;
  37463. }
  37464. D(fprintf(stderr, "%*c> _gather_207[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_208"));
  37465. void *elem;
  37466. asdl_seq * seq;
  37467. if (
  37468. (elem = _tmp_271_rule(p)) // expression ['as' star_target]
  37469. &&
  37470. (seq = _loop0_208_rule(p)) // _loop0_208
  37471. )
  37472. {
  37473. D(fprintf(stderr, "%*c+ _gather_207[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_208"));
  37474. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  37475. goto done;
  37476. }
  37477. p->mark = _mark;
  37478. D(fprintf(stderr, "%*c%s _gather_207[%d-%d]: %s failed!\n", p->level, ' ',
  37479. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expression ['as' star_target]) _loop0_208"));
  37480. }
  37481. _res = NULL;
  37482. done:
  37483. p->level--;
  37484. return _res;
  37485. }
  37486. // _loop0_210: ',' (expressions ['as' star_target])
  37487. static asdl_seq *
  37488. _loop0_210_rule(Parser *p)
  37489. {
  37490. if (p->level++ == MAXSTACK) {
  37491. _Pypegen_stack_overflow(p);
  37492. }
  37493. if (p->error_indicator) {
  37494. p->level--;
  37495. return NULL;
  37496. }
  37497. void *_res = NULL;
  37498. int _mark = p->mark;
  37499. void **_children = PyMem_Malloc(sizeof(void *));
  37500. if (!_children) {
  37501. p->error_indicator = 1;
  37502. PyErr_NoMemory();
  37503. p->level--;
  37504. return NULL;
  37505. }
  37506. Py_ssize_t _children_capacity = 1;
  37507. Py_ssize_t _n = 0;
  37508. { // ',' (expressions ['as' star_target])
  37509. if (p->error_indicator) {
  37510. p->level--;
  37511. return NULL;
  37512. }
  37513. D(fprintf(stderr, "%*c> _loop0_210[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expressions ['as' star_target])"));
  37514. Token * _literal;
  37515. void *elem;
  37516. while (
  37517. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  37518. &&
  37519. (elem = _tmp_272_rule(p)) // expressions ['as' star_target]
  37520. )
  37521. {
  37522. _res = elem;
  37523. if (_res == NULL && PyErr_Occurred()) {
  37524. p->error_indicator = 1;
  37525. PyMem_Free(_children);
  37526. p->level--;
  37527. return NULL;
  37528. }
  37529. if (_n == _children_capacity) {
  37530. _children_capacity *= 2;
  37531. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  37532. if (!_new_children) {
  37533. PyMem_Free(_children);
  37534. p->error_indicator = 1;
  37535. PyErr_NoMemory();
  37536. p->level--;
  37537. return NULL;
  37538. }
  37539. _children = _new_children;
  37540. }
  37541. _children[_n++] = _res;
  37542. _mark = p->mark;
  37543. }
  37544. p->mark = _mark;
  37545. D(fprintf(stderr, "%*c%s _loop0_210[%d-%d]: %s failed!\n", p->level, ' ',
  37546. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expressions ['as' star_target])"));
  37547. }
  37548. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  37549. if (!_seq) {
  37550. PyMem_Free(_children);
  37551. p->error_indicator = 1;
  37552. PyErr_NoMemory();
  37553. p->level--;
  37554. return NULL;
  37555. }
  37556. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  37557. PyMem_Free(_children);
  37558. p->level--;
  37559. return _seq;
  37560. }
  37561. // _gather_209: (expressions ['as' star_target]) _loop0_210
  37562. static asdl_seq *
  37563. _gather_209_rule(Parser *p)
  37564. {
  37565. if (p->level++ == MAXSTACK) {
  37566. _Pypegen_stack_overflow(p);
  37567. }
  37568. if (p->error_indicator) {
  37569. p->level--;
  37570. return NULL;
  37571. }
  37572. asdl_seq * _res = NULL;
  37573. int _mark = p->mark;
  37574. { // (expressions ['as' star_target]) _loop0_210
  37575. if (p->error_indicator) {
  37576. p->level--;
  37577. return NULL;
  37578. }
  37579. D(fprintf(stderr, "%*c> _gather_209[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_210"));
  37580. void *elem;
  37581. asdl_seq * seq;
  37582. if (
  37583. (elem = _tmp_272_rule(p)) // expressions ['as' star_target]
  37584. &&
  37585. (seq = _loop0_210_rule(p)) // _loop0_210
  37586. )
  37587. {
  37588. D(fprintf(stderr, "%*c+ _gather_209[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_210"));
  37589. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  37590. goto done;
  37591. }
  37592. p->mark = _mark;
  37593. D(fprintf(stderr, "%*c%s _gather_209[%d-%d]: %s failed!\n", p->level, ' ',
  37594. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expressions ['as' star_target]) _loop0_210"));
  37595. }
  37596. _res = NULL;
  37597. done:
  37598. p->level--;
  37599. return _res;
  37600. }
  37601. // _loop0_212: ',' (expression ['as' star_target])
  37602. static asdl_seq *
  37603. _loop0_212_rule(Parser *p)
  37604. {
  37605. if (p->level++ == MAXSTACK) {
  37606. _Pypegen_stack_overflow(p);
  37607. }
  37608. if (p->error_indicator) {
  37609. p->level--;
  37610. return NULL;
  37611. }
  37612. void *_res = NULL;
  37613. int _mark = p->mark;
  37614. void **_children = PyMem_Malloc(sizeof(void *));
  37615. if (!_children) {
  37616. p->error_indicator = 1;
  37617. PyErr_NoMemory();
  37618. p->level--;
  37619. return NULL;
  37620. }
  37621. Py_ssize_t _children_capacity = 1;
  37622. Py_ssize_t _n = 0;
  37623. { // ',' (expression ['as' star_target])
  37624. if (p->error_indicator) {
  37625. p->level--;
  37626. return NULL;
  37627. }
  37628. D(fprintf(stderr, "%*c> _loop0_212[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expression ['as' star_target])"));
  37629. Token * _literal;
  37630. void *elem;
  37631. while (
  37632. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  37633. &&
  37634. (elem = _tmp_273_rule(p)) // expression ['as' star_target]
  37635. )
  37636. {
  37637. _res = elem;
  37638. if (_res == NULL && PyErr_Occurred()) {
  37639. p->error_indicator = 1;
  37640. PyMem_Free(_children);
  37641. p->level--;
  37642. return NULL;
  37643. }
  37644. if (_n == _children_capacity) {
  37645. _children_capacity *= 2;
  37646. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  37647. if (!_new_children) {
  37648. PyMem_Free(_children);
  37649. p->error_indicator = 1;
  37650. PyErr_NoMemory();
  37651. p->level--;
  37652. return NULL;
  37653. }
  37654. _children = _new_children;
  37655. }
  37656. _children[_n++] = _res;
  37657. _mark = p->mark;
  37658. }
  37659. p->mark = _mark;
  37660. D(fprintf(stderr, "%*c%s _loop0_212[%d-%d]: %s failed!\n", p->level, ' ',
  37661. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expression ['as' star_target])"));
  37662. }
  37663. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  37664. if (!_seq) {
  37665. PyMem_Free(_children);
  37666. p->error_indicator = 1;
  37667. PyErr_NoMemory();
  37668. p->level--;
  37669. return NULL;
  37670. }
  37671. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  37672. PyMem_Free(_children);
  37673. p->level--;
  37674. return _seq;
  37675. }
  37676. // _gather_211: (expression ['as' star_target]) _loop0_212
  37677. static asdl_seq *
  37678. _gather_211_rule(Parser *p)
  37679. {
  37680. if (p->level++ == MAXSTACK) {
  37681. _Pypegen_stack_overflow(p);
  37682. }
  37683. if (p->error_indicator) {
  37684. p->level--;
  37685. return NULL;
  37686. }
  37687. asdl_seq * _res = NULL;
  37688. int _mark = p->mark;
  37689. { // (expression ['as' star_target]) _loop0_212
  37690. if (p->error_indicator) {
  37691. p->level--;
  37692. return NULL;
  37693. }
  37694. D(fprintf(stderr, "%*c> _gather_211[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_212"));
  37695. void *elem;
  37696. asdl_seq * seq;
  37697. if (
  37698. (elem = _tmp_273_rule(p)) // expression ['as' star_target]
  37699. &&
  37700. (seq = _loop0_212_rule(p)) // _loop0_212
  37701. )
  37702. {
  37703. D(fprintf(stderr, "%*c+ _gather_211[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_212"));
  37704. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  37705. goto done;
  37706. }
  37707. p->mark = _mark;
  37708. D(fprintf(stderr, "%*c%s _gather_211[%d-%d]: %s failed!\n", p->level, ' ',
  37709. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expression ['as' star_target]) _loop0_212"));
  37710. }
  37711. _res = NULL;
  37712. done:
  37713. p->level--;
  37714. return _res;
  37715. }
  37716. // _loop0_214: ',' (expressions ['as' star_target])
  37717. static asdl_seq *
  37718. _loop0_214_rule(Parser *p)
  37719. {
  37720. if (p->level++ == MAXSTACK) {
  37721. _Pypegen_stack_overflow(p);
  37722. }
  37723. if (p->error_indicator) {
  37724. p->level--;
  37725. return NULL;
  37726. }
  37727. void *_res = NULL;
  37728. int _mark = p->mark;
  37729. void **_children = PyMem_Malloc(sizeof(void *));
  37730. if (!_children) {
  37731. p->error_indicator = 1;
  37732. PyErr_NoMemory();
  37733. p->level--;
  37734. return NULL;
  37735. }
  37736. Py_ssize_t _children_capacity = 1;
  37737. Py_ssize_t _n = 0;
  37738. { // ',' (expressions ['as' star_target])
  37739. if (p->error_indicator) {
  37740. p->level--;
  37741. return NULL;
  37742. }
  37743. D(fprintf(stderr, "%*c> _loop0_214[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expressions ['as' star_target])"));
  37744. Token * _literal;
  37745. void *elem;
  37746. while (
  37747. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  37748. &&
  37749. (elem = _tmp_274_rule(p)) // expressions ['as' star_target]
  37750. )
  37751. {
  37752. _res = elem;
  37753. if (_res == NULL && PyErr_Occurred()) {
  37754. p->error_indicator = 1;
  37755. PyMem_Free(_children);
  37756. p->level--;
  37757. return NULL;
  37758. }
  37759. if (_n == _children_capacity) {
  37760. _children_capacity *= 2;
  37761. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  37762. if (!_new_children) {
  37763. PyMem_Free(_children);
  37764. p->error_indicator = 1;
  37765. PyErr_NoMemory();
  37766. p->level--;
  37767. return NULL;
  37768. }
  37769. _children = _new_children;
  37770. }
  37771. _children[_n++] = _res;
  37772. _mark = p->mark;
  37773. }
  37774. p->mark = _mark;
  37775. D(fprintf(stderr, "%*c%s _loop0_214[%d-%d]: %s failed!\n", p->level, ' ',
  37776. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expressions ['as' star_target])"));
  37777. }
  37778. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  37779. if (!_seq) {
  37780. PyMem_Free(_children);
  37781. p->error_indicator = 1;
  37782. PyErr_NoMemory();
  37783. p->level--;
  37784. return NULL;
  37785. }
  37786. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  37787. PyMem_Free(_children);
  37788. p->level--;
  37789. return _seq;
  37790. }
  37791. // _gather_213: (expressions ['as' star_target]) _loop0_214
  37792. static asdl_seq *
  37793. _gather_213_rule(Parser *p)
  37794. {
  37795. if (p->level++ == MAXSTACK) {
  37796. _Pypegen_stack_overflow(p);
  37797. }
  37798. if (p->error_indicator) {
  37799. p->level--;
  37800. return NULL;
  37801. }
  37802. asdl_seq * _res = NULL;
  37803. int _mark = p->mark;
  37804. { // (expressions ['as' star_target]) _loop0_214
  37805. if (p->error_indicator) {
  37806. p->level--;
  37807. return NULL;
  37808. }
  37809. D(fprintf(stderr, "%*c> _gather_213[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_214"));
  37810. void *elem;
  37811. asdl_seq * seq;
  37812. if (
  37813. (elem = _tmp_274_rule(p)) // expressions ['as' star_target]
  37814. &&
  37815. (seq = _loop0_214_rule(p)) // _loop0_214
  37816. )
  37817. {
  37818. D(fprintf(stderr, "%*c+ _gather_213[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_214"));
  37819. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  37820. goto done;
  37821. }
  37822. p->mark = _mark;
  37823. D(fprintf(stderr, "%*c%s _gather_213[%d-%d]: %s failed!\n", p->level, ' ',
  37824. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expressions ['as' star_target]) _loop0_214"));
  37825. }
  37826. _res = NULL;
  37827. done:
  37828. p->level--;
  37829. return _res;
  37830. }
  37831. // _tmp_215: 'except' | 'finally'
  37832. static void *
  37833. _tmp_215_rule(Parser *p)
  37834. {
  37835. if (p->level++ == MAXSTACK) {
  37836. _Pypegen_stack_overflow(p);
  37837. }
  37838. if (p->error_indicator) {
  37839. p->level--;
  37840. return NULL;
  37841. }
  37842. void * _res = NULL;
  37843. int _mark = p->mark;
  37844. { // 'except'
  37845. if (p->error_indicator) {
  37846. p->level--;
  37847. return NULL;
  37848. }
  37849. D(fprintf(stderr, "%*c> _tmp_215[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except'"));
  37850. Token * _keyword;
  37851. if (
  37852. (_keyword = _PyPegen_expect_token(p, 637)) // token='except'
  37853. )
  37854. {
  37855. D(fprintf(stderr, "%*c+ _tmp_215[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except'"));
  37856. _res = _keyword;
  37857. goto done;
  37858. }
  37859. p->mark = _mark;
  37860. D(fprintf(stderr, "%*c%s _tmp_215[%d-%d]: %s failed!\n", p->level, ' ',
  37861. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except'"));
  37862. }
  37863. { // 'finally'
  37864. if (p->error_indicator) {
  37865. p->level--;
  37866. return NULL;
  37867. }
  37868. D(fprintf(stderr, "%*c> _tmp_215[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally'"));
  37869. Token * _keyword;
  37870. if (
  37871. (_keyword = _PyPegen_expect_token(p, 633)) // token='finally'
  37872. )
  37873. {
  37874. D(fprintf(stderr, "%*c+ _tmp_215[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally'"));
  37875. _res = _keyword;
  37876. goto done;
  37877. }
  37878. p->mark = _mark;
  37879. D(fprintf(stderr, "%*c%s _tmp_215[%d-%d]: %s failed!\n", p->level, ' ',
  37880. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally'"));
  37881. }
  37882. _res = NULL;
  37883. done:
  37884. p->level--;
  37885. return _res;
  37886. }
  37887. // _loop0_216: block
  37888. static asdl_seq *
  37889. _loop0_216_rule(Parser *p)
  37890. {
  37891. if (p->level++ == MAXSTACK) {
  37892. _Pypegen_stack_overflow(p);
  37893. }
  37894. if (p->error_indicator) {
  37895. p->level--;
  37896. return NULL;
  37897. }
  37898. void *_res = NULL;
  37899. int _mark = p->mark;
  37900. void **_children = PyMem_Malloc(sizeof(void *));
  37901. if (!_children) {
  37902. p->error_indicator = 1;
  37903. PyErr_NoMemory();
  37904. p->level--;
  37905. return NULL;
  37906. }
  37907. Py_ssize_t _children_capacity = 1;
  37908. Py_ssize_t _n = 0;
  37909. { // block
  37910. if (p->error_indicator) {
  37911. p->level--;
  37912. return NULL;
  37913. }
  37914. D(fprintf(stderr, "%*c> _loop0_216[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "block"));
  37915. asdl_stmt_seq* block_var;
  37916. while (
  37917. (block_var = block_rule(p)) // block
  37918. )
  37919. {
  37920. _res = block_var;
  37921. if (_n == _children_capacity) {
  37922. _children_capacity *= 2;
  37923. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  37924. if (!_new_children) {
  37925. PyMem_Free(_children);
  37926. p->error_indicator = 1;
  37927. PyErr_NoMemory();
  37928. p->level--;
  37929. return NULL;
  37930. }
  37931. _children = _new_children;
  37932. }
  37933. _children[_n++] = _res;
  37934. _mark = p->mark;
  37935. }
  37936. p->mark = _mark;
  37937. D(fprintf(stderr, "%*c%s _loop0_216[%d-%d]: %s failed!\n", p->level, ' ',
  37938. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "block"));
  37939. }
  37940. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  37941. if (!_seq) {
  37942. PyMem_Free(_children);
  37943. p->error_indicator = 1;
  37944. PyErr_NoMemory();
  37945. p->level--;
  37946. return NULL;
  37947. }
  37948. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  37949. PyMem_Free(_children);
  37950. p->level--;
  37951. return _seq;
  37952. }
  37953. // _loop1_217: except_block
  37954. static asdl_seq *
  37955. _loop1_217_rule(Parser *p)
  37956. {
  37957. if (p->level++ == MAXSTACK) {
  37958. _Pypegen_stack_overflow(p);
  37959. }
  37960. if (p->error_indicator) {
  37961. p->level--;
  37962. return NULL;
  37963. }
  37964. void *_res = NULL;
  37965. int _mark = p->mark;
  37966. void **_children = PyMem_Malloc(sizeof(void *));
  37967. if (!_children) {
  37968. p->error_indicator = 1;
  37969. PyErr_NoMemory();
  37970. p->level--;
  37971. return NULL;
  37972. }
  37973. Py_ssize_t _children_capacity = 1;
  37974. Py_ssize_t _n = 0;
  37975. { // except_block
  37976. if (p->error_indicator) {
  37977. p->level--;
  37978. return NULL;
  37979. }
  37980. D(fprintf(stderr, "%*c> _loop1_217[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block"));
  37981. excepthandler_ty except_block_var;
  37982. while (
  37983. (except_block_var = except_block_rule(p)) // except_block
  37984. )
  37985. {
  37986. _res = except_block_var;
  37987. if (_n == _children_capacity) {
  37988. _children_capacity *= 2;
  37989. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  37990. if (!_new_children) {
  37991. PyMem_Free(_children);
  37992. p->error_indicator = 1;
  37993. PyErr_NoMemory();
  37994. p->level--;
  37995. return NULL;
  37996. }
  37997. _children = _new_children;
  37998. }
  37999. _children[_n++] = _res;
  38000. _mark = p->mark;
  38001. }
  38002. p->mark = _mark;
  38003. D(fprintf(stderr, "%*c%s _loop1_217[%d-%d]: %s failed!\n", p->level, ' ',
  38004. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block"));
  38005. }
  38006. if (_n == 0 || p->error_indicator) {
  38007. PyMem_Free(_children);
  38008. p->level--;
  38009. return NULL;
  38010. }
  38011. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  38012. if (!_seq) {
  38013. PyMem_Free(_children);
  38014. p->error_indicator = 1;
  38015. PyErr_NoMemory();
  38016. p->level--;
  38017. return NULL;
  38018. }
  38019. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  38020. PyMem_Free(_children);
  38021. p->level--;
  38022. return _seq;
  38023. }
  38024. // _tmp_218: 'as' NAME
  38025. static void *
  38026. _tmp_218_rule(Parser *p)
  38027. {
  38028. if (p->level++ == MAXSTACK) {
  38029. _Pypegen_stack_overflow(p);
  38030. }
  38031. if (p->error_indicator) {
  38032. p->level--;
  38033. return NULL;
  38034. }
  38035. void * _res = NULL;
  38036. int _mark = p->mark;
  38037. { // 'as' NAME
  38038. if (p->error_indicator) {
  38039. p->level--;
  38040. return NULL;
  38041. }
  38042. D(fprintf(stderr, "%*c> _tmp_218[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  38043. Token * _keyword;
  38044. expr_ty name_var;
  38045. if (
  38046. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  38047. &&
  38048. (name_var = _PyPegen_name_token(p)) // NAME
  38049. )
  38050. {
  38051. D(fprintf(stderr, "%*c+ _tmp_218[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  38052. _res = _PyPegen_dummy_name(p, _keyword, name_var);
  38053. goto done;
  38054. }
  38055. p->mark = _mark;
  38056. D(fprintf(stderr, "%*c%s _tmp_218[%d-%d]: %s failed!\n", p->level, ' ',
  38057. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
  38058. }
  38059. _res = NULL;
  38060. done:
  38061. p->level--;
  38062. return _res;
  38063. }
  38064. // _loop0_219: block
  38065. static asdl_seq *
  38066. _loop0_219_rule(Parser *p)
  38067. {
  38068. if (p->level++ == MAXSTACK) {
  38069. _Pypegen_stack_overflow(p);
  38070. }
  38071. if (p->error_indicator) {
  38072. p->level--;
  38073. return NULL;
  38074. }
  38075. void *_res = NULL;
  38076. int _mark = p->mark;
  38077. void **_children = PyMem_Malloc(sizeof(void *));
  38078. if (!_children) {
  38079. p->error_indicator = 1;
  38080. PyErr_NoMemory();
  38081. p->level--;
  38082. return NULL;
  38083. }
  38084. Py_ssize_t _children_capacity = 1;
  38085. Py_ssize_t _n = 0;
  38086. { // block
  38087. if (p->error_indicator) {
  38088. p->level--;
  38089. return NULL;
  38090. }
  38091. D(fprintf(stderr, "%*c> _loop0_219[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "block"));
  38092. asdl_stmt_seq* block_var;
  38093. while (
  38094. (block_var = block_rule(p)) // block
  38095. )
  38096. {
  38097. _res = block_var;
  38098. if (_n == _children_capacity) {
  38099. _children_capacity *= 2;
  38100. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  38101. if (!_new_children) {
  38102. PyMem_Free(_children);
  38103. p->error_indicator = 1;
  38104. PyErr_NoMemory();
  38105. p->level--;
  38106. return NULL;
  38107. }
  38108. _children = _new_children;
  38109. }
  38110. _children[_n++] = _res;
  38111. _mark = p->mark;
  38112. }
  38113. p->mark = _mark;
  38114. D(fprintf(stderr, "%*c%s _loop0_219[%d-%d]: %s failed!\n", p->level, ' ',
  38115. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "block"));
  38116. }
  38117. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  38118. if (!_seq) {
  38119. PyMem_Free(_children);
  38120. p->error_indicator = 1;
  38121. PyErr_NoMemory();
  38122. p->level--;
  38123. return NULL;
  38124. }
  38125. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  38126. PyMem_Free(_children);
  38127. p->level--;
  38128. return _seq;
  38129. }
  38130. // _loop1_220: except_star_block
  38131. static asdl_seq *
  38132. _loop1_220_rule(Parser *p)
  38133. {
  38134. if (p->level++ == MAXSTACK) {
  38135. _Pypegen_stack_overflow(p);
  38136. }
  38137. if (p->error_indicator) {
  38138. p->level--;
  38139. return NULL;
  38140. }
  38141. void *_res = NULL;
  38142. int _mark = p->mark;
  38143. void **_children = PyMem_Malloc(sizeof(void *));
  38144. if (!_children) {
  38145. p->error_indicator = 1;
  38146. PyErr_NoMemory();
  38147. p->level--;
  38148. return NULL;
  38149. }
  38150. Py_ssize_t _children_capacity = 1;
  38151. Py_ssize_t _n = 0;
  38152. { // except_star_block
  38153. if (p->error_indicator) {
  38154. p->level--;
  38155. return NULL;
  38156. }
  38157. D(fprintf(stderr, "%*c> _loop1_220[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_star_block"));
  38158. excepthandler_ty except_star_block_var;
  38159. while (
  38160. (except_star_block_var = except_star_block_rule(p)) // except_star_block
  38161. )
  38162. {
  38163. _res = except_star_block_var;
  38164. if (_n == _children_capacity) {
  38165. _children_capacity *= 2;
  38166. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  38167. if (!_new_children) {
  38168. PyMem_Free(_children);
  38169. p->error_indicator = 1;
  38170. PyErr_NoMemory();
  38171. p->level--;
  38172. return NULL;
  38173. }
  38174. _children = _new_children;
  38175. }
  38176. _children[_n++] = _res;
  38177. _mark = p->mark;
  38178. }
  38179. p->mark = _mark;
  38180. D(fprintf(stderr, "%*c%s _loop1_220[%d-%d]: %s failed!\n", p->level, ' ',
  38181. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_star_block"));
  38182. }
  38183. if (_n == 0 || p->error_indicator) {
  38184. PyMem_Free(_children);
  38185. p->level--;
  38186. return NULL;
  38187. }
  38188. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  38189. if (!_seq) {
  38190. PyMem_Free(_children);
  38191. p->error_indicator = 1;
  38192. PyErr_NoMemory();
  38193. p->level--;
  38194. return NULL;
  38195. }
  38196. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  38197. PyMem_Free(_children);
  38198. p->level--;
  38199. return _seq;
  38200. }
  38201. // _tmp_221: expression ['as' NAME]
  38202. static void *
  38203. _tmp_221_rule(Parser *p)
  38204. {
  38205. if (p->level++ == MAXSTACK) {
  38206. _Pypegen_stack_overflow(p);
  38207. }
  38208. if (p->error_indicator) {
  38209. p->level--;
  38210. return NULL;
  38211. }
  38212. void * _res = NULL;
  38213. int _mark = p->mark;
  38214. { // expression ['as' NAME]
  38215. if (p->error_indicator) {
  38216. p->level--;
  38217. return NULL;
  38218. }
  38219. D(fprintf(stderr, "%*c> _tmp_221[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' NAME]"));
  38220. void *_opt_var;
  38221. UNUSED(_opt_var); // Silence compiler warnings
  38222. expr_ty expression_var;
  38223. if (
  38224. (expression_var = expression_rule(p)) // expression
  38225. &&
  38226. (_opt_var = _tmp_275_rule(p), !p->error_indicator) // ['as' NAME]
  38227. )
  38228. {
  38229. D(fprintf(stderr, "%*c+ _tmp_221[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' NAME]"));
  38230. _res = _PyPegen_dummy_name(p, expression_var, _opt_var);
  38231. goto done;
  38232. }
  38233. p->mark = _mark;
  38234. D(fprintf(stderr, "%*c%s _tmp_221[%d-%d]: %s failed!\n", p->level, ' ',
  38235. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' NAME]"));
  38236. }
  38237. _res = NULL;
  38238. done:
  38239. p->level--;
  38240. return _res;
  38241. }
  38242. // _tmp_222: 'as' NAME
  38243. static void *
  38244. _tmp_222_rule(Parser *p)
  38245. {
  38246. if (p->level++ == MAXSTACK) {
  38247. _Pypegen_stack_overflow(p);
  38248. }
  38249. if (p->error_indicator) {
  38250. p->level--;
  38251. return NULL;
  38252. }
  38253. void * _res = NULL;
  38254. int _mark = p->mark;
  38255. { // 'as' NAME
  38256. if (p->error_indicator) {
  38257. p->level--;
  38258. return NULL;
  38259. }
  38260. D(fprintf(stderr, "%*c> _tmp_222[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  38261. Token * _keyword;
  38262. expr_ty name_var;
  38263. if (
  38264. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  38265. &&
  38266. (name_var = _PyPegen_name_token(p)) // NAME
  38267. )
  38268. {
  38269. D(fprintf(stderr, "%*c+ _tmp_222[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  38270. _res = _PyPegen_dummy_name(p, _keyword, name_var);
  38271. goto done;
  38272. }
  38273. p->mark = _mark;
  38274. D(fprintf(stderr, "%*c%s _tmp_222[%d-%d]: %s failed!\n", p->level, ' ',
  38275. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
  38276. }
  38277. _res = NULL;
  38278. done:
  38279. p->level--;
  38280. return _res;
  38281. }
  38282. // _tmp_223: 'as' NAME
  38283. static void *
  38284. _tmp_223_rule(Parser *p)
  38285. {
  38286. if (p->level++ == MAXSTACK) {
  38287. _Pypegen_stack_overflow(p);
  38288. }
  38289. if (p->error_indicator) {
  38290. p->level--;
  38291. return NULL;
  38292. }
  38293. void * _res = NULL;
  38294. int _mark = p->mark;
  38295. { // 'as' NAME
  38296. if (p->error_indicator) {
  38297. p->level--;
  38298. return NULL;
  38299. }
  38300. D(fprintf(stderr, "%*c> _tmp_223[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  38301. Token * _keyword;
  38302. expr_ty name_var;
  38303. if (
  38304. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  38305. &&
  38306. (name_var = _PyPegen_name_token(p)) // NAME
  38307. )
  38308. {
  38309. D(fprintf(stderr, "%*c+ _tmp_223[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  38310. _res = _PyPegen_dummy_name(p, _keyword, name_var);
  38311. goto done;
  38312. }
  38313. p->mark = _mark;
  38314. D(fprintf(stderr, "%*c%s _tmp_223[%d-%d]: %s failed!\n", p->level, ' ',
  38315. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
  38316. }
  38317. _res = NULL;
  38318. done:
  38319. p->level--;
  38320. return _res;
  38321. }
  38322. // _tmp_224: NEWLINE | ':'
  38323. static void *
  38324. _tmp_224_rule(Parser *p)
  38325. {
  38326. if (p->level++ == MAXSTACK) {
  38327. _Pypegen_stack_overflow(p);
  38328. }
  38329. if (p->error_indicator) {
  38330. p->level--;
  38331. return NULL;
  38332. }
  38333. void * _res = NULL;
  38334. int _mark = p->mark;
  38335. { // NEWLINE
  38336. if (p->error_indicator) {
  38337. p->level--;
  38338. return NULL;
  38339. }
  38340. D(fprintf(stderr, "%*c> _tmp_224[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
  38341. Token * newline_var;
  38342. if (
  38343. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  38344. )
  38345. {
  38346. D(fprintf(stderr, "%*c+ _tmp_224[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
  38347. _res = newline_var;
  38348. goto done;
  38349. }
  38350. p->mark = _mark;
  38351. D(fprintf(stderr, "%*c%s _tmp_224[%d-%d]: %s failed!\n", p->level, ' ',
  38352. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
  38353. }
  38354. { // ':'
  38355. if (p->error_indicator) {
  38356. p->level--;
  38357. return NULL;
  38358. }
  38359. D(fprintf(stderr, "%*c> _tmp_224[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
  38360. Token * _literal;
  38361. if (
  38362. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  38363. )
  38364. {
  38365. D(fprintf(stderr, "%*c+ _tmp_224[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
  38366. _res = _literal;
  38367. goto done;
  38368. }
  38369. p->mark = _mark;
  38370. D(fprintf(stderr, "%*c%s _tmp_224[%d-%d]: %s failed!\n", p->level, ' ',
  38371. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
  38372. }
  38373. _res = NULL;
  38374. done:
  38375. p->level--;
  38376. return _res;
  38377. }
  38378. // _tmp_225: 'as' NAME
  38379. static void *
  38380. _tmp_225_rule(Parser *p)
  38381. {
  38382. if (p->level++ == MAXSTACK) {
  38383. _Pypegen_stack_overflow(p);
  38384. }
  38385. if (p->error_indicator) {
  38386. p->level--;
  38387. return NULL;
  38388. }
  38389. void * _res = NULL;
  38390. int _mark = p->mark;
  38391. { // 'as' NAME
  38392. if (p->error_indicator) {
  38393. p->level--;
  38394. return NULL;
  38395. }
  38396. D(fprintf(stderr, "%*c> _tmp_225[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  38397. Token * _keyword;
  38398. expr_ty name_var;
  38399. if (
  38400. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  38401. &&
  38402. (name_var = _PyPegen_name_token(p)) // NAME
  38403. )
  38404. {
  38405. D(fprintf(stderr, "%*c+ _tmp_225[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  38406. _res = _PyPegen_dummy_name(p, _keyword, name_var);
  38407. goto done;
  38408. }
  38409. p->mark = _mark;
  38410. D(fprintf(stderr, "%*c%s _tmp_225[%d-%d]: %s failed!\n", p->level, ' ',
  38411. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
  38412. }
  38413. _res = NULL;
  38414. done:
  38415. p->level--;
  38416. return _res;
  38417. }
  38418. // _tmp_226: 'as' NAME
  38419. static void *
  38420. _tmp_226_rule(Parser *p)
  38421. {
  38422. if (p->level++ == MAXSTACK) {
  38423. _Pypegen_stack_overflow(p);
  38424. }
  38425. if (p->error_indicator) {
  38426. p->level--;
  38427. return NULL;
  38428. }
  38429. void * _res = NULL;
  38430. int _mark = p->mark;
  38431. { // 'as' NAME
  38432. if (p->error_indicator) {
  38433. p->level--;
  38434. return NULL;
  38435. }
  38436. D(fprintf(stderr, "%*c> _tmp_226[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  38437. Token * _keyword;
  38438. expr_ty name_var;
  38439. if (
  38440. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  38441. &&
  38442. (name_var = _PyPegen_name_token(p)) // NAME
  38443. )
  38444. {
  38445. D(fprintf(stderr, "%*c+ _tmp_226[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  38446. _res = _PyPegen_dummy_name(p, _keyword, name_var);
  38447. goto done;
  38448. }
  38449. p->mark = _mark;
  38450. D(fprintf(stderr, "%*c%s _tmp_226[%d-%d]: %s failed!\n", p->level, ' ',
  38451. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
  38452. }
  38453. _res = NULL;
  38454. done:
  38455. p->level--;
  38456. return _res;
  38457. }
  38458. // _tmp_227: positional_patterns ','
  38459. static void *
  38460. _tmp_227_rule(Parser *p)
  38461. {
  38462. if (p->level++ == MAXSTACK) {
  38463. _Pypegen_stack_overflow(p);
  38464. }
  38465. if (p->error_indicator) {
  38466. p->level--;
  38467. return NULL;
  38468. }
  38469. void * _res = NULL;
  38470. int _mark = p->mark;
  38471. { // positional_patterns ','
  38472. if (p->error_indicator) {
  38473. p->level--;
  38474. return NULL;
  38475. }
  38476. D(fprintf(stderr, "%*c> _tmp_227[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "positional_patterns ','"));
  38477. Token * _literal;
  38478. asdl_pattern_seq* positional_patterns_var;
  38479. if (
  38480. (positional_patterns_var = positional_patterns_rule(p)) // positional_patterns
  38481. &&
  38482. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  38483. )
  38484. {
  38485. D(fprintf(stderr, "%*c+ _tmp_227[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "positional_patterns ','"));
  38486. _res = _PyPegen_dummy_name(p, positional_patterns_var, _literal);
  38487. goto done;
  38488. }
  38489. p->mark = _mark;
  38490. D(fprintf(stderr, "%*c%s _tmp_227[%d-%d]: %s failed!\n", p->level, ' ',
  38491. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "positional_patterns ','"));
  38492. }
  38493. _res = NULL;
  38494. done:
  38495. p->level--;
  38496. return _res;
  38497. }
  38498. // _tmp_228: '->' expression
  38499. static void *
  38500. _tmp_228_rule(Parser *p)
  38501. {
  38502. if (p->level++ == MAXSTACK) {
  38503. _Pypegen_stack_overflow(p);
  38504. }
  38505. if (p->error_indicator) {
  38506. p->level--;
  38507. return NULL;
  38508. }
  38509. void * _res = NULL;
  38510. int _mark = p->mark;
  38511. { // '->' expression
  38512. if (p->error_indicator) {
  38513. p->level--;
  38514. return NULL;
  38515. }
  38516. D(fprintf(stderr, "%*c> _tmp_228[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
  38517. Token * _literal;
  38518. expr_ty expression_var;
  38519. if (
  38520. (_literal = _PyPegen_expect_token(p, 51)) // token='->'
  38521. &&
  38522. (expression_var = expression_rule(p)) // expression
  38523. )
  38524. {
  38525. D(fprintf(stderr, "%*c+ _tmp_228[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
  38526. _res = _PyPegen_dummy_name(p, _literal, expression_var);
  38527. goto done;
  38528. }
  38529. p->mark = _mark;
  38530. D(fprintf(stderr, "%*c%s _tmp_228[%d-%d]: %s failed!\n", p->level, ' ',
  38531. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
  38532. }
  38533. _res = NULL;
  38534. done:
  38535. p->level--;
  38536. return _res;
  38537. }
  38538. // _tmp_229: '(' arguments? ')'
  38539. static void *
  38540. _tmp_229_rule(Parser *p)
  38541. {
  38542. if (p->level++ == MAXSTACK) {
  38543. _Pypegen_stack_overflow(p);
  38544. }
  38545. if (p->error_indicator) {
  38546. p->level--;
  38547. return NULL;
  38548. }
  38549. void * _res = NULL;
  38550. int _mark = p->mark;
  38551. { // '(' arguments? ')'
  38552. if (p->error_indicator) {
  38553. p->level--;
  38554. return NULL;
  38555. }
  38556. D(fprintf(stderr, "%*c> _tmp_229[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
  38557. Token * _literal;
  38558. Token * _literal_1;
  38559. void *_opt_var;
  38560. UNUSED(_opt_var); // Silence compiler warnings
  38561. if (
  38562. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  38563. &&
  38564. (_opt_var = arguments_rule(p), !p->error_indicator) // arguments?
  38565. &&
  38566. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  38567. )
  38568. {
  38569. D(fprintf(stderr, "%*c+ _tmp_229[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
  38570. _res = _PyPegen_dummy_name(p, _literal, _opt_var, _literal_1);
  38571. goto done;
  38572. }
  38573. p->mark = _mark;
  38574. D(fprintf(stderr, "%*c%s _tmp_229[%d-%d]: %s failed!\n", p->level, ' ',
  38575. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'"));
  38576. }
  38577. _res = NULL;
  38578. done:
  38579. p->level--;
  38580. return _res;
  38581. }
  38582. // _tmp_230: '(' arguments? ')'
  38583. static void *
  38584. _tmp_230_rule(Parser *p)
  38585. {
  38586. if (p->level++ == MAXSTACK) {
  38587. _Pypegen_stack_overflow(p);
  38588. }
  38589. if (p->error_indicator) {
  38590. p->level--;
  38591. return NULL;
  38592. }
  38593. void * _res = NULL;
  38594. int _mark = p->mark;
  38595. { // '(' arguments? ')'
  38596. if (p->error_indicator) {
  38597. p->level--;
  38598. return NULL;
  38599. }
  38600. D(fprintf(stderr, "%*c> _tmp_230[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
  38601. Token * _literal;
  38602. Token * _literal_1;
  38603. void *_opt_var;
  38604. UNUSED(_opt_var); // Silence compiler warnings
  38605. if (
  38606. (_literal = _PyPegen_expect_token(p, 7)) // token='('
  38607. &&
  38608. (_opt_var = arguments_rule(p), !p->error_indicator) // arguments?
  38609. &&
  38610. (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
  38611. )
  38612. {
  38613. D(fprintf(stderr, "%*c+ _tmp_230[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
  38614. _res = _PyPegen_dummy_name(p, _literal, _opt_var, _literal_1);
  38615. goto done;
  38616. }
  38617. p->mark = _mark;
  38618. D(fprintf(stderr, "%*c%s _tmp_230[%d-%d]: %s failed!\n", p->level, ' ',
  38619. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'"));
  38620. }
  38621. _res = NULL;
  38622. done:
  38623. p->level--;
  38624. return _res;
  38625. }
  38626. // _loop0_232: ',' double_starred_kvpair
  38627. static asdl_seq *
  38628. _loop0_232_rule(Parser *p)
  38629. {
  38630. if (p->level++ == MAXSTACK) {
  38631. _Pypegen_stack_overflow(p);
  38632. }
  38633. if (p->error_indicator) {
  38634. p->level--;
  38635. return NULL;
  38636. }
  38637. void *_res = NULL;
  38638. int _mark = p->mark;
  38639. void **_children = PyMem_Malloc(sizeof(void *));
  38640. if (!_children) {
  38641. p->error_indicator = 1;
  38642. PyErr_NoMemory();
  38643. p->level--;
  38644. return NULL;
  38645. }
  38646. Py_ssize_t _children_capacity = 1;
  38647. Py_ssize_t _n = 0;
  38648. { // ',' double_starred_kvpair
  38649. if (p->error_indicator) {
  38650. p->level--;
  38651. return NULL;
  38652. }
  38653. D(fprintf(stderr, "%*c> _loop0_232[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair"));
  38654. Token * _literal;
  38655. KeyValuePair* elem;
  38656. while (
  38657. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  38658. &&
  38659. (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
  38660. )
  38661. {
  38662. _res = elem;
  38663. if (_res == NULL && PyErr_Occurred()) {
  38664. p->error_indicator = 1;
  38665. PyMem_Free(_children);
  38666. p->level--;
  38667. return NULL;
  38668. }
  38669. if (_n == _children_capacity) {
  38670. _children_capacity *= 2;
  38671. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  38672. if (!_new_children) {
  38673. PyMem_Free(_children);
  38674. p->error_indicator = 1;
  38675. PyErr_NoMemory();
  38676. p->level--;
  38677. return NULL;
  38678. }
  38679. _children = _new_children;
  38680. }
  38681. _children[_n++] = _res;
  38682. _mark = p->mark;
  38683. }
  38684. p->mark = _mark;
  38685. D(fprintf(stderr, "%*c%s _loop0_232[%d-%d]: %s failed!\n", p->level, ' ',
  38686. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair"));
  38687. }
  38688. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  38689. if (!_seq) {
  38690. PyMem_Free(_children);
  38691. p->error_indicator = 1;
  38692. PyErr_NoMemory();
  38693. p->level--;
  38694. return NULL;
  38695. }
  38696. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  38697. PyMem_Free(_children);
  38698. p->level--;
  38699. return _seq;
  38700. }
  38701. // _gather_231: double_starred_kvpair _loop0_232
  38702. static asdl_seq *
  38703. _gather_231_rule(Parser *p)
  38704. {
  38705. if (p->level++ == MAXSTACK) {
  38706. _Pypegen_stack_overflow(p);
  38707. }
  38708. if (p->error_indicator) {
  38709. p->level--;
  38710. return NULL;
  38711. }
  38712. asdl_seq * _res = NULL;
  38713. int _mark = p->mark;
  38714. { // double_starred_kvpair _loop0_232
  38715. if (p->error_indicator) {
  38716. p->level--;
  38717. return NULL;
  38718. }
  38719. D(fprintf(stderr, "%*c> _gather_231[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_232"));
  38720. KeyValuePair* elem;
  38721. asdl_seq * seq;
  38722. if (
  38723. (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
  38724. &&
  38725. (seq = _loop0_232_rule(p)) // _loop0_232
  38726. )
  38727. {
  38728. D(fprintf(stderr, "%*c+ _gather_231[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_232"));
  38729. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  38730. goto done;
  38731. }
  38732. p->mark = _mark;
  38733. D(fprintf(stderr, "%*c%s _gather_231[%d-%d]: %s failed!\n", p->level, ' ',
  38734. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_232"));
  38735. }
  38736. _res = NULL;
  38737. done:
  38738. p->level--;
  38739. return _res;
  38740. }
  38741. // _tmp_233: '}' | ','
  38742. static void *
  38743. _tmp_233_rule(Parser *p)
  38744. {
  38745. if (p->level++ == MAXSTACK) {
  38746. _Pypegen_stack_overflow(p);
  38747. }
  38748. if (p->error_indicator) {
  38749. p->level--;
  38750. return NULL;
  38751. }
  38752. void * _res = NULL;
  38753. int _mark = p->mark;
  38754. { // '}'
  38755. if (p->error_indicator) {
  38756. p->level--;
  38757. return NULL;
  38758. }
  38759. D(fprintf(stderr, "%*c> _tmp_233[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'"));
  38760. Token * _literal;
  38761. if (
  38762. (_literal = _PyPegen_expect_token(p, 26)) // token='}'
  38763. )
  38764. {
  38765. D(fprintf(stderr, "%*c+ _tmp_233[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'"));
  38766. _res = _literal;
  38767. goto done;
  38768. }
  38769. p->mark = _mark;
  38770. D(fprintf(stderr, "%*c%s _tmp_233[%d-%d]: %s failed!\n", p->level, ' ',
  38771. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'"));
  38772. }
  38773. { // ','
  38774. if (p->error_indicator) {
  38775. p->level--;
  38776. return NULL;
  38777. }
  38778. D(fprintf(stderr, "%*c> _tmp_233[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
  38779. Token * _literal;
  38780. if (
  38781. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  38782. )
  38783. {
  38784. D(fprintf(stderr, "%*c+ _tmp_233[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
  38785. _res = _literal;
  38786. goto done;
  38787. }
  38788. p->mark = _mark;
  38789. D(fprintf(stderr, "%*c%s _tmp_233[%d-%d]: %s failed!\n", p->level, ' ',
  38790. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
  38791. }
  38792. _res = NULL;
  38793. done:
  38794. p->level--;
  38795. return _res;
  38796. }
  38797. // _tmp_234: '}' | ','
  38798. static void *
  38799. _tmp_234_rule(Parser *p)
  38800. {
  38801. if (p->level++ == MAXSTACK) {
  38802. _Pypegen_stack_overflow(p);
  38803. }
  38804. if (p->error_indicator) {
  38805. p->level--;
  38806. return NULL;
  38807. }
  38808. void * _res = NULL;
  38809. int _mark = p->mark;
  38810. { // '}'
  38811. if (p->error_indicator) {
  38812. p->level--;
  38813. return NULL;
  38814. }
  38815. D(fprintf(stderr, "%*c> _tmp_234[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'"));
  38816. Token * _literal;
  38817. if (
  38818. (_literal = _PyPegen_expect_token(p, 26)) // token='}'
  38819. )
  38820. {
  38821. D(fprintf(stderr, "%*c+ _tmp_234[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'"));
  38822. _res = _literal;
  38823. goto done;
  38824. }
  38825. p->mark = _mark;
  38826. D(fprintf(stderr, "%*c%s _tmp_234[%d-%d]: %s failed!\n", p->level, ' ',
  38827. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'"));
  38828. }
  38829. { // ','
  38830. if (p->error_indicator) {
  38831. p->level--;
  38832. return NULL;
  38833. }
  38834. D(fprintf(stderr, "%*c> _tmp_234[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
  38835. Token * _literal;
  38836. if (
  38837. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  38838. )
  38839. {
  38840. D(fprintf(stderr, "%*c+ _tmp_234[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
  38841. _res = _literal;
  38842. goto done;
  38843. }
  38844. p->mark = _mark;
  38845. D(fprintf(stderr, "%*c%s _tmp_234[%d-%d]: %s failed!\n", p->level, ' ',
  38846. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
  38847. }
  38848. _res = NULL;
  38849. done:
  38850. p->level--;
  38851. return _res;
  38852. }
  38853. // _tmp_235: yield_expr | star_expressions
  38854. static void *
  38855. _tmp_235_rule(Parser *p)
  38856. {
  38857. if (p->level++ == MAXSTACK) {
  38858. _Pypegen_stack_overflow(p);
  38859. }
  38860. if (p->error_indicator) {
  38861. p->level--;
  38862. return NULL;
  38863. }
  38864. void * _res = NULL;
  38865. int _mark = p->mark;
  38866. { // yield_expr
  38867. if (p->error_indicator) {
  38868. p->level--;
  38869. return NULL;
  38870. }
  38871. D(fprintf(stderr, "%*c> _tmp_235[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  38872. expr_ty yield_expr_var;
  38873. if (
  38874. (yield_expr_var = yield_expr_rule(p)) // yield_expr
  38875. )
  38876. {
  38877. D(fprintf(stderr, "%*c+ _tmp_235[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  38878. _res = yield_expr_var;
  38879. goto done;
  38880. }
  38881. p->mark = _mark;
  38882. D(fprintf(stderr, "%*c%s _tmp_235[%d-%d]: %s failed!\n", p->level, ' ',
  38883. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
  38884. }
  38885. { // star_expressions
  38886. if (p->error_indicator) {
  38887. p->level--;
  38888. return NULL;
  38889. }
  38890. D(fprintf(stderr, "%*c> _tmp_235[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  38891. expr_ty star_expressions_var;
  38892. if (
  38893. (star_expressions_var = star_expressions_rule(p)) // star_expressions
  38894. )
  38895. {
  38896. D(fprintf(stderr, "%*c+ _tmp_235[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  38897. _res = star_expressions_var;
  38898. goto done;
  38899. }
  38900. p->mark = _mark;
  38901. D(fprintf(stderr, "%*c%s _tmp_235[%d-%d]: %s failed!\n", p->level, ' ',
  38902. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
  38903. }
  38904. _res = NULL;
  38905. done:
  38906. p->level--;
  38907. return _res;
  38908. }
  38909. // _tmp_236: yield_expr | star_expressions
  38910. static void *
  38911. _tmp_236_rule(Parser *p)
  38912. {
  38913. if (p->level++ == MAXSTACK) {
  38914. _Pypegen_stack_overflow(p);
  38915. }
  38916. if (p->error_indicator) {
  38917. p->level--;
  38918. return NULL;
  38919. }
  38920. void * _res = NULL;
  38921. int _mark = p->mark;
  38922. { // yield_expr
  38923. if (p->error_indicator) {
  38924. p->level--;
  38925. return NULL;
  38926. }
  38927. D(fprintf(stderr, "%*c> _tmp_236[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  38928. expr_ty yield_expr_var;
  38929. if (
  38930. (yield_expr_var = yield_expr_rule(p)) // yield_expr
  38931. )
  38932. {
  38933. D(fprintf(stderr, "%*c+ _tmp_236[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  38934. _res = yield_expr_var;
  38935. goto done;
  38936. }
  38937. p->mark = _mark;
  38938. D(fprintf(stderr, "%*c%s _tmp_236[%d-%d]: %s failed!\n", p->level, ' ',
  38939. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
  38940. }
  38941. { // star_expressions
  38942. if (p->error_indicator) {
  38943. p->level--;
  38944. return NULL;
  38945. }
  38946. D(fprintf(stderr, "%*c> _tmp_236[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  38947. expr_ty star_expressions_var;
  38948. if (
  38949. (star_expressions_var = star_expressions_rule(p)) // star_expressions
  38950. )
  38951. {
  38952. D(fprintf(stderr, "%*c+ _tmp_236[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  38953. _res = star_expressions_var;
  38954. goto done;
  38955. }
  38956. p->mark = _mark;
  38957. D(fprintf(stderr, "%*c%s _tmp_236[%d-%d]: %s failed!\n", p->level, ' ',
  38958. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
  38959. }
  38960. _res = NULL;
  38961. done:
  38962. p->level--;
  38963. return _res;
  38964. }
  38965. // _tmp_237: '=' | '!' | ':' | '}'
  38966. static void *
  38967. _tmp_237_rule(Parser *p)
  38968. {
  38969. if (p->level++ == MAXSTACK) {
  38970. _Pypegen_stack_overflow(p);
  38971. }
  38972. if (p->error_indicator) {
  38973. p->level--;
  38974. return NULL;
  38975. }
  38976. void * _res = NULL;
  38977. int _mark = p->mark;
  38978. { // '='
  38979. if (p->error_indicator) {
  38980. p->level--;
  38981. return NULL;
  38982. }
  38983. D(fprintf(stderr, "%*c> _tmp_237[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='"));
  38984. Token * _literal;
  38985. if (
  38986. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  38987. )
  38988. {
  38989. D(fprintf(stderr, "%*c+ _tmp_237[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='"));
  38990. _res = _literal;
  38991. goto done;
  38992. }
  38993. p->mark = _mark;
  38994. D(fprintf(stderr, "%*c%s _tmp_237[%d-%d]: %s failed!\n", p->level, ' ',
  38995. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='"));
  38996. }
  38997. { // '!'
  38998. if (p->error_indicator) {
  38999. p->level--;
  39000. return NULL;
  39001. }
  39002. D(fprintf(stderr, "%*c> _tmp_237[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!'"));
  39003. Token * _literal;
  39004. if (
  39005. (_literal = _PyPegen_expect_token(p, 54)) // token='!'
  39006. )
  39007. {
  39008. D(fprintf(stderr, "%*c+ _tmp_237[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!'"));
  39009. _res = _literal;
  39010. goto done;
  39011. }
  39012. p->mark = _mark;
  39013. D(fprintf(stderr, "%*c%s _tmp_237[%d-%d]: %s failed!\n", p->level, ' ',
  39014. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!'"));
  39015. }
  39016. { // ':'
  39017. if (p->error_indicator) {
  39018. p->level--;
  39019. return NULL;
  39020. }
  39021. D(fprintf(stderr, "%*c> _tmp_237[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
  39022. Token * _literal;
  39023. if (
  39024. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  39025. )
  39026. {
  39027. D(fprintf(stderr, "%*c+ _tmp_237[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
  39028. _res = _literal;
  39029. goto done;
  39030. }
  39031. p->mark = _mark;
  39032. D(fprintf(stderr, "%*c%s _tmp_237[%d-%d]: %s failed!\n", p->level, ' ',
  39033. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
  39034. }
  39035. { // '}'
  39036. if (p->error_indicator) {
  39037. p->level--;
  39038. return NULL;
  39039. }
  39040. D(fprintf(stderr, "%*c> _tmp_237[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'"));
  39041. Token * _literal;
  39042. if (
  39043. (_literal = _PyPegen_expect_token(p, 26)) // token='}'
  39044. )
  39045. {
  39046. D(fprintf(stderr, "%*c+ _tmp_237[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'"));
  39047. _res = _literal;
  39048. goto done;
  39049. }
  39050. p->mark = _mark;
  39051. D(fprintf(stderr, "%*c%s _tmp_237[%d-%d]: %s failed!\n", p->level, ' ',
  39052. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'"));
  39053. }
  39054. _res = NULL;
  39055. done:
  39056. p->level--;
  39057. return _res;
  39058. }
  39059. // _tmp_238: yield_expr | star_expressions
  39060. static void *
  39061. _tmp_238_rule(Parser *p)
  39062. {
  39063. if (p->level++ == MAXSTACK) {
  39064. _Pypegen_stack_overflow(p);
  39065. }
  39066. if (p->error_indicator) {
  39067. p->level--;
  39068. return NULL;
  39069. }
  39070. void * _res = NULL;
  39071. int _mark = p->mark;
  39072. { // yield_expr
  39073. if (p->error_indicator) {
  39074. p->level--;
  39075. return NULL;
  39076. }
  39077. D(fprintf(stderr, "%*c> _tmp_238[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  39078. expr_ty yield_expr_var;
  39079. if (
  39080. (yield_expr_var = yield_expr_rule(p)) // yield_expr
  39081. )
  39082. {
  39083. D(fprintf(stderr, "%*c+ _tmp_238[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  39084. _res = yield_expr_var;
  39085. goto done;
  39086. }
  39087. p->mark = _mark;
  39088. D(fprintf(stderr, "%*c%s _tmp_238[%d-%d]: %s failed!\n", p->level, ' ',
  39089. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
  39090. }
  39091. { // star_expressions
  39092. if (p->error_indicator) {
  39093. p->level--;
  39094. return NULL;
  39095. }
  39096. D(fprintf(stderr, "%*c> _tmp_238[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  39097. expr_ty star_expressions_var;
  39098. if (
  39099. (star_expressions_var = star_expressions_rule(p)) // star_expressions
  39100. )
  39101. {
  39102. D(fprintf(stderr, "%*c+ _tmp_238[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  39103. _res = star_expressions_var;
  39104. goto done;
  39105. }
  39106. p->mark = _mark;
  39107. D(fprintf(stderr, "%*c%s _tmp_238[%d-%d]: %s failed!\n", p->level, ' ',
  39108. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
  39109. }
  39110. _res = NULL;
  39111. done:
  39112. p->level--;
  39113. return _res;
  39114. }
  39115. // _tmp_239: '!' | ':' | '}'
  39116. static void *
  39117. _tmp_239_rule(Parser *p)
  39118. {
  39119. if (p->level++ == MAXSTACK) {
  39120. _Pypegen_stack_overflow(p);
  39121. }
  39122. if (p->error_indicator) {
  39123. p->level--;
  39124. return NULL;
  39125. }
  39126. void * _res = NULL;
  39127. int _mark = p->mark;
  39128. { // '!'
  39129. if (p->error_indicator) {
  39130. p->level--;
  39131. return NULL;
  39132. }
  39133. D(fprintf(stderr, "%*c> _tmp_239[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!'"));
  39134. Token * _literal;
  39135. if (
  39136. (_literal = _PyPegen_expect_token(p, 54)) // token='!'
  39137. )
  39138. {
  39139. D(fprintf(stderr, "%*c+ _tmp_239[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!'"));
  39140. _res = _literal;
  39141. goto done;
  39142. }
  39143. p->mark = _mark;
  39144. D(fprintf(stderr, "%*c%s _tmp_239[%d-%d]: %s failed!\n", p->level, ' ',
  39145. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!'"));
  39146. }
  39147. { // ':'
  39148. if (p->error_indicator) {
  39149. p->level--;
  39150. return NULL;
  39151. }
  39152. D(fprintf(stderr, "%*c> _tmp_239[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
  39153. Token * _literal;
  39154. if (
  39155. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  39156. )
  39157. {
  39158. D(fprintf(stderr, "%*c+ _tmp_239[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
  39159. _res = _literal;
  39160. goto done;
  39161. }
  39162. p->mark = _mark;
  39163. D(fprintf(stderr, "%*c%s _tmp_239[%d-%d]: %s failed!\n", p->level, ' ',
  39164. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
  39165. }
  39166. { // '}'
  39167. if (p->error_indicator) {
  39168. p->level--;
  39169. return NULL;
  39170. }
  39171. D(fprintf(stderr, "%*c> _tmp_239[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'"));
  39172. Token * _literal;
  39173. if (
  39174. (_literal = _PyPegen_expect_token(p, 26)) // token='}'
  39175. )
  39176. {
  39177. D(fprintf(stderr, "%*c+ _tmp_239[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'"));
  39178. _res = _literal;
  39179. goto done;
  39180. }
  39181. p->mark = _mark;
  39182. D(fprintf(stderr, "%*c%s _tmp_239[%d-%d]: %s failed!\n", p->level, ' ',
  39183. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'"));
  39184. }
  39185. _res = NULL;
  39186. done:
  39187. p->level--;
  39188. return _res;
  39189. }
  39190. // _tmp_240: yield_expr | star_expressions
  39191. static void *
  39192. _tmp_240_rule(Parser *p)
  39193. {
  39194. if (p->level++ == MAXSTACK) {
  39195. _Pypegen_stack_overflow(p);
  39196. }
  39197. if (p->error_indicator) {
  39198. p->level--;
  39199. return NULL;
  39200. }
  39201. void * _res = NULL;
  39202. int _mark = p->mark;
  39203. { // yield_expr
  39204. if (p->error_indicator) {
  39205. p->level--;
  39206. return NULL;
  39207. }
  39208. D(fprintf(stderr, "%*c> _tmp_240[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  39209. expr_ty yield_expr_var;
  39210. if (
  39211. (yield_expr_var = yield_expr_rule(p)) // yield_expr
  39212. )
  39213. {
  39214. D(fprintf(stderr, "%*c+ _tmp_240[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  39215. _res = yield_expr_var;
  39216. goto done;
  39217. }
  39218. p->mark = _mark;
  39219. D(fprintf(stderr, "%*c%s _tmp_240[%d-%d]: %s failed!\n", p->level, ' ',
  39220. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
  39221. }
  39222. { // star_expressions
  39223. if (p->error_indicator) {
  39224. p->level--;
  39225. return NULL;
  39226. }
  39227. D(fprintf(stderr, "%*c> _tmp_240[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  39228. expr_ty star_expressions_var;
  39229. if (
  39230. (star_expressions_var = star_expressions_rule(p)) // star_expressions
  39231. )
  39232. {
  39233. D(fprintf(stderr, "%*c+ _tmp_240[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  39234. _res = star_expressions_var;
  39235. goto done;
  39236. }
  39237. p->mark = _mark;
  39238. D(fprintf(stderr, "%*c%s _tmp_240[%d-%d]: %s failed!\n", p->level, ' ',
  39239. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
  39240. }
  39241. _res = NULL;
  39242. done:
  39243. p->level--;
  39244. return _res;
  39245. }
  39246. // _tmp_241: yield_expr | star_expressions
  39247. static void *
  39248. _tmp_241_rule(Parser *p)
  39249. {
  39250. if (p->level++ == MAXSTACK) {
  39251. _Pypegen_stack_overflow(p);
  39252. }
  39253. if (p->error_indicator) {
  39254. p->level--;
  39255. return NULL;
  39256. }
  39257. void * _res = NULL;
  39258. int _mark = p->mark;
  39259. { // yield_expr
  39260. if (p->error_indicator) {
  39261. p->level--;
  39262. return NULL;
  39263. }
  39264. D(fprintf(stderr, "%*c> _tmp_241[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  39265. expr_ty yield_expr_var;
  39266. if (
  39267. (yield_expr_var = yield_expr_rule(p)) // yield_expr
  39268. )
  39269. {
  39270. D(fprintf(stderr, "%*c+ _tmp_241[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  39271. _res = yield_expr_var;
  39272. goto done;
  39273. }
  39274. p->mark = _mark;
  39275. D(fprintf(stderr, "%*c%s _tmp_241[%d-%d]: %s failed!\n", p->level, ' ',
  39276. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
  39277. }
  39278. { // star_expressions
  39279. if (p->error_indicator) {
  39280. p->level--;
  39281. return NULL;
  39282. }
  39283. D(fprintf(stderr, "%*c> _tmp_241[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  39284. expr_ty star_expressions_var;
  39285. if (
  39286. (star_expressions_var = star_expressions_rule(p)) // star_expressions
  39287. )
  39288. {
  39289. D(fprintf(stderr, "%*c+ _tmp_241[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  39290. _res = star_expressions_var;
  39291. goto done;
  39292. }
  39293. p->mark = _mark;
  39294. D(fprintf(stderr, "%*c%s _tmp_241[%d-%d]: %s failed!\n", p->level, ' ',
  39295. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
  39296. }
  39297. _res = NULL;
  39298. done:
  39299. p->level--;
  39300. return _res;
  39301. }
  39302. // _tmp_242: '!' NAME
  39303. static void *
  39304. _tmp_242_rule(Parser *p)
  39305. {
  39306. if (p->level++ == MAXSTACK) {
  39307. _Pypegen_stack_overflow(p);
  39308. }
  39309. if (p->error_indicator) {
  39310. p->level--;
  39311. return NULL;
  39312. }
  39313. void * _res = NULL;
  39314. int _mark = p->mark;
  39315. { // '!' NAME
  39316. if (p->error_indicator) {
  39317. p->level--;
  39318. return NULL;
  39319. }
  39320. D(fprintf(stderr, "%*c> _tmp_242[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!' NAME"));
  39321. Token * _literal;
  39322. expr_ty name_var;
  39323. if (
  39324. (_literal = _PyPegen_expect_token(p, 54)) // token='!'
  39325. &&
  39326. (name_var = _PyPegen_name_token(p)) // NAME
  39327. )
  39328. {
  39329. D(fprintf(stderr, "%*c+ _tmp_242[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!' NAME"));
  39330. _res = _PyPegen_dummy_name(p, _literal, name_var);
  39331. goto done;
  39332. }
  39333. p->mark = _mark;
  39334. D(fprintf(stderr, "%*c%s _tmp_242[%d-%d]: %s failed!\n", p->level, ' ',
  39335. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!' NAME"));
  39336. }
  39337. _res = NULL;
  39338. done:
  39339. p->level--;
  39340. return _res;
  39341. }
  39342. // _tmp_243: ':' | '}'
  39343. static void *
  39344. _tmp_243_rule(Parser *p)
  39345. {
  39346. if (p->level++ == MAXSTACK) {
  39347. _Pypegen_stack_overflow(p);
  39348. }
  39349. if (p->error_indicator) {
  39350. p->level--;
  39351. return NULL;
  39352. }
  39353. void * _res = NULL;
  39354. int _mark = p->mark;
  39355. { // ':'
  39356. if (p->error_indicator) {
  39357. p->level--;
  39358. return NULL;
  39359. }
  39360. D(fprintf(stderr, "%*c> _tmp_243[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
  39361. Token * _literal;
  39362. if (
  39363. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  39364. )
  39365. {
  39366. D(fprintf(stderr, "%*c+ _tmp_243[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
  39367. _res = _literal;
  39368. goto done;
  39369. }
  39370. p->mark = _mark;
  39371. D(fprintf(stderr, "%*c%s _tmp_243[%d-%d]: %s failed!\n", p->level, ' ',
  39372. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
  39373. }
  39374. { // '}'
  39375. if (p->error_indicator) {
  39376. p->level--;
  39377. return NULL;
  39378. }
  39379. D(fprintf(stderr, "%*c> _tmp_243[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'"));
  39380. Token * _literal;
  39381. if (
  39382. (_literal = _PyPegen_expect_token(p, 26)) // token='}'
  39383. )
  39384. {
  39385. D(fprintf(stderr, "%*c+ _tmp_243[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'"));
  39386. _res = _literal;
  39387. goto done;
  39388. }
  39389. p->mark = _mark;
  39390. D(fprintf(stderr, "%*c%s _tmp_243[%d-%d]: %s failed!\n", p->level, ' ',
  39391. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'"));
  39392. }
  39393. _res = NULL;
  39394. done:
  39395. p->level--;
  39396. return _res;
  39397. }
  39398. // _tmp_244: yield_expr | star_expressions
  39399. static void *
  39400. _tmp_244_rule(Parser *p)
  39401. {
  39402. if (p->level++ == MAXSTACK) {
  39403. _Pypegen_stack_overflow(p);
  39404. }
  39405. if (p->error_indicator) {
  39406. p->level--;
  39407. return NULL;
  39408. }
  39409. void * _res = NULL;
  39410. int _mark = p->mark;
  39411. { // yield_expr
  39412. if (p->error_indicator) {
  39413. p->level--;
  39414. return NULL;
  39415. }
  39416. D(fprintf(stderr, "%*c> _tmp_244[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  39417. expr_ty yield_expr_var;
  39418. if (
  39419. (yield_expr_var = yield_expr_rule(p)) // yield_expr
  39420. )
  39421. {
  39422. D(fprintf(stderr, "%*c+ _tmp_244[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  39423. _res = yield_expr_var;
  39424. goto done;
  39425. }
  39426. p->mark = _mark;
  39427. D(fprintf(stderr, "%*c%s _tmp_244[%d-%d]: %s failed!\n", p->level, ' ',
  39428. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
  39429. }
  39430. { // star_expressions
  39431. if (p->error_indicator) {
  39432. p->level--;
  39433. return NULL;
  39434. }
  39435. D(fprintf(stderr, "%*c> _tmp_244[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  39436. expr_ty star_expressions_var;
  39437. if (
  39438. (star_expressions_var = star_expressions_rule(p)) // star_expressions
  39439. )
  39440. {
  39441. D(fprintf(stderr, "%*c+ _tmp_244[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  39442. _res = star_expressions_var;
  39443. goto done;
  39444. }
  39445. p->mark = _mark;
  39446. D(fprintf(stderr, "%*c%s _tmp_244[%d-%d]: %s failed!\n", p->level, ' ',
  39447. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
  39448. }
  39449. _res = NULL;
  39450. done:
  39451. p->level--;
  39452. return _res;
  39453. }
  39454. // _tmp_245: '!' NAME
  39455. static void *
  39456. _tmp_245_rule(Parser *p)
  39457. {
  39458. if (p->level++ == MAXSTACK) {
  39459. _Pypegen_stack_overflow(p);
  39460. }
  39461. if (p->error_indicator) {
  39462. p->level--;
  39463. return NULL;
  39464. }
  39465. void * _res = NULL;
  39466. int _mark = p->mark;
  39467. { // '!' NAME
  39468. if (p->error_indicator) {
  39469. p->level--;
  39470. return NULL;
  39471. }
  39472. D(fprintf(stderr, "%*c> _tmp_245[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!' NAME"));
  39473. Token * _literal;
  39474. expr_ty name_var;
  39475. if (
  39476. (_literal = _PyPegen_expect_token(p, 54)) // token='!'
  39477. &&
  39478. (name_var = _PyPegen_name_token(p)) // NAME
  39479. )
  39480. {
  39481. D(fprintf(stderr, "%*c+ _tmp_245[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!' NAME"));
  39482. _res = _PyPegen_dummy_name(p, _literal, name_var);
  39483. goto done;
  39484. }
  39485. p->mark = _mark;
  39486. D(fprintf(stderr, "%*c%s _tmp_245[%d-%d]: %s failed!\n", p->level, ' ',
  39487. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!' NAME"));
  39488. }
  39489. _res = NULL;
  39490. done:
  39491. p->level--;
  39492. return _res;
  39493. }
  39494. // _loop0_246: fstring_format_spec
  39495. static asdl_seq *
  39496. _loop0_246_rule(Parser *p)
  39497. {
  39498. if (p->level++ == MAXSTACK) {
  39499. _Pypegen_stack_overflow(p);
  39500. }
  39501. if (p->error_indicator) {
  39502. p->level--;
  39503. return NULL;
  39504. }
  39505. void *_res = NULL;
  39506. int _mark = p->mark;
  39507. void **_children = PyMem_Malloc(sizeof(void *));
  39508. if (!_children) {
  39509. p->error_indicator = 1;
  39510. PyErr_NoMemory();
  39511. p->level--;
  39512. return NULL;
  39513. }
  39514. Py_ssize_t _children_capacity = 1;
  39515. Py_ssize_t _n = 0;
  39516. { // fstring_format_spec
  39517. if (p->error_indicator) {
  39518. p->level--;
  39519. return NULL;
  39520. }
  39521. D(fprintf(stderr, "%*c> _loop0_246[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "fstring_format_spec"));
  39522. expr_ty fstring_format_spec_var;
  39523. while (
  39524. (fstring_format_spec_var = fstring_format_spec_rule(p)) // fstring_format_spec
  39525. )
  39526. {
  39527. _res = fstring_format_spec_var;
  39528. if (_n == _children_capacity) {
  39529. _children_capacity *= 2;
  39530. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  39531. if (!_new_children) {
  39532. PyMem_Free(_children);
  39533. p->error_indicator = 1;
  39534. PyErr_NoMemory();
  39535. p->level--;
  39536. return NULL;
  39537. }
  39538. _children = _new_children;
  39539. }
  39540. _children[_n++] = _res;
  39541. _mark = p->mark;
  39542. }
  39543. p->mark = _mark;
  39544. D(fprintf(stderr, "%*c%s _loop0_246[%d-%d]: %s failed!\n", p->level, ' ',
  39545. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "fstring_format_spec"));
  39546. }
  39547. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  39548. if (!_seq) {
  39549. PyMem_Free(_children);
  39550. p->error_indicator = 1;
  39551. PyErr_NoMemory();
  39552. p->level--;
  39553. return NULL;
  39554. }
  39555. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  39556. PyMem_Free(_children);
  39557. p->level--;
  39558. return _seq;
  39559. }
  39560. // _tmp_247: yield_expr | star_expressions
  39561. static void *
  39562. _tmp_247_rule(Parser *p)
  39563. {
  39564. if (p->level++ == MAXSTACK) {
  39565. _Pypegen_stack_overflow(p);
  39566. }
  39567. if (p->error_indicator) {
  39568. p->level--;
  39569. return NULL;
  39570. }
  39571. void * _res = NULL;
  39572. int _mark = p->mark;
  39573. { // yield_expr
  39574. if (p->error_indicator) {
  39575. p->level--;
  39576. return NULL;
  39577. }
  39578. D(fprintf(stderr, "%*c> _tmp_247[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  39579. expr_ty yield_expr_var;
  39580. if (
  39581. (yield_expr_var = yield_expr_rule(p)) // yield_expr
  39582. )
  39583. {
  39584. D(fprintf(stderr, "%*c+ _tmp_247[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
  39585. _res = yield_expr_var;
  39586. goto done;
  39587. }
  39588. p->mark = _mark;
  39589. D(fprintf(stderr, "%*c%s _tmp_247[%d-%d]: %s failed!\n", p->level, ' ',
  39590. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
  39591. }
  39592. { // star_expressions
  39593. if (p->error_indicator) {
  39594. p->level--;
  39595. return NULL;
  39596. }
  39597. D(fprintf(stderr, "%*c> _tmp_247[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  39598. expr_ty star_expressions_var;
  39599. if (
  39600. (star_expressions_var = star_expressions_rule(p)) // star_expressions
  39601. )
  39602. {
  39603. D(fprintf(stderr, "%*c+ _tmp_247[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
  39604. _res = star_expressions_var;
  39605. goto done;
  39606. }
  39607. p->mark = _mark;
  39608. D(fprintf(stderr, "%*c%s _tmp_247[%d-%d]: %s failed!\n", p->level, ' ',
  39609. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
  39610. }
  39611. _res = NULL;
  39612. done:
  39613. p->level--;
  39614. return _res;
  39615. }
  39616. // _tmp_248: '!' NAME
  39617. static void *
  39618. _tmp_248_rule(Parser *p)
  39619. {
  39620. if (p->level++ == MAXSTACK) {
  39621. _Pypegen_stack_overflow(p);
  39622. }
  39623. if (p->error_indicator) {
  39624. p->level--;
  39625. return NULL;
  39626. }
  39627. void * _res = NULL;
  39628. int _mark = p->mark;
  39629. { // '!' NAME
  39630. if (p->error_indicator) {
  39631. p->level--;
  39632. return NULL;
  39633. }
  39634. D(fprintf(stderr, "%*c> _tmp_248[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!' NAME"));
  39635. Token * _literal;
  39636. expr_ty name_var;
  39637. if (
  39638. (_literal = _PyPegen_expect_token(p, 54)) // token='!'
  39639. &&
  39640. (name_var = _PyPegen_name_token(p)) // NAME
  39641. )
  39642. {
  39643. D(fprintf(stderr, "%*c+ _tmp_248[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!' NAME"));
  39644. _res = _PyPegen_dummy_name(p, _literal, name_var);
  39645. goto done;
  39646. }
  39647. p->mark = _mark;
  39648. D(fprintf(stderr, "%*c%s _tmp_248[%d-%d]: %s failed!\n", p->level, ' ',
  39649. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!' NAME"));
  39650. }
  39651. _res = NULL;
  39652. done:
  39653. p->level--;
  39654. return _res;
  39655. }
  39656. // _tmp_249: ':' | '}'
  39657. static void *
  39658. _tmp_249_rule(Parser *p)
  39659. {
  39660. if (p->level++ == MAXSTACK) {
  39661. _Pypegen_stack_overflow(p);
  39662. }
  39663. if (p->error_indicator) {
  39664. p->level--;
  39665. return NULL;
  39666. }
  39667. void * _res = NULL;
  39668. int _mark = p->mark;
  39669. { // ':'
  39670. if (p->error_indicator) {
  39671. p->level--;
  39672. return NULL;
  39673. }
  39674. D(fprintf(stderr, "%*c> _tmp_249[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
  39675. Token * _literal;
  39676. if (
  39677. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  39678. )
  39679. {
  39680. D(fprintf(stderr, "%*c+ _tmp_249[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
  39681. _res = _literal;
  39682. goto done;
  39683. }
  39684. p->mark = _mark;
  39685. D(fprintf(stderr, "%*c%s _tmp_249[%d-%d]: %s failed!\n", p->level, ' ',
  39686. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
  39687. }
  39688. { // '}'
  39689. if (p->error_indicator) {
  39690. p->level--;
  39691. return NULL;
  39692. }
  39693. D(fprintf(stderr, "%*c> _tmp_249[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'"));
  39694. Token * _literal;
  39695. if (
  39696. (_literal = _PyPegen_expect_token(p, 26)) // token='}'
  39697. )
  39698. {
  39699. D(fprintf(stderr, "%*c+ _tmp_249[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'"));
  39700. _res = _literal;
  39701. goto done;
  39702. }
  39703. p->mark = _mark;
  39704. D(fprintf(stderr, "%*c%s _tmp_249[%d-%d]: %s failed!\n", p->level, ' ',
  39705. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'"));
  39706. }
  39707. _res = NULL;
  39708. done:
  39709. p->level--;
  39710. return _res;
  39711. }
  39712. // _tmp_250: star_targets '='
  39713. static void *
  39714. _tmp_250_rule(Parser *p)
  39715. {
  39716. if (p->level++ == MAXSTACK) {
  39717. _Pypegen_stack_overflow(p);
  39718. }
  39719. if (p->error_indicator) {
  39720. p->level--;
  39721. return NULL;
  39722. }
  39723. void * _res = NULL;
  39724. int _mark = p->mark;
  39725. { // star_targets '='
  39726. if (p->error_indicator) {
  39727. p->level--;
  39728. return NULL;
  39729. }
  39730. D(fprintf(stderr, "%*c> _tmp_250[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
  39731. Token * _literal;
  39732. expr_ty z;
  39733. if (
  39734. (z = star_targets_rule(p)) // star_targets
  39735. &&
  39736. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  39737. )
  39738. {
  39739. D(fprintf(stderr, "%*c+ _tmp_250[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
  39740. _res = z;
  39741. if (_res == NULL && PyErr_Occurred()) {
  39742. p->error_indicator = 1;
  39743. p->level--;
  39744. return NULL;
  39745. }
  39746. goto done;
  39747. }
  39748. p->mark = _mark;
  39749. D(fprintf(stderr, "%*c%s _tmp_250[%d-%d]: %s failed!\n", p->level, ' ',
  39750. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
  39751. }
  39752. _res = NULL;
  39753. done:
  39754. p->level--;
  39755. return _res;
  39756. }
  39757. // _tmp_251: '.' | '...'
  39758. static void *
  39759. _tmp_251_rule(Parser *p)
  39760. {
  39761. if (p->level++ == MAXSTACK) {
  39762. _Pypegen_stack_overflow(p);
  39763. }
  39764. if (p->error_indicator) {
  39765. p->level--;
  39766. return NULL;
  39767. }
  39768. void * _res = NULL;
  39769. int _mark = p->mark;
  39770. { // '.'
  39771. if (p->error_indicator) {
  39772. p->level--;
  39773. return NULL;
  39774. }
  39775. D(fprintf(stderr, "%*c> _tmp_251[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
  39776. Token * _literal;
  39777. if (
  39778. (_literal = _PyPegen_expect_token(p, 23)) // token='.'
  39779. )
  39780. {
  39781. D(fprintf(stderr, "%*c+ _tmp_251[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
  39782. _res = _literal;
  39783. goto done;
  39784. }
  39785. p->mark = _mark;
  39786. D(fprintf(stderr, "%*c%s _tmp_251[%d-%d]: %s failed!\n", p->level, ' ',
  39787. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
  39788. }
  39789. { // '...'
  39790. if (p->error_indicator) {
  39791. p->level--;
  39792. return NULL;
  39793. }
  39794. D(fprintf(stderr, "%*c> _tmp_251[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
  39795. Token * _literal;
  39796. if (
  39797. (_literal = _PyPegen_expect_token(p, 52)) // token='...'
  39798. )
  39799. {
  39800. D(fprintf(stderr, "%*c+ _tmp_251[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
  39801. _res = _literal;
  39802. goto done;
  39803. }
  39804. p->mark = _mark;
  39805. D(fprintf(stderr, "%*c%s _tmp_251[%d-%d]: %s failed!\n", p->level, ' ',
  39806. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
  39807. }
  39808. _res = NULL;
  39809. done:
  39810. p->level--;
  39811. return _res;
  39812. }
  39813. // _tmp_252: '.' | '...'
  39814. static void *
  39815. _tmp_252_rule(Parser *p)
  39816. {
  39817. if (p->level++ == MAXSTACK) {
  39818. _Pypegen_stack_overflow(p);
  39819. }
  39820. if (p->error_indicator) {
  39821. p->level--;
  39822. return NULL;
  39823. }
  39824. void * _res = NULL;
  39825. int _mark = p->mark;
  39826. { // '.'
  39827. if (p->error_indicator) {
  39828. p->level--;
  39829. return NULL;
  39830. }
  39831. D(fprintf(stderr, "%*c> _tmp_252[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
  39832. Token * _literal;
  39833. if (
  39834. (_literal = _PyPegen_expect_token(p, 23)) // token='.'
  39835. )
  39836. {
  39837. D(fprintf(stderr, "%*c+ _tmp_252[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
  39838. _res = _literal;
  39839. goto done;
  39840. }
  39841. p->mark = _mark;
  39842. D(fprintf(stderr, "%*c%s _tmp_252[%d-%d]: %s failed!\n", p->level, ' ',
  39843. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
  39844. }
  39845. { // '...'
  39846. if (p->error_indicator) {
  39847. p->level--;
  39848. return NULL;
  39849. }
  39850. D(fprintf(stderr, "%*c> _tmp_252[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
  39851. Token * _literal;
  39852. if (
  39853. (_literal = _PyPegen_expect_token(p, 52)) // token='...'
  39854. )
  39855. {
  39856. D(fprintf(stderr, "%*c+ _tmp_252[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
  39857. _res = _literal;
  39858. goto done;
  39859. }
  39860. p->mark = _mark;
  39861. D(fprintf(stderr, "%*c%s _tmp_252[%d-%d]: %s failed!\n", p->level, ' ',
  39862. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
  39863. }
  39864. _res = NULL;
  39865. done:
  39866. p->level--;
  39867. return _res;
  39868. }
  39869. // _tmp_253: '@' named_expression NEWLINE
  39870. static void *
  39871. _tmp_253_rule(Parser *p)
  39872. {
  39873. if (p->level++ == MAXSTACK) {
  39874. _Pypegen_stack_overflow(p);
  39875. }
  39876. if (p->error_indicator) {
  39877. p->level--;
  39878. return NULL;
  39879. }
  39880. void * _res = NULL;
  39881. int _mark = p->mark;
  39882. { // '@' named_expression NEWLINE
  39883. if (p->error_indicator) {
  39884. p->level--;
  39885. return NULL;
  39886. }
  39887. D(fprintf(stderr, "%*c> _tmp_253[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE"));
  39888. Token * _literal;
  39889. expr_ty f;
  39890. Token * newline_var;
  39891. if (
  39892. (_literal = _PyPegen_expect_token(p, 49)) // token='@'
  39893. &&
  39894. (f = named_expression_rule(p)) // named_expression
  39895. &&
  39896. (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
  39897. )
  39898. {
  39899. D(fprintf(stderr, "%*c+ _tmp_253[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE"));
  39900. _res = f;
  39901. if (_res == NULL && PyErr_Occurred()) {
  39902. p->error_indicator = 1;
  39903. p->level--;
  39904. return NULL;
  39905. }
  39906. goto done;
  39907. }
  39908. p->mark = _mark;
  39909. D(fprintf(stderr, "%*c%s _tmp_253[%d-%d]: %s failed!\n", p->level, ' ',
  39910. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE"));
  39911. }
  39912. _res = NULL;
  39913. done:
  39914. p->level--;
  39915. return _res;
  39916. }
  39917. // _tmp_254: ',' expression
  39918. static void *
  39919. _tmp_254_rule(Parser *p)
  39920. {
  39921. if (p->level++ == MAXSTACK) {
  39922. _Pypegen_stack_overflow(p);
  39923. }
  39924. if (p->error_indicator) {
  39925. p->level--;
  39926. return NULL;
  39927. }
  39928. void * _res = NULL;
  39929. int _mark = p->mark;
  39930. { // ',' expression
  39931. if (p->error_indicator) {
  39932. p->level--;
  39933. return NULL;
  39934. }
  39935. D(fprintf(stderr, "%*c> _tmp_254[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
  39936. Token * _literal;
  39937. expr_ty c;
  39938. if (
  39939. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  39940. &&
  39941. (c = expression_rule(p)) // expression
  39942. )
  39943. {
  39944. D(fprintf(stderr, "%*c+ _tmp_254[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
  39945. _res = c;
  39946. if (_res == NULL && PyErr_Occurred()) {
  39947. p->error_indicator = 1;
  39948. p->level--;
  39949. return NULL;
  39950. }
  39951. goto done;
  39952. }
  39953. p->mark = _mark;
  39954. D(fprintf(stderr, "%*c%s _tmp_254[%d-%d]: %s failed!\n", p->level, ' ',
  39955. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
  39956. }
  39957. _res = NULL;
  39958. done:
  39959. p->level--;
  39960. return _res;
  39961. }
  39962. // _tmp_255: ',' star_expression
  39963. static void *
  39964. _tmp_255_rule(Parser *p)
  39965. {
  39966. if (p->level++ == MAXSTACK) {
  39967. _Pypegen_stack_overflow(p);
  39968. }
  39969. if (p->error_indicator) {
  39970. p->level--;
  39971. return NULL;
  39972. }
  39973. void * _res = NULL;
  39974. int _mark = p->mark;
  39975. { // ',' star_expression
  39976. if (p->error_indicator) {
  39977. p->level--;
  39978. return NULL;
  39979. }
  39980. D(fprintf(stderr, "%*c> _tmp_255[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
  39981. Token * _literal;
  39982. expr_ty c;
  39983. if (
  39984. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  39985. &&
  39986. (c = star_expression_rule(p)) // star_expression
  39987. )
  39988. {
  39989. D(fprintf(stderr, "%*c+ _tmp_255[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
  39990. _res = c;
  39991. if (_res == NULL && PyErr_Occurred()) {
  39992. p->error_indicator = 1;
  39993. p->level--;
  39994. return NULL;
  39995. }
  39996. goto done;
  39997. }
  39998. p->mark = _mark;
  39999. D(fprintf(stderr, "%*c%s _tmp_255[%d-%d]: %s failed!\n", p->level, ' ',
  40000. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
  40001. }
  40002. _res = NULL;
  40003. done:
  40004. p->level--;
  40005. return _res;
  40006. }
  40007. // _tmp_256: 'or' conjunction
  40008. static void *
  40009. _tmp_256_rule(Parser *p)
  40010. {
  40011. if (p->level++ == MAXSTACK) {
  40012. _Pypegen_stack_overflow(p);
  40013. }
  40014. if (p->error_indicator) {
  40015. p->level--;
  40016. return NULL;
  40017. }
  40018. void * _res = NULL;
  40019. int _mark = p->mark;
  40020. { // 'or' conjunction
  40021. if (p->error_indicator) {
  40022. p->level--;
  40023. return NULL;
  40024. }
  40025. D(fprintf(stderr, "%*c> _tmp_256[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
  40026. Token * _keyword;
  40027. expr_ty c;
  40028. if (
  40029. (_keyword = _PyPegen_expect_token(p, 574)) // token='or'
  40030. &&
  40031. (c = conjunction_rule(p)) // conjunction
  40032. )
  40033. {
  40034. D(fprintf(stderr, "%*c+ _tmp_256[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
  40035. _res = c;
  40036. if (_res == NULL && PyErr_Occurred()) {
  40037. p->error_indicator = 1;
  40038. p->level--;
  40039. return NULL;
  40040. }
  40041. goto done;
  40042. }
  40043. p->mark = _mark;
  40044. D(fprintf(stderr, "%*c%s _tmp_256[%d-%d]: %s failed!\n", p->level, ' ',
  40045. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction"));
  40046. }
  40047. _res = NULL;
  40048. done:
  40049. p->level--;
  40050. return _res;
  40051. }
  40052. // _tmp_257: 'and' inversion
  40053. static void *
  40054. _tmp_257_rule(Parser *p)
  40055. {
  40056. if (p->level++ == MAXSTACK) {
  40057. _Pypegen_stack_overflow(p);
  40058. }
  40059. if (p->error_indicator) {
  40060. p->level--;
  40061. return NULL;
  40062. }
  40063. void * _res = NULL;
  40064. int _mark = p->mark;
  40065. { // 'and' inversion
  40066. if (p->error_indicator) {
  40067. p->level--;
  40068. return NULL;
  40069. }
  40070. D(fprintf(stderr, "%*c> _tmp_257[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
  40071. Token * _keyword;
  40072. expr_ty c;
  40073. if (
  40074. (_keyword = _PyPegen_expect_token(p, 575)) // token='and'
  40075. &&
  40076. (c = inversion_rule(p)) // inversion
  40077. )
  40078. {
  40079. D(fprintf(stderr, "%*c+ _tmp_257[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
  40080. _res = c;
  40081. if (_res == NULL && PyErr_Occurred()) {
  40082. p->error_indicator = 1;
  40083. p->level--;
  40084. return NULL;
  40085. }
  40086. goto done;
  40087. }
  40088. p->mark = _mark;
  40089. D(fprintf(stderr, "%*c%s _tmp_257[%d-%d]: %s failed!\n", p->level, ' ',
  40090. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion"));
  40091. }
  40092. _res = NULL;
  40093. done:
  40094. p->level--;
  40095. return _res;
  40096. }
  40097. // _tmp_258: slice | starred_expression
  40098. static void *
  40099. _tmp_258_rule(Parser *p)
  40100. {
  40101. if (p->level++ == MAXSTACK) {
  40102. _Pypegen_stack_overflow(p);
  40103. }
  40104. if (p->error_indicator) {
  40105. p->level--;
  40106. return NULL;
  40107. }
  40108. void * _res = NULL;
  40109. int _mark = p->mark;
  40110. { // slice
  40111. if (p->error_indicator) {
  40112. p->level--;
  40113. return NULL;
  40114. }
  40115. D(fprintf(stderr, "%*c> _tmp_258[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice"));
  40116. expr_ty slice_var;
  40117. if (
  40118. (slice_var = slice_rule(p)) // slice
  40119. )
  40120. {
  40121. D(fprintf(stderr, "%*c+ _tmp_258[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice"));
  40122. _res = slice_var;
  40123. goto done;
  40124. }
  40125. p->mark = _mark;
  40126. D(fprintf(stderr, "%*c%s _tmp_258[%d-%d]: %s failed!\n", p->level, ' ',
  40127. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice"));
  40128. }
  40129. { // starred_expression
  40130. if (p->error_indicator) {
  40131. p->level--;
  40132. return NULL;
  40133. }
  40134. D(fprintf(stderr, "%*c> _tmp_258[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
  40135. expr_ty starred_expression_var;
  40136. if (
  40137. (starred_expression_var = starred_expression_rule(p)) // starred_expression
  40138. )
  40139. {
  40140. D(fprintf(stderr, "%*c+ _tmp_258[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
  40141. _res = starred_expression_var;
  40142. goto done;
  40143. }
  40144. p->mark = _mark;
  40145. D(fprintf(stderr, "%*c%s _tmp_258[%d-%d]: %s failed!\n", p->level, ' ',
  40146. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
  40147. }
  40148. _res = NULL;
  40149. done:
  40150. p->level--;
  40151. return _res;
  40152. }
  40153. // _tmp_259: fstring | string
  40154. static void *
  40155. _tmp_259_rule(Parser *p)
  40156. {
  40157. if (p->level++ == MAXSTACK) {
  40158. _Pypegen_stack_overflow(p);
  40159. }
  40160. if (p->error_indicator) {
  40161. p->level--;
  40162. return NULL;
  40163. }
  40164. void * _res = NULL;
  40165. int _mark = p->mark;
  40166. { // fstring
  40167. if (p->error_indicator) {
  40168. p->level--;
  40169. return NULL;
  40170. }
  40171. D(fprintf(stderr, "%*c> _tmp_259[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "fstring"));
  40172. expr_ty fstring_var;
  40173. if (
  40174. (fstring_var = fstring_rule(p)) // fstring
  40175. )
  40176. {
  40177. D(fprintf(stderr, "%*c+ _tmp_259[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "fstring"));
  40178. _res = fstring_var;
  40179. goto done;
  40180. }
  40181. p->mark = _mark;
  40182. D(fprintf(stderr, "%*c%s _tmp_259[%d-%d]: %s failed!\n", p->level, ' ',
  40183. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "fstring"));
  40184. }
  40185. { // string
  40186. if (p->error_indicator) {
  40187. p->level--;
  40188. return NULL;
  40189. }
  40190. D(fprintf(stderr, "%*c> _tmp_259[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "string"));
  40191. expr_ty string_var;
  40192. if (
  40193. (string_var = string_rule(p)) // string
  40194. )
  40195. {
  40196. D(fprintf(stderr, "%*c+ _tmp_259[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "string"));
  40197. _res = string_var;
  40198. goto done;
  40199. }
  40200. p->mark = _mark;
  40201. D(fprintf(stderr, "%*c%s _tmp_259[%d-%d]: %s failed!\n", p->level, ' ',
  40202. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "string"));
  40203. }
  40204. _res = NULL;
  40205. done:
  40206. p->level--;
  40207. return _res;
  40208. }
  40209. // _tmp_260: 'if' disjunction
  40210. static void *
  40211. _tmp_260_rule(Parser *p)
  40212. {
  40213. if (p->level++ == MAXSTACK) {
  40214. _Pypegen_stack_overflow(p);
  40215. }
  40216. if (p->error_indicator) {
  40217. p->level--;
  40218. return NULL;
  40219. }
  40220. void * _res = NULL;
  40221. int _mark = p->mark;
  40222. { // 'if' disjunction
  40223. if (p->error_indicator) {
  40224. p->level--;
  40225. return NULL;
  40226. }
  40227. D(fprintf(stderr, "%*c> _tmp_260[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
  40228. Token * _keyword;
  40229. expr_ty z;
  40230. if (
  40231. (_keyword = _PyPegen_expect_token(p, 642)) // token='if'
  40232. &&
  40233. (z = disjunction_rule(p)) // disjunction
  40234. )
  40235. {
  40236. D(fprintf(stderr, "%*c+ _tmp_260[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
  40237. _res = z;
  40238. if (_res == NULL && PyErr_Occurred()) {
  40239. p->error_indicator = 1;
  40240. p->level--;
  40241. return NULL;
  40242. }
  40243. goto done;
  40244. }
  40245. p->mark = _mark;
  40246. D(fprintf(stderr, "%*c%s _tmp_260[%d-%d]: %s failed!\n", p->level, ' ',
  40247. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
  40248. }
  40249. _res = NULL;
  40250. done:
  40251. p->level--;
  40252. return _res;
  40253. }
  40254. // _tmp_261: 'if' disjunction
  40255. static void *
  40256. _tmp_261_rule(Parser *p)
  40257. {
  40258. if (p->level++ == MAXSTACK) {
  40259. _Pypegen_stack_overflow(p);
  40260. }
  40261. if (p->error_indicator) {
  40262. p->level--;
  40263. return NULL;
  40264. }
  40265. void * _res = NULL;
  40266. int _mark = p->mark;
  40267. { // 'if' disjunction
  40268. if (p->error_indicator) {
  40269. p->level--;
  40270. return NULL;
  40271. }
  40272. D(fprintf(stderr, "%*c> _tmp_261[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
  40273. Token * _keyword;
  40274. expr_ty z;
  40275. if (
  40276. (_keyword = _PyPegen_expect_token(p, 642)) // token='if'
  40277. &&
  40278. (z = disjunction_rule(p)) // disjunction
  40279. )
  40280. {
  40281. D(fprintf(stderr, "%*c+ _tmp_261[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
  40282. _res = z;
  40283. if (_res == NULL && PyErr_Occurred()) {
  40284. p->error_indicator = 1;
  40285. p->level--;
  40286. return NULL;
  40287. }
  40288. goto done;
  40289. }
  40290. p->mark = _mark;
  40291. D(fprintf(stderr, "%*c%s _tmp_261[%d-%d]: %s failed!\n", p->level, ' ',
  40292. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
  40293. }
  40294. _res = NULL;
  40295. done:
  40296. p->level--;
  40297. return _res;
  40298. }
  40299. // _tmp_262: starred_expression | (assignment_expression | expression !':=') !'='
  40300. static void *
  40301. _tmp_262_rule(Parser *p)
  40302. {
  40303. if (p->level++ == MAXSTACK) {
  40304. _Pypegen_stack_overflow(p);
  40305. }
  40306. if (p->error_indicator) {
  40307. p->level--;
  40308. return NULL;
  40309. }
  40310. void * _res = NULL;
  40311. int _mark = p->mark;
  40312. { // starred_expression
  40313. if (p->error_indicator) {
  40314. p->level--;
  40315. return NULL;
  40316. }
  40317. D(fprintf(stderr, "%*c> _tmp_262[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
  40318. expr_ty starred_expression_var;
  40319. if (
  40320. (starred_expression_var = starred_expression_rule(p)) // starred_expression
  40321. )
  40322. {
  40323. D(fprintf(stderr, "%*c+ _tmp_262[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
  40324. _res = starred_expression_var;
  40325. goto done;
  40326. }
  40327. p->mark = _mark;
  40328. D(fprintf(stderr, "%*c%s _tmp_262[%d-%d]: %s failed!\n", p->level, ' ',
  40329. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
  40330. }
  40331. { // (assignment_expression | expression !':=') !'='
  40332. if (p->error_indicator) {
  40333. p->level--;
  40334. return NULL;
  40335. }
  40336. D(fprintf(stderr, "%*c> _tmp_262[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='"));
  40337. void *_tmp_276_var;
  40338. if (
  40339. (_tmp_276_var = _tmp_276_rule(p)) // assignment_expression | expression !':='
  40340. &&
  40341. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
  40342. )
  40343. {
  40344. D(fprintf(stderr, "%*c+ _tmp_262[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='"));
  40345. _res = _tmp_276_var;
  40346. goto done;
  40347. }
  40348. p->mark = _mark;
  40349. D(fprintf(stderr, "%*c%s _tmp_262[%d-%d]: %s failed!\n", p->level, ' ',
  40350. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(assignment_expression | expression !':=') !'='"));
  40351. }
  40352. _res = NULL;
  40353. done:
  40354. p->level--;
  40355. return _res;
  40356. }
  40357. // _tmp_263: ',' star_target
  40358. static void *
  40359. _tmp_263_rule(Parser *p)
  40360. {
  40361. if (p->level++ == MAXSTACK) {
  40362. _Pypegen_stack_overflow(p);
  40363. }
  40364. if (p->error_indicator) {
  40365. p->level--;
  40366. return NULL;
  40367. }
  40368. void * _res = NULL;
  40369. int _mark = p->mark;
  40370. { // ',' star_target
  40371. if (p->error_indicator) {
  40372. p->level--;
  40373. return NULL;
  40374. }
  40375. D(fprintf(stderr, "%*c> _tmp_263[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
  40376. Token * _literal;
  40377. expr_ty c;
  40378. if (
  40379. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  40380. &&
  40381. (c = star_target_rule(p)) // star_target
  40382. )
  40383. {
  40384. D(fprintf(stderr, "%*c+ _tmp_263[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target"));
  40385. _res = c;
  40386. if (_res == NULL && PyErr_Occurred()) {
  40387. p->error_indicator = 1;
  40388. p->level--;
  40389. return NULL;
  40390. }
  40391. goto done;
  40392. }
  40393. p->mark = _mark;
  40394. D(fprintf(stderr, "%*c%s _tmp_263[%d-%d]: %s failed!\n", p->level, ' ',
  40395. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
  40396. }
  40397. _res = NULL;
  40398. done:
  40399. p->level--;
  40400. return _res;
  40401. }
  40402. // _tmp_264: ',' star_target
  40403. static void *
  40404. _tmp_264_rule(Parser *p)
  40405. {
  40406. if (p->level++ == MAXSTACK) {
  40407. _Pypegen_stack_overflow(p);
  40408. }
  40409. if (p->error_indicator) {
  40410. p->level--;
  40411. return NULL;
  40412. }
  40413. void * _res = NULL;
  40414. int _mark = p->mark;
  40415. { // ',' star_target
  40416. if (p->error_indicator) {
  40417. p->level--;
  40418. return NULL;
  40419. }
  40420. D(fprintf(stderr, "%*c> _tmp_264[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
  40421. Token * _literal;
  40422. expr_ty c;
  40423. if (
  40424. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  40425. &&
  40426. (c = star_target_rule(p)) // star_target
  40427. )
  40428. {
  40429. D(fprintf(stderr, "%*c+ _tmp_264[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target"));
  40430. _res = c;
  40431. if (_res == NULL && PyErr_Occurred()) {
  40432. p->error_indicator = 1;
  40433. p->level--;
  40434. return NULL;
  40435. }
  40436. goto done;
  40437. }
  40438. p->mark = _mark;
  40439. D(fprintf(stderr, "%*c%s _tmp_264[%d-%d]: %s failed!\n", p->level, ' ',
  40440. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
  40441. }
  40442. _res = NULL;
  40443. done:
  40444. p->level--;
  40445. return _res;
  40446. }
  40447. // _tmp_265:
  40448. // | ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs
  40449. static void *
  40450. _tmp_265_rule(Parser *p)
  40451. {
  40452. if (p->level++ == MAXSTACK) {
  40453. _Pypegen_stack_overflow(p);
  40454. }
  40455. if (p->error_indicator) {
  40456. p->level--;
  40457. return NULL;
  40458. }
  40459. void * _res = NULL;
  40460. int _mark = p->mark;
  40461. { // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs
  40462. if (p->error_indicator) {
  40463. p->level--;
  40464. return NULL;
  40465. }
  40466. D(fprintf(stderr, "%*c> _tmp_265[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs"));
  40467. asdl_seq * _gather_277_var;
  40468. Token * _literal;
  40469. asdl_seq* kwargs_var;
  40470. if (
  40471. (_gather_277_var = _gather_277_rule(p)) // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+
  40472. &&
  40473. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  40474. &&
  40475. (kwargs_var = kwargs_rule(p)) // kwargs
  40476. )
  40477. {
  40478. D(fprintf(stderr, "%*c+ _tmp_265[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs"));
  40479. _res = _PyPegen_dummy_name(p, _gather_277_var, _literal, kwargs_var);
  40480. goto done;
  40481. }
  40482. p->mark = _mark;
  40483. D(fprintf(stderr, "%*c%s _tmp_265[%d-%d]: %s failed!\n", p->level, ' ',
  40484. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs"));
  40485. }
  40486. _res = NULL;
  40487. done:
  40488. p->level--;
  40489. return _res;
  40490. }
  40491. // _tmp_266: starred_expression !'='
  40492. static void *
  40493. _tmp_266_rule(Parser *p)
  40494. {
  40495. if (p->level++ == MAXSTACK) {
  40496. _Pypegen_stack_overflow(p);
  40497. }
  40498. if (p->error_indicator) {
  40499. p->level--;
  40500. return NULL;
  40501. }
  40502. void * _res = NULL;
  40503. int _mark = p->mark;
  40504. { // starred_expression !'='
  40505. if (p->error_indicator) {
  40506. p->level--;
  40507. return NULL;
  40508. }
  40509. D(fprintf(stderr, "%*c> _tmp_266[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression !'='"));
  40510. expr_ty starred_expression_var;
  40511. if (
  40512. (starred_expression_var = starred_expression_rule(p)) // starred_expression
  40513. &&
  40514. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
  40515. )
  40516. {
  40517. D(fprintf(stderr, "%*c+ _tmp_266[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression !'='"));
  40518. _res = starred_expression_var;
  40519. goto done;
  40520. }
  40521. p->mark = _mark;
  40522. D(fprintf(stderr, "%*c%s _tmp_266[%d-%d]: %s failed!\n", p->level, ' ',
  40523. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression !'='"));
  40524. }
  40525. _res = NULL;
  40526. done:
  40527. p->level--;
  40528. return _res;
  40529. }
  40530. // _tmp_267: star_targets '='
  40531. static void *
  40532. _tmp_267_rule(Parser *p)
  40533. {
  40534. if (p->level++ == MAXSTACK) {
  40535. _Pypegen_stack_overflow(p);
  40536. }
  40537. if (p->error_indicator) {
  40538. p->level--;
  40539. return NULL;
  40540. }
  40541. void * _res = NULL;
  40542. int _mark = p->mark;
  40543. { // star_targets '='
  40544. if (p->error_indicator) {
  40545. p->level--;
  40546. return NULL;
  40547. }
  40548. D(fprintf(stderr, "%*c> _tmp_267[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
  40549. Token * _literal;
  40550. expr_ty star_targets_var;
  40551. if (
  40552. (star_targets_var = star_targets_rule(p)) // star_targets
  40553. &&
  40554. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  40555. )
  40556. {
  40557. D(fprintf(stderr, "%*c+ _tmp_267[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
  40558. _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
  40559. goto done;
  40560. }
  40561. p->mark = _mark;
  40562. D(fprintf(stderr, "%*c%s _tmp_267[%d-%d]: %s failed!\n", p->level, ' ',
  40563. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
  40564. }
  40565. _res = NULL;
  40566. done:
  40567. p->level--;
  40568. return _res;
  40569. }
  40570. // _tmp_268: star_targets '='
  40571. static void *
  40572. _tmp_268_rule(Parser *p)
  40573. {
  40574. if (p->level++ == MAXSTACK) {
  40575. _Pypegen_stack_overflow(p);
  40576. }
  40577. if (p->error_indicator) {
  40578. p->level--;
  40579. return NULL;
  40580. }
  40581. void * _res = NULL;
  40582. int _mark = p->mark;
  40583. { // star_targets '='
  40584. if (p->error_indicator) {
  40585. p->level--;
  40586. return NULL;
  40587. }
  40588. D(fprintf(stderr, "%*c> _tmp_268[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
  40589. Token * _literal;
  40590. expr_ty star_targets_var;
  40591. if (
  40592. (star_targets_var = star_targets_rule(p)) // star_targets
  40593. &&
  40594. (_literal = _PyPegen_expect_token(p, 22)) // token='='
  40595. )
  40596. {
  40597. D(fprintf(stderr, "%*c+ _tmp_268[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
  40598. _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
  40599. goto done;
  40600. }
  40601. p->mark = _mark;
  40602. D(fprintf(stderr, "%*c%s _tmp_268[%d-%d]: %s failed!\n", p->level, ' ',
  40603. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
  40604. }
  40605. _res = NULL;
  40606. done:
  40607. p->level--;
  40608. return _res;
  40609. }
  40610. // _tmp_269: ')' | '**'
  40611. static void *
  40612. _tmp_269_rule(Parser *p)
  40613. {
  40614. if (p->level++ == MAXSTACK) {
  40615. _Pypegen_stack_overflow(p);
  40616. }
  40617. if (p->error_indicator) {
  40618. p->level--;
  40619. return NULL;
  40620. }
  40621. void * _res = NULL;
  40622. int _mark = p->mark;
  40623. { // ')'
  40624. if (p->error_indicator) {
  40625. p->level--;
  40626. return NULL;
  40627. }
  40628. D(fprintf(stderr, "%*c> _tmp_269[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
  40629. Token * _literal;
  40630. if (
  40631. (_literal = _PyPegen_expect_token(p, 8)) // token=')'
  40632. )
  40633. {
  40634. D(fprintf(stderr, "%*c+ _tmp_269[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
  40635. _res = _literal;
  40636. goto done;
  40637. }
  40638. p->mark = _mark;
  40639. D(fprintf(stderr, "%*c%s _tmp_269[%d-%d]: %s failed!\n", p->level, ' ',
  40640. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
  40641. }
  40642. { // '**'
  40643. if (p->error_indicator) {
  40644. p->level--;
  40645. return NULL;
  40646. }
  40647. D(fprintf(stderr, "%*c> _tmp_269[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
  40648. Token * _literal;
  40649. if (
  40650. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  40651. )
  40652. {
  40653. D(fprintf(stderr, "%*c+ _tmp_269[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
  40654. _res = _literal;
  40655. goto done;
  40656. }
  40657. p->mark = _mark;
  40658. D(fprintf(stderr, "%*c%s _tmp_269[%d-%d]: %s failed!\n", p->level, ' ',
  40659. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
  40660. }
  40661. _res = NULL;
  40662. done:
  40663. p->level--;
  40664. return _res;
  40665. }
  40666. // _tmp_270: ':' | '**'
  40667. static void *
  40668. _tmp_270_rule(Parser *p)
  40669. {
  40670. if (p->level++ == MAXSTACK) {
  40671. _Pypegen_stack_overflow(p);
  40672. }
  40673. if (p->error_indicator) {
  40674. p->level--;
  40675. return NULL;
  40676. }
  40677. void * _res = NULL;
  40678. int _mark = p->mark;
  40679. { // ':'
  40680. if (p->error_indicator) {
  40681. p->level--;
  40682. return NULL;
  40683. }
  40684. D(fprintf(stderr, "%*c> _tmp_270[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
  40685. Token * _literal;
  40686. if (
  40687. (_literal = _PyPegen_expect_token(p, 11)) // token=':'
  40688. )
  40689. {
  40690. D(fprintf(stderr, "%*c+ _tmp_270[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
  40691. _res = _literal;
  40692. goto done;
  40693. }
  40694. p->mark = _mark;
  40695. D(fprintf(stderr, "%*c%s _tmp_270[%d-%d]: %s failed!\n", p->level, ' ',
  40696. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
  40697. }
  40698. { // '**'
  40699. if (p->error_indicator) {
  40700. p->level--;
  40701. return NULL;
  40702. }
  40703. D(fprintf(stderr, "%*c> _tmp_270[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
  40704. Token * _literal;
  40705. if (
  40706. (_literal = _PyPegen_expect_token(p, 35)) // token='**'
  40707. )
  40708. {
  40709. D(fprintf(stderr, "%*c+ _tmp_270[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
  40710. _res = _literal;
  40711. goto done;
  40712. }
  40713. p->mark = _mark;
  40714. D(fprintf(stderr, "%*c%s _tmp_270[%d-%d]: %s failed!\n", p->level, ' ',
  40715. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
  40716. }
  40717. _res = NULL;
  40718. done:
  40719. p->level--;
  40720. return _res;
  40721. }
  40722. // _tmp_271: expression ['as' star_target]
  40723. static void *
  40724. _tmp_271_rule(Parser *p)
  40725. {
  40726. if (p->level++ == MAXSTACK) {
  40727. _Pypegen_stack_overflow(p);
  40728. }
  40729. if (p->error_indicator) {
  40730. p->level--;
  40731. return NULL;
  40732. }
  40733. void * _res = NULL;
  40734. int _mark = p->mark;
  40735. { // expression ['as' star_target]
  40736. if (p->error_indicator) {
  40737. p->level--;
  40738. return NULL;
  40739. }
  40740. D(fprintf(stderr, "%*c> _tmp_271[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]"));
  40741. void *_opt_var;
  40742. UNUSED(_opt_var); // Silence compiler warnings
  40743. expr_ty expression_var;
  40744. if (
  40745. (expression_var = expression_rule(p)) // expression
  40746. &&
  40747. (_opt_var = _tmp_279_rule(p), !p->error_indicator) // ['as' star_target]
  40748. )
  40749. {
  40750. D(fprintf(stderr, "%*c+ _tmp_271[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]"));
  40751. _res = _PyPegen_dummy_name(p, expression_var, _opt_var);
  40752. goto done;
  40753. }
  40754. p->mark = _mark;
  40755. D(fprintf(stderr, "%*c%s _tmp_271[%d-%d]: %s failed!\n", p->level, ' ',
  40756. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' star_target]"));
  40757. }
  40758. _res = NULL;
  40759. done:
  40760. p->level--;
  40761. return _res;
  40762. }
  40763. // _tmp_272: expressions ['as' star_target]
  40764. static void *
  40765. _tmp_272_rule(Parser *p)
  40766. {
  40767. if (p->level++ == MAXSTACK) {
  40768. _Pypegen_stack_overflow(p);
  40769. }
  40770. if (p->error_indicator) {
  40771. p->level--;
  40772. return NULL;
  40773. }
  40774. void * _res = NULL;
  40775. int _mark = p->mark;
  40776. { // expressions ['as' star_target]
  40777. if (p->error_indicator) {
  40778. p->level--;
  40779. return NULL;
  40780. }
  40781. D(fprintf(stderr, "%*c> _tmp_272[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]"));
  40782. void *_opt_var;
  40783. UNUSED(_opt_var); // Silence compiler warnings
  40784. expr_ty expressions_var;
  40785. if (
  40786. (expressions_var = expressions_rule(p)) // expressions
  40787. &&
  40788. (_opt_var = _tmp_280_rule(p), !p->error_indicator) // ['as' star_target]
  40789. )
  40790. {
  40791. D(fprintf(stderr, "%*c+ _tmp_272[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]"));
  40792. _res = _PyPegen_dummy_name(p, expressions_var, _opt_var);
  40793. goto done;
  40794. }
  40795. p->mark = _mark;
  40796. D(fprintf(stderr, "%*c%s _tmp_272[%d-%d]: %s failed!\n", p->level, ' ',
  40797. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions ['as' star_target]"));
  40798. }
  40799. _res = NULL;
  40800. done:
  40801. p->level--;
  40802. return _res;
  40803. }
  40804. // _tmp_273: expression ['as' star_target]
  40805. static void *
  40806. _tmp_273_rule(Parser *p)
  40807. {
  40808. if (p->level++ == MAXSTACK) {
  40809. _Pypegen_stack_overflow(p);
  40810. }
  40811. if (p->error_indicator) {
  40812. p->level--;
  40813. return NULL;
  40814. }
  40815. void * _res = NULL;
  40816. int _mark = p->mark;
  40817. { // expression ['as' star_target]
  40818. if (p->error_indicator) {
  40819. p->level--;
  40820. return NULL;
  40821. }
  40822. D(fprintf(stderr, "%*c> _tmp_273[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]"));
  40823. void *_opt_var;
  40824. UNUSED(_opt_var); // Silence compiler warnings
  40825. expr_ty expression_var;
  40826. if (
  40827. (expression_var = expression_rule(p)) // expression
  40828. &&
  40829. (_opt_var = _tmp_281_rule(p), !p->error_indicator) // ['as' star_target]
  40830. )
  40831. {
  40832. D(fprintf(stderr, "%*c+ _tmp_273[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]"));
  40833. _res = _PyPegen_dummy_name(p, expression_var, _opt_var);
  40834. goto done;
  40835. }
  40836. p->mark = _mark;
  40837. D(fprintf(stderr, "%*c%s _tmp_273[%d-%d]: %s failed!\n", p->level, ' ',
  40838. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' star_target]"));
  40839. }
  40840. _res = NULL;
  40841. done:
  40842. p->level--;
  40843. return _res;
  40844. }
  40845. // _tmp_274: expressions ['as' star_target]
  40846. static void *
  40847. _tmp_274_rule(Parser *p)
  40848. {
  40849. if (p->level++ == MAXSTACK) {
  40850. _Pypegen_stack_overflow(p);
  40851. }
  40852. if (p->error_indicator) {
  40853. p->level--;
  40854. return NULL;
  40855. }
  40856. void * _res = NULL;
  40857. int _mark = p->mark;
  40858. { // expressions ['as' star_target]
  40859. if (p->error_indicator) {
  40860. p->level--;
  40861. return NULL;
  40862. }
  40863. D(fprintf(stderr, "%*c> _tmp_274[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]"));
  40864. void *_opt_var;
  40865. UNUSED(_opt_var); // Silence compiler warnings
  40866. expr_ty expressions_var;
  40867. if (
  40868. (expressions_var = expressions_rule(p)) // expressions
  40869. &&
  40870. (_opt_var = _tmp_282_rule(p), !p->error_indicator) // ['as' star_target]
  40871. )
  40872. {
  40873. D(fprintf(stderr, "%*c+ _tmp_274[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]"));
  40874. _res = _PyPegen_dummy_name(p, expressions_var, _opt_var);
  40875. goto done;
  40876. }
  40877. p->mark = _mark;
  40878. D(fprintf(stderr, "%*c%s _tmp_274[%d-%d]: %s failed!\n", p->level, ' ',
  40879. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions ['as' star_target]"));
  40880. }
  40881. _res = NULL;
  40882. done:
  40883. p->level--;
  40884. return _res;
  40885. }
  40886. // _tmp_275: 'as' NAME
  40887. static void *
  40888. _tmp_275_rule(Parser *p)
  40889. {
  40890. if (p->level++ == MAXSTACK) {
  40891. _Pypegen_stack_overflow(p);
  40892. }
  40893. if (p->error_indicator) {
  40894. p->level--;
  40895. return NULL;
  40896. }
  40897. void * _res = NULL;
  40898. int _mark = p->mark;
  40899. { // 'as' NAME
  40900. if (p->error_indicator) {
  40901. p->level--;
  40902. return NULL;
  40903. }
  40904. D(fprintf(stderr, "%*c> _tmp_275[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  40905. Token * _keyword;
  40906. expr_ty name_var;
  40907. if (
  40908. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  40909. &&
  40910. (name_var = _PyPegen_name_token(p)) // NAME
  40911. )
  40912. {
  40913. D(fprintf(stderr, "%*c+ _tmp_275[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
  40914. _res = _PyPegen_dummy_name(p, _keyword, name_var);
  40915. goto done;
  40916. }
  40917. p->mark = _mark;
  40918. D(fprintf(stderr, "%*c%s _tmp_275[%d-%d]: %s failed!\n", p->level, ' ',
  40919. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
  40920. }
  40921. _res = NULL;
  40922. done:
  40923. p->level--;
  40924. return _res;
  40925. }
  40926. // _tmp_276: assignment_expression | expression !':='
  40927. static void *
  40928. _tmp_276_rule(Parser *p)
  40929. {
  40930. if (p->level++ == MAXSTACK) {
  40931. _Pypegen_stack_overflow(p);
  40932. }
  40933. if (p->error_indicator) {
  40934. p->level--;
  40935. return NULL;
  40936. }
  40937. void * _res = NULL;
  40938. int _mark = p->mark;
  40939. { // assignment_expression
  40940. if (p->error_indicator) {
  40941. p->level--;
  40942. return NULL;
  40943. }
  40944. D(fprintf(stderr, "%*c> _tmp_276[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
  40945. expr_ty assignment_expression_var;
  40946. if (
  40947. (assignment_expression_var = assignment_expression_rule(p)) // assignment_expression
  40948. )
  40949. {
  40950. D(fprintf(stderr, "%*c+ _tmp_276[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
  40951. _res = assignment_expression_var;
  40952. goto done;
  40953. }
  40954. p->mark = _mark;
  40955. D(fprintf(stderr, "%*c%s _tmp_276[%d-%d]: %s failed!\n", p->level, ' ',
  40956. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment_expression"));
  40957. }
  40958. { // expression !':='
  40959. if (p->error_indicator) {
  40960. p->level--;
  40961. return NULL;
  40962. }
  40963. D(fprintf(stderr, "%*c> _tmp_276[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
  40964. expr_ty expression_var;
  40965. if (
  40966. (expression_var = expression_rule(p)) // expression
  40967. &&
  40968. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':='
  40969. )
  40970. {
  40971. D(fprintf(stderr, "%*c+ _tmp_276[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
  40972. _res = expression_var;
  40973. goto done;
  40974. }
  40975. p->mark = _mark;
  40976. D(fprintf(stderr, "%*c%s _tmp_276[%d-%d]: %s failed!\n", p->level, ' ',
  40977. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
  40978. }
  40979. _res = NULL;
  40980. done:
  40981. p->level--;
  40982. return _res;
  40983. }
  40984. // _loop0_278: ',' (starred_expression | (assignment_expression | expression !':=') !'=')
  40985. static asdl_seq *
  40986. _loop0_278_rule(Parser *p)
  40987. {
  40988. if (p->level++ == MAXSTACK) {
  40989. _Pypegen_stack_overflow(p);
  40990. }
  40991. if (p->error_indicator) {
  40992. p->level--;
  40993. return NULL;
  40994. }
  40995. void *_res = NULL;
  40996. int _mark = p->mark;
  40997. void **_children = PyMem_Malloc(sizeof(void *));
  40998. if (!_children) {
  40999. p->error_indicator = 1;
  41000. PyErr_NoMemory();
  41001. p->level--;
  41002. return NULL;
  41003. }
  41004. Py_ssize_t _children_capacity = 1;
  41005. Py_ssize_t _n = 0;
  41006. { // ',' (starred_expression | (assignment_expression | expression !':=') !'=')
  41007. if (p->error_indicator) {
  41008. p->level--;
  41009. return NULL;
  41010. }
  41011. D(fprintf(stderr, "%*c> _loop0_278[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | (assignment_expression | expression !':=') !'=')"));
  41012. Token * _literal;
  41013. void *elem;
  41014. while (
  41015. (_literal = _PyPegen_expect_token(p, 12)) // token=','
  41016. &&
  41017. (elem = _tmp_283_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'='
  41018. )
  41019. {
  41020. _res = elem;
  41021. if (_res == NULL && PyErr_Occurred()) {
  41022. p->error_indicator = 1;
  41023. PyMem_Free(_children);
  41024. p->level--;
  41025. return NULL;
  41026. }
  41027. if (_n == _children_capacity) {
  41028. _children_capacity *= 2;
  41029. void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
  41030. if (!_new_children) {
  41031. PyMem_Free(_children);
  41032. p->error_indicator = 1;
  41033. PyErr_NoMemory();
  41034. p->level--;
  41035. return NULL;
  41036. }
  41037. _children = _new_children;
  41038. }
  41039. _children[_n++] = _res;
  41040. _mark = p->mark;
  41041. }
  41042. p->mark = _mark;
  41043. D(fprintf(stderr, "%*c%s _loop0_278[%d-%d]: %s failed!\n", p->level, ' ',
  41044. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | (assignment_expression | expression !':=') !'=')"));
  41045. }
  41046. asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
  41047. if (!_seq) {
  41048. PyMem_Free(_children);
  41049. p->error_indicator = 1;
  41050. PyErr_NoMemory();
  41051. p->level--;
  41052. return NULL;
  41053. }
  41054. for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
  41055. PyMem_Free(_children);
  41056. p->level--;
  41057. return _seq;
  41058. }
  41059. // _gather_277:
  41060. // | (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_278
  41061. static asdl_seq *
  41062. _gather_277_rule(Parser *p)
  41063. {
  41064. if (p->level++ == MAXSTACK) {
  41065. _Pypegen_stack_overflow(p);
  41066. }
  41067. if (p->error_indicator) {
  41068. p->level--;
  41069. return NULL;
  41070. }
  41071. asdl_seq * _res = NULL;
  41072. int _mark = p->mark;
  41073. { // (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_278
  41074. if (p->error_indicator) {
  41075. p->level--;
  41076. return NULL;
  41077. }
  41078. D(fprintf(stderr, "%*c> _gather_277[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_278"));
  41079. void *elem;
  41080. asdl_seq * seq;
  41081. if (
  41082. (elem = _tmp_283_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'='
  41083. &&
  41084. (seq = _loop0_278_rule(p)) // _loop0_278
  41085. )
  41086. {
  41087. D(fprintf(stderr, "%*c+ _gather_277[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_278"));
  41088. _res = _PyPegen_seq_insert_in_front(p, elem, seq);
  41089. goto done;
  41090. }
  41091. p->mark = _mark;
  41092. D(fprintf(stderr, "%*c%s _gather_277[%d-%d]: %s failed!\n", p->level, ' ',
  41093. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_278"));
  41094. }
  41095. _res = NULL;
  41096. done:
  41097. p->level--;
  41098. return _res;
  41099. }
  41100. // _tmp_279: 'as' star_target
  41101. static void *
  41102. _tmp_279_rule(Parser *p)
  41103. {
  41104. if (p->level++ == MAXSTACK) {
  41105. _Pypegen_stack_overflow(p);
  41106. }
  41107. if (p->error_indicator) {
  41108. p->level--;
  41109. return NULL;
  41110. }
  41111. void * _res = NULL;
  41112. int _mark = p->mark;
  41113. { // 'as' star_target
  41114. if (p->error_indicator) {
  41115. p->level--;
  41116. return NULL;
  41117. }
  41118. D(fprintf(stderr, "%*c> _tmp_279[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
  41119. Token * _keyword;
  41120. expr_ty star_target_var;
  41121. if (
  41122. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  41123. &&
  41124. (star_target_var = star_target_rule(p)) // star_target
  41125. )
  41126. {
  41127. D(fprintf(stderr, "%*c+ _tmp_279[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
  41128. _res = _PyPegen_dummy_name(p, _keyword, star_target_var);
  41129. goto done;
  41130. }
  41131. p->mark = _mark;
  41132. D(fprintf(stderr, "%*c%s _tmp_279[%d-%d]: %s failed!\n", p->level, ' ',
  41133. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target"));
  41134. }
  41135. _res = NULL;
  41136. done:
  41137. p->level--;
  41138. return _res;
  41139. }
  41140. // _tmp_280: 'as' star_target
  41141. static void *
  41142. _tmp_280_rule(Parser *p)
  41143. {
  41144. if (p->level++ == MAXSTACK) {
  41145. _Pypegen_stack_overflow(p);
  41146. }
  41147. if (p->error_indicator) {
  41148. p->level--;
  41149. return NULL;
  41150. }
  41151. void * _res = NULL;
  41152. int _mark = p->mark;
  41153. { // 'as' star_target
  41154. if (p->error_indicator) {
  41155. p->level--;
  41156. return NULL;
  41157. }
  41158. D(fprintf(stderr, "%*c> _tmp_280[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
  41159. Token * _keyword;
  41160. expr_ty star_target_var;
  41161. if (
  41162. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  41163. &&
  41164. (star_target_var = star_target_rule(p)) // star_target
  41165. )
  41166. {
  41167. D(fprintf(stderr, "%*c+ _tmp_280[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
  41168. _res = _PyPegen_dummy_name(p, _keyword, star_target_var);
  41169. goto done;
  41170. }
  41171. p->mark = _mark;
  41172. D(fprintf(stderr, "%*c%s _tmp_280[%d-%d]: %s failed!\n", p->level, ' ',
  41173. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target"));
  41174. }
  41175. _res = NULL;
  41176. done:
  41177. p->level--;
  41178. return _res;
  41179. }
  41180. // _tmp_281: 'as' star_target
  41181. static void *
  41182. _tmp_281_rule(Parser *p)
  41183. {
  41184. if (p->level++ == MAXSTACK) {
  41185. _Pypegen_stack_overflow(p);
  41186. }
  41187. if (p->error_indicator) {
  41188. p->level--;
  41189. return NULL;
  41190. }
  41191. void * _res = NULL;
  41192. int _mark = p->mark;
  41193. { // 'as' star_target
  41194. if (p->error_indicator) {
  41195. p->level--;
  41196. return NULL;
  41197. }
  41198. D(fprintf(stderr, "%*c> _tmp_281[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
  41199. Token * _keyword;
  41200. expr_ty star_target_var;
  41201. if (
  41202. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  41203. &&
  41204. (star_target_var = star_target_rule(p)) // star_target
  41205. )
  41206. {
  41207. D(fprintf(stderr, "%*c+ _tmp_281[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
  41208. _res = _PyPegen_dummy_name(p, _keyword, star_target_var);
  41209. goto done;
  41210. }
  41211. p->mark = _mark;
  41212. D(fprintf(stderr, "%*c%s _tmp_281[%d-%d]: %s failed!\n", p->level, ' ',
  41213. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target"));
  41214. }
  41215. _res = NULL;
  41216. done:
  41217. p->level--;
  41218. return _res;
  41219. }
  41220. // _tmp_282: 'as' star_target
  41221. static void *
  41222. _tmp_282_rule(Parser *p)
  41223. {
  41224. if (p->level++ == MAXSTACK) {
  41225. _Pypegen_stack_overflow(p);
  41226. }
  41227. if (p->error_indicator) {
  41228. p->level--;
  41229. return NULL;
  41230. }
  41231. void * _res = NULL;
  41232. int _mark = p->mark;
  41233. { // 'as' star_target
  41234. if (p->error_indicator) {
  41235. p->level--;
  41236. return NULL;
  41237. }
  41238. D(fprintf(stderr, "%*c> _tmp_282[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
  41239. Token * _keyword;
  41240. expr_ty star_target_var;
  41241. if (
  41242. (_keyword = _PyPegen_expect_token(p, 640)) // token='as'
  41243. &&
  41244. (star_target_var = star_target_rule(p)) // star_target
  41245. )
  41246. {
  41247. D(fprintf(stderr, "%*c+ _tmp_282[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
  41248. _res = _PyPegen_dummy_name(p, _keyword, star_target_var);
  41249. goto done;
  41250. }
  41251. p->mark = _mark;
  41252. D(fprintf(stderr, "%*c%s _tmp_282[%d-%d]: %s failed!\n", p->level, ' ',
  41253. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target"));
  41254. }
  41255. _res = NULL;
  41256. done:
  41257. p->level--;
  41258. return _res;
  41259. }
  41260. // _tmp_283: starred_expression | (assignment_expression | expression !':=') !'='
  41261. static void *
  41262. _tmp_283_rule(Parser *p)
  41263. {
  41264. if (p->level++ == MAXSTACK) {
  41265. _Pypegen_stack_overflow(p);
  41266. }
  41267. if (p->error_indicator) {
  41268. p->level--;
  41269. return NULL;
  41270. }
  41271. void * _res = NULL;
  41272. int _mark = p->mark;
  41273. { // starred_expression
  41274. if (p->error_indicator) {
  41275. p->level--;
  41276. return NULL;
  41277. }
  41278. D(fprintf(stderr, "%*c> _tmp_283[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
  41279. expr_ty starred_expression_var;
  41280. if (
  41281. (starred_expression_var = starred_expression_rule(p)) // starred_expression
  41282. )
  41283. {
  41284. D(fprintf(stderr, "%*c+ _tmp_283[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
  41285. _res = starred_expression_var;
  41286. goto done;
  41287. }
  41288. p->mark = _mark;
  41289. D(fprintf(stderr, "%*c%s _tmp_283[%d-%d]: %s failed!\n", p->level, ' ',
  41290. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
  41291. }
  41292. { // (assignment_expression | expression !':=') !'='
  41293. if (p->error_indicator) {
  41294. p->level--;
  41295. return NULL;
  41296. }
  41297. D(fprintf(stderr, "%*c> _tmp_283[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='"));
  41298. void *_tmp_284_var;
  41299. if (
  41300. (_tmp_284_var = _tmp_284_rule(p)) // assignment_expression | expression !':='
  41301. &&
  41302. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
  41303. )
  41304. {
  41305. D(fprintf(stderr, "%*c+ _tmp_283[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='"));
  41306. _res = _tmp_284_var;
  41307. goto done;
  41308. }
  41309. p->mark = _mark;
  41310. D(fprintf(stderr, "%*c%s _tmp_283[%d-%d]: %s failed!\n", p->level, ' ',
  41311. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(assignment_expression | expression !':=') !'='"));
  41312. }
  41313. _res = NULL;
  41314. done:
  41315. p->level--;
  41316. return _res;
  41317. }
  41318. // _tmp_284: assignment_expression | expression !':='
  41319. static void *
  41320. _tmp_284_rule(Parser *p)
  41321. {
  41322. if (p->level++ == MAXSTACK) {
  41323. _Pypegen_stack_overflow(p);
  41324. }
  41325. if (p->error_indicator) {
  41326. p->level--;
  41327. return NULL;
  41328. }
  41329. void * _res = NULL;
  41330. int _mark = p->mark;
  41331. { // assignment_expression
  41332. if (p->error_indicator) {
  41333. p->level--;
  41334. return NULL;
  41335. }
  41336. D(fprintf(stderr, "%*c> _tmp_284[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
  41337. expr_ty assignment_expression_var;
  41338. if (
  41339. (assignment_expression_var = assignment_expression_rule(p)) // assignment_expression
  41340. )
  41341. {
  41342. D(fprintf(stderr, "%*c+ _tmp_284[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
  41343. _res = assignment_expression_var;
  41344. goto done;
  41345. }
  41346. p->mark = _mark;
  41347. D(fprintf(stderr, "%*c%s _tmp_284[%d-%d]: %s failed!\n", p->level, ' ',
  41348. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment_expression"));
  41349. }
  41350. { // expression !':='
  41351. if (p->error_indicator) {
  41352. p->level--;
  41353. return NULL;
  41354. }
  41355. D(fprintf(stderr, "%*c> _tmp_284[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
  41356. expr_ty expression_var;
  41357. if (
  41358. (expression_var = expression_rule(p)) // expression
  41359. &&
  41360. _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':='
  41361. )
  41362. {
  41363. D(fprintf(stderr, "%*c+ _tmp_284[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
  41364. _res = expression_var;
  41365. goto done;
  41366. }
  41367. p->mark = _mark;
  41368. D(fprintf(stderr, "%*c%s _tmp_284[%d-%d]: %s failed!\n", p->level, ' ',
  41369. p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
  41370. }
  41371. _res = NULL;
  41372. done:
  41373. p->level--;
  41374. return _res;
  41375. }
  41376. void *
  41377. _PyPegen_parse(Parser *p)
  41378. {
  41379. // Initialize keywords
  41380. p->keywords = reserved_keywords;
  41381. p->n_keyword_lists = n_keyword_lists;
  41382. p->soft_keywords = soft_keywords;
  41383. // Run parser
  41384. void *result = NULL;
  41385. if (p->start_rule == Py_file_input) {
  41386. result = file_rule(p);
  41387. } else if (p->start_rule == Py_single_input) {
  41388. result = interactive_rule(p);
  41389. } else if (p->start_rule == Py_eval_input) {
  41390. result = eval_rule(p);
  41391. } else if (p->start_rule == Py_func_type_input) {
  41392. result = func_type_rule(p);
  41393. }
  41394. return result;
  41395. }