apiparser_parser.go 136 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688
  1. // Code generated from tools/goctl/api/parser/g4/ApiParser.g4 by ANTLR 4.9. DO NOT EDIT.
  2. package api // ApiParser
  3. import (
  4. "fmt"
  5. "reflect"
  6. "strconv"
  7. "github.com/antlr/antlr4/runtime/Go/antlr"
  8. )
  9. // Suppress unused import errors
  10. var _ = fmt.Printf
  11. var _ = reflect.Copy
  12. var _ = strconv.Itoa
  13. var parserATN = []uint16{
  14. 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 25, 348,
  15. 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7,
  16. 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13,
  17. 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9,
  18. 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23,
  19. 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4,
  20. 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34,
  21. 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 3, 2, 7,
  22. 2, 78, 10, 2, 12, 2, 14, 2, 81, 11, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5,
  23. 3, 88, 10, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 5, 5, 98,
  24. 10, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 6, 7, 108, 10, 7,
  25. 13, 7, 14, 7, 109, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 10, 3,
  26. 10, 3, 10, 3, 10, 6, 10, 123, 10, 10, 13, 10, 14, 10, 124, 3, 10, 3, 10,
  27. 3, 11, 3, 11, 5, 11, 131, 10, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 13, 3,
  28. 13, 3, 13, 3, 13, 7, 13, 141, 10, 13, 12, 13, 14, 13, 144, 11, 13, 3, 13,
  29. 3, 13, 3, 14, 3, 14, 5, 14, 150, 10, 14, 3, 15, 3, 15, 5, 15, 154, 10,
  30. 15, 3, 16, 3, 16, 3, 16, 5, 16, 159, 10, 16, 3, 16, 3, 16, 7, 16, 163,
  31. 10, 16, 12, 16, 14, 16, 166, 11, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17,
  32. 5, 17, 173, 10, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 5, 18, 180, 10,
  33. 18, 3, 18, 3, 18, 7, 18, 184, 10, 18, 12, 18, 14, 18, 187, 11, 18, 3, 18,
  34. 3, 18, 3, 19, 3, 19, 3, 19, 5, 19, 194, 10, 19, 3, 19, 3, 19, 3, 20, 3,
  35. 20, 3, 20, 5, 20, 201, 10, 20, 3, 21, 3, 21, 3, 21, 3, 21, 5, 21, 207,
  36. 10, 21, 3, 22, 5, 22, 210, 10, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3,
  37. 23, 3, 23, 3, 23, 3, 23, 3, 23, 5, 23, 222, 10, 23, 3, 24, 3, 24, 3, 24,
  38. 3, 24, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 26, 3,
  39. 26, 3, 26, 3, 26, 3, 27, 5, 27, 241, 10, 27, 3, 27, 3, 27, 3, 28, 3, 28,
  40. 3, 28, 6, 28, 248, 10, 28, 13, 28, 14, 28, 249, 3, 28, 3, 28, 3, 29, 3,
  41. 29, 3, 29, 3, 29, 3, 29, 7, 29, 259, 10, 29, 12, 29, 14, 29, 262, 11, 29,
  42. 3, 29, 3, 29, 3, 30, 5, 30, 267, 10, 30, 3, 30, 3, 30, 5, 30, 271, 10,
  43. 30, 3, 30, 3, 30, 3, 31, 3, 31, 5, 31, 277, 10, 31, 3, 31, 6, 31, 280,
  44. 10, 31, 13, 31, 14, 31, 281, 3, 31, 5, 31, 285, 10, 31, 3, 31, 5, 31, 288,
  45. 10, 31, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 33, 5, 33, 297, 10,
  46. 33, 3, 33, 5, 33, 300, 10, 33, 3, 33, 5, 33, 303, 10, 33, 3, 34, 3, 34,
  47. 5, 34, 307, 10, 34, 3, 34, 3, 34, 3, 35, 3, 35, 5, 35, 313, 10, 35, 3,
  48. 35, 3, 35, 3, 36, 3, 36, 3, 36, 3, 36, 3, 37, 3, 37, 5, 37, 323, 10, 37,
  49. 6, 37, 325, 10, 37, 13, 37, 14, 37, 326, 3, 38, 3, 38, 3, 38, 3, 38, 7,
  50. 38, 333, 10, 38, 12, 38, 14, 38, 336, 11, 38, 3, 38, 3, 38, 3, 38, 3, 38,
  51. 5, 38, 342, 10, 38, 6, 38, 344, 10, 38, 13, 38, 14, 38, 345, 3, 38, 2,
  52. 2, 39, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34,
  53. 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70,
  54. 72, 74, 2, 2, 2, 357, 2, 79, 3, 2, 2, 2, 4, 87, 3, 2, 2, 2, 6, 89, 3, 2,
  55. 2, 2, 8, 97, 3, 2, 2, 2, 10, 99, 3, 2, 2, 2, 12, 103, 3, 2, 2, 2, 14, 113,
  56. 3, 2, 2, 2, 16, 115, 3, 2, 2, 2, 18, 118, 3, 2, 2, 2, 20, 130, 3, 2, 2,
  57. 2, 22, 132, 3, 2, 2, 2, 24, 136, 3, 2, 2, 2, 26, 149, 3, 2, 2, 2, 28, 153,
  58. 3, 2, 2, 2, 30, 155, 3, 2, 2, 2, 32, 169, 3, 2, 2, 2, 34, 176, 3, 2, 2,
  59. 2, 36, 190, 3, 2, 2, 2, 38, 200, 3, 2, 2, 2, 40, 202, 3, 2, 2, 2, 42, 209,
  60. 3, 2, 2, 2, 44, 221, 3, 2, 2, 2, 46, 223, 3, 2, 2, 2, 48, 227, 3, 2, 2,
  61. 2, 50, 235, 3, 2, 2, 2, 52, 240, 3, 2, 2, 2, 54, 244, 3, 2, 2, 2, 56, 253,
  62. 3, 2, 2, 2, 58, 266, 3, 2, 2, 2, 60, 274, 3, 2, 2, 2, 62, 289, 3, 2, 2,
  63. 2, 64, 292, 3, 2, 2, 2, 66, 304, 3, 2, 2, 2, 68, 310, 3, 2, 2, 2, 70, 316,
  64. 3, 2, 2, 2, 72, 324, 3, 2, 2, 2, 74, 343, 3, 2, 2, 2, 76, 78, 5, 4, 3,
  65. 2, 77, 76, 3, 2, 2, 2, 78, 81, 3, 2, 2, 2, 79, 77, 3, 2, 2, 2, 79, 80,
  66. 3, 2, 2, 2, 80, 3, 3, 2, 2, 2, 81, 79, 3, 2, 2, 2, 82, 88, 5, 6, 4, 2,
  67. 83, 88, 5, 8, 5, 2, 84, 88, 5, 18, 10, 2, 85, 88, 5, 20, 11, 2, 86, 88,
  68. 5, 52, 27, 2, 87, 82, 3, 2, 2, 2, 87, 83, 3, 2, 2, 2, 87, 84, 3, 2, 2,
  69. 2, 87, 85, 3, 2, 2, 2, 87, 86, 3, 2, 2, 2, 88, 5, 3, 2, 2, 2, 89, 90, 8,
  70. 4, 1, 2, 90, 91, 7, 25, 2, 2, 91, 92, 7, 3, 2, 2, 92, 93, 8, 4, 1, 2, 93,
  71. 94, 7, 22, 2, 2, 94, 7, 3, 2, 2, 2, 95, 98, 5, 10, 6, 2, 96, 98, 5, 12,
  72. 7, 2, 97, 95, 3, 2, 2, 2, 97, 96, 3, 2, 2, 2, 98, 9, 3, 2, 2, 2, 99, 100,
  73. 8, 6, 1, 2, 100, 101, 7, 25, 2, 2, 101, 102, 5, 16, 9, 2, 102, 11, 3, 2,
  74. 2, 2, 103, 104, 8, 7, 1, 2, 104, 105, 7, 25, 2, 2, 105, 107, 7, 4, 2, 2,
  75. 106, 108, 5, 14, 8, 2, 107, 106, 3, 2, 2, 2, 108, 109, 3, 2, 2, 2, 109,
  76. 107, 3, 2, 2, 2, 109, 110, 3, 2, 2, 2, 110, 111, 3, 2, 2, 2, 111, 112,
  77. 7, 5, 2, 2, 112, 13, 3, 2, 2, 2, 113, 114, 5, 16, 9, 2, 114, 15, 3, 2,
  78. 2, 2, 115, 116, 8, 9, 1, 2, 116, 117, 7, 22, 2, 2, 117, 17, 3, 2, 2, 2,
  79. 118, 119, 8, 10, 1, 2, 119, 120, 7, 25, 2, 2, 120, 122, 7, 4, 2, 2, 121,
  80. 123, 5, 70, 36, 2, 122, 121, 3, 2, 2, 2, 123, 124, 3, 2, 2, 2, 124, 122,
  81. 3, 2, 2, 2, 124, 125, 3, 2, 2, 2, 125, 126, 3, 2, 2, 2, 126, 127, 7, 5,
  82. 2, 2, 127, 19, 3, 2, 2, 2, 128, 131, 5, 22, 12, 2, 129, 131, 5, 24, 13,
  83. 2, 130, 128, 3, 2, 2, 2, 130, 129, 3, 2, 2, 2, 131, 21, 3, 2, 2, 2, 132,
  84. 133, 8, 12, 1, 2, 133, 134, 7, 25, 2, 2, 134, 135, 5, 26, 14, 2, 135, 23,
  85. 3, 2, 2, 2, 136, 137, 8, 13, 1, 2, 137, 138, 7, 25, 2, 2, 138, 142, 7,
  86. 4, 2, 2, 139, 141, 5, 28, 15, 2, 140, 139, 3, 2, 2, 2, 141, 144, 3, 2,
  87. 2, 2, 142, 140, 3, 2, 2, 2, 142, 143, 3, 2, 2, 2, 143, 145, 3, 2, 2, 2,
  88. 144, 142, 3, 2, 2, 2, 145, 146, 7, 5, 2, 2, 146, 25, 3, 2, 2, 2, 147, 150,
  89. 5, 30, 16, 2, 148, 150, 5, 32, 17, 2, 149, 147, 3, 2, 2, 2, 149, 148, 3,
  90. 2, 2, 2, 150, 27, 3, 2, 2, 2, 151, 154, 5, 34, 18, 2, 152, 154, 5, 36,
  91. 19, 2, 153, 151, 3, 2, 2, 2, 153, 152, 3, 2, 2, 2, 154, 29, 3, 2, 2, 2,
  92. 155, 156, 8, 16, 1, 2, 156, 158, 7, 25, 2, 2, 157, 159, 7, 25, 2, 2, 158,
  93. 157, 3, 2, 2, 2, 158, 159, 3, 2, 2, 2, 159, 160, 3, 2, 2, 2, 160, 164,
  94. 7, 6, 2, 2, 161, 163, 5, 38, 20, 2, 162, 161, 3, 2, 2, 2, 163, 166, 3,
  95. 2, 2, 2, 164, 162, 3, 2, 2, 2, 164, 165, 3, 2, 2, 2, 165, 167, 3, 2, 2,
  96. 2, 166, 164, 3, 2, 2, 2, 167, 168, 7, 7, 2, 2, 168, 31, 3, 2, 2, 2, 169,
  97. 170, 8, 17, 1, 2, 170, 172, 7, 25, 2, 2, 171, 173, 7, 3, 2, 2, 172, 171,
  98. 3, 2, 2, 2, 172, 173, 3, 2, 2, 2, 173, 174, 3, 2, 2, 2, 174, 175, 5, 44,
  99. 23, 2, 175, 33, 3, 2, 2, 2, 176, 177, 8, 18, 1, 2, 177, 179, 7, 25, 2,
  100. 2, 178, 180, 7, 25, 2, 2, 179, 178, 3, 2, 2, 2, 179, 180, 3, 2, 2, 2, 180,
  101. 181, 3, 2, 2, 2, 181, 185, 7, 6, 2, 2, 182, 184, 5, 38, 20, 2, 183, 182,
  102. 3, 2, 2, 2, 184, 187, 3, 2, 2, 2, 185, 183, 3, 2, 2, 2, 185, 186, 3, 2,
  103. 2, 2, 186, 188, 3, 2, 2, 2, 187, 185, 3, 2, 2, 2, 188, 189, 7, 7, 2, 2,
  104. 189, 35, 3, 2, 2, 2, 190, 191, 8, 19, 1, 2, 191, 193, 7, 25, 2, 2, 192,
  105. 194, 7, 3, 2, 2, 193, 192, 3, 2, 2, 2, 193, 194, 3, 2, 2, 2, 194, 195,
  106. 3, 2, 2, 2, 195, 196, 5, 44, 23, 2, 196, 37, 3, 2, 2, 2, 197, 198, 6, 20,
  107. 2, 2, 198, 201, 5, 40, 21, 2, 199, 201, 5, 42, 22, 2, 200, 197, 3, 2, 2,
  108. 2, 200, 199, 3, 2, 2, 2, 201, 39, 3, 2, 2, 2, 202, 203, 8, 21, 1, 2, 203,
  109. 204, 7, 25, 2, 2, 204, 206, 5, 44, 23, 2, 205, 207, 7, 23, 2, 2, 206, 205,
  110. 3, 2, 2, 2, 206, 207, 3, 2, 2, 2, 207, 41, 3, 2, 2, 2, 208, 210, 7, 8,
  111. 2, 2, 209, 208, 3, 2, 2, 2, 209, 210, 3, 2, 2, 2, 210, 211, 3, 2, 2, 2,
  112. 211, 212, 7, 25, 2, 2, 212, 43, 3, 2, 2, 2, 213, 214, 8, 23, 1, 2, 214,
  113. 222, 7, 25, 2, 2, 215, 222, 5, 48, 25, 2, 216, 222, 5, 50, 26, 2, 217,
  114. 222, 7, 17, 2, 2, 218, 222, 7, 9, 2, 2, 219, 222, 5, 46, 24, 2, 220, 222,
  115. 5, 30, 16, 2, 221, 213, 3, 2, 2, 2, 221, 215, 3, 2, 2, 2, 221, 216, 3,
  116. 2, 2, 2, 221, 217, 3, 2, 2, 2, 221, 218, 3, 2, 2, 2, 221, 219, 3, 2, 2,
  117. 2, 221, 220, 3, 2, 2, 2, 222, 45, 3, 2, 2, 2, 223, 224, 7, 8, 2, 2, 224,
  118. 225, 8, 24, 1, 2, 225, 226, 7, 25, 2, 2, 226, 47, 3, 2, 2, 2, 227, 228,
  119. 8, 25, 1, 2, 228, 229, 7, 25, 2, 2, 229, 230, 7, 10, 2, 2, 230, 231, 8,
  120. 25, 1, 2, 231, 232, 7, 25, 2, 2, 232, 233, 7, 11, 2, 2, 233, 234, 5, 44,
  121. 23, 2, 234, 49, 3, 2, 2, 2, 235, 236, 7, 10, 2, 2, 236, 237, 7, 11, 2,
  122. 2, 237, 238, 5, 44, 23, 2, 238, 51, 3, 2, 2, 2, 239, 241, 5, 54, 28, 2,
  123. 240, 239, 3, 2, 2, 2, 240, 241, 3, 2, 2, 2, 241, 242, 3, 2, 2, 2, 242,
  124. 243, 5, 56, 29, 2, 243, 53, 3, 2, 2, 2, 244, 245, 7, 18, 2, 2, 245, 247,
  125. 7, 4, 2, 2, 246, 248, 5, 70, 36, 2, 247, 246, 3, 2, 2, 2, 248, 249, 3,
  126. 2, 2, 2, 249, 247, 3, 2, 2, 2, 249, 250, 3, 2, 2, 2, 250, 251, 3, 2, 2,
  127. 2, 251, 252, 7, 5, 2, 2, 252, 55, 3, 2, 2, 2, 253, 254, 8, 29, 1, 2, 254,
  128. 255, 7, 25, 2, 2, 255, 256, 5, 72, 37, 2, 256, 260, 7, 6, 2, 2, 257, 259,
  129. 5, 58, 30, 2, 258, 257, 3, 2, 2, 2, 259, 262, 3, 2, 2, 2, 260, 258, 3,
  130. 2, 2, 2, 260, 261, 3, 2, 2, 2, 261, 263, 3, 2, 2, 2, 262, 260, 3, 2, 2,
  131. 2, 263, 264, 7, 7, 2, 2, 264, 57, 3, 2, 2, 2, 265, 267, 5, 60, 31, 2, 266,
  132. 265, 3, 2, 2, 2, 266, 267, 3, 2, 2, 2, 267, 270, 3, 2, 2, 2, 268, 271,
  133. 5, 54, 28, 2, 269, 271, 5, 62, 32, 2, 270, 268, 3, 2, 2, 2, 270, 269, 3,
  134. 2, 2, 2, 271, 272, 3, 2, 2, 2, 272, 273, 5, 64, 33, 2, 273, 59, 3, 2, 2,
  135. 2, 274, 276, 7, 15, 2, 2, 275, 277, 7, 4, 2, 2, 276, 275, 3, 2, 2, 2, 276,
  136. 277, 3, 2, 2, 2, 277, 284, 3, 2, 2, 2, 278, 280, 5, 70, 36, 2, 279, 278,
  137. 3, 2, 2, 2, 280, 281, 3, 2, 2, 2, 281, 279, 3, 2, 2, 2, 281, 282, 3, 2,
  138. 2, 2, 282, 285, 3, 2, 2, 2, 283, 285, 7, 22, 2, 2, 284, 279, 3, 2, 2, 2,
  139. 284, 283, 3, 2, 2, 2, 285, 287, 3, 2, 2, 2, 286, 288, 7, 5, 2, 2, 287,
  140. 286, 3, 2, 2, 2, 287, 288, 3, 2, 2, 2, 288, 61, 3, 2, 2, 2, 289, 290, 7,
  141. 16, 2, 2, 290, 291, 7, 25, 2, 2, 291, 63, 3, 2, 2, 2, 292, 293, 8, 33,
  142. 1, 2, 293, 294, 7, 25, 2, 2, 294, 296, 5, 74, 38, 2, 295, 297, 5, 66, 34,
  143. 2, 296, 295, 3, 2, 2, 2, 296, 297, 3, 2, 2, 2, 297, 299, 3, 2, 2, 2, 298,
  144. 300, 7, 25, 2, 2, 299, 298, 3, 2, 2, 2, 299, 300, 3, 2, 2, 2, 300, 302,
  145. 3, 2, 2, 2, 301, 303, 5, 68, 35, 2, 302, 301, 3, 2, 2, 2, 302, 303, 3,
  146. 2, 2, 2, 303, 65, 3, 2, 2, 2, 304, 306, 7, 4, 2, 2, 305, 307, 7, 25, 2,
  147. 2, 306, 305, 3, 2, 2, 2, 306, 307, 3, 2, 2, 2, 307, 308, 3, 2, 2, 2, 308,
  148. 309, 7, 5, 2, 2, 309, 67, 3, 2, 2, 2, 310, 312, 7, 4, 2, 2, 311, 313, 5,
  149. 44, 23, 2, 312, 311, 3, 2, 2, 2, 312, 313, 3, 2, 2, 2, 313, 314, 3, 2,
  150. 2, 2, 314, 315, 7, 5, 2, 2, 315, 69, 3, 2, 2, 2, 316, 317, 7, 25, 2, 2,
  151. 317, 318, 8, 36, 1, 2, 318, 319, 7, 24, 2, 2, 319, 71, 3, 2, 2, 2, 320,
  152. 322, 7, 25, 2, 2, 321, 323, 7, 12, 2, 2, 322, 321, 3, 2, 2, 2, 322, 323,
  153. 3, 2, 2, 2, 323, 325, 3, 2, 2, 2, 324, 320, 3, 2, 2, 2, 325, 326, 3, 2,
  154. 2, 2, 326, 324, 3, 2, 2, 2, 326, 327, 3, 2, 2, 2, 327, 73, 3, 2, 2, 2,
  155. 328, 329, 7, 13, 2, 2, 329, 334, 7, 25, 2, 2, 330, 331, 7, 12, 2, 2, 331,
  156. 333, 7, 25, 2, 2, 332, 330, 3, 2, 2, 2, 333, 336, 3, 2, 2, 2, 334, 332,
  157. 3, 2, 2, 2, 334, 335, 3, 2, 2, 2, 335, 344, 3, 2, 2, 2, 336, 334, 3, 2,
  158. 2, 2, 337, 338, 7, 14, 2, 2, 338, 341, 7, 25, 2, 2, 339, 340, 7, 12, 2,
  159. 2, 340, 342, 7, 25, 2, 2, 341, 339, 3, 2, 2, 2, 341, 342, 3, 2, 2, 2, 342,
  160. 344, 3, 2, 2, 2, 343, 328, 3, 2, 2, 2, 343, 337, 3, 2, 2, 2, 344, 345,
  161. 3, 2, 2, 2, 345, 343, 3, 2, 2, 2, 345, 346, 3, 2, 2, 2, 346, 75, 3, 2,
  162. 2, 2, 41, 79, 87, 97, 109, 124, 130, 142, 149, 153, 158, 164, 172, 179,
  163. 185, 193, 200, 206, 209, 221, 240, 249, 260, 266, 270, 276, 281, 284, 287,
  164. 296, 299, 302, 306, 312, 322, 326, 334, 341, 343, 345,
  165. }
  166. var literalNames = []string{
  167. "", "'='", "'('", "')'", "'{'", "'}'", "'*'", "'time.Time'", "'['", "']'",
  168. "'-'", "'/'", "'/:'", "'@doc'", "'@handler'", "'interface{}'", "'@server'",
  169. }
  170. var symbolicNames = []string{
  171. "", "", "", "", "", "", "", "", "", "", "", "", "", "ATDOC", "ATHANDLER",
  172. "INTERFACE", "ATSERVER", "WS", "COMMENT", "LINE_COMMENT", "STRING", "RAW_STRING",
  173. "LINE_VALUE", "ID",
  174. }
  175. var ruleNames = []string{
  176. "api", "spec", "syntaxLit", "importSpec", "importLit", "importBlock", "importBlockValue",
  177. "importValue", "infoSpec", "typeSpec", "typeLit", "typeBlock", "typeLitBody",
  178. "typeBlockBody", "typeStruct", "typeAlias", "typeBlockStruct", "typeBlockAlias",
  179. "field", "normalField", "anonymousFiled", "dataType", "pointerType", "mapType",
  180. "arrayType", "serviceSpec", "atServer", "serviceApi", "serviceRoute", "atDoc",
  181. "atHandler", "route", "body", "replybody", "kvLit", "serviceName", "path",
  182. }
  183. type ApiParserParser struct {
  184. *antlr.BaseParser
  185. }
  186. // NewApiParserParser produces a new parser instance for the optional input antlr.TokenStream.
  187. //
  188. // The *ApiParserParser instance produced may be reused by calling the SetInputStream method.
  189. // The initial parser configuration is expensive to construct, and the object is not thread-safe;
  190. // however, if used within a Golang sync.Pool, the construction cost amortizes well and the
  191. // objects can be used in a thread-safe manner.
  192. func NewApiParserParser(input antlr.TokenStream) *ApiParserParser {
  193. this := new(ApiParserParser)
  194. deserializer := antlr.NewATNDeserializer(nil)
  195. deserializedATN := deserializer.DeserializeFromUInt16(parserATN)
  196. decisionToDFA := make([]*antlr.DFA, len(deserializedATN.DecisionToState))
  197. for index, ds := range deserializedATN.DecisionToState {
  198. decisionToDFA[index] = antlr.NewDFA(ds, index)
  199. }
  200. this.BaseParser = antlr.NewBaseParser(input)
  201. this.Interpreter = antlr.NewParserATNSimulator(this, deserializedATN, decisionToDFA, antlr.NewPredictionContextCache())
  202. this.RuleNames = ruleNames
  203. this.LiteralNames = literalNames
  204. this.SymbolicNames = symbolicNames
  205. this.GrammarFileName = "ApiParser.g4"
  206. return this
  207. }
  208. // ApiParserParser tokens.
  209. const (
  210. ApiParserParserEOF = antlr.TokenEOF
  211. ApiParserParserT__0 = 1
  212. ApiParserParserT__1 = 2
  213. ApiParserParserT__2 = 3
  214. ApiParserParserT__3 = 4
  215. ApiParserParserT__4 = 5
  216. ApiParserParserT__5 = 6
  217. ApiParserParserT__6 = 7
  218. ApiParserParserT__7 = 8
  219. ApiParserParserT__8 = 9
  220. ApiParserParserT__9 = 10
  221. ApiParserParserT__10 = 11
  222. ApiParserParserT__11 = 12
  223. ApiParserParserATDOC = 13
  224. ApiParserParserATHANDLER = 14
  225. ApiParserParserINTERFACE = 15
  226. ApiParserParserATSERVER = 16
  227. ApiParserParserWS = 17
  228. ApiParserParserCOMMENT = 18
  229. ApiParserParserLINE_COMMENT = 19
  230. ApiParserParserSTRING = 20
  231. ApiParserParserRAW_STRING = 21
  232. ApiParserParserLINE_VALUE = 22
  233. ApiParserParserID = 23
  234. )
  235. // ApiParserParser rules.
  236. const (
  237. ApiParserParserRULE_api = 0
  238. ApiParserParserRULE_spec = 1
  239. ApiParserParserRULE_syntaxLit = 2
  240. ApiParserParserRULE_importSpec = 3
  241. ApiParserParserRULE_importLit = 4
  242. ApiParserParserRULE_importBlock = 5
  243. ApiParserParserRULE_importBlockValue = 6
  244. ApiParserParserRULE_importValue = 7
  245. ApiParserParserRULE_infoSpec = 8
  246. ApiParserParserRULE_typeSpec = 9
  247. ApiParserParserRULE_typeLit = 10
  248. ApiParserParserRULE_typeBlock = 11
  249. ApiParserParserRULE_typeLitBody = 12
  250. ApiParserParserRULE_typeBlockBody = 13
  251. ApiParserParserRULE_typeStruct = 14
  252. ApiParserParserRULE_typeAlias = 15
  253. ApiParserParserRULE_typeBlockStruct = 16
  254. ApiParserParserRULE_typeBlockAlias = 17
  255. ApiParserParserRULE_field = 18
  256. ApiParserParserRULE_normalField = 19
  257. ApiParserParserRULE_anonymousFiled = 20
  258. ApiParserParserRULE_dataType = 21
  259. ApiParserParserRULE_pointerType = 22
  260. ApiParserParserRULE_mapType = 23
  261. ApiParserParserRULE_arrayType = 24
  262. ApiParserParserRULE_serviceSpec = 25
  263. ApiParserParserRULE_atServer = 26
  264. ApiParserParserRULE_serviceApi = 27
  265. ApiParserParserRULE_serviceRoute = 28
  266. ApiParserParserRULE_atDoc = 29
  267. ApiParserParserRULE_atHandler = 30
  268. ApiParserParserRULE_route = 31
  269. ApiParserParserRULE_body = 32
  270. ApiParserParserRULE_replybody = 33
  271. ApiParserParserRULE_kvLit = 34
  272. ApiParserParserRULE_serviceName = 35
  273. ApiParserParserRULE_path = 36
  274. )
  275. // IApiContext is an interface to support dynamic dispatch.
  276. type IApiContext interface {
  277. antlr.ParserRuleContext
  278. // GetParser returns the parser.
  279. GetParser() antlr.Parser
  280. // IsApiContext differentiates from other interfaces.
  281. IsApiContext()
  282. }
  283. type ApiContext struct {
  284. *antlr.BaseParserRuleContext
  285. parser antlr.Parser
  286. }
  287. func NewEmptyApiContext() *ApiContext {
  288. var p = new(ApiContext)
  289. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  290. p.RuleIndex = ApiParserParserRULE_api
  291. return p
  292. }
  293. func (*ApiContext) IsApiContext() {}
  294. func NewApiContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ApiContext {
  295. var p = new(ApiContext)
  296. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  297. p.parser = parser
  298. p.RuleIndex = ApiParserParserRULE_api
  299. return p
  300. }
  301. func (s *ApiContext) GetParser() antlr.Parser { return s.parser }
  302. func (s *ApiContext) AllSpec() []ISpecContext {
  303. var ts = s.GetTypedRuleContexts(reflect.TypeOf((*ISpecContext)(nil)).Elem())
  304. var tst = make([]ISpecContext, len(ts))
  305. for i, t := range ts {
  306. if t != nil {
  307. tst[i] = t.(ISpecContext)
  308. }
  309. }
  310. return tst
  311. }
  312. func (s *ApiContext) Spec(i int) ISpecContext {
  313. var t = s.GetTypedRuleContext(reflect.TypeOf((*ISpecContext)(nil)).Elem(), i)
  314. if t == nil {
  315. return nil
  316. }
  317. return t.(ISpecContext)
  318. }
  319. func (s *ApiContext) GetRuleContext() antlr.RuleContext {
  320. return s
  321. }
  322. func (s *ApiContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  323. return antlr.TreesStringTree(s, ruleNames, recog)
  324. }
  325. func (s *ApiContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  326. switch t := visitor.(type) {
  327. case ApiParserVisitor:
  328. return t.VisitApi(s)
  329. default:
  330. return t.VisitChildren(s)
  331. }
  332. }
  333. func (p *ApiParserParser) Api() (localctx IApiContext) {
  334. localctx = NewApiContext(p, p.GetParserRuleContext(), p.GetState())
  335. p.EnterRule(localctx, 0, ApiParserParserRULE_api)
  336. var _la int
  337. defer func() {
  338. p.ExitRule()
  339. }()
  340. defer func() {
  341. if err := recover(); err != nil {
  342. if v, ok := err.(antlr.RecognitionException); ok {
  343. localctx.SetException(v)
  344. p.GetErrorHandler().ReportError(p, v)
  345. p.GetErrorHandler().Recover(p, v)
  346. } else {
  347. panic(err)
  348. }
  349. }
  350. }()
  351. p.EnterOuterAlt(localctx, 1)
  352. p.SetState(77)
  353. p.GetErrorHandler().Sync(p)
  354. _la = p.GetTokenStream().LA(1)
  355. for _la == ApiParserParserATSERVER || _la == ApiParserParserID {
  356. {
  357. p.SetState(74)
  358. p.Spec()
  359. }
  360. p.SetState(79)
  361. p.GetErrorHandler().Sync(p)
  362. _la = p.GetTokenStream().LA(1)
  363. }
  364. return localctx
  365. }
  366. // ISpecContext is an interface to support dynamic dispatch.
  367. type ISpecContext interface {
  368. antlr.ParserRuleContext
  369. // GetParser returns the parser.
  370. GetParser() antlr.Parser
  371. // IsSpecContext differentiates from other interfaces.
  372. IsSpecContext()
  373. }
  374. type SpecContext struct {
  375. *antlr.BaseParserRuleContext
  376. parser antlr.Parser
  377. }
  378. func NewEmptySpecContext() *SpecContext {
  379. var p = new(SpecContext)
  380. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  381. p.RuleIndex = ApiParserParserRULE_spec
  382. return p
  383. }
  384. func (*SpecContext) IsSpecContext() {}
  385. func NewSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SpecContext {
  386. var p = new(SpecContext)
  387. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  388. p.parser = parser
  389. p.RuleIndex = ApiParserParserRULE_spec
  390. return p
  391. }
  392. func (s *SpecContext) GetParser() antlr.Parser { return s.parser }
  393. func (s *SpecContext) SyntaxLit() ISyntaxLitContext {
  394. var t = s.GetTypedRuleContext(reflect.TypeOf((*ISyntaxLitContext)(nil)).Elem(), 0)
  395. if t == nil {
  396. return nil
  397. }
  398. return t.(ISyntaxLitContext)
  399. }
  400. func (s *SpecContext) ImportSpec() IImportSpecContext {
  401. var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportSpecContext)(nil)).Elem(), 0)
  402. if t == nil {
  403. return nil
  404. }
  405. return t.(IImportSpecContext)
  406. }
  407. func (s *SpecContext) InfoSpec() IInfoSpecContext {
  408. var t = s.GetTypedRuleContext(reflect.TypeOf((*IInfoSpecContext)(nil)).Elem(), 0)
  409. if t == nil {
  410. return nil
  411. }
  412. return t.(IInfoSpecContext)
  413. }
  414. func (s *SpecContext) TypeSpec() ITypeSpecContext {
  415. var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeSpecContext)(nil)).Elem(), 0)
  416. if t == nil {
  417. return nil
  418. }
  419. return t.(ITypeSpecContext)
  420. }
  421. func (s *SpecContext) ServiceSpec() IServiceSpecContext {
  422. var t = s.GetTypedRuleContext(reflect.TypeOf((*IServiceSpecContext)(nil)).Elem(), 0)
  423. if t == nil {
  424. return nil
  425. }
  426. return t.(IServiceSpecContext)
  427. }
  428. func (s *SpecContext) GetRuleContext() antlr.RuleContext {
  429. return s
  430. }
  431. func (s *SpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  432. return antlr.TreesStringTree(s, ruleNames, recog)
  433. }
  434. func (s *SpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  435. switch t := visitor.(type) {
  436. case ApiParserVisitor:
  437. return t.VisitSpec(s)
  438. default:
  439. return t.VisitChildren(s)
  440. }
  441. }
  442. func (p *ApiParserParser) Spec() (localctx ISpecContext) {
  443. localctx = NewSpecContext(p, p.GetParserRuleContext(), p.GetState())
  444. p.EnterRule(localctx, 2, ApiParserParserRULE_spec)
  445. defer func() {
  446. p.ExitRule()
  447. }()
  448. defer func() {
  449. if err := recover(); err != nil {
  450. if v, ok := err.(antlr.RecognitionException); ok {
  451. localctx.SetException(v)
  452. p.GetErrorHandler().ReportError(p, v)
  453. p.GetErrorHandler().Recover(p, v)
  454. } else {
  455. panic(err)
  456. }
  457. }
  458. }()
  459. p.SetState(85)
  460. p.GetErrorHandler().Sync(p)
  461. switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 1, p.GetParserRuleContext()) {
  462. case 1:
  463. p.EnterOuterAlt(localctx, 1)
  464. {
  465. p.SetState(80)
  466. p.SyntaxLit()
  467. }
  468. case 2:
  469. p.EnterOuterAlt(localctx, 2)
  470. {
  471. p.SetState(81)
  472. p.ImportSpec()
  473. }
  474. case 3:
  475. p.EnterOuterAlt(localctx, 3)
  476. {
  477. p.SetState(82)
  478. p.InfoSpec()
  479. }
  480. case 4:
  481. p.EnterOuterAlt(localctx, 4)
  482. {
  483. p.SetState(83)
  484. p.TypeSpec()
  485. }
  486. case 5:
  487. p.EnterOuterAlt(localctx, 5)
  488. {
  489. p.SetState(84)
  490. p.ServiceSpec()
  491. }
  492. }
  493. return localctx
  494. }
  495. // ISyntaxLitContext is an interface to support dynamic dispatch.
  496. type ISyntaxLitContext interface {
  497. antlr.ParserRuleContext
  498. // GetParser returns the parser.
  499. GetParser() antlr.Parser
  500. // GetSyntaxToken returns the syntaxToken token.
  501. GetSyntaxToken() antlr.Token
  502. // GetAssign returns the assign token.
  503. GetAssign() antlr.Token
  504. // GetVersion returns the version token.
  505. GetVersion() antlr.Token
  506. // SetSyntaxToken sets the syntaxToken token.
  507. SetSyntaxToken(antlr.Token)
  508. // SetAssign sets the assign token.
  509. SetAssign(antlr.Token)
  510. // SetVersion sets the version token.
  511. SetVersion(antlr.Token)
  512. // IsSyntaxLitContext differentiates from other interfaces.
  513. IsSyntaxLitContext()
  514. }
  515. type SyntaxLitContext struct {
  516. *antlr.BaseParserRuleContext
  517. parser antlr.Parser
  518. syntaxToken antlr.Token
  519. assign antlr.Token
  520. version antlr.Token
  521. }
  522. func NewEmptySyntaxLitContext() *SyntaxLitContext {
  523. var p = new(SyntaxLitContext)
  524. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  525. p.RuleIndex = ApiParserParserRULE_syntaxLit
  526. return p
  527. }
  528. func (*SyntaxLitContext) IsSyntaxLitContext() {}
  529. func NewSyntaxLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SyntaxLitContext {
  530. var p = new(SyntaxLitContext)
  531. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  532. p.parser = parser
  533. p.RuleIndex = ApiParserParserRULE_syntaxLit
  534. return p
  535. }
  536. func (s *SyntaxLitContext) GetParser() antlr.Parser { return s.parser }
  537. func (s *SyntaxLitContext) GetSyntaxToken() antlr.Token { return s.syntaxToken }
  538. func (s *SyntaxLitContext) GetAssign() antlr.Token { return s.assign }
  539. func (s *SyntaxLitContext) GetVersion() antlr.Token { return s.version }
  540. func (s *SyntaxLitContext) SetSyntaxToken(v antlr.Token) { s.syntaxToken = v }
  541. func (s *SyntaxLitContext) SetAssign(v antlr.Token) { s.assign = v }
  542. func (s *SyntaxLitContext) SetVersion(v antlr.Token) { s.version = v }
  543. func (s *SyntaxLitContext) ID() antlr.TerminalNode {
  544. return s.GetToken(ApiParserParserID, 0)
  545. }
  546. func (s *SyntaxLitContext) STRING() antlr.TerminalNode {
  547. return s.GetToken(ApiParserParserSTRING, 0)
  548. }
  549. func (s *SyntaxLitContext) GetRuleContext() antlr.RuleContext {
  550. return s
  551. }
  552. func (s *SyntaxLitContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  553. return antlr.TreesStringTree(s, ruleNames, recog)
  554. }
  555. func (s *SyntaxLitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  556. switch t := visitor.(type) {
  557. case ApiParserVisitor:
  558. return t.VisitSyntaxLit(s)
  559. default:
  560. return t.VisitChildren(s)
  561. }
  562. }
  563. func (p *ApiParserParser) SyntaxLit() (localctx ISyntaxLitContext) {
  564. localctx = NewSyntaxLitContext(p, p.GetParserRuleContext(), p.GetState())
  565. p.EnterRule(localctx, 4, ApiParserParserRULE_syntaxLit)
  566. defer func() {
  567. p.ExitRule()
  568. }()
  569. defer func() {
  570. if err := recover(); err != nil {
  571. if v, ok := err.(antlr.RecognitionException); ok {
  572. localctx.SetException(v)
  573. p.GetErrorHandler().ReportError(p, v)
  574. p.GetErrorHandler().Recover(p, v)
  575. } else {
  576. panic(err)
  577. }
  578. }
  579. }()
  580. p.EnterOuterAlt(localctx, 1)
  581. match(p, "syntax")
  582. {
  583. p.SetState(88)
  584. var _m = p.Match(ApiParserParserID)
  585. localctx.(*SyntaxLitContext).syntaxToken = _m
  586. }
  587. {
  588. p.SetState(89)
  589. var _m = p.Match(ApiParserParserT__0)
  590. localctx.(*SyntaxLitContext).assign = _m
  591. }
  592. checkVersion(p)
  593. {
  594. p.SetState(91)
  595. var _m = p.Match(ApiParserParserSTRING)
  596. localctx.(*SyntaxLitContext).version = _m
  597. }
  598. return localctx
  599. }
  600. // IImportSpecContext is an interface to support dynamic dispatch.
  601. type IImportSpecContext interface {
  602. antlr.ParserRuleContext
  603. // GetParser returns the parser.
  604. GetParser() antlr.Parser
  605. // IsImportSpecContext differentiates from other interfaces.
  606. IsImportSpecContext()
  607. }
  608. type ImportSpecContext struct {
  609. *antlr.BaseParserRuleContext
  610. parser antlr.Parser
  611. }
  612. func NewEmptyImportSpecContext() *ImportSpecContext {
  613. var p = new(ImportSpecContext)
  614. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  615. p.RuleIndex = ApiParserParserRULE_importSpec
  616. return p
  617. }
  618. func (*ImportSpecContext) IsImportSpecContext() {}
  619. func NewImportSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportSpecContext {
  620. var p = new(ImportSpecContext)
  621. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  622. p.parser = parser
  623. p.RuleIndex = ApiParserParserRULE_importSpec
  624. return p
  625. }
  626. func (s *ImportSpecContext) GetParser() antlr.Parser { return s.parser }
  627. func (s *ImportSpecContext) ImportLit() IImportLitContext {
  628. var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportLitContext)(nil)).Elem(), 0)
  629. if t == nil {
  630. return nil
  631. }
  632. return t.(IImportLitContext)
  633. }
  634. func (s *ImportSpecContext) ImportBlock() IImportBlockContext {
  635. var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportBlockContext)(nil)).Elem(), 0)
  636. if t == nil {
  637. return nil
  638. }
  639. return t.(IImportBlockContext)
  640. }
  641. func (s *ImportSpecContext) GetRuleContext() antlr.RuleContext {
  642. return s
  643. }
  644. func (s *ImportSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  645. return antlr.TreesStringTree(s, ruleNames, recog)
  646. }
  647. func (s *ImportSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  648. switch t := visitor.(type) {
  649. case ApiParserVisitor:
  650. return t.VisitImportSpec(s)
  651. default:
  652. return t.VisitChildren(s)
  653. }
  654. }
  655. func (p *ApiParserParser) ImportSpec() (localctx IImportSpecContext) {
  656. localctx = NewImportSpecContext(p, p.GetParserRuleContext(), p.GetState())
  657. p.EnterRule(localctx, 6, ApiParserParserRULE_importSpec)
  658. defer func() {
  659. p.ExitRule()
  660. }()
  661. defer func() {
  662. if err := recover(); err != nil {
  663. if v, ok := err.(antlr.RecognitionException); ok {
  664. localctx.SetException(v)
  665. p.GetErrorHandler().ReportError(p, v)
  666. p.GetErrorHandler().Recover(p, v)
  667. } else {
  668. panic(err)
  669. }
  670. }
  671. }()
  672. p.SetState(95)
  673. p.GetErrorHandler().Sync(p)
  674. switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 2, p.GetParserRuleContext()) {
  675. case 1:
  676. p.EnterOuterAlt(localctx, 1)
  677. {
  678. p.SetState(93)
  679. p.ImportLit()
  680. }
  681. case 2:
  682. p.EnterOuterAlt(localctx, 2)
  683. {
  684. p.SetState(94)
  685. p.ImportBlock()
  686. }
  687. }
  688. return localctx
  689. }
  690. // IImportLitContext is an interface to support dynamic dispatch.
  691. type IImportLitContext interface {
  692. antlr.ParserRuleContext
  693. // GetParser returns the parser.
  694. GetParser() antlr.Parser
  695. // GetImportToken returns the importToken token.
  696. GetImportToken() antlr.Token
  697. // SetImportToken sets the importToken token.
  698. SetImportToken(antlr.Token)
  699. // IsImportLitContext differentiates from other interfaces.
  700. IsImportLitContext()
  701. }
  702. type ImportLitContext struct {
  703. *antlr.BaseParserRuleContext
  704. parser antlr.Parser
  705. importToken antlr.Token
  706. }
  707. func NewEmptyImportLitContext() *ImportLitContext {
  708. var p = new(ImportLitContext)
  709. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  710. p.RuleIndex = ApiParserParserRULE_importLit
  711. return p
  712. }
  713. func (*ImportLitContext) IsImportLitContext() {}
  714. func NewImportLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportLitContext {
  715. var p = new(ImportLitContext)
  716. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  717. p.parser = parser
  718. p.RuleIndex = ApiParserParserRULE_importLit
  719. return p
  720. }
  721. func (s *ImportLitContext) GetParser() antlr.Parser { return s.parser }
  722. func (s *ImportLitContext) GetImportToken() antlr.Token { return s.importToken }
  723. func (s *ImportLitContext) SetImportToken(v antlr.Token) { s.importToken = v }
  724. func (s *ImportLitContext) ImportValue() IImportValueContext {
  725. var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportValueContext)(nil)).Elem(), 0)
  726. if t == nil {
  727. return nil
  728. }
  729. return t.(IImportValueContext)
  730. }
  731. func (s *ImportLitContext) ID() antlr.TerminalNode {
  732. return s.GetToken(ApiParserParserID, 0)
  733. }
  734. func (s *ImportLitContext) GetRuleContext() antlr.RuleContext {
  735. return s
  736. }
  737. func (s *ImportLitContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  738. return antlr.TreesStringTree(s, ruleNames, recog)
  739. }
  740. func (s *ImportLitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  741. switch t := visitor.(type) {
  742. case ApiParserVisitor:
  743. return t.VisitImportLit(s)
  744. default:
  745. return t.VisitChildren(s)
  746. }
  747. }
  748. func (p *ApiParserParser) ImportLit() (localctx IImportLitContext) {
  749. localctx = NewImportLitContext(p, p.GetParserRuleContext(), p.GetState())
  750. p.EnterRule(localctx, 8, ApiParserParserRULE_importLit)
  751. defer func() {
  752. p.ExitRule()
  753. }()
  754. defer func() {
  755. if err := recover(); err != nil {
  756. if v, ok := err.(antlr.RecognitionException); ok {
  757. localctx.SetException(v)
  758. p.GetErrorHandler().ReportError(p, v)
  759. p.GetErrorHandler().Recover(p, v)
  760. } else {
  761. panic(err)
  762. }
  763. }
  764. }()
  765. p.EnterOuterAlt(localctx, 1)
  766. match(p, "import")
  767. {
  768. p.SetState(98)
  769. var _m = p.Match(ApiParserParserID)
  770. localctx.(*ImportLitContext).importToken = _m
  771. }
  772. {
  773. p.SetState(99)
  774. p.ImportValue()
  775. }
  776. return localctx
  777. }
  778. // IImportBlockContext is an interface to support dynamic dispatch.
  779. type IImportBlockContext interface {
  780. antlr.ParserRuleContext
  781. // GetParser returns the parser.
  782. GetParser() antlr.Parser
  783. // GetImportToken returns the importToken token.
  784. GetImportToken() antlr.Token
  785. // SetImportToken sets the importToken token.
  786. SetImportToken(antlr.Token)
  787. // IsImportBlockContext differentiates from other interfaces.
  788. IsImportBlockContext()
  789. }
  790. type ImportBlockContext struct {
  791. *antlr.BaseParserRuleContext
  792. parser antlr.Parser
  793. importToken antlr.Token
  794. }
  795. func NewEmptyImportBlockContext() *ImportBlockContext {
  796. var p = new(ImportBlockContext)
  797. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  798. p.RuleIndex = ApiParserParserRULE_importBlock
  799. return p
  800. }
  801. func (*ImportBlockContext) IsImportBlockContext() {}
  802. func NewImportBlockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportBlockContext {
  803. var p = new(ImportBlockContext)
  804. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  805. p.parser = parser
  806. p.RuleIndex = ApiParserParserRULE_importBlock
  807. return p
  808. }
  809. func (s *ImportBlockContext) GetParser() antlr.Parser { return s.parser }
  810. func (s *ImportBlockContext) GetImportToken() antlr.Token { return s.importToken }
  811. func (s *ImportBlockContext) SetImportToken(v antlr.Token) { s.importToken = v }
  812. func (s *ImportBlockContext) ID() antlr.TerminalNode {
  813. return s.GetToken(ApiParserParserID, 0)
  814. }
  815. func (s *ImportBlockContext) AllImportBlockValue() []IImportBlockValueContext {
  816. var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IImportBlockValueContext)(nil)).Elem())
  817. var tst = make([]IImportBlockValueContext, len(ts))
  818. for i, t := range ts {
  819. if t != nil {
  820. tst[i] = t.(IImportBlockValueContext)
  821. }
  822. }
  823. return tst
  824. }
  825. func (s *ImportBlockContext) ImportBlockValue(i int) IImportBlockValueContext {
  826. var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportBlockValueContext)(nil)).Elem(), i)
  827. if t == nil {
  828. return nil
  829. }
  830. return t.(IImportBlockValueContext)
  831. }
  832. func (s *ImportBlockContext) GetRuleContext() antlr.RuleContext {
  833. return s
  834. }
  835. func (s *ImportBlockContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  836. return antlr.TreesStringTree(s, ruleNames, recog)
  837. }
  838. func (s *ImportBlockContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  839. switch t := visitor.(type) {
  840. case ApiParserVisitor:
  841. return t.VisitImportBlock(s)
  842. default:
  843. return t.VisitChildren(s)
  844. }
  845. }
  846. func (p *ApiParserParser) ImportBlock() (localctx IImportBlockContext) {
  847. localctx = NewImportBlockContext(p, p.GetParserRuleContext(), p.GetState())
  848. p.EnterRule(localctx, 10, ApiParserParserRULE_importBlock)
  849. var _la int
  850. defer func() {
  851. p.ExitRule()
  852. }()
  853. defer func() {
  854. if err := recover(); err != nil {
  855. if v, ok := err.(antlr.RecognitionException); ok {
  856. localctx.SetException(v)
  857. p.GetErrorHandler().ReportError(p, v)
  858. p.GetErrorHandler().Recover(p, v)
  859. } else {
  860. panic(err)
  861. }
  862. }
  863. }()
  864. p.EnterOuterAlt(localctx, 1)
  865. match(p, "import")
  866. {
  867. p.SetState(102)
  868. var _m = p.Match(ApiParserParserID)
  869. localctx.(*ImportBlockContext).importToken = _m
  870. }
  871. {
  872. p.SetState(103)
  873. p.Match(ApiParserParserT__1)
  874. }
  875. p.SetState(105)
  876. p.GetErrorHandler().Sync(p)
  877. _la = p.GetTokenStream().LA(1)
  878. for ok := true; ok; ok = _la == ApiParserParserSTRING {
  879. {
  880. p.SetState(104)
  881. p.ImportBlockValue()
  882. }
  883. p.SetState(107)
  884. p.GetErrorHandler().Sync(p)
  885. _la = p.GetTokenStream().LA(1)
  886. }
  887. {
  888. p.SetState(109)
  889. p.Match(ApiParserParserT__2)
  890. }
  891. return localctx
  892. }
  893. // IImportBlockValueContext is an interface to support dynamic dispatch.
  894. type IImportBlockValueContext interface {
  895. antlr.ParserRuleContext
  896. // GetParser returns the parser.
  897. GetParser() antlr.Parser
  898. // IsImportBlockValueContext differentiates from other interfaces.
  899. IsImportBlockValueContext()
  900. }
  901. type ImportBlockValueContext struct {
  902. *antlr.BaseParserRuleContext
  903. parser antlr.Parser
  904. }
  905. func NewEmptyImportBlockValueContext() *ImportBlockValueContext {
  906. var p = new(ImportBlockValueContext)
  907. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  908. p.RuleIndex = ApiParserParserRULE_importBlockValue
  909. return p
  910. }
  911. func (*ImportBlockValueContext) IsImportBlockValueContext() {}
  912. func NewImportBlockValueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportBlockValueContext {
  913. var p = new(ImportBlockValueContext)
  914. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  915. p.parser = parser
  916. p.RuleIndex = ApiParserParserRULE_importBlockValue
  917. return p
  918. }
  919. func (s *ImportBlockValueContext) GetParser() antlr.Parser { return s.parser }
  920. func (s *ImportBlockValueContext) ImportValue() IImportValueContext {
  921. var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportValueContext)(nil)).Elem(), 0)
  922. if t == nil {
  923. return nil
  924. }
  925. return t.(IImportValueContext)
  926. }
  927. func (s *ImportBlockValueContext) GetRuleContext() antlr.RuleContext {
  928. return s
  929. }
  930. func (s *ImportBlockValueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  931. return antlr.TreesStringTree(s, ruleNames, recog)
  932. }
  933. func (s *ImportBlockValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  934. switch t := visitor.(type) {
  935. case ApiParserVisitor:
  936. return t.VisitImportBlockValue(s)
  937. default:
  938. return t.VisitChildren(s)
  939. }
  940. }
  941. func (p *ApiParserParser) ImportBlockValue() (localctx IImportBlockValueContext) {
  942. localctx = NewImportBlockValueContext(p, p.GetParserRuleContext(), p.GetState())
  943. p.EnterRule(localctx, 12, ApiParserParserRULE_importBlockValue)
  944. defer func() {
  945. p.ExitRule()
  946. }()
  947. defer func() {
  948. if err := recover(); err != nil {
  949. if v, ok := err.(antlr.RecognitionException); ok {
  950. localctx.SetException(v)
  951. p.GetErrorHandler().ReportError(p, v)
  952. p.GetErrorHandler().Recover(p, v)
  953. } else {
  954. panic(err)
  955. }
  956. }
  957. }()
  958. p.EnterOuterAlt(localctx, 1)
  959. {
  960. p.SetState(111)
  961. p.ImportValue()
  962. }
  963. return localctx
  964. }
  965. // IImportValueContext is an interface to support dynamic dispatch.
  966. type IImportValueContext interface {
  967. antlr.ParserRuleContext
  968. // GetParser returns the parser.
  969. GetParser() antlr.Parser
  970. // IsImportValueContext differentiates from other interfaces.
  971. IsImportValueContext()
  972. }
  973. type ImportValueContext struct {
  974. *antlr.BaseParserRuleContext
  975. parser antlr.Parser
  976. }
  977. func NewEmptyImportValueContext() *ImportValueContext {
  978. var p = new(ImportValueContext)
  979. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  980. p.RuleIndex = ApiParserParserRULE_importValue
  981. return p
  982. }
  983. func (*ImportValueContext) IsImportValueContext() {}
  984. func NewImportValueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportValueContext {
  985. var p = new(ImportValueContext)
  986. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  987. p.parser = parser
  988. p.RuleIndex = ApiParserParserRULE_importValue
  989. return p
  990. }
  991. func (s *ImportValueContext) GetParser() antlr.Parser { return s.parser }
  992. func (s *ImportValueContext) STRING() antlr.TerminalNode {
  993. return s.GetToken(ApiParserParserSTRING, 0)
  994. }
  995. func (s *ImportValueContext) GetRuleContext() antlr.RuleContext {
  996. return s
  997. }
  998. func (s *ImportValueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  999. return antlr.TreesStringTree(s, ruleNames, recog)
  1000. }
  1001. func (s *ImportValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  1002. switch t := visitor.(type) {
  1003. case ApiParserVisitor:
  1004. return t.VisitImportValue(s)
  1005. default:
  1006. return t.VisitChildren(s)
  1007. }
  1008. }
  1009. func (p *ApiParserParser) ImportValue() (localctx IImportValueContext) {
  1010. localctx = NewImportValueContext(p, p.GetParserRuleContext(), p.GetState())
  1011. p.EnterRule(localctx, 14, ApiParserParserRULE_importValue)
  1012. defer func() {
  1013. p.ExitRule()
  1014. }()
  1015. defer func() {
  1016. if err := recover(); err != nil {
  1017. if v, ok := err.(antlr.RecognitionException); ok {
  1018. localctx.SetException(v)
  1019. p.GetErrorHandler().ReportError(p, v)
  1020. p.GetErrorHandler().Recover(p, v)
  1021. } else {
  1022. panic(err)
  1023. }
  1024. }
  1025. }()
  1026. p.EnterOuterAlt(localctx, 1)
  1027. checkImportValue(p)
  1028. {
  1029. p.SetState(114)
  1030. p.Match(ApiParserParserSTRING)
  1031. }
  1032. return localctx
  1033. }
  1034. // IInfoSpecContext is an interface to support dynamic dispatch.
  1035. type IInfoSpecContext interface {
  1036. antlr.ParserRuleContext
  1037. // GetParser returns the parser.
  1038. GetParser() antlr.Parser
  1039. // GetInfoToken returns the infoToken token.
  1040. GetInfoToken() antlr.Token
  1041. // GetLp returns the lp token.
  1042. GetLp() antlr.Token
  1043. // GetRp returns the rp token.
  1044. GetRp() antlr.Token
  1045. // SetInfoToken sets the infoToken token.
  1046. SetInfoToken(antlr.Token)
  1047. // SetLp sets the lp token.
  1048. SetLp(antlr.Token)
  1049. // SetRp sets the rp token.
  1050. SetRp(antlr.Token)
  1051. // IsInfoSpecContext differentiates from other interfaces.
  1052. IsInfoSpecContext()
  1053. }
  1054. type InfoSpecContext struct {
  1055. *antlr.BaseParserRuleContext
  1056. parser antlr.Parser
  1057. infoToken antlr.Token
  1058. lp antlr.Token
  1059. rp antlr.Token
  1060. }
  1061. func NewEmptyInfoSpecContext() *InfoSpecContext {
  1062. var p = new(InfoSpecContext)
  1063. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  1064. p.RuleIndex = ApiParserParserRULE_infoSpec
  1065. return p
  1066. }
  1067. func (*InfoSpecContext) IsInfoSpecContext() {}
  1068. func NewInfoSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *InfoSpecContext {
  1069. var p = new(InfoSpecContext)
  1070. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  1071. p.parser = parser
  1072. p.RuleIndex = ApiParserParserRULE_infoSpec
  1073. return p
  1074. }
  1075. func (s *InfoSpecContext) GetParser() antlr.Parser { return s.parser }
  1076. func (s *InfoSpecContext) GetInfoToken() antlr.Token { return s.infoToken }
  1077. func (s *InfoSpecContext) GetLp() antlr.Token { return s.lp }
  1078. func (s *InfoSpecContext) GetRp() antlr.Token { return s.rp }
  1079. func (s *InfoSpecContext) SetInfoToken(v antlr.Token) { s.infoToken = v }
  1080. func (s *InfoSpecContext) SetLp(v antlr.Token) { s.lp = v }
  1081. func (s *InfoSpecContext) SetRp(v antlr.Token) { s.rp = v }
  1082. func (s *InfoSpecContext) ID() antlr.TerminalNode {
  1083. return s.GetToken(ApiParserParserID, 0)
  1084. }
  1085. func (s *InfoSpecContext) AllKvLit() []IKvLitContext {
  1086. var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IKvLitContext)(nil)).Elem())
  1087. var tst = make([]IKvLitContext, len(ts))
  1088. for i, t := range ts {
  1089. if t != nil {
  1090. tst[i] = t.(IKvLitContext)
  1091. }
  1092. }
  1093. return tst
  1094. }
  1095. func (s *InfoSpecContext) KvLit(i int) IKvLitContext {
  1096. var t = s.GetTypedRuleContext(reflect.TypeOf((*IKvLitContext)(nil)).Elem(), i)
  1097. if t == nil {
  1098. return nil
  1099. }
  1100. return t.(IKvLitContext)
  1101. }
  1102. func (s *InfoSpecContext) GetRuleContext() antlr.RuleContext {
  1103. return s
  1104. }
  1105. func (s *InfoSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  1106. return antlr.TreesStringTree(s, ruleNames, recog)
  1107. }
  1108. func (s *InfoSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  1109. switch t := visitor.(type) {
  1110. case ApiParserVisitor:
  1111. return t.VisitInfoSpec(s)
  1112. default:
  1113. return t.VisitChildren(s)
  1114. }
  1115. }
  1116. func (p *ApiParserParser) InfoSpec() (localctx IInfoSpecContext) {
  1117. localctx = NewInfoSpecContext(p, p.GetParserRuleContext(), p.GetState())
  1118. p.EnterRule(localctx, 16, ApiParserParserRULE_infoSpec)
  1119. var _la int
  1120. defer func() {
  1121. p.ExitRule()
  1122. }()
  1123. defer func() {
  1124. if err := recover(); err != nil {
  1125. if v, ok := err.(antlr.RecognitionException); ok {
  1126. localctx.SetException(v)
  1127. p.GetErrorHandler().ReportError(p, v)
  1128. p.GetErrorHandler().Recover(p, v)
  1129. } else {
  1130. panic(err)
  1131. }
  1132. }
  1133. }()
  1134. p.EnterOuterAlt(localctx, 1)
  1135. match(p, "info")
  1136. {
  1137. p.SetState(117)
  1138. var _m = p.Match(ApiParserParserID)
  1139. localctx.(*InfoSpecContext).infoToken = _m
  1140. }
  1141. {
  1142. p.SetState(118)
  1143. var _m = p.Match(ApiParserParserT__1)
  1144. localctx.(*InfoSpecContext).lp = _m
  1145. }
  1146. p.SetState(120)
  1147. p.GetErrorHandler().Sync(p)
  1148. _la = p.GetTokenStream().LA(1)
  1149. for ok := true; ok; ok = _la == ApiParserParserID {
  1150. {
  1151. p.SetState(119)
  1152. p.KvLit()
  1153. }
  1154. p.SetState(122)
  1155. p.GetErrorHandler().Sync(p)
  1156. _la = p.GetTokenStream().LA(1)
  1157. }
  1158. {
  1159. p.SetState(124)
  1160. var _m = p.Match(ApiParserParserT__2)
  1161. localctx.(*InfoSpecContext).rp = _m
  1162. }
  1163. return localctx
  1164. }
  1165. // ITypeSpecContext is an interface to support dynamic dispatch.
  1166. type ITypeSpecContext interface {
  1167. antlr.ParserRuleContext
  1168. // GetParser returns the parser.
  1169. GetParser() antlr.Parser
  1170. // IsTypeSpecContext differentiates from other interfaces.
  1171. IsTypeSpecContext()
  1172. }
  1173. type TypeSpecContext struct {
  1174. *antlr.BaseParserRuleContext
  1175. parser antlr.Parser
  1176. }
  1177. func NewEmptyTypeSpecContext() *TypeSpecContext {
  1178. var p = new(TypeSpecContext)
  1179. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  1180. p.RuleIndex = ApiParserParserRULE_typeSpec
  1181. return p
  1182. }
  1183. func (*TypeSpecContext) IsTypeSpecContext() {}
  1184. func NewTypeSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeSpecContext {
  1185. var p = new(TypeSpecContext)
  1186. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  1187. p.parser = parser
  1188. p.RuleIndex = ApiParserParserRULE_typeSpec
  1189. return p
  1190. }
  1191. func (s *TypeSpecContext) GetParser() antlr.Parser { return s.parser }
  1192. func (s *TypeSpecContext) TypeLit() ITypeLitContext {
  1193. var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeLitContext)(nil)).Elem(), 0)
  1194. if t == nil {
  1195. return nil
  1196. }
  1197. return t.(ITypeLitContext)
  1198. }
  1199. func (s *TypeSpecContext) TypeBlock() ITypeBlockContext {
  1200. var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockContext)(nil)).Elem(), 0)
  1201. if t == nil {
  1202. return nil
  1203. }
  1204. return t.(ITypeBlockContext)
  1205. }
  1206. func (s *TypeSpecContext) GetRuleContext() antlr.RuleContext {
  1207. return s
  1208. }
  1209. func (s *TypeSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  1210. return antlr.TreesStringTree(s, ruleNames, recog)
  1211. }
  1212. func (s *TypeSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  1213. switch t := visitor.(type) {
  1214. case ApiParserVisitor:
  1215. return t.VisitTypeSpec(s)
  1216. default:
  1217. return t.VisitChildren(s)
  1218. }
  1219. }
  1220. func (p *ApiParserParser) TypeSpec() (localctx ITypeSpecContext) {
  1221. localctx = NewTypeSpecContext(p, p.GetParserRuleContext(), p.GetState())
  1222. p.EnterRule(localctx, 18, ApiParserParserRULE_typeSpec)
  1223. defer func() {
  1224. p.ExitRule()
  1225. }()
  1226. defer func() {
  1227. if err := recover(); err != nil {
  1228. if v, ok := err.(antlr.RecognitionException); ok {
  1229. localctx.SetException(v)
  1230. p.GetErrorHandler().ReportError(p, v)
  1231. p.GetErrorHandler().Recover(p, v)
  1232. } else {
  1233. panic(err)
  1234. }
  1235. }
  1236. }()
  1237. p.SetState(128)
  1238. p.GetErrorHandler().Sync(p)
  1239. switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 5, p.GetParserRuleContext()) {
  1240. case 1:
  1241. p.EnterOuterAlt(localctx, 1)
  1242. {
  1243. p.SetState(126)
  1244. p.TypeLit()
  1245. }
  1246. case 2:
  1247. p.EnterOuterAlt(localctx, 2)
  1248. {
  1249. p.SetState(127)
  1250. p.TypeBlock()
  1251. }
  1252. }
  1253. return localctx
  1254. }
  1255. // ITypeLitContext is an interface to support dynamic dispatch.
  1256. type ITypeLitContext interface {
  1257. antlr.ParserRuleContext
  1258. // GetParser returns the parser.
  1259. GetParser() antlr.Parser
  1260. // GetTypeToken returns the typeToken token.
  1261. GetTypeToken() antlr.Token
  1262. // SetTypeToken sets the typeToken token.
  1263. SetTypeToken(antlr.Token)
  1264. // IsTypeLitContext differentiates from other interfaces.
  1265. IsTypeLitContext()
  1266. }
  1267. type TypeLitContext struct {
  1268. *antlr.BaseParserRuleContext
  1269. parser antlr.Parser
  1270. typeToken antlr.Token
  1271. }
  1272. func NewEmptyTypeLitContext() *TypeLitContext {
  1273. var p = new(TypeLitContext)
  1274. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  1275. p.RuleIndex = ApiParserParserRULE_typeLit
  1276. return p
  1277. }
  1278. func (*TypeLitContext) IsTypeLitContext() {}
  1279. func NewTypeLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeLitContext {
  1280. var p = new(TypeLitContext)
  1281. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  1282. p.parser = parser
  1283. p.RuleIndex = ApiParserParserRULE_typeLit
  1284. return p
  1285. }
  1286. func (s *TypeLitContext) GetParser() antlr.Parser { return s.parser }
  1287. func (s *TypeLitContext) GetTypeToken() antlr.Token { return s.typeToken }
  1288. func (s *TypeLitContext) SetTypeToken(v antlr.Token) { s.typeToken = v }
  1289. func (s *TypeLitContext) TypeLitBody() ITypeLitBodyContext {
  1290. var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeLitBodyContext)(nil)).Elem(), 0)
  1291. if t == nil {
  1292. return nil
  1293. }
  1294. return t.(ITypeLitBodyContext)
  1295. }
  1296. func (s *TypeLitContext) ID() antlr.TerminalNode {
  1297. return s.GetToken(ApiParserParserID, 0)
  1298. }
  1299. func (s *TypeLitContext) GetRuleContext() antlr.RuleContext {
  1300. return s
  1301. }
  1302. func (s *TypeLitContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  1303. return antlr.TreesStringTree(s, ruleNames, recog)
  1304. }
  1305. func (s *TypeLitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  1306. switch t := visitor.(type) {
  1307. case ApiParserVisitor:
  1308. return t.VisitTypeLit(s)
  1309. default:
  1310. return t.VisitChildren(s)
  1311. }
  1312. }
  1313. func (p *ApiParserParser) TypeLit() (localctx ITypeLitContext) {
  1314. localctx = NewTypeLitContext(p, p.GetParserRuleContext(), p.GetState())
  1315. p.EnterRule(localctx, 20, ApiParserParserRULE_typeLit)
  1316. defer func() {
  1317. p.ExitRule()
  1318. }()
  1319. defer func() {
  1320. if err := recover(); err != nil {
  1321. if v, ok := err.(antlr.RecognitionException); ok {
  1322. localctx.SetException(v)
  1323. p.GetErrorHandler().ReportError(p, v)
  1324. p.GetErrorHandler().Recover(p, v)
  1325. } else {
  1326. panic(err)
  1327. }
  1328. }
  1329. }()
  1330. p.EnterOuterAlt(localctx, 1)
  1331. match(p, "type")
  1332. {
  1333. p.SetState(131)
  1334. var _m = p.Match(ApiParserParserID)
  1335. localctx.(*TypeLitContext).typeToken = _m
  1336. }
  1337. {
  1338. p.SetState(132)
  1339. p.TypeLitBody()
  1340. }
  1341. return localctx
  1342. }
  1343. // ITypeBlockContext is an interface to support dynamic dispatch.
  1344. type ITypeBlockContext interface {
  1345. antlr.ParserRuleContext
  1346. // GetParser returns the parser.
  1347. GetParser() antlr.Parser
  1348. // GetTypeToken returns the typeToken token.
  1349. GetTypeToken() antlr.Token
  1350. // GetLp returns the lp token.
  1351. GetLp() antlr.Token
  1352. // GetRp returns the rp token.
  1353. GetRp() antlr.Token
  1354. // SetTypeToken sets the typeToken token.
  1355. SetTypeToken(antlr.Token)
  1356. // SetLp sets the lp token.
  1357. SetLp(antlr.Token)
  1358. // SetRp sets the rp token.
  1359. SetRp(antlr.Token)
  1360. // IsTypeBlockContext differentiates from other interfaces.
  1361. IsTypeBlockContext()
  1362. }
  1363. type TypeBlockContext struct {
  1364. *antlr.BaseParserRuleContext
  1365. parser antlr.Parser
  1366. typeToken antlr.Token
  1367. lp antlr.Token
  1368. rp antlr.Token
  1369. }
  1370. func NewEmptyTypeBlockContext() *TypeBlockContext {
  1371. var p = new(TypeBlockContext)
  1372. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  1373. p.RuleIndex = ApiParserParserRULE_typeBlock
  1374. return p
  1375. }
  1376. func (*TypeBlockContext) IsTypeBlockContext() {}
  1377. func NewTypeBlockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockContext {
  1378. var p = new(TypeBlockContext)
  1379. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  1380. p.parser = parser
  1381. p.RuleIndex = ApiParserParserRULE_typeBlock
  1382. return p
  1383. }
  1384. func (s *TypeBlockContext) GetParser() antlr.Parser { return s.parser }
  1385. func (s *TypeBlockContext) GetTypeToken() antlr.Token { return s.typeToken }
  1386. func (s *TypeBlockContext) GetLp() antlr.Token { return s.lp }
  1387. func (s *TypeBlockContext) GetRp() antlr.Token { return s.rp }
  1388. func (s *TypeBlockContext) SetTypeToken(v antlr.Token) { s.typeToken = v }
  1389. func (s *TypeBlockContext) SetLp(v antlr.Token) { s.lp = v }
  1390. func (s *TypeBlockContext) SetRp(v antlr.Token) { s.rp = v }
  1391. func (s *TypeBlockContext) ID() antlr.TerminalNode {
  1392. return s.GetToken(ApiParserParserID, 0)
  1393. }
  1394. func (s *TypeBlockContext) AllTypeBlockBody() []ITypeBlockBodyContext {
  1395. var ts = s.GetTypedRuleContexts(reflect.TypeOf((*ITypeBlockBodyContext)(nil)).Elem())
  1396. var tst = make([]ITypeBlockBodyContext, len(ts))
  1397. for i, t := range ts {
  1398. if t != nil {
  1399. tst[i] = t.(ITypeBlockBodyContext)
  1400. }
  1401. }
  1402. return tst
  1403. }
  1404. func (s *TypeBlockContext) TypeBlockBody(i int) ITypeBlockBodyContext {
  1405. var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockBodyContext)(nil)).Elem(), i)
  1406. if t == nil {
  1407. return nil
  1408. }
  1409. return t.(ITypeBlockBodyContext)
  1410. }
  1411. func (s *TypeBlockContext) GetRuleContext() antlr.RuleContext {
  1412. return s
  1413. }
  1414. func (s *TypeBlockContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  1415. return antlr.TreesStringTree(s, ruleNames, recog)
  1416. }
  1417. func (s *TypeBlockContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  1418. switch t := visitor.(type) {
  1419. case ApiParserVisitor:
  1420. return t.VisitTypeBlock(s)
  1421. default:
  1422. return t.VisitChildren(s)
  1423. }
  1424. }
  1425. func (p *ApiParserParser) TypeBlock() (localctx ITypeBlockContext) {
  1426. localctx = NewTypeBlockContext(p, p.GetParserRuleContext(), p.GetState())
  1427. p.EnterRule(localctx, 22, ApiParserParserRULE_typeBlock)
  1428. var _la int
  1429. defer func() {
  1430. p.ExitRule()
  1431. }()
  1432. defer func() {
  1433. if err := recover(); err != nil {
  1434. if v, ok := err.(antlr.RecognitionException); ok {
  1435. localctx.SetException(v)
  1436. p.GetErrorHandler().ReportError(p, v)
  1437. p.GetErrorHandler().Recover(p, v)
  1438. } else {
  1439. panic(err)
  1440. }
  1441. }
  1442. }()
  1443. p.EnterOuterAlt(localctx, 1)
  1444. match(p, "type")
  1445. {
  1446. p.SetState(135)
  1447. var _m = p.Match(ApiParserParserID)
  1448. localctx.(*TypeBlockContext).typeToken = _m
  1449. }
  1450. {
  1451. p.SetState(136)
  1452. var _m = p.Match(ApiParserParserT__1)
  1453. localctx.(*TypeBlockContext).lp = _m
  1454. }
  1455. p.SetState(140)
  1456. p.GetErrorHandler().Sync(p)
  1457. _la = p.GetTokenStream().LA(1)
  1458. for _la == ApiParserParserID {
  1459. {
  1460. p.SetState(137)
  1461. p.TypeBlockBody()
  1462. }
  1463. p.SetState(142)
  1464. p.GetErrorHandler().Sync(p)
  1465. _la = p.GetTokenStream().LA(1)
  1466. }
  1467. {
  1468. p.SetState(143)
  1469. var _m = p.Match(ApiParserParserT__2)
  1470. localctx.(*TypeBlockContext).rp = _m
  1471. }
  1472. return localctx
  1473. }
  1474. // ITypeLitBodyContext is an interface to support dynamic dispatch.
  1475. type ITypeLitBodyContext interface {
  1476. antlr.ParserRuleContext
  1477. // GetParser returns the parser.
  1478. GetParser() antlr.Parser
  1479. // IsTypeLitBodyContext differentiates from other interfaces.
  1480. IsTypeLitBodyContext()
  1481. }
  1482. type TypeLitBodyContext struct {
  1483. *antlr.BaseParserRuleContext
  1484. parser antlr.Parser
  1485. }
  1486. func NewEmptyTypeLitBodyContext() *TypeLitBodyContext {
  1487. var p = new(TypeLitBodyContext)
  1488. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  1489. p.RuleIndex = ApiParserParserRULE_typeLitBody
  1490. return p
  1491. }
  1492. func (*TypeLitBodyContext) IsTypeLitBodyContext() {}
  1493. func NewTypeLitBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeLitBodyContext {
  1494. var p = new(TypeLitBodyContext)
  1495. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  1496. p.parser = parser
  1497. p.RuleIndex = ApiParserParserRULE_typeLitBody
  1498. return p
  1499. }
  1500. func (s *TypeLitBodyContext) GetParser() antlr.Parser { return s.parser }
  1501. func (s *TypeLitBodyContext) TypeStruct() ITypeStructContext {
  1502. var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeStructContext)(nil)).Elem(), 0)
  1503. if t == nil {
  1504. return nil
  1505. }
  1506. return t.(ITypeStructContext)
  1507. }
  1508. func (s *TypeLitBodyContext) TypeAlias() ITypeAliasContext {
  1509. var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeAliasContext)(nil)).Elem(), 0)
  1510. if t == nil {
  1511. return nil
  1512. }
  1513. return t.(ITypeAliasContext)
  1514. }
  1515. func (s *TypeLitBodyContext) GetRuleContext() antlr.RuleContext {
  1516. return s
  1517. }
  1518. func (s *TypeLitBodyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  1519. return antlr.TreesStringTree(s, ruleNames, recog)
  1520. }
  1521. func (s *TypeLitBodyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  1522. switch t := visitor.(type) {
  1523. case ApiParserVisitor:
  1524. return t.VisitTypeLitBody(s)
  1525. default:
  1526. return t.VisitChildren(s)
  1527. }
  1528. }
  1529. func (p *ApiParserParser) TypeLitBody() (localctx ITypeLitBodyContext) {
  1530. localctx = NewTypeLitBodyContext(p, p.GetParserRuleContext(), p.GetState())
  1531. p.EnterRule(localctx, 24, ApiParserParserRULE_typeLitBody)
  1532. defer func() {
  1533. p.ExitRule()
  1534. }()
  1535. defer func() {
  1536. if err := recover(); err != nil {
  1537. if v, ok := err.(antlr.RecognitionException); ok {
  1538. localctx.SetException(v)
  1539. p.GetErrorHandler().ReportError(p, v)
  1540. p.GetErrorHandler().Recover(p, v)
  1541. } else {
  1542. panic(err)
  1543. }
  1544. }
  1545. }()
  1546. p.SetState(147)
  1547. p.GetErrorHandler().Sync(p)
  1548. switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 7, p.GetParserRuleContext()) {
  1549. case 1:
  1550. p.EnterOuterAlt(localctx, 1)
  1551. {
  1552. p.SetState(145)
  1553. p.TypeStruct()
  1554. }
  1555. case 2:
  1556. p.EnterOuterAlt(localctx, 2)
  1557. {
  1558. p.SetState(146)
  1559. p.TypeAlias()
  1560. }
  1561. }
  1562. return localctx
  1563. }
  1564. // ITypeBlockBodyContext is an interface to support dynamic dispatch.
  1565. type ITypeBlockBodyContext interface {
  1566. antlr.ParserRuleContext
  1567. // GetParser returns the parser.
  1568. GetParser() antlr.Parser
  1569. // IsTypeBlockBodyContext differentiates from other interfaces.
  1570. IsTypeBlockBodyContext()
  1571. }
  1572. type TypeBlockBodyContext struct {
  1573. *antlr.BaseParserRuleContext
  1574. parser antlr.Parser
  1575. }
  1576. func NewEmptyTypeBlockBodyContext() *TypeBlockBodyContext {
  1577. var p = new(TypeBlockBodyContext)
  1578. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  1579. p.RuleIndex = ApiParserParserRULE_typeBlockBody
  1580. return p
  1581. }
  1582. func (*TypeBlockBodyContext) IsTypeBlockBodyContext() {}
  1583. func NewTypeBlockBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockBodyContext {
  1584. var p = new(TypeBlockBodyContext)
  1585. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  1586. p.parser = parser
  1587. p.RuleIndex = ApiParserParserRULE_typeBlockBody
  1588. return p
  1589. }
  1590. func (s *TypeBlockBodyContext) GetParser() antlr.Parser { return s.parser }
  1591. func (s *TypeBlockBodyContext) TypeBlockStruct() ITypeBlockStructContext {
  1592. var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockStructContext)(nil)).Elem(), 0)
  1593. if t == nil {
  1594. return nil
  1595. }
  1596. return t.(ITypeBlockStructContext)
  1597. }
  1598. func (s *TypeBlockBodyContext) TypeBlockAlias() ITypeBlockAliasContext {
  1599. var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockAliasContext)(nil)).Elem(), 0)
  1600. if t == nil {
  1601. return nil
  1602. }
  1603. return t.(ITypeBlockAliasContext)
  1604. }
  1605. func (s *TypeBlockBodyContext) GetRuleContext() antlr.RuleContext {
  1606. return s
  1607. }
  1608. func (s *TypeBlockBodyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  1609. return antlr.TreesStringTree(s, ruleNames, recog)
  1610. }
  1611. func (s *TypeBlockBodyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  1612. switch t := visitor.(type) {
  1613. case ApiParserVisitor:
  1614. return t.VisitTypeBlockBody(s)
  1615. default:
  1616. return t.VisitChildren(s)
  1617. }
  1618. }
  1619. func (p *ApiParserParser) TypeBlockBody() (localctx ITypeBlockBodyContext) {
  1620. localctx = NewTypeBlockBodyContext(p, p.GetParserRuleContext(), p.GetState())
  1621. p.EnterRule(localctx, 26, ApiParserParserRULE_typeBlockBody)
  1622. defer func() {
  1623. p.ExitRule()
  1624. }()
  1625. defer func() {
  1626. if err := recover(); err != nil {
  1627. if v, ok := err.(antlr.RecognitionException); ok {
  1628. localctx.SetException(v)
  1629. p.GetErrorHandler().ReportError(p, v)
  1630. p.GetErrorHandler().Recover(p, v)
  1631. } else {
  1632. panic(err)
  1633. }
  1634. }
  1635. }()
  1636. p.SetState(151)
  1637. p.GetErrorHandler().Sync(p)
  1638. switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 8, p.GetParserRuleContext()) {
  1639. case 1:
  1640. p.EnterOuterAlt(localctx, 1)
  1641. {
  1642. p.SetState(149)
  1643. p.TypeBlockStruct()
  1644. }
  1645. case 2:
  1646. p.EnterOuterAlt(localctx, 2)
  1647. {
  1648. p.SetState(150)
  1649. p.TypeBlockAlias()
  1650. }
  1651. }
  1652. return localctx
  1653. }
  1654. // ITypeStructContext is an interface to support dynamic dispatch.
  1655. type ITypeStructContext interface {
  1656. antlr.ParserRuleContext
  1657. // GetParser returns the parser.
  1658. GetParser() antlr.Parser
  1659. // GetStructName returns the structName token.
  1660. GetStructName() antlr.Token
  1661. // GetStructToken returns the structToken token.
  1662. GetStructToken() antlr.Token
  1663. // GetLbrace returns the lbrace token.
  1664. GetLbrace() antlr.Token
  1665. // GetRbrace returns the rbrace token.
  1666. GetRbrace() antlr.Token
  1667. // SetStructName sets the structName token.
  1668. SetStructName(antlr.Token)
  1669. // SetStructToken sets the structToken token.
  1670. SetStructToken(antlr.Token)
  1671. // SetLbrace sets the lbrace token.
  1672. SetLbrace(antlr.Token)
  1673. // SetRbrace sets the rbrace token.
  1674. SetRbrace(antlr.Token)
  1675. // IsTypeStructContext differentiates from other interfaces.
  1676. IsTypeStructContext()
  1677. }
  1678. type TypeStructContext struct {
  1679. *antlr.BaseParserRuleContext
  1680. parser antlr.Parser
  1681. structName antlr.Token
  1682. structToken antlr.Token
  1683. lbrace antlr.Token
  1684. rbrace antlr.Token
  1685. }
  1686. func NewEmptyTypeStructContext() *TypeStructContext {
  1687. var p = new(TypeStructContext)
  1688. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  1689. p.RuleIndex = ApiParserParserRULE_typeStruct
  1690. return p
  1691. }
  1692. func (*TypeStructContext) IsTypeStructContext() {}
  1693. func NewTypeStructContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeStructContext {
  1694. var p = new(TypeStructContext)
  1695. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  1696. p.parser = parser
  1697. p.RuleIndex = ApiParserParserRULE_typeStruct
  1698. return p
  1699. }
  1700. func (s *TypeStructContext) GetParser() antlr.Parser { return s.parser }
  1701. func (s *TypeStructContext) GetStructName() antlr.Token { return s.structName }
  1702. func (s *TypeStructContext) GetStructToken() antlr.Token { return s.structToken }
  1703. func (s *TypeStructContext) GetLbrace() antlr.Token { return s.lbrace }
  1704. func (s *TypeStructContext) GetRbrace() antlr.Token { return s.rbrace }
  1705. func (s *TypeStructContext) SetStructName(v antlr.Token) { s.structName = v }
  1706. func (s *TypeStructContext) SetStructToken(v antlr.Token) { s.structToken = v }
  1707. func (s *TypeStructContext) SetLbrace(v antlr.Token) { s.lbrace = v }
  1708. func (s *TypeStructContext) SetRbrace(v antlr.Token) { s.rbrace = v }
  1709. func (s *TypeStructContext) AllID() []antlr.TerminalNode {
  1710. return s.GetTokens(ApiParserParserID)
  1711. }
  1712. func (s *TypeStructContext) ID(i int) antlr.TerminalNode {
  1713. return s.GetToken(ApiParserParserID, i)
  1714. }
  1715. func (s *TypeStructContext) AllField() []IFieldContext {
  1716. var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IFieldContext)(nil)).Elem())
  1717. var tst = make([]IFieldContext, len(ts))
  1718. for i, t := range ts {
  1719. if t != nil {
  1720. tst[i] = t.(IFieldContext)
  1721. }
  1722. }
  1723. return tst
  1724. }
  1725. func (s *TypeStructContext) Field(i int) IFieldContext {
  1726. var t = s.GetTypedRuleContext(reflect.TypeOf((*IFieldContext)(nil)).Elem(), i)
  1727. if t == nil {
  1728. return nil
  1729. }
  1730. return t.(IFieldContext)
  1731. }
  1732. func (s *TypeStructContext) GetRuleContext() antlr.RuleContext {
  1733. return s
  1734. }
  1735. func (s *TypeStructContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  1736. return antlr.TreesStringTree(s, ruleNames, recog)
  1737. }
  1738. func (s *TypeStructContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  1739. switch t := visitor.(type) {
  1740. case ApiParserVisitor:
  1741. return t.VisitTypeStruct(s)
  1742. default:
  1743. return t.VisitChildren(s)
  1744. }
  1745. }
  1746. func (p *ApiParserParser) TypeStruct() (localctx ITypeStructContext) {
  1747. localctx = NewTypeStructContext(p, p.GetParserRuleContext(), p.GetState())
  1748. p.EnterRule(localctx, 28, ApiParserParserRULE_typeStruct)
  1749. var _la int
  1750. defer func() {
  1751. p.ExitRule()
  1752. }()
  1753. defer func() {
  1754. if err := recover(); err != nil {
  1755. if v, ok := err.(antlr.RecognitionException); ok {
  1756. localctx.SetException(v)
  1757. p.GetErrorHandler().ReportError(p, v)
  1758. p.GetErrorHandler().Recover(p, v)
  1759. } else {
  1760. panic(err)
  1761. }
  1762. }
  1763. }()
  1764. var _alt int
  1765. p.EnterOuterAlt(localctx, 1)
  1766. checkKeyword(p)
  1767. {
  1768. p.SetState(154)
  1769. var _m = p.Match(ApiParserParserID)
  1770. localctx.(*TypeStructContext).structName = _m
  1771. }
  1772. p.SetState(156)
  1773. p.GetErrorHandler().Sync(p)
  1774. _la = p.GetTokenStream().LA(1)
  1775. if _la == ApiParserParserID {
  1776. {
  1777. p.SetState(155)
  1778. var _m = p.Match(ApiParserParserID)
  1779. localctx.(*TypeStructContext).structToken = _m
  1780. }
  1781. }
  1782. {
  1783. p.SetState(158)
  1784. var _m = p.Match(ApiParserParserT__3)
  1785. localctx.(*TypeStructContext).lbrace = _m
  1786. }
  1787. p.SetState(162)
  1788. p.GetErrorHandler().Sync(p)
  1789. _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 10, p.GetParserRuleContext())
  1790. for _alt != 2 && _alt != antlr.ATNInvalidAltNumber {
  1791. if _alt == 1 {
  1792. {
  1793. p.SetState(159)
  1794. p.Field()
  1795. }
  1796. }
  1797. p.SetState(164)
  1798. p.GetErrorHandler().Sync(p)
  1799. _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 10, p.GetParserRuleContext())
  1800. }
  1801. {
  1802. p.SetState(165)
  1803. var _m = p.Match(ApiParserParserT__4)
  1804. localctx.(*TypeStructContext).rbrace = _m
  1805. }
  1806. return localctx
  1807. }
  1808. // ITypeAliasContext is an interface to support dynamic dispatch.
  1809. type ITypeAliasContext interface {
  1810. antlr.ParserRuleContext
  1811. // GetParser returns the parser.
  1812. GetParser() antlr.Parser
  1813. // GetAlias returns the alias token.
  1814. GetAlias() antlr.Token
  1815. // GetAssign returns the assign token.
  1816. GetAssign() antlr.Token
  1817. // SetAlias sets the alias token.
  1818. SetAlias(antlr.Token)
  1819. // SetAssign sets the assign token.
  1820. SetAssign(antlr.Token)
  1821. // IsTypeAliasContext differentiates from other interfaces.
  1822. IsTypeAliasContext()
  1823. }
  1824. type TypeAliasContext struct {
  1825. *antlr.BaseParserRuleContext
  1826. parser antlr.Parser
  1827. alias antlr.Token
  1828. assign antlr.Token
  1829. }
  1830. func NewEmptyTypeAliasContext() *TypeAliasContext {
  1831. var p = new(TypeAliasContext)
  1832. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  1833. p.RuleIndex = ApiParserParserRULE_typeAlias
  1834. return p
  1835. }
  1836. func (*TypeAliasContext) IsTypeAliasContext() {}
  1837. func NewTypeAliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeAliasContext {
  1838. var p = new(TypeAliasContext)
  1839. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  1840. p.parser = parser
  1841. p.RuleIndex = ApiParserParserRULE_typeAlias
  1842. return p
  1843. }
  1844. func (s *TypeAliasContext) GetParser() antlr.Parser { return s.parser }
  1845. func (s *TypeAliasContext) GetAlias() antlr.Token { return s.alias }
  1846. func (s *TypeAliasContext) GetAssign() antlr.Token { return s.assign }
  1847. func (s *TypeAliasContext) SetAlias(v antlr.Token) { s.alias = v }
  1848. func (s *TypeAliasContext) SetAssign(v antlr.Token) { s.assign = v }
  1849. func (s *TypeAliasContext) DataType() IDataTypeContext {
  1850. var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
  1851. if t == nil {
  1852. return nil
  1853. }
  1854. return t.(IDataTypeContext)
  1855. }
  1856. func (s *TypeAliasContext) ID() antlr.TerminalNode {
  1857. return s.GetToken(ApiParserParserID, 0)
  1858. }
  1859. func (s *TypeAliasContext) GetRuleContext() antlr.RuleContext {
  1860. return s
  1861. }
  1862. func (s *TypeAliasContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  1863. return antlr.TreesStringTree(s, ruleNames, recog)
  1864. }
  1865. func (s *TypeAliasContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  1866. switch t := visitor.(type) {
  1867. case ApiParserVisitor:
  1868. return t.VisitTypeAlias(s)
  1869. default:
  1870. return t.VisitChildren(s)
  1871. }
  1872. }
  1873. func (p *ApiParserParser) TypeAlias() (localctx ITypeAliasContext) {
  1874. localctx = NewTypeAliasContext(p, p.GetParserRuleContext(), p.GetState())
  1875. p.EnterRule(localctx, 30, ApiParserParserRULE_typeAlias)
  1876. var _la int
  1877. defer func() {
  1878. p.ExitRule()
  1879. }()
  1880. defer func() {
  1881. if err := recover(); err != nil {
  1882. if v, ok := err.(antlr.RecognitionException); ok {
  1883. localctx.SetException(v)
  1884. p.GetErrorHandler().ReportError(p, v)
  1885. p.GetErrorHandler().Recover(p, v)
  1886. } else {
  1887. panic(err)
  1888. }
  1889. }
  1890. }()
  1891. p.EnterOuterAlt(localctx, 1)
  1892. checkKeyword(p)
  1893. {
  1894. p.SetState(168)
  1895. var _m = p.Match(ApiParserParserID)
  1896. localctx.(*TypeAliasContext).alias = _m
  1897. }
  1898. p.SetState(170)
  1899. p.GetErrorHandler().Sync(p)
  1900. _la = p.GetTokenStream().LA(1)
  1901. if _la == ApiParserParserT__0 {
  1902. {
  1903. p.SetState(169)
  1904. var _m = p.Match(ApiParserParserT__0)
  1905. localctx.(*TypeAliasContext).assign = _m
  1906. }
  1907. }
  1908. {
  1909. p.SetState(172)
  1910. p.DataType()
  1911. }
  1912. return localctx
  1913. }
  1914. // ITypeBlockStructContext is an interface to support dynamic dispatch.
  1915. type ITypeBlockStructContext interface {
  1916. antlr.ParserRuleContext
  1917. // GetParser returns the parser.
  1918. GetParser() antlr.Parser
  1919. // GetStructName returns the structName token.
  1920. GetStructName() antlr.Token
  1921. // GetStructToken returns the structToken token.
  1922. GetStructToken() antlr.Token
  1923. // GetLbrace returns the lbrace token.
  1924. GetLbrace() antlr.Token
  1925. // GetRbrace returns the rbrace token.
  1926. GetRbrace() antlr.Token
  1927. // SetStructName sets the structName token.
  1928. SetStructName(antlr.Token)
  1929. // SetStructToken sets the structToken token.
  1930. SetStructToken(antlr.Token)
  1931. // SetLbrace sets the lbrace token.
  1932. SetLbrace(antlr.Token)
  1933. // SetRbrace sets the rbrace token.
  1934. SetRbrace(antlr.Token)
  1935. // IsTypeBlockStructContext differentiates from other interfaces.
  1936. IsTypeBlockStructContext()
  1937. }
  1938. type TypeBlockStructContext struct {
  1939. *antlr.BaseParserRuleContext
  1940. parser antlr.Parser
  1941. structName antlr.Token
  1942. structToken antlr.Token
  1943. lbrace antlr.Token
  1944. rbrace antlr.Token
  1945. }
  1946. func NewEmptyTypeBlockStructContext() *TypeBlockStructContext {
  1947. var p = new(TypeBlockStructContext)
  1948. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  1949. p.RuleIndex = ApiParserParserRULE_typeBlockStruct
  1950. return p
  1951. }
  1952. func (*TypeBlockStructContext) IsTypeBlockStructContext() {}
  1953. func NewTypeBlockStructContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockStructContext {
  1954. var p = new(TypeBlockStructContext)
  1955. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  1956. p.parser = parser
  1957. p.RuleIndex = ApiParserParserRULE_typeBlockStruct
  1958. return p
  1959. }
  1960. func (s *TypeBlockStructContext) GetParser() antlr.Parser { return s.parser }
  1961. func (s *TypeBlockStructContext) GetStructName() antlr.Token { return s.structName }
  1962. func (s *TypeBlockStructContext) GetStructToken() antlr.Token { return s.structToken }
  1963. func (s *TypeBlockStructContext) GetLbrace() antlr.Token { return s.lbrace }
  1964. func (s *TypeBlockStructContext) GetRbrace() antlr.Token { return s.rbrace }
  1965. func (s *TypeBlockStructContext) SetStructName(v antlr.Token) { s.structName = v }
  1966. func (s *TypeBlockStructContext) SetStructToken(v antlr.Token) { s.structToken = v }
  1967. func (s *TypeBlockStructContext) SetLbrace(v antlr.Token) { s.lbrace = v }
  1968. func (s *TypeBlockStructContext) SetRbrace(v antlr.Token) { s.rbrace = v }
  1969. func (s *TypeBlockStructContext) AllID() []antlr.TerminalNode {
  1970. return s.GetTokens(ApiParserParserID)
  1971. }
  1972. func (s *TypeBlockStructContext) ID(i int) antlr.TerminalNode {
  1973. return s.GetToken(ApiParserParserID, i)
  1974. }
  1975. func (s *TypeBlockStructContext) AllField() []IFieldContext {
  1976. var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IFieldContext)(nil)).Elem())
  1977. var tst = make([]IFieldContext, len(ts))
  1978. for i, t := range ts {
  1979. if t != nil {
  1980. tst[i] = t.(IFieldContext)
  1981. }
  1982. }
  1983. return tst
  1984. }
  1985. func (s *TypeBlockStructContext) Field(i int) IFieldContext {
  1986. var t = s.GetTypedRuleContext(reflect.TypeOf((*IFieldContext)(nil)).Elem(), i)
  1987. if t == nil {
  1988. return nil
  1989. }
  1990. return t.(IFieldContext)
  1991. }
  1992. func (s *TypeBlockStructContext) GetRuleContext() antlr.RuleContext {
  1993. return s
  1994. }
  1995. func (s *TypeBlockStructContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  1996. return antlr.TreesStringTree(s, ruleNames, recog)
  1997. }
  1998. func (s *TypeBlockStructContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  1999. switch t := visitor.(type) {
  2000. case ApiParserVisitor:
  2001. return t.VisitTypeBlockStruct(s)
  2002. default:
  2003. return t.VisitChildren(s)
  2004. }
  2005. }
  2006. func (p *ApiParserParser) TypeBlockStruct() (localctx ITypeBlockStructContext) {
  2007. localctx = NewTypeBlockStructContext(p, p.GetParserRuleContext(), p.GetState())
  2008. p.EnterRule(localctx, 32, ApiParserParserRULE_typeBlockStruct)
  2009. var _la int
  2010. defer func() {
  2011. p.ExitRule()
  2012. }()
  2013. defer func() {
  2014. if err := recover(); err != nil {
  2015. if v, ok := err.(antlr.RecognitionException); ok {
  2016. localctx.SetException(v)
  2017. p.GetErrorHandler().ReportError(p, v)
  2018. p.GetErrorHandler().Recover(p, v)
  2019. } else {
  2020. panic(err)
  2021. }
  2022. }
  2023. }()
  2024. var _alt int
  2025. p.EnterOuterAlt(localctx, 1)
  2026. checkKeyword(p)
  2027. {
  2028. p.SetState(175)
  2029. var _m = p.Match(ApiParserParserID)
  2030. localctx.(*TypeBlockStructContext).structName = _m
  2031. }
  2032. p.SetState(177)
  2033. p.GetErrorHandler().Sync(p)
  2034. _la = p.GetTokenStream().LA(1)
  2035. if _la == ApiParserParserID {
  2036. {
  2037. p.SetState(176)
  2038. var _m = p.Match(ApiParserParserID)
  2039. localctx.(*TypeBlockStructContext).structToken = _m
  2040. }
  2041. }
  2042. {
  2043. p.SetState(179)
  2044. var _m = p.Match(ApiParserParserT__3)
  2045. localctx.(*TypeBlockStructContext).lbrace = _m
  2046. }
  2047. p.SetState(183)
  2048. p.GetErrorHandler().Sync(p)
  2049. _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 13, p.GetParserRuleContext())
  2050. for _alt != 2 && _alt != antlr.ATNInvalidAltNumber {
  2051. if _alt == 1 {
  2052. {
  2053. p.SetState(180)
  2054. p.Field()
  2055. }
  2056. }
  2057. p.SetState(185)
  2058. p.GetErrorHandler().Sync(p)
  2059. _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 13, p.GetParserRuleContext())
  2060. }
  2061. {
  2062. p.SetState(186)
  2063. var _m = p.Match(ApiParserParserT__4)
  2064. localctx.(*TypeBlockStructContext).rbrace = _m
  2065. }
  2066. return localctx
  2067. }
  2068. // ITypeBlockAliasContext is an interface to support dynamic dispatch.
  2069. type ITypeBlockAliasContext interface {
  2070. antlr.ParserRuleContext
  2071. // GetParser returns the parser.
  2072. GetParser() antlr.Parser
  2073. // GetAlias returns the alias token.
  2074. GetAlias() antlr.Token
  2075. // GetAssign returns the assign token.
  2076. GetAssign() antlr.Token
  2077. // SetAlias sets the alias token.
  2078. SetAlias(antlr.Token)
  2079. // SetAssign sets the assign token.
  2080. SetAssign(antlr.Token)
  2081. // IsTypeBlockAliasContext differentiates from other interfaces.
  2082. IsTypeBlockAliasContext()
  2083. }
  2084. type TypeBlockAliasContext struct {
  2085. *antlr.BaseParserRuleContext
  2086. parser antlr.Parser
  2087. alias antlr.Token
  2088. assign antlr.Token
  2089. }
  2090. func NewEmptyTypeBlockAliasContext() *TypeBlockAliasContext {
  2091. var p = new(TypeBlockAliasContext)
  2092. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  2093. p.RuleIndex = ApiParserParserRULE_typeBlockAlias
  2094. return p
  2095. }
  2096. func (*TypeBlockAliasContext) IsTypeBlockAliasContext() {}
  2097. func NewTypeBlockAliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockAliasContext {
  2098. var p = new(TypeBlockAliasContext)
  2099. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  2100. p.parser = parser
  2101. p.RuleIndex = ApiParserParserRULE_typeBlockAlias
  2102. return p
  2103. }
  2104. func (s *TypeBlockAliasContext) GetParser() antlr.Parser { return s.parser }
  2105. func (s *TypeBlockAliasContext) GetAlias() antlr.Token { return s.alias }
  2106. func (s *TypeBlockAliasContext) GetAssign() antlr.Token { return s.assign }
  2107. func (s *TypeBlockAliasContext) SetAlias(v antlr.Token) { s.alias = v }
  2108. func (s *TypeBlockAliasContext) SetAssign(v antlr.Token) { s.assign = v }
  2109. func (s *TypeBlockAliasContext) DataType() IDataTypeContext {
  2110. var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
  2111. if t == nil {
  2112. return nil
  2113. }
  2114. return t.(IDataTypeContext)
  2115. }
  2116. func (s *TypeBlockAliasContext) ID() antlr.TerminalNode {
  2117. return s.GetToken(ApiParserParserID, 0)
  2118. }
  2119. func (s *TypeBlockAliasContext) GetRuleContext() antlr.RuleContext {
  2120. return s
  2121. }
  2122. func (s *TypeBlockAliasContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  2123. return antlr.TreesStringTree(s, ruleNames, recog)
  2124. }
  2125. func (s *TypeBlockAliasContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  2126. switch t := visitor.(type) {
  2127. case ApiParserVisitor:
  2128. return t.VisitTypeBlockAlias(s)
  2129. default:
  2130. return t.VisitChildren(s)
  2131. }
  2132. }
  2133. func (p *ApiParserParser) TypeBlockAlias() (localctx ITypeBlockAliasContext) {
  2134. localctx = NewTypeBlockAliasContext(p, p.GetParserRuleContext(), p.GetState())
  2135. p.EnterRule(localctx, 34, ApiParserParserRULE_typeBlockAlias)
  2136. var _la int
  2137. defer func() {
  2138. p.ExitRule()
  2139. }()
  2140. defer func() {
  2141. if err := recover(); err != nil {
  2142. if v, ok := err.(antlr.RecognitionException); ok {
  2143. localctx.SetException(v)
  2144. p.GetErrorHandler().ReportError(p, v)
  2145. p.GetErrorHandler().Recover(p, v)
  2146. } else {
  2147. panic(err)
  2148. }
  2149. }
  2150. }()
  2151. p.EnterOuterAlt(localctx, 1)
  2152. checkKeyword(p)
  2153. {
  2154. p.SetState(189)
  2155. var _m = p.Match(ApiParserParserID)
  2156. localctx.(*TypeBlockAliasContext).alias = _m
  2157. }
  2158. p.SetState(191)
  2159. p.GetErrorHandler().Sync(p)
  2160. _la = p.GetTokenStream().LA(1)
  2161. if _la == ApiParserParserT__0 {
  2162. {
  2163. p.SetState(190)
  2164. var _m = p.Match(ApiParserParserT__0)
  2165. localctx.(*TypeBlockAliasContext).assign = _m
  2166. }
  2167. }
  2168. {
  2169. p.SetState(193)
  2170. p.DataType()
  2171. }
  2172. return localctx
  2173. }
  2174. // IFieldContext is an interface to support dynamic dispatch.
  2175. type IFieldContext interface {
  2176. antlr.ParserRuleContext
  2177. // GetParser returns the parser.
  2178. GetParser() antlr.Parser
  2179. // IsFieldContext differentiates from other interfaces.
  2180. IsFieldContext()
  2181. }
  2182. type FieldContext struct {
  2183. *antlr.BaseParserRuleContext
  2184. parser antlr.Parser
  2185. }
  2186. func NewEmptyFieldContext() *FieldContext {
  2187. var p = new(FieldContext)
  2188. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  2189. p.RuleIndex = ApiParserParserRULE_field
  2190. return p
  2191. }
  2192. func (*FieldContext) IsFieldContext() {}
  2193. func NewFieldContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FieldContext {
  2194. var p = new(FieldContext)
  2195. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  2196. p.parser = parser
  2197. p.RuleIndex = ApiParserParserRULE_field
  2198. return p
  2199. }
  2200. func (s *FieldContext) GetParser() antlr.Parser { return s.parser }
  2201. func (s *FieldContext) NormalField() INormalFieldContext {
  2202. var t = s.GetTypedRuleContext(reflect.TypeOf((*INormalFieldContext)(nil)).Elem(), 0)
  2203. if t == nil {
  2204. return nil
  2205. }
  2206. return t.(INormalFieldContext)
  2207. }
  2208. func (s *FieldContext) AnonymousFiled() IAnonymousFiledContext {
  2209. var t = s.GetTypedRuleContext(reflect.TypeOf((*IAnonymousFiledContext)(nil)).Elem(), 0)
  2210. if t == nil {
  2211. return nil
  2212. }
  2213. return t.(IAnonymousFiledContext)
  2214. }
  2215. func (s *FieldContext) GetRuleContext() antlr.RuleContext {
  2216. return s
  2217. }
  2218. func (s *FieldContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  2219. return antlr.TreesStringTree(s, ruleNames, recog)
  2220. }
  2221. func (s *FieldContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  2222. switch t := visitor.(type) {
  2223. case ApiParserVisitor:
  2224. return t.VisitField(s)
  2225. default:
  2226. return t.VisitChildren(s)
  2227. }
  2228. }
  2229. func (p *ApiParserParser) Field() (localctx IFieldContext) {
  2230. localctx = NewFieldContext(p, p.GetParserRuleContext(), p.GetState())
  2231. p.EnterRule(localctx, 36, ApiParserParserRULE_field)
  2232. defer func() {
  2233. p.ExitRule()
  2234. }()
  2235. defer func() {
  2236. if err := recover(); err != nil {
  2237. if v, ok := err.(antlr.RecognitionException); ok {
  2238. localctx.SetException(v)
  2239. p.GetErrorHandler().ReportError(p, v)
  2240. p.GetErrorHandler().Recover(p, v)
  2241. } else {
  2242. panic(err)
  2243. }
  2244. }
  2245. }()
  2246. p.SetState(198)
  2247. p.GetErrorHandler().Sync(p)
  2248. switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 15, p.GetParserRuleContext()) {
  2249. case 1:
  2250. p.EnterOuterAlt(localctx, 1)
  2251. p.SetState(195)
  2252. if !(isNormal(p)) {
  2253. panic(antlr.NewFailedPredicateException(p, "isNormal(p)", ""))
  2254. }
  2255. {
  2256. p.SetState(196)
  2257. p.NormalField()
  2258. }
  2259. case 2:
  2260. p.EnterOuterAlt(localctx, 2)
  2261. {
  2262. p.SetState(197)
  2263. p.AnonymousFiled()
  2264. }
  2265. }
  2266. return localctx
  2267. }
  2268. // INormalFieldContext is an interface to support dynamic dispatch.
  2269. type INormalFieldContext interface {
  2270. antlr.ParserRuleContext
  2271. // GetParser returns the parser.
  2272. GetParser() antlr.Parser
  2273. // GetFieldName returns the fieldName token.
  2274. GetFieldName() antlr.Token
  2275. // GetTag returns the tag token.
  2276. GetTag() antlr.Token
  2277. // SetFieldName sets the fieldName token.
  2278. SetFieldName(antlr.Token)
  2279. // SetTag sets the tag token.
  2280. SetTag(antlr.Token)
  2281. // IsNormalFieldContext differentiates from other interfaces.
  2282. IsNormalFieldContext()
  2283. }
  2284. type NormalFieldContext struct {
  2285. *antlr.BaseParserRuleContext
  2286. parser antlr.Parser
  2287. fieldName antlr.Token
  2288. tag antlr.Token
  2289. }
  2290. func NewEmptyNormalFieldContext() *NormalFieldContext {
  2291. var p = new(NormalFieldContext)
  2292. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  2293. p.RuleIndex = ApiParserParserRULE_normalField
  2294. return p
  2295. }
  2296. func (*NormalFieldContext) IsNormalFieldContext() {}
  2297. func NewNormalFieldContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *NormalFieldContext {
  2298. var p = new(NormalFieldContext)
  2299. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  2300. p.parser = parser
  2301. p.RuleIndex = ApiParserParserRULE_normalField
  2302. return p
  2303. }
  2304. func (s *NormalFieldContext) GetParser() antlr.Parser { return s.parser }
  2305. func (s *NormalFieldContext) GetFieldName() antlr.Token { return s.fieldName }
  2306. func (s *NormalFieldContext) GetTag() antlr.Token { return s.tag }
  2307. func (s *NormalFieldContext) SetFieldName(v antlr.Token) { s.fieldName = v }
  2308. func (s *NormalFieldContext) SetTag(v antlr.Token) { s.tag = v }
  2309. func (s *NormalFieldContext) DataType() IDataTypeContext {
  2310. var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
  2311. if t == nil {
  2312. return nil
  2313. }
  2314. return t.(IDataTypeContext)
  2315. }
  2316. func (s *NormalFieldContext) ID() antlr.TerminalNode {
  2317. return s.GetToken(ApiParserParserID, 0)
  2318. }
  2319. func (s *NormalFieldContext) RAW_STRING() antlr.TerminalNode {
  2320. return s.GetToken(ApiParserParserRAW_STRING, 0)
  2321. }
  2322. func (s *NormalFieldContext) GetRuleContext() antlr.RuleContext {
  2323. return s
  2324. }
  2325. func (s *NormalFieldContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  2326. return antlr.TreesStringTree(s, ruleNames, recog)
  2327. }
  2328. func (s *NormalFieldContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  2329. switch t := visitor.(type) {
  2330. case ApiParserVisitor:
  2331. return t.VisitNormalField(s)
  2332. default:
  2333. return t.VisitChildren(s)
  2334. }
  2335. }
  2336. func (p *ApiParserParser) NormalField() (localctx INormalFieldContext) {
  2337. localctx = NewNormalFieldContext(p, p.GetParserRuleContext(), p.GetState())
  2338. p.EnterRule(localctx, 38, ApiParserParserRULE_normalField)
  2339. defer func() {
  2340. p.ExitRule()
  2341. }()
  2342. defer func() {
  2343. if err := recover(); err != nil {
  2344. if v, ok := err.(antlr.RecognitionException); ok {
  2345. localctx.SetException(v)
  2346. p.GetErrorHandler().ReportError(p, v)
  2347. p.GetErrorHandler().Recover(p, v)
  2348. } else {
  2349. panic(err)
  2350. }
  2351. }
  2352. }()
  2353. p.EnterOuterAlt(localctx, 1)
  2354. checkKeyword(p)
  2355. {
  2356. p.SetState(201)
  2357. var _m = p.Match(ApiParserParserID)
  2358. localctx.(*NormalFieldContext).fieldName = _m
  2359. }
  2360. {
  2361. p.SetState(202)
  2362. p.DataType()
  2363. }
  2364. p.SetState(204)
  2365. p.GetErrorHandler().Sync(p)
  2366. if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 16, p.GetParserRuleContext()) == 1 {
  2367. {
  2368. p.SetState(203)
  2369. var _m = p.Match(ApiParserParserRAW_STRING)
  2370. localctx.(*NormalFieldContext).tag = _m
  2371. }
  2372. }
  2373. return localctx
  2374. }
  2375. // IAnonymousFiledContext is an interface to support dynamic dispatch.
  2376. type IAnonymousFiledContext interface {
  2377. antlr.ParserRuleContext
  2378. // GetParser returns the parser.
  2379. GetParser() antlr.Parser
  2380. // GetStar returns the star token.
  2381. GetStar() antlr.Token
  2382. // SetStar sets the star token.
  2383. SetStar(antlr.Token)
  2384. // IsAnonymousFiledContext differentiates from other interfaces.
  2385. IsAnonymousFiledContext()
  2386. }
  2387. type AnonymousFiledContext struct {
  2388. *antlr.BaseParserRuleContext
  2389. parser antlr.Parser
  2390. star antlr.Token
  2391. }
  2392. func NewEmptyAnonymousFiledContext() *AnonymousFiledContext {
  2393. var p = new(AnonymousFiledContext)
  2394. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  2395. p.RuleIndex = ApiParserParserRULE_anonymousFiled
  2396. return p
  2397. }
  2398. func (*AnonymousFiledContext) IsAnonymousFiledContext() {}
  2399. func NewAnonymousFiledContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AnonymousFiledContext {
  2400. var p = new(AnonymousFiledContext)
  2401. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  2402. p.parser = parser
  2403. p.RuleIndex = ApiParserParserRULE_anonymousFiled
  2404. return p
  2405. }
  2406. func (s *AnonymousFiledContext) GetParser() antlr.Parser { return s.parser }
  2407. func (s *AnonymousFiledContext) GetStar() antlr.Token { return s.star }
  2408. func (s *AnonymousFiledContext) SetStar(v antlr.Token) { s.star = v }
  2409. func (s *AnonymousFiledContext) ID() antlr.TerminalNode {
  2410. return s.GetToken(ApiParserParserID, 0)
  2411. }
  2412. func (s *AnonymousFiledContext) GetRuleContext() antlr.RuleContext {
  2413. return s
  2414. }
  2415. func (s *AnonymousFiledContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  2416. return antlr.TreesStringTree(s, ruleNames, recog)
  2417. }
  2418. func (s *AnonymousFiledContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  2419. switch t := visitor.(type) {
  2420. case ApiParserVisitor:
  2421. return t.VisitAnonymousFiled(s)
  2422. default:
  2423. return t.VisitChildren(s)
  2424. }
  2425. }
  2426. func (p *ApiParserParser) AnonymousFiled() (localctx IAnonymousFiledContext) {
  2427. localctx = NewAnonymousFiledContext(p, p.GetParserRuleContext(), p.GetState())
  2428. p.EnterRule(localctx, 40, ApiParserParserRULE_anonymousFiled)
  2429. var _la int
  2430. defer func() {
  2431. p.ExitRule()
  2432. }()
  2433. defer func() {
  2434. if err := recover(); err != nil {
  2435. if v, ok := err.(antlr.RecognitionException); ok {
  2436. localctx.SetException(v)
  2437. p.GetErrorHandler().ReportError(p, v)
  2438. p.GetErrorHandler().Recover(p, v)
  2439. } else {
  2440. panic(err)
  2441. }
  2442. }
  2443. }()
  2444. p.EnterOuterAlt(localctx, 1)
  2445. p.SetState(207)
  2446. p.GetErrorHandler().Sync(p)
  2447. _la = p.GetTokenStream().LA(1)
  2448. if _la == ApiParserParserT__5 {
  2449. {
  2450. p.SetState(206)
  2451. var _m = p.Match(ApiParserParserT__5)
  2452. localctx.(*AnonymousFiledContext).star = _m
  2453. }
  2454. }
  2455. {
  2456. p.SetState(209)
  2457. p.Match(ApiParserParserID)
  2458. }
  2459. return localctx
  2460. }
  2461. // IDataTypeContext is an interface to support dynamic dispatch.
  2462. type IDataTypeContext interface {
  2463. antlr.ParserRuleContext
  2464. // GetParser returns the parser.
  2465. GetParser() antlr.Parser
  2466. // GetInter returns the inter token.
  2467. GetInter() antlr.Token
  2468. // GetTime returns the time token.
  2469. GetTime() antlr.Token
  2470. // SetInter sets the inter token.
  2471. SetInter(antlr.Token)
  2472. // SetTime sets the time token.
  2473. SetTime(antlr.Token)
  2474. // IsDataTypeContext differentiates from other interfaces.
  2475. IsDataTypeContext()
  2476. }
  2477. type DataTypeContext struct {
  2478. *antlr.BaseParserRuleContext
  2479. parser antlr.Parser
  2480. inter antlr.Token
  2481. time antlr.Token
  2482. }
  2483. func NewEmptyDataTypeContext() *DataTypeContext {
  2484. var p = new(DataTypeContext)
  2485. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  2486. p.RuleIndex = ApiParserParserRULE_dataType
  2487. return p
  2488. }
  2489. func (*DataTypeContext) IsDataTypeContext() {}
  2490. func NewDataTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DataTypeContext {
  2491. var p = new(DataTypeContext)
  2492. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  2493. p.parser = parser
  2494. p.RuleIndex = ApiParserParserRULE_dataType
  2495. return p
  2496. }
  2497. func (s *DataTypeContext) GetParser() antlr.Parser { return s.parser }
  2498. func (s *DataTypeContext) GetInter() antlr.Token { return s.inter }
  2499. func (s *DataTypeContext) GetTime() antlr.Token { return s.time }
  2500. func (s *DataTypeContext) SetInter(v antlr.Token) { s.inter = v }
  2501. func (s *DataTypeContext) SetTime(v antlr.Token) { s.time = v }
  2502. func (s *DataTypeContext) ID() antlr.TerminalNode {
  2503. return s.GetToken(ApiParserParserID, 0)
  2504. }
  2505. func (s *DataTypeContext) MapType() IMapTypeContext {
  2506. var t = s.GetTypedRuleContext(reflect.TypeOf((*IMapTypeContext)(nil)).Elem(), 0)
  2507. if t == nil {
  2508. return nil
  2509. }
  2510. return t.(IMapTypeContext)
  2511. }
  2512. func (s *DataTypeContext) ArrayType() IArrayTypeContext {
  2513. var t = s.GetTypedRuleContext(reflect.TypeOf((*IArrayTypeContext)(nil)).Elem(), 0)
  2514. if t == nil {
  2515. return nil
  2516. }
  2517. return t.(IArrayTypeContext)
  2518. }
  2519. func (s *DataTypeContext) INTERFACE() antlr.TerminalNode {
  2520. return s.GetToken(ApiParserParserINTERFACE, 0)
  2521. }
  2522. func (s *DataTypeContext) PointerType() IPointerTypeContext {
  2523. var t = s.GetTypedRuleContext(reflect.TypeOf((*IPointerTypeContext)(nil)).Elem(), 0)
  2524. if t == nil {
  2525. return nil
  2526. }
  2527. return t.(IPointerTypeContext)
  2528. }
  2529. func (s *DataTypeContext) TypeStruct() ITypeStructContext {
  2530. var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeStructContext)(nil)).Elem(), 0)
  2531. if t == nil {
  2532. return nil
  2533. }
  2534. return t.(ITypeStructContext)
  2535. }
  2536. func (s *DataTypeContext) GetRuleContext() antlr.RuleContext {
  2537. return s
  2538. }
  2539. func (s *DataTypeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  2540. return antlr.TreesStringTree(s, ruleNames, recog)
  2541. }
  2542. func (s *DataTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  2543. switch t := visitor.(type) {
  2544. case ApiParserVisitor:
  2545. return t.VisitDataType(s)
  2546. default:
  2547. return t.VisitChildren(s)
  2548. }
  2549. }
  2550. func (p *ApiParserParser) DataType() (localctx IDataTypeContext) {
  2551. localctx = NewDataTypeContext(p, p.GetParserRuleContext(), p.GetState())
  2552. p.EnterRule(localctx, 42, ApiParserParserRULE_dataType)
  2553. defer func() {
  2554. p.ExitRule()
  2555. }()
  2556. defer func() {
  2557. if err := recover(); err != nil {
  2558. if v, ok := err.(antlr.RecognitionException); ok {
  2559. localctx.SetException(v)
  2560. p.GetErrorHandler().ReportError(p, v)
  2561. p.GetErrorHandler().Recover(p, v)
  2562. } else {
  2563. panic(err)
  2564. }
  2565. }
  2566. }()
  2567. p.SetState(219)
  2568. p.GetErrorHandler().Sync(p)
  2569. switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 18, p.GetParserRuleContext()) {
  2570. case 1:
  2571. p.EnterOuterAlt(localctx, 1)
  2572. isInterface(p)
  2573. {
  2574. p.SetState(212)
  2575. p.Match(ApiParserParserID)
  2576. }
  2577. case 2:
  2578. p.EnterOuterAlt(localctx, 2)
  2579. {
  2580. p.SetState(213)
  2581. p.MapType()
  2582. }
  2583. case 3:
  2584. p.EnterOuterAlt(localctx, 3)
  2585. {
  2586. p.SetState(214)
  2587. p.ArrayType()
  2588. }
  2589. case 4:
  2590. p.EnterOuterAlt(localctx, 4)
  2591. {
  2592. p.SetState(215)
  2593. var _m = p.Match(ApiParserParserINTERFACE)
  2594. localctx.(*DataTypeContext).inter = _m
  2595. }
  2596. case 5:
  2597. p.EnterOuterAlt(localctx, 5)
  2598. {
  2599. p.SetState(216)
  2600. var _m = p.Match(ApiParserParserT__6)
  2601. localctx.(*DataTypeContext).time = _m
  2602. }
  2603. case 6:
  2604. p.EnterOuterAlt(localctx, 6)
  2605. {
  2606. p.SetState(217)
  2607. p.PointerType()
  2608. }
  2609. case 7:
  2610. p.EnterOuterAlt(localctx, 7)
  2611. {
  2612. p.SetState(218)
  2613. p.TypeStruct()
  2614. }
  2615. }
  2616. return localctx
  2617. }
  2618. // IPointerTypeContext is an interface to support dynamic dispatch.
  2619. type IPointerTypeContext interface {
  2620. antlr.ParserRuleContext
  2621. // GetParser returns the parser.
  2622. GetParser() antlr.Parser
  2623. // GetStar returns the star token.
  2624. GetStar() antlr.Token
  2625. // SetStar sets the star token.
  2626. SetStar(antlr.Token)
  2627. // IsPointerTypeContext differentiates from other interfaces.
  2628. IsPointerTypeContext()
  2629. }
  2630. type PointerTypeContext struct {
  2631. *antlr.BaseParserRuleContext
  2632. parser antlr.Parser
  2633. star antlr.Token
  2634. }
  2635. func NewEmptyPointerTypeContext() *PointerTypeContext {
  2636. var p = new(PointerTypeContext)
  2637. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  2638. p.RuleIndex = ApiParserParserRULE_pointerType
  2639. return p
  2640. }
  2641. func (*PointerTypeContext) IsPointerTypeContext() {}
  2642. func NewPointerTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PointerTypeContext {
  2643. var p = new(PointerTypeContext)
  2644. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  2645. p.parser = parser
  2646. p.RuleIndex = ApiParserParserRULE_pointerType
  2647. return p
  2648. }
  2649. func (s *PointerTypeContext) GetParser() antlr.Parser { return s.parser }
  2650. func (s *PointerTypeContext) GetStar() antlr.Token { return s.star }
  2651. func (s *PointerTypeContext) SetStar(v antlr.Token) { s.star = v }
  2652. func (s *PointerTypeContext) ID() antlr.TerminalNode {
  2653. return s.GetToken(ApiParserParserID, 0)
  2654. }
  2655. func (s *PointerTypeContext) GetRuleContext() antlr.RuleContext {
  2656. return s
  2657. }
  2658. func (s *PointerTypeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  2659. return antlr.TreesStringTree(s, ruleNames, recog)
  2660. }
  2661. func (s *PointerTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  2662. switch t := visitor.(type) {
  2663. case ApiParserVisitor:
  2664. return t.VisitPointerType(s)
  2665. default:
  2666. return t.VisitChildren(s)
  2667. }
  2668. }
  2669. func (p *ApiParserParser) PointerType() (localctx IPointerTypeContext) {
  2670. localctx = NewPointerTypeContext(p, p.GetParserRuleContext(), p.GetState())
  2671. p.EnterRule(localctx, 44, ApiParserParserRULE_pointerType)
  2672. defer func() {
  2673. p.ExitRule()
  2674. }()
  2675. defer func() {
  2676. if err := recover(); err != nil {
  2677. if v, ok := err.(antlr.RecognitionException); ok {
  2678. localctx.SetException(v)
  2679. p.GetErrorHandler().ReportError(p, v)
  2680. p.GetErrorHandler().Recover(p, v)
  2681. } else {
  2682. panic(err)
  2683. }
  2684. }
  2685. }()
  2686. p.EnterOuterAlt(localctx, 1)
  2687. {
  2688. p.SetState(221)
  2689. var _m = p.Match(ApiParserParserT__5)
  2690. localctx.(*PointerTypeContext).star = _m
  2691. }
  2692. checkKeyword(p)
  2693. {
  2694. p.SetState(223)
  2695. p.Match(ApiParserParserID)
  2696. }
  2697. return localctx
  2698. }
  2699. // IMapTypeContext is an interface to support dynamic dispatch.
  2700. type IMapTypeContext interface {
  2701. antlr.ParserRuleContext
  2702. // GetParser returns the parser.
  2703. GetParser() antlr.Parser
  2704. // GetMapToken returns the mapToken token.
  2705. GetMapToken() antlr.Token
  2706. // GetLbrack returns the lbrack token.
  2707. GetLbrack() antlr.Token
  2708. // GetKey returns the key token.
  2709. GetKey() antlr.Token
  2710. // GetRbrack returns the rbrack token.
  2711. GetRbrack() antlr.Token
  2712. // SetMapToken sets the mapToken token.
  2713. SetMapToken(antlr.Token)
  2714. // SetLbrack sets the lbrack token.
  2715. SetLbrack(antlr.Token)
  2716. // SetKey sets the key token.
  2717. SetKey(antlr.Token)
  2718. // SetRbrack sets the rbrack token.
  2719. SetRbrack(antlr.Token)
  2720. // GetValue returns the value rule contexts.
  2721. GetValue() IDataTypeContext
  2722. // SetValue sets the value rule contexts.
  2723. SetValue(IDataTypeContext)
  2724. // IsMapTypeContext differentiates from other interfaces.
  2725. IsMapTypeContext()
  2726. }
  2727. type MapTypeContext struct {
  2728. *antlr.BaseParserRuleContext
  2729. parser antlr.Parser
  2730. mapToken antlr.Token
  2731. lbrack antlr.Token
  2732. key antlr.Token
  2733. rbrack antlr.Token
  2734. value IDataTypeContext
  2735. }
  2736. func NewEmptyMapTypeContext() *MapTypeContext {
  2737. var p = new(MapTypeContext)
  2738. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  2739. p.RuleIndex = ApiParserParserRULE_mapType
  2740. return p
  2741. }
  2742. func (*MapTypeContext) IsMapTypeContext() {}
  2743. func NewMapTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *MapTypeContext {
  2744. var p = new(MapTypeContext)
  2745. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  2746. p.parser = parser
  2747. p.RuleIndex = ApiParserParserRULE_mapType
  2748. return p
  2749. }
  2750. func (s *MapTypeContext) GetParser() antlr.Parser { return s.parser }
  2751. func (s *MapTypeContext) GetMapToken() antlr.Token { return s.mapToken }
  2752. func (s *MapTypeContext) GetLbrack() antlr.Token { return s.lbrack }
  2753. func (s *MapTypeContext) GetKey() antlr.Token { return s.key }
  2754. func (s *MapTypeContext) GetRbrack() antlr.Token { return s.rbrack }
  2755. func (s *MapTypeContext) SetMapToken(v antlr.Token) { s.mapToken = v }
  2756. func (s *MapTypeContext) SetLbrack(v antlr.Token) { s.lbrack = v }
  2757. func (s *MapTypeContext) SetKey(v antlr.Token) { s.key = v }
  2758. func (s *MapTypeContext) SetRbrack(v antlr.Token) { s.rbrack = v }
  2759. func (s *MapTypeContext) GetValue() IDataTypeContext { return s.value }
  2760. func (s *MapTypeContext) SetValue(v IDataTypeContext) { s.value = v }
  2761. func (s *MapTypeContext) AllID() []antlr.TerminalNode {
  2762. return s.GetTokens(ApiParserParserID)
  2763. }
  2764. func (s *MapTypeContext) ID(i int) antlr.TerminalNode {
  2765. return s.GetToken(ApiParserParserID, i)
  2766. }
  2767. func (s *MapTypeContext) DataType() IDataTypeContext {
  2768. var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
  2769. if t == nil {
  2770. return nil
  2771. }
  2772. return t.(IDataTypeContext)
  2773. }
  2774. func (s *MapTypeContext) GetRuleContext() antlr.RuleContext {
  2775. return s
  2776. }
  2777. func (s *MapTypeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  2778. return antlr.TreesStringTree(s, ruleNames, recog)
  2779. }
  2780. func (s *MapTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  2781. switch t := visitor.(type) {
  2782. case ApiParserVisitor:
  2783. return t.VisitMapType(s)
  2784. default:
  2785. return t.VisitChildren(s)
  2786. }
  2787. }
  2788. func (p *ApiParserParser) MapType() (localctx IMapTypeContext) {
  2789. localctx = NewMapTypeContext(p, p.GetParserRuleContext(), p.GetState())
  2790. p.EnterRule(localctx, 46, ApiParserParserRULE_mapType)
  2791. defer func() {
  2792. p.ExitRule()
  2793. }()
  2794. defer func() {
  2795. if err := recover(); err != nil {
  2796. if v, ok := err.(antlr.RecognitionException); ok {
  2797. localctx.SetException(v)
  2798. p.GetErrorHandler().ReportError(p, v)
  2799. p.GetErrorHandler().Recover(p, v)
  2800. } else {
  2801. panic(err)
  2802. }
  2803. }
  2804. }()
  2805. p.EnterOuterAlt(localctx, 1)
  2806. match(p, "map")
  2807. {
  2808. p.SetState(226)
  2809. var _m = p.Match(ApiParserParserID)
  2810. localctx.(*MapTypeContext).mapToken = _m
  2811. }
  2812. {
  2813. p.SetState(227)
  2814. var _m = p.Match(ApiParserParserT__7)
  2815. localctx.(*MapTypeContext).lbrack = _m
  2816. }
  2817. checkKey(p)
  2818. {
  2819. p.SetState(229)
  2820. var _m = p.Match(ApiParserParserID)
  2821. localctx.(*MapTypeContext).key = _m
  2822. }
  2823. {
  2824. p.SetState(230)
  2825. var _m = p.Match(ApiParserParserT__8)
  2826. localctx.(*MapTypeContext).rbrack = _m
  2827. }
  2828. {
  2829. p.SetState(231)
  2830. var _x = p.DataType()
  2831. localctx.(*MapTypeContext).value = _x
  2832. }
  2833. return localctx
  2834. }
  2835. // IArrayTypeContext is an interface to support dynamic dispatch.
  2836. type IArrayTypeContext interface {
  2837. antlr.ParserRuleContext
  2838. // GetParser returns the parser.
  2839. GetParser() antlr.Parser
  2840. // GetLbrack returns the lbrack token.
  2841. GetLbrack() antlr.Token
  2842. // GetRbrack returns the rbrack token.
  2843. GetRbrack() antlr.Token
  2844. // SetLbrack sets the lbrack token.
  2845. SetLbrack(antlr.Token)
  2846. // SetRbrack sets the rbrack token.
  2847. SetRbrack(antlr.Token)
  2848. // IsArrayTypeContext differentiates from other interfaces.
  2849. IsArrayTypeContext()
  2850. }
  2851. type ArrayTypeContext struct {
  2852. *antlr.BaseParserRuleContext
  2853. parser antlr.Parser
  2854. lbrack antlr.Token
  2855. rbrack antlr.Token
  2856. }
  2857. func NewEmptyArrayTypeContext() *ArrayTypeContext {
  2858. var p = new(ArrayTypeContext)
  2859. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  2860. p.RuleIndex = ApiParserParserRULE_arrayType
  2861. return p
  2862. }
  2863. func (*ArrayTypeContext) IsArrayTypeContext() {}
  2864. func NewArrayTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ArrayTypeContext {
  2865. var p = new(ArrayTypeContext)
  2866. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  2867. p.parser = parser
  2868. p.RuleIndex = ApiParserParserRULE_arrayType
  2869. return p
  2870. }
  2871. func (s *ArrayTypeContext) GetParser() antlr.Parser { return s.parser }
  2872. func (s *ArrayTypeContext) GetLbrack() antlr.Token { return s.lbrack }
  2873. func (s *ArrayTypeContext) GetRbrack() antlr.Token { return s.rbrack }
  2874. func (s *ArrayTypeContext) SetLbrack(v antlr.Token) { s.lbrack = v }
  2875. func (s *ArrayTypeContext) SetRbrack(v antlr.Token) { s.rbrack = v }
  2876. func (s *ArrayTypeContext) DataType() IDataTypeContext {
  2877. var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
  2878. if t == nil {
  2879. return nil
  2880. }
  2881. return t.(IDataTypeContext)
  2882. }
  2883. func (s *ArrayTypeContext) GetRuleContext() antlr.RuleContext {
  2884. return s
  2885. }
  2886. func (s *ArrayTypeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  2887. return antlr.TreesStringTree(s, ruleNames, recog)
  2888. }
  2889. func (s *ArrayTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  2890. switch t := visitor.(type) {
  2891. case ApiParserVisitor:
  2892. return t.VisitArrayType(s)
  2893. default:
  2894. return t.VisitChildren(s)
  2895. }
  2896. }
  2897. func (p *ApiParserParser) ArrayType() (localctx IArrayTypeContext) {
  2898. localctx = NewArrayTypeContext(p, p.GetParserRuleContext(), p.GetState())
  2899. p.EnterRule(localctx, 48, ApiParserParserRULE_arrayType)
  2900. defer func() {
  2901. p.ExitRule()
  2902. }()
  2903. defer func() {
  2904. if err := recover(); err != nil {
  2905. if v, ok := err.(antlr.RecognitionException); ok {
  2906. localctx.SetException(v)
  2907. p.GetErrorHandler().ReportError(p, v)
  2908. p.GetErrorHandler().Recover(p, v)
  2909. } else {
  2910. panic(err)
  2911. }
  2912. }
  2913. }()
  2914. p.EnterOuterAlt(localctx, 1)
  2915. {
  2916. p.SetState(233)
  2917. var _m = p.Match(ApiParserParserT__7)
  2918. localctx.(*ArrayTypeContext).lbrack = _m
  2919. }
  2920. {
  2921. p.SetState(234)
  2922. var _m = p.Match(ApiParserParserT__8)
  2923. localctx.(*ArrayTypeContext).rbrack = _m
  2924. }
  2925. {
  2926. p.SetState(235)
  2927. p.DataType()
  2928. }
  2929. return localctx
  2930. }
  2931. // IServiceSpecContext is an interface to support dynamic dispatch.
  2932. type IServiceSpecContext interface {
  2933. antlr.ParserRuleContext
  2934. // GetParser returns the parser.
  2935. GetParser() antlr.Parser
  2936. // IsServiceSpecContext differentiates from other interfaces.
  2937. IsServiceSpecContext()
  2938. }
  2939. type ServiceSpecContext struct {
  2940. *antlr.BaseParserRuleContext
  2941. parser antlr.Parser
  2942. }
  2943. func NewEmptyServiceSpecContext() *ServiceSpecContext {
  2944. var p = new(ServiceSpecContext)
  2945. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  2946. p.RuleIndex = ApiParserParserRULE_serviceSpec
  2947. return p
  2948. }
  2949. func (*ServiceSpecContext) IsServiceSpecContext() {}
  2950. func NewServiceSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceSpecContext {
  2951. var p = new(ServiceSpecContext)
  2952. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  2953. p.parser = parser
  2954. p.RuleIndex = ApiParserParserRULE_serviceSpec
  2955. return p
  2956. }
  2957. func (s *ServiceSpecContext) GetParser() antlr.Parser { return s.parser }
  2958. func (s *ServiceSpecContext) ServiceApi() IServiceApiContext {
  2959. var t = s.GetTypedRuleContext(reflect.TypeOf((*IServiceApiContext)(nil)).Elem(), 0)
  2960. if t == nil {
  2961. return nil
  2962. }
  2963. return t.(IServiceApiContext)
  2964. }
  2965. func (s *ServiceSpecContext) AtServer() IAtServerContext {
  2966. var t = s.GetTypedRuleContext(reflect.TypeOf((*IAtServerContext)(nil)).Elem(), 0)
  2967. if t == nil {
  2968. return nil
  2969. }
  2970. return t.(IAtServerContext)
  2971. }
  2972. func (s *ServiceSpecContext) GetRuleContext() antlr.RuleContext {
  2973. return s
  2974. }
  2975. func (s *ServiceSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  2976. return antlr.TreesStringTree(s, ruleNames, recog)
  2977. }
  2978. func (s *ServiceSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  2979. switch t := visitor.(type) {
  2980. case ApiParserVisitor:
  2981. return t.VisitServiceSpec(s)
  2982. default:
  2983. return t.VisitChildren(s)
  2984. }
  2985. }
  2986. func (p *ApiParserParser) ServiceSpec() (localctx IServiceSpecContext) {
  2987. localctx = NewServiceSpecContext(p, p.GetParserRuleContext(), p.GetState())
  2988. p.EnterRule(localctx, 50, ApiParserParserRULE_serviceSpec)
  2989. var _la int
  2990. defer func() {
  2991. p.ExitRule()
  2992. }()
  2993. defer func() {
  2994. if err := recover(); err != nil {
  2995. if v, ok := err.(antlr.RecognitionException); ok {
  2996. localctx.SetException(v)
  2997. p.GetErrorHandler().ReportError(p, v)
  2998. p.GetErrorHandler().Recover(p, v)
  2999. } else {
  3000. panic(err)
  3001. }
  3002. }
  3003. }()
  3004. p.EnterOuterAlt(localctx, 1)
  3005. p.SetState(238)
  3006. p.GetErrorHandler().Sync(p)
  3007. _la = p.GetTokenStream().LA(1)
  3008. if _la == ApiParserParserATSERVER {
  3009. {
  3010. p.SetState(237)
  3011. p.AtServer()
  3012. }
  3013. }
  3014. {
  3015. p.SetState(240)
  3016. p.ServiceApi()
  3017. }
  3018. return localctx
  3019. }
  3020. // IAtServerContext is an interface to support dynamic dispatch.
  3021. type IAtServerContext interface {
  3022. antlr.ParserRuleContext
  3023. // GetParser returns the parser.
  3024. GetParser() antlr.Parser
  3025. // GetLp returns the lp token.
  3026. GetLp() antlr.Token
  3027. // GetRp returns the rp token.
  3028. GetRp() antlr.Token
  3029. // SetLp sets the lp token.
  3030. SetLp(antlr.Token)
  3031. // SetRp sets the rp token.
  3032. SetRp(antlr.Token)
  3033. // IsAtServerContext differentiates from other interfaces.
  3034. IsAtServerContext()
  3035. }
  3036. type AtServerContext struct {
  3037. *antlr.BaseParserRuleContext
  3038. parser antlr.Parser
  3039. lp antlr.Token
  3040. rp antlr.Token
  3041. }
  3042. func NewEmptyAtServerContext() *AtServerContext {
  3043. var p = new(AtServerContext)
  3044. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  3045. p.RuleIndex = ApiParserParserRULE_atServer
  3046. return p
  3047. }
  3048. func (*AtServerContext) IsAtServerContext() {}
  3049. func NewAtServerContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AtServerContext {
  3050. var p = new(AtServerContext)
  3051. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  3052. p.parser = parser
  3053. p.RuleIndex = ApiParserParserRULE_atServer
  3054. return p
  3055. }
  3056. func (s *AtServerContext) GetParser() antlr.Parser { return s.parser }
  3057. func (s *AtServerContext) GetLp() antlr.Token { return s.lp }
  3058. func (s *AtServerContext) GetRp() antlr.Token { return s.rp }
  3059. func (s *AtServerContext) SetLp(v antlr.Token) { s.lp = v }
  3060. func (s *AtServerContext) SetRp(v antlr.Token) { s.rp = v }
  3061. func (s *AtServerContext) ATSERVER() antlr.TerminalNode {
  3062. return s.GetToken(ApiParserParserATSERVER, 0)
  3063. }
  3064. func (s *AtServerContext) AllKvLit() []IKvLitContext {
  3065. var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IKvLitContext)(nil)).Elem())
  3066. var tst = make([]IKvLitContext, len(ts))
  3067. for i, t := range ts {
  3068. if t != nil {
  3069. tst[i] = t.(IKvLitContext)
  3070. }
  3071. }
  3072. return tst
  3073. }
  3074. func (s *AtServerContext) KvLit(i int) IKvLitContext {
  3075. var t = s.GetTypedRuleContext(reflect.TypeOf((*IKvLitContext)(nil)).Elem(), i)
  3076. if t == nil {
  3077. return nil
  3078. }
  3079. return t.(IKvLitContext)
  3080. }
  3081. func (s *AtServerContext) GetRuleContext() antlr.RuleContext {
  3082. return s
  3083. }
  3084. func (s *AtServerContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  3085. return antlr.TreesStringTree(s, ruleNames, recog)
  3086. }
  3087. func (s *AtServerContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  3088. switch t := visitor.(type) {
  3089. case ApiParserVisitor:
  3090. return t.VisitAtServer(s)
  3091. default:
  3092. return t.VisitChildren(s)
  3093. }
  3094. }
  3095. func (p *ApiParserParser) AtServer() (localctx IAtServerContext) {
  3096. localctx = NewAtServerContext(p, p.GetParserRuleContext(), p.GetState())
  3097. p.EnterRule(localctx, 52, ApiParserParserRULE_atServer)
  3098. var _la int
  3099. defer func() {
  3100. p.ExitRule()
  3101. }()
  3102. defer func() {
  3103. if err := recover(); err != nil {
  3104. if v, ok := err.(antlr.RecognitionException); ok {
  3105. localctx.SetException(v)
  3106. p.GetErrorHandler().ReportError(p, v)
  3107. p.GetErrorHandler().Recover(p, v)
  3108. } else {
  3109. panic(err)
  3110. }
  3111. }
  3112. }()
  3113. p.EnterOuterAlt(localctx, 1)
  3114. {
  3115. p.SetState(242)
  3116. p.Match(ApiParserParserATSERVER)
  3117. }
  3118. {
  3119. p.SetState(243)
  3120. var _m = p.Match(ApiParserParserT__1)
  3121. localctx.(*AtServerContext).lp = _m
  3122. }
  3123. p.SetState(245)
  3124. p.GetErrorHandler().Sync(p)
  3125. _la = p.GetTokenStream().LA(1)
  3126. for ok := true; ok; ok = _la == ApiParserParserID {
  3127. {
  3128. p.SetState(244)
  3129. p.KvLit()
  3130. }
  3131. p.SetState(247)
  3132. p.GetErrorHandler().Sync(p)
  3133. _la = p.GetTokenStream().LA(1)
  3134. }
  3135. {
  3136. p.SetState(249)
  3137. var _m = p.Match(ApiParserParserT__2)
  3138. localctx.(*AtServerContext).rp = _m
  3139. }
  3140. return localctx
  3141. }
  3142. // IServiceApiContext is an interface to support dynamic dispatch.
  3143. type IServiceApiContext interface {
  3144. antlr.ParserRuleContext
  3145. // GetParser returns the parser.
  3146. GetParser() antlr.Parser
  3147. // GetServiceToken returns the serviceToken token.
  3148. GetServiceToken() antlr.Token
  3149. // GetLbrace returns the lbrace token.
  3150. GetLbrace() antlr.Token
  3151. // GetRbrace returns the rbrace token.
  3152. GetRbrace() antlr.Token
  3153. // SetServiceToken sets the serviceToken token.
  3154. SetServiceToken(antlr.Token)
  3155. // SetLbrace sets the lbrace token.
  3156. SetLbrace(antlr.Token)
  3157. // SetRbrace sets the rbrace token.
  3158. SetRbrace(antlr.Token)
  3159. // IsServiceApiContext differentiates from other interfaces.
  3160. IsServiceApiContext()
  3161. }
  3162. type ServiceApiContext struct {
  3163. *antlr.BaseParserRuleContext
  3164. parser antlr.Parser
  3165. serviceToken antlr.Token
  3166. lbrace antlr.Token
  3167. rbrace antlr.Token
  3168. }
  3169. func NewEmptyServiceApiContext() *ServiceApiContext {
  3170. var p = new(ServiceApiContext)
  3171. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  3172. p.RuleIndex = ApiParserParserRULE_serviceApi
  3173. return p
  3174. }
  3175. func (*ServiceApiContext) IsServiceApiContext() {}
  3176. func NewServiceApiContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceApiContext {
  3177. var p = new(ServiceApiContext)
  3178. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  3179. p.parser = parser
  3180. p.RuleIndex = ApiParserParserRULE_serviceApi
  3181. return p
  3182. }
  3183. func (s *ServiceApiContext) GetParser() antlr.Parser { return s.parser }
  3184. func (s *ServiceApiContext) GetServiceToken() antlr.Token { return s.serviceToken }
  3185. func (s *ServiceApiContext) GetLbrace() antlr.Token { return s.lbrace }
  3186. func (s *ServiceApiContext) GetRbrace() antlr.Token { return s.rbrace }
  3187. func (s *ServiceApiContext) SetServiceToken(v antlr.Token) { s.serviceToken = v }
  3188. func (s *ServiceApiContext) SetLbrace(v antlr.Token) { s.lbrace = v }
  3189. func (s *ServiceApiContext) SetRbrace(v antlr.Token) { s.rbrace = v }
  3190. func (s *ServiceApiContext) ServiceName() IServiceNameContext {
  3191. var t = s.GetTypedRuleContext(reflect.TypeOf((*IServiceNameContext)(nil)).Elem(), 0)
  3192. if t == nil {
  3193. return nil
  3194. }
  3195. return t.(IServiceNameContext)
  3196. }
  3197. func (s *ServiceApiContext) ID() antlr.TerminalNode {
  3198. return s.GetToken(ApiParserParserID, 0)
  3199. }
  3200. func (s *ServiceApiContext) AllServiceRoute() []IServiceRouteContext {
  3201. var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IServiceRouteContext)(nil)).Elem())
  3202. var tst = make([]IServiceRouteContext, len(ts))
  3203. for i, t := range ts {
  3204. if t != nil {
  3205. tst[i] = t.(IServiceRouteContext)
  3206. }
  3207. }
  3208. return tst
  3209. }
  3210. func (s *ServiceApiContext) ServiceRoute(i int) IServiceRouteContext {
  3211. var t = s.GetTypedRuleContext(reflect.TypeOf((*IServiceRouteContext)(nil)).Elem(), i)
  3212. if t == nil {
  3213. return nil
  3214. }
  3215. return t.(IServiceRouteContext)
  3216. }
  3217. func (s *ServiceApiContext) GetRuleContext() antlr.RuleContext {
  3218. return s
  3219. }
  3220. func (s *ServiceApiContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  3221. return antlr.TreesStringTree(s, ruleNames, recog)
  3222. }
  3223. func (s *ServiceApiContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  3224. switch t := visitor.(type) {
  3225. case ApiParserVisitor:
  3226. return t.VisitServiceApi(s)
  3227. default:
  3228. return t.VisitChildren(s)
  3229. }
  3230. }
  3231. func (p *ApiParserParser) ServiceApi() (localctx IServiceApiContext) {
  3232. localctx = NewServiceApiContext(p, p.GetParserRuleContext(), p.GetState())
  3233. p.EnterRule(localctx, 54, ApiParserParserRULE_serviceApi)
  3234. var _la int
  3235. defer func() {
  3236. p.ExitRule()
  3237. }()
  3238. defer func() {
  3239. if err := recover(); err != nil {
  3240. if v, ok := err.(antlr.RecognitionException); ok {
  3241. localctx.SetException(v)
  3242. p.GetErrorHandler().ReportError(p, v)
  3243. p.GetErrorHandler().Recover(p, v)
  3244. } else {
  3245. panic(err)
  3246. }
  3247. }
  3248. }()
  3249. p.EnterOuterAlt(localctx, 1)
  3250. match(p, "service")
  3251. {
  3252. p.SetState(252)
  3253. var _m = p.Match(ApiParserParserID)
  3254. localctx.(*ServiceApiContext).serviceToken = _m
  3255. }
  3256. {
  3257. p.SetState(253)
  3258. p.ServiceName()
  3259. }
  3260. {
  3261. p.SetState(254)
  3262. var _m = p.Match(ApiParserParserT__3)
  3263. localctx.(*ServiceApiContext).lbrace = _m
  3264. }
  3265. p.SetState(258)
  3266. p.GetErrorHandler().Sync(p)
  3267. _la = p.GetTokenStream().LA(1)
  3268. for ((_la)&-(0x1f+1)) == 0 && ((1<<uint(_la))&((1<<ApiParserParserATDOC)|(1<<ApiParserParserATHANDLER)|(1<<ApiParserParserATSERVER))) != 0 {
  3269. {
  3270. p.SetState(255)
  3271. p.ServiceRoute()
  3272. }
  3273. p.SetState(260)
  3274. p.GetErrorHandler().Sync(p)
  3275. _la = p.GetTokenStream().LA(1)
  3276. }
  3277. {
  3278. p.SetState(261)
  3279. var _m = p.Match(ApiParserParserT__4)
  3280. localctx.(*ServiceApiContext).rbrace = _m
  3281. }
  3282. return localctx
  3283. }
  3284. // IServiceRouteContext is an interface to support dynamic dispatch.
  3285. type IServiceRouteContext interface {
  3286. antlr.ParserRuleContext
  3287. // GetParser returns the parser.
  3288. GetParser() antlr.Parser
  3289. // IsServiceRouteContext differentiates from other interfaces.
  3290. IsServiceRouteContext()
  3291. }
  3292. type ServiceRouteContext struct {
  3293. *antlr.BaseParserRuleContext
  3294. parser antlr.Parser
  3295. }
  3296. func NewEmptyServiceRouteContext() *ServiceRouteContext {
  3297. var p = new(ServiceRouteContext)
  3298. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  3299. p.RuleIndex = ApiParserParserRULE_serviceRoute
  3300. return p
  3301. }
  3302. func (*ServiceRouteContext) IsServiceRouteContext() {}
  3303. func NewServiceRouteContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceRouteContext {
  3304. var p = new(ServiceRouteContext)
  3305. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  3306. p.parser = parser
  3307. p.RuleIndex = ApiParserParserRULE_serviceRoute
  3308. return p
  3309. }
  3310. func (s *ServiceRouteContext) GetParser() antlr.Parser { return s.parser }
  3311. func (s *ServiceRouteContext) Route() IRouteContext {
  3312. var t = s.GetTypedRuleContext(reflect.TypeOf((*IRouteContext)(nil)).Elem(), 0)
  3313. if t == nil {
  3314. return nil
  3315. }
  3316. return t.(IRouteContext)
  3317. }
  3318. func (s *ServiceRouteContext) AtServer() IAtServerContext {
  3319. var t = s.GetTypedRuleContext(reflect.TypeOf((*IAtServerContext)(nil)).Elem(), 0)
  3320. if t == nil {
  3321. return nil
  3322. }
  3323. return t.(IAtServerContext)
  3324. }
  3325. func (s *ServiceRouteContext) AtHandler() IAtHandlerContext {
  3326. var t = s.GetTypedRuleContext(reflect.TypeOf((*IAtHandlerContext)(nil)).Elem(), 0)
  3327. if t == nil {
  3328. return nil
  3329. }
  3330. return t.(IAtHandlerContext)
  3331. }
  3332. func (s *ServiceRouteContext) AtDoc() IAtDocContext {
  3333. var t = s.GetTypedRuleContext(reflect.TypeOf((*IAtDocContext)(nil)).Elem(), 0)
  3334. if t == nil {
  3335. return nil
  3336. }
  3337. return t.(IAtDocContext)
  3338. }
  3339. func (s *ServiceRouteContext) GetRuleContext() antlr.RuleContext {
  3340. return s
  3341. }
  3342. func (s *ServiceRouteContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  3343. return antlr.TreesStringTree(s, ruleNames, recog)
  3344. }
  3345. func (s *ServiceRouteContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  3346. switch t := visitor.(type) {
  3347. case ApiParserVisitor:
  3348. return t.VisitServiceRoute(s)
  3349. default:
  3350. return t.VisitChildren(s)
  3351. }
  3352. }
  3353. func (p *ApiParserParser) ServiceRoute() (localctx IServiceRouteContext) {
  3354. localctx = NewServiceRouteContext(p, p.GetParserRuleContext(), p.GetState())
  3355. p.EnterRule(localctx, 56, ApiParserParserRULE_serviceRoute)
  3356. var _la int
  3357. defer func() {
  3358. p.ExitRule()
  3359. }()
  3360. defer func() {
  3361. if err := recover(); err != nil {
  3362. if v, ok := err.(antlr.RecognitionException); ok {
  3363. localctx.SetException(v)
  3364. p.GetErrorHandler().ReportError(p, v)
  3365. p.GetErrorHandler().Recover(p, v)
  3366. } else {
  3367. panic(err)
  3368. }
  3369. }
  3370. }()
  3371. p.EnterOuterAlt(localctx, 1)
  3372. p.SetState(264)
  3373. p.GetErrorHandler().Sync(p)
  3374. _la = p.GetTokenStream().LA(1)
  3375. if _la == ApiParserParserATDOC {
  3376. {
  3377. p.SetState(263)
  3378. p.AtDoc()
  3379. }
  3380. }
  3381. p.SetState(268)
  3382. p.GetErrorHandler().Sync(p)
  3383. switch p.GetTokenStream().LA(1) {
  3384. case ApiParserParserATSERVER:
  3385. {
  3386. p.SetState(266)
  3387. p.AtServer()
  3388. }
  3389. case ApiParserParserATHANDLER:
  3390. {
  3391. p.SetState(267)
  3392. p.AtHandler()
  3393. }
  3394. default:
  3395. panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
  3396. }
  3397. {
  3398. p.SetState(270)
  3399. p.Route()
  3400. }
  3401. return localctx
  3402. }
  3403. // IAtDocContext is an interface to support dynamic dispatch.
  3404. type IAtDocContext interface {
  3405. antlr.ParserRuleContext
  3406. // GetParser returns the parser.
  3407. GetParser() antlr.Parser
  3408. // GetLp returns the lp token.
  3409. GetLp() antlr.Token
  3410. // GetRp returns the rp token.
  3411. GetRp() antlr.Token
  3412. // SetLp sets the lp token.
  3413. SetLp(antlr.Token)
  3414. // SetRp sets the rp token.
  3415. SetRp(antlr.Token)
  3416. // IsAtDocContext differentiates from other interfaces.
  3417. IsAtDocContext()
  3418. }
  3419. type AtDocContext struct {
  3420. *antlr.BaseParserRuleContext
  3421. parser antlr.Parser
  3422. lp antlr.Token
  3423. rp antlr.Token
  3424. }
  3425. func NewEmptyAtDocContext() *AtDocContext {
  3426. var p = new(AtDocContext)
  3427. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  3428. p.RuleIndex = ApiParserParserRULE_atDoc
  3429. return p
  3430. }
  3431. func (*AtDocContext) IsAtDocContext() {}
  3432. func NewAtDocContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AtDocContext {
  3433. var p = new(AtDocContext)
  3434. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  3435. p.parser = parser
  3436. p.RuleIndex = ApiParserParserRULE_atDoc
  3437. return p
  3438. }
  3439. func (s *AtDocContext) GetParser() antlr.Parser { return s.parser }
  3440. func (s *AtDocContext) GetLp() antlr.Token { return s.lp }
  3441. func (s *AtDocContext) GetRp() antlr.Token { return s.rp }
  3442. func (s *AtDocContext) SetLp(v antlr.Token) { s.lp = v }
  3443. func (s *AtDocContext) SetRp(v antlr.Token) { s.rp = v }
  3444. func (s *AtDocContext) ATDOC() antlr.TerminalNode {
  3445. return s.GetToken(ApiParserParserATDOC, 0)
  3446. }
  3447. func (s *AtDocContext) STRING() antlr.TerminalNode {
  3448. return s.GetToken(ApiParserParserSTRING, 0)
  3449. }
  3450. func (s *AtDocContext) AllKvLit() []IKvLitContext {
  3451. var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IKvLitContext)(nil)).Elem())
  3452. var tst = make([]IKvLitContext, len(ts))
  3453. for i, t := range ts {
  3454. if t != nil {
  3455. tst[i] = t.(IKvLitContext)
  3456. }
  3457. }
  3458. return tst
  3459. }
  3460. func (s *AtDocContext) KvLit(i int) IKvLitContext {
  3461. var t = s.GetTypedRuleContext(reflect.TypeOf((*IKvLitContext)(nil)).Elem(), i)
  3462. if t == nil {
  3463. return nil
  3464. }
  3465. return t.(IKvLitContext)
  3466. }
  3467. func (s *AtDocContext) GetRuleContext() antlr.RuleContext {
  3468. return s
  3469. }
  3470. func (s *AtDocContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  3471. return antlr.TreesStringTree(s, ruleNames, recog)
  3472. }
  3473. func (s *AtDocContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  3474. switch t := visitor.(type) {
  3475. case ApiParserVisitor:
  3476. return t.VisitAtDoc(s)
  3477. default:
  3478. return t.VisitChildren(s)
  3479. }
  3480. }
  3481. func (p *ApiParserParser) AtDoc() (localctx IAtDocContext) {
  3482. localctx = NewAtDocContext(p, p.GetParserRuleContext(), p.GetState())
  3483. p.EnterRule(localctx, 58, ApiParserParserRULE_atDoc)
  3484. var _la int
  3485. defer func() {
  3486. p.ExitRule()
  3487. }()
  3488. defer func() {
  3489. if err := recover(); err != nil {
  3490. if v, ok := err.(antlr.RecognitionException); ok {
  3491. localctx.SetException(v)
  3492. p.GetErrorHandler().ReportError(p, v)
  3493. p.GetErrorHandler().Recover(p, v)
  3494. } else {
  3495. panic(err)
  3496. }
  3497. }
  3498. }()
  3499. p.EnterOuterAlt(localctx, 1)
  3500. {
  3501. p.SetState(272)
  3502. p.Match(ApiParserParserATDOC)
  3503. }
  3504. p.SetState(274)
  3505. p.GetErrorHandler().Sync(p)
  3506. _la = p.GetTokenStream().LA(1)
  3507. if _la == ApiParserParserT__1 {
  3508. {
  3509. p.SetState(273)
  3510. var _m = p.Match(ApiParserParserT__1)
  3511. localctx.(*AtDocContext).lp = _m
  3512. }
  3513. }
  3514. p.SetState(282)
  3515. p.GetErrorHandler().Sync(p)
  3516. switch p.GetTokenStream().LA(1) {
  3517. case ApiParserParserID:
  3518. p.SetState(277)
  3519. p.GetErrorHandler().Sync(p)
  3520. _la = p.GetTokenStream().LA(1)
  3521. for ok := true; ok; ok = _la == ApiParserParserID {
  3522. {
  3523. p.SetState(276)
  3524. p.KvLit()
  3525. }
  3526. p.SetState(279)
  3527. p.GetErrorHandler().Sync(p)
  3528. _la = p.GetTokenStream().LA(1)
  3529. }
  3530. case ApiParserParserSTRING:
  3531. {
  3532. p.SetState(281)
  3533. p.Match(ApiParserParserSTRING)
  3534. }
  3535. default:
  3536. panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
  3537. }
  3538. p.SetState(285)
  3539. p.GetErrorHandler().Sync(p)
  3540. _la = p.GetTokenStream().LA(1)
  3541. if _la == ApiParserParserT__2 {
  3542. {
  3543. p.SetState(284)
  3544. var _m = p.Match(ApiParserParserT__2)
  3545. localctx.(*AtDocContext).rp = _m
  3546. }
  3547. }
  3548. return localctx
  3549. }
  3550. // IAtHandlerContext is an interface to support dynamic dispatch.
  3551. type IAtHandlerContext interface {
  3552. antlr.ParserRuleContext
  3553. // GetParser returns the parser.
  3554. GetParser() antlr.Parser
  3555. // IsAtHandlerContext differentiates from other interfaces.
  3556. IsAtHandlerContext()
  3557. }
  3558. type AtHandlerContext struct {
  3559. *antlr.BaseParserRuleContext
  3560. parser antlr.Parser
  3561. }
  3562. func NewEmptyAtHandlerContext() *AtHandlerContext {
  3563. var p = new(AtHandlerContext)
  3564. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  3565. p.RuleIndex = ApiParserParserRULE_atHandler
  3566. return p
  3567. }
  3568. func (*AtHandlerContext) IsAtHandlerContext() {}
  3569. func NewAtHandlerContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AtHandlerContext {
  3570. var p = new(AtHandlerContext)
  3571. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  3572. p.parser = parser
  3573. p.RuleIndex = ApiParserParserRULE_atHandler
  3574. return p
  3575. }
  3576. func (s *AtHandlerContext) GetParser() antlr.Parser { return s.parser }
  3577. func (s *AtHandlerContext) ATHANDLER() antlr.TerminalNode {
  3578. return s.GetToken(ApiParserParserATHANDLER, 0)
  3579. }
  3580. func (s *AtHandlerContext) ID() antlr.TerminalNode {
  3581. return s.GetToken(ApiParserParserID, 0)
  3582. }
  3583. func (s *AtHandlerContext) GetRuleContext() antlr.RuleContext {
  3584. return s
  3585. }
  3586. func (s *AtHandlerContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  3587. return antlr.TreesStringTree(s, ruleNames, recog)
  3588. }
  3589. func (s *AtHandlerContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  3590. switch t := visitor.(type) {
  3591. case ApiParserVisitor:
  3592. return t.VisitAtHandler(s)
  3593. default:
  3594. return t.VisitChildren(s)
  3595. }
  3596. }
  3597. func (p *ApiParserParser) AtHandler() (localctx IAtHandlerContext) {
  3598. localctx = NewAtHandlerContext(p, p.GetParserRuleContext(), p.GetState())
  3599. p.EnterRule(localctx, 60, ApiParserParserRULE_atHandler)
  3600. defer func() {
  3601. p.ExitRule()
  3602. }()
  3603. defer func() {
  3604. if err := recover(); err != nil {
  3605. if v, ok := err.(antlr.RecognitionException); ok {
  3606. localctx.SetException(v)
  3607. p.GetErrorHandler().ReportError(p, v)
  3608. p.GetErrorHandler().Recover(p, v)
  3609. } else {
  3610. panic(err)
  3611. }
  3612. }
  3613. }()
  3614. p.EnterOuterAlt(localctx, 1)
  3615. {
  3616. p.SetState(287)
  3617. p.Match(ApiParserParserATHANDLER)
  3618. }
  3619. {
  3620. p.SetState(288)
  3621. p.Match(ApiParserParserID)
  3622. }
  3623. return localctx
  3624. }
  3625. // IRouteContext is an interface to support dynamic dispatch.
  3626. type IRouteContext interface {
  3627. antlr.ParserRuleContext
  3628. // GetParser returns the parser.
  3629. GetParser() antlr.Parser
  3630. // GetHttpMethod returns the httpMethod token.
  3631. GetHttpMethod() antlr.Token
  3632. // GetReturnToken returns the returnToken token.
  3633. GetReturnToken() antlr.Token
  3634. // SetHttpMethod sets the httpMethod token.
  3635. SetHttpMethod(antlr.Token)
  3636. // SetReturnToken sets the returnToken token.
  3637. SetReturnToken(antlr.Token)
  3638. // GetRequest returns the request rule contexts.
  3639. GetRequest() IBodyContext
  3640. // GetResponse returns the response rule contexts.
  3641. GetResponse() IReplybodyContext
  3642. // SetRequest sets the request rule contexts.
  3643. SetRequest(IBodyContext)
  3644. // SetResponse sets the response rule contexts.
  3645. SetResponse(IReplybodyContext)
  3646. // IsRouteContext differentiates from other interfaces.
  3647. IsRouteContext()
  3648. }
  3649. type RouteContext struct {
  3650. *antlr.BaseParserRuleContext
  3651. parser antlr.Parser
  3652. httpMethod antlr.Token
  3653. request IBodyContext
  3654. returnToken antlr.Token
  3655. response IReplybodyContext
  3656. }
  3657. func NewEmptyRouteContext() *RouteContext {
  3658. var p = new(RouteContext)
  3659. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  3660. p.RuleIndex = ApiParserParserRULE_route
  3661. return p
  3662. }
  3663. func (*RouteContext) IsRouteContext() {}
  3664. func NewRouteContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RouteContext {
  3665. var p = new(RouteContext)
  3666. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  3667. p.parser = parser
  3668. p.RuleIndex = ApiParserParserRULE_route
  3669. return p
  3670. }
  3671. func (s *RouteContext) GetParser() antlr.Parser { return s.parser }
  3672. func (s *RouteContext) GetHttpMethod() antlr.Token { return s.httpMethod }
  3673. func (s *RouteContext) GetReturnToken() antlr.Token { return s.returnToken }
  3674. func (s *RouteContext) SetHttpMethod(v antlr.Token) { s.httpMethod = v }
  3675. func (s *RouteContext) SetReturnToken(v antlr.Token) { s.returnToken = v }
  3676. func (s *RouteContext) GetRequest() IBodyContext { return s.request }
  3677. func (s *RouteContext) GetResponse() IReplybodyContext { return s.response }
  3678. func (s *RouteContext) SetRequest(v IBodyContext) { s.request = v }
  3679. func (s *RouteContext) SetResponse(v IReplybodyContext) { s.response = v }
  3680. func (s *RouteContext) Path() IPathContext {
  3681. var t = s.GetTypedRuleContext(reflect.TypeOf((*IPathContext)(nil)).Elem(), 0)
  3682. if t == nil {
  3683. return nil
  3684. }
  3685. return t.(IPathContext)
  3686. }
  3687. func (s *RouteContext) AllID() []antlr.TerminalNode {
  3688. return s.GetTokens(ApiParserParserID)
  3689. }
  3690. func (s *RouteContext) ID(i int) antlr.TerminalNode {
  3691. return s.GetToken(ApiParserParserID, i)
  3692. }
  3693. func (s *RouteContext) Body() IBodyContext {
  3694. var t = s.GetTypedRuleContext(reflect.TypeOf((*IBodyContext)(nil)).Elem(), 0)
  3695. if t == nil {
  3696. return nil
  3697. }
  3698. return t.(IBodyContext)
  3699. }
  3700. func (s *RouteContext) Replybody() IReplybodyContext {
  3701. var t = s.GetTypedRuleContext(reflect.TypeOf((*IReplybodyContext)(nil)).Elem(), 0)
  3702. if t == nil {
  3703. return nil
  3704. }
  3705. return t.(IReplybodyContext)
  3706. }
  3707. func (s *RouteContext) GetRuleContext() antlr.RuleContext {
  3708. return s
  3709. }
  3710. func (s *RouteContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  3711. return antlr.TreesStringTree(s, ruleNames, recog)
  3712. }
  3713. func (s *RouteContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  3714. switch t := visitor.(type) {
  3715. case ApiParserVisitor:
  3716. return t.VisitRoute(s)
  3717. default:
  3718. return t.VisitChildren(s)
  3719. }
  3720. }
  3721. func (p *ApiParserParser) Route() (localctx IRouteContext) {
  3722. localctx = NewRouteContext(p, p.GetParserRuleContext(), p.GetState())
  3723. p.EnterRule(localctx, 62, ApiParserParserRULE_route)
  3724. var _la int
  3725. defer func() {
  3726. p.ExitRule()
  3727. }()
  3728. defer func() {
  3729. if err := recover(); err != nil {
  3730. if v, ok := err.(antlr.RecognitionException); ok {
  3731. localctx.SetException(v)
  3732. p.GetErrorHandler().ReportError(p, v)
  3733. p.GetErrorHandler().Recover(p, v)
  3734. } else {
  3735. panic(err)
  3736. }
  3737. }
  3738. }()
  3739. p.EnterOuterAlt(localctx, 1)
  3740. checkHTTPMethod(p)
  3741. {
  3742. p.SetState(291)
  3743. var _m = p.Match(ApiParserParserID)
  3744. localctx.(*RouteContext).httpMethod = _m
  3745. }
  3746. {
  3747. p.SetState(292)
  3748. p.Path()
  3749. }
  3750. p.SetState(294)
  3751. p.GetErrorHandler().Sync(p)
  3752. if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 28, p.GetParserRuleContext()) == 1 {
  3753. {
  3754. p.SetState(293)
  3755. var _x = p.Body()
  3756. localctx.(*RouteContext).request = _x
  3757. }
  3758. }
  3759. p.SetState(297)
  3760. p.GetErrorHandler().Sync(p)
  3761. _la = p.GetTokenStream().LA(1)
  3762. if _la == ApiParserParserID {
  3763. {
  3764. p.SetState(296)
  3765. var _m = p.Match(ApiParserParserID)
  3766. localctx.(*RouteContext).returnToken = _m
  3767. }
  3768. }
  3769. p.SetState(300)
  3770. p.GetErrorHandler().Sync(p)
  3771. _la = p.GetTokenStream().LA(1)
  3772. if _la == ApiParserParserT__1 {
  3773. {
  3774. p.SetState(299)
  3775. var _x = p.Replybody()
  3776. localctx.(*RouteContext).response = _x
  3777. }
  3778. }
  3779. return localctx
  3780. }
  3781. // IBodyContext is an interface to support dynamic dispatch.
  3782. type IBodyContext interface {
  3783. antlr.ParserRuleContext
  3784. // GetParser returns the parser.
  3785. GetParser() antlr.Parser
  3786. // GetLp returns the lp token.
  3787. GetLp() antlr.Token
  3788. // GetRp returns the rp token.
  3789. GetRp() antlr.Token
  3790. // SetLp sets the lp token.
  3791. SetLp(antlr.Token)
  3792. // SetRp sets the rp token.
  3793. SetRp(antlr.Token)
  3794. // IsBodyContext differentiates from other interfaces.
  3795. IsBodyContext()
  3796. }
  3797. type BodyContext struct {
  3798. *antlr.BaseParserRuleContext
  3799. parser antlr.Parser
  3800. lp antlr.Token
  3801. rp antlr.Token
  3802. }
  3803. func NewEmptyBodyContext() *BodyContext {
  3804. var p = new(BodyContext)
  3805. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  3806. p.RuleIndex = ApiParserParserRULE_body
  3807. return p
  3808. }
  3809. func (*BodyContext) IsBodyContext() {}
  3810. func NewBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *BodyContext {
  3811. var p = new(BodyContext)
  3812. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  3813. p.parser = parser
  3814. p.RuleIndex = ApiParserParserRULE_body
  3815. return p
  3816. }
  3817. func (s *BodyContext) GetParser() antlr.Parser { return s.parser }
  3818. func (s *BodyContext) GetLp() antlr.Token { return s.lp }
  3819. func (s *BodyContext) GetRp() antlr.Token { return s.rp }
  3820. func (s *BodyContext) SetLp(v antlr.Token) { s.lp = v }
  3821. func (s *BodyContext) SetRp(v antlr.Token) { s.rp = v }
  3822. func (s *BodyContext) ID() antlr.TerminalNode {
  3823. return s.GetToken(ApiParserParserID, 0)
  3824. }
  3825. func (s *BodyContext) GetRuleContext() antlr.RuleContext {
  3826. return s
  3827. }
  3828. func (s *BodyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  3829. return antlr.TreesStringTree(s, ruleNames, recog)
  3830. }
  3831. func (s *BodyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  3832. switch t := visitor.(type) {
  3833. case ApiParserVisitor:
  3834. return t.VisitBody(s)
  3835. default:
  3836. return t.VisitChildren(s)
  3837. }
  3838. }
  3839. func (p *ApiParserParser) Body() (localctx IBodyContext) {
  3840. localctx = NewBodyContext(p, p.GetParserRuleContext(), p.GetState())
  3841. p.EnterRule(localctx, 64, ApiParserParserRULE_body)
  3842. var _la int
  3843. defer func() {
  3844. p.ExitRule()
  3845. }()
  3846. defer func() {
  3847. if err := recover(); err != nil {
  3848. if v, ok := err.(antlr.RecognitionException); ok {
  3849. localctx.SetException(v)
  3850. p.GetErrorHandler().ReportError(p, v)
  3851. p.GetErrorHandler().Recover(p, v)
  3852. } else {
  3853. panic(err)
  3854. }
  3855. }
  3856. }()
  3857. p.EnterOuterAlt(localctx, 1)
  3858. {
  3859. p.SetState(302)
  3860. var _m = p.Match(ApiParserParserT__1)
  3861. localctx.(*BodyContext).lp = _m
  3862. }
  3863. p.SetState(304)
  3864. p.GetErrorHandler().Sync(p)
  3865. _la = p.GetTokenStream().LA(1)
  3866. if _la == ApiParserParserID {
  3867. {
  3868. p.SetState(303)
  3869. p.Match(ApiParserParserID)
  3870. }
  3871. }
  3872. {
  3873. p.SetState(306)
  3874. var _m = p.Match(ApiParserParserT__2)
  3875. localctx.(*BodyContext).rp = _m
  3876. }
  3877. return localctx
  3878. }
  3879. // IReplybodyContext is an interface to support dynamic dispatch.
  3880. type IReplybodyContext interface {
  3881. antlr.ParserRuleContext
  3882. // GetParser returns the parser.
  3883. GetParser() antlr.Parser
  3884. // GetLp returns the lp token.
  3885. GetLp() antlr.Token
  3886. // GetRp returns the rp token.
  3887. GetRp() antlr.Token
  3888. // SetLp sets the lp token.
  3889. SetLp(antlr.Token)
  3890. // SetRp sets the rp token.
  3891. SetRp(antlr.Token)
  3892. // IsReplybodyContext differentiates from other interfaces.
  3893. IsReplybodyContext()
  3894. }
  3895. type ReplybodyContext struct {
  3896. *antlr.BaseParserRuleContext
  3897. parser antlr.Parser
  3898. lp antlr.Token
  3899. rp antlr.Token
  3900. }
  3901. func NewEmptyReplybodyContext() *ReplybodyContext {
  3902. var p = new(ReplybodyContext)
  3903. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  3904. p.RuleIndex = ApiParserParserRULE_replybody
  3905. return p
  3906. }
  3907. func (*ReplybodyContext) IsReplybodyContext() {}
  3908. func NewReplybodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ReplybodyContext {
  3909. var p = new(ReplybodyContext)
  3910. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  3911. p.parser = parser
  3912. p.RuleIndex = ApiParserParserRULE_replybody
  3913. return p
  3914. }
  3915. func (s *ReplybodyContext) GetParser() antlr.Parser { return s.parser }
  3916. func (s *ReplybodyContext) GetLp() antlr.Token { return s.lp }
  3917. func (s *ReplybodyContext) GetRp() antlr.Token { return s.rp }
  3918. func (s *ReplybodyContext) SetLp(v antlr.Token) { s.lp = v }
  3919. func (s *ReplybodyContext) SetRp(v antlr.Token) { s.rp = v }
  3920. func (s *ReplybodyContext) DataType() IDataTypeContext {
  3921. var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
  3922. if t == nil {
  3923. return nil
  3924. }
  3925. return t.(IDataTypeContext)
  3926. }
  3927. func (s *ReplybodyContext) GetRuleContext() antlr.RuleContext {
  3928. return s
  3929. }
  3930. func (s *ReplybodyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  3931. return antlr.TreesStringTree(s, ruleNames, recog)
  3932. }
  3933. func (s *ReplybodyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  3934. switch t := visitor.(type) {
  3935. case ApiParserVisitor:
  3936. return t.VisitReplybody(s)
  3937. default:
  3938. return t.VisitChildren(s)
  3939. }
  3940. }
  3941. func (p *ApiParserParser) Replybody() (localctx IReplybodyContext) {
  3942. localctx = NewReplybodyContext(p, p.GetParserRuleContext(), p.GetState())
  3943. p.EnterRule(localctx, 66, ApiParserParserRULE_replybody)
  3944. var _la int
  3945. defer func() {
  3946. p.ExitRule()
  3947. }()
  3948. defer func() {
  3949. if err := recover(); err != nil {
  3950. if v, ok := err.(antlr.RecognitionException); ok {
  3951. localctx.SetException(v)
  3952. p.GetErrorHandler().ReportError(p, v)
  3953. p.GetErrorHandler().Recover(p, v)
  3954. } else {
  3955. panic(err)
  3956. }
  3957. }
  3958. }()
  3959. p.EnterOuterAlt(localctx, 1)
  3960. {
  3961. p.SetState(308)
  3962. var _m = p.Match(ApiParserParserT__1)
  3963. localctx.(*ReplybodyContext).lp = _m
  3964. }
  3965. p.SetState(310)
  3966. p.GetErrorHandler().Sync(p)
  3967. _la = p.GetTokenStream().LA(1)
  3968. if ((_la)&-(0x1f+1)) == 0 && ((1<<uint(_la))&((1<<ApiParserParserT__5)|(1<<ApiParserParserT__6)|(1<<ApiParserParserT__7)|(1<<ApiParserParserINTERFACE)|(1<<ApiParserParserID))) != 0 {
  3969. {
  3970. p.SetState(309)
  3971. p.DataType()
  3972. }
  3973. }
  3974. {
  3975. p.SetState(312)
  3976. var _m = p.Match(ApiParserParserT__2)
  3977. localctx.(*ReplybodyContext).rp = _m
  3978. }
  3979. return localctx
  3980. }
  3981. // IKvLitContext is an interface to support dynamic dispatch.
  3982. type IKvLitContext interface {
  3983. antlr.ParserRuleContext
  3984. // GetParser returns the parser.
  3985. GetParser() antlr.Parser
  3986. // GetKey returns the key token.
  3987. GetKey() antlr.Token
  3988. // GetValue returns the value token.
  3989. GetValue() antlr.Token
  3990. // SetKey sets the key token.
  3991. SetKey(antlr.Token)
  3992. // SetValue sets the value token.
  3993. SetValue(antlr.Token)
  3994. // IsKvLitContext differentiates from other interfaces.
  3995. IsKvLitContext()
  3996. }
  3997. type KvLitContext struct {
  3998. *antlr.BaseParserRuleContext
  3999. parser antlr.Parser
  4000. key antlr.Token
  4001. value antlr.Token
  4002. }
  4003. func NewEmptyKvLitContext() *KvLitContext {
  4004. var p = new(KvLitContext)
  4005. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  4006. p.RuleIndex = ApiParserParserRULE_kvLit
  4007. return p
  4008. }
  4009. func (*KvLitContext) IsKvLitContext() {}
  4010. func NewKvLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *KvLitContext {
  4011. var p = new(KvLitContext)
  4012. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  4013. p.parser = parser
  4014. p.RuleIndex = ApiParserParserRULE_kvLit
  4015. return p
  4016. }
  4017. func (s *KvLitContext) GetParser() antlr.Parser { return s.parser }
  4018. func (s *KvLitContext) GetKey() antlr.Token { return s.key }
  4019. func (s *KvLitContext) GetValue() antlr.Token { return s.value }
  4020. func (s *KvLitContext) SetKey(v antlr.Token) { s.key = v }
  4021. func (s *KvLitContext) SetValue(v antlr.Token) { s.value = v }
  4022. func (s *KvLitContext) ID() antlr.TerminalNode {
  4023. return s.GetToken(ApiParserParserID, 0)
  4024. }
  4025. func (s *KvLitContext) LINE_VALUE() antlr.TerminalNode {
  4026. return s.GetToken(ApiParserParserLINE_VALUE, 0)
  4027. }
  4028. func (s *KvLitContext) GetRuleContext() antlr.RuleContext {
  4029. return s
  4030. }
  4031. func (s *KvLitContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  4032. return antlr.TreesStringTree(s, ruleNames, recog)
  4033. }
  4034. func (s *KvLitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  4035. switch t := visitor.(type) {
  4036. case ApiParserVisitor:
  4037. return t.VisitKvLit(s)
  4038. default:
  4039. return t.VisitChildren(s)
  4040. }
  4041. }
  4042. func (p *ApiParserParser) KvLit() (localctx IKvLitContext) {
  4043. localctx = NewKvLitContext(p, p.GetParserRuleContext(), p.GetState())
  4044. p.EnterRule(localctx, 68, ApiParserParserRULE_kvLit)
  4045. defer func() {
  4046. p.ExitRule()
  4047. }()
  4048. defer func() {
  4049. if err := recover(); err != nil {
  4050. if v, ok := err.(antlr.RecognitionException); ok {
  4051. localctx.SetException(v)
  4052. p.GetErrorHandler().ReportError(p, v)
  4053. p.GetErrorHandler().Recover(p, v)
  4054. } else {
  4055. panic(err)
  4056. }
  4057. }
  4058. }()
  4059. p.EnterOuterAlt(localctx, 1)
  4060. {
  4061. p.SetState(314)
  4062. var _m = p.Match(ApiParserParserID)
  4063. localctx.(*KvLitContext).key = _m
  4064. }
  4065. checkKeyValue(p)
  4066. {
  4067. p.SetState(316)
  4068. var _m = p.Match(ApiParserParserLINE_VALUE)
  4069. localctx.(*KvLitContext).value = _m
  4070. }
  4071. return localctx
  4072. }
  4073. // IServiceNameContext is an interface to support dynamic dispatch.
  4074. type IServiceNameContext interface {
  4075. antlr.ParserRuleContext
  4076. // GetParser returns the parser.
  4077. GetParser() antlr.Parser
  4078. // IsServiceNameContext differentiates from other interfaces.
  4079. IsServiceNameContext()
  4080. }
  4081. type ServiceNameContext struct {
  4082. *antlr.BaseParserRuleContext
  4083. parser antlr.Parser
  4084. }
  4085. func NewEmptyServiceNameContext() *ServiceNameContext {
  4086. var p = new(ServiceNameContext)
  4087. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  4088. p.RuleIndex = ApiParserParserRULE_serviceName
  4089. return p
  4090. }
  4091. func (*ServiceNameContext) IsServiceNameContext() {}
  4092. func NewServiceNameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceNameContext {
  4093. var p = new(ServiceNameContext)
  4094. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  4095. p.parser = parser
  4096. p.RuleIndex = ApiParserParserRULE_serviceName
  4097. return p
  4098. }
  4099. func (s *ServiceNameContext) GetParser() antlr.Parser { return s.parser }
  4100. func (s *ServiceNameContext) AllID() []antlr.TerminalNode {
  4101. return s.GetTokens(ApiParserParserID)
  4102. }
  4103. func (s *ServiceNameContext) ID(i int) antlr.TerminalNode {
  4104. return s.GetToken(ApiParserParserID, i)
  4105. }
  4106. func (s *ServiceNameContext) GetRuleContext() antlr.RuleContext {
  4107. return s
  4108. }
  4109. func (s *ServiceNameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  4110. return antlr.TreesStringTree(s, ruleNames, recog)
  4111. }
  4112. func (s *ServiceNameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  4113. switch t := visitor.(type) {
  4114. case ApiParserVisitor:
  4115. return t.VisitServiceName(s)
  4116. default:
  4117. return t.VisitChildren(s)
  4118. }
  4119. }
  4120. func (p *ApiParserParser) ServiceName() (localctx IServiceNameContext) {
  4121. localctx = NewServiceNameContext(p, p.GetParserRuleContext(), p.GetState())
  4122. p.EnterRule(localctx, 70, ApiParserParserRULE_serviceName)
  4123. var _la int
  4124. defer func() {
  4125. p.ExitRule()
  4126. }()
  4127. defer func() {
  4128. if err := recover(); err != nil {
  4129. if v, ok := err.(antlr.RecognitionException); ok {
  4130. localctx.SetException(v)
  4131. p.GetErrorHandler().ReportError(p, v)
  4132. p.GetErrorHandler().Recover(p, v)
  4133. } else {
  4134. panic(err)
  4135. }
  4136. }
  4137. }()
  4138. p.EnterOuterAlt(localctx, 1)
  4139. p.SetState(322)
  4140. p.GetErrorHandler().Sync(p)
  4141. _la = p.GetTokenStream().LA(1)
  4142. for ok := true; ok; ok = _la == ApiParserParserID {
  4143. {
  4144. p.SetState(318)
  4145. p.Match(ApiParserParserID)
  4146. }
  4147. p.SetState(320)
  4148. p.GetErrorHandler().Sync(p)
  4149. _la = p.GetTokenStream().LA(1)
  4150. if _la == ApiParserParserT__9 {
  4151. {
  4152. p.SetState(319)
  4153. p.Match(ApiParserParserT__9)
  4154. }
  4155. }
  4156. p.SetState(324)
  4157. p.GetErrorHandler().Sync(p)
  4158. _la = p.GetTokenStream().LA(1)
  4159. }
  4160. return localctx
  4161. }
  4162. // IPathContext is an interface to support dynamic dispatch.
  4163. type IPathContext interface {
  4164. antlr.ParserRuleContext
  4165. // GetParser returns the parser.
  4166. GetParser() antlr.Parser
  4167. // IsPathContext differentiates from other interfaces.
  4168. IsPathContext()
  4169. }
  4170. type PathContext struct {
  4171. *antlr.BaseParserRuleContext
  4172. parser antlr.Parser
  4173. }
  4174. func NewEmptyPathContext() *PathContext {
  4175. var p = new(PathContext)
  4176. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  4177. p.RuleIndex = ApiParserParserRULE_path
  4178. return p
  4179. }
  4180. func (*PathContext) IsPathContext() {}
  4181. func NewPathContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PathContext {
  4182. var p = new(PathContext)
  4183. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  4184. p.parser = parser
  4185. p.RuleIndex = ApiParserParserRULE_path
  4186. return p
  4187. }
  4188. func (s *PathContext) GetParser() antlr.Parser { return s.parser }
  4189. func (s *PathContext) AllID() []antlr.TerminalNode {
  4190. return s.GetTokens(ApiParserParserID)
  4191. }
  4192. func (s *PathContext) ID(i int) antlr.TerminalNode {
  4193. return s.GetToken(ApiParserParserID, i)
  4194. }
  4195. func (s *PathContext) GetRuleContext() antlr.RuleContext {
  4196. return s
  4197. }
  4198. func (s *PathContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  4199. return antlr.TreesStringTree(s, ruleNames, recog)
  4200. }
  4201. func (s *PathContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  4202. switch t := visitor.(type) {
  4203. case ApiParserVisitor:
  4204. return t.VisitPath(s)
  4205. default:
  4206. return t.VisitChildren(s)
  4207. }
  4208. }
  4209. func (p *ApiParserParser) Path() (localctx IPathContext) {
  4210. localctx = NewPathContext(p, p.GetParserRuleContext(), p.GetState())
  4211. p.EnterRule(localctx, 72, ApiParserParserRULE_path)
  4212. var _la int
  4213. defer func() {
  4214. p.ExitRule()
  4215. }()
  4216. defer func() {
  4217. if err := recover(); err != nil {
  4218. if v, ok := err.(antlr.RecognitionException); ok {
  4219. localctx.SetException(v)
  4220. p.GetErrorHandler().ReportError(p, v)
  4221. p.GetErrorHandler().Recover(p, v)
  4222. } else {
  4223. panic(err)
  4224. }
  4225. }
  4226. }()
  4227. p.EnterOuterAlt(localctx, 1)
  4228. p.SetState(341)
  4229. p.GetErrorHandler().Sync(p)
  4230. _la = p.GetTokenStream().LA(1)
  4231. for ok := true; ok; ok = _la == ApiParserParserT__10 || _la == ApiParserParserT__11 {
  4232. p.SetState(341)
  4233. p.GetErrorHandler().Sync(p)
  4234. switch p.GetTokenStream().LA(1) {
  4235. case ApiParserParserT__10:
  4236. {
  4237. p.SetState(326)
  4238. p.Match(ApiParserParserT__10)
  4239. }
  4240. {
  4241. p.SetState(327)
  4242. p.Match(ApiParserParserID)
  4243. }
  4244. p.SetState(332)
  4245. p.GetErrorHandler().Sync(p)
  4246. _la = p.GetTokenStream().LA(1)
  4247. for _la == ApiParserParserT__9 {
  4248. {
  4249. p.SetState(328)
  4250. p.Match(ApiParserParserT__9)
  4251. }
  4252. {
  4253. p.SetState(329)
  4254. p.Match(ApiParserParserID)
  4255. }
  4256. p.SetState(334)
  4257. p.GetErrorHandler().Sync(p)
  4258. _la = p.GetTokenStream().LA(1)
  4259. }
  4260. case ApiParserParserT__11:
  4261. {
  4262. p.SetState(335)
  4263. p.Match(ApiParserParserT__11)
  4264. }
  4265. {
  4266. p.SetState(336)
  4267. p.Match(ApiParserParserID)
  4268. }
  4269. p.SetState(339)
  4270. p.GetErrorHandler().Sync(p)
  4271. _la = p.GetTokenStream().LA(1)
  4272. if _la == ApiParserParserT__9 {
  4273. {
  4274. p.SetState(337)
  4275. p.Match(ApiParserParserT__9)
  4276. }
  4277. {
  4278. p.SetState(338)
  4279. p.Match(ApiParserParserID)
  4280. }
  4281. }
  4282. default:
  4283. panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
  4284. }
  4285. p.SetState(343)
  4286. p.GetErrorHandler().Sync(p)
  4287. _la = p.GetTokenStream().LA(1)
  4288. }
  4289. return localctx
  4290. }
  4291. func (p *ApiParserParser) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex int) bool {
  4292. switch ruleIndex {
  4293. case 18:
  4294. var t *FieldContext = nil
  4295. if localctx != nil {
  4296. t = localctx.(*FieldContext)
  4297. }
  4298. return p.Field_Sempred(t, predIndex)
  4299. default:
  4300. panic("No predicate with index: " + fmt.Sprint(ruleIndex))
  4301. }
  4302. }
  4303. func (p *ApiParserParser) Field_Sempred(localctx antlr.RuleContext, predIndex int) bool {
  4304. switch predIndex {
  4305. case 0:
  4306. return isNormal(p)
  4307. default:
  4308. panic("No predicate with index: " + fmt.Sprint(predIndex))
  4309. }
  4310. }