apiparser_parser.go 135 KB

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