1
0

ivprog.bundle.js 1.2 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  40. /******/ }
  41. /******/ };
  42. /******/
  43. /******/ // define __esModule on exports
  44. /******/ __webpack_require__.r = function(exports) {
  45. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47. /******/ }
  48. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  49. /******/ };
  50. /******/
  51. /******/ // create a fake namespace object
  52. /******/ // mode & 1: value is a module id, require it
  53. /******/ // mode & 2: merge all properties of value into the ns
  54. /******/ // mode & 4: return value when already ns object
  55. /******/ // mode & 8|1: behave like require
  56. /******/ __webpack_require__.t = function(value, mode) {
  57. /******/ if(mode & 1) value = __webpack_require__(value);
  58. /******/ if(mode & 8) return value;
  59. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60. /******/ var ns = Object.create(null);
  61. /******/ __webpack_require__.r(ns);
  62. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64. /******/ return ns;
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "";
  81. /******/
  82. /******/
  83. /******/ // Load entry module and return exports
  84. /******/ return __webpack_require__(__webpack_require__.s = "./js/main.js");
  85. /******/ })
  86. /************************************************************************/
  87. /******/ ({
  88. /***/ "./grammar/en/ivprog.g4":
  89. /*!******************************!*\
  90. !*** ./grammar/en/ivprog.g4 ***!
  91. \******************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports, __webpack_require__) {
  94. module.exports =
  95. /******/ (function(modules) { // webpackBootstrap
  96. /******/ // The module cache
  97. /******/ var installedModules = {};
  98. /******/
  99. /******/ // The require function
  100. /******/ function __webpack_require__(moduleId) {
  101. /******/
  102. /******/ // Check if module is in cache
  103. /******/ if(installedModules[moduleId]) {
  104. /******/ return installedModules[moduleId].exports;
  105. /******/ }
  106. /******/ // Create a new module (and put it into the cache)
  107. /******/ var module = installedModules[moduleId] = {
  108. /******/ i: moduleId,
  109. /******/ l: false,
  110. /******/ exports: {}
  111. /******/ };
  112. /******/
  113. /******/ // Execute the module function
  114. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  115. /******/
  116. /******/ // Flag the module as loaded
  117. /******/ module.l = true;
  118. /******/
  119. /******/ // Return the exports of the module
  120. /******/ return module.exports;
  121. /******/ }
  122. /******/
  123. /******/
  124. /******/ // expose the modules object (__webpack_modules__)
  125. /******/ __webpack_require__.m = modules;
  126. /******/
  127. /******/ // expose the module cache
  128. /******/ __webpack_require__.c = installedModules;
  129. /******/
  130. /******/ // identity function for calling harmony imports with the correct context
  131. /******/ __webpack_require__.i = function(value) { return value; };
  132. /******/
  133. /******/ // define getter function for harmony exports
  134. /******/ __webpack_require__.d = function(exports, name, getter) {
  135. /******/ if(!__webpack_require__.o(exports, name)) {
  136. /******/ Object.defineProperty(exports, name, {
  137. /******/ configurable: false,
  138. /******/ enumerable: true,
  139. /******/ get: getter
  140. /******/ });
  141. /******/ }
  142. /******/ };
  143. /******/
  144. /******/ // getDefaultExport function for compatibility with non-harmony modules
  145. /******/ __webpack_require__.n = function(module) {
  146. /******/ var getter = module && module.__esModule ?
  147. /******/ function getDefault() { return module['default']; } :
  148. /******/ function getModuleExports() { return module; };
  149. /******/ __webpack_require__.d(getter, 'a', getter);
  150. /******/ return getter;
  151. /******/ };
  152. /******/
  153. /******/ // Object.prototype.hasOwnProperty.call
  154. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  155. /******/
  156. /******/ // __webpack_public_path__
  157. /******/ __webpack_require__.p = "";
  158. /******/
  159. /******/ // Load entry module and return exports
  160. /******/ return __webpack_require__(__webpack_require__.s = 1);
  161. /******/ })
  162. /************************************************************************/
  163. /******/ ([
  164. /* 0 */
  165. /***/ (function(module, exports, __webpack_require__) {
  166. // Generated from /tmp/tmp-31848zMNEObev5i43/ivprog.g4 by ANTLR 4.7
  167. // jshint ignore: start
  168. var antlr4 = __webpack_require__(2);
  169. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  170. "\u0002/\u01d1\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  171. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  172. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  173. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  174. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  175. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  176. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  177. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  178. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  179. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  180. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  181. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  182. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  183. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003",
  184. "\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003",
  185. "\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003",
  186. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003\u0006\u0003",
  187. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0007\u0003",
  188. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  189. "\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  190. "\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  191. "\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b\u0003\u000b\u0003",
  192. "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003",
  193. "\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003",
  194. "\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  195. "\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  196. "\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u0010\u0003",
  197. "\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0011\u0003",
  198. "\u0011\u0003\u0011\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  199. "\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0014\u0003",
  200. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0015\u0003\u0015\u0003",
  201. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0016\u0003\u0016\u0003",
  202. "\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003\u0017\u0003\u0017\u0003",
  203. "\u0017\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  204. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  205. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  206. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  207. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  208. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0125\n&\u0003\'\u0003\'\u0003",
  209. "(\u0003(\u0003)\u0003)\u0007)\u012d\n)\f)\u000e)\u0130\u000b)\u0003",
  210. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0137\n+\r+\u000e+\u0138\u0003",
  211. "+\u0003+\u0003+\u0003+\u0005+\u013f\n+\u0003+\u0006+\u0142\n+\r+\u000e",
  212. "+\u0143\u0003+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d",
  213. "\n+\r+\u000e+\u014e\u0005+\u0151\n+\u0003,\u0006,\u0154\n,\r,\u000e",
  214. ",\u0155\u0003,\u0003,\u0006,\u015a\n,\r,\u000e,\u015b\u0003,\u0006,",
  215. "\u015f\n,\r,\u000e,\u0160\u0003,\u0003,\u0007,\u0165\n,\f,\u000e,\u0168",
  216. "\u000b,\u0003,\u0005,\u016b\n,\u0003-\u0003-\u0005-\u016f\n-\u0003-",
  217. "\u0006-\u0172\n-\r-\u000e-\u0173\u0003.\u0003.\u0007.\u0178\n.\f.\u000e",
  218. ".\u017b\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u0181\n/\u00030\u0003",
  219. "0\u00030\u00050\u0186\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  220. "2\u00032\u00033\u00063\u0191\n3\r3\u000e3\u0192\u00033\u00053\u0196",
  221. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01a0",
  222. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  223. "7\u00037\u00057\u01ad\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  224. "8\u00039\u00039\u00039\u00039\u00079\u01ba\n9\f9\u000e9\u01bd\u000b",
  225. "9\u00039\u00059\u01c0\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01c7",
  226. "\n9\f9\u000e9\u01ca\u000b9\u00039\u00039\u00059\u01ce\n9\u00039\u0003",
  227. "9\u0003\u01c8\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  228. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  229. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  230. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  231. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  232. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  233. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  234. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  235. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  236. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  237. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01e5\u0002\u0003\u0003",
  238. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  239. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  240. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  241. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  242. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  243. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  244. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  245. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  246. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  247. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  248. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  249. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  250. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  251. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  252. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  253. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  254. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  255. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  256. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  257. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  258. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  259. "s\u0003\u0002\u0002\u0002\u0005{\u0003\u0002\u0002\u0002\u0007\u0080",
  260. "\u0003\u0002\u0002\u0002\t\u0085\u0003\u0002\u0002\u0002\u000b\u008d",
  261. "\u0003\u0002\u0002\u0002\r\u0094\u0003\u0002\u0002\u0002\u000f\u009c",
  262. "\u0003\u0002\u0002\u0002\u0011\u00a6\u0003\u0002\u0002\u0002\u0013\u00ad",
  263. "\u0003\u0002\u0002\u0002\u0015\u00b2\u0003\u0002\u0002\u0002\u0017\u00bc",
  264. "\u0003\u0002\u0002\u0002\u0019\u00c2\u0003\u0002\u0002\u0002\u001b\u00cb",
  265. "\u0003\u0002\u0002\u0002\u001d\u00d2\u0003\u0002\u0002\u0002\u001f\u00d6",
  266. "\u0003\u0002\u0002\u0002!\u00dc\u0003\u0002\u0002\u0002#\u00df\u0003",
  267. "\u0002\u0002\u0002%\u00e5\u0003\u0002\u0002\u0002\'\u00e8\u0003\u0002",
  268. "\u0002\u0002)\u00ed\u0003\u0002\u0002\u0002+\u00f3\u0003\u0002\u0002",
  269. "\u0002-\u00f8\u0003\u0002\u0002\u0002/\u00fc\u0003\u0002\u0002\u0002",
  270. "1\u0100\u0003\u0002\u0002\u00023\u0103\u0003\u0002\u0002\u00025\u0105",
  271. "\u0003\u0002\u0002\u00027\u0107\u0003\u0002\u0002\u00029\u0109\u0003",
  272. "\u0002\u0002\u0002;\u010b\u0003\u0002\u0002\u0002=\u010d\u0003\u0002",
  273. "\u0002\u0002?\u010f\u0003\u0002\u0002\u0002A\u0111\u0003\u0002\u0002",
  274. "\u0002C\u0113\u0003\u0002\u0002\u0002E\u0115\u0003\u0002\u0002\u0002",
  275. "G\u0117\u0003\u0002\u0002\u0002I\u0119\u0003\u0002\u0002\u0002K\u0124",
  276. "\u0003\u0002\u0002\u0002M\u0126\u0003\u0002\u0002\u0002O\u0128\u0003",
  277. "\u0002\u0002\u0002Q\u012a\u0003\u0002\u0002\u0002S\u0131\u0003\u0002",
  278. "\u0002\u0002U\u0150\u0003\u0002\u0002\u0002W\u016a\u0003\u0002\u0002",
  279. "\u0002Y\u016c\u0003\u0002\u0002\u0002[\u0175\u0003\u0002\u0002\u0002",
  280. "]\u0180\u0003\u0002\u0002\u0002_\u0182\u0003\u0002\u0002\u0002a\u0189",
  281. "\u0003\u0002\u0002\u0002c\u018d\u0003\u0002\u0002\u0002e\u0195\u0003",
  282. "\u0002\u0002\u0002g\u0197\u0003\u0002\u0002\u0002i\u0199\u0003\u0002",
  283. "\u0002\u0002k\u019f\u0003\u0002\u0002\u0002m\u01ac\u0003\u0002\u0002",
  284. "\u0002o\u01ae\u0003\u0002\u0002\u0002q\u01cd\u0003\u0002\u0002\u0002",
  285. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  286. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  287. "\u0002z\u0004\u0003\u0002\u0002\u0002{|\u0007t\u0002\u0002|}\u0007g",
  288. "\u0002\u0002}~\u0007c\u0002\u0002~\u007f\u0007n\u0002\u0002\u007f\u0006",
  289. "\u0003\u0002\u0002\u0002\u0080\u0081\u0007x\u0002\u0002\u0081\u0082",
  290. "\u0007q\u0002\u0002\u0082\u0083\u0007k\u0002\u0002\u0083\u0084\u0007",
  291. "f\u0002\u0002\u0084\b\u0003\u0002\u0002\u0002\u0085\u0086\u0007d\u0002",
  292. "\u0002\u0086\u0087\u0007q\u0002\u0002\u0087\u0088\u0007q\u0002\u0002",
  293. "\u0088\u0089\u0007n\u0002\u0002\u0089\u008a\u0007g\u0002\u0002\u008a",
  294. "\u008b\u0007c\u0002\u0002\u008b\u008c\u0007p\u0002\u0002\u008c\n\u0003",
  295. "\u0002\u0002\u0002\u008d\u008e\u0007u\u0002\u0002\u008e\u008f\u0007",
  296. "v\u0002\u0002\u008f\u0090\u0007t\u0002\u0002\u0090\u0091\u0007k\u0002",
  297. "\u0002\u0091\u0092\u0007p\u0002\u0002\u0092\u0093\u0007i\u0002\u0002",
  298. "\u0093\f\u0003\u0002\u0002\u0002\u0094\u0095\u0007k\u0002\u0002\u0095",
  299. "\u0096\u0007p\u0002\u0002\u0096\u0097\u0007v\u0002\u0002\u0097\u0098",
  300. "\u0007g\u0002\u0002\u0098\u0099\u0007i\u0002\u0002\u0099\u009a\u0007",
  301. "g\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u000e\u0003\u0002",
  302. "\u0002\u0002\u009c\u009d\u0007e\u0002\u0002\u009d\u009e\u0007j\u0002",
  303. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  304. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  305. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  306. "\u0007t\u0002\u0002\u00a5\u0010\u0003\u0002\u0002\u0002\u00a6\u00a7",
  307. "\u0007u\u0002\u0002\u00a7\u00a8\u0007y\u0002\u0002\u00a8\u00a9\u0007",
  308. "k\u0002\u0002\u00a9\u00aa\u0007v\u0002\u0002\u00aa\u00ab\u0007e\u0002",
  309. "\u0002\u00ab\u00ac\u0007j\u0002\u0002\u00ac\u0012\u0003\u0002\u0002",
  310. "\u0002\u00ad\u00ae\u0007e\u0002\u0002\u00ae\u00af\u0007c\u0002\u0002",
  311. "\u00af\u00b0\u0007u\u0002\u0002\u00b0\u00b1\u0007g\u0002\u0002\u00b1",
  312. "\u0014\u0003\u0002\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3",
  313. "\u00b4\u0007v\u0002\u0002\u00b4\u00b5\u0007j\u0002\u0002\u00b5\u00b6",
  314. "\u0007g\u0002\u0002\u00b6\u00b7\u0007t\u0002\u0002\u00b7\u00b8\u0007",
  315. "y\u0002\u0002\u00b8\u00b9\u0007k\u0002\u0002\u00b9\u00ba\u0007u\u0002",
  316. "\u0002\u00ba\u00bb\u0007g\u0002\u0002\u00bb\u0016\u0003\u0002\u0002",
  317. "\u0002\u00bc\u00bd\u0007e\u0002\u0002\u00bd\u00be\u0007q\u0002\u0002",
  318. "\u00be\u00bf\u0007p\u0002\u0002\u00bf\u00c0\u0007u\u0002\u0002\u00c0",
  319. "\u00c1\u0007v\u0002\u0002\u00c1\u0018\u0003\u0002\u0002\u0002\u00c2",
  320. "\u00c3\u0007h\u0002\u0002\u00c3\u00c4\u0007w\u0002\u0002\u00c4\u00c5",
  321. "\u0007p\u0002\u0002\u00c5\u00c6\u0007e\u0002\u0002\u00c6\u00c7\u0007",
  322. "v\u0002\u0002\u00c7\u00c8\u0007k\u0002\u0002\u00c8\u00c9\u0007q\u0002",
  323. "\u0002\u00c9\u00ca\u0007p\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  324. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  325. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007w\u0002\u0002\u00cf",
  326. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u001c",
  327. "\u0003\u0002\u0002\u0002\u00d2\u00d3\u0007h\u0002\u0002\u00d3\u00d4",
  328. "\u0007q\u0002\u0002\u00d4\u00d5\u0007t\u0002\u0002\u00d5\u001e\u0003",
  329. "\u0002\u0002\u0002\u00d6\u00d7\u0007d\u0002\u0002\u00d7\u00d8\u0007",
  330. "t\u0002\u0002\u00d8\u00d9\u0007g\u0002\u0002\u00d9\u00da\u0007c\u0002",
  331. "\u0002\u00da\u00db\u0007m\u0002\u0002\u00db \u0003\u0002\u0002\u0002",
  332. "\u00dc\u00dd\u0007f\u0002\u0002\u00dd\u00de\u0007q\u0002\u0002\u00de",
  333. "\"\u0003\u0002\u0002\u0002\u00df\u00e0\u0007y\u0002\u0002\u00e0\u00e1",
  334. "\u0007j\u0002\u0002\u00e1\u00e2\u0007k\u0002\u0002\u00e2\u00e3\u0007",
  335. "n\u0002\u0002\u00e3\u00e4\u0007g\u0002\u0002\u00e4$\u0003\u0002\u0002",
  336. "\u0002\u00e5\u00e6\u0007k\u0002\u0002\u00e6\u00e7\u0007h\u0002\u0002",
  337. "\u00e7&\u0003\u0002\u0002\u0002\u00e8\u00e9\u0007g\u0002\u0002\u00e9",
  338. "\u00ea\u0007n\u0002\u0002\u00ea\u00eb\u0007u\u0002\u0002\u00eb\u00ec",
  339. "\u0007g\u0002\u0002\u00ec(\u0003\u0002\u0002\u0002\u00ed\u00ee\u0007",
  340. "h\u0002\u0002\u00ee\u00ef\u0007c\u0002\u0002\u00ef\u00f0\u0007n\u0002",
  341. "\u0002\u00f0\u00f1\u0007u\u0002\u0002\u00f1\u00f2\u0007g\u0002\u0002",
  342. "\u00f2*\u0003\u0002\u0002\u0002\u00f3\u00f4\u0007v\u0002\u0002\u00f4",
  343. "\u00f5\u0007t\u0002\u0002\u00f5\u00f6\u0007w\u0002\u0002\u00f6\u00f7",
  344. "\u0007g\u0002\u0002\u00f7,\u0003\u0002\u0002\u0002\u00f8\u00f9\u0007",
  345. "p\u0002\u0002\u00f9\u00fa\u0007q\u0002\u0002\u00fa\u00fb\u0007v\u0002",
  346. "\u0002\u00fb.\u0003\u0002\u0002\u0002\u00fc\u00fd\u0007C\u0002\u0002",
  347. "\u00fd\u00fe\u0007P\u0002\u0002\u00fe\u00ff\u0007F\u0002\u0002\u00ff",
  348. "0\u0003\u0002\u0002\u0002\u0100\u0101\u0007Q\u0002\u0002\u0101\u0102",
  349. "\u0007T\u0002\u0002\u01022\u0003\u0002\u0002\u0002\u0103\u0104\u0007",
  350. "*\u0002\u0002\u01044\u0003\u0002\u0002\u0002\u0105\u0106\u0007+\u0002",
  351. "\u0002\u01066\u0003\u0002\u0002\u0002\u0107\u0108\u0007]\u0002\u0002",
  352. "\u01088\u0003\u0002\u0002\u0002\u0109\u010a\u0007_\u0002\u0002\u010a",
  353. ":\u0003\u0002\u0002\u0002\u010b\u010c\u0007}\u0002\u0002\u010c<\u0003",
  354. "\u0002\u0002\u0002\u010d\u010e\u0007\u007f\u0002\u0002\u010e>\u0003",
  355. "\u0002\u0002\u0002\u010f\u0110\u0007.\u0002\u0002\u0110@\u0003\u0002",
  356. "\u0002\u0002\u0111\u0112\u0007?\u0002\u0002\u0112B\u0003\u0002\u0002",
  357. "\u0002\u0113\u0114\t\u0002\u0002\u0002\u0114D\u0003\u0002\u0002\u0002",
  358. "\u0115\u0116\t\u0003\u0002\u0002\u0116F\u0003\u0002\u0002\u0002\u0117",
  359. "\u0118\u0005/\u0018\u0002\u0118H\u0003\u0002\u0002\u0002\u0119\u011a",
  360. "\u00051\u0019\u0002\u011aJ\u0003\u0002\u0002\u0002\u011b\u011c\u0007",
  361. "@\u0002\u0002\u011c\u0125\u0007?\u0002\u0002\u011d\u011e\u0007?\u0002",
  362. "\u0002\u011e\u0125\u0007?\u0002\u0002\u011f\u0120\u0007>\u0002\u0002",
  363. "\u0120\u0125\u0007?\u0002\u0002\u0121\u0125\t\u0004\u0002\u0002\u0122",
  364. "\u0123\u0007#\u0002\u0002\u0123\u0125\u0007?\u0002\u0002\u0124\u011b",
  365. "\u0003\u0002\u0002\u0002\u0124\u011d\u0003\u0002\u0002\u0002\u0124\u011f",
  366. "\u0003\u0002\u0002\u0002\u0124\u0121\u0003\u0002\u0002\u0002\u0124\u0122",
  367. "\u0003\u0002\u0002\u0002\u0125L\u0003\u0002\u0002\u0002\u0126\u0127",
  368. "\u0007<\u0002\u0002\u0127N\u0003\u0002\u0002\u0002\u0128\u0129\u0005",
  369. "-\u0017\u0002\u0129P\u0003\u0002\u0002\u0002\u012a\u012e\t\u0005\u0002",
  370. "\u0002\u012b\u012d\t\u0006\u0002\u0002\u012c\u012b\u0003\u0002\u0002",
  371. "\u0002\u012d\u0130\u0003\u0002\u0002\u0002\u012e\u012c\u0003\u0002\u0002",
  372. "\u0002\u012e\u012f\u0003\u0002\u0002\u0002\u012fR\u0003\u0002\u0002",
  373. "\u0002\u0130\u012e\u0003\u0002\u0002\u0002\u0131\u0132\u0005Q)\u0002",
  374. "\u0132\u0133\u00070\u0002\u0002\u0133\u0134\u0005Q)\u0002\u0134T\u0003",
  375. "\u0002\u0002\u0002\u0135\u0137\t\u0007\u0002\u0002\u0136\u0135\u0003",
  376. "\u0002\u0002\u0002\u0137\u0138\u0003\u0002\u0002\u0002\u0138\u0136\u0003",
  377. "\u0002\u0002\u0002\u0138\u0139\u0003\u0002\u0002\u0002\u0139\u0151\u0003",
  378. "\u0002\u0002\u0002\u013a\u013b\u00072\u0002\u0002\u013b\u013f\u0007",
  379. "z\u0002\u0002\u013c\u013d\u00072\u0002\u0002\u013d\u013f\u0007Z\u0002",
  380. "\u0002\u013e\u013a\u0003\u0002\u0002\u0002\u013e\u013c\u0003\u0002\u0002",
  381. "\u0002\u013f\u0141\u0003\u0002\u0002\u0002\u0140\u0142\u0005g4\u0002",
  382. "\u0141\u0140\u0003\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002",
  383. "\u0143\u0141\u0003\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002",
  384. "\u0144\u0151\u0003\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002",
  385. "\u0146\u014a\u0007d\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148",
  386. "\u014a\u0007D\u0002\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149",
  387. "\u0147\u0003\u0002\u0002\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b",
  388. "\u014d\t\b\u0002\u0002\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e",
  389. "\u0003\u0002\u0002\u0002\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f",
  390. "\u0003\u0002\u0002\u0002\u014f\u0151\u0003\u0002\u0002\u0002\u0150\u0136",
  391. "\u0003\u0002\u0002\u0002\u0150\u013e\u0003\u0002\u0002\u0002\u0150\u0149",
  392. "\u0003\u0002\u0002\u0002\u0151V\u0003\u0002\u0002\u0002\u0152\u0154",
  393. "\t\u0007\u0002\u0002\u0153\u0152\u0003\u0002\u0002\u0002\u0154\u0155",
  394. "\u0003\u0002\u0002\u0002\u0155\u0153\u0003\u0002\u0002\u0002\u0155\u0156",
  395. "\u0003\u0002\u0002\u0002\u0156\u0157\u0003\u0002\u0002\u0002\u0157\u0159",
  396. "\u00070\u0002\u0002\u0158\u015a\t\u0007\u0002\u0002\u0159\u0158\u0003",
  397. "\u0002\u0002\u0002\u015a\u015b\u0003\u0002\u0002\u0002\u015b\u0159\u0003",
  398. "\u0002\u0002\u0002\u015b\u015c\u0003\u0002\u0002\u0002\u015c\u016b\u0003",
  399. "\u0002\u0002\u0002\u015d\u015f\t\u0007\u0002\u0002\u015e\u015d\u0003",
  400. "\u0002\u0002\u0002\u015f\u0160\u0003\u0002\u0002\u0002\u0160\u015e\u0003",
  401. "\u0002\u0002\u0002\u0160\u0161\u0003\u0002\u0002\u0002\u0161\u0162\u0003",
  402. "\u0002\u0002\u0002\u0162\u0166\u00070\u0002\u0002\u0163\u0165\t\u0007",
  403. "\u0002\u0002\u0164\u0163\u0003\u0002\u0002\u0002\u0165\u0168\u0003\u0002",
  404. "\u0002\u0002\u0166\u0164\u0003\u0002\u0002\u0002\u0166\u0167\u0003\u0002",
  405. "\u0002\u0002\u0167\u0169\u0003\u0002\u0002\u0002\u0168\u0166\u0003\u0002",
  406. "\u0002\u0002\u0169\u016b\u0005Y-\u0002\u016a\u0153\u0003\u0002\u0002",
  407. "\u0002\u016a\u015e\u0003\u0002\u0002\u0002\u016bX\u0003\u0002\u0002",
  408. "\u0002\u016c\u016e\t\t\u0002\u0002\u016d\u016f\t\u0002\u0002\u0002\u016e",
  409. "\u016d\u0003\u0002\u0002\u0002\u016e\u016f\u0003\u0002\u0002\u0002\u016f",
  410. "\u0171\u0003\u0002\u0002\u0002\u0170\u0172\t\u0007\u0002\u0002\u0171",
  411. "\u0170\u0003\u0002\u0002\u0002\u0172\u0173\u0003\u0002\u0002\u0002\u0173",
  412. "\u0171\u0003\u0002\u0002\u0002\u0173\u0174\u0003\u0002\u0002\u0002\u0174",
  413. "Z\u0003\u0002\u0002\u0002\u0175\u0179\u0007$\u0002\u0002\u0176\u0178",
  414. "\u0005]/\u0002\u0177\u0176\u0003\u0002\u0002\u0002\u0178\u017b\u0003",
  415. "\u0002\u0002\u0002\u0179\u0177\u0003\u0002\u0002\u0002\u0179\u017a\u0003",
  416. "\u0002\u0002\u0002\u017a\u017c\u0003\u0002\u0002\u0002\u017b\u0179\u0003",
  417. "\u0002\u0002\u0002\u017c\u017d\u0007$\u0002\u0002\u017d\\\u0003\u0002",
  418. "\u0002\u0002\u017e\u0181\n\n\u0002\u0002\u017f\u0181\u0005k6\u0002\u0180",
  419. "\u017e\u0003\u0002\u0002\u0002\u0180\u017f\u0003\u0002\u0002\u0002\u0181",
  420. "^\u0003\u0002\u0002\u0002\u0182\u0185\u0007)\u0002\u0002\u0183\u0186",
  421. "\u0005k6\u0002\u0184\u0186\n\u000b\u0002\u0002\u0185\u0183\u0003\u0002",
  422. "\u0002\u0002\u0185\u0184\u0003\u0002\u0002\u0002\u0186\u0187\u0003\u0002",
  423. "\u0002\u0002\u0187\u0188\u0007)\u0002\u0002\u0188`\u0003\u0002\u0002",
  424. "\u0002\u0189\u018a\t\f\u0002\u0002\u018a\u018b\u0003\u0002\u0002\u0002",
  425. "\u018b\u018c\b1\u0002\u0002\u018cb\u0003\u0002\u0002\u0002\u018d\u018e",
  426. "\u0007=\u0002\u0002\u018ed\u0003\u0002\u0002\u0002\u018f\u0191\t\r\u0002",
  427. "\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002\u0002",
  428. "\u0002\u0192\u0190\u0003\u0002\u0002\u0002\u0192\u0193\u0003\u0002\u0002",
  429. "\u0002\u0193\u0196\u0003\u0002\u0002\u0002\u0194\u0196\u0005c2\u0002",
  430. "\u0195\u0190\u0003\u0002\u0002\u0002\u0195\u0194\u0003\u0002\u0002\u0002",
  431. "\u0196f\u0003\u0002\u0002\u0002\u0197\u0198\t\u000e\u0002\u0002\u0198",
  432. "h\u0003\u0002\u0002\u0002\u0199\u019a\t\u000f\u0002\u0002\u019aj\u0003",
  433. "\u0002\u0002\u0002\u019b\u019c\u0007^\u0002\u0002\u019c\u01a0\t\u0010",
  434. "\u0002\u0002\u019d\u01a0\u0005o8\u0002\u019e\u01a0\u0005m7\u0002\u019f",
  435. "\u019b\u0003\u0002\u0002\u0002\u019f\u019d\u0003\u0002\u0002\u0002\u019f",
  436. "\u019e\u0003\u0002\u0002\u0002\u01a0l\u0003\u0002\u0002\u0002\u01a1",
  437. "\u01a2\u0007^\u0002\u0002\u01a2\u01a3\t\u0011\u0002\u0002\u01a3\u01a4",
  438. "\u0005i5\u0002\u01a4\u01a5\u0005i5\u0002\u01a5\u01ad\u0003\u0002\u0002",
  439. "\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01a8\u0005i5\u0002\u01a8",
  440. "\u01a9\u0005i5\u0002\u01a9\u01ad\u0003\u0002\u0002\u0002\u01aa\u01ab",
  441. "\u0007^\u0002\u0002\u01ab\u01ad\u0005i5\u0002\u01ac\u01a1\u0003\u0002",
  442. "\u0002\u0002\u01ac\u01a6\u0003\u0002\u0002\u0002\u01ac\u01aa\u0003\u0002",
  443. "\u0002\u0002\u01adn\u0003\u0002\u0002\u0002\u01ae\u01af\u0007^\u0002",
  444. "\u0002\u01af\u01b0\u0007w\u0002\u0002\u01b0\u01b1\u0005g4\u0002\u01b1",
  445. "\u01b2\u0005g4\u0002\u01b2\u01b3\u0005g4\u0002\u01b3\u01b4\u0005g4\u0002",
  446. "\u01b4p\u0003\u0002\u0002\u0002\u01b5\u01b6\u00071\u0002\u0002\u01b6",
  447. "\u01b7\u00071\u0002\u0002\u01b7\u01bb\u0003\u0002\u0002\u0002\u01b8",
  448. "\u01ba\n\r\u0002\u0002\u01b9\u01b8\u0003\u0002\u0002\u0002\u01ba\u01bd",
  449. "\u0003\u0002\u0002\u0002\u01bb\u01b9\u0003\u0002\u0002\u0002\u01bb\u01bc",
  450. "\u0003\u0002\u0002\u0002\u01bc\u01bf\u0003\u0002\u0002\u0002\u01bd\u01bb",
  451. "\u0003\u0002\u0002\u0002\u01be\u01c0\u0007\u000f\u0002\u0002\u01bf\u01be",
  452. "\u0003\u0002\u0002\u0002\u01bf\u01c0\u0003\u0002\u0002\u0002\u01c0\u01c1",
  453. "\u0003\u0002\u0002\u0002\u01c1\u01ce\u0007\f\u0002\u0002\u01c2\u01c3",
  454. "\u00071\u0002\u0002\u01c3\u01c4\u0007,\u0002\u0002\u01c4\u01c8\u0003",
  455. "\u0002\u0002\u0002\u01c5\u01c7\u000b\u0002\u0002\u0002\u01c6\u01c5\u0003",
  456. "\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c9\u0003",
  457. "\u0002\u0002\u0002\u01c8\u01c6\u0003\u0002\u0002\u0002\u01c9\u01cb\u0003",
  458. "\u0002\u0002\u0002\u01ca\u01c8\u0003\u0002\u0002\u0002\u01cb\u01cc\u0007",
  459. ",\u0002\u0002\u01cc\u01ce\u00071\u0002\u0002\u01cd\u01b5\u0003\u0002",
  460. "\u0002\u0002\u01cd\u01c2\u0003\u0002\u0002\u0002\u01ce\u01cf\u0003\u0002",
  461. "\u0002\u0002\u01cf\u01d0\b9\u0003\u0002\u01d0r\u0003\u0002\u0002\u0002",
  462. "\u001d\u0002\u0124\u012e\u0138\u013e\u0143\u0149\u014e\u0150\u0155\u015b",
  463. "\u0160\u0166\u016a\u016e\u0173\u0179\u0180\u0185\u0192\u0195\u019f\u01ac",
  464. "\u01bb\u01bf\u01c8\u01cd\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  465. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  466. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  467. function ivprog(input) {
  468. antlr4.Lexer.call(this, input);
  469. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  470. return this;
  471. }
  472. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  473. ivprog.prototype.constructor = ivprog;
  474. ivprog.EOF = antlr4.Token.EOF;
  475. ivprog.RK_PROGRAM = 1;
  476. ivprog.RK_REAL = 2;
  477. ivprog.RK_VOID = 3;
  478. ivprog.RK_BOOLEAN = 4;
  479. ivprog.RK_STRING = 5;
  480. ivprog.RK_INTEGER = 6;
  481. ivprog.RK_CHARACTER = 7;
  482. ivprog.RK_SWITCH = 8;
  483. ivprog.RK_CASE = 9;
  484. ivprog.RK_DEFAULT = 10;
  485. ivprog.RK_CONST = 11;
  486. ivprog.RK_FUNCTION = 12;
  487. ivprog.RK_RETURN = 13;
  488. ivprog.RK_FOR = 14;
  489. ivprog.RK_BREAK = 15;
  490. ivprog.RK_DO = 16;
  491. ivprog.RK_WHILE = 17;
  492. ivprog.RK_IF = 18;
  493. ivprog.RK_ELSE = 19;
  494. ivprog.RK_FALSE = 20;
  495. ivprog.RK_TRUE = 21;
  496. ivprog.OPEN_PARENTHESIS = 22;
  497. ivprog.CLOSE_PARENTHESIS = 23;
  498. ivprog.OPEN_BRACE = 24;
  499. ivprog.CLOSE_BRACE = 25;
  500. ivprog.OPEN_CURLY = 26;
  501. ivprog.CLOSE_CURLY = 27;
  502. ivprog.COMMA = 28;
  503. ivprog.EQUAL = 29;
  504. ivprog.SUM_OP = 30;
  505. ivprog.MULTI_OP = 31;
  506. ivprog.AND_OPERATOR = 32;
  507. ivprog.OR_OPERATOR = 33;
  508. ivprog.RELATIONAL_OPERATOR = 34;
  509. ivprog.COLON = 35;
  510. ivprog.NOT_OPERATOR = 36;
  511. ivprog.ID = 37;
  512. ivprog.LIB_ID = 38;
  513. ivprog.INTEGER = 39;
  514. ivprog.REAL = 40;
  515. ivprog.STRING = 41;
  516. ivprog.CHARACTER = 42;
  517. ivprog.WHITESPACE = 43;
  518. ivprog.EOS = 44;
  519. ivprog.COMMENTS = 45;
  520. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  521. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  522. ivprog.prototype.literalNames = [ null, "'program'", "'real'", "'void'",
  523. "'boolean'", "'string'", "'integer'",
  524. "'character'", "'switch'", "'case'", "'otherwise'",
  525. "'const'", "'function'", "'return'", "'for'",
  526. "'break'", "'do'", "'while'", "'if'",
  527. "'else'", "'false'", "'true'", "'('",
  528. "')'", "'['", "']'", "'{'", "'}'", "','",
  529. "'='", null, null, null, null, null, "':'" ];
  530. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  531. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  532. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  533. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  534. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  535. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  536. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  537. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  538. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  539. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  540. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  541. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  542. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  543. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  544. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  545. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  546. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  547. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  548. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  549. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  550. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  551. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  552. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  553. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  554. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  555. "STRING", "STRING_CHARACTER", "CHARACTER",
  556. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  557. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  558. "COMMENTS" ];
  559. ivprog.prototype.grammarFileName = "ivprog.g4";
  560. exports.ivprog = ivprog;
  561. /***/ }),
  562. /* 1 */
  563. /***/ (function(module, exports, __webpack_require__) {
  564. module.exports = {
  565. ivprog: __webpack_require__(0).ivprog
  566. };
  567. /***/ }),
  568. /* 2 */
  569. /***/ (function(module, exports) {
  570. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  571. /***/ })
  572. /******/ ]);
  573. /***/ }),
  574. /***/ "./grammar/en/langFunctions.js":
  575. /*!*************************************!*\
  576. !*** ./grammar/en/langFunctions.js ***!
  577. \*************************************/
  578. /*! no static exports found */
  579. /***/ (function(module, exports, __webpack_require__) {
  580. "use strict";
  581. Object.defineProperty(exports, "__esModule", {
  582. value: true
  583. });
  584. /* This is a dictionary of the language defined functions
  585. **/
  586. exports.default = {
  587. main_function: "start",
  588. $read: "read",
  589. $write: "write",
  590. $numElements: "numero_elementos",
  591. $matrixLines: "matriz_linhas",
  592. $matrixColumns: "matriz_colunas",
  593. $substring: "subcadeia",
  594. $length: "comprimento",
  595. $uppercase: "caixa_alta",
  596. $lowercase: "caixa_baixa",
  597. $charAt: "char_at",
  598. $isReal: "e_real",
  599. $isInt: "e_inteiro",
  600. $isBool: "e_logico",
  601. $castReal: "como_real",
  602. $castInt: "como_inteiro",
  603. $castBool: "como_logico",
  604. $castString: "como_cadeia",
  605. $sin: "sen",
  606. $cos: "cos",
  607. $tan: "tan",
  608. $sqrt: "raiz_quadrada",
  609. $pow: "pot",
  610. $log: "log",
  611. $abs: "modulo",
  612. $negate: "trocar_sinal",
  613. $invert: "inverter_valor",
  614. $max: "maximo",
  615. $min: "minimo"
  616. };
  617. /***/ }),
  618. /***/ "./grammar/en/langLibs.js":
  619. /*!********************************!*\
  620. !*** ./grammar/en/langLibs.js ***!
  621. \********************************/
  622. /*! no static exports found */
  623. /***/ (function(module, exports, __webpack_require__) {
  624. "use strict";
  625. Object.defineProperty(exports, "__esModule", {
  626. value: true
  627. });
  628. /**
  629. * This is the dictionary of the language defined libraries
  630. */
  631. exports.default = {
  632. $mathLib: "Matematica",
  633. $ioLib: "ES",
  634. $strLib: "Texto",
  635. $arrayLib: "Arranjo",
  636. $langLib: "IV"
  637. };
  638. /***/ }),
  639. /***/ "./grammar/es/ivprog.g4":
  640. /*!******************************!*\
  641. !*** ./grammar/es/ivprog.g4 ***!
  642. \******************************/
  643. /*! no static exports found */
  644. /***/ (function(module, exports, __webpack_require__) {
  645. module.exports =
  646. /******/ (function(modules) { // webpackBootstrap
  647. /******/ // The module cache
  648. /******/ var installedModules = {};
  649. /******/
  650. /******/ // The require function
  651. /******/ function __webpack_require__(moduleId) {
  652. /******/
  653. /******/ // Check if module is in cache
  654. /******/ if(installedModules[moduleId]) {
  655. /******/ return installedModules[moduleId].exports;
  656. /******/ }
  657. /******/ // Create a new module (and put it into the cache)
  658. /******/ var module = installedModules[moduleId] = {
  659. /******/ i: moduleId,
  660. /******/ l: false,
  661. /******/ exports: {}
  662. /******/ };
  663. /******/
  664. /******/ // Execute the module function
  665. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  666. /******/
  667. /******/ // Flag the module as loaded
  668. /******/ module.l = true;
  669. /******/
  670. /******/ // Return the exports of the module
  671. /******/ return module.exports;
  672. /******/ }
  673. /******/
  674. /******/
  675. /******/ // expose the modules object (__webpack_modules__)
  676. /******/ __webpack_require__.m = modules;
  677. /******/
  678. /******/ // expose the module cache
  679. /******/ __webpack_require__.c = installedModules;
  680. /******/
  681. /******/ // identity function for calling harmony imports with the correct context
  682. /******/ __webpack_require__.i = function(value) { return value; };
  683. /******/
  684. /******/ // define getter function for harmony exports
  685. /******/ __webpack_require__.d = function(exports, name, getter) {
  686. /******/ if(!__webpack_require__.o(exports, name)) {
  687. /******/ Object.defineProperty(exports, name, {
  688. /******/ configurable: false,
  689. /******/ enumerable: true,
  690. /******/ get: getter
  691. /******/ });
  692. /******/ }
  693. /******/ };
  694. /******/
  695. /******/ // getDefaultExport function for compatibility with non-harmony modules
  696. /******/ __webpack_require__.n = function(module) {
  697. /******/ var getter = module && module.__esModule ?
  698. /******/ function getDefault() { return module['default']; } :
  699. /******/ function getModuleExports() { return module; };
  700. /******/ __webpack_require__.d(getter, 'a', getter);
  701. /******/ return getter;
  702. /******/ };
  703. /******/
  704. /******/ // Object.prototype.hasOwnProperty.call
  705. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  706. /******/
  707. /******/ // __webpack_public_path__
  708. /******/ __webpack_require__.p = "";
  709. /******/
  710. /******/ // Load entry module and return exports
  711. /******/ return __webpack_require__(__webpack_require__.s = 1);
  712. /******/ })
  713. /************************************************************************/
  714. /******/ ([
  715. /* 0 */
  716. /***/ (function(module, exports, __webpack_require__) {
  717. // Generated from /tmp/tmp-31848uOXWlFdlHH2K/ivprog.g4 by ANTLR 4.7
  718. // jshint ignore: start
  719. var antlr4 = __webpack_require__(2);
  720. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  721. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  722. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  723. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  724. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  725. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  726. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  727. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  728. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  729. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  730. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  731. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  732. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  733. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  734. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  735. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  736. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  737. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  738. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  739. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  740. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  741. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  742. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  743. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  744. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  745. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  746. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  747. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  748. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  749. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  750. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  751. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  752. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  753. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  754. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  755. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  756. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  757. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  758. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  759. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  760. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  761. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  762. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  763. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  764. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  765. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  766. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  767. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  768. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  769. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  770. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  771. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  772. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  773. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  774. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  775. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  776. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  777. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  778. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  779. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  780. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  781. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  782. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  783. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  784. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  785. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  786. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  787. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  788. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  789. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  790. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  791. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  792. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  793. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  794. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  795. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  796. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  797. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  798. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  799. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  800. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  801. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  802. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  803. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  804. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  805. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  806. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  807. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  808. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  809. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  810. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  811. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  812. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  813. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  814. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  815. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  816. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  817. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  818. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  819. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  820. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  821. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  822. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  823. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  824. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  825. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  826. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  827. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  828. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  829. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  830. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  831. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  832. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  833. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  834. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  835. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  836. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  837. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  838. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  839. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  840. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  841. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  842. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  843. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  844. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  845. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  846. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  847. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  848. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  849. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  850. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  851. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  852. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  853. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  854. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  855. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  856. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  857. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  858. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  859. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  860. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  861. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  862. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  863. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  864. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  865. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  866. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  867. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  868. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  869. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  870. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  871. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  872. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  873. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  874. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  875. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  876. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  877. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  878. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  879. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  880. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  881. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  882. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  883. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  884. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  885. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  886. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  887. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  888. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  889. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  890. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  891. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  892. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  893. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  894. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  895. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  896. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  897. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  898. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  899. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  900. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  901. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  902. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  903. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  904. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  905. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  906. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  907. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  908. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  909. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  910. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  911. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  912. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  913. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  914. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  915. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  916. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  917. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  918. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  919. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  920. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  921. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  922. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  923. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  924. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  925. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  926. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  927. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  928. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  929. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  930. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  931. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  932. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  933. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  934. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  935. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  936. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  937. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  938. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  939. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  940. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  941. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  942. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  943. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  944. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  945. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  946. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  947. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  948. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  949. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  950. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  951. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  952. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  953. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  954. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  955. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  956. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  957. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  958. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  959. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  960. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  961. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  962. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  963. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  964. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  965. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  966. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  967. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  968. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  969. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  970. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  971. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  972. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  973. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  974. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  975. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  976. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  977. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  978. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  979. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  980. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  981. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  982. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  983. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  984. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  985. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  986. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  987. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  988. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  989. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  990. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  991. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  992. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  993. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  994. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  995. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  996. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  997. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  998. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  999. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1000. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1001. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1002. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1003. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1004. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1005. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1006. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1007. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1008. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1009. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1010. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1011. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1012. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1013. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1014. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1015. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1016. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1017. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1018. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1019. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1020. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1021. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1022. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1023. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1024. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1025. function ivprog(input) {
  1026. antlr4.Lexer.call(this, input);
  1027. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1028. return this;
  1029. }
  1030. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1031. ivprog.prototype.constructor = ivprog;
  1032. ivprog.EOF = antlr4.Token.EOF;
  1033. ivprog.RK_PROGRAM = 1;
  1034. ivprog.RK_REAL = 2;
  1035. ivprog.RK_VOID = 3;
  1036. ivprog.RK_BOOLEAN = 4;
  1037. ivprog.RK_STRING = 5;
  1038. ivprog.RK_INTEGER = 6;
  1039. ivprog.RK_CHARACTER = 7;
  1040. ivprog.RK_SWITCH = 8;
  1041. ivprog.RK_CASE = 9;
  1042. ivprog.RK_DEFAULT = 10;
  1043. ivprog.RK_CONST = 11;
  1044. ivprog.RK_FUNCTION = 12;
  1045. ivprog.RK_RETURN = 13;
  1046. ivprog.RK_FOR = 14;
  1047. ivprog.RK_BREAK = 15;
  1048. ivprog.RK_DO = 16;
  1049. ivprog.RK_WHILE = 17;
  1050. ivprog.RK_IF = 18;
  1051. ivprog.RK_ELSE = 19;
  1052. ivprog.RK_FALSE = 20;
  1053. ivprog.RK_TRUE = 21;
  1054. ivprog.OPEN_PARENTHESIS = 22;
  1055. ivprog.CLOSE_PARENTHESIS = 23;
  1056. ivprog.OPEN_BRACE = 24;
  1057. ivprog.CLOSE_BRACE = 25;
  1058. ivprog.OPEN_CURLY = 26;
  1059. ivprog.CLOSE_CURLY = 27;
  1060. ivprog.COMMA = 28;
  1061. ivprog.EQUAL = 29;
  1062. ivprog.SUM_OP = 30;
  1063. ivprog.MULTI_OP = 31;
  1064. ivprog.AND_OPERATOR = 32;
  1065. ivprog.OR_OPERATOR = 33;
  1066. ivprog.RELATIONAL_OPERATOR = 34;
  1067. ivprog.COLON = 35;
  1068. ivprog.NOT_OPERATOR = 36;
  1069. ivprog.ID = 37;
  1070. ivprog.LIB_ID = 38;
  1071. ivprog.INTEGER = 39;
  1072. ivprog.REAL = 40;
  1073. ivprog.STRING = 41;
  1074. ivprog.CHARACTER = 42;
  1075. ivprog.WHITESPACE = 43;
  1076. ivprog.EOS = 44;
  1077. ivprog.COMMENTS = 45;
  1078. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1079. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1080. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1081. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1082. "'escolha'", "'caso'", "'contrario'",
  1083. "'const'", "'funcao'", "'retorne'", "'para'",
  1084. "'pare'", "'faca'", "'enquanto'", "'se'",
  1085. "'senao'", "'falso'", "'verdadeiro'",
  1086. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1087. "','", "'='", null, null, null, null,
  1088. null, "':'" ];
  1089. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1090. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1091. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1092. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1093. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1094. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1095. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1096. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1097. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1098. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1099. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1100. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1101. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1102. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1103. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1104. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1105. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1106. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1107. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1108. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1109. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1110. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1111. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1112. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1113. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1114. "STRING", "STRING_CHARACTER", "CHARACTER",
  1115. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1116. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1117. "COMMENTS" ];
  1118. ivprog.prototype.grammarFileName = "ivprog.g4";
  1119. exports.ivprog = ivprog;
  1120. /***/ }),
  1121. /* 1 */
  1122. /***/ (function(module, exports, __webpack_require__) {
  1123. module.exports = {
  1124. ivprog: __webpack_require__(0).ivprog
  1125. };
  1126. /***/ }),
  1127. /* 2 */
  1128. /***/ (function(module, exports) {
  1129. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1130. /***/ })
  1131. /******/ ]);
  1132. /***/ }),
  1133. /***/ "./grammar/es/langFunctions.js":
  1134. /*!*************************************!*\
  1135. !*** ./grammar/es/langFunctions.js ***!
  1136. \*************************************/
  1137. /*! no static exports found */
  1138. /***/ (function(module, exports, __webpack_require__) {
  1139. "use strict";
  1140. Object.defineProperty(exports, "__esModule", {
  1141. value: true
  1142. });
  1143. /* This is a dictionary of the language defined functions
  1144. **/
  1145. exports.default = {
  1146. main_function: "inicio",
  1147. $read: "leia",
  1148. $write: "escreva",
  1149. $numElements: "numero_elementos",
  1150. $matrixLines: "matriz_linhas",
  1151. $matrixColumns: "matriz_colunas",
  1152. $substring: "subcadeia",
  1153. $length: "comprimento",
  1154. $uppercase: "caixa_alta",
  1155. $lowercase: "caixa_baixa",
  1156. $charAt: "char_at",
  1157. $isReal: "e_real",
  1158. $isInt: "e_inteiro",
  1159. $isBool: "e_logico",
  1160. $castReal: "como_real",
  1161. $castInt: "como_inteiro",
  1162. $castBool: "como_logico",
  1163. $castString: "como_cadeia",
  1164. $sin: "sen",
  1165. $cos: "cos",
  1166. $tan: "tan",
  1167. $sqrt: "raiz_quadrada",
  1168. $pow: "pot",
  1169. $log: "log",
  1170. $abs: "modulo",
  1171. $negate: "trocar_sinal",
  1172. $invert: "inverter_valor",
  1173. $max: "maximo",
  1174. $min: "minimo"
  1175. };
  1176. /***/ }),
  1177. /***/ "./grammar/es/langLibs.js":
  1178. /*!********************************!*\
  1179. !*** ./grammar/es/langLibs.js ***!
  1180. \********************************/
  1181. /*! no static exports found */
  1182. /***/ (function(module, exports, __webpack_require__) {
  1183. "use strict";
  1184. Object.defineProperty(exports, "__esModule", {
  1185. value: true
  1186. });
  1187. /**
  1188. * This is the dictionary of the language defined libraries
  1189. */
  1190. exports.default = {
  1191. $mathLib: "Matematica",
  1192. $ioLib: "ES",
  1193. $strLib: "Texto",
  1194. $arrayLib: "Arranjo",
  1195. $langLib: "IV"
  1196. };
  1197. /***/ }),
  1198. /***/ "./grammar/index.js":
  1199. /*!**************************!*\
  1200. !*** ./grammar/index.js ***!
  1201. \**************************/
  1202. /*! no static exports found */
  1203. /***/ (function(module, exports, __webpack_require__) {
  1204. "use strict";
  1205. var _ivprog = __webpack_require__(/*! ./pt/ivprog.g4 */ "./grammar/pt/ivprog.g4");
  1206. var PT = _interopRequireWildcard(_ivprog);
  1207. var _langFunctions = __webpack_require__(/*! ./pt/langFunctions */ "./grammar/pt/langFunctions.js");
  1208. var _langFunctions2 = _interopRequireDefault(_langFunctions);
  1209. var _langLibs = __webpack_require__(/*! ./pt/langLibs */ "./grammar/pt/langLibs.js");
  1210. var _langLibs2 = _interopRequireDefault(_langLibs);
  1211. var _ivprog2 = __webpack_require__(/*! ./en/ivprog.g4 */ "./grammar/en/ivprog.g4");
  1212. var EN = _interopRequireWildcard(_ivprog2);
  1213. var _langFunctions3 = __webpack_require__(/*! ./en/langFunctions */ "./grammar/en/langFunctions.js");
  1214. var _langFunctions4 = _interopRequireDefault(_langFunctions3);
  1215. var _langLibs3 = __webpack_require__(/*! ./en/langLibs */ "./grammar/en/langLibs.js");
  1216. var _langLibs4 = _interopRequireDefault(_langLibs3);
  1217. var _ivprog3 = __webpack_require__(/*! ./es/ivprog.g4 */ "./grammar/es/ivprog.g4");
  1218. var ES = _interopRequireWildcard(_ivprog3);
  1219. var _langFunctions5 = __webpack_require__(/*! ./es/langFunctions */ "./grammar/es/langFunctions.js");
  1220. var _langFunctions6 = _interopRequireDefault(_langFunctions5);
  1221. var _langLibs5 = __webpack_require__(/*! ./es/langLibs */ "./grammar/es/langLibs.js");
  1222. var _langLibs6 = _interopRequireDefault(_langLibs5);
  1223. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1224. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  1225. exports.pt = { lexer: PT.ivprog, langFuncs: _langFunctions2.default, langLibs: _langLibs2.default };
  1226. exports.en = { lexer: EN.ivprog, langFuncs: _langFunctions4.default, langLibs: _langLibs4.default };
  1227. exports.es = { lexer: ES.ivprog, langFuncs: _langFunctions6.default, langLibs: _langLibs6.default };
  1228. /***/ }),
  1229. /***/ "./grammar/pt/ivprog.g4":
  1230. /*!******************************!*\
  1231. !*** ./grammar/pt/ivprog.g4 ***!
  1232. \******************************/
  1233. /*! no static exports found */
  1234. /***/ (function(module, exports, __webpack_require__) {
  1235. module.exports =
  1236. /******/ (function(modules) { // webpackBootstrap
  1237. /******/ // The module cache
  1238. /******/ var installedModules = {};
  1239. /******/
  1240. /******/ // The require function
  1241. /******/ function __webpack_require__(moduleId) {
  1242. /******/
  1243. /******/ // Check if module is in cache
  1244. /******/ if(installedModules[moduleId]) {
  1245. /******/ return installedModules[moduleId].exports;
  1246. /******/ }
  1247. /******/ // Create a new module (and put it into the cache)
  1248. /******/ var module = installedModules[moduleId] = {
  1249. /******/ i: moduleId,
  1250. /******/ l: false,
  1251. /******/ exports: {}
  1252. /******/ };
  1253. /******/
  1254. /******/ // Execute the module function
  1255. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1256. /******/
  1257. /******/ // Flag the module as loaded
  1258. /******/ module.l = true;
  1259. /******/
  1260. /******/ // Return the exports of the module
  1261. /******/ return module.exports;
  1262. /******/ }
  1263. /******/
  1264. /******/
  1265. /******/ // expose the modules object (__webpack_modules__)
  1266. /******/ __webpack_require__.m = modules;
  1267. /******/
  1268. /******/ // expose the module cache
  1269. /******/ __webpack_require__.c = installedModules;
  1270. /******/
  1271. /******/ // identity function for calling harmony imports with the correct context
  1272. /******/ __webpack_require__.i = function(value) { return value; };
  1273. /******/
  1274. /******/ // define getter function for harmony exports
  1275. /******/ __webpack_require__.d = function(exports, name, getter) {
  1276. /******/ if(!__webpack_require__.o(exports, name)) {
  1277. /******/ Object.defineProperty(exports, name, {
  1278. /******/ configurable: false,
  1279. /******/ enumerable: true,
  1280. /******/ get: getter
  1281. /******/ });
  1282. /******/ }
  1283. /******/ };
  1284. /******/
  1285. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1286. /******/ __webpack_require__.n = function(module) {
  1287. /******/ var getter = module && module.__esModule ?
  1288. /******/ function getDefault() { return module['default']; } :
  1289. /******/ function getModuleExports() { return module; };
  1290. /******/ __webpack_require__.d(getter, 'a', getter);
  1291. /******/ return getter;
  1292. /******/ };
  1293. /******/
  1294. /******/ // Object.prototype.hasOwnProperty.call
  1295. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  1296. /******/
  1297. /******/ // __webpack_public_path__
  1298. /******/ __webpack_require__.p = "";
  1299. /******/
  1300. /******/ // Load entry module and return exports
  1301. /******/ return __webpack_require__(__webpack_require__.s = 1);
  1302. /******/ })
  1303. /************************************************************************/
  1304. /******/ ([
  1305. /* 0 */
  1306. /***/ (function(module, exports, __webpack_require__) {
  1307. // Generated from /tmp/tmp-31848WpK7uo7lp4Ky/ivprog.g4 by ANTLR 4.7
  1308. // jshint ignore: start
  1309. var antlr4 = __webpack_require__(2);
  1310. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  1311. "\u00020\u01e0\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  1312. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  1313. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  1314. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  1315. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  1316. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  1317. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  1318. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  1319. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  1320. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  1321. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  1322. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  1323. "8\t8\u00049\t9\u0004:\t:\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002",
  1324. "\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003",
  1325. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004",
  1326. "\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005",
  1327. "\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006",
  1328. "\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006",
  1329. "\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007",
  1330. "\u0003\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  1331. "\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  1332. "\t\u0003\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003",
  1333. "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003",
  1334. "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003",
  1335. "\f\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  1336. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  1337. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  1338. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  1339. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  1340. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  1341. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  1342. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  1343. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  1344. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  1345. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  1346. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  1347. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  1348. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  1349. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  1350. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  1351. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0132\n&\u0003\'\u0003\'\u0003",
  1352. "(\u0003(\u0003)\u0003)\u0007)\u013a\n)\f)\u000e)\u013d\u000b)\u0003",
  1353. "*\u0003*\u0003+\u0003+\u0003+\u0003+\u0003,\u0006,\u0146\n,\r,\u000e",
  1354. ",\u0147\u0003,\u0003,\u0003,\u0003,\u0005,\u014e\n,\u0003,\u0006,\u0151",
  1355. "\n,\r,\u000e,\u0152\u0003,\u0003,\u0003,\u0003,\u0005,\u0159\n,\u0003",
  1356. ",\u0006,\u015c\n,\r,\u000e,\u015d\u0005,\u0160\n,\u0003-\u0006-\u0163",
  1357. "\n-\r-\u000e-\u0164\u0003-\u0003-\u0006-\u0169\n-\r-\u000e-\u016a\u0003",
  1358. "-\u0006-\u016e\n-\r-\u000e-\u016f\u0003-\u0003-\u0007-\u0174\n-\f-\u000e",
  1359. "-\u0177\u000b-\u0003-\u0005-\u017a\n-\u0003.\u0003.\u0005.\u017e\n.",
  1360. "\u0003.\u0006.\u0181\n.\r.\u000e.\u0182\u0003/\u0003/\u0007/\u0187\n",
  1361. "/\f/\u000e/\u018a\u000b/\u0003/\u0003/\u00030\u00030\u00050\u0190\n",
  1362. "0\u00031\u00031\u00031\u00051\u0195\n1\u00031\u00031\u00032\u00032\u0003",
  1363. "2\u00032\u00033\u00033\u00034\u00064\u01a0\n4\r4\u000e4\u01a1\u0003",
  1364. "4\u00054\u01a5\n4\u00035\u00035\u00036\u00036\u00037\u00037\u00037\u0003",
  1365. "7\u00057\u01af\n7\u00038\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  1366. "8\u00038\u00038\u00038\u00058\u01bc\n8\u00039\u00039\u00039\u00039\u0003",
  1367. "9\u00039\u00039\u0003:\u0003:\u0003:\u0003:\u0007:\u01c9\n:\f:\u000e",
  1368. ":\u01cc\u000b:\u0003:\u0005:\u01cf\n:\u0003:\u0003:\u0003:\u0003:\u0003",
  1369. ":\u0007:\u01d6\n:\f:\u000e:\u01d9\u000b:\u0003:\u0003:\u0005:\u01dd",
  1370. "\n:\u0003:\u0003:\u0003\u01d7\u0002;\u0003\u0003\u0005\u0004\u0007\u0005",
  1371. "\t\u0006\u000b\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r",
  1372. "\u0019\u000e\u001b\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014",
  1373. "\'\u0015)\u0016+\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b",
  1374. ";\u001c=\u001d?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y+[\u0002],_\u0002",
  1375. "a-c.e\u0002g/i\u0002k\u0002m\u0002o\u0002q\u0002s0\u0003\u0002\u0012",
  1376. "\u0004\u0002--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\",
  1377. "aac|\u0006\u00022;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GG",
  1378. "gg\u0006\u0002\f\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004",
  1379. "\u0002\u000b\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHc",
  1380. "h\u0003\u000229\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f4\u0002",
  1381. "\u0003\u0003\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002",
  1382. "\u0007\u0003\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002",
  1383. "\u000b\u0003\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002",
  1384. "\u000f\u0003\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002",
  1385. "\u0013\u0003\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002",
  1386. "\u0017\u0003\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002",
  1387. "\u001b\u0003\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002",
  1388. "\u001f\u0003\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002",
  1389. "#\u0003\u0002\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003",
  1390. "\u0002\u0002\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002",
  1391. "\u0002\u0002\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002",
  1392. "\u0002\u00027\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002",
  1393. "\u0002;\u0003\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002",
  1394. "?\u0003\u0002\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003",
  1395. "\u0002\u0002\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002",
  1396. "\u0002\u0002\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002",
  1397. "\u0002\u0002M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002",
  1398. "\u0002Q\u0003\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002",
  1399. "U\u0003\u0002\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002Y\u0003",
  1400. "\u0002\u0002\u0002\u0002]\u0003\u0002\u0002\u0002\u0002a\u0003\u0002",
  1401. "\u0002\u0002\u0002c\u0003\u0002\u0002\u0002\u0002g\u0003\u0002\u0002",
  1402. "\u0002\u0002s\u0003\u0002\u0002\u0002\u0003u\u0003\u0002\u0002\u0002",
  1403. "\u0005~\u0003\u0002\u0002\u0002\u0007\u0083\u0003\u0002\u0002\u0002",
  1404. "\t\u0089\u0003\u0002\u0002\u0002\u000b\u0090\u0003\u0002\u0002\u0002",
  1405. "\r\u0097\u0003\u0002\u0002\u0002\u000f\u009f\u0003\u0002\u0002\u0002",
  1406. "\u0011\u00a9\u0003\u0002\u0002\u0002\u0013\u00b1\u0003\u0002\u0002\u0002",
  1407. "\u0015\u00b6\u0003\u0002\u0002\u0002\u0017\u00c0\u0003\u0002\u0002\u0002",
  1408. "\u0019\u00c6\u0003\u0002\u0002\u0002\u001b\u00cd\u0003\u0002\u0002\u0002",
  1409. "\u001d\u00d5\u0003\u0002\u0002\u0002\u001f\u00da\u0003\u0002\u0002\u0002",
  1410. "!\u00df\u0003\u0002\u0002\u0002#\u00e4\u0003\u0002\u0002\u0002%\u00ed",
  1411. "\u0003\u0002\u0002\u0002\'\u00f0\u0003\u0002\u0002\u0002)\u00f6\u0003",
  1412. "\u0002\u0002\u0002+\u00fc\u0003\u0002\u0002\u0002-\u0107\u0003\u0002",
  1413. "\u0002\u0002/\u010b\u0003\u0002\u0002\u00021\u010d\u0003\u0002\u0002",
  1414. "\u00023\u0110\u0003\u0002\u0002\u00025\u0112\u0003\u0002\u0002\u0002",
  1415. "7\u0114\u0003\u0002\u0002\u00029\u0116\u0003\u0002\u0002\u0002;\u0118",
  1416. "\u0003\u0002\u0002\u0002=\u011a\u0003\u0002\u0002\u0002?\u011c\u0003",
  1417. "\u0002\u0002\u0002A\u011e\u0003\u0002\u0002\u0002C\u0120\u0003\u0002",
  1418. "\u0002\u0002E\u0122\u0003\u0002\u0002\u0002G\u0124\u0003\u0002\u0002",
  1419. "\u0002I\u0126\u0003\u0002\u0002\u0002K\u0131\u0003\u0002\u0002\u0002",
  1420. "M\u0133\u0003\u0002\u0002\u0002O\u0135\u0003\u0002\u0002\u0002Q\u0137",
  1421. "\u0003\u0002\u0002\u0002S\u013e\u0003\u0002\u0002\u0002U\u0140\u0003",
  1422. "\u0002\u0002\u0002W\u015f\u0003\u0002\u0002\u0002Y\u0179\u0003\u0002",
  1423. "\u0002\u0002[\u017b\u0003\u0002\u0002\u0002]\u0184\u0003\u0002\u0002",
  1424. "\u0002_\u018f\u0003\u0002\u0002\u0002a\u0191\u0003\u0002\u0002\u0002",
  1425. "c\u0198\u0003\u0002\u0002\u0002e\u019c\u0003\u0002\u0002\u0002g\u01a4",
  1426. "\u0003\u0002\u0002\u0002i\u01a6\u0003\u0002\u0002\u0002k\u01a8\u0003",
  1427. "\u0002\u0002\u0002m\u01ae\u0003\u0002\u0002\u0002o\u01bb\u0003\u0002",
  1428. "\u0002\u0002q\u01bd\u0003\u0002\u0002\u0002s\u01dc\u0003\u0002\u0002",
  1429. "\u0002uv\u0007r\u0002\u0002vw\u0007t\u0002\u0002wx\u0007q\u0002\u0002",
  1430. "xy\u0007i\u0002\u0002yz\u0007t\u0002\u0002z{\u0007c\u0002\u0002{|\u0007",
  1431. "o\u0002\u0002|}\u0007c\u0002\u0002}\u0004\u0003\u0002\u0002\u0002~\u007f",
  1432. "\u0007t\u0002\u0002\u007f\u0080\u0007g\u0002\u0002\u0080\u0081\u0007",
  1433. "c\u0002\u0002\u0081\u0082\u0007n\u0002\u0002\u0082\u0006\u0003\u0002",
  1434. "\u0002\u0002\u0083\u0084\u0007x\u0002\u0002\u0084\u0085\u0007c\u0002",
  1435. "\u0002\u0085\u0086\u0007|\u0002\u0002\u0086\u0087\u0007k\u0002\u0002",
  1436. "\u0087\u0088\u0007q\u0002\u0002\u0088\b\u0003\u0002\u0002\u0002\u0089",
  1437. "\u008a\u0007n\u0002\u0002\u008a\u008b\u0007q\u0002\u0002\u008b\u008c",
  1438. "\u0007i\u0002\u0002\u008c\u008d\u0007k\u0002\u0002\u008d\u008e\u0007",
  1439. "e\u0002\u0002\u008e\u008f\u0007q\u0002\u0002\u008f\n\u0003\u0002\u0002",
  1440. "\u0002\u0090\u0091\u0007e\u0002\u0002\u0091\u0092\u0007c\u0002\u0002",
  1441. "\u0092\u0093\u0007f\u0002\u0002\u0093\u0094\u0007g\u0002\u0002\u0094",
  1442. "\u0095\u0007k\u0002\u0002\u0095\u0096\u0007c\u0002\u0002\u0096\f\u0003",
  1443. "\u0002\u0002\u0002\u0097\u0098\u0007k\u0002\u0002\u0098\u0099\u0007",
  1444. "p\u0002\u0002\u0099\u009a\u0007v\u0002\u0002\u009a\u009b\u0007g\u0002",
  1445. "\u0002\u009b\u009c\u0007k\u0002\u0002\u009c\u009d\u0007t\u0002\u0002",
  1446. "\u009d\u009e\u0007q\u0002\u0002\u009e\u000e\u0003\u0002\u0002\u0002",
  1447. "\u009f\u00a0\u0007e\u0002\u0002\u00a0\u00a1\u0007c\u0002\u0002\u00a1",
  1448. "\u00a2\u0007t\u0002\u0002\u00a2\u00a3\u0007c\u0002\u0002\u00a3\u00a4",
  1449. "\u0007e\u0002\u0002\u00a4\u00a5\u0007v\u0002\u0002\u00a5\u00a6\u0007",
  1450. "g\u0002\u0002\u00a6\u00a7\u0007t\u0002\u0002\u00a7\u00a8\u0007g\u0002",
  1451. "\u0002\u00a8\u0010\u0003\u0002\u0002\u0002\u00a9\u00aa\u0007g\u0002",
  1452. "\u0002\u00aa\u00ab\u0007u\u0002\u0002\u00ab\u00ac\u0007e\u0002\u0002",
  1453. "\u00ac\u00ad\u0007q\u0002\u0002\u00ad\u00ae\u0007n\u0002\u0002\u00ae",
  1454. "\u00af\u0007j\u0002\u0002\u00af\u00b0\u0007c\u0002\u0002\u00b0\u0012",
  1455. "\u0003\u0002\u0002\u0002\u00b1\u00b2\u0007e\u0002\u0002\u00b2\u00b3",
  1456. "\u0007c\u0002\u0002\u00b3\u00b4\u0007u\u0002\u0002\u00b4\u00b5\u0007",
  1457. "q\u0002\u0002\u00b5\u0014\u0003\u0002\u0002\u0002\u00b6\u00b7\u0007",
  1458. "e\u0002\u0002\u00b7\u00b8\u0007q\u0002\u0002\u00b8\u00b9\u0007p\u0002",
  1459. "\u0002\u00b9\u00ba\u0007v\u0002\u0002\u00ba\u00bb\u0007t\u0002\u0002",
  1460. "\u00bb\u00bc\u0007c\u0002\u0002\u00bc\u00bd\u0007t\u0002\u0002\u00bd",
  1461. "\u00be\u0007k\u0002\u0002\u00be\u00bf\u0007q\u0002\u0002\u00bf\u0016",
  1462. "\u0003\u0002\u0002\u0002\u00c0\u00c1\u0007e\u0002\u0002\u00c1\u00c2",
  1463. "\u0007q\u0002\u0002\u00c2\u00c3\u0007p\u0002\u0002\u00c3\u00c4\u0007",
  1464. "u\u0002\u0002\u00c4\u00c5\u0007v\u0002\u0002\u00c5\u0018\u0003\u0002",
  1465. "\u0002\u0002\u00c6\u00c7\u0007h\u0002\u0002\u00c7\u00c8\u0007w\u0002",
  1466. "\u0002\u00c8\u00c9\u0007p\u0002\u0002\u00c9\u00ca\u0007e\u0002\u0002",
  1467. "\u00ca\u00cb\u0007c\u0002\u0002\u00cb\u00cc\u0007q\u0002\u0002\u00cc",
  1468. "\u001a\u0003\u0002\u0002\u0002\u00cd\u00ce\u0007t\u0002\u0002\u00ce",
  1469. "\u00cf\u0007g\u0002\u0002\u00cf\u00d0\u0007v\u0002\u0002\u00d0\u00d1",
  1470. "\u0007q\u0002\u0002\u00d1\u00d2\u0007t\u0002\u0002\u00d2\u00d3\u0007",
  1471. "p\u0002\u0002\u00d3\u00d4\u0007g\u0002\u0002\u00d4\u001c\u0003\u0002",
  1472. "\u0002\u0002\u00d5\u00d6\u0007r\u0002\u0002\u00d6\u00d7\u0007c\u0002",
  1473. "\u0002\u00d7\u00d8\u0007t\u0002\u0002\u00d8\u00d9\u0007c\u0002\u0002",
  1474. "\u00d9\u001e\u0003\u0002\u0002\u0002\u00da\u00db\u0007r\u0002\u0002",
  1475. "\u00db\u00dc\u0007c\u0002\u0002\u00dc\u00dd\u0007t\u0002\u0002\u00dd",
  1476. "\u00de\u0007g\u0002\u0002\u00de \u0003\u0002\u0002\u0002\u00df\u00e0",
  1477. "\u0007h\u0002\u0002\u00e0\u00e1\u0007c\u0002\u0002\u00e1\u00e2\u0007",
  1478. "e\u0002\u0002\u00e2\u00e3\u0007c\u0002\u0002\u00e3\"\u0003\u0002\u0002",
  1479. "\u0002\u00e4\u00e5\u0007g\u0002\u0002\u00e5\u00e6\u0007p\u0002\u0002",
  1480. "\u00e6\u00e7\u0007s\u0002\u0002\u00e7\u00e8\u0007w\u0002\u0002\u00e8",
  1481. "\u00e9\u0007c\u0002\u0002\u00e9\u00ea\u0007p\u0002\u0002\u00ea\u00eb",
  1482. "\u0007v\u0002\u0002\u00eb\u00ec\u0007q\u0002\u0002\u00ec$\u0003\u0002",
  1483. "\u0002\u0002\u00ed\u00ee\u0007u\u0002\u0002\u00ee\u00ef\u0007g\u0002",
  1484. "\u0002\u00ef&\u0003\u0002\u0002\u0002\u00f0\u00f1\u0007u\u0002\u0002",
  1485. "\u00f1\u00f2\u0007g\u0002\u0002\u00f2\u00f3\u0007p\u0002\u0002\u00f3",
  1486. "\u00f4\u0007c\u0002\u0002\u00f4\u00f5\u0007q\u0002\u0002\u00f5(\u0003",
  1487. "\u0002\u0002\u0002\u00f6\u00f7\u0007h\u0002\u0002\u00f7\u00f8\u0007",
  1488. "c\u0002\u0002\u00f8\u00f9\u0007n\u0002\u0002\u00f9\u00fa\u0007u\u0002",
  1489. "\u0002\u00fa\u00fb\u0007q\u0002\u0002\u00fb*\u0003\u0002\u0002\u0002",
  1490. "\u00fc\u00fd\u0007x\u0002\u0002\u00fd\u00fe\u0007g\u0002\u0002\u00fe",
  1491. "\u00ff\u0007t\u0002\u0002\u00ff\u0100\u0007f\u0002\u0002\u0100\u0101",
  1492. "\u0007c\u0002\u0002\u0101\u0102\u0007f\u0002\u0002\u0102\u0103\u0007",
  1493. "g\u0002\u0002\u0103\u0104\u0007k\u0002\u0002\u0104\u0105\u0007t\u0002",
  1494. "\u0002\u0105\u0106\u0007q\u0002\u0002\u0106,\u0003\u0002\u0002\u0002",
  1495. "\u0107\u0108\u0007p\u0002\u0002\u0108\u0109\u0007c\u0002\u0002\u0109",
  1496. "\u010a\u0007q\u0002\u0002\u010a.\u0003\u0002\u0002\u0002\u010b\u010c",
  1497. "\u0007G\u0002\u0002\u010c0\u0003\u0002\u0002\u0002\u010d\u010e\u0007",
  1498. "Q\u0002\u0002\u010e\u010f\u0007W\u0002\u0002\u010f2\u0003\u0002\u0002",
  1499. "\u0002\u0110\u0111\u0007*\u0002\u0002\u01114\u0003\u0002\u0002\u0002",
  1500. "\u0112\u0113\u0007+\u0002\u0002\u01136\u0003\u0002\u0002\u0002\u0114",
  1501. "\u0115\u0007]\u0002\u0002\u01158\u0003\u0002\u0002\u0002\u0116\u0117",
  1502. "\u0007_\u0002\u0002\u0117:\u0003\u0002\u0002\u0002\u0118\u0119\u0007",
  1503. "}\u0002\u0002\u0119<\u0003\u0002\u0002\u0002\u011a\u011b\u0007\u007f",
  1504. "\u0002\u0002\u011b>\u0003\u0002\u0002\u0002\u011c\u011d\u0007.\u0002",
  1505. "\u0002\u011d@\u0003\u0002\u0002\u0002\u011e\u011f\u0007?\u0002\u0002",
  1506. "\u011fB\u0003\u0002\u0002\u0002\u0120\u0121\t\u0002\u0002\u0002\u0121",
  1507. "D\u0003\u0002\u0002\u0002\u0122\u0123\t\u0003\u0002\u0002\u0123F\u0003",
  1508. "\u0002\u0002\u0002\u0124\u0125\u0005/\u0018\u0002\u0125H\u0003\u0002",
  1509. "\u0002\u0002\u0126\u0127\u00051\u0019\u0002\u0127J\u0003\u0002\u0002",
  1510. "\u0002\u0128\u0129\u0007@\u0002\u0002\u0129\u0132\u0007?\u0002\u0002",
  1511. "\u012a\u012b\u0007?\u0002\u0002\u012b\u0132\u0007?\u0002\u0002\u012c",
  1512. "\u012d\u0007>\u0002\u0002\u012d\u0132\u0007?\u0002\u0002\u012e\u0132",
  1513. "\t\u0004\u0002\u0002\u012f\u0130\u0007#\u0002\u0002\u0130\u0132\u0007",
  1514. "?\u0002\u0002\u0131\u0128\u0003\u0002\u0002\u0002\u0131\u012a\u0003",
  1515. "\u0002\u0002\u0002\u0131\u012c\u0003\u0002\u0002\u0002\u0131\u012e\u0003",
  1516. "\u0002\u0002\u0002\u0131\u012f\u0003\u0002\u0002\u0002\u0132L\u0003",
  1517. "\u0002\u0002\u0002\u0133\u0134\u0007<\u0002\u0002\u0134N\u0003\u0002",
  1518. "\u0002\u0002\u0135\u0136\u0005-\u0017\u0002\u0136P\u0003\u0002\u0002",
  1519. "\u0002\u0137\u013b\t\u0005\u0002\u0002\u0138\u013a\t\u0006\u0002\u0002",
  1520. "\u0139\u0138\u0003\u0002\u0002\u0002\u013a\u013d\u0003\u0002\u0002\u0002",
  1521. "\u013b\u0139\u0003\u0002\u0002\u0002\u013b\u013c\u0003\u0002\u0002\u0002",
  1522. "\u013cR\u0003\u0002\u0002\u0002\u013d\u013b\u0003\u0002\u0002\u0002",
  1523. "\u013e\u013f\u0007&\u0002\u0002\u013fT\u0003\u0002\u0002\u0002\u0140",
  1524. "\u0141\u0005Q)\u0002\u0141\u0142\u00070\u0002\u0002\u0142\u0143\u0005",
  1525. "Q)\u0002\u0143V\u0003\u0002\u0002\u0002\u0144\u0146\t\u0007\u0002\u0002",
  1526. "\u0145\u0144\u0003\u0002\u0002\u0002\u0146\u0147\u0003\u0002\u0002\u0002",
  1527. "\u0147\u0145\u0003\u0002\u0002\u0002\u0147\u0148\u0003\u0002\u0002\u0002",
  1528. "\u0148\u0160\u0003\u0002\u0002\u0002\u0149\u014a\u00072\u0002\u0002",
  1529. "\u014a\u014e\u0007z\u0002\u0002\u014b\u014c\u00072\u0002\u0002\u014c",
  1530. "\u014e\u0007Z\u0002\u0002\u014d\u0149\u0003\u0002\u0002\u0002\u014d",
  1531. "\u014b\u0003\u0002\u0002\u0002\u014e\u0150\u0003\u0002\u0002\u0002\u014f",
  1532. "\u0151\u0005i5\u0002\u0150\u014f\u0003\u0002\u0002\u0002\u0151\u0152",
  1533. "\u0003\u0002\u0002\u0002\u0152\u0150\u0003\u0002\u0002\u0002\u0152\u0153",
  1534. "\u0003\u0002\u0002\u0002\u0153\u0160\u0003\u0002\u0002\u0002\u0154\u0155",
  1535. "\u00072\u0002\u0002\u0155\u0159\u0007d\u0002\u0002\u0156\u0157\u0007",
  1536. "2\u0002\u0002\u0157\u0159\u0007D\u0002\u0002\u0158\u0154\u0003\u0002",
  1537. "\u0002\u0002\u0158\u0156\u0003\u0002\u0002\u0002\u0159\u015b\u0003\u0002",
  1538. "\u0002\u0002\u015a\u015c\t\b\u0002\u0002\u015b\u015a\u0003\u0002\u0002",
  1539. "\u0002\u015c\u015d\u0003\u0002\u0002\u0002\u015d\u015b\u0003\u0002\u0002",
  1540. "\u0002\u015d\u015e\u0003\u0002\u0002\u0002\u015e\u0160\u0003\u0002\u0002",
  1541. "\u0002\u015f\u0145\u0003\u0002\u0002\u0002\u015f\u014d\u0003\u0002\u0002",
  1542. "\u0002\u015f\u0158\u0003\u0002\u0002\u0002\u0160X\u0003\u0002\u0002",
  1543. "\u0002\u0161\u0163\t\u0007\u0002\u0002\u0162\u0161\u0003\u0002\u0002",
  1544. "\u0002\u0163\u0164\u0003\u0002\u0002\u0002\u0164\u0162\u0003\u0002\u0002",
  1545. "\u0002\u0164\u0165\u0003\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002",
  1546. "\u0002\u0166\u0168\u00070\u0002\u0002\u0167\u0169\t\u0007\u0002\u0002",
  1547. "\u0168\u0167\u0003\u0002\u0002\u0002\u0169\u016a\u0003\u0002\u0002\u0002",
  1548. "\u016a\u0168\u0003\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002",
  1549. "\u016b\u017a\u0003\u0002\u0002\u0002\u016c\u016e\t\u0007\u0002\u0002",
  1550. "\u016d\u016c\u0003\u0002\u0002\u0002\u016e\u016f\u0003\u0002\u0002\u0002",
  1551. "\u016f\u016d\u0003\u0002\u0002\u0002\u016f\u0170\u0003\u0002\u0002\u0002",
  1552. "\u0170\u0171\u0003\u0002\u0002\u0002\u0171\u0175\u00070\u0002\u0002",
  1553. "\u0172\u0174\t\u0007\u0002\u0002\u0173\u0172\u0003\u0002\u0002\u0002",
  1554. "\u0174\u0177\u0003\u0002\u0002\u0002\u0175\u0173\u0003\u0002\u0002\u0002",
  1555. "\u0175\u0176\u0003\u0002\u0002\u0002\u0176\u0178\u0003\u0002\u0002\u0002",
  1556. "\u0177\u0175\u0003\u0002\u0002\u0002\u0178\u017a\u0005[.\u0002\u0179",
  1557. "\u0162\u0003\u0002\u0002\u0002\u0179\u016d\u0003\u0002\u0002\u0002\u017a",
  1558. "Z\u0003\u0002\u0002\u0002\u017b\u017d\t\t\u0002\u0002\u017c\u017e\t",
  1559. "\u0002\u0002\u0002\u017d\u017c\u0003\u0002\u0002\u0002\u017d\u017e\u0003",
  1560. "\u0002\u0002\u0002\u017e\u0180\u0003\u0002\u0002\u0002\u017f\u0181\t",
  1561. "\u0007\u0002\u0002\u0180\u017f\u0003\u0002\u0002\u0002\u0181\u0182\u0003",
  1562. "\u0002\u0002\u0002\u0182\u0180\u0003\u0002\u0002\u0002\u0182\u0183\u0003",
  1563. "\u0002\u0002\u0002\u0183\\\u0003\u0002\u0002\u0002\u0184\u0188\u0007",
  1564. "$\u0002\u0002\u0185\u0187\u0005_0\u0002\u0186\u0185\u0003\u0002\u0002",
  1565. "\u0002\u0187\u018a\u0003\u0002\u0002\u0002\u0188\u0186\u0003\u0002\u0002",
  1566. "\u0002\u0188\u0189\u0003\u0002\u0002\u0002\u0189\u018b\u0003\u0002\u0002",
  1567. "\u0002\u018a\u0188\u0003\u0002\u0002\u0002\u018b\u018c\u0007$\u0002",
  1568. "\u0002\u018c^\u0003\u0002\u0002\u0002\u018d\u0190\n\n\u0002\u0002\u018e",
  1569. "\u0190\u0005m7\u0002\u018f\u018d\u0003\u0002\u0002\u0002\u018f\u018e",
  1570. "\u0003\u0002\u0002\u0002\u0190`\u0003\u0002\u0002\u0002\u0191\u0194",
  1571. "\u0007)\u0002\u0002\u0192\u0195\u0005m7\u0002\u0193\u0195\n\u000b\u0002",
  1572. "\u0002\u0194\u0192\u0003\u0002\u0002\u0002\u0194\u0193\u0003\u0002\u0002",
  1573. "\u0002\u0195\u0196\u0003\u0002\u0002\u0002\u0196\u0197\u0007)\u0002",
  1574. "\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199\t\f\u0002\u0002\u0199",
  1575. "\u019a\u0003\u0002\u0002\u0002\u019a\u019b\b2\u0002\u0002\u019bd\u0003",
  1576. "\u0002\u0002\u0002\u019c\u019d\u0007=\u0002\u0002\u019df\u0003\u0002",
  1577. "\u0002\u0002\u019e\u01a0\t\r\u0002\u0002\u019f\u019e\u0003\u0002\u0002",
  1578. "\u0002\u01a0\u01a1\u0003\u0002\u0002\u0002\u01a1\u019f\u0003\u0002\u0002",
  1579. "\u0002\u01a1\u01a2\u0003\u0002\u0002\u0002\u01a2\u01a5\u0003\u0002\u0002",
  1580. "\u0002\u01a3\u01a5\u0005e3\u0002\u01a4\u019f\u0003\u0002\u0002\u0002",
  1581. "\u01a4\u01a3\u0003\u0002\u0002\u0002\u01a5h\u0003\u0002\u0002\u0002",
  1582. "\u01a6\u01a7\t\u000e\u0002\u0002\u01a7j\u0003\u0002\u0002\u0002\u01a8",
  1583. "\u01a9\t\u000f\u0002\u0002\u01a9l\u0003\u0002\u0002\u0002\u01aa\u01ab",
  1584. "\u0007^\u0002\u0002\u01ab\u01af\t\u0010\u0002\u0002\u01ac\u01af\u0005",
  1585. "q9\u0002\u01ad\u01af\u0005o8\u0002\u01ae\u01aa\u0003\u0002\u0002\u0002",
  1586. "\u01ae\u01ac\u0003\u0002\u0002\u0002\u01ae\u01ad\u0003\u0002\u0002\u0002",
  1587. "\u01afn\u0003\u0002\u0002\u0002\u01b0\u01b1\u0007^\u0002\u0002\u01b1",
  1588. "\u01b2\t\u0011\u0002\u0002\u01b2\u01b3\u0005k6\u0002\u01b3\u01b4\u0005",
  1589. "k6\u0002\u01b4\u01bc\u0003\u0002\u0002\u0002\u01b5\u01b6\u0007^\u0002",
  1590. "\u0002\u01b6\u01b7\u0005k6\u0002\u01b7\u01b8\u0005k6\u0002\u01b8\u01bc",
  1591. "\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002\u0002\u01ba\u01bc",
  1592. "\u0005k6\u0002\u01bb\u01b0\u0003\u0002\u0002\u0002\u01bb\u01b5\u0003",
  1593. "\u0002\u0002\u0002\u01bb\u01b9\u0003\u0002\u0002\u0002\u01bcp\u0003",
  1594. "\u0002\u0002\u0002\u01bd\u01be\u0007^\u0002\u0002\u01be\u01bf\u0007",
  1595. "w\u0002\u0002\u01bf\u01c0\u0005i5\u0002\u01c0\u01c1\u0005i5\u0002\u01c1",
  1596. "\u01c2\u0005i5\u0002\u01c2\u01c3\u0005i5\u0002\u01c3r\u0003\u0002\u0002",
  1597. "\u0002\u01c4\u01c5\u00071\u0002\u0002\u01c5\u01c6\u00071\u0002\u0002",
  1598. "\u01c6\u01ca\u0003\u0002\u0002\u0002\u01c7\u01c9\n\r\u0002\u0002\u01c8",
  1599. "\u01c7\u0003\u0002\u0002\u0002\u01c9\u01cc\u0003\u0002\u0002\u0002\u01ca",
  1600. "\u01c8\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb",
  1601. "\u01ce\u0003\u0002\u0002\u0002\u01cc\u01ca\u0003\u0002\u0002\u0002\u01cd",
  1602. "\u01cf\u0007\u000f\u0002\u0002\u01ce\u01cd\u0003\u0002\u0002\u0002\u01ce",
  1603. "\u01cf\u0003\u0002\u0002\u0002\u01cf\u01d0\u0003\u0002\u0002\u0002\u01d0",
  1604. "\u01dd\u0007\f\u0002\u0002\u01d1\u01d2\u00071\u0002\u0002\u01d2\u01d3",
  1605. "\u0007,\u0002\u0002\u01d3\u01d7\u0003\u0002\u0002\u0002\u01d4\u01d6",
  1606. "\u000b\u0002\u0002\u0002\u01d5\u01d4\u0003\u0002\u0002\u0002\u01d6\u01d9",
  1607. "\u0003\u0002\u0002\u0002\u01d7\u01d8\u0003\u0002\u0002\u0002\u01d7\u01d5",
  1608. "\u0003\u0002\u0002\u0002\u01d8\u01da\u0003\u0002\u0002\u0002\u01d9\u01d7",
  1609. "\u0003\u0002\u0002\u0002\u01da\u01db\u0007,\u0002\u0002\u01db\u01dd",
  1610. "\u00071\u0002\u0002\u01dc\u01c4\u0003\u0002\u0002\u0002\u01dc\u01d1",
  1611. "\u0003\u0002\u0002\u0002\u01dd\u01de\u0003\u0002\u0002\u0002\u01de\u01df",
  1612. "\b:\u0003\u0002\u01dft\u0003\u0002\u0002\u0002\u001d\u0002\u0131\u013b",
  1613. "\u0147\u014d\u0152\u0158\u015d\u015f\u0164\u016a\u016f\u0175\u0179\u017d",
  1614. "\u0182\u0188\u018f\u0194\u01a1\u01a4\u01ae\u01bb\u01ca\u01ce\u01d7\u01dc",
  1615. "\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1616. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1617. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1618. function ivprog(input) {
  1619. antlr4.Lexer.call(this, input);
  1620. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1621. return this;
  1622. }
  1623. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1624. ivprog.prototype.constructor = ivprog;
  1625. ivprog.EOF = antlr4.Token.EOF;
  1626. ivprog.RK_PROGRAM = 1;
  1627. ivprog.RK_REAL = 2;
  1628. ivprog.RK_VOID = 3;
  1629. ivprog.RK_BOOLEAN = 4;
  1630. ivprog.RK_STRING = 5;
  1631. ivprog.RK_INTEGER = 6;
  1632. ivprog.RK_CHARACTER = 7;
  1633. ivprog.RK_SWITCH = 8;
  1634. ivprog.RK_CASE = 9;
  1635. ivprog.RK_DEFAULT = 10;
  1636. ivprog.RK_CONST = 11;
  1637. ivprog.RK_FUNCTION = 12;
  1638. ivprog.RK_RETURN = 13;
  1639. ivprog.RK_FOR = 14;
  1640. ivprog.RK_BREAK = 15;
  1641. ivprog.RK_DO = 16;
  1642. ivprog.RK_WHILE = 17;
  1643. ivprog.RK_IF = 18;
  1644. ivprog.RK_ELSE = 19;
  1645. ivprog.RK_FALSE = 20;
  1646. ivprog.RK_TRUE = 21;
  1647. ivprog.OPEN_PARENTHESIS = 22;
  1648. ivprog.CLOSE_PARENTHESIS = 23;
  1649. ivprog.OPEN_BRACE = 24;
  1650. ivprog.CLOSE_BRACE = 25;
  1651. ivprog.OPEN_CURLY = 26;
  1652. ivprog.CLOSE_CURLY = 27;
  1653. ivprog.COMMA = 28;
  1654. ivprog.EQUAL = 29;
  1655. ivprog.SUM_OP = 30;
  1656. ivprog.MULTI_OP = 31;
  1657. ivprog.AND_OPERATOR = 32;
  1658. ivprog.OR_OPERATOR = 33;
  1659. ivprog.RELATIONAL_OPERATOR = 34;
  1660. ivprog.COLON = 35;
  1661. ivprog.NOT_OPERATOR = 36;
  1662. ivprog.ID = 37;
  1663. ivprog.NULL_VALUE = 38;
  1664. ivprog.LIB_ID = 39;
  1665. ivprog.INTEGER = 40;
  1666. ivprog.REAL = 41;
  1667. ivprog.STRING = 42;
  1668. ivprog.CHARACTER = 43;
  1669. ivprog.WHITESPACE = 44;
  1670. ivprog.EOS = 45;
  1671. ivprog.COMMENTS = 46;
  1672. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1673. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1674. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1675. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1676. "'escolha'", "'caso'", "'contrario'",
  1677. "'const'", "'funcao'", "'retorne'", "'para'",
  1678. "'pare'", "'faca'", "'enquanto'", "'se'",
  1679. "'senao'", "'falso'", "'verdadeiro'",
  1680. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1681. "','", "'='", null, null, null, null,
  1682. null, "':'", null, null, "'$'" ];
  1683. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1684. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1685. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1686. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1687. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1688. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1689. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1690. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1691. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1692. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1693. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1694. "ID", "NULL_VALUE", "LIB_ID", "INTEGER",
  1695. "REAL", "STRING", "CHARACTER", "WHITESPACE",
  1696. "EOS", "COMMENTS" ];
  1697. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1698. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1699. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1700. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1701. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1702. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1703. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1704. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1705. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1706. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1707. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1708. "ID", "NULL_VALUE", "LIB_ID", "INTEGER",
  1709. "REAL", "ExponentPart", "STRING", "STRING_CHARACTER",
  1710. "CHARACTER", "WHITESPACE", "SEMICOLON", "EOS",
  1711. "HEX_DIGIT", "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL",
  1712. "ESC_UNICODE", "COMMENTS" ];
  1713. ivprog.prototype.grammarFileName = "ivprog.g4";
  1714. exports.ivprog = ivprog;
  1715. /***/ }),
  1716. /* 1 */
  1717. /***/ (function(module, exports, __webpack_require__) {
  1718. module.exports = {
  1719. ivprog: __webpack_require__(0).ivprog
  1720. };
  1721. /***/ }),
  1722. /* 2 */
  1723. /***/ (function(module, exports) {
  1724. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1725. /***/ })
  1726. /******/ ]);
  1727. /***/ }),
  1728. /***/ "./grammar/pt/langFunctions.js":
  1729. /*!*************************************!*\
  1730. !*** ./grammar/pt/langFunctions.js ***!
  1731. \*************************************/
  1732. /*! no static exports found */
  1733. /***/ (function(module, exports, __webpack_require__) {
  1734. "use strict";
  1735. Object.defineProperty(exports, "__esModule", {
  1736. value: true
  1737. });
  1738. /* This is a dictionary of the language defined functions
  1739. **/
  1740. exports.default = {
  1741. main_function: "inicio",
  1742. $read: "leia",
  1743. $write: "escreva",
  1744. $numElements: "numero_elementos",
  1745. $matrixLines: "matriz_linhas",
  1746. $matrixColumns: "matriz_colunas",
  1747. $substring: "subcadeia",
  1748. $length: "comprimento",
  1749. $uppercase: "caixa_alta",
  1750. $lowercase: "caixa_baixa",
  1751. $charAt: "char_at",
  1752. $isReal: "e_real",
  1753. $isInt: "e_inteiro",
  1754. $isBool: "e_logico",
  1755. $castReal: "como_real",
  1756. $castInt: "como_inteiro",
  1757. $castBool: "como_logico",
  1758. $castString: "como_cadeia",
  1759. $sin: "sen",
  1760. $cos: "cos",
  1761. $tan: "tan",
  1762. $sqrt: "raiz_quadrada",
  1763. $pow: "pot",
  1764. $log: "log",
  1765. $abs: "modulo",
  1766. $negate: "trocar_sinal",
  1767. $invert: "inverter_valor",
  1768. $max: "maximo",
  1769. $min: "minimo"
  1770. };
  1771. /***/ }),
  1772. /***/ "./grammar/pt/langLibs.js":
  1773. /*!********************************!*\
  1774. !*** ./grammar/pt/langLibs.js ***!
  1775. \********************************/
  1776. /*! no static exports found */
  1777. /***/ (function(module, exports, __webpack_require__) {
  1778. "use strict";
  1779. Object.defineProperty(exports, "__esModule", {
  1780. value: true
  1781. });
  1782. /**
  1783. * This is the dictionary of the language defined libraries
  1784. */
  1785. exports.default = {
  1786. $mathLib: "Matematica",
  1787. $ioLib: "ES",
  1788. $strLib: "Texto",
  1789. $arrayLib: "Arranjo",
  1790. $langLib: "IV"
  1791. };
  1792. /***/ }),
  1793. /***/ "./i18n/en/error.json":
  1794. /*!****************************!*\
  1795. !*** ./i18n/en/error.json ***!
  1796. \****************************/
  1797. /*! exports provided: default */
  1798. /***/ (function(module) {
  1799. module.exports = {};
  1800. /***/ }),
  1801. /***/ "./i18n/en/index.js":
  1802. /*!**************************!*\
  1803. !*** ./i18n/en/index.js ***!
  1804. \**************************/
  1805. /*! no static exports found */
  1806. /***/ (function(module, exports, __webpack_require__) {
  1807. "use strict";
  1808. Object.defineProperty(exports, "__esModule", {
  1809. value: true
  1810. });
  1811. var _error = __webpack_require__(/*! ./error.json */ "./i18n/en/error.json");
  1812. var _error2 = _interopRequireDefault(_error);
  1813. var _message = __webpack_require__(/*! ./message.json */ "./i18n/en/message.json");
  1814. var _message2 = _interopRequireDefault(_message);
  1815. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/en/ui.json");
  1816. var _ui2 = _interopRequireDefault(_ui);
  1817. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1818. exports.default = {
  1819. 'message': _message2.default,
  1820. 'error': _error2.default,
  1821. 'ui': _ui2.default
  1822. };
  1823. /***/ }),
  1824. /***/ "./i18n/en/message.json":
  1825. /*!******************************!*\
  1826. !*** ./i18n/en/message.json ***!
  1827. \******************************/
  1828. /*! exports provided: default */
  1829. /***/ (function(module) {
  1830. module.exports = {};
  1831. /***/ }),
  1832. /***/ "./i18n/en/ui.json":
  1833. /*!*************************!*\
  1834. !*** ./i18n/en/ui.json ***!
  1835. \*************************/
  1836. /*! exports provided: function, btn_function, start, void, integer, real, program, text, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_comment, default */
  1837. /***/ (function(module) {
  1838. module.exports = {"function":"function","btn_function":"Function","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_comment":"Comment"};
  1839. /***/ }),
  1840. /***/ "./i18n/es/error.json":
  1841. /*!****************************!*\
  1842. !*** ./i18n/es/error.json ***!
  1843. \****************************/
  1844. /*! exports provided: default */
  1845. /***/ (function(module) {
  1846. module.exports = {};
  1847. /***/ }),
  1848. /***/ "./i18n/es/index.js":
  1849. /*!**************************!*\
  1850. !*** ./i18n/es/index.js ***!
  1851. \**************************/
  1852. /*! no static exports found */
  1853. /***/ (function(module, exports, __webpack_require__) {
  1854. "use strict";
  1855. Object.defineProperty(exports, "__esModule", {
  1856. value: true
  1857. });
  1858. var _error = __webpack_require__(/*! ./error.json */ "./i18n/es/error.json");
  1859. var _error2 = _interopRequireDefault(_error);
  1860. var _message = __webpack_require__(/*! ./message.json */ "./i18n/es/message.json");
  1861. var _message2 = _interopRequireDefault(_message);
  1862. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/es/ui.json");
  1863. var _ui2 = _interopRequireDefault(_ui);
  1864. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1865. exports.default = {
  1866. 'message': _message2.default,
  1867. 'error': _error2.default,
  1868. 'ui': _ui2.default
  1869. };
  1870. /***/ }),
  1871. /***/ "./i18n/es/message.json":
  1872. /*!******************************!*\
  1873. !*** ./i18n/es/message.json ***!
  1874. \******************************/
  1875. /*! exports provided: default */
  1876. /***/ (function(module) {
  1877. module.exports = {};
  1878. /***/ }),
  1879. /***/ "./i18n/es/ui.json":
  1880. /*!*************************!*\
  1881. !*** ./i18n/es/ui.json ***!
  1882. \*************************/
  1883. /*! exports provided: function, btn_function, start, void, integer, real, program, text, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_comment, default */
  1884. /***/ (function(module) {
  1885. module.exports = {"function":"function","btn_function":"Function","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_comment":"Comment"};
  1886. /***/ }),
  1887. /***/ "./i18n/index.js":
  1888. /*!***********************!*\
  1889. !*** ./i18n/index.js ***!
  1890. \***********************/
  1891. /*! no static exports found */
  1892. /***/ (function(module, exports, __webpack_require__) {
  1893. "use strict";
  1894. Object.defineProperty(exports, "__esModule", {
  1895. value: true
  1896. });
  1897. var _en = __webpack_require__(/*! ./en */ "./i18n/en/index.js");
  1898. var _en2 = _interopRequireDefault(_en);
  1899. var _pt = __webpack_require__(/*! ./pt */ "./i18n/pt/index.js");
  1900. var _pt2 = _interopRequireDefault(_pt);
  1901. var _es = __webpack_require__(/*! ./es */ "./i18n/es/index.js");
  1902. var _es2 = _interopRequireDefault(_es);
  1903. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1904. exports.default = {
  1905. 'en': _en2.default,
  1906. 'pt': _pt2.default,
  1907. 'es': _es2.default
  1908. };
  1909. /***/ }),
  1910. /***/ "./i18n/pt/error.json":
  1911. /*!****************************!*\
  1912. !*** ./i18n/pt/error.json ***!
  1913. \****************************/
  1914. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, default */
  1915. /***/ (function(module) {
  1916. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição dos laços de repetição deve ser do tipo lógico","loop_condition_type":"A condição dos laços de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição de um comando se...senao deve ser do tipo lógico","if_condition_type":"A condição de um comando se...senao deve ser do tipo lógico","invalid_return_type_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","unexpected_break_command":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1."};
  1917. /***/ }),
  1918. /***/ "./i18n/pt/index.js":
  1919. /*!**************************!*\
  1920. !*** ./i18n/pt/index.js ***!
  1921. \**************************/
  1922. /*! no static exports found */
  1923. /***/ (function(module, exports, __webpack_require__) {
  1924. "use strict";
  1925. Object.defineProperty(exports, "__esModule", {
  1926. value: true
  1927. });
  1928. var _error = __webpack_require__(/*! ./error.json */ "./i18n/pt/error.json");
  1929. var _error2 = _interopRequireDefault(_error);
  1930. var _message = __webpack_require__(/*! ./message.json */ "./i18n/pt/message.json");
  1931. var _message2 = _interopRequireDefault(_message);
  1932. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/pt/ui.json");
  1933. var _ui2 = _interopRequireDefault(_ui);
  1934. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1935. exports.default = {
  1936. 'message': _message2.default,
  1937. 'error': _error2.default,
  1938. 'ui': _ui2.default
  1939. };
  1940. /***/ }),
  1941. /***/ "./i18n/pt/message.json":
  1942. /*!******************************!*\
  1943. !*** ./i18n/pt/message.json ***!
  1944. \******************************/
  1945. /*! exports provided: default */
  1946. /***/ (function(module) {
  1947. module.exports = {};
  1948. /***/ }),
  1949. /***/ "./i18n/pt/ui.json":
  1950. /*!*************************!*\
  1951. !*** ./i18n/pt/ui.json ***!
  1952. \*************************/
  1953. /*! exports provided: function, btn_function, start, void, integer, and, or, not, real, program, text, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_comment, join_or, matrix_string, vector_string, default */
  1954. /***/ (function(module) {
  1955. module.exports = {"function":"funcao","btn_function":"Função","start":"inicio","void":"vazio","integer":"inteiro","and":"E","or":"OU","not":"nao","real":"real","program":"programa","text":"cadeia","boolean":"logico","true":"verdadeiro","false":"fals0","variable":"Variável","command":"Comando","new_parameter":"novo_parametro","new_variable":"nova_variavel","new_global":"nova_global","new_function":"nova_funcao","vector":"vetor","text_comment_start":"Comentário inicial da função...","text_comment_main":"Esta é a função principal...","text_read_var":"Leitura de dados","text_write_var":"Escrita de dados","text_comment":"Comentário","join_or":"ou","matrix_string":"matriz de $0","vector_string":"vetor de $0"};
  1956. /***/ }),
  1957. /***/ "./js/ast/commands/arrayAssign.js":
  1958. /*!****************************************!*\
  1959. !*** ./js/ast/commands/arrayAssign.js ***!
  1960. \****************************************/
  1961. /*! no static exports found */
  1962. /***/ (function(module, exports, __webpack_require__) {
  1963. "use strict";
  1964. Object.defineProperty(exports, "__esModule", {
  1965. value: true
  1966. });
  1967. exports.ArrayIndexAssign = undefined;
  1968. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  1969. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1970. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1971. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1972. var ArrayIndexAssign = exports.ArrayIndexAssign = function (_Assign) {
  1973. _inherits(ArrayIndexAssign, _Assign);
  1974. function ArrayIndexAssign(id, lineExpression, columnExpression, expression) {
  1975. _classCallCheck(this, ArrayIndexAssign);
  1976. var _this = _possibleConstructorReturn(this, (ArrayIndexAssign.__proto__ || Object.getPrototypeOf(ArrayIndexAssign)).call(this, id, expression));
  1977. _this.line = lineExpression;
  1978. _this.column = columnExpression;
  1979. return _this;
  1980. }
  1981. return ArrayIndexAssign;
  1982. }(_assign.Assign);
  1983. /***/ }),
  1984. /***/ "./js/ast/commands/arrayDeclaration.js":
  1985. /*!*********************************************!*\
  1986. !*** ./js/ast/commands/arrayDeclaration.js ***!
  1987. \*********************************************/
  1988. /*! no static exports found */
  1989. /***/ (function(module, exports, __webpack_require__) {
  1990. "use strict";
  1991. Object.defineProperty(exports, "__esModule", {
  1992. value: true
  1993. });
  1994. exports.ArrayDeclaration = undefined;
  1995. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  1996. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1997. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1998. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1999. var ArrayDeclaration = exports.ArrayDeclaration = function (_Declaration) {
  2000. _inherits(ArrayDeclaration, _Declaration);
  2001. function ArrayDeclaration(id, type, lines, columns, initial, isConst) {
  2002. _classCallCheck(this, ArrayDeclaration);
  2003. var _this = _possibleConstructorReturn(this, (ArrayDeclaration.__proto__ || Object.getPrototypeOf(ArrayDeclaration)).call(this, id, type, initial, isConst));
  2004. _this.lines = lines;
  2005. _this.columns = columns;
  2006. return _this;
  2007. }
  2008. return ArrayDeclaration;
  2009. }(_declaration.Declaration);
  2010. /***/ }),
  2011. /***/ "./js/ast/commands/assign.js":
  2012. /*!***********************************!*\
  2013. !*** ./js/ast/commands/assign.js ***!
  2014. \***********************************/
  2015. /*! no static exports found */
  2016. /***/ (function(module, exports, __webpack_require__) {
  2017. "use strict";
  2018. Object.defineProperty(exports, "__esModule", {
  2019. value: true
  2020. });
  2021. exports.Assign = undefined;
  2022. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2023. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2024. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2025. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2026. var Assign = exports.Assign = function (_Command) {
  2027. _inherits(Assign, _Command);
  2028. function Assign(id, expression) {
  2029. _classCallCheck(this, Assign);
  2030. var _this = _possibleConstructorReturn(this, (Assign.__proto__ || Object.getPrototypeOf(Assign)).call(this));
  2031. _this.id = id;
  2032. _this.expression = expression;
  2033. return _this;
  2034. }
  2035. return Assign;
  2036. }(_command.Command);
  2037. /***/ }),
  2038. /***/ "./js/ast/commands/break.js":
  2039. /*!**********************************!*\
  2040. !*** ./js/ast/commands/break.js ***!
  2041. \**********************************/
  2042. /*! no static exports found */
  2043. /***/ (function(module, exports, __webpack_require__) {
  2044. "use strict";
  2045. Object.defineProperty(exports, "__esModule", {
  2046. value: true
  2047. });
  2048. exports.Break = undefined;
  2049. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2050. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2051. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2052. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2053. var Break = exports.Break = function (_Command) {
  2054. _inherits(Break, _Command);
  2055. function Break() {
  2056. _classCallCheck(this, Break);
  2057. return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).call(this));
  2058. }
  2059. return Break;
  2060. }(_command.Command);
  2061. /***/ }),
  2062. /***/ "./js/ast/commands/case.js":
  2063. /*!*********************************!*\
  2064. !*** ./js/ast/commands/case.js ***!
  2065. \*********************************/
  2066. /*! no static exports found */
  2067. /***/ (function(module, exports, __webpack_require__) {
  2068. "use strict";
  2069. Object.defineProperty(exports, "__esModule", {
  2070. value: true
  2071. });
  2072. exports.Case = undefined;
  2073. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2074. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2075. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2076. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2077. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2078. var Case = exports.Case = function (_Command) {
  2079. _inherits(Case, _Command);
  2080. function Case(expression) {
  2081. _classCallCheck(this, Case);
  2082. var _this = _possibleConstructorReturn(this, (Case.__proto__ || Object.getPrototypeOf(Case)).call(this));
  2083. _this.expression = expression;
  2084. _this.commands = [];
  2085. return _this;
  2086. }
  2087. _createClass(Case, [{
  2088. key: 'setCommands',
  2089. value: function setCommands(commands) {
  2090. this.commands = commands;
  2091. }
  2092. }, {
  2093. key: 'isDefault',
  2094. get: function get() {
  2095. return this.expression === null;
  2096. }
  2097. }]);
  2098. return Case;
  2099. }(_command.Command);
  2100. /***/ }),
  2101. /***/ "./js/ast/commands/command.js":
  2102. /*!************************************!*\
  2103. !*** ./js/ast/commands/command.js ***!
  2104. \************************************/
  2105. /*! no static exports found */
  2106. /***/ (function(module, exports, __webpack_require__) {
  2107. "use strict";
  2108. Object.defineProperty(exports, "__esModule", {
  2109. value: true
  2110. });
  2111. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2112. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2113. var Command = exports.Command = function () {
  2114. function Command() {
  2115. _classCallCheck(this, Command);
  2116. this._sourceInfo = null;
  2117. }
  2118. _createClass(Command, [{
  2119. key: "sourceInfo",
  2120. set: function set(sourceInfo) {
  2121. this._sourceInfo = sourceInfo;
  2122. },
  2123. get: function get() {
  2124. return this._sourceInfo;
  2125. }
  2126. }]);
  2127. return Command;
  2128. }();
  2129. /***/ }),
  2130. /***/ "./js/ast/commands/commandBlock.js":
  2131. /*!*****************************************!*\
  2132. !*** ./js/ast/commands/commandBlock.js ***!
  2133. \*****************************************/
  2134. /*! no static exports found */
  2135. /***/ (function(module, exports, __webpack_require__) {
  2136. "use strict";
  2137. Object.defineProperty(exports, "__esModule", {
  2138. value: true
  2139. });
  2140. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2141. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2142. var CommandBlock = exports.CommandBlock = function () {
  2143. function CommandBlock(variables, commands) {
  2144. _classCallCheck(this, CommandBlock);
  2145. this.variables = variables;
  2146. this.commands = commands;
  2147. this._sourceInfo = null;
  2148. }
  2149. _createClass(CommandBlock, [{
  2150. key: "sourceInfo",
  2151. set: function set(sourceInfo) {
  2152. this._sourceInfo = sourceInfo;
  2153. },
  2154. get: function get() {
  2155. return this._sourceInfo;
  2156. }
  2157. }]);
  2158. return CommandBlock;
  2159. }();
  2160. /***/ }),
  2161. /***/ "./js/ast/commands/declaration.js":
  2162. /*!****************************************!*\
  2163. !*** ./js/ast/commands/declaration.js ***!
  2164. \****************************************/
  2165. /*! no static exports found */
  2166. /***/ (function(module, exports, __webpack_require__) {
  2167. "use strict";
  2168. Object.defineProperty(exports, "__esModule", {
  2169. value: true
  2170. });
  2171. exports.Declaration = undefined;
  2172. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2173. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2174. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2175. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2176. var Declaration = exports.Declaration = function (_Command) {
  2177. _inherits(Declaration, _Command);
  2178. function Declaration(id, type, initial, isConst) {
  2179. _classCallCheck(this, Declaration);
  2180. var _this = _possibleConstructorReturn(this, (Declaration.__proto__ || Object.getPrototypeOf(Declaration)).call(this));
  2181. _this.id = id;
  2182. _this.type = type;
  2183. _this.initial = initial;
  2184. _this.isConst = isConst;
  2185. return _this;
  2186. }
  2187. return Declaration;
  2188. }(_command.Command);
  2189. /***/ }),
  2190. /***/ "./js/ast/commands/doWhile.js":
  2191. /*!************************************!*\
  2192. !*** ./js/ast/commands/doWhile.js ***!
  2193. \************************************/
  2194. /*! no static exports found */
  2195. /***/ (function(module, exports, __webpack_require__) {
  2196. "use strict";
  2197. Object.defineProperty(exports, "__esModule", {
  2198. value: true
  2199. });
  2200. exports.DoWhile = undefined;
  2201. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2202. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  2203. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2204. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2205. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2206. var DoWhile = exports.DoWhile = function (_While) {
  2207. _inherits(DoWhile, _While);
  2208. function DoWhile(condition, commandBlock) {
  2209. _classCallCheck(this, DoWhile);
  2210. return _possibleConstructorReturn(this, (DoWhile.__proto__ || Object.getPrototypeOf(DoWhile)).call(this, condition, commandBlock));
  2211. }
  2212. _createClass(DoWhile, [{
  2213. key: 'testFirst',
  2214. get: function get() {
  2215. return false;
  2216. }
  2217. }]);
  2218. return DoWhile;
  2219. }(_while.While);
  2220. /***/ }),
  2221. /***/ "./js/ast/commands/for.js":
  2222. /*!********************************!*\
  2223. !*** ./js/ast/commands/for.js ***!
  2224. \********************************/
  2225. /*! no static exports found */
  2226. /***/ (function(module, exports, __webpack_require__) {
  2227. "use strict";
  2228. Object.defineProperty(exports, "__esModule", {
  2229. value: true
  2230. });
  2231. exports.For = undefined;
  2232. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2233. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2234. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2235. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2236. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2237. var For = exports.For = function (_Command) {
  2238. _inherits(For, _Command);
  2239. function For(assignment, condition, increment, commandBlock) {
  2240. _classCallCheck(this, For);
  2241. var _this = _possibleConstructorReturn(this, (For.__proto__ || Object.getPrototypeOf(For)).call(this));
  2242. _this.assignment = assignment;
  2243. _this.condition = condition;
  2244. _this.increment = increment;
  2245. _this.commandBlock = commandBlock;
  2246. return _this;
  2247. }
  2248. _createClass(For, [{
  2249. key: 'commands',
  2250. get: function get() {
  2251. return this.commandBlock.commands;
  2252. }
  2253. }]);
  2254. return For;
  2255. }(_command.Command);
  2256. /***/ }),
  2257. /***/ "./js/ast/commands/formalParameter.js":
  2258. /*!********************************************!*\
  2259. !*** ./js/ast/commands/formalParameter.js ***!
  2260. \********************************************/
  2261. /*! no static exports found */
  2262. /***/ (function(module, exports, __webpack_require__) {
  2263. "use strict";
  2264. Object.defineProperty(exports, "__esModule", {
  2265. value: true
  2266. });
  2267. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2268. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2269. var FormalParameter = exports.FormalParameter = function () {
  2270. function FormalParameter(type, id) {
  2271. var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  2272. _classCallCheck(this, FormalParameter);
  2273. this.type = type;
  2274. this.id = id;
  2275. this.byRef = byRef;
  2276. this._sourceInfo = null;
  2277. }
  2278. _createClass(FormalParameter, [{
  2279. key: "sourceInfo",
  2280. set: function set(sourceInfo) {
  2281. this._sourceInfo = sourceInfo;
  2282. },
  2283. get: function get() {
  2284. return this._sourceInfo;
  2285. }
  2286. }]);
  2287. return FormalParameter;
  2288. }();
  2289. /***/ }),
  2290. /***/ "./js/ast/commands/function.js":
  2291. /*!*************************************!*\
  2292. !*** ./js/ast/commands/function.js ***!
  2293. \*************************************/
  2294. /*! no static exports found */
  2295. /***/ (function(module, exports, __webpack_require__) {
  2296. "use strict";
  2297. Object.defineProperty(exports, "__esModule", {
  2298. value: true
  2299. });
  2300. exports.Function = undefined;
  2301. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2302. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  2303. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2304. var Function = exports.Function = function () {
  2305. function Function(name, returnType, formalParameters, commandBlock) {
  2306. _classCallCheck(this, Function);
  2307. this.name = name;
  2308. this.returnType = returnType;
  2309. this.formalParameters = formalParameters;
  2310. this.commandBlock = commandBlock;
  2311. this._sourceInfo = null;
  2312. }
  2313. _createClass(Function, [{
  2314. key: 'isMain',
  2315. get: function get() {
  2316. return this.name === null && this.returnType.isCompatible(_types.Types.VOID);
  2317. }
  2318. }, {
  2319. key: 'commands',
  2320. get: function get() {
  2321. return this.commandBlock.commands;
  2322. }
  2323. }, {
  2324. key: 'variablesDeclarations',
  2325. get: function get() {
  2326. return this.commandBlock.variables;
  2327. }
  2328. }, {
  2329. key: 'sourceInfo',
  2330. set: function set(sourceInfo) {
  2331. this._sourceInfo = sourceInfo;
  2332. },
  2333. get: function get() {
  2334. return this._sourceInfo;
  2335. }
  2336. }]);
  2337. return Function;
  2338. }();
  2339. /***/ }),
  2340. /***/ "./js/ast/commands/ifThenElse.js":
  2341. /*!***************************************!*\
  2342. !*** ./js/ast/commands/ifThenElse.js ***!
  2343. \***************************************/
  2344. /*! no static exports found */
  2345. /***/ (function(module, exports, __webpack_require__) {
  2346. "use strict";
  2347. Object.defineProperty(exports, "__esModule", {
  2348. value: true
  2349. });
  2350. exports.IfThenElse = undefined;
  2351. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2352. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2353. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2354. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2355. var IfThenElse = exports.IfThenElse = function (_Command) {
  2356. _inherits(IfThenElse, _Command);
  2357. function IfThenElse(condition, ifTrue, ifFalse) {
  2358. _classCallCheck(this, IfThenElse);
  2359. var _this = _possibleConstructorReturn(this, (IfThenElse.__proto__ || Object.getPrototypeOf(IfThenElse)).call(this));
  2360. _this.condition = condition;
  2361. _this.ifTrue = ifTrue;
  2362. _this.ifFalse = ifFalse;
  2363. return _this;
  2364. }
  2365. return IfThenElse;
  2366. }(_command.Command);
  2367. /***/ }),
  2368. /***/ "./js/ast/commands/index.js":
  2369. /*!**********************************!*\
  2370. !*** ./js/ast/commands/index.js ***!
  2371. \**********************************/
  2372. /*! no static exports found */
  2373. /***/ (function(module, exports, __webpack_require__) {
  2374. "use strict";
  2375. Object.defineProperty(exports, "__esModule", {
  2376. value: true
  2377. });
  2378. exports.FunctionCall = exports.FormalParameter = exports.SysCall = exports.Case = exports.Switch = exports.DoWhile = exports.CommandBlock = exports.IfThenElse = exports.Function = exports.For = exports.While = exports.ArrayDeclaration = exports.Declaration = exports.ArrayIndexAssign = exports.Assign = exports.Return = exports.Break = undefined;
  2379. var _break = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js");
  2380. var _return = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js");
  2381. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  2382. var _arrayAssign = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js");
  2383. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  2384. var _arrayDeclaration = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js");
  2385. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  2386. var _for = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js");
  2387. var _function = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js");
  2388. var _ifThenElse = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js");
  2389. var _commandBlock = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js");
  2390. var _doWhile = __webpack_require__(/*! ./doWhile */ "./js/ast/commands/doWhile.js");
  2391. var _switch = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js");
  2392. var _case = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js");
  2393. var _sysCall = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js");
  2394. var _formalParameter = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js");
  2395. var _functionCall = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js");
  2396. //Proxy to expression since they do exatcly the same thing
  2397. exports.Break = _break.Break;
  2398. exports.Return = _return.Return;
  2399. exports.Assign = _assign.Assign;
  2400. exports.ArrayIndexAssign = _arrayAssign.ArrayIndexAssign;
  2401. exports.Declaration = _declaration.Declaration;
  2402. exports.ArrayDeclaration = _arrayDeclaration.ArrayDeclaration;
  2403. exports.While = _while.While;
  2404. exports.For = _for.For;
  2405. exports.Function = _function.Function;
  2406. exports.IfThenElse = _ifThenElse.IfThenElse;
  2407. exports.CommandBlock = _commandBlock.CommandBlock;
  2408. exports.DoWhile = _doWhile.DoWhile;
  2409. exports.Switch = _switch.Switch;
  2410. exports.Case = _case.Case;
  2411. exports.SysCall = _sysCall.SysCall;
  2412. exports.FormalParameter = _formalParameter.FormalParameter;
  2413. exports.FunctionCall = _functionCall.FunctionCall;
  2414. /***/ }),
  2415. /***/ "./js/ast/commands/return.js":
  2416. /*!***********************************!*\
  2417. !*** ./js/ast/commands/return.js ***!
  2418. \***********************************/
  2419. /*! no static exports found */
  2420. /***/ (function(module, exports, __webpack_require__) {
  2421. "use strict";
  2422. Object.defineProperty(exports, "__esModule", {
  2423. value: true
  2424. });
  2425. exports.Return = undefined;
  2426. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2427. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2428. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2429. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2430. var Return = exports.Return = function (_Command) {
  2431. _inherits(Return, _Command);
  2432. function Return(expression) {
  2433. _classCallCheck(this, Return);
  2434. var _this = _possibleConstructorReturn(this, (Return.__proto__ || Object.getPrototypeOf(Return)).call(this));
  2435. _this.expression = expression;
  2436. return _this;
  2437. }
  2438. return Return;
  2439. }(_command.Command);
  2440. /***/ }),
  2441. /***/ "./js/ast/commands/switch.js":
  2442. /*!***********************************!*\
  2443. !*** ./js/ast/commands/switch.js ***!
  2444. \***********************************/
  2445. /*! no static exports found */
  2446. /***/ (function(module, exports, __webpack_require__) {
  2447. "use strict";
  2448. Object.defineProperty(exports, "__esModule", {
  2449. value: true
  2450. });
  2451. exports.Switch = undefined;
  2452. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2453. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2454. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2455. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2456. var Switch = exports.Switch = function (_Command) {
  2457. _inherits(Switch, _Command);
  2458. function Switch(expression, cases) {
  2459. _classCallCheck(this, Switch);
  2460. var _this = _possibleConstructorReturn(this, (Switch.__proto__ || Object.getPrototypeOf(Switch)).call(this));
  2461. _this.expression = expression;
  2462. _this.cases = cases;
  2463. return _this;
  2464. }
  2465. return Switch;
  2466. }(_command.Command);
  2467. /***/ }),
  2468. /***/ "./js/ast/commands/sysCall.js":
  2469. /*!************************************!*\
  2470. !*** ./js/ast/commands/sysCall.js ***!
  2471. \************************************/
  2472. /*! no static exports found */
  2473. /***/ (function(module, exports, __webpack_require__) {
  2474. "use strict";
  2475. Object.defineProperty(exports, "__esModule", {
  2476. value: true
  2477. });
  2478. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2479. /**
  2480. * This class represents all the language defined functions.
  2481. * The language processor uses the id provided here to properly execute the desired function.
  2482. * The function is actually implemented inside the language processor.
  2483. * All the functions can be found at: js/processor/definedFunctions.js
  2484. */
  2485. var SysCall = exports.SysCall = function SysCall(langFunc) {
  2486. _classCallCheck(this, SysCall);
  2487. this.langFunc = langFunc;
  2488. };
  2489. /***/ }),
  2490. /***/ "./js/ast/commands/while.js":
  2491. /*!**********************************!*\
  2492. !*** ./js/ast/commands/while.js ***!
  2493. \**********************************/
  2494. /*! no static exports found */
  2495. /***/ (function(module, exports, __webpack_require__) {
  2496. "use strict";
  2497. Object.defineProperty(exports, "__esModule", {
  2498. value: true
  2499. });
  2500. exports.While = undefined;
  2501. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2502. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2503. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2504. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2505. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2506. var While = exports.While = function (_Command) {
  2507. _inherits(While, _Command);
  2508. function While(expression, commandBlock) {
  2509. _classCallCheck(this, While);
  2510. var _this = _possibleConstructorReturn(this, (While.__proto__ || Object.getPrototypeOf(While)).call(this));
  2511. _this.expression = expression;
  2512. _this.commandBlock = commandBlock;
  2513. return _this;
  2514. }
  2515. _createClass(While, [{
  2516. key: 'commands',
  2517. get: function get() {
  2518. return this.commandBlock.commands;
  2519. }
  2520. }, {
  2521. key: 'testFirst',
  2522. get: function get() {
  2523. return true;
  2524. }
  2525. }]);
  2526. return While;
  2527. }(_command.Command);
  2528. /***/ }),
  2529. /***/ "./js/ast/error/syntaxError.js":
  2530. /*!*************************************!*\
  2531. !*** ./js/ast/error/syntaxError.js ***!
  2532. \*************************************/
  2533. /*! no static exports found */
  2534. /***/ (function(module, exports, __webpack_require__) {
  2535. "use strict";
  2536. Object.defineProperty(exports, "__esModule", {
  2537. value: true
  2538. });
  2539. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2540. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2541. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2542. var SyntaxError = exports.SyntaxError = function (_Error) {
  2543. _inherits(SyntaxError, _Error);
  2544. function SyntaxError() {
  2545. var _ref;
  2546. _classCallCheck(this, SyntaxError);
  2547. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  2548. msg[_key] = arguments[_key];
  2549. }
  2550. var _this = _possibleConstructorReturn(this, (_ref = SyntaxError.__proto__ || Object.getPrototypeOf(SyntaxError)).call.apply(_ref, [this].concat(msg)));
  2551. if (Error.captureStackTrace) Error.captureStackTrace(_this, SyntaxError);
  2552. return _this;
  2553. }
  2554. return SyntaxError;
  2555. }(Error);
  2556. /***/ }),
  2557. /***/ "./js/ast/error/syntaxErrorFactory.js":
  2558. /*!********************************************!*\
  2559. !*** ./js/ast/error/syntaxErrorFactory.js ***!
  2560. \********************************************/
  2561. /*! no static exports found */
  2562. /***/ (function(module, exports, __webpack_require__) {
  2563. "use strict";
  2564. Object.defineProperty(exports, "__esModule", {
  2565. value: true
  2566. });
  2567. exports.SyntaxErrorFactory = undefined;
  2568. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  2569. var _syntaxError = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js");
  2570. var SyntaxErrorFactory = exports.SyntaxErrorFactory = Object.freeze({
  2571. extra_lines: function extra_lines() {
  2572. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("extra_lines"));
  2573. },
  2574. token_missing_one: function token_missing_one(expected, token) {
  2575. var context = [expected, token.text, token.line, token.column];
  2576. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("token_missing_one", context));
  2577. },
  2578. token_missing_list: function token_missing_list(expectedList, token) {
  2579. var line = expectedList.join(_localizedStringsService.LocalizedStrings.getOR());
  2580. return SyntaxErrorFactory.token_missing_one(line, token);
  2581. },
  2582. id_missing: function id_missing(token) {
  2583. var context = [token.text, token.line, token.column];
  2584. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("id_missing", context));
  2585. },
  2586. eos_missing: function eos_missing(token) {
  2587. var context = [token.line, token.column];
  2588. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("eos_missing", context));
  2589. },
  2590. invalid_array_dimension: function invalid_array_dimension(typeName, token) {
  2591. var context = [token.line, token.column, typeName];
  2592. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_dimension", context));
  2593. },
  2594. invalid_array_size: function invalid_array_size(token) {
  2595. var context = [token.line];
  2596. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_size", context));
  2597. },
  2598. invalid_main_return: function invalid_main_return(name, typeName, token) {
  2599. var context = [name, typeName, token.line];
  2600. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_main_return", context));
  2601. },
  2602. invalid_var_declaration: function invalid_var_declaration(token) {
  2603. var context = [token.line];
  2604. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_var_declaration", context));
  2605. },
  2606. invalid_break_command: function invalid_break_command(cmdName, token) {
  2607. var context = [token.line, cmdName];
  2608. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_break_command", context));
  2609. },
  2610. invalid_terminal: function invalid_terminal(token) {
  2611. var context = [token.text, token.line, token.column];
  2612. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError('invalid_terminal', context));
  2613. },
  2614. invalid_type: function invalid_type(list, token) {
  2615. var line = list.join(_localizedStringsService.LocalizedStrings.getOR());
  2616. var context = [token.text, token.line, token.column, line];
  2617. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_type", context));
  2618. },
  2619. const_not_init: function const_not_init(token) {
  2620. var context = [token.line, token.column];
  2621. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("const_not_init", context));
  2622. },
  2623. invalid_id_format: function invalid_id_format(token) {
  2624. var context = [token.text, token.line, token.column];
  2625. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_id_format", context));
  2626. },
  2627. duplicate_function: function duplicate_function(token) {
  2628. var context = [token.text, token.line, token.column];
  2629. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_function", context));
  2630. },
  2631. main_parameters: function main_parameters() {
  2632. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("main_parameters"));
  2633. },
  2634. duplicate_variable: function duplicate_variable(token) {
  2635. var context = [token.text, token.line, token.column];
  2636. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_variable", context));
  2637. }
  2638. });
  2639. /***/ }),
  2640. /***/ "./js/ast/expressions/arrayAccess.js":
  2641. /*!*******************************************!*\
  2642. !*** ./js/ast/expressions/arrayAccess.js ***!
  2643. \*******************************************/
  2644. /*! no static exports found */
  2645. /***/ (function(module, exports, __webpack_require__) {
  2646. "use strict";
  2647. Object.defineProperty(exports, "__esModule", {
  2648. value: true
  2649. });
  2650. exports.ArrayAccess = undefined;
  2651. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2652. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  2653. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2654. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2655. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2656. var ArrayAccess = exports.ArrayAccess = function (_Expression) {
  2657. _inherits(ArrayAccess, _Expression);
  2658. function ArrayAccess(id, line, column) {
  2659. _classCallCheck(this, ArrayAccess);
  2660. var _this = _possibleConstructorReturn(this, (ArrayAccess.__proto__ || Object.getPrototypeOf(ArrayAccess)).call(this));
  2661. _this.id = id;
  2662. _this.line = line;
  2663. _this.column = column;
  2664. return _this;
  2665. }
  2666. _createClass(ArrayAccess, [{
  2667. key: 'toString',
  2668. value: function toString() {
  2669. var strLine = this.line.toString();
  2670. var strColumn = null;
  2671. if (this.column) {
  2672. strColumn = this.column.toString();
  2673. }
  2674. if (strColumn) {
  2675. return this.id + '[' + strLine + '][' + strColumn + ']';
  2676. } else {
  2677. return this.id + '[' + strLine + ']';
  2678. }
  2679. }
  2680. }]);
  2681. return ArrayAccess;
  2682. }(_expression.Expression);
  2683. /***/ }),
  2684. /***/ "./js/ast/expressions/arrayLiteral.js":
  2685. /*!********************************************!*\
  2686. !*** ./js/ast/expressions/arrayLiteral.js ***!
  2687. \********************************************/
  2688. /*! no static exports found */
  2689. /***/ (function(module, exports, __webpack_require__) {
  2690. "use strict";
  2691. Object.defineProperty(exports, "__esModule", {
  2692. value: true
  2693. });
  2694. exports.ArrayLiteral = undefined;
  2695. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2696. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  2697. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2698. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2699. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2700. var ArrayLiteral = exports.ArrayLiteral = function (_Literal) {
  2701. _inherits(ArrayLiteral, _Literal);
  2702. function ArrayLiteral(type, value) {
  2703. _classCallCheck(this, ArrayLiteral);
  2704. var _this = _possibleConstructorReturn(this, (ArrayLiteral.__proto__ || Object.getPrototypeOf(ArrayLiteral)).call(this, type));
  2705. _this.value = value;
  2706. return _this;
  2707. }
  2708. _createClass(ArrayLiteral, [{
  2709. key: 'validateType',
  2710. value: function validateType() {
  2711. // let valid = true;
  2712. // if(this.columns !== null) {
  2713. // const len = this.columns;
  2714. // const len2 = this.lines;
  2715. // for (let i = len - 1; i >= 0; i--) {
  2716. // for (let j = len2 - 1; j >= 0; j--) {
  2717. // if(this.value[i].value[j].type !== this.subtype) {
  2718. // valid = false;
  2719. // break;
  2720. // }
  2721. // }
  2722. // }
  2723. // } else {
  2724. // const len = this.lines;
  2725. // for (var i = len - 1; i >= 0; i--) {
  2726. // if(this.value[i].type !== this.subtype) {
  2727. // valid = false;
  2728. // break;
  2729. // }
  2730. // }
  2731. // }
  2732. return true; //valid;
  2733. }
  2734. }, {
  2735. key: 'validateSize',
  2736. value: function validateSize() {
  2737. var valid = true;
  2738. if (this.columns !== null) {
  2739. var equalityTest = data.value.map(function (v) {
  2740. return v.length;
  2741. }).reduce(function (old, next) {
  2742. if (old === null) {
  2743. return next;
  2744. } else if (old === next) {
  2745. return old;
  2746. } else {
  2747. return -1;
  2748. }
  2749. }, null);
  2750. valid = equalityTest !== -1;
  2751. }
  2752. return valid;
  2753. }
  2754. }, {
  2755. key: 'toString',
  2756. value: function toString() {
  2757. var strList = this.value.map(function (arrayLiteral) {
  2758. return arrayLiteral.toString();
  2759. });
  2760. return "{" + strList.join(',') + "}";
  2761. }
  2762. }, {
  2763. key: 'subtype',
  2764. get: function get() {
  2765. var element = this.value[0];
  2766. if (element instanceof ArrayLiteral) {
  2767. return element.value[0].type;
  2768. } else {
  2769. return element.type;
  2770. }
  2771. }
  2772. }, {
  2773. key: 'lines',
  2774. get: function get() {
  2775. return this.value.length;
  2776. }
  2777. }, {
  2778. key: 'columns',
  2779. get: function get() {
  2780. var element = this.value[0];
  2781. if (!(element instanceof ArrayLiteral)) {
  2782. return null;
  2783. } else {
  2784. return element.value[0].value.length;
  2785. }
  2786. }
  2787. }, {
  2788. key: 'isVector',
  2789. get: function get() {
  2790. return this.columns === null;
  2791. }
  2792. }, {
  2793. key: 'isValid',
  2794. get: function get() {
  2795. return true; //this.validateType() && this.validateSize();
  2796. }
  2797. }]);
  2798. return ArrayLiteral;
  2799. }(_literal.Literal);
  2800. /***/ }),
  2801. /***/ "./js/ast/expressions/boolLiteral.js":
  2802. /*!*******************************************!*\
  2803. !*** ./js/ast/expressions/boolLiteral.js ***!
  2804. \*******************************************/
  2805. /*! no static exports found */
  2806. /***/ (function(module, exports, __webpack_require__) {
  2807. "use strict";
  2808. Object.defineProperty(exports, "__esModule", {
  2809. value: true
  2810. });
  2811. exports.BoolLiteral = undefined;
  2812. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2813. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  2814. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  2815. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  2816. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2817. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2818. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2819. var BoolLiteral = exports.BoolLiteral = function (_Literal) {
  2820. _inherits(BoolLiteral, _Literal);
  2821. function BoolLiteral(value) {
  2822. _classCallCheck(this, BoolLiteral);
  2823. var _this = _possibleConstructorReturn(this, (BoolLiteral.__proto__ || Object.getPrototypeOf(BoolLiteral)).call(this, _types.Types.BOOLEAN));
  2824. _this.value = value;
  2825. return _this;
  2826. }
  2827. _createClass(BoolLiteral, [{
  2828. key: 'toString',
  2829. value: function toString() {
  2830. return (0, _parsers.convertBoolToString)(this.value);
  2831. }
  2832. }]);
  2833. return BoolLiteral;
  2834. }(_literal.Literal);
  2835. /***/ }),
  2836. /***/ "./js/ast/expressions/expression.js":
  2837. /*!******************************************!*\
  2838. !*** ./js/ast/expressions/expression.js ***!
  2839. \******************************************/
  2840. /*! no static exports found */
  2841. /***/ (function(module, exports, __webpack_require__) {
  2842. "use strict";
  2843. Object.defineProperty(exports, "__esModule", {
  2844. value: true
  2845. });
  2846. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2847. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2848. var Expression = exports.Expression = function () {
  2849. function Expression() {
  2850. _classCallCheck(this, Expression);
  2851. this._sourceInfo = null;
  2852. }
  2853. _createClass(Expression, [{
  2854. key: "sourceInfo",
  2855. set: function set(sourceInfo) {
  2856. this._sourceInfo = sourceInfo;
  2857. },
  2858. get: function get() {
  2859. return this._sourceInfo;
  2860. }
  2861. }]);
  2862. return Expression;
  2863. }();
  2864. /***/ }),
  2865. /***/ "./js/ast/expressions/functionCall.js":
  2866. /*!********************************************!*\
  2867. !*** ./js/ast/expressions/functionCall.js ***!
  2868. \********************************************/
  2869. /*! no static exports found */
  2870. /***/ (function(module, exports, __webpack_require__) {
  2871. "use strict";
  2872. Object.defineProperty(exports, "__esModule", {
  2873. value: true
  2874. });
  2875. exports.FunctionCall = undefined;
  2876. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2877. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  2878. var _definedFunctions = __webpack_require__(/*! ../../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  2879. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2880. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2881. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2882. var FunctionCall = exports.FunctionCall = function (_Expression) {
  2883. _inherits(FunctionCall, _Expression);
  2884. function FunctionCall(id, actualParameters) {
  2885. _classCallCheck(this, FunctionCall);
  2886. var _this = _possibleConstructorReturn(this, (FunctionCall.__proto__ || Object.getPrototypeOf(FunctionCall)).call(this));
  2887. _this.id = id;
  2888. _this.actualParameters = actualParameters;
  2889. return _this;
  2890. }
  2891. _createClass(FunctionCall, [{
  2892. key: 'toString',
  2893. value: function toString() {
  2894. var name = null;
  2895. if (this.isMainCall) {
  2896. name = _definedFunctions.LanguageDefinedFunction.getMainFunctionName();
  2897. } else {
  2898. name = _definedFunctions.LanguageDefinedFunction.getLocalName(this.id);
  2899. }
  2900. var params = null;
  2901. if (this.actualParameters.length == 0) {
  2902. params = "()";
  2903. } else {
  2904. var strParams = this.actualParameters.map(function (v) {
  2905. return v.toString();
  2906. });
  2907. params = "(" + strParams.join(",") + ")";
  2908. }
  2909. return name + params;
  2910. }
  2911. }, {
  2912. key: 'isMainCall',
  2913. get: function get() {
  2914. return this.id === null;
  2915. }
  2916. }, {
  2917. key: 'parametersSize',
  2918. get: function get() {
  2919. return this.actualParameters.length;
  2920. }
  2921. }]);
  2922. return FunctionCall;
  2923. }(_expression.Expression);
  2924. /***/ }),
  2925. /***/ "./js/ast/expressions/index.js":
  2926. /*!*************************************!*\
  2927. !*** ./js/ast/expressions/index.js ***!
  2928. \*************************************/
  2929. /*! no static exports found */
  2930. /***/ (function(module, exports, __webpack_require__) {
  2931. "use strict";
  2932. Object.defineProperty(exports, "__esModule", {
  2933. value: true
  2934. });
  2935. exports.UnaryApp = exports.InfixApp = exports.VariableLiteral = exports.ArrayLiteral = exports.StringLiteral = exports.BoolLiteral = exports.RealLiteral = exports.IntLiteral = exports.FunctionCall = exports.ArrayAccess = undefined;
  2936. var _arrayAccess = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js");
  2937. var _functionCall = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js");
  2938. var _intLiteral = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js");
  2939. var _realLiteral = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js");
  2940. var _boolLiteral = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js");
  2941. var _stringLiteral = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js");
  2942. var _arrayLiteral = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js");
  2943. var _variableLiteral = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js");
  2944. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  2945. var _unaryApp = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js");
  2946. exports.ArrayAccess = _arrayAccess.ArrayAccess;
  2947. exports.FunctionCall = _functionCall.FunctionCall;
  2948. exports.IntLiteral = _intLiteral.IntLiteral;
  2949. exports.RealLiteral = _realLiteral.RealLiteral;
  2950. exports.BoolLiteral = _boolLiteral.BoolLiteral;
  2951. exports.StringLiteral = _stringLiteral.StringLiteral;
  2952. exports.ArrayLiteral = _arrayLiteral.ArrayLiteral;
  2953. exports.VariableLiteral = _variableLiteral.VariableLiteral;
  2954. exports.InfixApp = _infixApp.InfixApp;
  2955. exports.UnaryApp = _unaryApp.UnaryApp;
  2956. /***/ }),
  2957. /***/ "./js/ast/expressions/infixApp.js":
  2958. /*!****************************************!*\
  2959. !*** ./js/ast/expressions/infixApp.js ***!
  2960. \****************************************/
  2961. /*! no static exports found */
  2962. /***/ (function(module, exports, __webpack_require__) {
  2963. "use strict";
  2964. Object.defineProperty(exports, "__esModule", {
  2965. value: true
  2966. });
  2967. exports.InfixApp = undefined;
  2968. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2969. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  2970. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2971. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2972. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2973. var InfixApp = exports.InfixApp = function (_Expression) {
  2974. _inherits(InfixApp, _Expression);
  2975. function InfixApp(op, left, right) {
  2976. _classCallCheck(this, InfixApp);
  2977. var _this = _possibleConstructorReturn(this, (InfixApp.__proto__ || Object.getPrototypeOf(InfixApp)).call(this));
  2978. _this.op = op;
  2979. _this.left = left;
  2980. _this.right = right;
  2981. return _this;
  2982. }
  2983. _createClass(InfixApp, [{
  2984. key: 'toString',
  2985. value: function toString() {
  2986. var l = this.left.toString();
  2987. var op = this.op.value;
  2988. var r = this.right.toString();
  2989. return l + op + r;
  2990. }
  2991. }]);
  2992. return InfixApp;
  2993. }(_expression.Expression);
  2994. /***/ }),
  2995. /***/ "./js/ast/expressions/intLiteral.js":
  2996. /*!******************************************!*\
  2997. !*** ./js/ast/expressions/intLiteral.js ***!
  2998. \******************************************/
  2999. /*! no static exports found */
  3000. /***/ (function(module, exports, __webpack_require__) {
  3001. "use strict";
  3002. Object.defineProperty(exports, "__esModule", {
  3003. value: true
  3004. });
  3005. exports.IntLiteral = undefined;
  3006. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3007. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3008. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3009. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  3010. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3011. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3012. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3013. var IntLiteral = exports.IntLiteral = function (_Literal) {
  3014. _inherits(IntLiteral, _Literal);
  3015. function IntLiteral(value) {
  3016. _classCallCheck(this, IntLiteral);
  3017. var _this = _possibleConstructorReturn(this, (IntLiteral.__proto__ || Object.getPrototypeOf(IntLiteral)).call(this, _types.Types.INTEGER));
  3018. _this.value = value;
  3019. return _this;
  3020. }
  3021. _createClass(IntLiteral, [{
  3022. key: 'toString',
  3023. value: function toString() {
  3024. return (0, _parsers.convertToString)(this.value, this.type);
  3025. }
  3026. }]);
  3027. return IntLiteral;
  3028. }(_literal.Literal);
  3029. /***/ }),
  3030. /***/ "./js/ast/expressions/literal.js":
  3031. /*!***************************************!*\
  3032. !*** ./js/ast/expressions/literal.js ***!
  3033. \***************************************/
  3034. /*! no static exports found */
  3035. /***/ (function(module, exports, __webpack_require__) {
  3036. "use strict";
  3037. Object.defineProperty(exports, "__esModule", {
  3038. value: true
  3039. });
  3040. exports.Literal = undefined;
  3041. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  3042. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3043. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3044. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3045. var Literal = exports.Literal = function (_Expression) {
  3046. _inherits(Literal, _Expression);
  3047. function Literal(type) {
  3048. _classCallCheck(this, Literal);
  3049. var _this = _possibleConstructorReturn(this, (Literal.__proto__ || Object.getPrototypeOf(Literal)).call(this));
  3050. _this.type = type;
  3051. return _this;
  3052. }
  3053. return Literal;
  3054. }(_expression.Expression);
  3055. /***/ }),
  3056. /***/ "./js/ast/expressions/realLiteral.js":
  3057. /*!*******************************************!*\
  3058. !*** ./js/ast/expressions/realLiteral.js ***!
  3059. \*******************************************/
  3060. /*! no static exports found */
  3061. /***/ (function(module, exports, __webpack_require__) {
  3062. "use strict";
  3063. Object.defineProperty(exports, "__esModule", {
  3064. value: true
  3065. });
  3066. exports.RealLiteral = undefined;
  3067. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3068. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3069. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3070. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  3071. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3072. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3073. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3074. var RealLiteral = exports.RealLiteral = function (_Literal) {
  3075. _inherits(RealLiteral, _Literal);
  3076. function RealLiteral(value) {
  3077. _classCallCheck(this, RealLiteral);
  3078. var _this = _possibleConstructorReturn(this, (RealLiteral.__proto__ || Object.getPrototypeOf(RealLiteral)).call(this, _types.Types.REAL));
  3079. _this.value = value;
  3080. return _this;
  3081. }
  3082. _createClass(RealLiteral, [{
  3083. key: 'toString',
  3084. value: function toString() {
  3085. return (0, _parsers.convertToString)(this.value, this.type);
  3086. }
  3087. }]);
  3088. return RealLiteral;
  3089. }(_literal.Literal);
  3090. /***/ }),
  3091. /***/ "./js/ast/expressions/stringLiteral.js":
  3092. /*!*********************************************!*\
  3093. !*** ./js/ast/expressions/stringLiteral.js ***!
  3094. \*********************************************/
  3095. /*! no static exports found */
  3096. /***/ (function(module, exports, __webpack_require__) {
  3097. "use strict";
  3098. Object.defineProperty(exports, "__esModule", {
  3099. value: true
  3100. });
  3101. exports.StringLiteral = undefined;
  3102. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3103. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3104. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3105. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3106. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3107. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3108. var StringLiteral = exports.StringLiteral = function (_Literal) {
  3109. _inherits(StringLiteral, _Literal);
  3110. function StringLiteral(value) {
  3111. _classCallCheck(this, StringLiteral);
  3112. var _this = _possibleConstructorReturn(this, (StringLiteral.__proto__ || Object.getPrototypeOf(StringLiteral)).call(this, _types.Types.STRING));
  3113. _this.value = value;
  3114. return _this;
  3115. }
  3116. _createClass(StringLiteral, [{
  3117. key: 'toString',
  3118. value: function toString() {
  3119. return this.value;
  3120. }
  3121. }]);
  3122. return StringLiteral;
  3123. }(_literal.Literal);
  3124. /***/ }),
  3125. /***/ "./js/ast/expressions/unaryApp.js":
  3126. /*!****************************************!*\
  3127. !*** ./js/ast/expressions/unaryApp.js ***!
  3128. \****************************************/
  3129. /*! no static exports found */
  3130. /***/ (function(module, exports, __webpack_require__) {
  3131. "use strict";
  3132. Object.defineProperty(exports, "__esModule", {
  3133. value: true
  3134. });
  3135. exports.UnaryApp = undefined;
  3136. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3137. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  3138. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3139. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3140. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3141. var UnaryApp = exports.UnaryApp = function (_InfixApp) {
  3142. _inherits(UnaryApp, _InfixApp);
  3143. function UnaryApp(op, left) {
  3144. _classCallCheck(this, UnaryApp);
  3145. return _possibleConstructorReturn(this, (UnaryApp.__proto__ || Object.getPrototypeOf(UnaryApp)).call(this, op, left, null));
  3146. }
  3147. _createClass(UnaryApp, [{
  3148. key: 'toString',
  3149. value: function toString() {
  3150. var l = this.left.toString();
  3151. var op = this.op.value;
  3152. return op + l;
  3153. }
  3154. }]);
  3155. return UnaryApp;
  3156. }(_infixApp.InfixApp);
  3157. /***/ }),
  3158. /***/ "./js/ast/expressions/variableLiteral.js":
  3159. /*!***********************************************!*\
  3160. !*** ./js/ast/expressions/variableLiteral.js ***!
  3161. \***********************************************/
  3162. /*! no static exports found */
  3163. /***/ (function(module, exports, __webpack_require__) {
  3164. "use strict";
  3165. Object.defineProperty(exports, "__esModule", {
  3166. value: true
  3167. });
  3168. exports.VariableLiteral = undefined;
  3169. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3170. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3171. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3172. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3173. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3174. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3175. var VariableLiteral = exports.VariableLiteral = function (_Literal) {
  3176. _inherits(VariableLiteral, _Literal);
  3177. function VariableLiteral(id) {
  3178. _classCallCheck(this, VariableLiteral);
  3179. var _this = _possibleConstructorReturn(this, (VariableLiteral.__proto__ || Object.getPrototypeOf(VariableLiteral)).call(this, _types.Types.UNDEFINED));
  3180. _this.id = id;
  3181. return _this;
  3182. }
  3183. _createClass(VariableLiteral, [{
  3184. key: 'toString',
  3185. value: function toString() {
  3186. return this.id;
  3187. }
  3188. }]);
  3189. return VariableLiteral;
  3190. }(_literal.Literal);
  3191. /***/ }),
  3192. /***/ "./js/ast/ivprogParser.js":
  3193. /*!********************************!*\
  3194. !*** ./js/ast/ivprogParser.js ***!
  3195. \********************************/
  3196. /*! no static exports found */
  3197. /***/ (function(module, exports, __webpack_require__) {
  3198. "use strict";
  3199. Object.defineProperty(exports, "__esModule", {
  3200. value: true
  3201. });
  3202. exports.IVProgParser = undefined;
  3203. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3204. var _index = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  3205. var _expressions = __webpack_require__(/*! ./expressions/ */ "./js/ast/expressions/index.js");
  3206. var Expressions = _interopRequireWildcard(_expressions);
  3207. var _commands = __webpack_require__(/*! ./commands/ */ "./js/ast/commands/index.js");
  3208. var Commands = _interopRequireWildcard(_commands);
  3209. var _parsers = __webpack_require__(/*! ./../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  3210. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  3211. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  3212. var _sourceInfo2 = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js");
  3213. var _operators = __webpack_require__(/*! ./operators */ "./js/ast/operators.js");
  3214. var _syntaxErrorFactory = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js");
  3215. var _definedFunctions = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  3216. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  3217. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  3218. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3219. var IVProgParser = exports.IVProgParser = function () {
  3220. _createClass(IVProgParser, null, [{
  3221. key: 'createParser',
  3222. value: function createParser(input) {
  3223. var lexerClass = _languageService.LanguageService.getCurrentLexer();
  3224. return new IVProgParser(input, lexerClass);
  3225. }
  3226. // <BEGIN scope consts>
  3227. }, {
  3228. key: 'BASE',
  3229. get: function get() {
  3230. return 0;
  3231. }
  3232. }, {
  3233. key: 'FUNCTION',
  3234. get: function get() {
  3235. return 1;
  3236. }
  3237. }, {
  3238. key: 'COMMAND',
  3239. get: function get() {
  3240. return 2;
  3241. }
  3242. }, {
  3243. key: 'BREAKABLE',
  3244. get: function get() {
  3245. return 4;
  3246. }
  3247. // </ END scope consts>
  3248. }]);
  3249. function IVProgParser(input, lexerClass) {
  3250. _classCallCheck(this, IVProgParser);
  3251. this.lexerClass = lexerClass;
  3252. this.lexer = new lexerClass(new _index.InputStream(input));
  3253. this.tokenStream = new _index.CommonTokenStream(this.lexer);
  3254. this.tokenStream.fill();
  3255. this.pos = 1;
  3256. this.variableTypes = [this.lexerClass.RK_INTEGER, this.lexerClass.RK_REAL, this.lexerClass.RK_BOOLEAN, this.lexerClass.RK_STRING];
  3257. this.functionTypes = this.variableTypes.concat(this.lexerClass.RK_VOID);
  3258. this.parsingArrayDimension = 0;
  3259. this.scope = [];
  3260. this.langFuncs = _languageService.LanguageService.getCurrentLangFuncs();
  3261. this.definedFuncsNameList = [];
  3262. this.definedVariablesStack = [];
  3263. }
  3264. _createClass(IVProgParser, [{
  3265. key: 'parseTree',
  3266. value: function parseTree() {
  3267. return this.parseProgram();
  3268. }
  3269. }, {
  3270. key: 'getToken',
  3271. value: function getToken() {
  3272. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos;
  3273. // if(index === null)
  3274. // index = this.pos;
  3275. return this.tokenStream.LT(index);
  3276. }
  3277. }, {
  3278. key: 'insideScope',
  3279. value: function insideScope(scope) {
  3280. if (this.scope.length <= 0) {
  3281. return IVProgParser.BASE === scope;
  3282. } else {
  3283. return this.scope[this.scope.length - 1] === scope;
  3284. }
  3285. }
  3286. }, {
  3287. key: 'pushScope',
  3288. value: function pushScope(scope) {
  3289. this.scope.push(scope);
  3290. }
  3291. }, {
  3292. key: 'pushVariableStack',
  3293. value: function pushVariableStack() {
  3294. this.definedVariablesStack.push([]);
  3295. }
  3296. }, {
  3297. key: 'popScope',
  3298. value: function popScope() {
  3299. return this.scope.pop();
  3300. }
  3301. }, {
  3302. key: 'popVariableStack',
  3303. value: function popVariableStack() {
  3304. return this.definedVariablesStack.pop();
  3305. }
  3306. }, {
  3307. key: 'getCurrentVariableStack',
  3308. value: function getCurrentVariableStack() {
  3309. return this.definedVariablesStack[this.definedVariablesStack.length - 1];
  3310. }
  3311. }, {
  3312. key: 'isEOF',
  3313. value: function isEOF() {
  3314. this.getToken(this.pos);
  3315. return this.tokenStream.fetchedEOF;
  3316. }
  3317. }, {
  3318. key: 'parseProgram',
  3319. value: function parseProgram() {
  3320. var token = this.getToken();
  3321. var globalVars = [];
  3322. var functions = [];
  3323. if (this.lexerClass.RK_PROGRAM === token.type) {
  3324. this.pos++;
  3325. this.consumeNewLines();
  3326. this.checkOpenCurly();
  3327. this.pos++;
  3328. this.pushVariableStack();
  3329. while (true) {
  3330. this.consumeNewLines();
  3331. var _token = this.getToken();
  3332. if (_token.type === this.lexerClass.RK_CONST || this.isVariableType(_token)) {
  3333. globalVars = globalVars.concat(this.parseGlobalVariables());
  3334. } else if (_token.type === this.lexerClass.RK_FUNCTION) {
  3335. this.pushVariableStack();
  3336. functions = functions.concat(this.parseFunction());
  3337. this.popVariableStack();
  3338. } else {
  3339. break;
  3340. }
  3341. }
  3342. this.consumeNewLines();
  3343. this.checkCloseCurly();
  3344. this.pos++;
  3345. this.consumeNewLines();
  3346. if (!this.isEOF()) {
  3347. throw _syntaxErrorFactory.SyntaxErrorFactory.extra_lines();
  3348. }
  3349. this.popVariableStack();
  3350. return { global: globalVars, functions: functions };
  3351. } else {
  3352. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_PROGRAM], token);
  3353. }
  3354. }
  3355. }, {
  3356. key: 'checkOpenCurly',
  3357. value: function checkOpenCurly() {
  3358. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3359. var token = this.getToken();
  3360. if (this.lexerClass.OPEN_CURLY !== token.type) {
  3361. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('{', token);else return false;
  3362. }
  3363. return true;
  3364. }
  3365. }, {
  3366. key: 'checkCloseCurly',
  3367. value: function checkCloseCurly() {
  3368. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3369. var token = this.getToken();
  3370. if (this.lexerClass.CLOSE_CURLY !== token.type) {
  3371. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('}', token);else return false;
  3372. }
  3373. return true;
  3374. }
  3375. /* It checks if the current token at position pos is a ']'.
  3376. * As a check function it doesn't increment pos.
  3377. *
  3378. * @params bool:attempt, indicates that the token is optional. Defaults: false
  3379. *
  3380. * @returns true if the attempt is true and current token is '[',
  3381. * false is attempt is true and current token is not '['
  3382. **/
  3383. }, {
  3384. key: 'checkOpenBrace',
  3385. value: function checkOpenBrace() {
  3386. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3387. var token = this.getToken();
  3388. if (this.lexerClass.OPEN_BRACE !== token.type) {
  3389. if (!attempt) {
  3390. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('[', token);
  3391. } else {
  3392. return false;
  3393. }
  3394. }
  3395. return true;
  3396. }
  3397. }, {
  3398. key: 'checkCloseBrace',
  3399. value: function checkCloseBrace() {
  3400. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3401. var token = this.getToken();
  3402. if (this.lexerClass.CLOSE_BRACE !== token.type) {
  3403. if (!attempt) {
  3404. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(']', token);
  3405. } else {
  3406. return false;
  3407. }
  3408. }
  3409. return true;
  3410. }
  3411. }, {
  3412. key: 'checkOpenParenthesis',
  3413. value: function checkOpenParenthesis() {
  3414. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3415. var token = this.getToken();
  3416. if (this.lexerClass.OPEN_PARENTHESIS !== token.type) {
  3417. if (!attempt) {
  3418. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('(', token);
  3419. } else {
  3420. return false;
  3421. }
  3422. }
  3423. return true;
  3424. }
  3425. }, {
  3426. key: 'checkCloseParenthesis',
  3427. value: function checkCloseParenthesis() {
  3428. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3429. var token = this.getToken();
  3430. if (this.lexerClass.CLOSE_PARENTHESIS !== token.type) {
  3431. if (!attempt) {
  3432. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(')', token);
  3433. } else {
  3434. return false;
  3435. }
  3436. }
  3437. return true;
  3438. }
  3439. }, {
  3440. key: 'checkEOS',
  3441. value: function checkEOS() {
  3442. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3443. var eosToken = this.getToken();
  3444. if (eosToken.type !== this.lexerClass.EOS) {
  3445. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.eos_missing(eosToken);else return false;
  3446. }
  3447. return true;
  3448. }
  3449. }, {
  3450. key: 'checkFunctionDuplicate',
  3451. value: function checkFunctionDuplicate(functionID, funcIDToken) {
  3452. var id = functionID === null ? "$main" : functionID;
  3453. var index = this.definedFuncsNameList.indexOf(id);
  3454. if (index !== -1) {
  3455. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_function(funcIDToken);
  3456. }
  3457. this.definedFuncsNameList.push(id);
  3458. }
  3459. }, {
  3460. key: 'checkVariableDuplicate',
  3461. value: function checkVariableDuplicate(variableID, variableIDToken) {
  3462. var index = this.getCurrentVariableStack().indexOf(variableID);
  3463. if (index !== -1) {
  3464. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_variable(variableIDToken);
  3465. }
  3466. this.getCurrentVariableStack().push(variableID);
  3467. }
  3468. }, {
  3469. key: 'consumeForSemiColon',
  3470. value: function consumeForSemiColon() {
  3471. var eosToken = this.getToken();
  3472. if (eosToken.type === this.lexerClass.EOS && eosToken.text.match(';')) {
  3473. this.pos++;
  3474. return;
  3475. }
  3476. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(';', eosToken);
  3477. }
  3478. }, {
  3479. key: 'parseGlobalVariables',
  3480. value: function parseGlobalVariables() {
  3481. var decl = this.parseMaybeConst();
  3482. this.checkEOS();
  3483. this.pos++;
  3484. return decl;
  3485. }
  3486. /*
  3487. * Checks if the next token is PR_CONST. It's only available
  3488. * at global variables declaration level
  3489. * @returns Declararion(const, type, id, initVal?)
  3490. **/
  3491. }, {
  3492. key: 'parseMaybeConst',
  3493. value: function parseMaybeConst() {
  3494. var constToken = this.getToken();
  3495. if (constToken.type === this.lexerClass.RK_CONST) {
  3496. this.pos++;
  3497. var typeString = this.parseType();
  3498. return this.parseDeclaration(typeString, true);
  3499. } else if (this.isVariableType(constToken)) {
  3500. var _typeString = this.parseType();
  3501. return this.parseDeclaration(_typeString);
  3502. } else {
  3503. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_CONST]].concat(this.getTypeArray()), constToken);
  3504. }
  3505. }
  3506. /*
  3507. * Parses a declarion of the form: type --- id --- (= --- EAnd)?
  3508. * @returns a list of Declararion(const, type, id, initVal?)
  3509. **/
  3510. }, {
  3511. key: 'parseDeclaration',
  3512. value: function parseDeclaration(typeString) {
  3513. var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  3514. var initial = null;
  3515. var dim1 = null;
  3516. var dim2 = null;
  3517. var idToken = this.getToken();
  3518. var idString = this.parseID();
  3519. this.checkVariableDuplicate(idString, idToken);
  3520. // Check for array or vector
  3521. // ID[int/IDi][int/IDj]
  3522. if (this.checkOpenBrace(true)) {
  3523. this.pos++;
  3524. this.consumeNewLines();
  3525. dim1 = this.parseArrayDimension();
  3526. this.consumeNewLines();
  3527. this.checkCloseBrace();
  3528. this.pos++;
  3529. if (this.checkOpenBrace(true)) {
  3530. this.pos++;
  3531. this.consumeNewLines();
  3532. dim2 = this.parseArrayDimension();
  3533. this.consumeNewLines();
  3534. this.checkCloseBrace();
  3535. this.pos++;
  3536. }
  3537. }
  3538. var equalsToken = this.getToken();
  3539. if (isConst && equalsToken.type !== this.lexerClass.EQUAL) {
  3540. throw _syntaxErrorFactory.SyntaxErrorFactory.const_not_init(idToken);
  3541. }
  3542. if (equalsToken.type === this.lexerClass.EQUAL) {
  3543. this.pos++;
  3544. initial = this.parseExpressionOR();
  3545. }
  3546. var declaration = null;
  3547. var dimensions = 0;
  3548. if (dim1 !== null) {
  3549. dimensions++;
  3550. if (dim2 !== null) {
  3551. dimensions++;
  3552. }
  3553. declaration = new Commands.ArrayDeclaration(idString, new _compoundType.CompoundType(typeString, dimensions), dim1, dim2, initial, isConst);
  3554. } else {
  3555. declaration = new Commands.Declaration(idString, typeString, initial, isConst);
  3556. }
  3557. declaration.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(idToken);
  3558. var commaToken = this.getToken();
  3559. if (commaToken.type === this.lexerClass.COMMA) {
  3560. this.pos++;
  3561. this.consumeNewLines();
  3562. return [declaration].concat(this.parseDeclaration(typeString, isConst));
  3563. } else {
  3564. return [declaration];
  3565. }
  3566. }
  3567. }, {
  3568. key: 'consumeNewLines',
  3569. value: function consumeNewLines() {
  3570. var token = this.getToken();
  3571. while (token.type === this.lexerClass.EOS && token.text.match('[\r\n]+')) {
  3572. this.pos++;
  3573. token = this.getToken();
  3574. }
  3575. }
  3576. }, {
  3577. key: 'isVariableType',
  3578. value: function isVariableType(token) {
  3579. return this.variableTypes.find(function (v) {
  3580. return v === token.type;
  3581. });
  3582. }
  3583. /*
  3584. * Reads the next token of the stream to check if it is a Integer or an ID.
  3585. * @returns Integer | ID
  3586. **/
  3587. }, {
  3588. key: 'parseArrayDimension',
  3589. value: function parseArrayDimension() {
  3590. var dimToken = this.getToken();
  3591. if (dimToken.type === this.lexerClass.INTEGER) {
  3592. //parse as int literal
  3593. this.pos++;
  3594. return this.getIntLiteral(dimToken);
  3595. } else if (dimToken.type === this.lexerClass.ID) {
  3596. //parse as variable
  3597. this.pos++;
  3598. return this.parseVariable(dimToken);
  3599. } else {
  3600. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_array_dimension(this.lexer.literalNames[this.lexerClass.RK_INTEGER], dimToken);
  3601. }
  3602. }
  3603. /*
  3604. * Returns an object {type: 'int', value: value}.
  3605. * It checks for binary and hexadecimal integers.
  3606. * @returns object with fields type and value
  3607. **/
  3608. }, {
  3609. key: 'getIntLiteral',
  3610. value: function getIntLiteral(token) {
  3611. var text = token.text;
  3612. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  3613. var exp = new Expressions.IntLiteral((0, _parsers.toInt)(text));
  3614. exp.sourceInfo = sourceInfo;
  3615. return exp;
  3616. }
  3617. }, {
  3618. key: 'getRealLiteral',
  3619. value: function getRealLiteral(token) {
  3620. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  3621. var exp = new Expressions.RealLiteral((0, _parsers.toReal)(token.text));
  3622. exp.sourceInfo = sourceInfo;
  3623. return exp;
  3624. }
  3625. }, {
  3626. key: 'getStringLiteral',
  3627. value: function getStringLiteral(token) {
  3628. var text = token.text;
  3629. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  3630. var exp = new Expressions.StringLiteral((0, _parsers.toString)(text));
  3631. exp.sourceInfo = sourceInfo;
  3632. return exp;
  3633. }
  3634. }, {
  3635. key: 'getBoolLiteral',
  3636. value: function getBoolLiteral(token) {
  3637. var val = (0, _parsers.toBool)(token.text);
  3638. var exp = new Expressions.BoolLiteral(val);
  3639. exp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);;
  3640. return exp;
  3641. }
  3642. }, {
  3643. key: 'parseArrayLiteral',
  3644. value: function parseArrayLiteral() {
  3645. this.checkOpenCurly();
  3646. var beginArray = this.getToken();
  3647. if (this.parsingArrayDimension >= 2) {
  3648. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list('Array dimensions exceed maximum size of 2 at line ' + beginArray.line);
  3649. }
  3650. this.pos++;
  3651. this.parsingArrayDimension++;
  3652. this.consumeNewLines();
  3653. var data = this.parseExpressionList();
  3654. this.consumeNewLines();
  3655. this.checkCloseCurly();
  3656. var endArray = this.getToken();
  3657. this.pos++;
  3658. this.parsingArrayDimension--;
  3659. if (this.parsingArrayDimension === 0) {
  3660. // if (!data.isValid) {
  3661. // // TODO: better error message
  3662. // console.log('invalid array');
  3663. // throw new Error(`Invalid array at line ${beginArray.line}`);
  3664. // }
  3665. }
  3666. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(beginArray, endArray);
  3667. var dataDim = 1;
  3668. if (data[0] instanceof Expressions.ArrayLiteral) {
  3669. dataDim++;
  3670. }
  3671. var type = new _compoundType.CompoundType(_types.Types.UNDEFINED, dataDim);
  3672. var exp = new Expressions.ArrayLiteral(type, data);
  3673. exp.sourceInfo = sourceInfo;
  3674. return exp;
  3675. }
  3676. /*
  3677. * Returns an object {type: 'variable', value: value}.
  3678. * @returns object with fields type and value
  3679. **/
  3680. }, {
  3681. key: 'parseVariable',
  3682. value: function parseVariable(token) {
  3683. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  3684. var exp = new Expressions.VariableLiteral(token.text);
  3685. exp.sourceInfo = sourceInfo;
  3686. return exp;
  3687. }
  3688. /*
  3689. * Returns an object representing a function. It has
  3690. * four attributes: returnType, id, formalParams and block.
  3691. * The block object has two attributes: declarations and commands
  3692. **/
  3693. }, {
  3694. key: 'parseFunction',
  3695. value: function parseFunction() {
  3696. this.pushScope(IVProgParser.FUNCTION);
  3697. var formalParams = [];
  3698. var token = this.getToken();
  3699. if (token.type !== this.lexerClass.RK_FUNCTION) {
  3700. //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token);
  3701. return null;
  3702. }
  3703. this.pos++;
  3704. var funType = this.parseType();
  3705. var dimensions = 0;
  3706. if (this.checkOpenBrace(true)) {
  3707. this.pos++;
  3708. this.checkCloseBrace();
  3709. this.pos++;
  3710. dimensions++;
  3711. if (this.checkOpenBrace(true)) {
  3712. this.pos++;
  3713. this.checkCloseBrace();
  3714. this.pos++;
  3715. dimensions++;
  3716. }
  3717. }
  3718. var funcIDToken = this.getToken();
  3719. var functionID = this.parseID();
  3720. this.checkFunctionDuplicate(functionID, funcIDToken);
  3721. this.checkOpenParenthesis();
  3722. this.pos++;
  3723. this.consumeNewLines();
  3724. if (!this.checkCloseParenthesis(true)) {
  3725. formalParams = this.parseFormalParameters(); // formal parameters
  3726. this.consumeNewLines();
  3727. this.checkCloseParenthesis();
  3728. this.pos++;
  3729. } else {
  3730. this.pos++;
  3731. }
  3732. this.consumeNewLines();
  3733. var commandsBlock = this.parseCommandBlock();
  3734. var returnType = funType;
  3735. if (dimensions > 0) {
  3736. returnType = new _compoundType.CompoundType(funType, dimensions);
  3737. }
  3738. var func = new Commands.Function(functionID, returnType, formalParams, commandsBlock);
  3739. if (functionID === null && !func.isMain) {
  3740. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_main_return(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), this.lexer.literalNames[this.lexerClass.RK_VOID], token.line);
  3741. } else if (func.isMain && formalParams.length !== 0) {
  3742. throw _syntaxErrorFactory.SyntaxErrorFactory.main_parameters();
  3743. }
  3744. this.popScope();
  3745. return func;
  3746. }
  3747. /*
  3748. * Parse the formal parameters of a function.
  3749. * @returns a list of objects with the following attributes: type, id and dimensions.
  3750. **/
  3751. }, {
  3752. key: 'parseFormalParameters',
  3753. value: function parseFormalParameters() {
  3754. var list = [];
  3755. while (true) {
  3756. var dimensions = 0;
  3757. var typeString = this.parseType();
  3758. var idToken = this.getToken();
  3759. var idString = this.parseID();
  3760. this.checkVariableDuplicate(idString, idToken);
  3761. if (this.checkOpenBrace(true)) {
  3762. this.pos++;
  3763. dimensions++;
  3764. this.checkCloseBrace();
  3765. this.pos++;
  3766. if (this.checkOpenBrace(true)) {
  3767. this.pos++;
  3768. dimensions++;
  3769. this.checkCloseBrace();
  3770. this.pos++;
  3771. }
  3772. }
  3773. var type = null;
  3774. if (dimensions > 0) {
  3775. type = new _compoundType.CompoundType(typeString, dimensions);
  3776. } else {
  3777. type = typeString;
  3778. }
  3779. list.push(new Commands.FormalParameter(type, idString));
  3780. var commaToken = this.getToken();
  3781. if (commaToken.type !== this.lexerClass.COMMA) break;
  3782. this.pos++;
  3783. this.consumeNewLines();
  3784. }
  3785. return list;
  3786. }
  3787. }, {
  3788. key: 'parseID',
  3789. value: function parseID() {
  3790. var token = this.getToken();
  3791. if (token.type !== this.lexerClass.ID) {
  3792. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  3793. }
  3794. this.pos++;
  3795. console.log(token.text);
  3796. if (this.insideScope(IVProgParser.FUNCTION)) {
  3797. if (token.text === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  3798. return null;
  3799. }
  3800. }
  3801. return token.text;
  3802. }
  3803. }, {
  3804. key: 'parseMaybeLibID',
  3805. value: function parseMaybeLibID() {
  3806. var token = this.getToken();
  3807. if (token.type !== this.lexerClass.ID && token.type !== this.lexerClass.LIB_ID) {
  3808. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  3809. }
  3810. this.pos++;
  3811. return token.text;
  3812. }
  3813. }, {
  3814. key: 'parseType',
  3815. value: function parseType() {
  3816. var token = this.getToken();
  3817. if (token.type === this.lexerClass.ID && this.insideScope(IVProgParser.FUNCTION)) {
  3818. return _types.Types.VOID;
  3819. } else if (token.type === this.lexerClass.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) {
  3820. this.pos++;
  3821. return _types.Types.VOID;
  3822. } else if (this.isVariableType(token)) {
  3823. this.pos++;
  3824. switch (token.type) {
  3825. case this.lexerClass.RK_INTEGER:
  3826. return _types.Types.INTEGER;
  3827. case this.lexerClass.RK_BOOLEAN:
  3828. return _types.Types.BOOLEAN;
  3829. case this.lexerClass.RK_REAL:
  3830. return _types.Types.REAL;
  3831. case this.lexerClass.RK_STRING:
  3832. return _types.Types.STRING;
  3833. default:
  3834. break;
  3835. }
  3836. }
  3837. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_type(this.getTypeArray(), token);
  3838. }
  3839. }, {
  3840. key: 'parseCommandBlock',
  3841. value: function parseCommandBlock() {
  3842. var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3843. var variablesDecl = [];
  3844. var commands = [];
  3845. var hasOpen = false;
  3846. if (this.checkOpenCurly(optionalCurly)) {
  3847. this.pos++;
  3848. hasOpen = true;
  3849. }
  3850. this.consumeNewLines();
  3851. while (true) {
  3852. var cmd = this.parseCommand();
  3853. if (cmd === null) break;
  3854. if (cmd !== -1) {
  3855. if (cmd instanceof Array) {
  3856. variablesDecl = variablesDecl.concat(cmd);
  3857. } else {
  3858. commands.push(cmd);
  3859. }
  3860. }
  3861. }
  3862. this.consumeNewLines();
  3863. if (hasOpen) {
  3864. this.checkCloseCurly();
  3865. this.pos++;
  3866. this.consumeNewLines();
  3867. }
  3868. return new Commands.CommandBlock(variablesDecl, commands);
  3869. }
  3870. }, {
  3871. key: 'parseCommand',
  3872. value: function parseCommand() {
  3873. var token = this.getToken();
  3874. if (this.isVariableType(token)) {
  3875. if (!this.insideScope(IVProgParser.FUNCTION)) {
  3876. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_var_declaration(token.line);
  3877. }
  3878. this.pushScope(IVProgParser.BASE);
  3879. var varType = this.parseType();
  3880. this.popScope();
  3881. var cmd = this.parseDeclaration(varType);
  3882. this.checkEOS();
  3883. this.pos++;
  3884. return cmd;
  3885. } else if (token.type === this.lexerClass.ID) {
  3886. return this.parseIDCommand();
  3887. } else if (token.type === this.lexerClass.LIB_ID) {
  3888. return this.parseIDCommand();
  3889. } else if (token.type === this.lexerClass.RK_RETURN) {
  3890. return this.parseReturn();
  3891. } else if (token.type === this.lexerClass.RK_WHILE) {
  3892. return this.parseWhile();
  3893. } else if (token.type === this.lexerClass.RK_FOR) {
  3894. return this.parseFor();
  3895. } else if (token.type === this.lexerClass.RK_BREAK) {
  3896. if (!this.insideScope(IVProgParser.BREAKABLE)) {
  3897. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_break_command(this.lexer.literalNames[this.lexerClass.RK_BREAK], token);
  3898. }
  3899. return this.parseBreak();
  3900. } else if (token.type === this.lexerClass.RK_SWITCH) {
  3901. return this.parseSwitchCase();
  3902. } else if (token.type === this.lexerClass.RK_DO) {
  3903. return this.parseDoWhile();
  3904. } else if (token.type === this.lexerClass.RK_IF) {
  3905. return this.parseIfThenElse();
  3906. } else if (this.checkEOS(true)) {
  3907. this.pos++;
  3908. return -1;
  3909. } else {
  3910. return null;
  3911. }
  3912. }
  3913. }, {
  3914. key: 'parseSwitchCase',
  3915. value: function parseSwitchCase() {
  3916. this.pushScope(IVProgParser.BREAKABLE);
  3917. this.pos++;
  3918. this.checkOpenParenthesis();
  3919. this.pos++;
  3920. this.consumeNewLines();
  3921. var exp = this.parseExpressionOR();
  3922. this.consumeNewLines();
  3923. this.checkCloseParenthesis();
  3924. this.pos++;
  3925. this.consumeNewLines();
  3926. this.checkOpenCurly();
  3927. this.pos++;
  3928. this.consumeNewLines();
  3929. var casesList = this.parseCases();
  3930. this.consumeNewLines();
  3931. this.checkCloseCurly();
  3932. this.pos++;
  3933. this.consumeNewLines();
  3934. this.popScope();
  3935. return new Commands.Switch(exp, casesList);
  3936. }
  3937. }, {
  3938. key: 'parseDoWhile',
  3939. value: function parseDoWhile() {
  3940. this.pos++;
  3941. this.consumeNewLines();
  3942. this.pushScope(IVProgParser.BREAKABLE);
  3943. var commandsBlock = this.parseCommandBlock();
  3944. this.consumeNewLines(); //Maybe not...
  3945. var whileToken = this.getToken();
  3946. if (whileToken.type !== this.lexerClass.RK_WHILE) {
  3947. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_WHILE], whileToken);
  3948. }
  3949. this.pos++;
  3950. this.checkOpenParenthesis();
  3951. this.pos++;
  3952. this.consumeNewLines();
  3953. var condition = this.parseExpressionOR();
  3954. this.consumeNewLines();
  3955. this.checkCloseParenthesis();
  3956. this.pos++;
  3957. this.checkEOS();
  3958. this.popScope();
  3959. return new Commands.DoWhile(condition, commandsBlock);
  3960. }
  3961. }, {
  3962. key: 'parseIfThenElse',
  3963. value: function parseIfThenElse() {
  3964. if (this.insideScope(IVProgParser.BREAKABLE)) {
  3965. this.pushScope(IVProgParser.BREAKABLE);
  3966. } else {
  3967. this.pushScope(IVProgParser.COMMAND);
  3968. }
  3969. this.pos++;
  3970. this.checkOpenParenthesis();
  3971. this.pos++;
  3972. this.consumeNewLines();
  3973. var logicalExpression = this.parseExpressionOR();
  3974. this.consumeNewLines();
  3975. this.checkCloseParenthesis();
  3976. this.pos++;
  3977. this.consumeNewLines();
  3978. var cmdBlocks = this.parseCommandBlock();
  3979. var maybeElse = this.getToken();
  3980. if (maybeElse.type === this.lexerClass.RK_ELSE) {
  3981. this.pos++;
  3982. this.consumeNewLines();
  3983. var maybeIf = this.getToken();
  3984. var elseBlock = null;
  3985. if (this.checkOpenCurly(true)) {
  3986. elseBlock = this.parseCommandBlock();
  3987. } else if (maybeIf.type === this.lexerClass.RK_IF) {
  3988. elseBlock = this.parseIfThenElse();
  3989. } else {
  3990. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_IF], '{'], maybeIf);
  3991. }
  3992. return new Commands.IfThenElse(logicalExpression, cmdBlocks, elseBlock);
  3993. }
  3994. this.popScope();
  3995. return new Commands.IfThenElse(logicalExpression, cmdBlocks, null);
  3996. }
  3997. }, {
  3998. key: 'parseFor',
  3999. value: function parseFor() {
  4000. this.pushScope(IVProgParser.BREAKABLE);
  4001. this.pos++;
  4002. this.checkOpenParenthesis();
  4003. this.pos++;
  4004. this.consumeNewLines();
  4005. var attribution = this.parseForAssign();
  4006. this.consumeNewLines();
  4007. var condition = this.parseExpressionOR();
  4008. this.consumeForSemiColon();
  4009. var increment = this.parseForAssign(true);
  4010. this.checkCloseParenthesis();
  4011. this.pos++;
  4012. this.consumeNewLines();
  4013. var commandsBlock = this.parseCommandBlock();
  4014. this.popScope();
  4015. return new Commands.For(attribution, condition, increment, commandsBlock);
  4016. }
  4017. }, {
  4018. key: 'parseWhile',
  4019. value: function parseWhile() {
  4020. this.pushScope(IVProgParser.BREAKABLE);
  4021. this.pos++;
  4022. this.checkOpenParenthesis();
  4023. this.pos++;
  4024. this.consumeNewLines();
  4025. var logicalExpression = this.parseExpressionOR();
  4026. this.consumeNewLines();
  4027. this.checkCloseParenthesis();
  4028. this.pos++;
  4029. this.consumeNewLines();
  4030. var cmdBlocks = this.parseCommandBlock();
  4031. this.popScope();
  4032. return new Commands.While(logicalExpression, cmdBlocks);
  4033. }
  4034. }, {
  4035. key: 'parseBreak',
  4036. value: function parseBreak() {
  4037. this.pos++;
  4038. this.checkEOS();
  4039. this.pos++;
  4040. return new Commands.Break();
  4041. }
  4042. }, {
  4043. key: 'parseReturn',
  4044. value: function parseReturn() {
  4045. this.pos++;
  4046. var exp = null;
  4047. if (!this.checkEOS(true)) {
  4048. exp = this.parseExpressionOR();
  4049. this.checkEOS();
  4050. }
  4051. this.pos++;
  4052. return new Commands.Return(exp);
  4053. }
  4054. }, {
  4055. key: 'parseIDCommand',
  4056. value: function parseIDCommand() {
  4057. var refToken = this.getToken();
  4058. var isID = refToken.type === this.lexerClass.ID;
  4059. var id = this.parseMaybeLibID();
  4060. if (this.checkOpenBrace(true)) {
  4061. this.pos++;
  4062. var lineExpression = null;
  4063. var columnExpression = null;
  4064. this.consumeNewLines();
  4065. lineExpression = this.parseExpression();
  4066. this.consumeNewLines();
  4067. this.checkCloseBrace();
  4068. this.pos++;
  4069. if (this.checkOpenBrace(true)) {
  4070. this.pos++;
  4071. this.consumeNewLines();
  4072. columnExpression = this.parseExpression();
  4073. this.consumeNewLines();
  4074. this.checkCloseBrace();
  4075. this.pos++;
  4076. }
  4077. var equalToken = this.getToken();
  4078. if (equalToken.type !== this.lexerClass.EQUAL) {
  4079. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equalToken);
  4080. }
  4081. this.pos++;
  4082. var exp = this.parseExpressionOR();
  4083. this.checkEOS();
  4084. this.pos++;
  4085. var cmd = new Commands.ArrayIndexAssign(id, lineExpression, columnExpression, exp);
  4086. cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalToken);
  4087. return cmd;
  4088. }
  4089. var equalOrParenthesis = this.getToken();
  4090. if (isID && equalOrParenthesis.type === this.lexerClass.EQUAL) {
  4091. this.pos++;
  4092. var _exp = this.parseExpressionOR();
  4093. this.checkEOS();
  4094. this.pos++;
  4095. var _cmd = new Commands.Assign(id, _exp);
  4096. _cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalOrParenthesis);
  4097. return _cmd;
  4098. } else if (equalOrParenthesis.type === this.lexerClass.OPEN_PARENTHESIS) {
  4099. var funcCall = this.parseFunctionCallCommand(id);
  4100. this.checkEOS();
  4101. this.pos++;
  4102. return funcCall;
  4103. } else if (isID) {
  4104. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list(['=', '('], equalOrParenthesis);
  4105. } else {
  4106. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(refToken);
  4107. }
  4108. }
  4109. }, {
  4110. key: 'parseForAssign',
  4111. value: function parseForAssign() {
  4112. var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4113. if (!isLast) this.consumeNewLines();
  4114. if (this.checkEOS(true)) {
  4115. return null;
  4116. }
  4117. var id = this.parseID();
  4118. var equal = this.getToken();
  4119. if (equal.type !== this.lexerClass.EQUAL) {
  4120. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equal);
  4121. }
  4122. this.pos++;
  4123. var exp = this.parseExpressionOR();
  4124. if (!isLast) {
  4125. this.consumeForSemiColon();
  4126. }
  4127. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equal);
  4128. var cmd = new Commands.Assign(id, exp);
  4129. cmd.sourceInfo = sourceInfo;
  4130. return cmd;
  4131. }
  4132. }, {
  4133. key: 'parseCases',
  4134. value: function parseCases() {
  4135. var token = this.getToken();
  4136. if (token.type !== this.lexerClass.RK_CASE) {
  4137. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_CASE], token);
  4138. }
  4139. this.pos++;
  4140. var nextToken = this.getToken();
  4141. if (nextToken.type === this.lexerClass.RK_DEFAULT) {
  4142. this.pos++;
  4143. var colonToken = this.getToken();
  4144. if (colonToken.type !== this.lexerClass.COLON) {
  4145. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', colonToken);
  4146. }
  4147. this.pos++;
  4148. this.consumeNewLines();
  4149. var block = this.parseCommandBlock(true);
  4150. var defaultCase = new Commands.Case(null);
  4151. defaultCase.setCommands(block.commands);
  4152. return [defaultCase];
  4153. } else {
  4154. var exp = this.parseExpressionOR();
  4155. var _colonToken = this.getToken();
  4156. if (_colonToken.type !== this.lexerClass.COLON) {
  4157. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', _colonToken);
  4158. }
  4159. this.pos++;
  4160. this.consumeNewLines();
  4161. var _block = this.parseCommandBlock(true);
  4162. var aCase = new Commands.Case(exp);
  4163. aCase.setCommands(_block.commands);
  4164. var caseToken = this.getToken();
  4165. if (caseToken.type === this.lexerClass.RK_CASE) {
  4166. return [aCase].concat(this.parseCases());
  4167. } else {
  4168. return [aCase];
  4169. }
  4170. }
  4171. }
  4172. /*
  4173. * Parses an Expression following the structure:
  4174. *
  4175. * EOR => EAnd ( 'or' EOR)? #expression and
  4176. *
  4177. * EOR => ENot ('and' EOR)? #expression or
  4178. *
  4179. * ENot => 'not'? ER #expression not
  4180. *
  4181. * ER => E ((>=, <=, ==, >, <) E)? #expression relational
  4182. *
  4183. * E => factor ((+, -) E)? #expression
  4184. *
  4185. * factor=> term ((*, /, %) factor)?
  4186. *
  4187. * term => literal || arrayAccess || FuncCall || ID || '('EAnd')'
  4188. **/
  4189. }, {
  4190. key: 'parseExpressionOR',
  4191. value: function parseExpressionOR() {
  4192. var exp1 = this.parseExpressionAND();
  4193. while (this.getToken().type === this.lexerClass.OR_OPERATOR) {
  4194. var opToken = this.getToken();
  4195. this.pos++;
  4196. var or = (0, _operators.convertFromString)('or');
  4197. this.consumeNewLines();
  4198. var exp2 = this.parseExpressionAND();
  4199. var _finalExp = new Expressions.InfixApp(or, exp1, exp2);
  4200. _finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  4201. exp1 = _finalExp;
  4202. }
  4203. return exp1;
  4204. }
  4205. }, {
  4206. key: 'parseExpressionAND',
  4207. value: function parseExpressionAND() {
  4208. var exp1 = this.parseExpressionNot();
  4209. while (this.getToken().type === this.lexerClass.AND_OPERATOR) {
  4210. var opToken = this.getToken();
  4211. this.pos++;
  4212. var and = (0, _operators.convertFromString)('and');
  4213. this.consumeNewLines();
  4214. var exp2 = this.parseExpressionNot();
  4215. var _finalExp2 = new Expressions.InfixApp(and, exp1, exp2);
  4216. _finalExp2.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  4217. exp1 = _finalExp2;
  4218. }
  4219. return exp1;
  4220. }
  4221. }, {
  4222. key: 'parseExpressionNot',
  4223. value: function parseExpressionNot() {
  4224. var maybeNotToken = this.getToken();
  4225. if (maybeNotToken.type === this.lexerClass.NOT_OPERATOR) {
  4226. var opToken = this.getToken();
  4227. this.pos++;
  4228. var not = (0, _operators.convertFromString)('not');
  4229. var exp1 = this.parseExpressionRel();
  4230. finalExp = new Expressions.UnaryApp(not, exp1);
  4231. finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  4232. return finalExp;
  4233. } else {
  4234. return this.parseExpressionRel();
  4235. }
  4236. }
  4237. }, {
  4238. key: 'parseExpressionRel',
  4239. value: function parseExpressionRel() {
  4240. var exp1 = this.parseExpression();
  4241. while (this.getToken().type === this.lexerClass.RELATIONAL_OPERATOR) {
  4242. var relToken = this.getToken();
  4243. this.pos++;
  4244. var rel = (0, _operators.convertFromString)(relToken.text);
  4245. var exp2 = this.parseExpression();
  4246. var _finalExp3 = new Expressions.InfixApp(rel, exp1, exp2);
  4247. _finalExp3.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(relToken);
  4248. exp1 = _finalExp3;
  4249. }
  4250. return exp1;
  4251. }
  4252. }, {
  4253. key: 'parseExpression',
  4254. value: function parseExpression() {
  4255. var factor = this.parseFactor();
  4256. while (this.getToken().type === this.lexerClass.SUM_OP) {
  4257. var sumOpToken = this.getToken();
  4258. this.pos++;
  4259. var op = (0, _operators.convertFromString)(sumOpToken.text);
  4260. var factor2 = this.parseFactor();
  4261. var _finalExp4 = new Expressions.InfixApp(op, factor, factor2);
  4262. _finalExp4.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(sumOpToken);
  4263. factor = _finalExp4;
  4264. }
  4265. return factor;
  4266. }
  4267. }, {
  4268. key: 'parseFactor',
  4269. value: function parseFactor() {
  4270. var term = this.parseTerm();
  4271. while (this.getToken().type === this.lexerClass.MULTI_OP) {
  4272. var multOpToken = this.getToken();
  4273. this.pos++;
  4274. var op = (0, _operators.convertFromString)(multOpToken.text);
  4275. var term2 = this.parseTerm();
  4276. var _finalExp5 = new Expressions.InfixApp(op, term, term2);
  4277. _finalExp5.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(multOpToken);
  4278. term = _finalExp5;
  4279. }
  4280. return term;
  4281. }
  4282. }, {
  4283. key: 'parseTerm',
  4284. value: function parseTerm() {
  4285. var token = this.getToken();
  4286. var sourceInfo = null;
  4287. switch (token.type) {
  4288. case this.lexerClass.SUM_OP:
  4289. this.pos++;
  4290. sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4291. var exp = new Expressions.UnaryApp((0, _operators.convertFromString)(token.text), this.parseTerm());
  4292. exp.sourceInfo = sourceInfo;
  4293. return exp;
  4294. case this.lexerClass.INTEGER:
  4295. this.pos++;
  4296. return this.getIntLiteral(token);
  4297. case this.lexerClass.REAL:
  4298. this.pos++;
  4299. return this.getRealLiteral(token);
  4300. case this.lexerClass.STRING:
  4301. this.pos++;
  4302. return this.getStringLiteral(token);
  4303. case this.lexerClass.RK_TRUE:
  4304. case this.lexerClass.RK_FALSE:
  4305. this.pos++;
  4306. return this.getBoolLiteral(token);
  4307. case this.lexerClass.OPEN_CURLY:
  4308. return this.parseArrayLiteral();
  4309. case this.lexerClass.ID:
  4310. case this.lexerClass.LIB_ID:
  4311. return this.parseIDTerm();
  4312. case this.lexerClass.OPEN_PARENTHESIS:
  4313. return this.parseParenthesisExp();
  4314. default:
  4315. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_terminal(token);
  4316. }
  4317. }
  4318. }, {
  4319. key: 'parseIDTerm',
  4320. value: function parseIDTerm() {
  4321. var tokenA = this.getToken();
  4322. var id = this.parseMaybeLibID();
  4323. var isID = tokenA.type === this.lexerClass.ID;
  4324. if (isID && this.checkOpenBrace(true)) {
  4325. var tokenB = null;
  4326. this.pos++;
  4327. var firstIndex = this.parseExpression();
  4328. var secondIndex = null;
  4329. this.consumeNewLines();
  4330. this.checkCloseBrace();
  4331. tokenB = this.getToken();
  4332. this.pos++;
  4333. if (this.checkOpenBrace(true)) {
  4334. this.pos++;
  4335. secondIndex = this.parseExpression();
  4336. this.consumeNewLines();
  4337. this.checkCloseBrace();
  4338. tokenB = this.getToken();
  4339. this.pos++;
  4340. }
  4341. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  4342. var exp = new Expressions.ArrayAccess(id, firstIndex, secondIndex);
  4343. exp.sourceInfo = sourceInfo;
  4344. return exp;
  4345. } else if (this.checkOpenParenthesis(true)) {
  4346. return this.parseFunctionCallExpression(id);
  4347. } else if (isID) {
  4348. var _sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(tokenA);
  4349. var _exp2 = new Expressions.VariableLiteral(id);
  4350. _exp2.sourceInfo = _sourceInfo;
  4351. return _exp2;
  4352. } else {
  4353. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(tokenA);
  4354. }
  4355. }
  4356. }, {
  4357. key: 'getFunctionName',
  4358. value: function getFunctionName(id) {
  4359. var name = _definedFunctions.LanguageDefinedFunction.getInternalName(id);
  4360. if (name === null) {
  4361. if (id === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  4362. return null;
  4363. }
  4364. return id;
  4365. } else {
  4366. return name;
  4367. }
  4368. }
  4369. }, {
  4370. key: 'parseFunctionCallExpression',
  4371. value: function parseFunctionCallExpression(id) {
  4372. var tokenA = this.getToken(this.pos - 1);
  4373. var actualParameters = this.parseActualParameters();
  4374. var tokenB = this.getToken(this.pos - 1);
  4375. var funcName = this.getFunctionName(id);
  4376. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  4377. var cmd = new Expressions.FunctionCall(funcName, actualParameters);
  4378. cmd.sourceInfo = sourceInfo;
  4379. return cmd;
  4380. }
  4381. }, {
  4382. key: 'parseFunctionCallCommand',
  4383. value: function parseFunctionCallCommand(id) {
  4384. return this.parseFunctionCallExpression(id);
  4385. }
  4386. }, {
  4387. key: 'parseParenthesisExp',
  4388. value: function parseParenthesisExp() {
  4389. this.checkOpenParenthesis();
  4390. var tokenA = this.getToken();
  4391. this.pos++;
  4392. this.consumeNewLines();
  4393. var exp = this.parseExpressionOR();
  4394. this.consumeNewLines();
  4395. this.checkCloseParenthesis();
  4396. var tokenB = this.getToken();
  4397. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  4398. this.pos++;
  4399. exp.sourceInfo = sourceInfo;
  4400. return exp;
  4401. }
  4402. }, {
  4403. key: 'parseActualParameters',
  4404. value: function parseActualParameters() {
  4405. this.checkOpenParenthesis();
  4406. this.pos++;
  4407. if (this.checkCloseParenthesis(true)) {
  4408. this.pos++;
  4409. return [];
  4410. }
  4411. this.consumeNewLines();
  4412. var list = this.parseExpressionList();
  4413. this.consumeNewLines();
  4414. this.checkCloseParenthesis();
  4415. this.pos++;
  4416. return list;
  4417. }
  4418. }, {
  4419. key: 'parseExpressionList',
  4420. value: function parseExpressionList() {
  4421. var list = [];
  4422. while (true) {
  4423. var exp = this.parseExpressionOR();
  4424. list.push(exp);
  4425. var maybeToken = this.getToken();
  4426. if (maybeToken.type !== this.lexerClass.COMMA) {
  4427. break;
  4428. } else {
  4429. this.pos++;
  4430. this.consumeNewLines();
  4431. }
  4432. }
  4433. return list;
  4434. }
  4435. }, {
  4436. key: 'getTypeArray',
  4437. value: function getTypeArray() {
  4438. var _this = this;
  4439. var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes;
  4440. return types.map(function (x) {
  4441. return _this.lexer.literalNames[x];
  4442. });
  4443. }
  4444. }]);
  4445. return IVProgParser;
  4446. }();
  4447. /***/ }),
  4448. /***/ "./js/ast/operators.js":
  4449. /*!*****************************!*\
  4450. !*** ./js/ast/operators.js ***!
  4451. \*****************************/
  4452. /*! no static exports found */
  4453. /***/ (function(module, exports, __webpack_require__) {
  4454. "use strict";
  4455. Object.defineProperty(exports, "__esModule", {
  4456. value: true
  4457. });
  4458. exports.convertFromString = convertFromString;
  4459. var Operators = exports.Operators = Object.freeze({
  4460. ADD: { ord: 0, value: "+" },
  4461. SUB: { ord: 1, value: "-" },
  4462. MULT: { ord: 2, value: '*' },
  4463. DIV: { ord: 3, value: '/' },
  4464. MOD: { ord: 4, value: '%' },
  4465. GT: { ord: 5, value: '>' },
  4466. GE: { ord: 6, value: '>=' },
  4467. LT: { ord: 7, value: '<' },
  4468. LE: { ord: 8, value: '<=' },
  4469. EQ: { ord: 9, value: '==' },
  4470. NEQ: { ord: 10, value: '!=' },
  4471. AND: { ord: 11, value: 'and' },
  4472. OR: { ord: 12, value: 'or' },
  4473. NOT: { ord: 13, value: 'not' }
  4474. });
  4475. function convertFromString(op) {
  4476. switch (op) {
  4477. case '+':
  4478. return Operators.ADD;
  4479. case '-':
  4480. return Operators.SUB;
  4481. case '*':
  4482. return Operators.MULT;
  4483. case '/':
  4484. return Operators.DIV;
  4485. case '%':
  4486. return Operators.MOD;
  4487. case '>':
  4488. return Operators.GT;
  4489. case '>=':
  4490. return Operators.GE;
  4491. case '<':
  4492. return Operators.LT;
  4493. case '<=':
  4494. return Operators.LE;
  4495. case '==':
  4496. return Operators.EQ;
  4497. case '!=':
  4498. return Operators.NEQ;
  4499. case 'and':
  4500. return Operators.AND;
  4501. case 'or':
  4502. return Operators.OR;
  4503. case 'not':
  4504. return Operators.NOT;
  4505. }
  4506. }
  4507. /***/ }),
  4508. /***/ "./js/ast/sourceInfo.js":
  4509. /*!******************************!*\
  4510. !*** ./js/ast/sourceInfo.js ***!
  4511. \******************************/
  4512. /*! no static exports found */
  4513. /***/ (function(module, exports, __webpack_require__) {
  4514. "use strict";
  4515. Object.defineProperty(exports, "__esModule", {
  4516. value: true
  4517. });
  4518. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4519. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4520. var SourceInfo = exports.SourceInfo = function () {
  4521. _createClass(SourceInfo, null, [{
  4522. key: "createSourceInfo",
  4523. value: function createSourceInfo(token) {
  4524. return new SourceInfo(token.line, token.column, token.text.length);
  4525. }
  4526. }, {
  4527. key: "createSourceInfoFromList",
  4528. value: function createSourceInfoFromList(tokenA, tokenB) {
  4529. var line = tokenA.line;
  4530. var column = tokenA.column;
  4531. // copied from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g
  4532. // No idea why...
  4533. var size = tokenB.tokenIndex + 1 - tokenA.tokenIndex;
  4534. return new SourceInfo(line, column, size);
  4535. }
  4536. }]);
  4537. function SourceInfo(line, column, size) {
  4538. _classCallCheck(this, SourceInfo);
  4539. this.line = line;
  4540. this.column = column;
  4541. this.size = size;
  4542. }
  4543. return SourceInfo;
  4544. }();
  4545. /***/ }),
  4546. /***/ "./js/io/domInput.js":
  4547. /*!***************************!*\
  4548. !*** ./js/io/domInput.js ***!
  4549. \***************************/
  4550. /*! no static exports found */
  4551. /***/ (function(module, exports, __webpack_require__) {
  4552. "use strict";
  4553. Object.defineProperty(exports, "__esModule", {
  4554. value: true
  4555. });
  4556. exports.DOMInput = undefined;
  4557. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4558. var _input = __webpack_require__(/*! ./input */ "./js/io/input.js");
  4559. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  4560. var _jquery2 = _interopRequireDefault(_jquery);
  4561. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4562. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4563. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4564. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4565. var DOMInput = exports.DOMInput = function (_Input) {
  4566. _inherits(DOMInput, _Input);
  4567. function DOMInput(element) {
  4568. _classCallCheck(this, DOMInput);
  4569. var _this = _possibleConstructorReturn(this, (DOMInput.__proto__ || Object.getPrototypeOf(DOMInput)).call(this));
  4570. _this.el = (0, _jquery2.default)(element);
  4571. _this.listeners = [];
  4572. _this.setupEvents();
  4573. return _this;
  4574. }
  4575. _createClass(DOMInput, [{
  4576. key: 'setupEvents',
  4577. value: function setupEvents() {
  4578. var _this2 = this;
  4579. this.el.on('keydown', function (e) {
  4580. var code = e.keyCode || e.which;
  4581. if (code === 13) {
  4582. var text = _this2.el.val();
  4583. text = text.replace('[\n\r]+', '');
  4584. _this2.notifyInput(text);
  4585. _this2.el.val('');
  4586. }
  4587. });
  4588. }
  4589. }, {
  4590. key: 'requestInput',
  4591. value: function requestInput(callback) {
  4592. this.listeners.push(callback);
  4593. this.el.focus();
  4594. }
  4595. }, {
  4596. key: 'notifyInput',
  4597. value: function notifyInput(text) {
  4598. this.listeners.forEach(function (resolve) {
  4599. resolve(text);
  4600. });
  4601. this.listeners.splice(0, this.listeners.length);
  4602. }
  4603. }]);
  4604. return DOMInput;
  4605. }(_input.Input);
  4606. /***/ }),
  4607. /***/ "./js/io/domOutput.js":
  4608. /*!****************************!*\
  4609. !*** ./js/io/domOutput.js ***!
  4610. \****************************/
  4611. /*! no static exports found */
  4612. /***/ (function(module, exports, __webpack_require__) {
  4613. "use strict";
  4614. Object.defineProperty(exports, "__esModule", {
  4615. value: true
  4616. });
  4617. exports.DOMOutput = undefined;
  4618. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4619. var _output = __webpack_require__(/*! ./output */ "./js/io/output.js");
  4620. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  4621. var _jquery2 = _interopRequireDefault(_jquery);
  4622. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4623. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4624. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4625. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4626. var DOMOutput = exports.DOMOutput = function (_Output) {
  4627. _inherits(DOMOutput, _Output);
  4628. function DOMOutput(selector) {
  4629. _classCallCheck(this, DOMOutput);
  4630. var _this = _possibleConstructorReturn(this, (DOMOutput.__proto__ || Object.getPrototypeOf(DOMOutput)).call(this));
  4631. _this.el = (0, _jquery2.default)(selector);
  4632. return _this;
  4633. }
  4634. _createClass(DOMOutput, [{
  4635. key: 'sendOutput',
  4636. value: function sendOutput(text) {
  4637. text = text.replace("\n", '</br>');
  4638. text = text.replace(/\t/g, '&#9;');
  4639. var span = (0, _jquery2.default)('<span />').addClass('ivprog-io-output-text').html(text);
  4640. this.el.append(span);
  4641. }
  4642. }, {
  4643. key: 'clear',
  4644. value: function clear() {
  4645. this.el.empty();
  4646. }
  4647. }]);
  4648. return DOMOutput;
  4649. }(_output.Output);
  4650. /***/ }),
  4651. /***/ "./js/io/input.js":
  4652. /*!************************!*\
  4653. !*** ./js/io/input.js ***!
  4654. \************************/
  4655. /*! no static exports found */
  4656. /***/ (function(module, exports, __webpack_require__) {
  4657. "use strict";
  4658. Object.defineProperty(exports, "__esModule", {
  4659. value: true
  4660. });
  4661. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4662. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4663. var Input = exports.Input = function () {
  4664. function Input() {
  4665. _classCallCheck(this, Input);
  4666. }
  4667. _createClass(Input, [{
  4668. key: "requestInput",
  4669. value: function requestInput(callback) {
  4670. throw new Error("Must be implemented");
  4671. }
  4672. }]);
  4673. return Input;
  4674. }();
  4675. /***/ }),
  4676. /***/ "./js/io/output.js":
  4677. /*!*************************!*\
  4678. !*** ./js/io/output.js ***!
  4679. \*************************/
  4680. /*! no static exports found */
  4681. /***/ (function(module, exports, __webpack_require__) {
  4682. "use strict";
  4683. Object.defineProperty(exports, "__esModule", {
  4684. value: true
  4685. });
  4686. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4687. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4688. var Output = exports.Output = function () {
  4689. function Output() {
  4690. _classCallCheck(this, Output);
  4691. }
  4692. _createClass(Output, [{
  4693. key: "sendOutput",
  4694. value: function sendOutput(text) {
  4695. throw new Error("Must be implemented");
  4696. }
  4697. }]);
  4698. return Output;
  4699. }();
  4700. /***/ }),
  4701. /***/ "./js/main.js":
  4702. /*!********************!*\
  4703. !*** ./js/main.js ***!
  4704. \********************/
  4705. /*! no static exports found */
  4706. /***/ (function(module, exports, __webpack_require__) {
  4707. "use strict";
  4708. var _ivprogParser = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js");
  4709. var _ivprogProcessor = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  4710. var _semanticAnalyser = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  4711. var _domInput = __webpack_require__(/*! ./io/domInput */ "./js/io/domInput.js");
  4712. var _domOutput = __webpack_require__(/*! ./io/domOutput */ "./js/io/domOutput.js");
  4713. var _languageService = __webpack_require__(/*! ./services/languageService */ "./js/services/languageService.js");
  4714. var _localizedStringsService = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js");
  4715. var ivprogLexer = _languageService.LanguageService.getCurrentLexer();
  4716. console.log(_localizedStringsService.LocalizedStrings.getUI('start'));
  4717. // const lexer = new ivprogLexer(new InputStream(input));
  4718. // const stream = new CommonTokenStream(lexer);
  4719. // stream.fill();
  4720. // let i = 1;
  4721. // let token = null;
  4722. // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
  4723. // console.log(`${token.type}-${token.text}`);
  4724. // console.log('\n')
  4725. // i++;
  4726. // }
  4727. // const anaSin = new IVProgParser(input, ivprogLexer);
  4728. var editor = new JsonEditor('#json-renderer', {});
  4729. var domIn = new _domInput.DOMInput('#dom-in');
  4730. var domOut = new _domOutput.DOMOutput('#dom-out');
  4731. // proc.interpretAST().then( sto => {
  4732. // console.log(sto.applyStore('a'));
  4733. // }).catch(e => console.log(e));
  4734. try {
  4735. $('#btn').click(function () {
  4736. var input = $('#input').val();
  4737. var analiser = new _ivprogParser.IVProgParser(input, ivprogLexer);
  4738. try {
  4739. var data = analiser.parseTree();
  4740. var semAna = new _semanticAnalyser.SemanticAnalyser(data);
  4741. var proc = new _ivprogProcessor.IVProgProcessor(semAna.analyseTree());
  4742. proc.registerInput(domIn);
  4743. domOut.clear();
  4744. proc.registerOutput(domOut);
  4745. proc.interpretAST().then(function (_) {
  4746. return editor.load({});
  4747. }).catch(function (e) {
  4748. alert(e);console.log(e);
  4749. });
  4750. } catch (error) {
  4751. alert(error);
  4752. console.log(error);
  4753. }
  4754. });
  4755. } catch (a) {
  4756. console.log(a);
  4757. }
  4758. /***/ }),
  4759. /***/ "./js/processor/compatibilityTable.js":
  4760. /*!********************************************!*\
  4761. !*** ./js/processor/compatibilityTable.js ***!
  4762. \********************************************/
  4763. /*! no static exports found */
  4764. /***/ (function(module, exports, __webpack_require__) {
  4765. "use strict";
  4766. Object.defineProperty(exports, "__esModule", {
  4767. value: true
  4768. });
  4769. exports.resultTypeAfterInfixOp = resultTypeAfterInfixOp;
  4770. exports.resultTypeAfterUnaryOp = resultTypeAfterUnaryOp;
  4771. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  4772. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  4773. var _multiType = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  4774. function buildInfixAddTable() {
  4775. var table = [[], [], [], []];
  4776. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  4777. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  4778. table[_types.Types.INTEGER.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  4779. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  4780. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  4781. table[_types.Types.REAL.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  4782. table[_types.Types.STRING.ord][_types.Types.INTEGER.ord] = _types.Types.STRING;
  4783. table[_types.Types.STRING.ord][_types.Types.REAL.ord] = _types.Types.STRING;
  4784. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  4785. table[_types.Types.STRING.ord][_types.Types.BOOLEAN.ord] = _types.Types.STRING;
  4786. return table;
  4787. }
  4788. function buildInfixMultiDivSubTable() {
  4789. var table = [[], [], [], []];
  4790. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  4791. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  4792. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  4793. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  4794. return table;
  4795. }
  4796. function buildInfixEqualityInequalityTable() {
  4797. var table = [[], [], [], []];
  4798. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  4799. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  4800. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  4801. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  4802. return table;
  4803. }
  4804. function buildInfixRelationalTable() {
  4805. var table = [[], [], [], []];
  4806. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  4807. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  4808. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  4809. return table;
  4810. }
  4811. function buildInfixAndOrTable() {
  4812. var table = [[], [], [], []];
  4813. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  4814. return table;
  4815. }
  4816. function buildInfixModTable() {
  4817. var table = [[], [], [], []];
  4818. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  4819. return table;
  4820. }
  4821. function buildUnarySumSubList() {
  4822. var list = [];
  4823. list[_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  4824. list[_types.Types.REAL.ord] = _types.Types.REAL;
  4825. return list;
  4826. }
  4827. function buildUnaryNegList() {
  4828. var list = [];
  4829. list[_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  4830. return list;
  4831. }
  4832. function buildInfixCompatibilityTable() {
  4833. var compatibilityMap = new WeakMap();
  4834. compatibilityMap.set(_operators.Operators.ADD, buildInfixAddTable());
  4835. compatibilityMap.set(_operators.Operators.SUB, buildInfixMultiDivSubTable());
  4836. compatibilityMap.set(_operators.Operators.MULT, buildInfixMultiDivSubTable());
  4837. compatibilityMap.set(_operators.Operators.DIV, buildInfixMultiDivSubTable());
  4838. compatibilityMap.set(_operators.Operators.EQ, buildInfixEqualityInequalityTable());
  4839. compatibilityMap.set(_operators.Operators.NEQ, buildInfixEqualityInequalityTable());
  4840. compatibilityMap.set(_operators.Operators.GE, buildInfixRelationalTable());
  4841. compatibilityMap.set(_operators.Operators.GT, buildInfixRelationalTable());
  4842. compatibilityMap.set(_operators.Operators.LE, buildInfixRelationalTable());
  4843. compatibilityMap.set(_operators.Operators.LT, buildInfixRelationalTable());
  4844. compatibilityMap.set(_operators.Operators.OR, buildInfixAndOrTable());
  4845. compatibilityMap.set(_operators.Operators.AND, buildInfixAndOrTable());
  4846. compatibilityMap.set(_operators.Operators.MOD, buildInfixModTable());
  4847. return compatibilityMap;
  4848. }
  4849. function buildUnaryCompatibilityTable() {
  4850. var compatibilityMap = new WeakMap();
  4851. compatibilityMap.set(_operators.Operators.ADD, buildUnarySumSubList());
  4852. compatibilityMap.set(_operators.Operators.SUB, buildUnarySumSubList());
  4853. compatibilityMap.set(_operators.Operators.NOT, buildUnaryNegList());
  4854. return compatibilityMap;
  4855. }
  4856. var infixMap = buildInfixCompatibilityTable();
  4857. var unaryMap = buildUnaryCompatibilityTable();
  4858. function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
  4859. try {
  4860. if (leftExpressionType instanceof _multiType.MultiType && rightExpressionType instanceof _multiType.MultiType) {
  4861. var newMulti = [];
  4862. for (var i = 0; i < leftExpressionType.types.length; i++) {
  4863. var element = leftExpressionType.types[i];
  4864. if (rightExpressionType.types.indexOf(element) !== -1) {
  4865. newMulti.push(element);
  4866. }
  4867. }
  4868. if (newMulti.length <= 0) {
  4869. return _types.Types.UNDEFINED;
  4870. } else {
  4871. return new _multiType.MultiType(newMulti);
  4872. }
  4873. } else if (leftExpressionType instanceof _multiType.MultiType) {
  4874. if (leftExpressionType.isCompatible(rightExpressionType)) {
  4875. return rightExpressionType;
  4876. } else {
  4877. return _types.Types.UNDEFINED;
  4878. }
  4879. } else if (rightExpressionType instanceof _multiType.MultiType) {
  4880. if (rightExpressionType.isCompatible(leftExpressionType)) {
  4881. return leftExpressionType;
  4882. } else {
  4883. return _types.Types.UNDEFINED;
  4884. }
  4885. }
  4886. var resultType = infixMap.get(operator)[leftExpressionType.ord][rightExpressionType.ord];
  4887. if (resultType === null || resultType === undefined) {
  4888. return _types.Types.UNDEFINED;
  4889. }
  4890. return resultType;
  4891. } catch (e) {
  4892. if (e instanceof TypeError) {
  4893. return _types.Types.UNDEFINED;
  4894. } else {
  4895. throw e;
  4896. }
  4897. }
  4898. }
  4899. function resultTypeAfterUnaryOp(operator, leftExpressionType) {
  4900. try {
  4901. if (leftExpressionType instanceof _multiType.MultiType) {
  4902. return leftExpressionType;
  4903. }
  4904. return unaryMap.get(operator)[leftExpressionType.ord];
  4905. } catch (e) {
  4906. if (e instanceof TypeError) {
  4907. return _types.Types.UNDEFINED;
  4908. } else {
  4909. throw e;
  4910. }
  4911. }
  4912. }
  4913. /***/ }),
  4914. /***/ "./js/processor/context.js":
  4915. /*!*********************************!*\
  4916. !*** ./js/processor/context.js ***!
  4917. \*********************************/
  4918. /*! no static exports found */
  4919. /***/ (function(module, exports, __webpack_require__) {
  4920. "use strict";
  4921. Object.defineProperty(exports, "__esModule", {
  4922. value: true
  4923. });
  4924. var Context = exports.Context = Object.freeze({
  4925. BASE: Symbol('context:base'),
  4926. BREAKABLE: Symbol('context:breakable'),
  4927. FUNCTION: Symbol('context:function')
  4928. });
  4929. /***/ }),
  4930. /***/ "./js/processor/definedFunctions.js":
  4931. /*!******************************************!*\
  4932. !*** ./js/processor/definedFunctions.js ***!
  4933. \******************************************/
  4934. /*! no static exports found */
  4935. /***/ (function(module, exports, __webpack_require__) {
  4936. "use strict";
  4937. Object.defineProperty(exports, "__esModule", {
  4938. value: true
  4939. });
  4940. exports.LanguageDefinedFunction = undefined;
  4941. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  4942. var _io = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js");
  4943. var _strings = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js");
  4944. var _arrays = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js");
  4945. var _lang = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js");
  4946. var _math = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js");
  4947. function valueToKey(value, object) {
  4948. for (var key in object) {
  4949. if (object.hasOwnProperty(key)) {
  4950. if (object[key] === value) {
  4951. return key;
  4952. }
  4953. }
  4954. }
  4955. return null;
  4956. }
  4957. function concatObjects() {
  4958. var result = {};
  4959. for (var _len = arguments.length, objs = Array(_len), _key = 0; _key < _len; _key++) {
  4960. objs[_key] = arguments[_key];
  4961. }
  4962. for (var i = 0; i < objs.length; i++) {
  4963. var obj = objs[i];
  4964. for (var key in obj) {
  4965. if (obj.hasOwnProperty(key)) {
  4966. result[key] = obj[key];
  4967. }
  4968. }
  4969. }
  4970. return result;
  4971. }
  4972. var libsObject = {
  4973. $mathLib: {
  4974. $sin: (0, _math.createSinFun)(),
  4975. $cos: (0, _math.createCosFun)(),
  4976. $tan: (0, _math.createTanFun)(),
  4977. $sqrt: (0, _math.createSqrtFun)(),
  4978. $pow: (0, _math.createPowFun)(),
  4979. $log: (0, _math.createLogFun)(),
  4980. $abs: (0, _math.createAbsFun)(),
  4981. $negate: (0, _math.createNegateFun)(),
  4982. $invert: (0, _math.createInvertFun)(),
  4983. $max: (0, _math.createMaxFun)(),
  4984. $min: (0, _math.createMinFun)()
  4985. },
  4986. $ioLib: {
  4987. $read: (0, _io.createInputFun)(),
  4988. $write: (0, _io.createOutputFun)()
  4989. },
  4990. $strLib: {
  4991. $substring: (0, _strings.createSubstringFun)(),
  4992. $length: (0, _strings.createLengthFun)(),
  4993. $uppercase: (0, _strings.createUppercaseFun)(),
  4994. $lowercase: (0, _strings.createLowercaseFun)(),
  4995. $charAt: (0, _strings.createrCharAtFun)()
  4996. },
  4997. $arrayLib: {
  4998. $numElements: (0, _arrays.createNumElementsFun)(),
  4999. $matrixLines: (0, _arrays.createMatrixLinesFun)(),
  5000. $matrixColumns: (0, _arrays.createMatrixColumnsFun)()
  5001. },
  5002. $langLib: {
  5003. $isReal: (0, _lang.createIsRealFun)(),
  5004. $isInt: (0, _lang.createIsIntFun)(),
  5005. $isBool: (0, _lang.createIsBoolFun)(),
  5006. $castReal: (0, _lang.createCastRealFun)(),
  5007. $castInt: (0, _lang.createCastIntFun)(),
  5008. $castBool: (0, _lang.createCastBoolFun)(),
  5009. $castString: (0, _lang.createCastStringFun)()
  5010. }
  5011. };
  5012. var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib);
  5013. var LanguageDefinedFunction = exports.LanguageDefinedFunction = Object.freeze({
  5014. getMainFunctionName: function getMainFunctionName() {
  5015. return _languageService.LanguageService.getCurrentLangFuncs().main_function;
  5016. },
  5017. getInternalName: function getInternalName(localName) {
  5018. if (localName.indexOf(".") !== -1) {
  5019. var names = localName.split(".");
  5020. var lib = valueToKey(names[0], _languageService.LanguageService.getCurrentLangLibs());
  5021. var internalName = valueToKey(names[1], _languageService.LanguageService.getCurrentLangFuncs());
  5022. if (lib === null || internalName === null) {
  5023. return null;
  5024. }
  5025. return lib + "." + internalName;
  5026. }
  5027. var funcName = valueToKey(localName, _languageService.LanguageService.getCurrentLangFuncs());
  5028. if (funcName !== null) {
  5029. if (funcsObject[funcName]) {
  5030. return funcName;
  5031. }
  5032. }
  5033. return null;
  5034. },
  5035. getFunction: function getFunction(internalName) {
  5036. if (internalName.indexOf(".") !== -1) {
  5037. var names = internalName.split(".");
  5038. var libName = names[0];
  5039. var funName = names[1];
  5040. return libsObject[libName][funName];
  5041. }
  5042. return funcsObject[internalName];
  5043. },
  5044. getLocalName: function getLocalName(internalName) {
  5045. if (internalName.indexOf(".") !== -1) {
  5046. var names = internalName.split(".");
  5047. var libName = _languageService.LanguageService.getCurrentLangLibs()[names[0]];
  5048. var funName = _languageService.LanguageService.getCurrentLangFuncs()[names[1]];
  5049. return libName + '.' + funName;
  5050. } else if (_languageService.LanguageService.getCurrentLangFuncs()[internalName]) {
  5051. return _languageService.LanguageService.getCurrentLangFuncs()[internalName];
  5052. } else {
  5053. return internalName;
  5054. }
  5055. }
  5056. });
  5057. /***/ }),
  5058. /***/ "./js/processor/error/processorErrorFactory.js":
  5059. /*!*****************************************************!*\
  5060. !*** ./js/processor/error/processorErrorFactory.js ***!
  5061. \*****************************************************/
  5062. /*! no static exports found */
  5063. /***/ (function(module, exports, __webpack_require__) {
  5064. "use strict";
  5065. Object.defineProperty(exports, "__esModule", {
  5066. value: true
  5067. });
  5068. exports.ProcessorErrorFactory = undefined;
  5069. var _runtimeError = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js");
  5070. var _semanticError = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js");
  5071. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  5072. var _operators = __webpack_require__(/*! ../../ast/operators */ "./js/ast/operators.js");
  5073. function translateType(type, dim) {
  5074. switch (dim) {
  5075. case 0:
  5076. return _localizedStringsService.LocalizedStrings.getUI(type);
  5077. default:
  5078. var transType = _localizedStringsService.LocalizedStrings.getUI(type);
  5079. if (dim === 1) return _localizedStringsService.LocalizedStrings.getUI("vector_string", [transType]);else return _localizedStringsService.LocalizedStrings.getUI("matrix_string", [transType]);
  5080. }
  5081. }
  5082. function translateOp(op) {
  5083. switch (op.ord) {
  5084. case _operators.Operators.AND.ord:
  5085. case _operators.Operators.OR.ord:
  5086. case _operators.Operators.NOT.ord:
  5087. return _localizedStringsService.LocalizedStrings.getUI(op.value);
  5088. default:
  5089. return op.value;
  5090. }
  5091. }
  5092. var ProcessorErrorFactory = exports.ProcessorErrorFactory = Object.freeze({
  5093. symbol_not_found_full: function symbol_not_found_full(id, sourceInfo) {
  5094. if (sourceInfo) {
  5095. var context = [id, sourceInfo.line, sourceInfo.column];
  5096. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found_full", context));
  5097. } else {
  5098. return ProcessorErrorFactory.symbol_not_found(id);
  5099. }
  5100. },
  5101. symbol_not_found: function symbol_not_found(id) {
  5102. var context = [id];
  5103. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found", context));
  5104. },
  5105. function_missing_full: function function_missing_full(id, sourceInfo) {
  5106. if (sourceInfo) {
  5107. var context = [id, sourceInfo.line, sourceInfo.column];
  5108. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing_full", context));
  5109. } else {
  5110. return ProcessorErrorFactory.function_missing(id);
  5111. }
  5112. },
  5113. function_missing: function function_missing(id) {
  5114. var context = [id];
  5115. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing", context));
  5116. },
  5117. main_missing: function main_missing() {
  5118. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("main_missing"));
  5119. }, // TODO: better urgent error message
  5120. array_dimension_not_int_full: function array_dimension_not_int_full(sourceInfo) {
  5121. if (sourceInfo) {
  5122. var context = [sourceInfo.line];
  5123. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int_full", context));
  5124. } else {
  5125. return ProcessorErrorFactory.array_dimension_not_int();
  5126. }
  5127. },
  5128. array_dimension_not_int: function array_dimension_not_int() {
  5129. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int"));
  5130. },
  5131. unknown_command_full: function unknown_command_full(sourceInfo) {
  5132. if (sourceInfo) {
  5133. var context = [sourceInfo.line];
  5134. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command_full", context));
  5135. } else {
  5136. return ProcessorErrorFactory.unknown_command();
  5137. }
  5138. },
  5139. unknown_command: function unknown_command() {
  5140. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command"));
  5141. },
  5142. incompatible_types_full: function incompatible_types_full(type, dim, sourceInfo) {
  5143. if (sourceInfo) {
  5144. var context = [translateType(type, dim), sourceInfo.line, sourceInfo.column];
  5145. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_full", context));
  5146. } else {
  5147. return ProcessorErrorFactory.incompatible_types(type, dim);
  5148. }
  5149. },
  5150. incompatible_types: function incompatible_types(type, dim) {
  5151. var context = [translateType(type, dim)];
  5152. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types", context));
  5153. },
  5154. incompatible_types_array_full: function incompatible_types_array_full(exp, type, dim, sourceInfo) {
  5155. if (sourceInfo) {
  5156. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  5157. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array_full", context));
  5158. } else {
  5159. return ProcessorErrorFactory.incompatible_types_array(exp, type, dim);
  5160. }
  5161. },
  5162. incompatible_types_array: function incompatible_types_array(exp, type, dim) {
  5163. var context = [exp, translateType(type, dim)];
  5164. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array", context));
  5165. },
  5166. loop_condition_type_full: function loop_condition_type_full(sourceInfo) {
  5167. if (sourceInfo) {
  5168. var context = [sourceInfo.line, sourceInfo.column];
  5169. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type_full", context));
  5170. } else {
  5171. return ProcessorErrorFactory.loop_condition_type();
  5172. }
  5173. },
  5174. loop_condition_type: function loop_condition_type() {
  5175. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type"));
  5176. },
  5177. endless_loop_full: function endless_loop_full(sourceInfo) {
  5178. if (sourceInfo) {
  5179. var context = [sourceInfo.line];
  5180. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop_full", context));
  5181. } else {
  5182. return ProcessorErrorFactory.endless_loop();
  5183. }
  5184. },
  5185. endless_loop: function endless_loop() {
  5186. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop"));
  5187. },
  5188. for_condition_type_full: function for_condition_type_full(sourceInfo) {
  5189. if (sourceInfo) {
  5190. var context = [sourceInfo.line, sourceInfo.column];
  5191. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type_full", context));
  5192. } else {
  5193. return ProcessorErrorFactory.for_condition_type();
  5194. }
  5195. },
  5196. for_condition_type: function for_condition_type() {
  5197. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type"));
  5198. },
  5199. if_condition_type_full: function if_condition_type_full(sourceInfo) {
  5200. if (sourceInfo) {
  5201. var context = [sourceInfo.line, sourceInfo.column];
  5202. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type_full", context));
  5203. } else {
  5204. return ProcessorErrorFactory.if_condition_type();
  5205. }
  5206. },
  5207. if_condition_type: function if_condition_type() {
  5208. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type"));
  5209. },
  5210. invalid_global_var: function invalid_global_var() {
  5211. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_global_var"));
  5212. },
  5213. not_implemented: function not_implemented(id) {
  5214. var context = [id];
  5215. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("not_implemented", context));
  5216. },
  5217. invalid_case_type_full: function invalid_case_type_full(exp, type, dim, sourceInfo) {
  5218. if (sourceInfo) {
  5219. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  5220. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type_full", context));
  5221. } else {
  5222. return ProcessorErrorFactory.invalid_case_type(exp, type, dim);
  5223. }
  5224. },
  5225. invalid_case_type: function invalid_case_type(exp, type, dim) {
  5226. var context = [exp, translateType(type, dim)];
  5227. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type", context));
  5228. },
  5229. void_in_expression_full: function void_in_expression_full(id, sourceInfo) {
  5230. if (sourceInfo) {
  5231. var context = [sourceInfo.line, sourceInfo.column, id];
  5232. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression_full", context));
  5233. } else {
  5234. return ProcessorErrorFactory.void_in_expression(id);
  5235. }
  5236. },
  5237. void_in_expression: function void_in_expression(id) {
  5238. var context = [id];
  5239. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression", context));
  5240. },
  5241. invalid_array_access_full: function invalid_array_access_full(id, sourceInfo) {
  5242. if (sourceInfo) {
  5243. var context = [id, sourceInfo.line, sourceInfo.column];
  5244. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access_full", context));
  5245. } else {
  5246. return ProcessorErrorFactory.invalid_array_access(id);
  5247. }
  5248. },
  5249. invalid_array_access: function invalid_array_access(id) {
  5250. var context = [id];
  5251. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access", context));
  5252. },
  5253. invalid_matrix_access_full: function invalid_matrix_access_full(id, sourceInfo) {
  5254. if (sourceInfo) {
  5255. var context = [id, sourceInfo.line, sourceInfo.column];
  5256. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access_full", context));
  5257. } else {
  5258. return ProcessorErrorFactory.invalid_matrix_access(id);
  5259. }
  5260. },
  5261. invalid_matrix_access: function invalid_matrix_access(id) {
  5262. var context = [id];
  5263. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access", context));
  5264. },
  5265. matrix_column_outbounds_full: function matrix_column_outbounds_full(id, value, columns, sourceInfo) {
  5266. if (sourceInfo) {
  5267. var context = [sourceInfo.line, value, id, columns];
  5268. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds_full", context));
  5269. } else {
  5270. return ProcessorErrorFactory.matrix_column_outbounds(id, value, columns);
  5271. }
  5272. },
  5273. matrix_column_outbounds: function matrix_column_outbounds(id, value, columns) {
  5274. var context = [value, id, columns];
  5275. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds", context));
  5276. },
  5277. matrix_line_outbounds_full: function matrix_line_outbounds_full(id, value, lines, sourceInfo) {
  5278. if (sourceInfo) {
  5279. var context = [sourceInfo.line, value, id, lines];
  5280. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds_full", context));
  5281. } else {
  5282. return ProcessorErrorFactory.matrix_line_outbounds(id, value, lines);
  5283. }
  5284. },
  5285. matrix_line_outbounds: function matrix_line_outbounds(id, value, lines) {
  5286. var context = [value, id, lines];
  5287. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds", context));
  5288. },
  5289. vector_line_outbounds_full: function vector_line_outbounds_full(id, value, lines, sourceInfo) {
  5290. if (sourceInfo) {
  5291. var context = [sourceInfo.line, value, id, lines];
  5292. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds_full", context));
  5293. } else {
  5294. return ProcessorErrorFactory.vector_line_outbounds(id, value, lines);
  5295. }
  5296. },
  5297. vector_line_outbounds: function vector_line_outbounds(id, value, lines) {
  5298. var context = [value, id, lines];
  5299. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds", context));
  5300. },
  5301. vector_not_matrix_full: function vector_not_matrix_full(id, sourceInfo) {
  5302. if (sourceInfo) {
  5303. var context = [sourceInfo.line, id];
  5304. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix_full", context));
  5305. } else {
  5306. return ProcessorErrorFactory.vector_not_matrix(id);
  5307. }
  5308. },
  5309. vector_not_matrix: function vector_not_matrix(id) {
  5310. var context = [id];
  5311. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix", context));
  5312. },
  5313. function_no_return: function function_no_return(id) {
  5314. var context = [id];
  5315. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_no_return", context));
  5316. },
  5317. invalid_void_return_full: function invalid_void_return_full(id, type, dim, sourceInfo) {
  5318. if (sourceInfo) {
  5319. var context = [sourceInfo.line, id, translateType(type, dim)];
  5320. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  5321. } else {
  5322. return ProcessorErrorFactory.invalid_void_return(id, type, dim);
  5323. }
  5324. },
  5325. invalid_void_return: function invalid_void_return(id, type, dim) {
  5326. var context = [id, translateType(type, dim)];
  5327. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  5328. },
  5329. invalid_return_type_full: function invalid_return_type_full(id, type, dim, sourceInfo) {
  5330. if (sourceInfo) {
  5331. var context = [sourceInfo.line, id, translateType(type, dim)];
  5332. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type_full", context));
  5333. } else {
  5334. return ProcessorErrorFactory.invalid_return_type(id, type, dim);
  5335. }
  5336. },
  5337. invalid_return_type: function invalid_return_type(id, type, dim) {
  5338. var context = [id, translateType(type, dim)];
  5339. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type", context));
  5340. },
  5341. invalid_parameters_size_full: function invalid_parameters_size_full(id, expected, actual, sourceInfo) {
  5342. if (sourceInfo) {
  5343. var context = [sourceInfo.line, id, expected, actual];
  5344. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size_full", context));
  5345. } else {
  5346. return ProcessorErrorFactory.invalid_parameters_size(id, expected, actual);
  5347. }
  5348. },
  5349. invalid_parameters_size: function invalid_parameters_size(id, expected, actual) {
  5350. var context = [id, expected, actual];
  5351. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size", context));
  5352. },
  5353. invalid_parameter_type_full: function invalid_parameter_type_full(id, exp, sourceInfo) {
  5354. if (sourceInfo) {
  5355. var context = [exp, id, sourceInfo.line];
  5356. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  5357. } else {
  5358. return ProcessorErrorFactory.invalid_parameter_type(id, exp);
  5359. }
  5360. },
  5361. invalid_parameter_type: function invalid_parameter_type(id, exp) {
  5362. var context = [exp, id];
  5363. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  5364. },
  5365. invalid_ref_full: function invalid_ref_full(id, exp, sourceInfo) {
  5366. if (sourceInfo) {
  5367. var context = [exp, id, sourceInfo.line];
  5368. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref_full", context));
  5369. } else {
  5370. return ProcessorErrorFactory.invalid_ref(id, exp);
  5371. }
  5372. },
  5373. invalid_ref: function invalid_ref(id, exp) {
  5374. var context = [exp, id];
  5375. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref", context));
  5376. },
  5377. unexpected_break_command_full: function unexpected_break_command_full(sourceInfo) {
  5378. if (sourceInfo) {
  5379. var context = [sourceInfo.line];
  5380. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command_full", context));
  5381. } else {
  5382. return ProcessorErrorFactory.unexpected_break_command();
  5383. }
  5384. },
  5385. unexpected_break_command: function unexpected_break_command() {
  5386. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command"));
  5387. },
  5388. invalid_array_literal_type_full: function invalid_array_literal_type_full(exp, sourceInfo) {
  5389. if (sourceInfo) {
  5390. var context = [sourceInfo.line, exp];
  5391. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type_full", context));
  5392. } else {
  5393. return ProcessorErrorFactory.invalid_array_literal_type(exp);
  5394. }
  5395. },
  5396. invalid_array_literal_type: function invalid_array_literal_type(exp) {
  5397. var context = [exp];
  5398. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type", context));
  5399. },
  5400. invalid_array_literal_line_full: function invalid_array_literal_line_full(expected, actual, sourceInfo) {
  5401. if (sourceInfo) {
  5402. var context = [sourceInfo.line, expected, actual];
  5403. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line_full", context));
  5404. } else {
  5405. return ProcessorErrorFactory.invalid_array_literal_type(expected, actual);
  5406. }
  5407. },
  5408. invalid_array_literal_line: function invalid_array_literal_line(expected, actual) {
  5409. var context = [expected, actual];
  5410. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line", context));
  5411. },
  5412. invalid_array_literal_column_full: function invalid_array_literal_column_full(expected, actual, sourceInfo) {
  5413. if (sourceInfo) {
  5414. var context = [sourceInfo.line, expected, actual];
  5415. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column_full", context));
  5416. } else {
  5417. return ProcessorErrorFactory.invalid_array_literal_column(expected, actual);
  5418. }
  5419. },
  5420. invalid_array_literal_column: function invalid_array_literal_column(expected, actual) {
  5421. var context = [expected, actual];
  5422. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column", context));
  5423. },
  5424. invalid_unary_op_full: function invalid_unary_op_full(opName, type, dim, sourceInfo) {
  5425. if (sourceInfo) {
  5426. var context = [sourceInfo.line, translateOp(opName), translateType(type, dim)];
  5427. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op_full", context));
  5428. } else {
  5429. return ProcessorErrorFactory.invalid_unary_op(opName, type, dim);
  5430. }
  5431. },
  5432. invalid_unary_op: function invalid_unary_op(opName, type, dim) {
  5433. var context = [translateOp(opName), translateType(type, dim)];
  5434. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op", context));
  5435. },
  5436. invalid_infix_op_full: function invalid_infix_op_full(opName, typeLeft, dimLeft, typeRight, dimRight, sourceInfo) {
  5437. if (sourceInfo) {
  5438. var context = [sourceInfo.line, translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  5439. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op_full", context));
  5440. } else {
  5441. return ProcessorErrorFactory.invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight);
  5442. }
  5443. },
  5444. invalid_infix_op: function invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight) {
  5445. var context = [translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  5446. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op", context));
  5447. },
  5448. array_dimension_not_positive_full: function array_dimension_not_positive_full(sourceInfo) {
  5449. if (sourceInfo) {
  5450. var context = [sourceInfo.line];
  5451. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive_full", context));
  5452. } else {
  5453. return ProcessorErrorFactory.array_dimension_not_positive();
  5454. }
  5455. },
  5456. array_dimension_not_positive: function array_dimension_not_positive() {
  5457. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive"));
  5458. }
  5459. });
  5460. /***/ }),
  5461. /***/ "./js/processor/error/runtimeError.js":
  5462. /*!********************************************!*\
  5463. !*** ./js/processor/error/runtimeError.js ***!
  5464. \********************************************/
  5465. /*! no static exports found */
  5466. /***/ (function(module, exports, __webpack_require__) {
  5467. "use strict";
  5468. Object.defineProperty(exports, "__esModule", {
  5469. value: true
  5470. });
  5471. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5472. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5473. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5474. var RuntimeError = exports.RuntimeError = function (_Error) {
  5475. _inherits(RuntimeError, _Error);
  5476. function RuntimeError() {
  5477. var _ref;
  5478. _classCallCheck(this, RuntimeError);
  5479. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  5480. msg[_key] = arguments[_key];
  5481. }
  5482. var _this = _possibleConstructorReturn(this, (_ref = RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).call.apply(_ref, [this].concat(msg)));
  5483. if (Error.captureStackTrace) Error.captureStackTrace(_this, RuntimeError);
  5484. return _this;
  5485. }
  5486. return RuntimeError;
  5487. }(Error);
  5488. /***/ }),
  5489. /***/ "./js/processor/error/semanticError.js":
  5490. /*!*********************************************!*\
  5491. !*** ./js/processor/error/semanticError.js ***!
  5492. \*********************************************/
  5493. /*! no static exports found */
  5494. /***/ (function(module, exports, __webpack_require__) {
  5495. "use strict";
  5496. Object.defineProperty(exports, "__esModule", {
  5497. value: true
  5498. });
  5499. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5500. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5501. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5502. var SemanticError = exports.SemanticError = function (_Error) {
  5503. _inherits(SemanticError, _Error);
  5504. function SemanticError() {
  5505. var _ref;
  5506. _classCallCheck(this, SemanticError);
  5507. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  5508. msg[_key] = arguments[_key];
  5509. }
  5510. var _this = _possibleConstructorReturn(this, (_ref = SemanticError.__proto__ || Object.getPrototypeOf(SemanticError)).call.apply(_ref, [this].concat(msg)));
  5511. if (Error.captureStackTrace) Error.captureStackTrace(_this, SemanticError);
  5512. return _this;
  5513. }
  5514. return SemanticError;
  5515. }(Error);
  5516. /***/ }),
  5517. /***/ "./js/processor/ivprogProcessor.js":
  5518. /*!*****************************************!*\
  5519. !*** ./js/processor/ivprogProcessor.js ***!
  5520. \*****************************************/
  5521. /*! no static exports found */
  5522. /***/ (function(module, exports, __webpack_require__) {
  5523. "use strict";
  5524. Object.defineProperty(exports, "__esModule", {
  5525. value: true
  5526. });
  5527. exports.IVProgProcessor = undefined;
  5528. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5529. var _store = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.js");
  5530. var _storeObject = __webpack_require__(/*! ./store/storeObject */ "./js/processor/store/storeObject.js");
  5531. var _storeObjectArray = __webpack_require__(/*! ./store/storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  5532. var _storeObjectRef = __webpack_require__(/*! ./store/storeObjectRef */ "./js/processor/store/storeObjectRef.js");
  5533. var _modes = __webpack_require__(/*! ./modes */ "./js/processor/modes.js");
  5534. var _context = __webpack_require__(/*! ./context */ "./js/processor/context.js");
  5535. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  5536. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  5537. var _definedFunctions = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js");
  5538. var _compatibilityTable = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.js");
  5539. var _commands = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js");
  5540. var Commands = _interopRequireWildcard(_commands);
  5541. var _expressions = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js");
  5542. var Expressions = _interopRequireWildcard(_expressions);
  5543. var _storeObjectArrayAddress = __webpack_require__(/*! ./store/storeObjectArrayAddress */ "./js/processor/store/storeObjectArrayAddress.js");
  5544. var _storeObjectArrayAddressRef = __webpack_require__(/*! ./store/storeObjectArrayAddressRef */ "./js/processor/store/storeObjectArrayAddressRef.js");
  5545. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  5546. var _parsers = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  5547. var _config = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  5548. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  5549. var _decimal2 = _interopRequireDefault(_decimal);
  5550. var _processorErrorFactory = __webpack_require__(/*! ./error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  5551. var _runtimeError = __webpack_require__(/*! ./error/runtimeError */ "./js/processor/error/runtimeError.js");
  5552. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5553. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  5554. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5555. var IVProgProcessor = exports.IVProgProcessor = function () {
  5556. _createClass(IVProgProcessor, null, [{
  5557. key: 'LOOP_TIMEOUT',
  5558. get: function get() {
  5559. return _config.Config.loopTimeout;
  5560. },
  5561. set: function set(ms) {
  5562. _config.Config.setConfig({ loopTimeout: ms });
  5563. }
  5564. }, {
  5565. key: 'MAIN_INTERNAL_ID',
  5566. get: function get() {
  5567. return "$main";
  5568. }
  5569. }]);
  5570. function IVProgProcessor(ast) {
  5571. _classCallCheck(this, IVProgProcessor);
  5572. this.ast = ast;
  5573. this.globalStore = new _store.Store("$global");
  5574. this.stores = [this.globalStore];
  5575. this.context = [_context.Context.BASE];
  5576. this.input = null;
  5577. this.forceKill = false;
  5578. this.loopTimers = [];
  5579. this.output = null;
  5580. }
  5581. _createClass(IVProgProcessor, [{
  5582. key: 'registerInput',
  5583. value: function registerInput(input) {
  5584. this.input = input;
  5585. }
  5586. }, {
  5587. key: 'registerOutput',
  5588. value: function registerOutput(output) {
  5589. this.output = output;
  5590. }
  5591. }, {
  5592. key: 'checkContext',
  5593. value: function checkContext(context) {
  5594. return this.context[this.context.length - 1] === context;
  5595. }
  5596. }, {
  5597. key: 'ignoreSwitchCases',
  5598. value: function ignoreSwitchCases(store) {
  5599. if (store.mode === _modes.Modes.RETURN) {
  5600. return true;
  5601. } else if (store.mode === _modes.Modes.BREAK) {
  5602. return true;
  5603. } else {
  5604. return false;
  5605. }
  5606. }
  5607. }, {
  5608. key: 'interpretAST',
  5609. value: function interpretAST() {
  5610. this.initGlobal();
  5611. var mainFunc = this.findMainFunction();
  5612. if (mainFunc === null) {
  5613. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  5614. }
  5615. return this.runFunction(mainFunc, [], this.globalStore);
  5616. }
  5617. }, {
  5618. key: 'initGlobal',
  5619. value: function initGlobal() {
  5620. var _this = this;
  5621. if (!this.checkContext(_context.Context.BASE)) {
  5622. throw _processorErrorFactory.ProcessorErrorFactory.invalid_global_var();
  5623. }
  5624. this.ast.global.forEach(function (decl) {
  5625. _this.executeCommand(_this.globalStore, decl).then(function (sto) {
  5626. return _this.globalStore = sto;
  5627. });
  5628. });
  5629. }
  5630. }, {
  5631. key: 'findMainFunction',
  5632. value: function findMainFunction() {
  5633. return this.ast.functions.find(function (v) {
  5634. return v.isMain;
  5635. });
  5636. }
  5637. }, {
  5638. key: 'findFunction',
  5639. value: function findFunction(name) {
  5640. if (name.match(/^\$.+$/)) {
  5641. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  5642. if (!!!fun) {
  5643. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  5644. }
  5645. return fun;
  5646. } else {
  5647. var val = this.ast.functions.find(function (v) {
  5648. return v.name === name;
  5649. });
  5650. if (!!!val) {
  5651. // TODO: better error message;
  5652. throw _processorErrorFactory.ProcessorErrorFactory.function_missing(name);
  5653. }
  5654. return val;
  5655. }
  5656. }
  5657. }, {
  5658. key: 'runFunction',
  5659. value: function runFunction(func, actualParameters, store) {
  5660. var _this2 = this;
  5661. var funcName = func.isMain ? IVProgProcessor.MAIN_INTERNAL_ID : func.name;
  5662. var funcStore = new _store.Store(funcName);
  5663. funcStore.extendStore(this.globalStore);
  5664. var returnStoreObject = null;
  5665. if (func.returnType instanceof _compoundType.CompoundType) {
  5666. if (func.returnType.dimensions > 1) {
  5667. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, -1, [[]]);
  5668. } else {
  5669. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, null, []);
  5670. }
  5671. } else {
  5672. returnStoreObject = new _storeObject.StoreObject(func.returnType, null);
  5673. }
  5674. funcStore.insertStore('$', returnStoreObject);
  5675. var newFuncStore$ = this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
  5676. return newFuncStore$.then(function (sto) {
  5677. _this2.context.push(_context.Context.FUNCTION);
  5678. _this2.stores.push(sto);
  5679. return _this2.executeCommands(sto, func.variablesDeclarations).then(function (stoWithVars) {
  5680. return _this2.executeCommands(stoWithVars, func.commands);
  5681. }).then(function (finalSto) {
  5682. _this2.stores.pop();
  5683. _this2.context.pop();
  5684. return finalSto;
  5685. });
  5686. });
  5687. }
  5688. }, {
  5689. key: 'associateParameters',
  5690. value: function associateParameters(formalList, actualList, callerStore, calleeStore) {
  5691. var _this3 = this;
  5692. var funcName = calleeStore.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : calleeStore.name;
  5693. if (formalList.length != actualList.length) {
  5694. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size(funcName, formalList.length, actualList.length);
  5695. }
  5696. var promises$ = actualList.map(function (actualParameter) {
  5697. return _this3.evaluateExpression(callerStore, actualParameter);
  5698. });
  5699. return Promise.all(promises$).then(function (values) {
  5700. for (var i = 0; i < values.length; i++) {
  5701. var stoObj = values[i];
  5702. var exp = actualList[i];
  5703. var formalParameter = formalList[i];
  5704. if (formalParameter.type.isCompatible(stoObj.type)) {
  5705. if (formalParameter.byRef && !stoObj.inStore) {
  5706. throw _processorErrorFactory.ProcessorErrorFactory.invalid_ref(funcName, exp.toString());
  5707. }
  5708. if (formalParameter.byRef) {
  5709. var ref = null;
  5710. if (stoObj instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  5711. ref = new _storeObjectArrayAddressRef.StoreObjectArrayAddressRef(stoObj);
  5712. } else {
  5713. ref = new _storeObjectRef.StoreObjectRef(stoObj.id, callerStore);
  5714. }
  5715. calleeStore.insertStore(formalParameter.id, ref);
  5716. } else {
  5717. var realValue = _this3.parseStoreObjectValue(stoObj);
  5718. calleeStore.insertStore(formalParameter.id, realValue);
  5719. }
  5720. } else {
  5721. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type(funcName, exp.toString());
  5722. }
  5723. }
  5724. return calleeStore;
  5725. });
  5726. }
  5727. }, {
  5728. key: 'executeCommands',
  5729. value: function executeCommands(store, cmds) {
  5730. // helper to partially apply a function, in this case executeCommand
  5731. var outerRef = this;
  5732. var partial = function partial(fun, cmd) {
  5733. return function (sto) {
  5734. return fun(sto, cmd);
  5735. };
  5736. };
  5737. return cmds.reduce(function (lastCommand, next) {
  5738. var nextCommand = partial(outerRef.executeCommand.bind(outerRef), next);
  5739. return lastCommand.then(nextCommand);
  5740. }, Promise.resolve(store));
  5741. }
  5742. }, {
  5743. key: 'executeCommand',
  5744. value: function executeCommand(store, cmd) {
  5745. if (this.forceKill) {
  5746. return Promise.reject("FORCED_KILL!");
  5747. } else if (store.mode === _modes.Modes.PAUSE) {
  5748. return Promise.resolve(this.executeCommand(store, cmd));
  5749. } else if (store.mode === _modes.Modes.RETURN) {
  5750. return Promise.resolve(store);
  5751. } else if (this.checkContext(_context.Context.BREAKABLE) && store.mode === _modes.Modes.BREAK) {
  5752. return Promise.resolve(store);
  5753. }
  5754. if (cmd instanceof Commands.Declaration) {
  5755. return this.executeDeclaration(store, cmd);
  5756. } else if (cmd instanceof Commands.ArrayIndexAssign) {
  5757. return this.executeArrayIndexAssign(store, cmd);
  5758. } else if (cmd instanceof Commands.Assign) {
  5759. return this.executeAssign(store, cmd);
  5760. } else if (cmd instanceof Commands.Break) {
  5761. return this.executeBreak(store, cmd);
  5762. } else if (cmd instanceof Commands.Return) {
  5763. return this.executeReturn(store, cmd);
  5764. } else if (cmd instanceof Commands.IfThenElse) {
  5765. return this.executeIfThenElse(store, cmd);
  5766. } else if (cmd instanceof Commands.While) {
  5767. return this.executeWhile(store, cmd);
  5768. } else if (cmd instanceof Commands.DoWhile) {
  5769. return this.executeDoWhile(store, cmd);
  5770. } else if (cmd instanceof Commands.For) {
  5771. return this.executeFor(store, cmd);
  5772. } else if (cmd instanceof Commands.Switch) {
  5773. return this.executeSwitch(store, cmd);
  5774. } else if (cmd instanceof Expressions.FunctionCall) {
  5775. return this.executeFunctionCall(store, cmd);
  5776. } else if (cmd instanceof Commands.SysCall) {
  5777. return this.executeSysCall(store, cmd);
  5778. } else {
  5779. throw _processorErrorFactory.ProcessorErrorFactory.unknown_command(cmd.sourceInfo);
  5780. }
  5781. }
  5782. }, {
  5783. key: 'executeSysCall',
  5784. value: function executeSysCall(store, cmd) {
  5785. var func = cmd.langFunc.bind(this);
  5786. return func(store, cmd);
  5787. }
  5788. }, {
  5789. key: 'executeFunctionCall',
  5790. value: function executeFunctionCall(store, cmd) {
  5791. var func = null;
  5792. if (cmd.isMainCall) {
  5793. func = this.findMainFunction();
  5794. } else {
  5795. func = this.findFunction(cmd.id);
  5796. }
  5797. return this.runFunction(func, cmd.actualParameters, store).then(function (sto) {
  5798. if (!_types.Types.VOID.isCompatible(func.returnType) && sto.mode !== _modes.Modes.RETURN) {
  5799. var funcName = func.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : func.name;
  5800. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.function_no_return(funcName));
  5801. } else {
  5802. return store;
  5803. }
  5804. });
  5805. }
  5806. }, {
  5807. key: 'executeSwitch',
  5808. value: function executeSwitch(store, cmd) {
  5809. var _this4 = this;
  5810. this.context.push(_context.Context.BREAKABLE);
  5811. var auxCaseFun = function auxCaseFun(promise, switchExp, aCase) {
  5812. return promise.then(function (result) {
  5813. var sto = result.sto;
  5814. if (_this4.ignoreSwitchCases(sto)) {
  5815. return Promise.resolve(result);
  5816. } else if (result.wasTrue || aCase.isDefault) {
  5817. var $newSto = _this4.executeCommands(result.sto, aCase.commands);
  5818. return $newSto.then(function (nSto) {
  5819. return Promise.resolve({ wasTrue: true, sto: nSto });
  5820. });
  5821. } else {
  5822. var $value = _this4.evaluateExpression(sto, new Expressions.InfixApp(_operators.Operators.EQ, switchExp, aCase.expression));
  5823. return $value.then(function (vl) {
  5824. if (vl.value) {
  5825. var _$newSto = _this4.executeCommands(result.sto, aCase.commands);
  5826. return _$newSto.then(function (nSto) {
  5827. return Promise.resolve({ wasTrue: true, sto: nSto });
  5828. });
  5829. } else {
  5830. return Promise.resolve({ wasTrue: false, sto: sto });
  5831. }
  5832. });
  5833. }
  5834. });
  5835. };
  5836. try {
  5837. var breakLoop = false;
  5838. var $result = Promise.resolve({ wasTrue: false, sto: store });
  5839. for (var index = 0; index < cmd.cases.length && !breakLoop; index++) {
  5840. var aCase = cmd.cases[index];
  5841. $result = auxCaseFun($result, cmd.expression, aCase);
  5842. $result.then(function (r) {
  5843. return breakLoop = _this4.ignoreSwitchCases(r.sto);
  5844. });
  5845. }
  5846. return $result.then(function (r) {
  5847. _this4.context.pop();
  5848. if (r.sto.mode === _modes.Modes.BREAK) {
  5849. r.sto.mode = _modes.Modes.RUN;
  5850. }
  5851. return r.sto;
  5852. });
  5853. } catch (error) {
  5854. return Promise.reject(error);
  5855. }
  5856. }
  5857. }, {
  5858. key: 'executeFor',
  5859. value: function executeFor(store, cmd) {
  5860. try {
  5861. //BEGIN for -> while rewrite
  5862. var initCmd = cmd.assignment;
  5863. var condition = cmd.condition;
  5864. var increment = cmd.increment;
  5865. var whileBlock = new Commands.CommandBlock([], cmd.commands.concat(increment));
  5866. var forAsWhile = new Commands.While(condition, whileBlock);
  5867. //END for -> while rewrite
  5868. var newCmdList = [initCmd, forAsWhile];
  5869. return this.executeCommands(store, newCmdList);
  5870. } catch (error) {
  5871. return Promise.reject(error);
  5872. }
  5873. }
  5874. }, {
  5875. key: 'executeDoWhile',
  5876. value: function executeDoWhile(store, cmd) {
  5877. var outerRef = this;
  5878. try {
  5879. outerRef.loopTimers.push(Date.now());
  5880. outerRef.context.push(_context.Context.BREAKABLE);
  5881. var $newStore = outerRef.executeCommands(store, cmd.commands);
  5882. return $newStore.then(function (sto) {
  5883. if (sto.mode === _modes.Modes.BREAK) {
  5884. outerRef.context.pop();
  5885. sto.mode = _modes.Modes.RUN;
  5886. outerRef.loopTimers.pop();
  5887. return sto;
  5888. }
  5889. var $value = outerRef.evaluateExpression(sto, cmd.expression);
  5890. return $value.then(function (vl) {
  5891. if (!vl.type.isCompatible(_types.Types.BOOLEAN)) {
  5892. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
  5893. }
  5894. if (vl.value) {
  5895. outerRef.context.pop();
  5896. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  5897. var time = outerRef.loopTimers[i];
  5898. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  5899. outerRef.forceKill = true;
  5900. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  5901. }
  5902. }
  5903. return outerRef.executeCommand(sto, cmd);
  5904. } else {
  5905. outerRef.context.pop();
  5906. outerRef.loopTimers.pop();
  5907. return sto;
  5908. }
  5909. });
  5910. });
  5911. } catch (error) {
  5912. return Promise.reject(error);
  5913. }
  5914. }
  5915. }, {
  5916. key: 'executeWhile',
  5917. value: function executeWhile(store, cmd) {
  5918. var outerRef = this;
  5919. try {
  5920. outerRef.loopTimers.push(Date.now());
  5921. outerRef.context.push(_context.Context.BREAKABLE);
  5922. var $value = outerRef.evaluateExpression(store, cmd.expression);
  5923. return $value.then(function (vl) {
  5924. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  5925. if (vl.value) {
  5926. var $newStore = outerRef.executeCommands(store, cmd.commands);
  5927. return $newStore.then(function (sto) {
  5928. outerRef.context.pop();
  5929. if (sto.mode === _modes.Modes.BREAK) {
  5930. outerRef.loopTimers.pop();
  5931. sto.mode = _modes.Modes.RUN;
  5932. return sto;
  5933. }
  5934. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  5935. var time = outerRef.loopTimers[i];
  5936. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  5937. outerRef.forceKill = true;
  5938. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  5939. }
  5940. }
  5941. return outerRef.executeCommand(sto, cmd);
  5942. });
  5943. } else {
  5944. outerRef.context.pop();
  5945. outerRef.loopTimers.pop();
  5946. return store;
  5947. }
  5948. } else {
  5949. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
  5950. }
  5951. });
  5952. } catch (error) {
  5953. return Promise.reject(error);
  5954. }
  5955. }
  5956. }, {
  5957. key: 'executeIfThenElse',
  5958. value: function executeIfThenElse(store, cmd) {
  5959. var _this5 = this;
  5960. try {
  5961. var $value = this.evaluateExpression(store, cmd.condition);
  5962. return $value.then(function (vl) {
  5963. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  5964. if (vl.value) {
  5965. return _this5.executeCommands(store, cmd.ifTrue.commands);
  5966. } else if (cmd.ifFalse !== null) {
  5967. if (cmd.ifFalse instanceof Commands.IfThenElse) {
  5968. return _this5.executeCommand(store, cmd.ifFalse);
  5969. } else {
  5970. return _this5.executeCommands(store, cmd.ifFalse.commands);
  5971. }
  5972. } else {
  5973. return Promise.resolve(store);
  5974. }
  5975. } else {
  5976. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo));
  5977. }
  5978. });
  5979. } catch (error) {
  5980. return Promise.reject(error);
  5981. }
  5982. }
  5983. }, {
  5984. key: 'executeReturn',
  5985. value: function executeReturn(store, cmd) {
  5986. var _this6 = this;
  5987. try {
  5988. var funcType = store.applyStore('$').type;
  5989. var $value = this.evaluateExpression(store, cmd.expression);
  5990. var funcName = store.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : store.name;
  5991. return $value.then(function (vl) {
  5992. if (vl === null && funcType.isCompatible(_types.Types.VOID)) {
  5993. return Promise.resolve(store);
  5994. }
  5995. if (vl === null || !funcType.isCompatible(vl.type)) {
  5996. var stringInfo = funcType.stringInfo();
  5997. var info = stringInfo[0];
  5998. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, info.type, info.dim, cmd.sourceInfo));
  5999. } else {
  6000. var realValue = _this6.parseStoreObjectValue(vl);
  6001. store.updateStore('$', realValue);
  6002. store.mode = _modes.Modes.RETURN;
  6003. return Promise.resolve(store);
  6004. }
  6005. });
  6006. } catch (error) {
  6007. return Promise.reject(error);
  6008. }
  6009. }
  6010. }, {
  6011. key: 'executeBreak',
  6012. value: function executeBreak(store, cmd) {
  6013. if (this.checkContext(_context.Context.BREAKABLE)) {
  6014. store.mode = _modes.Modes.BREAK;
  6015. return Promise.resolve(store);
  6016. } else {
  6017. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.unexpected_break_command_full(cmd.sourceInfo));
  6018. }
  6019. }
  6020. }, {
  6021. key: 'executeAssign',
  6022. value: function executeAssign(store, cmd) {
  6023. var _this7 = this;
  6024. try {
  6025. var $value = this.evaluateExpression(store, cmd.expression);
  6026. return $value.then(function (vl) {
  6027. var realValue = _this7.parseStoreObjectValue(vl);
  6028. store.updateStore(cmd.id, realValue);
  6029. return store;
  6030. });
  6031. } catch (error) {
  6032. return Promise.reject(error);
  6033. }
  6034. }
  6035. }, {
  6036. key: 'executeArrayIndexAssign',
  6037. value: function executeArrayIndexAssign(store, cmd) {
  6038. var _this8 = this;
  6039. var mustBeArray = store.applyStore(cmd.id);
  6040. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  6041. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo));
  6042. }
  6043. var line$ = this.evaluateExpression(store, cmd.line);
  6044. var column$ = this.evaluateExpression(store, cmd.column);
  6045. var value$ = this.evaluateExpression(store, cmd.expression);
  6046. return Promise.all([line$, column$, value$]).then(function (results) {
  6047. var lineSO = results[0];
  6048. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  6049. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  6050. }
  6051. var line = lineSO.number;
  6052. var columnSO = results[1];
  6053. var column = null;
  6054. if (columnSO !== null) {
  6055. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  6056. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  6057. }
  6058. column = columnSO.number;
  6059. }
  6060. var value = _this8.parseStoreObjectValue(results[2]);
  6061. if (line >= mustBeArray.lines) {
  6062. if (mustBeArray.isVector) {
  6063. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  6064. } else {
  6065. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  6066. }
  6067. } else if (line < 0) {
  6068. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  6069. }
  6070. if (column !== null && mustBeArray.columns === null) {
  6071. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(cmd.id, cmd.sourceInfo));
  6072. }
  6073. if (column !== null) {
  6074. if (column >= mustBeArray.columns) {
  6075. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(cmd.id, column, mustBeArray.columns, cmd.sourceInfo));
  6076. } else if (column < 0) {
  6077. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  6078. }
  6079. }
  6080. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), mustBeArray);
  6081. if (column !== null) {
  6082. if (value.type instanceof _compoundType.CompoundType) {
  6083. var type = mustBeArray.type.innerType;
  6084. var stringInfo = type.stringInfo();
  6085. var info = stringInfo[0];
  6086. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  6087. }
  6088. newArray.value[line].value[column] = value;
  6089. store.updateStore(cmd.id, newArray);
  6090. } else {
  6091. if (mustBeArray.columns !== null && value.type instanceof _compoundType.CompoundType) {
  6092. var _type = mustBeArray.type;
  6093. var _stringInfo = _type.stringInfo();
  6094. var _info = _stringInfo[0];
  6095. var exp = cmd.expression.toString();
  6096. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(exp, _info.type, _info.dim - 1, cmd.sourceInfo));
  6097. }
  6098. newArray.value[line] = value;
  6099. store.updateStore(cmd.id, newArray);
  6100. }
  6101. return store;
  6102. });
  6103. }
  6104. }, {
  6105. key: 'executeDeclaration',
  6106. value: function executeDeclaration(store, cmd) {
  6107. try {
  6108. var $value = this.evaluateExpression(store, cmd.initial);
  6109. if (cmd instanceof Commands.ArrayDeclaration) {
  6110. var $lines = this.evaluateExpression(store, cmd.lines);
  6111. var $columns = cmd.columns === null ? null : this.evaluateExpression(store, cmd.columns);
  6112. return Promise.all([$lines, $columns, $value]).then(function (values) {
  6113. var lineSO = values[0];
  6114. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  6115. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  6116. }
  6117. var line = lineSO.number;
  6118. if (line < 0) {
  6119. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  6120. }
  6121. var columnSO = values[1];
  6122. var column = null;
  6123. if (columnSO !== null) {
  6124. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  6125. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  6126. }
  6127. column = columnSO.number;
  6128. if (column < 0) {
  6129. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  6130. }
  6131. }
  6132. var value = values[2];
  6133. var temp = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, null);
  6134. store.insertStore(cmd.id, temp);
  6135. var realValue = value;
  6136. if (value !== null) {
  6137. if (value instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  6138. if (value.type instanceof _compoundType.CompoundType) {
  6139. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), value.refValue);
  6140. } else {
  6141. realValue = Object.assign(new _storeObject.StoreObject(null, null), value.refValue);
  6142. }
  6143. }
  6144. } else {
  6145. realValue = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, []);
  6146. if (column !== null) {
  6147. for (var i = 0; i < line; i++) {
  6148. realValue.value.push(new _storeObjectArray.StoreObjectArray(new _compoundType.CompoundType(cmd.type.innerType, 1), column, null, []));
  6149. }
  6150. }
  6151. }
  6152. realValue.readOnly = cmd.isConst;
  6153. store.updateStore(cmd.id, realValue);
  6154. return store;
  6155. });
  6156. } else {
  6157. var temp = new _storeObject.StoreObject(cmd.type, null);
  6158. store.insertStore(cmd.id, temp);
  6159. return $value.then(function (vl) {
  6160. var realValue = vl;
  6161. if (vl !== null) {
  6162. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  6163. if (vl.type instanceof _compoundType.CompoundType) {
  6164. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), vl.refValue);
  6165. } else {
  6166. realValue = Object.assign(new _storeObject.StoreObject(null, null), vl.refValue);
  6167. }
  6168. }
  6169. } else {
  6170. realValue = new _storeObject.StoreObject(cmd.type, 0);
  6171. }
  6172. realValue.readOnly = cmd.isConst;
  6173. store.updateStore(cmd.id, realValue);
  6174. return store;
  6175. });
  6176. }
  6177. } catch (e) {
  6178. return Promise.reject(e);
  6179. }
  6180. }
  6181. }, {
  6182. key: 'evaluateExpression',
  6183. value: function evaluateExpression(store, exp) {
  6184. if (exp instanceof Expressions.UnaryApp) {
  6185. return this.evaluateUnaryApp(store, exp);
  6186. } else if (exp instanceof Expressions.InfixApp) {
  6187. return this.evaluateInfixApp(store, exp);
  6188. } else if (exp instanceof Expressions.ArrayAccess) {
  6189. return this.evaluateArrayAccess(store, exp);
  6190. } else if (exp instanceof Expressions.VariableLiteral) {
  6191. return this.evaluateVariableLiteral(store, exp);
  6192. } else if (exp instanceof Expressions.IntLiteral) {
  6193. return this.evaluateLiteral(store, exp);
  6194. } else if (exp instanceof Expressions.RealLiteral) {
  6195. return this.evaluateLiteral(store, exp);
  6196. } else if (exp instanceof Expressions.BoolLiteral) {
  6197. return this.evaluateLiteral(store, exp);
  6198. } else if (exp instanceof Expressions.StringLiteral) {
  6199. return this.evaluateLiteral(store, exp);
  6200. } else if (exp instanceof Expressions.ArrayLiteral) {
  6201. return this.evaluateArrayLiteral(store, exp);
  6202. } else if (exp instanceof Expressions.FunctionCall) {
  6203. return this.evaluateFunctionCall(store, exp);
  6204. }
  6205. return Promise.resolve(null);
  6206. }
  6207. }, {
  6208. key: 'evaluateFunctionCall',
  6209. value: function evaluateFunctionCall(store, exp) {
  6210. if (exp.isMainCall) {
  6211. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), exp.sourceInfo));
  6212. }
  6213. var func = this.findFunction(exp.id);
  6214. if (_types.Types.VOID.isCompatible(func.returnType)) {
  6215. // TODO: better error message
  6216. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(exp.id, exp.sourceInfo));
  6217. }
  6218. var $newStore = this.runFunction(func, exp.actualParameters, store);
  6219. return $newStore.then(function (sto) {
  6220. if (sto.mode !== _modes.Modes.RETURN) {
  6221. return Promise.reject(new Error("The function that was called did not had a return command: " + exp.id));
  6222. }
  6223. var val = sto.applyStore('$');
  6224. if (val instanceof _storeObjectArray.StoreObjectArray) {
  6225. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null, null), val));
  6226. } else {
  6227. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  6228. }
  6229. });
  6230. }
  6231. }, {
  6232. key: 'evaluateArrayLiteral',
  6233. value: function evaluateArrayLiteral(store, exp) {
  6234. var errorHelperFunction = function errorHelperFunction(validationResult, exp) {
  6235. var errorCode = validationResult[0];
  6236. switch (errorCode) {
  6237. case _storeObjectArray.StoreObjectArray.WRONG_COLUMN_NUMBER:
  6238. {
  6239. var columnValue = validationResult[1];
  6240. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_column_full(arr.columns, columnValue, exp.sourceInfo));
  6241. }
  6242. case _storeObjectArray.StoreObjectArray.WRONG_LINE_NUMBER:
  6243. {
  6244. var lineValue = validationResult[1];
  6245. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_line_full(arr.lines, lineValue, exp.sourceInfo));
  6246. }
  6247. case _storeObjectArray.StoreObjectArray.WRONG_TYPE:
  6248. {
  6249. var line = null;
  6250. var strExp = null;
  6251. if (validationResult.length > 2) {
  6252. line = validationResult[1];
  6253. var column = validationResult[2];
  6254. strExp = exp.value[line].value[column].toString();
  6255. } else {
  6256. line = validationResult[1];
  6257. strExp = exp.value[line].toString();
  6258. }
  6259. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_type_full(strExp, exp.sourceInfo));
  6260. }
  6261. }
  6262. };
  6263. if (!exp.isVector) {
  6264. var $matrix = this.evaluateMatrix(store, exp.value);
  6265. return $matrix.then(function (list) {
  6266. var type = new _compoundType.CompoundType(list[0].type.innerType, 2);
  6267. var arr = new _storeObjectArray.StoreObjectArray(type, list.length, list[0].lines, list);
  6268. var checkResult = arr.isValid;
  6269. if (checkResult.length == 0) return Promise.resolve(arr);else {
  6270. return errorHelperFunction(checkResult, exp);
  6271. }
  6272. });
  6273. } else {
  6274. return this.evaluateVector(store, exp.value).then(function (list) {
  6275. var type = new _compoundType.CompoundType(list[0].type, 1);
  6276. var stoArray = new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  6277. var checkResult = stoArray.isValid;
  6278. if (checkResult.length == 0) return Promise.resolve(stoArray);else {
  6279. return errorHelperFunction(checkResult, exp);
  6280. }
  6281. });
  6282. }
  6283. }
  6284. }, {
  6285. key: 'evaluateVector',
  6286. value: function evaluateVector(store, exps) {
  6287. var _this9 = this;
  6288. return Promise.all(exps.map(function (exp) {
  6289. return _this9.evaluateExpression(store, exp);
  6290. }));
  6291. }
  6292. }, {
  6293. key: 'evaluateMatrix',
  6294. value: function evaluateMatrix(store, exps) {
  6295. var _this10 = this;
  6296. return Promise.all(exps.map(function (vector) {
  6297. var $vector = _this10.evaluateVector(store, vector.value);
  6298. return $vector.then(function (list) {
  6299. var type = new _compoundType.CompoundType(list[0].type, 1);
  6300. return new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  6301. });
  6302. }));
  6303. }
  6304. }, {
  6305. key: 'evaluateLiteral',
  6306. value: function evaluateLiteral(_, exp) {
  6307. return Promise.resolve(new _storeObject.StoreObject(exp.type, exp.value));
  6308. }
  6309. }, {
  6310. key: 'evaluateVariableLiteral',
  6311. value: function evaluateVariableLiteral(store, exp) {
  6312. try {
  6313. var val = store.applyStore(exp.id);
  6314. if (val instanceof _storeObjectArray.StoreObjectArray) {
  6315. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null), val));
  6316. } else {
  6317. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  6318. }
  6319. } catch (error) {
  6320. return Promise.reject(error);
  6321. }
  6322. }
  6323. }, {
  6324. key: 'evaluateArrayAccess',
  6325. value: function evaluateArrayAccess(store, exp) {
  6326. var mustBeArray = store.applyStore(exp.id);
  6327. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  6328. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(exp.id, exp.sourceInfo));
  6329. }
  6330. var $line = this.evaluateExpression(store, exp.line);
  6331. var $column = this.evaluateExpression(store, exp.column);
  6332. return Promise.all([$line, $column]).then(function (values) {
  6333. var lineSO = values[0];
  6334. var columnSO = values[1];
  6335. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  6336. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  6337. }
  6338. var line = lineSO.number;
  6339. var column = null;
  6340. if (columnSO !== null) {
  6341. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  6342. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  6343. }
  6344. column = columnSO.number;
  6345. }
  6346. if (line >= mustBeArray.lines) {
  6347. if (mustBeArray.isVector) {
  6348. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  6349. } else {
  6350. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  6351. }
  6352. } else if (line < 0) {
  6353. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  6354. }
  6355. if (column !== null && mustBeArray.columns === null) {
  6356. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(exp.id, exp.sourceInfo));
  6357. }
  6358. if (column !== null) {
  6359. if (column >= mustBeArray.columns) {
  6360. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(exp.id, column, mustBeArray.columns, exp.sourceInfo));
  6361. } else if (column < 0) {
  6362. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  6363. }
  6364. }
  6365. return Promise.resolve(new _storeObjectArrayAddress.StoreObjectArrayAddress(mustBeArray.id, line, column, store));
  6366. });
  6367. }
  6368. }, {
  6369. key: 'evaluateUnaryApp',
  6370. value: function evaluateUnaryApp(store, unaryApp) {
  6371. var $left = this.evaluateExpression(store, unaryApp.left);
  6372. return $left.then(function (left) {
  6373. var resultType = (0, _compatibilityTable.resultTypeAfterUnaryOp)(unaryApp.op, left.type);
  6374. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  6375. var stringInfo = left.type.stringInfo();
  6376. var info = stringInfo[0];
  6377. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_unary_op_full(unaryApp.op, info.type, info.dim, unaryApp.sourceInfo));
  6378. }
  6379. switch (unaryApp.op.ord) {
  6380. case _operators.Operators.ADD.ord:
  6381. return new _storeObject.StoreObject(resultType, left.value);
  6382. case _operators.Operators.SUB.ord:
  6383. return new _storeObject.StoreObject(resultType, left.value.negated());
  6384. case _operators.Operators.NOT.ord:
  6385. return new _storeObject.StoreObject(resultType, !left.value);
  6386. default:
  6387. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid UnaryApp ' + unaryApp.op));
  6388. }
  6389. });
  6390. }
  6391. }, {
  6392. key: 'evaluateInfixApp',
  6393. value: function evaluateInfixApp(store, infixApp) {
  6394. var $left = this.evaluateExpression(store, infixApp.left);
  6395. var $right = this.evaluateExpression(store, infixApp.right);
  6396. return Promise.all([$left, $right]).then(function (values) {
  6397. var left = values[0];
  6398. var right = values[1];
  6399. var resultType = (0, _compatibilityTable.resultTypeAfterInfixOp)(infixApp.op, left.type, right.type);
  6400. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  6401. var stringInfoLeft = left.type.stringInfo();
  6402. var infoLeft = stringInfoLeft[0];
  6403. var stringInfoRight = right.type.stringInfo();
  6404. var infoRight = stringInfoRight[0];
  6405. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_infix_op_full(infixApp.op, infoLeft.type, infoLeft.dim, infoRight.type, infoRight.dim, infixApp.sourceInfo));
  6406. }
  6407. var result = null;
  6408. switch (infixApp.op.ord) {
  6409. case _operators.Operators.ADD.ord:
  6410. {
  6411. if (_types.Types.STRING.isCompatible(left.type)) {
  6412. var rightStr = (0, _parsers.convertToString)(right.value, right.type);
  6413. return new _storeObject.StoreObject(resultType, left.value + rightStr);
  6414. } else if (_types.Types.STRING.isCompatible(right.type)) {
  6415. var leftStr = (0, _parsers.convertToString)(left.value, left.type);
  6416. return new _storeObject.StoreObject(resultType, leftStr + right.value);
  6417. } else {
  6418. return new _storeObject.StoreObject(resultType, left.value.plus(right.value));
  6419. }
  6420. }
  6421. case _operators.Operators.SUB.ord:
  6422. return new _storeObject.StoreObject(resultType, left.value.minus(right.value));
  6423. case _operators.Operators.MULT.ord:
  6424. {
  6425. result = left.value.times(right.value);
  6426. if (result.dp() > _config.Config.decimalPlaces) {
  6427. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  6428. }
  6429. return new _storeObject.StoreObject(resultType, result);
  6430. }
  6431. case _operators.Operators.DIV.ord:
  6432. {
  6433. if (_types.Types.INTEGER.isCompatible(resultType)) result = left.value.divToInt(right.value);else result = left.value.div(right.value);
  6434. if (result.dp() > _config.Config.decimalPlaces) {
  6435. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  6436. }
  6437. return new _storeObject.StoreObject(resultType, result);
  6438. }
  6439. case _operators.Operators.MOD.ord:
  6440. {
  6441. result = left.value.modulo(right.value);
  6442. if (result.dp() > _config.Config.decimalPlaces) {
  6443. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  6444. }
  6445. return new _storeObject.StoreObject(resultType, result);
  6446. }
  6447. case _operators.Operators.GT.ord:
  6448. {
  6449. if (_types.Types.STRING.isCompatible(left.type)) {
  6450. result = left.value.length > right.value.length;
  6451. } else {
  6452. result = left.value.gt(right.value);
  6453. }
  6454. return new _storeObject.StoreObject(resultType, result);
  6455. }
  6456. case _operators.Operators.GE.ord:
  6457. {
  6458. if (_types.Types.STRING.isCompatible(left.type)) {
  6459. result = left.value.length >= right.value.length;
  6460. } else {
  6461. result = left.value.gte(right.value);
  6462. }
  6463. return new _storeObject.StoreObject(resultType, result);
  6464. }
  6465. case _operators.Operators.LT.ord:
  6466. {
  6467. if (_types.Types.STRING.isCompatible(left.type)) {
  6468. result = left.value.length < right.value.length;
  6469. } else {
  6470. result = left.value.lt(right.value);
  6471. }
  6472. return new _storeObject.StoreObject(resultType, result);
  6473. }
  6474. case _operators.Operators.LE.ord:
  6475. {
  6476. if (_types.Types.STRING.isCompatible(left.type)) {
  6477. result = left.value.length <= right.value.length;
  6478. } else {
  6479. result = left.value.lte(right.value);
  6480. }
  6481. return new _storeObject.StoreObject(resultType, result);
  6482. }
  6483. case _operators.Operators.EQ.ord:
  6484. {
  6485. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  6486. result = left.value.eq(right.value);
  6487. } else {
  6488. result = left.value === right.value;
  6489. }
  6490. return new _storeObject.StoreObject(resultType, result);
  6491. }
  6492. case _operators.Operators.NEQ.ord:
  6493. {
  6494. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  6495. result = !left.value.eq(right.value);
  6496. } else {
  6497. result = left.value !== right.value;
  6498. }
  6499. return new _storeObject.StoreObject(resultType, result);
  6500. }
  6501. case _operators.Operators.AND.ord:
  6502. return new _storeObject.StoreObject(resultType, left.value && right.value);
  6503. case _operators.Operators.OR.ord:
  6504. return new _storeObject.StoreObject(resultType, left.value || right.value);
  6505. default:
  6506. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid InfixApp ' + infixApp.op));
  6507. }
  6508. });
  6509. }
  6510. }, {
  6511. key: 'parseStoreObjectValue',
  6512. value: function parseStoreObjectValue(vl) {
  6513. var realValue = vl;
  6514. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  6515. if (vl.type instanceof _compoundType.CompoundType) {
  6516. switch (vl.type.dimensions) {
  6517. case 1:
  6518. {
  6519. realValue = new _storeObjectArray.StoreObjectArray(vl.type, vl.value);
  6520. break;
  6521. }
  6522. default:
  6523. {
  6524. throw new _runtimeError.RuntimeError("Three dimensional array address...");
  6525. }
  6526. }
  6527. } else {
  6528. realValue = new _storeObject.StoreObject(vl.type, vl.value);
  6529. }
  6530. }
  6531. return realValue;
  6532. }
  6533. }]);
  6534. return IVProgProcessor;
  6535. }();
  6536. /***/ }),
  6537. /***/ "./js/processor/lib/arrays.js":
  6538. /*!************************************!*\
  6539. !*** ./js/processor/lib/arrays.js ***!
  6540. \************************************/
  6541. /*! no static exports found */
  6542. /***/ (function(module, exports, __webpack_require__) {
  6543. "use strict";
  6544. Object.defineProperty(exports, "__esModule", {
  6545. value: true
  6546. });
  6547. exports.createNumElementsFun = createNumElementsFun;
  6548. exports.createMatrixLinesFun = createMatrixLinesFun;
  6549. exports.createMatrixColumnsFun = createMatrixColumnsFun;
  6550. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  6551. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  6552. var Commands = _interopRequireWildcard(_commands);
  6553. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  6554. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6555. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  6556. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  6557. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6558. /**
  6559. * num_elements
  6560. * matrix_lines
  6561. * matrix_columns
  6562. */
  6563. function createNumElementsFun() {
  6564. var numElementsFun = function numElementsFun(sto, _) {
  6565. var vector = sto.applyStore("vector");
  6566. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(vector.lines));
  6567. sto.mode = _modes.Modes.RETURN;
  6568. return Promise.resolve(sto.updateStore("$", temp));
  6569. };
  6570. var block = new Commands.CommandBlock([], [new Commands.SysCall(numElementsFun)]);
  6571. var func = new Commands.Function('$numElements', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 1), 'vector', false)], block);
  6572. return func;
  6573. }
  6574. function createMatrixLinesFun() {
  6575. var matrixLinesFun = function matrixLinesFun(sto, _) {
  6576. var matrix = sto.applyStore("matrix");
  6577. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.lines));
  6578. sto.mode = _modes.Modes.RETURN;
  6579. return Promise.resolve(sto.updateStore("$", temp));
  6580. };
  6581. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixLinesFun)]);
  6582. var func = new Commands.Function('$matrixLines', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  6583. return func;
  6584. }
  6585. function createMatrixColumnsFun() {
  6586. var matrixColumnsFun = function matrixColumnsFun(sto, _) {
  6587. var matrix = sto.applyStore("matrix");
  6588. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.columns));
  6589. sto.mode = _modes.Modes.RETURN;
  6590. return Promise.resolve(sto.updateStore("$", temp));
  6591. };
  6592. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixColumnsFun)]);
  6593. var func = new Commands.Function('$matrixColumns', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  6594. return func;
  6595. }
  6596. /***/ }),
  6597. /***/ "./js/processor/lib/io.js":
  6598. /*!********************************!*\
  6599. !*** ./js/processor/lib/io.js ***!
  6600. \********************************/
  6601. /*! no static exports found */
  6602. /***/ (function(module, exports, __webpack_require__) {
  6603. "use strict";
  6604. Object.defineProperty(exports, "__esModule", {
  6605. value: true
  6606. });
  6607. exports.createOutputFun = createOutputFun;
  6608. exports.createInputFun = createInputFun;
  6609. var _storeObject = __webpack_require__(/*! ./../store/storeObject */ "./js/processor/store/storeObject.js");
  6610. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  6611. var Commands = _interopRequireWildcard(_commands);
  6612. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6613. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  6614. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6615. function createOutputFun() {
  6616. var writeFunction = function writeFunction(store, _) {
  6617. var val = store.applyStore('p1');
  6618. if (val.type.isCompatible(_types.Types.INTEGER)) {
  6619. this.output.sendOutput(val.value.toString());
  6620. } else if (val.type.isCompatible(_types.Types.REAL)) {
  6621. if (val.value.dp() <= 0) {
  6622. this.output.sendOutput(val.value.toFixed(1));
  6623. } else {
  6624. this.output.sendOutput(val.value.toString());
  6625. }
  6626. } else {
  6627. this.output.sendOutput(val.value);
  6628. }
  6629. return Promise.resolve(store);
  6630. };
  6631. var block = new Commands.CommandBlock([], [new Commands.SysCall(writeFunction)]);
  6632. var func = new Commands.Function('$write', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', false)], block);
  6633. return func;
  6634. }
  6635. function createInputFun() {
  6636. var readFunction = function readFunction(store, _) {
  6637. var _this = this;
  6638. var request = new Promise(function (resolve, _) {
  6639. _this.input.requestInput(resolve);
  6640. });
  6641. return request.then(function (text) {
  6642. var typeToConvert = store.applyStore('p1').type;
  6643. var stoObj = null;
  6644. if (typeToConvert.isCompatible(_types.Types.INTEGER)) {
  6645. var val = (0, _parsers.toInt)(text);
  6646. stoObj = new _storeObject.StoreObject(_types.Types.INTEGER, val);
  6647. } else if (typeToConvert.isCompatible(_types.Types.REAL)) {
  6648. stoObj = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(text));
  6649. } else if (typeToConvert.isCompatible(_types.Types.BOOLEAN)) {
  6650. stoObj = new _storeObject.StoreObject(_types.Types.BOOLEAN, (0, _parsers.toBool)(text));
  6651. } else if (typeToConvert.isCompatible(_types.Types.STRING)) {
  6652. stoObj = new _storeObject.StoreObject(_types.Types.STRING, (0, _parsers.toString)(text));
  6653. }
  6654. _this.loopTimers.splice(0, _this.loopTimers.length);
  6655. store.updateStore('p1', stoObj);
  6656. return Promise.resolve(store);
  6657. });
  6658. };
  6659. var block = new Commands.CommandBlock([], [new Commands.SysCall(readFunction)]);
  6660. var func = new Commands.Function('$read', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', true)], block);
  6661. return func;
  6662. }
  6663. /***/ }),
  6664. /***/ "./js/processor/lib/lang.js":
  6665. /*!**********************************!*\
  6666. !*** ./js/processor/lib/lang.js ***!
  6667. \**********************************/
  6668. /*! no static exports found */
  6669. /***/ (function(module, exports, __webpack_require__) {
  6670. "use strict";
  6671. Object.defineProperty(exports, "__esModule", {
  6672. value: true
  6673. });
  6674. exports.createIsRealFun = createIsRealFun;
  6675. exports.createIsIntFun = createIsIntFun;
  6676. exports.createIsBoolFun = createIsBoolFun;
  6677. exports.createCastRealFun = createCastRealFun;
  6678. exports.createCastIntFun = createCastIntFun;
  6679. exports.createCastBoolFun = createCastBoolFun;
  6680. exports.createCastStringFun = createCastStringFun;
  6681. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  6682. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  6683. var Commands = _interopRequireWildcard(_commands);
  6684. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  6685. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6686. var _ivprogParser = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  6687. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  6688. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  6689. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6690. /**
  6691. *
  6692. * is_real
  6693. * is_int
  6694. * is_bool
  6695. * cast_real
  6696. * cast_int
  6697. * cast_bool
  6698. * cast_string
  6699. */
  6700. function createIsRealFun() {
  6701. var isRealFun = function isRealFun(sto, _) {
  6702. var str = sto.applyStore("str");
  6703. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  6704. var result = false;
  6705. try {
  6706. var val = parser.parseTerm();
  6707. if (val instanceof _expressions.RealLiteral) {
  6708. result = true;
  6709. }
  6710. } catch (error) {}
  6711. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  6712. sto.mode = _modes.Modes.RETURN;
  6713. return Promise.resolve(sto.updateStore("$", temp));
  6714. };
  6715. var block = new Commands.CommandBlock([], [new Commands.SysCall(isRealFun)]);
  6716. var func = new Commands.Function('$isReal', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6717. return func;
  6718. }
  6719. function createIsIntFun() {
  6720. var isIntFun = function isIntFun(sto, _) {
  6721. var str = sto.applyStore("str");
  6722. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  6723. var result = false;
  6724. try {
  6725. var val = parser.parseTerm();
  6726. if (val instanceof _expressions.IntLiteral) {
  6727. result = true;
  6728. }
  6729. } catch (error) {}
  6730. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  6731. sto.mode = _modes.Modes.RETURN;
  6732. return Promise.resolve(sto.updateStore("$", temp));
  6733. };
  6734. var block = new Commands.CommandBlock([], [new Commands.SysCall(isIntFun)]);
  6735. var func = new Commands.Function('$isInt', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6736. return func;
  6737. }
  6738. function createIsBoolFun() {
  6739. var isBoolFun = function isBoolFun(sto, _) {
  6740. var str = sto.applyStore("str");
  6741. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  6742. var result = false;
  6743. try {
  6744. var val = parser.parseTerm();
  6745. if (val instanceof _expressions.BoolLiteral) {
  6746. result = true;
  6747. }
  6748. } catch (error) {}
  6749. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  6750. sto.mode = _modes.Modes.RETURN;
  6751. return Promise.resolve(sto.updateStore("$", temp));
  6752. };
  6753. var block = new Commands.CommandBlock([], [new Commands.SysCall(isBoolFun)]);
  6754. var func = new Commands.Function('$isBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6755. return func;
  6756. }
  6757. function createCastRealFun() {
  6758. var castRealFun = function castRealFun(sto, _) {
  6759. var val = sto.applyStore("val");
  6760. switch (val.type.ord) {
  6761. case _types.Types.INTEGER.ord:
  6762. {
  6763. var temp = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(val.number));
  6764. sto.mode = _modes.Modes.RETURN;
  6765. return Promise.resolve(sto.updateStore("$", temp));
  6766. }
  6767. case _types.Types.STRING.ord:
  6768. {
  6769. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  6770. try {
  6771. var result = parser.parseTerm();
  6772. if (result instanceof _expressions.RealLiteral) {
  6773. var _temp = new _storeObject.StoreObject(_types.Types.REAL, result.value);
  6774. sto.mode = _modes.Modes.RETURN;
  6775. return Promise.resolve(sto.updateStore("$", _temp));
  6776. }
  6777. } catch (error) {
  6778. return Promise.reject("cannot convert string to real");
  6779. }
  6780. }
  6781. }
  6782. };
  6783. var block = new Commands.CommandBlock([], [new Commands.SysCall(castRealFun)]);
  6784. var func = new Commands.Function('$castReal', _types.Types.REAL, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  6785. return func;
  6786. }
  6787. function createCastIntFun() {
  6788. var castIntFun = function castIntFun(sto, _) {
  6789. var val = sto.applyStore("val");
  6790. switch (val.type.ord) {
  6791. case _types.Types.REAL.ord:
  6792. {
  6793. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, Math.floor(val.number));
  6794. sto.mode = _modes.Modes.RETURN;
  6795. return Promise.resolve(sto.updateStore("$", temp));
  6796. }
  6797. case _types.Types.STRING.ord:
  6798. {
  6799. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  6800. try {
  6801. var result = parser.parseTerm();
  6802. if (result instanceof _expressions.IntLiteral) {
  6803. var _temp2 = new _storeObject.StoreObject(_types.Types.INTEGER, result.value);
  6804. sto.mode = _modes.Modes.RETURN;
  6805. return Promise.resolve(sto.updateStore("$", _temp2));
  6806. }
  6807. } catch (error) {
  6808. return Promise.reject("cannot convert string to real");
  6809. }
  6810. }
  6811. }
  6812. };
  6813. var block = new Commands.CommandBlock([], [new Commands.SysCall(castIntFun)]);
  6814. var func = new Commands.Function('$castInt', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  6815. return func;
  6816. }
  6817. function createCastBoolFun() {
  6818. var castBoolFun = function castBoolFun(sto, _) {
  6819. var str = sto.applyStore("str");
  6820. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  6821. try {
  6822. var val = parser.parseTerm();
  6823. if (val instanceof _expressions.BoolLiteral) {
  6824. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, val.value);
  6825. sto.mode = _modes.Modes.RETURN;
  6826. return Promise.resolve(sto.updateStore("$", temp));
  6827. }
  6828. } catch (error) {}
  6829. return Promise.reject("cannot convert " + str.value + " to boolean");
  6830. };
  6831. var block = new Commands.CommandBlock([], [new Commands.SysCall(castBoolFun)]);
  6832. var func = new Commands.Function('$castBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6833. return func;
  6834. }
  6835. function createCastStringFun() {
  6836. var castStringFun = function castStringFun(store, _) {
  6837. var val = store.applyStore('str');
  6838. var result = (0, _parsers.convertToString)(val);
  6839. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  6840. sto.mode = _modes.Modes.RETURN;
  6841. return Promise.resolve(sto.updateStore("$", temp));
  6842. };
  6843. var block = new Commands.CommandBlock([], [new Commands.SysCall(castStringFun)]);
  6844. var func = new Commands.Function('$castString', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.ALL, 'str', false)], block);
  6845. return func;
  6846. }
  6847. /***/ }),
  6848. /***/ "./js/processor/lib/math.js":
  6849. /*!**********************************!*\
  6850. !*** ./js/processor/lib/math.js ***!
  6851. \**********************************/
  6852. /*! no static exports found */
  6853. /***/ (function(module, exports, __webpack_require__) {
  6854. "use strict";
  6855. Object.defineProperty(exports, "__esModule", {
  6856. value: true
  6857. });
  6858. exports.createSinFun = createSinFun;
  6859. exports.createCosFun = createCosFun;
  6860. exports.createTanFun = createTanFun;
  6861. exports.createSqrtFun = createSqrtFun;
  6862. exports.createPowFun = createPowFun;
  6863. exports.createLogFun = createLogFun;
  6864. exports.createAbsFun = createAbsFun;
  6865. exports.createNegateFun = createNegateFun;
  6866. exports.createInvertFun = createInvertFun;
  6867. exports.createMaxFun = createMaxFun;
  6868. exports.createMinFun = createMinFun;
  6869. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  6870. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  6871. var Commands = _interopRequireWildcard(_commands);
  6872. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  6873. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6874. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  6875. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  6876. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  6877. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  6878. var _config = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  6879. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6880. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  6881. /**
  6882. * sin
  6883. * cos
  6884. * tan
  6885. * sqrt
  6886. * pow
  6887. * log
  6888. * abs
  6889. * negate
  6890. * invert
  6891. * max
  6892. * min
  6893. */
  6894. function convertToRadians(degrees) {
  6895. return degrees.times(_decimal.Decimal.acos(-1)).div(180);
  6896. }
  6897. function createSinFun() {
  6898. var sinFun = function sinFun(sto, _) {
  6899. var x = sto.applyStore('x');
  6900. var angle = x.value.mod(360);
  6901. var result = null;
  6902. if (angle.eq(90)) {
  6903. result = new _decimal.Decimal(1);
  6904. } else if (angle.eq(180)) {
  6905. result = new _decimal.Decimal(0);
  6906. } else if (angle.eq(270)) {
  6907. result = new _decimal.Decimal(-1);
  6908. } else {
  6909. result = _decimal.Decimal.sin(convertToRadians(angle));
  6910. }
  6911. if (result.dp() > _config.Config.decimalPlaces) {
  6912. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  6913. }
  6914. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6915. sto.mode = _modes.Modes.RETURN;
  6916. return Promise.resolve(sto.updateStore('$', temp));
  6917. };
  6918. var block = new Commands.CommandBlock([], [new Commands.SysCall(sinFun)]);
  6919. var func = new Commands.Function('$sin', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6920. return func;
  6921. }
  6922. function createCosFun() {
  6923. var cosFun = function cosFun(sto, _) {
  6924. var x = sto.applyStore('x');
  6925. var angle = x.value.mod(360);
  6926. var result = null;
  6927. if (angle.eq(90)) {
  6928. result = new _decimal.Decimal(0);
  6929. } else if (angle.eq(180)) {
  6930. result = new _decimal.Decimal(-1);
  6931. } else if (angle.eq(270)) {
  6932. result = new _decimal.Decimal(0);
  6933. }
  6934. result = _decimal.Decimal.cos(convertToRadians(angle));
  6935. if (result.dp() > _config.Config.decimalPlaces) {
  6936. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  6937. }
  6938. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6939. sto.mode = _modes.Modes.RETURN;
  6940. return Promise.resolve(sto.updateStore('$', temp));
  6941. };
  6942. var block = new Commands.CommandBlock([], [new Commands.SysCall(cosFun)]);
  6943. var func = new Commands.Function('$cos', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6944. return func;
  6945. }
  6946. function createTanFun() {
  6947. var tanFun = function tanFun(sto, _) {
  6948. var x = sto.applyStore('x');
  6949. var angle = x.value.mod(360);
  6950. if (angle.eq(90) || angle.eq(270)) {
  6951. return Promise.reject("Tangent of " + x.value.toNumber() + "° is undefined.");
  6952. }
  6953. var result = _decimal.Decimal.tan(convertToRadians(angle));
  6954. if (result.dp() > _config.Config.decimalPlaces) {
  6955. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  6956. }
  6957. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6958. sto.mode = _modes.Modes.RETURN;
  6959. return Promise.resolve(sto.updateStore('$', temp));
  6960. };
  6961. var block = new Commands.CommandBlock([], [new Commands.SysCall(tanFun)]);
  6962. var func = new Commands.Function('$tan', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6963. return func;
  6964. }
  6965. function createSqrtFun() {
  6966. var sqrtFun = function sqrtFun(sto, _) {
  6967. var x = sto.applyStore('x');
  6968. var result = x.value.sqrt();
  6969. if (result.dp() > _config.Config.decimalPlaces) {
  6970. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  6971. }
  6972. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6973. sto.mode = _modes.Modes.RETURN;
  6974. return Promise.resolve(sto.updateStore('$', temp));
  6975. };
  6976. var block = new Commands.CommandBlock([], [new Commands.SysCall(sqrtFun)]);
  6977. var func = new Commands.Function('$sqrt', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6978. return func;
  6979. }
  6980. function createPowFun() {
  6981. var powFun = function powFun(sto, _) {
  6982. var x = sto.applyStore('x');
  6983. var y = sto.applyStore('y');
  6984. var result = x.value.pow(y.value);
  6985. if (result.dp() > _config.Config.decimalPlaces) {
  6986. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  6987. }
  6988. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6989. sto.mode = _modes.Modes.RETURN;
  6990. return Promise.resolve(sto.updateStore('$', temp));
  6991. };
  6992. var block = new Commands.CommandBlock([], [new Commands.SysCall(powFun)]);
  6993. var func = new Commands.Function('$pow', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false), new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'y', false)], block);
  6994. return func;
  6995. }
  6996. function createLogFun() {
  6997. var logFun = function logFun(sto, _) {
  6998. var x = sto.applyStore('x');
  6999. if (x.value.isNegative()) {
  7000. return Promise.reject("the value passed to log function cannot be negative");
  7001. }
  7002. var result = _decimal.Decimal.log10(x.value);
  7003. if (result.dp() > _config.Config.decimalPlaces) {
  7004. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  7005. }
  7006. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  7007. sto.mode = _modes.Modes.RETURN;
  7008. return Promise.resolve(sto.updateStore('$', temp));
  7009. };
  7010. var block = new Commands.CommandBlock([], [new Commands.SysCall(logFun)]);
  7011. var func = new Commands.Function('$log', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  7012. return func;
  7013. }
  7014. function createAbsFun() {
  7015. var absFun = function absFun(sto, _) {
  7016. var x = sto.applyStore('x');
  7017. var result = x.value.abs();
  7018. var temp = new _storeObject.StoreObject(x.type, result);
  7019. sto.mode = _modes.Modes.RETURN;
  7020. return Promise.resolve(sto.updateStore('$', temp));
  7021. };
  7022. var block = new Commands.CommandBlock([], [new Commands.SysCall(absFun)]);
  7023. var func = new Commands.Function('$abs', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  7024. return func;
  7025. }
  7026. function createNegateFun() {
  7027. var negateFun = function negateFun(sto, _) {
  7028. var x = sto.applyStore('x');
  7029. var result = x.value.negated();
  7030. var temp = new _storeObject.StoreObject(x.type, result);
  7031. sto.mode = _modes.Modes.RETURN;
  7032. return Promise.resolve(sto.updateStore('$', temp));
  7033. };
  7034. var block = new Commands.CommandBlock([], [new Commands.SysCall(negateFun)]);
  7035. var func = new Commands.Function('$negate', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  7036. return func;
  7037. }
  7038. function createInvertFun() {
  7039. var invertFun = function invertFun(sto, _) {
  7040. var x = sto.applyStore('x');
  7041. var result = (0, _parsers.toReal)(1).dividedBy(x.value);
  7042. if (result.dp() > _config.Config.decimalPlaces) {
  7043. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  7044. }
  7045. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  7046. sto.mode = _modes.Modes.RETURN;
  7047. return Promise.resolve(sto.updateStore('$', temp));
  7048. };
  7049. var block = new Commands.CommandBlock([], [new Commands.SysCall(invertFun)]);
  7050. var func = new Commands.Function('$invert', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  7051. return func;
  7052. }
  7053. function createMaxFun() {
  7054. var maxFun = function maxFun(sto, _) {
  7055. var x = sto.applyStore('x');
  7056. var numbers = x.value.map(function (stoObj) {
  7057. return stoObj.value;
  7058. });
  7059. var result = _decimal.Decimal.max.apply(_decimal.Decimal, _toConsumableArray(numbers));
  7060. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  7061. sto.mode = _modes.Modes.RETURN;
  7062. return Promise.resolve(sto.updateStore('$', temp));
  7063. };
  7064. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  7065. var block = new Commands.CommandBlock([], [new Commands.SysCall(maxFun)]);
  7066. var func = new Commands.Function('$max', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  7067. return func;
  7068. }
  7069. function createMinFun() {
  7070. var minFun = function minFun(sto, _) {
  7071. var x = sto.applyStore('x');
  7072. var numbers = x.value.map(function (stoObj) {
  7073. return stoObj.value;
  7074. });
  7075. var result = _decimal.Decimal.min.apply(_decimal.Decimal, _toConsumableArray(numbers));
  7076. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  7077. sto.mode = _modes.Modes.RETURN;
  7078. return Promise.resolve(sto.updateStore('$', temp));
  7079. };
  7080. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  7081. var block = new Commands.CommandBlock([], [new Commands.SysCall(minFun)]);
  7082. var func = new Commands.Function('$min', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  7083. return func;
  7084. }
  7085. /***/ }),
  7086. /***/ "./js/processor/lib/strings.js":
  7087. /*!*************************************!*\
  7088. !*** ./js/processor/lib/strings.js ***!
  7089. \*************************************/
  7090. /*! no static exports found */
  7091. /***/ (function(module, exports, __webpack_require__) {
  7092. "use strict";
  7093. Object.defineProperty(exports, "__esModule", {
  7094. value: true
  7095. });
  7096. exports.createSubstringFun = createSubstringFun;
  7097. exports.createLengthFun = createLengthFun;
  7098. exports.createUppercaseFun = createUppercaseFun;
  7099. exports.createLowercaseFun = createLowercaseFun;
  7100. exports.createrCharAtFun = createrCharAtFun;
  7101. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  7102. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  7103. var Commands = _interopRequireWildcard(_commands);
  7104. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  7105. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7106. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  7107. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  7108. /*
  7109. * substring
  7110. * length
  7111. * uppercase
  7112. * lowercase
  7113. * charAt
  7114. **/
  7115. function createSubstringFun() {
  7116. var substringFun = function substringFun(sto, _) {
  7117. var str = sto.applyStore("str");
  7118. var start = sto.applyStore("start");
  7119. var end = sto.applyStore("end");
  7120. var result = str.value.substring(start.value, end.value);
  7121. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  7122. sto.mode = _modes.Modes.RETURN;
  7123. return Promise.resolve(sto.updateStore("$", temp));
  7124. };
  7125. var block = new Commands.CommandBlock([], [new Commands.SysCall(substringFun)]);
  7126. var func = new Commands.Function('$substring', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false), new Commands.FormalParameter(_types.Types.INTEGER, 'start', false), new Commands.FormalParameter(_types.Types.INTEGER, 'end', false)], block);
  7127. return func;
  7128. }
  7129. function createLengthFun() {
  7130. var lengthFun = function lengthFun(sto, _) {
  7131. var str = sto.applyStore("str");
  7132. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(str.value.length));
  7133. sto.mode = _modes.Modes.RETURN;
  7134. return Promise.resolve(sto.updateStore("$", temp));
  7135. };
  7136. var block = new Commands.CommandBlock([], [new Commands.SysCall(lengthFun)]);
  7137. var func = new Commands.Function('$length', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  7138. return func;
  7139. }
  7140. function createUppercaseFun() {
  7141. var uppercaseFun = function uppercaseFun(sto, _) {
  7142. var str = sto.applyStore("str");
  7143. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toUpperCase());
  7144. sto.mode = _modes.Modes.RETURN;
  7145. return Promise.resolve(sto.updateStore("$", temp));
  7146. };
  7147. var block = new Commands.CommandBlock([], [new Commands.SysCall(uppercaseFun)]);
  7148. var func = new Commands.Function('$uppercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  7149. return func;
  7150. }
  7151. function createLowercaseFun() {
  7152. var lowercaseFun = function lowercaseFun(sto, _) {
  7153. var str = sto.applyStore("str");
  7154. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toLowerCase());
  7155. sto.mode = _modes.Modes.RETURN;
  7156. return Promise.resolve(sto.updateStore("$", temp));
  7157. };
  7158. var block = new Commands.CommandBlock([], [new Commands.SysCall(lowercaseFun)]);
  7159. var func = new Commands.Function('$lowercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  7160. return func;
  7161. }
  7162. function createrCharAtFun() {
  7163. var charAtFun = function charAtFun(sto, _) {
  7164. var str = sto.applyStore("str");
  7165. var idx = sto.applyStore("index");
  7166. if (idx.value.toNumber() < 0 || idx.value.toNumber() >= str.value.length) {
  7167. return Promise.reject(new Error("invalid string position"));
  7168. }
  7169. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.charAt(idx.value.toNumber()));
  7170. sto.mode = _modes.Modes.RETURN;
  7171. return Promise.resolve(sto.updateStore("$", temp));
  7172. };
  7173. var block = new Commands.CommandBlock([], [new Commands.SysCall(charAtFun)]);
  7174. var func = new Commands.Function('$charAt', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false), new Commands.FormalParameter(_types.Types.INTEGER, 'index', false)], block);
  7175. return func;
  7176. }
  7177. /***/ }),
  7178. /***/ "./js/processor/modes.js":
  7179. /*!*******************************!*\
  7180. !*** ./js/processor/modes.js ***!
  7181. \*******************************/
  7182. /*! no static exports found */
  7183. /***/ (function(module, exports, __webpack_require__) {
  7184. "use strict";
  7185. Object.defineProperty(exports, "__esModule", {
  7186. value: true
  7187. });
  7188. var Modes = exports.Modes = Object.freeze({
  7189. RETURN: Symbol('mode:return'),
  7190. BREAK: Symbol('mode:break'),
  7191. PAUSE: Symbol('mode:pause'),
  7192. RUN: Symbol('mode:run')
  7193. });
  7194. /***/ }),
  7195. /***/ "./js/processor/semantic/semanticAnalyser.js":
  7196. /*!***************************************************!*\
  7197. !*** ./js/processor/semantic/semanticAnalyser.js ***!
  7198. \***************************************************/
  7199. /*! no static exports found */
  7200. /***/ (function(module, exports, __webpack_require__) {
  7201. "use strict";
  7202. Object.defineProperty(exports, "__esModule", {
  7203. value: true
  7204. });
  7205. exports.SemanticAnalyser = undefined;
  7206. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7207. var _processorErrorFactory = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  7208. var _definedFunctions = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js");
  7209. var _languageService = __webpack_require__(/*! ./../../services/languageService */ "./js/services/languageService.js");
  7210. var _commands = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js");
  7211. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  7212. var _literal = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  7213. var _compatibilityTable = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.js");
  7214. var _types = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.js");
  7215. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  7216. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  7217. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7218. var SemanticAnalyser = exports.SemanticAnalyser = function () {
  7219. function SemanticAnalyser(ast) {
  7220. _classCallCheck(this, SemanticAnalyser);
  7221. this.ast = ast;
  7222. this.lexerClass = _languageService.LanguageService.getCurrentLexer();
  7223. var lexer = new this.lexerClass(null);
  7224. this.literalNames = lexer.literalNames;
  7225. this.symbolMap = null;
  7226. this.currentFunction = null;
  7227. }
  7228. _createClass(SemanticAnalyser, [{
  7229. key: 'pushMap',
  7230. value: function pushMap() {
  7231. if (this.symbolMap === null) {
  7232. this.symbolMap = { map: {}, next: null };
  7233. } else {
  7234. var n = { map: {}, next: this.symbolMap };
  7235. this.symbolMap = n;
  7236. }
  7237. }
  7238. }, {
  7239. key: 'popMap',
  7240. value: function popMap() {
  7241. if (this.symbolMap !== null) {
  7242. this.symbolMap = this.symbolMap.next;
  7243. }
  7244. }
  7245. }, {
  7246. key: 'insertSymbol',
  7247. value: function insertSymbol(id, typeInfo) {
  7248. this.symbolMap.map[id] = typeInfo;
  7249. }
  7250. }, {
  7251. key: 'findSymbol',
  7252. value: function findSymbol(id, symMap) {
  7253. if (!symMap.map[id]) {
  7254. if (symMap.next) {
  7255. return this.findSymbol(id, symMap.next);
  7256. }
  7257. return null;
  7258. } else {
  7259. return symMap.map[id];
  7260. }
  7261. }
  7262. }, {
  7263. key: 'getMainFunction',
  7264. value: function getMainFunction() {
  7265. return this.ast.functions.find(function (v) {
  7266. return v.isMain;
  7267. });
  7268. }
  7269. }, {
  7270. key: 'findFunction',
  7271. value: function findFunction(name) {
  7272. if (name.match(/^\$.+$/)) {
  7273. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  7274. if (!!!fun) {
  7275. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  7276. }
  7277. return fun;
  7278. } else {
  7279. var val = this.ast.functions.find(function (v) {
  7280. return v.name === name;
  7281. });
  7282. if (!!!val) {
  7283. return null;
  7284. }
  7285. return val;
  7286. }
  7287. }
  7288. }, {
  7289. key: 'analyseTree',
  7290. value: function analyseTree() {
  7291. var globalVars = this.ast.global;
  7292. this.pushMap();
  7293. this.assertDeclarations(globalVars);
  7294. var functions = this.ast.functions;
  7295. var mainFunc = functions.filter(function (f) {
  7296. return f.name === null;
  7297. });
  7298. if (mainFunc.length <= 0) {
  7299. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  7300. }
  7301. for (var i = 0; i < functions.length; i++) {
  7302. var fun = functions[i];
  7303. this.assertFunction(fun);
  7304. }
  7305. return this.ast;
  7306. }
  7307. }, {
  7308. key: 'assertDeclarations',
  7309. value: function assertDeclarations(list) {
  7310. for (var i = 0; i < list.length; i++) {
  7311. this.assertDeclaration(list[i]);
  7312. }
  7313. }
  7314. }, {
  7315. key: 'assertDeclaration',
  7316. value: function assertDeclaration(declaration) {
  7317. if (declaration instanceof _commands.ArrayDeclaration) {
  7318. if (declaration.initial === null) {
  7319. var lineType = this.evaluateExpressionType(declaration.lines);
  7320. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  7321. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  7322. }
  7323. if (declaration.columns !== null) {
  7324. var columnType = this.evaluateExpressionType(declaration.columns);
  7325. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  7326. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  7327. }
  7328. }
  7329. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  7330. return;
  7331. }
  7332. this.evaluateArrayLiteral(declaration.id, declaration.lines, declaration.columns, declaration.type, declaration.initial);
  7333. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  7334. } else {
  7335. if (declaration.initial === null) {
  7336. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  7337. return;
  7338. }
  7339. var resultType = this.evaluateExpressionType(declaration.initial);
  7340. if (resultType instanceof _multiType.MultiType) {
  7341. if (!resultType.isCompatible(declaration.type)) {
  7342. var stringInfo = declaration.type.stringInfo();
  7343. var info = stringInfo[0];
  7344. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, declaration.sourceInfo);
  7345. }
  7346. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  7347. } else if (!declaration.type.isCompatible(resultType)) {
  7348. var _stringInfo = declaration.type.stringInfo();
  7349. var _info = _stringInfo[0];
  7350. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info.type, _info.dim, declaration.sourceInfo);
  7351. } else {
  7352. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  7353. }
  7354. }
  7355. }
  7356. }, {
  7357. key: 'evaluateExpressionType',
  7358. value: function evaluateExpressionType(expression) {
  7359. if (expression instanceof _expressions.UnaryApp) {
  7360. var op = expression.op;
  7361. var resultType = this.evaluateExpressionType(expression.left);
  7362. return (0, _compatibilityTable.resultTypeAfterUnaryOp)(op, resultType);
  7363. } else if (expression instanceof _expressions.InfixApp) {
  7364. var _op = expression.op;
  7365. var resultTypeLeft = this.evaluateExpressionType(expression.left);
  7366. var resultTypeRight = this.evaluateExpressionType(expression.right);
  7367. return (0, _compatibilityTable.resultTypeAfterInfixOp)(_op, resultTypeLeft, resultTypeRight);
  7368. } else if (expression instanceof _literal.Literal) {
  7369. return this.evaluateLiteralType(expression);
  7370. } else if (expression instanceof _expressions.FunctionCall) {
  7371. if (expression.isMainCall) {
  7372. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), expression.sourceInfo);
  7373. }
  7374. var fun = this.findFunction(expression.id);
  7375. if (fun === null) {
  7376. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(expression.id, expression.sourceInfo);
  7377. }
  7378. if (fun.returnType.isCompatible(_types.Types.VOID)) {
  7379. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(expression.id, expression.sourceInfo);
  7380. }
  7381. this.assertParameters(fun, expression.actualParameters);
  7382. return fun.returnType;
  7383. } else if (expression instanceof _expressions.ArrayAccess) {
  7384. var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
  7385. if (arrayTypeInfo === null) {
  7386. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(expression.id, expression.sourceInfo);
  7387. }
  7388. if (!(arrayTypeInfo.type instanceof _compoundType.CompoundType)) {
  7389. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(expression.id, expression.sourceInfo);
  7390. }
  7391. var lineType = this.evaluateExpressionType(expression.line);
  7392. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  7393. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  7394. }
  7395. if (expression.column !== null) {
  7396. if (arrayTypeInfo.columns === null) {
  7397. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(expression.id, expression.sourceInfo);
  7398. }
  7399. var columnType = this.evaluateExpressionType(expression.column);
  7400. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  7401. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  7402. }
  7403. }
  7404. var arrType = arrayTypeInfo.type;
  7405. if (expression.column !== null) {
  7406. // indexing matrix
  7407. return arrType.innerType;
  7408. } else {
  7409. if (arrayTypeInfo.columns === null) {
  7410. return arrType.innerType;
  7411. }
  7412. return new _compoundType.CompoundType(arrType.innerType, 1);
  7413. }
  7414. }
  7415. }
  7416. }, {
  7417. key: 'evaluateLiteralType',
  7418. value: function evaluateLiteralType(literal) {
  7419. if (literal instanceof _expressions.IntLiteral) {
  7420. return literal.type;
  7421. } else if (literal instanceof _expressions.RealLiteral) {
  7422. return literal.type;
  7423. } else if (literal instanceof _expressions.StringLiteral) {
  7424. return literal.type;
  7425. } else if (literal instanceof _expressions.BoolLiteral) {
  7426. return literal.type;
  7427. } else if (literal instanceof _expressions.VariableLiteral) {
  7428. var typeInfo = this.findSymbol(literal.id, this.symbolMap);
  7429. if (typeInfo === null) {
  7430. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(literal.id, literal.sourceInfo);
  7431. }
  7432. if (typeInfo.type instanceof _compoundType.CompoundType) {
  7433. return typeInfo.type;
  7434. }
  7435. return typeInfo.type;
  7436. } else {
  7437. console.warn("Evaluating type only for an array literal...");
  7438. var last = null;
  7439. if (literal.value.length === 1) {
  7440. last = this.evaluateExpressionType(literal.value[0]);
  7441. } else {
  7442. for (var i = 0; i < literal.value.length; i++) {
  7443. var e = this.evaluateExpressionType(literal.value[i]);
  7444. if (last === null) {
  7445. last = e;
  7446. } else if (!last.isCompatible(e)) {
  7447. var strInfo = last.stringInfo();
  7448. var info = strInfo[0];
  7449. var strExp = literal.toString();
  7450. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  7451. }
  7452. }
  7453. }
  7454. if (last instanceof _compoundType.CompoundType) {
  7455. return new _compoundType.CompoundType(last.innerType, last.dimensions + 1);
  7456. }
  7457. return new _compoundType.CompoundType(last, 1);
  7458. }
  7459. }
  7460. }, {
  7461. key: 'evaluateArrayLiteral',
  7462. value: function evaluateArrayLiteral(id, lines, columns, type, literal) {
  7463. var _this = this;
  7464. if (literal instanceof _expressions.ArrayLiteral) {
  7465. if (columns === null) {
  7466. // it's a vector...
  7467. var dimType = this.evaluateExpressionType(lines);
  7468. if (!dimType.isCompatible(_types.Types.INTEGER)) {
  7469. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  7470. }
  7471. if (lines instanceof _expressions.IntLiteral) {
  7472. if (!lines.value.eq(literal.value.length)) {
  7473. if (type.dimensions > 1) {
  7474. throw _processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(id, literal.value.length, lines.values.toNumber(), literal.sourceInfo);
  7475. } else {
  7476. throw _processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(id, literal.value.length, lines.values.toNumber(), literal.sourceInfo);
  7477. }
  7478. } else if (line.value.isNeg()) {
  7479. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  7480. }
  7481. }
  7482. literal.value.reduce(function (last, next) {
  7483. var eType = _this.evaluateExpressionType(next);
  7484. if (!last.canAccept(eType)) {
  7485. var strInfo = last.stringInfo();invalid;
  7486. var info = strInfo[0];
  7487. var strExp = literal.toString();
  7488. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  7489. }
  7490. return last;
  7491. }, type);
  7492. return true;
  7493. } else {
  7494. var _dimType = this.evaluateExpressionType(columns);
  7495. if (!_dimType.isCompatible(_types.Types.INTEGER)) {
  7496. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  7497. }
  7498. if (columns instanceof _expressions.IntLiteral) {
  7499. if (!columns.value.eq(literal.value.length)) {
  7500. if (type.dimensions > 1) {
  7501. throw _processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(id, literal.value.length, columns.values.toNumber(), literal.sourceInfo);
  7502. } else {
  7503. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(id, literal.sourceInfo);
  7504. }
  7505. } else if (columns.value.isNeg()) {
  7506. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  7507. }
  7508. }
  7509. for (var i = 0; i < columns; i++) {
  7510. var anotherArray = literal.value[i];
  7511. this.evaluateArrayLiteral(id, lines, null, type, anotherArray);
  7512. }
  7513. }
  7514. } else {
  7515. var resultType = this.evaluateExpressionType(literal);
  7516. if (!(resultType instanceof _compoundType.CompoundType)) {
  7517. var strInfo = type.stringInfo();
  7518. var info = strInfo[0];
  7519. var strExp = literal.toString();
  7520. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  7521. }
  7522. if (!type.isCompatible(resultType)) {
  7523. var _strInfo = type.stringInfo();
  7524. var _info2 = _strInfo[0];
  7525. var _strExp = literal.toString();
  7526. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(_strExp, _info2.type, _info2.dim, literal.sourceInfo);
  7527. }
  7528. return true;
  7529. }
  7530. }
  7531. }, {
  7532. key: 'assertFunction',
  7533. value: function assertFunction(fun) {
  7534. var _this2 = this;
  7535. this.pushMap();
  7536. this.currentFunction = fun;
  7537. fun.formalParameters.forEach(function (formalParam) {
  7538. if (formalParam.type instanceof _compoundType.CompoundType) {
  7539. if (formalParam.type.dimensions > 1) {
  7540. _this2.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: -1, type: formalParam.type });
  7541. } else {
  7542. _this2.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: null, type: formalParam.type });
  7543. }
  7544. } else {
  7545. _this2.insertSymbol(formalParam.id, { id: formalParam.id, type: formalParam.type });
  7546. }
  7547. });
  7548. this.assertDeclarations(fun.variablesDeclarations);
  7549. var optional = fun.returnType.isCompatible(_types.Types.VOID);
  7550. var valid = this.assertReturn(fun, optional);
  7551. if (!valid) {
  7552. throw _processorErrorFactory.ProcessorErrorFactory.function_no_return(fun.name);
  7553. }
  7554. this.popMap();
  7555. }
  7556. }, {
  7557. key: 'assertReturn',
  7558. value: function assertReturn(fun, optional) {
  7559. var _this3 = this;
  7560. return fun.commands.reduce(function (last, next) {
  7561. return _this3.checkCommand(fun.returnType, next, optional) || last;
  7562. }, optional);
  7563. }
  7564. }, {
  7565. key: 'checkCommand',
  7566. value: function checkCommand(type, cmd, optional) {
  7567. if (cmd instanceof _commands.While) {
  7568. var resultType = this.evaluateExpressionType(cmd.expression);
  7569. if (!resultType.isCompatible(_types.Types.BOOLEAN)) {
  7570. throw _processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo);
  7571. }
  7572. this.checkCommands(type, cmd.commands, optional);
  7573. return false;
  7574. } else if (cmd instanceof _commands.For) {
  7575. this.checkCommand(type, cmd.assignment, optional);
  7576. var _resultType = this.evaluateExpressionType(cmd.condition);
  7577. if (!_resultType.isCompatible(_types.Types.BOOLEAN)) {
  7578. throw _processorErrorFactory.ProcessorErrorFactory.for_condition_type_full(cmd.sourceInfo);
  7579. }
  7580. this.checkCommand(type, cmd.increment, optional);
  7581. this.checkCommands(type, cmd.commands, optional);
  7582. return false;
  7583. } else if (cmd instanceof _commands.Switch) {
  7584. var sType = this.evaluateExpressionType(cmd.expression);
  7585. var result = optional;
  7586. var hasDefault = false;
  7587. for (var i = 0; i < cmd.cases.length; i++) {
  7588. var aCase = cmd.cases[i];
  7589. if (aCase.expression !== null) {
  7590. var caseType = this.evaluateExpressionType(aCase.expression);
  7591. if (!sType.isCompatible(caseType)) {
  7592. var strInfo = sType.stringInfo();
  7593. var info = strInfo[0];
  7594. var strExp = aCase.expression.toString();
  7595. throw _processorErrorFactory.ProcessorErrorFactory.invalid_case_type_full(strExp, info.type, info.dim, aCase.sourceInfo);
  7596. }
  7597. } else {
  7598. hasDefault = true;
  7599. }
  7600. result = result && this.checkCommands(type, aCase.commands, result);
  7601. }
  7602. return result && hasDefault;
  7603. } else if (cmd instanceof _commands.ArrayIndexAssign) {
  7604. var typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  7605. if (typeInfo === null) {
  7606. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  7607. }
  7608. if (!(typeInfo.type instanceof _compoundType.CompoundType)) {
  7609. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo);
  7610. }
  7611. var exp = cmd.expression;
  7612. var lineExp = cmd.line;
  7613. var lineType = this.evaluateExpressionType(lineExp);
  7614. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  7615. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  7616. }
  7617. var columnExp = cmd.column;
  7618. if (typeInfo.columns === null && columnExp !== null) {
  7619. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(cmd.id, cmd.sourceInfo);
  7620. } else if (columnExp !== null) {
  7621. var columnType = this.evaluateExpressionType(columnExp);
  7622. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  7623. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  7624. }
  7625. }
  7626. // exp can be a arrayLiteral, a single value exp or an array access
  7627. if (exp instanceof _expressions.ArrayLiteral) {
  7628. this.evaluateArrayLiteral(cmd.id, typeInfo.lines, columnExp ? typeInfo.columns : null, typeInfo.type, exp);
  7629. } else {
  7630. // cannot properly evaluate since type system is poorly constructed
  7631. }
  7632. return optional;
  7633. } else if (cmd instanceof _commands.Assign) {
  7634. var _typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  7635. if (_typeInfo === null) {
  7636. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  7637. }
  7638. var _exp = cmd.expression;
  7639. if (_exp instanceof _expressions.ArrayLiteral) {
  7640. if (!(_typeInfo.type instanceof _compoundType.CompoundType)) {
  7641. var stringInfo = _typeInfo.type.stringInfo();
  7642. var _info3 = stringInfo[0];
  7643. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info3.type, _info3.dim, cmd.sourceInfo);
  7644. }
  7645. this.evaluateArrayLiteral(cmd.id, _typeInfo.lines, _typeInfo.columns, _typeInfo.type, _exp);
  7646. } else {
  7647. var _resultType2 = this.evaluateExpressionType(_exp);
  7648. if (!_resultType2.isCompatible(_typeInfo.type)) {
  7649. var _stringInfo2 = _typeInfo.type.stringInfo();
  7650. var _info4 = _stringInfo2[0];
  7651. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info4.type, _info4.dim, cmd.sourceInfo);
  7652. }
  7653. }
  7654. return optional;
  7655. } else if (cmd instanceof _commands.Break) {
  7656. return optional;
  7657. } else if (cmd instanceof _commands.IfThenElse) {
  7658. var _resultType3 = this.evaluateExpressionType(cmd.condition);
  7659. if (!_resultType3.isCompatible(_types.Types.BOOLEAN)) {
  7660. throw _processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo);
  7661. }
  7662. if (cmd.ifFalse instanceof _commands.IfThenElse) {
  7663. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
  7664. } else {
  7665. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional);
  7666. }
  7667. } else if (cmd instanceof _expressions.FunctionCall) {
  7668. var fun = null;
  7669. if (cmd.isMainCall) {
  7670. fun = this.getMainFunction();
  7671. } else {
  7672. fun = this.findFunction(cmd.id);
  7673. }
  7674. if (fun === null) {
  7675. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(cmd.id, cmd.sourceInfo);
  7676. }
  7677. this.assertParameters(fun, cmd.actualParameters);
  7678. return optional;
  7679. } else if (cmd instanceof _commands.Return) {
  7680. var funcName = this.currentFunction.isMain ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : this.currentFunction.name;
  7681. if (cmd.expression === null && !type.isCompatible(_types.Types.VOID)) {
  7682. var _stringInfo3 = type.stringInfo();
  7683. var _info5 = _stringInfo3[0];
  7684. throw _processorErrorFactory.ProcessorErrorFactory.invalid_void_return_full(funcName, _info5.type, _info5.dim, cmd.sourceInfo);
  7685. } else if (cmd.expression !== null) {
  7686. var _resultType4 = this.evaluateExpressionType(cmd.expression);
  7687. if (!type.isCompatible(_resultType4)) {
  7688. var _stringInfo4 = type.stringInfo();
  7689. var _info6 = _stringInfo4[0];
  7690. throw _processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, _info6.type, _info6.dim, cmd.sourceInfo);
  7691. } else {
  7692. return true;
  7693. }
  7694. } else {
  7695. return true;
  7696. }
  7697. }
  7698. }
  7699. }, {
  7700. key: 'checkCommands',
  7701. value: function checkCommands(type, cmds, optional) {
  7702. var _this4 = this;
  7703. return cmds.reduce(function (last, next) {
  7704. return _this4.checkCommand(type, next, optional) || last;
  7705. }, optional);
  7706. }
  7707. }, {
  7708. key: 'assertParameters',
  7709. value: function assertParameters(fun, actualParametersList) {
  7710. if (fun.formalParameters.length !== actualParametersList.length) {
  7711. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size_full(fun.name, actualParametersList.length, fun.formalParameters.length, null);
  7712. }
  7713. for (var i = 0; i < actualParametersList.length; i++) {
  7714. var param = actualParametersList[i];
  7715. var formalParam = fun.formalParameters[i];
  7716. if (formalParam.byRef) {
  7717. if (!(param instanceof _expressions.VariableLiteral || param instanceof _expressions.ArrayAccess)) {
  7718. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  7719. }
  7720. }
  7721. var resultType = this.evaluateExpressionType(param);
  7722. if (resultType instanceof _multiType.MultiType && formalParam.type instanceof _multiType.MultiType) {
  7723. var shared = 0;
  7724. for (var j = 0; j < resultType.types.length; j++) {
  7725. var element = resultType.types[j];
  7726. if (formalParam.type.types.indexOf(element) !== -1) {
  7727. shared++;
  7728. }
  7729. }
  7730. if (shared <= 0) {
  7731. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  7732. }
  7733. } else if (resultType instanceof _multiType.MultiType) {
  7734. if (!resultType.isCompatible(formalParam.type)) {
  7735. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  7736. }
  7737. } else if (!formalParam.type.isCompatible(resultType)) {
  7738. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  7739. }
  7740. }
  7741. }
  7742. }]);
  7743. return SemanticAnalyser;
  7744. }();
  7745. /***/ }),
  7746. /***/ "./js/processor/store/store.js":
  7747. /*!*************************************!*\
  7748. !*** ./js/processor/store/store.js ***!
  7749. \*************************************/
  7750. /*! no static exports found */
  7751. /***/ (function(module, exports, __webpack_require__) {
  7752. "use strict";
  7753. Object.defineProperty(exports, "__esModule", {
  7754. value: true
  7755. });
  7756. exports.Store = undefined;
  7757. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7758. var _modes = __webpack_require__(/*! ./../modes */ "./js/processor/modes.js");
  7759. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7760. var Store = exports.Store = function () {
  7761. function Store(name) {
  7762. _classCallCheck(this, Store);
  7763. this.name = name;
  7764. this.store = {};
  7765. this.nextStore = null;
  7766. this.mode = _modes.Modes.RUN;
  7767. }
  7768. _createClass(Store, [{
  7769. key: "extendStore",
  7770. value: function extendStore(nextStore) {
  7771. this.nextStore = nextStore;
  7772. }
  7773. }, {
  7774. key: "applyStore",
  7775. value: function applyStore(id) {
  7776. if (!this.store[id]) {
  7777. if (this.nextStore !== null) {
  7778. return this.nextStore.applyStore(id);
  7779. } else {
  7780. // TODO: better error message
  7781. throw new Error("Variable " + id + " not found.");
  7782. }
  7783. }
  7784. var val = this.store[id];
  7785. if (val.isRef) {
  7786. return val.getRefObj();
  7787. }
  7788. return this.store[id];
  7789. }
  7790. }, {
  7791. key: "updateStore",
  7792. value: function updateStore(id, stoObj) {
  7793. if (!this.store[id]) {
  7794. if (this.nextStore !== null) {
  7795. this.nextStore.updateStore(id, stoObj);
  7796. return this;
  7797. } else {
  7798. // TODO: better error message
  7799. throw new Error("Variable " + id + " not found.");
  7800. }
  7801. } else {
  7802. var oldObj = this.store[id];
  7803. if (oldObj.readOnly) {
  7804. // TODO: better error message
  7805. throw new Error("Cannot change value of a read only variable: " + id);
  7806. }
  7807. if (oldObj.isRef) {
  7808. oldObj.updateRef(stoObj);
  7809. return this;
  7810. } else if (oldObj.isCompatible(stoObj)) {
  7811. stoObj.setID(id);
  7812. this.store[id] = Object.freeze(stoObj);
  7813. return this;
  7814. } else {
  7815. var oldType = oldObj.type;
  7816. var stoType = stoObj.type;
  7817. // TODO: better error message
  7818. throw new Error(oldType + " is not compatible with type " + stoType + " given");
  7819. }
  7820. }
  7821. }
  7822. //In case of future use of ref, it needs to have a special function to update the storeRefObject
  7823. // and no the StoreObject refferenced by it
  7824. // updateStoreRef(id, stoObjAddress) {...}
  7825. }, {
  7826. key: "insertStore",
  7827. value: function insertStore(id, stoObj) {
  7828. if (this.store[id]) {
  7829. // TODO: better error message
  7830. throw new Error(id + " is already defined");
  7831. }
  7832. stoObj.setID(id);
  7833. this.store[id] = Object.freeze(stoObj);
  7834. return this;
  7835. }
  7836. }]);
  7837. return Store;
  7838. }();
  7839. /***/ }),
  7840. /***/ "./js/processor/store/storeObject.js":
  7841. /*!*******************************************!*\
  7842. !*** ./js/processor/store/storeObject.js ***!
  7843. \*******************************************/
  7844. /*! no static exports found */
  7845. /***/ (function(module, exports, __webpack_require__) {
  7846. "use strict";
  7847. Object.defineProperty(exports, "__esModule", {
  7848. value: true
  7849. });
  7850. exports.StoreObject = undefined;
  7851. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7852. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  7853. var _decimal2 = _interopRequireDefault(_decimal);
  7854. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7855. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7856. var StoreObject = exports.StoreObject = function () {
  7857. function StoreObject(type, value) {
  7858. var readOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  7859. _classCallCheck(this, StoreObject);
  7860. this._type = type;
  7861. this._value = value;
  7862. this._readOnly = readOnly;
  7863. this._id = null;
  7864. }
  7865. _createClass(StoreObject, [{
  7866. key: 'setID',
  7867. value: function setID(id) {
  7868. this._id = id;
  7869. }
  7870. }, {
  7871. key: 'isCompatible',
  7872. value: function isCompatible(another) {
  7873. if (another instanceof StoreObject) {
  7874. return this.type.isCompatible(another.type);
  7875. }
  7876. return false;
  7877. }
  7878. }, {
  7879. key: 'id',
  7880. get: function get() {
  7881. return this._id;
  7882. }
  7883. }, {
  7884. key: 'inStore',
  7885. get: function get() {
  7886. return this.id !== null;
  7887. }
  7888. }, {
  7889. key: 'type',
  7890. get: function get() {
  7891. return this._type;
  7892. }
  7893. }, {
  7894. key: 'value',
  7895. get: function get() {
  7896. return this._value;
  7897. }
  7898. }, {
  7899. key: 'number',
  7900. get: function get() {
  7901. if (this._value instanceof _decimal2.default) {
  7902. return this._value.toNumber();
  7903. } else {
  7904. return null;
  7905. }
  7906. }
  7907. }, {
  7908. key: 'readOnly',
  7909. get: function get() {
  7910. return this._readOnly;
  7911. },
  7912. set: function set(value) {
  7913. this._readOnly = value;
  7914. }
  7915. }]);
  7916. return StoreObject;
  7917. }();
  7918. /***/ }),
  7919. /***/ "./js/processor/store/storeObjectArray.js":
  7920. /*!************************************************!*\
  7921. !*** ./js/processor/store/storeObjectArray.js ***!
  7922. \************************************************/
  7923. /*! no static exports found */
  7924. /***/ (function(module, exports, __webpack_require__) {
  7925. "use strict";
  7926. Object.defineProperty(exports, "__esModule", {
  7927. value: true
  7928. });
  7929. exports.StoreObjectArray = undefined;
  7930. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  7931. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7932. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  7933. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7934. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  7935. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  7936. var StoreObjectArray = exports.StoreObjectArray = function (_StoreObject) {
  7937. _inherits(StoreObjectArray, _StoreObject);
  7938. _createClass(StoreObjectArray, null, [{
  7939. key: 'WRONG_LINE_NUMBER',
  7940. get: function get() {
  7941. return 1;
  7942. }
  7943. }, {
  7944. key: 'WRONG_TYPE',
  7945. get: function get() {
  7946. return 2;
  7947. }
  7948. }, {
  7949. key: 'WRONG_COLUMN_NUMBER',
  7950. get: function get() {
  7951. return 3;
  7952. }
  7953. }]);
  7954. function StoreObjectArray(type, lines, columns) {
  7955. var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  7956. var readOnly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  7957. _classCallCheck(this, StoreObjectArray);
  7958. var _this = _possibleConstructorReturn(this, (StoreObjectArray.__proto__ || Object.getPrototypeOf(StoreObjectArray)).call(this, type, value, readOnly));
  7959. _this._lines = lines;
  7960. _this._columns = columns;
  7961. return _this;
  7962. }
  7963. _createClass(StoreObjectArray, [{
  7964. key: 'isCompatible',
  7965. value: function isCompatible(another) {
  7966. if (another instanceof _storeObject.StoreObject) {
  7967. if (this.lines === -1 && another.lines > 0 || this.lines === another.lines) {
  7968. if (this.columns === -1 && another.columns > 0 || this.columns === another.columns) {
  7969. return _get(StoreObjectArray.prototype.__proto__ || Object.getPrototypeOf(StoreObjectArray.prototype), 'isCompatible', this).call(this, another);
  7970. }
  7971. }
  7972. }
  7973. return false;
  7974. }
  7975. }, {
  7976. key: 'lines',
  7977. get: function get() {
  7978. return this._lines;
  7979. }
  7980. }, {
  7981. key: 'columns',
  7982. get: function get() {
  7983. return this._columns;
  7984. }
  7985. }, {
  7986. key: 'isVector',
  7987. get: function get() {
  7988. return this.type.dimensions === 1;
  7989. }
  7990. }, {
  7991. key: 'isValid',
  7992. get: function get() {
  7993. var _this2 = this;
  7994. if (this.value !== null) {
  7995. if (this.isVector) {
  7996. if (this.value.length !== this.lines) {
  7997. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];;
  7998. }
  7999. var mustBeNull = this.value.find(function (v) {
  8000. return !_this2.type.canAccept(v.type);
  8001. });
  8002. if (!!mustBeNull) {
  8003. return [StoreObjectArray.WRONG_TYPE, this.value.indexOf(mustBeNull)];;
  8004. }
  8005. }
  8006. return [];
  8007. } else {
  8008. if (this.lines !== this.value.length) {
  8009. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
  8010. }
  8011. for (var i = 0; i < this.lines; i++) {
  8012. for (var j = 0; j < this.columns; j++) {
  8013. var arr = this.value[i];
  8014. if (arr.length !== this.columns) {
  8015. return [StoreObjectArray.WRONG_COLUMN_NUMBER, arr.length];
  8016. }
  8017. var _mustBeNull = arr.find(function (v) {
  8018. return !_this2.type.canAccept(v.type);
  8019. });
  8020. if (!!_mustBeNull) {
  8021. return [StoreObjectArray.WRONG_TYPE, i, arr.indexOf(_mustBeNull)];
  8022. }
  8023. }
  8024. }
  8025. return [];
  8026. }
  8027. }
  8028. }]);
  8029. return StoreObjectArray;
  8030. }(_storeObject.StoreObject);
  8031. /***/ }),
  8032. /***/ "./js/processor/store/storeObjectArrayAddress.js":
  8033. /*!*******************************************************!*\
  8034. !*** ./js/processor/store/storeObjectArrayAddress.js ***!
  8035. \*******************************************************/
  8036. /*! no static exports found */
  8037. /***/ (function(module, exports, __webpack_require__) {
  8038. "use strict";
  8039. Object.defineProperty(exports, "__esModule", {
  8040. value: true
  8041. });
  8042. exports.StoreObjectArrayAddress = undefined;
  8043. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8044. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  8045. var _storeObjectArray = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  8046. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8047. var _processorErrorFactory = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8048. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8049. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8050. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8051. var StoreObjectArrayAddress = exports.StoreObjectArrayAddress = function (_StoreObject) {
  8052. _inherits(StoreObjectArrayAddress, _StoreObject);
  8053. function StoreObjectArrayAddress(refID, line, column, store) {
  8054. _classCallCheck(this, StoreObjectArrayAddress);
  8055. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddress.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddress)).call(this, null, null, false));
  8056. _this.refID = refID;
  8057. _this.store = store;
  8058. _this.line = line;
  8059. _this.column = column;
  8060. return _this;
  8061. }
  8062. _createClass(StoreObjectArrayAddress, [{
  8063. key: 'getArrayObject',
  8064. value: function getArrayObject() {
  8065. return this.store.applyStore(this.refID);
  8066. }
  8067. }, {
  8068. key: 'updateArrayObject',
  8069. value: function updateArrayObject(stoObj) {
  8070. var anArray = this.getArrayObject();
  8071. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), anArray);
  8072. if (!stoObj.type.isCompatible(this.type)) {
  8073. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  8074. } else if (this.type instanceof _compoundType.CompoundType && this.type.canAccept(stoObj.type)) {
  8075. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  8076. }
  8077. if (this.column !== null) {
  8078. newArray.value[this.line].value[this.column] = stoObj;
  8079. return newArray;
  8080. } else {
  8081. newArray.value[this.line] = stoObj;
  8082. return newArray;
  8083. }
  8084. }
  8085. }, {
  8086. key: 'isCompatible',
  8087. value: function isCompatible(another) {
  8088. if (this.type.isCompatible(another.type)) {
  8089. if (another.type instanceof _compoundType.CompoundType) {
  8090. return this.lines === another.lines && this.columns === another.columns;
  8091. } else {
  8092. this.refValue.isCompatible(another);
  8093. }
  8094. }
  8095. }
  8096. }, {
  8097. key: 'isRef',
  8098. get: function get() {
  8099. return false;
  8100. }
  8101. }, {
  8102. key: 'inStore',
  8103. get: function get() {
  8104. return true;
  8105. }
  8106. }, {
  8107. key: 'refValue',
  8108. get: function get() {
  8109. var refLine = this.store.applyStore(this.refID).value[this.line];
  8110. if (!refLine) {
  8111. if (this.getArrayObject().isVector) {
  8112. throw _processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  8113. } else {
  8114. throw _processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  8115. }
  8116. }
  8117. if (this.column !== null) {
  8118. var refColumn = refLine.value[this.column];
  8119. if (!refColumn) {
  8120. if (this.getArrayObject().isVector) {
  8121. throw _processorErrorFactory.ProcessorErrorFactory.vector_not_matrix(this.refID);
  8122. } else {
  8123. throw _processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds(this.refID, this.column, this.getArrayObject().columns);
  8124. }
  8125. }
  8126. return refColumn;
  8127. }
  8128. return refLine;
  8129. }
  8130. }, {
  8131. key: 'value',
  8132. get: function get() {
  8133. return this.refValue.value;
  8134. }
  8135. }, {
  8136. key: 'type',
  8137. get: function get() {
  8138. return this.refValue.type;
  8139. }
  8140. }, {
  8141. key: 'lines',
  8142. get: function get() {
  8143. if (!(this.type instanceof _compoundType.CompoundType)) {
  8144. return null;
  8145. }
  8146. return this.refValue.value.length;
  8147. }
  8148. }, {
  8149. key: 'columns',
  8150. get: function get() {
  8151. switch (this.type.dimensions) {
  8152. case 2:
  8153. return this.refValue.value[0].value.length;
  8154. default:
  8155. return null;
  8156. }
  8157. }
  8158. }]);
  8159. return StoreObjectArrayAddress;
  8160. }(_storeObject.StoreObject);
  8161. /***/ }),
  8162. /***/ "./js/processor/store/storeObjectArrayAddressRef.js":
  8163. /*!**********************************************************!*\
  8164. !*** ./js/processor/store/storeObjectArrayAddressRef.js ***!
  8165. \**********************************************************/
  8166. /*! no static exports found */
  8167. /***/ (function(module, exports, __webpack_require__) {
  8168. "use strict";
  8169. Object.defineProperty(exports, "__esModule", {
  8170. value: true
  8171. });
  8172. exports.StoreObjectArrayAddressRef = undefined;
  8173. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8174. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  8175. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  8176. var _decimal2 = _interopRequireDefault(_decimal);
  8177. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8178. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8179. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8180. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8181. var StoreObjectArrayAddressRef = exports.StoreObjectArrayAddressRef = function (_StoreObject) {
  8182. _inherits(StoreObjectArrayAddressRef, _StoreObject);
  8183. function StoreObjectArrayAddressRef(address) {
  8184. _classCallCheck(this, StoreObjectArrayAddressRef);
  8185. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddressRef.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddressRef)).call(this, null, null, false));
  8186. _this.address = address;
  8187. return _this;
  8188. }
  8189. _createClass(StoreObjectArrayAddressRef, [{
  8190. key: 'getRefObj',
  8191. value: function getRefObj() {
  8192. return this.address.refValue;
  8193. }
  8194. }, {
  8195. key: 'updateRef',
  8196. value: function updateRef(stoObj) {
  8197. var newArray = this.address.updateArrayObject(stoObj);
  8198. this.address.store.updateStore(this.address.refID, newArray);
  8199. }
  8200. }, {
  8201. key: 'isCompatible',
  8202. value: function isCompatible(another) {
  8203. return this.address.isCompatible(another);
  8204. }
  8205. }, {
  8206. key: 'isRef',
  8207. get: function get() {
  8208. return true;
  8209. }
  8210. }, {
  8211. key: 'type',
  8212. get: function get() {
  8213. return this.address.type;
  8214. }
  8215. }, {
  8216. key: 'value',
  8217. get: function get() {
  8218. return this.address.value;
  8219. }
  8220. }, {
  8221. key: 'number',
  8222. get: function get() {
  8223. if (this.value instanceof _decimal2.default) {
  8224. return this.value.toNumber();
  8225. } else {
  8226. return null;
  8227. }
  8228. }
  8229. }]);
  8230. return StoreObjectArrayAddressRef;
  8231. }(_storeObject.StoreObject);
  8232. /***/ }),
  8233. /***/ "./js/processor/store/storeObjectRef.js":
  8234. /*!**********************************************!*\
  8235. !*** ./js/processor/store/storeObjectRef.js ***!
  8236. \**********************************************/
  8237. /*! no static exports found */
  8238. /***/ (function(module, exports, __webpack_require__) {
  8239. "use strict";
  8240. Object.defineProperty(exports, "__esModule", {
  8241. value: true
  8242. });
  8243. exports.StoreObjectRef = undefined;
  8244. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8245. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  8246. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  8247. var _decimal2 = _interopRequireDefault(_decimal);
  8248. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8249. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8250. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8251. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8252. var StoreObjectRef = exports.StoreObjectRef = function (_StoreObject) {
  8253. _inherits(StoreObjectRef, _StoreObject);
  8254. function StoreObjectRef(refID, store) {
  8255. _classCallCheck(this, StoreObjectRef);
  8256. var _this = _possibleConstructorReturn(this, (StoreObjectRef.__proto__ || Object.getPrototypeOf(StoreObjectRef)).call(this, null, null, false));
  8257. _this.refID = refID;
  8258. _this.store = store;
  8259. return _this;
  8260. }
  8261. _createClass(StoreObjectRef, [{
  8262. key: 'getRefObj',
  8263. value: function getRefObj() {
  8264. return this.store.applyStore(this.refID);
  8265. }
  8266. }, {
  8267. key: 'updateRef',
  8268. value: function updateRef(stoObj) {
  8269. this.store.updateStore(this.refID, stoObj);
  8270. }
  8271. }, {
  8272. key: 'isCompatible',
  8273. value: function isCompatible(another) {
  8274. return this.store.applyStore(this.refID).isCompatible(another);
  8275. }
  8276. }, {
  8277. key: 'isRef',
  8278. get: function get() {
  8279. return true;
  8280. }
  8281. }, {
  8282. key: 'type',
  8283. get: function get() {
  8284. return this.store.applyStore(this.refID).type;
  8285. }
  8286. }, {
  8287. key: 'value',
  8288. get: function get() {
  8289. return this.store.applyStore(this.refID).value;
  8290. }
  8291. }, {
  8292. key: 'number',
  8293. get: function get() {
  8294. if (this.value instanceof _decimal2.default) {
  8295. return this.value.toNumber();
  8296. } else {
  8297. return null;
  8298. }
  8299. }
  8300. }]);
  8301. return StoreObjectRef;
  8302. }(_storeObject.StoreObject);
  8303. /***/ }),
  8304. /***/ "./js/services/languageService.js":
  8305. /*!****************************************!*\
  8306. !*** ./js/services/languageService.js ***!
  8307. \****************************************/
  8308. /*! no static exports found */
  8309. /***/ (function(module, exports, __webpack_require__) {
  8310. "use strict";
  8311. Object.defineProperty(exports, "__esModule", {
  8312. value: true
  8313. });
  8314. exports.LanguageService = undefined;
  8315. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8316. var _grammar = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.js");
  8317. var _grammar2 = _interopRequireDefault(_grammar);
  8318. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  8319. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  8320. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8321. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8322. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8323. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8324. var DEFAULT_LANG = "pt";
  8325. var LanguageServiceExtended = function (_line_i18n$LanguageSe) {
  8326. _inherits(LanguageServiceExtended, _line_i18n$LanguageSe);
  8327. function LanguageServiceExtended() {
  8328. _classCallCheck(this, LanguageServiceExtended);
  8329. return _possibleConstructorReturn(this, (LanguageServiceExtended.__proto__ || Object.getPrototypeOf(LanguageServiceExtended)).call(this, "ivprog.lang", DEFAULT_LANG));
  8330. }
  8331. _createClass(LanguageServiceExtended, [{
  8332. key: 'getCurrentLexer',
  8333. value: function getCurrentLexer() {
  8334. var langInfo = _grammar2.default[this.getLang()];
  8335. if (langInfo === null || langInfo === undefined) {
  8336. return _grammar2.default[this.getDefaultLang()].lexer;
  8337. } else {
  8338. return langInfo.lexer;
  8339. }
  8340. }
  8341. }, {
  8342. key: 'getCurrentLangFuncs',
  8343. value: function getCurrentLangFuncs() {
  8344. var langInfo = _grammar2.default[this.getLang()];
  8345. if (langInfo === null || langInfo === undefined) {
  8346. return _grammar2.default[this.getDefaultLang()].langFuncs;
  8347. } else {
  8348. return langInfo.langFuncs;
  8349. }
  8350. }
  8351. }, {
  8352. key: 'getCurrentLangLibs',
  8353. value: function getCurrentLangLibs() {
  8354. var langInfo = _grammar2.default[this.getLang()];
  8355. if (langInfo === null || langInfo === undefined) {
  8356. return _grammar2.default[this.getDefaultLang()].langLibs;
  8357. }
  8358. return langInfo.langLibs;
  8359. }
  8360. }]);
  8361. return LanguageServiceExtended;
  8362. }(_lineI18n2.default.LanguageService);
  8363. var LanguageService = exports.LanguageService = Object.freeze(new LanguageServiceExtended());
  8364. /***/ }),
  8365. /***/ "./js/services/localizedStringsService.js":
  8366. /*!************************************************!*\
  8367. !*** ./js/services/localizedStringsService.js ***!
  8368. \************************************************/
  8369. /*! no static exports found */
  8370. /***/ (function(module, exports, __webpack_require__) {
  8371. "use strict";
  8372. Object.defineProperty(exports, "__esModule", {
  8373. value: true
  8374. });
  8375. exports.LocalizedStrings = undefined;
  8376. var _languageService = __webpack_require__(/*! ./languageService */ "./js/services/languageService.js");
  8377. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  8378. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  8379. var _i18n = __webpack_require__(/*! ./../../i18n */ "./i18n/index.js");
  8380. var _i18n2 = _interopRequireDefault(_i18n);
  8381. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8382. var LocalizedStrings = exports.LocalizedStrings = Object.freeze(new _lineI18n2.default.LocalizedStrings(_languageService.LanguageService, _i18n2.default, true));
  8383. /***/ }),
  8384. /***/ "./js/typeSystem/baseTypes.js":
  8385. /*!************************************!*\
  8386. !*** ./js/typeSystem/baseTypes.js ***!
  8387. \************************************/
  8388. /*! no static exports found */
  8389. /***/ (function(module, exports, __webpack_require__) {
  8390. "use strict";
  8391. Object.defineProperty(exports, "__esModule", {
  8392. value: true
  8393. });
  8394. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8395. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8396. var BaseType = function () {
  8397. function BaseType(name, ord) {
  8398. _classCallCheck(this, BaseType);
  8399. this.name = name;
  8400. this.ord = ord;
  8401. }
  8402. _createClass(BaseType, [{
  8403. key: "isCompatible",
  8404. value: function isCompatible(another) {
  8405. if (another instanceof BaseType) {
  8406. return this.name === another.name && this.ord === another.ord;
  8407. }
  8408. return false;
  8409. }
  8410. }, {
  8411. key: "value",
  8412. get: function get() {
  8413. return this.name;
  8414. }
  8415. }]);
  8416. return BaseType;
  8417. }();
  8418. // Base types names are the same as i18n ui type keys
  8419. var BaseTypes = exports.BaseTypes = Object.freeze({
  8420. INTEGER: new BaseType("integer", 0),
  8421. REAL: new BaseType("real", 1),
  8422. STRING: new BaseType("text", 2),
  8423. BOOLEAN: new BaseType("boolean", 3),
  8424. VOID: new BaseType("void", 4),
  8425. UNDEFINED: new BaseType("undefined", 5)
  8426. });
  8427. /***/ }),
  8428. /***/ "./js/typeSystem/compoundType.js":
  8429. /*!***************************************!*\
  8430. !*** ./js/typeSystem/compoundType.js ***!
  8431. \***************************************/
  8432. /*! no static exports found */
  8433. /***/ (function(module, exports, __webpack_require__) {
  8434. "use strict";
  8435. Object.defineProperty(exports, "__esModule", {
  8436. value: true
  8437. });
  8438. exports.CompoundType = undefined;
  8439. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8440. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  8441. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8442. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8443. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8444. var CompoundType = exports.CompoundType = function (_Type) {
  8445. _inherits(CompoundType, _Type);
  8446. function CompoundType(type, dimensions) {
  8447. _classCallCheck(this, CompoundType);
  8448. var _this = _possibleConstructorReturn(this, (CompoundType.__proto__ || Object.getPrototypeOf(CompoundType)).call(this, null));
  8449. _this.innerType = type;
  8450. _this.dimensions = dimensions;
  8451. return _this;
  8452. }
  8453. _createClass(CompoundType, [{
  8454. key: "isCompatible",
  8455. value: function isCompatible(another) {
  8456. if (another instanceof CompoundType) {
  8457. if (this.dimensions !== another.dimensions) {
  8458. return false;
  8459. }
  8460. return this.innerType.isCompatible(another.innerType);
  8461. }
  8462. return false;
  8463. }
  8464. }, {
  8465. key: "stringInfo",
  8466. value: function stringInfo() {
  8467. var _this2 = this;
  8468. var list = this.innerType.stringInfo();
  8469. list.forEach(function (v) {
  8470. v.dim = _this2.dimensions;
  8471. });
  8472. return list;
  8473. }
  8474. }, {
  8475. key: "canAccept",
  8476. value: function canAccept(another) {
  8477. if (another instanceof CompoundType) {
  8478. return this.dimensions > another.dimensions && this.innerType.isCompatible(another.innerType);
  8479. } else {
  8480. return this.innerType.isCompatible(another);
  8481. }
  8482. }
  8483. }]);
  8484. return CompoundType;
  8485. }(_type.Type);
  8486. /***/ }),
  8487. /***/ "./js/typeSystem/multiType.js":
  8488. /*!************************************!*\
  8489. !*** ./js/typeSystem/multiType.js ***!
  8490. \************************************/
  8491. /*! no static exports found */
  8492. /***/ (function(module, exports, __webpack_require__) {
  8493. "use strict";
  8494. Object.defineProperty(exports, "__esModule", {
  8495. value: true
  8496. });
  8497. exports.MultiType = undefined;
  8498. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8499. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  8500. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8501. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8502. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8503. var MultiType = exports.MultiType = function (_Type) {
  8504. _inherits(MultiType, _Type);
  8505. function MultiType(types) {
  8506. _classCallCheck(this, MultiType);
  8507. var _this = _possibleConstructorReturn(this, (MultiType.__proto__ || Object.getPrototypeOf(MultiType)).call(this, null));
  8508. _this.types = types;
  8509. return _this;
  8510. }
  8511. _createClass(MultiType, [{
  8512. key: "stringInfo",
  8513. value: function stringInfo() {
  8514. var list = [];
  8515. for (var i = 0; i < this.types.length; i++) {
  8516. var t = this.types[i];
  8517. list = list.concat(t.stringInfo());
  8518. }
  8519. return list;
  8520. }
  8521. }, {
  8522. key: "isCompatible",
  8523. value: function isCompatible(another) {
  8524. if (another instanceof _type.Type) {
  8525. for (var i = 0; i < this.types.length; i++) {
  8526. var t = this.types[i];
  8527. if (t.isCompatible(another)) {
  8528. return true;
  8529. }
  8530. }
  8531. }
  8532. return false;
  8533. }
  8534. }, {
  8535. key: "value",
  8536. get: function get() {
  8537. return null;
  8538. }
  8539. }, {
  8540. key: "ord",
  8541. get: function get() {
  8542. return null;
  8543. }
  8544. }]);
  8545. return MultiType;
  8546. }(_type.Type);
  8547. /***/ }),
  8548. /***/ "./js/typeSystem/parsers.js":
  8549. /*!**********************************!*\
  8550. !*** ./js/typeSystem/parsers.js ***!
  8551. \**********************************/
  8552. /*! no static exports found */
  8553. /***/ (function(module, exports, __webpack_require__) {
  8554. "use strict";
  8555. Object.defineProperty(exports, "__esModule", {
  8556. value: true
  8557. });
  8558. exports.toInt = toInt;
  8559. exports.toString = toString;
  8560. exports.toReal = toReal;
  8561. exports.toBool = toBool;
  8562. exports.convertToString = convertToString;
  8563. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  8564. var _types = __webpack_require__(/*! ./types */ "./js/typeSystem/types.js");
  8565. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  8566. var _decimal2 = _interopRequireDefault(_decimal);
  8567. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8568. function toInt(str) {
  8569. return new _decimal2.default(str);
  8570. }
  8571. function toString(str) {
  8572. var value = str.replace(/^"/, '');
  8573. value = value.replace(/"$/, '');
  8574. value = value.replace(/\\b/g, "\b");
  8575. value = value.replace(/\\t/g, "\t");
  8576. value = value.replace(/\\n/g, "\n");
  8577. value = value.replace(/\\r/g, "\r");
  8578. value = value.replace(/\\\"/g, "\"");
  8579. value = value.replace(/\\\'/g, "\'");
  8580. value = value.replace(/\\\\/g, "\\");
  8581. return value;
  8582. }
  8583. function toReal(value) {
  8584. return new _decimal2.default(value);
  8585. }
  8586. function toBool(str) {
  8587. var val = "'" + str + "'";
  8588. var lexer = _languageService.LanguageService.getCurrentLexer();
  8589. var instance = new lexer(null);
  8590. if (instance.literalNames[lexer.RK_TRUE] === val) {
  8591. return true;
  8592. } else if (instance.literalNames[lexer.RK_FALSE] === val) {
  8593. return false;
  8594. } else {
  8595. // TODO: better error message
  8596. throw new Error(str + "not a valid boolean");
  8597. }
  8598. }
  8599. function convertBoolToString(bool) {
  8600. var lexer = _languageService.LanguageService.getCurrentLexer();
  8601. var instance = new lexer(null);
  8602. if (bool) {
  8603. return instance.literalNames[lexer.RK_TRUE];
  8604. } else {
  8605. return instance.literalNames[lexer.RK_FALSE];
  8606. }
  8607. }
  8608. function convertToString(stoObj, type) {
  8609. switch (type.ord) {
  8610. case _types.Types.INTEGER.ord:
  8611. return stoObj.toString();
  8612. case _types.Types.REAL.ord:
  8613. {
  8614. if (stoObj.dp() <= 0) {
  8615. return stoObj.toFixed(1);
  8616. } else {
  8617. return stoObj.toNumber();
  8618. }
  8619. }
  8620. case _types.Types.BOOLEAN.ord:
  8621. return convertBoolToString(stoObj);
  8622. default:
  8623. return stoObj;
  8624. }
  8625. }
  8626. /***/ }),
  8627. /***/ "./js/typeSystem/type.js":
  8628. /*!*******************************!*\
  8629. !*** ./js/typeSystem/type.js ***!
  8630. \*******************************/
  8631. /*! no static exports found */
  8632. /***/ (function(module, exports, __webpack_require__) {
  8633. "use strict";
  8634. Object.defineProperty(exports, "__esModule", {
  8635. value: true
  8636. });
  8637. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8638. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8639. var Type = exports.Type = function () {
  8640. function Type(baseType) {
  8641. _classCallCheck(this, Type);
  8642. this.baseType = baseType;
  8643. }
  8644. _createClass(Type, [{
  8645. key: "stringInfo",
  8646. value: function stringInfo() {
  8647. return [{ type: this.baseType.name, dim: 0 }];
  8648. }
  8649. }, {
  8650. key: "isCompatible",
  8651. value: function isCompatible(another) {
  8652. if (another instanceof Type) {
  8653. return this.baseType.isCompatible(another.baseType);
  8654. }
  8655. return false;
  8656. }
  8657. }, {
  8658. key: "value",
  8659. get: function get() {
  8660. return this.baseType.value;
  8661. }
  8662. }, {
  8663. key: "ord",
  8664. get: function get() {
  8665. return this.baseType.ord;
  8666. }
  8667. }]);
  8668. return Type;
  8669. }();
  8670. /***/ }),
  8671. /***/ "./js/typeSystem/types.js":
  8672. /*!********************************!*\
  8673. !*** ./js/typeSystem/types.js ***!
  8674. \********************************/
  8675. /*! no static exports found */
  8676. /***/ (function(module, exports, __webpack_require__) {
  8677. "use strict";
  8678. Object.defineProperty(exports, "__esModule", {
  8679. value: true
  8680. });
  8681. exports.Types = undefined;
  8682. var _baseTypes = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  8683. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  8684. var _multiType = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.js");
  8685. var INTEGER = new _type.Type(_baseTypes.BaseTypes.INTEGER);
  8686. var REAL = new _type.Type(_baseTypes.BaseTypes.REAL);
  8687. var STRING = new _type.Type(_baseTypes.BaseTypes.STRING);
  8688. var BOOLEAN = new _type.Type(_baseTypes.BaseTypes.BOOLEAN);
  8689. var VOID = new _type.Type(_baseTypes.BaseTypes.VOID);
  8690. var UNDEFINED = new _type.Type(_baseTypes.BaseTypes.UNDEFINED);
  8691. var ALL = new _multiType.MultiType([INTEGER, REAL, STRING, BOOLEAN]);
  8692. var Types = exports.Types = Object.freeze({
  8693. INTEGER: INTEGER,
  8694. REAL: REAL,
  8695. STRING: STRING,
  8696. BOOLEAN: BOOLEAN,
  8697. VOID: VOID,
  8698. UNDEFINED: UNDEFINED,
  8699. ALL: ALL
  8700. });
  8701. /***/ }),
  8702. /***/ "./js/util/config.js":
  8703. /*!***************************!*\
  8704. !*** ./js/util/config.js ***!
  8705. \***************************/
  8706. /*! no static exports found */
  8707. /***/ (function(module, exports, __webpack_require__) {
  8708. "use strict";
  8709. Object.defineProperty(exports, "__esModule", {
  8710. value: true
  8711. });
  8712. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8713. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8714. var ConfigObject = function () {
  8715. function ConfigObject() {
  8716. _classCallCheck(this, ConfigObject);
  8717. this.loopTimeout = 5000;
  8718. this.decimalPlaces = 5;
  8719. this.intConvertRoundMode = 2;
  8720. }
  8721. _createClass(ConfigObject, [{
  8722. key: "setConfig",
  8723. value: function setConfig(opts) {
  8724. for (var key in opts) {
  8725. if (this.hasOwnProperty(key)) {
  8726. this[key] = opts[key];
  8727. }
  8728. }
  8729. }
  8730. }]);
  8731. return ConfigObject;
  8732. }();
  8733. var config = new ConfigObject();
  8734. var Config = exports.Config = config;
  8735. /***/ }),
  8736. /***/ "./node_modules/antlr4/BufferedTokenStream.js":
  8737. /*!****************************************************!*\
  8738. !*** ./node_modules/antlr4/BufferedTokenStream.js ***!
  8739. \****************************************************/
  8740. /*! no static exports found */
  8741. /***/ (function(module, exports, __webpack_require__) {
  8742. "use strict";
  8743. //
  8744. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  8745. * Use of this file is governed by the BSD 3-clause license that
  8746. * can be found in the LICENSE.txt file in the project root.
  8747. */
  8748. // This implementation of {@link TokenStream} loads tokens from a
  8749. // {@link TokenSource} on-demand, and places the tokens in a buffer to provide
  8750. // access to any previous token by index.
  8751. //
  8752. // <p>
  8753. // This token stream ignores the value of {@link Token//getChannel}. If your
  8754. // parser requires the token stream filter tokens to only those on a particular
  8755. // channel, such as {@link Token//DEFAULT_CHANNEL} or
  8756. // {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a
  8757. // {@link CommonTokenStream}.</p>
  8758. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  8759. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  8760. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  8761. // this is just to keep meaningful parameter types to Parser
  8762. function TokenStream() {
  8763. return this;
  8764. }
  8765. function BufferedTokenStream(tokenSource) {
  8766. TokenStream.call(this);
  8767. // The {@link TokenSource} from which tokens for this stream are fetched.
  8768. this.tokenSource = tokenSource;
  8769. // A collection of all tokens fetched from the token source. The list is
  8770. // considered a complete view of the input once {@link //fetchedEOF} is set
  8771. // to {@code true}.
  8772. this.tokens = [];
  8773. // The index into {@link //tokens} of the current token (next token to
  8774. // {@link //consume}). {@link //tokens}{@code [}{@link //p}{@code ]} should
  8775. // be
  8776. // {@link //LT LT(1)}.
  8777. //
  8778. // <p>This field is set to -1 when the stream is first constructed or when
  8779. // {@link //setTokenSource} is called, indicating that the first token has
  8780. // not yet been fetched from the token source. For additional information,
  8781. // see the documentation of {@link IntStream} for a description of
  8782. // Initializing Methods.</p>
  8783. this.index = -1;
  8784. // Indicates whether the {@link Token//EOF} token has been fetched from
  8785. // {@link //tokenSource} and added to {@link //tokens}. This field improves
  8786. // performance for the following cases:
  8787. //
  8788. // <ul>
  8789. // <li>{@link //consume}: The lookahead check in {@link //consume} to
  8790. // prevent
  8791. // consuming the EOF symbol is optimized by checking the values of
  8792. // {@link //fetchedEOF} and {@link //p} instead of calling {@link
  8793. // //LA}.</li>
  8794. // <li>{@link //fetch}: The check to prevent adding multiple EOF symbols
  8795. // into
  8796. // {@link //tokens} is trivial with this field.</li>
  8797. // <ul>
  8798. this.fetchedEOF = false;
  8799. return this;
  8800. }
  8801. BufferedTokenStream.prototype = Object.create(TokenStream.prototype);
  8802. BufferedTokenStream.prototype.constructor = BufferedTokenStream;
  8803. BufferedTokenStream.prototype.mark = function () {
  8804. return 0;
  8805. };
  8806. BufferedTokenStream.prototype.release = function (marker) {
  8807. // no resources to release
  8808. };
  8809. BufferedTokenStream.prototype.reset = function () {
  8810. this.seek(0);
  8811. };
  8812. BufferedTokenStream.prototype.seek = function (index) {
  8813. this.lazyInit();
  8814. this.index = this.adjustSeekIndex(index);
  8815. };
  8816. BufferedTokenStream.prototype.get = function (index) {
  8817. this.lazyInit();
  8818. return this.tokens[index];
  8819. };
  8820. BufferedTokenStream.prototype.consume = function () {
  8821. var skipEofCheck = false;
  8822. if (this.index >= 0) {
  8823. if (this.fetchedEOF) {
  8824. // the last token in tokens is EOF. skip check if p indexes any
  8825. // fetched token except the last.
  8826. skipEofCheck = this.index < this.tokens.length - 1;
  8827. } else {
  8828. // no EOF token in tokens. skip check if p indexes a fetched token.
  8829. skipEofCheck = this.index < this.tokens.length;
  8830. }
  8831. } else {
  8832. // not yet initialized
  8833. skipEofCheck = false;
  8834. }
  8835. if (!skipEofCheck && this.LA(1) === Token.EOF) {
  8836. throw "cannot consume EOF";
  8837. }
  8838. if (this.sync(this.index + 1)) {
  8839. this.index = this.adjustSeekIndex(this.index + 1);
  8840. }
  8841. };
  8842. // Make sure index {@code i} in tokens has a token.
  8843. //
  8844. // @return {@code true} if a token is located at index {@code i}, otherwise
  8845. // {@code false}.
  8846. // @see //get(int i)
  8847. // /
  8848. BufferedTokenStream.prototype.sync = function (i) {
  8849. var n = i - this.tokens.length + 1; // how many more elements we need?
  8850. if (n > 0) {
  8851. var fetched = this.fetch(n);
  8852. return fetched >= n;
  8853. }
  8854. return true;
  8855. };
  8856. // Add {@code n} elements to buffer.
  8857. //
  8858. // @return The actual number of elements added to the buffer.
  8859. // /
  8860. BufferedTokenStream.prototype.fetch = function (n) {
  8861. if (this.fetchedEOF) {
  8862. return 0;
  8863. }
  8864. for (var i = 0; i < n; i++) {
  8865. var t = this.tokenSource.nextToken();
  8866. t.tokenIndex = this.tokens.length;
  8867. this.tokens.push(t);
  8868. if (t.type === Token.EOF) {
  8869. this.fetchedEOF = true;
  8870. return i + 1;
  8871. }
  8872. }
  8873. return n;
  8874. };
  8875. // Get all tokens from start..stop inclusively///
  8876. BufferedTokenStream.prototype.getTokens = function (start, stop, types) {
  8877. if (types === undefined) {
  8878. types = null;
  8879. }
  8880. if (start < 0 || stop < 0) {
  8881. return null;
  8882. }
  8883. this.lazyInit();
  8884. var subset = [];
  8885. if (stop >= this.tokens.length) {
  8886. stop = this.tokens.length - 1;
  8887. }
  8888. for (var i = start; i < stop; i++) {
  8889. var t = this.tokens[i];
  8890. if (t.type === Token.EOF) {
  8891. break;
  8892. }
  8893. if (types === null || types.contains(t.type)) {
  8894. subset.push(t);
  8895. }
  8896. }
  8897. return subset;
  8898. };
  8899. BufferedTokenStream.prototype.LA = function (i) {
  8900. return this.LT(i).type;
  8901. };
  8902. BufferedTokenStream.prototype.LB = function (k) {
  8903. if (this.index - k < 0) {
  8904. return null;
  8905. }
  8906. return this.tokens[this.index - k];
  8907. };
  8908. BufferedTokenStream.prototype.LT = function (k) {
  8909. this.lazyInit();
  8910. if (k === 0) {
  8911. return null;
  8912. }
  8913. if (k < 0) {
  8914. return this.LB(-k);
  8915. }
  8916. var i = this.index + k - 1;
  8917. this.sync(i);
  8918. if (i >= this.tokens.length) {
  8919. // return EOF token
  8920. // EOF must be last token
  8921. return this.tokens[this.tokens.length - 1];
  8922. }
  8923. return this.tokens[i];
  8924. };
  8925. // Allowed derived classes to modify the behavior of operations which change
  8926. // the current stream position by adjusting the target token index of a seek
  8927. // operation. The default implementation simply returns {@code i}. If an
  8928. // exception is thrown in this method, the current stream index should not be
  8929. // changed.
  8930. //
  8931. // <p>For example, {@link CommonTokenStream} overrides this method to ensure
  8932. // that
  8933. // the seek target is always an on-channel token.</p>
  8934. //
  8935. // @param i The target token index.
  8936. // @return The adjusted target token index.
  8937. BufferedTokenStream.prototype.adjustSeekIndex = function (i) {
  8938. return i;
  8939. };
  8940. BufferedTokenStream.prototype.lazyInit = function () {
  8941. if (this.index === -1) {
  8942. this.setup();
  8943. }
  8944. };
  8945. BufferedTokenStream.prototype.setup = function () {
  8946. this.sync(0);
  8947. this.index = this.adjustSeekIndex(0);
  8948. };
  8949. // Reset this token stream by setting its token source.///
  8950. BufferedTokenStream.prototype.setTokenSource = function (tokenSource) {
  8951. this.tokenSource = tokenSource;
  8952. this.tokens = [];
  8953. this.index = -1;
  8954. this.fetchedEOF = false;
  8955. };
  8956. // Given a starting index, return the index of the next token on channel.
  8957. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  8958. // on channel between i and EOF.
  8959. // /
  8960. BufferedTokenStream.prototype.nextTokenOnChannel = function (i, channel) {
  8961. this.sync(i);
  8962. if (i >= this.tokens.length) {
  8963. return -1;
  8964. }
  8965. var token = this.tokens[i];
  8966. while (token.channel !== this.channel) {
  8967. if (token.type === Token.EOF) {
  8968. return -1;
  8969. }
  8970. i += 1;
  8971. this.sync(i);
  8972. token = this.tokens[i];
  8973. }
  8974. return i;
  8975. };
  8976. // Given a starting index, return the index of the previous token on channel.
  8977. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  8978. // on channel between i and 0.
  8979. BufferedTokenStream.prototype.previousTokenOnChannel = function (i, channel) {
  8980. while (i >= 0 && this.tokens[i].channel !== channel) {
  8981. i -= 1;
  8982. }
  8983. return i;
  8984. };
  8985. // Collect all tokens on specified channel to the right of
  8986. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
  8987. // EOF. If channel is -1, find any non default channel token.
  8988. BufferedTokenStream.prototype.getHiddenTokensToRight = function (tokenIndex, channel) {
  8989. if (channel === undefined) {
  8990. channel = -1;
  8991. }
  8992. this.lazyInit();
  8993. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  8994. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  8995. }
  8996. var nextOnChannel = this.nextTokenOnChannel(tokenIndex + 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  8997. var from_ = tokenIndex + 1;
  8998. // if none onchannel to right, nextOnChannel=-1 so set to = last token
  8999. var to = nextOnChannel === -1 ? this.tokens.length - 1 : nextOnChannel;
  9000. return this.filterForChannel(from_, to, channel);
  9001. };
  9002. // Collect all tokens on specified channel to the left of
  9003. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
  9004. // If channel is -1, find any non default channel token.
  9005. BufferedTokenStream.prototype.getHiddenTokensToLeft = function (tokenIndex, channel) {
  9006. if (channel === undefined) {
  9007. channel = -1;
  9008. }
  9009. this.lazyInit();
  9010. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  9011. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  9012. }
  9013. var prevOnChannel = this.previousTokenOnChannel(tokenIndex - 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  9014. if (prevOnChannel === tokenIndex - 1) {
  9015. return null;
  9016. }
  9017. // if none on channel to left, prevOnChannel=-1 then from=0
  9018. var from_ = prevOnChannel + 1;
  9019. var to = tokenIndex - 1;
  9020. return this.filterForChannel(from_, to, channel);
  9021. };
  9022. BufferedTokenStream.prototype.filterForChannel = function (left, right, channel) {
  9023. var hidden = [];
  9024. for (var i = left; i < right + 1; i++) {
  9025. var t = this.tokens[i];
  9026. if (channel === -1) {
  9027. if (t.channel !== Lexer.DEFAULT_TOKEN_CHANNEL) {
  9028. hidden.push(t);
  9029. }
  9030. } else if (t.channel === channel) {
  9031. hidden.push(t);
  9032. }
  9033. }
  9034. if (hidden.length === 0) {
  9035. return null;
  9036. }
  9037. return hidden;
  9038. };
  9039. BufferedTokenStream.prototype.getSourceName = function () {
  9040. return this.tokenSource.getSourceName();
  9041. };
  9042. // Get the text of all tokens in this buffer.///
  9043. BufferedTokenStream.prototype.getText = function (interval) {
  9044. this.lazyInit();
  9045. this.fill();
  9046. if (interval === undefined || interval === null) {
  9047. interval = new Interval(0, this.tokens.length - 1);
  9048. }
  9049. var start = interval.start;
  9050. if (start instanceof Token) {
  9051. start = start.tokenIndex;
  9052. }
  9053. var stop = interval.stop;
  9054. if (stop instanceof Token) {
  9055. stop = stop.tokenIndex;
  9056. }
  9057. if (start === null || stop === null || start < 0 || stop < 0) {
  9058. return "";
  9059. }
  9060. if (stop >= this.tokens.length) {
  9061. stop = this.tokens.length - 1;
  9062. }
  9063. var s = "";
  9064. for (var i = start; i < stop + 1; i++) {
  9065. var t = this.tokens[i];
  9066. if (t.type === Token.EOF) {
  9067. break;
  9068. }
  9069. s = s + t.text;
  9070. }
  9071. return s;
  9072. };
  9073. // Get all tokens from lexer until EOF///
  9074. BufferedTokenStream.prototype.fill = function () {
  9075. this.lazyInit();
  9076. while (this.fetch(1000) === 1000) {
  9077. continue;
  9078. }
  9079. };
  9080. exports.BufferedTokenStream = BufferedTokenStream;
  9081. /***/ }),
  9082. /***/ "./node_modules/antlr4/CharStreams.js":
  9083. /*!********************************************!*\
  9084. !*** ./node_modules/antlr4/CharStreams.js ***!
  9085. \********************************************/
  9086. /*! no static exports found */
  9087. /***/ (function(module, exports, __webpack_require__) {
  9088. "use strict";
  9089. //
  9090. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  9091. * Use of this file is governed by the BSD 3-clause license that
  9092. * can be found in the LICENSE.txt file in the project root.
  9093. */
  9094. //
  9095. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  9096. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  9097. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  9098. // Utility functions to create InputStreams from various sources.
  9099. //
  9100. // All returned InputStreams support the full range of Unicode
  9101. // up to U+10FFFF (the default behavior of InputStream only supports
  9102. // code points up to U+FFFF).
  9103. var CharStreams = {
  9104. // Creates an InputStream from a string.
  9105. fromString: function fromString(str) {
  9106. return new InputStream(str, true);
  9107. },
  9108. // Asynchronously creates an InputStream from a blob given the
  9109. // encoding of the bytes in that blob (defaults to 'utf8' if
  9110. // encoding is null).
  9111. //
  9112. // Invokes onLoad(result) on success, onError(error) on
  9113. // failure.
  9114. fromBlob: function fromBlob(blob, encoding, onLoad, onError) {
  9115. var reader = FileReader();
  9116. reader.onload = function (e) {
  9117. var is = new InputStream(e.target.result, true);
  9118. onLoad(is);
  9119. };
  9120. reader.onerror = onError;
  9121. reader.readAsText(blob, encoding);
  9122. },
  9123. // Creates an InputStream from a Buffer given the
  9124. // encoding of the bytes in that buffer (defaults to 'utf8' if
  9125. // encoding is null).
  9126. fromBuffer: function fromBuffer(buffer, encoding) {
  9127. return new InputStream(buffer.toString(encoding), true);
  9128. },
  9129. // Asynchronously creates an InputStream from a file on disk given
  9130. // the encoding of the bytes in that file (defaults to 'utf8' if
  9131. // encoding is null).
  9132. //
  9133. // Invokes callback(error, result) on completion.
  9134. fromPath: function fromPath(path, encoding, callback) {
  9135. fs.readFile(path, encoding, function (err, data) {
  9136. var is = null;
  9137. if (data !== null) {
  9138. is = new InputStream(data, true);
  9139. }
  9140. callback(err, is);
  9141. });
  9142. },
  9143. // Synchronously creates an InputStream given a path to a file
  9144. // on disk and the encoding of the bytes in that file (defaults to
  9145. // 'utf8' if encoding is null).
  9146. fromPathSync: function fromPathSync(path, encoding) {
  9147. var data = fs.readFileSync(path, encoding);
  9148. return new InputStream(data, true);
  9149. }
  9150. };
  9151. exports.CharStreams = CharStreams;
  9152. /***/ }),
  9153. /***/ "./node_modules/antlr4/CommonTokenFactory.js":
  9154. /*!***************************************************!*\
  9155. !*** ./node_modules/antlr4/CommonTokenFactory.js ***!
  9156. \***************************************************/
  9157. /*! no static exports found */
  9158. /***/ (function(module, exports, __webpack_require__) {
  9159. "use strict";
  9160. //
  9161. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  9162. * Use of this file is governed by the BSD 3-clause license that
  9163. * can be found in the LICENSE.txt file in the project root.
  9164. */
  9165. //
  9166. //
  9167. // This default implementation of {@link TokenFactory} creates
  9168. // {@link CommonToken} objects.
  9169. //
  9170. var CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  9171. function TokenFactory() {
  9172. return this;
  9173. }
  9174. function CommonTokenFactory(copyText) {
  9175. TokenFactory.call(this);
  9176. // Indicates whether {@link CommonToken//setText} should be called after
  9177. // constructing tokens to explicitly set the text. This is useful for cases
  9178. // where the input stream might not be able to provide arbitrary substrings
  9179. // of text from the input after the lexer creates a token (e.g. the
  9180. // implementation of {@link CharStream//getText} in
  9181. // {@link UnbufferedCharStream} throws an
  9182. // {@link UnsupportedOperationException}). Explicitly setting the token text
  9183. // allows {@link Token//getText} to be called at any time regardless of the
  9184. // input stream implementation.
  9185. //
  9186. // <p>
  9187. // The default value is {@code false} to avoid the performance and memory
  9188. // overhead of copying text for every token unless explicitly requested.</p>
  9189. //
  9190. this.copyText = copyText === undefined ? false : copyText;
  9191. return this;
  9192. }
  9193. CommonTokenFactory.prototype = Object.create(TokenFactory.prototype);
  9194. CommonTokenFactory.prototype.constructor = CommonTokenFactory;
  9195. //
  9196. // The default {@link CommonTokenFactory} instance.
  9197. //
  9198. // <p>
  9199. // This token factory does not explicitly copy token text when constructing
  9200. // tokens.</p>
  9201. //
  9202. CommonTokenFactory.DEFAULT = new CommonTokenFactory();
  9203. CommonTokenFactory.prototype.create = function (source, type, text, channel, start, stop, line, column) {
  9204. var t = new CommonToken(source, type, channel, start, stop);
  9205. t.line = line;
  9206. t.column = column;
  9207. if (text !== null) {
  9208. t.text = text;
  9209. } else if (this.copyText && source[1] !== null) {
  9210. t.text = source[1].getText(start, stop);
  9211. }
  9212. return t;
  9213. };
  9214. CommonTokenFactory.prototype.createThin = function (type, text) {
  9215. var t = new CommonToken(null, type);
  9216. t.text = text;
  9217. return t;
  9218. };
  9219. exports.CommonTokenFactory = CommonTokenFactory;
  9220. /***/ }),
  9221. /***/ "./node_modules/antlr4/CommonTokenStream.js":
  9222. /*!**************************************************!*\
  9223. !*** ./node_modules/antlr4/CommonTokenStream.js ***!
  9224. \**************************************************/
  9225. /*! no static exports found */
  9226. /***/ (function(module, exports, __webpack_require__) {
  9227. "use strict";
  9228. //
  9229. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  9230. * Use of this file is governed by the BSD 3-clause license that
  9231. * can be found in the LICENSE.txt file in the project root.
  9232. */
  9233. ///
  9234. //
  9235. // This class extends {@link BufferedTokenStream} with functionality to filter
  9236. // token streams to tokens on a particular channel (tokens where
  9237. // {@link Token//getChannel} returns a particular value).
  9238. //
  9239. // <p>
  9240. // This token stream provides access to all tokens by index or when calling
  9241. // methods like {@link //getText}. The channel filtering is only used for code
  9242. // accessing tokens via the lookahead methods {@link //LA}, {@link //LT}, and
  9243. // {@link //LB}.</p>
  9244. //
  9245. // <p>
  9246. // By default, tokens are placed on the default channel
  9247. // ({@link Token//DEFAULT_CHANNEL}), but may be reassigned by using the
  9248. // {@code ->channel(HIDDEN)} lexer command, or by using an embedded action to
  9249. // call {@link Lexer//setChannel}.
  9250. // </p>
  9251. //
  9252. // <p>
  9253. // Note: lexer rules which use the {@code ->skip} lexer command or call
  9254. // {@link Lexer//skip} do not produce tokens at all, so input text matched by
  9255. // such a rule will not be available as part of the token stream, regardless of
  9256. // channel.</p>
  9257. ///
  9258. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  9259. var BufferedTokenStream = __webpack_require__(/*! ./BufferedTokenStream */ "./node_modules/antlr4/BufferedTokenStream.js").BufferedTokenStream;
  9260. function CommonTokenStream(lexer, channel) {
  9261. BufferedTokenStream.call(this, lexer);
  9262. this.channel = channel === undefined ? Token.DEFAULT_CHANNEL : channel;
  9263. return this;
  9264. }
  9265. CommonTokenStream.prototype = Object.create(BufferedTokenStream.prototype);
  9266. CommonTokenStream.prototype.constructor = CommonTokenStream;
  9267. CommonTokenStream.prototype.adjustSeekIndex = function (i) {
  9268. return this.nextTokenOnChannel(i, this.channel);
  9269. };
  9270. CommonTokenStream.prototype.LB = function (k) {
  9271. if (k === 0 || this.index - k < 0) {
  9272. return null;
  9273. }
  9274. var i = this.index;
  9275. var n = 1;
  9276. // find k good tokens looking backwards
  9277. while (n <= k) {
  9278. // skip off-channel tokens
  9279. i = this.previousTokenOnChannel(i - 1, this.channel);
  9280. n += 1;
  9281. }
  9282. if (i < 0) {
  9283. return null;
  9284. }
  9285. return this.tokens[i];
  9286. };
  9287. CommonTokenStream.prototype.LT = function (k) {
  9288. this.lazyInit();
  9289. if (k === 0) {
  9290. return null;
  9291. }
  9292. if (k < 0) {
  9293. return this.LB(-k);
  9294. }
  9295. var i = this.index;
  9296. var n = 1; // we know tokens[pos] is a good one
  9297. // find k good tokens
  9298. while (n < k) {
  9299. // skip off-channel tokens, but make sure to not look past EOF
  9300. if (this.sync(i + 1)) {
  9301. i = this.nextTokenOnChannel(i + 1, this.channel);
  9302. }
  9303. n += 1;
  9304. }
  9305. return this.tokens[i];
  9306. };
  9307. // Count EOF just once.///
  9308. CommonTokenStream.prototype.getNumberOfOnChannelTokens = function () {
  9309. var n = 0;
  9310. this.fill();
  9311. for (var i = 0; i < this.tokens.length; i++) {
  9312. var t = this.tokens[i];
  9313. if (t.channel === this.channel) {
  9314. n += 1;
  9315. }
  9316. if (t.type === Token.EOF) {
  9317. break;
  9318. }
  9319. }
  9320. return n;
  9321. };
  9322. exports.CommonTokenStream = CommonTokenStream;
  9323. /***/ }),
  9324. /***/ "./node_modules/antlr4/FileStream.js":
  9325. /*!*******************************************!*\
  9326. !*** ./node_modules/antlr4/FileStream.js ***!
  9327. \*******************************************/
  9328. /*! no static exports found */
  9329. /***/ (function(module, exports, __webpack_require__) {
  9330. "use strict";
  9331. //
  9332. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  9333. * Use of this file is governed by the BSD 3-clause license that
  9334. * can be found in the LICENSE.txt file in the project root.
  9335. */
  9336. //
  9337. //
  9338. // This is an InputStream that is loaded from a file all at once
  9339. // when you construct the object.
  9340. //
  9341. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  9342. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  9343. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  9344. function FileStream(fileName, decodeToUnicodeCodePoints) {
  9345. var data = fs.readFileSync(fileName, "utf8");
  9346. InputStream.call(this, data, decodeToUnicodeCodePoints);
  9347. this.fileName = fileName;
  9348. return this;
  9349. }
  9350. FileStream.prototype = Object.create(InputStream.prototype);
  9351. FileStream.prototype.constructor = FileStream;
  9352. exports.FileStream = FileStream;
  9353. /***/ }),
  9354. /***/ "./node_modules/antlr4/InputStream.js":
  9355. /*!********************************************!*\
  9356. !*** ./node_modules/antlr4/InputStream.js ***!
  9357. \********************************************/
  9358. /*! no static exports found */
  9359. /***/ (function(module, exports, __webpack_require__) {
  9360. "use strict";
  9361. //
  9362. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  9363. * Use of this file is governed by the BSD 3-clause license that
  9364. * can be found in the LICENSE.txt file in the project root.
  9365. */
  9366. //
  9367. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  9368. __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  9369. __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  9370. // Vacuum all input from a string and then treat it like a buffer.
  9371. function _loadString(stream, decodeToUnicodeCodePoints) {
  9372. stream._index = 0;
  9373. stream.data = [];
  9374. if (stream.decodeToUnicodeCodePoints) {
  9375. for (var i = 0; i < stream.strdata.length;) {
  9376. var codePoint = stream.strdata.codePointAt(i);
  9377. stream.data.push(codePoint);
  9378. i += codePoint <= 0xFFFF ? 1 : 2;
  9379. }
  9380. } else {
  9381. for (var i = 0; i < stream.strdata.length; i++) {
  9382. var codeUnit = stream.strdata.charCodeAt(i);
  9383. stream.data.push(codeUnit);
  9384. }
  9385. }
  9386. stream._size = stream.data.length;
  9387. }
  9388. // If decodeToUnicodeCodePoints is true, the input is treated
  9389. // as a series of Unicode code points.
  9390. //
  9391. // Otherwise, the input is treated as a series of 16-bit UTF-16 code
  9392. // units.
  9393. function InputStream(data, decodeToUnicodeCodePoints) {
  9394. this.name = "<empty>";
  9395. this.strdata = data;
  9396. this.decodeToUnicodeCodePoints = decodeToUnicodeCodePoints || false;
  9397. _loadString(this);
  9398. return this;
  9399. }
  9400. Object.defineProperty(InputStream.prototype, "index", {
  9401. get: function get() {
  9402. return this._index;
  9403. }
  9404. });
  9405. Object.defineProperty(InputStream.prototype, "size", {
  9406. get: function get() {
  9407. return this._size;
  9408. }
  9409. });
  9410. // Reset the stream so that it's in the same state it was
  9411. // when the object was created *except* the data array is not
  9412. // touched.
  9413. //
  9414. InputStream.prototype.reset = function () {
  9415. this._index = 0;
  9416. };
  9417. InputStream.prototype.consume = function () {
  9418. if (this._index >= this._size) {
  9419. // assert this.LA(1) == Token.EOF
  9420. throw "cannot consume EOF";
  9421. }
  9422. this._index += 1;
  9423. };
  9424. InputStream.prototype.LA = function (offset) {
  9425. if (offset === 0) {
  9426. return 0; // undefined
  9427. }
  9428. if (offset < 0) {
  9429. offset += 1; // e.g., translate LA(-1) to use offset=0
  9430. }
  9431. var pos = this._index + offset - 1;
  9432. if (pos < 0 || pos >= this._size) {
  9433. // invalid
  9434. return Token.EOF;
  9435. }
  9436. return this.data[pos];
  9437. };
  9438. InputStream.prototype.LT = function (offset) {
  9439. return this.LA(offset);
  9440. };
  9441. // mark/release do nothing; we have entire buffer
  9442. InputStream.prototype.mark = function () {
  9443. return -1;
  9444. };
  9445. InputStream.prototype.release = function (marker) {};
  9446. // consume() ahead until p==_index; can't just set p=_index as we must
  9447. // update line and column. If we seek backwards, just set p
  9448. //
  9449. InputStream.prototype.seek = function (_index) {
  9450. if (_index <= this._index) {
  9451. this._index = _index; // just jump; don't update stream state (line,
  9452. // ...)
  9453. return;
  9454. }
  9455. // seek forward
  9456. this._index = Math.min(_index, this._size);
  9457. };
  9458. InputStream.prototype.getText = function (start, stop) {
  9459. if (stop >= this._size) {
  9460. stop = this._size - 1;
  9461. }
  9462. if (start >= this._size) {
  9463. return "";
  9464. } else {
  9465. if (this.decodeToUnicodeCodePoints) {
  9466. var result = "";
  9467. for (var i = start; i <= stop; i++) {
  9468. result += String.fromCodePoint(this.data[i]);
  9469. }
  9470. return result;
  9471. } else {
  9472. return this.strdata.slice(start, stop + 1);
  9473. }
  9474. }
  9475. };
  9476. InputStream.prototype.toString = function () {
  9477. return this.strdata;
  9478. };
  9479. exports.InputStream = InputStream;
  9480. /***/ }),
  9481. /***/ "./node_modules/antlr4/IntervalSet.js":
  9482. /*!********************************************!*\
  9483. !*** ./node_modules/antlr4/IntervalSet.js ***!
  9484. \********************************************/
  9485. /*! no static exports found */
  9486. /***/ (function(module, exports, __webpack_require__) {
  9487. "use strict";
  9488. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  9489. * Use of this file is governed by the BSD 3-clause license that
  9490. * can be found in the LICENSE.txt file in the project root.
  9491. */
  9492. /*jslint smarttabs:true */
  9493. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  9494. /* stop is not included! */
  9495. function Interval(start, stop) {
  9496. this.start = start;
  9497. this.stop = stop;
  9498. return this;
  9499. }
  9500. Interval.prototype.contains = function (item) {
  9501. return item >= this.start && item < this.stop;
  9502. };
  9503. Interval.prototype.toString = function () {
  9504. if (this.start === this.stop - 1) {
  9505. return this.start.toString();
  9506. } else {
  9507. return this.start.toString() + ".." + (this.stop - 1).toString();
  9508. }
  9509. };
  9510. Object.defineProperty(Interval.prototype, "length", {
  9511. get: function get() {
  9512. return this.stop - this.start;
  9513. }
  9514. });
  9515. function IntervalSet() {
  9516. this.intervals = null;
  9517. this.readOnly = false;
  9518. }
  9519. IntervalSet.prototype.first = function (v) {
  9520. if (this.intervals === null || this.intervals.length === 0) {
  9521. return Token.INVALID_TYPE;
  9522. } else {
  9523. return this.intervals[0].start;
  9524. }
  9525. };
  9526. IntervalSet.prototype.addOne = function (v) {
  9527. this.addInterval(new Interval(v, v + 1));
  9528. };
  9529. IntervalSet.prototype.addRange = function (l, h) {
  9530. this.addInterval(new Interval(l, h + 1));
  9531. };
  9532. IntervalSet.prototype.addInterval = function (v) {
  9533. if (this.intervals === null) {
  9534. this.intervals = [];
  9535. this.intervals.push(v);
  9536. } else {
  9537. // find insert pos
  9538. for (var k = 0; k < this.intervals.length; k++) {
  9539. var i = this.intervals[k];
  9540. // distinct range -> insert
  9541. if (v.stop < i.start) {
  9542. this.intervals.splice(k, 0, v);
  9543. return;
  9544. }
  9545. // contiguous range -> adjust
  9546. else if (v.stop === i.start) {
  9547. this.intervals[k].start = v.start;
  9548. return;
  9549. }
  9550. // overlapping range -> adjust and reduce
  9551. else if (v.start <= i.stop) {
  9552. this.intervals[k] = new Interval(Math.min(i.start, v.start), Math.max(i.stop, v.stop));
  9553. this.reduce(k);
  9554. return;
  9555. }
  9556. }
  9557. // greater than any existing
  9558. this.intervals.push(v);
  9559. }
  9560. };
  9561. IntervalSet.prototype.addSet = function (other) {
  9562. if (other.intervals !== null) {
  9563. for (var k = 0; k < other.intervals.length; k++) {
  9564. var i = other.intervals[k];
  9565. this.addInterval(new Interval(i.start, i.stop));
  9566. }
  9567. }
  9568. return this;
  9569. };
  9570. IntervalSet.prototype.reduce = function (k) {
  9571. // only need to reduce if k is not the last
  9572. if (k < this.intervalslength - 1) {
  9573. var l = this.intervals[k];
  9574. var r = this.intervals[k + 1];
  9575. // if r contained in l
  9576. if (l.stop >= r.stop) {
  9577. this.intervals.pop(k + 1);
  9578. this.reduce(k);
  9579. } else if (l.stop >= r.start) {
  9580. this.intervals[k] = new Interval(l.start, r.stop);
  9581. this.intervals.pop(k + 1);
  9582. }
  9583. }
  9584. };
  9585. IntervalSet.prototype.complement = function (start, stop) {
  9586. var result = new IntervalSet();
  9587. result.addInterval(new Interval(start, stop + 1));
  9588. for (var i = 0; i < this.intervals.length; i++) {
  9589. result.removeRange(this.intervals[i]);
  9590. }
  9591. return result;
  9592. };
  9593. IntervalSet.prototype.contains = function (item) {
  9594. if (this.intervals === null) {
  9595. return false;
  9596. } else {
  9597. for (var k = 0; k < this.intervals.length; k++) {
  9598. if (this.intervals[k].contains(item)) {
  9599. return true;
  9600. }
  9601. }
  9602. return false;
  9603. }
  9604. };
  9605. Object.defineProperty(IntervalSet.prototype, "length", {
  9606. get: function get() {
  9607. var len = 0;
  9608. this.intervals.map(function (i) {
  9609. len += i.length;
  9610. });
  9611. return len;
  9612. }
  9613. });
  9614. IntervalSet.prototype.removeRange = function (v) {
  9615. if (v.start === v.stop - 1) {
  9616. this.removeOne(v.start);
  9617. } else if (this.intervals !== null) {
  9618. var k = 0;
  9619. for (var n = 0; n < this.intervals.length; n++) {
  9620. var i = this.intervals[k];
  9621. // intervals are ordered
  9622. if (v.stop <= i.start) {
  9623. return;
  9624. }
  9625. // check for including range, split it
  9626. else if (v.start > i.start && v.stop < i.stop) {
  9627. this.intervals[k] = new Interval(i.start, v.start);
  9628. var x = new Interval(v.stop, i.stop);
  9629. this.intervals.splice(k, 0, x);
  9630. return;
  9631. }
  9632. // check for included range, remove it
  9633. else if (v.start <= i.start && v.stop >= i.stop) {
  9634. this.intervals.splice(k, 1);
  9635. k = k - 1; // need another pass
  9636. }
  9637. // check for lower boundary
  9638. else if (v.start < i.stop) {
  9639. this.intervals[k] = new Interval(i.start, v.start);
  9640. }
  9641. // check for upper boundary
  9642. else if (v.stop < i.stop) {
  9643. this.intervals[k] = new Interval(v.stop, i.stop);
  9644. }
  9645. k += 1;
  9646. }
  9647. }
  9648. };
  9649. IntervalSet.prototype.removeOne = function (v) {
  9650. if (this.intervals !== null) {
  9651. for (var k = 0; k < this.intervals.length; k++) {
  9652. var i = this.intervals[k];
  9653. // intervals is ordered
  9654. if (v < i.start) {
  9655. return;
  9656. }
  9657. // check for single value range
  9658. else if (v === i.start && v === i.stop - 1) {
  9659. this.intervals.splice(k, 1);
  9660. return;
  9661. }
  9662. // check for lower boundary
  9663. else if (v === i.start) {
  9664. this.intervals[k] = new Interval(i.start + 1, i.stop);
  9665. return;
  9666. }
  9667. // check for upper boundary
  9668. else if (v === i.stop - 1) {
  9669. this.intervals[k] = new Interval(i.start, i.stop - 1);
  9670. return;
  9671. }
  9672. // split existing range
  9673. else if (v < i.stop - 1) {
  9674. var x = new Interval(i.start, v);
  9675. i.start = v + 1;
  9676. this.intervals.splice(k, 0, x);
  9677. return;
  9678. }
  9679. }
  9680. }
  9681. };
  9682. IntervalSet.prototype.toString = function (literalNames, symbolicNames, elemsAreChar) {
  9683. literalNames = literalNames || null;
  9684. symbolicNames = symbolicNames || null;
  9685. elemsAreChar = elemsAreChar || false;
  9686. if (this.intervals === null) {
  9687. return "{}";
  9688. } else if (literalNames !== null || symbolicNames !== null) {
  9689. return this.toTokenString(literalNames, symbolicNames);
  9690. } else if (elemsAreChar) {
  9691. return this.toCharString();
  9692. } else {
  9693. return this.toIndexString();
  9694. }
  9695. };
  9696. IntervalSet.prototype.toCharString = function () {
  9697. var names = [];
  9698. for (var i = 0; i < this.intervals.length; i++) {
  9699. var v = this.intervals[i];
  9700. if (v.stop === v.start + 1) {
  9701. if (v.start === Token.EOF) {
  9702. names.push("<EOF>");
  9703. } else {
  9704. names.push("'" + String.fromCharCode(v.start) + "'");
  9705. }
  9706. } else {
  9707. names.push("'" + String.fromCharCode(v.start) + "'..'" + String.fromCharCode(v.stop - 1) + "'");
  9708. }
  9709. }
  9710. if (names.length > 1) {
  9711. return "{" + names.join(", ") + "}";
  9712. } else {
  9713. return names[0];
  9714. }
  9715. };
  9716. IntervalSet.prototype.toIndexString = function () {
  9717. var names = [];
  9718. for (var i = 0; i < this.intervals.length; i++) {
  9719. var v = this.intervals[i];
  9720. if (v.stop === v.start + 1) {
  9721. if (v.start === Token.EOF) {
  9722. names.push("<EOF>");
  9723. } else {
  9724. names.push(v.start.toString());
  9725. }
  9726. } else {
  9727. names.push(v.start.toString() + ".." + (v.stop - 1).toString());
  9728. }
  9729. }
  9730. if (names.length > 1) {
  9731. return "{" + names.join(", ") + "}";
  9732. } else {
  9733. return names[0];
  9734. }
  9735. };
  9736. IntervalSet.prototype.toTokenString = function (literalNames, symbolicNames) {
  9737. var names = [];
  9738. for (var i = 0; i < this.intervals.length; i++) {
  9739. var v = this.intervals[i];
  9740. for (var j = v.start; j < v.stop; j++) {
  9741. names.push(this.elementName(literalNames, symbolicNames, j));
  9742. }
  9743. }
  9744. if (names.length > 1) {
  9745. return "{" + names.join(", ") + "}";
  9746. } else {
  9747. return names[0];
  9748. }
  9749. };
  9750. IntervalSet.prototype.elementName = function (literalNames, symbolicNames, a) {
  9751. if (a === Token.EOF) {
  9752. return "<EOF>";
  9753. } else if (a === Token.EPSILON) {
  9754. return "<EPSILON>";
  9755. } else {
  9756. return literalNames[a] || symbolicNames[a];
  9757. }
  9758. };
  9759. exports.Interval = Interval;
  9760. exports.IntervalSet = IntervalSet;
  9761. /***/ }),
  9762. /***/ "./node_modules/antlr4/LL1Analyzer.js":
  9763. /*!********************************************!*\
  9764. !*** ./node_modules/antlr4/LL1Analyzer.js ***!
  9765. \********************************************/
  9766. /*! no static exports found */
  9767. /***/ (function(module, exports, __webpack_require__) {
  9768. "use strict";
  9769. //
  9770. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  9771. * Use of this file is governed by the BSD 3-clause license that
  9772. * can be found in the LICENSE.txt file in the project root.
  9773. */
  9774. ///
  9775. var Set = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Set;
  9776. var BitSet = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  9777. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  9778. var ATNConfig = __webpack_require__(/*! ./atn/ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  9779. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  9780. var IntervalSet = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  9781. var RuleStopState = __webpack_require__(/*! ./atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  9782. var RuleTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").RuleTransition;
  9783. var NotSetTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").NotSetTransition;
  9784. var WildcardTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").WildcardTransition;
  9785. var AbstractPredicateTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").AbstractPredicateTransition;
  9786. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  9787. var predictionContextFromRuleContext = pc.predictionContextFromRuleContext;
  9788. var PredictionContext = pc.PredictionContext;
  9789. var SingletonPredictionContext = pc.SingletonPredictionContext;
  9790. function LL1Analyzer(atn) {
  9791. this.atn = atn;
  9792. }
  9793. //* Special value added to the lookahead sets to indicate that we hit
  9794. // a predicate during analysis if {@code seeThruPreds==false}.
  9795. ///
  9796. LL1Analyzer.HIT_PRED = Token.INVALID_TYPE;
  9797. //*
  9798. // Calculates the SLL(1) expected lookahead set for each outgoing transition
  9799. // of an {@link ATNState}. The returned array has one element for each
  9800. // outgoing transition in {@code s}. If the closure from transition
  9801. // <em>i</em> leads to a semantic predicate before matching a symbol, the
  9802. // element at index <em>i</em> of the result will be {@code null}.
  9803. //
  9804. // @param s the ATN state
  9805. // @return the expected symbols for each outgoing transition of {@code s}.
  9806. ///
  9807. LL1Analyzer.prototype.getDecisionLookahead = function (s) {
  9808. if (s === null) {
  9809. return null;
  9810. }
  9811. var count = s.transitions.length;
  9812. var look = [];
  9813. for (var alt = 0; alt < count; alt++) {
  9814. look[alt] = new IntervalSet();
  9815. var lookBusy = new Set();
  9816. var seeThruPreds = false; // fail to get lookahead upon pred
  9817. this._LOOK(s.transition(alt).target, null, PredictionContext.EMPTY, look[alt], lookBusy, new BitSet(), seeThruPreds, false);
  9818. // Wipe out lookahead for this alternative if we found nothing
  9819. // or we had a predicate when we !seeThruPreds
  9820. if (look[alt].length === 0 || look[alt].contains(LL1Analyzer.HIT_PRED)) {
  9821. look[alt] = null;
  9822. }
  9823. }
  9824. return look;
  9825. };
  9826. //*
  9827. // Compute set of tokens that can follow {@code s} in the ATN in the
  9828. // specified {@code ctx}.
  9829. //
  9830. // <p>If {@code ctx} is {@code null} and the end of the rule containing
  9831. // {@code s} is reached, {@link Token//EPSILON} is added to the result set.
  9832. // If {@code ctx} is not {@code null} and the end of the outermost rule is
  9833. // reached, {@link Token//EOF} is added to the result set.</p>
  9834. //
  9835. // @param s the ATN state
  9836. // @param stopState the ATN state to stop at. This can be a
  9837. // {@link BlockEndState} to detect epsilon paths through a closure.
  9838. // @param ctx the complete parser context, or {@code null} if the context
  9839. // should be ignored
  9840. //
  9841. // @return The set of tokens that can follow {@code s} in the ATN in the
  9842. // specified {@code ctx}.
  9843. ///
  9844. LL1Analyzer.prototype.LOOK = function (s, stopState, ctx) {
  9845. var r = new IntervalSet();
  9846. var seeThruPreds = true; // ignore preds; get all lookahead
  9847. ctx = ctx || null;
  9848. var lookContext = ctx !== null ? predictionContextFromRuleContext(s.atn, ctx) : null;
  9849. this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true);
  9850. return r;
  9851. };
  9852. //*
  9853. // Compute set of tokens that can follow {@code s} in the ATN in the
  9854. // specified {@code ctx}.
  9855. //
  9856. // <p>If {@code ctx} is {@code null} and {@code stopState} or the end of the
  9857. // rule containing {@code s} is reached, {@link Token//EPSILON} is added to
  9858. // the result set. If {@code ctx} is not {@code null} and {@code addEOF} is
  9859. // {@code true} and {@code stopState} or the end of the outermost rule is
  9860. // reached, {@link Token//EOF} is added to the result set.</p>
  9861. //
  9862. // @param s the ATN state.
  9863. // @param stopState the ATN state to stop at. This can be a
  9864. // {@link BlockEndState} to detect epsilon paths through a closure.
  9865. // @param ctx The outer context, or {@code null} if the outer context should
  9866. // not be used.
  9867. // @param look The result lookahead set.
  9868. // @param lookBusy A set used for preventing epsilon closures in the ATN
  9869. // from causing a stack overflow. Outside code should pass
  9870. // {@code new Set<ATNConfig>} for this argument.
  9871. // @param calledRuleStack A set used for preventing left recursion in the
  9872. // ATN from causing a stack overflow. Outside code should pass
  9873. // {@code new BitSet()} for this argument.
  9874. // @param seeThruPreds {@code true} to true semantic predicates as
  9875. // implicitly {@code true} and "see through them", otherwise {@code false}
  9876. // to treat semantic predicates as opaque and add {@link //HIT_PRED} to the
  9877. // result if one is encountered.
  9878. // @param addEOF Add {@link Token//EOF} to the result if the end of the
  9879. // outermost context is reached. This parameter has no effect if {@code ctx}
  9880. // is {@code null}.
  9881. ///
  9882. LL1Analyzer.prototype._LOOK = function (s, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) {
  9883. var c = new ATNConfig({ state: s, alt: 0, context: ctx }, null);
  9884. if (lookBusy.contains(c)) {
  9885. return;
  9886. }
  9887. lookBusy.add(c);
  9888. if (s === stopState) {
  9889. if (ctx === null) {
  9890. look.addOne(Token.EPSILON);
  9891. return;
  9892. } else if (ctx.isEmpty() && addEOF) {
  9893. look.addOne(Token.EOF);
  9894. return;
  9895. }
  9896. }
  9897. if (s instanceof RuleStopState) {
  9898. if (ctx === null) {
  9899. look.addOne(Token.EPSILON);
  9900. return;
  9901. } else if (ctx.isEmpty() && addEOF) {
  9902. look.addOne(Token.EOF);
  9903. return;
  9904. }
  9905. if (ctx !== PredictionContext.EMPTY) {
  9906. // run thru all possible stack tops in ctx
  9907. for (var i = 0; i < ctx.length; i++) {
  9908. var returnState = this.atn.states[ctx.getReturnState(i)];
  9909. var removed = calledRuleStack.contains(returnState.ruleIndex);
  9910. try {
  9911. calledRuleStack.remove(returnState.ruleIndex);
  9912. this._LOOK(returnState, stopState, ctx.getParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  9913. } finally {
  9914. if (removed) {
  9915. calledRuleStack.add(returnState.ruleIndex);
  9916. }
  9917. }
  9918. }
  9919. return;
  9920. }
  9921. }
  9922. for (var j = 0; j < s.transitions.length; j++) {
  9923. var t = s.transitions[j];
  9924. if (t.constructor === RuleTransition) {
  9925. if (calledRuleStack.contains(t.target.ruleIndex)) {
  9926. continue;
  9927. }
  9928. var newContext = SingletonPredictionContext.create(ctx, t.followState.stateNumber);
  9929. try {
  9930. calledRuleStack.add(t.target.ruleIndex);
  9931. this._LOOK(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  9932. } finally {
  9933. calledRuleStack.remove(t.target.ruleIndex);
  9934. }
  9935. } else if (t instanceof AbstractPredicateTransition) {
  9936. if (seeThruPreds) {
  9937. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  9938. } else {
  9939. look.addOne(LL1Analyzer.HIT_PRED);
  9940. }
  9941. } else if (t.isEpsilon) {
  9942. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  9943. } else if (t.constructor === WildcardTransition) {
  9944. look.addRange(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  9945. } else {
  9946. var set = t.label;
  9947. if (set !== null) {
  9948. if (t instanceof NotSetTransition) {
  9949. set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  9950. }
  9951. look.addSet(set);
  9952. }
  9953. }
  9954. }
  9955. };
  9956. exports.LL1Analyzer = LL1Analyzer;
  9957. /***/ }),
  9958. /***/ "./node_modules/antlr4/Lexer.js":
  9959. /*!**************************************!*\
  9960. !*** ./node_modules/antlr4/Lexer.js ***!
  9961. \**************************************/
  9962. /*! no static exports found */
  9963. /***/ (function(module, exports, __webpack_require__) {
  9964. "use strict";
  9965. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  9966. * Use of this file is governed by the BSD 3-clause license that
  9967. * can be found in the LICENSE.txt file in the project root.
  9968. */
  9969. ///
  9970. // A lexer is recognizer that draws input symbols from a character stream.
  9971. // lexer grammars result in a subclass of this object. A Lexer object
  9972. // uses simplified match() and error recovery mechanisms in the interest of speed.
  9973. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  9974. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  9975. var CommonTokenFactory = __webpack_require__(/*! ./CommonTokenFactory */ "./node_modules/antlr4/CommonTokenFactory.js").CommonTokenFactory;
  9976. var RecognitionException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  9977. var LexerNoViableAltException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  9978. function TokenSource() {
  9979. return this;
  9980. }
  9981. function Lexer(input) {
  9982. Recognizer.call(this);
  9983. this._input = input;
  9984. this._factory = CommonTokenFactory.DEFAULT;
  9985. this._tokenFactorySourcePair = [this, input];
  9986. this._interp = null; // child classes must populate this
  9987. // The goal of all lexer rules/methods is to create a token object.
  9988. // this is an instance variable as multiple rules may collaborate to
  9989. // create a single token. nextToken will return this object after
  9990. // matching lexer rule(s). If you subclass to allow multiple token
  9991. // emissions, then set this to the last token to be matched or
  9992. // something nonnull so that the auto token emit mechanism will not
  9993. // emit another token.
  9994. this._token = null;
  9995. // What character index in the stream did the current token start at?
  9996. // Needed, for example, to get the text for current token. Set at
  9997. // the start of nextToken.
  9998. this._tokenStartCharIndex = -1;
  9999. // The line on which the first character of the token resides///
  10000. this._tokenStartLine = -1;
  10001. // The character position of first character within the line///
  10002. this._tokenStartColumn = -1;
  10003. // Once we see EOF on char stream, next token will be EOF.
  10004. // If you have DONE : EOF ; then you see DONE EOF.
  10005. this._hitEOF = false;
  10006. // The channel number for the current token///
  10007. this._channel = Token.DEFAULT_CHANNEL;
  10008. // The token type for the current token///
  10009. this._type = Token.INVALID_TYPE;
  10010. this._modeStack = [];
  10011. this._mode = Lexer.DEFAULT_MODE;
  10012. // You can set the text for the current token to override what is in
  10013. // the input char buffer. Use setText() or can set this instance var.
  10014. // /
  10015. this._text = null;
  10016. return this;
  10017. }
  10018. Lexer.prototype = Object.create(Recognizer.prototype);
  10019. Lexer.prototype.constructor = Lexer;
  10020. Lexer.DEFAULT_MODE = 0;
  10021. Lexer.MORE = -2;
  10022. Lexer.SKIP = -3;
  10023. Lexer.DEFAULT_TOKEN_CHANNEL = Token.DEFAULT_CHANNEL;
  10024. Lexer.HIDDEN = Token.HIDDEN_CHANNEL;
  10025. Lexer.MIN_CHAR_VALUE = 0x0000;
  10026. Lexer.MAX_CHAR_VALUE = 0x10FFFF;
  10027. Lexer.prototype.reset = function () {
  10028. // wack Lexer state variables
  10029. if (this._input !== null) {
  10030. this._input.seek(0); // rewind the input
  10031. }
  10032. this._token = null;
  10033. this._type = Token.INVALID_TYPE;
  10034. this._channel = Token.DEFAULT_CHANNEL;
  10035. this._tokenStartCharIndex = -1;
  10036. this._tokenStartColumn = -1;
  10037. this._tokenStartLine = -1;
  10038. this._text = null;
  10039. this._hitEOF = false;
  10040. this._mode = Lexer.DEFAULT_MODE;
  10041. this._modeStack = [];
  10042. this._interp.reset();
  10043. };
  10044. // Return a token from this source; i.e., match a token on the char stream.
  10045. Lexer.prototype.nextToken = function () {
  10046. if (this._input === null) {
  10047. throw "nextToken requires a non-null input stream.";
  10048. }
  10049. // Mark start location in char stream so unbuffered streams are
  10050. // guaranteed at least have text of current token
  10051. var tokenStartMarker = this._input.mark();
  10052. try {
  10053. while (true) {
  10054. if (this._hitEOF) {
  10055. this.emitEOF();
  10056. return this._token;
  10057. }
  10058. this._token = null;
  10059. this._channel = Token.DEFAULT_CHANNEL;
  10060. this._tokenStartCharIndex = this._input.index;
  10061. this._tokenStartColumn = this._interp.column;
  10062. this._tokenStartLine = this._interp.line;
  10063. this._text = null;
  10064. var continueOuter = false;
  10065. while (true) {
  10066. this._type = Token.INVALID_TYPE;
  10067. var ttype = Lexer.SKIP;
  10068. try {
  10069. ttype = this._interp.match(this._input, this._mode);
  10070. } catch (e) {
  10071. if (e instanceof RecognitionException) {
  10072. this.notifyListeners(e); // report error
  10073. this.recover(e);
  10074. } else {
  10075. console.log(e.stack);
  10076. throw e;
  10077. }
  10078. }
  10079. if (this._input.LA(1) === Token.EOF) {
  10080. this._hitEOF = true;
  10081. }
  10082. if (this._type === Token.INVALID_TYPE) {
  10083. this._type = ttype;
  10084. }
  10085. if (this._type === Lexer.SKIP) {
  10086. continueOuter = true;
  10087. break;
  10088. }
  10089. if (this._type !== Lexer.MORE) {
  10090. break;
  10091. }
  10092. }
  10093. if (continueOuter) {
  10094. continue;
  10095. }
  10096. if (this._token === null) {
  10097. this.emit();
  10098. }
  10099. return this._token;
  10100. }
  10101. } finally {
  10102. // make sure we release marker after match or
  10103. // unbuffered char stream will keep buffering
  10104. this._input.release(tokenStartMarker);
  10105. }
  10106. };
  10107. // Instruct the lexer to skip creating a token for current lexer rule
  10108. // and look for another token. nextToken() knows to keep looking when
  10109. // a lexer rule finishes with token set to SKIP_TOKEN. Recall that
  10110. // if token==null at end of any token rule, it creates one for you
  10111. // and emits it.
  10112. // /
  10113. Lexer.prototype.skip = function () {
  10114. this._type = Lexer.SKIP;
  10115. };
  10116. Lexer.prototype.more = function () {
  10117. this._type = Lexer.MORE;
  10118. };
  10119. Lexer.prototype.mode = function (m) {
  10120. this._mode = m;
  10121. };
  10122. Lexer.prototype.pushMode = function (m) {
  10123. if (this._interp.debug) {
  10124. console.log("pushMode " + m);
  10125. }
  10126. this._modeStack.push(this._mode);
  10127. this.mode(m);
  10128. };
  10129. Lexer.prototype.popMode = function () {
  10130. if (this._modeStack.length === 0) {
  10131. throw "Empty Stack";
  10132. }
  10133. if (this._interp.debug) {
  10134. console.log("popMode back to " + this._modeStack.slice(0, -1));
  10135. }
  10136. this.mode(this._modeStack.pop());
  10137. return this._mode;
  10138. };
  10139. // Set the char stream and reset the lexer
  10140. Object.defineProperty(Lexer.prototype, "inputStream", {
  10141. get: function get() {
  10142. return this._input;
  10143. },
  10144. set: function set(input) {
  10145. this._input = null;
  10146. this._tokenFactorySourcePair = [this, this._input];
  10147. this.reset();
  10148. this._input = input;
  10149. this._tokenFactorySourcePair = [this, this._input];
  10150. }
  10151. });
  10152. Object.defineProperty(Lexer.prototype, "sourceName", {
  10153. get: function sourceName() {
  10154. return this._input.sourceName;
  10155. }
  10156. });
  10157. // By default does not support multiple emits per nextToken invocation
  10158. // for efficiency reasons. Subclass and override this method, nextToken,
  10159. // and getToken (to push tokens into a list and pull from that list
  10160. // rather than a single variable as this implementation does).
  10161. // /
  10162. Lexer.prototype.emitToken = function (token) {
  10163. this._token = token;
  10164. };
  10165. // The standard method called to automatically emit a token at the
  10166. // outermost lexical rule. The token object should point into the
  10167. // char buffer start..stop. If there is a text override in 'text',
  10168. // use that to set the token's text. Override this method to emit
  10169. // custom Token objects or provide a new factory.
  10170. // /
  10171. Lexer.prototype.emit = function () {
  10172. var t = this._factory.create(this._tokenFactorySourcePair, this._type, this._text, this._channel, this._tokenStartCharIndex, this.getCharIndex() - 1, this._tokenStartLine, this._tokenStartColumn);
  10173. this.emitToken(t);
  10174. return t;
  10175. };
  10176. Lexer.prototype.emitEOF = function () {
  10177. var cpos = this.column;
  10178. var lpos = this.line;
  10179. var eof = this._factory.create(this._tokenFactorySourcePair, Token.EOF, null, Token.DEFAULT_CHANNEL, this._input.index, this._input.index - 1, lpos, cpos);
  10180. this.emitToken(eof);
  10181. return eof;
  10182. };
  10183. Object.defineProperty(Lexer.prototype, "type", {
  10184. get: function get() {
  10185. return this.type;
  10186. },
  10187. set: function set(type) {
  10188. this._type = type;
  10189. }
  10190. });
  10191. Object.defineProperty(Lexer.prototype, "line", {
  10192. get: function get() {
  10193. return this._interp.line;
  10194. },
  10195. set: function set(line) {
  10196. this._interp.line = line;
  10197. }
  10198. });
  10199. Object.defineProperty(Lexer.prototype, "column", {
  10200. get: function get() {
  10201. return this._interp.column;
  10202. },
  10203. set: function set(column) {
  10204. this._interp.column = column;
  10205. }
  10206. });
  10207. // What is the index of the current character of lookahead?///
  10208. Lexer.prototype.getCharIndex = function () {
  10209. return this._input.index;
  10210. };
  10211. // Return the text matched so far for the current token or any text override.
  10212. //Set the complete text of this token; it wipes any previous changes to the text.
  10213. Object.defineProperty(Lexer.prototype, "text", {
  10214. get: function get() {
  10215. if (this._text !== null) {
  10216. return this._text;
  10217. } else {
  10218. return this._interp.getText(this._input);
  10219. }
  10220. },
  10221. set: function set(text) {
  10222. this._text = text;
  10223. }
  10224. });
  10225. // Return a list of all Token objects in input char stream.
  10226. // Forces load of all tokens. Does not include EOF token.
  10227. // /
  10228. Lexer.prototype.getAllTokens = function () {
  10229. var tokens = [];
  10230. var t = this.nextToken();
  10231. while (t.type !== Token.EOF) {
  10232. tokens.push(t);
  10233. t = this.nextToken();
  10234. }
  10235. return tokens;
  10236. };
  10237. Lexer.prototype.notifyListeners = function (e) {
  10238. var start = this._tokenStartCharIndex;
  10239. var stop = this._input.index;
  10240. var text = this._input.getText(start, stop);
  10241. var msg = "token recognition error at: '" + this.getErrorDisplay(text) + "'";
  10242. var listener = this.getErrorListenerDispatch();
  10243. listener.syntaxError(this, null, this._tokenStartLine, this._tokenStartColumn, msg, e);
  10244. };
  10245. Lexer.prototype.getErrorDisplay = function (s) {
  10246. var d = [];
  10247. for (var i = 0; i < s.length; i++) {
  10248. d.push(s[i]);
  10249. }
  10250. return d.join('');
  10251. };
  10252. Lexer.prototype.getErrorDisplayForChar = function (c) {
  10253. if (c.charCodeAt(0) === Token.EOF) {
  10254. return "<EOF>";
  10255. } else if (c === '\n') {
  10256. return "\\n";
  10257. } else if (c === '\t') {
  10258. return "\\t";
  10259. } else if (c === '\r') {
  10260. return "\\r";
  10261. } else {
  10262. return c;
  10263. }
  10264. };
  10265. Lexer.prototype.getCharErrorDisplay = function (c) {
  10266. return "'" + this.getErrorDisplayForChar(c) + "'";
  10267. };
  10268. // Lexers can normally match any char in it's vocabulary after matching
  10269. // a token, so do the easy thing and just kill a character and hope
  10270. // it all works out. You can instead use the rule invocation stack
  10271. // to do sophisticated error recovery if you are in a fragment rule.
  10272. // /
  10273. Lexer.prototype.recover = function (re) {
  10274. if (this._input.LA(1) !== Token.EOF) {
  10275. if (re instanceof LexerNoViableAltException) {
  10276. // skip a char and try again
  10277. this._interp.consume(this._input);
  10278. } else {
  10279. // TODO: Do we lose character or line position information?
  10280. this._input.consume();
  10281. }
  10282. }
  10283. };
  10284. exports.Lexer = Lexer;
  10285. /***/ }),
  10286. /***/ "./node_modules/antlr4/Parser.js":
  10287. /*!***************************************!*\
  10288. !*** ./node_modules/antlr4/Parser.js ***!
  10289. \***************************************/
  10290. /*! no static exports found */
  10291. /***/ (function(module, exports, __webpack_require__) {
  10292. "use strict";
  10293. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  10294. * Use of this file is governed by the BSD 3-clause license that
  10295. * can be found in the LICENSE.txt file in the project root.
  10296. */
  10297. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  10298. var ParseTreeListener = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ParseTreeListener;
  10299. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  10300. var DefaultErrorStrategy = __webpack_require__(/*! ./error/ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").DefaultErrorStrategy;
  10301. var ATNDeserializer = __webpack_require__(/*! ./atn/ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  10302. var ATNDeserializationOptions = __webpack_require__(/*! ./atn/ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  10303. var TerminalNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  10304. var ErrorNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  10305. function TraceListener(parser) {
  10306. ParseTreeListener.call(this);
  10307. this.parser = parser;
  10308. return this;
  10309. }
  10310. TraceListener.prototype = Object.create(ParseTreeListener.prototype);
  10311. TraceListener.prototype.constructor = TraceListener;
  10312. TraceListener.prototype.enterEveryRule = function (ctx) {
  10313. console.log("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  10314. };
  10315. TraceListener.prototype.visitTerminal = function (node) {
  10316. console.log("consume " + node.symbol + " rule " + this.parser.ruleNames[this.parser._ctx.ruleIndex]);
  10317. };
  10318. TraceListener.prototype.exitEveryRule = function (ctx) {
  10319. console.log("exit " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  10320. };
  10321. // this is all the parsing support code essentially; most of it is error
  10322. // recovery stuff.//
  10323. function Parser(input) {
  10324. Recognizer.call(this);
  10325. // The input stream.
  10326. this._input = null;
  10327. // The error handling strategy for the parser. The default value is a new
  10328. // instance of {@link DefaultErrorStrategy}.
  10329. this._errHandler = new DefaultErrorStrategy();
  10330. this._precedenceStack = [];
  10331. this._precedenceStack.push(0);
  10332. // The {@link ParserRuleContext} object for the currently executing rule.
  10333. // this is always non-null during the parsing process.
  10334. this._ctx = null;
  10335. // Specifies whether or not the parser should construct a parse tree during
  10336. // the parsing process. The default value is {@code true}.
  10337. this.buildParseTrees = true;
  10338. // When {@link //setTrace}{@code (true)} is called, a reference to the
  10339. // {@link TraceListener} is stored here so it can be easily removed in a
  10340. // later call to {@link //setTrace}{@code (false)}. The listener itself is
  10341. // implemented as a parser listener so this field is not directly used by
  10342. // other parser methods.
  10343. this._tracer = null;
  10344. // The list of {@link ParseTreeListener} listeners registered to receive
  10345. // events during the parse.
  10346. this._parseListeners = null;
  10347. // The number of syntax errors reported during parsing. this value is
  10348. // incremented each time {@link //notifyErrorListeners} is called.
  10349. this._syntaxErrors = 0;
  10350. this.setInputStream(input);
  10351. return this;
  10352. }
  10353. Parser.prototype = Object.create(Recognizer.prototype);
  10354. Parser.prototype.contructor = Parser;
  10355. // this field maps from the serialized ATN string to the deserialized {@link
  10356. // ATN} with
  10357. // bypass alternatives.
  10358. //
  10359. // @see ATNDeserializationOptions//isGenerateRuleBypassTransitions()
  10360. //
  10361. Parser.bypassAltsAtnCache = {};
  10362. // reset the parser's state//
  10363. Parser.prototype.reset = function () {
  10364. if (this._input !== null) {
  10365. this._input.seek(0);
  10366. }
  10367. this._errHandler.reset(this);
  10368. this._ctx = null;
  10369. this._syntaxErrors = 0;
  10370. this.setTrace(false);
  10371. this._precedenceStack = [];
  10372. this._precedenceStack.push(0);
  10373. if (this._interp !== null) {
  10374. this._interp.reset();
  10375. }
  10376. };
  10377. // Match current input symbol against {@code ttype}. If the symbol type
  10378. // matches, {@link ANTLRErrorStrategy//reportMatch} and {@link //consume} are
  10379. // called to complete the match process.
  10380. //
  10381. // <p>If the symbol type does not match,
  10382. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  10383. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  10384. // {@code true} and the token index of the symbol returned by
  10385. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  10386. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  10387. //
  10388. // @param ttype the token type to match
  10389. // @return the matched symbol
  10390. // @throws RecognitionException if the current input symbol did not match
  10391. // {@code ttype} and the error strategy could not recover from the
  10392. // mismatched symbol
  10393. Parser.prototype.match = function (ttype) {
  10394. var t = this.getCurrentToken();
  10395. if (t.type === ttype) {
  10396. this._errHandler.reportMatch(this);
  10397. this.consume();
  10398. } else {
  10399. t = this._errHandler.recoverInline(this);
  10400. if (this.buildParseTrees && t.tokenIndex === -1) {
  10401. // we must have conjured up a new token during single token
  10402. // insertion
  10403. // if it's not the current symbol
  10404. this._ctx.addErrorNode(t);
  10405. }
  10406. }
  10407. return t;
  10408. };
  10409. // Match current input symbol as a wildcard. If the symbol type matches
  10410. // (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}
  10411. // and {@link //consume} are called to complete the match process.
  10412. //
  10413. // <p>If the symbol type does not match,
  10414. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  10415. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  10416. // {@code true} and the token index of the symbol returned by
  10417. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  10418. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  10419. //
  10420. // @return the matched symbol
  10421. // @throws RecognitionException if the current input symbol did not match
  10422. // a wildcard and the error strategy could not recover from the mismatched
  10423. // symbol
  10424. Parser.prototype.matchWildcard = function () {
  10425. var t = this.getCurrentToken();
  10426. if (t.type > 0) {
  10427. this._errHandler.reportMatch(this);
  10428. this.consume();
  10429. } else {
  10430. t = this._errHandler.recoverInline(this);
  10431. if (this._buildParseTrees && t.tokenIndex === -1) {
  10432. // we must have conjured up a new token during single token
  10433. // insertion
  10434. // if it's not the current symbol
  10435. this._ctx.addErrorNode(t);
  10436. }
  10437. }
  10438. return t;
  10439. };
  10440. Parser.prototype.getParseListeners = function () {
  10441. return this._parseListeners || [];
  10442. };
  10443. // Registers {@code listener} to receive events during the parsing process.
  10444. //
  10445. // <p>To support output-preserving grammar transformations (including but not
  10446. // limited to left-recursion removal, automated left-factoring, and
  10447. // optimized code generation), calls to listener methods during the parse
  10448. // may differ substantially from calls made by
  10449. // {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In
  10450. // particular, rule entry and exit events may occur in a different order
  10451. // during the parse than after the parser. In addition, calls to certain
  10452. // rule entry methods may be omitted.</p>
  10453. //
  10454. // <p>With the following specific exceptions, calls to listener events are
  10455. // <em>deterministic</em>, i.e. for identical input the calls to listener
  10456. // methods will be the same.</p>
  10457. //
  10458. // <ul>
  10459. // <li>Alterations to the grammar used to generate code may change the
  10460. // behavior of the listener calls.</li>
  10461. // <li>Alterations to the command line options passed to ANTLR 4 when
  10462. // generating the parser may change the behavior of the listener calls.</li>
  10463. // <li>Changing the version of the ANTLR Tool used to generate the parser
  10464. // may change the behavior of the listener calls.</li>
  10465. // </ul>
  10466. //
  10467. // @param listener the listener to add
  10468. //
  10469. // @throws NullPointerException if {@code} listener is {@code null}
  10470. //
  10471. Parser.prototype.addParseListener = function (listener) {
  10472. if (listener === null) {
  10473. throw "listener";
  10474. }
  10475. if (this._parseListeners === null) {
  10476. this._parseListeners = [];
  10477. }
  10478. this._parseListeners.push(listener);
  10479. };
  10480. //
  10481. // Remove {@code listener} from the list of parse listeners.
  10482. //
  10483. // <p>If {@code listener} is {@code null} or has not been added as a parse
  10484. // listener, this method does nothing.</p>
  10485. // @param listener the listener to remove
  10486. //
  10487. Parser.prototype.removeParseListener = function (listener) {
  10488. if (this._parseListeners !== null) {
  10489. var idx = this._parseListeners.indexOf(listener);
  10490. if (idx >= 0) {
  10491. this._parseListeners.splice(idx, 1);
  10492. }
  10493. if (this._parseListeners.length === 0) {
  10494. this._parseListeners = null;
  10495. }
  10496. }
  10497. };
  10498. // Remove all parse listeners.
  10499. Parser.prototype.removeParseListeners = function () {
  10500. this._parseListeners = null;
  10501. };
  10502. // Notify any parse listeners of an enter rule event.
  10503. Parser.prototype.triggerEnterRuleEvent = function () {
  10504. if (this._parseListeners !== null) {
  10505. var ctx = this._ctx;
  10506. this._parseListeners.map(function (listener) {
  10507. listener.enterEveryRule(ctx);
  10508. ctx.enterRule(listener);
  10509. });
  10510. }
  10511. };
  10512. //
  10513. // Notify any parse listeners of an exit rule event.
  10514. //
  10515. // @see //addParseListener
  10516. //
  10517. Parser.prototype.triggerExitRuleEvent = function () {
  10518. if (this._parseListeners !== null) {
  10519. // reverse order walk of listeners
  10520. var ctx = this._ctx;
  10521. this._parseListeners.slice(0).reverse().map(function (listener) {
  10522. ctx.exitRule(listener);
  10523. listener.exitEveryRule(ctx);
  10524. });
  10525. }
  10526. };
  10527. Parser.prototype.getTokenFactory = function () {
  10528. return this._input.tokenSource._factory;
  10529. };
  10530. // Tell our token source and error strategy about a new way to create tokens.//
  10531. Parser.prototype.setTokenFactory = function (factory) {
  10532. this._input.tokenSource._factory = factory;
  10533. };
  10534. // The ATN with bypass alternatives is expensive to create so we create it
  10535. // lazily.
  10536. //
  10537. // @throws UnsupportedOperationException if the current parser does not
  10538. // implement the {@link //getSerializedATN()} method.
  10539. //
  10540. Parser.prototype.getATNWithBypassAlts = function () {
  10541. var serializedAtn = this.getSerializedATN();
  10542. if (serializedAtn === null) {
  10543. throw "The current parser does not support an ATN with bypass alternatives.";
  10544. }
  10545. var result = this.bypassAltsAtnCache[serializedAtn];
  10546. if (result === null) {
  10547. var deserializationOptions = new ATNDeserializationOptions();
  10548. deserializationOptions.generateRuleBypassTransitions = true;
  10549. result = new ATNDeserializer(deserializationOptions).deserialize(serializedAtn);
  10550. this.bypassAltsAtnCache[serializedAtn] = result;
  10551. }
  10552. return result;
  10553. };
  10554. // The preferred method of getting a tree pattern. For example, here's a
  10555. // sample use:
  10556. //
  10557. // <pre>
  10558. // ParseTree t = parser.expr();
  10559. // ParseTreePattern p = parser.compileParseTreePattern("&lt;ID&gt;+0",
  10560. // MyParser.RULE_expr);
  10561. // ParseTreeMatch m = p.match(t);
  10562. // String id = m.get("ID");
  10563. // </pre>
  10564. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  10565. Parser.prototype.compileParseTreePattern = function (pattern, patternRuleIndex, lexer) {
  10566. lexer = lexer || null;
  10567. if (lexer === null) {
  10568. if (this.getTokenStream() !== null) {
  10569. var tokenSource = this.getTokenStream().tokenSource;
  10570. if (tokenSource instanceof Lexer) {
  10571. lexer = tokenSource;
  10572. }
  10573. }
  10574. }
  10575. if (lexer === null) {
  10576. throw "Parser can't discover a lexer to use";
  10577. }
  10578. var m = new ParseTreePatternMatcher(lexer, this);
  10579. return m.compile(pattern, patternRuleIndex);
  10580. };
  10581. Parser.prototype.getInputStream = function () {
  10582. return this.getTokenStream();
  10583. };
  10584. Parser.prototype.setInputStream = function (input) {
  10585. this.setTokenStream(input);
  10586. };
  10587. Parser.prototype.getTokenStream = function () {
  10588. return this._input;
  10589. };
  10590. // Set the token stream and reset the parser.//
  10591. Parser.prototype.setTokenStream = function (input) {
  10592. this._input = null;
  10593. this.reset();
  10594. this._input = input;
  10595. };
  10596. // Match needs to return the current input symbol, which gets put
  10597. // into the label for the associated token ref; e.g., x=ID.
  10598. //
  10599. Parser.prototype.getCurrentToken = function () {
  10600. return this._input.LT(1);
  10601. };
  10602. Parser.prototype.notifyErrorListeners = function (msg, offendingToken, err) {
  10603. offendingToken = offendingToken || null;
  10604. err = err || null;
  10605. if (offendingToken === null) {
  10606. offendingToken = this.getCurrentToken();
  10607. }
  10608. this._syntaxErrors += 1;
  10609. var line = offendingToken.line;
  10610. var column = offendingToken.column;
  10611. var listener = this.getErrorListenerDispatch();
  10612. listener.syntaxError(this, offendingToken, line, column, msg, err);
  10613. };
  10614. //
  10615. // Consume and return the {@linkplain //getCurrentToken current symbol}.
  10616. //
  10617. // <p>E.g., given the following input with {@code A} being the current
  10618. // lookahead symbol, this function moves the cursor to {@code B} and returns
  10619. // {@code A}.</p>
  10620. //
  10621. // <pre>
  10622. // A B
  10623. // ^
  10624. // </pre>
  10625. //
  10626. // If the parser is not in error recovery mode, the consumed symbol is added
  10627. // to the parse tree using {@link ParserRuleContext//addChild(Token)}, and
  10628. // {@link ParseTreeListener//visitTerminal} is called on any parse listeners.
  10629. // If the parser <em>is</em> in error recovery mode, the consumed symbol is
  10630. // added to the parse tree using
  10631. // {@link ParserRuleContext//addErrorNode(Token)}, and
  10632. // {@link ParseTreeListener//visitErrorNode} is called on any parse
  10633. // listeners.
  10634. //
  10635. Parser.prototype.consume = function () {
  10636. var o = this.getCurrentToken();
  10637. if (o.type !== Token.EOF) {
  10638. this.getInputStream().consume();
  10639. }
  10640. var hasListener = this._parseListeners !== null && this._parseListeners.length > 0;
  10641. if (this.buildParseTrees || hasListener) {
  10642. var node;
  10643. if (this._errHandler.inErrorRecoveryMode(this)) {
  10644. node = this._ctx.addErrorNode(o);
  10645. } else {
  10646. node = this._ctx.addTokenNode(o);
  10647. }
  10648. node.invokingState = this.state;
  10649. if (hasListener) {
  10650. this._parseListeners.map(function (listener) {
  10651. if (node instanceof ErrorNode || node.isErrorNode !== undefined && node.isErrorNode()) {
  10652. listener.visitErrorNode(node);
  10653. } else if (node instanceof TerminalNode) {
  10654. listener.visitTerminal(node);
  10655. }
  10656. });
  10657. }
  10658. }
  10659. return o;
  10660. };
  10661. Parser.prototype.addContextToParseTree = function () {
  10662. // add current context to parent if we have a parent
  10663. if (this._ctx.parentCtx !== null) {
  10664. this._ctx.parentCtx.addChild(this._ctx);
  10665. }
  10666. };
  10667. // Always called by generated parsers upon entry to a rule. Access field
  10668. // {@link //_ctx} get the current context.
  10669. Parser.prototype.enterRule = function (localctx, state, ruleIndex) {
  10670. this.state = state;
  10671. this._ctx = localctx;
  10672. this._ctx.start = this._input.LT(1);
  10673. if (this.buildParseTrees) {
  10674. this.addContextToParseTree();
  10675. }
  10676. if (this._parseListeners !== null) {
  10677. this.triggerEnterRuleEvent();
  10678. }
  10679. };
  10680. Parser.prototype.exitRule = function () {
  10681. this._ctx.stop = this._input.LT(-1);
  10682. // trigger event on _ctx, before it reverts to parent
  10683. if (this._parseListeners !== null) {
  10684. this.triggerExitRuleEvent();
  10685. }
  10686. this.state = this._ctx.invokingState;
  10687. this._ctx = this._ctx.parentCtx;
  10688. };
  10689. Parser.prototype.enterOuterAlt = function (localctx, altNum) {
  10690. localctx.setAltNumber(altNum);
  10691. // if we have new localctx, make sure we replace existing ctx
  10692. // that is previous child of parse tree
  10693. if (this.buildParseTrees && this._ctx !== localctx) {
  10694. if (this._ctx.parentCtx !== null) {
  10695. this._ctx.parentCtx.removeLastChild();
  10696. this._ctx.parentCtx.addChild(localctx);
  10697. }
  10698. }
  10699. this._ctx = localctx;
  10700. };
  10701. // Get the precedence level for the top-most precedence rule.
  10702. //
  10703. // @return The precedence level for the top-most precedence rule, or -1 if
  10704. // the parser context is not nested within a precedence rule.
  10705. Parser.prototype.getPrecedence = function () {
  10706. if (this._precedenceStack.length === 0) {
  10707. return -1;
  10708. } else {
  10709. return this._precedenceStack[this._precedenceStack.length - 1];
  10710. }
  10711. };
  10712. Parser.prototype.enterRecursionRule = function (localctx, state, ruleIndex, precedence) {
  10713. this.state = state;
  10714. this._precedenceStack.push(precedence);
  10715. this._ctx = localctx;
  10716. this._ctx.start = this._input.LT(1);
  10717. if (this._parseListeners !== null) {
  10718. this.triggerEnterRuleEvent(); // simulates rule entry for
  10719. // left-recursive rules
  10720. }
  10721. };
  10722. //
  10723. // Like {@link //enterRule} but for recursive rules.
  10724. Parser.prototype.pushNewRecursionContext = function (localctx, state, ruleIndex) {
  10725. var previous = this._ctx;
  10726. previous.parentCtx = localctx;
  10727. previous.invokingState = state;
  10728. previous.stop = this._input.LT(-1);
  10729. this._ctx = localctx;
  10730. this._ctx.start = previous.start;
  10731. if (this.buildParseTrees) {
  10732. this._ctx.addChild(previous);
  10733. }
  10734. if (this._parseListeners !== null) {
  10735. this.triggerEnterRuleEvent(); // simulates rule entry for
  10736. // left-recursive rules
  10737. }
  10738. };
  10739. Parser.prototype.unrollRecursionContexts = function (parentCtx) {
  10740. this._precedenceStack.pop();
  10741. this._ctx.stop = this._input.LT(-1);
  10742. var retCtx = this._ctx; // save current ctx (return value)
  10743. // unroll so _ctx is as it was before call to recursive method
  10744. if (this._parseListeners !== null) {
  10745. while (this._ctx !== parentCtx) {
  10746. this.triggerExitRuleEvent();
  10747. this._ctx = this._ctx.parentCtx;
  10748. }
  10749. } else {
  10750. this._ctx = parentCtx;
  10751. }
  10752. // hook into tree
  10753. retCtx.parentCtx = parentCtx;
  10754. if (this.buildParseTrees && parentCtx !== null) {
  10755. // add return ctx into invoking rule's tree
  10756. parentCtx.addChild(retCtx);
  10757. }
  10758. };
  10759. Parser.prototype.getInvokingContext = function (ruleIndex) {
  10760. var ctx = this._ctx;
  10761. while (ctx !== null) {
  10762. if (ctx.ruleIndex === ruleIndex) {
  10763. return ctx;
  10764. }
  10765. ctx = ctx.parentCtx;
  10766. }
  10767. return null;
  10768. };
  10769. Parser.prototype.precpred = function (localctx, precedence) {
  10770. return precedence >= this._precedenceStack[this._precedenceStack.length - 1];
  10771. };
  10772. Parser.prototype.inContext = function (context) {
  10773. // TODO: useful in parser?
  10774. return false;
  10775. };
  10776. //
  10777. // Checks whether or not {@code symbol} can follow the current state in the
  10778. // ATN. The behavior of this method is equivalent to the following, but is
  10779. // implemented such that the complete context-sensitive follow set does not
  10780. // need to be explicitly constructed.
  10781. //
  10782. // <pre>
  10783. // return getExpectedTokens().contains(symbol);
  10784. // </pre>
  10785. //
  10786. // @param symbol the symbol type to check
  10787. // @return {@code true} if {@code symbol} can follow the current state in
  10788. // the ATN, otherwise {@code false}.
  10789. Parser.prototype.isExpectedToken = function (symbol) {
  10790. var atn = this._interp.atn;
  10791. var ctx = this._ctx;
  10792. var s = atn.states[this.state];
  10793. var following = atn.nextTokens(s);
  10794. if (following.contains(symbol)) {
  10795. return true;
  10796. }
  10797. if (!following.contains(Token.EPSILON)) {
  10798. return false;
  10799. }
  10800. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  10801. var invokingState = atn.states[ctx.invokingState];
  10802. var rt = invokingState.transitions[0];
  10803. following = atn.nextTokens(rt.followState);
  10804. if (following.contains(symbol)) {
  10805. return true;
  10806. }
  10807. ctx = ctx.parentCtx;
  10808. }
  10809. if (following.contains(Token.EPSILON) && symbol === Token.EOF) {
  10810. return true;
  10811. } else {
  10812. return false;
  10813. }
  10814. };
  10815. // Computes the set of input symbols which could follow the current parser
  10816. // state and context, as given by {@link //getState} and {@link //getContext},
  10817. // respectively.
  10818. //
  10819. // @see ATN//getExpectedTokens(int, RuleContext)
  10820. //
  10821. Parser.prototype.getExpectedTokens = function () {
  10822. return this._interp.atn.getExpectedTokens(this.state, this._ctx);
  10823. };
  10824. Parser.prototype.getExpectedTokensWithinCurrentRule = function () {
  10825. var atn = this._interp.atn;
  10826. var s = atn.states[this.state];
  10827. return atn.nextTokens(s);
  10828. };
  10829. // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//
  10830. Parser.prototype.getRuleIndex = function (ruleName) {
  10831. var ruleIndex = this.getRuleIndexMap()[ruleName];
  10832. if (ruleIndex !== null) {
  10833. return ruleIndex;
  10834. } else {
  10835. return -1;
  10836. }
  10837. };
  10838. // Return List&lt;String&gt; of the rule names in your parser instance
  10839. // leading up to a call to the current rule. You could override if
  10840. // you want more details such as the file/line info of where
  10841. // in the ATN a rule is invoked.
  10842. //
  10843. // this is very useful for error messages.
  10844. //
  10845. Parser.prototype.getRuleInvocationStack = function (p) {
  10846. p = p || null;
  10847. if (p === null) {
  10848. p = this._ctx;
  10849. }
  10850. var stack = [];
  10851. while (p !== null) {
  10852. // compute what follows who invoked us
  10853. var ruleIndex = p.ruleIndex;
  10854. if (ruleIndex < 0) {
  10855. stack.push("n/a");
  10856. } else {
  10857. stack.push(this.ruleNames[ruleIndex]);
  10858. }
  10859. p = p.parentCtx;
  10860. }
  10861. return stack;
  10862. };
  10863. // For debugging and other purposes.//
  10864. Parser.prototype.getDFAStrings = function () {
  10865. return this._interp.decisionToDFA.toString();
  10866. };
  10867. // For debugging and other purposes.//
  10868. Parser.prototype.dumpDFA = function () {
  10869. var seenOne = false;
  10870. for (var i = 0; i < this._interp.decisionToDFA.length; i++) {
  10871. var dfa = this._interp.decisionToDFA[i];
  10872. if (dfa.states.length > 0) {
  10873. if (seenOne) {
  10874. console.log();
  10875. }
  10876. this.printer.println("Decision " + dfa.decision + ":");
  10877. this.printer.print(dfa.toString(this.literalNames, this.symbolicNames));
  10878. seenOne = true;
  10879. }
  10880. }
  10881. };
  10882. /*
  10883. " printer = function() {\r\n" +
  10884. " this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
  10885. " this.print = function(s) { document.getElementById('output') += s; }\r\n" +
  10886. " };\r\n" +
  10887. */
  10888. Parser.prototype.getSourceName = function () {
  10889. return this._input.sourceName;
  10890. };
  10891. // During a parse is sometimes useful to listen in on the rule entry and exit
  10892. // events as well as token matches. this is for quick and dirty debugging.
  10893. //
  10894. Parser.prototype.setTrace = function (trace) {
  10895. if (!trace) {
  10896. this.removeParseListener(this._tracer);
  10897. this._tracer = null;
  10898. } else {
  10899. if (this._tracer !== null) {
  10900. this.removeParseListener(this._tracer);
  10901. }
  10902. this._tracer = new TraceListener(this);
  10903. this.addParseListener(this._tracer);
  10904. }
  10905. };
  10906. exports.Parser = Parser;
  10907. /***/ }),
  10908. /***/ "./node_modules/antlr4/ParserRuleContext.js":
  10909. /*!**************************************************!*\
  10910. !*** ./node_modules/antlr4/ParserRuleContext.js ***!
  10911. \**************************************************/
  10912. /*! no static exports found */
  10913. /***/ (function(module, exports, __webpack_require__) {
  10914. "use strict";
  10915. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  10916. * Use of this file is governed by the BSD 3-clause license that
  10917. * can be found in the LICENSE.txt file in the project root.
  10918. */
  10919. //* A rule invocation record for parsing.
  10920. //
  10921. // Contains all of the information about the current rule not stored in the
  10922. // RuleContext. It handles parse tree children list, Any ATN state
  10923. // tracing, and the default values available for rule indications:
  10924. // start, stop, rule index, current alt number, current
  10925. // ATN state.
  10926. //
  10927. // Subclasses made for each rule and grammar track the parameters,
  10928. // return values, locals, and labels specific to that rule. These
  10929. // are the objects that are returned from rules.
  10930. //
  10931. // Note text is not an actual field of a rule return value; it is computed
  10932. // from start and stop using the input stream's toString() method. I
  10933. // could add a ctor to this so that we can pass in and store the input
  10934. // stream, but I'm not sure we want to do that. It would seem to be undefined
  10935. // to get the .text property anyway if the rule matches tokens from multiple
  10936. // input streams.
  10937. //
  10938. // I do not use getters for fields of objects that are used simply to
  10939. // group values such as this aggregate. The getters/setters are there to
  10940. // satisfy the superclass interface.
  10941. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  10942. var Tree = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js");
  10943. var INVALID_INTERVAL = Tree.INVALID_INTERVAL;
  10944. var TerminalNode = Tree.TerminalNode;
  10945. var TerminalNodeImpl = Tree.TerminalNodeImpl;
  10946. var ErrorNodeImpl = Tree.ErrorNodeImpl;
  10947. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  10948. function ParserRuleContext(parent, invokingStateNumber) {
  10949. parent = parent || null;
  10950. invokingStateNumber = invokingStateNumber || null;
  10951. RuleContext.call(this, parent, invokingStateNumber);
  10952. this.ruleIndex = -1;
  10953. // * If we are debugging or building a parse tree for a visitor,
  10954. // we need to track all of the tokens and rule invocations associated
  10955. // with this rule's context. This is empty for parsing w/o tree constr.
  10956. // operation because we don't the need to track the details about
  10957. // how we parse this rule.
  10958. // /
  10959. this.children = null;
  10960. this.start = null;
  10961. this.stop = null;
  10962. // The exception that forced this rule to return. If the rule successfully
  10963. // completed, this is {@code null}.
  10964. this.exception = null;
  10965. }
  10966. ParserRuleContext.prototype = Object.create(RuleContext.prototype);
  10967. ParserRuleContext.prototype.constructor = ParserRuleContext;
  10968. // * COPY a ctx (I'm deliberately not using copy constructor)///
  10969. ParserRuleContext.prototype.copyFrom = function (ctx) {
  10970. // from RuleContext
  10971. this.parentCtx = ctx.parentCtx;
  10972. this.invokingState = ctx.invokingState;
  10973. this.children = null;
  10974. this.start = ctx.start;
  10975. this.stop = ctx.stop;
  10976. // copy any error nodes to alt label node
  10977. if (ctx.children) {
  10978. this.children = [];
  10979. // reset parent pointer for any error nodes
  10980. ctx.children.map(function (child) {
  10981. if (child instanceof ErrorNodeImpl) {
  10982. this.children.push(child);
  10983. child.parentCtx = this;
  10984. }
  10985. }, this);
  10986. }
  10987. };
  10988. // Double dispatch methods for listeners
  10989. ParserRuleContext.prototype.enterRule = function (listener) {};
  10990. ParserRuleContext.prototype.exitRule = function (listener) {};
  10991. // * Does not set parent link; other add methods do that///
  10992. ParserRuleContext.prototype.addChild = function (child) {
  10993. if (this.children === null) {
  10994. this.children = [];
  10995. }
  10996. this.children.push(child);
  10997. return child;
  10998. };
  10999. // * Used by enterOuterAlt to toss out a RuleContext previously added as
  11000. // we entered a rule. If we have // label, we will need to remove
  11001. // generic ruleContext object.
  11002. // /
  11003. ParserRuleContext.prototype.removeLastChild = function () {
  11004. if (this.children !== null) {
  11005. this.children.pop();
  11006. }
  11007. };
  11008. ParserRuleContext.prototype.addTokenNode = function (token) {
  11009. var node = new TerminalNodeImpl(token);
  11010. this.addChild(node);
  11011. node.parentCtx = this;
  11012. return node;
  11013. };
  11014. ParserRuleContext.prototype.addErrorNode = function (badToken) {
  11015. var node = new ErrorNodeImpl(badToken);
  11016. this.addChild(node);
  11017. node.parentCtx = this;
  11018. return node;
  11019. };
  11020. ParserRuleContext.prototype.getChild = function (i, type) {
  11021. type = type || null;
  11022. if (this.children === null || i < 0 || i >= this.children.length) {
  11023. return null;
  11024. }
  11025. if (type === null) {
  11026. return this.children[i];
  11027. } else {
  11028. for (var j = 0; j < this.children.length; j++) {
  11029. var child = this.children[j];
  11030. if (child instanceof type) {
  11031. if (i === 0) {
  11032. return child;
  11033. } else {
  11034. i -= 1;
  11035. }
  11036. }
  11037. }
  11038. return null;
  11039. }
  11040. };
  11041. ParserRuleContext.prototype.getToken = function (ttype, i) {
  11042. if (this.children === null || i < 0 || i >= this.children.length) {
  11043. return null;
  11044. }
  11045. for (var j = 0; j < this.children.length; j++) {
  11046. var child = this.children[j];
  11047. if (child instanceof TerminalNode) {
  11048. if (child.symbol.type === ttype) {
  11049. if (i === 0) {
  11050. return child;
  11051. } else {
  11052. i -= 1;
  11053. }
  11054. }
  11055. }
  11056. }
  11057. return null;
  11058. };
  11059. ParserRuleContext.prototype.getTokens = function (ttype) {
  11060. if (this.children === null) {
  11061. return [];
  11062. } else {
  11063. var tokens = [];
  11064. for (var j = 0; j < this.children.length; j++) {
  11065. var child = this.children[j];
  11066. if (child instanceof TerminalNode) {
  11067. if (child.symbol.type === ttype) {
  11068. tokens.push(child);
  11069. }
  11070. }
  11071. }
  11072. return tokens;
  11073. }
  11074. };
  11075. ParserRuleContext.prototype.getTypedRuleContext = function (ctxType, i) {
  11076. return this.getChild(i, ctxType);
  11077. };
  11078. ParserRuleContext.prototype.getTypedRuleContexts = function (ctxType) {
  11079. if (this.children === null) {
  11080. return [];
  11081. } else {
  11082. var contexts = [];
  11083. for (var j = 0; j < this.children.length; j++) {
  11084. var child = this.children[j];
  11085. if (child instanceof ctxType) {
  11086. contexts.push(child);
  11087. }
  11088. }
  11089. return contexts;
  11090. }
  11091. };
  11092. ParserRuleContext.prototype.getChildCount = function () {
  11093. if (this.children === null) {
  11094. return 0;
  11095. } else {
  11096. return this.children.length;
  11097. }
  11098. };
  11099. ParserRuleContext.prototype.getSourceInterval = function () {
  11100. if (this.start === null || this.stop === null) {
  11101. return INVALID_INTERVAL;
  11102. } else {
  11103. return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
  11104. }
  11105. };
  11106. RuleContext.EMPTY = new ParserRuleContext();
  11107. function InterpreterRuleContext(parent, invokingStateNumber, ruleIndex) {
  11108. ParserRuleContext.call(parent, invokingStateNumber);
  11109. this.ruleIndex = ruleIndex;
  11110. return this;
  11111. }
  11112. InterpreterRuleContext.prototype = Object.create(ParserRuleContext.prototype);
  11113. InterpreterRuleContext.prototype.constructor = InterpreterRuleContext;
  11114. exports.ParserRuleContext = ParserRuleContext;
  11115. /***/ }),
  11116. /***/ "./node_modules/antlr4/PredictionContext.js":
  11117. /*!**************************************************!*\
  11118. !*** ./node_modules/antlr4/PredictionContext.js ***!
  11119. \**************************************************/
  11120. /*! no static exports found */
  11121. /***/ (function(module, exports, __webpack_require__) {
  11122. "use strict";
  11123. //
  11124. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  11125. * Use of this file is governed by the BSD 3-clause license that
  11126. * can be found in the LICENSE.txt file in the project root.
  11127. */
  11128. ///
  11129. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  11130. var Hash = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Hash;
  11131. function PredictionContext(cachedHashCode) {
  11132. this.cachedHashCode = cachedHashCode;
  11133. }
  11134. // Represents {@code $} in local context prediction, which means wildcard.
  11135. // {@code//+x =//}.
  11136. // /
  11137. PredictionContext.EMPTY = null;
  11138. // Represents {@code $} in an array in full context mode, when {@code $}
  11139. // doesn't mean wildcard: {@code $ + x = [$,x]}. Here,
  11140. // {@code $} = {@link //EMPTY_RETURN_STATE}.
  11141. // /
  11142. PredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;
  11143. PredictionContext.globalNodeCount = 1;
  11144. PredictionContext.id = PredictionContext.globalNodeCount;
  11145. // Stores the computed hash code of this {@link PredictionContext}. The hash
  11146. // code is computed in parts to match the following reference algorithm.
  11147. //
  11148. // <pre>
  11149. // private int referenceHashCode() {
  11150. // int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link
  11151. // //INITIAL_HASH});
  11152. //
  11153. // for (int i = 0; i &lt; {@link //size()}; i++) {
  11154. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent
  11155. // getParent}(i));
  11156. // }
  11157. //
  11158. // for (int i = 0; i &lt; {@link //size()}; i++) {
  11159. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link
  11160. // //getReturnState getReturnState}(i));
  11161. // }
  11162. //
  11163. // hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link
  11164. // //size()});
  11165. // return hash;
  11166. // }
  11167. // </pre>
  11168. // /
  11169. // This means only the {@link //EMPTY} context is in set.
  11170. PredictionContext.prototype.isEmpty = function () {
  11171. return this === PredictionContext.EMPTY;
  11172. };
  11173. PredictionContext.prototype.hasEmptyPath = function () {
  11174. return this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;
  11175. };
  11176. PredictionContext.prototype.hashCode = function () {
  11177. return this.cachedHashCode;
  11178. };
  11179. PredictionContext.prototype.updateHashCode = function (hash) {
  11180. hash.update(this.cachedHashCode);
  11181. };
  11182. /*
  11183. function calculateHashString(parent, returnState) {
  11184. return "" + parent + returnState;
  11185. }
  11186. */
  11187. // Used to cache {@link PredictionContext} objects. Its used for the shared
  11188. // context cash associated with contexts in DFA states. This cache
  11189. // can be used for both lexers and parsers.
  11190. function PredictionContextCache() {
  11191. this.cache = {};
  11192. return this;
  11193. }
  11194. // Add a context to the cache and return it. If the context already exists,
  11195. // return that one instead and do not add a new context to the cache.
  11196. // Protect shared cache from unsafe thread access.
  11197. //
  11198. PredictionContextCache.prototype.add = function (ctx) {
  11199. if (ctx === PredictionContext.EMPTY) {
  11200. return PredictionContext.EMPTY;
  11201. }
  11202. var existing = this.cache[ctx] || null;
  11203. if (existing !== null) {
  11204. return existing;
  11205. }
  11206. this.cache[ctx] = ctx;
  11207. return ctx;
  11208. };
  11209. PredictionContextCache.prototype.get = function (ctx) {
  11210. return this.cache[ctx] || null;
  11211. };
  11212. Object.defineProperty(PredictionContextCache.prototype, "length", {
  11213. get: function get() {
  11214. return this.cache.length;
  11215. }
  11216. });
  11217. function SingletonPredictionContext(parent, returnState) {
  11218. var hashCode = 0;
  11219. if (parent !== null) {
  11220. var hash = new Hash();
  11221. hash.update(parent, returnState);
  11222. hashCode = hash.finish();
  11223. }
  11224. PredictionContext.call(this, hashCode);
  11225. this.parentCtx = parent;
  11226. this.returnState = returnState;
  11227. }
  11228. SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);
  11229. SingletonPredictionContext.prototype.contructor = SingletonPredictionContext;
  11230. SingletonPredictionContext.create = function (parent, returnState) {
  11231. if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
  11232. // someone can pass in the bits of an array ctx that mean $
  11233. return PredictionContext.EMPTY;
  11234. } else {
  11235. return new SingletonPredictionContext(parent, returnState);
  11236. }
  11237. };
  11238. Object.defineProperty(SingletonPredictionContext.prototype, "length", {
  11239. get: function get() {
  11240. return 1;
  11241. }
  11242. });
  11243. SingletonPredictionContext.prototype.getParent = function (index) {
  11244. return this.parentCtx;
  11245. };
  11246. SingletonPredictionContext.prototype.getReturnState = function (index) {
  11247. return this.returnState;
  11248. };
  11249. SingletonPredictionContext.prototype.equals = function (other) {
  11250. if (this === other) {
  11251. return true;
  11252. } else if (!(other instanceof SingletonPredictionContext)) {
  11253. return false;
  11254. } else if (this.hashCode() !== other.hashCode()) {
  11255. return false; // can't be same if hash is different
  11256. } else {
  11257. if (this.returnState !== other.returnState) return false;else if (this.parentCtx == null) return other.parentCtx == null;else return this.parentCtx.equals(other.parentCtx);
  11258. }
  11259. };
  11260. SingletonPredictionContext.prototype.toString = function () {
  11261. var up = this.parentCtx === null ? "" : this.parentCtx.toString();
  11262. if (up.length === 0) {
  11263. if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
  11264. return "$";
  11265. } else {
  11266. return "" + this.returnState;
  11267. }
  11268. } else {
  11269. return "" + this.returnState + " " + up;
  11270. }
  11271. };
  11272. function EmptyPredictionContext() {
  11273. SingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);
  11274. return this;
  11275. }
  11276. EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);
  11277. EmptyPredictionContext.prototype.constructor = EmptyPredictionContext;
  11278. EmptyPredictionContext.prototype.isEmpty = function () {
  11279. return true;
  11280. };
  11281. EmptyPredictionContext.prototype.getParent = function (index) {
  11282. return null;
  11283. };
  11284. EmptyPredictionContext.prototype.getReturnState = function (index) {
  11285. return this.returnState;
  11286. };
  11287. EmptyPredictionContext.prototype.equals = function (other) {
  11288. return this === other;
  11289. };
  11290. EmptyPredictionContext.prototype.toString = function () {
  11291. return "$";
  11292. };
  11293. PredictionContext.EMPTY = new EmptyPredictionContext();
  11294. function ArrayPredictionContext(parents, returnStates) {
  11295. // Parent can be null only if full ctx mode and we make an array
  11296. // from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using
  11297. // null parent and
  11298. // returnState == {@link //EMPTY_RETURN_STATE}.
  11299. var h = new Hash();
  11300. h.update(parents, returnStates);
  11301. var hashCode = h.finish();
  11302. PredictionContext.call(this, hashCode);
  11303. this.parents = parents;
  11304. this.returnStates = returnStates;
  11305. return this;
  11306. }
  11307. ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);
  11308. ArrayPredictionContext.prototype.constructor = ArrayPredictionContext;
  11309. ArrayPredictionContext.prototype.isEmpty = function () {
  11310. // since EMPTY_RETURN_STATE can only appear in the last position, we
  11311. // don't need to verify that size==1
  11312. return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
  11313. };
  11314. Object.defineProperty(ArrayPredictionContext.prototype, "length", {
  11315. get: function get() {
  11316. return this.returnStates.length;
  11317. }
  11318. });
  11319. ArrayPredictionContext.prototype.getParent = function (index) {
  11320. return this.parents[index];
  11321. };
  11322. ArrayPredictionContext.prototype.getReturnState = function (index) {
  11323. return this.returnStates[index];
  11324. };
  11325. ArrayPredictionContext.prototype.equals = function (other) {
  11326. if (this === other) {
  11327. return true;
  11328. } else if (!(other instanceof ArrayPredictionContext)) {
  11329. return false;
  11330. } else if (this.hashCode() !== other.hashCode()) {
  11331. return false; // can't be same if hash is different
  11332. } else {
  11333. return this.returnStates === other.returnStates && this.parents === other.parents;
  11334. }
  11335. };
  11336. ArrayPredictionContext.prototype.toString = function () {
  11337. if (this.isEmpty()) {
  11338. return "[]";
  11339. } else {
  11340. var s = "[";
  11341. for (var i = 0; i < this.returnStates.length; i++) {
  11342. if (i > 0) {
  11343. s = s + ", ";
  11344. }
  11345. if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
  11346. s = s + "$";
  11347. continue;
  11348. }
  11349. s = s + this.returnStates[i];
  11350. if (this.parents[i] !== null) {
  11351. s = s + " " + this.parents[i];
  11352. } else {
  11353. s = s + "null";
  11354. }
  11355. }
  11356. return s + "]";
  11357. }
  11358. };
  11359. // Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.
  11360. // Return {@link //EMPTY} if {@code outerContext} is empty or null.
  11361. // /
  11362. function predictionContextFromRuleContext(atn, outerContext) {
  11363. if (outerContext === undefined || outerContext === null) {
  11364. outerContext = RuleContext.EMPTY;
  11365. }
  11366. // if we are in RuleContext of start rule, s, then PredictionContext
  11367. // is EMPTY. Nobody called us. (if we are empty, return empty)
  11368. if (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {
  11369. return PredictionContext.EMPTY;
  11370. }
  11371. // If we have a parent, convert it to a PredictionContext graph
  11372. var parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);
  11373. var state = atn.states[outerContext.invokingState];
  11374. var transition = state.transitions[0];
  11375. return SingletonPredictionContext.create(parent, transition.followState.stateNumber);
  11376. }
  11377. /*
  11378. function calculateListsHashString(parents, returnStates) {
  11379. var s = "";
  11380. parents.map(function(p) {
  11381. s = s + p;
  11382. });
  11383. returnStates.map(function(r) {
  11384. s = s + r;
  11385. });
  11386. return s;
  11387. }
  11388. */
  11389. function merge(a, b, rootIsWildcard, mergeCache) {
  11390. // share same graph if both same
  11391. if (a === b) {
  11392. return a;
  11393. }
  11394. if (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {
  11395. return mergeSingletons(a, b, rootIsWildcard, mergeCache);
  11396. }
  11397. // At least one of a or b is array
  11398. // If one is $ and rootIsWildcard, return $ as// wildcard
  11399. if (rootIsWildcard) {
  11400. if (a instanceof EmptyPredictionContext) {
  11401. return a;
  11402. }
  11403. if (b instanceof EmptyPredictionContext) {
  11404. return b;
  11405. }
  11406. }
  11407. // convert singleton so both are arrays to normalize
  11408. if (a instanceof SingletonPredictionContext) {
  11409. a = new ArrayPredictionContext([a.getParent()], [a.returnState]);
  11410. }
  11411. if (b instanceof SingletonPredictionContext) {
  11412. b = new ArrayPredictionContext([b.getParent()], [b.returnState]);
  11413. }
  11414. return mergeArrays(a, b, rootIsWildcard, mergeCache);
  11415. }
  11416. //
  11417. // Merge two {@link SingletonPredictionContext} instances.
  11418. //
  11419. // <p>Stack tops equal, parents merge is same; return left graph.<br>
  11420. // <embed src="images/SingletonMerge_SameRootSamePar.svg"
  11421. // type="image/svg+xml"/></p>
  11422. //
  11423. // <p>Same stack top, parents differ; merge parents giving array node, then
  11424. // remainders of those graphs. A new root node is created to point to the
  11425. // merged parents.<br>
  11426. // <embed src="images/SingletonMerge_SameRootDiffPar.svg"
  11427. // type="image/svg+xml"/></p>
  11428. //
  11429. // <p>Different stack tops pointing to same parent. Make array node for the
  11430. // root where both element in the root point to the same (original)
  11431. // parent.<br>
  11432. // <embed src="images/SingletonMerge_DiffRootSamePar.svg"
  11433. // type="image/svg+xml"/></p>
  11434. //
  11435. // <p>Different stack tops pointing to different parents. Make array node for
  11436. // the root where each element points to the corresponding original
  11437. // parent.<br>
  11438. // <embed src="images/SingletonMerge_DiffRootDiffPar.svg"
  11439. // type="image/svg+xml"/></p>
  11440. //
  11441. // @param a the first {@link SingletonPredictionContext}
  11442. // @param b the second {@link SingletonPredictionContext}
  11443. // @param rootIsWildcard {@code true} if this is a local-context merge,
  11444. // otherwise false to indicate a full-context merge
  11445. // @param mergeCache
  11446. // /
  11447. function mergeSingletons(a, b, rootIsWildcard, mergeCache) {
  11448. if (mergeCache !== null) {
  11449. var previous = mergeCache.get(a, b);
  11450. if (previous !== null) {
  11451. return previous;
  11452. }
  11453. previous = mergeCache.get(b, a);
  11454. if (previous !== null) {
  11455. return previous;
  11456. }
  11457. }
  11458. var rootMerge = mergeRoot(a, b, rootIsWildcard);
  11459. if (rootMerge !== null) {
  11460. if (mergeCache !== null) {
  11461. mergeCache.set(a, b, rootMerge);
  11462. }
  11463. return rootMerge;
  11464. }
  11465. if (a.returnState === b.returnState) {
  11466. var parent = merge(a.parentCtx, b.parentCtx, rootIsWildcard, mergeCache);
  11467. // if parent is same as existing a or b parent or reduced to a parent,
  11468. // return it
  11469. if (parent === a.parentCtx) {
  11470. return a; // ax + bx = ax, if a=b
  11471. }
  11472. if (parent === b.parentCtx) {
  11473. return b; // ax + bx = bx, if a=b
  11474. }
  11475. // else: ax + ay = a'[x,y]
  11476. // merge parents x and y, giving array node with x,y then remainders
  11477. // of those graphs. dup a, a' points at merged array
  11478. // new joined parent so create new singleton pointing to it, a'
  11479. var spc = SingletonPredictionContext.create(parent, a.returnState);
  11480. if (mergeCache !== null) {
  11481. mergeCache.set(a, b, spc);
  11482. }
  11483. return spc;
  11484. } else {
  11485. // a != b payloads differ
  11486. // see if we can collapse parents due to $+x parents if local ctx
  11487. var singleParent = null;
  11488. if (a === b || a.parentCtx !== null && a.parentCtx === b.parentCtx) {
  11489. // ax +
  11490. // bx =
  11491. // [a,b]x
  11492. singleParent = a.parentCtx;
  11493. }
  11494. if (singleParent !== null) {
  11495. // parents are same
  11496. // sort payloads and use same parent
  11497. var payloads = [a.returnState, b.returnState];
  11498. if (a.returnState > b.returnState) {
  11499. payloads[0] = b.returnState;
  11500. payloads[1] = a.returnState;
  11501. }
  11502. var parents = [singleParent, singleParent];
  11503. var apc = new ArrayPredictionContext(parents, payloads);
  11504. if (mergeCache !== null) {
  11505. mergeCache.set(a, b, apc);
  11506. }
  11507. return apc;
  11508. }
  11509. // parents differ and can't merge them. Just pack together
  11510. // into array; can't merge.
  11511. // ax + by = [ax,by]
  11512. var payloads = [a.returnState, b.returnState];
  11513. var parents = [a.parentCtx, b.parentCtx];
  11514. if (a.returnState > b.returnState) {
  11515. // sort by payload
  11516. payloads[0] = b.returnState;
  11517. payloads[1] = a.returnState;
  11518. parents = [b.parentCtx, a.parentCtx];
  11519. }
  11520. var a_ = new ArrayPredictionContext(parents, payloads);
  11521. if (mergeCache !== null) {
  11522. mergeCache.set(a, b, a_);
  11523. }
  11524. return a_;
  11525. }
  11526. }
  11527. //
  11528. // Handle case where at least one of {@code a} or {@code b} is
  11529. // {@link //EMPTY}. In the following diagrams, the symbol {@code $} is used
  11530. // to represent {@link //EMPTY}.
  11531. //
  11532. // <h2>Local-Context Merges</h2>
  11533. //
  11534. // <p>These local-context merge operations are used when {@code rootIsWildcard}
  11535. // is true.</p>
  11536. //
  11537. // <p>{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.<br>
  11538. // <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  11539. //
  11540. // <p>{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is
  11541. // {@code //EMPTY}; return left graph.<br>
  11542. // <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
  11543. //
  11544. // <p>Special case of last merge if local context.<br>
  11545. // <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
  11546. //
  11547. // <h2>Full-Context Merges</h2>
  11548. //
  11549. // <p>These full-context merge operations are used when {@code rootIsWildcard}
  11550. // is false.</p>
  11551. //
  11552. // <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
  11553. //
  11554. // <p>Must keep all contexts; {@link //EMPTY} in array is a special value (and
  11555. // null parent).<br>
  11556. // <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  11557. //
  11558. // <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
  11559. //
  11560. // @param a the first {@link SingletonPredictionContext}
  11561. // @param b the second {@link SingletonPredictionContext}
  11562. // @param rootIsWildcard {@code true} if this is a local-context merge,
  11563. // otherwise false to indicate a full-context merge
  11564. // /
  11565. function mergeRoot(a, b, rootIsWildcard) {
  11566. if (rootIsWildcard) {
  11567. if (a === PredictionContext.EMPTY) {
  11568. return PredictionContext.EMPTY; // // + b =//
  11569. }
  11570. if (b === PredictionContext.EMPTY) {
  11571. return PredictionContext.EMPTY; // a +// =//
  11572. }
  11573. } else {
  11574. if (a === PredictionContext.EMPTY && b === PredictionContext.EMPTY) {
  11575. return PredictionContext.EMPTY; // $ + $ = $
  11576. } else if (a === PredictionContext.EMPTY) {
  11577. // $ + x = [$,x]
  11578. var payloads = [b.returnState, PredictionContext.EMPTY_RETURN_STATE];
  11579. var parents = [b.parentCtx, null];
  11580. return new ArrayPredictionContext(parents, payloads);
  11581. } else if (b === PredictionContext.EMPTY) {
  11582. // x + $ = [$,x] ($ is always first if present)
  11583. var payloads = [a.returnState, PredictionContext.EMPTY_RETURN_STATE];
  11584. var parents = [a.parentCtx, null];
  11585. return new ArrayPredictionContext(parents, payloads);
  11586. }
  11587. }
  11588. return null;
  11589. }
  11590. //
  11591. // Merge two {@link ArrayPredictionContext} instances.
  11592. //
  11593. // <p>Different tops, different parents.<br>
  11594. // <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
  11595. //
  11596. // <p>Shared top, same parents.<br>
  11597. // <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
  11598. //
  11599. // <p>Shared top, different parents.<br>
  11600. // <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
  11601. //
  11602. // <p>Shared top, all shared parents.<br>
  11603. // <embed src="images/ArrayMerge_ShareTopSharePar.svg"
  11604. // type="image/svg+xml"/></p>
  11605. //
  11606. // <p>Equal tops, merge parents and reduce top to
  11607. // {@link SingletonPredictionContext}.<br>
  11608. // <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
  11609. // /
  11610. function mergeArrays(a, b, rootIsWildcard, mergeCache) {
  11611. if (mergeCache !== null) {
  11612. var previous = mergeCache.get(a, b);
  11613. if (previous !== null) {
  11614. return previous;
  11615. }
  11616. previous = mergeCache.get(b, a);
  11617. if (previous !== null) {
  11618. return previous;
  11619. }
  11620. }
  11621. // merge sorted payloads a + b => M
  11622. var i = 0; // walks a
  11623. var j = 0; // walks b
  11624. var k = 0; // walks target M array
  11625. var mergedReturnStates = [];
  11626. var mergedParents = [];
  11627. // walk and merge to yield mergedParents, mergedReturnStates
  11628. while (i < a.returnStates.length && j < b.returnStates.length) {
  11629. var a_parent = a.parents[i];
  11630. var b_parent = b.parents[j];
  11631. if (a.returnStates[i] === b.returnStates[j]) {
  11632. // same payload (stack tops are equal), must yield merged singleton
  11633. var payload = a.returnStates[i];
  11634. // $+$ = $
  11635. var bothDollars = payload === PredictionContext.EMPTY_RETURN_STATE && a_parent === null && b_parent === null;
  11636. var ax_ax = a_parent !== null && b_parent !== null && a_parent === b_parent; // ax+ax
  11637. // ->
  11638. // ax
  11639. if (bothDollars || ax_ax) {
  11640. mergedParents[k] = a_parent; // choose left
  11641. mergedReturnStates[k] = payload;
  11642. } else {
  11643. // ax+ay -> a'[x,y]
  11644. var mergedParent = merge(a_parent, b_parent, rootIsWildcard, mergeCache);
  11645. mergedParents[k] = mergedParent;
  11646. mergedReturnStates[k] = payload;
  11647. }
  11648. i += 1; // hop over left one as usual
  11649. j += 1; // but also skip one in right side since we merge
  11650. } else if (a.returnStates[i] < b.returnStates[j]) {
  11651. // copy a[i] to M
  11652. mergedParents[k] = a_parent;
  11653. mergedReturnStates[k] = a.returnStates[i];
  11654. i += 1;
  11655. } else {
  11656. // b > a, copy b[j] to M
  11657. mergedParents[k] = b_parent;
  11658. mergedReturnStates[k] = b.returnStates[j];
  11659. j += 1;
  11660. }
  11661. k += 1;
  11662. }
  11663. // copy over any payloads remaining in either array
  11664. if (i < a.returnStates.length) {
  11665. for (var p = i; p < a.returnStates.length; p++) {
  11666. mergedParents[k] = a.parents[p];
  11667. mergedReturnStates[k] = a.returnStates[p];
  11668. k += 1;
  11669. }
  11670. } else {
  11671. for (var p = j; p < b.returnStates.length; p++) {
  11672. mergedParents[k] = b.parents[p];
  11673. mergedReturnStates[k] = b.returnStates[p];
  11674. k += 1;
  11675. }
  11676. }
  11677. // trim merged if we combined a few that had same stack tops
  11678. if (k < mergedParents.length) {
  11679. // write index < last position; trim
  11680. if (k === 1) {
  11681. // for just one merged element, return singleton top
  11682. var a_ = SingletonPredictionContext.create(mergedParents[0], mergedReturnStates[0]);
  11683. if (mergeCache !== null) {
  11684. mergeCache.set(a, b, a_);
  11685. }
  11686. return a_;
  11687. }
  11688. mergedParents = mergedParents.slice(0, k);
  11689. mergedReturnStates = mergedReturnStates.slice(0, k);
  11690. }
  11691. var M = new ArrayPredictionContext(mergedParents, mergedReturnStates);
  11692. // if we created same array as a or b, return that instead
  11693. // TODO: track whether this is possible above during merge sort for speed
  11694. if (M === a) {
  11695. if (mergeCache !== null) {
  11696. mergeCache.set(a, b, a);
  11697. }
  11698. return a;
  11699. }
  11700. if (M === b) {
  11701. if (mergeCache !== null) {
  11702. mergeCache.set(a, b, b);
  11703. }
  11704. return b;
  11705. }
  11706. combineCommonParents(mergedParents);
  11707. if (mergeCache !== null) {
  11708. mergeCache.set(a, b, M);
  11709. }
  11710. return M;
  11711. }
  11712. //
  11713. // Make pass over all <em>M</em> {@code parents}; merge any {@code equals()}
  11714. // ones.
  11715. // /
  11716. function combineCommonParents(parents) {
  11717. var uniqueParents = {};
  11718. for (var p = 0; p < parents.length; p++) {
  11719. var parent = parents[p];
  11720. if (!(parent in uniqueParents)) {
  11721. uniqueParents[parent] = parent;
  11722. }
  11723. }
  11724. for (var q = 0; q < parents.length; q++) {
  11725. parents[q] = uniqueParents[parents[q]];
  11726. }
  11727. }
  11728. function getCachedPredictionContext(context, contextCache, visited) {
  11729. if (context.isEmpty()) {
  11730. return context;
  11731. }
  11732. var existing = visited[context] || null;
  11733. if (existing !== null) {
  11734. return existing;
  11735. }
  11736. existing = contextCache.get(context);
  11737. if (existing !== null) {
  11738. visited[context] = existing;
  11739. return existing;
  11740. }
  11741. var changed = false;
  11742. var parents = [];
  11743. for (var i = 0; i < parents.length; i++) {
  11744. var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
  11745. if (changed || parent !== context.getParent(i)) {
  11746. if (!changed) {
  11747. parents = [];
  11748. for (var j = 0; j < context.length; j++) {
  11749. parents[j] = context.getParent(j);
  11750. }
  11751. changed = true;
  11752. }
  11753. parents[i] = parent;
  11754. }
  11755. }
  11756. if (!changed) {
  11757. contextCache.add(context);
  11758. visited[context] = context;
  11759. return context;
  11760. }
  11761. var updated = null;
  11762. if (parents.length === 0) {
  11763. updated = PredictionContext.EMPTY;
  11764. } else if (parents.length === 1) {
  11765. updated = SingletonPredictionContext.create(parents[0], context.getReturnState(0));
  11766. } else {
  11767. updated = new ArrayPredictionContext(parents, context.returnStates);
  11768. }
  11769. contextCache.add(updated);
  11770. visited[updated] = updated;
  11771. visited[context] = updated;
  11772. return updated;
  11773. }
  11774. // ter's recursive version of Sam's getAllNodes()
  11775. function getAllContextNodes(context, nodes, visited) {
  11776. if (nodes === null) {
  11777. nodes = [];
  11778. return getAllContextNodes(context, nodes, visited);
  11779. } else if (visited === null) {
  11780. visited = {};
  11781. return getAllContextNodes(context, nodes, visited);
  11782. } else {
  11783. if (context === null || visited[context] !== null) {
  11784. return nodes;
  11785. }
  11786. visited[context] = context;
  11787. nodes.push(context);
  11788. for (var i = 0; i < context.length; i++) {
  11789. getAllContextNodes(context.getParent(i), nodes, visited);
  11790. }
  11791. return nodes;
  11792. }
  11793. }
  11794. exports.merge = merge;
  11795. exports.PredictionContext = PredictionContext;
  11796. exports.PredictionContextCache = PredictionContextCache;
  11797. exports.SingletonPredictionContext = SingletonPredictionContext;
  11798. exports.predictionContextFromRuleContext = predictionContextFromRuleContext;
  11799. exports.getCachedPredictionContext = getCachedPredictionContext;
  11800. /***/ }),
  11801. /***/ "./node_modules/antlr4/Recognizer.js":
  11802. /*!*******************************************!*\
  11803. !*** ./node_modules/antlr4/Recognizer.js ***!
  11804. \*******************************************/
  11805. /*! no static exports found */
  11806. /***/ (function(module, exports, __webpack_require__) {
  11807. "use strict";
  11808. //
  11809. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  11810. * Use of this file is governed by the BSD 3-clause license that
  11811. * can be found in the LICENSE.txt file in the project root.
  11812. */
  11813. //
  11814. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  11815. var ConsoleErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ConsoleErrorListener;
  11816. var ProxyErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ProxyErrorListener;
  11817. function Recognizer() {
  11818. this._listeners = [ConsoleErrorListener.INSTANCE];
  11819. this._interp = null;
  11820. this._stateNumber = -1;
  11821. return this;
  11822. }
  11823. Recognizer.tokenTypeMapCache = {};
  11824. Recognizer.ruleIndexMapCache = {};
  11825. Recognizer.prototype.checkVersion = function (toolVersion) {
  11826. var runtimeVersion = "4.7.1";
  11827. if (runtimeVersion !== toolVersion) {
  11828. console.log("ANTLR runtime and generated code versions disagree: " + runtimeVersion + "!=" + toolVersion);
  11829. }
  11830. };
  11831. Recognizer.prototype.addErrorListener = function (listener) {
  11832. this._listeners.push(listener);
  11833. };
  11834. Recognizer.prototype.removeErrorListeners = function () {
  11835. this._listeners = [];
  11836. };
  11837. Recognizer.prototype.getTokenTypeMap = function () {
  11838. var tokenNames = this.getTokenNames();
  11839. if (tokenNames === null) {
  11840. throw "The current recognizer does not provide a list of token names.";
  11841. }
  11842. var result = this.tokenTypeMapCache[tokenNames];
  11843. if (result === undefined) {
  11844. result = tokenNames.reduce(function (o, k, i) {
  11845. o[k] = i;
  11846. });
  11847. result.EOF = Token.EOF;
  11848. this.tokenTypeMapCache[tokenNames] = result;
  11849. }
  11850. return result;
  11851. };
  11852. // Get a map from rule names to rule indexes.
  11853. //
  11854. // <p>Used for XPath and tree pattern compilation.</p>
  11855. //
  11856. Recognizer.prototype.getRuleIndexMap = function () {
  11857. var ruleNames = this.ruleNames;
  11858. if (ruleNames === null) {
  11859. throw "The current recognizer does not provide a list of rule names.";
  11860. }
  11861. var result = this.ruleIndexMapCache[ruleNames];
  11862. if (result === undefined) {
  11863. result = ruleNames.reduce(function (o, k, i) {
  11864. o[k] = i;
  11865. });
  11866. this.ruleIndexMapCache[ruleNames] = result;
  11867. }
  11868. return result;
  11869. };
  11870. Recognizer.prototype.getTokenType = function (tokenName) {
  11871. var ttype = this.getTokenTypeMap()[tokenName];
  11872. if (ttype !== undefined) {
  11873. return ttype;
  11874. } else {
  11875. return Token.INVALID_TYPE;
  11876. }
  11877. };
  11878. // What is the error header, normally line/character position information?//
  11879. Recognizer.prototype.getErrorHeader = function (e) {
  11880. var line = e.getOffendingToken().line;
  11881. var column = e.getOffendingToken().column;
  11882. return "line " + line + ":" + column;
  11883. };
  11884. // How should a token be displayed in an error message? The default
  11885. // is to display just the text, but during development you might
  11886. // want to have a lot of information spit out. Override in that case
  11887. // to use t.toString() (which, for CommonToken, dumps everything about
  11888. // the token). This is better than forcing you to override a method in
  11889. // your token objects because you don't have to go modify your lexer
  11890. // so that it creates a new Java type.
  11891. //
  11892. // @deprecated This method is not called by the ANTLR 4 Runtime. Specific
  11893. // implementations of {@link ANTLRErrorStrategy} may provide a similar
  11894. // feature when necessary. For example, see
  11895. // {@link DefaultErrorStrategy//getTokenErrorDisplay}.
  11896. //
  11897. Recognizer.prototype.getTokenErrorDisplay = function (t) {
  11898. if (t === null) {
  11899. return "<no token>";
  11900. }
  11901. var s = t.text;
  11902. if (s === null) {
  11903. if (t.type === Token.EOF) {
  11904. s = "<EOF>";
  11905. } else {
  11906. s = "<" + t.type + ">";
  11907. }
  11908. }
  11909. s = s.replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t");
  11910. return "'" + s + "'";
  11911. };
  11912. Recognizer.prototype.getErrorListenerDispatch = function () {
  11913. return new ProxyErrorListener(this._listeners);
  11914. };
  11915. // subclass needs to override these if there are sempreds or actions
  11916. // that the ATN interp needs to execute
  11917. Recognizer.prototype.sempred = function (localctx, ruleIndex, actionIndex) {
  11918. return true;
  11919. };
  11920. Recognizer.prototype.precpred = function (localctx, precedence) {
  11921. return true;
  11922. };
  11923. //Indicate that the recognizer has changed internal state that is
  11924. //consistent with the ATN state passed in. This way we always know
  11925. //where we are in the ATN as the parser goes along. The rule
  11926. //context objects form a stack that lets us see the stack of
  11927. //invoking rules. Combine this and we have complete ATN
  11928. //configuration information.
  11929. Object.defineProperty(Recognizer.prototype, "state", {
  11930. get: function get() {
  11931. return this._stateNumber;
  11932. },
  11933. set: function set(state) {
  11934. this._stateNumber = state;
  11935. }
  11936. });
  11937. exports.Recognizer = Recognizer;
  11938. /***/ }),
  11939. /***/ "./node_modules/antlr4/RuleContext.js":
  11940. /*!********************************************!*\
  11941. !*** ./node_modules/antlr4/RuleContext.js ***!
  11942. \********************************************/
  11943. /*! no static exports found */
  11944. /***/ (function(module, exports, __webpack_require__) {
  11945. "use strict";
  11946. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  11947. * Use of this file is governed by the BSD 3-clause license that
  11948. * can be found in the LICENSE.txt file in the project root.
  11949. */
  11950. ///
  11951. // A rule context is a record of a single rule invocation. It knows
  11952. // which context invoked it, if any. If there is no parent context, then
  11953. // naturally the invoking state is not valid. The parent link
  11954. // provides a chain upwards from the current rule invocation to the root
  11955. // of the invocation tree, forming a stack. We actually carry no
  11956. // information about the rule associated with this context (except
  11957. // when parsing). We keep only the state number of the invoking state from
  11958. // the ATN submachine that invoked this. Contrast this with the s
  11959. // pointer inside ParserRuleContext that tracks the current state
  11960. // being "executed" for the current rule.
  11961. //
  11962. // The parent contexts are useful for computing lookahead sets and
  11963. // getting error information.
  11964. //
  11965. // These objects are used during parsing and prediction.
  11966. // For the special case of parsers, we use the subclass
  11967. // ParserRuleContext.
  11968. //
  11969. // @see ParserRuleContext
  11970. ///
  11971. var RuleNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  11972. var INVALID_INTERVAL = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").INVALID_INTERVAL;
  11973. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  11974. function RuleContext(parent, invokingState) {
  11975. RuleNode.call(this);
  11976. // What context invoked this rule?
  11977. this.parentCtx = parent || null;
  11978. // What state invoked the rule associated with this context?
  11979. // The "return address" is the followState of invokingState
  11980. // If parent is null, this should be -1.
  11981. this.invokingState = invokingState || -1;
  11982. return this;
  11983. }
  11984. RuleContext.prototype = Object.create(RuleNode.prototype);
  11985. RuleContext.prototype.constructor = RuleContext;
  11986. RuleContext.prototype.depth = function () {
  11987. var n = 0;
  11988. var p = this;
  11989. while (p !== null) {
  11990. p = p.parentCtx;
  11991. n += 1;
  11992. }
  11993. return n;
  11994. };
  11995. // A context is empty if there is no invoking state; meaning nobody call
  11996. // current context.
  11997. RuleContext.prototype.isEmpty = function () {
  11998. return this.invokingState === -1;
  11999. };
  12000. // satisfy the ParseTree / SyntaxTree interface
  12001. RuleContext.prototype.getSourceInterval = function () {
  12002. return INVALID_INTERVAL;
  12003. };
  12004. RuleContext.prototype.getRuleContext = function () {
  12005. return this;
  12006. };
  12007. RuleContext.prototype.getPayload = function () {
  12008. return this;
  12009. };
  12010. // Return the combined text of all child nodes. This method only considers
  12011. // tokens which have been added to the parse tree.
  12012. // <p>
  12013. // Since tokens on hidden channels (e.g. whitespace or comments) are not
  12014. // added to the parse trees, they will not appear in the output of this
  12015. // method.
  12016. // /
  12017. RuleContext.prototype.getText = function () {
  12018. if (this.getChildCount() === 0) {
  12019. return "";
  12020. } else {
  12021. return this.children.map(function (child) {
  12022. return child.getText();
  12023. }).join("");
  12024. }
  12025. };
  12026. // For rule associated with this parse tree internal node, return
  12027. // the outer alternative number used to match the input. Default
  12028. // implementation does not compute nor store this alt num. Create
  12029. // a subclass of ParserRuleContext with backing field and set
  12030. // option contextSuperClass.
  12031. // to set it.
  12032. RuleContext.prototype.getAltNumber = function () {
  12033. return INVALID_ALT_NUMBER;
  12034. };
  12035. // Set the outer alternative number for this context node. Default
  12036. // implementation does nothing to avoid backing field overhead for
  12037. // trees that don't need it. Create
  12038. // a subclass of ParserRuleContext with backing field and set
  12039. // option contextSuperClass.
  12040. RuleContext.prototype.setAltNumber = function (altNumber) {};
  12041. RuleContext.prototype.getChild = function (i) {
  12042. return null;
  12043. };
  12044. RuleContext.prototype.getChildCount = function () {
  12045. return 0;
  12046. };
  12047. RuleContext.prototype.accept = function (visitor) {
  12048. return visitor.visitChildren(this);
  12049. };
  12050. //need to manage circular dependencies, so export now
  12051. exports.RuleContext = RuleContext;
  12052. var Trees = __webpack_require__(/*! ./tree/Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  12053. // Print out a whole tree, not just a node, in LISP format
  12054. // (root child1 .. childN). Print just a node if this is a leaf.
  12055. //
  12056. RuleContext.prototype.toStringTree = function (ruleNames, recog) {
  12057. return Trees.toStringTree(this, ruleNames, recog);
  12058. };
  12059. RuleContext.prototype.toString = function (ruleNames, stop) {
  12060. ruleNames = ruleNames || null;
  12061. stop = stop || null;
  12062. var p = this;
  12063. var s = "[";
  12064. while (p !== null && p !== stop) {
  12065. if (ruleNames === null) {
  12066. if (!p.isEmpty()) {
  12067. s += p.invokingState;
  12068. }
  12069. } else {
  12070. var ri = p.ruleIndex;
  12071. var ruleName = ri >= 0 && ri < ruleNames.length ? ruleNames[ri] : "" + ri;
  12072. s += ruleName;
  12073. }
  12074. if (p.parentCtx !== null && (ruleNames !== null || !p.parentCtx.isEmpty())) {
  12075. s += " ";
  12076. }
  12077. p = p.parentCtx;
  12078. }
  12079. s += "]";
  12080. return s;
  12081. };
  12082. /***/ }),
  12083. /***/ "./node_modules/antlr4/Token.js":
  12084. /*!**************************************!*\
  12085. !*** ./node_modules/antlr4/Token.js ***!
  12086. \**************************************/
  12087. /*! no static exports found */
  12088. /***/ (function(module, exports, __webpack_require__) {
  12089. "use strict";
  12090. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  12091. * Use of this file is governed by the BSD 3-clause license that
  12092. * can be found in the LICENSE.txt file in the project root.
  12093. */
  12094. //
  12095. // A token has properties: text, type, line, character position in the line
  12096. // (so we can ignore tabs), token channel, index, and source from which
  12097. // we obtained this token.
  12098. function Token() {
  12099. this.source = null;
  12100. this.type = null; // token type of the token
  12101. this.channel = null; // The parser ignores everything not on DEFAULT_CHANNEL
  12102. this.start = null; // optional; return -1 if not implemented.
  12103. this.stop = null; // optional; return -1 if not implemented.
  12104. this.tokenIndex = null; // from 0..n-1 of the token object in the input stream
  12105. this.line = null; // line=1..n of the 1st character
  12106. this.column = null; // beginning of the line at which it occurs, 0..n-1
  12107. this._text = null; // text of the token.
  12108. return this;
  12109. }
  12110. Token.INVALID_TYPE = 0;
  12111. // During lookahead operations, this "token" signifies we hit rule end ATN state
  12112. // and did not follow it despite needing to.
  12113. Token.EPSILON = -2;
  12114. Token.MIN_USER_TOKEN_TYPE = 1;
  12115. Token.EOF = -1;
  12116. // All tokens go to the parser (unless skip() is called in that rule)
  12117. // on a particular "channel". The parser tunes to a particular channel
  12118. // so that whitespace etc... can go to the parser on a "hidden" channel.
  12119. Token.DEFAULT_CHANNEL = 0;
  12120. // Anything on different channel than DEFAULT_CHANNEL is not parsed
  12121. // by parser.
  12122. Token.HIDDEN_CHANNEL = 1;
  12123. // Explicitly set the text for this token. If {code text} is not
  12124. // {@code null}, then {@link //getText} will return this value rather than
  12125. // extracting the text from the input.
  12126. //
  12127. // @param text The explicit text of the token, or {@code null} if the text
  12128. // should be obtained from the input along with the start and stop indexes
  12129. // of the token.
  12130. Object.defineProperty(Token.prototype, "text", {
  12131. get: function get() {
  12132. return this._text;
  12133. },
  12134. set: function set(text) {
  12135. this._text = text;
  12136. }
  12137. });
  12138. Token.prototype.getTokenSource = function () {
  12139. return this.source[0];
  12140. };
  12141. Token.prototype.getInputStream = function () {
  12142. return this.source[1];
  12143. };
  12144. function CommonToken(source, type, channel, start, stop) {
  12145. Token.call(this);
  12146. this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE;
  12147. this.type = type !== undefined ? type : null;
  12148. this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL;
  12149. this.start = start !== undefined ? start : -1;
  12150. this.stop = stop !== undefined ? stop : -1;
  12151. this.tokenIndex = -1;
  12152. if (this.source[0] !== null) {
  12153. this.line = source[0].line;
  12154. this.column = source[0].column;
  12155. } else {
  12156. this.column = -1;
  12157. }
  12158. return this;
  12159. }
  12160. CommonToken.prototype = Object.create(Token.prototype);
  12161. CommonToken.prototype.constructor = CommonToken;
  12162. // An empty {@link Pair} which is used as the default value of
  12163. // {@link //source} for tokens that do not have a source.
  12164. CommonToken.EMPTY_SOURCE = [null, null];
  12165. // Constructs a new {@link CommonToken} as a copy of another {@link Token}.
  12166. //
  12167. // <p>
  12168. // If {@code oldToken} is also a {@link CommonToken} instance, the newly
  12169. // constructed token will share a reference to the {@link //text} field and
  12170. // the {@link Pair} stored in {@link //source}. Otherwise, {@link //text} will
  12171. // be assigned the result of calling {@link //getText}, and {@link //source}
  12172. // will be constructed from the result of {@link Token//getTokenSource} and
  12173. // {@link Token//getInputStream}.</p>
  12174. //
  12175. // @param oldToken The token to copy.
  12176. //
  12177. CommonToken.prototype.clone = function () {
  12178. var t = new CommonToken(this.source, this.type, this.channel, this.start, this.stop);
  12179. t.tokenIndex = this.tokenIndex;
  12180. t.line = this.line;
  12181. t.column = this.column;
  12182. t.text = this.text;
  12183. return t;
  12184. };
  12185. Object.defineProperty(CommonToken.prototype, "text", {
  12186. get: function get() {
  12187. if (this._text !== null) {
  12188. return this._text;
  12189. }
  12190. var input = this.getInputStream();
  12191. if (input === null) {
  12192. return null;
  12193. }
  12194. var n = input.size;
  12195. if (this.start < n && this.stop < n) {
  12196. return input.getText(this.start, this.stop);
  12197. } else {
  12198. return "<EOF>";
  12199. }
  12200. },
  12201. set: function set(text) {
  12202. this._text = text;
  12203. }
  12204. });
  12205. CommonToken.prototype.toString = function () {
  12206. var txt = this.text;
  12207. if (txt !== null) {
  12208. txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
  12209. } else {
  12210. txt = "<no text>";
  12211. }
  12212. return "[@" + this.tokenIndex + "," + this.start + ":" + this.stop + "='" + txt + "',<" + this.type + ">" + (this.channel > 0 ? ",channel=" + this.channel : "") + "," + this.line + ":" + this.column + "]";
  12213. };
  12214. exports.Token = Token;
  12215. exports.CommonToken = CommonToken;
  12216. /***/ }),
  12217. /***/ "./node_modules/antlr4/Utils.js":
  12218. /*!**************************************!*\
  12219. !*** ./node_modules/antlr4/Utils.js ***!
  12220. \**************************************/
  12221. /*! no static exports found */
  12222. /***/ (function(module, exports, __webpack_require__) {
  12223. "use strict";
  12224. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  12225. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  12226. * Use of this file is governed by the BSD 3-clause license that
  12227. * can be found in the LICENSE.txt file in the project root.
  12228. */
  12229. function arrayToString(a) {
  12230. return "[" + a.join(", ") + "]";
  12231. }
  12232. String.prototype.seed = String.prototype.seed || Math.round(Math.random() * Math.pow(2, 32));
  12233. String.prototype.hashCode = function () {
  12234. var remainder,
  12235. bytes,
  12236. h1,
  12237. h1b,
  12238. c1,
  12239. c1b,
  12240. c2,
  12241. c2b,
  12242. k1,
  12243. i,
  12244. key = this.toString();
  12245. remainder = key.length & 3; // key.length % 4
  12246. bytes = key.length - remainder;
  12247. h1 = String.prototype.seed;
  12248. c1 = 0xcc9e2d51;
  12249. c2 = 0x1b873593;
  12250. i = 0;
  12251. while (i < bytes) {
  12252. k1 = key.charCodeAt(i) & 0xff | (key.charCodeAt(++i) & 0xff) << 8 | (key.charCodeAt(++i) & 0xff) << 16 | (key.charCodeAt(++i) & 0xff) << 24;
  12253. ++i;
  12254. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  12255. k1 = k1 << 15 | k1 >>> 17;
  12256. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  12257. h1 ^= k1;
  12258. h1 = h1 << 13 | h1 >>> 19;
  12259. h1b = (h1 & 0xffff) * 5 + (((h1 >>> 16) * 5 & 0xffff) << 16) & 0xffffffff;
  12260. h1 = (h1b & 0xffff) + 0x6b64 + (((h1b >>> 16) + 0xe654 & 0xffff) << 16);
  12261. }
  12262. k1 = 0;
  12263. switch (remainder) {
  12264. case 3:
  12265. k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  12266. case 2:
  12267. k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  12268. case 1:
  12269. k1 ^= key.charCodeAt(i) & 0xff;
  12270. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  12271. k1 = k1 << 15 | k1 >>> 17;
  12272. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  12273. h1 ^= k1;
  12274. }
  12275. h1 ^= key.length;
  12276. h1 ^= h1 >>> 16;
  12277. h1 = (h1 & 0xffff) * 0x85ebca6b + (((h1 >>> 16) * 0x85ebca6b & 0xffff) << 16) & 0xffffffff;
  12278. h1 ^= h1 >>> 13;
  12279. h1 = (h1 & 0xffff) * 0xc2b2ae35 + (((h1 >>> 16) * 0xc2b2ae35 & 0xffff) << 16) & 0xffffffff;
  12280. h1 ^= h1 >>> 16;
  12281. return h1 >>> 0;
  12282. };
  12283. function standardEqualsFunction(a, b) {
  12284. return a.equals(b);
  12285. }
  12286. function standardHashCodeFunction(a) {
  12287. return a.hashCode();
  12288. }
  12289. function Set(hashFunction, equalsFunction) {
  12290. this.data = {};
  12291. this.hashFunction = hashFunction || standardHashCodeFunction;
  12292. this.equalsFunction = equalsFunction || standardEqualsFunction;
  12293. return this;
  12294. }
  12295. Object.defineProperty(Set.prototype, "length", {
  12296. get: function get() {
  12297. var l = 0;
  12298. for (var key in this.data) {
  12299. if (key.indexOf("hash_") === 0) {
  12300. l = l + this.data[key].length;
  12301. }
  12302. }
  12303. return l;
  12304. }
  12305. });
  12306. Set.prototype.add = function (value) {
  12307. var hash = this.hashFunction(value);
  12308. var key = "hash_" + hash;
  12309. if (key in this.data) {
  12310. var values = this.data[key];
  12311. for (var i = 0; i < values.length; i++) {
  12312. if (this.equalsFunction(value, values[i])) {
  12313. return values[i];
  12314. }
  12315. }
  12316. values.push(value);
  12317. return value;
  12318. } else {
  12319. this.data[key] = [value];
  12320. return value;
  12321. }
  12322. };
  12323. Set.prototype.contains = function (value) {
  12324. return this.get(value) != null;
  12325. };
  12326. Set.prototype.get = function (value) {
  12327. var hash = this.hashFunction(value);
  12328. var key = "hash_" + hash;
  12329. if (key in this.data) {
  12330. var values = this.data[key];
  12331. for (var i = 0; i < values.length; i++) {
  12332. if (this.equalsFunction(value, values[i])) {
  12333. return values[i];
  12334. }
  12335. }
  12336. }
  12337. return null;
  12338. };
  12339. Set.prototype.values = function () {
  12340. var l = [];
  12341. for (var key in this.data) {
  12342. if (key.indexOf("hash_") === 0) {
  12343. l = l.concat(this.data[key]);
  12344. }
  12345. }
  12346. return l;
  12347. };
  12348. Set.prototype.toString = function () {
  12349. return arrayToString(this.values());
  12350. };
  12351. function BitSet() {
  12352. this.data = [];
  12353. return this;
  12354. }
  12355. BitSet.prototype.add = function (value) {
  12356. this.data[value] = true;
  12357. };
  12358. BitSet.prototype.or = function (set) {
  12359. var bits = this;
  12360. Object.keys(set.data).map(function (alt) {
  12361. bits.add(alt);
  12362. });
  12363. };
  12364. BitSet.prototype.remove = function (value) {
  12365. delete this.data[value];
  12366. };
  12367. BitSet.prototype.contains = function (value) {
  12368. return this.data[value] === true;
  12369. };
  12370. BitSet.prototype.values = function () {
  12371. return Object.keys(this.data);
  12372. };
  12373. BitSet.prototype.minValue = function () {
  12374. return Math.min.apply(null, this.values());
  12375. };
  12376. BitSet.prototype.hashCode = function () {
  12377. var hash = new Hash();
  12378. hash.update(this.values());
  12379. return hash.finish();
  12380. };
  12381. BitSet.prototype.equals = function (other) {
  12382. if (!(other instanceof BitSet)) {
  12383. return false;
  12384. }
  12385. return this.hashCode() === other.hashCode();
  12386. };
  12387. Object.defineProperty(BitSet.prototype, "length", {
  12388. get: function get() {
  12389. return this.values().length;
  12390. }
  12391. });
  12392. BitSet.prototype.toString = function () {
  12393. return "{" + this.values().join(", ") + "}";
  12394. };
  12395. function Map(hashFunction, equalsFunction) {
  12396. this.data = {};
  12397. this.hashFunction = hashFunction || standardHashCodeFunction;
  12398. this.equalsFunction = equalsFunction || standardEqualsFunction;
  12399. return this;
  12400. }
  12401. Object.defineProperty(Map.prototype, "length", {
  12402. get: function get() {
  12403. var l = 0;
  12404. for (var hashKey in this.data) {
  12405. if (hashKey.indexOf("hash_") === 0) {
  12406. l = l + this.data[hashKey].length;
  12407. }
  12408. }
  12409. return l;
  12410. }
  12411. });
  12412. Map.prototype.put = function (key, value) {
  12413. var hashKey = "hash_" + this.hashFunction(key);
  12414. if (hashKey in this.data) {
  12415. var entries = this.data[hashKey];
  12416. for (var i = 0; i < entries.length; i++) {
  12417. var entry = entries[i];
  12418. if (this.equalsFunction(key, entry.key)) {
  12419. var oldValue = entry.value;
  12420. entry.value = value;
  12421. return oldValue;
  12422. }
  12423. }
  12424. entries.push({ key: key, value: value });
  12425. return value;
  12426. } else {
  12427. this.data[hashKey] = [{ key: key, value: value }];
  12428. return value;
  12429. }
  12430. };
  12431. Map.prototype.containsKey = function (key) {
  12432. var hashKey = "hash_" + this.hashFunction(key);
  12433. if (hashKey in this.data) {
  12434. var entries = this.data[hashKey];
  12435. for (var i = 0; i < entries.length; i++) {
  12436. var entry = entries[i];
  12437. if (this.equalsFunction(key, entry.key)) return true;
  12438. }
  12439. }
  12440. return false;
  12441. };
  12442. Map.prototype.get = function (key) {
  12443. var hashKey = "hash_" + this.hashFunction(key);
  12444. if (hashKey in this.data) {
  12445. var entries = this.data[hashKey];
  12446. for (var i = 0; i < entries.length; i++) {
  12447. var entry = entries[i];
  12448. if (this.equalsFunction(key, entry.key)) return entry.value;
  12449. }
  12450. }
  12451. return null;
  12452. };
  12453. Map.prototype.entries = function () {
  12454. var l = [];
  12455. for (var key in this.data) {
  12456. if (key.indexOf("hash_") === 0) {
  12457. l = l.concat(this.data[key]);
  12458. }
  12459. }
  12460. return l;
  12461. };
  12462. Map.prototype.getKeys = function () {
  12463. return this.entries().map(function (e) {
  12464. return e.key;
  12465. });
  12466. };
  12467. Map.prototype.getValues = function () {
  12468. return this.entries().map(function (e) {
  12469. return e.value;
  12470. });
  12471. };
  12472. Map.prototype.toString = function () {
  12473. var ss = this.entries().map(function (entry) {
  12474. return '{' + entry.key + ':' + entry.value + '}';
  12475. });
  12476. return '[' + ss.join(", ") + ']';
  12477. };
  12478. function AltDict() {
  12479. this.data = {};
  12480. return this;
  12481. }
  12482. AltDict.prototype.get = function (key) {
  12483. key = "k-" + key;
  12484. if (key in this.data) {
  12485. return this.data[key];
  12486. } else {
  12487. return null;
  12488. }
  12489. };
  12490. AltDict.prototype.put = function (key, value) {
  12491. key = "k-" + key;
  12492. this.data[key] = value;
  12493. };
  12494. AltDict.prototype.values = function () {
  12495. var data = this.data;
  12496. var keys = Object.keys(this.data);
  12497. return keys.map(function (key) {
  12498. return data[key];
  12499. });
  12500. };
  12501. function DoubleDict() {
  12502. return this;
  12503. }
  12504. function Hash() {
  12505. this.count = 0;
  12506. this.hash = 0;
  12507. return this;
  12508. }
  12509. Hash.prototype.update = function () {
  12510. for (var i = 0; i < arguments.length; i++) {
  12511. var value = arguments[i];
  12512. if (value == null) continue;
  12513. if (Array.isArray(value)) this.update.apply(value);else {
  12514. var k = 0;
  12515. switch (typeof value === "undefined" ? "undefined" : _typeof(value)) {
  12516. case 'undefined':
  12517. case 'function':
  12518. continue;
  12519. case 'number':
  12520. case 'boolean':
  12521. k = value;
  12522. break;
  12523. case 'string':
  12524. k = value.hashCode();
  12525. break;
  12526. default:
  12527. value.updateHashCode(this);
  12528. continue;
  12529. }
  12530. k = k * 0xCC9E2D51;
  12531. k = k << 15 | k >>> 32 - 15;
  12532. k = k * 0x1B873593;
  12533. this.count = this.count + 1;
  12534. var hash = this.hash ^ k;
  12535. hash = hash << 13 | hash >>> 32 - 13;
  12536. hash = hash * 5 + 0xE6546B64;
  12537. this.hash = hash;
  12538. }
  12539. }
  12540. };
  12541. Hash.prototype.finish = function () {
  12542. var hash = this.hash ^ this.count * 4;
  12543. hash = hash ^ hash >>> 16;
  12544. hash = hash * 0x85EBCA6B;
  12545. hash = hash ^ hash >>> 13;
  12546. hash = hash * 0xC2B2AE35;
  12547. hash = hash ^ hash >>> 16;
  12548. return hash;
  12549. };
  12550. function hashStuff() {
  12551. var hash = new Hash();
  12552. hash.update.apply(arguments);
  12553. return hash.finish();
  12554. }
  12555. DoubleDict.prototype.get = function (a, b) {
  12556. var d = this[a] || null;
  12557. return d === null ? null : d[b] || null;
  12558. };
  12559. DoubleDict.prototype.set = function (a, b, o) {
  12560. var d = this[a] || null;
  12561. if (d === null) {
  12562. d = {};
  12563. this[a] = d;
  12564. }
  12565. d[b] = o;
  12566. };
  12567. function escapeWhitespace(s, escapeSpaces) {
  12568. s = s.replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
  12569. if (escapeSpaces) {
  12570. s = s.replace(/ /g, "\xB7");
  12571. }
  12572. return s;
  12573. }
  12574. function titleCase(str) {
  12575. return str.replace(/\w\S*/g, function (txt) {
  12576. return txt.charAt(0).toUpperCase() + txt.substr(1);
  12577. });
  12578. };
  12579. function equalArrays(a, b) {
  12580. if (!Array.isArray(a) || !Array.isArray(b)) return false;
  12581. if (a == b) return true;
  12582. if (a.length != b.length) return false;
  12583. for (var i = 0; i < a.length; i++) {
  12584. if (a[i] == b[i]) continue;
  12585. if (!a[i].equals(b[i])) return false;
  12586. }
  12587. return true;
  12588. };
  12589. exports.Hash = Hash;
  12590. exports.Set = Set;
  12591. exports.Map = Map;
  12592. exports.BitSet = BitSet;
  12593. exports.AltDict = AltDict;
  12594. exports.DoubleDict = DoubleDict;
  12595. exports.hashStuff = hashStuff;
  12596. exports.escapeWhitespace = escapeWhitespace;
  12597. exports.arrayToString = arrayToString;
  12598. exports.titleCase = titleCase;
  12599. exports.equalArrays = equalArrays;
  12600. /***/ }),
  12601. /***/ "./node_modules/antlr4/atn/ATN.js":
  12602. /*!****************************************!*\
  12603. !*** ./node_modules/antlr4/atn/ATN.js ***!
  12604. \****************************************/
  12605. /*! no static exports found */
  12606. /***/ (function(module, exports, __webpack_require__) {
  12607. "use strict";
  12608. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  12609. * Use of this file is governed by the BSD 3-clause license that
  12610. * can be found in the LICENSE.txt file in the project root.
  12611. */
  12612. var LL1Analyzer = __webpack_require__(/*! ./../LL1Analyzer */ "./node_modules/antlr4/LL1Analyzer.js").LL1Analyzer;
  12613. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  12614. function ATN(grammarType, maxTokenType) {
  12615. // Used for runtime deserialization of ATNs from strings///
  12616. // The type of the ATN.
  12617. this.grammarType = grammarType;
  12618. // The maximum value for any symbol recognized by a transition in the ATN.
  12619. this.maxTokenType = maxTokenType;
  12620. this.states = [];
  12621. // Each subrule/rule is a decision point and we must track them so we
  12622. // can go back later and build DFA predictors for them. This includes
  12623. // all the rules, subrules, optional blocks, ()+, ()* etc...
  12624. this.decisionToState = [];
  12625. // Maps from rule index to starting state number.
  12626. this.ruleToStartState = [];
  12627. // Maps from rule index to stop state number.
  12628. this.ruleToStopState = null;
  12629. this.modeNameToStartState = {};
  12630. // For lexer ATNs, this maps the rule index to the resulting token type.
  12631. // For parser ATNs, this maps the rule index to the generated bypass token
  12632. // type if the
  12633. // {@link ATNDeserializationOptions//isGenerateRuleBypassTransitions}
  12634. // deserialization option was specified; otherwise, this is {@code null}.
  12635. this.ruleToTokenType = null;
  12636. // For lexer ATNs, this is an array of {@link LexerAction} objects which may
  12637. // be referenced by action transitions in the ATN.
  12638. this.lexerActions = null;
  12639. this.modeToStartState = [];
  12640. return this;
  12641. }
  12642. // Compute the set of valid tokens that can occur starting in state {@code s}.
  12643. // If {@code ctx} is null, the set of tokens will not include what can follow
  12644. // the rule surrounding {@code s}. In other words, the set will be
  12645. // restricted to tokens reachable staying within {@code s}'s rule.
  12646. ATN.prototype.nextTokensInContext = function (s, ctx) {
  12647. var anal = new LL1Analyzer(this);
  12648. return anal.LOOK(s, null, ctx);
  12649. };
  12650. // Compute the set of valid tokens that can occur starting in {@code s} and
  12651. // staying in same rule. {@link Token//EPSILON} is in set if we reach end of
  12652. // rule.
  12653. ATN.prototype.nextTokensNoContext = function (s) {
  12654. if (s.nextTokenWithinRule !== null) {
  12655. return s.nextTokenWithinRule;
  12656. }
  12657. s.nextTokenWithinRule = this.nextTokensInContext(s, null);
  12658. s.nextTokenWithinRule.readOnly = true;
  12659. return s.nextTokenWithinRule;
  12660. };
  12661. ATN.prototype.nextTokens = function (s, ctx) {
  12662. if (ctx === undefined) {
  12663. return this.nextTokensNoContext(s);
  12664. } else {
  12665. return this.nextTokensInContext(s, ctx);
  12666. }
  12667. };
  12668. ATN.prototype.addState = function (state) {
  12669. if (state !== null) {
  12670. state.atn = this;
  12671. state.stateNumber = this.states.length;
  12672. }
  12673. this.states.push(state);
  12674. };
  12675. ATN.prototype.removeState = function (state) {
  12676. this.states[state.stateNumber] = null; // just free mem, don't shift states in list
  12677. };
  12678. ATN.prototype.defineDecisionState = function (s) {
  12679. this.decisionToState.push(s);
  12680. s.decision = this.decisionToState.length - 1;
  12681. return s.decision;
  12682. };
  12683. ATN.prototype.getDecisionState = function (decision) {
  12684. if (this.decisionToState.length === 0) {
  12685. return null;
  12686. } else {
  12687. return this.decisionToState[decision];
  12688. }
  12689. };
  12690. // Computes the set of input symbols which could follow ATN state number
  12691. // {@code stateNumber} in the specified full {@code context}. This method
  12692. // considers the complete parser context, but does not evaluate semantic
  12693. // predicates (i.e. all predicates encountered during the calculation are
  12694. // assumed true). If a path in the ATN exists from the starting state to the
  12695. // {@link RuleStopState} of the outermost context without matching any
  12696. // symbols, {@link Token//EOF} is added to the returned set.
  12697. //
  12698. // <p>If {@code context} is {@code null}, it is treated as
  12699. // {@link ParserRuleContext//EMPTY}.</p>
  12700. //
  12701. // @param stateNumber the ATN state number
  12702. // @param context the full parse context
  12703. // @return The set of potentially valid input symbols which could follow the
  12704. // specified state in the specified context.
  12705. // @throws IllegalArgumentException if the ATN does not contain a state with
  12706. // number {@code stateNumber}
  12707. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  12708. ATN.prototype.getExpectedTokens = function (stateNumber, ctx) {
  12709. if (stateNumber < 0 || stateNumber >= this.states.length) {
  12710. throw "Invalid state number.";
  12711. }
  12712. var s = this.states[stateNumber];
  12713. var following = this.nextTokens(s);
  12714. if (!following.contains(Token.EPSILON)) {
  12715. return following;
  12716. }
  12717. var expected = new IntervalSet();
  12718. expected.addSet(following);
  12719. expected.removeOne(Token.EPSILON);
  12720. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  12721. var invokingState = this.states[ctx.invokingState];
  12722. var rt = invokingState.transitions[0];
  12723. following = this.nextTokens(rt.followState);
  12724. expected.addSet(following);
  12725. expected.removeOne(Token.EPSILON);
  12726. ctx = ctx.parentCtx;
  12727. }
  12728. if (following.contains(Token.EPSILON)) {
  12729. expected.addOne(Token.EOF);
  12730. }
  12731. return expected;
  12732. };
  12733. ATN.INVALID_ALT_NUMBER = 0;
  12734. exports.ATN = ATN;
  12735. /***/ }),
  12736. /***/ "./node_modules/antlr4/atn/ATNConfig.js":
  12737. /*!**********************************************!*\
  12738. !*** ./node_modules/antlr4/atn/ATNConfig.js ***!
  12739. \**********************************************/
  12740. /*! no static exports found */
  12741. /***/ (function(module, exports, __webpack_require__) {
  12742. "use strict";
  12743. //
  12744. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  12745. * Use of this file is governed by the BSD 3-clause license that
  12746. * can be found in the LICENSE.txt file in the project root.
  12747. */
  12748. ///
  12749. // A tuple: (ATN state, predicted alt, syntactic, semantic context).
  12750. // The syntactic context is a graph-structured stack node whose
  12751. // path(s) to the root is the rule invocation(s)
  12752. // chain used to arrive at the state. The semantic context is
  12753. // the tree of semantic predicates encountered before reaching
  12754. // an ATN state.
  12755. ///
  12756. var DecisionState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").DecisionState;
  12757. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  12758. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  12759. function checkParams(params, isCfg) {
  12760. if (params === null) {
  12761. var result = { state: null, alt: null, context: null, semanticContext: null };
  12762. if (isCfg) {
  12763. result.reachesIntoOuterContext = 0;
  12764. }
  12765. return result;
  12766. } else {
  12767. var props = {};
  12768. props.state = params.state || null;
  12769. props.alt = params.alt === undefined ? null : params.alt;
  12770. props.context = params.context || null;
  12771. props.semanticContext = params.semanticContext || null;
  12772. if (isCfg) {
  12773. props.reachesIntoOuterContext = params.reachesIntoOuterContext || 0;
  12774. props.precedenceFilterSuppressed = params.precedenceFilterSuppressed || false;
  12775. }
  12776. return props;
  12777. }
  12778. }
  12779. function ATNConfig(params, config) {
  12780. this.checkContext(params, config);
  12781. params = checkParams(params);
  12782. config = checkParams(config, true);
  12783. // The ATN state associated with this configuration///
  12784. this.state = params.state !== null ? params.state : config.state;
  12785. // What alt (or lexer rule) is predicted by this configuration///
  12786. this.alt = params.alt !== null ? params.alt : config.alt;
  12787. // The stack of invoking states leading to the rule/states associated
  12788. // with this config. We track only those contexts pushed during
  12789. // execution of the ATN simulator.
  12790. this.context = params.context !== null ? params.context : config.context;
  12791. this.semanticContext = params.semanticContext !== null ? params.semanticContext : config.semanticContext !== null ? config.semanticContext : SemanticContext.NONE;
  12792. // We cannot execute predicates dependent upon local context unless
  12793. // we know for sure we are in the correct context. Because there is
  12794. // no way to do this efficiently, we simply cannot evaluate
  12795. // dependent predicates unless we are in the rule that initially
  12796. // invokes the ATN simulator.
  12797. //
  12798. // closure() tracks the depth of how far we dip into the
  12799. // outer context: depth &gt; 0. Note that it may not be totally
  12800. // accurate depth since I don't ever decrement. TODO: make it a boolean then
  12801. this.reachesIntoOuterContext = config.reachesIntoOuterContext;
  12802. this.precedenceFilterSuppressed = config.precedenceFilterSuppressed;
  12803. return this;
  12804. }
  12805. ATNConfig.prototype.checkContext = function (params, config) {
  12806. if ((params.context === null || params.context === undefined) && (config === null || config.context === null || config.context === undefined)) {
  12807. this.context = null;
  12808. }
  12809. };
  12810. ATNConfig.prototype.hashCode = function () {
  12811. var hash = new Hash();
  12812. this.updateHashCode(hash);
  12813. return hash.finish();
  12814. };
  12815. ATNConfig.prototype.updateHashCode = function (hash) {
  12816. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
  12817. };
  12818. // An ATN configuration is equal to another if both have
  12819. // the same state, they predict the same alternative, and
  12820. // syntactic/semantic contexts are the same.
  12821. ATNConfig.prototype.equals = function (other) {
  12822. if (this === other) {
  12823. return true;
  12824. } else if (!(other instanceof ATNConfig)) {
  12825. return false;
  12826. } else {
  12827. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && (this.context === null ? other.context === null : this.context.equals(other.context)) && this.semanticContext.equals(other.semanticContext) && this.precedenceFilterSuppressed === other.precedenceFilterSuppressed;
  12828. }
  12829. };
  12830. ATNConfig.prototype.hashCodeForConfigSet = function () {
  12831. var hash = new Hash();
  12832. hash.update(this.state.stateNumber, this.alt, this.semanticContext);
  12833. return hash.finish();
  12834. };
  12835. ATNConfig.prototype.equalsForConfigSet = function (other) {
  12836. if (this === other) {
  12837. return true;
  12838. } else if (!(other instanceof ATNConfig)) {
  12839. return false;
  12840. } else {
  12841. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && this.semanticContext.equals(other.semanticContext);
  12842. }
  12843. };
  12844. ATNConfig.prototype.toString = function () {
  12845. return "(" + this.state + "," + this.alt + (this.context !== null ? ",[" + this.context.toString() + "]" : "") + (this.semanticContext !== SemanticContext.NONE ? "," + this.semanticContext.toString() : "") + (this.reachesIntoOuterContext > 0 ? ",up=" + this.reachesIntoOuterContext : "") + ")";
  12846. };
  12847. function LexerATNConfig(params, config) {
  12848. ATNConfig.call(this, params, config);
  12849. // This is the backing field for {@link //getLexerActionExecutor}.
  12850. var lexerActionExecutor = params.lexerActionExecutor || null;
  12851. this.lexerActionExecutor = lexerActionExecutor || (config !== null ? config.lexerActionExecutor : null);
  12852. this.passedThroughNonGreedyDecision = config !== null ? this.checkNonGreedyDecision(config, this.state) : false;
  12853. return this;
  12854. }
  12855. LexerATNConfig.prototype = Object.create(ATNConfig.prototype);
  12856. LexerATNConfig.prototype.constructor = LexerATNConfig;
  12857. LexerATNConfig.prototype.updateHashCode = function (hash) {
  12858. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext, this.passedThroughNonGreedyDecision, this.lexerActionExecutor);
  12859. };
  12860. LexerATNConfig.prototype.equals = function (other) {
  12861. return this === other || other instanceof LexerATNConfig && this.passedThroughNonGreedyDecision == other.passedThroughNonGreedyDecision && (this.lexerActionExecutor ? this.lexerActionExecutor.equals(other.lexerActionExecutor) : !other.lexerActionExecutor) && ATNConfig.prototype.equals.call(this, other);
  12862. };
  12863. LexerATNConfig.prototype.hashCodeForConfigSet = LexerATNConfig.prototype.hashCode;
  12864. LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.equals;
  12865. LexerATNConfig.prototype.checkNonGreedyDecision = function (source, target) {
  12866. return source.passedThroughNonGreedyDecision || target instanceof DecisionState && target.nonGreedy;
  12867. };
  12868. exports.ATNConfig = ATNConfig;
  12869. exports.LexerATNConfig = LexerATNConfig;
  12870. /***/ }),
  12871. /***/ "./node_modules/antlr4/atn/ATNConfigSet.js":
  12872. /*!*************************************************!*\
  12873. !*** ./node_modules/antlr4/atn/ATNConfigSet.js ***!
  12874. \*************************************************/
  12875. /*! no static exports found */
  12876. /***/ (function(module, exports, __webpack_require__) {
  12877. "use strict";
  12878. //
  12879. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  12880. * Use of this file is governed by the BSD 3-clause license that
  12881. * can be found in the LICENSE.txt file in the project root.
  12882. */
  12883. //
  12884. // Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track
  12885. // info about the set, with support for combining similar configurations using a
  12886. // graph-structured stack.
  12887. ///
  12888. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  12889. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  12890. var Hash = Utils.Hash;
  12891. var Set = Utils.Set;
  12892. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  12893. var merge = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").merge;
  12894. function hashATNConfig(c) {
  12895. return c.hashCodeForConfigSet();
  12896. }
  12897. function equalATNConfigs(a, b) {
  12898. if (a === b) {
  12899. return true;
  12900. } else if (a === null || b === null) {
  12901. return false;
  12902. } else return a.equalsForConfigSet(b);
  12903. }
  12904. function ATNConfigSet(fullCtx) {
  12905. //
  12906. // The reason that we need this is because we don't want the hash map to use
  12907. // the standard hash code and equals. We need all configurations with the
  12908. // same
  12909. // {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively
  12910. // doubles
  12911. // the number of objects associated with ATNConfigs. The other solution is
  12912. // to
  12913. // use a hash table that lets us specify the equals/hashcode operation.
  12914. // All configs but hashed by (s, i, _, pi) not including context. Wiped out
  12915. // when we go readonly as this set becomes a DFA state.
  12916. this.configLookup = new Set(hashATNConfig, equalATNConfigs);
  12917. // Indicates that this configuration set is part of a full context
  12918. // LL prediction. It will be used to determine how to merge $. With SLL
  12919. // it's a wildcard whereas it is not for LL context merge.
  12920. this.fullCtx = fullCtx === undefined ? true : fullCtx;
  12921. // Indicates that the set of configurations is read-only. Do not
  12922. // allow any code to manipulate the set; DFA states will point at
  12923. // the sets and they must not change. This does not protect the other
  12924. // fields; in particular, conflictingAlts is set after
  12925. // we've made this readonly.
  12926. this.readOnly = false;
  12927. // Track the elements as they are added to the set; supports get(i)///
  12928. this.configs = [];
  12929. // TODO: these fields make me pretty uncomfortable but nice to pack up info
  12930. // together, saves recomputation
  12931. // TODO: can we track conflicts as they are added to save scanning configs
  12932. // later?
  12933. this.uniqueAlt = 0;
  12934. this.conflictingAlts = null;
  12935. // Used in parser and lexer. In lexer, it indicates we hit a pred
  12936. // while computing a closure operation. Don't make a DFA state from this.
  12937. this.hasSemanticContext = false;
  12938. this.dipsIntoOuterContext = false;
  12939. this.cachedHashCode = -1;
  12940. return this;
  12941. }
  12942. // Adding a new config means merging contexts with existing configs for
  12943. // {@code (s, i, pi, _)}, where {@code s} is the
  12944. // {@link ATNConfig//state}, {@code i} is the {@link ATNConfig//alt}, and
  12945. // {@code pi} is the {@link ATNConfig//semanticContext}. We use
  12946. // {@code (s,i,pi)} as key.
  12947. //
  12948. // <p>This method updates {@link //dipsIntoOuterContext} and
  12949. // {@link //hasSemanticContext} when necessary.</p>
  12950. // /
  12951. ATNConfigSet.prototype.add = function (config, mergeCache) {
  12952. if (mergeCache === undefined) {
  12953. mergeCache = null;
  12954. }
  12955. if (this.readOnly) {
  12956. throw "This set is readonly";
  12957. }
  12958. if (config.semanticContext !== SemanticContext.NONE) {
  12959. this.hasSemanticContext = true;
  12960. }
  12961. if (config.reachesIntoOuterContext > 0) {
  12962. this.dipsIntoOuterContext = true;
  12963. }
  12964. var existing = this.configLookup.add(config);
  12965. if (existing === config) {
  12966. this.cachedHashCode = -1;
  12967. this.configs.push(config); // track order here
  12968. return true;
  12969. }
  12970. // a previous (s,i,pi,_), merge with it and save result
  12971. var rootIsWildcard = !this.fullCtx;
  12972. var merged = merge(existing.context, config.context, rootIsWildcard, mergeCache);
  12973. // no need to check for existing.context, config.context in cache
  12974. // since only way to create new graphs is "call rule" and here. We
  12975. // cache at both places.
  12976. existing.reachesIntoOuterContext = Math.max(existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
  12977. // make sure to preserve the precedence filter suppression during the merge
  12978. if (config.precedenceFilterSuppressed) {
  12979. existing.precedenceFilterSuppressed = true;
  12980. }
  12981. existing.context = merged; // replace context; no need to alt mapping
  12982. return true;
  12983. };
  12984. ATNConfigSet.prototype.getStates = function () {
  12985. var states = new Set();
  12986. for (var i = 0; i < this.configs.length; i++) {
  12987. states.add(this.configs[i].state);
  12988. }
  12989. return states;
  12990. };
  12991. ATNConfigSet.prototype.getPredicates = function () {
  12992. var preds = [];
  12993. for (var i = 0; i < this.configs.length; i++) {
  12994. var c = this.configs[i].semanticContext;
  12995. if (c !== SemanticContext.NONE) {
  12996. preds.push(c.semanticContext);
  12997. }
  12998. }
  12999. return preds;
  13000. };
  13001. Object.defineProperty(ATNConfigSet.prototype, "items", {
  13002. get: function get() {
  13003. return this.configs;
  13004. }
  13005. });
  13006. ATNConfigSet.prototype.optimizeConfigs = function (interpreter) {
  13007. if (this.readOnly) {
  13008. throw "This set is readonly";
  13009. }
  13010. if (this.configLookup.length === 0) {
  13011. return;
  13012. }
  13013. for (var i = 0; i < this.configs.length; i++) {
  13014. var config = this.configs[i];
  13015. config.context = interpreter.getCachedContext(config.context);
  13016. }
  13017. };
  13018. ATNConfigSet.prototype.addAll = function (coll) {
  13019. for (var i = 0; i < coll.length; i++) {
  13020. this.add(coll[i]);
  13021. }
  13022. return false;
  13023. };
  13024. ATNConfigSet.prototype.equals = function (other) {
  13025. return this === other || other instanceof ATNConfigSet && Utils.equalArrays(this.configs, other.configs) && this.fullCtx === other.fullCtx && this.uniqueAlt === other.uniqueAlt && this.conflictingAlts === other.conflictingAlts && this.hasSemanticContext === other.hasSemanticContext && this.dipsIntoOuterContext === other.dipsIntoOuterContext;
  13026. };
  13027. ATNConfigSet.prototype.hashCode = function () {
  13028. var hash = new Hash();
  13029. this.updateHashCode(hash);
  13030. return hash.finish();
  13031. };
  13032. ATNConfigSet.prototype.updateHashCode = function (hash) {
  13033. if (this.readOnly) {
  13034. if (this.cachedHashCode === -1) {
  13035. var hash = new Hash();
  13036. hash.update(this.configs);
  13037. this.cachedHashCode = hash.finish();
  13038. }
  13039. hash.update(this.cachedHashCode);
  13040. } else {
  13041. hash.update(this.configs);
  13042. }
  13043. };
  13044. Object.defineProperty(ATNConfigSet.prototype, "length", {
  13045. get: function get() {
  13046. return this.configs.length;
  13047. }
  13048. });
  13049. ATNConfigSet.prototype.isEmpty = function () {
  13050. return this.configs.length === 0;
  13051. };
  13052. ATNConfigSet.prototype.contains = function (item) {
  13053. if (this.configLookup === null) {
  13054. throw "This method is not implemented for readonly sets.";
  13055. }
  13056. return this.configLookup.contains(item);
  13057. };
  13058. ATNConfigSet.prototype.containsFast = function (item) {
  13059. if (this.configLookup === null) {
  13060. throw "This method is not implemented for readonly sets.";
  13061. }
  13062. return this.configLookup.containsFast(item);
  13063. };
  13064. ATNConfigSet.prototype.clear = function () {
  13065. if (this.readOnly) {
  13066. throw "This set is readonly";
  13067. }
  13068. this.configs = [];
  13069. this.cachedHashCode = -1;
  13070. this.configLookup = new Set();
  13071. };
  13072. ATNConfigSet.prototype.setReadonly = function (readOnly) {
  13073. this.readOnly = readOnly;
  13074. if (readOnly) {
  13075. this.configLookup = null; // can't mod, no need for lookup cache
  13076. }
  13077. };
  13078. ATNConfigSet.prototype.toString = function () {
  13079. return Utils.arrayToString(this.configs) + (this.hasSemanticContext ? ",hasSemanticContext=" + this.hasSemanticContext : "") + (this.uniqueAlt !== ATN.INVALID_ALT_NUMBER ? ",uniqueAlt=" + this.uniqueAlt : "") + (this.conflictingAlts !== null ? ",conflictingAlts=" + this.conflictingAlts : "") + (this.dipsIntoOuterContext ? ",dipsIntoOuterContext" : "");
  13080. };
  13081. function OrderedATNConfigSet() {
  13082. ATNConfigSet.call(this);
  13083. this.configLookup = new Set();
  13084. return this;
  13085. }
  13086. OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype);
  13087. OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet;
  13088. exports.ATNConfigSet = ATNConfigSet;
  13089. exports.OrderedATNConfigSet = OrderedATNConfigSet;
  13090. /***/ }),
  13091. /***/ "./node_modules/antlr4/atn/ATNDeserializationOptions.js":
  13092. /*!**************************************************************!*\
  13093. !*** ./node_modules/antlr4/atn/ATNDeserializationOptions.js ***!
  13094. \**************************************************************/
  13095. /*! no static exports found */
  13096. /***/ (function(module, exports, __webpack_require__) {
  13097. "use strict";
  13098. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  13099. * Use of this file is governed by the BSD 3-clause license that
  13100. * can be found in the LICENSE.txt file in the project root.
  13101. */
  13102. function ATNDeserializationOptions(copyFrom) {
  13103. if (copyFrom === undefined) {
  13104. copyFrom = null;
  13105. }
  13106. this.readOnly = false;
  13107. this.verifyATN = copyFrom === null ? true : copyFrom.verifyATN;
  13108. this.generateRuleBypassTransitions = copyFrom === null ? false : copyFrom.generateRuleBypassTransitions;
  13109. return this;
  13110. }
  13111. ATNDeserializationOptions.defaultOptions = new ATNDeserializationOptions();
  13112. ATNDeserializationOptions.defaultOptions.readOnly = true;
  13113. // def __setattr__(self, key, value):
  13114. // if key!="readOnly" and self.readOnly:
  13115. // raise Exception("The object is read only.")
  13116. // super(type(self), self).__setattr__(key,value)
  13117. exports.ATNDeserializationOptions = ATNDeserializationOptions;
  13118. /***/ }),
  13119. /***/ "./node_modules/antlr4/atn/ATNDeserializer.js":
  13120. /*!****************************************************!*\
  13121. !*** ./node_modules/antlr4/atn/ATNDeserializer.js ***!
  13122. \****************************************************/
  13123. /*! no static exports found */
  13124. /***/ (function(module, exports, __webpack_require__) {
  13125. "use strict";
  13126. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  13127. * Use of this file is governed by the BSD 3-clause license that
  13128. * can be found in the LICENSE.txt file in the project root.
  13129. */
  13130. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  13131. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  13132. var ATNType = __webpack_require__(/*! ./ATNType */ "./node_modules/antlr4/atn/ATNType.js").ATNType;
  13133. var ATNStates = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js");
  13134. var ATNState = ATNStates.ATNState;
  13135. var BasicState = ATNStates.BasicState;
  13136. var DecisionState = ATNStates.DecisionState;
  13137. var BlockStartState = ATNStates.BlockStartState;
  13138. var BlockEndState = ATNStates.BlockEndState;
  13139. var LoopEndState = ATNStates.LoopEndState;
  13140. var RuleStartState = ATNStates.RuleStartState;
  13141. var RuleStopState = ATNStates.RuleStopState;
  13142. var TokensStartState = ATNStates.TokensStartState;
  13143. var PlusLoopbackState = ATNStates.PlusLoopbackState;
  13144. var StarLoopbackState = ATNStates.StarLoopbackState;
  13145. var StarLoopEntryState = ATNStates.StarLoopEntryState;
  13146. var PlusBlockStartState = ATNStates.PlusBlockStartState;
  13147. var StarBlockStartState = ATNStates.StarBlockStartState;
  13148. var BasicBlockStartState = ATNStates.BasicBlockStartState;
  13149. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  13150. var Transition = Transitions.Transition;
  13151. var AtomTransition = Transitions.AtomTransition;
  13152. var SetTransition = Transitions.SetTransition;
  13153. var NotSetTransition = Transitions.NotSetTransition;
  13154. var RuleTransition = Transitions.RuleTransition;
  13155. var RangeTransition = Transitions.RangeTransition;
  13156. var ActionTransition = Transitions.ActionTransition;
  13157. var EpsilonTransition = Transitions.EpsilonTransition;
  13158. var WildcardTransition = Transitions.WildcardTransition;
  13159. var PredicateTransition = Transitions.PredicateTransition;
  13160. var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition;
  13161. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  13162. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  13163. var ATNDeserializationOptions = __webpack_require__(/*! ./ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  13164. var LexerActions = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js");
  13165. var LexerActionType = LexerActions.LexerActionType;
  13166. var LexerSkipAction = LexerActions.LexerSkipAction;
  13167. var LexerChannelAction = LexerActions.LexerChannelAction;
  13168. var LexerCustomAction = LexerActions.LexerCustomAction;
  13169. var LexerMoreAction = LexerActions.LexerMoreAction;
  13170. var LexerTypeAction = LexerActions.LexerTypeAction;
  13171. var LexerPushModeAction = LexerActions.LexerPushModeAction;
  13172. var LexerPopModeAction = LexerActions.LexerPopModeAction;
  13173. var LexerModeAction = LexerActions.LexerModeAction;
  13174. // This is the earliest supported serialized UUID.
  13175. // stick to serialized version for now, we don't need a UUID instance
  13176. var BASE_SERIALIZED_UUID = "AADB8D7E-AEEF-4415-AD2B-8204D6CF042E";
  13177. //
  13178. // This UUID indicates the serialized ATN contains two sets of
  13179. // IntervalSets, where the second set's values are encoded as
  13180. // 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
  13181. //
  13182. var ADDED_UNICODE_SMP = "59627784-3BE5-417A-B9EB-8131A7286089";
  13183. // This list contains all of the currently supported UUIDs, ordered by when
  13184. // the feature first appeared in this branch.
  13185. var SUPPORTED_UUIDS = [BASE_SERIALIZED_UUID, ADDED_UNICODE_SMP];
  13186. var SERIALIZED_VERSION = 3;
  13187. // This is the current serialized UUID.
  13188. var SERIALIZED_UUID = ADDED_UNICODE_SMP;
  13189. function initArray(length, value) {
  13190. var tmp = [];
  13191. tmp[length - 1] = value;
  13192. return tmp.map(function (i) {
  13193. return value;
  13194. });
  13195. }
  13196. function ATNDeserializer(options) {
  13197. if (options === undefined || options === null) {
  13198. options = ATNDeserializationOptions.defaultOptions;
  13199. }
  13200. this.deserializationOptions = options;
  13201. this.stateFactories = null;
  13202. this.actionFactories = null;
  13203. return this;
  13204. }
  13205. // Determines if a particular serialized representation of an ATN supports
  13206. // a particular feature, identified by the {@link UUID} used for serializing
  13207. // the ATN at the time the feature was first introduced.
  13208. //
  13209. // @param feature The {@link UUID} marking the first time the feature was
  13210. // supported in the serialized ATN.
  13211. // @param actualUuid The {@link UUID} of the actual serialized ATN which is
  13212. // currently being deserialized.
  13213. // @return {@code true} if the {@code actualUuid} value represents a
  13214. // serialized ATN at or after the feature identified by {@code feature} was
  13215. // introduced; otherwise, {@code false}.
  13216. ATNDeserializer.prototype.isFeatureSupported = function (feature, actualUuid) {
  13217. var idx1 = SUPPORTED_UUIDS.indexOf(feature);
  13218. if (idx1 < 0) {
  13219. return false;
  13220. }
  13221. var idx2 = SUPPORTED_UUIDS.indexOf(actualUuid);
  13222. return idx2 >= idx1;
  13223. };
  13224. ATNDeserializer.prototype.deserialize = function (data) {
  13225. this.reset(data);
  13226. this.checkVersion();
  13227. this.checkUUID();
  13228. var atn = this.readATN();
  13229. this.readStates(atn);
  13230. this.readRules(atn);
  13231. this.readModes(atn);
  13232. var sets = [];
  13233. // First, deserialize sets with 16-bit arguments <= U+FFFF.
  13234. this.readSets(atn, sets, this.readInt.bind(this));
  13235. // Next, if the ATN was serialized with the Unicode SMP feature,
  13236. // deserialize sets with 32-bit arguments <= U+10FFFF.
  13237. if (this.isFeatureSupported(ADDED_UNICODE_SMP, this.uuid)) {
  13238. this.readSets(atn, sets, this.readInt32.bind(this));
  13239. }
  13240. this.readEdges(atn, sets);
  13241. this.readDecisions(atn);
  13242. this.readLexerActions(atn);
  13243. this.markPrecedenceDecisions(atn);
  13244. this.verifyATN(atn);
  13245. if (this.deserializationOptions.generateRuleBypassTransitions && atn.grammarType === ATNType.PARSER) {
  13246. this.generateRuleBypassTransitions(atn);
  13247. // re-verify after modification
  13248. this.verifyATN(atn);
  13249. }
  13250. return atn;
  13251. };
  13252. ATNDeserializer.prototype.reset = function (data) {
  13253. var adjust = function adjust(c) {
  13254. var v = c.charCodeAt(0);
  13255. return v > 1 ? v - 2 : v + 65533;
  13256. };
  13257. var temp = data.split("").map(adjust);
  13258. // don't adjust the first value since that's the version number
  13259. temp[0] = data.charCodeAt(0);
  13260. this.data = temp;
  13261. this.pos = 0;
  13262. };
  13263. ATNDeserializer.prototype.checkVersion = function () {
  13264. var version = this.readInt();
  13265. if (version !== SERIALIZED_VERSION) {
  13266. throw "Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").";
  13267. }
  13268. };
  13269. ATNDeserializer.prototype.checkUUID = function () {
  13270. var uuid = this.readUUID();
  13271. if (SUPPORTED_UUIDS.indexOf(uuid) < 0) {
  13272. throw "Could not deserialize ATN with UUID: " + uuid + " (expected " + SERIALIZED_UUID + " or a legacy UUID).", uuid, SERIALIZED_UUID;
  13273. }
  13274. this.uuid = uuid;
  13275. };
  13276. ATNDeserializer.prototype.readATN = function () {
  13277. var grammarType = this.readInt();
  13278. var maxTokenType = this.readInt();
  13279. return new ATN(grammarType, maxTokenType);
  13280. };
  13281. ATNDeserializer.prototype.readStates = function (atn) {
  13282. var j, pair, stateNumber;
  13283. var loopBackStateNumbers = [];
  13284. var endStateNumbers = [];
  13285. var nstates = this.readInt();
  13286. for (var i = 0; i < nstates; i++) {
  13287. var stype = this.readInt();
  13288. // ignore bad type of states
  13289. if (stype === ATNState.INVALID_TYPE) {
  13290. atn.addState(null);
  13291. continue;
  13292. }
  13293. var ruleIndex = this.readInt();
  13294. if (ruleIndex === 0xFFFF) {
  13295. ruleIndex = -1;
  13296. }
  13297. var s = this.stateFactory(stype, ruleIndex);
  13298. if (stype === ATNState.LOOP_END) {
  13299. // special case
  13300. var loopBackStateNumber = this.readInt();
  13301. loopBackStateNumbers.push([s, loopBackStateNumber]);
  13302. } else if (s instanceof BlockStartState) {
  13303. var endStateNumber = this.readInt();
  13304. endStateNumbers.push([s, endStateNumber]);
  13305. }
  13306. atn.addState(s);
  13307. }
  13308. // delay the assignment of loop back and end states until we know all the
  13309. // state instances have been initialized
  13310. for (j = 0; j < loopBackStateNumbers.length; j++) {
  13311. pair = loopBackStateNumbers[j];
  13312. pair[0].loopBackState = atn.states[pair[1]];
  13313. }
  13314. for (j = 0; j < endStateNumbers.length; j++) {
  13315. pair = endStateNumbers[j];
  13316. pair[0].endState = atn.states[pair[1]];
  13317. }
  13318. var numNonGreedyStates = this.readInt();
  13319. for (j = 0; j < numNonGreedyStates; j++) {
  13320. stateNumber = this.readInt();
  13321. atn.states[stateNumber].nonGreedy = true;
  13322. }
  13323. var numPrecedenceStates = this.readInt();
  13324. for (j = 0; j < numPrecedenceStates; j++) {
  13325. stateNumber = this.readInt();
  13326. atn.states[stateNumber].isPrecedenceRule = true;
  13327. }
  13328. };
  13329. ATNDeserializer.prototype.readRules = function (atn) {
  13330. var i;
  13331. var nrules = this.readInt();
  13332. if (atn.grammarType === ATNType.LEXER) {
  13333. atn.ruleToTokenType = initArray(nrules, 0);
  13334. }
  13335. atn.ruleToStartState = initArray(nrules, 0);
  13336. for (i = 0; i < nrules; i++) {
  13337. var s = this.readInt();
  13338. var startState = atn.states[s];
  13339. atn.ruleToStartState[i] = startState;
  13340. if (atn.grammarType === ATNType.LEXER) {
  13341. var tokenType = this.readInt();
  13342. if (tokenType === 0xFFFF) {
  13343. tokenType = Token.EOF;
  13344. }
  13345. atn.ruleToTokenType[i] = tokenType;
  13346. }
  13347. }
  13348. atn.ruleToStopState = initArray(nrules, 0);
  13349. for (i = 0; i < atn.states.length; i++) {
  13350. var state = atn.states[i];
  13351. if (!(state instanceof RuleStopState)) {
  13352. continue;
  13353. }
  13354. atn.ruleToStopState[state.ruleIndex] = state;
  13355. atn.ruleToStartState[state.ruleIndex].stopState = state;
  13356. }
  13357. };
  13358. ATNDeserializer.prototype.readModes = function (atn) {
  13359. var nmodes = this.readInt();
  13360. for (var i = 0; i < nmodes; i++) {
  13361. var s = this.readInt();
  13362. atn.modeToStartState.push(atn.states[s]);
  13363. }
  13364. };
  13365. ATNDeserializer.prototype.readSets = function (atn, sets, readUnicode) {
  13366. var m = this.readInt();
  13367. for (var i = 0; i < m; i++) {
  13368. var iset = new IntervalSet();
  13369. sets.push(iset);
  13370. var n = this.readInt();
  13371. var containsEof = this.readInt();
  13372. if (containsEof !== 0) {
  13373. iset.addOne(-1);
  13374. }
  13375. for (var j = 0; j < n; j++) {
  13376. var i1 = readUnicode();
  13377. var i2 = readUnicode();
  13378. iset.addRange(i1, i2);
  13379. }
  13380. }
  13381. };
  13382. ATNDeserializer.prototype.readEdges = function (atn, sets) {
  13383. var i, j, state, trans, target;
  13384. var nedges = this.readInt();
  13385. for (i = 0; i < nedges; i++) {
  13386. var src = this.readInt();
  13387. var trg = this.readInt();
  13388. var ttype = this.readInt();
  13389. var arg1 = this.readInt();
  13390. var arg2 = this.readInt();
  13391. var arg3 = this.readInt();
  13392. trans = this.edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
  13393. var srcState = atn.states[src];
  13394. srcState.addTransition(trans);
  13395. }
  13396. // edges for rule stop states can be derived, so they aren't serialized
  13397. for (i = 0; i < atn.states.length; i++) {
  13398. state = atn.states[i];
  13399. for (j = 0; j < state.transitions.length; j++) {
  13400. var t = state.transitions[j];
  13401. if (!(t instanceof RuleTransition)) {
  13402. continue;
  13403. }
  13404. var outermostPrecedenceReturn = -1;
  13405. if (atn.ruleToStartState[t.target.ruleIndex].isPrecedenceRule) {
  13406. if (t.precedence === 0) {
  13407. outermostPrecedenceReturn = t.target.ruleIndex;
  13408. }
  13409. }
  13410. trans = new EpsilonTransition(t.followState, outermostPrecedenceReturn);
  13411. atn.ruleToStopState[t.target.ruleIndex].addTransition(trans);
  13412. }
  13413. }
  13414. for (i = 0; i < atn.states.length; i++) {
  13415. state = atn.states[i];
  13416. if (state instanceof BlockStartState) {
  13417. // we need to know the end state to set its start state
  13418. if (state.endState === null) {
  13419. throw "IllegalState";
  13420. }
  13421. // block end states can only be associated to a single block start
  13422. // state
  13423. if (state.endState.startState !== null) {
  13424. throw "IllegalState";
  13425. }
  13426. state.endState.startState = state;
  13427. }
  13428. if (state instanceof PlusLoopbackState) {
  13429. for (j = 0; j < state.transitions.length; j++) {
  13430. target = state.transitions[j].target;
  13431. if (target instanceof PlusBlockStartState) {
  13432. target.loopBackState = state;
  13433. }
  13434. }
  13435. } else if (state instanceof StarLoopbackState) {
  13436. for (j = 0; j < state.transitions.length; j++) {
  13437. target = state.transitions[j].target;
  13438. if (target instanceof StarLoopEntryState) {
  13439. target.loopBackState = state;
  13440. }
  13441. }
  13442. }
  13443. }
  13444. };
  13445. ATNDeserializer.prototype.readDecisions = function (atn) {
  13446. var ndecisions = this.readInt();
  13447. for (var i = 0; i < ndecisions; i++) {
  13448. var s = this.readInt();
  13449. var decState = atn.states[s];
  13450. atn.decisionToState.push(decState);
  13451. decState.decision = i;
  13452. }
  13453. };
  13454. ATNDeserializer.prototype.readLexerActions = function (atn) {
  13455. if (atn.grammarType === ATNType.LEXER) {
  13456. var count = this.readInt();
  13457. atn.lexerActions = initArray(count, null);
  13458. for (var i = 0; i < count; i++) {
  13459. var actionType = this.readInt();
  13460. var data1 = this.readInt();
  13461. if (data1 === 0xFFFF) {
  13462. data1 = -1;
  13463. }
  13464. var data2 = this.readInt();
  13465. if (data2 === 0xFFFF) {
  13466. data2 = -1;
  13467. }
  13468. var lexerAction = this.lexerActionFactory(actionType, data1, data2);
  13469. atn.lexerActions[i] = lexerAction;
  13470. }
  13471. }
  13472. };
  13473. ATNDeserializer.prototype.generateRuleBypassTransitions = function (atn) {
  13474. var i;
  13475. var count = atn.ruleToStartState.length;
  13476. for (i = 0; i < count; i++) {
  13477. atn.ruleToTokenType[i] = atn.maxTokenType + i + 1;
  13478. }
  13479. for (i = 0; i < count; i++) {
  13480. this.generateRuleBypassTransition(atn, i);
  13481. }
  13482. };
  13483. ATNDeserializer.prototype.generateRuleBypassTransition = function (atn, idx) {
  13484. var i, state;
  13485. var bypassStart = new BasicBlockStartState();
  13486. bypassStart.ruleIndex = idx;
  13487. atn.addState(bypassStart);
  13488. var bypassStop = new BlockEndState();
  13489. bypassStop.ruleIndex = idx;
  13490. atn.addState(bypassStop);
  13491. bypassStart.endState = bypassStop;
  13492. atn.defineDecisionState(bypassStart);
  13493. bypassStop.startState = bypassStart;
  13494. var excludeTransition = null;
  13495. var endState = null;
  13496. if (atn.ruleToStartState[idx].isPrecedenceRule) {
  13497. // wrap from the beginning of the rule to the StarLoopEntryState
  13498. endState = null;
  13499. for (i = 0; i < atn.states.length; i++) {
  13500. state = atn.states[i];
  13501. if (this.stateIsEndStateFor(state, idx)) {
  13502. endState = state;
  13503. excludeTransition = state.loopBackState.transitions[0];
  13504. break;
  13505. }
  13506. }
  13507. if (excludeTransition === null) {
  13508. throw "Couldn't identify final state of the precedence rule prefix section.";
  13509. }
  13510. } else {
  13511. endState = atn.ruleToStopState[idx];
  13512. }
  13513. // all non-excluded transitions that currently target end state need to
  13514. // target blockEnd instead
  13515. for (i = 0; i < atn.states.length; i++) {
  13516. state = atn.states[i];
  13517. for (var j = 0; j < state.transitions.length; j++) {
  13518. var transition = state.transitions[j];
  13519. if (transition === excludeTransition) {
  13520. continue;
  13521. }
  13522. if (transition.target === endState) {
  13523. transition.target = bypassStop;
  13524. }
  13525. }
  13526. }
  13527. // all transitions leaving the rule start state need to leave blockStart
  13528. // instead
  13529. var ruleToStartState = atn.ruleToStartState[idx];
  13530. var count = ruleToStartState.transitions.length;
  13531. while (count > 0) {
  13532. bypassStart.addTransition(ruleToStartState.transitions[count - 1]);
  13533. ruleToStartState.transitions = ruleToStartState.transitions.slice(-1);
  13534. }
  13535. // link the new states
  13536. atn.ruleToStartState[idx].addTransition(new EpsilonTransition(bypassStart));
  13537. bypassStop.addTransition(new EpsilonTransition(endState));
  13538. var matchState = new BasicState();
  13539. atn.addState(matchState);
  13540. matchState.addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[idx]));
  13541. bypassStart.addTransition(new EpsilonTransition(matchState));
  13542. };
  13543. ATNDeserializer.prototype.stateIsEndStateFor = function (state, idx) {
  13544. if (state.ruleIndex !== idx) {
  13545. return null;
  13546. }
  13547. if (!(state instanceof StarLoopEntryState)) {
  13548. return null;
  13549. }
  13550. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  13551. if (!(maybeLoopEndState instanceof LoopEndState)) {
  13552. return null;
  13553. }
  13554. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  13555. return state;
  13556. } else {
  13557. return null;
  13558. }
  13559. };
  13560. //
  13561. // Analyze the {@link StarLoopEntryState} states in the specified ATN to set
  13562. // the {@link StarLoopEntryState//isPrecedenceDecision} field to the
  13563. // correct value.
  13564. //
  13565. // @param atn The ATN.
  13566. //
  13567. ATNDeserializer.prototype.markPrecedenceDecisions = function (atn) {
  13568. for (var i = 0; i < atn.states.length; i++) {
  13569. var state = atn.states[i];
  13570. if (!(state instanceof StarLoopEntryState)) {
  13571. continue;
  13572. }
  13573. // We analyze the ATN to determine if this ATN decision state is the
  13574. // decision for the closure block that determines whether a
  13575. // precedence rule should continue or complete.
  13576. //
  13577. if (atn.ruleToStartState[state.ruleIndex].isPrecedenceRule) {
  13578. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  13579. if (maybeLoopEndState instanceof LoopEndState) {
  13580. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  13581. state.isPrecedenceDecision = true;
  13582. }
  13583. }
  13584. }
  13585. }
  13586. };
  13587. ATNDeserializer.prototype.verifyATN = function (atn) {
  13588. if (!this.deserializationOptions.verifyATN) {
  13589. return;
  13590. }
  13591. // verify assumptions
  13592. for (var i = 0; i < atn.states.length; i++) {
  13593. var state = atn.states[i];
  13594. if (state === null) {
  13595. continue;
  13596. }
  13597. this.checkCondition(state.epsilonOnlyTransitions || state.transitions.length <= 1);
  13598. if (state instanceof PlusBlockStartState) {
  13599. this.checkCondition(state.loopBackState !== null);
  13600. } else if (state instanceof StarLoopEntryState) {
  13601. this.checkCondition(state.loopBackState !== null);
  13602. this.checkCondition(state.transitions.length === 2);
  13603. if (state.transitions[0].target instanceof StarBlockStartState) {
  13604. this.checkCondition(state.transitions[1].target instanceof LoopEndState);
  13605. this.checkCondition(!state.nonGreedy);
  13606. } else if (state.transitions[0].target instanceof LoopEndState) {
  13607. this.checkCondition(state.transitions[1].target instanceof StarBlockStartState);
  13608. this.checkCondition(state.nonGreedy);
  13609. } else {
  13610. throw "IllegalState";
  13611. }
  13612. } else if (state instanceof StarLoopbackState) {
  13613. this.checkCondition(state.transitions.length === 1);
  13614. this.checkCondition(state.transitions[0].target instanceof StarLoopEntryState);
  13615. } else if (state instanceof LoopEndState) {
  13616. this.checkCondition(state.loopBackState !== null);
  13617. } else if (state instanceof RuleStartState) {
  13618. this.checkCondition(state.stopState !== null);
  13619. } else if (state instanceof BlockStartState) {
  13620. this.checkCondition(state.endState !== null);
  13621. } else if (state instanceof BlockEndState) {
  13622. this.checkCondition(state.startState !== null);
  13623. } else if (state instanceof DecisionState) {
  13624. this.checkCondition(state.transitions.length <= 1 || state.decision >= 0);
  13625. } else {
  13626. this.checkCondition(state.transitions.length <= 1 || state instanceof RuleStopState);
  13627. }
  13628. }
  13629. };
  13630. ATNDeserializer.prototype.checkCondition = function (condition, message) {
  13631. if (!condition) {
  13632. if (message === undefined || message === null) {
  13633. message = "IllegalState";
  13634. }
  13635. throw message;
  13636. }
  13637. };
  13638. ATNDeserializer.prototype.readInt = function () {
  13639. return this.data[this.pos++];
  13640. };
  13641. ATNDeserializer.prototype.readInt32 = function () {
  13642. var low = this.readInt();
  13643. var high = this.readInt();
  13644. return low | high << 16;
  13645. };
  13646. ATNDeserializer.prototype.readLong = function () {
  13647. var low = this.readInt32();
  13648. var high = this.readInt32();
  13649. return low & 0x00000000FFFFFFFF | high << 32;
  13650. };
  13651. function createByteToHex() {
  13652. var bth = [];
  13653. for (var i = 0; i < 256; i++) {
  13654. bth[i] = (i + 0x100).toString(16).substr(1).toUpperCase();
  13655. }
  13656. return bth;
  13657. }
  13658. var byteToHex = createByteToHex();
  13659. ATNDeserializer.prototype.readUUID = function () {
  13660. var bb = [];
  13661. for (var i = 7; i >= 0; i--) {
  13662. var int = this.readInt();
  13663. /* jshint bitwise: false */
  13664. bb[2 * i + 1] = int & 0xFF;
  13665. bb[2 * i] = int >> 8 & 0xFF;
  13666. }
  13667. return byteToHex[bb[0]] + byteToHex[bb[1]] + byteToHex[bb[2]] + byteToHex[bb[3]] + '-' + byteToHex[bb[4]] + byteToHex[bb[5]] + '-' + byteToHex[bb[6]] + byteToHex[bb[7]] + '-' + byteToHex[bb[8]] + byteToHex[bb[9]] + '-' + byteToHex[bb[10]] + byteToHex[bb[11]] + byteToHex[bb[12]] + byteToHex[bb[13]] + byteToHex[bb[14]] + byteToHex[bb[15]];
  13668. };
  13669. ATNDeserializer.prototype.edgeFactory = function (atn, type, src, trg, arg1, arg2, arg3, sets) {
  13670. var target = atn.states[trg];
  13671. switch (type) {
  13672. case Transition.EPSILON:
  13673. return new EpsilonTransition(target);
  13674. case Transition.RANGE:
  13675. return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2);
  13676. case Transition.RULE:
  13677. return new RuleTransition(atn.states[arg1], arg2, arg3, target);
  13678. case Transition.PREDICATE:
  13679. return new PredicateTransition(target, arg1, arg2, arg3 !== 0);
  13680. case Transition.PRECEDENCE:
  13681. return new PrecedencePredicateTransition(target, arg1);
  13682. case Transition.ATOM:
  13683. return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1);
  13684. case Transition.ACTION:
  13685. return new ActionTransition(target, arg1, arg2, arg3 !== 0);
  13686. case Transition.SET:
  13687. return new SetTransition(target, sets[arg1]);
  13688. case Transition.NOT_SET:
  13689. return new NotSetTransition(target, sets[arg1]);
  13690. case Transition.WILDCARD:
  13691. return new WildcardTransition(target);
  13692. default:
  13693. throw "The specified transition type: " + type + " is not valid.";
  13694. }
  13695. };
  13696. ATNDeserializer.prototype.stateFactory = function (type, ruleIndex) {
  13697. if (this.stateFactories === null) {
  13698. var sf = [];
  13699. sf[ATNState.INVALID_TYPE] = null;
  13700. sf[ATNState.BASIC] = function () {
  13701. return new BasicState();
  13702. };
  13703. sf[ATNState.RULE_START] = function () {
  13704. return new RuleStartState();
  13705. };
  13706. sf[ATNState.BLOCK_START] = function () {
  13707. return new BasicBlockStartState();
  13708. };
  13709. sf[ATNState.PLUS_BLOCK_START] = function () {
  13710. return new PlusBlockStartState();
  13711. };
  13712. sf[ATNState.STAR_BLOCK_START] = function () {
  13713. return new StarBlockStartState();
  13714. };
  13715. sf[ATNState.TOKEN_START] = function () {
  13716. return new TokensStartState();
  13717. };
  13718. sf[ATNState.RULE_STOP] = function () {
  13719. return new RuleStopState();
  13720. };
  13721. sf[ATNState.BLOCK_END] = function () {
  13722. return new BlockEndState();
  13723. };
  13724. sf[ATNState.STAR_LOOP_BACK] = function () {
  13725. return new StarLoopbackState();
  13726. };
  13727. sf[ATNState.STAR_LOOP_ENTRY] = function () {
  13728. return new StarLoopEntryState();
  13729. };
  13730. sf[ATNState.PLUS_LOOP_BACK] = function () {
  13731. return new PlusLoopbackState();
  13732. };
  13733. sf[ATNState.LOOP_END] = function () {
  13734. return new LoopEndState();
  13735. };
  13736. this.stateFactories = sf;
  13737. }
  13738. if (type > this.stateFactories.length || this.stateFactories[type] === null) {
  13739. throw "The specified state type " + type + " is not valid.";
  13740. } else {
  13741. var s = this.stateFactories[type]();
  13742. if (s !== null) {
  13743. s.ruleIndex = ruleIndex;
  13744. return s;
  13745. }
  13746. }
  13747. };
  13748. ATNDeserializer.prototype.lexerActionFactory = function (type, data1, data2) {
  13749. if (this.actionFactories === null) {
  13750. var af = [];
  13751. af[LexerActionType.CHANNEL] = function (data1, data2) {
  13752. return new LexerChannelAction(data1);
  13753. };
  13754. af[LexerActionType.CUSTOM] = function (data1, data2) {
  13755. return new LexerCustomAction(data1, data2);
  13756. };
  13757. af[LexerActionType.MODE] = function (data1, data2) {
  13758. return new LexerModeAction(data1);
  13759. };
  13760. af[LexerActionType.MORE] = function (data1, data2) {
  13761. return LexerMoreAction.INSTANCE;
  13762. };
  13763. af[LexerActionType.POP_MODE] = function (data1, data2) {
  13764. return LexerPopModeAction.INSTANCE;
  13765. };
  13766. af[LexerActionType.PUSH_MODE] = function (data1, data2) {
  13767. return new LexerPushModeAction(data1);
  13768. };
  13769. af[LexerActionType.SKIP] = function (data1, data2) {
  13770. return LexerSkipAction.INSTANCE;
  13771. };
  13772. af[LexerActionType.TYPE] = function (data1, data2) {
  13773. return new LexerTypeAction(data1);
  13774. };
  13775. this.actionFactories = af;
  13776. }
  13777. if (type > this.actionFactories.length || this.actionFactories[type] === null) {
  13778. throw "The specified lexer action type " + type + " is not valid.";
  13779. } else {
  13780. return this.actionFactories[type](data1, data2);
  13781. }
  13782. };
  13783. exports.ATNDeserializer = ATNDeserializer;
  13784. /***/ }),
  13785. /***/ "./node_modules/antlr4/atn/ATNSimulator.js":
  13786. /*!*************************************************!*\
  13787. !*** ./node_modules/antlr4/atn/ATNSimulator.js ***!
  13788. \*************************************************/
  13789. /*! no static exports found */
  13790. /***/ (function(module, exports, __webpack_require__) {
  13791. "use strict";
  13792. //
  13793. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  13794. * Use of this file is governed by the BSD 3-clause license that
  13795. * can be found in the LICENSE.txt file in the project root.
  13796. */
  13797. ///
  13798. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  13799. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  13800. var getCachedPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").getCachedPredictionContext;
  13801. function ATNSimulator(atn, sharedContextCache) {
  13802. // The context cache maps all PredictionContext objects that are ==
  13803. // to a single cached copy. This cache is shared across all contexts
  13804. // in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
  13805. // to use only cached nodes/graphs in addDFAState(). We don't want to
  13806. // fill this during closure() since there are lots of contexts that
  13807. // pop up but are not used ever again. It also greatly slows down closure().
  13808. //
  13809. // <p>This cache makes a huge difference in memory and a little bit in speed.
  13810. // For the Java grammar on java.*, it dropped the memory requirements
  13811. // at the end from 25M to 16M. We don't store any of the full context
  13812. // graphs in the DFA because they are limited to local context only,
  13813. // but apparently there's a lot of repetition there as well. We optimize
  13814. // the config contexts before storing the config set in the DFA states
  13815. // by literally rebuilding them with cached subgraphs only.</p>
  13816. //
  13817. // <p>I tried a cache for use during closure operations, that was
  13818. // whacked after each adaptivePredict(). It cost a little bit
  13819. // more time I think and doesn't save on the overall footprint
  13820. // so it's not worth the complexity.</p>
  13821. ///
  13822. this.atn = atn;
  13823. this.sharedContextCache = sharedContextCache;
  13824. return this;
  13825. }
  13826. // Must distinguish between missing edge and edge we know leads nowhere///
  13827. ATNSimulator.ERROR = new DFAState(0x7FFFFFFF, new ATNConfigSet());
  13828. ATNSimulator.prototype.getCachedContext = function (context) {
  13829. if (this.sharedContextCache === null) {
  13830. return context;
  13831. }
  13832. var visited = {};
  13833. return getCachedPredictionContext(context, this.sharedContextCache, visited);
  13834. };
  13835. exports.ATNSimulator = ATNSimulator;
  13836. /***/ }),
  13837. /***/ "./node_modules/antlr4/atn/ATNState.js":
  13838. /*!*********************************************!*\
  13839. !*** ./node_modules/antlr4/atn/ATNState.js ***!
  13840. \*********************************************/
  13841. /*! no static exports found */
  13842. /***/ (function(module, exports, __webpack_require__) {
  13843. "use strict";
  13844. //
  13845. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  13846. * Use of this file is governed by the BSD 3-clause license that
  13847. * can be found in the LICENSE.txt file in the project root.
  13848. */
  13849. //
  13850. // The following images show the relation of states and
  13851. // {@link ATNState//transitions} for various grammar constructs.
  13852. //
  13853. // <ul>
  13854. //
  13855. // <li>Solid edges marked with an &//0949; indicate a required
  13856. // {@link EpsilonTransition}.</li>
  13857. //
  13858. // <li>Dashed edges indicate locations where any transition derived from
  13859. // {@link Transition} might appear.</li>
  13860. //
  13861. // <li>Dashed nodes are place holders for either a sequence of linked
  13862. // {@link BasicState} states or the inclusion of a block representing a nested
  13863. // construct in one of the forms below.</li>
  13864. //
  13865. // <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
  13866. // any number of alternatives (one or more). Nodes without the {@code ...} only
  13867. // support the exact number of alternatives shown in the diagram.</li>
  13868. //
  13869. // </ul>
  13870. //
  13871. // <h2>Basic Blocks</h2>
  13872. //
  13873. // <h3>Rule</h3>
  13874. //
  13875. // <embed src="images/Rule.svg" type="image/svg+xml"/>
  13876. //
  13877. // <h3>Block of 1 or more alternatives</h3>
  13878. //
  13879. // <embed src="images/Block.svg" type="image/svg+xml"/>
  13880. //
  13881. // <h2>Greedy Loops</h2>
  13882. //
  13883. // <h3>Greedy Closure: {@code (...)*}</h3>
  13884. //
  13885. // <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
  13886. //
  13887. // <h3>Greedy Positive Closure: {@code (...)+}</h3>
  13888. //
  13889. // <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
  13890. //
  13891. // <h3>Greedy Optional: {@code (...)?}</h3>
  13892. //
  13893. // <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
  13894. //
  13895. // <h2>Non-Greedy Loops</h2>
  13896. //
  13897. // <h3>Non-Greedy Closure: {@code (...)*?}</h3>
  13898. //
  13899. // <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
  13900. //
  13901. // <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
  13902. //
  13903. // <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
  13904. //
  13905. // <h3>Non-Greedy Optional: {@code (...)??}</h3>
  13906. //
  13907. // <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
  13908. //
  13909. var INITIAL_NUM_TRANSITIONS = 4;
  13910. function ATNState() {
  13911. // Which ATN are we in?
  13912. this.atn = null;
  13913. this.stateNumber = ATNState.INVALID_STATE_NUMBER;
  13914. this.stateType = null;
  13915. this.ruleIndex = 0; // at runtime, we don't have Rule objects
  13916. this.epsilonOnlyTransitions = false;
  13917. // Track the transitions emanating from this ATN state.
  13918. this.transitions = [];
  13919. // Used to cache lookahead during parsing, not used during construction
  13920. this.nextTokenWithinRule = null;
  13921. return this;
  13922. }
  13923. // constants for serialization
  13924. ATNState.INVALID_TYPE = 0;
  13925. ATNState.BASIC = 1;
  13926. ATNState.RULE_START = 2;
  13927. ATNState.BLOCK_START = 3;
  13928. ATNState.PLUS_BLOCK_START = 4;
  13929. ATNState.STAR_BLOCK_START = 5;
  13930. ATNState.TOKEN_START = 6;
  13931. ATNState.RULE_STOP = 7;
  13932. ATNState.BLOCK_END = 8;
  13933. ATNState.STAR_LOOP_BACK = 9;
  13934. ATNState.STAR_LOOP_ENTRY = 10;
  13935. ATNState.PLUS_LOOP_BACK = 11;
  13936. ATNState.LOOP_END = 12;
  13937. ATNState.serializationNames = ["INVALID", "BASIC", "RULE_START", "BLOCK_START", "PLUS_BLOCK_START", "STAR_BLOCK_START", "TOKEN_START", "RULE_STOP", "BLOCK_END", "STAR_LOOP_BACK", "STAR_LOOP_ENTRY", "PLUS_LOOP_BACK", "LOOP_END"];
  13938. ATNState.INVALID_STATE_NUMBER = -1;
  13939. ATNState.prototype.toString = function () {
  13940. return this.stateNumber;
  13941. };
  13942. ATNState.prototype.equals = function (other) {
  13943. if (other instanceof ATNState) {
  13944. return this.stateNumber === other.stateNumber;
  13945. } else {
  13946. return false;
  13947. }
  13948. };
  13949. ATNState.prototype.isNonGreedyExitState = function () {
  13950. return false;
  13951. };
  13952. ATNState.prototype.addTransition = function (trans, index) {
  13953. if (index === undefined) {
  13954. index = -1;
  13955. }
  13956. if (this.transitions.length === 0) {
  13957. this.epsilonOnlyTransitions = trans.isEpsilon;
  13958. } else if (this.epsilonOnlyTransitions !== trans.isEpsilon) {
  13959. this.epsilonOnlyTransitions = false;
  13960. }
  13961. if (index === -1) {
  13962. this.transitions.push(trans);
  13963. } else {
  13964. this.transitions.splice(index, 1, trans);
  13965. }
  13966. };
  13967. function BasicState() {
  13968. ATNState.call(this);
  13969. this.stateType = ATNState.BASIC;
  13970. return this;
  13971. }
  13972. BasicState.prototype = Object.create(ATNState.prototype);
  13973. BasicState.prototype.constructor = BasicState;
  13974. function DecisionState() {
  13975. ATNState.call(this);
  13976. this.decision = -1;
  13977. this.nonGreedy = false;
  13978. return this;
  13979. }
  13980. DecisionState.prototype = Object.create(ATNState.prototype);
  13981. DecisionState.prototype.constructor = DecisionState;
  13982. // The start of a regular {@code (...)} block.
  13983. function BlockStartState() {
  13984. DecisionState.call(this);
  13985. this.endState = null;
  13986. return this;
  13987. }
  13988. BlockStartState.prototype = Object.create(DecisionState.prototype);
  13989. BlockStartState.prototype.constructor = BlockStartState;
  13990. function BasicBlockStartState() {
  13991. BlockStartState.call(this);
  13992. this.stateType = ATNState.BLOCK_START;
  13993. return this;
  13994. }
  13995. BasicBlockStartState.prototype = Object.create(BlockStartState.prototype);
  13996. BasicBlockStartState.prototype.constructor = BasicBlockStartState;
  13997. // Terminal node of a simple {@code (a|b|c)} block.
  13998. function BlockEndState() {
  13999. ATNState.call(this);
  14000. this.stateType = ATNState.BLOCK_END;
  14001. this.startState = null;
  14002. return this;
  14003. }
  14004. BlockEndState.prototype = Object.create(ATNState.prototype);
  14005. BlockEndState.prototype.constructor = BlockEndState;
  14006. // The last node in the ATN for a rule, unless that rule is the start symbol.
  14007. // In that case, there is one transition to EOF. Later, we might encode
  14008. // references to all calls to this rule to compute FOLLOW sets for
  14009. // error handling.
  14010. //
  14011. function RuleStopState() {
  14012. ATNState.call(this);
  14013. this.stateType = ATNState.RULE_STOP;
  14014. return this;
  14015. }
  14016. RuleStopState.prototype = Object.create(ATNState.prototype);
  14017. RuleStopState.prototype.constructor = RuleStopState;
  14018. function RuleStartState() {
  14019. ATNState.call(this);
  14020. this.stateType = ATNState.RULE_START;
  14021. this.stopState = null;
  14022. this.isPrecedenceRule = false;
  14023. return this;
  14024. }
  14025. RuleStartState.prototype = Object.create(ATNState.prototype);
  14026. RuleStartState.prototype.constructor = RuleStartState;
  14027. // Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
  14028. // one to the loop back to start of the block and one to exit.
  14029. //
  14030. function PlusLoopbackState() {
  14031. DecisionState.call(this);
  14032. this.stateType = ATNState.PLUS_LOOP_BACK;
  14033. return this;
  14034. }
  14035. PlusLoopbackState.prototype = Object.create(DecisionState.prototype);
  14036. PlusLoopbackState.prototype.constructor = PlusLoopbackState;
  14037. // Start of {@code (A|B|...)+} loop. Technically a decision state, but
  14038. // we don't use for code generation; somebody might need it, so I'm defining
  14039. // it for completeness. In reality, the {@link PlusLoopbackState} node is the
  14040. // real decision-making note for {@code A+}.
  14041. //
  14042. function PlusBlockStartState() {
  14043. BlockStartState.call(this);
  14044. this.stateType = ATNState.PLUS_BLOCK_START;
  14045. this.loopBackState = null;
  14046. return this;
  14047. }
  14048. PlusBlockStartState.prototype = Object.create(BlockStartState.prototype);
  14049. PlusBlockStartState.prototype.constructor = PlusBlockStartState;
  14050. // The block that begins a closure loop.
  14051. function StarBlockStartState() {
  14052. BlockStartState.call(this);
  14053. this.stateType = ATNState.STAR_BLOCK_START;
  14054. return this;
  14055. }
  14056. StarBlockStartState.prototype = Object.create(BlockStartState.prototype);
  14057. StarBlockStartState.prototype.constructor = StarBlockStartState;
  14058. function StarLoopbackState() {
  14059. ATNState.call(this);
  14060. this.stateType = ATNState.STAR_LOOP_BACK;
  14061. return this;
  14062. }
  14063. StarLoopbackState.prototype = Object.create(ATNState.prototype);
  14064. StarLoopbackState.prototype.constructor = StarLoopbackState;
  14065. function StarLoopEntryState() {
  14066. DecisionState.call(this);
  14067. this.stateType = ATNState.STAR_LOOP_ENTRY;
  14068. this.loopBackState = null;
  14069. // Indicates whether this state can benefit from a precedence DFA during SLL decision making.
  14070. this.isPrecedenceDecision = null;
  14071. return this;
  14072. }
  14073. StarLoopEntryState.prototype = Object.create(DecisionState.prototype);
  14074. StarLoopEntryState.prototype.constructor = StarLoopEntryState;
  14075. // Mark the end of a * or + loop.
  14076. function LoopEndState() {
  14077. ATNState.call(this);
  14078. this.stateType = ATNState.LOOP_END;
  14079. this.loopBackState = null;
  14080. return this;
  14081. }
  14082. LoopEndState.prototype = Object.create(ATNState.prototype);
  14083. LoopEndState.prototype.constructor = LoopEndState;
  14084. // The Tokens rule start state linking to each lexer rule start state */
  14085. function TokensStartState() {
  14086. DecisionState.call(this);
  14087. this.stateType = ATNState.TOKEN_START;
  14088. return this;
  14089. }
  14090. TokensStartState.prototype = Object.create(DecisionState.prototype);
  14091. TokensStartState.prototype.constructor = TokensStartState;
  14092. exports.ATNState = ATNState;
  14093. exports.BasicState = BasicState;
  14094. exports.DecisionState = DecisionState;
  14095. exports.BlockStartState = BlockStartState;
  14096. exports.BlockEndState = BlockEndState;
  14097. exports.LoopEndState = LoopEndState;
  14098. exports.RuleStartState = RuleStartState;
  14099. exports.RuleStopState = RuleStopState;
  14100. exports.TokensStartState = TokensStartState;
  14101. exports.PlusLoopbackState = PlusLoopbackState;
  14102. exports.StarLoopbackState = StarLoopbackState;
  14103. exports.StarLoopEntryState = StarLoopEntryState;
  14104. exports.PlusBlockStartState = PlusBlockStartState;
  14105. exports.StarBlockStartState = StarBlockStartState;
  14106. exports.BasicBlockStartState = BasicBlockStartState;
  14107. /***/ }),
  14108. /***/ "./node_modules/antlr4/atn/ATNType.js":
  14109. /*!********************************************!*\
  14110. !*** ./node_modules/antlr4/atn/ATNType.js ***!
  14111. \********************************************/
  14112. /*! no static exports found */
  14113. /***/ (function(module, exports, __webpack_require__) {
  14114. "use strict";
  14115. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  14116. * Use of this file is governed by the BSD 3-clause license that
  14117. * can be found in the LICENSE.txt file in the project root.
  14118. */
  14119. ///
  14120. // Represents the type of recognizer an ATN applies to.
  14121. function ATNType() {}
  14122. ATNType.LEXER = 0;
  14123. ATNType.PARSER = 1;
  14124. exports.ATNType = ATNType;
  14125. /***/ }),
  14126. /***/ "./node_modules/antlr4/atn/LexerATNSimulator.js":
  14127. /*!******************************************************!*\
  14128. !*** ./node_modules/antlr4/atn/LexerATNSimulator.js ***!
  14129. \******************************************************/
  14130. /*! no static exports found */
  14131. /***/ (function(module, exports, __webpack_require__) {
  14132. "use strict";
  14133. //
  14134. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  14135. * Use of this file is governed by the BSD 3-clause license that
  14136. * can be found in the LICENSE.txt file in the project root.
  14137. */
  14138. ///
  14139. // When we hit an accept state in either the DFA or the ATN, we
  14140. // have to notify the character stream to start buffering characters
  14141. // via {@link IntStream//mark} and record the current state. The current sim state
  14142. // includes the current index into the input, the current line,
  14143. // and current character position in that line. Note that the Lexer is
  14144. // tracking the starting line and characterization of the token. These
  14145. // variables track the "state" of the simulator when it hits an accept state.
  14146. //
  14147. // <p>We track these variables separately for the DFA and ATN simulation
  14148. // because the DFA simulation often has to fail over to the ATN
  14149. // simulation. If the ATN simulation fails, we need the DFA to fall
  14150. // back to its previously accepted state, if any. If the ATN succeeds,
  14151. // then the ATN does the accept and the DFA simulator that invoked it
  14152. // can simply return the predicted token type.</p>
  14153. ///
  14154. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  14155. var Lexer = __webpack_require__(/*! ./../Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  14156. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  14157. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  14158. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  14159. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  14160. var OrderedATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").OrderedATNConfigSet;
  14161. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  14162. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  14163. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  14164. var LexerATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").LexerATNConfig;
  14165. var Transition = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js").Transition;
  14166. var LexerActionExecutor = __webpack_require__(/*! ./LexerActionExecutor */ "./node_modules/antlr4/atn/LexerActionExecutor.js").LexerActionExecutor;
  14167. var LexerNoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  14168. function resetSimState(sim) {
  14169. sim.index = -1;
  14170. sim.line = 0;
  14171. sim.column = -1;
  14172. sim.dfaState = null;
  14173. }
  14174. function SimState() {
  14175. resetSimState(this);
  14176. return this;
  14177. }
  14178. SimState.prototype.reset = function () {
  14179. resetSimState(this);
  14180. };
  14181. function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
  14182. ATNSimulator.call(this, atn, sharedContextCache);
  14183. this.decisionToDFA = decisionToDFA;
  14184. this.recog = recog;
  14185. // The current token's starting index into the character stream.
  14186. // Shared across DFA to ATN simulation in case the ATN fails and the
  14187. // DFA did not have a previous accept state. In this case, we use the
  14188. // ATN-generated exception object.
  14189. this.startIndex = -1;
  14190. // line number 1..n within the input///
  14191. this.line = 1;
  14192. // The index of the character relative to the beginning of the line
  14193. // 0..n-1///
  14194. this.column = 0;
  14195. this.mode = Lexer.DEFAULT_MODE;
  14196. // Used during DFA/ATN exec to record the most recent accept configuration
  14197. // info
  14198. this.prevAccept = new SimState();
  14199. // done
  14200. return this;
  14201. }
  14202. LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  14203. LexerATNSimulator.prototype.constructor = LexerATNSimulator;
  14204. LexerATNSimulator.debug = false;
  14205. LexerATNSimulator.dfa_debug = false;
  14206. LexerATNSimulator.MIN_DFA_EDGE = 0;
  14207. LexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
  14208. LexerATNSimulator.match_calls = 0;
  14209. LexerATNSimulator.prototype.copyState = function (simulator) {
  14210. this.column = simulator.column;
  14211. this.line = simulator.line;
  14212. this.mode = simulator.mode;
  14213. this.startIndex = simulator.startIndex;
  14214. };
  14215. LexerATNSimulator.prototype.match = function (input, mode) {
  14216. this.match_calls += 1;
  14217. this.mode = mode;
  14218. var mark = input.mark();
  14219. try {
  14220. this.startIndex = input.index;
  14221. this.prevAccept.reset();
  14222. var dfa = this.decisionToDFA[mode];
  14223. if (dfa.s0 === null) {
  14224. return this.matchATN(input);
  14225. } else {
  14226. return this.execATN(input, dfa.s0);
  14227. }
  14228. } finally {
  14229. input.release(mark);
  14230. }
  14231. };
  14232. LexerATNSimulator.prototype.reset = function () {
  14233. this.prevAccept.reset();
  14234. this.startIndex = -1;
  14235. this.line = 1;
  14236. this.column = 0;
  14237. this.mode = Lexer.DEFAULT_MODE;
  14238. };
  14239. LexerATNSimulator.prototype.matchATN = function (input) {
  14240. var startState = this.atn.modeToStartState[this.mode];
  14241. if (LexerATNSimulator.debug) {
  14242. console.log("matchATN mode " + this.mode + " start: " + startState);
  14243. }
  14244. var old_mode = this.mode;
  14245. var s0_closure = this.computeStartState(input, startState);
  14246. var suppressEdge = s0_closure.hasSemanticContext;
  14247. s0_closure.hasSemanticContext = false;
  14248. var next = this.addDFAState(s0_closure);
  14249. if (!suppressEdge) {
  14250. this.decisionToDFA[this.mode].s0 = next;
  14251. }
  14252. var predict = this.execATN(input, next);
  14253. if (LexerATNSimulator.debug) {
  14254. console.log("DFA after matchATN: " + this.decisionToDFA[old_mode].toLexerString());
  14255. }
  14256. return predict;
  14257. };
  14258. LexerATNSimulator.prototype.execATN = function (input, ds0) {
  14259. if (LexerATNSimulator.debug) {
  14260. console.log("start state closure=" + ds0.configs);
  14261. }
  14262. if (ds0.isAcceptState) {
  14263. // allow zero-length tokens
  14264. this.captureSimState(this.prevAccept, input, ds0);
  14265. }
  14266. var t = input.LA(1);
  14267. var s = ds0; // s is current/from DFA state
  14268. while (true) {
  14269. // while more work
  14270. if (LexerATNSimulator.debug) {
  14271. console.log("execATN loop starting closure: " + s.configs);
  14272. }
  14273. // As we move src->trg, src->trg, we keep track of the previous trg to
  14274. // avoid looking up the DFA state again, which is expensive.
  14275. // If the previous target was already part of the DFA, we might
  14276. // be able to avoid doing a reach operation upon t. If s!=null,
  14277. // it means that semantic predicates didn't prevent us from
  14278. // creating a DFA state. Once we know s!=null, we check to see if
  14279. // the DFA state has an edge already for t. If so, we can just reuse
  14280. // it's configuration set; there's no point in re-computing it.
  14281. // This is kind of like doing DFA simulation within the ATN
  14282. // simulation because DFA simulation is really just a way to avoid
  14283. // computing reach/closure sets. Technically, once we know that
  14284. // we have a previously added DFA state, we could jump over to
  14285. // the DFA simulator. But, that would mean popping back and forth
  14286. // a lot and making things more complicated algorithmically.
  14287. // This optimization makes a lot of sense for loops within DFA.
  14288. // A character will take us back to an existing DFA state
  14289. // that already has lots of edges out of it. e.g., .* in comments.
  14290. // print("Target for:" + str(s) + " and:" + str(t))
  14291. var target = this.getExistingTargetState(s, t);
  14292. // print("Existing:" + str(target))
  14293. if (target === null) {
  14294. target = this.computeTargetState(input, s, t);
  14295. // print("Computed:" + str(target))
  14296. }
  14297. if (target === ATNSimulator.ERROR) {
  14298. break;
  14299. }
  14300. // If this is a consumable input element, make sure to consume before
  14301. // capturing the accept state so the input index, line, and char
  14302. // position accurately reflect the state of the interpreter at the
  14303. // end of the token.
  14304. if (t !== Token.EOF) {
  14305. this.consume(input);
  14306. }
  14307. if (target.isAcceptState) {
  14308. this.captureSimState(this.prevAccept, input, target);
  14309. if (t === Token.EOF) {
  14310. break;
  14311. }
  14312. }
  14313. t = input.LA(1);
  14314. s = target; // flip; current DFA target becomes new src/from state
  14315. }
  14316. return this.failOrAccept(this.prevAccept, input, s.configs, t);
  14317. };
  14318. // Get an existing target state for an edge in the DFA. If the target state
  14319. // for the edge has not yet been computed or is otherwise not available,
  14320. // this method returns {@code null}.
  14321. //
  14322. // @param s The current DFA state
  14323. // @param t The next input symbol
  14324. // @return The existing target DFA state for the given input symbol
  14325. // {@code t}, or {@code null} if the target state for this edge is not
  14326. // already cached
  14327. LexerATNSimulator.prototype.getExistingTargetState = function (s, t) {
  14328. if (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {
  14329. return null;
  14330. }
  14331. var target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];
  14332. if (target === undefined) {
  14333. target = null;
  14334. }
  14335. if (LexerATNSimulator.debug && target !== null) {
  14336. console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
  14337. }
  14338. return target;
  14339. };
  14340. // Compute a target state for an edge in the DFA, and attempt to add the
  14341. // computed state and corresponding edge to the DFA.
  14342. //
  14343. // @param input The input stream
  14344. // @param s The current DFA state
  14345. // @param t The next input symbol
  14346. //
  14347. // @return The computed target DFA state for the given input symbol
  14348. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  14349. // returns {@link //ERROR}.
  14350. LexerATNSimulator.prototype.computeTargetState = function (input, s, t) {
  14351. var reach = new OrderedATNConfigSet();
  14352. // if we don't find an existing DFA state
  14353. // Fill reach starting from closure, following t transitions
  14354. this.getReachableConfigSet(input, s.configs, reach, t);
  14355. if (reach.items.length === 0) {
  14356. // we got nowhere on t from s
  14357. if (!reach.hasSemanticContext) {
  14358. // we got nowhere on t, don't throw out this knowledge; it'd
  14359. // cause a failover from DFA later.
  14360. this.addDFAEdge(s, t, ATNSimulator.ERROR);
  14361. }
  14362. // stop when we can't match any more char
  14363. return ATNSimulator.ERROR;
  14364. }
  14365. // Add an edge from s to target DFA found/created for reach
  14366. return this.addDFAEdge(s, t, null, reach);
  14367. };
  14368. LexerATNSimulator.prototype.failOrAccept = function (prevAccept, input, reach, t) {
  14369. if (this.prevAccept.dfaState !== null) {
  14370. var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;
  14371. this.accept(input, lexerActionExecutor, this.startIndex, prevAccept.index, prevAccept.line, prevAccept.column);
  14372. return prevAccept.dfaState.prediction;
  14373. } else {
  14374. // if no accept and EOF is first char, return EOF
  14375. if (t === Token.EOF && input.index === this.startIndex) {
  14376. return Token.EOF;
  14377. }
  14378. throw new LexerNoViableAltException(this.recog, input, this.startIndex, reach);
  14379. }
  14380. };
  14381. // Given a starting configuration set, figure out all ATN configurations
  14382. // we can reach upon input {@code t}. Parameter {@code reach} is a return
  14383. // parameter.
  14384. LexerATNSimulator.prototype.getReachableConfigSet = function (input, closure, reach, t) {
  14385. // this is used to skip processing for configs which have a lower priority
  14386. // than a config that already reached an accept state for the same rule
  14387. var skipAlt = ATN.INVALID_ALT_NUMBER;
  14388. for (var i = 0; i < closure.items.length; i++) {
  14389. var cfg = closure.items[i];
  14390. var currentAltReachedAcceptState = cfg.alt === skipAlt;
  14391. if (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {
  14392. continue;
  14393. }
  14394. if (LexerATNSimulator.debug) {
  14395. console.log("testing %s at %s\n", this.getTokenName(t), cfg.toString(this.recog, true));
  14396. }
  14397. for (var j = 0; j < cfg.state.transitions.length; j++) {
  14398. var trans = cfg.state.transitions[j]; // for each transition
  14399. var target = this.getReachableTarget(trans, t);
  14400. if (target !== null) {
  14401. var lexerActionExecutor = cfg.lexerActionExecutor;
  14402. if (lexerActionExecutor !== null) {
  14403. lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);
  14404. }
  14405. var treatEofAsEpsilon = t === Token.EOF;
  14406. var config = new LexerATNConfig({ state: target, lexerActionExecutor: lexerActionExecutor }, cfg);
  14407. if (this.closure(input, config, reach, currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
  14408. // any remaining configs for this alt have a lower priority
  14409. // than the one that just reached an accept state.
  14410. skipAlt = cfg.alt;
  14411. }
  14412. }
  14413. }
  14414. }
  14415. };
  14416. LexerATNSimulator.prototype.accept = function (input, lexerActionExecutor, startIndex, index, line, charPos) {
  14417. if (LexerATNSimulator.debug) {
  14418. console.log("ACTION %s\n", lexerActionExecutor);
  14419. }
  14420. // seek to after last char in token
  14421. input.seek(index);
  14422. this.line = line;
  14423. this.column = charPos;
  14424. if (lexerActionExecutor !== null && this.recog !== null) {
  14425. lexerActionExecutor.execute(this.recog, input, startIndex);
  14426. }
  14427. };
  14428. LexerATNSimulator.prototype.getReachableTarget = function (trans, t) {
  14429. if (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {
  14430. return trans.target;
  14431. } else {
  14432. return null;
  14433. }
  14434. };
  14435. LexerATNSimulator.prototype.computeStartState = function (input, p) {
  14436. var initialContext = PredictionContext.EMPTY;
  14437. var configs = new OrderedATNConfigSet();
  14438. for (var i = 0; i < p.transitions.length; i++) {
  14439. var target = p.transitions[i].target;
  14440. var cfg = new LexerATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  14441. this.closure(input, cfg, configs, false, false, false);
  14442. }
  14443. return configs;
  14444. };
  14445. // Since the alternatives within any lexer decision are ordered by
  14446. // preference, this method stops pursuing the closure as soon as an accept
  14447. // state is reached. After the first accept state is reached by depth-first
  14448. // search from {@code config}, all other (potentially reachable) states for
  14449. // this rule would have a lower priority.
  14450. //
  14451. // @return {@code true} if an accept state is reached, otherwise
  14452. // {@code false}.
  14453. LexerATNSimulator.prototype.closure = function (input, config, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon) {
  14454. var cfg = null;
  14455. if (LexerATNSimulator.debug) {
  14456. console.log("closure(" + config.toString(this.recog, true) + ")");
  14457. }
  14458. if (config.state instanceof RuleStopState) {
  14459. if (LexerATNSimulator.debug) {
  14460. if (this.recog !== null) {
  14461. console.log("closure at %s rule stop %s\n", this.recog.ruleNames[config.state.ruleIndex], config);
  14462. } else {
  14463. console.log("closure at rule stop %s\n", config);
  14464. }
  14465. }
  14466. if (config.context === null || config.context.hasEmptyPath()) {
  14467. if (config.context === null || config.context.isEmpty()) {
  14468. configs.add(config);
  14469. return true;
  14470. } else {
  14471. configs.add(new LexerATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config));
  14472. currentAltReachedAcceptState = true;
  14473. }
  14474. }
  14475. if (config.context !== null && !config.context.isEmpty()) {
  14476. for (var i = 0; i < config.context.length; i++) {
  14477. if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {
  14478. var newContext = config.context.getParent(i); // "pop" return state
  14479. var returnState = this.atn.states[config.context.getReturnState(i)];
  14480. cfg = new LexerATNConfig({ state: returnState, context: newContext }, config);
  14481. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  14482. }
  14483. }
  14484. }
  14485. return currentAltReachedAcceptState;
  14486. }
  14487. // optimization
  14488. if (!config.state.epsilonOnlyTransitions) {
  14489. if (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {
  14490. configs.add(config);
  14491. }
  14492. }
  14493. for (var j = 0; j < config.state.transitions.length; j++) {
  14494. var trans = config.state.transitions[j];
  14495. cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);
  14496. if (cfg !== null) {
  14497. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  14498. }
  14499. }
  14500. return currentAltReachedAcceptState;
  14501. };
  14502. // side-effect: can alter configs.hasSemanticContext
  14503. LexerATNSimulator.prototype.getEpsilonTarget = function (input, config, trans, configs, speculative, treatEofAsEpsilon) {
  14504. var cfg = null;
  14505. if (trans.serializationType === Transition.RULE) {
  14506. var newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);
  14507. cfg = new LexerATNConfig({ state: trans.target, context: newContext }, config);
  14508. } else if (trans.serializationType === Transition.PRECEDENCE) {
  14509. throw "Precedence predicates are not supported in lexers.";
  14510. } else if (trans.serializationType === Transition.PREDICATE) {
  14511. // Track traversing semantic predicates. If we traverse,
  14512. // we cannot add a DFA state for this "reach" computation
  14513. // because the DFA would not test the predicate again in the
  14514. // future. Rather than creating collections of semantic predicates
  14515. // like v3 and testing them on prediction, v4 will test them on the
  14516. // fly all the time using the ATN not the DFA. This is slower but
  14517. // semantically it's not used that often. One of the key elements to
  14518. // this predicate mechanism is not adding DFA states that see
  14519. // predicates immediately afterwards in the ATN. For example,
  14520. // a : ID {p1}? | ID {p2}? ;
  14521. // should create the start state for rule 'a' (to save start state
  14522. // competition), but should not create target of ID state. The
  14523. // collection of ATN states the following ID references includes
  14524. // states reached by traversing predicates. Since this is when we
  14525. // test them, we cannot cash the DFA state target of ID.
  14526. if (LexerATNSimulator.debug) {
  14527. console.log("EVAL rule " + trans.ruleIndex + ":" + trans.predIndex);
  14528. }
  14529. configs.hasSemanticContext = true;
  14530. if (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {
  14531. cfg = new LexerATNConfig({ state: trans.target }, config);
  14532. }
  14533. } else if (trans.serializationType === Transition.ACTION) {
  14534. if (config.context === null || config.context.hasEmptyPath()) {
  14535. // execute actions anywhere in the start rule for a token.
  14536. //
  14537. // TODO: if the entry rule is invoked recursively, some
  14538. // actions may be executed during the recursive call. The
  14539. // problem can appear when hasEmptyPath() is true but
  14540. // isEmpty() is false. In this case, the config needs to be
  14541. // split into two contexts - one with just the empty path
  14542. // and another with everything but the empty path.
  14543. // Unfortunately, the current algorithm does not allow
  14544. // getEpsilonTarget to return two configurations, so
  14545. // additional modifications are needed before we can support
  14546. // the split operation.
  14547. var lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor, this.atn.lexerActions[trans.actionIndex]);
  14548. cfg = new LexerATNConfig({ state: trans.target, lexerActionExecutor: lexerActionExecutor }, config);
  14549. } else {
  14550. // ignore actions in referenced rules
  14551. cfg = new LexerATNConfig({ state: trans.target }, config);
  14552. }
  14553. } else if (trans.serializationType === Transition.EPSILON) {
  14554. cfg = new LexerATNConfig({ state: trans.target }, config);
  14555. } else if (trans.serializationType === Transition.ATOM || trans.serializationType === Transition.RANGE || trans.serializationType === Transition.SET) {
  14556. if (treatEofAsEpsilon) {
  14557. if (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {
  14558. cfg = new LexerATNConfig({ state: trans.target }, config);
  14559. }
  14560. }
  14561. }
  14562. return cfg;
  14563. };
  14564. // Evaluate a predicate specified in the lexer.
  14565. //
  14566. // <p>If {@code speculative} is {@code true}, this method was called before
  14567. // {@link //consume} for the matched character. This method should call
  14568. // {@link //consume} before evaluating the predicate to ensure position
  14569. // sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},
  14570. // and {@link Lexer//getcolumn}, properly reflect the current
  14571. // lexer state. This method should restore {@code input} and the simulator
  14572. // to the original state before returning (i.e. undo the actions made by the
  14573. // call to {@link //consume}.</p>
  14574. //
  14575. // @param input The input stream.
  14576. // @param ruleIndex The rule containing the predicate.
  14577. // @param predIndex The index of the predicate within the rule.
  14578. // @param speculative {@code true} if the current index in {@code input} is
  14579. // one character before the predicate's location.
  14580. //
  14581. // @return {@code true} if the specified predicate evaluates to
  14582. // {@code true}.
  14583. // /
  14584. LexerATNSimulator.prototype.evaluatePredicate = function (input, ruleIndex, predIndex, speculative) {
  14585. // assume true if no recognizer was provided
  14586. if (this.recog === null) {
  14587. return true;
  14588. }
  14589. if (!speculative) {
  14590. return this.recog.sempred(null, ruleIndex, predIndex);
  14591. }
  14592. var savedcolumn = this.column;
  14593. var savedLine = this.line;
  14594. var index = input.index;
  14595. var marker = input.mark();
  14596. try {
  14597. this.consume(input);
  14598. return this.recog.sempred(null, ruleIndex, predIndex);
  14599. } finally {
  14600. this.column = savedcolumn;
  14601. this.line = savedLine;
  14602. input.seek(index);
  14603. input.release(marker);
  14604. }
  14605. };
  14606. LexerATNSimulator.prototype.captureSimState = function (settings, input, dfaState) {
  14607. settings.index = input.index;
  14608. settings.line = this.line;
  14609. settings.column = this.column;
  14610. settings.dfaState = dfaState;
  14611. };
  14612. LexerATNSimulator.prototype.addDFAEdge = function (from_, tk, to, cfgs) {
  14613. if (to === undefined) {
  14614. to = null;
  14615. }
  14616. if (cfgs === undefined) {
  14617. cfgs = null;
  14618. }
  14619. if (to === null && cfgs !== null) {
  14620. // leading to this call, ATNConfigSet.hasSemanticContext is used as a
  14621. // marker indicating dynamic predicate evaluation makes this edge
  14622. // dependent on the specific input sequence, so the static edge in the
  14623. // DFA should be omitted. The target DFAState is still created since
  14624. // execATN has the ability to resynchronize with the DFA state cache
  14625. // following the predicate evaluation step.
  14626. //
  14627. // TJP notes: next time through the DFA, we see a pred again and eval.
  14628. // If that gets us to a previously created (but dangling) DFA
  14629. // state, we can continue in pure DFA mode from there.
  14630. // /
  14631. var suppressEdge = cfgs.hasSemanticContext;
  14632. cfgs.hasSemanticContext = false;
  14633. to = this.addDFAState(cfgs);
  14634. if (suppressEdge) {
  14635. return to;
  14636. }
  14637. }
  14638. // add the edge
  14639. if (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {
  14640. // Only track edges within the DFA bounds
  14641. return to;
  14642. }
  14643. if (LexerATNSimulator.debug) {
  14644. console.log("EDGE " + from_ + " -> " + to + " upon " + tk);
  14645. }
  14646. if (from_.edges === null) {
  14647. // make room for tokens 1..n and -1 masquerading as index 0
  14648. from_.edges = [];
  14649. }
  14650. from_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect
  14651. return to;
  14652. };
  14653. // Add a new DFA state if there isn't one with this set of
  14654. // configurations already. This method also detects the first
  14655. // configuration containing an ATN rule stop state. Later, when
  14656. // traversing the DFA, we will know which rule to accept.
  14657. LexerATNSimulator.prototype.addDFAState = function (configs) {
  14658. var proposed = new DFAState(null, configs);
  14659. var firstConfigWithRuleStopState = null;
  14660. for (var i = 0; i < configs.items.length; i++) {
  14661. var cfg = configs.items[i];
  14662. if (cfg.state instanceof RuleStopState) {
  14663. firstConfigWithRuleStopState = cfg;
  14664. break;
  14665. }
  14666. }
  14667. if (firstConfigWithRuleStopState !== null) {
  14668. proposed.isAcceptState = true;
  14669. proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;
  14670. proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
  14671. }
  14672. var dfa = this.decisionToDFA[this.mode];
  14673. var existing = dfa.states.get(proposed);
  14674. if (existing !== null) {
  14675. return existing;
  14676. }
  14677. var newState = proposed;
  14678. newState.stateNumber = dfa.states.length;
  14679. configs.setReadonly(true);
  14680. newState.configs = configs;
  14681. dfa.states.add(newState);
  14682. return newState;
  14683. };
  14684. LexerATNSimulator.prototype.getDFA = function (mode) {
  14685. return this.decisionToDFA[mode];
  14686. };
  14687. // Get the text matched so far for the current token.
  14688. LexerATNSimulator.prototype.getText = function (input) {
  14689. // index is first lookahead char, don't include.
  14690. return input.getText(this.startIndex, input.index - 1);
  14691. };
  14692. LexerATNSimulator.prototype.consume = function (input) {
  14693. var curChar = input.LA(1);
  14694. if (curChar === "\n".charCodeAt(0)) {
  14695. this.line += 1;
  14696. this.column = 0;
  14697. } else {
  14698. this.column += 1;
  14699. }
  14700. input.consume();
  14701. };
  14702. LexerATNSimulator.prototype.getTokenName = function (tt) {
  14703. if (tt === -1) {
  14704. return "EOF";
  14705. } else {
  14706. return "'" + String.fromCharCode(tt) + "'";
  14707. }
  14708. };
  14709. exports.LexerATNSimulator = LexerATNSimulator;
  14710. /***/ }),
  14711. /***/ "./node_modules/antlr4/atn/LexerAction.js":
  14712. /*!************************************************!*\
  14713. !*** ./node_modules/antlr4/atn/LexerAction.js ***!
  14714. \************************************************/
  14715. /*! no static exports found */
  14716. /***/ (function(module, exports, __webpack_require__) {
  14717. "use strict";
  14718. //
  14719. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  14720. * Use of this file is governed by the BSD 3-clause license that
  14721. * can be found in the LICENSE.txt file in the project root.
  14722. */
  14723. //
  14724. function LexerActionType() {}
  14725. LexerActionType.CHANNEL = 0; //The type of a {@link LexerChannelAction} action.
  14726. LexerActionType.CUSTOM = 1; //The type of a {@link LexerCustomAction} action.
  14727. LexerActionType.MODE = 2; //The type of a {@link LexerModeAction} action.
  14728. LexerActionType.MORE = 3; //The type of a {@link LexerMoreAction} action.
  14729. LexerActionType.POP_MODE = 4; //The type of a {@link LexerPopModeAction} action.
  14730. LexerActionType.PUSH_MODE = 5; //The type of a {@link LexerPushModeAction} action.
  14731. LexerActionType.SKIP = 6; //The type of a {@link LexerSkipAction} action.
  14732. LexerActionType.TYPE = 7; //The type of a {@link LexerTypeAction} action.
  14733. function LexerAction(action) {
  14734. this.actionType = action;
  14735. this.isPositionDependent = false;
  14736. return this;
  14737. }
  14738. LexerAction.prototype.hashCode = function () {
  14739. var hash = new Hash();
  14740. this.updateHashCode(hash);
  14741. return hash.finish();
  14742. };
  14743. LexerAction.prototype.updateHashCode = function (hash) {
  14744. hash.update(this.actionType);
  14745. };
  14746. LexerAction.prototype.equals = function (other) {
  14747. return this === other;
  14748. };
  14749. //
  14750. // Implements the {@code skip} lexer action by calling {@link Lexer//skip}.
  14751. //
  14752. // <p>The {@code skip} command does not have any parameters, so this action is
  14753. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  14754. function LexerSkipAction() {
  14755. LexerAction.call(this, LexerActionType.SKIP);
  14756. return this;
  14757. }
  14758. LexerSkipAction.prototype = Object.create(LexerAction.prototype);
  14759. LexerSkipAction.prototype.constructor = LexerSkipAction;
  14760. // Provides a singleton instance of this parameterless lexer action.
  14761. LexerSkipAction.INSTANCE = new LexerSkipAction();
  14762. LexerSkipAction.prototype.execute = function (lexer) {
  14763. lexer.skip();
  14764. };
  14765. LexerSkipAction.prototype.toString = function () {
  14766. return "skip";
  14767. };
  14768. // Implements the {@code type} lexer action by calling {@link Lexer//setType}
  14769. // with the assigned type.
  14770. function LexerTypeAction(type) {
  14771. LexerAction.call(this, LexerActionType.TYPE);
  14772. this.type = type;
  14773. return this;
  14774. }
  14775. LexerTypeAction.prototype = Object.create(LexerAction.prototype);
  14776. LexerTypeAction.prototype.constructor = LexerTypeAction;
  14777. LexerTypeAction.prototype.execute = function (lexer) {
  14778. lexer.type = this.type;
  14779. };
  14780. LexerTypeAction.prototype.updateHashCode = function (hash) {
  14781. hash.update(this.actionType, this.type);
  14782. };
  14783. LexerTypeAction.prototype.equals = function (other) {
  14784. if (this === other) {
  14785. return true;
  14786. } else if (!(other instanceof LexerTypeAction)) {
  14787. return false;
  14788. } else {
  14789. return this.type === other.type;
  14790. }
  14791. };
  14792. LexerTypeAction.prototype.toString = function () {
  14793. return "type(" + this.type + ")";
  14794. };
  14795. // Implements the {@code pushMode} lexer action by calling
  14796. // {@link Lexer//pushMode} with the assigned mode.
  14797. function LexerPushModeAction(mode) {
  14798. LexerAction.call(this, LexerActionType.PUSH_MODE);
  14799. this.mode = mode;
  14800. return this;
  14801. }
  14802. LexerPushModeAction.prototype = Object.create(LexerAction.prototype);
  14803. LexerPushModeAction.prototype.constructor = LexerPushModeAction;
  14804. // <p>This action is implemented by calling {@link Lexer//pushMode} with the
  14805. // value provided by {@link //getMode}.</p>
  14806. LexerPushModeAction.prototype.execute = function (lexer) {
  14807. lexer.pushMode(this.mode);
  14808. };
  14809. LexerPushModeAction.prototype.updateHashCode = function (hash) {
  14810. hash.update(this.actionType, this.mode);
  14811. };
  14812. LexerPushModeAction.prototype.equals = function (other) {
  14813. if (this === other) {
  14814. return true;
  14815. } else if (!(other instanceof LexerPushModeAction)) {
  14816. return false;
  14817. } else {
  14818. return this.mode === other.mode;
  14819. }
  14820. };
  14821. LexerPushModeAction.prototype.toString = function () {
  14822. return "pushMode(" + this.mode + ")";
  14823. };
  14824. // Implements the {@code popMode} lexer action by calling {@link Lexer//popMode}.
  14825. //
  14826. // <p>The {@code popMode} command does not have any parameters, so this action is
  14827. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  14828. function LexerPopModeAction() {
  14829. LexerAction.call(this, LexerActionType.POP_MODE);
  14830. return this;
  14831. }
  14832. LexerPopModeAction.prototype = Object.create(LexerAction.prototype);
  14833. LexerPopModeAction.prototype.constructor = LexerPopModeAction;
  14834. LexerPopModeAction.INSTANCE = new LexerPopModeAction();
  14835. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  14836. LexerPopModeAction.prototype.execute = function (lexer) {
  14837. lexer.popMode();
  14838. };
  14839. LexerPopModeAction.prototype.toString = function () {
  14840. return "popMode";
  14841. };
  14842. // Implements the {@code more} lexer action by calling {@link Lexer//more}.
  14843. //
  14844. // <p>The {@code more} command does not have any parameters, so this action is
  14845. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  14846. function LexerMoreAction() {
  14847. LexerAction.call(this, LexerActionType.MORE);
  14848. return this;
  14849. }
  14850. LexerMoreAction.prototype = Object.create(LexerAction.prototype);
  14851. LexerMoreAction.prototype.constructor = LexerMoreAction;
  14852. LexerMoreAction.INSTANCE = new LexerMoreAction();
  14853. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  14854. LexerMoreAction.prototype.execute = function (lexer) {
  14855. lexer.more();
  14856. };
  14857. LexerMoreAction.prototype.toString = function () {
  14858. return "more";
  14859. };
  14860. // Implements the {@code mode} lexer action by calling {@link Lexer//mode} with
  14861. // the assigned mode.
  14862. function LexerModeAction(mode) {
  14863. LexerAction.call(this, LexerActionType.MODE);
  14864. this.mode = mode;
  14865. return this;
  14866. }
  14867. LexerModeAction.prototype = Object.create(LexerAction.prototype);
  14868. LexerModeAction.prototype.constructor = LexerModeAction;
  14869. // <p>This action is implemented by calling {@link Lexer//mode} with the
  14870. // value provided by {@link //getMode}.</p>
  14871. LexerModeAction.prototype.execute = function (lexer) {
  14872. lexer.mode(this.mode);
  14873. };
  14874. LexerModeAction.prototype.updateHashCode = function (hash) {
  14875. hash.update(this.actionType, this.mode);
  14876. };
  14877. LexerModeAction.prototype.equals = function (other) {
  14878. if (this === other) {
  14879. return true;
  14880. } else if (!(other instanceof LexerModeAction)) {
  14881. return false;
  14882. } else {
  14883. return this.mode === other.mode;
  14884. }
  14885. };
  14886. LexerModeAction.prototype.toString = function () {
  14887. return "mode(" + this.mode + ")";
  14888. };
  14889. // Executes a custom lexer action by calling {@link Recognizer//action} with the
  14890. // rule and action indexes assigned to the custom action. The implementation of
  14891. // a custom action is added to the generated code for the lexer in an override
  14892. // of {@link Recognizer//action} when the grammar is compiled.
  14893. //
  14894. // <p>This class may represent embedded actions created with the <code>{...}</code>
  14895. // syntax in ANTLR 4, as well as actions created for lexer commands where the
  14896. // command argument could not be evaluated when the grammar was compiled.</p>
  14897. // Constructs a custom lexer action with the specified rule and action
  14898. // indexes.
  14899. //
  14900. // @param ruleIndex The rule index to use for calls to
  14901. // {@link Recognizer//action}.
  14902. // @param actionIndex The action index to use for calls to
  14903. // {@link Recognizer//action}.
  14904. function LexerCustomAction(ruleIndex, actionIndex) {
  14905. LexerAction.call(this, LexerActionType.CUSTOM);
  14906. this.ruleIndex = ruleIndex;
  14907. this.actionIndex = actionIndex;
  14908. this.isPositionDependent = true;
  14909. return this;
  14910. }
  14911. LexerCustomAction.prototype = Object.create(LexerAction.prototype);
  14912. LexerCustomAction.prototype.constructor = LexerCustomAction;
  14913. // <p>Custom actions are implemented by calling {@link Lexer//action} with the
  14914. // appropriate rule and action indexes.</p>
  14915. LexerCustomAction.prototype.execute = function (lexer) {
  14916. lexer.action(null, this.ruleIndex, this.actionIndex);
  14917. };
  14918. LexerCustomAction.prototype.updateHashCode = function (hash) {
  14919. hash.update(this.actionType, this.ruleIndex, this.actionIndex);
  14920. };
  14921. LexerCustomAction.prototype.equals = function (other) {
  14922. if (this === other) {
  14923. return true;
  14924. } else if (!(other instanceof LexerCustomAction)) {
  14925. return false;
  14926. } else {
  14927. return this.ruleIndex === other.ruleIndex && this.actionIndex === other.actionIndex;
  14928. }
  14929. };
  14930. // Implements the {@code channel} lexer action by calling
  14931. // {@link Lexer//setChannel} with the assigned channel.
  14932. // Constructs a new {@code channel} action with the specified channel value.
  14933. // @param channel The channel value to pass to {@link Lexer//setChannel}.
  14934. function LexerChannelAction(channel) {
  14935. LexerAction.call(this, LexerActionType.CHANNEL);
  14936. this.channel = channel;
  14937. return this;
  14938. }
  14939. LexerChannelAction.prototype = Object.create(LexerAction.prototype);
  14940. LexerChannelAction.prototype.constructor = LexerChannelAction;
  14941. // <p>This action is implemented by calling {@link Lexer//setChannel} with the
  14942. // value provided by {@link //getChannel}.</p>
  14943. LexerChannelAction.prototype.execute = function (lexer) {
  14944. lexer._channel = this.channel;
  14945. };
  14946. LexerChannelAction.prototype.updateHashCode = function (hash) {
  14947. hash.update(this.actionType, this.channel);
  14948. };
  14949. LexerChannelAction.prototype.equals = function (other) {
  14950. if (this === other) {
  14951. return true;
  14952. } else if (!(other instanceof LexerChannelAction)) {
  14953. return false;
  14954. } else {
  14955. return this.channel === other.channel;
  14956. }
  14957. };
  14958. LexerChannelAction.prototype.toString = function () {
  14959. return "channel(" + this.channel + ")";
  14960. };
  14961. // This implementation of {@link LexerAction} is used for tracking input offsets
  14962. // for position-dependent actions within a {@link LexerActionExecutor}.
  14963. //
  14964. // <p>This action is not serialized as part of the ATN, and is only required for
  14965. // position-dependent lexer actions which appear at a location other than the
  14966. // end of a rule. For more information about DFA optimizations employed for
  14967. // lexer actions, see {@link LexerActionExecutor//append} and
  14968. // {@link LexerActionExecutor//fixOffsetBeforeMatch}.</p>
  14969. // Constructs a new indexed custom action by associating a character offset
  14970. // with a {@link LexerAction}.
  14971. //
  14972. // <p>Note: This class is only required for lexer actions for which
  14973. // {@link LexerAction//isPositionDependent} returns {@code true}.</p>
  14974. //
  14975. // @param offset The offset into the input {@link CharStream}, relative to
  14976. // the token start index, at which the specified lexer action should be
  14977. // executed.
  14978. // @param action The lexer action to execute at a particular offset in the
  14979. // input {@link CharStream}.
  14980. function LexerIndexedCustomAction(offset, action) {
  14981. LexerAction.call(this, action.actionType);
  14982. this.offset = offset;
  14983. this.action = action;
  14984. this.isPositionDependent = true;
  14985. return this;
  14986. }
  14987. LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype);
  14988. LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction;
  14989. // <p>This method calls {@link //execute} on the result of {@link //getAction}
  14990. // using the provided {@code lexer}.</p>
  14991. LexerIndexedCustomAction.prototype.execute = function (lexer) {
  14992. // assume the input stream position was properly set by the calling code
  14993. this.action.execute(lexer);
  14994. };
  14995. LexerIndexedCustomAction.prototype.updateHashCode = function (hash) {
  14996. hash.update(this.actionType, this.offset, this.action);
  14997. };
  14998. LexerIndexedCustomAction.prototype.equals = function (other) {
  14999. if (this === other) {
  15000. return true;
  15001. } else if (!(other instanceof LexerIndexedCustomAction)) {
  15002. return false;
  15003. } else {
  15004. return this.offset === other.offset && this.action === other.action;
  15005. }
  15006. };
  15007. exports.LexerActionType = LexerActionType;
  15008. exports.LexerSkipAction = LexerSkipAction;
  15009. exports.LexerChannelAction = LexerChannelAction;
  15010. exports.LexerCustomAction = LexerCustomAction;
  15011. exports.LexerIndexedCustomAction = LexerIndexedCustomAction;
  15012. exports.LexerMoreAction = LexerMoreAction;
  15013. exports.LexerTypeAction = LexerTypeAction;
  15014. exports.LexerPushModeAction = LexerPushModeAction;
  15015. exports.LexerPopModeAction = LexerPopModeAction;
  15016. exports.LexerModeAction = LexerModeAction;
  15017. /***/ }),
  15018. /***/ "./node_modules/antlr4/atn/LexerActionExecutor.js":
  15019. /*!********************************************************!*\
  15020. !*** ./node_modules/antlr4/atn/LexerActionExecutor.js ***!
  15021. \********************************************************/
  15022. /*! no static exports found */
  15023. /***/ (function(module, exports, __webpack_require__) {
  15024. "use strict";
  15025. //
  15026. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  15027. * Use of this file is governed by the BSD 3-clause license that
  15028. * can be found in the LICENSE.txt file in the project root.
  15029. */
  15030. ///
  15031. // Represents an executor for a sequence of lexer actions which traversed during
  15032. // the matching operation of a lexer rule (token).
  15033. //
  15034. // <p>The executor tracks position information for position-dependent lexer actions
  15035. // efficiently, ensuring that actions appearing only at the end of the rule do
  15036. // not cause bloating of the {@link DFA} created for the lexer.</p>
  15037. var hashStuff = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  15038. var LexerIndexedCustomAction = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js").LexerIndexedCustomAction;
  15039. function LexerActionExecutor(lexerActions) {
  15040. this.lexerActions = lexerActions === null ? [] : lexerActions;
  15041. // Caches the result of {@link //hashCode} since the hash code is an element
  15042. // of the performance-critical {@link LexerATNConfig//hashCode} operation.
  15043. this.cachedHashCode = hashStuff(lexerActions); // "".join([str(la) for la in
  15044. // lexerActions]))
  15045. return this;
  15046. }
  15047. // Creates a {@link LexerActionExecutor} which executes the actions for
  15048. // the input {@code lexerActionExecutor} followed by a specified
  15049. // {@code lexerAction}.
  15050. //
  15051. // @param lexerActionExecutor The executor for actions already traversed by
  15052. // the lexer while matching a token within a particular
  15053. // {@link LexerATNConfig}. If this is {@code null}, the method behaves as
  15054. // though it were an empty executor.
  15055. // @param lexerAction The lexer action to execute after the actions
  15056. // specified in {@code lexerActionExecutor}.
  15057. //
  15058. // @return A {@link LexerActionExecutor} for executing the combine actions
  15059. // of {@code lexerActionExecutor} and {@code lexerAction}.
  15060. LexerActionExecutor.append = function (lexerActionExecutor, lexerAction) {
  15061. if (lexerActionExecutor === null) {
  15062. return new LexerActionExecutor([lexerAction]);
  15063. }
  15064. var lexerActions = lexerActionExecutor.lexerActions.concat([lexerAction]);
  15065. return new LexerActionExecutor(lexerActions);
  15066. };
  15067. // Creates a {@link LexerActionExecutor} which encodes the current offset
  15068. // for position-dependent lexer actions.
  15069. //
  15070. // <p>Normally, when the executor encounters lexer actions where
  15071. // {@link LexerAction//isPositionDependent} returns {@code true}, it calls
  15072. // {@link IntStream//seek} on the input {@link CharStream} to set the input
  15073. // position to the <em>end</em> of the current token. This behavior provides
  15074. // for efficient DFA representation of lexer actions which appear at the end
  15075. // of a lexer rule, even when the lexer rule matches a variable number of
  15076. // characters.</p>
  15077. //
  15078. // <p>Prior to traversing a match transition in the ATN, the current offset
  15079. // from the token start index is assigned to all position-dependent lexer
  15080. // actions which have not already been assigned a fixed offset. By storing
  15081. // the offsets relative to the token start index, the DFA representation of
  15082. // lexer actions which appear in the middle of tokens remains efficient due
  15083. // to sharing among tokens of the same length, regardless of their absolute
  15084. // position in the input stream.</p>
  15085. //
  15086. // <p>If the current executor already has offsets assigned to all
  15087. // position-dependent lexer actions, the method returns {@code this}.</p>
  15088. //
  15089. // @param offset The current offset to assign to all position-dependent
  15090. // lexer actions which do not already have offsets assigned.
  15091. //
  15092. // @return A {@link LexerActionExecutor} which stores input stream offsets
  15093. // for all position-dependent lexer actions.
  15094. // /
  15095. LexerActionExecutor.prototype.fixOffsetBeforeMatch = function (offset) {
  15096. var updatedLexerActions = null;
  15097. for (var i = 0; i < this.lexerActions.length; i++) {
  15098. if (this.lexerActions[i].isPositionDependent && !(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {
  15099. if (updatedLexerActions === null) {
  15100. updatedLexerActions = this.lexerActions.concat([]);
  15101. }
  15102. updatedLexerActions[i] = new LexerIndexedCustomAction(offset, this.lexerActions[i]);
  15103. }
  15104. }
  15105. if (updatedLexerActions === null) {
  15106. return this;
  15107. } else {
  15108. return new LexerActionExecutor(updatedLexerActions);
  15109. }
  15110. };
  15111. // Execute the actions encapsulated by this executor within the context of a
  15112. // particular {@link Lexer}.
  15113. //
  15114. // <p>This method calls {@link IntStream//seek} to set the position of the
  15115. // {@code input} {@link CharStream} prior to calling
  15116. // {@link LexerAction//execute} on a position-dependent action. Before the
  15117. // method returns, the input position will be restored to the same position
  15118. // it was in when the method was invoked.</p>
  15119. //
  15120. // @param lexer The lexer instance.
  15121. // @param input The input stream which is the source for the current token.
  15122. // When this method is called, the current {@link IntStream//index} for
  15123. // {@code input} should be the start of the following token, i.e. 1
  15124. // character past the end of the current token.
  15125. // @param startIndex The token start index. This value may be passed to
  15126. // {@link IntStream//seek} to set the {@code input} position to the beginning
  15127. // of the token.
  15128. // /
  15129. LexerActionExecutor.prototype.execute = function (lexer, input, startIndex) {
  15130. var requiresSeek = false;
  15131. var stopIndex = input.index;
  15132. try {
  15133. for (var i = 0; i < this.lexerActions.length; i++) {
  15134. var lexerAction = this.lexerActions[i];
  15135. if (lexerAction instanceof LexerIndexedCustomAction) {
  15136. var offset = lexerAction.offset;
  15137. input.seek(startIndex + offset);
  15138. lexerAction = lexerAction.action;
  15139. requiresSeek = startIndex + offset !== stopIndex;
  15140. } else if (lexerAction.isPositionDependent) {
  15141. input.seek(stopIndex);
  15142. requiresSeek = false;
  15143. }
  15144. lexerAction.execute(lexer);
  15145. }
  15146. } finally {
  15147. if (requiresSeek) {
  15148. input.seek(stopIndex);
  15149. }
  15150. }
  15151. };
  15152. LexerActionExecutor.prototype.hashCode = function () {
  15153. return this.cachedHashCode;
  15154. };
  15155. LexerActionExecutor.prototype.updateHashCode = function (hash) {
  15156. hash.update(this.cachedHashCode);
  15157. };
  15158. LexerActionExecutor.prototype.equals = function (other) {
  15159. if (this === other) {
  15160. return true;
  15161. } else if (!(other instanceof LexerActionExecutor)) {
  15162. return false;
  15163. } else if (this.cachedHashCode != other.cachedHashCode) {
  15164. return false;
  15165. } else if (this.lexerActions.length != other.lexerActions.length) {
  15166. return false;
  15167. } else {
  15168. var numActions = this.lexerActions.length;
  15169. for (var idx = 0; idx < numActions; ++idx) {
  15170. if (!this.lexerActions[idx].equals(other.lexerActions[idx])) {
  15171. return false;
  15172. }
  15173. }
  15174. return true;
  15175. }
  15176. };
  15177. exports.LexerActionExecutor = LexerActionExecutor;
  15178. /***/ }),
  15179. /***/ "./node_modules/antlr4/atn/ParserATNSimulator.js":
  15180. /*!*******************************************************!*\
  15181. !*** ./node_modules/antlr4/atn/ParserATNSimulator.js ***!
  15182. \*******************************************************/
  15183. /*! no static exports found */
  15184. /***/ (function(module, exports, __webpack_require__) {
  15185. "use strict";
  15186. //
  15187. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  15188. * Use of this file is governed by the BSD 3-clause license that
  15189. * can be found in the LICENSE.txt file in the project root.
  15190. */
  15191. //
  15192. //
  15193. // The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
  15194. //
  15195. // <p>
  15196. // The basic complexity of the adaptive strategy makes it harder to understand.
  15197. // We begin with ATN simulation to build paths in a DFA. Subsequent prediction
  15198. // requests go through the DFA first. If they reach a state without an edge for
  15199. // the current symbol, the algorithm fails over to the ATN simulation to
  15200. // complete the DFA path for the current input (until it finds a conflict state
  15201. // or uniquely predicting state).</p>
  15202. //
  15203. // <p>
  15204. // All of that is done without using the outer context because we want to create
  15205. // a DFA that is not dependent upon the rule invocation stack when we do a
  15206. // prediction. One DFA works in all contexts. We avoid using context not
  15207. // necessarily because it's slower, although it can be, but because of the DFA
  15208. // caching problem. The closure routine only considers the rule invocation stack
  15209. // created during prediction beginning in the decision rule. For example, if
  15210. // prediction occurs without invoking another rule's ATN, there are no context
  15211. // stacks in the configurations. When lack of context leads to a conflict, we
  15212. // don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
  15213. // strategy (versus full LL(*)).</p>
  15214. //
  15215. // <p>
  15216. // When SLL yields a configuration set with conflict, we rewind the input and
  15217. // retry the ATN simulation, this time using full outer context without adding
  15218. // to the DFA. Configuration context stacks will be the full invocation stacks
  15219. // from the start rule. If we get a conflict using full context, then we can
  15220. // definitively say we have a true ambiguity for that input sequence. If we
  15221. // don't get a conflict, it implies that the decision is sensitive to the outer
  15222. // context. (It is not context-sensitive in the sense of context-sensitive
  15223. // grammars.)</p>
  15224. //
  15225. // <p>
  15226. // The next time we reach this DFA state with an SLL conflict, through DFA
  15227. // simulation, we will again retry the ATN simulation using full context mode.
  15228. // This is slow because we can't save the results and have to "interpret" the
  15229. // ATN each time we get that input.</p>
  15230. //
  15231. // <p>
  15232. // <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
  15233. //
  15234. // <p>
  15235. // We could cache results from full context to predicted alternative easily and
  15236. // that saves a lot of time but doesn't work in presence of predicates. The set
  15237. // of visible predicates from the ATN start state changes depending on the
  15238. // context, because closure can fall off the end of a rule. I tried to cache
  15239. // tuples (stack context, semantic context, predicted alt) but it was slower
  15240. // than interpreting and much more complicated. Also required a huge amount of
  15241. // memory. The goal is not to create the world's fastest parser anyway. I'd like
  15242. // to keep this algorithm simple. By launching multiple threads, we can improve
  15243. // the speed of parsing across a large number of files.</p>
  15244. //
  15245. // <p>
  15246. // There is no strict ordering between the amount of input used by SLL vs LL,
  15247. // which makes it really hard to build a cache for full context. Let's say that
  15248. // we have input A B C that leads to an SLL conflict with full context X. That
  15249. // implies that using X we might only use A B but we could also use A B C D to
  15250. // resolve conflict. Input A B C D could predict alternative 1 in one position
  15251. // in the input and A B C E could predict alternative 2 in another position in
  15252. // input. The conflicting SLL configurations could still be non-unique in the
  15253. // full context prediction, which would lead us to requiring more input than the
  15254. // original A B C. To make a prediction cache work, we have to track the exact
  15255. // input used during the previous prediction. That amounts to a cache that maps
  15256. // X to a specific DFA for that context.</p>
  15257. //
  15258. // <p>
  15259. // Something should be done for left-recursive expression predictions. They are
  15260. // likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
  15261. // with full LL thing Sam does.</p>
  15262. //
  15263. // <p>
  15264. // <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
  15265. //
  15266. // <p>
  15267. // We avoid doing full context retry when the outer context is empty, we did not
  15268. // dip into the outer context by falling off the end of the decision state rule,
  15269. // or when we force SLL mode.</p>
  15270. //
  15271. // <p>
  15272. // As an example of the not dip into outer context case, consider as super
  15273. // constructor calls versus function calls. One grammar might look like
  15274. // this:</p>
  15275. //
  15276. // <pre>
  15277. // ctorBody
  15278. // : '{' superCall? stat* '}'
  15279. // ;
  15280. // </pre>
  15281. //
  15282. // <p>
  15283. // Or, you might see something like</p>
  15284. //
  15285. // <pre>
  15286. // stat
  15287. // : superCall ';'
  15288. // | expression ';'
  15289. // | ...
  15290. // ;
  15291. // </pre>
  15292. //
  15293. // <p>
  15294. // In both cases I believe that no closure operations will dip into the outer
  15295. // context. In the first case ctorBody in the worst case will stop at the '}'.
  15296. // In the 2nd case it should stop at the ';'. Both cases should stay within the
  15297. // entry rule and not dip into the outer context.</p>
  15298. //
  15299. // <p>
  15300. // <strong>PREDICATES</strong></p>
  15301. //
  15302. // <p>
  15303. // Predicates are always evaluated if present in either SLL or LL both. SLL and
  15304. // LL simulation deals with predicates differently. SLL collects predicates as
  15305. // it performs closure operations like ANTLR v3 did. It delays predicate
  15306. // evaluation until it reaches and accept state. This allows us to cache the SLL
  15307. // ATN simulation whereas, if we had evaluated predicates on-the-fly during
  15308. // closure, the DFA state configuration sets would be different and we couldn't
  15309. // build up a suitable DFA.</p>
  15310. //
  15311. // <p>
  15312. // When building a DFA accept state during ATN simulation, we evaluate any
  15313. // predicates and return the sole semantically valid alternative. If there is
  15314. // more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
  15315. // we throw an exception. Alternatives without predicates act like they have
  15316. // true predicates. The simple way to think about it is to strip away all
  15317. // alternatives with false predicates and choose the minimum alternative that
  15318. // remains.</p>
  15319. //
  15320. // <p>
  15321. // When we start in the DFA and reach an accept state that's predicated, we test
  15322. // those and return the minimum semantically viable alternative. If no
  15323. // alternatives are viable, we throw an exception.</p>
  15324. //
  15325. // <p>
  15326. // During full LL ATN simulation, closure always evaluates predicates and
  15327. // on-the-fly. This is crucial to reducing the configuration set size during
  15328. // closure. It hits a landmine when parsing with the Java grammar, for example,
  15329. // without this on-the-fly evaluation.</p>
  15330. //
  15331. // <p>
  15332. // <strong>SHARING DFA</strong></p>
  15333. //
  15334. // <p>
  15335. // All instances of the same parser share the same decision DFAs through a
  15336. // static field. Each instance gets its own ATN simulator but they share the
  15337. // same {@link //decisionToDFA} field. They also share a
  15338. // {@link PredictionContextCache} object that makes sure that all
  15339. // {@link PredictionContext} objects are shared among the DFA states. This makes
  15340. // a big size difference.</p>
  15341. //
  15342. // <p>
  15343. // <strong>THREAD SAFETY</strong></p>
  15344. //
  15345. // <p>
  15346. // The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when
  15347. // it adds a new DFA object to that array. {@link //addDFAEdge}
  15348. // locks on the DFA for the current decision when setting the
  15349. // {@link DFAState//edges} field. {@link //addDFAState} locks on
  15350. // the DFA for the current decision when looking up a DFA state to see if it
  15351. // already exists. We must make sure that all requests to add DFA states that
  15352. // are equivalent result in the same shared DFA object. This is because lots of
  15353. // threads will be trying to update the DFA at once. The
  15354. // {@link //addDFAState} method also locks inside the DFA lock
  15355. // but this time on the shared context cache when it rebuilds the
  15356. // configurations' {@link PredictionContext} objects using cached
  15357. // subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
  15358. // safe as long as we can guarantee that all threads referencing
  15359. // {@code s.edge[t]} get the same physical target {@link DFAState}, or
  15360. // {@code null}. Once into the DFA, the DFA simulation does not reference the
  15361. // {@link DFA//states} map. It follows the {@link DFAState//edges} field to new
  15362. // targets. The DFA simulator will either find {@link DFAState//edges} to be
  15363. // {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
  15364. // {@code dfa.edges[t]} to be non-null. The
  15365. // {@link //addDFAEdge} method could be racing to set the field
  15366. // but in either case the DFA simulator works; if {@code null}, and requests ATN
  15367. // simulation. It could also race trying to get {@code dfa.edges[t]}, but either
  15368. // way it will work because it's not doing a test and set operation.</p>
  15369. //
  15370. // <p>
  15371. // <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
  15372. // Parsing)</strong></p>
  15373. //
  15374. // <p>
  15375. // Sam pointed out that if SLL does not give a syntax error, then there is no
  15376. // point in doing full LL, which is slower. We only have to try LL if we get a
  15377. // syntax error. For maximum speed, Sam starts the parser set to pure SLL
  15378. // mode with the {@link BailErrorStrategy}:</p>
  15379. //
  15380. // <pre>
  15381. // parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};
  15382. // parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
  15383. // </pre>
  15384. //
  15385. // <p>
  15386. // If it does not get a syntax error, then we're done. If it does get a syntax
  15387. // error, we need to retry with the combined SLL/LL strategy.</p>
  15388. //
  15389. // <p>
  15390. // The reason this works is as follows. If there are no SLL conflicts, then the
  15391. // grammar is SLL (at least for that input set). If there is an SLL conflict,
  15392. // the full LL analysis must yield a set of viable alternatives which is a
  15393. // subset of the alternatives reported by SLL. If the LL set is a singleton,
  15394. // then the grammar is LL but not SLL. If the LL set is the same size as the SLL
  15395. // set, the decision is SLL. If the LL set has size &gt; 1, then that decision
  15396. // is truly ambiguous on the current input. If the LL set is smaller, then the
  15397. // SLL conflict resolution might choose an alternative that the full LL would
  15398. // rule out as a possibility based upon better context information. If that's
  15399. // the case, then the SLL parse will definitely get an error because the full LL
  15400. // analysis says it's not viable. If SLL conflict resolution chooses an
  15401. // alternative within the LL set, them both SLL and LL would choose the same
  15402. // alternative because they both choose the minimum of multiple conflicting
  15403. // alternatives.</p>
  15404. //
  15405. // <p>
  15406. // Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
  15407. // a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
  15408. // parsing will get an error because SLL will pursue alternative 1. If
  15409. // <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
  15410. // choose the same alternative because alternative one is the minimum of either
  15411. // set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
  15412. // error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
  15413. //
  15414. // <p>
  15415. // Of course, if the input is invalid, then we will get an error for sure in
  15416. // both SLL and LL parsing. Erroneous input will therefore require 2 passes over
  15417. // the input.</p>
  15418. //
  15419. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  15420. var Set = Utils.Set;
  15421. var BitSet = Utils.BitSet;
  15422. var DoubleDict = Utils.DoubleDict;
  15423. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  15424. var ATNState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  15425. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  15426. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  15427. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  15428. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  15429. var PredPrediction = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  15430. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  15431. var PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  15432. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  15433. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  15434. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  15435. var StarLoopEntryState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  15436. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  15437. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  15438. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  15439. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  15440. var Transition = Transitions.Transition;
  15441. var SetTransition = Transitions.SetTransition;
  15442. var NotSetTransition = Transitions.NotSetTransition;
  15443. var RuleTransition = Transitions.RuleTransition;
  15444. var ActionTransition = Transitions.ActionTransition;
  15445. var NoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  15446. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  15447. var predictionContextFromRuleContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").predictionContextFromRuleContext;
  15448. function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
  15449. ATNSimulator.call(this, atn, sharedContextCache);
  15450. this.parser = parser;
  15451. this.decisionToDFA = decisionToDFA;
  15452. // SLL, LL, or LL + exact ambig detection?//
  15453. this.predictionMode = PredictionMode.LL;
  15454. // LAME globals to avoid parameters!!!!! I need these down deep in predTransition
  15455. this._input = null;
  15456. this._startIndex = 0;
  15457. this._outerContext = null;
  15458. this._dfa = null;
  15459. // Each prediction operation uses a cache for merge of prediction contexts.
  15460. // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap
  15461. // isn't synchronized but we're ok since two threads shouldn't reuse same
  15462. // parser/atnsim object because it can only handle one input at a time.
  15463. // This maps graphs a and b to merged result c. (a,b)&rarr;c. We can avoid
  15464. // the merge if we ever see a and b again. Note that (b,a)&rarr;c should
  15465. // also be examined during cache lookup.
  15466. //
  15467. this.mergeCache = null;
  15468. return this;
  15469. }
  15470. ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  15471. ParserATNSimulator.prototype.constructor = ParserATNSimulator;
  15472. ParserATNSimulator.prototype.debug = false;
  15473. ParserATNSimulator.prototype.debug_closure = false;
  15474. ParserATNSimulator.prototype.debug_add = false;
  15475. ParserATNSimulator.prototype.debug_list_atn_decisions = false;
  15476. ParserATNSimulator.prototype.dfa_debug = false;
  15477. ParserATNSimulator.prototype.retry_debug = false;
  15478. ParserATNSimulator.prototype.reset = function () {};
  15479. ParserATNSimulator.prototype.adaptivePredict = function (input, decision, outerContext) {
  15480. if (this.debug || this.debug_list_atn_decisions) {
  15481. console.log("adaptivePredict decision " + decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  15482. }
  15483. this._input = input;
  15484. this._startIndex = input.index;
  15485. this._outerContext = outerContext;
  15486. var dfa = this.decisionToDFA[decision];
  15487. this._dfa = dfa;
  15488. var m = input.mark();
  15489. var index = input.index;
  15490. // Now we are certain to have a specific decision's DFA
  15491. // But, do we still need an initial state?
  15492. try {
  15493. var s0;
  15494. if (dfa.precedenceDfa) {
  15495. // the start state for a precedence DFA depends on the current
  15496. // parser precedence, and is provided by a DFA method.
  15497. s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());
  15498. } else {
  15499. // the start state for a "regular" DFA is just s0
  15500. s0 = dfa.s0;
  15501. }
  15502. if (s0 === null) {
  15503. if (outerContext === null) {
  15504. outerContext = RuleContext.EMPTY;
  15505. }
  15506. if (this.debug || this.debug_list_atn_decisions) {
  15507. console.log("predictATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + ", outerContext=" + outerContext.toString(this.parser.ruleNames));
  15508. }
  15509. var fullCtx = false;
  15510. var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);
  15511. if (dfa.precedenceDfa) {
  15512. // If this is a precedence DFA, we use applyPrecedenceFilter
  15513. // to convert the computed start state to a precedence start
  15514. // state. We then use DFA.setPrecedenceStartState to set the
  15515. // appropriate start state for the precedence level rather
  15516. // than simply setting DFA.s0.
  15517. //
  15518. dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway
  15519. s0_closure = this.applyPrecedenceFilter(s0_closure);
  15520. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  15521. dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);
  15522. } else {
  15523. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  15524. dfa.s0 = s0;
  15525. }
  15526. }
  15527. var alt = this.execATN(dfa, s0, input, index, outerContext);
  15528. if (this.debug) {
  15529. console.log("DFA after predictATN: " + dfa.toString(this.parser.literalNames));
  15530. }
  15531. return alt;
  15532. } finally {
  15533. this._dfa = null;
  15534. this.mergeCache = null; // wack cache after each prediction
  15535. input.seek(index);
  15536. input.release(m);
  15537. }
  15538. };
  15539. // Performs ATN simulation to compute a predicted alternative based
  15540. // upon the remaining input, but also updates the DFA cache to avoid
  15541. // having to traverse the ATN again for the same input sequence.
  15542. // There are some key conditions we're looking for after computing a new
  15543. // set of ATN configs (proposed DFA state):
  15544. // if the set is empty, there is no viable alternative for current symbol
  15545. // does the state uniquely predict an alternative?
  15546. // does the state have a conflict that would prevent us from
  15547. // putting it on the work list?
  15548. // We also have some key operations to do:
  15549. // add an edge from previous DFA state to potentially new DFA state, D,
  15550. // upon current symbol but only if adding to work list, which means in all
  15551. // cases except no viable alternative (and possibly non-greedy decisions?)
  15552. // collecting predicates and adding semantic context to DFA accept states
  15553. // adding rule context to context-sensitive DFA accept states
  15554. // consuming an input symbol
  15555. // reporting a conflict
  15556. // reporting an ambiguity
  15557. // reporting a context sensitivity
  15558. // reporting insufficient predicates
  15559. // cover these cases:
  15560. // dead end
  15561. // single alt
  15562. // single alt + preds
  15563. // conflict
  15564. // conflict + preds
  15565. //
  15566. ParserATNSimulator.prototype.execATN = function (dfa, s0, input, startIndex, outerContext) {
  15567. if (this.debug || this.debug_list_atn_decisions) {
  15568. console.log("execATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  15569. }
  15570. var alt;
  15571. var previousD = s0;
  15572. if (this.debug) {
  15573. console.log("s0 = " + s0);
  15574. }
  15575. var t = input.LA(1);
  15576. while (true) {
  15577. // while more work
  15578. var D = this.getExistingTargetState(previousD, t);
  15579. if (D === null) {
  15580. D = this.computeTargetState(dfa, previousD, t);
  15581. }
  15582. if (D === ATNSimulator.ERROR) {
  15583. // if any configs in previous dipped into outer context, that
  15584. // means that input up to t actually finished entry rule
  15585. // at least for SLL decision. Full LL doesn't dip into outer
  15586. // so don't need special case.
  15587. // We will get an error no matter what so delay until after
  15588. // decision; better error message. Also, no reachable target
  15589. // ATN states in SLL implies LL will also get nowhere.
  15590. // If conflict in states that dip out, choose min since we
  15591. // will get error no matter what.
  15592. var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);
  15593. input.seek(startIndex);
  15594. alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);
  15595. if (alt !== ATN.INVALID_ALT_NUMBER) {
  15596. return alt;
  15597. } else {
  15598. throw e;
  15599. }
  15600. }
  15601. if (D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {
  15602. // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)
  15603. var conflictingAlts = null;
  15604. if (D.predicates !== null) {
  15605. if (this.debug) {
  15606. console.log("DFA state has preds in DFA sim LL failover");
  15607. }
  15608. var conflictIndex = input.index;
  15609. if (conflictIndex !== startIndex) {
  15610. input.seek(startIndex);
  15611. }
  15612. conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);
  15613. if (conflictingAlts.length === 1) {
  15614. if (this.debug) {
  15615. console.log("Full LL avoided");
  15616. }
  15617. return conflictingAlts.minValue();
  15618. }
  15619. if (conflictIndex !== startIndex) {
  15620. // restore the index so reporting the fallback to full
  15621. // context occurs with the index at the correct spot
  15622. input.seek(conflictIndex);
  15623. }
  15624. }
  15625. if (this.dfa_debug) {
  15626. console.log("ctx sensitive state " + outerContext + " in " + D);
  15627. }
  15628. var fullCtx = true;
  15629. var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);
  15630. this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);
  15631. alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);
  15632. return alt;
  15633. }
  15634. if (D.isAcceptState) {
  15635. if (D.predicates === null) {
  15636. return D.prediction;
  15637. }
  15638. var stopIndex = input.index;
  15639. input.seek(startIndex);
  15640. var alts = this.evalSemanticContext(D.predicates, outerContext, true);
  15641. if (alts.length === 0) {
  15642. throw this.noViableAlt(input, outerContext, D.configs, startIndex);
  15643. } else if (alts.length === 1) {
  15644. return alts.minValue();
  15645. } else {
  15646. // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.
  15647. this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);
  15648. return alts.minValue();
  15649. }
  15650. }
  15651. previousD = D;
  15652. if (t !== Token.EOF) {
  15653. input.consume();
  15654. t = input.LA(1);
  15655. }
  15656. }
  15657. };
  15658. //
  15659. // Get an existing target state for an edge in the DFA. If the target state
  15660. // for the edge has not yet been computed or is otherwise not available,
  15661. // this method returns {@code null}.
  15662. //
  15663. // @param previousD The current DFA state
  15664. // @param t The next input symbol
  15665. // @return The existing target DFA state for the given input symbol
  15666. // {@code t}, or {@code null} if the target state for this edge is not
  15667. // already cached
  15668. //
  15669. ParserATNSimulator.prototype.getExistingTargetState = function (previousD, t) {
  15670. var edges = previousD.edges;
  15671. if (edges === null) {
  15672. return null;
  15673. } else {
  15674. return edges[t + 1] || null;
  15675. }
  15676. };
  15677. //
  15678. // Compute a target state for an edge in the DFA, and attempt to add the
  15679. // computed state and corresponding edge to the DFA.
  15680. //
  15681. // @param dfa The DFA
  15682. // @param previousD The current DFA state
  15683. // @param t The next input symbol
  15684. //
  15685. // @return The computed target DFA state for the given input symbol
  15686. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  15687. // returns {@link //ERROR}.
  15688. //
  15689. ParserATNSimulator.prototype.computeTargetState = function (dfa, previousD, t) {
  15690. var reach = this.computeReachSet(previousD.configs, t, false);
  15691. if (reach === null) {
  15692. this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);
  15693. return ATNSimulator.ERROR;
  15694. }
  15695. // create new target state; we'll add to DFA after it's complete
  15696. var D = new DFAState(null, reach);
  15697. var predictedAlt = this.getUniqueAlt(reach);
  15698. if (this.debug) {
  15699. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  15700. console.log("SLL altSubSets=" + Utils.arrayToString(altSubSets) + ", previous=" + previousD.configs + ", configs=" + reach + ", predict=" + predictedAlt + ", allSubsetsConflict=" + PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" + this.getConflictingAlts(reach));
  15701. }
  15702. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  15703. // NO CONFLICT, UNIQUELY PREDICTED ALT
  15704. D.isAcceptState = true;
  15705. D.configs.uniqueAlt = predictedAlt;
  15706. D.prediction = predictedAlt;
  15707. } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {
  15708. // MORE THAN ONE VIABLE ALTERNATIVE
  15709. D.configs.conflictingAlts = this.getConflictingAlts(reach);
  15710. D.requiresFullContext = true;
  15711. // in SLL-only mode, we will stop at this state and return the minimum alt
  15712. D.isAcceptState = true;
  15713. D.prediction = D.configs.conflictingAlts.minValue();
  15714. }
  15715. if (D.isAcceptState && D.configs.hasSemanticContext) {
  15716. this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));
  15717. if (D.predicates !== null) {
  15718. D.prediction = ATN.INVALID_ALT_NUMBER;
  15719. }
  15720. }
  15721. // all adds to dfa are done after we've created full D state
  15722. D = this.addDFAEdge(dfa, previousD, t, D);
  15723. return D;
  15724. };
  15725. ParserATNSimulator.prototype.predicateDFAState = function (dfaState, decisionState) {
  15726. // We need to test all predicates, even in DFA states that
  15727. // uniquely predict alternative.
  15728. var nalts = decisionState.transitions.length;
  15729. // Update DFA so reach becomes accept state with (predicate,alt)
  15730. // pairs if preds found for conflicting alts
  15731. var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);
  15732. var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);
  15733. if (altToPred !== null) {
  15734. dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);
  15735. dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds
  15736. } else {
  15737. // There are preds in configs but they might go away
  15738. // when OR'd together like {p}? || NONE == NONE. If neither
  15739. // alt has preds, resolve to min alt
  15740. dfaState.prediction = altsToCollectPredsFrom.minValue();
  15741. }
  15742. };
  15743. // comes back with reach.uniqueAlt set to a valid alt
  15744. ParserATNSimulator.prototype.execATNWithFullContext = function (dfa, D, // how far we got before failing over
  15745. s0, input, startIndex, outerContext) {
  15746. if (this.debug || this.debug_list_atn_decisions) {
  15747. console.log("execATNWithFullContext " + s0);
  15748. }
  15749. var fullCtx = true;
  15750. var foundExactAmbig = false;
  15751. var reach = null;
  15752. var previous = s0;
  15753. input.seek(startIndex);
  15754. var t = input.LA(1);
  15755. var predictedAlt = -1;
  15756. while (true) {
  15757. // while more work
  15758. reach = this.computeReachSet(previous, t, fullCtx);
  15759. if (reach === null) {
  15760. // if any configs in previous dipped into outer context, that
  15761. // means that input up to t actually finished entry rule
  15762. // at least for LL decision. Full LL doesn't dip into outer
  15763. // so don't need special case.
  15764. // We will get an error no matter what so delay until after
  15765. // decision; better error message. Also, no reachable target
  15766. // ATN states in SLL implies LL will also get nowhere.
  15767. // If conflict in states that dip out, choose min since we
  15768. // will get error no matter what.
  15769. var e = this.noViableAlt(input, outerContext, previous, startIndex);
  15770. input.seek(startIndex);
  15771. var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);
  15772. if (alt !== ATN.INVALID_ALT_NUMBER) {
  15773. return alt;
  15774. } else {
  15775. throw e;
  15776. }
  15777. }
  15778. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  15779. if (this.debug) {
  15780. console.log("LL altSubSets=" + altSubSets + ", predict=" + PredictionMode.getUniqueAlt(altSubSets) + ", resolvesToJustOneViableAlt=" + PredictionMode.resolvesToJustOneViableAlt(altSubSets));
  15781. }
  15782. reach.uniqueAlt = this.getUniqueAlt(reach);
  15783. // unique prediction?
  15784. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  15785. predictedAlt = reach.uniqueAlt;
  15786. break;
  15787. } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {
  15788. predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);
  15789. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  15790. break;
  15791. }
  15792. } else {
  15793. // In exact ambiguity mode, we never try to terminate early.
  15794. // Just keeps scarfing until we know what the conflict is
  15795. if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {
  15796. foundExactAmbig = true;
  15797. predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);
  15798. break;
  15799. }
  15800. // else there are multiple non-conflicting subsets or
  15801. // we're not sure what the ambiguity is yet.
  15802. // So, keep going.
  15803. }
  15804. previous = reach;
  15805. if (t !== Token.EOF) {
  15806. input.consume();
  15807. t = input.LA(1);
  15808. }
  15809. }
  15810. // If the configuration set uniquely predicts an alternative,
  15811. // without conflict, then we know that it's a full LL decision
  15812. // not SLL.
  15813. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  15814. this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);
  15815. return predictedAlt;
  15816. }
  15817. // We do not check predicates here because we have checked them
  15818. // on-the-fly when doing full context prediction.
  15819. //
  15820. // In non-exact ambiguity detection mode, we might actually be able to
  15821. // detect an exact ambiguity, but I'm not going to spend the cycles
  15822. // needed to check. We only emit ambiguity warnings in exact ambiguity
  15823. // mode.
  15824. //
  15825. // For example, we might know that we have conflicting configurations.
  15826. // But, that does not mean that there is no way forward without a
  15827. // conflict. It's possible to have nonconflicting alt subsets as in:
  15828. // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]
  15829. // from
  15830. //
  15831. // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),
  15832. // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]
  15833. //
  15834. // In this case, (17,1,[5 $]) indicates there is some next sequence that
  15835. // would resolve this without conflict to alternative 1. Any other viable
  15836. // next sequence, however, is associated with a conflict. We stop
  15837. // looking for input because no amount of further lookahead will alter
  15838. // the fact that we should predict alternative 1. We just can't say for
  15839. // sure that there is an ambiguity without looking further.
  15840. this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);
  15841. return predictedAlt;
  15842. };
  15843. ParserATNSimulator.prototype.computeReachSet = function (closure, t, fullCtx) {
  15844. if (this.debug) {
  15845. console.log("in computeReachSet, starting closure: " + closure);
  15846. }
  15847. if (this.mergeCache === null) {
  15848. this.mergeCache = new DoubleDict();
  15849. }
  15850. var intermediate = new ATNConfigSet(fullCtx);
  15851. // Configurations already in a rule stop state indicate reaching the end
  15852. // of the decision rule (local context) or end of the start rule (full
  15853. // context). Once reached, these configurations are never updated by a
  15854. // closure operation, so they are handled separately for the performance
  15855. // advantage of having a smaller intermediate set when calling closure.
  15856. //
  15857. // For full-context reach operations, separate handling is required to
  15858. // ensure that the alternative matching the longest overall sequence is
  15859. // chosen when multiple such configurations can match the input.
  15860. var skippedStopStates = null;
  15861. // First figure out where we can reach on input t
  15862. for (var i = 0; i < closure.items.length; i++) {
  15863. var c = closure.items[i];
  15864. if (this.debug_add) {
  15865. console.log("testing " + this.getTokenName(t) + " at " + c);
  15866. }
  15867. if (c.state instanceof RuleStopState) {
  15868. if (fullCtx || t === Token.EOF) {
  15869. if (skippedStopStates === null) {
  15870. skippedStopStates = [];
  15871. }
  15872. skippedStopStates.push(c);
  15873. if (this.debug_add) {
  15874. console.log("added " + c + " to skippedStopStates");
  15875. }
  15876. }
  15877. continue;
  15878. }
  15879. for (var j = 0; j < c.state.transitions.length; j++) {
  15880. var trans = c.state.transitions[j];
  15881. var target = this.getReachableTarget(trans, t);
  15882. if (target !== null) {
  15883. var cfg = new ATNConfig({ state: target }, c);
  15884. intermediate.add(cfg, this.mergeCache);
  15885. if (this.debug_add) {
  15886. console.log("added " + cfg + " to intermediate");
  15887. }
  15888. }
  15889. }
  15890. }
  15891. // Now figure out where the reach operation can take us...
  15892. var reach = null;
  15893. // This block optimizes the reach operation for intermediate sets which
  15894. // trivially indicate a termination state for the overall
  15895. // adaptivePredict operation.
  15896. //
  15897. // The conditions assume that intermediate
  15898. // contains all configurations relevant to the reach set, but this
  15899. // condition is not true when one or more configurations have been
  15900. // withheld in skippedStopStates, or when the current symbol is EOF.
  15901. //
  15902. if (skippedStopStates === null && t !== Token.EOF) {
  15903. if (intermediate.items.length === 1) {
  15904. // Don't pursue the closure if there is just one state.
  15905. // It can only have one alternative; just add to result
  15906. // Also don't pursue the closure if there is unique alternative
  15907. // among the configurations.
  15908. reach = intermediate;
  15909. } else if (this.getUniqueAlt(intermediate) !== ATN.INVALID_ALT_NUMBER) {
  15910. // Also don't pursue the closure if there is unique alternative
  15911. // among the configurations.
  15912. reach = intermediate;
  15913. }
  15914. }
  15915. // If the reach set could not be trivially determined, perform a closure
  15916. // operation on the intermediate set to compute its initial value.
  15917. //
  15918. if (reach === null) {
  15919. reach = new ATNConfigSet(fullCtx);
  15920. var closureBusy = new Set();
  15921. var treatEofAsEpsilon = t === Token.EOF;
  15922. for (var k = 0; k < intermediate.items.length; k++) {
  15923. this.closure(intermediate.items[k], reach, closureBusy, false, fullCtx, treatEofAsEpsilon);
  15924. }
  15925. }
  15926. if (t === Token.EOF) {
  15927. // After consuming EOF no additional input is possible, so we are
  15928. // only interested in configurations which reached the end of the
  15929. // decision rule (local context) or end of the start rule (full
  15930. // context). Update reach to contain only these configurations. This
  15931. // handles both explicit EOF transitions in the grammar and implicit
  15932. // EOF transitions following the end of the decision or start rule.
  15933. //
  15934. // When reach==intermediate, no closure operation was performed. In
  15935. // this case, removeAllConfigsNotInRuleStopState needs to check for
  15936. // reachable rule stop states as well as configurations already in
  15937. // a rule stop state.
  15938. //
  15939. // This is handled before the configurations in skippedStopStates,
  15940. // because any configurations potentially added from that list are
  15941. // already guaranteed to meet this condition whether or not it's
  15942. // required.
  15943. //
  15944. reach = this.removeAllConfigsNotInRuleStopState(reach, reach === intermediate);
  15945. }
  15946. // If skippedStopStates!==null, then it contains at least one
  15947. // configuration. For full-context reach operations, these
  15948. // configurations reached the end of the start rule, in which case we
  15949. // only add them back to reach if no configuration during the current
  15950. // closure operation reached such a state. This ensures adaptivePredict
  15951. // chooses an alternative matching the longest overall sequence when
  15952. // multiple alternatives are viable.
  15953. //
  15954. if (skippedStopStates !== null && (!fullCtx || !PredictionMode.hasConfigInRuleStopState(reach))) {
  15955. for (var l = 0; l < skippedStopStates.length; l++) {
  15956. reach.add(skippedStopStates[l], this.mergeCache);
  15957. }
  15958. }
  15959. if (reach.items.length === 0) {
  15960. return null;
  15961. } else {
  15962. return reach;
  15963. }
  15964. };
  15965. //
  15966. // Return a configuration set containing only the configurations from
  15967. // {@code configs} which are in a {@link RuleStopState}. If all
  15968. // configurations in {@code configs} are already in a rule stop state, this
  15969. // method simply returns {@code configs}.
  15970. //
  15971. // <p>When {@code lookToEndOfRule} is true, this method uses
  15972. // {@link ATN//nextTokens} for each configuration in {@code configs} which is
  15973. // not already in a rule stop state to see if a rule stop state is reachable
  15974. // from the configuration via epsilon-only transitions.</p>
  15975. //
  15976. // @param configs the configuration set to update
  15977. // @param lookToEndOfRule when true, this method checks for rule stop states
  15978. // reachable by epsilon-only transitions from each configuration in
  15979. // {@code configs}.
  15980. //
  15981. // @return {@code configs} if all configurations in {@code configs} are in a
  15982. // rule stop state, otherwise return a new configuration set containing only
  15983. // the configurations from {@code configs} which are in a rule stop state
  15984. //
  15985. ParserATNSimulator.prototype.removeAllConfigsNotInRuleStopState = function (configs, lookToEndOfRule) {
  15986. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  15987. return configs;
  15988. }
  15989. var result = new ATNConfigSet(configs.fullCtx);
  15990. for (var i = 0; i < configs.items.length; i++) {
  15991. var config = configs.items[i];
  15992. if (config.state instanceof RuleStopState) {
  15993. result.add(config, this.mergeCache);
  15994. continue;
  15995. }
  15996. if (lookToEndOfRule && config.state.epsilonOnlyTransitions) {
  15997. var nextTokens = this.atn.nextTokens(config.state);
  15998. if (nextTokens.contains(Token.EPSILON)) {
  15999. var endOfRuleState = this.atn.ruleToStopState[config.state.ruleIndex];
  16000. result.add(new ATNConfig({ state: endOfRuleState }, config), this.mergeCache);
  16001. }
  16002. }
  16003. }
  16004. return result;
  16005. };
  16006. ParserATNSimulator.prototype.computeStartState = function (p, ctx, fullCtx) {
  16007. // always at least the implicit call to start rule
  16008. var initialContext = predictionContextFromRuleContext(this.atn, ctx);
  16009. var configs = new ATNConfigSet(fullCtx);
  16010. for (var i = 0; i < p.transitions.length; i++) {
  16011. var target = p.transitions[i].target;
  16012. var c = new ATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  16013. var closureBusy = new Set();
  16014. this.closure(c, configs, closureBusy, true, fullCtx, false);
  16015. }
  16016. return configs;
  16017. };
  16018. //
  16019. // This method transforms the start state computed by
  16020. // {@link //computeStartState} to the special start state used by a
  16021. // precedence DFA for a particular precedence value. The transformation
  16022. // process applies the following changes to the start state's configuration
  16023. // set.
  16024. //
  16025. // <ol>
  16026. // <li>Evaluate the precedence predicates for each configuration using
  16027. // {@link SemanticContext//evalPrecedence}.</li>
  16028. // <li>Remove all configurations which predict an alternative greater than
  16029. // 1, for which another configuration that predicts alternative 1 is in the
  16030. // same ATN state with the same prediction context. This transformation is
  16031. // valid for the following reasons:
  16032. // <ul>
  16033. // <li>The closure block cannot contain any epsilon transitions which bypass
  16034. // the body of the closure, so all states reachable via alternative 1 are
  16035. // part of the precedence alternatives of the transformed left-recursive
  16036. // rule.</li>
  16037. // <li>The "primary" portion of a left recursive rule cannot contain an
  16038. // epsilon transition, so the only way an alternative other than 1 can exist
  16039. // in a state that is also reachable via alternative 1 is by nesting calls
  16040. // to the left-recursive rule, with the outer calls not being at the
  16041. // preferred precedence level.</li>
  16042. // </ul>
  16043. // </li>
  16044. // </ol>
  16045. //
  16046. // <p>
  16047. // The prediction context must be considered by this filter to address
  16048. // situations like the following.
  16049. // </p>
  16050. // <code>
  16051. // <pre>
  16052. // grammar TA;
  16053. // prog: statement* EOF;
  16054. // statement: letterA | statement letterA 'b' ;
  16055. // letterA: 'a';
  16056. // </pre>
  16057. // </code>
  16058. // <p>
  16059. // If the above grammar, the ATN state immediately before the token
  16060. // reference {@code 'a'} in {@code letterA} is reachable from the left edge
  16061. // of both the primary and closure blocks of the left-recursive rule
  16062. // {@code statement}. The prediction context associated with each of these
  16063. // configurations distinguishes between them, and prevents the alternative
  16064. // which stepped out to {@code prog} (and then back in to {@code statement}
  16065. // from being eliminated by the filter.
  16066. // </p>
  16067. //
  16068. // @param configs The configuration set computed by
  16069. // {@link //computeStartState} as the start state for the DFA.
  16070. // @return The transformed configuration set representing the start state
  16071. // for a precedence DFA at a particular precedence level (determined by
  16072. // calling {@link Parser//getPrecedence}).
  16073. //
  16074. ParserATNSimulator.prototype.applyPrecedenceFilter = function (configs) {
  16075. var config;
  16076. var statesFromAlt1 = [];
  16077. var configSet = new ATNConfigSet(configs.fullCtx);
  16078. for (var i = 0; i < configs.items.length; i++) {
  16079. config = configs.items[i];
  16080. // handle alt 1 first
  16081. if (config.alt !== 1) {
  16082. continue;
  16083. }
  16084. var updatedContext = config.semanticContext.evalPrecedence(this.parser, this._outerContext);
  16085. if (updatedContext === null) {
  16086. // the configuration was eliminated
  16087. continue;
  16088. }
  16089. statesFromAlt1[config.state.stateNumber] = config.context;
  16090. if (updatedContext !== config.semanticContext) {
  16091. configSet.add(new ATNConfig({ semanticContext: updatedContext }, config), this.mergeCache);
  16092. } else {
  16093. configSet.add(config, this.mergeCache);
  16094. }
  16095. }
  16096. for (i = 0; i < configs.items.length; i++) {
  16097. config = configs.items[i];
  16098. if (config.alt === 1) {
  16099. // already handled
  16100. continue;
  16101. }
  16102. // In the future, this elimination step could be updated to also
  16103. // filter the prediction context for alternatives predicting alt>1
  16104. // (basically a graph subtraction algorithm).
  16105. if (!config.precedenceFilterSuppressed) {
  16106. var context = statesFromAlt1[config.state.stateNumber] || null;
  16107. if (context !== null && context.equals(config.context)) {
  16108. // eliminated
  16109. continue;
  16110. }
  16111. }
  16112. configSet.add(config, this.mergeCache);
  16113. }
  16114. return configSet;
  16115. };
  16116. ParserATNSimulator.prototype.getReachableTarget = function (trans, ttype) {
  16117. if (trans.matches(ttype, 0, this.atn.maxTokenType)) {
  16118. return trans.target;
  16119. } else {
  16120. return null;
  16121. }
  16122. };
  16123. ParserATNSimulator.prototype.getPredsForAmbigAlts = function (ambigAlts, configs, nalts) {
  16124. // REACH=[1|1|[]|0:0, 1|2|[]|0:1]
  16125. // altToPred starts as an array of all null contexts. The entry at index i
  16126. // corresponds to alternative i. altToPred[i] may have one of three values:
  16127. // 1. null: no ATNConfig c is found such that c.alt==i
  16128. // 2. SemanticContext.NONE: At least one ATNConfig c exists such that
  16129. // c.alt==i and c.semanticContext==SemanticContext.NONE. In other words,
  16130. // alt i has at least one unpredicated config.
  16131. // 3. Non-NONE Semantic Context: There exists at least one, and for all
  16132. // ATNConfig c such that c.alt==i, c.semanticContext!=SemanticContext.NONE.
  16133. //
  16134. // From this, it is clear that NONE||anything==NONE.
  16135. //
  16136. var altToPred = [];
  16137. for (var i = 0; i < configs.items.length; i++) {
  16138. var c = configs.items[i];
  16139. if (ambigAlts.contains(c.alt)) {
  16140. altToPred[c.alt] = SemanticContext.orContext(altToPred[c.alt] || null, c.semanticContext);
  16141. }
  16142. }
  16143. var nPredAlts = 0;
  16144. for (i = 1; i < nalts + 1; i++) {
  16145. var pred = altToPred[i] || null;
  16146. if (pred === null) {
  16147. altToPred[i] = SemanticContext.NONE;
  16148. } else if (pred !== SemanticContext.NONE) {
  16149. nPredAlts += 1;
  16150. }
  16151. }
  16152. // nonambig alts are null in altToPred
  16153. if (nPredAlts === 0) {
  16154. altToPred = null;
  16155. }
  16156. if (this.debug) {
  16157. console.log("getPredsForAmbigAlts result " + Utils.arrayToString(altToPred));
  16158. }
  16159. return altToPred;
  16160. };
  16161. ParserATNSimulator.prototype.getPredicatePredictions = function (ambigAlts, altToPred) {
  16162. var pairs = [];
  16163. var containsPredicate = false;
  16164. for (var i = 1; i < altToPred.length; i++) {
  16165. var pred = altToPred[i];
  16166. // unpredicated is indicated by SemanticContext.NONE
  16167. if (ambigAlts !== null && ambigAlts.contains(i)) {
  16168. pairs.push(new PredPrediction(pred, i));
  16169. }
  16170. if (pred !== SemanticContext.NONE) {
  16171. containsPredicate = true;
  16172. }
  16173. }
  16174. if (!containsPredicate) {
  16175. return null;
  16176. }
  16177. return pairs;
  16178. };
  16179. //
  16180. // This method is used to improve the localization of error messages by
  16181. // choosing an alternative rather than throwing a
  16182. // {@link NoViableAltException} in particular prediction scenarios where the
  16183. // {@link //ERROR} state was reached during ATN simulation.
  16184. //
  16185. // <p>
  16186. // The default implementation of this method uses the following
  16187. // algorithm to identify an ATN configuration which successfully parsed the
  16188. // decision entry rule. Choosing such an alternative ensures that the
  16189. // {@link ParserRuleContext} returned by the calling rule will be complete
  16190. // and valid, and the syntax error will be reported later at a more
  16191. // localized location.</p>
  16192. //
  16193. // <ul>
  16194. // <li>If a syntactically valid path or paths reach the end of the decision rule and
  16195. // they are semantically valid if predicated, return the min associated alt.</li>
  16196. // <li>Else, if a semantically invalid but syntactically valid path exist
  16197. // or paths exist, return the minimum associated alt.
  16198. // </li>
  16199. // <li>Otherwise, return {@link ATN//INVALID_ALT_NUMBER}.</li>
  16200. // </ul>
  16201. //
  16202. // <p>
  16203. // In some scenarios, the algorithm described above could predict an
  16204. // alternative which will result in a {@link FailedPredicateException} in
  16205. // the parser. Specifically, this could occur if the <em>only</em> configuration
  16206. // capable of successfully parsing to the end of the decision rule is
  16207. // blocked by a semantic predicate. By choosing this alternative within
  16208. // {@link //adaptivePredict} instead of throwing a
  16209. // {@link NoViableAltException}, the resulting
  16210. // {@link FailedPredicateException} in the parser will identify the specific
  16211. // predicate which is preventing the parser from successfully parsing the
  16212. // decision rule, which helps developers identify and correct logic errors
  16213. // in semantic predicates.
  16214. // </p>
  16215. //
  16216. // @param configs The ATN configurations which were valid immediately before
  16217. // the {@link //ERROR} state was reached
  16218. // @param outerContext The is the \gamma_0 initial parser context from the paper
  16219. // or the parser stack at the instant before prediction commences.
  16220. //
  16221. // @return The value to return from {@link //adaptivePredict}, or
  16222. // {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not
  16223. // identified and {@link //adaptivePredict} should report an error instead.
  16224. //
  16225. ParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function (configs, outerContext) {
  16226. var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);
  16227. var semValidConfigs = cfgs[0];
  16228. var semInvalidConfigs = cfgs[1];
  16229. var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);
  16230. if (alt !== ATN.INVALID_ALT_NUMBER) {
  16231. // semantically/syntactically viable path exists
  16232. return alt;
  16233. }
  16234. // Is there a syntactically valid path with a failed pred?
  16235. if (semInvalidConfigs.items.length > 0) {
  16236. alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);
  16237. if (alt !== ATN.INVALID_ALT_NUMBER) {
  16238. // syntactically viable path exists
  16239. return alt;
  16240. }
  16241. }
  16242. return ATN.INVALID_ALT_NUMBER;
  16243. };
  16244. ParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function (configs) {
  16245. var alts = [];
  16246. for (var i = 0; i < configs.items.length; i++) {
  16247. var c = configs.items[i];
  16248. if (c.reachesIntoOuterContext > 0 || c.state instanceof RuleStopState && c.context.hasEmptyPath()) {
  16249. if (alts.indexOf(c.alt) < 0) {
  16250. alts.push(c.alt);
  16251. }
  16252. }
  16253. }
  16254. if (alts.length === 0) {
  16255. return ATN.INVALID_ALT_NUMBER;
  16256. } else {
  16257. return Math.min.apply(null, alts);
  16258. }
  16259. };
  16260. // Walk the list of configurations and split them according to
  16261. // those that have preds evaluating to true/false. If no pred, assume
  16262. // true pred and include in succeeded set. Returns Pair of sets.
  16263. //
  16264. // Create a new set so as not to alter the incoming parameter.
  16265. //
  16266. // Assumption: the input stream has been restored to the starting point
  16267. // prediction, which is where predicates need to evaluate.
  16268. //
  16269. ParserATNSimulator.prototype.splitAccordingToSemanticValidity = function (configs, outerContext) {
  16270. var succeeded = new ATNConfigSet(configs.fullCtx);
  16271. var failed = new ATNConfigSet(configs.fullCtx);
  16272. for (var i = 0; i < configs.items.length; i++) {
  16273. var c = configs.items[i];
  16274. if (c.semanticContext !== SemanticContext.NONE) {
  16275. var predicateEvaluationResult = c.semanticContext.evaluate(this.parser, outerContext);
  16276. if (predicateEvaluationResult) {
  16277. succeeded.add(c);
  16278. } else {
  16279. failed.add(c);
  16280. }
  16281. } else {
  16282. succeeded.add(c);
  16283. }
  16284. }
  16285. return [succeeded, failed];
  16286. };
  16287. // Look through a list of predicate/alt pairs, returning alts for the
  16288. // pairs that win. A {@code NONE} predicate indicates an alt containing an
  16289. // unpredicated config which behaves as "always true." If !complete
  16290. // then we stop at the first predicate that evaluates to true. This
  16291. // includes pairs with null predicates.
  16292. //
  16293. ParserATNSimulator.prototype.evalSemanticContext = function (predPredictions, outerContext, complete) {
  16294. var predictions = new BitSet();
  16295. for (var i = 0; i < predPredictions.length; i++) {
  16296. var pair = predPredictions[i];
  16297. if (pair.pred === SemanticContext.NONE) {
  16298. predictions.add(pair.alt);
  16299. if (!complete) {
  16300. break;
  16301. }
  16302. continue;
  16303. }
  16304. var predicateEvaluationResult = pair.pred.evaluate(this.parser, outerContext);
  16305. if (this.debug || this.dfa_debug) {
  16306. console.log("eval pred " + pair + "=" + predicateEvaluationResult);
  16307. }
  16308. if (predicateEvaluationResult) {
  16309. if (this.debug || this.dfa_debug) {
  16310. console.log("PREDICT " + pair.alt);
  16311. }
  16312. predictions.add(pair.alt);
  16313. if (!complete) {
  16314. break;
  16315. }
  16316. }
  16317. }
  16318. return predictions;
  16319. };
  16320. // TODO: If we are doing predicates, there is no point in pursuing
  16321. // closure operations if we reach a DFA state that uniquely predicts
  16322. // alternative. We will not be caching that DFA state and it is a
  16323. // waste to pursue the closure. Might have to advance when we do
  16324. // ambig detection thought :(
  16325. //
  16326. ParserATNSimulator.prototype.closure = function (config, configs, closureBusy, collectPredicates, fullCtx, treatEofAsEpsilon) {
  16327. var initialDepth = 0;
  16328. this.closureCheckingStopState(config, configs, closureBusy, collectPredicates, fullCtx, initialDepth, treatEofAsEpsilon);
  16329. };
  16330. ParserATNSimulator.prototype.closureCheckingStopState = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  16331. if (this.debug || this.debug_closure) {
  16332. console.log("closure(" + config.toString(this.parser, true) + ")");
  16333. // console.log("configs(" + configs.toString() + ")");
  16334. if (config.reachesIntoOuterContext > 50) {
  16335. throw "problem";
  16336. }
  16337. }
  16338. if (config.state instanceof RuleStopState) {
  16339. // We hit rule end. If we have context info, use it
  16340. // run thru all possible stack tops in ctx
  16341. if (!config.context.isEmpty()) {
  16342. for (var i = 0; i < config.context.length; i++) {
  16343. if (config.context.getReturnState(i) === PredictionContext.EMPTY_RETURN_STATE) {
  16344. if (fullCtx) {
  16345. configs.add(new ATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config), this.mergeCache);
  16346. continue;
  16347. } else {
  16348. // we have no context info, just chase follow links (if greedy)
  16349. if (this.debug) {
  16350. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  16351. }
  16352. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  16353. }
  16354. continue;
  16355. }
  16356. var returnState = this.atn.states[config.context.getReturnState(i)];
  16357. var newContext = config.context.getParent(i); // "pop" return state
  16358. var parms = { state: returnState, alt: config.alt, context: newContext, semanticContext: config.semanticContext };
  16359. var c = new ATNConfig(parms, null);
  16360. // While we have context to pop back from, we may have
  16361. // gotten that context AFTER having falling off a rule.
  16362. // Make sure we track that we are now out of context.
  16363. c.reachesIntoOuterContext = config.reachesIntoOuterContext;
  16364. this.closureCheckingStopState(c, configs, closureBusy, collectPredicates, fullCtx, depth - 1, treatEofAsEpsilon);
  16365. }
  16366. return;
  16367. } else if (fullCtx) {
  16368. // reached end of start rule
  16369. configs.add(config, this.mergeCache);
  16370. return;
  16371. } else {
  16372. // else if we have no context info, just chase follow links (if greedy)
  16373. if (this.debug) {
  16374. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  16375. }
  16376. }
  16377. }
  16378. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  16379. };
  16380. // Do the actual work of walking epsilon edges//
  16381. ParserATNSimulator.prototype.closure_ = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  16382. var p = config.state;
  16383. // optimization
  16384. if (!p.epsilonOnlyTransitions) {
  16385. configs.add(config, this.mergeCache);
  16386. // make sure to not return here, because EOF transitions can act as
  16387. // both epsilon transitions and non-epsilon transitions.
  16388. }
  16389. for (var i = 0; i < p.transitions.length; i++) {
  16390. if (i == 0 && this.canDropLoopEntryEdgeInLeftRecursiveRule(config)) continue;
  16391. var t = p.transitions[i];
  16392. var continueCollecting = collectPredicates && !(t instanceof ActionTransition);
  16393. var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon);
  16394. if (c !== null) {
  16395. if (!t.isEpsilon && closureBusy.add(c) !== c) {
  16396. // avoid infinite recursion for EOF* and EOF+
  16397. continue;
  16398. }
  16399. var newDepth = depth;
  16400. if (config.state instanceof RuleStopState) {
  16401. // target fell off end of rule; mark resulting c as having dipped into outer context
  16402. // We can't get here if incoming config was rule stop and we had context
  16403. // track how far we dip into outer context. Might
  16404. // come in handy and we avoid evaluating context dependent
  16405. // preds if this is > 0.
  16406. if (closureBusy.add(c) !== c) {
  16407. // avoid infinite recursion for right-recursive rules
  16408. continue;
  16409. }
  16410. if (this._dfa !== null && this._dfa.precedenceDfa) {
  16411. if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) {
  16412. c.precedenceFilterSuppressed = true;
  16413. }
  16414. }
  16415. c.reachesIntoOuterContext += 1;
  16416. configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
  16417. newDepth -= 1;
  16418. if (this.debug) {
  16419. console.log("dips into outer ctx: " + c);
  16420. }
  16421. } else if (t instanceof RuleTransition) {
  16422. // latch when newDepth goes negative - once we step out of the entry context we can't return
  16423. if (newDepth >= 0) {
  16424. newDepth += 1;
  16425. }
  16426. }
  16427. this.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon);
  16428. }
  16429. }
  16430. };
  16431. ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function (config) {
  16432. // return False
  16433. var p = config.state;
  16434. // First check to see if we are in StarLoopEntryState generated during
  16435. // left-recursion elimination. For efficiency, also check if
  16436. // the context has an empty stack case. If so, it would mean
  16437. // global FOLLOW so we can't perform optimization
  16438. // Are we the special loop entry/exit state? or SLL wildcard
  16439. if (p.stateType != ATNState.STAR_LOOP_ENTRY) return false;
  16440. if (p.stateType != ATNState.STAR_LOOP_ENTRY || !p.isPrecedenceDecision || config.context.isEmpty() || config.context.hasEmptyPath()) return false;
  16441. // Require all return states to return back to the same rule that p is in.
  16442. var numCtxs = config.context.length;
  16443. for (var i = 0; i < numCtxs; i++) {
  16444. // for each stack context
  16445. var returnState = this.atn.states[config.context.getReturnState(i)];
  16446. if (returnState.ruleIndex != p.ruleIndex) return false;
  16447. }
  16448. var decisionStartState = p.transitions[0].target;
  16449. var blockEndStateNum = decisionStartState.endState.stateNumber;
  16450. var blockEndState = this.atn.states[blockEndStateNum];
  16451. // Verify that the top of each stack context leads to loop entry/exit
  16452. // state through epsilon edges and w/o leaving rule.
  16453. for (var i = 0; i < numCtxs; i++) {
  16454. // for each stack context
  16455. var returnStateNumber = config.context.getReturnState(i);
  16456. var returnState = this.atn.states[returnStateNumber];
  16457. // all states must have single outgoing epsilon edge
  16458. if (returnState.transitions.length != 1 || !returnState.transitions[0].isEpsilon) return false;
  16459. // Look for prefix op case like 'not expr', (' type ')' expr
  16460. var returnStateTarget = returnState.transitions[0].target;
  16461. if (returnState.stateType == ATNState.BLOCK_END && returnStateTarget == p) continue;
  16462. // Look for 'expr op expr' or case where expr's return state is block end
  16463. // of (...)* internal block; the block end points to loop back
  16464. // which points to p but we don't need to check that
  16465. if (returnState == blockEndState) continue;
  16466. // Look for ternary expr ? expr : expr. The return state points at block end,
  16467. // which points at loop entry state
  16468. if (returnStateTarget == blockEndState) continue;
  16469. // Look for complex prefix 'between expr and expr' case where 2nd expr's
  16470. // return state points at block end state of (...)* internal block
  16471. if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1 && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p) continue;
  16472. // anything else ain't conforming
  16473. return false;
  16474. }
  16475. return true;
  16476. };
  16477. ParserATNSimulator.prototype.getRuleName = function (index) {
  16478. if (this.parser !== null && index >= 0) {
  16479. return this.parser.ruleNames[index];
  16480. } else {
  16481. return "<rule " + index + ">";
  16482. }
  16483. };
  16484. ParserATNSimulator.prototype.getEpsilonTarget = function (config, t, collectPredicates, inContext, fullCtx, treatEofAsEpsilon) {
  16485. switch (t.serializationType) {
  16486. case Transition.RULE:
  16487. return this.ruleTransition(config, t);
  16488. case Transition.PRECEDENCE:
  16489. return this.precedenceTransition(config, t, collectPredicates, inContext, fullCtx);
  16490. case Transition.PREDICATE:
  16491. return this.predTransition(config, t, collectPredicates, inContext, fullCtx);
  16492. case Transition.ACTION:
  16493. return this.actionTransition(config, t);
  16494. case Transition.EPSILON:
  16495. return new ATNConfig({ state: t.target }, config);
  16496. case Transition.ATOM:
  16497. case Transition.RANGE:
  16498. case Transition.SET:
  16499. // EOF transitions act like epsilon transitions after the first EOF
  16500. // transition is traversed
  16501. if (treatEofAsEpsilon) {
  16502. if (t.matches(Token.EOF, 0, 1)) {
  16503. return new ATNConfig({ state: t.target }, config);
  16504. }
  16505. }
  16506. return null;
  16507. default:
  16508. return null;
  16509. }
  16510. };
  16511. ParserATNSimulator.prototype.actionTransition = function (config, t) {
  16512. if (this.debug) {
  16513. var index = t.actionIndex == -1 ? 65535 : t.actionIndex;
  16514. console.log("ACTION edge " + t.ruleIndex + ":" + index);
  16515. }
  16516. return new ATNConfig({ state: t.target }, config);
  16517. };
  16518. ParserATNSimulator.prototype.precedenceTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  16519. if (this.debug) {
  16520. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.precedence + ">=_p, ctx dependent=true");
  16521. if (this.parser !== null) {
  16522. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  16523. }
  16524. }
  16525. var c = null;
  16526. if (collectPredicates && inContext) {
  16527. if (fullCtx) {
  16528. // In full context mode, we can evaluate predicates on-the-fly
  16529. // during closure, which dramatically reduces the size of
  16530. // the config sets. It also obviates the need to test predicates
  16531. // later during conflict resolution.
  16532. var currentPosition = this._input.index;
  16533. this._input.seek(this._startIndex);
  16534. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  16535. this._input.seek(currentPosition);
  16536. if (predSucceeds) {
  16537. c = new ATNConfig({ state: pt.target }, config); // no pred context
  16538. }
  16539. } else {
  16540. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  16541. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  16542. }
  16543. } else {
  16544. c = new ATNConfig({ state: pt.target }, config);
  16545. }
  16546. if (this.debug) {
  16547. console.log("config from pred transition=" + c);
  16548. }
  16549. return c;
  16550. };
  16551. ParserATNSimulator.prototype.predTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  16552. if (this.debug) {
  16553. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex + ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent);
  16554. if (this.parser !== null) {
  16555. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  16556. }
  16557. }
  16558. var c = null;
  16559. if (collectPredicates && (pt.isCtxDependent && inContext || !pt.isCtxDependent)) {
  16560. if (fullCtx) {
  16561. // In full context mode, we can evaluate predicates on-the-fly
  16562. // during closure, which dramatically reduces the size of
  16563. // the config sets. It also obviates the need to test predicates
  16564. // later during conflict resolution.
  16565. var currentPosition = this._input.index;
  16566. this._input.seek(this._startIndex);
  16567. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  16568. this._input.seek(currentPosition);
  16569. if (predSucceeds) {
  16570. c = new ATNConfig({ state: pt.target }, config); // no pred context
  16571. }
  16572. } else {
  16573. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  16574. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  16575. }
  16576. } else {
  16577. c = new ATNConfig({ state: pt.target }, config);
  16578. }
  16579. if (this.debug) {
  16580. console.log("config from pred transition=" + c);
  16581. }
  16582. return c;
  16583. };
  16584. ParserATNSimulator.prototype.ruleTransition = function (config, t) {
  16585. if (this.debug) {
  16586. console.log("CALL rule " + this.getRuleName(t.target.ruleIndex) + ", ctx=" + config.context);
  16587. }
  16588. var returnState = t.followState;
  16589. var newContext = SingletonPredictionContext.create(config.context, returnState.stateNumber);
  16590. return new ATNConfig({ state: t.target, context: newContext }, config);
  16591. };
  16592. ParserATNSimulator.prototype.getConflictingAlts = function (configs) {
  16593. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  16594. return PredictionMode.getAlts(altsets);
  16595. };
  16596. // Sam pointed out a problem with the previous definition, v3, of
  16597. // ambiguous states. If we have another state associated with conflicting
  16598. // alternatives, we should keep going. For example, the following grammar
  16599. //
  16600. // s : (ID | ID ID?) ';' ;
  16601. //
  16602. // When the ATN simulation reaches the state before ';', it has a DFA
  16603. // state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
  16604. // 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
  16605. // because alternative to has another way to continue, via [6|2|[]].
  16606. // The key is that we have a single state that has config's only associated
  16607. // with a single alternative, 2, and crucially the state transitions
  16608. // among the configurations are all non-epsilon transitions. That means
  16609. // we don't consider any conflicts that include alternative 2. So, we
  16610. // ignore the conflict between alts 1 and 2. We ignore a set of
  16611. // conflicting alts when there is an intersection with an alternative
  16612. // associated with a single alt state in the state&rarr;config-list map.
  16613. //
  16614. // It's also the case that we might have two conflicting configurations but
  16615. // also a 3rd nonconflicting configuration for a different alternative:
  16616. // [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
  16617. //
  16618. // a : A | A | A B ;
  16619. //
  16620. // After matching input A, we reach the stop state for rule A, state 1.
  16621. // State 8 is the state right before B. Clearly alternatives 1 and 2
  16622. // conflict and no amount of further lookahead will separate the two.
  16623. // However, alternative 3 will be able to continue and so we do not
  16624. // stop working on this state. In the previous example, we're concerned
  16625. // with states associated with the conflicting alternatives. Here alt
  16626. // 3 is not associated with the conflicting configs, but since we can continue
  16627. // looking for input reasonably, I don't declare the state done. We
  16628. // ignore a set of conflicting alts when we have an alternative
  16629. // that we still need to pursue.
  16630. //
  16631. ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function (configs) {
  16632. var conflictingAlts = null;
  16633. if (configs.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  16634. conflictingAlts = new BitSet();
  16635. conflictingAlts.add(configs.uniqueAlt);
  16636. } else {
  16637. conflictingAlts = configs.conflictingAlts;
  16638. }
  16639. return conflictingAlts;
  16640. };
  16641. ParserATNSimulator.prototype.getTokenName = function (t) {
  16642. if (t === Token.EOF) {
  16643. return "EOF";
  16644. }
  16645. if (this.parser !== null && this.parser.literalNames !== null) {
  16646. if (t >= this.parser.literalNames.length && t >= this.parser.symbolicNames.length) {
  16647. console.log("" + t + " ttype out of range: " + this.parser.literalNames);
  16648. console.log("" + this.parser.getInputStream().getTokens());
  16649. } else {
  16650. var name = this.parser.literalNames[t] || this.parser.symbolicNames[t];
  16651. return name + "<" + t + ">";
  16652. }
  16653. }
  16654. return "" + t;
  16655. };
  16656. ParserATNSimulator.prototype.getLookaheadName = function (input) {
  16657. return this.getTokenName(input.LA(1));
  16658. };
  16659. // Used for debugging in adaptivePredict around execATN but I cut
  16660. // it out for clarity now that alg. works well. We can leave this
  16661. // "dead" code for a bit.
  16662. //
  16663. ParserATNSimulator.prototype.dumpDeadEndConfigs = function (nvae) {
  16664. console.log("dead end configs: ");
  16665. var decs = nvae.getDeadEndConfigs();
  16666. for (var i = 0; i < decs.length; i++) {
  16667. var c = decs[i];
  16668. var trans = "no edges";
  16669. if (c.state.transitions.length > 0) {
  16670. var t = c.state.transitions[0];
  16671. if (t instanceof AtomTransition) {
  16672. trans = "Atom " + this.getTokenName(t.label);
  16673. } else if (t instanceof SetTransition) {
  16674. var neg = t instanceof NotSetTransition;
  16675. trans = (neg ? "~" : "") + "Set " + t.set;
  16676. }
  16677. }
  16678. console.error(c.toString(this.parser, true) + ":" + trans);
  16679. }
  16680. };
  16681. ParserATNSimulator.prototype.noViableAlt = function (input, outerContext, configs, startIndex) {
  16682. return new NoViableAltException(this.parser, input, input.get(startIndex), input.LT(1), configs, outerContext);
  16683. };
  16684. ParserATNSimulator.prototype.getUniqueAlt = function (configs) {
  16685. var alt = ATN.INVALID_ALT_NUMBER;
  16686. for (var i = 0; i < configs.items.length; i++) {
  16687. var c = configs.items[i];
  16688. if (alt === ATN.INVALID_ALT_NUMBER) {
  16689. alt = c.alt; // found first alt
  16690. } else if (c.alt !== alt) {
  16691. return ATN.INVALID_ALT_NUMBER;
  16692. }
  16693. }
  16694. return alt;
  16695. };
  16696. //
  16697. // Add an edge to the DFA, if possible. This method calls
  16698. // {@link //addDFAState} to ensure the {@code to} state is present in the
  16699. // DFA. If {@code from} is {@code null}, or if {@code t} is outside the
  16700. // range of edges that can be represented in the DFA tables, this method
  16701. // returns without adding the edge to the DFA.
  16702. //
  16703. // <p>If {@code to} is {@code null}, this method returns {@code null}.
  16704. // Otherwise, this method returns the {@link DFAState} returned by calling
  16705. // {@link //addDFAState} for the {@code to} state.</p>
  16706. //
  16707. // @param dfa The DFA
  16708. // @param from The source state for the edge
  16709. // @param t The input symbol
  16710. // @param to The target state for the edge
  16711. //
  16712. // @return If {@code to} is {@code null}, this method returns {@code null};
  16713. // otherwise this method returns the result of calling {@link //addDFAState}
  16714. // on {@code to}
  16715. //
  16716. ParserATNSimulator.prototype.addDFAEdge = function (dfa, from_, t, to) {
  16717. if (this.debug) {
  16718. console.log("EDGE " + from_ + " -> " + to + " upon " + this.getTokenName(t));
  16719. }
  16720. if (to === null) {
  16721. return null;
  16722. }
  16723. to = this.addDFAState(dfa, to); // used existing if possible not incoming
  16724. if (from_ === null || t < -1 || t > this.atn.maxTokenType) {
  16725. return to;
  16726. }
  16727. if (from_.edges === null) {
  16728. from_.edges = [];
  16729. }
  16730. from_.edges[t + 1] = to; // connect
  16731. if (this.debug) {
  16732. var literalNames = this.parser === null ? null : this.parser.literalNames;
  16733. var symbolicNames = this.parser === null ? null : this.parser.symbolicNames;
  16734. console.log("DFA=\n" + dfa.toString(literalNames, symbolicNames));
  16735. }
  16736. return to;
  16737. };
  16738. //
  16739. // Add state {@code D} to the DFA if it is not already present, and return
  16740. // the actual instance stored in the DFA. If a state equivalent to {@code D}
  16741. // is already in the DFA, the existing state is returned. Otherwise this
  16742. // method returns {@code D} after adding it to the DFA.
  16743. //
  16744. // <p>If {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and
  16745. // does not change the DFA.</p>
  16746. //
  16747. // @param dfa The dfa
  16748. // @param D The DFA state to add
  16749. // @return The state stored in the DFA. This will be either the existing
  16750. // state if {@code D} is already in the DFA, or {@code D} itself if the
  16751. // state was not already present.
  16752. //
  16753. ParserATNSimulator.prototype.addDFAState = function (dfa, D) {
  16754. if (D == ATNSimulator.ERROR) {
  16755. return D;
  16756. }
  16757. var existing = dfa.states.get(D);
  16758. if (existing !== null) {
  16759. return existing;
  16760. }
  16761. D.stateNumber = dfa.states.length;
  16762. if (!D.configs.readOnly) {
  16763. D.configs.optimizeConfigs(this);
  16764. D.configs.setReadonly(true);
  16765. }
  16766. dfa.states.add(D);
  16767. if (this.debug) {
  16768. console.log("adding new DFA state: " + D);
  16769. }
  16770. return D;
  16771. };
  16772. ParserATNSimulator.prototype.reportAttemptingFullContext = function (dfa, conflictingAlts, configs, startIndex, stopIndex) {
  16773. if (this.debug || this.retry_debug) {
  16774. var interval = new Interval(startIndex, stopIndex + 1);
  16775. console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  16776. }
  16777. if (this.parser !== null) {
  16778. this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);
  16779. }
  16780. };
  16781. ParserATNSimulator.prototype.reportContextSensitivity = function (dfa, prediction, configs, startIndex, stopIndex) {
  16782. if (this.debug || this.retry_debug) {
  16783. var interval = new Interval(startIndex, stopIndex + 1);
  16784. console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  16785. }
  16786. if (this.parser !== null) {
  16787. this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);
  16788. }
  16789. };
  16790. // If context sensitive parsing, we know it's ambiguity not conflict//
  16791. ParserATNSimulator.prototype.reportAmbiguity = function (dfa, D, startIndex, stopIndex, exact, ambigAlts, configs) {
  16792. if (this.debug || this.retry_debug) {
  16793. var interval = new Interval(startIndex, stopIndex + 1);
  16794. console.log("reportAmbiguity " + ambigAlts + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  16795. }
  16796. if (this.parser !== null) {
  16797. this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  16798. }
  16799. };
  16800. exports.ParserATNSimulator = ParserATNSimulator;
  16801. /***/ }),
  16802. /***/ "./node_modules/antlr4/atn/PredictionMode.js":
  16803. /*!***************************************************!*\
  16804. !*** ./node_modules/antlr4/atn/PredictionMode.js ***!
  16805. \***************************************************/
  16806. /*! no static exports found */
  16807. /***/ (function(module, exports, __webpack_require__) {
  16808. "use strict";
  16809. //
  16810. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  16811. * Use of this file is governed by the BSD 3-clause license that
  16812. * can be found in the LICENSE.txt file in the project root.
  16813. */
  16814. //
  16815. //
  16816. // This enumeration defines the prediction modes available in ANTLR 4 along with
  16817. // utility methods for analyzing configuration sets for conflicts and/or
  16818. // ambiguities.
  16819. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  16820. var Map = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Map;
  16821. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  16822. var AltDict = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").AltDict;
  16823. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  16824. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  16825. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  16826. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  16827. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  16828. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  16829. var hashStuff = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  16830. var equalArrays = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").equalArrays;
  16831. function PredictionMode() {
  16832. return this;
  16833. }
  16834. //
  16835. // The SLL(*) prediction mode. This prediction mode ignores the current
  16836. // parser context when making predictions. This is the fastest prediction
  16837. // mode, and provides correct results for many grammars. This prediction
  16838. // mode is more powerful than the prediction mode provided by ANTLR 3, but
  16839. // may result in syntax errors for grammar and input combinations which are
  16840. // not SLL.
  16841. //
  16842. // <p>
  16843. // When using this prediction mode, the parser will either return a correct
  16844. // parse tree (i.e. the same parse tree that would be returned with the
  16845. // {@link //LL} prediction mode), or it will report a syntax error. If a
  16846. // syntax error is encountered when using the {@link //SLL} prediction mode,
  16847. // it may be due to either an actual syntax error in the input or indicate
  16848. // that the particular combination of grammar and input requires the more
  16849. // powerful {@link //LL} prediction abilities to complete successfully.</p>
  16850. //
  16851. // <p>
  16852. // This prediction mode does not provide any guarantees for prediction
  16853. // behavior for syntactically-incorrect inputs.</p>
  16854. //
  16855. PredictionMode.SLL = 0;
  16856. //
  16857. // The LL(*) prediction mode. This prediction mode allows the current parser
  16858. // context to be used for resolving SLL conflicts that occur during
  16859. // prediction. This is the fastest prediction mode that guarantees correct
  16860. // parse results for all combinations of grammars with syntactically correct
  16861. // inputs.
  16862. //
  16863. // <p>
  16864. // When using this prediction mode, the parser will make correct decisions
  16865. // for all syntactically-correct grammar and input combinations. However, in
  16866. // cases where the grammar is truly ambiguous this prediction mode might not
  16867. // report a precise answer for <em>exactly which</em> alternatives are
  16868. // ambiguous.</p>
  16869. //
  16870. // <p>
  16871. // This prediction mode does not provide any guarantees for prediction
  16872. // behavior for syntactically-incorrect inputs.</p>
  16873. //
  16874. PredictionMode.LL = 1;
  16875. //
  16876. // The LL(*) prediction mode with exact ambiguity detection. In addition to
  16877. // the correctness guarantees provided by the {@link //LL} prediction mode,
  16878. // this prediction mode instructs the prediction algorithm to determine the
  16879. // complete and exact set of ambiguous alternatives for every ambiguous
  16880. // decision encountered while parsing.
  16881. //
  16882. // <p>
  16883. // This prediction mode may be used for diagnosing ambiguities during
  16884. // grammar development. Due to the performance overhead of calculating sets
  16885. // of ambiguous alternatives, this prediction mode should be avoided when
  16886. // the exact results are not necessary.</p>
  16887. //
  16888. // <p>
  16889. // This prediction mode does not provide any guarantees for prediction
  16890. // behavior for syntactically-incorrect inputs.</p>
  16891. //
  16892. PredictionMode.LL_EXACT_AMBIG_DETECTION = 2;
  16893. //
  16894. // Computes the SLL prediction termination condition.
  16895. //
  16896. // <p>
  16897. // This method computes the SLL prediction termination condition for both of
  16898. // the following cases.</p>
  16899. //
  16900. // <ul>
  16901. // <li>The usual SLL+LL fallback upon SLL conflict</li>
  16902. // <li>Pure SLL without LL fallback</li>
  16903. // </ul>
  16904. //
  16905. // <p><strong>COMBINED SLL+LL PARSING</strong></p>
  16906. //
  16907. // <p>When LL-fallback is enabled upon SLL conflict, correct predictions are
  16908. // ensured regardless of how the termination condition is computed by this
  16909. // method. Due to the substantially higher cost of LL prediction, the
  16910. // prediction should only fall back to LL when the additional lookahead
  16911. // cannot lead to a unique SLL prediction.</p>
  16912. //
  16913. // <p>Assuming combined SLL+LL parsing, an SLL configuration set with only
  16914. // conflicting subsets should fall back to full LL, even if the
  16915. // configuration sets don't resolve to the same alternative (e.g.
  16916. // {@code {1,2}} and {@code {3,4}}. If there is at least one non-conflicting
  16917. // configuration, SLL could continue with the hopes that more lookahead will
  16918. // resolve via one of those non-conflicting configurations.</p>
  16919. //
  16920. // <p>Here's the prediction termination rule them: SLL (for SLL+LL parsing)
  16921. // stops when it sees only conflicting configuration subsets. In contrast,
  16922. // full LL keeps going when there is uncertainty.</p>
  16923. //
  16924. // <p><strong>HEURISTIC</strong></p>
  16925. //
  16926. // <p>As a heuristic, we stop prediction when we see any conflicting subset
  16927. // unless we see a state that only has one alternative associated with it.
  16928. // The single-alt-state thing lets prediction continue upon rules like
  16929. // (otherwise, it would admit defeat too soon):</p>
  16930. //
  16931. // <p>{@code [12|1|[], 6|2|[], 12|2|[]]. s : (ID | ID ID?) ';' ;}</p>
  16932. //
  16933. // <p>When the ATN simulation reaches the state before {@code ';'}, it has a
  16934. // DFA state that looks like: {@code [12|1|[], 6|2|[], 12|2|[]]}. Naturally
  16935. // {@code 12|1|[]} and {@code 12|2|[]} conflict, but we cannot stop
  16936. // processing this node because alternative to has another way to continue,
  16937. // via {@code [6|2|[]]}.</p>
  16938. //
  16939. // <p>It also let's us continue for this rule:</p>
  16940. //
  16941. // <p>{@code [1|1|[], 1|2|[], 8|3|[]] a : A | A | A B ;}</p>
  16942. //
  16943. // <p>After matching input A, we reach the stop state for rule A, state 1.
  16944. // State 8 is the state right before B. Clearly alternatives 1 and 2
  16945. // conflict and no amount of further lookahead will separate the two.
  16946. // However, alternative 3 will be able to continue and so we do not stop
  16947. // working on this state. In the previous example, we're concerned with
  16948. // states associated with the conflicting alternatives. Here alt 3 is not
  16949. // associated with the conflicting configs, but since we can continue
  16950. // looking for input reasonably, don't declare the state done.</p>
  16951. //
  16952. // <p><strong>PURE SLL PARSING</strong></p>
  16953. //
  16954. // <p>To handle pure SLL parsing, all we have to do is make sure that we
  16955. // combine stack contexts for configurations that differ only by semantic
  16956. // predicate. From there, we can do the usual SLL termination heuristic.</p>
  16957. //
  16958. // <p><strong>PREDICATES IN SLL+LL PARSING</strong></p>
  16959. //
  16960. // <p>SLL decisions don't evaluate predicates until after they reach DFA stop
  16961. // states because they need to create the DFA cache that works in all
  16962. // semantic situations. In contrast, full LL evaluates predicates collected
  16963. // during start state computation so it can ignore predicates thereafter.
  16964. // This means that SLL termination detection can totally ignore semantic
  16965. // predicates.</p>
  16966. //
  16967. // <p>Implementation-wise, {@link ATNConfigSet} combines stack contexts but not
  16968. // semantic predicate contexts so we might see two configurations like the
  16969. // following.</p>
  16970. //
  16971. // <p>{@code (s, 1, x, {}), (s, 1, x', {p})}</p>
  16972. //
  16973. // <p>Before testing these configurations against others, we have to merge
  16974. // {@code x} and {@code x'} (without modifying the existing configurations).
  16975. // For example, we test {@code (x+x')==x''} when looking for conflicts in
  16976. // the following configurations.</p>
  16977. //
  16978. // <p>{@code (s, 1, x, {}), (s, 1, x', {p}), (s, 2, x'', {})}</p>
  16979. //
  16980. // <p>If the configuration set has predicates (as indicated by
  16981. // {@link ATNConfigSet//hasSemanticContext}), this algorithm makes a copy of
  16982. // the configurations to strip out all of the predicates so that a standard
  16983. // {@link ATNConfigSet} will merge everything ignoring predicates.</p>
  16984. //
  16985. PredictionMode.hasSLLConflictTerminatingPrediction = function (mode, configs) {
  16986. // Configs in rule stop states indicate reaching the end of the decision
  16987. // rule (local context) or end of start rule (full context). If all
  16988. // configs meet this condition, then none of the configurations is able
  16989. // to match additional input so we terminate prediction.
  16990. //
  16991. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  16992. return true;
  16993. }
  16994. // pure SLL mode parsing
  16995. if (mode === PredictionMode.SLL) {
  16996. // Don't bother with combining configs from different semantic
  16997. // contexts if we can fail over to full LL; costs more time
  16998. // since we'll often fail over anyway.
  16999. if (configs.hasSemanticContext) {
  17000. // dup configs, tossing out semantic predicates
  17001. var dup = new ATNConfigSet();
  17002. for (var i = 0; i < configs.items.length; i++) {
  17003. var c = configs.items[i];
  17004. c = new ATNConfig({ semanticContext: SemanticContext.NONE }, c);
  17005. dup.add(c);
  17006. }
  17007. configs = dup;
  17008. }
  17009. // now we have combined contexts for configs with dissimilar preds
  17010. }
  17011. // pure SLL or combined SLL+LL mode parsing
  17012. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  17013. return PredictionMode.hasConflictingAltSet(altsets) && !PredictionMode.hasStateAssociatedWithOneAlt(configs);
  17014. };
  17015. // Checks if any configuration in {@code configs} is in a
  17016. // {@link RuleStopState}. Configurations meeting this condition have reached
  17017. // the end of the decision rule (local context) or end of start rule (full
  17018. // context).
  17019. //
  17020. // @param configs the configuration set to test
  17021. // @return {@code true} if any configuration in {@code configs} is in a
  17022. // {@link RuleStopState}, otherwise {@code false}
  17023. PredictionMode.hasConfigInRuleStopState = function (configs) {
  17024. for (var i = 0; i < configs.items.length; i++) {
  17025. var c = configs.items[i];
  17026. if (c.state instanceof RuleStopState) {
  17027. return true;
  17028. }
  17029. }
  17030. return false;
  17031. };
  17032. // Checks if all configurations in {@code configs} are in a
  17033. // {@link RuleStopState}. Configurations meeting this condition have reached
  17034. // the end of the decision rule (local context) or end of start rule (full
  17035. // context).
  17036. //
  17037. // @param configs the configuration set to test
  17038. // @return {@code true} if all configurations in {@code configs} are in a
  17039. // {@link RuleStopState}, otherwise {@code false}
  17040. PredictionMode.allConfigsInRuleStopStates = function (configs) {
  17041. for (var i = 0; i < configs.items.length; i++) {
  17042. var c = configs.items[i];
  17043. if (!(c.state instanceof RuleStopState)) {
  17044. return false;
  17045. }
  17046. }
  17047. return true;
  17048. };
  17049. //
  17050. // Full LL prediction termination.
  17051. //
  17052. // <p>Can we stop looking ahead during ATN simulation or is there some
  17053. // uncertainty as to which alternative we will ultimately pick, after
  17054. // consuming more input? Even if there are partial conflicts, we might know
  17055. // that everything is going to resolve to the same minimum alternative. That
  17056. // means we can stop since no more lookahead will change that fact. On the
  17057. // other hand, there might be multiple conflicts that resolve to different
  17058. // minimums. That means we need more look ahead to decide which of those
  17059. // alternatives we should predict.</p>
  17060. //
  17061. // <p>The basic idea is to split the set of configurations {@code C}, into
  17062. // conflicting subsets {@code (s, _, ctx, _)} and singleton subsets with
  17063. // non-conflicting configurations. Two configurations conflict if they have
  17064. // identical {@link ATNConfig//state} and {@link ATNConfig//context} values
  17065. // but different {@link ATNConfig//alt} value, e.g. {@code (s, i, ctx, _)}
  17066. // and {@code (s, j, ctx, _)} for {@code i!=j}.</p>
  17067. //
  17068. // <p>Reduce these configuration subsets to the set of possible alternatives.
  17069. // You can compute the alternative subsets in one pass as follows:</p>
  17070. //
  17071. // <p>{@code A_s,ctx = {i | (s, i, ctx, _)}} for each configuration in
  17072. // {@code C} holding {@code s} and {@code ctx} fixed.</p>
  17073. //
  17074. // <p>Or in pseudo-code, for each configuration {@code c} in {@code C}:</p>
  17075. //
  17076. // <pre>
  17077. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  17078. // alt and not pred
  17079. // </pre>
  17080. //
  17081. // <p>The values in {@code map} are the set of {@code A_s,ctx} sets.</p>
  17082. //
  17083. // <p>If {@code |A_s,ctx|=1} then there is no conflict associated with
  17084. // {@code s} and {@code ctx}.</p>
  17085. //
  17086. // <p>Reduce the subsets to singletons by choosing a minimum of each subset. If
  17087. // the union of these alternative subsets is a singleton, then no amount of
  17088. // more lookahead will help us. We will always pick that alternative. If,
  17089. // however, there is more than one alternative, then we are uncertain which
  17090. // alternative to predict and must continue looking for resolution. We may
  17091. // or may not discover an ambiguity in the future, even if there are no
  17092. // conflicting subsets this round.</p>
  17093. //
  17094. // <p>The biggest sin is to terminate early because it means we've made a
  17095. // decision but were uncertain as to the eventual outcome. We haven't used
  17096. // enough lookahead. On the other hand, announcing a conflict too late is no
  17097. // big deal; you will still have the conflict. It's just inefficient. It
  17098. // might even look until the end of file.</p>
  17099. //
  17100. // <p>No special consideration for semantic predicates is required because
  17101. // predicates are evaluated on-the-fly for full LL prediction, ensuring that
  17102. // no configuration contains a semantic context during the termination
  17103. // check.</p>
  17104. //
  17105. // <p><strong>CONFLICTING CONFIGS</strong></p>
  17106. //
  17107. // <p>Two configurations {@code (s, i, x)} and {@code (s, j, x')}, conflict
  17108. // when {@code i!=j} but {@code x=x'}. Because we merge all
  17109. // {@code (s, i, _)} configurations together, that means that there are at
  17110. // most {@code n} configurations associated with state {@code s} for
  17111. // {@code n} possible alternatives in the decision. The merged stacks
  17112. // complicate the comparison of configuration contexts {@code x} and
  17113. // {@code x'}. Sam checks to see if one is a subset of the other by calling
  17114. // merge and checking to see if the merged result is either {@code x} or
  17115. // {@code x'}. If the {@code x} associated with lowest alternative {@code i}
  17116. // is the superset, then {@code i} is the only possible prediction since the
  17117. // others resolve to {@code min(i)} as well. However, if {@code x} is
  17118. // associated with {@code j>i} then at least one stack configuration for
  17119. // {@code j} is not in conflict with alternative {@code i}. The algorithm
  17120. // should keep going, looking for more lookahead due to the uncertainty.</p>
  17121. //
  17122. // <p>For simplicity, I'm doing a equality check between {@code x} and
  17123. // {@code x'} that lets the algorithm continue to consume lookahead longer
  17124. // than necessary. The reason I like the equality is of course the
  17125. // simplicity but also because that is the test you need to detect the
  17126. // alternatives that are actually in conflict.</p>
  17127. //
  17128. // <p><strong>CONTINUE/STOP RULE</strong></p>
  17129. //
  17130. // <p>Continue if union of resolved alternative sets from non-conflicting and
  17131. // conflicting alternative subsets has more than one alternative. We are
  17132. // uncertain about which alternative to predict.</p>
  17133. //
  17134. // <p>The complete set of alternatives, {@code [i for (_,i,_)]}, tells us which
  17135. // alternatives are still in the running for the amount of input we've
  17136. // consumed at this point. The conflicting sets let us to strip away
  17137. // configurations that won't lead to more states because we resolve
  17138. // conflicts to the configuration with a minimum alternate for the
  17139. // conflicting set.</p>
  17140. //
  17141. // <p><strong>CASES</strong></p>
  17142. //
  17143. // <ul>
  17144. //
  17145. // <li>no conflicts and more than 1 alternative in set =&gt; continue</li>
  17146. //
  17147. // <li> {@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s, 3, z)},
  17148. // {@code (s', 1, y)}, {@code (s', 2, y)} yields non-conflicting set
  17149. // {@code {3}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  17150. // {@code {1,3}} =&gt; continue
  17151. // </li>
  17152. //
  17153. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  17154. // {@code (s', 2, y)}, {@code (s'', 1, z)} yields non-conflicting set
  17155. // {@code {1}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  17156. // {@code {1}} =&gt; stop and predict 1</li>
  17157. //
  17158. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  17159. // {@code (s', 2, y)} yields conflicting, reduced sets {@code {1}} U
  17160. // {@code {1}} = {@code {1}} =&gt; stop and predict 1, can announce
  17161. // ambiguity {@code {1,2}}</li>
  17162. //
  17163. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 2, y)},
  17164. // {@code (s', 3, y)} yields conflicting, reduced sets {@code {1}} U
  17165. // {@code {2}} = {@code {1,2}} =&gt; continue</li>
  17166. //
  17167. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 3, y)},
  17168. // {@code (s', 4, y)} yields conflicting, reduced sets {@code {1}} U
  17169. // {@code {3}} = {@code {1,3}} =&gt; continue</li>
  17170. //
  17171. // </ul>
  17172. //
  17173. // <p><strong>EXACT AMBIGUITY DETECTION</strong></p>
  17174. //
  17175. // <p>If all states report the same conflicting set of alternatives, then we
  17176. // know we have the exact ambiguity set.</p>
  17177. //
  17178. // <p><code>|A_<em>i</em>|&gt;1</code> and
  17179. // <code>A_<em>i</em> = A_<em>j</em></code> for all <em>i</em>, <em>j</em>.</p>
  17180. //
  17181. // <p>In other words, we continue examining lookahead until all {@code A_i}
  17182. // have more than one alternative and all {@code A_i} are the same. If
  17183. // {@code A={{1,2}, {1,3}}}, then regular LL prediction would terminate
  17184. // because the resolved set is {@code {1}}. To determine what the real
  17185. // ambiguity is, we have to know whether the ambiguity is between one and
  17186. // two or one and three so we keep going. We can only stop prediction when
  17187. // we need exact ambiguity detection when the sets look like
  17188. // {@code A={{1,2}}} or {@code {{1,2},{1,2}}}, etc...</p>
  17189. //
  17190. PredictionMode.resolvesToJustOneViableAlt = function (altsets) {
  17191. return PredictionMode.getSingleViableAlt(altsets);
  17192. };
  17193. //
  17194. // Determines if every alternative subset in {@code altsets} contains more
  17195. // than one alternative.
  17196. //
  17197. // @param altsets a collection of alternative subsets
  17198. // @return {@code true} if every {@link BitSet} in {@code altsets} has
  17199. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  17200. //
  17201. PredictionMode.allSubsetsConflict = function (altsets) {
  17202. return !PredictionMode.hasNonConflictingAltSet(altsets);
  17203. };
  17204. //
  17205. // Determines if any single alternative subset in {@code altsets} contains
  17206. // exactly one alternative.
  17207. //
  17208. // @param altsets a collection of alternative subsets
  17209. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  17210. // {@link BitSet//cardinality cardinality} 1, otherwise {@code false}
  17211. //
  17212. PredictionMode.hasNonConflictingAltSet = function (altsets) {
  17213. for (var i = 0; i < altsets.length; i++) {
  17214. var alts = altsets[i];
  17215. if (alts.length === 1) {
  17216. return true;
  17217. }
  17218. }
  17219. return false;
  17220. };
  17221. //
  17222. // Determines if any single alternative subset in {@code altsets} contains
  17223. // more than one alternative.
  17224. //
  17225. // @param altsets a collection of alternative subsets
  17226. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  17227. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  17228. //
  17229. PredictionMode.hasConflictingAltSet = function (altsets) {
  17230. for (var i = 0; i < altsets.length; i++) {
  17231. var alts = altsets[i];
  17232. if (alts.length > 1) {
  17233. return true;
  17234. }
  17235. }
  17236. return false;
  17237. };
  17238. //
  17239. // Determines if every alternative subset in {@code altsets} is equivalent.
  17240. //
  17241. // @param altsets a collection of alternative subsets
  17242. // @return {@code true} if every member of {@code altsets} is equal to the
  17243. // others, otherwise {@code false}
  17244. //
  17245. PredictionMode.allSubsetsEqual = function (altsets) {
  17246. var first = null;
  17247. for (var i = 0; i < altsets.length; i++) {
  17248. var alts = altsets[i];
  17249. if (first === null) {
  17250. first = alts;
  17251. } else if (alts !== first) {
  17252. return false;
  17253. }
  17254. }
  17255. return true;
  17256. };
  17257. //
  17258. // Returns the unique alternative predicted by all alternative subsets in
  17259. // {@code altsets}. If no such alternative exists, this method returns
  17260. // {@link ATN//INVALID_ALT_NUMBER}.
  17261. //
  17262. // @param altsets a collection of alternative subsets
  17263. //
  17264. PredictionMode.getUniqueAlt = function (altsets) {
  17265. var all = PredictionMode.getAlts(altsets);
  17266. if (all.length === 1) {
  17267. return all.minValue();
  17268. } else {
  17269. return ATN.INVALID_ALT_NUMBER;
  17270. }
  17271. };
  17272. // Gets the complete set of represented alternatives for a collection of
  17273. // alternative subsets. This method returns the union of each {@link BitSet}
  17274. // in {@code altsets}.
  17275. //
  17276. // @param altsets a collection of alternative subsets
  17277. // @return the set of represented alternatives in {@code altsets}
  17278. //
  17279. PredictionMode.getAlts = function (altsets) {
  17280. var all = new BitSet();
  17281. altsets.map(function (alts) {
  17282. all.or(alts);
  17283. });
  17284. return all;
  17285. };
  17286. //
  17287. // This function gets the conflicting alt subsets from a configuration set.
  17288. // For each configuration {@code c} in {@code configs}:
  17289. //
  17290. // <pre>
  17291. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  17292. // alt and not pred
  17293. // </pre>
  17294. PredictionMode.getConflictingAltSubsets = function (configs) {
  17295. var configToAlts = new Map();
  17296. configToAlts.hashFunction = function (cfg) {
  17297. hashStuff(cfg.state.stateNumber, cfg.context);
  17298. };
  17299. configToAlts.equalsFunction = function (c1, c2) {
  17300. return c1.state.stateNumber == c2.state.stateNumber && c1.context.equals(c2.context);
  17301. };
  17302. configs.items.map(function (cfg) {
  17303. var alts = configToAlts.get(cfg);
  17304. if (alts === null) {
  17305. alts = new BitSet();
  17306. configToAlts.put(cfg, alts);
  17307. }
  17308. alts.add(cfg.alt);
  17309. });
  17310. return configToAlts.getValues();
  17311. };
  17312. //
  17313. // Get a map from state to alt subset from a configuration set. For each
  17314. // configuration {@code c} in {@code configs}:
  17315. //
  17316. // <pre>
  17317. // map[c.{@link ATNConfig//state state}] U= c.{@link ATNConfig//alt alt}
  17318. // </pre>
  17319. //
  17320. PredictionMode.getStateToAltMap = function (configs) {
  17321. var m = new AltDict();
  17322. configs.items.map(function (c) {
  17323. var alts = m.get(c.state);
  17324. if (alts === null) {
  17325. alts = new BitSet();
  17326. m.put(c.state, alts);
  17327. }
  17328. alts.add(c.alt);
  17329. });
  17330. return m;
  17331. };
  17332. PredictionMode.hasStateAssociatedWithOneAlt = function (configs) {
  17333. var values = PredictionMode.getStateToAltMap(configs).values();
  17334. for (var i = 0; i < values.length; i++) {
  17335. if (values[i].length === 1) {
  17336. return true;
  17337. }
  17338. }
  17339. return false;
  17340. };
  17341. PredictionMode.getSingleViableAlt = function (altsets) {
  17342. var result = null;
  17343. for (var i = 0; i < altsets.length; i++) {
  17344. var alts = altsets[i];
  17345. var minAlt = alts.minValue();
  17346. if (result === null) {
  17347. result = minAlt;
  17348. } else if (result !== minAlt) {
  17349. // more than 1 viable alt
  17350. return ATN.INVALID_ALT_NUMBER;
  17351. }
  17352. }
  17353. return result;
  17354. };
  17355. exports.PredictionMode = PredictionMode;
  17356. /***/ }),
  17357. /***/ "./node_modules/antlr4/atn/SemanticContext.js":
  17358. /*!****************************************************!*\
  17359. !*** ./node_modules/antlr4/atn/SemanticContext.js ***!
  17360. \****************************************************/
  17361. /*! no static exports found */
  17362. /***/ (function(module, exports, __webpack_require__) {
  17363. "use strict";
  17364. //
  17365. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  17366. * Use of this file is governed by the BSD 3-clause license that
  17367. * can be found in the LICENSE.txt file in the project root.
  17368. */
  17369. //
  17370. // A tree structure used to record the semantic context in which
  17371. // an ATN configuration is valid. It's either a single predicate,
  17372. // a conjunction {@code p1&&p2}, or a sum of products {@code p1||p2}.
  17373. //
  17374. // <p>I have scoped the {@link AND}, {@link OR}, and {@link Predicate} subclasses of
  17375. // {@link SemanticContext} within the scope of this outer class.</p>
  17376. //
  17377. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  17378. var Hash = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  17379. function SemanticContext() {
  17380. return this;
  17381. }
  17382. SemanticContext.prototype.hashCode = function () {
  17383. var hash = new Hash();
  17384. this.updateHashCode(hash);
  17385. return hash.finish();
  17386. };
  17387. // For context independent predicates, we evaluate them without a local
  17388. // context (i.e., null context). That way, we can evaluate them without
  17389. // having to create proper rule-specific context during prediction (as
  17390. // opposed to the parser, which creates them naturally). In a practical
  17391. // sense, this avoids a cast exception from RuleContext to myruleContext.
  17392. //
  17393. // <p>For context dependent predicates, we must pass in a local context so that
  17394. // references such as $arg evaluate properly as _localctx.arg. We only
  17395. // capture context dependent predicates in the context in which we begin
  17396. // prediction, so we passed in the outer context here in case of context
  17397. // dependent predicate evaluation.</p>
  17398. //
  17399. SemanticContext.prototype.evaluate = function (parser, outerContext) {};
  17400. //
  17401. // Evaluate the precedence predicates for the context and reduce the result.
  17402. //
  17403. // @param parser The parser instance.
  17404. // @param outerContext The current parser context object.
  17405. // @return The simplified semantic context after precedence predicates are
  17406. // evaluated, which will be one of the following values.
  17407. // <ul>
  17408. // <li>{@link //NONE}: if the predicate simplifies to {@code true} after
  17409. // precedence predicates are evaluated.</li>
  17410. // <li>{@code null}: if the predicate simplifies to {@code false} after
  17411. // precedence predicates are evaluated.</li>
  17412. // <li>{@code this}: if the semantic context is not changed as a result of
  17413. // precedence predicate evaluation.</li>
  17414. // <li>A non-{@code null} {@link SemanticContext}: the new simplified
  17415. // semantic context after precedence predicates are evaluated.</li>
  17416. // </ul>
  17417. //
  17418. SemanticContext.prototype.evalPrecedence = function (parser, outerContext) {
  17419. return this;
  17420. };
  17421. SemanticContext.andContext = function (a, b) {
  17422. if (a === null || a === SemanticContext.NONE) {
  17423. return b;
  17424. }
  17425. if (b === null || b === SemanticContext.NONE) {
  17426. return a;
  17427. }
  17428. var result = new AND(a, b);
  17429. if (result.opnds.length === 1) {
  17430. return result.opnds[0];
  17431. } else {
  17432. return result;
  17433. }
  17434. };
  17435. SemanticContext.orContext = function (a, b) {
  17436. if (a === null) {
  17437. return b;
  17438. }
  17439. if (b === null) {
  17440. return a;
  17441. }
  17442. if (a === SemanticContext.NONE || b === SemanticContext.NONE) {
  17443. return SemanticContext.NONE;
  17444. }
  17445. var result = new OR(a, b);
  17446. if (result.opnds.length === 1) {
  17447. return result.opnds[0];
  17448. } else {
  17449. return result;
  17450. }
  17451. };
  17452. function Predicate(ruleIndex, predIndex, isCtxDependent) {
  17453. SemanticContext.call(this);
  17454. this.ruleIndex = ruleIndex === undefined ? -1 : ruleIndex;
  17455. this.predIndex = predIndex === undefined ? -1 : predIndex;
  17456. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  17457. return this;
  17458. }
  17459. Predicate.prototype = Object.create(SemanticContext.prototype);
  17460. Predicate.prototype.constructor = Predicate;
  17461. //The default {@link SemanticContext}, which is semantically equivalent to
  17462. //a predicate of the form {@code {true}?}.
  17463. //
  17464. SemanticContext.NONE = new Predicate();
  17465. Predicate.prototype.evaluate = function (parser, outerContext) {
  17466. var localctx = this.isCtxDependent ? outerContext : null;
  17467. return parser.sempred(localctx, this.ruleIndex, this.predIndex);
  17468. };
  17469. Predicate.prototype.updateHashCode = function (hash) {
  17470. hash.update(this.ruleIndex, this.predIndex, this.isCtxDependent);
  17471. };
  17472. Predicate.prototype.equals = function (other) {
  17473. if (this === other) {
  17474. return true;
  17475. } else if (!(other instanceof Predicate)) {
  17476. return false;
  17477. } else {
  17478. return this.ruleIndex === other.ruleIndex && this.predIndex === other.predIndex && this.isCtxDependent === other.isCtxDependent;
  17479. }
  17480. };
  17481. Predicate.prototype.toString = function () {
  17482. return "{" + this.ruleIndex + ":" + this.predIndex + "}?";
  17483. };
  17484. function PrecedencePredicate(precedence) {
  17485. SemanticContext.call(this);
  17486. this.precedence = precedence === undefined ? 0 : precedence;
  17487. }
  17488. PrecedencePredicate.prototype = Object.create(SemanticContext.prototype);
  17489. PrecedencePredicate.prototype.constructor = PrecedencePredicate;
  17490. PrecedencePredicate.prototype.evaluate = function (parser, outerContext) {
  17491. return parser.precpred(outerContext, this.precedence);
  17492. };
  17493. PrecedencePredicate.prototype.evalPrecedence = function (parser, outerContext) {
  17494. if (parser.precpred(outerContext, this.precedence)) {
  17495. return SemanticContext.NONE;
  17496. } else {
  17497. return null;
  17498. }
  17499. };
  17500. PrecedencePredicate.prototype.compareTo = function (other) {
  17501. return this.precedence - other.precedence;
  17502. };
  17503. PrecedencePredicate.prototype.updateHashCode = function (hash) {
  17504. hash.update(31);
  17505. };
  17506. PrecedencePredicate.prototype.equals = function (other) {
  17507. if (this === other) {
  17508. return true;
  17509. } else if (!(other instanceof PrecedencePredicate)) {
  17510. return false;
  17511. } else {
  17512. return this.precedence === other.precedence;
  17513. }
  17514. };
  17515. PrecedencePredicate.prototype.toString = function () {
  17516. return "{" + this.precedence + ">=prec}?";
  17517. };
  17518. PrecedencePredicate.filterPrecedencePredicates = function (set) {
  17519. var result = [];
  17520. set.values().map(function (context) {
  17521. if (context instanceof PrecedencePredicate) {
  17522. result.push(context);
  17523. }
  17524. });
  17525. return result;
  17526. };
  17527. // A semantic context which is true whenever none of the contained contexts
  17528. // is false.
  17529. //
  17530. function AND(a, b) {
  17531. SemanticContext.call(this);
  17532. var operands = new Set();
  17533. if (a instanceof AND) {
  17534. a.opnds.map(function (o) {
  17535. operands.add(o);
  17536. });
  17537. } else {
  17538. operands.add(a);
  17539. }
  17540. if (b instanceof AND) {
  17541. b.opnds.map(function (o) {
  17542. operands.add(o);
  17543. });
  17544. } else {
  17545. operands.add(b);
  17546. }
  17547. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  17548. if (precedencePredicates.length > 0) {
  17549. // interested in the transition with the lowest precedence
  17550. var reduced = null;
  17551. precedencePredicates.map(function (p) {
  17552. if (reduced === null || p.precedence < reduced.precedence) {
  17553. reduced = p;
  17554. }
  17555. });
  17556. operands.add(reduced);
  17557. }
  17558. this.opnds = operands.values();
  17559. return this;
  17560. }
  17561. AND.prototype = Object.create(SemanticContext.prototype);
  17562. AND.prototype.constructor = AND;
  17563. AND.prototype.equals = function (other) {
  17564. if (this === other) {
  17565. return true;
  17566. } else if (!(other instanceof AND)) {
  17567. return false;
  17568. } else {
  17569. return this.opnds === other.opnds;
  17570. }
  17571. };
  17572. AND.prototype.updateHashCode = function (hash) {
  17573. hash.update(this.opnds, "AND");
  17574. };
  17575. //
  17576. // {@inheritDoc}
  17577. //
  17578. // <p>
  17579. // The evaluation of predicates by this context is short-circuiting, but
  17580. // unordered.</p>
  17581. //
  17582. AND.prototype.evaluate = function (parser, outerContext) {
  17583. for (var i = 0; i < this.opnds.length; i++) {
  17584. if (!this.opnds[i].evaluate(parser, outerContext)) {
  17585. return false;
  17586. }
  17587. }
  17588. return true;
  17589. };
  17590. AND.prototype.evalPrecedence = function (parser, outerContext) {
  17591. var differs = false;
  17592. var operands = [];
  17593. for (var i = 0; i < this.opnds.length; i++) {
  17594. var context = this.opnds[i];
  17595. var evaluated = context.evalPrecedence(parser, outerContext);
  17596. differs |= evaluated !== context;
  17597. if (evaluated === null) {
  17598. // The AND context is false if any element is false
  17599. return null;
  17600. } else if (evaluated !== SemanticContext.NONE) {
  17601. // Reduce the result by skipping true elements
  17602. operands.push(evaluated);
  17603. }
  17604. }
  17605. if (!differs) {
  17606. return this;
  17607. }
  17608. if (operands.length === 0) {
  17609. // all elements were true, so the AND context is true
  17610. return SemanticContext.NONE;
  17611. }
  17612. var result = null;
  17613. operands.map(function (o) {
  17614. result = result === null ? o : SemanticContext.andContext(result, o);
  17615. });
  17616. return result;
  17617. };
  17618. AND.prototype.toString = function () {
  17619. var s = "";
  17620. this.opnds.map(function (o) {
  17621. s += "&& " + o.toString();
  17622. });
  17623. return s.length > 3 ? s.slice(3) : s;
  17624. };
  17625. //
  17626. // A semantic context which is true whenever at least one of the contained
  17627. // contexts is true.
  17628. //
  17629. function OR(a, b) {
  17630. SemanticContext.call(this);
  17631. var operands = new Set();
  17632. if (a instanceof OR) {
  17633. a.opnds.map(function (o) {
  17634. operands.add(o);
  17635. });
  17636. } else {
  17637. operands.add(a);
  17638. }
  17639. if (b instanceof OR) {
  17640. b.opnds.map(function (o) {
  17641. operands.add(o);
  17642. });
  17643. } else {
  17644. operands.add(b);
  17645. }
  17646. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  17647. if (precedencePredicates.length > 0) {
  17648. // interested in the transition with the highest precedence
  17649. var s = precedencePredicates.sort(function (a, b) {
  17650. return a.compareTo(b);
  17651. });
  17652. var reduced = s[s.length - 1];
  17653. operands.add(reduced);
  17654. }
  17655. this.opnds = operands.values();
  17656. return this;
  17657. }
  17658. OR.prototype = Object.create(SemanticContext.prototype);
  17659. OR.prototype.constructor = OR;
  17660. OR.prototype.constructor = function (other) {
  17661. if (this === other) {
  17662. return true;
  17663. } else if (!(other instanceof OR)) {
  17664. return false;
  17665. } else {
  17666. return this.opnds === other.opnds;
  17667. }
  17668. };
  17669. OR.prototype.updateHashCode = function (hash) {
  17670. hash.update(this.opnds, "OR");
  17671. };
  17672. // <p>
  17673. // The evaluation of predicates by this context is short-circuiting, but
  17674. // unordered.</p>
  17675. //
  17676. OR.prototype.evaluate = function (parser, outerContext) {
  17677. for (var i = 0; i < this.opnds.length; i++) {
  17678. if (this.opnds[i].evaluate(parser, outerContext)) {
  17679. return true;
  17680. }
  17681. }
  17682. return false;
  17683. };
  17684. OR.prototype.evalPrecedence = function (parser, outerContext) {
  17685. var differs = false;
  17686. var operands = [];
  17687. for (var i = 0; i < this.opnds.length; i++) {
  17688. var context = this.opnds[i];
  17689. var evaluated = context.evalPrecedence(parser, outerContext);
  17690. differs |= evaluated !== context;
  17691. if (evaluated === SemanticContext.NONE) {
  17692. // The OR context is true if any element is true
  17693. return SemanticContext.NONE;
  17694. } else if (evaluated !== null) {
  17695. // Reduce the result by skipping false elements
  17696. operands.push(evaluated);
  17697. }
  17698. }
  17699. if (!differs) {
  17700. return this;
  17701. }
  17702. if (operands.length === 0) {
  17703. // all elements were false, so the OR context is false
  17704. return null;
  17705. }
  17706. var result = null;
  17707. operands.map(function (o) {
  17708. return result === null ? o : SemanticContext.orContext(result, o);
  17709. });
  17710. return result;
  17711. };
  17712. OR.prototype.toString = function () {
  17713. var s = "";
  17714. this.opnds.map(function (o) {
  17715. s += "|| " + o.toString();
  17716. });
  17717. return s.length > 3 ? s.slice(3) : s;
  17718. };
  17719. exports.SemanticContext = SemanticContext;
  17720. exports.PrecedencePredicate = PrecedencePredicate;
  17721. exports.Predicate = Predicate;
  17722. /***/ }),
  17723. /***/ "./node_modules/antlr4/atn/Transition.js":
  17724. /*!***********************************************!*\
  17725. !*** ./node_modules/antlr4/atn/Transition.js ***!
  17726. \***********************************************/
  17727. /*! no static exports found */
  17728. /***/ (function(module, exports, __webpack_require__) {
  17729. "use strict";
  17730. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  17731. * Use of this file is governed by the BSD 3-clause license that
  17732. * can be found in the LICENSE.txt file in the project root.
  17733. */
  17734. //
  17735. // An ATN transition between any two ATN states. Subclasses define
  17736. // atom, set, epsilon, action, predicate, rule transitions.
  17737. //
  17738. // <p>This is a one way link. It emanates from a state (usually via a list of
  17739. // transitions) and has a target state.</p>
  17740. //
  17741. // <p>Since we never have to change the ATN transitions once we construct it,
  17742. // we can fix these transitions as specific classes. The DFA transitions
  17743. // on the other hand need to update the labels as it adds transitions to
  17744. // the states. We'll use the term Edge for the DFA to distinguish them from
  17745. // ATN transitions.</p>
  17746. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  17747. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  17748. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  17749. var Predicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").Predicate;
  17750. var PrecedencePredicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").PrecedencePredicate;
  17751. function Transition(target) {
  17752. // The target of this transition.
  17753. if (target === undefined || target === null) {
  17754. throw "target cannot be null.";
  17755. }
  17756. this.target = target;
  17757. // Are we epsilon, action, sempred?
  17758. this.isEpsilon = false;
  17759. this.label = null;
  17760. return this;
  17761. }
  17762. // constants for serialization
  17763. Transition.EPSILON = 1;
  17764. Transition.RANGE = 2;
  17765. Transition.RULE = 3;
  17766. Transition.PREDICATE = 4; // e.g., {isType(input.LT(1))}?
  17767. Transition.ATOM = 5;
  17768. Transition.ACTION = 6;
  17769. Transition.SET = 7; // ~(A|B) or ~atom, wildcard, which convert to next 2
  17770. Transition.NOT_SET = 8;
  17771. Transition.WILDCARD = 9;
  17772. Transition.PRECEDENCE = 10;
  17773. Transition.serializationNames = ["INVALID", "EPSILON", "RANGE", "RULE", "PREDICATE", "ATOM", "ACTION", "SET", "NOT_SET", "WILDCARD", "PRECEDENCE"];
  17774. Transition.serializationTypes = {
  17775. EpsilonTransition: Transition.EPSILON,
  17776. RangeTransition: Transition.RANGE,
  17777. RuleTransition: Transition.RULE,
  17778. PredicateTransition: Transition.PREDICATE,
  17779. AtomTransition: Transition.ATOM,
  17780. ActionTransition: Transition.ACTION,
  17781. SetTransition: Transition.SET,
  17782. NotSetTransition: Transition.NOT_SET,
  17783. WildcardTransition: Transition.WILDCARD,
  17784. PrecedencePredicateTransition: Transition.PRECEDENCE
  17785. };
  17786. // TODO: make all transitions sets? no, should remove set edges
  17787. function AtomTransition(target, label) {
  17788. Transition.call(this, target);
  17789. this.label_ = label; // The token type or character value; or, signifies special label.
  17790. this.label = this.makeLabel();
  17791. this.serializationType = Transition.ATOM;
  17792. return this;
  17793. }
  17794. AtomTransition.prototype = Object.create(Transition.prototype);
  17795. AtomTransition.prototype.constructor = AtomTransition;
  17796. AtomTransition.prototype.makeLabel = function () {
  17797. var s = new IntervalSet();
  17798. s.addOne(this.label_);
  17799. return s;
  17800. };
  17801. AtomTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  17802. return this.label_ === symbol;
  17803. };
  17804. AtomTransition.prototype.toString = function () {
  17805. return this.label_;
  17806. };
  17807. function RuleTransition(ruleStart, ruleIndex, precedence, followState) {
  17808. Transition.call(this, ruleStart);
  17809. this.ruleIndex = ruleIndex; // ptr to the rule definition object for this rule ref
  17810. this.precedence = precedence;
  17811. this.followState = followState; // what node to begin computations following ref to rule
  17812. this.serializationType = Transition.RULE;
  17813. this.isEpsilon = true;
  17814. return this;
  17815. }
  17816. RuleTransition.prototype = Object.create(Transition.prototype);
  17817. RuleTransition.prototype.constructor = RuleTransition;
  17818. RuleTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  17819. return false;
  17820. };
  17821. function EpsilonTransition(target, outermostPrecedenceReturn) {
  17822. Transition.call(this, target);
  17823. this.serializationType = Transition.EPSILON;
  17824. this.isEpsilon = true;
  17825. this.outermostPrecedenceReturn = outermostPrecedenceReturn;
  17826. return this;
  17827. }
  17828. EpsilonTransition.prototype = Object.create(Transition.prototype);
  17829. EpsilonTransition.prototype.constructor = EpsilonTransition;
  17830. EpsilonTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  17831. return false;
  17832. };
  17833. EpsilonTransition.prototype.toString = function () {
  17834. return "epsilon";
  17835. };
  17836. function RangeTransition(target, start, stop) {
  17837. Transition.call(this, target);
  17838. this.serializationType = Transition.RANGE;
  17839. this.start = start;
  17840. this.stop = stop;
  17841. this.label = this.makeLabel();
  17842. return this;
  17843. }
  17844. RangeTransition.prototype = Object.create(Transition.prototype);
  17845. RangeTransition.prototype.constructor = RangeTransition;
  17846. RangeTransition.prototype.makeLabel = function () {
  17847. var s = new IntervalSet();
  17848. s.addRange(this.start, this.stop);
  17849. return s;
  17850. };
  17851. RangeTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  17852. return symbol >= this.start && symbol <= this.stop;
  17853. };
  17854. RangeTransition.prototype.toString = function () {
  17855. return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'";
  17856. };
  17857. function AbstractPredicateTransition(target) {
  17858. Transition.call(this, target);
  17859. return this;
  17860. }
  17861. AbstractPredicateTransition.prototype = Object.create(Transition.prototype);
  17862. AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition;
  17863. function PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
  17864. AbstractPredicateTransition.call(this, target);
  17865. this.serializationType = Transition.PREDICATE;
  17866. this.ruleIndex = ruleIndex;
  17867. this.predIndex = predIndex;
  17868. this.isCtxDependent = isCtxDependent; // e.g., $i ref in pred
  17869. this.isEpsilon = true;
  17870. return this;
  17871. }
  17872. PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  17873. PredicateTransition.prototype.constructor = PredicateTransition;
  17874. PredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  17875. return false;
  17876. };
  17877. PredicateTransition.prototype.getPredicate = function () {
  17878. return new Predicate(this.ruleIndex, this.predIndex, this.isCtxDependent);
  17879. };
  17880. PredicateTransition.prototype.toString = function () {
  17881. return "pred_" + this.ruleIndex + ":" + this.predIndex;
  17882. };
  17883. function ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
  17884. Transition.call(this, target);
  17885. this.serializationType = Transition.ACTION;
  17886. this.ruleIndex = ruleIndex;
  17887. this.actionIndex = actionIndex === undefined ? -1 : actionIndex;
  17888. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  17889. this.isEpsilon = true;
  17890. return this;
  17891. }
  17892. ActionTransition.prototype = Object.create(Transition.prototype);
  17893. ActionTransition.prototype.constructor = ActionTransition;
  17894. ActionTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  17895. return false;
  17896. };
  17897. ActionTransition.prototype.toString = function () {
  17898. return "action_" + this.ruleIndex + ":" + this.actionIndex;
  17899. };
  17900. // A transition containing a set of values.
  17901. function SetTransition(target, set) {
  17902. Transition.call(this, target);
  17903. this.serializationType = Transition.SET;
  17904. if (set !== undefined && set !== null) {
  17905. this.label = set;
  17906. } else {
  17907. this.label = new IntervalSet();
  17908. this.label.addOne(Token.INVALID_TYPE);
  17909. }
  17910. return this;
  17911. }
  17912. SetTransition.prototype = Object.create(Transition.prototype);
  17913. SetTransition.prototype.constructor = SetTransition;
  17914. SetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  17915. return this.label.contains(symbol);
  17916. };
  17917. SetTransition.prototype.toString = function () {
  17918. return this.label.toString();
  17919. };
  17920. function NotSetTransition(target, set) {
  17921. SetTransition.call(this, target, set);
  17922. this.serializationType = Transition.NOT_SET;
  17923. return this;
  17924. }
  17925. NotSetTransition.prototype = Object.create(SetTransition.prototype);
  17926. NotSetTransition.prototype.constructor = NotSetTransition;
  17927. NotSetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  17928. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol && !SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol);
  17929. };
  17930. NotSetTransition.prototype.toString = function () {
  17931. return '~' + SetTransition.prototype.toString.call(this);
  17932. };
  17933. function WildcardTransition(target) {
  17934. Transition.call(this, target);
  17935. this.serializationType = Transition.WILDCARD;
  17936. return this;
  17937. }
  17938. WildcardTransition.prototype = Object.create(Transition.prototype);
  17939. WildcardTransition.prototype.constructor = WildcardTransition;
  17940. WildcardTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  17941. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol;
  17942. };
  17943. WildcardTransition.prototype.toString = function () {
  17944. return ".";
  17945. };
  17946. function PrecedencePredicateTransition(target, precedence) {
  17947. AbstractPredicateTransition.call(this, target);
  17948. this.serializationType = Transition.PRECEDENCE;
  17949. this.precedence = precedence;
  17950. this.isEpsilon = true;
  17951. return this;
  17952. }
  17953. PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  17954. PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition;
  17955. PrecedencePredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  17956. return false;
  17957. };
  17958. PrecedencePredicateTransition.prototype.getPredicate = function () {
  17959. return new PrecedencePredicate(this.precedence);
  17960. };
  17961. PrecedencePredicateTransition.prototype.toString = function () {
  17962. return this.precedence + " >= _p";
  17963. };
  17964. exports.Transition = Transition;
  17965. exports.AtomTransition = AtomTransition;
  17966. exports.SetTransition = SetTransition;
  17967. exports.NotSetTransition = NotSetTransition;
  17968. exports.RuleTransition = RuleTransition;
  17969. exports.ActionTransition = ActionTransition;
  17970. exports.EpsilonTransition = EpsilonTransition;
  17971. exports.RangeTransition = RangeTransition;
  17972. exports.WildcardTransition = WildcardTransition;
  17973. exports.PredicateTransition = PredicateTransition;
  17974. exports.PrecedencePredicateTransition = PrecedencePredicateTransition;
  17975. exports.AbstractPredicateTransition = AbstractPredicateTransition;
  17976. /***/ }),
  17977. /***/ "./node_modules/antlr4/atn/index.js":
  17978. /*!******************************************!*\
  17979. !*** ./node_modules/antlr4/atn/index.js ***!
  17980. \******************************************/
  17981. /*! no static exports found */
  17982. /***/ (function(module, exports, __webpack_require__) {
  17983. "use strict";
  17984. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  17985. * Use of this file is governed by the BSD 3-clause license that
  17986. * can be found in the LICENSE.txt file in the project root.
  17987. */
  17988. exports.ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  17989. exports.ATNDeserializer = __webpack_require__(/*! ./ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  17990. exports.LexerATNSimulator = __webpack_require__(/*! ./LexerATNSimulator */ "./node_modules/antlr4/atn/LexerATNSimulator.js").LexerATNSimulator;
  17991. exports.ParserATNSimulator = __webpack_require__(/*! ./ParserATNSimulator */ "./node_modules/antlr4/atn/ParserATNSimulator.js").ParserATNSimulator;
  17992. exports.PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  17993. /***/ }),
  17994. /***/ "./node_modules/antlr4/dfa/DFA.js":
  17995. /*!****************************************!*\
  17996. !*** ./node_modules/antlr4/dfa/DFA.js ***!
  17997. \****************************************/
  17998. /*! no static exports found */
  17999. /***/ (function(module, exports, __webpack_require__) {
  18000. "use strict";
  18001. //
  18002. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  18003. * Use of this file is governed by the BSD 3-clause license that
  18004. * can be found in the LICENSE.txt file in the project root.
  18005. */
  18006. var Set = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Set;
  18007. var DFAState = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  18008. var StarLoopEntryState = __webpack_require__(/*! ../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  18009. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  18010. var DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  18011. var LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  18012. function DFA(atnStartState, decision) {
  18013. if (decision === undefined) {
  18014. decision = 0;
  18015. }
  18016. // From which ATN state did we create this DFA?
  18017. this.atnStartState = atnStartState;
  18018. this.decision = decision;
  18019. // A set of all DFA states. Use {@link Map} so we can get old state back
  18020. // ({@link Set} only allows you to see if it's there).
  18021. this._states = new Set();
  18022. this.s0 = null;
  18023. // {@code true} if this DFA is for a precedence decision; otherwise,
  18024. // {@code false}. This is the backing field for {@link //isPrecedenceDfa},
  18025. // {@link //setPrecedenceDfa}.
  18026. this.precedenceDfa = false;
  18027. if (atnStartState instanceof StarLoopEntryState) {
  18028. if (atnStartState.isPrecedenceDecision) {
  18029. this.precedenceDfa = true;
  18030. var precedenceState = new DFAState(null, new ATNConfigSet());
  18031. precedenceState.edges = [];
  18032. precedenceState.isAcceptState = false;
  18033. precedenceState.requiresFullContext = false;
  18034. this.s0 = precedenceState;
  18035. }
  18036. }
  18037. return this;
  18038. }
  18039. // Get the start state for a specific precedence value.
  18040. //
  18041. // @param precedence The current precedence.
  18042. // @return The start state corresponding to the specified precedence, or
  18043. // {@code null} if no start state exists for the specified precedence.
  18044. //
  18045. // @throws IllegalStateException if this is not a precedence DFA.
  18046. // @see //isPrecedenceDfa()
  18047. DFA.prototype.getPrecedenceStartState = function (precedence) {
  18048. if (!this.precedenceDfa) {
  18049. throw "Only precedence DFAs may contain a precedence start state.";
  18050. }
  18051. // s0.edges is never null for a precedence DFA
  18052. if (precedence < 0 || precedence >= this.s0.edges.length) {
  18053. return null;
  18054. }
  18055. return this.s0.edges[precedence] || null;
  18056. };
  18057. // Set the start state for a specific precedence value.
  18058. //
  18059. // @param precedence The current precedence.
  18060. // @param startState The start state corresponding to the specified
  18061. // precedence.
  18062. //
  18063. // @throws IllegalStateException if this is not a precedence DFA.
  18064. // @see //isPrecedenceDfa()
  18065. //
  18066. DFA.prototype.setPrecedenceStartState = function (precedence, startState) {
  18067. if (!this.precedenceDfa) {
  18068. throw "Only precedence DFAs may contain a precedence start state.";
  18069. }
  18070. if (precedence < 0) {
  18071. return;
  18072. }
  18073. // synchronization on s0 here is ok. when the DFA is turned into a
  18074. // precedence DFA, s0 will be initialized once and not updated again
  18075. // s0.edges is never null for a precedence DFA
  18076. this.s0.edges[precedence] = startState;
  18077. };
  18078. //
  18079. // Sets whether this is a precedence DFA. If the specified value differs
  18080. // from the current DFA configuration, the following actions are taken;
  18081. // otherwise no changes are made to the current DFA.
  18082. //
  18083. // <ul>
  18084. // <li>The {@link //states} map is cleared</li>
  18085. // <li>If {@code precedenceDfa} is {@code false}, the initial state
  18086. // {@link //s0} is set to {@code null}; otherwise, it is initialized to a new
  18087. // {@link DFAState} with an empty outgoing {@link DFAState//edges} array to
  18088. // store the start states for individual precedence values.</li>
  18089. // <li>The {@link //precedenceDfa} field is updated</li>
  18090. // </ul>
  18091. //
  18092. // @param precedenceDfa {@code true} if this is a precedence DFA; otherwise,
  18093. // {@code false}
  18094. DFA.prototype.setPrecedenceDfa = function (precedenceDfa) {
  18095. if (this.precedenceDfa !== precedenceDfa) {
  18096. this._states = new DFAStatesSet();
  18097. if (precedenceDfa) {
  18098. var precedenceState = new DFAState(null, new ATNConfigSet());
  18099. precedenceState.edges = [];
  18100. precedenceState.isAcceptState = false;
  18101. precedenceState.requiresFullContext = false;
  18102. this.s0 = precedenceState;
  18103. } else {
  18104. this.s0 = null;
  18105. }
  18106. this.precedenceDfa = precedenceDfa;
  18107. }
  18108. };
  18109. Object.defineProperty(DFA.prototype, "states", {
  18110. get: function get() {
  18111. return this._states;
  18112. }
  18113. });
  18114. // Return a list of all states in this DFA, ordered by state number.
  18115. DFA.prototype.sortedStates = function () {
  18116. var list = this._states.values();
  18117. return list.sort(function (a, b) {
  18118. return a.stateNumber - b.stateNumber;
  18119. });
  18120. };
  18121. DFA.prototype.toString = function (literalNames, symbolicNames) {
  18122. literalNames = literalNames || null;
  18123. symbolicNames = symbolicNames || null;
  18124. if (this.s0 === null) {
  18125. return "";
  18126. }
  18127. var serializer = new DFASerializer(this, literalNames, symbolicNames);
  18128. return serializer.toString();
  18129. };
  18130. DFA.prototype.toLexerString = function () {
  18131. if (this.s0 === null) {
  18132. return "";
  18133. }
  18134. var serializer = new LexerDFASerializer(this);
  18135. return serializer.toString();
  18136. };
  18137. exports.DFA = DFA;
  18138. /***/ }),
  18139. /***/ "./node_modules/antlr4/dfa/DFASerializer.js":
  18140. /*!**************************************************!*\
  18141. !*** ./node_modules/antlr4/dfa/DFASerializer.js ***!
  18142. \**************************************************/
  18143. /*! no static exports found */
  18144. /***/ (function(module, exports, __webpack_require__) {
  18145. "use strict";
  18146. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  18147. * Use of this file is governed by the BSD 3-clause license that
  18148. * can be found in the LICENSE.txt file in the project root.
  18149. */
  18150. // A DFA walker that knows how to dump them to serialized strings.#/
  18151. function DFASerializer(dfa, literalNames, symbolicNames) {
  18152. this.dfa = dfa;
  18153. this.literalNames = literalNames || [];
  18154. this.symbolicNames = symbolicNames || [];
  18155. return this;
  18156. }
  18157. DFASerializer.prototype.toString = function () {
  18158. if (this.dfa.s0 === null) {
  18159. return null;
  18160. }
  18161. var buf = "";
  18162. var states = this.dfa.sortedStates();
  18163. for (var i = 0; i < states.length; i++) {
  18164. var s = states[i];
  18165. if (s.edges !== null) {
  18166. var n = s.edges.length;
  18167. for (var j = 0; j < n; j++) {
  18168. var t = s.edges[j] || null;
  18169. if (t !== null && t.stateNumber !== 0x7FFFFFFF) {
  18170. buf = buf.concat(this.getStateString(s));
  18171. buf = buf.concat("-");
  18172. buf = buf.concat(this.getEdgeLabel(j));
  18173. buf = buf.concat("->");
  18174. buf = buf.concat(this.getStateString(t));
  18175. buf = buf.concat('\n');
  18176. }
  18177. }
  18178. }
  18179. }
  18180. return buf.length === 0 ? null : buf;
  18181. };
  18182. DFASerializer.prototype.getEdgeLabel = function (i) {
  18183. if (i === 0) {
  18184. return "EOF";
  18185. } else if (this.literalNames !== null || this.symbolicNames !== null) {
  18186. return this.literalNames[i - 1] || this.symbolicNames[i - 1];
  18187. } else {
  18188. return String.fromCharCode(i - 1);
  18189. }
  18190. };
  18191. DFASerializer.prototype.getStateString = function (s) {
  18192. var baseStateStr = (s.isAcceptState ? ":" : "") + "s" + s.stateNumber + (s.requiresFullContext ? "^" : "");
  18193. if (s.isAcceptState) {
  18194. if (s.predicates !== null) {
  18195. return baseStateStr + "=>" + s.predicates.toString();
  18196. } else {
  18197. return baseStateStr + "=>" + s.prediction.toString();
  18198. }
  18199. } else {
  18200. return baseStateStr;
  18201. }
  18202. };
  18203. function LexerDFASerializer(dfa) {
  18204. DFASerializer.call(this, dfa, null);
  18205. return this;
  18206. }
  18207. LexerDFASerializer.prototype = Object.create(DFASerializer.prototype);
  18208. LexerDFASerializer.prototype.constructor = LexerDFASerializer;
  18209. LexerDFASerializer.prototype.getEdgeLabel = function (i) {
  18210. return "'" + String.fromCharCode(i) + "'";
  18211. };
  18212. exports.DFASerializer = DFASerializer;
  18213. exports.LexerDFASerializer = LexerDFASerializer;
  18214. /***/ }),
  18215. /***/ "./node_modules/antlr4/dfa/DFAState.js":
  18216. /*!*********************************************!*\
  18217. !*** ./node_modules/antlr4/dfa/DFAState.js ***!
  18218. \*********************************************/
  18219. /*! no static exports found */
  18220. /***/ (function(module, exports, __webpack_require__) {
  18221. "use strict";
  18222. //
  18223. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  18224. * Use of this file is governed by the BSD 3-clause license that
  18225. * can be found in the LICENSE.txt file in the project root.
  18226. */
  18227. ///
  18228. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  18229. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  18230. var Hash = Utils.Hash;
  18231. var Set = Utils.Set;
  18232. // Map a predicate to a predicted alternative.///
  18233. function PredPrediction(pred, alt) {
  18234. this.alt = alt;
  18235. this.pred = pred;
  18236. return this;
  18237. }
  18238. PredPrediction.prototype.toString = function () {
  18239. return "(" + this.pred + ", " + this.alt + ")";
  18240. };
  18241. // A DFA state represents a set of possible ATN configurations.
  18242. // As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
  18243. // to keep track of all possible states the ATN can be in after
  18244. // reading each input symbol. That is to say, after reading
  18245. // input a1a2..an, the DFA is in a state that represents the
  18246. // subset T of the states of the ATN that are reachable from the
  18247. // ATN's start state along some path labeled a1a2..an."
  18248. // In conventional NFA&rarr;DFA conversion, therefore, the subset T
  18249. // would be a bitset representing the set of states the
  18250. // ATN could be in. We need to track the alt predicted by each
  18251. // state as well, however. More importantly, we need to maintain
  18252. // a stack of states, tracking the closure operations as they
  18253. // jump from rule to rule, emulating rule invocations (method calls).
  18254. // I have to add a stack to simulate the proper lookahead sequences for
  18255. // the underlying LL grammar from which the ATN was derived.
  18256. //
  18257. // <p>I use a set of ATNConfig objects not simple states. An ATNConfig
  18258. // is both a state (ala normal conversion) and a RuleContext describing
  18259. // the chain of rules (if any) followed to arrive at that state.</p>
  18260. //
  18261. // <p>A DFA state may have multiple references to a particular state,
  18262. // but with different ATN contexts (with same or different alts)
  18263. // meaning that state was reached via a different set of rule invocations.</p>
  18264. // /
  18265. function DFAState(stateNumber, configs) {
  18266. if (stateNumber === null) {
  18267. stateNumber = -1;
  18268. }
  18269. if (configs === null) {
  18270. configs = new ATNConfigSet();
  18271. }
  18272. this.stateNumber = stateNumber;
  18273. this.configs = configs;
  18274. // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)
  18275. // {@link Token//EOF} maps to {@code edges[0]}.
  18276. this.edges = null;
  18277. this.isAcceptState = false;
  18278. // if accept state, what ttype do we match or alt do we predict?
  18279. // This is set to {@link ATN//INVALID_ALT_NUMBER} when {@link
  18280. // //predicates}{@code !=null} or
  18281. // {@link //requiresFullContext}.
  18282. this.prediction = 0;
  18283. this.lexerActionExecutor = null;
  18284. // Indicates that this state was created during SLL prediction that
  18285. // discovered a conflict between the configurations in the state. Future
  18286. // {@link ParserATNSimulator//execATN} invocations immediately jumped doing
  18287. // full context prediction if this field is true.
  18288. this.requiresFullContext = false;
  18289. // During SLL parsing, this is a list of predicates associated with the
  18290. // ATN configurations of the DFA state. When we have predicates,
  18291. // {@link //requiresFullContext} is {@code false} since full context
  18292. // prediction evaluates predicates
  18293. // on-the-fly. If this is not null, then {@link //prediction} is
  18294. // {@link ATN//INVALID_ALT_NUMBER}.
  18295. //
  18296. // <p>We only use these for non-{@link //requiresFullContext} but
  18297. // conflicting states. That
  18298. // means we know from the context (it's $ or we don't dip into outer
  18299. // context) that it's an ambiguity not a conflict.</p>
  18300. //
  18301. // <p>This list is computed by {@link
  18302. // ParserATNSimulator//predicateDFAState}.</p>
  18303. this.predicates = null;
  18304. return this;
  18305. }
  18306. // Get the set of all alts mentioned by all ATN configurations in this
  18307. // DFA state.
  18308. DFAState.prototype.getAltSet = function () {
  18309. var alts = new Set();
  18310. if (this.configs !== null) {
  18311. for (var i = 0; i < this.configs.length; i++) {
  18312. var c = this.configs[i];
  18313. alts.add(c.alt);
  18314. }
  18315. }
  18316. if (alts.length === 0) {
  18317. return null;
  18318. } else {
  18319. return alts;
  18320. }
  18321. };
  18322. // Two {@link DFAState} instances are equal if their ATN configuration sets
  18323. // are the same. This method is used to see if a state already exists.
  18324. //
  18325. // <p>Because the number of alternatives and number of ATN configurations are
  18326. // finite, there is a finite number of DFA states that can be processed.
  18327. // This is necessary to show that the algorithm terminates.</p>
  18328. //
  18329. // <p>Cannot test the DFA state numbers here because in
  18330. // {@link ParserATNSimulator//addDFAState} we need to know if any other state
  18331. // exists that has this exact set of ATN configurations. The
  18332. // {@link //stateNumber} is irrelevant.</p>
  18333. DFAState.prototype.equals = function (other) {
  18334. // compare set of ATN configurations in this set with other
  18335. return this === other || other instanceof DFAState && this.configs.equals(other.configs);
  18336. };
  18337. DFAState.prototype.toString = function () {
  18338. var s = "" + this.stateNumber + ":" + this.configs;
  18339. if (this.isAcceptState) {
  18340. s = s + "=>";
  18341. if (this.predicates !== null) s = s + this.predicates;else s = s + this.prediction;
  18342. }
  18343. return s;
  18344. };
  18345. DFAState.prototype.hashCode = function () {
  18346. var hash = new Hash();
  18347. hash.update(this.configs);
  18348. if (this.isAcceptState) {
  18349. if (this.predicates !== null) hash.update(this.predicates);else hash.update(this.prediction);
  18350. }
  18351. return hash.finish();
  18352. };
  18353. exports.DFAState = DFAState;
  18354. exports.PredPrediction = PredPrediction;
  18355. /***/ }),
  18356. /***/ "./node_modules/antlr4/dfa/index.js":
  18357. /*!******************************************!*\
  18358. !*** ./node_modules/antlr4/dfa/index.js ***!
  18359. \******************************************/
  18360. /*! no static exports found */
  18361. /***/ (function(module, exports, __webpack_require__) {
  18362. "use strict";
  18363. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  18364. * Use of this file is governed by the BSD 3-clause license that
  18365. * can be found in the LICENSE.txt file in the project root.
  18366. */
  18367. exports.DFA = __webpack_require__(/*! ./DFA */ "./node_modules/antlr4/dfa/DFA.js").DFA;
  18368. exports.DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  18369. exports.LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  18370. exports.PredPrediction = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  18371. /***/ }),
  18372. /***/ "./node_modules/antlr4/error/DiagnosticErrorListener.js":
  18373. /*!**************************************************************!*\
  18374. !*** ./node_modules/antlr4/error/DiagnosticErrorListener.js ***!
  18375. \**************************************************************/
  18376. /*! no static exports found */
  18377. /***/ (function(module, exports, __webpack_require__) {
  18378. "use strict";
  18379. //
  18380. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  18381. * Use of this file is governed by the BSD 3-clause license that
  18382. * can be found in the LICENSE.txt file in the project root.
  18383. */
  18384. //
  18385. //
  18386. // This implementation of {@link ANTLRErrorListener} can be used to identify
  18387. // certain potential correctness and performance problems in grammars. "Reports"
  18388. // are made by calling {@link Parser//notifyErrorListeners} with the appropriate
  18389. // message.
  18390. //
  18391. // <ul>
  18392. // <li><b>Ambiguities</b>: These are cases where more than one path through the
  18393. // grammar can match the input.</li>
  18394. // <li><b>Weak context sensitivity</b>: These are cases where full-context
  18395. // prediction resolved an SLL conflict to a unique alternative which equaled the
  18396. // minimum alternative of the SLL conflict.</li>
  18397. // <li><b>Strong (forced) context sensitivity</b>: These are cases where the
  18398. // full-context prediction resolved an SLL conflict to a unique alternative,
  18399. // <em>and</em> the minimum alternative of the SLL conflict was found to not be
  18400. // a truly viable alternative. Two-stage parsing cannot be used for inputs where
  18401. // this situation occurs.</li>
  18402. // </ul>
  18403. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  18404. var ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  18405. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  18406. function DiagnosticErrorListener(exactOnly) {
  18407. ErrorListener.call(this);
  18408. exactOnly = exactOnly || true;
  18409. // whether all ambiguities or only exact ambiguities are reported.
  18410. this.exactOnly = exactOnly;
  18411. return this;
  18412. }
  18413. DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype);
  18414. DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener;
  18415. DiagnosticErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  18416. if (this.exactOnly && !exact) {
  18417. return;
  18418. }
  18419. var msg = "reportAmbiguity d=" + this.getDecisionDescription(recognizer, dfa) + ": ambigAlts=" + this.getConflictingAlts(ambigAlts, configs) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  18420. recognizer.notifyErrorListeners(msg);
  18421. };
  18422. DiagnosticErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  18423. var msg = "reportAttemptingFullContext d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  18424. recognizer.notifyErrorListeners(msg);
  18425. };
  18426. DiagnosticErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  18427. var msg = "reportContextSensitivity d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  18428. recognizer.notifyErrorListeners(msg);
  18429. };
  18430. DiagnosticErrorListener.prototype.getDecisionDescription = function (recognizer, dfa) {
  18431. var decision = dfa.decision;
  18432. var ruleIndex = dfa.atnStartState.ruleIndex;
  18433. var ruleNames = recognizer.ruleNames;
  18434. if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
  18435. return "" + decision;
  18436. }
  18437. var ruleName = ruleNames[ruleIndex] || null;
  18438. if (ruleName === null || ruleName.length === 0) {
  18439. return "" + decision;
  18440. }
  18441. return "" + decision + " (" + ruleName + ")";
  18442. };
  18443. //
  18444. // Computes the set of conflicting or ambiguous alternatives from a
  18445. // configuration set, if that information was not already provided by the
  18446. // parser.
  18447. //
  18448. // @param reportedAlts The set of conflicting or ambiguous alternatives, as
  18449. // reported by the parser.
  18450. // @param configs The conflicting or ambiguous configuration set.
  18451. // @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
  18452. // returns the set of alternatives represented in {@code configs}.
  18453. //
  18454. DiagnosticErrorListener.prototype.getConflictingAlts = function (reportedAlts, configs) {
  18455. if (reportedAlts !== null) {
  18456. return reportedAlts;
  18457. }
  18458. var result = new BitSet();
  18459. for (var i = 0; i < configs.items.length; i++) {
  18460. result.add(configs.items[i].alt);
  18461. }
  18462. return "{" + result.values().join(", ") + "}";
  18463. };
  18464. exports.DiagnosticErrorListener = DiagnosticErrorListener;
  18465. /***/ }),
  18466. /***/ "./node_modules/antlr4/error/ErrorListener.js":
  18467. /*!****************************************************!*\
  18468. !*** ./node_modules/antlr4/error/ErrorListener.js ***!
  18469. \****************************************************/
  18470. /*! no static exports found */
  18471. /***/ (function(module, exports, __webpack_require__) {
  18472. "use strict";
  18473. //
  18474. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  18475. * Use of this file is governed by the BSD 3-clause license that
  18476. * can be found in the LICENSE.txt file in the project root.
  18477. */
  18478. // Provides an empty default implementation of {@link ANTLRErrorListener}. The
  18479. // default implementation of each method does nothing, but can be overridden as
  18480. // necessary.
  18481. function ErrorListener() {
  18482. return this;
  18483. }
  18484. ErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {};
  18485. ErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {};
  18486. ErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {};
  18487. ErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {};
  18488. function ConsoleErrorListener() {
  18489. ErrorListener.call(this);
  18490. return this;
  18491. }
  18492. ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype);
  18493. ConsoleErrorListener.prototype.constructor = ConsoleErrorListener;
  18494. //
  18495. // Provides a default instance of {@link ConsoleErrorListener}.
  18496. //
  18497. ConsoleErrorListener.INSTANCE = new ConsoleErrorListener();
  18498. //
  18499. // {@inheritDoc}
  18500. //
  18501. // <p>
  18502. // This implementation prints messages to {@link System//err} containing the
  18503. // values of {@code line}, {@code charPositionInLine}, and {@code msg} using
  18504. // the following format.</p>
  18505. //
  18506. // <pre>
  18507. // line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
  18508. // </pre>
  18509. //
  18510. ConsoleErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  18511. console.error("line " + line + ":" + column + " " + msg);
  18512. };
  18513. function ProxyErrorListener(delegates) {
  18514. ErrorListener.call(this);
  18515. if (delegates === null) {
  18516. throw "delegates";
  18517. }
  18518. this.delegates = delegates;
  18519. return this;
  18520. }
  18521. ProxyErrorListener.prototype = Object.create(ErrorListener.prototype);
  18522. ProxyErrorListener.prototype.constructor = ProxyErrorListener;
  18523. ProxyErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  18524. this.delegates.map(function (d) {
  18525. d.syntaxError(recognizer, offendingSymbol, line, column, msg, e);
  18526. });
  18527. };
  18528. ProxyErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  18529. this.delegates.map(function (d) {
  18530. d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  18531. });
  18532. };
  18533. ProxyErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  18534. this.delegates.map(function (d) {
  18535. d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs);
  18536. });
  18537. };
  18538. ProxyErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  18539. this.delegates.map(function (d) {
  18540. d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs);
  18541. });
  18542. };
  18543. exports.ErrorListener = ErrorListener;
  18544. exports.ConsoleErrorListener = ConsoleErrorListener;
  18545. exports.ProxyErrorListener = ProxyErrorListener;
  18546. /***/ }),
  18547. /***/ "./node_modules/antlr4/error/ErrorStrategy.js":
  18548. /*!****************************************************!*\
  18549. !*** ./node_modules/antlr4/error/ErrorStrategy.js ***!
  18550. \****************************************************/
  18551. /*! no static exports found */
  18552. /***/ (function(module, exports, __webpack_require__) {
  18553. "use strict";
  18554. //
  18555. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  18556. * Use of this file is governed by the BSD 3-clause license that
  18557. * can be found in the LICENSE.txt file in the project root.
  18558. */
  18559. //
  18560. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  18561. var Errors = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js");
  18562. var NoViableAltException = Errors.NoViableAltException;
  18563. var InputMismatchException = Errors.InputMismatchException;
  18564. var FailedPredicateException = Errors.FailedPredicateException;
  18565. var ParseCancellationException = Errors.ParseCancellationException;
  18566. var ATNState = __webpack_require__(/*! ./../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  18567. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  18568. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  18569. function ErrorStrategy() {}
  18570. ErrorStrategy.prototype.reset = function (recognizer) {};
  18571. ErrorStrategy.prototype.recoverInline = function (recognizer) {};
  18572. ErrorStrategy.prototype.recover = function (recognizer, e) {};
  18573. ErrorStrategy.prototype.sync = function (recognizer) {};
  18574. ErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {};
  18575. ErrorStrategy.prototype.reportError = function (recognizer) {};
  18576. // This is the default implementation of {@link ANTLRErrorStrategy} used for
  18577. // error reporting and recovery in ANTLR parsers.
  18578. //
  18579. function DefaultErrorStrategy() {
  18580. ErrorStrategy.call(this);
  18581. // Indicates whether the error strategy is currently "recovering from an
  18582. // error". This is used to suppress reporting multiple error messages while
  18583. // attempting to recover from a detected syntax error.
  18584. //
  18585. // @see //inErrorRecoveryMode
  18586. //
  18587. this.errorRecoveryMode = false;
  18588. // The index into the input stream where the last error occurred.
  18589. // This is used to prevent infinite loops where an error is found
  18590. // but no token is consumed during recovery...another error is found,
  18591. // ad nauseum. This is a failsafe mechanism to guarantee that at least
  18592. // one token/tree node is consumed for two errors.
  18593. //
  18594. this.lastErrorIndex = -1;
  18595. this.lastErrorStates = null;
  18596. return this;
  18597. }
  18598. DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype);
  18599. DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy;
  18600. // <p>The default implementation simply calls {@link //endErrorCondition} to
  18601. // ensure that the handler is not in error recovery mode.</p>
  18602. DefaultErrorStrategy.prototype.reset = function (recognizer) {
  18603. this.endErrorCondition(recognizer);
  18604. };
  18605. //
  18606. // This method is called to enter error recovery mode when a recognition
  18607. // exception is reported.
  18608. //
  18609. // @param recognizer the parser instance
  18610. //
  18611. DefaultErrorStrategy.prototype.beginErrorCondition = function (recognizer) {
  18612. this.errorRecoveryMode = true;
  18613. };
  18614. DefaultErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {
  18615. return this.errorRecoveryMode;
  18616. };
  18617. //
  18618. // This method is called to leave error recovery mode after recovering from
  18619. // a recognition exception.
  18620. //
  18621. // @param recognizer
  18622. //
  18623. DefaultErrorStrategy.prototype.endErrorCondition = function (recognizer) {
  18624. this.errorRecoveryMode = false;
  18625. this.lastErrorStates = null;
  18626. this.lastErrorIndex = -1;
  18627. };
  18628. //
  18629. // {@inheritDoc}
  18630. //
  18631. // <p>The default implementation simply calls {@link //endErrorCondition}.</p>
  18632. //
  18633. DefaultErrorStrategy.prototype.reportMatch = function (recognizer) {
  18634. this.endErrorCondition(recognizer);
  18635. };
  18636. //
  18637. // {@inheritDoc}
  18638. //
  18639. // <p>The default implementation returns immediately if the handler is already
  18640. // in error recovery mode. Otherwise, it calls {@link //beginErrorCondition}
  18641. // and dispatches the reporting task based on the runtime type of {@code e}
  18642. // according to the following table.</p>
  18643. //
  18644. // <ul>
  18645. // <li>{@link NoViableAltException}: Dispatches the call to
  18646. // {@link //reportNoViableAlternative}</li>
  18647. // <li>{@link InputMismatchException}: Dispatches the call to
  18648. // {@link //reportInputMismatch}</li>
  18649. // <li>{@link FailedPredicateException}: Dispatches the call to
  18650. // {@link //reportFailedPredicate}</li>
  18651. // <li>All other types: calls {@link Parser//notifyErrorListeners} to report
  18652. // the exception</li>
  18653. // </ul>
  18654. //
  18655. DefaultErrorStrategy.prototype.reportError = function (recognizer, e) {
  18656. // if we've already reported an error and have not matched a token
  18657. // yet successfully, don't report any errors.
  18658. if (this.inErrorRecoveryMode(recognizer)) {
  18659. return; // don't report spurious errors
  18660. }
  18661. this.beginErrorCondition(recognizer);
  18662. if (e instanceof NoViableAltException) {
  18663. this.reportNoViableAlternative(recognizer, e);
  18664. } else if (e instanceof InputMismatchException) {
  18665. this.reportInputMismatch(recognizer, e);
  18666. } else if (e instanceof FailedPredicateException) {
  18667. this.reportFailedPredicate(recognizer, e);
  18668. } else {
  18669. console.log("unknown recognition error type: " + e.constructor.name);
  18670. console.log(e.stack);
  18671. recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
  18672. }
  18673. };
  18674. //
  18675. // {@inheritDoc}
  18676. //
  18677. // <p>The default implementation resynchronizes the parser by consuming tokens
  18678. // until we find one in the resynchronization set--loosely the set of tokens
  18679. // that can follow the current rule.</p>
  18680. //
  18681. DefaultErrorStrategy.prototype.recover = function (recognizer, e) {
  18682. if (this.lastErrorIndex === recognizer.getInputStream().index && this.lastErrorStates !== null && this.lastErrorStates.indexOf(recognizer.state) >= 0) {
  18683. // uh oh, another error at same token index and previously-visited
  18684. // state in ATN; must be a case where LT(1) is in the recovery
  18685. // token set so nothing got consumed. Consume a single token
  18686. // at least to prevent an infinite loop; this is a failsafe.
  18687. recognizer.consume();
  18688. }
  18689. this.lastErrorIndex = recognizer._input.index;
  18690. if (this.lastErrorStates === null) {
  18691. this.lastErrorStates = [];
  18692. }
  18693. this.lastErrorStates.push(recognizer.state);
  18694. var followSet = this.getErrorRecoverySet(recognizer);
  18695. this.consumeUntil(recognizer, followSet);
  18696. };
  18697. // The default implementation of {@link ANTLRErrorStrategy//sync} makes sure
  18698. // that the current lookahead symbol is consistent with what were expecting
  18699. // at this point in the ATN. You can call this anytime but ANTLR only
  18700. // generates code to check before subrules/loops and each iteration.
  18701. //
  18702. // <p>Implements Jim Idle's magic sync mechanism in closures and optional
  18703. // subrules. E.g.,</p>
  18704. //
  18705. // <pre>
  18706. // a : sync ( stuff sync )* ;
  18707. // sync : {consume to what can follow sync} ;
  18708. // </pre>
  18709. //
  18710. // At the start of a sub rule upon error, {@link //sync} performs single
  18711. // token deletion, if possible. If it can't do that, it bails on the current
  18712. // rule and uses the default error recovery, which consumes until the
  18713. // resynchronization set of the current rule.
  18714. //
  18715. // <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
  18716. // with an empty alternative), then the expected set includes what follows
  18717. // the subrule.</p>
  18718. //
  18719. // <p>During loop iteration, it consumes until it sees a token that can start a
  18720. // sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
  18721. // stay in the loop as long as possible.</p>
  18722. //
  18723. // <p><strong>ORIGINS</strong></p>
  18724. //
  18725. // <p>Previous versions of ANTLR did a poor job of their recovery within loops.
  18726. // A single mismatch token or missing token would force the parser to bail
  18727. // out of the entire rules surrounding the loop. So, for rule</p>
  18728. //
  18729. // <pre>
  18730. // classDef : 'class' ID '{' member* '}'
  18731. // </pre>
  18732. //
  18733. // input with an extra token between members would force the parser to
  18734. // consume until it found the next class definition rather than the next
  18735. // member definition of the current class.
  18736. //
  18737. // <p>This functionality cost a little bit of effort because the parser has to
  18738. // compare token set at the start of the loop and at each iteration. If for
  18739. // some reason speed is suffering for you, you can turn off this
  18740. // functionality by simply overriding this method as a blank { }.</p>
  18741. //
  18742. DefaultErrorStrategy.prototype.sync = function (recognizer) {
  18743. // If already recovering, don't try to sync
  18744. if (this.inErrorRecoveryMode(recognizer)) {
  18745. return;
  18746. }
  18747. var s = recognizer._interp.atn.states[recognizer.state];
  18748. var la = recognizer.getTokenStream().LA(1);
  18749. // try cheaper subset first; might get lucky. seems to shave a wee bit off
  18750. var nextTokens = recognizer.atn.nextTokens(s);
  18751. if (nextTokens.contains(Token.EPSILON) || nextTokens.contains(la)) {
  18752. return;
  18753. }
  18754. switch (s.stateType) {
  18755. case ATNState.BLOCK_START:
  18756. case ATNState.STAR_BLOCK_START:
  18757. case ATNState.PLUS_BLOCK_START:
  18758. case ATNState.STAR_LOOP_ENTRY:
  18759. // report error and recover if possible
  18760. if (this.singleTokenDeletion(recognizer) !== null) {
  18761. return;
  18762. } else {
  18763. throw new InputMismatchException(recognizer);
  18764. }
  18765. break;
  18766. case ATNState.PLUS_LOOP_BACK:
  18767. case ATNState.STAR_LOOP_BACK:
  18768. this.reportUnwantedToken(recognizer);
  18769. var expecting = new IntervalSet();
  18770. expecting.addSet(recognizer.getExpectedTokens());
  18771. var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
  18772. this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
  18773. break;
  18774. default:
  18775. // do nothing if we can't identify the exact kind of ATN state
  18776. }
  18777. };
  18778. // This is called by {@link //reportError} when the exception is a
  18779. // {@link NoViableAltException}.
  18780. //
  18781. // @see //reportError
  18782. //
  18783. // @param recognizer the parser instance
  18784. // @param e the recognition exception
  18785. //
  18786. DefaultErrorStrategy.prototype.reportNoViableAlternative = function (recognizer, e) {
  18787. var tokens = recognizer.getTokenStream();
  18788. var input;
  18789. if (tokens !== null) {
  18790. if (e.startToken.type === Token.EOF) {
  18791. input = "<EOF>";
  18792. } else {
  18793. input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
  18794. }
  18795. } else {
  18796. input = "<unknown input>";
  18797. }
  18798. var msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
  18799. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  18800. };
  18801. //
  18802. // This is called by {@link //reportError} when the exception is an
  18803. // {@link InputMismatchException}.
  18804. //
  18805. // @see //reportError
  18806. //
  18807. // @param recognizer the parser instance
  18808. // @param e the recognition exception
  18809. //
  18810. DefaultErrorStrategy.prototype.reportInputMismatch = function (recognizer, e) {
  18811. var msg = "mismatched input " + this.getTokenErrorDisplay(e.offendingToken) + " expecting " + e.getExpectedTokens().toString(recognizer.literalNames, recognizer.symbolicNames);
  18812. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  18813. };
  18814. //
  18815. // This is called by {@link //reportError} when the exception is a
  18816. // {@link FailedPredicateException}.
  18817. //
  18818. // @see //reportError
  18819. //
  18820. // @param recognizer the parser instance
  18821. // @param e the recognition exception
  18822. //
  18823. DefaultErrorStrategy.prototype.reportFailedPredicate = function (recognizer, e) {
  18824. var ruleName = recognizer.ruleNames[recognizer._ctx.ruleIndex];
  18825. var msg = "rule " + ruleName + " " + e.message;
  18826. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  18827. };
  18828. // This method is called to report a syntax error which requires the removal
  18829. // of a token from the input stream. At the time this method is called, the
  18830. // erroneous symbol is current {@code LT(1)} symbol and has not yet been
  18831. // removed from the input stream. When this method returns,
  18832. // {@code recognizer} is in error recovery mode.
  18833. //
  18834. // <p>This method is called when {@link //singleTokenDeletion} identifies
  18835. // single-token deletion as a viable recovery strategy for a mismatched
  18836. // input error.</p>
  18837. //
  18838. // <p>The default implementation simply returns if the handler is already in
  18839. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  18840. // enter error recovery mode, followed by calling
  18841. // {@link Parser//notifyErrorListeners}.</p>
  18842. //
  18843. // @param recognizer the parser instance
  18844. //
  18845. DefaultErrorStrategy.prototype.reportUnwantedToken = function (recognizer) {
  18846. if (this.inErrorRecoveryMode(recognizer)) {
  18847. return;
  18848. }
  18849. this.beginErrorCondition(recognizer);
  18850. var t = recognizer.getCurrentToken();
  18851. var tokenName = this.getTokenErrorDisplay(t);
  18852. var expecting = this.getExpectedTokens(recognizer);
  18853. var msg = "extraneous input " + tokenName + " expecting " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames);
  18854. recognizer.notifyErrorListeners(msg, t, null);
  18855. };
  18856. // This method is called to report a syntax error which requires the
  18857. // insertion of a missing token into the input stream. At the time this
  18858. // method is called, the missing token has not yet been inserted. When this
  18859. // method returns, {@code recognizer} is in error recovery mode.
  18860. //
  18861. // <p>This method is called when {@link //singleTokenInsertion} identifies
  18862. // single-token insertion as a viable recovery strategy for a mismatched
  18863. // input error.</p>
  18864. //
  18865. // <p>The default implementation simply returns if the handler is already in
  18866. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  18867. // enter error recovery mode, followed by calling
  18868. // {@link Parser//notifyErrorListeners}.</p>
  18869. //
  18870. // @param recognizer the parser instance
  18871. //
  18872. DefaultErrorStrategy.prototype.reportMissingToken = function (recognizer) {
  18873. if (this.inErrorRecoveryMode(recognizer)) {
  18874. return;
  18875. }
  18876. this.beginErrorCondition(recognizer);
  18877. var t = recognizer.getCurrentToken();
  18878. var expecting = this.getExpectedTokens(recognizer);
  18879. var msg = "missing " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames) + " at " + this.getTokenErrorDisplay(t);
  18880. recognizer.notifyErrorListeners(msg, t, null);
  18881. };
  18882. // <p>The default implementation attempts to recover from the mismatched input
  18883. // by using single token insertion and deletion as described below. If the
  18884. // recovery attempt fails, this method throws an
  18885. // {@link InputMismatchException}.</p>
  18886. //
  18887. // <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
  18888. //
  18889. // <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
  18890. // right token, however, then assume {@code LA(1)} is some extra spurious
  18891. // token and delete it. Then consume and return the next token (which was
  18892. // the {@code LA(2)} token) as the successful result of the match operation.</p>
  18893. //
  18894. // <p>This recovery strategy is implemented by {@link
  18895. // //singleTokenDeletion}.</p>
  18896. //
  18897. // <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
  18898. //
  18899. // <p>If current token (at {@code LA(1)}) is consistent with what could come
  18900. // after the expected {@code LA(1)} token, then assume the token is missing
  18901. // and use the parser's {@link TokenFactory} to create it on the fly. The
  18902. // "insertion" is performed by returning the created token as the successful
  18903. // result of the match operation.</p>
  18904. //
  18905. // <p>This recovery strategy is implemented by {@link
  18906. // //singleTokenInsertion}.</p>
  18907. //
  18908. // <p><strong>EXAMPLE</strong></p>
  18909. //
  18910. // <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
  18911. // the parser returns from the nested call to {@code expr}, it will have
  18912. // call chain:</p>
  18913. //
  18914. // <pre>
  18915. // stat &rarr; expr &rarr; atom
  18916. // </pre>
  18917. //
  18918. // and it will be trying to match the {@code ')'} at this point in the
  18919. // derivation:
  18920. //
  18921. // <pre>
  18922. // =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
  18923. // ^
  18924. // </pre>
  18925. //
  18926. // The attempt to match {@code ')'} will fail when it sees {@code ';'} and
  18927. // call {@link //recoverInline}. To recover, it sees that {@code LA(1)==';'}
  18928. // is in the set of tokens that can follow the {@code ')'} token reference
  18929. // in rule {@code atom}. It can assume that you forgot the {@code ')'}.
  18930. //
  18931. DefaultErrorStrategy.prototype.recoverInline = function (recognizer) {
  18932. // SINGLE TOKEN DELETION
  18933. var matchedSymbol = this.singleTokenDeletion(recognizer);
  18934. if (matchedSymbol !== null) {
  18935. // we have deleted the extra token.
  18936. // now, move past ttype token as if all were ok
  18937. recognizer.consume();
  18938. return matchedSymbol;
  18939. }
  18940. // SINGLE TOKEN INSERTION
  18941. if (this.singleTokenInsertion(recognizer)) {
  18942. return this.getMissingSymbol(recognizer);
  18943. }
  18944. // even that didn't work; must throw the exception
  18945. throw new InputMismatchException(recognizer);
  18946. };
  18947. //
  18948. // This method implements the single-token insertion inline error recovery
  18949. // strategy. It is called by {@link //recoverInline} if the single-token
  18950. // deletion strategy fails to recover from the mismatched input. If this
  18951. // method returns {@code true}, {@code recognizer} will be in error recovery
  18952. // mode.
  18953. //
  18954. // <p>This method determines whether or not single-token insertion is viable by
  18955. // checking if the {@code LA(1)} input symbol could be successfully matched
  18956. // if it were instead the {@code LA(2)} symbol. If this method returns
  18957. // {@code true}, the caller is responsible for creating and inserting a
  18958. // token with the correct type to produce this behavior.</p>
  18959. //
  18960. // @param recognizer the parser instance
  18961. // @return {@code true} if single-token insertion is a viable recovery
  18962. // strategy for the current mismatched input, otherwise {@code false}
  18963. //
  18964. DefaultErrorStrategy.prototype.singleTokenInsertion = function (recognizer) {
  18965. var currentSymbolType = recognizer.getTokenStream().LA(1);
  18966. // if current token is consistent with what could come after current
  18967. // ATN state, then we know we're missing a token; error recovery
  18968. // is free to conjure up and insert the missing token
  18969. var atn = recognizer._interp.atn;
  18970. var currentState = atn.states[recognizer.state];
  18971. var next = currentState.transitions[0].target;
  18972. var expectingAtLL2 = atn.nextTokens(next, recognizer._ctx);
  18973. if (expectingAtLL2.contains(currentSymbolType)) {
  18974. this.reportMissingToken(recognizer);
  18975. return true;
  18976. } else {
  18977. return false;
  18978. }
  18979. };
  18980. // This method implements the single-token deletion inline error recovery
  18981. // strategy. It is called by {@link //recoverInline} to attempt to recover
  18982. // from mismatched input. If this method returns null, the parser and error
  18983. // handler state will not have changed. If this method returns non-null,
  18984. // {@code recognizer} will <em>not</em> be in error recovery mode since the
  18985. // returned token was a successful match.
  18986. //
  18987. // <p>If the single-token deletion is successful, this method calls
  18988. // {@link //reportUnwantedToken} to report the error, followed by
  18989. // {@link Parser//consume} to actually "delete" the extraneous token. Then,
  18990. // before returning {@link //reportMatch} is called to signal a successful
  18991. // match.</p>
  18992. //
  18993. // @param recognizer the parser instance
  18994. // @return the successfully matched {@link Token} instance if single-token
  18995. // deletion successfully recovers from the mismatched input, otherwise
  18996. // {@code null}
  18997. //
  18998. DefaultErrorStrategy.prototype.singleTokenDeletion = function (recognizer) {
  18999. var nextTokenType = recognizer.getTokenStream().LA(2);
  19000. var expecting = this.getExpectedTokens(recognizer);
  19001. if (expecting.contains(nextTokenType)) {
  19002. this.reportUnwantedToken(recognizer);
  19003. // print("recoverFromMismatchedToken deleting " \
  19004. // + str(recognizer.getTokenStream().LT(1)) \
  19005. // + " since " + str(recognizer.getTokenStream().LT(2)) \
  19006. // + " is what we want", file=sys.stderr)
  19007. recognizer.consume(); // simply delete extra token
  19008. // we want to return the token we're actually matching
  19009. var matchedSymbol = recognizer.getCurrentToken();
  19010. this.reportMatch(recognizer); // we know current token is correct
  19011. return matchedSymbol;
  19012. } else {
  19013. return null;
  19014. }
  19015. };
  19016. // Conjure up a missing token during error recovery.
  19017. //
  19018. // The recognizer attempts to recover from single missing
  19019. // symbols. But, actions might refer to that missing symbol.
  19020. // For example, x=ID {f($x);}. The action clearly assumes
  19021. // that there has been an identifier matched previously and that
  19022. // $x points at that token. If that token is missing, but
  19023. // the next token in the stream is what we want we assume that
  19024. // this token is missing and we keep going. Because we
  19025. // have to return some token to replace the missing token,
  19026. // we have to conjure one up. This method gives the user control
  19027. // over the tokens returned for missing tokens. Mostly,
  19028. // you will want to create something special for identifier
  19029. // tokens. For literals such as '{' and ',', the default
  19030. // action in the parser or tree parser works. It simply creates
  19031. // a CommonToken of the appropriate type. The text will be the token.
  19032. // If you change what tokens must be created by the lexer,
  19033. // override this method to create the appropriate tokens.
  19034. //
  19035. DefaultErrorStrategy.prototype.getMissingSymbol = function (recognizer) {
  19036. var currentSymbol = recognizer.getCurrentToken();
  19037. var expecting = this.getExpectedTokens(recognizer);
  19038. var expectedTokenType = expecting.first(); // get any element
  19039. var tokenText;
  19040. if (expectedTokenType === Token.EOF) {
  19041. tokenText = "<missing EOF>";
  19042. } else {
  19043. tokenText = "<missing " + recognizer.literalNames[expectedTokenType] + ">";
  19044. }
  19045. var current = currentSymbol;
  19046. var lookback = recognizer.getTokenStream().LT(-1);
  19047. if (current.type === Token.EOF && lookback !== null) {
  19048. current = lookback;
  19049. }
  19050. return recognizer.getTokenFactory().create(current.source, expectedTokenType, tokenText, Token.DEFAULT_CHANNEL, -1, -1, current.line, current.column);
  19051. };
  19052. DefaultErrorStrategy.prototype.getExpectedTokens = function (recognizer) {
  19053. return recognizer.getExpectedTokens();
  19054. };
  19055. // How should a token be displayed in an error message? The default
  19056. // is to display just the text, but during development you might
  19057. // want to have a lot of information spit out. Override in that case
  19058. // to use t.toString() (which, for CommonToken, dumps everything about
  19059. // the token). This is better than forcing you to override a method in
  19060. // your token objects because you don't have to go modify your lexer
  19061. // so that it creates a new Java type.
  19062. //
  19063. DefaultErrorStrategy.prototype.getTokenErrorDisplay = function (t) {
  19064. if (t === null) {
  19065. return "<no token>";
  19066. }
  19067. var s = t.text;
  19068. if (s === null) {
  19069. if (t.type === Token.EOF) {
  19070. s = "<EOF>";
  19071. } else {
  19072. s = "<" + t.type + ">";
  19073. }
  19074. }
  19075. return this.escapeWSAndQuote(s);
  19076. };
  19077. DefaultErrorStrategy.prototype.escapeWSAndQuote = function (s) {
  19078. s = s.replace(/\n/g, "\\n");
  19079. s = s.replace(/\r/g, "\\r");
  19080. s = s.replace(/\t/g, "\\t");
  19081. return "'" + s + "'";
  19082. };
  19083. // Compute the error recovery set for the current rule. During
  19084. // rule invocation, the parser pushes the set of tokens that can
  19085. // follow that rule reference on the stack; this amounts to
  19086. // computing FIRST of what follows the rule reference in the
  19087. // enclosing rule. See LinearApproximator.FIRST().
  19088. // This local follow set only includes tokens
  19089. // from within the rule; i.e., the FIRST computation done by
  19090. // ANTLR stops at the end of a rule.
  19091. //
  19092. // EXAMPLE
  19093. //
  19094. // When you find a "no viable alt exception", the input is not
  19095. // consistent with any of the alternatives for rule r. The best
  19096. // thing to do is to consume tokens until you see something that
  19097. // can legally follow a call to r//or* any rule that called r.
  19098. // You don't want the exact set of viable next tokens because the
  19099. // input might just be missing a token--you might consume the
  19100. // rest of the input looking for one of the missing tokens.
  19101. //
  19102. // Consider grammar:
  19103. //
  19104. // a : '[' b ']'
  19105. // | '(' b ')'
  19106. // ;
  19107. // b : c '^' INT ;
  19108. // c : ID
  19109. // | INT
  19110. // ;
  19111. //
  19112. // At each rule invocation, the set of tokens that could follow
  19113. // that rule is pushed on a stack. Here are the various
  19114. // context-sensitive follow sets:
  19115. //
  19116. // FOLLOW(b1_in_a) = FIRST(']') = ']'
  19117. // FOLLOW(b2_in_a) = FIRST(')') = ')'
  19118. // FOLLOW(c_in_b) = FIRST('^') = '^'
  19119. //
  19120. // Upon erroneous input "[]", the call chain is
  19121. //
  19122. // a -> b -> c
  19123. //
  19124. // and, hence, the follow context stack is:
  19125. //
  19126. // depth follow set start of rule execution
  19127. // 0 <EOF> a (from main())
  19128. // 1 ']' b
  19129. // 2 '^' c
  19130. //
  19131. // Notice that ')' is not included, because b would have to have
  19132. // been called from a different context in rule a for ')' to be
  19133. // included.
  19134. //
  19135. // For error recovery, we cannot consider FOLLOW(c)
  19136. // (context-sensitive or otherwise). We need the combined set of
  19137. // all context-sensitive FOLLOW sets--the set of all tokens that
  19138. // could follow any reference in the call chain. We need to
  19139. // resync to one of those tokens. Note that FOLLOW(c)='^' and if
  19140. // we resync'd to that token, we'd consume until EOF. We need to
  19141. // sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
  19142. // In this case, for input "[]", LA(1) is ']' and in the set, so we would
  19143. // not consume anything. After printing an error, rule c would
  19144. // return normally. Rule b would not find the required '^' though.
  19145. // At this point, it gets a mismatched token error and throws an
  19146. // exception (since LA(1) is not in the viable following token
  19147. // set). The rule exception handler tries to recover, but finds
  19148. // the same recovery set and doesn't consume anything. Rule b
  19149. // exits normally returning to rule a. Now it finds the ']' (and
  19150. // with the successful match exits errorRecovery mode).
  19151. //
  19152. // So, you can see that the parser walks up the call chain looking
  19153. // for the token that was a member of the recovery set.
  19154. //
  19155. // Errors are not generated in errorRecovery mode.
  19156. //
  19157. // ANTLR's error recovery mechanism is based upon original ideas:
  19158. //
  19159. // "Algorithms + Data Structures = Programs" by Niklaus Wirth
  19160. //
  19161. // and
  19162. //
  19163. // "A note on error recovery in recursive descent parsers":
  19164. // http://portal.acm.org/citation.cfm?id=947902.947905
  19165. //
  19166. // Later, Josef Grosch had some good ideas:
  19167. //
  19168. // "Efficient and Comfortable Error Recovery in Recursive Descent
  19169. // Parsers":
  19170. // ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
  19171. //
  19172. // Like Grosch I implement context-sensitive FOLLOW sets that are combined
  19173. // at run-time upon error to avoid overhead during parsing.
  19174. //
  19175. DefaultErrorStrategy.prototype.getErrorRecoverySet = function (recognizer) {
  19176. var atn = recognizer._interp.atn;
  19177. var ctx = recognizer._ctx;
  19178. var recoverSet = new IntervalSet();
  19179. while (ctx !== null && ctx.invokingState >= 0) {
  19180. // compute what follows who invoked us
  19181. var invokingState = atn.states[ctx.invokingState];
  19182. var rt = invokingState.transitions[0];
  19183. var follow = atn.nextTokens(rt.followState);
  19184. recoverSet.addSet(follow);
  19185. ctx = ctx.parentCtx;
  19186. }
  19187. recoverSet.removeOne(Token.EPSILON);
  19188. return recoverSet;
  19189. };
  19190. // Consume tokens until one matches the given token set.//
  19191. DefaultErrorStrategy.prototype.consumeUntil = function (recognizer, set) {
  19192. var ttype = recognizer.getTokenStream().LA(1);
  19193. while (ttype !== Token.EOF && !set.contains(ttype)) {
  19194. recognizer.consume();
  19195. ttype = recognizer.getTokenStream().LA(1);
  19196. }
  19197. };
  19198. //
  19199. // This implementation of {@link ANTLRErrorStrategy} responds to syntax errors
  19200. // by immediately canceling the parse operation with a
  19201. // {@link ParseCancellationException}. The implementation ensures that the
  19202. // {@link ParserRuleContext//exception} field is set for all parse tree nodes
  19203. // that were not completed prior to encountering the error.
  19204. //
  19205. // <p>
  19206. // This error strategy is useful in the following scenarios.</p>
  19207. //
  19208. // <ul>
  19209. // <li><strong>Two-stage parsing:</strong> This error strategy allows the first
  19210. // stage of two-stage parsing to immediately terminate if an error is
  19211. // encountered, and immediately fall back to the second stage. In addition to
  19212. // avoiding wasted work by attempting to recover from errors here, the empty
  19213. // implementation of {@link BailErrorStrategy//sync} improves the performance of
  19214. // the first stage.</li>
  19215. // <li><strong>Silent validation:</strong> When syntax errors are not being
  19216. // reported or logged, and the parse result is simply ignored if errors occur,
  19217. // the {@link BailErrorStrategy} avoids wasting work on recovering from errors
  19218. // when the result will be ignored either way.</li>
  19219. // </ul>
  19220. //
  19221. // <p>
  19222. // {@code myparser.setErrorHandler(new BailErrorStrategy());}</p>
  19223. //
  19224. // @see Parser//setErrorHandler(ANTLRErrorStrategy)
  19225. //
  19226. function BailErrorStrategy() {
  19227. DefaultErrorStrategy.call(this);
  19228. return this;
  19229. }
  19230. BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype);
  19231. BailErrorStrategy.prototype.constructor = BailErrorStrategy;
  19232. // Instead of recovering from exception {@code e}, re-throw it wrapped
  19233. // in a {@link ParseCancellationException} so it is not caught by the
  19234. // rule function catches. Use {@link Exception//getCause()} to get the
  19235. // original {@link RecognitionException}.
  19236. //
  19237. BailErrorStrategy.prototype.recover = function (recognizer, e) {
  19238. var context = recognizer._ctx;
  19239. while (context !== null) {
  19240. context.exception = e;
  19241. context = context.parentCtx;
  19242. }
  19243. throw new ParseCancellationException(e);
  19244. };
  19245. // Make sure we don't attempt to recover inline; if the parser
  19246. // successfully recovers, it won't throw an exception.
  19247. //
  19248. BailErrorStrategy.prototype.recoverInline = function (recognizer) {
  19249. this.recover(recognizer, new InputMismatchException(recognizer));
  19250. };
  19251. // Make sure we don't attempt to recover from problems in subrules.//
  19252. BailErrorStrategy.prototype.sync = function (recognizer) {
  19253. // pass
  19254. };
  19255. exports.BailErrorStrategy = BailErrorStrategy;
  19256. exports.DefaultErrorStrategy = DefaultErrorStrategy;
  19257. /***/ }),
  19258. /***/ "./node_modules/antlr4/error/Errors.js":
  19259. /*!*********************************************!*\
  19260. !*** ./node_modules/antlr4/error/Errors.js ***!
  19261. \*********************************************/
  19262. /*! no static exports found */
  19263. /***/ (function(module, exports, __webpack_require__) {
  19264. "use strict";
  19265. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19266. * Use of this file is governed by the BSD 3-clause license that
  19267. * can be found in the LICENSE.txt file in the project root.
  19268. */
  19269. // The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
  19270. // 3 kinds of errors: prediction errors, failed predicate errors, and
  19271. // mismatched input errors. In each case, the parser knows where it is
  19272. // in the input, where it is in the ATN, the rule invocation stack,
  19273. // and what kind of problem occurred.
  19274. var PredicateTransition = __webpack_require__(/*! ./../atn/Transition */ "./node_modules/antlr4/atn/Transition.js").PredicateTransition;
  19275. function RecognitionException(params) {
  19276. Error.call(this);
  19277. if (!!Error.captureStackTrace) {
  19278. Error.captureStackTrace(this, RecognitionException);
  19279. } else {
  19280. var stack = new Error().stack;
  19281. }
  19282. this.message = params.message;
  19283. this.recognizer = params.recognizer;
  19284. this.input = params.input;
  19285. this.ctx = params.ctx;
  19286. // The current {@link Token} when an error occurred. Since not all streams
  19287. // support accessing symbols by index, we have to track the {@link Token}
  19288. // instance itself.
  19289. this.offendingToken = null;
  19290. // Get the ATN state number the parser was in at the time the error
  19291. // occurred. For {@link NoViableAltException} and
  19292. // {@link LexerNoViableAltException} exceptions, this is the
  19293. // {@link DecisionState} number. For others, it is the state whose outgoing
  19294. // edge we couldn't match.
  19295. this.offendingState = -1;
  19296. if (this.recognizer !== null) {
  19297. this.offendingState = this.recognizer.state;
  19298. }
  19299. return this;
  19300. }
  19301. RecognitionException.prototype = Object.create(Error.prototype);
  19302. RecognitionException.prototype.constructor = RecognitionException;
  19303. // <p>If the state number is not known, this method returns -1.</p>
  19304. //
  19305. // Gets the set of input symbols which could potentially follow the
  19306. // previously matched symbol at the time this exception was thrown.
  19307. //
  19308. // <p>If the set of expected tokens is not known and could not be computed,
  19309. // this method returns {@code null}.</p>
  19310. //
  19311. // @return The set of token types that could potentially follow the current
  19312. // state in the ATN, or {@code null} if the information is not available.
  19313. // /
  19314. RecognitionException.prototype.getExpectedTokens = function () {
  19315. if (this.recognizer !== null) {
  19316. return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);
  19317. } else {
  19318. return null;
  19319. }
  19320. };
  19321. RecognitionException.prototype.toString = function () {
  19322. return this.message;
  19323. };
  19324. function LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
  19325. RecognitionException.call(this, { message: "", recognizer: lexer, input: input, ctx: null });
  19326. this.startIndex = startIndex;
  19327. this.deadEndConfigs = deadEndConfigs;
  19328. return this;
  19329. }
  19330. LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);
  19331. LexerNoViableAltException.prototype.constructor = LexerNoViableAltException;
  19332. LexerNoViableAltException.prototype.toString = function () {
  19333. var symbol = "";
  19334. if (this.startIndex >= 0 && this.startIndex < this.input.size) {
  19335. symbol = this.input.getText((this.startIndex, this.startIndex));
  19336. }
  19337. return "LexerNoViableAltException" + symbol;
  19338. };
  19339. // Indicates that the parser could not decide which of two or more paths
  19340. // to take based upon the remaining input. It tracks the starting token
  19341. // of the offending input and also knows where the parser was
  19342. // in the various paths when the error. Reported by reportNoViableAlternative()
  19343. //
  19344. function NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
  19345. ctx = ctx || recognizer._ctx;
  19346. offendingToken = offendingToken || recognizer.getCurrentToken();
  19347. startToken = startToken || recognizer.getCurrentToken();
  19348. input = input || recognizer.getInputStream();
  19349. RecognitionException.call(this, { message: "", recognizer: recognizer, input: input, ctx: ctx });
  19350. // Which configurations did we try at input.index() that couldn't match
  19351. // input.LT(1)?//
  19352. this.deadEndConfigs = deadEndConfigs;
  19353. // The token object at the start index; the input stream might
  19354. // not be buffering tokens so get a reference to it. (At the
  19355. // time the error occurred, of course the stream needs to keep a
  19356. // buffer all of the tokens but later we might not have access to those.)
  19357. this.startToken = startToken;
  19358. this.offendingToken = offendingToken;
  19359. }
  19360. NoViableAltException.prototype = Object.create(RecognitionException.prototype);
  19361. NoViableAltException.prototype.constructor = NoViableAltException;
  19362. // This signifies any kind of mismatched input exceptions such as
  19363. // when the current input does not match the expected token.
  19364. //
  19365. function InputMismatchException(recognizer) {
  19366. RecognitionException.call(this, { message: "", recognizer: recognizer, input: recognizer.getInputStream(), ctx: recognizer._ctx });
  19367. this.offendingToken = recognizer.getCurrentToken();
  19368. }
  19369. InputMismatchException.prototype = Object.create(RecognitionException.prototype);
  19370. InputMismatchException.prototype.constructor = InputMismatchException;
  19371. // A semantic predicate failed during validation. Validation of predicates
  19372. // occurs when normally parsing the alternative just like matching a token.
  19373. // Disambiguating predicate evaluation occurs when we test a predicate during
  19374. // prediction.
  19375. function FailedPredicateException(recognizer, predicate, message) {
  19376. RecognitionException.call(this, { message: this.formatMessage(predicate, message || null), recognizer: recognizer,
  19377. input: recognizer.getInputStream(), ctx: recognizer._ctx });
  19378. var s = recognizer._interp.atn.states[recognizer.state];
  19379. var trans = s.transitions[0];
  19380. if (trans instanceof PredicateTransition) {
  19381. this.ruleIndex = trans.ruleIndex;
  19382. this.predicateIndex = trans.predIndex;
  19383. } else {
  19384. this.ruleIndex = 0;
  19385. this.predicateIndex = 0;
  19386. }
  19387. this.predicate = predicate;
  19388. this.offendingToken = recognizer.getCurrentToken();
  19389. return this;
  19390. }
  19391. FailedPredicateException.prototype = Object.create(RecognitionException.prototype);
  19392. FailedPredicateException.prototype.constructor = FailedPredicateException;
  19393. FailedPredicateException.prototype.formatMessage = function (predicate, message) {
  19394. if (message !== null) {
  19395. return message;
  19396. } else {
  19397. return "failed predicate: {" + predicate + "}?";
  19398. }
  19399. };
  19400. function ParseCancellationException() {
  19401. Error.call(this);
  19402. Error.captureStackTrace(this, ParseCancellationException);
  19403. return this;
  19404. }
  19405. ParseCancellationException.prototype = Object.create(Error.prototype);
  19406. ParseCancellationException.prototype.constructor = ParseCancellationException;
  19407. exports.RecognitionException = RecognitionException;
  19408. exports.NoViableAltException = NoViableAltException;
  19409. exports.LexerNoViableAltException = LexerNoViableAltException;
  19410. exports.InputMismatchException = InputMismatchException;
  19411. exports.FailedPredicateException = FailedPredicateException;
  19412. exports.ParseCancellationException = ParseCancellationException;
  19413. /***/ }),
  19414. /***/ "./node_modules/antlr4/error/index.js":
  19415. /*!********************************************!*\
  19416. !*** ./node_modules/antlr4/error/index.js ***!
  19417. \********************************************/
  19418. /*! no static exports found */
  19419. /***/ (function(module, exports, __webpack_require__) {
  19420. "use strict";
  19421. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19422. * Use of this file is governed by the BSD 3-clause license that
  19423. * can be found in the LICENSE.txt file in the project root.
  19424. */
  19425. exports.RecognitionException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  19426. exports.NoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  19427. exports.LexerNoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  19428. exports.InputMismatchException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").InputMismatchException;
  19429. exports.FailedPredicateException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").FailedPredicateException;
  19430. exports.DiagnosticErrorListener = __webpack_require__(/*! ./DiagnosticErrorListener */ "./node_modules/antlr4/error/DiagnosticErrorListener.js").DiagnosticErrorListener;
  19431. exports.BailErrorStrategy = __webpack_require__(/*! ./ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").BailErrorStrategy;
  19432. exports.ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  19433. /***/ }),
  19434. /***/ "./node_modules/antlr4/index.js":
  19435. /*!**************************************!*\
  19436. !*** ./node_modules/antlr4/index.js ***!
  19437. \**************************************/
  19438. /*! no static exports found */
  19439. /***/ (function(module, exports, __webpack_require__) {
  19440. "use strict";
  19441. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19442. * Use of this file is governed by the BSD 3-clause license that
  19443. * can be found in the LICENSE.txt file in the project root.
  19444. */
  19445. exports.atn = __webpack_require__(/*! ./atn/index */ "./node_modules/antlr4/atn/index.js");
  19446. exports.codepointat = __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  19447. exports.dfa = __webpack_require__(/*! ./dfa/index */ "./node_modules/antlr4/dfa/index.js");
  19448. exports.fromcodepoint = __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  19449. exports.tree = __webpack_require__(/*! ./tree/index */ "./node_modules/antlr4/tree/index.js");
  19450. exports.error = __webpack_require__(/*! ./error/index */ "./node_modules/antlr4/error/index.js");
  19451. exports.Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  19452. exports.CharStreams = __webpack_require__(/*! ./CharStreams */ "./node_modules/antlr4/CharStreams.js").CharStreams;
  19453. exports.CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  19454. exports.InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  19455. exports.FileStream = __webpack_require__(/*! ./FileStream */ "./node_modules/antlr4/FileStream.js").FileStream;
  19456. exports.CommonTokenStream = __webpack_require__(/*! ./CommonTokenStream */ "./node_modules/antlr4/CommonTokenStream.js").CommonTokenStream;
  19457. exports.Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  19458. exports.Parser = __webpack_require__(/*! ./Parser */ "./node_modules/antlr4/Parser.js").Parser;
  19459. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  19460. exports.PredictionContextCache = pc.PredictionContextCache;
  19461. exports.ParserRuleContext = __webpack_require__(/*! ./ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  19462. exports.Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  19463. exports.Utils = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js");
  19464. /***/ }),
  19465. /***/ "./node_modules/antlr4/polyfills/codepointat.js":
  19466. /*!******************************************************!*\
  19467. !*** ./node_modules/antlr4/polyfills/codepointat.js ***!
  19468. \******************************************************/
  19469. /*! no static exports found */
  19470. /***/ (function(module, exports, __webpack_require__) {
  19471. "use strict";
  19472. /*! https://mths.be/codepointat v0.2.0 by @mathias */
  19473. if (!String.prototype.codePointAt) {
  19474. (function () {
  19475. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  19476. var defineProperty = function () {
  19477. // IE 8 only supports `Object.defineProperty` on DOM elements
  19478. try {
  19479. var object = {};
  19480. var $defineProperty = Object.defineProperty;
  19481. var result = $defineProperty(object, object, object) && $defineProperty;
  19482. } catch (error) {}
  19483. return result;
  19484. }();
  19485. var codePointAt = function codePointAt(position) {
  19486. if (this == null) {
  19487. throw TypeError();
  19488. }
  19489. var string = String(this);
  19490. var size = string.length;
  19491. // `ToInteger`
  19492. var index = position ? Number(position) : 0;
  19493. if (index != index) {
  19494. // better `isNaN`
  19495. index = 0;
  19496. }
  19497. // Account for out-of-bounds indices:
  19498. if (index < 0 || index >= size) {
  19499. return undefined;
  19500. }
  19501. // Get the first code unit
  19502. var first = string.charCodeAt(index);
  19503. var second;
  19504. if ( // check if it’s the start of a surrogate pair
  19505. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  19506. size > index + 1 // there is a next code unit
  19507. ) {
  19508. second = string.charCodeAt(index + 1);
  19509. if (second >= 0xDC00 && second <= 0xDFFF) {
  19510. // low surrogate
  19511. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  19512. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  19513. }
  19514. }
  19515. return first;
  19516. };
  19517. if (defineProperty) {
  19518. defineProperty(String.prototype, 'codePointAt', {
  19519. 'value': codePointAt,
  19520. 'configurable': true,
  19521. 'writable': true
  19522. });
  19523. } else {
  19524. String.prototype.codePointAt = codePointAt;
  19525. }
  19526. })();
  19527. }
  19528. /***/ }),
  19529. /***/ "./node_modules/antlr4/polyfills/fromcodepoint.js":
  19530. /*!********************************************************!*\
  19531. !*** ./node_modules/antlr4/polyfills/fromcodepoint.js ***!
  19532. \********************************************************/
  19533. /*! no static exports found */
  19534. /***/ (function(module, exports, __webpack_require__) {
  19535. "use strict";
  19536. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  19537. if (!String.fromCodePoint) {
  19538. (function () {
  19539. var defineProperty = function () {
  19540. // IE 8 only supports `Object.defineProperty` on DOM elements
  19541. try {
  19542. var object = {};
  19543. var $defineProperty = Object.defineProperty;
  19544. var result = $defineProperty(object, object, object) && $defineProperty;
  19545. } catch (error) {}
  19546. return result;
  19547. }();
  19548. var stringFromCharCode = String.fromCharCode;
  19549. var floor = Math.floor;
  19550. var fromCodePoint = function fromCodePoint(_) {
  19551. var MAX_SIZE = 0x4000;
  19552. var codeUnits = [];
  19553. var highSurrogate;
  19554. var lowSurrogate;
  19555. var index = -1;
  19556. var length = arguments.length;
  19557. if (!length) {
  19558. return '';
  19559. }
  19560. var result = '';
  19561. while (++index < length) {
  19562. var codePoint = Number(arguments[index]);
  19563. if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  19564. codePoint < 0 || // not a valid Unicode code point
  19565. codePoint > 0x10FFFF || // not a valid Unicode code point
  19566. floor(codePoint) != codePoint // not an integer
  19567. ) {
  19568. throw RangeError('Invalid code point: ' + codePoint);
  19569. }
  19570. if (codePoint <= 0xFFFF) {
  19571. // BMP code point
  19572. codeUnits.push(codePoint);
  19573. } else {
  19574. // Astral code point; split in surrogate halves
  19575. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  19576. codePoint -= 0x10000;
  19577. highSurrogate = (codePoint >> 10) + 0xD800;
  19578. lowSurrogate = codePoint % 0x400 + 0xDC00;
  19579. codeUnits.push(highSurrogate, lowSurrogate);
  19580. }
  19581. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  19582. result += stringFromCharCode.apply(null, codeUnits);
  19583. codeUnits.length = 0;
  19584. }
  19585. }
  19586. return result;
  19587. };
  19588. if (defineProperty) {
  19589. defineProperty(String, 'fromCodePoint', {
  19590. 'value': fromCodePoint,
  19591. 'configurable': true,
  19592. 'writable': true
  19593. });
  19594. } else {
  19595. String.fromCodePoint = fromCodePoint;
  19596. }
  19597. })();
  19598. }
  19599. /***/ }),
  19600. /***/ "./node_modules/antlr4/tree/Tree.js":
  19601. /*!******************************************!*\
  19602. !*** ./node_modules/antlr4/tree/Tree.js ***!
  19603. \******************************************/
  19604. /*! no static exports found */
  19605. /***/ (function(module, exports, __webpack_require__) {
  19606. "use strict";
  19607. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19608. * Use of this file is governed by the BSD 3-clause license that
  19609. * can be found in the LICENSE.txt file in the project root.
  19610. */
  19611. ///
  19612. // The basic notion of a tree has a parent, a payload, and a list of children.
  19613. // It is the most abstract interface for all the trees used by ANTLR.
  19614. ///
  19615. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  19616. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  19617. var INVALID_INTERVAL = new Interval(-1, -2);
  19618. var Utils = __webpack_require__(/*! ../Utils.js */ "./node_modules/antlr4/Utils.js");
  19619. function Tree() {
  19620. return this;
  19621. }
  19622. function SyntaxTree() {
  19623. Tree.call(this);
  19624. return this;
  19625. }
  19626. SyntaxTree.prototype = Object.create(Tree.prototype);
  19627. SyntaxTree.prototype.constructor = SyntaxTree;
  19628. function ParseTree() {
  19629. SyntaxTree.call(this);
  19630. return this;
  19631. }
  19632. ParseTree.prototype = Object.create(SyntaxTree.prototype);
  19633. ParseTree.prototype.constructor = ParseTree;
  19634. function RuleNode() {
  19635. ParseTree.call(this);
  19636. return this;
  19637. }
  19638. RuleNode.prototype = Object.create(ParseTree.prototype);
  19639. RuleNode.prototype.constructor = RuleNode;
  19640. function TerminalNode() {
  19641. ParseTree.call(this);
  19642. return this;
  19643. }
  19644. TerminalNode.prototype = Object.create(ParseTree.prototype);
  19645. TerminalNode.prototype.constructor = TerminalNode;
  19646. function ErrorNode() {
  19647. TerminalNode.call(this);
  19648. return this;
  19649. }
  19650. ErrorNode.prototype = Object.create(TerminalNode.prototype);
  19651. ErrorNode.prototype.constructor = ErrorNode;
  19652. function ParseTreeVisitor() {
  19653. return this;
  19654. }
  19655. ParseTreeVisitor.prototype.visit = function (ctx) {
  19656. if (Array.isArray(ctx)) {
  19657. return ctx.map(function (child) {
  19658. return child.accept(this);
  19659. }, this);
  19660. } else {
  19661. return ctx.accept(this);
  19662. }
  19663. };
  19664. ParseTreeVisitor.prototype.visitChildren = function (ctx) {
  19665. return this.visit(ctx.children);
  19666. };
  19667. ParseTreeVisitor.prototype.visitTerminal = function (node) {};
  19668. ParseTreeVisitor.prototype.visitErrorNode = function (node) {};
  19669. function ParseTreeListener() {
  19670. return this;
  19671. }
  19672. ParseTreeListener.prototype.visitTerminal = function (node) {};
  19673. ParseTreeListener.prototype.visitErrorNode = function (node) {};
  19674. ParseTreeListener.prototype.enterEveryRule = function (node) {};
  19675. ParseTreeListener.prototype.exitEveryRule = function (node) {};
  19676. function TerminalNodeImpl(symbol) {
  19677. TerminalNode.call(this);
  19678. this.parentCtx = null;
  19679. this.symbol = symbol;
  19680. return this;
  19681. }
  19682. TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype);
  19683. TerminalNodeImpl.prototype.constructor = TerminalNodeImpl;
  19684. TerminalNodeImpl.prototype.getChild = function (i) {
  19685. return null;
  19686. };
  19687. TerminalNodeImpl.prototype.getSymbol = function () {
  19688. return this.symbol;
  19689. };
  19690. TerminalNodeImpl.prototype.getParent = function () {
  19691. return this.parentCtx;
  19692. };
  19693. TerminalNodeImpl.prototype.getPayload = function () {
  19694. return this.symbol;
  19695. };
  19696. TerminalNodeImpl.prototype.getSourceInterval = function () {
  19697. if (this.symbol === null) {
  19698. return INVALID_INTERVAL;
  19699. }
  19700. var tokenIndex = this.symbol.tokenIndex;
  19701. return new Interval(tokenIndex, tokenIndex);
  19702. };
  19703. TerminalNodeImpl.prototype.getChildCount = function () {
  19704. return 0;
  19705. };
  19706. TerminalNodeImpl.prototype.accept = function (visitor) {
  19707. return visitor.visitTerminal(this);
  19708. };
  19709. TerminalNodeImpl.prototype.getText = function () {
  19710. return this.symbol.text;
  19711. };
  19712. TerminalNodeImpl.prototype.toString = function () {
  19713. if (this.symbol.type === Token.EOF) {
  19714. return "<EOF>";
  19715. } else {
  19716. return this.symbol.text;
  19717. }
  19718. };
  19719. // Represents a token that was consumed during resynchronization
  19720. // rather than during a valid match operation. For example,
  19721. // we will create this kind of a node during single token insertion
  19722. // and deletion as well as during "consume until error recovery set"
  19723. // upon no viable alternative exceptions.
  19724. function ErrorNodeImpl(token) {
  19725. TerminalNodeImpl.call(this, token);
  19726. return this;
  19727. }
  19728. ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype);
  19729. ErrorNodeImpl.prototype.constructor = ErrorNodeImpl;
  19730. ErrorNodeImpl.prototype.isErrorNode = function () {
  19731. return true;
  19732. };
  19733. ErrorNodeImpl.prototype.accept = function (visitor) {
  19734. return visitor.visitErrorNode(this);
  19735. };
  19736. function ParseTreeWalker() {
  19737. return this;
  19738. }
  19739. ParseTreeWalker.prototype.walk = function (listener, t) {
  19740. var errorNode = t instanceof ErrorNode || t.isErrorNode !== undefined && t.isErrorNode();
  19741. if (errorNode) {
  19742. listener.visitErrorNode(t);
  19743. } else if (t instanceof TerminalNode) {
  19744. listener.visitTerminal(t);
  19745. } else {
  19746. this.enterRule(listener, t);
  19747. for (var i = 0; i < t.getChildCount(); i++) {
  19748. var child = t.getChild(i);
  19749. this.walk(listener, child);
  19750. }
  19751. this.exitRule(listener, t);
  19752. }
  19753. };
  19754. //
  19755. // The discovery of a rule node, involves sending two events: the generic
  19756. // {@link ParseTreeListener//enterEveryRule} and a
  19757. // {@link RuleContext}-specific event. First we trigger the generic and then
  19758. // the rule specific. We to them in reverse order upon finishing the node.
  19759. //
  19760. ParseTreeWalker.prototype.enterRule = function (listener, r) {
  19761. var ctx = r.getRuleContext();
  19762. listener.enterEveryRule(ctx);
  19763. ctx.enterRule(listener);
  19764. };
  19765. ParseTreeWalker.prototype.exitRule = function (listener, r) {
  19766. var ctx = r.getRuleContext();
  19767. ctx.exitRule(listener);
  19768. listener.exitEveryRule(ctx);
  19769. };
  19770. ParseTreeWalker.DEFAULT = new ParseTreeWalker();
  19771. exports.RuleNode = RuleNode;
  19772. exports.ErrorNode = ErrorNode;
  19773. exports.TerminalNode = TerminalNode;
  19774. exports.ErrorNodeImpl = ErrorNodeImpl;
  19775. exports.TerminalNodeImpl = TerminalNodeImpl;
  19776. exports.ParseTreeListener = ParseTreeListener;
  19777. exports.ParseTreeVisitor = ParseTreeVisitor;
  19778. exports.ParseTreeWalker = ParseTreeWalker;
  19779. exports.INVALID_INTERVAL = INVALID_INTERVAL;
  19780. /***/ }),
  19781. /***/ "./node_modules/antlr4/tree/Trees.js":
  19782. /*!*******************************************!*\
  19783. !*** ./node_modules/antlr4/tree/Trees.js ***!
  19784. \*******************************************/
  19785. /*! no static exports found */
  19786. /***/ (function(module, exports, __webpack_require__) {
  19787. "use strict";
  19788. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19789. * Use of this file is governed by the BSD 3-clause license that
  19790. * can be found in the LICENSE.txt file in the project root.
  19791. */
  19792. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  19793. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  19794. var RuleNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  19795. var ErrorNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  19796. var TerminalNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  19797. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  19798. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  19799. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./../atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  19800. /** A set of utility routines useful for all kinds of ANTLR trees. */
  19801. function Trees() {}
  19802. // Print out a whole tree in LISP form. {@link //getNodeText} is used on the
  19803. // node payloads to get the text for the nodes. Detect
  19804. // parse trees and extract data appropriately.
  19805. Trees.toStringTree = function (tree, ruleNames, recog) {
  19806. ruleNames = ruleNames || null;
  19807. recog = recog || null;
  19808. if (recog !== null) {
  19809. ruleNames = recog.ruleNames;
  19810. }
  19811. var s = Trees.getNodeText(tree, ruleNames);
  19812. s = Utils.escapeWhitespace(s, false);
  19813. var c = tree.getChildCount();
  19814. if (c === 0) {
  19815. return s;
  19816. }
  19817. var res = "(" + s + ' ';
  19818. if (c > 0) {
  19819. s = Trees.toStringTree(tree.getChild(0), ruleNames);
  19820. res = res.concat(s);
  19821. }
  19822. for (var i = 1; i < c; i++) {
  19823. s = Trees.toStringTree(tree.getChild(i), ruleNames);
  19824. res = res.concat(' ' + s);
  19825. }
  19826. res = res.concat(")");
  19827. return res;
  19828. };
  19829. Trees.getNodeText = function (t, ruleNames, recog) {
  19830. ruleNames = ruleNames || null;
  19831. recog = recog || null;
  19832. if (recog !== null) {
  19833. ruleNames = recog.ruleNames;
  19834. }
  19835. if (ruleNames !== null) {
  19836. if (t instanceof RuleContext) {
  19837. var altNumber = t.getAltNumber();
  19838. if (altNumber != INVALID_ALT_NUMBER) {
  19839. return ruleNames[t.ruleIndex] + ":" + altNumber;
  19840. }
  19841. return ruleNames[t.ruleIndex];
  19842. } else if (t instanceof ErrorNode) {
  19843. return t.toString();
  19844. } else if (t instanceof TerminalNode) {
  19845. if (t.symbol !== null) {
  19846. return t.symbol.text;
  19847. }
  19848. }
  19849. }
  19850. // no recog for rule names
  19851. var payload = t.getPayload();
  19852. if (payload instanceof Token) {
  19853. return payload.text;
  19854. }
  19855. return t.getPayload().toString();
  19856. };
  19857. // Return ordered list of all children of this node
  19858. Trees.getChildren = function (t) {
  19859. var list = [];
  19860. for (var i = 0; i < t.getChildCount(); i++) {
  19861. list.push(t.getChild(i));
  19862. }
  19863. return list;
  19864. };
  19865. // Return a list of all ancestors of this node. The first node of
  19866. // list is the root and the last is the parent of this node.
  19867. //
  19868. Trees.getAncestors = function (t) {
  19869. var ancestors = [];
  19870. t = t.getParent();
  19871. while (t !== null) {
  19872. ancestors = [t].concat(ancestors);
  19873. t = t.getParent();
  19874. }
  19875. return ancestors;
  19876. };
  19877. Trees.findAllTokenNodes = function (t, ttype) {
  19878. return Trees.findAllNodes(t, ttype, true);
  19879. };
  19880. Trees.findAllRuleNodes = function (t, ruleIndex) {
  19881. return Trees.findAllNodes(t, ruleIndex, false);
  19882. };
  19883. Trees.findAllNodes = function (t, index, findTokens) {
  19884. var nodes = [];
  19885. Trees._findAllNodes(t, index, findTokens, nodes);
  19886. return nodes;
  19887. };
  19888. Trees._findAllNodes = function (t, index, findTokens, nodes) {
  19889. // check this node (the root) first
  19890. if (findTokens && t instanceof TerminalNode) {
  19891. if (t.symbol.type === index) {
  19892. nodes.push(t);
  19893. }
  19894. } else if (!findTokens && t instanceof ParserRuleContext) {
  19895. if (t.ruleIndex === index) {
  19896. nodes.push(t);
  19897. }
  19898. }
  19899. // check children
  19900. for (var i = 0; i < t.getChildCount(); i++) {
  19901. Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
  19902. }
  19903. };
  19904. Trees.descendants = function (t) {
  19905. var nodes = [t];
  19906. for (var i = 0; i < t.getChildCount(); i++) {
  19907. nodes = nodes.concat(Trees.descendants(t.getChild(i)));
  19908. }
  19909. return nodes;
  19910. };
  19911. exports.Trees = Trees;
  19912. /***/ }),
  19913. /***/ "./node_modules/antlr4/tree/index.js":
  19914. /*!*******************************************!*\
  19915. !*** ./node_modules/antlr4/tree/index.js ***!
  19916. \*******************************************/
  19917. /*! no static exports found */
  19918. /***/ (function(module, exports, __webpack_require__) {
  19919. "use strict";
  19920. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19921. * Use of this file is governed by the BSD 3-clause license that
  19922. * can be found in the LICENSE.txt file in the project root.
  19923. */
  19924. var Tree = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js");
  19925. exports.Trees = __webpack_require__(/*! ./Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  19926. exports.RuleNode = Tree.RuleNode;
  19927. exports.ParseTreeListener = Tree.ParseTreeListener;
  19928. exports.ParseTreeVisitor = Tree.ParseTreeVisitor;
  19929. exports.ParseTreeWalker = Tree.ParseTreeWalker;
  19930. /***/ }),
  19931. /***/ "./node_modules/decimal.js/decimal.js":
  19932. /*!********************************************!*\
  19933. !*** ./node_modules/decimal.js/decimal.js ***!
  19934. \********************************************/
  19935. /*! no static exports found */
  19936. /***/ (function(module, exports, __webpack_require__) {
  19937. "use strict";
  19938. var __WEBPACK_AMD_DEFINE_RESULT__;
  19939. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  19940. /*! decimal.js v10.0.1 https://github.com/MikeMcl/decimal.js/LICENCE */
  19941. ;(function (globalScope) {
  19942. 'use strict';
  19943. /*
  19944. * decimal.js v10.0.1
  19945. * An arbitrary-precision Decimal type for JavaScript.
  19946. * https://github.com/MikeMcl/decimal.js
  19947. * Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>
  19948. * MIT Licence
  19949. */
  19950. // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
  19951. // The maximum exponent magnitude.
  19952. // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
  19953. var EXP_LIMIT = 9e15,
  19954. // 0 to 9e15
  19955. // The limit on the value of `precision`, and on the value of the first argument to
  19956. // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
  19957. MAX_DIGITS = 1e9,
  19958. // 0 to 1e9
  19959. // Base conversion alphabet.
  19960. NUMERALS = '0123456789abcdef',
  19961. // The natural logarithm of 10 (1025 digits).
  19962. LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
  19963. // Pi (1025 digits).
  19964. PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
  19965. // The initial configuration properties of the Decimal constructor.
  19966. DEFAULTS = {
  19967. // These values must be integers within the stated ranges (inclusive).
  19968. // Most of these values can be changed at run-time using the `Decimal.config` method.
  19969. // The maximum number of significant digits of the result of a calculation or base conversion.
  19970. // E.g. `Decimal.config({ precision: 20 });`
  19971. precision: 20, // 1 to MAX_DIGITS
  19972. // The rounding mode used when rounding to `precision`.
  19973. //
  19974. // ROUND_UP 0 Away from zero.
  19975. // ROUND_DOWN 1 Towards zero.
  19976. // ROUND_CEIL 2 Towards +Infinity.
  19977. // ROUND_FLOOR 3 Towards -Infinity.
  19978. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
  19979. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
  19980. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
  19981. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
  19982. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
  19983. //
  19984. // E.g.
  19985. // `Decimal.rounding = 4;`
  19986. // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
  19987. rounding: 4, // 0 to 8
  19988. // The modulo mode used when calculating the modulus: a mod n.
  19989. // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
  19990. // The remainder (r) is calculated as: r = a - n * q.
  19991. //
  19992. // UP 0 The remainder is positive if the dividend is negative, else is negative.
  19993. // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
  19994. // FLOOR 3 The remainder has the same sign as the divisor (Python %).
  19995. // HALF_EVEN 6 The IEEE 754 remainder function.
  19996. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
  19997. //
  19998. // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
  19999. // division (9) are commonly used for the modulus operation. The other rounding modes can also
  20000. // be used, but they may not give useful results.
  20001. modulo: 1, // 0 to 9
  20002. // The exponent value at and beneath which `toString` returns exponential notation.
  20003. // JavaScript numbers: -7
  20004. toExpNeg: -7, // 0 to -EXP_LIMIT
  20005. // The exponent value at and above which `toString` returns exponential notation.
  20006. // JavaScript numbers: 21
  20007. toExpPos: 21, // 0 to EXP_LIMIT
  20008. // The minimum exponent value, beneath which underflow to zero occurs.
  20009. // JavaScript numbers: -324 (5e-324)
  20010. minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
  20011. // The maximum exponent value, above which overflow to Infinity occurs.
  20012. // JavaScript numbers: 308 (1.7976931348623157e+308)
  20013. maxE: EXP_LIMIT, // 1 to EXP_LIMIT
  20014. // Whether to use cryptographically-secure random number generation, if available.
  20015. crypto: false // true/false
  20016. },
  20017. // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
  20018. Decimal,
  20019. inexact,
  20020. noConflict,
  20021. quadrant,
  20022. external = true,
  20023. decimalError = '[DecimalError] ',
  20024. invalidArgument = decimalError + 'Invalid argument: ',
  20025. precisionLimitExceeded = decimalError + 'Precision limit exceeded',
  20026. cryptoUnavailable = decimalError + 'crypto unavailable',
  20027. mathfloor = Math.floor,
  20028. mathpow = Math.pow,
  20029. isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
  20030. isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
  20031. isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
  20032. isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
  20033. BASE = 1e7,
  20034. LOG_BASE = 7,
  20035. MAX_SAFE_INTEGER = 9007199254740991,
  20036. LN10_PRECISION = LN10.length - 1,
  20037. PI_PRECISION = PI.length - 1,
  20038. // Decimal.prototype object
  20039. P = { name: '[object Decimal]' };
  20040. // Decimal prototype methods
  20041. /*
  20042. * absoluteValue abs
  20043. * ceil
  20044. * comparedTo cmp
  20045. * cosine cos
  20046. * cubeRoot cbrt
  20047. * decimalPlaces dp
  20048. * dividedBy div
  20049. * dividedToIntegerBy divToInt
  20050. * equals eq
  20051. * floor
  20052. * greaterThan gt
  20053. * greaterThanOrEqualTo gte
  20054. * hyperbolicCosine cosh
  20055. * hyperbolicSine sinh
  20056. * hyperbolicTangent tanh
  20057. * inverseCosine acos
  20058. * inverseHyperbolicCosine acosh
  20059. * inverseHyperbolicSine asinh
  20060. * inverseHyperbolicTangent atanh
  20061. * inverseSine asin
  20062. * inverseTangent atan
  20063. * isFinite
  20064. * isInteger isInt
  20065. * isNaN
  20066. * isNegative isNeg
  20067. * isPositive isPos
  20068. * isZero
  20069. * lessThan lt
  20070. * lessThanOrEqualTo lte
  20071. * logarithm log
  20072. * [maximum] [max]
  20073. * [minimum] [min]
  20074. * minus sub
  20075. * modulo mod
  20076. * naturalExponential exp
  20077. * naturalLogarithm ln
  20078. * negated neg
  20079. * plus add
  20080. * precision sd
  20081. * round
  20082. * sine sin
  20083. * squareRoot sqrt
  20084. * tangent tan
  20085. * times mul
  20086. * toBinary
  20087. * toDecimalPlaces toDP
  20088. * toExponential
  20089. * toFixed
  20090. * toFraction
  20091. * toHexadecimal toHex
  20092. * toNearest
  20093. * toNumber
  20094. * toOctal
  20095. * toPower pow
  20096. * toPrecision
  20097. * toSignificantDigits toSD
  20098. * toString
  20099. * truncated trunc
  20100. * valueOf toJSON
  20101. */
  20102. /*
  20103. * Return a new Decimal whose value is the absolute value of this Decimal.
  20104. *
  20105. */
  20106. P.absoluteValue = P.abs = function () {
  20107. var x = new this.constructor(this);
  20108. if (x.s < 0) x.s = 1;
  20109. return finalise(x);
  20110. };
  20111. /*
  20112. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  20113. * direction of positive Infinity.
  20114. *
  20115. */
  20116. P.ceil = function () {
  20117. return finalise(new this.constructor(this), this.e + 1, 2);
  20118. };
  20119. /*
  20120. * Return
  20121. * 1 if the value of this Decimal is greater than the value of `y`,
  20122. * -1 if the value of this Decimal is less than the value of `y`,
  20123. * 0 if they have the same value,
  20124. * NaN if the value of either Decimal is NaN.
  20125. *
  20126. */
  20127. P.comparedTo = P.cmp = function (y) {
  20128. var i,
  20129. j,
  20130. xdL,
  20131. ydL,
  20132. x = this,
  20133. xd = x.d,
  20134. yd = (y = new x.constructor(y)).d,
  20135. xs = x.s,
  20136. ys = y.s;
  20137. // Either NaN or ±Infinity?
  20138. if (!xd || !yd) {
  20139. return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
  20140. }
  20141. // Either zero?
  20142. if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
  20143. // Signs differ?
  20144. if (xs !== ys) return xs;
  20145. // Compare exponents.
  20146. if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
  20147. xdL = xd.length;
  20148. ydL = yd.length;
  20149. // Compare digit by digit.
  20150. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
  20151. if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
  20152. }
  20153. // Compare lengths.
  20154. return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
  20155. };
  20156. /*
  20157. * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
  20158. *
  20159. * Domain: [-Infinity, Infinity]
  20160. * Range: [-1, 1]
  20161. *
  20162. * cos(0) = 1
  20163. * cos(-0) = 1
  20164. * cos(Infinity) = NaN
  20165. * cos(-Infinity) = NaN
  20166. * cos(NaN) = NaN
  20167. *
  20168. */
  20169. P.cosine = P.cos = function () {
  20170. var pr,
  20171. rm,
  20172. x = this,
  20173. Ctor = x.constructor;
  20174. if (!x.d) return new Ctor(NaN);
  20175. // cos(0) = cos(-0) = 1
  20176. if (!x.d[0]) return new Ctor(1);
  20177. pr = Ctor.precision;
  20178. rm = Ctor.rounding;
  20179. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  20180. Ctor.rounding = 1;
  20181. x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
  20182. Ctor.precision = pr;
  20183. Ctor.rounding = rm;
  20184. return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
  20185. };
  20186. /*
  20187. *
  20188. * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
  20189. * `precision` significant digits using rounding mode `rounding`.
  20190. *
  20191. * cbrt(0) = 0
  20192. * cbrt(-0) = -0
  20193. * cbrt(1) = 1
  20194. * cbrt(-1) = -1
  20195. * cbrt(N) = N
  20196. * cbrt(-I) = -I
  20197. * cbrt(I) = I
  20198. *
  20199. * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
  20200. *
  20201. */
  20202. P.cubeRoot = P.cbrt = function () {
  20203. var e,
  20204. m,
  20205. n,
  20206. r,
  20207. rep,
  20208. s,
  20209. sd,
  20210. t,
  20211. t3,
  20212. t3plusx,
  20213. x = this,
  20214. Ctor = x.constructor;
  20215. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  20216. external = false;
  20217. // Initial estimate.
  20218. s = x.s * Math.pow(x.s * x, 1 / 3);
  20219. // Math.cbrt underflow/overflow?
  20220. // Pass x to Math.pow as integer, then adjust the exponent of the result.
  20221. if (!s || Math.abs(s) == 1 / 0) {
  20222. n = digitsToString(x.d);
  20223. e = x.e;
  20224. // Adjust n exponent so it is a multiple of 3 away from x exponent.
  20225. if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? '0' : '00';
  20226. s = Math.pow(n, 1 / 3);
  20227. // Rarely, e may be one less than the result exponent value.
  20228. e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
  20229. if (s == 1 / 0) {
  20230. n = '5e' + e;
  20231. } else {
  20232. n = s.toExponential();
  20233. n = n.slice(0, n.indexOf('e') + 1) + e;
  20234. }
  20235. r = new Ctor(n);
  20236. r.s = x.s;
  20237. } else {
  20238. r = new Ctor(s.toString());
  20239. }
  20240. sd = (e = Ctor.precision) + 3;
  20241. // Halley's method.
  20242. // TODO? Compare Newton's method.
  20243. for (;;) {
  20244. t = r;
  20245. t3 = t.times(t).times(t);
  20246. t3plusx = t3.plus(x);
  20247. r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
  20248. // TODO? Replace with for-loop and checkRoundingDigits.
  20249. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  20250. n = n.slice(sd - 3, sd + 1);
  20251. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
  20252. // , i.e. approaching a rounding boundary, continue the iteration.
  20253. if (n == '9999' || !rep && n == '4999') {
  20254. // On the first iteration only, check to see if rounding up gives the exact result as the
  20255. // nines may infinitely repeat.
  20256. if (!rep) {
  20257. finalise(t, e + 1, 0);
  20258. if (t.times(t).times(t).eq(x)) {
  20259. r = t;
  20260. break;
  20261. }
  20262. }
  20263. sd += 4;
  20264. rep = 1;
  20265. } else {
  20266. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  20267. // If not, then there are further digits and m will be truthy.
  20268. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  20269. // Truncate to the first rounding digit.
  20270. finalise(r, e + 1, 1);
  20271. m = !r.times(r).times(r).eq(x);
  20272. }
  20273. break;
  20274. }
  20275. }
  20276. }
  20277. external = true;
  20278. return finalise(r, e, Ctor.rounding, m);
  20279. };
  20280. /*
  20281. * Return the number of decimal places of the value of this Decimal.
  20282. *
  20283. */
  20284. P.decimalPlaces = P.dp = function () {
  20285. var w,
  20286. d = this.d,
  20287. n = NaN;
  20288. if (d) {
  20289. w = d.length - 1;
  20290. n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
  20291. // Subtract the number of trailing zeros of the last word.
  20292. w = d[w];
  20293. if (w) for (; w % 10 == 0; w /= 10) {
  20294. n--;
  20295. }if (n < 0) n = 0;
  20296. }
  20297. return n;
  20298. };
  20299. /*
  20300. * n / 0 = I
  20301. * n / N = N
  20302. * n / I = 0
  20303. * 0 / n = 0
  20304. * 0 / 0 = N
  20305. * 0 / N = N
  20306. * 0 / I = 0
  20307. * N / n = N
  20308. * N / 0 = N
  20309. * N / N = N
  20310. * N / I = N
  20311. * I / n = I
  20312. * I / 0 = I
  20313. * I / N = N
  20314. * I / I = N
  20315. *
  20316. * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
  20317. * `precision` significant digits using rounding mode `rounding`.
  20318. *
  20319. */
  20320. P.dividedBy = P.div = function (y) {
  20321. return divide(this, new this.constructor(y));
  20322. };
  20323. /*
  20324. * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
  20325. * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
  20326. *
  20327. */
  20328. P.dividedToIntegerBy = P.divToInt = function (y) {
  20329. var x = this,
  20330. Ctor = x.constructor;
  20331. return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
  20332. };
  20333. /*
  20334. * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
  20335. *
  20336. */
  20337. P.equals = P.eq = function (y) {
  20338. return this.cmp(y) === 0;
  20339. };
  20340. /*
  20341. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  20342. * direction of negative Infinity.
  20343. *
  20344. */
  20345. P.floor = function () {
  20346. return finalise(new this.constructor(this), this.e + 1, 3);
  20347. };
  20348. /*
  20349. * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
  20350. * false.
  20351. *
  20352. */
  20353. P.greaterThan = P.gt = function (y) {
  20354. return this.cmp(y) > 0;
  20355. };
  20356. /*
  20357. * Return true if the value of this Decimal is greater than or equal to the value of `y`,
  20358. * otherwise return false.
  20359. *
  20360. */
  20361. P.greaterThanOrEqualTo = P.gte = function (y) {
  20362. var k = this.cmp(y);
  20363. return k == 1 || k === 0;
  20364. };
  20365. /*
  20366. * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
  20367. * Decimal.
  20368. *
  20369. * Domain: [-Infinity, Infinity]
  20370. * Range: [1, Infinity]
  20371. *
  20372. * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
  20373. *
  20374. * cosh(0) = 1
  20375. * cosh(-0) = 1
  20376. * cosh(Infinity) = Infinity
  20377. * cosh(-Infinity) = Infinity
  20378. * cosh(NaN) = NaN
  20379. *
  20380. * x time taken (ms) result
  20381. * 1000 9 9.8503555700852349694e+433
  20382. * 10000 25 4.4034091128314607936e+4342
  20383. * 100000 171 1.4033316802130615897e+43429
  20384. * 1000000 3817 1.5166076984010437725e+434294
  20385. * 10000000 abandoned after 2 minute wait
  20386. *
  20387. * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
  20388. *
  20389. */
  20390. P.hyperbolicCosine = P.cosh = function () {
  20391. var k,
  20392. n,
  20393. pr,
  20394. rm,
  20395. len,
  20396. x = this,
  20397. Ctor = x.constructor,
  20398. one = new Ctor(1);
  20399. if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
  20400. if (x.isZero()) return one;
  20401. pr = Ctor.precision;
  20402. rm = Ctor.rounding;
  20403. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  20404. Ctor.rounding = 1;
  20405. len = x.d.length;
  20406. // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
  20407. // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
  20408. // Estimate the optimum number of times to use the argument reduction.
  20409. // TODO? Estimation reused from cosine() and may not be optimal here.
  20410. if (len < 32) {
  20411. k = Math.ceil(len / 3);
  20412. n = Math.pow(4, -k).toString();
  20413. } else {
  20414. k = 16;
  20415. n = '2.3283064365386962890625e-10';
  20416. }
  20417. x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
  20418. // Reverse argument reduction
  20419. var cosh2_x,
  20420. i = k,
  20421. d8 = new Ctor(8);
  20422. for (; i--;) {
  20423. cosh2_x = x.times(x);
  20424. x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
  20425. }
  20426. return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
  20427. };
  20428. /*
  20429. * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
  20430. * Decimal.
  20431. *
  20432. * Domain: [-Infinity, Infinity]
  20433. * Range: [-Infinity, Infinity]
  20434. *
  20435. * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
  20436. *
  20437. * sinh(0) = 0
  20438. * sinh(-0) = -0
  20439. * sinh(Infinity) = Infinity
  20440. * sinh(-Infinity) = -Infinity
  20441. * sinh(NaN) = NaN
  20442. *
  20443. * x time taken (ms)
  20444. * 10 2 ms
  20445. * 100 5 ms
  20446. * 1000 14 ms
  20447. * 10000 82 ms
  20448. * 100000 886 ms 1.4033316802130615897e+43429
  20449. * 200000 2613 ms
  20450. * 300000 5407 ms
  20451. * 400000 8824 ms
  20452. * 500000 13026 ms 8.7080643612718084129e+217146
  20453. * 1000000 48543 ms
  20454. *
  20455. * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
  20456. *
  20457. */
  20458. P.hyperbolicSine = P.sinh = function () {
  20459. var k,
  20460. pr,
  20461. rm,
  20462. len,
  20463. x = this,
  20464. Ctor = x.constructor;
  20465. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  20466. pr = Ctor.precision;
  20467. rm = Ctor.rounding;
  20468. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  20469. Ctor.rounding = 1;
  20470. len = x.d.length;
  20471. if (len < 3) {
  20472. x = taylorSeries(Ctor, 2, x, x, true);
  20473. } else {
  20474. // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
  20475. // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
  20476. // 3 multiplications and 1 addition
  20477. // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
  20478. // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
  20479. // 4 multiplications and 2 additions
  20480. // Estimate the optimum number of times to use the argument reduction.
  20481. k = 1.4 * Math.sqrt(len);
  20482. k = k > 16 ? 16 : k | 0;
  20483. x = x.times(Math.pow(5, -k));
  20484. x = taylorSeries(Ctor, 2, x, x, true);
  20485. // Reverse argument reduction
  20486. var sinh2_x,
  20487. d5 = new Ctor(5),
  20488. d16 = new Ctor(16),
  20489. d20 = new Ctor(20);
  20490. for (; k--;) {
  20491. sinh2_x = x.times(x);
  20492. x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
  20493. }
  20494. }
  20495. Ctor.precision = pr;
  20496. Ctor.rounding = rm;
  20497. return finalise(x, pr, rm, true);
  20498. };
  20499. /*
  20500. * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
  20501. * Decimal.
  20502. *
  20503. * Domain: [-Infinity, Infinity]
  20504. * Range: [-1, 1]
  20505. *
  20506. * tanh(x) = sinh(x) / cosh(x)
  20507. *
  20508. * tanh(0) = 0
  20509. * tanh(-0) = -0
  20510. * tanh(Infinity) = 1
  20511. * tanh(-Infinity) = -1
  20512. * tanh(NaN) = NaN
  20513. *
  20514. */
  20515. P.hyperbolicTangent = P.tanh = function () {
  20516. var pr,
  20517. rm,
  20518. x = this,
  20519. Ctor = x.constructor;
  20520. if (!x.isFinite()) return new Ctor(x.s);
  20521. if (x.isZero()) return new Ctor(x);
  20522. pr = Ctor.precision;
  20523. rm = Ctor.rounding;
  20524. Ctor.precision = pr + 7;
  20525. Ctor.rounding = 1;
  20526. return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
  20527. };
  20528. /*
  20529. * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
  20530. * this Decimal.
  20531. *
  20532. * Domain: [-1, 1]
  20533. * Range: [0, pi]
  20534. *
  20535. * acos(x) = pi/2 - asin(x)
  20536. *
  20537. * acos(0) = pi/2
  20538. * acos(-0) = pi/2
  20539. * acos(1) = 0
  20540. * acos(-1) = pi
  20541. * acos(1/2) = pi/3
  20542. * acos(-1/2) = 2*pi/3
  20543. * acos(|x| > 1) = NaN
  20544. * acos(NaN) = NaN
  20545. *
  20546. */
  20547. P.inverseCosine = P.acos = function () {
  20548. var halfPi,
  20549. x = this,
  20550. Ctor = x.constructor,
  20551. k = x.abs().cmp(1),
  20552. pr = Ctor.precision,
  20553. rm = Ctor.rounding;
  20554. if (k !== -1) {
  20555. return k === 0
  20556. // |x| is 1
  20557. ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
  20558. // |x| > 1 or x is NaN
  20559. : new Ctor(NaN);
  20560. }
  20561. if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
  20562. // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
  20563. Ctor.precision = pr + 6;
  20564. Ctor.rounding = 1;
  20565. x = x.asin();
  20566. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  20567. Ctor.precision = pr;
  20568. Ctor.rounding = rm;
  20569. return halfPi.minus(x);
  20570. };
  20571. /*
  20572. * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
  20573. * value of this Decimal.
  20574. *
  20575. * Domain: [1, Infinity]
  20576. * Range: [0, Infinity]
  20577. *
  20578. * acosh(x) = ln(x + sqrt(x^2 - 1))
  20579. *
  20580. * acosh(x < 1) = NaN
  20581. * acosh(NaN) = NaN
  20582. * acosh(Infinity) = Infinity
  20583. * acosh(-Infinity) = NaN
  20584. * acosh(0) = NaN
  20585. * acosh(-0) = NaN
  20586. * acosh(1) = 0
  20587. * acosh(-1) = NaN
  20588. *
  20589. */
  20590. P.inverseHyperbolicCosine = P.acosh = function () {
  20591. var pr,
  20592. rm,
  20593. x = this,
  20594. Ctor = x.constructor;
  20595. if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
  20596. if (!x.isFinite()) return new Ctor(x);
  20597. pr = Ctor.precision;
  20598. rm = Ctor.rounding;
  20599. Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
  20600. Ctor.rounding = 1;
  20601. external = false;
  20602. x = x.times(x).minus(1).sqrt().plus(x);
  20603. external = true;
  20604. Ctor.precision = pr;
  20605. Ctor.rounding = rm;
  20606. return x.ln();
  20607. };
  20608. /*
  20609. * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
  20610. * of this Decimal.
  20611. *
  20612. * Domain: [-Infinity, Infinity]
  20613. * Range: [-Infinity, Infinity]
  20614. *
  20615. * asinh(x) = ln(x + sqrt(x^2 + 1))
  20616. *
  20617. * asinh(NaN) = NaN
  20618. * asinh(Infinity) = Infinity
  20619. * asinh(-Infinity) = -Infinity
  20620. * asinh(0) = 0
  20621. * asinh(-0) = -0
  20622. *
  20623. */
  20624. P.inverseHyperbolicSine = P.asinh = function () {
  20625. var pr,
  20626. rm,
  20627. x = this,
  20628. Ctor = x.constructor;
  20629. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  20630. pr = Ctor.precision;
  20631. rm = Ctor.rounding;
  20632. Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
  20633. Ctor.rounding = 1;
  20634. external = false;
  20635. x = x.times(x).plus(1).sqrt().plus(x);
  20636. external = true;
  20637. Ctor.precision = pr;
  20638. Ctor.rounding = rm;
  20639. return x.ln();
  20640. };
  20641. /*
  20642. * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
  20643. * value of this Decimal.
  20644. *
  20645. * Domain: [-1, 1]
  20646. * Range: [-Infinity, Infinity]
  20647. *
  20648. * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
  20649. *
  20650. * atanh(|x| > 1) = NaN
  20651. * atanh(NaN) = NaN
  20652. * atanh(Infinity) = NaN
  20653. * atanh(-Infinity) = NaN
  20654. * atanh(0) = 0
  20655. * atanh(-0) = -0
  20656. * atanh(1) = Infinity
  20657. * atanh(-1) = -Infinity
  20658. *
  20659. */
  20660. P.inverseHyperbolicTangent = P.atanh = function () {
  20661. var pr,
  20662. rm,
  20663. wpr,
  20664. xsd,
  20665. x = this,
  20666. Ctor = x.constructor;
  20667. if (!x.isFinite()) return new Ctor(NaN);
  20668. if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
  20669. pr = Ctor.precision;
  20670. rm = Ctor.rounding;
  20671. xsd = x.sd();
  20672. if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
  20673. Ctor.precision = wpr = xsd - x.e;
  20674. x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
  20675. Ctor.precision = pr + 4;
  20676. Ctor.rounding = 1;
  20677. x = x.ln();
  20678. Ctor.precision = pr;
  20679. Ctor.rounding = rm;
  20680. return x.times(0.5);
  20681. };
  20682. /*
  20683. * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
  20684. * Decimal.
  20685. *
  20686. * Domain: [-Infinity, Infinity]
  20687. * Range: [-pi/2, pi/2]
  20688. *
  20689. * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
  20690. *
  20691. * asin(0) = 0
  20692. * asin(-0) = -0
  20693. * asin(1/2) = pi/6
  20694. * asin(-1/2) = -pi/6
  20695. * asin(1) = pi/2
  20696. * asin(-1) = -pi/2
  20697. * asin(|x| > 1) = NaN
  20698. * asin(NaN) = NaN
  20699. *
  20700. * TODO? Compare performance of Taylor series.
  20701. *
  20702. */
  20703. P.inverseSine = P.asin = function () {
  20704. var halfPi,
  20705. k,
  20706. pr,
  20707. rm,
  20708. x = this,
  20709. Ctor = x.constructor;
  20710. if (x.isZero()) return new Ctor(x);
  20711. k = x.abs().cmp(1);
  20712. pr = Ctor.precision;
  20713. rm = Ctor.rounding;
  20714. if (k !== -1) {
  20715. // |x| is 1
  20716. if (k === 0) {
  20717. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  20718. halfPi.s = x.s;
  20719. return halfPi;
  20720. }
  20721. // |x| > 1 or x is NaN
  20722. return new Ctor(NaN);
  20723. }
  20724. // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
  20725. Ctor.precision = pr + 6;
  20726. Ctor.rounding = 1;
  20727. x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
  20728. Ctor.precision = pr;
  20729. Ctor.rounding = rm;
  20730. return x.times(2);
  20731. };
  20732. /*
  20733. * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
  20734. * of this Decimal.
  20735. *
  20736. * Domain: [-Infinity, Infinity]
  20737. * Range: [-pi/2, pi/2]
  20738. *
  20739. * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  20740. *
  20741. * atan(0) = 0
  20742. * atan(-0) = -0
  20743. * atan(1) = pi/4
  20744. * atan(-1) = -pi/4
  20745. * atan(Infinity) = pi/2
  20746. * atan(-Infinity) = -pi/2
  20747. * atan(NaN) = NaN
  20748. *
  20749. */
  20750. P.inverseTangent = P.atan = function () {
  20751. var i,
  20752. j,
  20753. k,
  20754. n,
  20755. px,
  20756. t,
  20757. r,
  20758. wpr,
  20759. x2,
  20760. x = this,
  20761. Ctor = x.constructor,
  20762. pr = Ctor.precision,
  20763. rm = Ctor.rounding;
  20764. if (!x.isFinite()) {
  20765. if (!x.s) return new Ctor(NaN);
  20766. if (pr + 4 <= PI_PRECISION) {
  20767. r = getPi(Ctor, pr + 4, rm).times(0.5);
  20768. r.s = x.s;
  20769. return r;
  20770. }
  20771. } else if (x.isZero()) {
  20772. return new Ctor(x);
  20773. } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
  20774. r = getPi(Ctor, pr + 4, rm).times(0.25);
  20775. r.s = x.s;
  20776. return r;
  20777. }
  20778. Ctor.precision = wpr = pr + 10;
  20779. Ctor.rounding = 1;
  20780. // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
  20781. // Argument reduction
  20782. // Ensure |x| < 0.42
  20783. // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
  20784. k = Math.min(28, wpr / LOG_BASE + 2 | 0);
  20785. for (i = k; i; --i) {
  20786. x = x.div(x.times(x).plus(1).sqrt().plus(1));
  20787. }external = false;
  20788. j = Math.ceil(wpr / LOG_BASE);
  20789. n = 1;
  20790. x2 = x.times(x);
  20791. r = new Ctor(x);
  20792. px = x;
  20793. // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  20794. for (; i !== -1;) {
  20795. px = px.times(x2);
  20796. t = r.minus(px.div(n += 2));
  20797. px = px.times(x2);
  20798. r = t.plus(px.div(n += 2));
  20799. if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;) {}
  20800. }
  20801. if (k) r = r.times(2 << k - 1);
  20802. external = true;
  20803. return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
  20804. };
  20805. /*
  20806. * Return true if the value of this Decimal is a finite number, otherwise return false.
  20807. *
  20808. */
  20809. P.isFinite = function () {
  20810. return !!this.d;
  20811. };
  20812. /*
  20813. * Return true if the value of this Decimal is an integer, otherwise return false.
  20814. *
  20815. */
  20816. P.isInteger = P.isInt = function () {
  20817. return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
  20818. };
  20819. /*
  20820. * Return true if the value of this Decimal is NaN, otherwise return false.
  20821. *
  20822. */
  20823. P.isNaN = function () {
  20824. return !this.s;
  20825. };
  20826. /*
  20827. * Return true if the value of this Decimal is negative, otherwise return false.
  20828. *
  20829. */
  20830. P.isNegative = P.isNeg = function () {
  20831. return this.s < 0;
  20832. };
  20833. /*
  20834. * Return true if the value of this Decimal is positive, otherwise return false.
  20835. *
  20836. */
  20837. P.isPositive = P.isPos = function () {
  20838. return this.s > 0;
  20839. };
  20840. /*
  20841. * Return true if the value of this Decimal is 0 or -0, otherwise return false.
  20842. *
  20843. */
  20844. P.isZero = function () {
  20845. return !!this.d && this.d[0] === 0;
  20846. };
  20847. /*
  20848. * Return true if the value of this Decimal is less than `y`, otherwise return false.
  20849. *
  20850. */
  20851. P.lessThan = P.lt = function (y) {
  20852. return this.cmp(y) < 0;
  20853. };
  20854. /*
  20855. * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
  20856. *
  20857. */
  20858. P.lessThanOrEqualTo = P.lte = function (y) {
  20859. return this.cmp(y) < 1;
  20860. };
  20861. /*
  20862. * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
  20863. * significant digits using rounding mode `rounding`.
  20864. *
  20865. * If no base is specified, return log[10](arg).
  20866. *
  20867. * log[base](arg) = ln(arg) / ln(base)
  20868. *
  20869. * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
  20870. * otherwise:
  20871. *
  20872. * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
  20873. * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
  20874. * between the result and the correctly rounded result will be one ulp (unit in the last place).
  20875. *
  20876. * log[-b](a) = NaN
  20877. * log[0](a) = NaN
  20878. * log[1](a) = NaN
  20879. * log[NaN](a) = NaN
  20880. * log[Infinity](a) = NaN
  20881. * log[b](0) = -Infinity
  20882. * log[b](-0) = -Infinity
  20883. * log[b](-a) = NaN
  20884. * log[b](1) = 0
  20885. * log[b](Infinity) = Infinity
  20886. * log[b](NaN) = NaN
  20887. *
  20888. * [base] {number|string|Decimal} The base of the logarithm.
  20889. *
  20890. */
  20891. P.logarithm = P.log = function (base) {
  20892. var isBase10,
  20893. d,
  20894. denominator,
  20895. k,
  20896. inf,
  20897. num,
  20898. sd,
  20899. r,
  20900. arg = this,
  20901. Ctor = arg.constructor,
  20902. pr = Ctor.precision,
  20903. rm = Ctor.rounding,
  20904. guard = 5;
  20905. // Default base is 10.
  20906. if (base == null) {
  20907. base = new Ctor(10);
  20908. isBase10 = true;
  20909. } else {
  20910. base = new Ctor(base);
  20911. d = base.d;
  20912. // Return NaN if base is negative, or non-finite, or is 0 or 1.
  20913. if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
  20914. isBase10 = base.eq(10);
  20915. }
  20916. d = arg.d;
  20917. // Is arg negative, non-finite, 0 or 1?
  20918. if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
  20919. return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
  20920. }
  20921. // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
  20922. // integer power of 10.
  20923. if (isBase10) {
  20924. if (d.length > 1) {
  20925. inf = true;
  20926. } else {
  20927. for (k = d[0]; k % 10 === 0;) {
  20928. k /= 10;
  20929. }inf = k !== 1;
  20930. }
  20931. }
  20932. external = false;
  20933. sd = pr + guard;
  20934. num = naturalLogarithm(arg, sd);
  20935. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  20936. // The result will have 5 rounding digits.
  20937. r = divide(num, denominator, sd, 1);
  20938. // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
  20939. // calculate 10 further digits.
  20940. //
  20941. // If the result is known to have an infinite decimal expansion, repeat this until it is clear
  20942. // that the result is above or below the boundary. Otherwise, if after calculating the 10
  20943. // further digits, the last 14 are nines, round up and assume the result is exact.
  20944. // Also assume the result is exact if the last 14 are zero.
  20945. //
  20946. // Example of a result that will be incorrectly rounded:
  20947. // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
  20948. // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
  20949. // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
  20950. // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
  20951. // place is still 2.6.
  20952. if (checkRoundingDigits(r.d, k = pr, rm)) {
  20953. do {
  20954. sd += 10;
  20955. num = naturalLogarithm(arg, sd);
  20956. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  20957. r = divide(num, denominator, sd, 1);
  20958. if (!inf) {
  20959. // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
  20960. if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
  20961. r = finalise(r, pr + 1, 0);
  20962. }
  20963. break;
  20964. }
  20965. } while (checkRoundingDigits(r.d, k += 10, rm));
  20966. }
  20967. external = true;
  20968. return finalise(r, pr, rm);
  20969. };
  20970. /*
  20971. * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
  20972. *
  20973. * arguments {number|string|Decimal}
  20974. *
  20975. P.max = function () {
  20976. Array.prototype.push.call(arguments, this);
  20977. return maxOrMin(this.constructor, arguments, 'lt');
  20978. };
  20979. */
  20980. /*
  20981. * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
  20982. *
  20983. * arguments {number|string|Decimal}
  20984. *
  20985. P.min = function () {
  20986. Array.prototype.push.call(arguments, this);
  20987. return maxOrMin(this.constructor, arguments, 'gt');
  20988. };
  20989. */
  20990. /*
  20991. * n - 0 = n
  20992. * n - N = N
  20993. * n - I = -I
  20994. * 0 - n = -n
  20995. * 0 - 0 = 0
  20996. * 0 - N = N
  20997. * 0 - I = -I
  20998. * N - n = N
  20999. * N - 0 = N
  21000. * N - N = N
  21001. * N - I = N
  21002. * I - n = I
  21003. * I - 0 = I
  21004. * I - N = N
  21005. * I - I = N
  21006. *
  21007. * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
  21008. * significant digits using rounding mode `rounding`.
  21009. *
  21010. */
  21011. P.minus = P.sub = function (y) {
  21012. var d,
  21013. e,
  21014. i,
  21015. j,
  21016. k,
  21017. len,
  21018. pr,
  21019. rm,
  21020. xd,
  21021. xe,
  21022. xLTy,
  21023. yd,
  21024. x = this,
  21025. Ctor = x.constructor;
  21026. y = new Ctor(y);
  21027. // If either is not finite...
  21028. if (!x.d || !y.d) {
  21029. // Return NaN if either is NaN.
  21030. if (!x.s || !y.s) y = new Ctor(NaN);
  21031. // Return y negated if x is finite and y is ±Infinity.
  21032. else if (x.d) y.s = -y.s;
  21033. // Return x if y is finite and x is ±Infinity.
  21034. // Return x if both are ±Infinity with different signs.
  21035. // Return NaN if both are ±Infinity with the same sign.
  21036. else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
  21037. return y;
  21038. }
  21039. // If signs differ...
  21040. if (x.s != y.s) {
  21041. y.s = -y.s;
  21042. return x.plus(y);
  21043. }
  21044. xd = x.d;
  21045. yd = y.d;
  21046. pr = Ctor.precision;
  21047. rm = Ctor.rounding;
  21048. // If either is zero...
  21049. if (!xd[0] || !yd[0]) {
  21050. // Return y negated if x is zero and y is non-zero.
  21051. if (yd[0]) y.s = -y.s;
  21052. // Return x if y is zero and x is non-zero.
  21053. else if (xd[0]) y = new Ctor(x);
  21054. // Return zero if both are zero.
  21055. // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
  21056. else return new Ctor(rm === 3 ? -0 : 0);
  21057. return external ? finalise(y, pr, rm) : y;
  21058. }
  21059. // x and y are finite, non-zero numbers with the same sign.
  21060. // Calculate base 1e7 exponents.
  21061. e = mathfloor(y.e / LOG_BASE);
  21062. xe = mathfloor(x.e / LOG_BASE);
  21063. xd = xd.slice();
  21064. k = xe - e;
  21065. // If base 1e7 exponents differ...
  21066. if (k) {
  21067. xLTy = k < 0;
  21068. if (xLTy) {
  21069. d = xd;
  21070. k = -k;
  21071. len = yd.length;
  21072. } else {
  21073. d = yd;
  21074. e = xe;
  21075. len = xd.length;
  21076. }
  21077. // Numbers with massively different exponents would result in a very high number of
  21078. // zeros needing to be prepended, but this can be avoided while still ensuring correct
  21079. // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
  21080. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
  21081. if (k > i) {
  21082. k = i;
  21083. d.length = 1;
  21084. }
  21085. // Prepend zeros to equalise exponents.
  21086. d.reverse();
  21087. for (i = k; i--;) {
  21088. d.push(0);
  21089. }d.reverse();
  21090. // Base 1e7 exponents equal.
  21091. } else {
  21092. // Check digits to determine which is the bigger number.
  21093. i = xd.length;
  21094. len = yd.length;
  21095. xLTy = i < len;
  21096. if (xLTy) len = i;
  21097. for (i = 0; i < len; i++) {
  21098. if (xd[i] != yd[i]) {
  21099. xLTy = xd[i] < yd[i];
  21100. break;
  21101. }
  21102. }
  21103. k = 0;
  21104. }
  21105. if (xLTy) {
  21106. d = xd;
  21107. xd = yd;
  21108. yd = d;
  21109. y.s = -y.s;
  21110. }
  21111. len = xd.length;
  21112. // Append zeros to `xd` if shorter.
  21113. // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
  21114. for (i = yd.length - len; i > 0; --i) {
  21115. xd[len++] = 0;
  21116. } // Subtract yd from xd.
  21117. for (i = yd.length; i > k;) {
  21118. if (xd[--i] < yd[i]) {
  21119. for (j = i; j && xd[--j] === 0;) {
  21120. xd[j] = BASE - 1;
  21121. }--xd[j];
  21122. xd[i] += BASE;
  21123. }
  21124. xd[i] -= yd[i];
  21125. }
  21126. // Remove trailing zeros.
  21127. for (; xd[--len] === 0;) {
  21128. xd.pop();
  21129. } // Remove leading zeros and adjust exponent accordingly.
  21130. for (; xd[0] === 0; xd.shift()) {
  21131. --e;
  21132. } // Zero?
  21133. if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
  21134. y.d = xd;
  21135. y.e = getBase10Exponent(xd, e);
  21136. return external ? finalise(y, pr, rm) : y;
  21137. };
  21138. /*
  21139. * n % 0 = N
  21140. * n % N = N
  21141. * n % I = n
  21142. * 0 % n = 0
  21143. * -0 % n = -0
  21144. * 0 % 0 = N
  21145. * 0 % N = N
  21146. * 0 % I = 0
  21147. * N % n = N
  21148. * N % 0 = N
  21149. * N % N = N
  21150. * N % I = N
  21151. * I % n = N
  21152. * I % 0 = N
  21153. * I % N = N
  21154. * I % I = N
  21155. *
  21156. * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
  21157. * `precision` significant digits using rounding mode `rounding`.
  21158. *
  21159. * The result depends on the modulo mode.
  21160. *
  21161. */
  21162. P.modulo = P.mod = function (y) {
  21163. var q,
  21164. x = this,
  21165. Ctor = x.constructor;
  21166. y = new Ctor(y);
  21167. // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
  21168. if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
  21169. // Return x if y is ±Infinity or x is ±0.
  21170. if (!y.d || x.d && !x.d[0]) {
  21171. return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
  21172. }
  21173. // Prevent rounding of intermediate calculations.
  21174. external = false;
  21175. if (Ctor.modulo == 9) {
  21176. // Euclidian division: q = sign(y) * floor(x / abs(y))
  21177. // result = x - q * y where 0 <= result < abs(y)
  21178. q = divide(x, y.abs(), 0, 3, 1);
  21179. q.s *= y.s;
  21180. } else {
  21181. q = divide(x, y, 0, Ctor.modulo, 1);
  21182. }
  21183. q = q.times(y);
  21184. external = true;
  21185. return x.minus(q);
  21186. };
  21187. /*
  21188. * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
  21189. * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
  21190. * significant digits using rounding mode `rounding`.
  21191. *
  21192. */
  21193. P.naturalExponential = P.exp = function () {
  21194. return naturalExponential(this);
  21195. };
  21196. /*
  21197. * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
  21198. * rounded to `precision` significant digits using rounding mode `rounding`.
  21199. *
  21200. */
  21201. P.naturalLogarithm = P.ln = function () {
  21202. return naturalLogarithm(this);
  21203. };
  21204. /*
  21205. * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
  21206. * -1.
  21207. *
  21208. */
  21209. P.negated = P.neg = function () {
  21210. var x = new this.constructor(this);
  21211. x.s = -x.s;
  21212. return finalise(x);
  21213. };
  21214. /*
  21215. * n + 0 = n
  21216. * n + N = N
  21217. * n + I = I
  21218. * 0 + n = n
  21219. * 0 + 0 = 0
  21220. * 0 + N = N
  21221. * 0 + I = I
  21222. * N + n = N
  21223. * N + 0 = N
  21224. * N + N = N
  21225. * N + I = N
  21226. * I + n = I
  21227. * I + 0 = I
  21228. * I + N = N
  21229. * I + I = I
  21230. *
  21231. * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
  21232. * significant digits using rounding mode `rounding`.
  21233. *
  21234. */
  21235. P.plus = P.add = function (y) {
  21236. var carry,
  21237. d,
  21238. e,
  21239. i,
  21240. k,
  21241. len,
  21242. pr,
  21243. rm,
  21244. xd,
  21245. yd,
  21246. x = this,
  21247. Ctor = x.constructor;
  21248. y = new Ctor(y);
  21249. // If either is not finite...
  21250. if (!x.d || !y.d) {
  21251. // Return NaN if either is NaN.
  21252. if (!x.s || !y.s) y = new Ctor(NaN);
  21253. // Return x if y is finite and x is ±Infinity.
  21254. // Return x if both are ±Infinity with the same sign.
  21255. // Return NaN if both are ±Infinity with different signs.
  21256. // Return y if x is finite and y is ±Infinity.
  21257. else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
  21258. return y;
  21259. }
  21260. // If signs differ...
  21261. if (x.s != y.s) {
  21262. y.s = -y.s;
  21263. return x.minus(y);
  21264. }
  21265. xd = x.d;
  21266. yd = y.d;
  21267. pr = Ctor.precision;
  21268. rm = Ctor.rounding;
  21269. // If either is zero...
  21270. if (!xd[0] || !yd[0]) {
  21271. // Return x if y is zero.
  21272. // Return y if y is non-zero.
  21273. if (!yd[0]) y = new Ctor(x);
  21274. return external ? finalise(y, pr, rm) : y;
  21275. }
  21276. // x and y are finite, non-zero numbers with the same sign.
  21277. // Calculate base 1e7 exponents.
  21278. k = mathfloor(x.e / LOG_BASE);
  21279. e = mathfloor(y.e / LOG_BASE);
  21280. xd = xd.slice();
  21281. i = k - e;
  21282. // If base 1e7 exponents differ...
  21283. if (i) {
  21284. if (i < 0) {
  21285. d = xd;
  21286. i = -i;
  21287. len = yd.length;
  21288. } else {
  21289. d = yd;
  21290. e = k;
  21291. len = xd.length;
  21292. }
  21293. // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
  21294. k = Math.ceil(pr / LOG_BASE);
  21295. len = k > len ? k + 1 : len + 1;
  21296. if (i > len) {
  21297. i = len;
  21298. d.length = 1;
  21299. }
  21300. // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
  21301. d.reverse();
  21302. for (; i--;) {
  21303. d.push(0);
  21304. }d.reverse();
  21305. }
  21306. len = xd.length;
  21307. i = yd.length;
  21308. // If yd is longer than xd, swap xd and yd so xd points to the longer array.
  21309. if (len - i < 0) {
  21310. i = len;
  21311. d = yd;
  21312. yd = xd;
  21313. xd = d;
  21314. }
  21315. // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
  21316. for (carry = 0; i;) {
  21317. carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
  21318. xd[i] %= BASE;
  21319. }
  21320. if (carry) {
  21321. xd.unshift(carry);
  21322. ++e;
  21323. }
  21324. // Remove trailing zeros.
  21325. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  21326. for (len = xd.length; xd[--len] == 0;) {
  21327. xd.pop();
  21328. }y.d = xd;
  21329. y.e = getBase10Exponent(xd, e);
  21330. return external ? finalise(y, pr, rm) : y;
  21331. };
  21332. /*
  21333. * Return the number of significant digits of the value of this Decimal.
  21334. *
  21335. * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
  21336. *
  21337. */
  21338. P.precision = P.sd = function (z) {
  21339. var k,
  21340. x = this;
  21341. if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
  21342. if (x.d) {
  21343. k = getPrecision(x.d);
  21344. if (z && x.e + 1 > k) k = x.e + 1;
  21345. } else {
  21346. k = NaN;
  21347. }
  21348. return k;
  21349. };
  21350. /*
  21351. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
  21352. * rounding mode `rounding`.
  21353. *
  21354. */
  21355. P.round = function () {
  21356. var x = this,
  21357. Ctor = x.constructor;
  21358. return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
  21359. };
  21360. /*
  21361. * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
  21362. *
  21363. * Domain: [-Infinity, Infinity]
  21364. * Range: [-1, 1]
  21365. *
  21366. * sin(x) = x - x^3/3! + x^5/5! - ...
  21367. *
  21368. * sin(0) = 0
  21369. * sin(-0) = -0
  21370. * sin(Infinity) = NaN
  21371. * sin(-Infinity) = NaN
  21372. * sin(NaN) = NaN
  21373. *
  21374. */
  21375. P.sine = P.sin = function () {
  21376. var pr,
  21377. rm,
  21378. x = this,
  21379. Ctor = x.constructor;
  21380. if (!x.isFinite()) return new Ctor(NaN);
  21381. if (x.isZero()) return new Ctor(x);
  21382. pr = Ctor.precision;
  21383. rm = Ctor.rounding;
  21384. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  21385. Ctor.rounding = 1;
  21386. x = sine(Ctor, toLessThanHalfPi(Ctor, x));
  21387. Ctor.precision = pr;
  21388. Ctor.rounding = rm;
  21389. return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
  21390. };
  21391. /*
  21392. * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
  21393. * significant digits using rounding mode `rounding`.
  21394. *
  21395. * sqrt(-n) = N
  21396. * sqrt(N) = N
  21397. * sqrt(-I) = N
  21398. * sqrt(I) = I
  21399. * sqrt(0) = 0
  21400. * sqrt(-0) = -0
  21401. *
  21402. */
  21403. P.squareRoot = P.sqrt = function () {
  21404. var m,
  21405. n,
  21406. sd,
  21407. r,
  21408. rep,
  21409. t,
  21410. x = this,
  21411. d = x.d,
  21412. e = x.e,
  21413. s = x.s,
  21414. Ctor = x.constructor;
  21415. // Negative/NaN/Infinity/zero?
  21416. if (s !== 1 || !d || !d[0]) {
  21417. return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
  21418. }
  21419. external = false;
  21420. // Initial estimate.
  21421. s = Math.sqrt(+x);
  21422. // Math.sqrt underflow/overflow?
  21423. // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
  21424. if (s == 0 || s == 1 / 0) {
  21425. n = digitsToString(d);
  21426. if ((n.length + e) % 2 == 0) n += '0';
  21427. s = Math.sqrt(n);
  21428. e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
  21429. if (s == 1 / 0) {
  21430. n = '1e' + e;
  21431. } else {
  21432. n = s.toExponential();
  21433. n = n.slice(0, n.indexOf('e') + 1) + e;
  21434. }
  21435. r = new Ctor(n);
  21436. } else {
  21437. r = new Ctor(s.toString());
  21438. }
  21439. sd = (e = Ctor.precision) + 3;
  21440. // Newton-Raphson iteration.
  21441. for (;;) {
  21442. t = r;
  21443. r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
  21444. // TODO? Replace with for-loop and checkRoundingDigits.
  21445. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  21446. n = n.slice(sd - 3, sd + 1);
  21447. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
  21448. // 4999, i.e. approaching a rounding boundary, continue the iteration.
  21449. if (n == '9999' || !rep && n == '4999') {
  21450. // On the first iteration only, check to see if rounding up gives the exact result as the
  21451. // nines may infinitely repeat.
  21452. if (!rep) {
  21453. finalise(t, e + 1, 0);
  21454. if (t.times(t).eq(x)) {
  21455. r = t;
  21456. break;
  21457. }
  21458. }
  21459. sd += 4;
  21460. rep = 1;
  21461. } else {
  21462. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  21463. // If not, then there are further digits and m will be truthy.
  21464. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  21465. // Truncate to the first rounding digit.
  21466. finalise(r, e + 1, 1);
  21467. m = !r.times(r).eq(x);
  21468. }
  21469. break;
  21470. }
  21471. }
  21472. }
  21473. external = true;
  21474. return finalise(r, e, Ctor.rounding, m);
  21475. };
  21476. /*
  21477. * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
  21478. *
  21479. * Domain: [-Infinity, Infinity]
  21480. * Range: [-Infinity, Infinity]
  21481. *
  21482. * tan(0) = 0
  21483. * tan(-0) = -0
  21484. * tan(Infinity) = NaN
  21485. * tan(-Infinity) = NaN
  21486. * tan(NaN) = NaN
  21487. *
  21488. */
  21489. P.tangent = P.tan = function () {
  21490. var pr,
  21491. rm,
  21492. x = this,
  21493. Ctor = x.constructor;
  21494. if (!x.isFinite()) return new Ctor(NaN);
  21495. if (x.isZero()) return new Ctor(x);
  21496. pr = Ctor.precision;
  21497. rm = Ctor.rounding;
  21498. Ctor.precision = pr + 10;
  21499. Ctor.rounding = 1;
  21500. x = x.sin();
  21501. x.s = 1;
  21502. x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
  21503. Ctor.precision = pr;
  21504. Ctor.rounding = rm;
  21505. return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
  21506. };
  21507. /*
  21508. * n * 0 = 0
  21509. * n * N = N
  21510. * n * I = I
  21511. * 0 * n = 0
  21512. * 0 * 0 = 0
  21513. * 0 * N = N
  21514. * 0 * I = N
  21515. * N * n = N
  21516. * N * 0 = N
  21517. * N * N = N
  21518. * N * I = N
  21519. * I * n = I
  21520. * I * 0 = N
  21521. * I * N = N
  21522. * I * I = I
  21523. *
  21524. * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
  21525. * digits using rounding mode `rounding`.
  21526. *
  21527. */
  21528. P.times = P.mul = function (y) {
  21529. var carry,
  21530. e,
  21531. i,
  21532. k,
  21533. r,
  21534. rL,
  21535. t,
  21536. xdL,
  21537. ydL,
  21538. x = this,
  21539. Ctor = x.constructor,
  21540. xd = x.d,
  21541. yd = (y = new Ctor(y)).d;
  21542. y.s *= x.s;
  21543. // If either is NaN, ±Infinity or ±0...
  21544. if (!xd || !xd[0] || !yd || !yd[0]) {
  21545. return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
  21546. // Return NaN if either is NaN.
  21547. // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
  21548. ? NaN
  21549. // Return ±Infinity if either is ±Infinity.
  21550. // Return ±0 if either is ±0.
  21551. : !xd || !yd ? y.s / 0 : y.s * 0);
  21552. }
  21553. e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
  21554. xdL = xd.length;
  21555. ydL = yd.length;
  21556. // Ensure xd points to the longer array.
  21557. if (xdL < ydL) {
  21558. r = xd;
  21559. xd = yd;
  21560. yd = r;
  21561. rL = xdL;
  21562. xdL = ydL;
  21563. ydL = rL;
  21564. }
  21565. // Initialise the result array with zeros.
  21566. r = [];
  21567. rL = xdL + ydL;
  21568. for (i = rL; i--;) {
  21569. r.push(0);
  21570. } // Multiply!
  21571. for (i = ydL; --i >= 0;) {
  21572. carry = 0;
  21573. for (k = xdL + i; k > i;) {
  21574. t = r[k] + yd[i] * xd[k - i - 1] + carry;
  21575. r[k--] = t % BASE | 0;
  21576. carry = t / BASE | 0;
  21577. }
  21578. r[k] = (r[k] + carry) % BASE | 0;
  21579. }
  21580. // Remove trailing zeros.
  21581. for (; !r[--rL];) {
  21582. r.pop();
  21583. }if (carry) ++e;else r.shift();
  21584. y.d = r;
  21585. y.e = getBase10Exponent(r, e);
  21586. return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
  21587. };
  21588. /*
  21589. * Return a string representing the value of this Decimal in base 2, round to `sd` significant
  21590. * digits using rounding mode `rm`.
  21591. *
  21592. * If the optional `sd` argument is present then return binary exponential notation.
  21593. *
  21594. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  21595. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  21596. *
  21597. */
  21598. P.toBinary = function (sd, rm) {
  21599. return toStringBinary(this, 2, sd, rm);
  21600. };
  21601. /*
  21602. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
  21603. * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
  21604. *
  21605. * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
  21606. *
  21607. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  21608. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  21609. *
  21610. */
  21611. P.toDecimalPlaces = P.toDP = function (dp, rm) {
  21612. var x = this,
  21613. Ctor = x.constructor;
  21614. x = new Ctor(x);
  21615. if (dp === void 0) return x;
  21616. checkInt32(dp, 0, MAX_DIGITS);
  21617. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  21618. return finalise(x, dp + x.e + 1, rm);
  21619. };
  21620. /*
  21621. * Return a string representing the value of this Decimal in exponential notation rounded to
  21622. * `dp` fixed decimal places using rounding mode `rounding`.
  21623. *
  21624. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  21625. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  21626. *
  21627. */
  21628. P.toExponential = function (dp, rm) {
  21629. var str,
  21630. x = this,
  21631. Ctor = x.constructor;
  21632. if (dp === void 0) {
  21633. str = finiteToString(x, true);
  21634. } else {
  21635. checkInt32(dp, 0, MAX_DIGITS);
  21636. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  21637. x = finalise(new Ctor(x), dp + 1, rm);
  21638. str = finiteToString(x, true, dp + 1);
  21639. }
  21640. return x.isNeg() && !x.isZero() ? '-' + str : str;
  21641. };
  21642. /*
  21643. * Return a string representing the value of this Decimal in normal (fixed-point) notation to
  21644. * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
  21645. * omitted.
  21646. *
  21647. * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
  21648. *
  21649. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  21650. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  21651. *
  21652. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  21653. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  21654. * (-0).toFixed(3) is '0.000'.
  21655. * (-0.5).toFixed(0) is '-0'.
  21656. *
  21657. */
  21658. P.toFixed = function (dp, rm) {
  21659. var str,
  21660. y,
  21661. x = this,
  21662. Ctor = x.constructor;
  21663. if (dp === void 0) {
  21664. str = finiteToString(x);
  21665. } else {
  21666. checkInt32(dp, 0, MAX_DIGITS);
  21667. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  21668. y = finalise(new Ctor(x), dp + x.e + 1, rm);
  21669. str = finiteToString(y, false, dp + y.e + 1);
  21670. }
  21671. // To determine whether to add the minus sign look at the value before it was rounded,
  21672. // i.e. look at `x` rather than `y`.
  21673. return x.isNeg() && !x.isZero() ? '-' + str : str;
  21674. };
  21675. /*
  21676. * Return an array representing the value of this Decimal as a simple fraction with an integer
  21677. * numerator and an integer denominator.
  21678. *
  21679. * The denominator will be a positive non-zero value less than or equal to the specified maximum
  21680. * denominator. If a maximum denominator is not specified, the denominator will be the lowest
  21681. * value necessary to represent the number exactly.
  21682. *
  21683. * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
  21684. *
  21685. */
  21686. P.toFraction = function (maxD) {
  21687. var d,
  21688. d0,
  21689. d1,
  21690. d2,
  21691. e,
  21692. k,
  21693. n,
  21694. n0,
  21695. n1,
  21696. pr,
  21697. q,
  21698. r,
  21699. x = this,
  21700. xd = x.d,
  21701. Ctor = x.constructor;
  21702. if (!xd) return new Ctor(x);
  21703. n1 = d0 = new Ctor(1);
  21704. d1 = n0 = new Ctor(0);
  21705. d = new Ctor(d1);
  21706. e = d.e = getPrecision(xd) - x.e - 1;
  21707. k = e % LOG_BASE;
  21708. d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
  21709. if (maxD == null) {
  21710. // d is 10**e, the minimum max-denominator needed.
  21711. maxD = e > 0 ? d : n1;
  21712. } else {
  21713. n = new Ctor(maxD);
  21714. if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
  21715. maxD = n.gt(d) ? e > 0 ? d : n1 : n;
  21716. }
  21717. external = false;
  21718. n = new Ctor(digitsToString(xd));
  21719. pr = Ctor.precision;
  21720. Ctor.precision = e = xd.length * LOG_BASE * 2;
  21721. for (;;) {
  21722. q = divide(n, d, 0, 1, 1);
  21723. d2 = d0.plus(q.times(d1));
  21724. if (d2.cmp(maxD) == 1) break;
  21725. d0 = d1;
  21726. d1 = d2;
  21727. d2 = n1;
  21728. n1 = n0.plus(q.times(d2));
  21729. n0 = d2;
  21730. d2 = d;
  21731. d = n.minus(q.times(d2));
  21732. n = d2;
  21733. }
  21734. d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
  21735. n0 = n0.plus(d2.times(n1));
  21736. d0 = d0.plus(d2.times(d1));
  21737. n0.s = n1.s = x.s;
  21738. // Determine which fraction is closer to x, n0/d0 or n1/d1?
  21739. r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];
  21740. Ctor.precision = pr;
  21741. external = true;
  21742. return r;
  21743. };
  21744. /*
  21745. * Return a string representing the value of this Decimal in base 16, round to `sd` significant
  21746. * digits using rounding mode `rm`.
  21747. *
  21748. * If the optional `sd` argument is present then return binary exponential notation.
  21749. *
  21750. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  21751. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  21752. *
  21753. */
  21754. P.toHexadecimal = P.toHex = function (sd, rm) {
  21755. return toStringBinary(this, 16, sd, rm);
  21756. };
  21757. /*
  21758. * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
  21759. * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
  21760. *
  21761. * The return value will always have the same sign as this Decimal, unless either this Decimal
  21762. * or `y` is NaN, in which case the return value will be also be NaN.
  21763. *
  21764. * The return value is not affected by the value of `precision`.
  21765. *
  21766. * y {number|string|Decimal} The magnitude to round to a multiple of.
  21767. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  21768. *
  21769. * 'toNearest() rounding mode not an integer: {rm}'
  21770. * 'toNearest() rounding mode out of range: {rm}'
  21771. *
  21772. */
  21773. P.toNearest = function (y, rm) {
  21774. var x = this,
  21775. Ctor = x.constructor;
  21776. x = new Ctor(x);
  21777. if (y == null) {
  21778. // If x is not finite, return x.
  21779. if (!x.d) return x;
  21780. y = new Ctor(1);
  21781. rm = Ctor.rounding;
  21782. } else {
  21783. y = new Ctor(y);
  21784. if (rm === void 0) {
  21785. rm = Ctor.rounding;
  21786. } else {
  21787. checkInt32(rm, 0, 8);
  21788. }
  21789. // If x is not finite, return x if y is not NaN, else NaN.
  21790. if (!x.d) return y.s ? x : y;
  21791. // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
  21792. if (!y.d) {
  21793. if (y.s) y.s = x.s;
  21794. return y;
  21795. }
  21796. }
  21797. // If y is not zero, calculate the nearest multiple of y to x.
  21798. if (y.d[0]) {
  21799. external = false;
  21800. x = divide(x, y, 0, rm, 1).times(y);
  21801. external = true;
  21802. finalise(x);
  21803. // If y is zero, return zero with the sign of x.
  21804. } else {
  21805. y.s = x.s;
  21806. x = y;
  21807. }
  21808. return x;
  21809. };
  21810. /*
  21811. * Return the value of this Decimal converted to a number primitive.
  21812. * Zero keeps its sign.
  21813. *
  21814. */
  21815. P.toNumber = function () {
  21816. return +this;
  21817. };
  21818. /*
  21819. * Return a string representing the value of this Decimal in base 8, round to `sd` significant
  21820. * digits using rounding mode `rm`.
  21821. *
  21822. * If the optional `sd` argument is present then return binary exponential notation.
  21823. *
  21824. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  21825. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  21826. *
  21827. */
  21828. P.toOctal = function (sd, rm) {
  21829. return toStringBinary(this, 8, sd, rm);
  21830. };
  21831. /*
  21832. * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
  21833. * to `precision` significant digits using rounding mode `rounding`.
  21834. *
  21835. * ECMAScript compliant.
  21836. *
  21837. * pow(x, NaN) = NaN
  21838. * pow(x, ±0) = 1
  21839. * pow(NaN, non-zero) = NaN
  21840. * pow(abs(x) > 1, +Infinity) = +Infinity
  21841. * pow(abs(x) > 1, -Infinity) = +0
  21842. * pow(abs(x) == 1, ±Infinity) = NaN
  21843. * pow(abs(x) < 1, +Infinity) = +0
  21844. * pow(abs(x) < 1, -Infinity) = +Infinity
  21845. * pow(+Infinity, y > 0) = +Infinity
  21846. * pow(+Infinity, y < 0) = +0
  21847. * pow(-Infinity, odd integer > 0) = -Infinity
  21848. * pow(-Infinity, even integer > 0) = +Infinity
  21849. * pow(-Infinity, odd integer < 0) = -0
  21850. * pow(-Infinity, even integer < 0) = +0
  21851. * pow(+0, y > 0) = +0
  21852. * pow(+0, y < 0) = +Infinity
  21853. * pow(-0, odd integer > 0) = -0
  21854. * pow(-0, even integer > 0) = +0
  21855. * pow(-0, odd integer < 0) = -Infinity
  21856. * pow(-0, even integer < 0) = +Infinity
  21857. * pow(finite x < 0, finite non-integer) = NaN
  21858. *
  21859. * For non-integer or very large exponents pow(x, y) is calculated using
  21860. *
  21861. * x^y = exp(y*ln(x))
  21862. *
  21863. * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
  21864. * probability of an incorrectly rounded result
  21865. * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
  21866. * i.e. 1 in 250,000,000,000,000
  21867. *
  21868. * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
  21869. *
  21870. * y {number|string|Decimal} The power to which to raise this Decimal.
  21871. *
  21872. */
  21873. P.toPower = P.pow = function (y) {
  21874. var e,
  21875. k,
  21876. pr,
  21877. r,
  21878. rm,
  21879. s,
  21880. x = this,
  21881. Ctor = x.constructor,
  21882. yn = +(y = new Ctor(y));
  21883. // Either ±Infinity, NaN or ±0?
  21884. if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
  21885. x = new Ctor(x);
  21886. if (x.eq(1)) return x;
  21887. pr = Ctor.precision;
  21888. rm = Ctor.rounding;
  21889. if (y.eq(1)) return finalise(x, pr, rm);
  21890. // y exponent
  21891. e = mathfloor(y.e / LOG_BASE);
  21892. // If y is a small integer use the 'exponentiation by squaring' algorithm.
  21893. if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
  21894. r = intPow(Ctor, x, k, pr);
  21895. return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
  21896. }
  21897. s = x.s;
  21898. // if x is negative
  21899. if (s < 0) {
  21900. // if y is not an integer
  21901. if (e < y.d.length - 1) return new Ctor(NaN);
  21902. // Result is positive if x is negative and the last digit of integer y is even.
  21903. if ((y.d[e] & 1) == 0) s = 1;
  21904. // if x.eq(-1)
  21905. if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
  21906. x.s = s;
  21907. return x;
  21908. }
  21909. }
  21910. // Estimate result exponent.
  21911. // x^y = 10^e, where e = y * log10(x)
  21912. // log10(x) = log10(x_significand) + x_exponent
  21913. // log10(x_significand) = ln(x_significand) / ln(10)
  21914. k = mathpow(+x, yn);
  21915. e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + '').e;
  21916. // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
  21917. // Overflow/underflow?
  21918. if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
  21919. external = false;
  21920. Ctor.rounding = x.s = 1;
  21921. // Estimate the extra guard digits needed to ensure five correct rounding digits from
  21922. // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
  21923. // new Decimal(2.32456).pow('2087987436534566.46411')
  21924. // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
  21925. k = Math.min(12, (e + '').length);
  21926. // r = x^y = exp(y*ln(x))
  21927. r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
  21928. // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
  21929. if (r.d) {
  21930. // Truncate to the required precision plus five rounding digits.
  21931. r = finalise(r, pr + 5, 1);
  21932. // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
  21933. // the result.
  21934. if (checkRoundingDigits(r.d, pr, rm)) {
  21935. e = pr + 10;
  21936. // Truncate to the increased precision plus five rounding digits.
  21937. r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
  21938. // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
  21939. if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
  21940. r = finalise(r, pr + 1, 0);
  21941. }
  21942. }
  21943. }
  21944. r.s = s;
  21945. external = true;
  21946. Ctor.rounding = rm;
  21947. return finalise(r, pr, rm);
  21948. };
  21949. /*
  21950. * Return a string representing the value of this Decimal rounded to `sd` significant digits
  21951. * using rounding mode `rounding`.
  21952. *
  21953. * Return exponential notation if `sd` is less than the number of digits necessary to represent
  21954. * the integer part of the value in normal notation.
  21955. *
  21956. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  21957. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  21958. *
  21959. */
  21960. P.toPrecision = function (sd, rm) {
  21961. var str,
  21962. x = this,
  21963. Ctor = x.constructor;
  21964. if (sd === void 0) {
  21965. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  21966. } else {
  21967. checkInt32(sd, 1, MAX_DIGITS);
  21968. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  21969. x = finalise(new Ctor(x), sd, rm);
  21970. str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
  21971. }
  21972. return x.isNeg() && !x.isZero() ? '-' + str : str;
  21973. };
  21974. /*
  21975. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
  21976. * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
  21977. * omitted.
  21978. *
  21979. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  21980. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  21981. *
  21982. * 'toSD() digits out of range: {sd}'
  21983. * 'toSD() digits not an integer: {sd}'
  21984. * 'toSD() rounding mode not an integer: {rm}'
  21985. * 'toSD() rounding mode out of range: {rm}'
  21986. *
  21987. */
  21988. P.toSignificantDigits = P.toSD = function (sd, rm) {
  21989. var x = this,
  21990. Ctor = x.constructor;
  21991. if (sd === void 0) {
  21992. sd = Ctor.precision;
  21993. rm = Ctor.rounding;
  21994. } else {
  21995. checkInt32(sd, 1, MAX_DIGITS);
  21996. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  21997. }
  21998. return finalise(new Ctor(x), sd, rm);
  21999. };
  22000. /*
  22001. * Return a string representing the value of this Decimal.
  22002. *
  22003. * Return exponential notation if this Decimal has a positive exponent equal to or greater than
  22004. * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
  22005. *
  22006. */
  22007. P.toString = function () {
  22008. var x = this,
  22009. Ctor = x.constructor,
  22010. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  22011. return x.isNeg() && !x.isZero() ? '-' + str : str;
  22012. };
  22013. /*
  22014. * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
  22015. *
  22016. */
  22017. P.truncated = P.trunc = function () {
  22018. return finalise(new this.constructor(this), this.e + 1, 1);
  22019. };
  22020. /*
  22021. * Return a string representing the value of this Decimal.
  22022. * Unlike `toString`, negative zero will include the minus sign.
  22023. *
  22024. */
  22025. P.valueOf = P.toJSON = function () {
  22026. var x = this,
  22027. Ctor = x.constructor,
  22028. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  22029. return x.isNeg() ? '-' + str : str;
  22030. };
  22031. /*
  22032. // Add aliases to match BigDecimal method names.
  22033. // P.add = P.plus;
  22034. P.subtract = P.minus;
  22035. P.multiply = P.times;
  22036. P.divide = P.div;
  22037. P.remainder = P.mod;
  22038. P.compareTo = P.cmp;
  22039. P.negate = P.neg;
  22040. */
  22041. // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
  22042. /*
  22043. * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
  22044. * finiteToString, naturalExponential, naturalLogarithm
  22045. * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
  22046. * P.toPrecision, P.toSignificantDigits, toStringBinary, random
  22047. * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
  22048. * convertBase toStringBinary, parseOther
  22049. * cos P.cos
  22050. * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
  22051. * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
  22052. * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
  22053. * taylorSeries, atan2, parseOther
  22054. * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
  22055. * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
  22056. * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
  22057. * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
  22058. * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
  22059. * P.truncated, divide, getLn10, getPi, naturalExponential,
  22060. * naturalLogarithm, ceil, floor, round, trunc
  22061. * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
  22062. * toStringBinary
  22063. * getBase10Exponent P.minus, P.plus, P.times, parseOther
  22064. * getLn10 P.logarithm, naturalLogarithm
  22065. * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
  22066. * getPrecision P.precision, P.toFraction
  22067. * getZeroString digitsToString, finiteToString
  22068. * intPow P.toPower, parseOther
  22069. * isOdd toLessThanHalfPi
  22070. * maxOrMin max, min
  22071. * naturalExponential P.naturalExponential, P.toPower
  22072. * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
  22073. * P.toPower, naturalExponential
  22074. * nonFiniteToString finiteToString, toStringBinary
  22075. * parseDecimal Decimal
  22076. * parseOther Decimal
  22077. * sin P.sin
  22078. * taylorSeries P.cosh, P.sinh, cos, sin
  22079. * toLessThanHalfPi P.cos, P.sin
  22080. * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
  22081. * truncate intPow
  22082. *
  22083. * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
  22084. * naturalLogarithm, config, parseOther, random, Decimal
  22085. */
  22086. function digitsToString(d) {
  22087. var i,
  22088. k,
  22089. ws,
  22090. indexOfLastWord = d.length - 1,
  22091. str = '',
  22092. w = d[0];
  22093. if (indexOfLastWord > 0) {
  22094. str += w;
  22095. for (i = 1; i < indexOfLastWord; i++) {
  22096. ws = d[i] + '';
  22097. k = LOG_BASE - ws.length;
  22098. if (k) str += getZeroString(k);
  22099. str += ws;
  22100. }
  22101. w = d[i];
  22102. ws = w + '';
  22103. k = LOG_BASE - ws.length;
  22104. if (k) str += getZeroString(k);
  22105. } else if (w === 0) {
  22106. return '0';
  22107. }
  22108. // Remove trailing zeros of last w.
  22109. for (; w % 10 === 0;) {
  22110. w /= 10;
  22111. }return str + w;
  22112. }
  22113. function checkInt32(i, min, max) {
  22114. if (i !== ~~i || i < min || i > max) {
  22115. throw Error(invalidArgument + i);
  22116. }
  22117. }
  22118. /*
  22119. * Check 5 rounding digits if `repeating` is null, 4 otherwise.
  22120. * `repeating == null` if caller is `log` or `pow`,
  22121. * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
  22122. */
  22123. function checkRoundingDigits(d, i, rm, repeating) {
  22124. var di, k, r, rd;
  22125. // Get the length of the first word of the array d.
  22126. for (k = d[0]; k >= 10; k /= 10) {
  22127. --i;
  22128. } // Is the rounding digit in the first word of d?
  22129. if (--i < 0) {
  22130. i += LOG_BASE;
  22131. di = 0;
  22132. } else {
  22133. di = Math.ceil((i + 1) / LOG_BASE);
  22134. i %= LOG_BASE;
  22135. }
  22136. // i is the index (0 - 6) of the rounding digit.
  22137. // E.g. if within the word 3487563 the first rounding digit is 5,
  22138. // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
  22139. k = mathpow(10, LOG_BASE - i);
  22140. rd = d[di] % k | 0;
  22141. if (repeating == null) {
  22142. if (i < 3) {
  22143. if (i == 0) rd = rd / 100 | 0;else if (i == 1) rd = rd / 10 | 0;
  22144. r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
  22145. } else {
  22146. r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 || (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0;
  22147. }
  22148. } else {
  22149. if (i < 4) {
  22150. if (i == 0) rd = rd / 1000 | 0;else if (i == 1) rd = rd / 100 | 0;else if (i == 2) rd = rd / 10 | 0;
  22151. r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
  22152. } else {
  22153. r = ((repeating || rm < 4) && rd + 1 == k || !repeating && rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1;
  22154. }
  22155. }
  22156. return r;
  22157. }
  22158. // Convert string of `baseIn` to an array of numbers of `baseOut`.
  22159. // Eg. convertBase('255', 10, 16) returns [15, 15].
  22160. // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
  22161. function convertBase(str, baseIn, baseOut) {
  22162. var j,
  22163. arr = [0],
  22164. arrL,
  22165. i = 0,
  22166. strL = str.length;
  22167. for (; i < strL;) {
  22168. for (arrL = arr.length; arrL--;) {
  22169. arr[arrL] *= baseIn;
  22170. }arr[0] += NUMERALS.indexOf(str.charAt(i++));
  22171. for (j = 0; j < arr.length; j++) {
  22172. if (arr[j] > baseOut - 1) {
  22173. if (arr[j + 1] === void 0) arr[j + 1] = 0;
  22174. arr[j + 1] += arr[j] / baseOut | 0;
  22175. arr[j] %= baseOut;
  22176. }
  22177. }
  22178. }
  22179. return arr.reverse();
  22180. }
  22181. /*
  22182. * cos(x) = 1 - x^2/2! + x^4/4! - ...
  22183. * |x| < pi/2
  22184. *
  22185. */
  22186. function cosine(Ctor, x) {
  22187. var k,
  22188. y,
  22189. len = x.d.length;
  22190. // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
  22191. // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
  22192. // Estimate the optimum number of times to use the argument reduction.
  22193. if (len < 32) {
  22194. k = Math.ceil(len / 3);
  22195. y = Math.pow(4, -k).toString();
  22196. } else {
  22197. k = 16;
  22198. y = '2.3283064365386962890625e-10';
  22199. }
  22200. Ctor.precision += k;
  22201. x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
  22202. // Reverse argument reduction
  22203. for (var i = k; i--;) {
  22204. var cos2x = x.times(x);
  22205. x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
  22206. }
  22207. Ctor.precision -= k;
  22208. return x;
  22209. }
  22210. /*
  22211. * Perform division in the specified base.
  22212. */
  22213. var divide = function () {
  22214. // Assumes non-zero x and k, and hence non-zero result.
  22215. function multiplyInteger(x, k, base) {
  22216. var temp,
  22217. carry = 0,
  22218. i = x.length;
  22219. for (x = x.slice(); i--;) {
  22220. temp = x[i] * k + carry;
  22221. x[i] = temp % base | 0;
  22222. carry = temp / base | 0;
  22223. }
  22224. if (carry) x.unshift(carry);
  22225. return x;
  22226. }
  22227. function compare(a, b, aL, bL) {
  22228. var i, r;
  22229. if (aL != bL) {
  22230. r = aL > bL ? 1 : -1;
  22231. } else {
  22232. for (i = r = 0; i < aL; i++) {
  22233. if (a[i] != b[i]) {
  22234. r = a[i] > b[i] ? 1 : -1;
  22235. break;
  22236. }
  22237. }
  22238. }
  22239. return r;
  22240. }
  22241. function subtract(a, b, aL, base) {
  22242. var i = 0;
  22243. // Subtract b from a.
  22244. for (; aL--;) {
  22245. a[aL] -= i;
  22246. i = a[aL] < b[aL] ? 1 : 0;
  22247. a[aL] = i * base + a[aL] - b[aL];
  22248. }
  22249. // Remove leading zeros.
  22250. for (; !a[0] && a.length > 1;) {
  22251. a.shift();
  22252. }
  22253. }
  22254. return function (x, y, pr, rm, dp, base) {
  22255. var cmp,
  22256. e,
  22257. i,
  22258. k,
  22259. logBase,
  22260. more,
  22261. prod,
  22262. prodL,
  22263. q,
  22264. qd,
  22265. rem,
  22266. remL,
  22267. rem0,
  22268. sd,
  22269. t,
  22270. xi,
  22271. xL,
  22272. yd0,
  22273. yL,
  22274. yz,
  22275. Ctor = x.constructor,
  22276. sign = x.s == y.s ? 1 : -1,
  22277. xd = x.d,
  22278. yd = y.d;
  22279. // Either NaN, Infinity or 0?
  22280. if (!xd || !xd[0] || !yd || !yd[0]) {
  22281. return new Ctor( // Return NaN if either NaN, or both Infinity or 0.
  22282. !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
  22283. // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
  22284. xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
  22285. }
  22286. if (base) {
  22287. logBase = 1;
  22288. e = x.e - y.e;
  22289. } else {
  22290. base = BASE;
  22291. logBase = LOG_BASE;
  22292. e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
  22293. }
  22294. yL = yd.length;
  22295. xL = xd.length;
  22296. q = new Ctor(sign);
  22297. qd = q.d = [];
  22298. // Result exponent may be one less than e.
  22299. // The digit array of a Decimal from toStringBinary may have trailing zeros.
  22300. for (i = 0; yd[i] == (xd[i] || 0); i++) {}
  22301. if (yd[i] > (xd[i] || 0)) e--;
  22302. if (pr == null) {
  22303. sd = pr = Ctor.precision;
  22304. rm = Ctor.rounding;
  22305. } else if (dp) {
  22306. sd = pr + (x.e - y.e) + 1;
  22307. } else {
  22308. sd = pr;
  22309. }
  22310. if (sd < 0) {
  22311. qd.push(1);
  22312. more = true;
  22313. } else {
  22314. // Convert precision in number of base 10 digits to base 1e7 digits.
  22315. sd = sd / logBase + 2 | 0;
  22316. i = 0;
  22317. // divisor < 1e7
  22318. if (yL == 1) {
  22319. k = 0;
  22320. yd = yd[0];
  22321. sd++;
  22322. // k is the carry.
  22323. for (; (i < xL || k) && sd--; i++) {
  22324. t = k * base + (xd[i] || 0);
  22325. qd[i] = t / yd | 0;
  22326. k = t % yd | 0;
  22327. }
  22328. more = k || i < xL;
  22329. // divisor >= 1e7
  22330. } else {
  22331. // Normalise xd and yd so highest order digit of yd is >= base/2
  22332. k = base / (yd[0] + 1) | 0;
  22333. if (k > 1) {
  22334. yd = multiplyInteger(yd, k, base);
  22335. xd = multiplyInteger(xd, k, base);
  22336. yL = yd.length;
  22337. xL = xd.length;
  22338. }
  22339. xi = yL;
  22340. rem = xd.slice(0, yL);
  22341. remL = rem.length;
  22342. // Add zeros to make remainder as long as divisor.
  22343. for (; remL < yL;) {
  22344. rem[remL++] = 0;
  22345. }yz = yd.slice();
  22346. yz.unshift(0);
  22347. yd0 = yd[0];
  22348. if (yd[1] >= base / 2) ++yd0;
  22349. do {
  22350. k = 0;
  22351. // Compare divisor and remainder.
  22352. cmp = compare(yd, rem, yL, remL);
  22353. // If divisor < remainder.
  22354. if (cmp < 0) {
  22355. // Calculate trial digit, k.
  22356. rem0 = rem[0];
  22357. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  22358. // k will be how many times the divisor goes into the current remainder.
  22359. k = rem0 / yd0 | 0;
  22360. // Algorithm:
  22361. // 1. product = divisor * trial digit (k)
  22362. // 2. if product > remainder: product -= divisor, k--
  22363. // 3. remainder -= product
  22364. // 4. if product was < remainder at 2:
  22365. // 5. compare new remainder and divisor
  22366. // 6. If remainder > divisor: remainder -= divisor, k++
  22367. if (k > 1) {
  22368. if (k >= base) k = base - 1;
  22369. // product = divisor * trial digit.
  22370. prod = multiplyInteger(yd, k, base);
  22371. prodL = prod.length;
  22372. remL = rem.length;
  22373. // Compare product and remainder.
  22374. cmp = compare(prod, rem, prodL, remL);
  22375. // product > remainder.
  22376. if (cmp == 1) {
  22377. k--;
  22378. // Subtract divisor from product.
  22379. subtract(prod, yL < prodL ? yz : yd, prodL, base);
  22380. }
  22381. } else {
  22382. // cmp is -1.
  22383. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
  22384. // to avoid it. If k is 1 there is a need to compare yd and rem again below.
  22385. if (k == 0) cmp = k = 1;
  22386. prod = yd.slice();
  22387. }
  22388. prodL = prod.length;
  22389. if (prodL < remL) prod.unshift(0);
  22390. // Subtract product from remainder.
  22391. subtract(rem, prod, remL, base);
  22392. // If product was < previous remainder.
  22393. if (cmp == -1) {
  22394. remL = rem.length;
  22395. // Compare divisor and new remainder.
  22396. cmp = compare(yd, rem, yL, remL);
  22397. // If divisor < new remainder, subtract divisor from remainder.
  22398. if (cmp < 1) {
  22399. k++;
  22400. // Subtract divisor from remainder.
  22401. subtract(rem, yL < remL ? yz : yd, remL, base);
  22402. }
  22403. }
  22404. remL = rem.length;
  22405. } else if (cmp === 0) {
  22406. k++;
  22407. rem = [0];
  22408. } // if cmp === 1, k will be 0
  22409. // Add the next digit, k, to the result array.
  22410. qd[i++] = k;
  22411. // Update the remainder.
  22412. if (cmp && rem[0]) {
  22413. rem[remL++] = xd[xi] || 0;
  22414. } else {
  22415. rem = [xd[xi]];
  22416. remL = 1;
  22417. }
  22418. } while ((xi++ < xL || rem[0] !== void 0) && sd--);
  22419. more = rem[0] !== void 0;
  22420. }
  22421. // Leading zero?
  22422. if (!qd[0]) qd.shift();
  22423. }
  22424. // logBase is 1 when divide is being used for base conversion.
  22425. if (logBase == 1) {
  22426. q.e = e;
  22427. inexact = more;
  22428. } else {
  22429. // To calculate q.e, first get the number of digits of qd[0].
  22430. for (i = 1, k = qd[0]; k >= 10; k /= 10) {
  22431. i++;
  22432. }q.e = i + e * logBase - 1;
  22433. finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
  22434. }
  22435. return q;
  22436. };
  22437. }();
  22438. /*
  22439. * Round `x` to `sd` significant digits using rounding mode `rm`.
  22440. * Check for over/under-flow.
  22441. */
  22442. function finalise(x, sd, rm, isTruncated) {
  22443. var digits,
  22444. i,
  22445. j,
  22446. k,
  22447. rd,
  22448. roundUp,
  22449. w,
  22450. xd,
  22451. xdi,
  22452. Ctor = x.constructor;
  22453. // Don't round if sd is null or undefined.
  22454. out: if (sd != null) {
  22455. xd = x.d;
  22456. // Infinity/NaN.
  22457. if (!xd) return x;
  22458. // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
  22459. // w: the word of xd containing rd, a base 1e7 number.
  22460. // xdi: the index of w within xd.
  22461. // digits: the number of digits of w.
  22462. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
  22463. // they had leading zeros)
  22464. // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
  22465. // Get the length of the first word of the digits array xd.
  22466. for (digits = 1, k = xd[0]; k >= 10; k /= 10) {
  22467. digits++;
  22468. }i = sd - digits;
  22469. // Is the rounding digit in the first word of xd?
  22470. if (i < 0) {
  22471. i += LOG_BASE;
  22472. j = sd;
  22473. w = xd[xdi = 0];
  22474. // Get the rounding digit at index j of w.
  22475. rd = w / mathpow(10, digits - j - 1) % 10 | 0;
  22476. } else {
  22477. xdi = Math.ceil((i + 1) / LOG_BASE);
  22478. k = xd.length;
  22479. if (xdi >= k) {
  22480. if (isTruncated) {
  22481. // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
  22482. for (; k++ <= xdi;) {
  22483. xd.push(0);
  22484. }w = rd = 0;
  22485. digits = 1;
  22486. i %= LOG_BASE;
  22487. j = i - LOG_BASE + 1;
  22488. } else {
  22489. break out;
  22490. }
  22491. } else {
  22492. w = k = xd[xdi];
  22493. // Get the number of digits of w.
  22494. for (digits = 1; k >= 10; k /= 10) {
  22495. digits++;
  22496. } // Get the index of rd within w.
  22497. i %= LOG_BASE;
  22498. // Get the index of rd within w, adjusted for leading zeros.
  22499. // The number of leading zeros of w is given by LOG_BASE - digits.
  22500. j = i - LOG_BASE + digits;
  22501. // Get the rounding digit at index j of w.
  22502. rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
  22503. }
  22504. }
  22505. // Are there any non-zero digits after the rounding digit?
  22506. isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
  22507. // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
  22508. // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
  22509. // will give 714.
  22510. roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
  22511. // Check whether the digit to the left of the rounding digit is odd.
  22512. (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
  22513. if (sd < 1 || !xd[0]) {
  22514. xd.length = 0;
  22515. if (roundUp) {
  22516. // Convert sd to decimal places.
  22517. sd -= x.e + 1;
  22518. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  22519. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
  22520. x.e = -sd || 0;
  22521. } else {
  22522. // Zero.
  22523. xd[0] = x.e = 0;
  22524. }
  22525. return x;
  22526. }
  22527. // Remove excess digits.
  22528. if (i == 0) {
  22529. xd.length = xdi;
  22530. k = 1;
  22531. xdi--;
  22532. } else {
  22533. xd.length = xdi + 1;
  22534. k = mathpow(10, LOG_BASE - i);
  22535. // E.g. 56700 becomes 56000 if 7 is the rounding digit.
  22536. // j > 0 means i > number of leading zeros of w.
  22537. xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
  22538. }
  22539. if (roundUp) {
  22540. for (;;) {
  22541. // Is the digit to be rounded up in the first word of xd?
  22542. if (xdi == 0) {
  22543. // i will be the length of xd[0] before k is added.
  22544. for (i = 1, j = xd[0]; j >= 10; j /= 10) {
  22545. i++;
  22546. }j = xd[0] += k;
  22547. for (k = 1; j >= 10; j /= 10) {
  22548. k++;
  22549. } // if i != k the length has increased.
  22550. if (i != k) {
  22551. x.e++;
  22552. if (xd[0] == BASE) xd[0] = 1;
  22553. }
  22554. break;
  22555. } else {
  22556. xd[xdi] += k;
  22557. if (xd[xdi] != BASE) break;
  22558. xd[xdi--] = 0;
  22559. k = 1;
  22560. }
  22561. }
  22562. }
  22563. // Remove trailing zeros.
  22564. for (i = xd.length; xd[--i] === 0;) {
  22565. xd.pop();
  22566. }
  22567. }
  22568. if (external) {
  22569. // Overflow?
  22570. if (x.e > Ctor.maxE) {
  22571. // Infinity.
  22572. x.d = null;
  22573. x.e = NaN;
  22574. // Underflow?
  22575. } else if (x.e < Ctor.minE) {
  22576. // Zero.
  22577. x.e = 0;
  22578. x.d = [0];
  22579. // Ctor.underflow = true;
  22580. } // else Ctor.underflow = false;
  22581. }
  22582. return x;
  22583. }
  22584. function finiteToString(x, isExp, sd) {
  22585. if (!x.isFinite()) return nonFiniteToString(x);
  22586. var k,
  22587. e = x.e,
  22588. str = digitsToString(x.d),
  22589. len = str.length;
  22590. if (isExp) {
  22591. if (sd && (k = sd - len) > 0) {
  22592. str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
  22593. } else if (len > 1) {
  22594. str = str.charAt(0) + '.' + str.slice(1);
  22595. }
  22596. str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
  22597. } else if (e < 0) {
  22598. str = '0.' + getZeroString(-e - 1) + str;
  22599. if (sd && (k = sd - len) > 0) str += getZeroString(k);
  22600. } else if (e >= len) {
  22601. str += getZeroString(e + 1 - len);
  22602. if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
  22603. } else {
  22604. if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
  22605. if (sd && (k = sd - len) > 0) {
  22606. if (e + 1 === len) str += '.';
  22607. str += getZeroString(k);
  22608. }
  22609. }
  22610. return str;
  22611. }
  22612. // Calculate the base 10 exponent from the base 1e7 exponent.
  22613. function getBase10Exponent(digits, e) {
  22614. var w = digits[0];
  22615. // Add the number of digits of the first word of the digits array.
  22616. for (e *= LOG_BASE; w >= 10; w /= 10) {
  22617. e++;
  22618. }return e;
  22619. }
  22620. function getLn10(Ctor, sd, pr) {
  22621. if (sd > LN10_PRECISION) {
  22622. // Reset global state in case the exception is caught.
  22623. external = true;
  22624. if (pr) Ctor.precision = pr;
  22625. throw Error(precisionLimitExceeded);
  22626. }
  22627. return finalise(new Ctor(LN10), sd, 1, true);
  22628. }
  22629. function getPi(Ctor, sd, rm) {
  22630. if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
  22631. return finalise(new Ctor(PI), sd, rm, true);
  22632. }
  22633. function getPrecision(digits) {
  22634. var w = digits.length - 1,
  22635. len = w * LOG_BASE + 1;
  22636. w = digits[w];
  22637. // If non-zero...
  22638. if (w) {
  22639. // Subtract the number of trailing zeros of the last word.
  22640. for (; w % 10 == 0; w /= 10) {
  22641. len--;
  22642. } // Add the number of digits of the first word.
  22643. for (w = digits[0]; w >= 10; w /= 10) {
  22644. len++;
  22645. }
  22646. }
  22647. return len;
  22648. }
  22649. function getZeroString(k) {
  22650. var zs = '';
  22651. for (; k--;) {
  22652. zs += '0';
  22653. }return zs;
  22654. }
  22655. /*
  22656. * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
  22657. * integer of type number.
  22658. *
  22659. * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
  22660. *
  22661. */
  22662. function intPow(Ctor, x, n, pr) {
  22663. var isTruncated,
  22664. r = new Ctor(1),
  22665. // Max n of 9007199254740991 takes 53 loop iterations.
  22666. // Maximum digits array length; leaves [28, 34] guard digits.
  22667. k = Math.ceil(pr / LOG_BASE + 4);
  22668. external = false;
  22669. for (;;) {
  22670. if (n % 2) {
  22671. r = r.times(x);
  22672. if (truncate(r.d, k)) isTruncated = true;
  22673. }
  22674. n = mathfloor(n / 2);
  22675. if (n === 0) {
  22676. // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
  22677. n = r.d.length - 1;
  22678. if (isTruncated && r.d[n] === 0) ++r.d[n];
  22679. break;
  22680. }
  22681. x = x.times(x);
  22682. truncate(x.d, k);
  22683. }
  22684. external = true;
  22685. return r;
  22686. }
  22687. function isOdd(n) {
  22688. return n.d[n.d.length - 1] & 1;
  22689. }
  22690. /*
  22691. * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
  22692. */
  22693. function maxOrMin(Ctor, args, ltgt) {
  22694. var y,
  22695. x = new Ctor(args[0]),
  22696. i = 0;
  22697. for (; ++i < args.length;) {
  22698. y = new Ctor(args[i]);
  22699. if (!y.s) {
  22700. x = y;
  22701. break;
  22702. } else if (x[ltgt](y)) {
  22703. x = y;
  22704. }
  22705. }
  22706. return x;
  22707. }
  22708. /*
  22709. * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
  22710. * digits.
  22711. *
  22712. * Taylor/Maclaurin series.
  22713. *
  22714. * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
  22715. *
  22716. * Argument reduction:
  22717. * Repeat x = x / 32, k += 5, until |x| < 0.1
  22718. * exp(x) = exp(x / 2^k)^(2^k)
  22719. *
  22720. * Previously, the argument was initially reduced by
  22721. * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
  22722. * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
  22723. * found to be slower than just dividing repeatedly by 32 as above.
  22724. *
  22725. * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
  22726. * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
  22727. * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
  22728. *
  22729. * exp(Infinity) = Infinity
  22730. * exp(-Infinity) = 0
  22731. * exp(NaN) = NaN
  22732. * exp(±0) = 1
  22733. *
  22734. * exp(x) is non-terminating for any finite, non-zero x.
  22735. *
  22736. * The result will always be correctly rounded.
  22737. *
  22738. */
  22739. function naturalExponential(x, sd) {
  22740. var denominator,
  22741. guard,
  22742. j,
  22743. pow,
  22744. sum,
  22745. t,
  22746. wpr,
  22747. rep = 0,
  22748. i = 0,
  22749. k = 0,
  22750. Ctor = x.constructor,
  22751. rm = Ctor.rounding,
  22752. pr = Ctor.precision;
  22753. // 0/NaN/Infinity?
  22754. if (!x.d || !x.d[0] || x.e > 17) {
  22755. return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0);
  22756. }
  22757. if (sd == null) {
  22758. external = false;
  22759. wpr = pr;
  22760. } else {
  22761. wpr = sd;
  22762. }
  22763. t = new Ctor(0.03125);
  22764. // while abs(x) >= 0.1
  22765. while (x.e > -2) {
  22766. // x = x / 2^5
  22767. x = x.times(t);
  22768. k += 5;
  22769. }
  22770. // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
  22771. // necessary to ensure the first 4 rounding digits are correct.
  22772. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
  22773. wpr += guard;
  22774. denominator = pow = sum = new Ctor(1);
  22775. Ctor.precision = wpr;
  22776. for (;;) {
  22777. pow = finalise(pow.times(x), wpr, 1);
  22778. denominator = denominator.times(++i);
  22779. t = sum.plus(divide(pow, denominator, wpr, 1));
  22780. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  22781. j = k;
  22782. while (j--) {
  22783. sum = finalise(sum.times(sum), wpr, 1);
  22784. } // Check to see if the first 4 rounding digits are [49]999.
  22785. // If so, repeat the summation with a higher precision, otherwise
  22786. // e.g. with precision: 18, rounding: 1
  22787. // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
  22788. // `wpr - guard` is the index of first rounding digit.
  22789. if (sd == null) {
  22790. if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  22791. Ctor.precision = wpr += 10;
  22792. denominator = pow = t = new Ctor(1);
  22793. i = 0;
  22794. rep++;
  22795. } else {
  22796. return finalise(sum, Ctor.precision = pr, rm, external = true);
  22797. }
  22798. } else {
  22799. Ctor.precision = pr;
  22800. return sum;
  22801. }
  22802. }
  22803. sum = t;
  22804. }
  22805. }
  22806. /*
  22807. * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
  22808. * digits.
  22809. *
  22810. * ln(-n) = NaN
  22811. * ln(0) = -Infinity
  22812. * ln(-0) = -Infinity
  22813. * ln(1) = 0
  22814. * ln(Infinity) = Infinity
  22815. * ln(-Infinity) = NaN
  22816. * ln(NaN) = NaN
  22817. *
  22818. * ln(n) (n != 1) is non-terminating.
  22819. *
  22820. */
  22821. function naturalLogarithm(y, sd) {
  22822. var c,
  22823. c0,
  22824. denominator,
  22825. e,
  22826. numerator,
  22827. rep,
  22828. sum,
  22829. t,
  22830. wpr,
  22831. x1,
  22832. x2,
  22833. n = 1,
  22834. guard = 10,
  22835. x = y,
  22836. xd = x.d,
  22837. Ctor = x.constructor,
  22838. rm = Ctor.rounding,
  22839. pr = Ctor.precision;
  22840. // Is x negative or Infinity, NaN, 0 or 1?
  22841. if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
  22842. return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
  22843. }
  22844. if (sd == null) {
  22845. external = false;
  22846. wpr = pr;
  22847. } else {
  22848. wpr = sd;
  22849. }
  22850. Ctor.precision = wpr += guard;
  22851. c = digitsToString(xd);
  22852. c0 = c.charAt(0);
  22853. if (Math.abs(e = x.e) < 1.5e15) {
  22854. // Argument reduction.
  22855. // The series converges faster the closer the argument is to 1, so using
  22856. // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
  22857. // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
  22858. // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
  22859. // later be divided by this number, then separate out the power of 10 using
  22860. // ln(a*10^b) = ln(a) + b*ln(10).
  22861. // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
  22862. //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
  22863. // max n is 6 (gives 0.7 - 1.3)
  22864. while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
  22865. x = x.times(y);
  22866. c = digitsToString(x.d);
  22867. c0 = c.charAt(0);
  22868. n++;
  22869. }
  22870. e = x.e;
  22871. if (c0 > 1) {
  22872. x = new Ctor('0.' + c);
  22873. e++;
  22874. } else {
  22875. x = new Ctor(c0 + '.' + c.slice(1));
  22876. }
  22877. } else {
  22878. // The argument reduction method above may result in overflow if the argument y is a massive
  22879. // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
  22880. // function using ln(x*10^e) = ln(x) + e*ln(10).
  22881. t = getLn10(Ctor, wpr + 2, pr).times(e + '');
  22882. x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
  22883. Ctor.precision = pr;
  22884. return sd == null ? finalise(x, pr, rm, external = true) : x;
  22885. }
  22886. // x1 is x reduced to a value near 1.
  22887. x1 = x;
  22888. // Taylor series.
  22889. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
  22890. // where x = (y - 1)/(y + 1) (|x| < 1)
  22891. sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
  22892. x2 = finalise(x.times(x), wpr, 1);
  22893. denominator = 3;
  22894. for (;;) {
  22895. numerator = finalise(numerator.times(x2), wpr, 1);
  22896. t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
  22897. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  22898. sum = sum.times(2);
  22899. // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
  22900. // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
  22901. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
  22902. sum = divide(sum, new Ctor(n), wpr, 1);
  22903. // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
  22904. // been repeated previously) and the first 4 rounding digits 9999?
  22905. // If so, restart the summation with a higher precision, otherwise
  22906. // e.g. with precision: 12, rounding: 1
  22907. // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
  22908. // `wpr - guard` is the index of first rounding digit.
  22909. if (sd == null) {
  22910. if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  22911. Ctor.precision = wpr += guard;
  22912. t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
  22913. x2 = finalise(x.times(x), wpr, 1);
  22914. denominator = rep = 1;
  22915. } else {
  22916. return finalise(sum, Ctor.precision = pr, rm, external = true);
  22917. }
  22918. } else {
  22919. Ctor.precision = pr;
  22920. return sum;
  22921. }
  22922. }
  22923. sum = t;
  22924. denominator += 2;
  22925. }
  22926. }
  22927. // ±Infinity, NaN.
  22928. function nonFiniteToString(x) {
  22929. // Unsigned.
  22930. return String(x.s * x.s / 0);
  22931. }
  22932. /*
  22933. * Parse the value of a new Decimal `x` from string `str`.
  22934. */
  22935. function parseDecimal(x, str) {
  22936. var e, i, len;
  22937. // Decimal point?
  22938. if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
  22939. // Exponential form?
  22940. if ((i = str.search(/e/i)) > 0) {
  22941. // Determine exponent.
  22942. if (e < 0) e = i;
  22943. e += +str.slice(i + 1);
  22944. str = str.substring(0, i);
  22945. } else if (e < 0) {
  22946. // Integer.
  22947. e = str.length;
  22948. }
  22949. // Determine leading zeros.
  22950. for (i = 0; str.charCodeAt(i) === 48; i++) {}
  22951. // Determine trailing zeros.
  22952. for (len = str.length; str.charCodeAt(len - 1) === 48; --len) {}
  22953. str = str.slice(i, len);
  22954. if (str) {
  22955. len -= i;
  22956. x.e = e = e - i - 1;
  22957. x.d = [];
  22958. // Transform base
  22959. // e is the base 10 exponent.
  22960. // i is where to slice str to get the first word of the digits array.
  22961. i = (e + 1) % LOG_BASE;
  22962. if (e < 0) i += LOG_BASE;
  22963. if (i < len) {
  22964. if (i) x.d.push(+str.slice(0, i));
  22965. for (len -= LOG_BASE; i < len;) {
  22966. x.d.push(+str.slice(i, i += LOG_BASE));
  22967. }str = str.slice(i);
  22968. i = LOG_BASE - str.length;
  22969. } else {
  22970. i -= len;
  22971. }
  22972. for (; i--;) {
  22973. str += '0';
  22974. }x.d.push(+str);
  22975. if (external) {
  22976. // Overflow?
  22977. if (x.e > x.constructor.maxE) {
  22978. // Infinity.
  22979. x.d = null;
  22980. x.e = NaN;
  22981. // Underflow?
  22982. } else if (x.e < x.constructor.minE) {
  22983. // Zero.
  22984. x.e = 0;
  22985. x.d = [0];
  22986. // x.constructor.underflow = true;
  22987. } // else x.constructor.underflow = false;
  22988. }
  22989. } else {
  22990. // Zero.
  22991. x.e = 0;
  22992. x.d = [0];
  22993. }
  22994. return x;
  22995. }
  22996. /*
  22997. * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
  22998. */
  22999. function parseOther(x, str) {
  23000. var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
  23001. if (str === 'Infinity' || str === 'NaN') {
  23002. if (!+str) x.s = NaN;
  23003. x.e = NaN;
  23004. x.d = null;
  23005. return x;
  23006. }
  23007. if (isHex.test(str)) {
  23008. base = 16;
  23009. str = str.toLowerCase();
  23010. } else if (isBinary.test(str)) {
  23011. base = 2;
  23012. } else if (isOctal.test(str)) {
  23013. base = 8;
  23014. } else {
  23015. throw Error(invalidArgument + str);
  23016. }
  23017. // Is there a binary exponent part?
  23018. i = str.search(/p/i);
  23019. if (i > 0) {
  23020. p = +str.slice(i + 1);
  23021. str = str.substring(2, i);
  23022. } else {
  23023. str = str.slice(2);
  23024. }
  23025. // Convert `str` as an integer then divide the result by `base` raised to a power such that the
  23026. // fraction part will be restored.
  23027. i = str.indexOf('.');
  23028. isFloat = i >= 0;
  23029. Ctor = x.constructor;
  23030. if (isFloat) {
  23031. str = str.replace('.', '');
  23032. len = str.length;
  23033. i = len - i;
  23034. // log[10](16) = 1.2041... , log[10](88) = 1.9444....
  23035. divisor = intPow(Ctor, new Ctor(base), i, i * 2);
  23036. }
  23037. xd = convertBase(str, base, BASE);
  23038. xe = xd.length - 1;
  23039. // Remove trailing zeros.
  23040. for (i = xe; xd[i] === 0; --i) {
  23041. xd.pop();
  23042. }if (i < 0) return new Ctor(x.s * 0);
  23043. x.e = getBase10Exponent(xd, xe);
  23044. x.d = xd;
  23045. external = false;
  23046. // At what precision to perform the division to ensure exact conversion?
  23047. // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
  23048. // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
  23049. // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
  23050. // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
  23051. // Therefore using 4 * the number of digits of str will always be enough.
  23052. if (isFloat) x = divide(x, divisor, len * 4);
  23053. // Multiply by the binary exponent part if present.
  23054. if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));
  23055. external = true;
  23056. return x;
  23057. }
  23058. /*
  23059. * sin(x) = x - x^3/3! + x^5/5! - ...
  23060. * |x| < pi/2
  23061. *
  23062. */
  23063. function sine(Ctor, x) {
  23064. var k,
  23065. len = x.d.length;
  23066. if (len < 3) return taylorSeries(Ctor, 2, x, x);
  23067. // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
  23068. // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
  23069. // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
  23070. // Estimate the optimum number of times to use the argument reduction.
  23071. k = 1.4 * Math.sqrt(len);
  23072. k = k > 16 ? 16 : k | 0;
  23073. // Max k before Math.pow precision loss is 22
  23074. x = x.times(Math.pow(5, -k));
  23075. x = taylorSeries(Ctor, 2, x, x);
  23076. // Reverse argument reduction
  23077. var sin2_x,
  23078. d5 = new Ctor(5),
  23079. d16 = new Ctor(16),
  23080. d20 = new Ctor(20);
  23081. for (; k--;) {
  23082. sin2_x = x.times(x);
  23083. x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
  23084. }
  23085. return x;
  23086. }
  23087. // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
  23088. function taylorSeries(Ctor, n, x, y, isHyperbolic) {
  23089. var j,
  23090. t,
  23091. u,
  23092. x2,
  23093. i = 1,
  23094. pr = Ctor.precision,
  23095. k = Math.ceil(pr / LOG_BASE);
  23096. external = false;
  23097. x2 = x.times(x);
  23098. u = new Ctor(y);
  23099. for (;;) {
  23100. t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
  23101. u = isHyperbolic ? y.plus(t) : y.minus(t);
  23102. y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
  23103. t = u.plus(y);
  23104. if (t.d[k] !== void 0) {
  23105. for (j = k; t.d[j] === u.d[j] && j--;) {}
  23106. if (j == -1) break;
  23107. }
  23108. j = u;
  23109. u = y;
  23110. y = t;
  23111. t = j;
  23112. i++;
  23113. }
  23114. external = true;
  23115. t.d.length = k + 1;
  23116. return t;
  23117. }
  23118. // Return the absolute value of `x` reduced to less than or equal to half pi.
  23119. function toLessThanHalfPi(Ctor, x) {
  23120. var t,
  23121. isNeg = x.s < 0,
  23122. pi = getPi(Ctor, Ctor.precision, 1),
  23123. halfPi = pi.times(0.5);
  23124. x = x.abs();
  23125. if (x.lte(halfPi)) {
  23126. quadrant = isNeg ? 4 : 1;
  23127. return x;
  23128. }
  23129. t = x.divToInt(pi);
  23130. if (t.isZero()) {
  23131. quadrant = isNeg ? 3 : 2;
  23132. } else {
  23133. x = x.minus(t.times(pi));
  23134. // 0 <= x < pi
  23135. if (x.lte(halfPi)) {
  23136. quadrant = isOdd(t) ? isNeg ? 2 : 3 : isNeg ? 4 : 1;
  23137. return x;
  23138. }
  23139. quadrant = isOdd(t) ? isNeg ? 1 : 4 : isNeg ? 3 : 2;
  23140. }
  23141. return x.minus(pi).abs();
  23142. }
  23143. /*
  23144. * Return the value of Decimal `x` as a string in base `baseOut`.
  23145. *
  23146. * If the optional `sd` argument is present include a binary exponent suffix.
  23147. */
  23148. function toStringBinary(x, baseOut, sd, rm) {
  23149. var base,
  23150. e,
  23151. i,
  23152. k,
  23153. len,
  23154. roundUp,
  23155. str,
  23156. xd,
  23157. y,
  23158. Ctor = x.constructor,
  23159. isExp = sd !== void 0;
  23160. if (isExp) {
  23161. checkInt32(sd, 1, MAX_DIGITS);
  23162. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  23163. } else {
  23164. sd = Ctor.precision;
  23165. rm = Ctor.rounding;
  23166. }
  23167. if (!x.isFinite()) {
  23168. str = nonFiniteToString(x);
  23169. } else {
  23170. str = finiteToString(x);
  23171. i = str.indexOf('.');
  23172. // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
  23173. // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
  23174. // minBinaryExponent = floor(decimalExponent * log[2](10))
  23175. // log[2](10) = 3.321928094887362347870319429489390175864
  23176. if (isExp) {
  23177. base = 2;
  23178. if (baseOut == 16) {
  23179. sd = sd * 4 - 3;
  23180. } else if (baseOut == 8) {
  23181. sd = sd * 3 - 2;
  23182. }
  23183. } else {
  23184. base = baseOut;
  23185. }
  23186. // Convert the number as an integer then divide the result by its base raised to a power such
  23187. // that the fraction part will be restored.
  23188. // Non-integer.
  23189. if (i >= 0) {
  23190. str = str.replace('.', '');
  23191. y = new Ctor(1);
  23192. y.e = str.length - i;
  23193. y.d = convertBase(finiteToString(y), 10, base);
  23194. y.e = y.d.length;
  23195. }
  23196. xd = convertBase(str, 10, base);
  23197. e = len = xd.length;
  23198. // Remove trailing zeros.
  23199. for (; xd[--len] == 0;) {
  23200. xd.pop();
  23201. }if (!xd[0]) {
  23202. str = isExp ? '0p+0' : '0';
  23203. } else {
  23204. if (i < 0) {
  23205. e--;
  23206. } else {
  23207. x = new Ctor(x);
  23208. x.d = xd;
  23209. x.e = e;
  23210. x = divide(x, y, sd, rm, 0, base);
  23211. xd = x.d;
  23212. e = x.e;
  23213. roundUp = inexact;
  23214. }
  23215. // The rounding digit, i.e. the digit after the digit that may be rounded up.
  23216. i = xd[sd];
  23217. k = base / 2;
  23218. roundUp = roundUp || xd[sd + 1] !== void 0;
  23219. roundUp = rm < 4 ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2)) : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || rm === (x.s < 0 ? 8 : 7));
  23220. xd.length = sd;
  23221. if (roundUp) {
  23222. // Rounding up may mean the previous digit has to be rounded up and so on.
  23223. for (; ++xd[--sd] > base - 1;) {
  23224. xd[sd] = 0;
  23225. if (!sd) {
  23226. ++e;
  23227. xd.unshift(1);
  23228. }
  23229. }
  23230. }
  23231. // Determine trailing zeros.
  23232. for (len = xd.length; !xd[len - 1]; --len) {}
  23233. // E.g. [4, 11, 15] becomes 4bf.
  23234. for (i = 0, str = ''; i < len; i++) {
  23235. str += NUMERALS.charAt(xd[i]);
  23236. } // Add binary exponent suffix?
  23237. if (isExp) {
  23238. if (len > 1) {
  23239. if (baseOut == 16 || baseOut == 8) {
  23240. i = baseOut == 16 ? 4 : 3;
  23241. for (--len; len % i; len++) {
  23242. str += '0';
  23243. }xd = convertBase(str, base, baseOut);
  23244. for (len = xd.length; !xd[len - 1]; --len) {}
  23245. // xd[0] will always be be 1
  23246. for (i = 1, str = '1.'; i < len; i++) {
  23247. str += NUMERALS.charAt(xd[i]);
  23248. }
  23249. } else {
  23250. str = str.charAt(0) + '.' + str.slice(1);
  23251. }
  23252. }
  23253. str = str + (e < 0 ? 'p' : 'p+') + e;
  23254. } else if (e < 0) {
  23255. for (; ++e;) {
  23256. str = '0' + str;
  23257. }str = '0.' + str;
  23258. } else {
  23259. if (++e > len) for (e -= len; e--;) {
  23260. str += '0';
  23261. } else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
  23262. }
  23263. }
  23264. str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
  23265. }
  23266. return x.s < 0 ? '-' + str : str;
  23267. }
  23268. // Does not strip trailing zeros.
  23269. function truncate(arr, len) {
  23270. if (arr.length > len) {
  23271. arr.length = len;
  23272. return true;
  23273. }
  23274. }
  23275. // Decimal methods
  23276. /*
  23277. * abs
  23278. * acos
  23279. * acosh
  23280. * add
  23281. * asin
  23282. * asinh
  23283. * atan
  23284. * atanh
  23285. * atan2
  23286. * cbrt
  23287. * ceil
  23288. * clone
  23289. * config
  23290. * cos
  23291. * cosh
  23292. * div
  23293. * exp
  23294. * floor
  23295. * hypot
  23296. * ln
  23297. * log
  23298. * log2
  23299. * log10
  23300. * max
  23301. * min
  23302. * mod
  23303. * mul
  23304. * pow
  23305. * random
  23306. * round
  23307. * set
  23308. * sign
  23309. * sin
  23310. * sinh
  23311. * sqrt
  23312. * sub
  23313. * tan
  23314. * tanh
  23315. * trunc
  23316. */
  23317. /*
  23318. * Return a new Decimal whose value is the absolute value of `x`.
  23319. *
  23320. * x {number|string|Decimal}
  23321. *
  23322. */
  23323. function abs(x) {
  23324. return new this(x).abs();
  23325. }
  23326. /*
  23327. * Return a new Decimal whose value is the arccosine in radians of `x`.
  23328. *
  23329. * x {number|string|Decimal}
  23330. *
  23331. */
  23332. function acos(x) {
  23333. return new this(x).acos();
  23334. }
  23335. /*
  23336. * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
  23337. * `precision` significant digits using rounding mode `rounding`.
  23338. *
  23339. * x {number|string|Decimal} A value in radians.
  23340. *
  23341. */
  23342. function acosh(x) {
  23343. return new this(x).acosh();
  23344. }
  23345. /*
  23346. * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
  23347. * digits using rounding mode `rounding`.
  23348. *
  23349. * x {number|string|Decimal}
  23350. * y {number|string|Decimal}
  23351. *
  23352. */
  23353. function add(x, y) {
  23354. return new this(x).plus(y);
  23355. }
  23356. /*
  23357. * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
  23358. * significant digits using rounding mode `rounding`.
  23359. *
  23360. * x {number|string|Decimal}
  23361. *
  23362. */
  23363. function asin(x) {
  23364. return new this(x).asin();
  23365. }
  23366. /*
  23367. * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
  23368. * `precision` significant digits using rounding mode `rounding`.
  23369. *
  23370. * x {number|string|Decimal} A value in radians.
  23371. *
  23372. */
  23373. function asinh(x) {
  23374. return new this(x).asinh();
  23375. }
  23376. /*
  23377. * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
  23378. * significant digits using rounding mode `rounding`.
  23379. *
  23380. * x {number|string|Decimal}
  23381. *
  23382. */
  23383. function atan(x) {
  23384. return new this(x).atan();
  23385. }
  23386. /*
  23387. * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
  23388. * `precision` significant digits using rounding mode `rounding`.
  23389. *
  23390. * x {number|string|Decimal} A value in radians.
  23391. *
  23392. */
  23393. function atanh(x) {
  23394. return new this(x).atanh();
  23395. }
  23396. /*
  23397. * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
  23398. * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
  23399. *
  23400. * Domain: [-Infinity, Infinity]
  23401. * Range: [-pi, pi]
  23402. *
  23403. * y {number|string|Decimal} The y-coordinate.
  23404. * x {number|string|Decimal} The x-coordinate.
  23405. *
  23406. * atan2(±0, -0) = ±pi
  23407. * atan2(±0, +0) = ±0
  23408. * atan2(±0, -x) = ±pi for x > 0
  23409. * atan2(±0, x) = ±0 for x > 0
  23410. * atan2(-y, ±0) = -pi/2 for y > 0
  23411. * atan2(y, ±0) = pi/2 for y > 0
  23412. * atan2(±y, -Infinity) = ±pi for finite y > 0
  23413. * atan2(±y, +Infinity) = ±0 for finite y > 0
  23414. * atan2(±Infinity, x) = ±pi/2 for finite x
  23415. * atan2(±Infinity, -Infinity) = ±3*pi/4
  23416. * atan2(±Infinity, +Infinity) = ±pi/4
  23417. * atan2(NaN, x) = NaN
  23418. * atan2(y, NaN) = NaN
  23419. *
  23420. */
  23421. function atan2(y, x) {
  23422. y = new this(y);
  23423. x = new this(x);
  23424. var r,
  23425. pr = this.precision,
  23426. rm = this.rounding,
  23427. wpr = pr + 4;
  23428. // Either NaN
  23429. if (!y.s || !x.s) {
  23430. r = new this(NaN);
  23431. // Both ±Infinity
  23432. } else if (!y.d && !x.d) {
  23433. r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
  23434. r.s = y.s;
  23435. // x is ±Infinity or y is ±0
  23436. } else if (!x.d || y.isZero()) {
  23437. r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
  23438. r.s = y.s;
  23439. // y is ±Infinity or x is ±0
  23440. } else if (!y.d || x.isZero()) {
  23441. r = getPi(this, wpr, 1).times(0.5);
  23442. r.s = y.s;
  23443. // Both non-zero and finite
  23444. } else if (x.s < 0) {
  23445. this.precision = wpr;
  23446. this.rounding = 1;
  23447. r = this.atan(divide(y, x, wpr, 1));
  23448. x = getPi(this, wpr, 1);
  23449. this.precision = pr;
  23450. this.rounding = rm;
  23451. r = y.s < 0 ? r.minus(x) : r.plus(x);
  23452. } else {
  23453. r = this.atan(divide(y, x, wpr, 1));
  23454. }
  23455. return r;
  23456. }
  23457. /*
  23458. * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
  23459. * digits using rounding mode `rounding`.
  23460. *
  23461. * x {number|string|Decimal}
  23462. *
  23463. */
  23464. function cbrt(x) {
  23465. return new this(x).cbrt();
  23466. }
  23467. /*
  23468. * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
  23469. *
  23470. * x {number|string|Decimal}
  23471. *
  23472. */
  23473. function ceil(x) {
  23474. return finalise(x = new this(x), x.e + 1, 2);
  23475. }
  23476. /*
  23477. * Configure global settings for a Decimal constructor.
  23478. *
  23479. * `obj` is an object with one or more of the following properties,
  23480. *
  23481. * precision {number}
  23482. * rounding {number}
  23483. * toExpNeg {number}
  23484. * toExpPos {number}
  23485. * maxE {number}
  23486. * minE {number}
  23487. * modulo {number}
  23488. * crypto {boolean|number}
  23489. * defaults {true}
  23490. *
  23491. * E.g. Decimal.config({ precision: 20, rounding: 4 })
  23492. *
  23493. */
  23494. function config(obj) {
  23495. if (!obj || (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') throw Error(decimalError + 'Object expected');
  23496. var i,
  23497. p,
  23498. v,
  23499. useDefaults = obj.defaults === true,
  23500. ps = ['precision', 1, MAX_DIGITS, 'rounding', 0, 8, 'toExpNeg', -EXP_LIMIT, 0, 'toExpPos', 0, EXP_LIMIT, 'maxE', 0, EXP_LIMIT, 'minE', -EXP_LIMIT, 0, 'modulo', 0, 9];
  23501. for (i = 0; i < ps.length; i += 3) {
  23502. if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
  23503. if ((v = obj[p]) !== void 0) {
  23504. if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;else throw Error(invalidArgument + p + ': ' + v);
  23505. }
  23506. }
  23507. if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
  23508. if ((v = obj[p]) !== void 0) {
  23509. if (v === true || v === false || v === 0 || v === 1) {
  23510. if (v) {
  23511. if (typeof crypto != 'undefined' && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
  23512. this[p] = true;
  23513. } else {
  23514. throw Error(cryptoUnavailable);
  23515. }
  23516. } else {
  23517. this[p] = false;
  23518. }
  23519. } else {
  23520. throw Error(invalidArgument + p + ': ' + v);
  23521. }
  23522. }
  23523. return this;
  23524. }
  23525. /*
  23526. * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
  23527. * digits using rounding mode `rounding`.
  23528. *
  23529. * x {number|string|Decimal} A value in radians.
  23530. *
  23531. */
  23532. function cos(x) {
  23533. return new this(x).cos();
  23534. }
  23535. /*
  23536. * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
  23537. * significant digits using rounding mode `rounding`.
  23538. *
  23539. * x {number|string|Decimal} A value in radians.
  23540. *
  23541. */
  23542. function cosh(x) {
  23543. return new this(x).cosh();
  23544. }
  23545. /*
  23546. * Create and return a Decimal constructor with the same configuration properties as this Decimal
  23547. * constructor.
  23548. *
  23549. */
  23550. function clone(obj) {
  23551. var i, p, ps;
  23552. /*
  23553. * The Decimal constructor and exported function.
  23554. * Return a new Decimal instance.
  23555. *
  23556. * v {number|string|Decimal} A numeric value.
  23557. *
  23558. */
  23559. function Decimal(v) {
  23560. var e,
  23561. i,
  23562. t,
  23563. x = this;
  23564. // Decimal called without new.
  23565. if (!(x instanceof Decimal)) return new Decimal(v);
  23566. // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
  23567. // which points to Object.
  23568. x.constructor = Decimal;
  23569. // Duplicate.
  23570. if (v instanceof Decimal) {
  23571. x.s = v.s;
  23572. x.e = v.e;
  23573. x.d = (v = v.d) ? v.slice() : v;
  23574. return;
  23575. }
  23576. t = typeof v === 'undefined' ? 'undefined' : _typeof(v);
  23577. if (t === 'number') {
  23578. if (v === 0) {
  23579. x.s = 1 / v < 0 ? -1 : 1;
  23580. x.e = 0;
  23581. x.d = [0];
  23582. return;
  23583. }
  23584. if (v < 0) {
  23585. v = -v;
  23586. x.s = -1;
  23587. } else {
  23588. x.s = 1;
  23589. }
  23590. // Fast path for small integers.
  23591. if (v === ~~v && v < 1e7) {
  23592. for (e = 0, i = v; i >= 10; i /= 10) {
  23593. e++;
  23594. }x.e = e;
  23595. x.d = [v];
  23596. return;
  23597. // Infinity, NaN.
  23598. } else if (v * 0 !== 0) {
  23599. if (!v) x.s = NaN;
  23600. x.e = NaN;
  23601. x.d = null;
  23602. return;
  23603. }
  23604. return parseDecimal(x, v.toString());
  23605. } else if (t !== 'string') {
  23606. throw Error(invalidArgument + v);
  23607. }
  23608. // Minus sign?
  23609. if (v.charCodeAt(0) === 45) {
  23610. v = v.slice(1);
  23611. x.s = -1;
  23612. } else {
  23613. x.s = 1;
  23614. }
  23615. return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
  23616. }
  23617. Decimal.prototype = P;
  23618. Decimal.ROUND_UP = 0;
  23619. Decimal.ROUND_DOWN = 1;
  23620. Decimal.ROUND_CEIL = 2;
  23621. Decimal.ROUND_FLOOR = 3;
  23622. Decimal.ROUND_HALF_UP = 4;
  23623. Decimal.ROUND_HALF_DOWN = 5;
  23624. Decimal.ROUND_HALF_EVEN = 6;
  23625. Decimal.ROUND_HALF_CEIL = 7;
  23626. Decimal.ROUND_HALF_FLOOR = 8;
  23627. Decimal.EUCLID = 9;
  23628. Decimal.config = Decimal.set = config;
  23629. Decimal.clone = clone;
  23630. Decimal.isDecimal = isDecimalInstance;
  23631. Decimal.abs = abs;
  23632. Decimal.acos = acos;
  23633. Decimal.acosh = acosh; // ES6
  23634. Decimal.add = add;
  23635. Decimal.asin = asin;
  23636. Decimal.asinh = asinh; // ES6
  23637. Decimal.atan = atan;
  23638. Decimal.atanh = atanh; // ES6
  23639. Decimal.atan2 = atan2;
  23640. Decimal.cbrt = cbrt; // ES6
  23641. Decimal.ceil = ceil;
  23642. Decimal.cos = cos;
  23643. Decimal.cosh = cosh; // ES6
  23644. Decimal.div = div;
  23645. Decimal.exp = exp;
  23646. Decimal.floor = floor;
  23647. Decimal.hypot = hypot; // ES6
  23648. Decimal.ln = ln;
  23649. Decimal.log = log;
  23650. Decimal.log10 = log10; // ES6
  23651. Decimal.log2 = log2; // ES6
  23652. Decimal.max = max;
  23653. Decimal.min = min;
  23654. Decimal.mod = mod;
  23655. Decimal.mul = mul;
  23656. Decimal.pow = pow;
  23657. Decimal.random = random;
  23658. Decimal.round = round;
  23659. Decimal.sign = sign; // ES6
  23660. Decimal.sin = sin;
  23661. Decimal.sinh = sinh; // ES6
  23662. Decimal.sqrt = sqrt;
  23663. Decimal.sub = sub;
  23664. Decimal.tan = tan;
  23665. Decimal.tanh = tanh; // ES6
  23666. Decimal.trunc = trunc; // ES6
  23667. if (obj === void 0) obj = {};
  23668. if (obj) {
  23669. if (obj.defaults !== true) {
  23670. ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
  23671. for (i = 0; i < ps.length;) {
  23672. if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
  23673. }
  23674. }
  23675. }
  23676. Decimal.config(obj);
  23677. return Decimal;
  23678. }
  23679. /*
  23680. * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
  23681. * digits using rounding mode `rounding`.
  23682. *
  23683. * x {number|string|Decimal}
  23684. * y {number|string|Decimal}
  23685. *
  23686. */
  23687. function div(x, y) {
  23688. return new this(x).div(y);
  23689. }
  23690. /*
  23691. * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
  23692. * significant digits using rounding mode `rounding`.
  23693. *
  23694. * x {number|string|Decimal} The power to which to raise the base of the natural log.
  23695. *
  23696. */
  23697. function exp(x) {
  23698. return new this(x).exp();
  23699. }
  23700. /*
  23701. * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
  23702. *
  23703. * x {number|string|Decimal}
  23704. *
  23705. */
  23706. function floor(x) {
  23707. return finalise(x = new this(x), x.e + 1, 3);
  23708. }
  23709. /*
  23710. * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
  23711. * rounded to `precision` significant digits using rounding mode `rounding`.
  23712. *
  23713. * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
  23714. *
  23715. */
  23716. function hypot() {
  23717. var i,
  23718. n,
  23719. t = new this(0);
  23720. external = false;
  23721. for (i = 0; i < arguments.length;) {
  23722. n = new this(arguments[i++]);
  23723. if (!n.d) {
  23724. if (n.s) {
  23725. external = true;
  23726. return new this(1 / 0);
  23727. }
  23728. t = n;
  23729. } else if (t.d) {
  23730. t = t.plus(n.times(n));
  23731. }
  23732. }
  23733. external = true;
  23734. return t.sqrt();
  23735. }
  23736. /*
  23737. * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
  23738. * otherwise return false.
  23739. *
  23740. */
  23741. function isDecimalInstance(obj) {
  23742. return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;
  23743. }
  23744. /*
  23745. * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
  23746. * significant digits using rounding mode `rounding`.
  23747. *
  23748. * x {number|string|Decimal}
  23749. *
  23750. */
  23751. function ln(x) {
  23752. return new this(x).ln();
  23753. }
  23754. /*
  23755. * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
  23756. * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
  23757. *
  23758. * log[y](x)
  23759. *
  23760. * x {number|string|Decimal} The argument of the logarithm.
  23761. * y {number|string|Decimal} The base of the logarithm.
  23762. *
  23763. */
  23764. function log(x, y) {
  23765. return new this(x).log(y);
  23766. }
  23767. /*
  23768. * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
  23769. * significant digits using rounding mode `rounding`.
  23770. *
  23771. * x {number|string|Decimal}
  23772. *
  23773. */
  23774. function log2(x) {
  23775. return new this(x).log(2);
  23776. }
  23777. /*
  23778. * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
  23779. * significant digits using rounding mode `rounding`.
  23780. *
  23781. * x {number|string|Decimal}
  23782. *
  23783. */
  23784. function log10(x) {
  23785. return new this(x).log(10);
  23786. }
  23787. /*
  23788. * Return a new Decimal whose value is the maximum of the arguments.
  23789. *
  23790. * arguments {number|string|Decimal}
  23791. *
  23792. */
  23793. function max() {
  23794. return maxOrMin(this, arguments, 'lt');
  23795. }
  23796. /*
  23797. * Return a new Decimal whose value is the minimum of the arguments.
  23798. *
  23799. * arguments {number|string|Decimal}
  23800. *
  23801. */
  23802. function min() {
  23803. return maxOrMin(this, arguments, 'gt');
  23804. }
  23805. /*
  23806. * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
  23807. * using rounding mode `rounding`.
  23808. *
  23809. * x {number|string|Decimal}
  23810. * y {number|string|Decimal}
  23811. *
  23812. */
  23813. function mod(x, y) {
  23814. return new this(x).mod(y);
  23815. }
  23816. /*
  23817. * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
  23818. * digits using rounding mode `rounding`.
  23819. *
  23820. * x {number|string|Decimal}
  23821. * y {number|string|Decimal}
  23822. *
  23823. */
  23824. function mul(x, y) {
  23825. return new this(x).mul(y);
  23826. }
  23827. /*
  23828. * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
  23829. * significant digits using rounding mode `rounding`.
  23830. *
  23831. * x {number|string|Decimal} The base.
  23832. * y {number|string|Decimal} The exponent.
  23833. *
  23834. */
  23835. function pow(x, y) {
  23836. return new this(x).pow(y);
  23837. }
  23838. /*
  23839. * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
  23840. * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
  23841. * are produced).
  23842. *
  23843. * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
  23844. *
  23845. */
  23846. function random(sd) {
  23847. var d,
  23848. e,
  23849. k,
  23850. n,
  23851. i = 0,
  23852. r = new this(1),
  23853. rd = [];
  23854. if (sd === void 0) sd = this.precision;else checkInt32(sd, 1, MAX_DIGITS);
  23855. k = Math.ceil(sd / LOG_BASE);
  23856. if (!this.crypto) {
  23857. for (; i < k;) {
  23858. rd[i++] = Math.random() * 1e7 | 0;
  23859. } // Browsers supporting crypto.getRandomValues.
  23860. } else if (crypto.getRandomValues) {
  23861. d = crypto.getRandomValues(new Uint32Array(k));
  23862. for (; i < k;) {
  23863. n = d[i];
  23864. // 0 <= n < 4294967296
  23865. // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
  23866. if (n >= 4.29e9) {
  23867. d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
  23868. } else {
  23869. // 0 <= n <= 4289999999
  23870. // 0 <= (n % 1e7) <= 9999999
  23871. rd[i++] = n % 1e7;
  23872. }
  23873. }
  23874. // Node.js supporting crypto.randomBytes.
  23875. } else if (crypto.randomBytes) {
  23876. // buffer
  23877. d = crypto.randomBytes(k *= 4);
  23878. for (; i < k;) {
  23879. // 0 <= n < 2147483648
  23880. n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
  23881. // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
  23882. if (n >= 2.14e9) {
  23883. crypto.randomBytes(4).copy(d, i);
  23884. } else {
  23885. // 0 <= n <= 2139999999
  23886. // 0 <= (n % 1e7) <= 9999999
  23887. rd.push(n % 1e7);
  23888. i += 4;
  23889. }
  23890. }
  23891. i = k / 4;
  23892. } else {
  23893. throw Error(cryptoUnavailable);
  23894. }
  23895. k = rd[--i];
  23896. sd %= LOG_BASE;
  23897. // Convert trailing digits to zeros according to sd.
  23898. if (k && sd) {
  23899. n = mathpow(10, LOG_BASE - sd);
  23900. rd[i] = (k / n | 0) * n;
  23901. }
  23902. // Remove trailing words which are zero.
  23903. for (; rd[i] === 0; i--) {
  23904. rd.pop();
  23905. } // Zero?
  23906. if (i < 0) {
  23907. e = 0;
  23908. rd = [0];
  23909. } else {
  23910. e = -1;
  23911. // Remove leading words which are zero and adjust exponent accordingly.
  23912. for (; rd[0] === 0; e -= LOG_BASE) {
  23913. rd.shift();
  23914. } // Count the digits of the first word of rd to determine leading zeros.
  23915. for (k = 1, n = rd[0]; n >= 10; n /= 10) {
  23916. k++;
  23917. } // Adjust the exponent for leading zeros of the first word of rd.
  23918. if (k < LOG_BASE) e -= LOG_BASE - k;
  23919. }
  23920. r.e = e;
  23921. r.d = rd;
  23922. return r;
  23923. }
  23924. /*
  23925. * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
  23926. *
  23927. * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
  23928. *
  23929. * x {number|string|Decimal}
  23930. *
  23931. */
  23932. function round(x) {
  23933. return finalise(x = new this(x), x.e + 1, this.rounding);
  23934. }
  23935. /*
  23936. * Return
  23937. * 1 if x > 0,
  23938. * -1 if x < 0,
  23939. * 0 if x is 0,
  23940. * -0 if x is -0,
  23941. * NaN otherwise
  23942. *
  23943. */
  23944. function sign(x) {
  23945. x = new this(x);
  23946. return x.d ? x.d[0] ? x.s : 0 * x.s : x.s || NaN;
  23947. }
  23948. /*
  23949. * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
  23950. * using rounding mode `rounding`.
  23951. *
  23952. * x {number|string|Decimal} A value in radians.
  23953. *
  23954. */
  23955. function sin(x) {
  23956. return new this(x).sin();
  23957. }
  23958. /*
  23959. * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
  23960. * significant digits using rounding mode `rounding`.
  23961. *
  23962. * x {number|string|Decimal} A value in radians.
  23963. *
  23964. */
  23965. function sinh(x) {
  23966. return new this(x).sinh();
  23967. }
  23968. /*
  23969. * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
  23970. * digits using rounding mode `rounding`.
  23971. *
  23972. * x {number|string|Decimal}
  23973. *
  23974. */
  23975. function sqrt(x) {
  23976. return new this(x).sqrt();
  23977. }
  23978. /*
  23979. * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
  23980. * using rounding mode `rounding`.
  23981. *
  23982. * x {number|string|Decimal}
  23983. * y {number|string|Decimal}
  23984. *
  23985. */
  23986. function sub(x, y) {
  23987. return new this(x).sub(y);
  23988. }
  23989. /*
  23990. * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
  23991. * digits using rounding mode `rounding`.
  23992. *
  23993. * x {number|string|Decimal} A value in radians.
  23994. *
  23995. */
  23996. function tan(x) {
  23997. return new this(x).tan();
  23998. }
  23999. /*
  24000. * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
  24001. * significant digits using rounding mode `rounding`.
  24002. *
  24003. * x {number|string|Decimal} A value in radians.
  24004. *
  24005. */
  24006. function tanh(x) {
  24007. return new this(x).tanh();
  24008. }
  24009. /*
  24010. * Return a new Decimal whose value is `x` truncated to an integer.
  24011. *
  24012. * x {number|string|Decimal}
  24013. *
  24014. */
  24015. function trunc(x) {
  24016. return finalise(x = new this(x), x.e + 1, 1);
  24017. }
  24018. // Create and configure initial Decimal constructor.
  24019. Decimal = clone(DEFAULTS);
  24020. Decimal['default'] = Decimal.Decimal = Decimal;
  24021. // Create the internal constants from their string values.
  24022. LN10 = new Decimal(LN10);
  24023. PI = new Decimal(PI);
  24024. // Export.
  24025. // AMD.
  24026. if (true) {
  24027. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  24028. return Decimal;
  24029. }).call(exports, __webpack_require__, exports, module),
  24030. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  24031. // Node and other environments that support module.exports.
  24032. } else {}
  24033. })(undefined);
  24034. /***/ }),
  24035. /***/ "./node_modules/jquery/dist/jquery.js":
  24036. /*!********************************************!*\
  24037. !*** ./node_modules/jquery/dist/jquery.js ***!
  24038. \********************************************/
  24039. /*! no static exports found */
  24040. /***/ (function(module, exports, __webpack_require__) {
  24041. "use strict";
  24042. /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  24043. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  24044. /*!
  24045. * jQuery JavaScript Library v3.3.1
  24046. * https://jquery.com/
  24047. *
  24048. * Includes Sizzle.js
  24049. * https://sizzlejs.com/
  24050. *
  24051. * Copyright JS Foundation and other contributors
  24052. * Released under the MIT license
  24053. * https://jquery.org/license
  24054. *
  24055. * Date: 2018-01-20T17:24Z
  24056. */
  24057. (function (global, factory) {
  24058. "use strict";
  24059. if (( false ? undefined : _typeof(module)) === "object" && _typeof(module.exports) === "object") {
  24060. // For CommonJS and CommonJS-like environments where a proper `window`
  24061. // is present, execute the factory and get jQuery.
  24062. // For environments that do not have a `window` with a `document`
  24063. // (such as Node.js), expose a factory as module.exports.
  24064. // This accentuates the need for the creation of a real `window`.
  24065. // e.g. var jQuery = require("jquery")(window);
  24066. // See ticket #14549 for more info.
  24067. module.exports = global.document ? factory(global, true) : function (w) {
  24068. if (!w.document) {
  24069. throw new Error("jQuery requires a window with a document");
  24070. }
  24071. return factory(w);
  24072. };
  24073. } else {
  24074. factory(global);
  24075. }
  24076. // Pass this if window is not defined yet
  24077. })(typeof window !== "undefined" ? window : undefined, function (window, noGlobal) {
  24078. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  24079. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  24080. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  24081. // enough that all such attempts are guarded in a try block.
  24082. "use strict";
  24083. var arr = [];
  24084. var document = window.document;
  24085. var getProto = Object.getPrototypeOf;
  24086. var _slice = arr.slice;
  24087. var concat = arr.concat;
  24088. var push = arr.push;
  24089. var indexOf = arr.indexOf;
  24090. var class2type = {};
  24091. var toString = class2type.toString;
  24092. var hasOwn = class2type.hasOwnProperty;
  24093. var fnToString = hasOwn.toString;
  24094. var ObjectFunctionString = fnToString.call(Object);
  24095. var support = {};
  24096. var isFunction = function isFunction(obj) {
  24097. // Support: Chrome <=57, Firefox <=52
  24098. // In some browsers, typeof returns "function" for HTML <object> elements
  24099. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  24100. // We don't want to classify *any* DOM node as a function.
  24101. return typeof obj === "function" && typeof obj.nodeType !== "number";
  24102. };
  24103. var isWindow = function isWindow(obj) {
  24104. return obj != null && obj === obj.window;
  24105. };
  24106. var preservedScriptAttributes = {
  24107. type: true,
  24108. src: true,
  24109. noModule: true
  24110. };
  24111. function DOMEval(code, doc, node) {
  24112. doc = doc || document;
  24113. var i,
  24114. script = doc.createElement("script");
  24115. script.text = code;
  24116. if (node) {
  24117. for (i in preservedScriptAttributes) {
  24118. if (node[i]) {
  24119. script[i] = node[i];
  24120. }
  24121. }
  24122. }
  24123. doc.head.appendChild(script).parentNode.removeChild(script);
  24124. }
  24125. function toType(obj) {
  24126. if (obj == null) {
  24127. return obj + "";
  24128. }
  24129. // Support: Android <=2.3 only (functionish RegExp)
  24130. return (typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  24131. }
  24132. /* global Symbol */
  24133. // Defining this global in .eslintrc.json would create a danger of using the global
  24134. // unguarded in another place, it seems safer to define global only for this module
  24135. var version = "3.3.1",
  24136. // Define a local copy of jQuery
  24137. jQuery = function jQuery(selector, context) {
  24138. // The jQuery object is actually just the init constructor 'enhanced'
  24139. // Need init if jQuery is called (just allow error to be thrown if not included)
  24140. return new jQuery.fn.init(selector, context);
  24141. },
  24142. // Support: Android <=4.0 only
  24143. // Make sure we trim BOM and NBSP
  24144. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  24145. jQuery.fn = jQuery.prototype = {
  24146. // The current version of jQuery being used
  24147. jquery: version,
  24148. constructor: jQuery,
  24149. // The default length of a jQuery object is 0
  24150. length: 0,
  24151. toArray: function toArray() {
  24152. return _slice.call(this);
  24153. },
  24154. // Get the Nth element in the matched element set OR
  24155. // Get the whole matched element set as a clean array
  24156. get: function get(num) {
  24157. // Return all the elements in a clean array
  24158. if (num == null) {
  24159. return _slice.call(this);
  24160. }
  24161. // Return just the one element from the set
  24162. return num < 0 ? this[num + this.length] : this[num];
  24163. },
  24164. // Take an array of elements and push it onto the stack
  24165. // (returning the new matched element set)
  24166. pushStack: function pushStack(elems) {
  24167. // Build a new jQuery matched element set
  24168. var ret = jQuery.merge(this.constructor(), elems);
  24169. // Add the old object onto the stack (as a reference)
  24170. ret.prevObject = this;
  24171. // Return the newly-formed element set
  24172. return ret;
  24173. },
  24174. // Execute a callback for every element in the matched set.
  24175. each: function each(callback) {
  24176. return jQuery.each(this, callback);
  24177. },
  24178. map: function map(callback) {
  24179. return this.pushStack(jQuery.map(this, function (elem, i) {
  24180. return callback.call(elem, i, elem);
  24181. }));
  24182. },
  24183. slice: function slice() {
  24184. return this.pushStack(_slice.apply(this, arguments));
  24185. },
  24186. first: function first() {
  24187. return this.eq(0);
  24188. },
  24189. last: function last() {
  24190. return this.eq(-1);
  24191. },
  24192. eq: function eq(i) {
  24193. var len = this.length,
  24194. j = +i + (i < 0 ? len : 0);
  24195. return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
  24196. },
  24197. end: function end() {
  24198. return this.prevObject || this.constructor();
  24199. },
  24200. // For internal use only.
  24201. // Behaves like an Array's method, not like a jQuery method.
  24202. push: push,
  24203. sort: arr.sort,
  24204. splice: arr.splice
  24205. };
  24206. jQuery.extend = jQuery.fn.extend = function () {
  24207. var options,
  24208. name,
  24209. src,
  24210. copy,
  24211. copyIsArray,
  24212. clone,
  24213. target = arguments[0] || {},
  24214. i = 1,
  24215. length = arguments.length,
  24216. deep = false;
  24217. // Handle a deep copy situation
  24218. if (typeof target === "boolean") {
  24219. deep = target;
  24220. // Skip the boolean and the target
  24221. target = arguments[i] || {};
  24222. i++;
  24223. }
  24224. // Handle case when target is a string or something (possible in deep copy)
  24225. if ((typeof target === "undefined" ? "undefined" : _typeof(target)) !== "object" && !isFunction(target)) {
  24226. target = {};
  24227. }
  24228. // Extend jQuery itself if only one argument is passed
  24229. if (i === length) {
  24230. target = this;
  24231. i--;
  24232. }
  24233. for (; i < length; i++) {
  24234. // Only deal with non-null/undefined values
  24235. if ((options = arguments[i]) != null) {
  24236. // Extend the base object
  24237. for (name in options) {
  24238. src = target[name];
  24239. copy = options[name];
  24240. // Prevent never-ending loop
  24241. if (target === copy) {
  24242. continue;
  24243. }
  24244. // Recurse if we're merging plain objects or arrays
  24245. if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
  24246. if (copyIsArray) {
  24247. copyIsArray = false;
  24248. clone = src && Array.isArray(src) ? src : [];
  24249. } else {
  24250. clone = src && jQuery.isPlainObject(src) ? src : {};
  24251. }
  24252. // Never move original objects, clone them
  24253. target[name] = jQuery.extend(deep, clone, copy);
  24254. // Don't bring in undefined values
  24255. } else if (copy !== undefined) {
  24256. target[name] = copy;
  24257. }
  24258. }
  24259. }
  24260. }
  24261. // Return the modified object
  24262. return target;
  24263. };
  24264. jQuery.extend({
  24265. // Unique for each copy of jQuery on the page
  24266. expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
  24267. // Assume jQuery is ready without the ready module
  24268. isReady: true,
  24269. error: function error(msg) {
  24270. throw new Error(msg);
  24271. },
  24272. noop: function noop() {},
  24273. isPlainObject: function isPlainObject(obj) {
  24274. var proto, Ctor;
  24275. // Detect obvious negatives
  24276. // Use toString instead of jQuery.type to catch host objects
  24277. if (!obj || toString.call(obj) !== "[object Object]") {
  24278. return false;
  24279. }
  24280. proto = getProto(obj);
  24281. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  24282. if (!proto) {
  24283. return true;
  24284. }
  24285. // Objects with prototype are plain iff they were constructed by a global Object function
  24286. Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
  24287. return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
  24288. },
  24289. isEmptyObject: function isEmptyObject(obj) {
  24290. /* eslint-disable no-unused-vars */
  24291. // See https://github.com/eslint/eslint/issues/6125
  24292. var name;
  24293. for (name in obj) {
  24294. return false;
  24295. }
  24296. return true;
  24297. },
  24298. // Evaluates a script in a global context
  24299. globalEval: function globalEval(code) {
  24300. DOMEval(code);
  24301. },
  24302. each: function each(obj, callback) {
  24303. var length,
  24304. i = 0;
  24305. if (isArrayLike(obj)) {
  24306. length = obj.length;
  24307. for (; i < length; i++) {
  24308. if (callback.call(obj[i], i, obj[i]) === false) {
  24309. break;
  24310. }
  24311. }
  24312. } else {
  24313. for (i in obj) {
  24314. if (callback.call(obj[i], i, obj[i]) === false) {
  24315. break;
  24316. }
  24317. }
  24318. }
  24319. return obj;
  24320. },
  24321. // Support: Android <=4.0 only
  24322. trim: function trim(text) {
  24323. return text == null ? "" : (text + "").replace(rtrim, "");
  24324. },
  24325. // results is for internal usage only
  24326. makeArray: function makeArray(arr, results) {
  24327. var ret = results || [];
  24328. if (arr != null) {
  24329. if (isArrayLike(Object(arr))) {
  24330. jQuery.merge(ret, typeof arr === "string" ? [arr] : arr);
  24331. } else {
  24332. push.call(ret, arr);
  24333. }
  24334. }
  24335. return ret;
  24336. },
  24337. inArray: function inArray(elem, arr, i) {
  24338. return arr == null ? -1 : indexOf.call(arr, elem, i);
  24339. },
  24340. // Support: Android <=4.0 only, PhantomJS 1 only
  24341. // push.apply(_, arraylike) throws on ancient WebKit
  24342. merge: function merge(first, second) {
  24343. var len = +second.length,
  24344. j = 0,
  24345. i = first.length;
  24346. for (; j < len; j++) {
  24347. first[i++] = second[j];
  24348. }
  24349. first.length = i;
  24350. return first;
  24351. },
  24352. grep: function grep(elems, callback, invert) {
  24353. var callbackInverse,
  24354. matches = [],
  24355. i = 0,
  24356. length = elems.length,
  24357. callbackExpect = !invert;
  24358. // Go through the array, only saving the items
  24359. // that pass the validator function
  24360. for (; i < length; i++) {
  24361. callbackInverse = !callback(elems[i], i);
  24362. if (callbackInverse !== callbackExpect) {
  24363. matches.push(elems[i]);
  24364. }
  24365. }
  24366. return matches;
  24367. },
  24368. // arg is for internal usage only
  24369. map: function map(elems, callback, arg) {
  24370. var length,
  24371. value,
  24372. i = 0,
  24373. ret = [];
  24374. // Go through the array, translating each of the items to their new values
  24375. if (isArrayLike(elems)) {
  24376. length = elems.length;
  24377. for (; i < length; i++) {
  24378. value = callback(elems[i], i, arg);
  24379. if (value != null) {
  24380. ret.push(value);
  24381. }
  24382. }
  24383. // Go through every key on the object,
  24384. } else {
  24385. for (i in elems) {
  24386. value = callback(elems[i], i, arg);
  24387. if (value != null) {
  24388. ret.push(value);
  24389. }
  24390. }
  24391. }
  24392. // Flatten any nested arrays
  24393. return concat.apply([], ret);
  24394. },
  24395. // A global GUID counter for objects
  24396. guid: 1,
  24397. // jQuery.support is not used in Core but other projects attach their
  24398. // properties to it so it needs to exist.
  24399. support: support
  24400. });
  24401. if (typeof Symbol === "function") {
  24402. jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
  24403. }
  24404. // Populate the class2type map
  24405. jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (i, name) {
  24406. class2type["[object " + name + "]"] = name.toLowerCase();
  24407. });
  24408. function isArrayLike(obj) {
  24409. // Support: real iOS 8.2 only (not reproducible in simulator)
  24410. // `in` check used to prevent JIT error (gh-2145)
  24411. // hasOwn isn't used here due to false negatives
  24412. // regarding Nodelist length in IE
  24413. var length = !!obj && "length" in obj && obj.length,
  24414. type = toType(obj);
  24415. if (isFunction(obj) || isWindow(obj)) {
  24416. return false;
  24417. }
  24418. return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
  24419. }
  24420. var Sizzle =
  24421. /*!
  24422. * Sizzle CSS Selector Engine v2.3.3
  24423. * https://sizzlejs.com/
  24424. *
  24425. * Copyright jQuery Foundation and other contributors
  24426. * Released under the MIT license
  24427. * http://jquery.org/license
  24428. *
  24429. * Date: 2016-08-08
  24430. */
  24431. function (window) {
  24432. var i,
  24433. support,
  24434. Expr,
  24435. getText,
  24436. isXML,
  24437. tokenize,
  24438. compile,
  24439. select,
  24440. outermostContext,
  24441. sortInput,
  24442. hasDuplicate,
  24443. // Local document vars
  24444. setDocument,
  24445. document,
  24446. docElem,
  24447. documentIsHTML,
  24448. rbuggyQSA,
  24449. rbuggyMatches,
  24450. matches,
  24451. contains,
  24452. // Instance-specific data
  24453. expando = "sizzle" + 1 * new Date(),
  24454. preferredDoc = window.document,
  24455. dirruns = 0,
  24456. done = 0,
  24457. classCache = createCache(),
  24458. tokenCache = createCache(),
  24459. compilerCache = createCache(),
  24460. sortOrder = function sortOrder(a, b) {
  24461. if (a === b) {
  24462. hasDuplicate = true;
  24463. }
  24464. return 0;
  24465. },
  24466. // Instance methods
  24467. hasOwn = {}.hasOwnProperty,
  24468. arr = [],
  24469. pop = arr.pop,
  24470. push_native = arr.push,
  24471. push = arr.push,
  24472. slice = arr.slice,
  24473. // Use a stripped-down indexOf as it's faster than native
  24474. // https://jsperf.com/thor-indexof-vs-for/5
  24475. indexOf = function indexOf(list, elem) {
  24476. var i = 0,
  24477. len = list.length;
  24478. for (; i < len; i++) {
  24479. if (list[i] === elem) {
  24480. return i;
  24481. }
  24482. }
  24483. return -1;
  24484. },
  24485. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  24486. // Regular expressions
  24487. // http://www.w3.org/TR/css3-selectors/#whitespace
  24488. whitespace = "[\\x20\\t\\r\\n\\f]",
  24489. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  24490. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  24491. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  24492. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  24493. // Operator (capture 2)
  24494. "*([*^$|!~]?=)" + whitespace +
  24495. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  24496. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
  24497. pseudos = ":(" + identifier + ")(?:\\((" +
  24498. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  24499. // 1. quoted (capture 3; capture 4 or capture 5)
  24500. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  24501. // 2. simple (capture 6)
  24502. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  24503. // 3. anything else (capture 2)
  24504. ".*" + ")\\)|)",
  24505. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  24506. rwhitespace = new RegExp(whitespace + "+", "g"),
  24507. rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
  24508. rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
  24509. rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
  24510. rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
  24511. rpseudo = new RegExp(pseudos),
  24512. ridentifier = new RegExp("^" + identifier + "$"),
  24513. matchExpr = {
  24514. "ID": new RegExp("^#(" + identifier + ")"),
  24515. "CLASS": new RegExp("^\\.(" + identifier + ")"),
  24516. "TAG": new RegExp("^(" + identifier + "|[*])"),
  24517. "ATTR": new RegExp("^" + attributes),
  24518. "PSEUDO": new RegExp("^" + pseudos),
  24519. "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
  24520. "bool": new RegExp("^(?:" + booleans + ")$", "i"),
  24521. // For use in libraries implementing .is()
  24522. // We use this for POS matching in `select`
  24523. "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
  24524. },
  24525. rinputs = /^(?:input|select|textarea|button)$/i,
  24526. rheader = /^h\d$/i,
  24527. rnative = /^[^{]+\{\s*\[native \w/,
  24528. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  24529. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  24530. rsibling = /[+~]/,
  24531. // CSS escapes
  24532. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  24533. runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
  24534. funescape = function funescape(_, escaped, escapedWhitespace) {
  24535. var high = "0x" + escaped - 0x10000;
  24536. // NaN means non-codepoint
  24537. // Support: Firefox<24
  24538. // Workaround erroneous numeric interpretation of +"0x"
  24539. return high !== high || escapedWhitespace ? escaped : high < 0 ?
  24540. // BMP codepoint
  24541. String.fromCharCode(high + 0x10000) :
  24542. // Supplemental Plane codepoint (surrogate pair)
  24543. String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
  24544. },
  24545. // CSS string/identifier serialization
  24546. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  24547. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  24548. fcssescape = function fcssescape(ch, asCodePoint) {
  24549. if (asCodePoint) {
  24550. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  24551. if (ch === "\0") {
  24552. return "\uFFFD";
  24553. }
  24554. // Control characters and (dependent upon position) numbers get escaped as code points
  24555. return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
  24556. }
  24557. // Other potentially-special ASCII characters get backslash-escaped
  24558. return "\\" + ch;
  24559. },
  24560. // Used for iframes
  24561. // See setDocument()
  24562. // Removing the function wrapper causes a "Permission Denied"
  24563. // error in IE
  24564. unloadHandler = function unloadHandler() {
  24565. setDocument();
  24566. },
  24567. disabledAncestor = addCombinator(function (elem) {
  24568. return elem.disabled === true && ("form" in elem || "label" in elem);
  24569. }, { dir: "parentNode", next: "legend" });
  24570. // Optimize for push.apply( _, NodeList )
  24571. try {
  24572. push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);
  24573. // Support: Android<4.0
  24574. // Detect silently failing push.apply
  24575. arr[preferredDoc.childNodes.length].nodeType;
  24576. } catch (e) {
  24577. push = { apply: arr.length ?
  24578. // Leverage slice if possible
  24579. function (target, els) {
  24580. push_native.apply(target, slice.call(els));
  24581. } :
  24582. // Support: IE<9
  24583. // Otherwise append directly
  24584. function (target, els) {
  24585. var j = target.length,
  24586. i = 0;
  24587. // Can't trust NodeList.length
  24588. while (target[j++] = els[i++]) {}
  24589. target.length = j - 1;
  24590. }
  24591. };
  24592. }
  24593. function Sizzle(selector, context, results, seed) {
  24594. var m,
  24595. i,
  24596. elem,
  24597. nid,
  24598. match,
  24599. groups,
  24600. newSelector,
  24601. newContext = context && context.ownerDocument,
  24602. // nodeType defaults to 9, since context defaults to document
  24603. nodeType = context ? context.nodeType : 9;
  24604. results = results || [];
  24605. // Return early from calls with invalid selector or context
  24606. if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  24607. return results;
  24608. }
  24609. // Try to shortcut find operations (as opposed to filters) in HTML documents
  24610. if (!seed) {
  24611. if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
  24612. setDocument(context);
  24613. }
  24614. context = context || document;
  24615. if (documentIsHTML) {
  24616. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  24617. // (excepting DocumentFragment context, where the methods don't exist)
  24618. if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
  24619. // ID selector
  24620. if (m = match[1]) {
  24621. // Document context
  24622. if (nodeType === 9) {
  24623. if (elem = context.getElementById(m)) {
  24624. // Support: IE, Opera, Webkit
  24625. // TODO: identify versions
  24626. // getElementById can match elements by name instead of ID
  24627. if (elem.id === m) {
  24628. results.push(elem);
  24629. return results;
  24630. }
  24631. } else {
  24632. return results;
  24633. }
  24634. // Element context
  24635. } else {
  24636. // Support: IE, Opera, Webkit
  24637. // TODO: identify versions
  24638. // getElementById can match elements by name instead of ID
  24639. if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) {
  24640. results.push(elem);
  24641. return results;
  24642. }
  24643. }
  24644. // Type selector
  24645. } else if (match[2]) {
  24646. push.apply(results, context.getElementsByTagName(selector));
  24647. return results;
  24648. // Class selector
  24649. } else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) {
  24650. push.apply(results, context.getElementsByClassName(m));
  24651. return results;
  24652. }
  24653. }
  24654. // Take advantage of querySelectorAll
  24655. if (support.qsa && !compilerCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  24656. if (nodeType !== 1) {
  24657. newContext = context;
  24658. newSelector = selector;
  24659. // qSA looks outside Element context, which is not what we want
  24660. // Thanks to Andrew Dupont for this workaround technique
  24661. // Support: IE <=8
  24662. // Exclude object elements
  24663. } else if (context.nodeName.toLowerCase() !== "object") {
  24664. // Capture the context ID, setting it first if necessary
  24665. if (nid = context.getAttribute("id")) {
  24666. nid = nid.replace(rcssescape, fcssescape);
  24667. } else {
  24668. context.setAttribute("id", nid = expando);
  24669. }
  24670. // Prefix every selector in the list
  24671. groups = tokenize(selector);
  24672. i = groups.length;
  24673. while (i--) {
  24674. groups[i] = "#" + nid + " " + toSelector(groups[i]);
  24675. }
  24676. newSelector = groups.join(",");
  24677. // Expand context for sibling selectors
  24678. newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
  24679. }
  24680. if (newSelector) {
  24681. try {
  24682. push.apply(results, newContext.querySelectorAll(newSelector));
  24683. return results;
  24684. } catch (qsaError) {} finally {
  24685. if (nid === expando) {
  24686. context.removeAttribute("id");
  24687. }
  24688. }
  24689. }
  24690. }
  24691. }
  24692. }
  24693. // All others
  24694. return select(selector.replace(rtrim, "$1"), context, results, seed);
  24695. }
  24696. /**
  24697. * Create key-value caches of limited size
  24698. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  24699. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  24700. * deleting the oldest entry
  24701. */
  24702. function createCache() {
  24703. var keys = [];
  24704. function cache(key, value) {
  24705. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  24706. if (keys.push(key + " ") > Expr.cacheLength) {
  24707. // Only keep the most recent entries
  24708. delete cache[keys.shift()];
  24709. }
  24710. return cache[key + " "] = value;
  24711. }
  24712. return cache;
  24713. }
  24714. /**
  24715. * Mark a function for special use by Sizzle
  24716. * @param {Function} fn The function to mark
  24717. */
  24718. function markFunction(fn) {
  24719. fn[expando] = true;
  24720. return fn;
  24721. }
  24722. /**
  24723. * Support testing using an element
  24724. * @param {Function} fn Passed the created element and returns a boolean result
  24725. */
  24726. function assert(fn) {
  24727. var el = document.createElement("fieldset");
  24728. try {
  24729. return !!fn(el);
  24730. } catch (e) {
  24731. return false;
  24732. } finally {
  24733. // Remove from its parent by default
  24734. if (el.parentNode) {
  24735. el.parentNode.removeChild(el);
  24736. }
  24737. // release memory in IE
  24738. el = null;
  24739. }
  24740. }
  24741. /**
  24742. * Adds the same handler for all of the specified attrs
  24743. * @param {String} attrs Pipe-separated list of attributes
  24744. * @param {Function} handler The method that will be applied
  24745. */
  24746. function addHandle(attrs, handler) {
  24747. var arr = attrs.split("|"),
  24748. i = arr.length;
  24749. while (i--) {
  24750. Expr.attrHandle[arr[i]] = handler;
  24751. }
  24752. }
  24753. /**
  24754. * Checks document order of two siblings
  24755. * @param {Element} a
  24756. * @param {Element} b
  24757. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  24758. */
  24759. function siblingCheck(a, b) {
  24760. var cur = b && a,
  24761. diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex;
  24762. // Use IE sourceIndex if available on both nodes
  24763. if (diff) {
  24764. return diff;
  24765. }
  24766. // Check if b follows a
  24767. if (cur) {
  24768. while (cur = cur.nextSibling) {
  24769. if (cur === b) {
  24770. return -1;
  24771. }
  24772. }
  24773. }
  24774. return a ? 1 : -1;
  24775. }
  24776. /**
  24777. * Returns a function to use in pseudos for input types
  24778. * @param {String} type
  24779. */
  24780. function createInputPseudo(type) {
  24781. return function (elem) {
  24782. var name = elem.nodeName.toLowerCase();
  24783. return name === "input" && elem.type === type;
  24784. };
  24785. }
  24786. /**
  24787. * Returns a function to use in pseudos for buttons
  24788. * @param {String} type
  24789. */
  24790. function createButtonPseudo(type) {
  24791. return function (elem) {
  24792. var name = elem.nodeName.toLowerCase();
  24793. return (name === "input" || name === "button") && elem.type === type;
  24794. };
  24795. }
  24796. /**
  24797. * Returns a function to use in pseudos for :enabled/:disabled
  24798. * @param {Boolean} disabled true for :disabled; false for :enabled
  24799. */
  24800. function createDisabledPseudo(disabled) {
  24801. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  24802. return function (elem) {
  24803. // Only certain elements can match :enabled or :disabled
  24804. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  24805. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  24806. if ("form" in elem) {
  24807. // Check for inherited disabledness on relevant non-disabled elements:
  24808. // * listed form-associated elements in a disabled fieldset
  24809. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  24810. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  24811. // * option elements in a disabled optgroup
  24812. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  24813. // All such elements have a "form" property.
  24814. if (elem.parentNode && elem.disabled === false) {
  24815. // Option elements defer to a parent optgroup if present
  24816. if ("label" in elem) {
  24817. if ("label" in elem.parentNode) {
  24818. return elem.parentNode.disabled === disabled;
  24819. } else {
  24820. return elem.disabled === disabled;
  24821. }
  24822. }
  24823. // Support: IE 6 - 11
  24824. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  24825. return elem.isDisabled === disabled ||
  24826. // Where there is no isDisabled, check manually
  24827. /* jshint -W018 */
  24828. elem.isDisabled !== !disabled && disabledAncestor(elem) === disabled;
  24829. }
  24830. return elem.disabled === disabled;
  24831. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  24832. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  24833. // even exist on them, let alone have a boolean value.
  24834. } else if ("label" in elem) {
  24835. return elem.disabled === disabled;
  24836. }
  24837. // Remaining elements are neither :enabled nor :disabled
  24838. return false;
  24839. };
  24840. }
  24841. /**
  24842. * Returns a function to use in pseudos for positionals
  24843. * @param {Function} fn
  24844. */
  24845. function createPositionalPseudo(fn) {
  24846. return markFunction(function (argument) {
  24847. argument = +argument;
  24848. return markFunction(function (seed, matches) {
  24849. var j,
  24850. matchIndexes = fn([], seed.length, argument),
  24851. i = matchIndexes.length;
  24852. // Match elements found at the specified indexes
  24853. while (i--) {
  24854. if (seed[j = matchIndexes[i]]) {
  24855. seed[j] = !(matches[j] = seed[j]);
  24856. }
  24857. }
  24858. });
  24859. });
  24860. }
  24861. /**
  24862. * Checks a node for validity as a Sizzle context
  24863. * @param {Element|Object=} context
  24864. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  24865. */
  24866. function testContext(context) {
  24867. return context && typeof context.getElementsByTagName !== "undefined" && context;
  24868. }
  24869. // Expose support vars for convenience
  24870. support = Sizzle.support = {};
  24871. /**
  24872. * Detects XML nodes
  24873. * @param {Element|Object} elem An element or a document
  24874. * @returns {Boolean} True iff elem is a non-HTML XML node
  24875. */
  24876. isXML = Sizzle.isXML = function (elem) {
  24877. // documentElement is verified for cases where it doesn't yet exist
  24878. // (such as loading iframes in IE - #4833)
  24879. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  24880. return documentElement ? documentElement.nodeName !== "HTML" : false;
  24881. };
  24882. /**
  24883. * Sets document-related variables once based on the current document
  24884. * @param {Element|Object} [doc] An element or document object to use to set the document
  24885. * @returns {Object} Returns the current document
  24886. */
  24887. setDocument = Sizzle.setDocument = function (node) {
  24888. var hasCompare,
  24889. subWindow,
  24890. doc = node ? node.ownerDocument || node : preferredDoc;
  24891. // Return early if doc is invalid or already selected
  24892. if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
  24893. return document;
  24894. }
  24895. // Update global variables
  24896. document = doc;
  24897. docElem = document.documentElement;
  24898. documentIsHTML = !isXML(document);
  24899. // Support: IE 9-11, Edge
  24900. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  24901. if (preferredDoc !== document && (subWindow = document.defaultView) && subWindow.top !== subWindow) {
  24902. // Support: IE 11, Edge
  24903. if (subWindow.addEventListener) {
  24904. subWindow.addEventListener("unload", unloadHandler, false);
  24905. // Support: IE 9 - 10 only
  24906. } else if (subWindow.attachEvent) {
  24907. subWindow.attachEvent("onunload", unloadHandler);
  24908. }
  24909. }
  24910. /* Attributes
  24911. ---------------------------------------------------------------------- */
  24912. // Support: IE<8
  24913. // Verify that getAttribute really returns attributes and not properties
  24914. // (excepting IE8 booleans)
  24915. support.attributes = assert(function (el) {
  24916. el.className = "i";
  24917. return !el.getAttribute("className");
  24918. });
  24919. /* getElement(s)By*
  24920. ---------------------------------------------------------------------- */
  24921. // Check if getElementsByTagName("*") returns only elements
  24922. support.getElementsByTagName = assert(function (el) {
  24923. el.appendChild(document.createComment(""));
  24924. return !el.getElementsByTagName("*").length;
  24925. });
  24926. // Support: IE<9
  24927. support.getElementsByClassName = rnative.test(document.getElementsByClassName);
  24928. // Support: IE<10
  24929. // Check if getElementById returns elements by name
  24930. // The broken getElementById methods don't pick up programmatically-set names,
  24931. // so use a roundabout getElementsByName test
  24932. support.getById = assert(function (el) {
  24933. docElem.appendChild(el).id = expando;
  24934. return !document.getElementsByName || !document.getElementsByName(expando).length;
  24935. });
  24936. // ID filter and find
  24937. if (support.getById) {
  24938. Expr.filter["ID"] = function (id) {
  24939. var attrId = id.replace(runescape, funescape);
  24940. return function (elem) {
  24941. return elem.getAttribute("id") === attrId;
  24942. };
  24943. };
  24944. Expr.find["ID"] = function (id, context) {
  24945. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  24946. var elem = context.getElementById(id);
  24947. return elem ? [elem] : [];
  24948. }
  24949. };
  24950. } else {
  24951. Expr.filter["ID"] = function (id) {
  24952. var attrId = id.replace(runescape, funescape);
  24953. return function (elem) {
  24954. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  24955. return node && node.value === attrId;
  24956. };
  24957. };
  24958. // Support: IE 6 - 7 only
  24959. // getElementById is not reliable as a find shortcut
  24960. Expr.find["ID"] = function (id, context) {
  24961. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  24962. var node,
  24963. i,
  24964. elems,
  24965. elem = context.getElementById(id);
  24966. if (elem) {
  24967. // Verify the id attribute
  24968. node = elem.getAttributeNode("id");
  24969. if (node && node.value === id) {
  24970. return [elem];
  24971. }
  24972. // Fall back on getElementsByName
  24973. elems = context.getElementsByName(id);
  24974. i = 0;
  24975. while (elem = elems[i++]) {
  24976. node = elem.getAttributeNode("id");
  24977. if (node && node.value === id) {
  24978. return [elem];
  24979. }
  24980. }
  24981. }
  24982. return [];
  24983. }
  24984. };
  24985. }
  24986. // Tag
  24987. Expr.find["TAG"] = support.getElementsByTagName ? function (tag, context) {
  24988. if (typeof context.getElementsByTagName !== "undefined") {
  24989. return context.getElementsByTagName(tag);
  24990. // DocumentFragment nodes don't have gEBTN
  24991. } else if (support.qsa) {
  24992. return context.querySelectorAll(tag);
  24993. }
  24994. } : function (tag, context) {
  24995. var elem,
  24996. tmp = [],
  24997. i = 0,
  24998. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  24999. results = context.getElementsByTagName(tag);
  25000. // Filter out possible comments
  25001. if (tag === "*") {
  25002. while (elem = results[i++]) {
  25003. if (elem.nodeType === 1) {
  25004. tmp.push(elem);
  25005. }
  25006. }
  25007. return tmp;
  25008. }
  25009. return results;
  25010. };
  25011. // Class
  25012. Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) {
  25013. if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
  25014. return context.getElementsByClassName(className);
  25015. }
  25016. };
  25017. /* QSA/matchesSelector
  25018. ---------------------------------------------------------------------- */
  25019. // QSA and matchesSelector support
  25020. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  25021. rbuggyMatches = [];
  25022. // qSa(:focus) reports false when true (Chrome 21)
  25023. // We allow this because of a bug in IE8/9 that throws an error
  25024. // whenever `document.activeElement` is accessed on an iframe
  25025. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  25026. // See https://bugs.jquery.com/ticket/13378
  25027. rbuggyQSA = [];
  25028. if (support.qsa = rnative.test(document.querySelectorAll)) {
  25029. // Build QSA regex
  25030. // Regex strategy adopted from Diego Perini
  25031. assert(function (el) {
  25032. // Select is set to empty string on purpose
  25033. // This is to test IE's treatment of not explicitly
  25034. // setting a boolean content attribute,
  25035. // since its presence should be enough
  25036. // https://bugs.jquery.com/ticket/12359
  25037. docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\r\\' msallowcapture=''>" + "<option selected=''></option></select>";
  25038. // Support: IE8, Opera 11-12.16
  25039. // Nothing should be selected when empty strings follow ^= or $= or *=
  25040. // The test attribute must be unknown in Opera but "safe" for WinRT
  25041. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  25042. if (el.querySelectorAll("[msallowcapture^='']").length) {
  25043. rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
  25044. }
  25045. // Support: IE8
  25046. // Boolean attributes and "value" are not treated correctly
  25047. if (!el.querySelectorAll("[selected]").length) {
  25048. rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
  25049. }
  25050. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  25051. if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
  25052. rbuggyQSA.push("~=");
  25053. }
  25054. // Webkit/Opera - :checked should return selected option elements
  25055. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  25056. // IE8 throws error here and will not see later tests
  25057. if (!el.querySelectorAll(":checked").length) {
  25058. rbuggyQSA.push(":checked");
  25059. }
  25060. // Support: Safari 8+, iOS 8+
  25061. // https://bugs.webkit.org/show_bug.cgi?id=136851
  25062. // In-page `selector#id sibling-combinator selector` fails
  25063. if (!el.querySelectorAll("a#" + expando + "+*").length) {
  25064. rbuggyQSA.push(".#.+[+~]");
  25065. }
  25066. });
  25067. assert(function (el) {
  25068. el.innerHTML = "<a href='' disabled='disabled'></a>" + "<select disabled='disabled'><option/></select>";
  25069. // Support: Windows 8 Native Apps
  25070. // The type and name attributes are restricted during .innerHTML assignment
  25071. var input = document.createElement("input");
  25072. input.setAttribute("type", "hidden");
  25073. el.appendChild(input).setAttribute("name", "D");
  25074. // Support: IE8
  25075. // Enforce case-sensitivity of name attribute
  25076. if (el.querySelectorAll("[name=d]").length) {
  25077. rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
  25078. }
  25079. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  25080. // IE8 throws error here and will not see later tests
  25081. if (el.querySelectorAll(":enabled").length !== 2) {
  25082. rbuggyQSA.push(":enabled", ":disabled");
  25083. }
  25084. // Support: IE9-11+
  25085. // IE's :disabled selector does not pick up the children of disabled fieldsets
  25086. docElem.appendChild(el).disabled = true;
  25087. if (el.querySelectorAll(":disabled").length !== 2) {
  25088. rbuggyQSA.push(":enabled", ":disabled");
  25089. }
  25090. // Opera 10-11 does not throw on post-comma invalid pseudos
  25091. el.querySelectorAll("*,:x");
  25092. rbuggyQSA.push(",.*:");
  25093. });
  25094. }
  25095. if (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) {
  25096. assert(function (el) {
  25097. // Check to see if it's possible to do matchesSelector
  25098. // on a disconnected node (IE 9)
  25099. support.disconnectedMatch = matches.call(el, "*");
  25100. // This should fail with an exception
  25101. // Gecko does not error, returns false instead
  25102. matches.call(el, "[s!='']:x");
  25103. rbuggyMatches.push("!=", pseudos);
  25104. });
  25105. }
  25106. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
  25107. rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
  25108. /* Contains
  25109. ---------------------------------------------------------------------- */
  25110. hasCompare = rnative.test(docElem.compareDocumentPosition);
  25111. // Element contains another
  25112. // Purposefully self-exclusive
  25113. // As in, an element does not contain itself
  25114. contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) {
  25115. var adown = a.nodeType === 9 ? a.documentElement : a,
  25116. bup = b && b.parentNode;
  25117. return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
  25118. } : function (a, b) {
  25119. if (b) {
  25120. while (b = b.parentNode) {
  25121. if (b === a) {
  25122. return true;
  25123. }
  25124. }
  25125. }
  25126. return false;
  25127. };
  25128. /* Sorting
  25129. ---------------------------------------------------------------------- */
  25130. // Document order sorting
  25131. sortOrder = hasCompare ? function (a, b) {
  25132. // Flag for duplicate removal
  25133. if (a === b) {
  25134. hasDuplicate = true;
  25135. return 0;
  25136. }
  25137. // Sort on method existence if only one input has compareDocumentPosition
  25138. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  25139. if (compare) {
  25140. return compare;
  25141. }
  25142. // Calculate position if both inputs belong to the same document
  25143. compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) :
  25144. // Otherwise we know they are disconnected
  25145. 1;
  25146. // Disconnected nodes
  25147. if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
  25148. // Choose the first element that is related to our preferred document
  25149. if (a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
  25150. return -1;
  25151. }
  25152. if (b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
  25153. return 1;
  25154. }
  25155. // Maintain original order
  25156. return sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  25157. }
  25158. return compare & 4 ? -1 : 1;
  25159. } : function (a, b) {
  25160. // Exit early if the nodes are identical
  25161. if (a === b) {
  25162. hasDuplicate = true;
  25163. return 0;
  25164. }
  25165. var cur,
  25166. i = 0,
  25167. aup = a.parentNode,
  25168. bup = b.parentNode,
  25169. ap = [a],
  25170. bp = [b];
  25171. // Parentless nodes are either documents or disconnected
  25172. if (!aup || !bup) {
  25173. return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  25174. // If the nodes are siblings, we can do a quick check
  25175. } else if (aup === bup) {
  25176. return siblingCheck(a, b);
  25177. }
  25178. // Otherwise we need full lists of their ancestors for comparison
  25179. cur = a;
  25180. while (cur = cur.parentNode) {
  25181. ap.unshift(cur);
  25182. }
  25183. cur = b;
  25184. while (cur = cur.parentNode) {
  25185. bp.unshift(cur);
  25186. }
  25187. // Walk down the tree looking for a discrepancy
  25188. while (ap[i] === bp[i]) {
  25189. i++;
  25190. }
  25191. return i ?
  25192. // Do a sibling check if the nodes have a common ancestor
  25193. siblingCheck(ap[i], bp[i]) :
  25194. // Otherwise nodes in our document sort first
  25195. ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;
  25196. };
  25197. return document;
  25198. };
  25199. Sizzle.matches = function (expr, elements) {
  25200. return Sizzle(expr, null, null, elements);
  25201. };
  25202. Sizzle.matchesSelector = function (elem, expr) {
  25203. // Set document vars if needed
  25204. if ((elem.ownerDocument || elem) !== document) {
  25205. setDocument(elem);
  25206. }
  25207. // Make sure that attribute selectors are quoted
  25208. expr = expr.replace(rattributeQuotes, "='$1']");
  25209. if (support.matchesSelector && documentIsHTML && !compilerCache[expr + " "] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  25210. try {
  25211. var ret = matches.call(elem, expr);
  25212. // IE 9's matchesSelector returns false on disconnected nodes
  25213. if (ret || support.disconnectedMatch ||
  25214. // As well, disconnected nodes are said to be in a document
  25215. // fragment in IE 9
  25216. elem.document && elem.document.nodeType !== 11) {
  25217. return ret;
  25218. }
  25219. } catch (e) {}
  25220. }
  25221. return Sizzle(expr, document, null, [elem]).length > 0;
  25222. };
  25223. Sizzle.contains = function (context, elem) {
  25224. // Set document vars if needed
  25225. if ((context.ownerDocument || context) !== document) {
  25226. setDocument(context);
  25227. }
  25228. return contains(context, elem);
  25229. };
  25230. Sizzle.attr = function (elem, name) {
  25231. // Set document vars if needed
  25232. if ((elem.ownerDocument || elem) !== document) {
  25233. setDocument(elem);
  25234. }
  25235. var fn = Expr.attrHandle[name.toLowerCase()],
  25236. // Don't get fooled by Object.prototype properties (jQuery #13807)
  25237. val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
  25238. return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  25239. };
  25240. Sizzle.escape = function (sel) {
  25241. return (sel + "").replace(rcssescape, fcssescape);
  25242. };
  25243. Sizzle.error = function (msg) {
  25244. throw new Error("Syntax error, unrecognized expression: " + msg);
  25245. };
  25246. /**
  25247. * Document sorting and removing duplicates
  25248. * @param {ArrayLike} results
  25249. */
  25250. Sizzle.uniqueSort = function (results) {
  25251. var elem,
  25252. duplicates = [],
  25253. j = 0,
  25254. i = 0;
  25255. // Unless we *know* we can detect duplicates, assume their presence
  25256. hasDuplicate = !support.detectDuplicates;
  25257. sortInput = !support.sortStable && results.slice(0);
  25258. results.sort(sortOrder);
  25259. if (hasDuplicate) {
  25260. while (elem = results[i++]) {
  25261. if (elem === results[i]) {
  25262. j = duplicates.push(i);
  25263. }
  25264. }
  25265. while (j--) {
  25266. results.splice(duplicates[j], 1);
  25267. }
  25268. }
  25269. // Clear input after sorting to release objects
  25270. // See https://github.com/jquery/sizzle/pull/225
  25271. sortInput = null;
  25272. return results;
  25273. };
  25274. /**
  25275. * Utility function for retrieving the text value of an array of DOM nodes
  25276. * @param {Array|Element} elem
  25277. */
  25278. getText = Sizzle.getText = function (elem) {
  25279. var node,
  25280. ret = "",
  25281. i = 0,
  25282. nodeType = elem.nodeType;
  25283. if (!nodeType) {
  25284. // If no nodeType, this is expected to be an array
  25285. while (node = elem[i++]) {
  25286. // Do not traverse comment nodes
  25287. ret += getText(node);
  25288. }
  25289. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  25290. // Use textContent for elements
  25291. // innerText usage removed for consistency of new lines (jQuery #11153)
  25292. if (typeof elem.textContent === "string") {
  25293. return elem.textContent;
  25294. } else {
  25295. // Traverse its children
  25296. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  25297. ret += getText(elem);
  25298. }
  25299. }
  25300. } else if (nodeType === 3 || nodeType === 4) {
  25301. return elem.nodeValue;
  25302. }
  25303. // Do not include comment or processing instruction nodes
  25304. return ret;
  25305. };
  25306. Expr = Sizzle.selectors = {
  25307. // Can be adjusted by the user
  25308. cacheLength: 50,
  25309. createPseudo: markFunction,
  25310. match: matchExpr,
  25311. attrHandle: {},
  25312. find: {},
  25313. relative: {
  25314. ">": { dir: "parentNode", first: true },
  25315. " ": { dir: "parentNode" },
  25316. "+": { dir: "previousSibling", first: true },
  25317. "~": { dir: "previousSibling" }
  25318. },
  25319. preFilter: {
  25320. "ATTR": function ATTR(match) {
  25321. match[1] = match[1].replace(runescape, funescape);
  25322. // Move the given value to match[3] whether quoted or unquoted
  25323. match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
  25324. if (match[2] === "~=") {
  25325. match[3] = " " + match[3] + " ";
  25326. }
  25327. return match.slice(0, 4);
  25328. },
  25329. "CHILD": function CHILD(match) {
  25330. /* matches from matchExpr["CHILD"]
  25331. 1 type (only|nth|...)
  25332. 2 what (child|of-type)
  25333. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  25334. 4 xn-component of xn+y argument ([+-]?\d*n|)
  25335. 5 sign of xn-component
  25336. 6 x of xn-component
  25337. 7 sign of y-component
  25338. 8 y of y-component
  25339. */
  25340. match[1] = match[1].toLowerCase();
  25341. if (match[1].slice(0, 3) === "nth") {
  25342. // nth-* requires argument
  25343. if (!match[3]) {
  25344. Sizzle.error(match[0]);
  25345. }
  25346. // numeric x and y parameters for Expr.filter.CHILD
  25347. // remember that false/true cast respectively to 0/1
  25348. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
  25349. match[5] = +(match[7] + match[8] || match[3] === "odd");
  25350. // other types prohibit arguments
  25351. } else if (match[3]) {
  25352. Sizzle.error(match[0]);
  25353. }
  25354. return match;
  25355. },
  25356. "PSEUDO": function PSEUDO(match) {
  25357. var excess,
  25358. unquoted = !match[6] && match[2];
  25359. if (matchExpr["CHILD"].test(match[0])) {
  25360. return null;
  25361. }
  25362. // Accept quoted arguments as-is
  25363. if (match[3]) {
  25364. match[2] = match[4] || match[5] || "";
  25365. // Strip excess characters from unquoted arguments
  25366. } else if (unquoted && rpseudo.test(unquoted) && (
  25367. // Get excess from tokenize (recursively)
  25368. excess = tokenize(unquoted, true)) && (
  25369. // advance to the next closing parenthesis
  25370. excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
  25371. // excess is a negative index
  25372. match[0] = match[0].slice(0, excess);
  25373. match[2] = unquoted.slice(0, excess);
  25374. }
  25375. // Return only captures needed by the pseudo filter method (type and argument)
  25376. return match.slice(0, 3);
  25377. }
  25378. },
  25379. filter: {
  25380. "TAG": function TAG(nodeNameSelector) {
  25381. var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  25382. return nodeNameSelector === "*" ? function () {
  25383. return true;
  25384. } : function (elem) {
  25385. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  25386. };
  25387. },
  25388. "CLASS": function CLASS(className) {
  25389. var pattern = classCache[className + " "];
  25390. return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function (elem) {
  25391. return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
  25392. });
  25393. },
  25394. "ATTR": function ATTR(name, operator, check) {
  25395. return function (elem) {
  25396. var result = Sizzle.attr(elem, name);
  25397. if (result == null) {
  25398. return operator === "!=";
  25399. }
  25400. if (!operator) {
  25401. return true;
  25402. }
  25403. result += "";
  25404. return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf(check) === 0 : operator === "*=" ? check && result.indexOf(check) > -1 : operator === "$=" ? check && result.slice(-check.length) === check : operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 : operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : false;
  25405. };
  25406. },
  25407. "CHILD": function CHILD(type, what, argument, first, last) {
  25408. var simple = type.slice(0, 3) !== "nth",
  25409. forward = type.slice(-4) !== "last",
  25410. ofType = what === "of-type";
  25411. return first === 1 && last === 0 ?
  25412. // Shortcut for :nth-*(n)
  25413. function (elem) {
  25414. return !!elem.parentNode;
  25415. } : function (elem, context, xml) {
  25416. var cache,
  25417. uniqueCache,
  25418. outerCache,
  25419. node,
  25420. nodeIndex,
  25421. start,
  25422. dir = simple !== forward ? "nextSibling" : "previousSibling",
  25423. parent = elem.parentNode,
  25424. name = ofType && elem.nodeName.toLowerCase(),
  25425. useCache = !xml && !ofType,
  25426. diff = false;
  25427. if (parent) {
  25428. // :(first|last|only)-(child|of-type)
  25429. if (simple) {
  25430. while (dir) {
  25431. node = elem;
  25432. while (node = node[dir]) {
  25433. if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
  25434. return false;
  25435. }
  25436. }
  25437. // Reverse direction for :only-* (if we haven't yet done so)
  25438. start = dir = type === "only" && !start && "nextSibling";
  25439. }
  25440. return true;
  25441. }
  25442. start = [forward ? parent.firstChild : parent.lastChild];
  25443. // non-xml :nth-child(...) stores cache data on `parent`
  25444. if (forward && useCache) {
  25445. // Seek `elem` from a previously-cached index
  25446. // ...in a gzip-friendly way
  25447. node = parent;
  25448. outerCache = node[expando] || (node[expando] = {});
  25449. // Support: IE <9 only
  25450. // Defend against cloned attroperties (jQuery gh-1709)
  25451. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  25452. cache = uniqueCache[type] || [];
  25453. nodeIndex = cache[0] === dirruns && cache[1];
  25454. diff = nodeIndex && cache[2];
  25455. node = nodeIndex && parent.childNodes[nodeIndex];
  25456. while (node = ++nodeIndex && node && node[dir] || (
  25457. // Fallback to seeking `elem` from the start
  25458. diff = nodeIndex = 0) || start.pop()) {
  25459. // When found, cache indexes on `parent` and break
  25460. if (node.nodeType === 1 && ++diff && node === elem) {
  25461. uniqueCache[type] = [dirruns, nodeIndex, diff];
  25462. break;
  25463. }
  25464. }
  25465. } else {
  25466. // Use previously-cached element index if available
  25467. if (useCache) {
  25468. // ...in a gzip-friendly way
  25469. node = elem;
  25470. outerCache = node[expando] || (node[expando] = {});
  25471. // Support: IE <9 only
  25472. // Defend against cloned attroperties (jQuery gh-1709)
  25473. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  25474. cache = uniqueCache[type] || [];
  25475. nodeIndex = cache[0] === dirruns && cache[1];
  25476. diff = nodeIndex;
  25477. }
  25478. // xml :nth-child(...)
  25479. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  25480. if (diff === false) {
  25481. // Use the same loop as above to seek `elem` from the start
  25482. while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
  25483. if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
  25484. // Cache the index of each encountered element
  25485. if (useCache) {
  25486. outerCache = node[expando] || (node[expando] = {});
  25487. // Support: IE <9 only
  25488. // Defend against cloned attroperties (jQuery gh-1709)
  25489. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  25490. uniqueCache[type] = [dirruns, diff];
  25491. }
  25492. if (node === elem) {
  25493. break;
  25494. }
  25495. }
  25496. }
  25497. }
  25498. }
  25499. // Incorporate the offset, then check against cycle size
  25500. diff -= last;
  25501. return diff === first || diff % first === 0 && diff / first >= 0;
  25502. }
  25503. };
  25504. },
  25505. "PSEUDO": function PSEUDO(pseudo, argument) {
  25506. // pseudo-class names are case-insensitive
  25507. // http://www.w3.org/TR/selectors/#pseudo-classes
  25508. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  25509. // Remember that setFilters inherits from pseudos
  25510. var args,
  25511. fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
  25512. // The user may use createPseudo to indicate that
  25513. // arguments are needed to create the filter function
  25514. // just as Sizzle does
  25515. if (fn[expando]) {
  25516. return fn(argument);
  25517. }
  25518. // But maintain support for old signatures
  25519. if (fn.length > 1) {
  25520. args = [pseudo, pseudo, "", argument];
  25521. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {
  25522. var idx,
  25523. matched = fn(seed, argument),
  25524. i = matched.length;
  25525. while (i--) {
  25526. idx = indexOf(seed, matched[i]);
  25527. seed[idx] = !(matches[idx] = matched[i]);
  25528. }
  25529. }) : function (elem) {
  25530. return fn(elem, 0, args);
  25531. };
  25532. }
  25533. return fn;
  25534. }
  25535. },
  25536. pseudos: {
  25537. // Potentially complex pseudos
  25538. "not": markFunction(function (selector) {
  25539. // Trim the selector passed to compile
  25540. // to avoid treating leading and trailing
  25541. // spaces as combinators
  25542. var input = [],
  25543. results = [],
  25544. matcher = compile(selector.replace(rtrim, "$1"));
  25545. return matcher[expando] ? markFunction(function (seed, matches, context, xml) {
  25546. var elem,
  25547. unmatched = matcher(seed, null, xml, []),
  25548. i = seed.length;
  25549. // Match elements unmatched by `matcher`
  25550. while (i--) {
  25551. if (elem = unmatched[i]) {
  25552. seed[i] = !(matches[i] = elem);
  25553. }
  25554. }
  25555. }) : function (elem, context, xml) {
  25556. input[0] = elem;
  25557. matcher(input, null, xml, results);
  25558. // Don't keep the element (issue #299)
  25559. input[0] = null;
  25560. return !results.pop();
  25561. };
  25562. }),
  25563. "has": markFunction(function (selector) {
  25564. return function (elem) {
  25565. return Sizzle(selector, elem).length > 0;
  25566. };
  25567. }),
  25568. "contains": markFunction(function (text) {
  25569. text = text.replace(runescape, funescape);
  25570. return function (elem) {
  25571. return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
  25572. };
  25573. }),
  25574. // "Whether an element is represented by a :lang() selector
  25575. // is based solely on the element's language value
  25576. // being equal to the identifier C,
  25577. // or beginning with the identifier C immediately followed by "-".
  25578. // The matching of C against the element's language value is performed case-insensitively.
  25579. // The identifier C does not have to be a valid language name."
  25580. // http://www.w3.org/TR/selectors/#lang-pseudo
  25581. "lang": markFunction(function (lang) {
  25582. // lang value must be a valid identifier
  25583. if (!ridentifier.test(lang || "")) {
  25584. Sizzle.error("unsupported lang: " + lang);
  25585. }
  25586. lang = lang.replace(runescape, funescape).toLowerCase();
  25587. return function (elem) {
  25588. var elemLang;
  25589. do {
  25590. if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
  25591. elemLang = elemLang.toLowerCase();
  25592. return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
  25593. }
  25594. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  25595. return false;
  25596. };
  25597. }),
  25598. // Miscellaneous
  25599. "target": function target(elem) {
  25600. var hash = window.location && window.location.hash;
  25601. return hash && hash.slice(1) === elem.id;
  25602. },
  25603. "root": function root(elem) {
  25604. return elem === docElem;
  25605. },
  25606. "focus": function focus(elem) {
  25607. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  25608. },
  25609. // Boolean properties
  25610. "enabled": createDisabledPseudo(false),
  25611. "disabled": createDisabledPseudo(true),
  25612. "checked": function checked(elem) {
  25613. // In CSS3, :checked should return both checked and selected elements
  25614. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  25615. var nodeName = elem.nodeName.toLowerCase();
  25616. return nodeName === "input" && !!elem.checked || nodeName === "option" && !!elem.selected;
  25617. },
  25618. "selected": function selected(elem) {
  25619. // Accessing this property makes selected-by-default
  25620. // options in Safari work properly
  25621. if (elem.parentNode) {
  25622. elem.parentNode.selectedIndex;
  25623. }
  25624. return elem.selected === true;
  25625. },
  25626. // Contents
  25627. "empty": function empty(elem) {
  25628. // http://www.w3.org/TR/selectors/#empty-pseudo
  25629. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  25630. // but not by others (comment: 8; processing instruction: 7; etc.)
  25631. // nodeType < 6 works because attributes (2) do not appear as children
  25632. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  25633. if (elem.nodeType < 6) {
  25634. return false;
  25635. }
  25636. }
  25637. return true;
  25638. },
  25639. "parent": function parent(elem) {
  25640. return !Expr.pseudos["empty"](elem);
  25641. },
  25642. // Element/input types
  25643. "header": function header(elem) {
  25644. return rheader.test(elem.nodeName);
  25645. },
  25646. "input": function input(elem) {
  25647. return rinputs.test(elem.nodeName);
  25648. },
  25649. "button": function button(elem) {
  25650. var name = elem.nodeName.toLowerCase();
  25651. return name === "input" && elem.type === "button" || name === "button";
  25652. },
  25653. "text": function text(elem) {
  25654. var attr;
  25655. return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && (
  25656. // Support: IE<8
  25657. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  25658. (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
  25659. },
  25660. // Position-in-collection
  25661. "first": createPositionalPseudo(function () {
  25662. return [0];
  25663. }),
  25664. "last": createPositionalPseudo(function (matchIndexes, length) {
  25665. return [length - 1];
  25666. }),
  25667. "eq": createPositionalPseudo(function (matchIndexes, length, argument) {
  25668. return [argument < 0 ? argument + length : argument];
  25669. }),
  25670. "even": createPositionalPseudo(function (matchIndexes, length) {
  25671. var i = 0;
  25672. for (; i < length; i += 2) {
  25673. matchIndexes.push(i);
  25674. }
  25675. return matchIndexes;
  25676. }),
  25677. "odd": createPositionalPseudo(function (matchIndexes, length) {
  25678. var i = 1;
  25679. for (; i < length; i += 2) {
  25680. matchIndexes.push(i);
  25681. }
  25682. return matchIndexes;
  25683. }),
  25684. "lt": createPositionalPseudo(function (matchIndexes, length, argument) {
  25685. var i = argument < 0 ? argument + length : argument;
  25686. for (; --i >= 0;) {
  25687. matchIndexes.push(i);
  25688. }
  25689. return matchIndexes;
  25690. }),
  25691. "gt": createPositionalPseudo(function (matchIndexes, length, argument) {
  25692. var i = argument < 0 ? argument + length : argument;
  25693. for (; ++i < length;) {
  25694. matchIndexes.push(i);
  25695. }
  25696. return matchIndexes;
  25697. })
  25698. }
  25699. };
  25700. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  25701. // Add button/input type pseudos
  25702. for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {
  25703. Expr.pseudos[i] = createInputPseudo(i);
  25704. }
  25705. for (i in { submit: true, reset: true }) {
  25706. Expr.pseudos[i] = createButtonPseudo(i);
  25707. }
  25708. // Easy API for creating new setFilters
  25709. function setFilters() {}
  25710. setFilters.prototype = Expr.filters = Expr.pseudos;
  25711. Expr.setFilters = new setFilters();
  25712. tokenize = Sizzle.tokenize = function (selector, parseOnly) {
  25713. var matched,
  25714. match,
  25715. tokens,
  25716. type,
  25717. soFar,
  25718. groups,
  25719. preFilters,
  25720. cached = tokenCache[selector + " "];
  25721. if (cached) {
  25722. return parseOnly ? 0 : cached.slice(0);
  25723. }
  25724. soFar = selector;
  25725. groups = [];
  25726. preFilters = Expr.preFilter;
  25727. while (soFar) {
  25728. // Comma and first run
  25729. if (!matched || (match = rcomma.exec(soFar))) {
  25730. if (match) {
  25731. // Don't consume trailing commas as valid
  25732. soFar = soFar.slice(match[0].length) || soFar;
  25733. }
  25734. groups.push(tokens = []);
  25735. }
  25736. matched = false;
  25737. // Combinators
  25738. if (match = rcombinators.exec(soFar)) {
  25739. matched = match.shift();
  25740. tokens.push({
  25741. value: matched,
  25742. // Cast descendant combinators to space
  25743. type: match[0].replace(rtrim, " ")
  25744. });
  25745. soFar = soFar.slice(matched.length);
  25746. }
  25747. // Filters
  25748. for (type in Expr.filter) {
  25749. if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
  25750. matched = match.shift();
  25751. tokens.push({
  25752. value: matched,
  25753. type: type,
  25754. matches: match
  25755. });
  25756. soFar = soFar.slice(matched.length);
  25757. }
  25758. }
  25759. if (!matched) {
  25760. break;
  25761. }
  25762. }
  25763. // Return the length of the invalid excess
  25764. // if we're just parsing
  25765. // Otherwise, throw an error or return tokens
  25766. return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) :
  25767. // Cache the tokens
  25768. tokenCache(selector, groups).slice(0);
  25769. };
  25770. function toSelector(tokens) {
  25771. var i = 0,
  25772. len = tokens.length,
  25773. selector = "";
  25774. for (; i < len; i++) {
  25775. selector += tokens[i].value;
  25776. }
  25777. return selector;
  25778. }
  25779. function addCombinator(matcher, combinator, base) {
  25780. var dir = combinator.dir,
  25781. skip = combinator.next,
  25782. key = skip || dir,
  25783. checkNonElements = base && key === "parentNode",
  25784. doneName = done++;
  25785. return combinator.first ?
  25786. // Check against closest ancestor/preceding element
  25787. function (elem, context, xml) {
  25788. while (elem = elem[dir]) {
  25789. if (elem.nodeType === 1 || checkNonElements) {
  25790. return matcher(elem, context, xml);
  25791. }
  25792. }
  25793. return false;
  25794. } :
  25795. // Check against all ancestor/preceding elements
  25796. function (elem, context, xml) {
  25797. var oldCache,
  25798. uniqueCache,
  25799. outerCache,
  25800. newCache = [dirruns, doneName];
  25801. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  25802. if (xml) {
  25803. while (elem = elem[dir]) {
  25804. if (elem.nodeType === 1 || checkNonElements) {
  25805. if (matcher(elem, context, xml)) {
  25806. return true;
  25807. }
  25808. }
  25809. }
  25810. } else {
  25811. while (elem = elem[dir]) {
  25812. if (elem.nodeType === 1 || checkNonElements) {
  25813. outerCache = elem[expando] || (elem[expando] = {});
  25814. // Support: IE <9 only
  25815. // Defend against cloned attroperties (jQuery gh-1709)
  25816. uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {});
  25817. if (skip && skip === elem.nodeName.toLowerCase()) {
  25818. elem = elem[dir] || elem;
  25819. } else if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
  25820. // Assign to newCache so results back-propagate to previous elements
  25821. return newCache[2] = oldCache[2];
  25822. } else {
  25823. // Reuse newcache so results back-propagate to previous elements
  25824. uniqueCache[key] = newCache;
  25825. // A match means we're done; a fail means we have to keep checking
  25826. if (newCache[2] = matcher(elem, context, xml)) {
  25827. return true;
  25828. }
  25829. }
  25830. }
  25831. }
  25832. }
  25833. return false;
  25834. };
  25835. }
  25836. function elementMatcher(matchers) {
  25837. return matchers.length > 1 ? function (elem, context, xml) {
  25838. var i = matchers.length;
  25839. while (i--) {
  25840. if (!matchers[i](elem, context, xml)) {
  25841. return false;
  25842. }
  25843. }
  25844. return true;
  25845. } : matchers[0];
  25846. }
  25847. function multipleContexts(selector, contexts, results) {
  25848. var i = 0,
  25849. len = contexts.length;
  25850. for (; i < len; i++) {
  25851. Sizzle(selector, contexts[i], results);
  25852. }
  25853. return results;
  25854. }
  25855. function condense(unmatched, map, filter, context, xml) {
  25856. var elem,
  25857. newUnmatched = [],
  25858. i = 0,
  25859. len = unmatched.length,
  25860. mapped = map != null;
  25861. for (; i < len; i++) {
  25862. if (elem = unmatched[i]) {
  25863. if (!filter || filter(elem, context, xml)) {
  25864. newUnmatched.push(elem);
  25865. if (mapped) {
  25866. map.push(i);
  25867. }
  25868. }
  25869. }
  25870. }
  25871. return newUnmatched;
  25872. }
  25873. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  25874. if (postFilter && !postFilter[expando]) {
  25875. postFilter = setMatcher(postFilter);
  25876. }
  25877. if (postFinder && !postFinder[expando]) {
  25878. postFinder = setMatcher(postFinder, postSelector);
  25879. }
  25880. return markFunction(function (seed, results, context, xml) {
  25881. var temp,
  25882. i,
  25883. elem,
  25884. preMap = [],
  25885. postMap = [],
  25886. preexisting = results.length,
  25887. // Get initial elements from seed or context
  25888. elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
  25889. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  25890. matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
  25891. matcherOut = matcher ?
  25892. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  25893. postFinder || (seed ? preFilter : preexisting || postFilter) ?
  25894. // ...intermediate processing is necessary
  25895. [] :
  25896. // ...otherwise use results directly
  25897. results : matcherIn;
  25898. // Find primary matches
  25899. if (matcher) {
  25900. matcher(matcherIn, matcherOut, context, xml);
  25901. }
  25902. // Apply postFilter
  25903. if (postFilter) {
  25904. temp = condense(matcherOut, postMap);
  25905. postFilter(temp, [], context, xml);
  25906. // Un-match failing elements by moving them back to matcherIn
  25907. i = temp.length;
  25908. while (i--) {
  25909. if (elem = temp[i]) {
  25910. matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
  25911. }
  25912. }
  25913. }
  25914. if (seed) {
  25915. if (postFinder || preFilter) {
  25916. if (postFinder) {
  25917. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  25918. temp = [];
  25919. i = matcherOut.length;
  25920. while (i--) {
  25921. if (elem = matcherOut[i]) {
  25922. // Restore matcherIn since elem is not yet a final match
  25923. temp.push(matcherIn[i] = elem);
  25924. }
  25925. }
  25926. postFinder(null, matcherOut = [], temp, xml);
  25927. }
  25928. // Move matched elements from seed to results to keep them synchronized
  25929. i = matcherOut.length;
  25930. while (i--) {
  25931. if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
  25932. seed[temp] = !(results[temp] = elem);
  25933. }
  25934. }
  25935. }
  25936. // Add elements to results, through postFinder if defined
  25937. } else {
  25938. matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
  25939. if (postFinder) {
  25940. postFinder(null, results, matcherOut, xml);
  25941. } else {
  25942. push.apply(results, matcherOut);
  25943. }
  25944. }
  25945. });
  25946. }
  25947. function matcherFromTokens(tokens) {
  25948. var checkContext,
  25949. matcher,
  25950. j,
  25951. len = tokens.length,
  25952. leadingRelative = Expr.relative[tokens[0].type],
  25953. implicitRelative = leadingRelative || Expr.relative[" "],
  25954. i = leadingRelative ? 1 : 0,
  25955. // The foundational matcher ensures that elements are reachable from top-level context(s)
  25956. matchContext = addCombinator(function (elem) {
  25957. return elem === checkContext;
  25958. }, implicitRelative, true),
  25959. matchAnyContext = addCombinator(function (elem) {
  25960. return indexOf(checkContext, elem) > -1;
  25961. }, implicitRelative, true),
  25962. matchers = [function (elem, context, xml) {
  25963. var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
  25964. // Avoid hanging onto element (issue #299)
  25965. checkContext = null;
  25966. return ret;
  25967. }];
  25968. for (; i < len; i++) {
  25969. if (matcher = Expr.relative[tokens[i].type]) {
  25970. matchers = [addCombinator(elementMatcher(matchers), matcher)];
  25971. } else {
  25972. matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
  25973. // Return special upon seeing a positional matcher
  25974. if (matcher[expando]) {
  25975. // Find the next relative operator (if any) for proper handling
  25976. j = ++i;
  25977. for (; j < len; j++) {
  25978. if (Expr.relative[tokens[j].type]) {
  25979. break;
  25980. }
  25981. }
  25982. return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(
  25983. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  25984. tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === " " ? "*" : "" })).replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens));
  25985. }
  25986. matchers.push(matcher);
  25987. }
  25988. }
  25989. return elementMatcher(matchers);
  25990. }
  25991. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  25992. var bySet = setMatchers.length > 0,
  25993. byElement = elementMatchers.length > 0,
  25994. superMatcher = function superMatcher(seed, context, xml, results, outermost) {
  25995. var elem,
  25996. j,
  25997. matcher,
  25998. matchedCount = 0,
  25999. i = "0",
  26000. unmatched = seed && [],
  26001. setMatched = [],
  26002. contextBackup = outermostContext,
  26003. // We must always have either seed elements or outermost context
  26004. elems = seed || byElement && Expr.find["TAG"]("*", outermost),
  26005. // Use integer dirruns iff this is the outermost matcher
  26006. dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1,
  26007. len = elems.length;
  26008. if (outermost) {
  26009. outermostContext = context === document || context || outermost;
  26010. }
  26011. // Add elements passing elementMatchers directly to results
  26012. // Support: IE<9, Safari
  26013. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  26014. for (; i !== len && (elem = elems[i]) != null; i++) {
  26015. if (byElement && elem) {
  26016. j = 0;
  26017. if (!context && elem.ownerDocument !== document) {
  26018. setDocument(elem);
  26019. xml = !documentIsHTML;
  26020. }
  26021. while (matcher = elementMatchers[j++]) {
  26022. if (matcher(elem, context || document, xml)) {
  26023. results.push(elem);
  26024. break;
  26025. }
  26026. }
  26027. if (outermost) {
  26028. dirruns = dirrunsUnique;
  26029. }
  26030. }
  26031. // Track unmatched elements for set filters
  26032. if (bySet) {
  26033. // They will have gone through all possible matchers
  26034. if (elem = !matcher && elem) {
  26035. matchedCount--;
  26036. }
  26037. // Lengthen the array for every element, matched or not
  26038. if (seed) {
  26039. unmatched.push(elem);
  26040. }
  26041. }
  26042. }
  26043. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  26044. // makes the latter nonnegative.
  26045. matchedCount += i;
  26046. // Apply set filters to unmatched elements
  26047. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  26048. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  26049. // no element matchers and no seed.
  26050. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  26051. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  26052. // numerically zero.
  26053. if (bySet && i !== matchedCount) {
  26054. j = 0;
  26055. while (matcher = setMatchers[j++]) {
  26056. matcher(unmatched, setMatched, context, xml);
  26057. }
  26058. if (seed) {
  26059. // Reintegrate element matches to eliminate the need for sorting
  26060. if (matchedCount > 0) {
  26061. while (i--) {
  26062. if (!(unmatched[i] || setMatched[i])) {
  26063. setMatched[i] = pop.call(results);
  26064. }
  26065. }
  26066. }
  26067. // Discard index placeholder values to get only actual matches
  26068. setMatched = condense(setMatched);
  26069. }
  26070. // Add matches to results
  26071. push.apply(results, setMatched);
  26072. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  26073. if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
  26074. Sizzle.uniqueSort(results);
  26075. }
  26076. }
  26077. // Override manipulation of globals by nested matchers
  26078. if (outermost) {
  26079. dirruns = dirrunsUnique;
  26080. outermostContext = contextBackup;
  26081. }
  26082. return unmatched;
  26083. };
  26084. return bySet ? markFunction(superMatcher) : superMatcher;
  26085. }
  26086. compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {
  26087. var i,
  26088. setMatchers = [],
  26089. elementMatchers = [],
  26090. cached = compilerCache[selector + " "];
  26091. if (!cached) {
  26092. // Generate a function of recursive functions that can be used to check each element
  26093. if (!match) {
  26094. match = tokenize(selector);
  26095. }
  26096. i = match.length;
  26097. while (i--) {
  26098. cached = matcherFromTokens(match[i]);
  26099. if (cached[expando]) {
  26100. setMatchers.push(cached);
  26101. } else {
  26102. elementMatchers.push(cached);
  26103. }
  26104. }
  26105. // Cache the compiled function
  26106. cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
  26107. // Save selector and tokenization
  26108. cached.selector = selector;
  26109. }
  26110. return cached;
  26111. };
  26112. /**
  26113. * A low-level selection function that works with Sizzle's compiled
  26114. * selector functions
  26115. * @param {String|Function} selector A selector or a pre-compiled
  26116. * selector function built with Sizzle.compile
  26117. * @param {Element} context
  26118. * @param {Array} [results]
  26119. * @param {Array} [seed] A set of elements to match against
  26120. */
  26121. select = Sizzle.select = function (selector, context, results, seed) {
  26122. var i,
  26123. tokens,
  26124. token,
  26125. type,
  26126. find,
  26127. compiled = typeof selector === "function" && selector,
  26128. match = !seed && tokenize(selector = compiled.selector || selector);
  26129. results = results || [];
  26130. // Try to minimize operations if there is only one selector in the list and no seed
  26131. // (the latter of which guarantees us context)
  26132. if (match.length === 1) {
  26133. // Reduce context if the leading compound selector is an ID
  26134. tokens = match[0] = match[0].slice(0);
  26135. if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  26136. context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
  26137. if (!context) {
  26138. return results;
  26139. // Precompiled matchers will still verify ancestry, so step up a level
  26140. } else if (compiled) {
  26141. context = context.parentNode;
  26142. }
  26143. selector = selector.slice(tokens.shift().value.length);
  26144. }
  26145. // Fetch a seed set for right-to-left matching
  26146. i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
  26147. while (i--) {
  26148. token = tokens[i];
  26149. // Abort if we hit a combinator
  26150. if (Expr.relative[type = token.type]) {
  26151. break;
  26152. }
  26153. if (find = Expr.find[type]) {
  26154. // Search, expanding context for leading sibling combinators
  26155. if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {
  26156. // If seed is empty or no tokens remain, we can return early
  26157. tokens.splice(i, 1);
  26158. selector = seed.length && toSelector(tokens);
  26159. if (!selector) {
  26160. push.apply(results, seed);
  26161. return results;
  26162. }
  26163. break;
  26164. }
  26165. }
  26166. }
  26167. }
  26168. // Compile and execute a filtering function if one is not provided
  26169. // Provide `match` to avoid retokenization if we modified the selector above
  26170. (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);
  26171. return results;
  26172. };
  26173. // One-time assignments
  26174. // Sort stability
  26175. support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
  26176. // Support: Chrome 14-35+
  26177. // Always assume duplicates if they aren't passed to the comparison function
  26178. support.detectDuplicates = !!hasDuplicate;
  26179. // Initialize against the default document
  26180. setDocument();
  26181. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  26182. // Detached nodes confoundingly follow *each other*
  26183. support.sortDetached = assert(function (el) {
  26184. // Should return 1, but returns 4 (following)
  26185. return el.compareDocumentPosition(document.createElement("fieldset")) & 1;
  26186. });
  26187. // Support: IE<8
  26188. // Prevent attribute/property "interpolation"
  26189. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  26190. if (!assert(function (el) {
  26191. el.innerHTML = "<a href='#'></a>";
  26192. return el.firstChild.getAttribute("href") === "#";
  26193. })) {
  26194. addHandle("type|href|height|width", function (elem, name, isXML) {
  26195. if (!isXML) {
  26196. return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
  26197. }
  26198. });
  26199. }
  26200. // Support: IE<9
  26201. // Use defaultValue in place of getAttribute("value")
  26202. if (!support.attributes || !assert(function (el) {
  26203. el.innerHTML = "<input/>";
  26204. el.firstChild.setAttribute("value", "");
  26205. return el.firstChild.getAttribute("value") === "";
  26206. })) {
  26207. addHandle("value", function (elem, name, isXML) {
  26208. if (!isXML && elem.nodeName.toLowerCase() === "input") {
  26209. return elem.defaultValue;
  26210. }
  26211. });
  26212. }
  26213. // Support: IE<9
  26214. // Use getAttributeNode to fetch booleans when getAttribute lies
  26215. if (!assert(function (el) {
  26216. return el.getAttribute("disabled") == null;
  26217. })) {
  26218. addHandle(booleans, function (elem, name, isXML) {
  26219. var val;
  26220. if (!isXML) {
  26221. return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  26222. }
  26223. });
  26224. }
  26225. return Sizzle;
  26226. }(window);
  26227. jQuery.find = Sizzle;
  26228. jQuery.expr = Sizzle.selectors;
  26229. // Deprecated
  26230. jQuery.expr[":"] = jQuery.expr.pseudos;
  26231. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  26232. jQuery.text = Sizzle.getText;
  26233. jQuery.isXMLDoc = Sizzle.isXML;
  26234. jQuery.contains = Sizzle.contains;
  26235. jQuery.escapeSelector = Sizzle.escape;
  26236. var dir = function dir(elem, _dir, until) {
  26237. var matched = [],
  26238. truncate = until !== undefined;
  26239. while ((elem = elem[_dir]) && elem.nodeType !== 9) {
  26240. if (elem.nodeType === 1) {
  26241. if (truncate && jQuery(elem).is(until)) {
  26242. break;
  26243. }
  26244. matched.push(elem);
  26245. }
  26246. }
  26247. return matched;
  26248. };
  26249. var _siblings = function _siblings(n, elem) {
  26250. var matched = [];
  26251. for (; n; n = n.nextSibling) {
  26252. if (n.nodeType === 1 && n !== elem) {
  26253. matched.push(n);
  26254. }
  26255. }
  26256. return matched;
  26257. };
  26258. var rneedsContext = jQuery.expr.match.needsContext;
  26259. function nodeName(elem, name) {
  26260. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  26261. };
  26262. var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
  26263. // Implement the identical functionality for filter and not
  26264. function winnow(elements, qualifier, not) {
  26265. if (isFunction(qualifier)) {
  26266. return jQuery.grep(elements, function (elem, i) {
  26267. return !!qualifier.call(elem, i, elem) !== not;
  26268. });
  26269. }
  26270. // Single element
  26271. if (qualifier.nodeType) {
  26272. return jQuery.grep(elements, function (elem) {
  26273. return elem === qualifier !== not;
  26274. });
  26275. }
  26276. // Arraylike of elements (jQuery, arguments, Array)
  26277. if (typeof qualifier !== "string") {
  26278. return jQuery.grep(elements, function (elem) {
  26279. return indexOf.call(qualifier, elem) > -1 !== not;
  26280. });
  26281. }
  26282. // Filtered directly for both simple and complex selectors
  26283. return jQuery.filter(qualifier, elements, not);
  26284. }
  26285. jQuery.filter = function (expr, elems, not) {
  26286. var elem = elems[0];
  26287. if (not) {
  26288. expr = ":not(" + expr + ")";
  26289. }
  26290. if (elems.length === 1 && elem.nodeType === 1) {
  26291. return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
  26292. }
  26293. return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
  26294. return elem.nodeType === 1;
  26295. }));
  26296. };
  26297. jQuery.fn.extend({
  26298. find: function find(selector) {
  26299. var i,
  26300. ret,
  26301. len = this.length,
  26302. self = this;
  26303. if (typeof selector !== "string") {
  26304. return this.pushStack(jQuery(selector).filter(function () {
  26305. for (i = 0; i < len; i++) {
  26306. if (jQuery.contains(self[i], this)) {
  26307. return true;
  26308. }
  26309. }
  26310. }));
  26311. }
  26312. ret = this.pushStack([]);
  26313. for (i = 0; i < len; i++) {
  26314. jQuery.find(selector, self[i], ret);
  26315. }
  26316. return len > 1 ? jQuery.uniqueSort(ret) : ret;
  26317. },
  26318. filter: function filter(selector) {
  26319. return this.pushStack(winnow(this, selector || [], false));
  26320. },
  26321. not: function not(selector) {
  26322. return this.pushStack(winnow(this, selector || [], true));
  26323. },
  26324. is: function is(selector) {
  26325. return !!winnow(this,
  26326. // If this is a positional/relative selector, check membership in the returned set
  26327. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  26328. typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length;
  26329. }
  26330. });
  26331. // Initialize a jQuery object
  26332. // A central reference to the root jQuery(document)
  26333. var rootjQuery,
  26334. // A simple way to check for HTML strings
  26335. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  26336. // Strict HTML recognition (#11290: must start with <)
  26337. // Shortcut simple #id case for speed
  26338. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  26339. init = jQuery.fn.init = function (selector, context, root) {
  26340. var match, elem;
  26341. // HANDLE: $(""), $(null), $(undefined), $(false)
  26342. if (!selector) {
  26343. return this;
  26344. }
  26345. // Method init() accepts an alternate rootjQuery
  26346. // so migrate can support jQuery.sub (gh-2101)
  26347. root = root || rootjQuery;
  26348. // Handle HTML strings
  26349. if (typeof selector === "string") {
  26350. if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
  26351. // Assume that strings that start and end with <> are HTML and skip the regex check
  26352. match = [null, selector, null];
  26353. } else {
  26354. match = rquickExpr.exec(selector);
  26355. }
  26356. // Match html or make sure no context is specified for #id
  26357. if (match && (match[1] || !context)) {
  26358. // HANDLE: $(html) -> $(array)
  26359. if (match[1]) {
  26360. context = context instanceof jQuery ? context[0] : context;
  26361. // Option to run scripts is true for back-compat
  26362. // Intentionally let the error be thrown if parseHTML is not present
  26363. jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
  26364. // HANDLE: $(html, props)
  26365. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  26366. for (match in context) {
  26367. // Properties of context are called as methods if possible
  26368. if (isFunction(this[match])) {
  26369. this[match](context[match]);
  26370. // ...and otherwise set as attributes
  26371. } else {
  26372. this.attr(match, context[match]);
  26373. }
  26374. }
  26375. }
  26376. return this;
  26377. // HANDLE: $(#id)
  26378. } else {
  26379. elem = document.getElementById(match[2]);
  26380. if (elem) {
  26381. // Inject the element directly into the jQuery object
  26382. this[0] = elem;
  26383. this.length = 1;
  26384. }
  26385. return this;
  26386. }
  26387. // HANDLE: $(expr, $(...))
  26388. } else if (!context || context.jquery) {
  26389. return (context || root).find(selector);
  26390. // HANDLE: $(expr, context)
  26391. // (which is just equivalent to: $(context).find(expr)
  26392. } else {
  26393. return this.constructor(context).find(selector);
  26394. }
  26395. // HANDLE: $(DOMElement)
  26396. } else if (selector.nodeType) {
  26397. this[0] = selector;
  26398. this.length = 1;
  26399. return this;
  26400. // HANDLE: $(function)
  26401. // Shortcut for document ready
  26402. } else if (isFunction(selector)) {
  26403. return root.ready !== undefined ? root.ready(selector) :
  26404. // Execute immediately if ready is not present
  26405. selector(jQuery);
  26406. }
  26407. return jQuery.makeArray(selector, this);
  26408. };
  26409. // Give the init function the jQuery prototype for later instantiation
  26410. init.prototype = jQuery.fn;
  26411. // Initialize central reference
  26412. rootjQuery = jQuery(document);
  26413. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  26414. // Methods guaranteed to produce a unique set when starting from a unique set
  26415. guaranteedUnique = {
  26416. children: true,
  26417. contents: true,
  26418. next: true,
  26419. prev: true
  26420. };
  26421. jQuery.fn.extend({
  26422. has: function has(target) {
  26423. var targets = jQuery(target, this),
  26424. l = targets.length;
  26425. return this.filter(function () {
  26426. var i = 0;
  26427. for (; i < l; i++) {
  26428. if (jQuery.contains(this, targets[i])) {
  26429. return true;
  26430. }
  26431. }
  26432. });
  26433. },
  26434. closest: function closest(selectors, context) {
  26435. var cur,
  26436. i = 0,
  26437. l = this.length,
  26438. matched = [],
  26439. targets = typeof selectors !== "string" && jQuery(selectors);
  26440. // Positional selectors never match, since there's no _selection_ context
  26441. if (!rneedsContext.test(selectors)) {
  26442. for (; i < l; i++) {
  26443. for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
  26444. // Always skip document fragments
  26445. if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 :
  26446. // Don't pass non-elements to Sizzle
  26447. cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
  26448. matched.push(cur);
  26449. break;
  26450. }
  26451. }
  26452. }
  26453. }
  26454. return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
  26455. },
  26456. // Determine the position of an element within the set
  26457. index: function index(elem) {
  26458. // No argument, return index in parent
  26459. if (!elem) {
  26460. return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
  26461. }
  26462. // Index in selector
  26463. if (typeof elem === "string") {
  26464. return indexOf.call(jQuery(elem), this[0]);
  26465. }
  26466. // Locate the position of the desired element
  26467. return indexOf.call(this,
  26468. // If it receives a jQuery object, the first element is used
  26469. elem.jquery ? elem[0] : elem);
  26470. },
  26471. add: function add(selector, context) {
  26472. return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));
  26473. },
  26474. addBack: function addBack(selector) {
  26475. return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
  26476. }
  26477. });
  26478. function sibling(cur, dir) {
  26479. while ((cur = cur[dir]) && cur.nodeType !== 1) {}
  26480. return cur;
  26481. }
  26482. jQuery.each({
  26483. parent: function parent(elem) {
  26484. var parent = elem.parentNode;
  26485. return parent && parent.nodeType !== 11 ? parent : null;
  26486. },
  26487. parents: function parents(elem) {
  26488. return dir(elem, "parentNode");
  26489. },
  26490. parentsUntil: function parentsUntil(elem, i, until) {
  26491. return dir(elem, "parentNode", until);
  26492. },
  26493. next: function next(elem) {
  26494. return sibling(elem, "nextSibling");
  26495. },
  26496. prev: function prev(elem) {
  26497. return sibling(elem, "previousSibling");
  26498. },
  26499. nextAll: function nextAll(elem) {
  26500. return dir(elem, "nextSibling");
  26501. },
  26502. prevAll: function prevAll(elem) {
  26503. return dir(elem, "previousSibling");
  26504. },
  26505. nextUntil: function nextUntil(elem, i, until) {
  26506. return dir(elem, "nextSibling", until);
  26507. },
  26508. prevUntil: function prevUntil(elem, i, until) {
  26509. return dir(elem, "previousSibling", until);
  26510. },
  26511. siblings: function siblings(elem) {
  26512. return _siblings((elem.parentNode || {}).firstChild, elem);
  26513. },
  26514. children: function children(elem) {
  26515. return _siblings(elem.firstChild);
  26516. },
  26517. contents: function contents(elem) {
  26518. if (nodeName(elem, "iframe")) {
  26519. return elem.contentDocument;
  26520. }
  26521. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  26522. // Treat the template element as a regular one in browsers that
  26523. // don't support it.
  26524. if (nodeName(elem, "template")) {
  26525. elem = elem.content || elem;
  26526. }
  26527. return jQuery.merge([], elem.childNodes);
  26528. }
  26529. }, function (name, fn) {
  26530. jQuery.fn[name] = function (until, selector) {
  26531. var matched = jQuery.map(this, fn, until);
  26532. if (name.slice(-5) !== "Until") {
  26533. selector = until;
  26534. }
  26535. if (selector && typeof selector === "string") {
  26536. matched = jQuery.filter(selector, matched);
  26537. }
  26538. if (this.length > 1) {
  26539. // Remove duplicates
  26540. if (!guaranteedUnique[name]) {
  26541. jQuery.uniqueSort(matched);
  26542. }
  26543. // Reverse order for parents* and prev-derivatives
  26544. if (rparentsprev.test(name)) {
  26545. matched.reverse();
  26546. }
  26547. }
  26548. return this.pushStack(matched);
  26549. };
  26550. });
  26551. var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
  26552. // Convert String-formatted options into Object-formatted ones
  26553. function createOptions(options) {
  26554. var object = {};
  26555. jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {
  26556. object[flag] = true;
  26557. });
  26558. return object;
  26559. }
  26560. /*
  26561. * Create a callback list using the following parameters:
  26562. *
  26563. * options: an optional list of space-separated options that will change how
  26564. * the callback list behaves or a more traditional option object
  26565. *
  26566. * By default a callback list will act like an event callback list and can be
  26567. * "fired" multiple times.
  26568. *
  26569. * Possible options:
  26570. *
  26571. * once: will ensure the callback list can only be fired once (like a Deferred)
  26572. *
  26573. * memory: will keep track of previous values and will call any callback added
  26574. * after the list has been fired right away with the latest "memorized"
  26575. * values (like a Deferred)
  26576. *
  26577. * unique: will ensure a callback can only be added once (no duplicate in the list)
  26578. *
  26579. * stopOnFalse: interrupt callings when a callback returns false
  26580. *
  26581. */
  26582. jQuery.Callbacks = function (options) {
  26583. // Convert options from String-formatted to Object-formatted if needed
  26584. // (we check in cache first)
  26585. options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options);
  26586. var // Flag to know if list is currently firing
  26587. firing,
  26588. // Last fire value for non-forgettable lists
  26589. memory,
  26590. // Flag to know if list was already fired
  26591. _fired,
  26592. // Flag to prevent firing
  26593. _locked,
  26594. // Actual callback list
  26595. list = [],
  26596. // Queue of execution data for repeatable lists
  26597. queue = [],
  26598. // Index of currently firing callback (modified by add/remove as needed)
  26599. firingIndex = -1,
  26600. // Fire callbacks
  26601. fire = function fire() {
  26602. // Enforce single-firing
  26603. _locked = _locked || options.once;
  26604. // Execute callbacks for all pending executions,
  26605. // respecting firingIndex overrides and runtime changes
  26606. _fired = firing = true;
  26607. for (; queue.length; firingIndex = -1) {
  26608. memory = queue.shift();
  26609. while (++firingIndex < list.length) {
  26610. // Run callback and check for early termination
  26611. if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {
  26612. // Jump to end and forget the data so .add doesn't re-fire
  26613. firingIndex = list.length;
  26614. memory = false;
  26615. }
  26616. }
  26617. }
  26618. // Forget the data if we're done with it
  26619. if (!options.memory) {
  26620. memory = false;
  26621. }
  26622. firing = false;
  26623. // Clean up if we're done firing for good
  26624. if (_locked) {
  26625. // Keep an empty list if we have data for future add calls
  26626. if (memory) {
  26627. list = [];
  26628. // Otherwise, this object is spent
  26629. } else {
  26630. list = "";
  26631. }
  26632. }
  26633. },
  26634. // Actual Callbacks object
  26635. self = {
  26636. // Add a callback or a collection of callbacks to the list
  26637. add: function add() {
  26638. if (list) {
  26639. // If we have memory from a past run, we should fire after adding
  26640. if (memory && !firing) {
  26641. firingIndex = list.length - 1;
  26642. queue.push(memory);
  26643. }
  26644. (function add(args) {
  26645. jQuery.each(args, function (_, arg) {
  26646. if (isFunction(arg)) {
  26647. if (!options.unique || !self.has(arg)) {
  26648. list.push(arg);
  26649. }
  26650. } else if (arg && arg.length && toType(arg) !== "string") {
  26651. // Inspect recursively
  26652. add(arg);
  26653. }
  26654. });
  26655. })(arguments);
  26656. if (memory && !firing) {
  26657. fire();
  26658. }
  26659. }
  26660. return this;
  26661. },
  26662. // Remove a callback from the list
  26663. remove: function remove() {
  26664. jQuery.each(arguments, function (_, arg) {
  26665. var index;
  26666. while ((index = jQuery.inArray(arg, list, index)) > -1) {
  26667. list.splice(index, 1);
  26668. // Handle firing indexes
  26669. if (index <= firingIndex) {
  26670. firingIndex--;
  26671. }
  26672. }
  26673. });
  26674. return this;
  26675. },
  26676. // Check if a given callback is in the list.
  26677. // If no argument is given, return whether or not list has callbacks attached.
  26678. has: function has(fn) {
  26679. return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;
  26680. },
  26681. // Remove all callbacks from the list
  26682. empty: function empty() {
  26683. if (list) {
  26684. list = [];
  26685. }
  26686. return this;
  26687. },
  26688. // Disable .fire and .add
  26689. // Abort any current/pending executions
  26690. // Clear all callbacks and values
  26691. disable: function disable() {
  26692. _locked = queue = [];
  26693. list = memory = "";
  26694. return this;
  26695. },
  26696. disabled: function disabled() {
  26697. return !list;
  26698. },
  26699. // Disable .fire
  26700. // Also disable .add unless we have memory (since it would have no effect)
  26701. // Abort any pending executions
  26702. lock: function lock() {
  26703. _locked = queue = [];
  26704. if (!memory && !firing) {
  26705. list = memory = "";
  26706. }
  26707. return this;
  26708. },
  26709. locked: function locked() {
  26710. return !!_locked;
  26711. },
  26712. // Call all callbacks with the given context and arguments
  26713. fireWith: function fireWith(context, args) {
  26714. if (!_locked) {
  26715. args = args || [];
  26716. args = [context, args.slice ? args.slice() : args];
  26717. queue.push(args);
  26718. if (!firing) {
  26719. fire();
  26720. }
  26721. }
  26722. return this;
  26723. },
  26724. // Call all the callbacks with the given arguments
  26725. fire: function fire() {
  26726. self.fireWith(this, arguments);
  26727. return this;
  26728. },
  26729. // To know if the callbacks have already been called at least once
  26730. fired: function fired() {
  26731. return !!_fired;
  26732. }
  26733. };
  26734. return self;
  26735. };
  26736. function Identity(v) {
  26737. return v;
  26738. }
  26739. function Thrower(ex) {
  26740. throw ex;
  26741. }
  26742. function adoptValue(value, resolve, reject, noValue) {
  26743. var method;
  26744. try {
  26745. // Check for promise aspect first to privilege synchronous behavior
  26746. if (value && isFunction(method = value.promise)) {
  26747. method.call(value).done(resolve).fail(reject);
  26748. // Other thenables
  26749. } else if (value && isFunction(method = value.then)) {
  26750. method.call(value, resolve, reject);
  26751. // Other non-thenables
  26752. } else {
  26753. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  26754. // * false: [ value ].slice( 0 ) => resolve( value )
  26755. // * true: [ value ].slice( 1 ) => resolve()
  26756. resolve.apply(undefined, [value].slice(noValue));
  26757. }
  26758. // For Promises/A+, convert exceptions into rejections
  26759. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  26760. // Deferred#then to conditionally suppress rejection.
  26761. } catch (value) {
  26762. // Support: Android 4.0 only
  26763. // Strict mode functions invoked without .call/.apply get global-object context
  26764. reject.apply(undefined, [value]);
  26765. }
  26766. }
  26767. jQuery.extend({
  26768. Deferred: function Deferred(func) {
  26769. var tuples = [
  26770. // action, add listener, callbacks,
  26771. // ... .then handlers, argument index, [final state]
  26772. ["notify", "progress", jQuery.Callbacks("memory"), jQuery.Callbacks("memory"), 2], ["resolve", "done", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 0, "resolved"], ["reject", "fail", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 1, "rejected"]],
  26773. _state = "pending",
  26774. _promise = {
  26775. state: function state() {
  26776. return _state;
  26777. },
  26778. always: function always() {
  26779. deferred.done(arguments).fail(arguments);
  26780. return this;
  26781. },
  26782. "catch": function _catch(fn) {
  26783. return _promise.then(null, fn);
  26784. },
  26785. // Keep pipe for back-compat
  26786. pipe: function pipe() /* fnDone, fnFail, fnProgress */{
  26787. var fns = arguments;
  26788. return jQuery.Deferred(function (newDefer) {
  26789. jQuery.each(tuples, function (i, tuple) {
  26790. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  26791. var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];
  26792. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  26793. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  26794. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  26795. deferred[tuple[1]](function () {
  26796. var returned = fn && fn.apply(this, arguments);
  26797. if (returned && isFunction(returned.promise)) {
  26798. returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
  26799. } else {
  26800. newDefer[tuple[0] + "With"](this, fn ? [returned] : arguments);
  26801. }
  26802. });
  26803. });
  26804. fns = null;
  26805. }).promise();
  26806. },
  26807. then: function then(onFulfilled, onRejected, onProgress) {
  26808. var maxDepth = 0;
  26809. function resolve(depth, deferred, handler, special) {
  26810. return function () {
  26811. var that = this,
  26812. args = arguments,
  26813. mightThrow = function mightThrow() {
  26814. var returned, then;
  26815. // Support: Promises/A+ section 2.3.3.3.3
  26816. // https://promisesaplus.com/#point-59
  26817. // Ignore double-resolution attempts
  26818. if (depth < maxDepth) {
  26819. return;
  26820. }
  26821. returned = handler.apply(that, args);
  26822. // Support: Promises/A+ section 2.3.1
  26823. // https://promisesaplus.com/#point-48
  26824. if (returned === deferred.promise()) {
  26825. throw new TypeError("Thenable self-resolution");
  26826. }
  26827. // Support: Promises/A+ sections 2.3.3.1, 3.5
  26828. // https://promisesaplus.com/#point-54
  26829. // https://promisesaplus.com/#point-75
  26830. // Retrieve `then` only once
  26831. then = returned && (
  26832. // Support: Promises/A+ section 2.3.4
  26833. // https://promisesaplus.com/#point-64
  26834. // Only check objects and functions for thenability
  26835. (typeof returned === "undefined" ? "undefined" : _typeof(returned)) === "object" || typeof returned === "function") && returned.then;
  26836. // Handle a returned thenable
  26837. if (isFunction(then)) {
  26838. // Special processors (notify) just wait for resolution
  26839. if (special) {
  26840. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special));
  26841. // Normal processors (resolve) also hook into progress
  26842. } else {
  26843. // ...and disregard older resolution values
  26844. maxDepth++;
  26845. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));
  26846. }
  26847. // Handle all other returned values
  26848. } else {
  26849. // Only substitute handlers pass on context
  26850. // and multiple values (non-spec behavior)
  26851. if (handler !== Identity) {
  26852. that = undefined;
  26853. args = [returned];
  26854. }
  26855. // Process the value(s)
  26856. // Default process is resolve
  26857. (special || deferred.resolveWith)(that, args);
  26858. }
  26859. },
  26860. // Only normal processors (resolve) catch and reject exceptions
  26861. process = special ? mightThrow : function () {
  26862. try {
  26863. mightThrow();
  26864. } catch (e) {
  26865. if (jQuery.Deferred.exceptionHook) {
  26866. jQuery.Deferred.exceptionHook(e, process.stackTrace);
  26867. }
  26868. // Support: Promises/A+ section 2.3.3.3.4.1
  26869. // https://promisesaplus.com/#point-61
  26870. // Ignore post-resolution exceptions
  26871. if (depth + 1 >= maxDepth) {
  26872. // Only substitute handlers pass on context
  26873. // and multiple values (non-spec behavior)
  26874. if (handler !== Thrower) {
  26875. that = undefined;
  26876. args = [e];
  26877. }
  26878. deferred.rejectWith(that, args);
  26879. }
  26880. }
  26881. };
  26882. // Support: Promises/A+ section 2.3.3.3.1
  26883. // https://promisesaplus.com/#point-57
  26884. // Re-resolve promises immediately to dodge false rejection from
  26885. // subsequent errors
  26886. if (depth) {
  26887. process();
  26888. } else {
  26889. // Call an optional hook to record the stack, in case of exception
  26890. // since it's otherwise lost when execution goes async
  26891. if (jQuery.Deferred.getStackHook) {
  26892. process.stackTrace = jQuery.Deferred.getStackHook();
  26893. }
  26894. window.setTimeout(process);
  26895. }
  26896. };
  26897. }
  26898. return jQuery.Deferred(function (newDefer) {
  26899. // progress_handlers.add( ... )
  26900. tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith));
  26901. // fulfilled_handlers.add( ... )
  26902. tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity));
  26903. // rejected_handlers.add( ... )
  26904. tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower));
  26905. }).promise();
  26906. },
  26907. // Get a promise for this deferred
  26908. // If obj is provided, the promise aspect is added to the object
  26909. promise: function promise(obj) {
  26910. return obj != null ? jQuery.extend(obj, _promise) : _promise;
  26911. }
  26912. },
  26913. deferred = {};
  26914. // Add list-specific methods
  26915. jQuery.each(tuples, function (i, tuple) {
  26916. var list = tuple[2],
  26917. stateString = tuple[5];
  26918. // promise.progress = list.add
  26919. // promise.done = list.add
  26920. // promise.fail = list.add
  26921. _promise[tuple[1]] = list.add;
  26922. // Handle state
  26923. if (stateString) {
  26924. list.add(function () {
  26925. // state = "resolved" (i.e., fulfilled)
  26926. // state = "rejected"
  26927. _state = stateString;
  26928. },
  26929. // rejected_callbacks.disable
  26930. // fulfilled_callbacks.disable
  26931. tuples[3 - i][2].disable,
  26932. // rejected_handlers.disable
  26933. // fulfilled_handlers.disable
  26934. tuples[3 - i][3].disable,
  26935. // progress_callbacks.lock
  26936. tuples[0][2].lock,
  26937. // progress_handlers.lock
  26938. tuples[0][3].lock);
  26939. }
  26940. // progress_handlers.fire
  26941. // fulfilled_handlers.fire
  26942. // rejected_handlers.fire
  26943. list.add(tuple[3].fire);
  26944. // deferred.notify = function() { deferred.notifyWith(...) }
  26945. // deferred.resolve = function() { deferred.resolveWith(...) }
  26946. // deferred.reject = function() { deferred.rejectWith(...) }
  26947. deferred[tuple[0]] = function () {
  26948. deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments);
  26949. return this;
  26950. };
  26951. // deferred.notifyWith = list.fireWith
  26952. // deferred.resolveWith = list.fireWith
  26953. // deferred.rejectWith = list.fireWith
  26954. deferred[tuple[0] + "With"] = list.fireWith;
  26955. });
  26956. // Make the deferred a promise
  26957. _promise.promise(deferred);
  26958. // Call given func if any
  26959. if (func) {
  26960. func.call(deferred, deferred);
  26961. }
  26962. // All done!
  26963. return deferred;
  26964. },
  26965. // Deferred helper
  26966. when: function when(singleValue) {
  26967. var
  26968. // count of uncompleted subordinates
  26969. remaining = arguments.length,
  26970. // count of unprocessed arguments
  26971. i = remaining,
  26972. // subordinate fulfillment data
  26973. resolveContexts = Array(i),
  26974. resolveValues = _slice.call(arguments),
  26975. // the master Deferred
  26976. master = jQuery.Deferred(),
  26977. // subordinate callback factory
  26978. updateFunc = function updateFunc(i) {
  26979. return function (value) {
  26980. resolveContexts[i] = this;
  26981. resolveValues[i] = arguments.length > 1 ? _slice.call(arguments) : value;
  26982. if (! --remaining) {
  26983. master.resolveWith(resolveContexts, resolveValues);
  26984. }
  26985. };
  26986. };
  26987. // Single- and empty arguments are adopted like Promise.resolve
  26988. if (remaining <= 1) {
  26989. adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, !remaining);
  26990. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  26991. if (master.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) {
  26992. return master.then();
  26993. }
  26994. }
  26995. // Multiple arguments are aggregated like Promise.all array elements
  26996. while (i--) {
  26997. adoptValue(resolveValues[i], updateFunc(i), master.reject);
  26998. }
  26999. return master.promise();
  27000. }
  27001. });
  27002. // These usually indicate a programmer mistake during development,
  27003. // warn about them ASAP rather than swallowing them by default.
  27004. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  27005. jQuery.Deferred.exceptionHook = function (error, stack) {
  27006. // Support: IE 8 - 9 only
  27007. // Console exists when dev tools are open, which can happen at any time
  27008. if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {
  27009. window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack);
  27010. }
  27011. };
  27012. jQuery.readyException = function (error) {
  27013. window.setTimeout(function () {
  27014. throw error;
  27015. });
  27016. };
  27017. // The deferred used on DOM ready
  27018. var readyList = jQuery.Deferred();
  27019. jQuery.fn.ready = function (fn) {
  27020. readyList.then(fn)
  27021. // Wrap jQuery.readyException in a function so that the lookup
  27022. // happens at the time of error handling instead of callback
  27023. // registration.
  27024. .catch(function (error) {
  27025. jQuery.readyException(error);
  27026. });
  27027. return this;
  27028. };
  27029. jQuery.extend({
  27030. // Is the DOM ready to be used? Set to true once it occurs.
  27031. isReady: false,
  27032. // A counter to track how many items to wait for before
  27033. // the ready event fires. See #6781
  27034. readyWait: 1,
  27035. // Handle when the DOM is ready
  27036. ready: function ready(wait) {
  27037. // Abort if there are pending holds or we're already ready
  27038. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  27039. return;
  27040. }
  27041. // Remember that the DOM is ready
  27042. jQuery.isReady = true;
  27043. // If a normal DOM Ready event fired, decrement, and wait if need be
  27044. if (wait !== true && --jQuery.readyWait > 0) {
  27045. return;
  27046. }
  27047. // If there are functions bound, to execute
  27048. readyList.resolveWith(document, [jQuery]);
  27049. }
  27050. });
  27051. jQuery.ready.then = readyList.then;
  27052. // The ready event handler and self cleanup method
  27053. function completed() {
  27054. document.removeEventListener("DOMContentLoaded", completed);
  27055. window.removeEventListener("load", completed);
  27056. jQuery.ready();
  27057. }
  27058. // Catch cases where $(document).ready() is called
  27059. // after the browser event has already occurred.
  27060. // Support: IE <=9 - 10 only
  27061. // Older IE sometimes signals "interactive" too soon
  27062. if (document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll) {
  27063. // Handle it asynchronously to allow scripts the opportunity to delay ready
  27064. window.setTimeout(jQuery.ready);
  27065. } else {
  27066. // Use the handy event callback
  27067. document.addEventListener("DOMContentLoaded", completed);
  27068. // A fallback to window.onload, that will always work
  27069. window.addEventListener("load", completed);
  27070. }
  27071. // Multifunctional method to get and set values of a collection
  27072. // The value/s can optionally be executed if it's a function
  27073. var access = function access(elems, fn, key, value, chainable, emptyGet, raw) {
  27074. var i = 0,
  27075. len = elems.length,
  27076. bulk = key == null;
  27077. // Sets many values
  27078. if (toType(key) === "object") {
  27079. chainable = true;
  27080. for (i in key) {
  27081. access(elems, fn, i, key[i], true, emptyGet, raw);
  27082. }
  27083. // Sets one value
  27084. } else if (value !== undefined) {
  27085. chainable = true;
  27086. if (!isFunction(value)) {
  27087. raw = true;
  27088. }
  27089. if (bulk) {
  27090. // Bulk operations run against the entire set
  27091. if (raw) {
  27092. fn.call(elems, value);
  27093. fn = null;
  27094. // ...except when executing function values
  27095. } else {
  27096. bulk = fn;
  27097. fn = function fn(elem, key, value) {
  27098. return bulk.call(jQuery(elem), value);
  27099. };
  27100. }
  27101. }
  27102. if (fn) {
  27103. for (; i < len; i++) {
  27104. fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
  27105. }
  27106. }
  27107. }
  27108. if (chainable) {
  27109. return elems;
  27110. }
  27111. // Gets
  27112. if (bulk) {
  27113. return fn.call(elems);
  27114. }
  27115. return len ? fn(elems[0], key) : emptyGet;
  27116. };
  27117. // Matches dashed string for camelizing
  27118. var rmsPrefix = /^-ms-/,
  27119. rdashAlpha = /-([a-z])/g;
  27120. // Used by camelCase as callback to replace()
  27121. function fcamelCase(all, letter) {
  27122. return letter.toUpperCase();
  27123. }
  27124. // Convert dashed to camelCase; used by the css and data modules
  27125. // Support: IE <=9 - 11, Edge 12 - 15
  27126. // Microsoft forgot to hump their vendor prefix (#9572)
  27127. function camelCase(string) {
  27128. return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
  27129. }
  27130. var acceptData = function acceptData(owner) {
  27131. // Accepts only:
  27132. // - Node
  27133. // - Node.ELEMENT_NODE
  27134. // - Node.DOCUMENT_NODE
  27135. // - Object
  27136. // - Any
  27137. return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
  27138. };
  27139. function Data() {
  27140. this.expando = jQuery.expando + Data.uid++;
  27141. }
  27142. Data.uid = 1;
  27143. Data.prototype = {
  27144. cache: function cache(owner) {
  27145. // Check if the owner object already has a cache
  27146. var value = owner[this.expando];
  27147. // If not, create one
  27148. if (!value) {
  27149. value = {};
  27150. // We can accept data for non-element nodes in modern browsers,
  27151. // but we should not, see #8335.
  27152. // Always return an empty object.
  27153. if (acceptData(owner)) {
  27154. // If it is a node unlikely to be stringify-ed or looped over
  27155. // use plain assignment
  27156. if (owner.nodeType) {
  27157. owner[this.expando] = value;
  27158. // Otherwise secure it in a non-enumerable property
  27159. // configurable must be true to allow the property to be
  27160. // deleted when data is removed
  27161. } else {
  27162. Object.defineProperty(owner, this.expando, {
  27163. value: value,
  27164. configurable: true
  27165. });
  27166. }
  27167. }
  27168. }
  27169. return value;
  27170. },
  27171. set: function set(owner, data, value) {
  27172. var prop,
  27173. cache = this.cache(owner);
  27174. // Handle: [ owner, key, value ] args
  27175. // Always use camelCase key (gh-2257)
  27176. if (typeof data === "string") {
  27177. cache[camelCase(data)] = value;
  27178. // Handle: [ owner, { properties } ] args
  27179. } else {
  27180. // Copy the properties one-by-one to the cache object
  27181. for (prop in data) {
  27182. cache[camelCase(prop)] = data[prop];
  27183. }
  27184. }
  27185. return cache;
  27186. },
  27187. get: function get(owner, key) {
  27188. return key === undefined ? this.cache(owner) :
  27189. // Always use camelCase key (gh-2257)
  27190. owner[this.expando] && owner[this.expando][camelCase(key)];
  27191. },
  27192. access: function access(owner, key, value) {
  27193. // In cases where either:
  27194. //
  27195. // 1. No key was specified
  27196. // 2. A string key was specified, but no value provided
  27197. //
  27198. // Take the "read" path and allow the get method to determine
  27199. // which value to return, respectively either:
  27200. //
  27201. // 1. The entire cache object
  27202. // 2. The data stored at the key
  27203. //
  27204. if (key === undefined || key && typeof key === "string" && value === undefined) {
  27205. return this.get(owner, key);
  27206. }
  27207. // When the key is not a string, or both a key and value
  27208. // are specified, set or extend (existing objects) with either:
  27209. //
  27210. // 1. An object of properties
  27211. // 2. A key and value
  27212. //
  27213. this.set(owner, key, value);
  27214. // Since the "set" path can have two possible entry points
  27215. // return the expected data based on which path was taken[*]
  27216. return value !== undefined ? value : key;
  27217. },
  27218. remove: function remove(owner, key) {
  27219. var i,
  27220. cache = owner[this.expando];
  27221. if (cache === undefined) {
  27222. return;
  27223. }
  27224. if (key !== undefined) {
  27225. // Support array or space separated string of keys
  27226. if (Array.isArray(key)) {
  27227. // If key is an array of keys...
  27228. // We always set camelCase keys, so remove that.
  27229. key = key.map(camelCase);
  27230. } else {
  27231. key = camelCase(key);
  27232. // If a key with the spaces exists, use it.
  27233. // Otherwise, create an array by matching non-whitespace
  27234. key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
  27235. }
  27236. i = key.length;
  27237. while (i--) {
  27238. delete cache[key[i]];
  27239. }
  27240. }
  27241. // Remove the expando if there's no more data
  27242. if (key === undefined || jQuery.isEmptyObject(cache)) {
  27243. // Support: Chrome <=35 - 45
  27244. // Webkit & Blink performance suffers when deleting properties
  27245. // from DOM nodes, so set to undefined instead
  27246. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  27247. if (owner.nodeType) {
  27248. owner[this.expando] = undefined;
  27249. } else {
  27250. delete owner[this.expando];
  27251. }
  27252. }
  27253. },
  27254. hasData: function hasData(owner) {
  27255. var cache = owner[this.expando];
  27256. return cache !== undefined && !jQuery.isEmptyObject(cache);
  27257. }
  27258. };
  27259. var dataPriv = new Data();
  27260. var dataUser = new Data();
  27261. // Implementation Summary
  27262. //
  27263. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  27264. // 2. Improve the module's maintainability by reducing the storage
  27265. // paths to a single mechanism.
  27266. // 3. Use the same single mechanism to support "private" and "user" data.
  27267. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  27268. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  27269. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  27270. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  27271. rmultiDash = /[A-Z]/g;
  27272. function getData(data) {
  27273. if (data === "true") {
  27274. return true;
  27275. }
  27276. if (data === "false") {
  27277. return false;
  27278. }
  27279. if (data === "null") {
  27280. return null;
  27281. }
  27282. // Only convert to a number if it doesn't change the string
  27283. if (data === +data + "") {
  27284. return +data;
  27285. }
  27286. if (rbrace.test(data)) {
  27287. return JSON.parse(data);
  27288. }
  27289. return data;
  27290. }
  27291. function dataAttr(elem, key, data) {
  27292. var name;
  27293. // If nothing was found internally, try to fetch any
  27294. // data from the HTML5 data-* attribute
  27295. if (data === undefined && elem.nodeType === 1) {
  27296. name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
  27297. data = elem.getAttribute(name);
  27298. if (typeof data === "string") {
  27299. try {
  27300. data = getData(data);
  27301. } catch (e) {}
  27302. // Make sure we set the data so it isn't changed later
  27303. dataUser.set(elem, key, data);
  27304. } else {
  27305. data = undefined;
  27306. }
  27307. }
  27308. return data;
  27309. }
  27310. jQuery.extend({
  27311. hasData: function hasData(elem) {
  27312. return dataUser.hasData(elem) || dataPriv.hasData(elem);
  27313. },
  27314. data: function data(elem, name, _data) {
  27315. return dataUser.access(elem, name, _data);
  27316. },
  27317. removeData: function removeData(elem, name) {
  27318. dataUser.remove(elem, name);
  27319. },
  27320. // TODO: Now that all calls to _data and _removeData have been replaced
  27321. // with direct calls to dataPriv methods, these can be deprecated.
  27322. _data: function _data(elem, name, data) {
  27323. return dataPriv.access(elem, name, data);
  27324. },
  27325. _removeData: function _removeData(elem, name) {
  27326. dataPriv.remove(elem, name);
  27327. }
  27328. });
  27329. jQuery.fn.extend({
  27330. data: function data(key, value) {
  27331. var i,
  27332. name,
  27333. data,
  27334. elem = this[0],
  27335. attrs = elem && elem.attributes;
  27336. // Gets all values
  27337. if (key === undefined) {
  27338. if (this.length) {
  27339. data = dataUser.get(elem);
  27340. if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
  27341. i = attrs.length;
  27342. while (i--) {
  27343. // Support: IE 11 only
  27344. // The attrs elements can be null (#14894)
  27345. if (attrs[i]) {
  27346. name = attrs[i].name;
  27347. if (name.indexOf("data-") === 0) {
  27348. name = camelCase(name.slice(5));
  27349. dataAttr(elem, name, data[name]);
  27350. }
  27351. }
  27352. }
  27353. dataPriv.set(elem, "hasDataAttrs", true);
  27354. }
  27355. }
  27356. return data;
  27357. }
  27358. // Sets multiple values
  27359. if ((typeof key === "undefined" ? "undefined" : _typeof(key)) === "object") {
  27360. return this.each(function () {
  27361. dataUser.set(this, key);
  27362. });
  27363. }
  27364. return access(this, function (value) {
  27365. var data;
  27366. // The calling jQuery object (element matches) is not empty
  27367. // (and therefore has an element appears at this[ 0 ]) and the
  27368. // `value` parameter was not undefined. An empty jQuery object
  27369. // will result in `undefined` for elem = this[ 0 ] which will
  27370. // throw an exception if an attempt to read a data cache is made.
  27371. if (elem && value === undefined) {
  27372. // Attempt to get data from the cache
  27373. // The key will always be camelCased in Data
  27374. data = dataUser.get(elem, key);
  27375. if (data !== undefined) {
  27376. return data;
  27377. }
  27378. // Attempt to "discover" the data in
  27379. // HTML5 custom data-* attrs
  27380. data = dataAttr(elem, key);
  27381. if (data !== undefined) {
  27382. return data;
  27383. }
  27384. // We tried really hard, but the data doesn't exist.
  27385. return;
  27386. }
  27387. // Set the data...
  27388. this.each(function () {
  27389. // We always store the camelCased key
  27390. dataUser.set(this, key, value);
  27391. });
  27392. }, null, value, arguments.length > 1, null, true);
  27393. },
  27394. removeData: function removeData(key) {
  27395. return this.each(function () {
  27396. dataUser.remove(this, key);
  27397. });
  27398. }
  27399. });
  27400. jQuery.extend({
  27401. queue: function queue(elem, type, data) {
  27402. var queue;
  27403. if (elem) {
  27404. type = (type || "fx") + "queue";
  27405. queue = dataPriv.get(elem, type);
  27406. // Speed up dequeue by getting out quickly if this is just a lookup
  27407. if (data) {
  27408. if (!queue || Array.isArray(data)) {
  27409. queue = dataPriv.access(elem, type, jQuery.makeArray(data));
  27410. } else {
  27411. queue.push(data);
  27412. }
  27413. }
  27414. return queue || [];
  27415. }
  27416. },
  27417. dequeue: function dequeue(elem, type) {
  27418. type = type || "fx";
  27419. var queue = jQuery.queue(elem, type),
  27420. startLength = queue.length,
  27421. fn = queue.shift(),
  27422. hooks = jQuery._queueHooks(elem, type),
  27423. next = function next() {
  27424. jQuery.dequeue(elem, type);
  27425. };
  27426. // If the fx queue is dequeued, always remove the progress sentinel
  27427. if (fn === "inprogress") {
  27428. fn = queue.shift();
  27429. startLength--;
  27430. }
  27431. if (fn) {
  27432. // Add a progress sentinel to prevent the fx queue from being
  27433. // automatically dequeued
  27434. if (type === "fx") {
  27435. queue.unshift("inprogress");
  27436. }
  27437. // Clear up the last queue stop function
  27438. delete hooks.stop;
  27439. fn.call(elem, next, hooks);
  27440. }
  27441. if (!startLength && hooks) {
  27442. hooks.empty.fire();
  27443. }
  27444. },
  27445. // Not public - generate a queueHooks object, or return the current one
  27446. _queueHooks: function _queueHooks(elem, type) {
  27447. var key = type + "queueHooks";
  27448. return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
  27449. empty: jQuery.Callbacks("once memory").add(function () {
  27450. dataPriv.remove(elem, [type + "queue", key]);
  27451. })
  27452. });
  27453. }
  27454. });
  27455. jQuery.fn.extend({
  27456. queue: function queue(type, data) {
  27457. var setter = 2;
  27458. if (typeof type !== "string") {
  27459. data = type;
  27460. type = "fx";
  27461. setter--;
  27462. }
  27463. if (arguments.length < setter) {
  27464. return jQuery.queue(this[0], type);
  27465. }
  27466. return data === undefined ? this : this.each(function () {
  27467. var queue = jQuery.queue(this, type, data);
  27468. // Ensure a hooks for this queue
  27469. jQuery._queueHooks(this, type);
  27470. if (type === "fx" && queue[0] !== "inprogress") {
  27471. jQuery.dequeue(this, type);
  27472. }
  27473. });
  27474. },
  27475. dequeue: function dequeue(type) {
  27476. return this.each(function () {
  27477. jQuery.dequeue(this, type);
  27478. });
  27479. },
  27480. clearQueue: function clearQueue(type) {
  27481. return this.queue(type || "fx", []);
  27482. },
  27483. // Get a promise resolved when queues of a certain type
  27484. // are emptied (fx is the type by default)
  27485. promise: function promise(type, obj) {
  27486. var tmp,
  27487. count = 1,
  27488. defer = jQuery.Deferred(),
  27489. elements = this,
  27490. i = this.length,
  27491. resolve = function resolve() {
  27492. if (! --count) {
  27493. defer.resolveWith(elements, [elements]);
  27494. }
  27495. };
  27496. if (typeof type !== "string") {
  27497. obj = type;
  27498. type = undefined;
  27499. }
  27500. type = type || "fx";
  27501. while (i--) {
  27502. tmp = dataPriv.get(elements[i], type + "queueHooks");
  27503. if (tmp && tmp.empty) {
  27504. count++;
  27505. tmp.empty.add(resolve);
  27506. }
  27507. }
  27508. resolve();
  27509. return defer.promise(obj);
  27510. }
  27511. });
  27512. var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
  27513. var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
  27514. var cssExpand = ["Top", "Right", "Bottom", "Left"];
  27515. var isHiddenWithinTree = function isHiddenWithinTree(elem, el) {
  27516. // isHiddenWithinTree might be called from jQuery#filter function;
  27517. // in that case, element will be second argument
  27518. elem = el || elem;
  27519. // Inline style trumps all
  27520. return elem.style.display === "none" || elem.style.display === "" &&
  27521. // Otherwise, check computed style
  27522. // Support: Firefox <=43 - 45
  27523. // Disconnected elements can have computed display: none, so first confirm that elem is
  27524. // in the document.
  27525. jQuery.contains(elem.ownerDocument, elem) && jQuery.css(elem, "display") === "none";
  27526. };
  27527. var swap = function swap(elem, options, callback, args) {
  27528. var ret,
  27529. name,
  27530. old = {};
  27531. // Remember the old values, and insert the new ones
  27532. for (name in options) {
  27533. old[name] = elem.style[name];
  27534. elem.style[name] = options[name];
  27535. }
  27536. ret = callback.apply(elem, args || []);
  27537. // Revert the old values
  27538. for (name in options) {
  27539. elem.style[name] = old[name];
  27540. }
  27541. return ret;
  27542. };
  27543. function adjustCSS(elem, prop, valueParts, tween) {
  27544. var adjusted,
  27545. scale,
  27546. maxIterations = 20,
  27547. currentValue = tween ? function () {
  27548. return tween.cur();
  27549. } : function () {
  27550. return jQuery.css(elem, prop, "");
  27551. },
  27552. initial = currentValue(),
  27553. unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
  27554. // Starting value computation is required for potential unit mismatches
  27555. initialInUnit = (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));
  27556. if (initialInUnit && initialInUnit[3] !== unit) {
  27557. // Support: Firefox <=54
  27558. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  27559. initial = initial / 2;
  27560. // Trust units reported by jQuery.css
  27561. unit = unit || initialInUnit[3];
  27562. // Iteratively approximate from a nonzero starting point
  27563. initialInUnit = +initial || 1;
  27564. while (maxIterations--) {
  27565. // Evaluate and update our best guess (doubling guesses that zero out).
  27566. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  27567. jQuery.style(elem, prop, initialInUnit + unit);
  27568. if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
  27569. maxIterations = 0;
  27570. }
  27571. initialInUnit = initialInUnit / scale;
  27572. }
  27573. initialInUnit = initialInUnit * 2;
  27574. jQuery.style(elem, prop, initialInUnit + unit);
  27575. // Make sure we update the tween properties later on
  27576. valueParts = valueParts || [];
  27577. }
  27578. if (valueParts) {
  27579. initialInUnit = +initialInUnit || +initial || 0;
  27580. // Apply relative offset (+=/-=) if specified
  27581. adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
  27582. if (tween) {
  27583. tween.unit = unit;
  27584. tween.start = initialInUnit;
  27585. tween.end = adjusted;
  27586. }
  27587. }
  27588. return adjusted;
  27589. }
  27590. var defaultDisplayMap = {};
  27591. function getDefaultDisplay(elem) {
  27592. var temp,
  27593. doc = elem.ownerDocument,
  27594. nodeName = elem.nodeName,
  27595. display = defaultDisplayMap[nodeName];
  27596. if (display) {
  27597. return display;
  27598. }
  27599. temp = doc.body.appendChild(doc.createElement(nodeName));
  27600. display = jQuery.css(temp, "display");
  27601. temp.parentNode.removeChild(temp);
  27602. if (display === "none") {
  27603. display = "block";
  27604. }
  27605. defaultDisplayMap[nodeName] = display;
  27606. return display;
  27607. }
  27608. function showHide(elements, show) {
  27609. var display,
  27610. elem,
  27611. values = [],
  27612. index = 0,
  27613. length = elements.length;
  27614. // Determine new display value for elements that need to change
  27615. for (; index < length; index++) {
  27616. elem = elements[index];
  27617. if (!elem.style) {
  27618. continue;
  27619. }
  27620. display = elem.style.display;
  27621. if (show) {
  27622. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  27623. // check is required in this first loop unless we have a nonempty display value (either
  27624. // inline or about-to-be-restored)
  27625. if (display === "none") {
  27626. values[index] = dataPriv.get(elem, "display") || null;
  27627. if (!values[index]) {
  27628. elem.style.display = "";
  27629. }
  27630. }
  27631. if (elem.style.display === "" && isHiddenWithinTree(elem)) {
  27632. values[index] = getDefaultDisplay(elem);
  27633. }
  27634. } else {
  27635. if (display !== "none") {
  27636. values[index] = "none";
  27637. // Remember what we're overwriting
  27638. dataPriv.set(elem, "display", display);
  27639. }
  27640. }
  27641. }
  27642. // Set the display of the elements in a second loop to avoid constant reflow
  27643. for (index = 0; index < length; index++) {
  27644. if (values[index] != null) {
  27645. elements[index].style.display = values[index];
  27646. }
  27647. }
  27648. return elements;
  27649. }
  27650. jQuery.fn.extend({
  27651. show: function show() {
  27652. return showHide(this, true);
  27653. },
  27654. hide: function hide() {
  27655. return showHide(this);
  27656. },
  27657. toggle: function toggle(state) {
  27658. if (typeof state === "boolean") {
  27659. return state ? this.show() : this.hide();
  27660. }
  27661. return this.each(function () {
  27662. if (isHiddenWithinTree(this)) {
  27663. jQuery(this).show();
  27664. } else {
  27665. jQuery(this).hide();
  27666. }
  27667. });
  27668. }
  27669. });
  27670. var rcheckableType = /^(?:checkbox|radio)$/i;
  27671. var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i;
  27672. var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
  27673. // We have to close these tags to support XHTML (#13200)
  27674. var wrapMap = {
  27675. // Support: IE <=9 only
  27676. option: [1, "<select multiple='multiple'>", "</select>"],
  27677. // XHTML parsers do not magically insert elements in the
  27678. // same way that tag soup parsers do. So we cannot shorten
  27679. // this by omitting <tbody> or other required elements.
  27680. thead: [1, "<table>", "</table>"],
  27681. col: [2, "<table><colgroup>", "</colgroup></table>"],
  27682. tr: [2, "<table><tbody>", "</tbody></table>"],
  27683. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  27684. _default: [0, "", ""]
  27685. };
  27686. // Support: IE <=9 only
  27687. wrapMap.optgroup = wrapMap.option;
  27688. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  27689. wrapMap.th = wrapMap.td;
  27690. function getAll(context, tag) {
  27691. // Support: IE <=9 - 11 only
  27692. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  27693. var ret;
  27694. if (typeof context.getElementsByTagName !== "undefined") {
  27695. ret = context.getElementsByTagName(tag || "*");
  27696. } else if (typeof context.querySelectorAll !== "undefined") {
  27697. ret = context.querySelectorAll(tag || "*");
  27698. } else {
  27699. ret = [];
  27700. }
  27701. if (tag === undefined || tag && nodeName(context, tag)) {
  27702. return jQuery.merge([context], ret);
  27703. }
  27704. return ret;
  27705. }
  27706. // Mark scripts as having already been evaluated
  27707. function setGlobalEval(elems, refElements) {
  27708. var i = 0,
  27709. l = elems.length;
  27710. for (; i < l; i++) {
  27711. dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval"));
  27712. }
  27713. }
  27714. var rhtml = /<|&#?\w+;/;
  27715. function buildFragment(elems, context, scripts, selection, ignored) {
  27716. var elem,
  27717. tmp,
  27718. tag,
  27719. wrap,
  27720. contains,
  27721. j,
  27722. fragment = context.createDocumentFragment(),
  27723. nodes = [],
  27724. i = 0,
  27725. l = elems.length;
  27726. for (; i < l; i++) {
  27727. elem = elems[i];
  27728. if (elem || elem === 0) {
  27729. // Add nodes directly
  27730. if (toType(elem) === "object") {
  27731. // Support: Android <=4.0 only, PhantomJS 1 only
  27732. // push.apply(_, arraylike) throws on ancient WebKit
  27733. jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
  27734. // Convert non-html into a text node
  27735. } else if (!rhtml.test(elem)) {
  27736. nodes.push(context.createTextNode(elem));
  27737. // Convert html into DOM nodes
  27738. } else {
  27739. tmp = tmp || fragment.appendChild(context.createElement("div"));
  27740. // Deserialize a standard representation
  27741. tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
  27742. wrap = wrapMap[tag] || wrapMap._default;
  27743. tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
  27744. // Descend through wrappers to the right content
  27745. j = wrap[0];
  27746. while (j--) {
  27747. tmp = tmp.lastChild;
  27748. }
  27749. // Support: Android <=4.0 only, PhantomJS 1 only
  27750. // push.apply(_, arraylike) throws on ancient WebKit
  27751. jQuery.merge(nodes, tmp.childNodes);
  27752. // Remember the top-level container
  27753. tmp = fragment.firstChild;
  27754. // Ensure the created nodes are orphaned (#12392)
  27755. tmp.textContent = "";
  27756. }
  27757. }
  27758. }
  27759. // Remove wrapper from fragment
  27760. fragment.textContent = "";
  27761. i = 0;
  27762. while (elem = nodes[i++]) {
  27763. // Skip elements already in the context collection (trac-4087)
  27764. if (selection && jQuery.inArray(elem, selection) > -1) {
  27765. if (ignored) {
  27766. ignored.push(elem);
  27767. }
  27768. continue;
  27769. }
  27770. contains = jQuery.contains(elem.ownerDocument, elem);
  27771. // Append to fragment
  27772. tmp = getAll(fragment.appendChild(elem), "script");
  27773. // Preserve script evaluation history
  27774. if (contains) {
  27775. setGlobalEval(tmp);
  27776. }
  27777. // Capture executables
  27778. if (scripts) {
  27779. j = 0;
  27780. while (elem = tmp[j++]) {
  27781. if (rscriptType.test(elem.type || "")) {
  27782. scripts.push(elem);
  27783. }
  27784. }
  27785. }
  27786. }
  27787. return fragment;
  27788. }
  27789. (function () {
  27790. var fragment = document.createDocumentFragment(),
  27791. div = fragment.appendChild(document.createElement("div")),
  27792. input = document.createElement("input");
  27793. // Support: Android 4.0 - 4.3 only
  27794. // Check state lost if the name is set (#11217)
  27795. // Support: Windows Web Apps (WWA)
  27796. // `name` and `type` must use .setAttribute for WWA (#14901)
  27797. input.setAttribute("type", "radio");
  27798. input.setAttribute("checked", "checked");
  27799. input.setAttribute("name", "t");
  27800. div.appendChild(input);
  27801. // Support: Android <=4.1 only
  27802. // Older WebKit doesn't clone checked state correctly in fragments
  27803. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  27804. // Support: IE <=11 only
  27805. // Make sure textarea (and checkbox) defaultValue is properly cloned
  27806. div.innerHTML = "<textarea>x</textarea>";
  27807. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  27808. })();
  27809. var documentElement = document.documentElement;
  27810. var rkeyEvent = /^key/,
  27811. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  27812. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  27813. function returnTrue() {
  27814. return true;
  27815. }
  27816. function returnFalse() {
  27817. return false;
  27818. }
  27819. // Support: IE <=9 only
  27820. // See #13393 for more info
  27821. function safeActiveElement() {
  27822. try {
  27823. return document.activeElement;
  27824. } catch (err) {}
  27825. }
  27826. function _on(elem, types, selector, data, fn, one) {
  27827. var origFn, type;
  27828. // Types can be a map of types/handlers
  27829. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  27830. // ( types-Object, selector, data )
  27831. if (typeof selector !== "string") {
  27832. // ( types-Object, data )
  27833. data = data || selector;
  27834. selector = undefined;
  27835. }
  27836. for (type in types) {
  27837. _on(elem, type, selector, data, types[type], one);
  27838. }
  27839. return elem;
  27840. }
  27841. if (data == null && fn == null) {
  27842. // ( types, fn )
  27843. fn = selector;
  27844. data = selector = undefined;
  27845. } else if (fn == null) {
  27846. if (typeof selector === "string") {
  27847. // ( types, selector, fn )
  27848. fn = data;
  27849. data = undefined;
  27850. } else {
  27851. // ( types, data, fn )
  27852. fn = data;
  27853. data = selector;
  27854. selector = undefined;
  27855. }
  27856. }
  27857. if (fn === false) {
  27858. fn = returnFalse;
  27859. } else if (!fn) {
  27860. return elem;
  27861. }
  27862. if (one === 1) {
  27863. origFn = fn;
  27864. fn = function fn(event) {
  27865. // Can use an empty set, since event contains the info
  27866. jQuery().off(event);
  27867. return origFn.apply(this, arguments);
  27868. };
  27869. // Use same guid so caller can remove using origFn
  27870. fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
  27871. }
  27872. return elem.each(function () {
  27873. jQuery.event.add(this, types, fn, data, selector);
  27874. });
  27875. }
  27876. /*
  27877. * Helper functions for managing events -- not part of the public interface.
  27878. * Props to Dean Edwards' addEvent library for many of the ideas.
  27879. */
  27880. jQuery.event = {
  27881. global: {},
  27882. add: function add(elem, types, handler, data, selector) {
  27883. var handleObjIn,
  27884. eventHandle,
  27885. tmp,
  27886. events,
  27887. t,
  27888. handleObj,
  27889. special,
  27890. handlers,
  27891. type,
  27892. namespaces,
  27893. origType,
  27894. elemData = dataPriv.get(elem);
  27895. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  27896. if (!elemData) {
  27897. return;
  27898. }
  27899. // Caller can pass in an object of custom data in lieu of the handler
  27900. if (handler.handler) {
  27901. handleObjIn = handler;
  27902. handler = handleObjIn.handler;
  27903. selector = handleObjIn.selector;
  27904. }
  27905. // Ensure that invalid selectors throw exceptions at attach time
  27906. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  27907. if (selector) {
  27908. jQuery.find.matchesSelector(documentElement, selector);
  27909. }
  27910. // Make sure that the handler has a unique ID, used to find/remove it later
  27911. if (!handler.guid) {
  27912. handler.guid = jQuery.guid++;
  27913. }
  27914. // Init the element's event structure and main handler, if this is the first
  27915. if (!(events = elemData.events)) {
  27916. events = elemData.events = {};
  27917. }
  27918. if (!(eventHandle = elemData.handle)) {
  27919. eventHandle = elemData.handle = function (e) {
  27920. // Discard the second event of a jQuery.event.trigger() and
  27921. // when an event is called after a page has unloaded
  27922. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;
  27923. };
  27924. }
  27925. // Handle multiple events separated by a space
  27926. types = (types || "").match(rnothtmlwhite) || [""];
  27927. t = types.length;
  27928. while (t--) {
  27929. tmp = rtypenamespace.exec(types[t]) || [];
  27930. type = origType = tmp[1];
  27931. namespaces = (tmp[2] || "").split(".").sort();
  27932. // There *must* be a type, no attaching namespace-only handlers
  27933. if (!type) {
  27934. continue;
  27935. }
  27936. // If event changes its type, use the special event handlers for the changed type
  27937. special = jQuery.event.special[type] || {};
  27938. // If selector defined, determine special event api type, otherwise given type
  27939. type = (selector ? special.delegateType : special.bindType) || type;
  27940. // Update special based on newly reset type
  27941. special = jQuery.event.special[type] || {};
  27942. // handleObj is passed to all event handlers
  27943. handleObj = jQuery.extend({
  27944. type: type,
  27945. origType: origType,
  27946. data: data,
  27947. handler: handler,
  27948. guid: handler.guid,
  27949. selector: selector,
  27950. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  27951. namespace: namespaces.join(".")
  27952. }, handleObjIn);
  27953. // Init the event handler queue if we're the first
  27954. if (!(handlers = events[type])) {
  27955. handlers = events[type] = [];
  27956. handlers.delegateCount = 0;
  27957. // Only use addEventListener if the special events handler returns false
  27958. if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
  27959. if (elem.addEventListener) {
  27960. elem.addEventListener(type, eventHandle);
  27961. }
  27962. }
  27963. }
  27964. if (special.add) {
  27965. special.add.call(elem, handleObj);
  27966. if (!handleObj.handler.guid) {
  27967. handleObj.handler.guid = handler.guid;
  27968. }
  27969. }
  27970. // Add to the element's handler list, delegates in front
  27971. if (selector) {
  27972. handlers.splice(handlers.delegateCount++, 0, handleObj);
  27973. } else {
  27974. handlers.push(handleObj);
  27975. }
  27976. // Keep track of which events have ever been used, for event optimization
  27977. jQuery.event.global[type] = true;
  27978. }
  27979. },
  27980. // Detach an event or set of events from an element
  27981. remove: function remove(elem, types, handler, selector, mappedTypes) {
  27982. var j,
  27983. origCount,
  27984. tmp,
  27985. events,
  27986. t,
  27987. handleObj,
  27988. special,
  27989. handlers,
  27990. type,
  27991. namespaces,
  27992. origType,
  27993. elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
  27994. if (!elemData || !(events = elemData.events)) {
  27995. return;
  27996. }
  27997. // Once for each type.namespace in types; type may be omitted
  27998. types = (types || "").match(rnothtmlwhite) || [""];
  27999. t = types.length;
  28000. while (t--) {
  28001. tmp = rtypenamespace.exec(types[t]) || [];
  28002. type = origType = tmp[1];
  28003. namespaces = (tmp[2] || "").split(".").sort();
  28004. // Unbind all events (on this namespace, if provided) for the element
  28005. if (!type) {
  28006. for (type in events) {
  28007. jQuery.event.remove(elem, type + types[t], handler, selector, true);
  28008. }
  28009. continue;
  28010. }
  28011. special = jQuery.event.special[type] || {};
  28012. type = (selector ? special.delegateType : special.bindType) || type;
  28013. handlers = events[type] || [];
  28014. tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
  28015. // Remove matching events
  28016. origCount = j = handlers.length;
  28017. while (j--) {
  28018. handleObj = handlers[j];
  28019. if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
  28020. handlers.splice(j, 1);
  28021. if (handleObj.selector) {
  28022. handlers.delegateCount--;
  28023. }
  28024. if (special.remove) {
  28025. special.remove.call(elem, handleObj);
  28026. }
  28027. }
  28028. }
  28029. // Remove generic event handler if we removed something and no more handlers exist
  28030. // (avoids potential for endless recursion during removal of special event handlers)
  28031. if (origCount && !handlers.length) {
  28032. if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
  28033. jQuery.removeEvent(elem, type, elemData.handle);
  28034. }
  28035. delete events[type];
  28036. }
  28037. }
  28038. // Remove data and the expando if it's no longer used
  28039. if (jQuery.isEmptyObject(events)) {
  28040. dataPriv.remove(elem, "handle events");
  28041. }
  28042. },
  28043. dispatch: function dispatch(nativeEvent) {
  28044. // Make a writable jQuery.Event from the native event object
  28045. var event = jQuery.event.fix(nativeEvent);
  28046. var i,
  28047. j,
  28048. ret,
  28049. matched,
  28050. handleObj,
  28051. handlerQueue,
  28052. args = new Array(arguments.length),
  28053. handlers = (dataPriv.get(this, "events") || {})[event.type] || [],
  28054. special = jQuery.event.special[event.type] || {};
  28055. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  28056. args[0] = event;
  28057. for (i = 1; i < arguments.length; i++) {
  28058. args[i] = arguments[i];
  28059. }
  28060. event.delegateTarget = this;
  28061. // Call the preDispatch hook for the mapped type, and let it bail if desired
  28062. if (special.preDispatch && special.preDispatch.call(this, event) === false) {
  28063. return;
  28064. }
  28065. // Determine handlers
  28066. handlerQueue = jQuery.event.handlers.call(this, event, handlers);
  28067. // Run delegates first; they may want to stop propagation beneath us
  28068. i = 0;
  28069. while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
  28070. event.currentTarget = matched.elem;
  28071. j = 0;
  28072. while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
  28073. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  28074. // a subset or equal to those in the bound event (both can have no namespace).
  28075. if (!event.rnamespace || event.rnamespace.test(handleObj.namespace)) {
  28076. event.handleObj = handleObj;
  28077. event.data = handleObj.data;
  28078. ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
  28079. if (ret !== undefined) {
  28080. if ((event.result = ret) === false) {
  28081. event.preventDefault();
  28082. event.stopPropagation();
  28083. }
  28084. }
  28085. }
  28086. }
  28087. }
  28088. // Call the postDispatch hook for the mapped type
  28089. if (special.postDispatch) {
  28090. special.postDispatch.call(this, event);
  28091. }
  28092. return event.result;
  28093. },
  28094. handlers: function handlers(event, _handlers) {
  28095. var i,
  28096. handleObj,
  28097. sel,
  28098. matchedHandlers,
  28099. matchedSelectors,
  28100. handlerQueue = [],
  28101. delegateCount = _handlers.delegateCount,
  28102. cur = event.target;
  28103. // Find delegate handlers
  28104. if (delegateCount &&
  28105. // Support: IE <=9
  28106. // Black-hole SVG <use> instance trees (trac-13180)
  28107. cur.nodeType &&
  28108. // Support: Firefox <=42
  28109. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  28110. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  28111. // Support: IE 11 only
  28112. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  28113. !(event.type === "click" && event.button >= 1)) {
  28114. for (; cur !== this; cur = cur.parentNode || this) {
  28115. // Don't check non-elements (#13208)
  28116. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  28117. if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) {
  28118. matchedHandlers = [];
  28119. matchedSelectors = {};
  28120. for (i = 0; i < delegateCount; i++) {
  28121. handleObj = _handlers[i];
  28122. // Don't conflict with Object.prototype properties (#13203)
  28123. sel = handleObj.selector + " ";
  28124. if (matchedSelectors[sel] === undefined) {
  28125. matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
  28126. }
  28127. if (matchedSelectors[sel]) {
  28128. matchedHandlers.push(handleObj);
  28129. }
  28130. }
  28131. if (matchedHandlers.length) {
  28132. handlerQueue.push({ elem: cur, handlers: matchedHandlers });
  28133. }
  28134. }
  28135. }
  28136. }
  28137. // Add the remaining (directly-bound) handlers
  28138. cur = this;
  28139. if (delegateCount < _handlers.length) {
  28140. handlerQueue.push({ elem: cur, handlers: _handlers.slice(delegateCount) });
  28141. }
  28142. return handlerQueue;
  28143. },
  28144. addProp: function addProp(name, hook) {
  28145. Object.defineProperty(jQuery.Event.prototype, name, {
  28146. enumerable: true,
  28147. configurable: true,
  28148. get: isFunction(hook) ? function () {
  28149. if (this.originalEvent) {
  28150. return hook(this.originalEvent);
  28151. }
  28152. } : function () {
  28153. if (this.originalEvent) {
  28154. return this.originalEvent[name];
  28155. }
  28156. },
  28157. set: function set(value) {
  28158. Object.defineProperty(this, name, {
  28159. enumerable: true,
  28160. configurable: true,
  28161. writable: true,
  28162. value: value
  28163. });
  28164. }
  28165. });
  28166. },
  28167. fix: function fix(originalEvent) {
  28168. return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
  28169. },
  28170. special: {
  28171. load: {
  28172. // Prevent triggered image.load events from bubbling to window.load
  28173. noBubble: true
  28174. },
  28175. focus: {
  28176. // Fire native event if possible so blur/focus sequence is correct
  28177. trigger: function trigger() {
  28178. if (this !== safeActiveElement() && this.focus) {
  28179. this.focus();
  28180. return false;
  28181. }
  28182. },
  28183. delegateType: "focusin"
  28184. },
  28185. blur: {
  28186. trigger: function trigger() {
  28187. if (this === safeActiveElement() && this.blur) {
  28188. this.blur();
  28189. return false;
  28190. }
  28191. },
  28192. delegateType: "focusout"
  28193. },
  28194. click: {
  28195. // For checkbox, fire native event so checked state will be right
  28196. trigger: function trigger() {
  28197. if (this.type === "checkbox" && this.click && nodeName(this, "input")) {
  28198. this.click();
  28199. return false;
  28200. }
  28201. },
  28202. // For cross-browser consistency, don't fire native .click() on links
  28203. _default: function _default(event) {
  28204. return nodeName(event.target, "a");
  28205. }
  28206. },
  28207. beforeunload: {
  28208. postDispatch: function postDispatch(event) {
  28209. // Support: Firefox 20+
  28210. // Firefox doesn't alert if the returnValue field is not set.
  28211. if (event.result !== undefined && event.originalEvent) {
  28212. event.originalEvent.returnValue = event.result;
  28213. }
  28214. }
  28215. }
  28216. }
  28217. };
  28218. jQuery.removeEvent = function (elem, type, handle) {
  28219. // This "if" is needed for plain objects
  28220. if (elem.removeEventListener) {
  28221. elem.removeEventListener(type, handle);
  28222. }
  28223. };
  28224. jQuery.Event = function (src, props) {
  28225. // Allow instantiation without the 'new' keyword
  28226. if (!(this instanceof jQuery.Event)) {
  28227. return new jQuery.Event(src, props);
  28228. }
  28229. // Event object
  28230. if (src && src.type) {
  28231. this.originalEvent = src;
  28232. this.type = src.type;
  28233. // Events bubbling up the document may have been marked as prevented
  28234. // by a handler lower down the tree; reflect the correct value.
  28235. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined &&
  28236. // Support: Android <=2.3 only
  28237. src.returnValue === false ? returnTrue : returnFalse;
  28238. // Create target properties
  28239. // Support: Safari <=6 - 7 only
  28240. // Target should not be a text node (#504, #13143)
  28241. this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
  28242. this.currentTarget = src.currentTarget;
  28243. this.relatedTarget = src.relatedTarget;
  28244. // Event type
  28245. } else {
  28246. this.type = src;
  28247. }
  28248. // Put explicitly provided properties onto the event object
  28249. if (props) {
  28250. jQuery.extend(this, props);
  28251. }
  28252. // Create a timestamp if incoming event doesn't have one
  28253. this.timeStamp = src && src.timeStamp || Date.now();
  28254. // Mark it as fixed
  28255. this[jQuery.expando] = true;
  28256. };
  28257. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  28258. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  28259. jQuery.Event.prototype = {
  28260. constructor: jQuery.Event,
  28261. isDefaultPrevented: returnFalse,
  28262. isPropagationStopped: returnFalse,
  28263. isImmediatePropagationStopped: returnFalse,
  28264. isSimulated: false,
  28265. preventDefault: function preventDefault() {
  28266. var e = this.originalEvent;
  28267. this.isDefaultPrevented = returnTrue;
  28268. if (e && !this.isSimulated) {
  28269. e.preventDefault();
  28270. }
  28271. },
  28272. stopPropagation: function stopPropagation() {
  28273. var e = this.originalEvent;
  28274. this.isPropagationStopped = returnTrue;
  28275. if (e && !this.isSimulated) {
  28276. e.stopPropagation();
  28277. }
  28278. },
  28279. stopImmediatePropagation: function stopImmediatePropagation() {
  28280. var e = this.originalEvent;
  28281. this.isImmediatePropagationStopped = returnTrue;
  28282. if (e && !this.isSimulated) {
  28283. e.stopImmediatePropagation();
  28284. }
  28285. this.stopPropagation();
  28286. }
  28287. };
  28288. // Includes all common event props including KeyEvent and MouseEvent specific props
  28289. jQuery.each({
  28290. altKey: true,
  28291. bubbles: true,
  28292. cancelable: true,
  28293. changedTouches: true,
  28294. ctrlKey: true,
  28295. detail: true,
  28296. eventPhase: true,
  28297. metaKey: true,
  28298. pageX: true,
  28299. pageY: true,
  28300. shiftKey: true,
  28301. view: true,
  28302. "char": true,
  28303. charCode: true,
  28304. key: true,
  28305. keyCode: true,
  28306. button: true,
  28307. buttons: true,
  28308. clientX: true,
  28309. clientY: true,
  28310. offsetX: true,
  28311. offsetY: true,
  28312. pointerId: true,
  28313. pointerType: true,
  28314. screenX: true,
  28315. screenY: true,
  28316. targetTouches: true,
  28317. toElement: true,
  28318. touches: true,
  28319. which: function which(event) {
  28320. var button = event.button;
  28321. // Add which for key events
  28322. if (event.which == null && rkeyEvent.test(event.type)) {
  28323. return event.charCode != null ? event.charCode : event.keyCode;
  28324. }
  28325. // Add which for click: 1 === left; 2 === middle; 3 === right
  28326. if (!event.which && button !== undefined && rmouseEvent.test(event.type)) {
  28327. if (button & 1) {
  28328. return 1;
  28329. }
  28330. if (button & 2) {
  28331. return 3;
  28332. }
  28333. if (button & 4) {
  28334. return 2;
  28335. }
  28336. return 0;
  28337. }
  28338. return event.which;
  28339. }
  28340. }, jQuery.event.addProp);
  28341. // Create mouseenter/leave events using mouseover/out and event-time checks
  28342. // so that event delegation works in jQuery.
  28343. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  28344. //
  28345. // Support: Safari 7 only
  28346. // Safari sends mouseenter too often; see:
  28347. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  28348. // for the description of the bug (it existed in older Chrome versions as well).
  28349. jQuery.each({
  28350. mouseenter: "mouseover",
  28351. mouseleave: "mouseout",
  28352. pointerenter: "pointerover",
  28353. pointerleave: "pointerout"
  28354. }, function (orig, fix) {
  28355. jQuery.event.special[orig] = {
  28356. delegateType: fix,
  28357. bindType: fix,
  28358. handle: function handle(event) {
  28359. var ret,
  28360. target = this,
  28361. related = event.relatedTarget,
  28362. handleObj = event.handleObj;
  28363. // For mouseenter/leave call the handler if related is outside the target.
  28364. // NB: No relatedTarget if the mouse left/entered the browser window
  28365. if (!related || related !== target && !jQuery.contains(target, related)) {
  28366. event.type = handleObj.origType;
  28367. ret = handleObj.handler.apply(this, arguments);
  28368. event.type = fix;
  28369. }
  28370. return ret;
  28371. }
  28372. };
  28373. });
  28374. jQuery.fn.extend({
  28375. on: function on(types, selector, data, fn) {
  28376. return _on(this, types, selector, data, fn);
  28377. },
  28378. one: function one(types, selector, data, fn) {
  28379. return _on(this, types, selector, data, fn, 1);
  28380. },
  28381. off: function off(types, selector, fn) {
  28382. var handleObj, type;
  28383. if (types && types.preventDefault && types.handleObj) {
  28384. // ( event ) dispatched jQuery.Event
  28385. handleObj = types.handleObj;
  28386. jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
  28387. return this;
  28388. }
  28389. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  28390. // ( types-object [, selector] )
  28391. for (type in types) {
  28392. this.off(type, selector, types[type]);
  28393. }
  28394. return this;
  28395. }
  28396. if (selector === false || typeof selector === "function") {
  28397. // ( types [, fn] )
  28398. fn = selector;
  28399. selector = undefined;
  28400. }
  28401. if (fn === false) {
  28402. fn = returnFalse;
  28403. }
  28404. return this.each(function () {
  28405. jQuery.event.remove(this, types, fn, selector);
  28406. });
  28407. }
  28408. });
  28409. var
  28410. /* eslint-disable max-len */
  28411. // See https://github.com/eslint/eslint/issues/3229
  28412. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  28413. /* eslint-enable */
  28414. // Support: IE <=10 - 11, Edge 12 - 13 only
  28415. // In IE/Edge using regex groups here causes severe slowdowns.
  28416. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  28417. rnoInnerhtml = /<script|<style|<link/i,
  28418. // checked="checked" or checked
  28419. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  28420. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  28421. // Prefer a tbody over its parent table for containing new rows
  28422. function manipulationTarget(elem, content) {
  28423. if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
  28424. return jQuery(elem).children("tbody")[0] || elem;
  28425. }
  28426. return elem;
  28427. }
  28428. // Replace/restore the type attribute of script elements for safe DOM manipulation
  28429. function disableScript(elem) {
  28430. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  28431. return elem;
  28432. }
  28433. function restoreScript(elem) {
  28434. if ((elem.type || "").slice(0, 5) === "true/") {
  28435. elem.type = elem.type.slice(5);
  28436. } else {
  28437. elem.removeAttribute("type");
  28438. }
  28439. return elem;
  28440. }
  28441. function cloneCopyEvent(src, dest) {
  28442. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  28443. if (dest.nodeType !== 1) {
  28444. return;
  28445. }
  28446. // 1. Copy private data: events, handlers, etc.
  28447. if (dataPriv.hasData(src)) {
  28448. pdataOld = dataPriv.access(src);
  28449. pdataCur = dataPriv.set(dest, pdataOld);
  28450. events = pdataOld.events;
  28451. if (events) {
  28452. delete pdataCur.handle;
  28453. pdataCur.events = {};
  28454. for (type in events) {
  28455. for (i = 0, l = events[type].length; i < l; i++) {
  28456. jQuery.event.add(dest, type, events[type][i]);
  28457. }
  28458. }
  28459. }
  28460. }
  28461. // 2. Copy user data
  28462. if (dataUser.hasData(src)) {
  28463. udataOld = dataUser.access(src);
  28464. udataCur = jQuery.extend({}, udataOld);
  28465. dataUser.set(dest, udataCur);
  28466. }
  28467. }
  28468. // Fix IE bugs, see support tests
  28469. function fixInput(src, dest) {
  28470. var nodeName = dest.nodeName.toLowerCase();
  28471. // Fails to persist the checked state of a cloned checkbox or radio button.
  28472. if (nodeName === "input" && rcheckableType.test(src.type)) {
  28473. dest.checked = src.checked;
  28474. // Fails to return the selected option to the default selected state when cloning options
  28475. } else if (nodeName === "input" || nodeName === "textarea") {
  28476. dest.defaultValue = src.defaultValue;
  28477. }
  28478. }
  28479. function domManip(collection, args, callback, ignored) {
  28480. // Flatten any nested arrays
  28481. args = concat.apply([], args);
  28482. var fragment,
  28483. first,
  28484. scripts,
  28485. hasScripts,
  28486. node,
  28487. doc,
  28488. i = 0,
  28489. l = collection.length,
  28490. iNoClone = l - 1,
  28491. value = args[0],
  28492. valueIsFunction = isFunction(value);
  28493. // We can't cloneNode fragments that contain checked, in WebKit
  28494. if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
  28495. return collection.each(function (index) {
  28496. var self = collection.eq(index);
  28497. if (valueIsFunction) {
  28498. args[0] = value.call(this, index, self.html());
  28499. }
  28500. domManip(self, args, callback, ignored);
  28501. });
  28502. }
  28503. if (l) {
  28504. fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
  28505. first = fragment.firstChild;
  28506. if (fragment.childNodes.length === 1) {
  28507. fragment = first;
  28508. }
  28509. // Require either new content or an interest in ignored elements to invoke the callback
  28510. if (first || ignored) {
  28511. scripts = jQuery.map(getAll(fragment, "script"), disableScript);
  28512. hasScripts = scripts.length;
  28513. // Use the original fragment for the last item
  28514. // instead of the first because it can end up
  28515. // being emptied incorrectly in certain situations (#8070).
  28516. for (; i < l; i++) {
  28517. node = fragment;
  28518. if (i !== iNoClone) {
  28519. node = jQuery.clone(node, true, true);
  28520. // Keep references to cloned scripts for later restoration
  28521. if (hasScripts) {
  28522. // Support: Android <=4.0 only, PhantomJS 1 only
  28523. // push.apply(_, arraylike) throws on ancient WebKit
  28524. jQuery.merge(scripts, getAll(node, "script"));
  28525. }
  28526. }
  28527. callback.call(collection[i], node, i);
  28528. }
  28529. if (hasScripts) {
  28530. doc = scripts[scripts.length - 1].ownerDocument;
  28531. // Reenable scripts
  28532. jQuery.map(scripts, restoreScript);
  28533. // Evaluate executable scripts on first document insertion
  28534. for (i = 0; i < hasScripts; i++) {
  28535. node = scripts[i];
  28536. if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) {
  28537. if (node.src && (node.type || "").toLowerCase() !== "module") {
  28538. // Optional AJAX dependency, but won't run scripts if not present
  28539. if (jQuery._evalUrl) {
  28540. jQuery._evalUrl(node.src);
  28541. }
  28542. } else {
  28543. DOMEval(node.textContent.replace(rcleanScript, ""), doc, node);
  28544. }
  28545. }
  28546. }
  28547. }
  28548. }
  28549. }
  28550. return collection;
  28551. }
  28552. function _remove(elem, selector, keepData) {
  28553. var node,
  28554. nodes = selector ? jQuery.filter(selector, elem) : elem,
  28555. i = 0;
  28556. for (; (node = nodes[i]) != null; i++) {
  28557. if (!keepData && node.nodeType === 1) {
  28558. jQuery.cleanData(getAll(node));
  28559. }
  28560. if (node.parentNode) {
  28561. if (keepData && jQuery.contains(node.ownerDocument, node)) {
  28562. setGlobalEval(getAll(node, "script"));
  28563. }
  28564. node.parentNode.removeChild(node);
  28565. }
  28566. }
  28567. return elem;
  28568. }
  28569. jQuery.extend({
  28570. htmlPrefilter: function htmlPrefilter(html) {
  28571. return html.replace(rxhtmlTag, "<$1></$2>");
  28572. },
  28573. clone: function clone(elem, dataAndEvents, deepDataAndEvents) {
  28574. var i,
  28575. l,
  28576. srcElements,
  28577. destElements,
  28578. clone = elem.cloneNode(true),
  28579. inPage = jQuery.contains(elem.ownerDocument, elem);
  28580. // Fix IE cloning issues
  28581. if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  28582. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  28583. destElements = getAll(clone);
  28584. srcElements = getAll(elem);
  28585. for (i = 0, l = srcElements.length; i < l; i++) {
  28586. fixInput(srcElements[i], destElements[i]);
  28587. }
  28588. }
  28589. // Copy the events from the original to the clone
  28590. if (dataAndEvents) {
  28591. if (deepDataAndEvents) {
  28592. srcElements = srcElements || getAll(elem);
  28593. destElements = destElements || getAll(clone);
  28594. for (i = 0, l = srcElements.length; i < l; i++) {
  28595. cloneCopyEvent(srcElements[i], destElements[i]);
  28596. }
  28597. } else {
  28598. cloneCopyEvent(elem, clone);
  28599. }
  28600. }
  28601. // Preserve script evaluation history
  28602. destElements = getAll(clone, "script");
  28603. if (destElements.length > 0) {
  28604. setGlobalEval(destElements, !inPage && getAll(elem, "script"));
  28605. }
  28606. // Return the cloned set
  28607. return clone;
  28608. },
  28609. cleanData: function cleanData(elems) {
  28610. var data,
  28611. elem,
  28612. type,
  28613. special = jQuery.event.special,
  28614. i = 0;
  28615. for (; (elem = elems[i]) !== undefined; i++) {
  28616. if (acceptData(elem)) {
  28617. if (data = elem[dataPriv.expando]) {
  28618. if (data.events) {
  28619. for (type in data.events) {
  28620. if (special[type]) {
  28621. jQuery.event.remove(elem, type);
  28622. // This is a shortcut to avoid jQuery.event.remove's overhead
  28623. } else {
  28624. jQuery.removeEvent(elem, type, data.handle);
  28625. }
  28626. }
  28627. }
  28628. // Support: Chrome <=35 - 45+
  28629. // Assign undefined instead of using delete, see Data#remove
  28630. elem[dataPriv.expando] = undefined;
  28631. }
  28632. if (elem[dataUser.expando]) {
  28633. // Support: Chrome <=35 - 45+
  28634. // Assign undefined instead of using delete, see Data#remove
  28635. elem[dataUser.expando] = undefined;
  28636. }
  28637. }
  28638. }
  28639. }
  28640. });
  28641. jQuery.fn.extend({
  28642. detach: function detach(selector) {
  28643. return _remove(this, selector, true);
  28644. },
  28645. remove: function remove(selector) {
  28646. return _remove(this, selector);
  28647. },
  28648. text: function text(value) {
  28649. return access(this, function (value) {
  28650. return value === undefined ? jQuery.text(this) : this.empty().each(function () {
  28651. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  28652. this.textContent = value;
  28653. }
  28654. });
  28655. }, null, value, arguments.length);
  28656. },
  28657. append: function append() {
  28658. return domManip(this, arguments, function (elem) {
  28659. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  28660. var target = manipulationTarget(this, elem);
  28661. target.appendChild(elem);
  28662. }
  28663. });
  28664. },
  28665. prepend: function prepend() {
  28666. return domManip(this, arguments, function (elem) {
  28667. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  28668. var target = manipulationTarget(this, elem);
  28669. target.insertBefore(elem, target.firstChild);
  28670. }
  28671. });
  28672. },
  28673. before: function before() {
  28674. return domManip(this, arguments, function (elem) {
  28675. if (this.parentNode) {
  28676. this.parentNode.insertBefore(elem, this);
  28677. }
  28678. });
  28679. },
  28680. after: function after() {
  28681. return domManip(this, arguments, function (elem) {
  28682. if (this.parentNode) {
  28683. this.parentNode.insertBefore(elem, this.nextSibling);
  28684. }
  28685. });
  28686. },
  28687. empty: function empty() {
  28688. var elem,
  28689. i = 0;
  28690. for (; (elem = this[i]) != null; i++) {
  28691. if (elem.nodeType === 1) {
  28692. // Prevent memory leaks
  28693. jQuery.cleanData(getAll(elem, false));
  28694. // Remove any remaining nodes
  28695. elem.textContent = "";
  28696. }
  28697. }
  28698. return this;
  28699. },
  28700. clone: function clone(dataAndEvents, deepDataAndEvents) {
  28701. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  28702. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  28703. return this.map(function () {
  28704. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  28705. });
  28706. },
  28707. html: function html(value) {
  28708. return access(this, function (value) {
  28709. var elem = this[0] || {},
  28710. i = 0,
  28711. l = this.length;
  28712. if (value === undefined && elem.nodeType === 1) {
  28713. return elem.innerHTML;
  28714. }
  28715. // See if we can take a shortcut and just use innerHTML
  28716. if (typeof value === "string" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
  28717. value = jQuery.htmlPrefilter(value);
  28718. try {
  28719. for (; i < l; i++) {
  28720. elem = this[i] || {};
  28721. // Remove element nodes and prevent memory leaks
  28722. if (elem.nodeType === 1) {
  28723. jQuery.cleanData(getAll(elem, false));
  28724. elem.innerHTML = value;
  28725. }
  28726. }
  28727. elem = 0;
  28728. // If using innerHTML throws an exception, use the fallback method
  28729. } catch (e) {}
  28730. }
  28731. if (elem) {
  28732. this.empty().append(value);
  28733. }
  28734. }, null, value, arguments.length);
  28735. },
  28736. replaceWith: function replaceWith() {
  28737. var ignored = [];
  28738. // Make the changes, replacing each non-ignored context element with the new content
  28739. return domManip(this, arguments, function (elem) {
  28740. var parent = this.parentNode;
  28741. if (jQuery.inArray(this, ignored) < 0) {
  28742. jQuery.cleanData(getAll(this));
  28743. if (parent) {
  28744. parent.replaceChild(elem, this);
  28745. }
  28746. }
  28747. // Force callback invocation
  28748. }, ignored);
  28749. }
  28750. });
  28751. jQuery.each({
  28752. appendTo: "append",
  28753. prependTo: "prepend",
  28754. insertBefore: "before",
  28755. insertAfter: "after",
  28756. replaceAll: "replaceWith"
  28757. }, function (name, original) {
  28758. jQuery.fn[name] = function (selector) {
  28759. var elems,
  28760. ret = [],
  28761. insert = jQuery(selector),
  28762. last = insert.length - 1,
  28763. i = 0;
  28764. for (; i <= last; i++) {
  28765. elems = i === last ? this : this.clone(true);
  28766. jQuery(insert[i])[original](elems);
  28767. // Support: Android <=4.0 only, PhantomJS 1 only
  28768. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  28769. push.apply(ret, elems.get());
  28770. }
  28771. return this.pushStack(ret);
  28772. };
  28773. });
  28774. var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  28775. var getStyles = function getStyles(elem) {
  28776. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  28777. // IE throws on elements created in popups
  28778. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  28779. var view = elem.ownerDocument.defaultView;
  28780. if (!view || !view.opener) {
  28781. view = window;
  28782. }
  28783. return view.getComputedStyle(elem);
  28784. };
  28785. var rboxStyle = new RegExp(cssExpand.join("|"), "i");
  28786. (function () {
  28787. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  28788. // so they're executed at the same time to save the second computation.
  28789. function computeStyleTests() {
  28790. // This is a singleton, we need to execute it only once
  28791. if (!div) {
  28792. return;
  28793. }
  28794. container.style.cssText = "position:absolute;left:-11111px;width:60px;" + "margin-top:1px;padding:0;border:0";
  28795. div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + "margin:auto;border:1px;padding:1px;" + "width:60%;top:1%";
  28796. documentElement.appendChild(container).appendChild(div);
  28797. var divStyle = window.getComputedStyle(div);
  28798. pixelPositionVal = divStyle.top !== "1%";
  28799. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  28800. reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
  28801. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  28802. // Some styles come back with percentage values, even though they shouldn't
  28803. div.style.right = "60%";
  28804. pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
  28805. // Support: IE 9 - 11 only
  28806. // Detect misreporting of content dimensions for box-sizing:border-box elements
  28807. boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
  28808. // Support: IE 9 only
  28809. // Detect overflow:scroll screwiness (gh-3699)
  28810. div.style.position = "absolute";
  28811. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  28812. documentElement.removeChild(container);
  28813. // Nullify the div so it wouldn't be stored in the memory and
  28814. // it will also be a sign that checks already performed
  28815. div = null;
  28816. }
  28817. function roundPixelMeasures(measure) {
  28818. return Math.round(parseFloat(measure));
  28819. }
  28820. var pixelPositionVal,
  28821. boxSizingReliableVal,
  28822. scrollboxSizeVal,
  28823. pixelBoxStylesVal,
  28824. reliableMarginLeftVal,
  28825. container = document.createElement("div"),
  28826. div = document.createElement("div");
  28827. // Finish early in limited (non-browser) environments
  28828. if (!div.style) {
  28829. return;
  28830. }
  28831. // Support: IE <=9 - 11 only
  28832. // Style of cloned element affects source element cloned (#8908)
  28833. div.style.backgroundClip = "content-box";
  28834. div.cloneNode(true).style.backgroundClip = "";
  28835. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  28836. jQuery.extend(support, {
  28837. boxSizingReliable: function boxSizingReliable() {
  28838. computeStyleTests();
  28839. return boxSizingReliableVal;
  28840. },
  28841. pixelBoxStyles: function pixelBoxStyles() {
  28842. computeStyleTests();
  28843. return pixelBoxStylesVal;
  28844. },
  28845. pixelPosition: function pixelPosition() {
  28846. computeStyleTests();
  28847. return pixelPositionVal;
  28848. },
  28849. reliableMarginLeft: function reliableMarginLeft() {
  28850. computeStyleTests();
  28851. return reliableMarginLeftVal;
  28852. },
  28853. scrollboxSize: function scrollboxSize() {
  28854. computeStyleTests();
  28855. return scrollboxSizeVal;
  28856. }
  28857. });
  28858. })();
  28859. function curCSS(elem, name, computed) {
  28860. var width,
  28861. minWidth,
  28862. maxWidth,
  28863. ret,
  28864. // Support: Firefox 51+
  28865. // Retrieving style before computed somehow
  28866. // fixes an issue with getting wrong values
  28867. // on detached elements
  28868. style = elem.style;
  28869. computed = computed || getStyles(elem);
  28870. // getPropertyValue is needed for:
  28871. // .css('filter') (IE 9 only, #12537)
  28872. // .css('--customProperty) (#3144)
  28873. if (computed) {
  28874. ret = computed.getPropertyValue(name) || computed[name];
  28875. if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
  28876. ret = jQuery.style(elem, name);
  28877. }
  28878. // A tribute to the "awesome hack by Dean Edwards"
  28879. // Android Browser returns percentage for some values,
  28880. // but width seems to be reliably pixels.
  28881. // This is against the CSSOM draft spec:
  28882. // https://drafts.csswg.org/cssom/#resolved-values
  28883. if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
  28884. // Remember the original values
  28885. width = style.width;
  28886. minWidth = style.minWidth;
  28887. maxWidth = style.maxWidth;
  28888. // Put in the new values to get a computed value out
  28889. style.minWidth = style.maxWidth = style.width = ret;
  28890. ret = computed.width;
  28891. // Revert the changed values
  28892. style.width = width;
  28893. style.minWidth = minWidth;
  28894. style.maxWidth = maxWidth;
  28895. }
  28896. }
  28897. return ret !== undefined ?
  28898. // Support: IE <=9 - 11 only
  28899. // IE returns zIndex value as an integer.
  28900. ret + "" : ret;
  28901. }
  28902. function addGetHookIf(conditionFn, hookFn) {
  28903. // Define the hook, we'll check on the first run if it's really needed.
  28904. return {
  28905. get: function get() {
  28906. if (conditionFn()) {
  28907. // Hook not needed (or it's not possible to use it due
  28908. // to missing dependency), remove it.
  28909. delete this.get;
  28910. return;
  28911. }
  28912. // Hook needed; redefine it so that the support test is not executed again.
  28913. return (this.get = hookFn).apply(this, arguments);
  28914. }
  28915. };
  28916. }
  28917. var
  28918. // Swappable if display is none or starts with table
  28919. // except "table", "table-cell", or "table-caption"
  28920. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  28921. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  28922. rcustomProp = /^--/,
  28923. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  28924. cssNormalTransform = {
  28925. letterSpacing: "0",
  28926. fontWeight: "400"
  28927. },
  28928. cssPrefixes = ["Webkit", "Moz", "ms"],
  28929. emptyStyle = document.createElement("div").style;
  28930. // Return a css property mapped to a potentially vendor prefixed property
  28931. function vendorPropName(name) {
  28932. // Shortcut for names that are not vendor prefixed
  28933. if (name in emptyStyle) {
  28934. return name;
  28935. }
  28936. // Check for vendor prefixed names
  28937. var capName = name[0].toUpperCase() + name.slice(1),
  28938. i = cssPrefixes.length;
  28939. while (i--) {
  28940. name = cssPrefixes[i] + capName;
  28941. if (name in emptyStyle) {
  28942. return name;
  28943. }
  28944. }
  28945. }
  28946. // Return a property mapped along what jQuery.cssProps suggests or to
  28947. // a vendor prefixed property.
  28948. function finalPropName(name) {
  28949. var ret = jQuery.cssProps[name];
  28950. if (!ret) {
  28951. ret = jQuery.cssProps[name] = vendorPropName(name) || name;
  28952. }
  28953. return ret;
  28954. }
  28955. function setPositiveNumber(elem, value, subtract) {
  28956. // Any relative (+/-) values have already been
  28957. // normalized at this point
  28958. var matches = rcssNum.exec(value);
  28959. return matches ?
  28960. // Guard against undefined "subtract", e.g., when used as in cssHooks
  28961. Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
  28962. }
  28963. function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
  28964. var i = dimension === "width" ? 1 : 0,
  28965. extra = 0,
  28966. delta = 0;
  28967. // Adjustment may not be necessary
  28968. if (box === (isBorderBox ? "border" : "content")) {
  28969. return 0;
  28970. }
  28971. for (; i < 4; i += 2) {
  28972. // Both box models exclude margin
  28973. if (box === "margin") {
  28974. delta += jQuery.css(elem, box + cssExpand[i], true, styles);
  28975. }
  28976. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  28977. if (!isBorderBox) {
  28978. // Add padding
  28979. delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  28980. // For "border" or "margin", add border
  28981. if (box !== "padding") {
  28982. delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  28983. // But still keep track of it otherwise
  28984. } else {
  28985. extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  28986. }
  28987. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  28988. // "padding" or "margin"
  28989. } else {
  28990. // For "content", subtract padding
  28991. if (box === "content") {
  28992. delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  28993. }
  28994. // For "content" or "padding", subtract border
  28995. if (box !== "margin") {
  28996. delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  28997. }
  28998. }
  28999. }
  29000. // Account for positive content-box scroll gutter when requested by providing computedVal
  29001. if (!isBorderBox && computedVal >= 0) {
  29002. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  29003. // Assuming integer scroll gutter, subtract the rest and round down
  29004. delta += Math.max(0, Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5));
  29005. }
  29006. return delta;
  29007. }
  29008. function getWidthOrHeight(elem, dimension, extra) {
  29009. // Start with computed style
  29010. var styles = getStyles(elem),
  29011. val = curCSS(elem, dimension, styles),
  29012. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  29013. valueIsBorderBox = isBorderBox;
  29014. // Support: Firefox <=54
  29015. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  29016. if (rnumnonpx.test(val)) {
  29017. if (!extra) {
  29018. return val;
  29019. }
  29020. val = "auto";
  29021. }
  29022. // Check for style in case a browser which returns unreliable values
  29023. // for getComputedStyle silently falls back to the reliable elem.style
  29024. valueIsBorderBox = valueIsBorderBox && (support.boxSizingReliable() || val === elem.style[dimension]);
  29025. // Fall back to offsetWidth/offsetHeight when value is "auto"
  29026. // This happens for inline elements with no explicit setting (gh-3571)
  29027. // Support: Android <=4.1 - 4.3 only
  29028. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  29029. if (val === "auto" || !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") {
  29030. val = elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)];
  29031. // offsetWidth/offsetHeight provide border-box values
  29032. valueIsBorderBox = true;
  29033. }
  29034. // Normalize "" and auto
  29035. val = parseFloat(val) || 0;
  29036. // Adjust for the element's box model
  29037. return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles,
  29038. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  29039. val) + "px";
  29040. }
  29041. jQuery.extend({
  29042. // Add in style property hooks for overriding the default
  29043. // behavior of getting and setting a style property
  29044. cssHooks: {
  29045. opacity: {
  29046. get: function get(elem, computed) {
  29047. if (computed) {
  29048. // We should always get a number back from opacity
  29049. var ret = curCSS(elem, "opacity");
  29050. return ret === "" ? "1" : ret;
  29051. }
  29052. }
  29053. }
  29054. },
  29055. // Don't automatically add "px" to these possibly-unitless properties
  29056. cssNumber: {
  29057. "animationIterationCount": true,
  29058. "columnCount": true,
  29059. "fillOpacity": true,
  29060. "flexGrow": true,
  29061. "flexShrink": true,
  29062. "fontWeight": true,
  29063. "lineHeight": true,
  29064. "opacity": true,
  29065. "order": true,
  29066. "orphans": true,
  29067. "widows": true,
  29068. "zIndex": true,
  29069. "zoom": true
  29070. },
  29071. // Add in properties whose names you wish to fix before
  29072. // setting or getting the value
  29073. cssProps: {},
  29074. // Get and set the style property on a DOM Node
  29075. style: function style(elem, name, value, extra) {
  29076. // Don't set styles on text and comment nodes
  29077. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  29078. return;
  29079. }
  29080. // Make sure that we're working with the right name
  29081. var ret,
  29082. type,
  29083. hooks,
  29084. origName = camelCase(name),
  29085. isCustomProp = rcustomProp.test(name),
  29086. style = elem.style;
  29087. // Make sure that we're working with the right name. We don't
  29088. // want to query the value if it is a CSS custom property
  29089. // since they are user-defined.
  29090. if (!isCustomProp) {
  29091. name = finalPropName(origName);
  29092. }
  29093. // Gets hook for the prefixed version, then unprefixed version
  29094. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  29095. // Check if we're setting a value
  29096. if (value !== undefined) {
  29097. type = typeof value === "undefined" ? "undefined" : _typeof(value);
  29098. // Convert "+=" or "-=" to relative numbers (#7345)
  29099. if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
  29100. value = adjustCSS(elem, name, ret);
  29101. // Fixes bug #9237
  29102. type = "number";
  29103. }
  29104. // Make sure that null and NaN values aren't set (#7116)
  29105. if (value == null || value !== value) {
  29106. return;
  29107. }
  29108. // If a number was passed in, add the unit (except for certain CSS properties)
  29109. if (type === "number") {
  29110. value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
  29111. }
  29112. // background-* props affect original clone's values
  29113. if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
  29114. style[name] = "inherit";
  29115. }
  29116. // If a hook was provided, use that value, otherwise just set the specified value
  29117. if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
  29118. if (isCustomProp) {
  29119. style.setProperty(name, value);
  29120. } else {
  29121. style[name] = value;
  29122. }
  29123. }
  29124. } else {
  29125. // If a hook was provided get the non-computed value from there
  29126. if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
  29127. return ret;
  29128. }
  29129. // Otherwise just get the value from the style object
  29130. return style[name];
  29131. }
  29132. },
  29133. css: function css(elem, name, extra, styles) {
  29134. var val,
  29135. num,
  29136. hooks,
  29137. origName = camelCase(name),
  29138. isCustomProp = rcustomProp.test(name);
  29139. // Make sure that we're working with the right name. We don't
  29140. // want to modify the value if it is a CSS custom property
  29141. // since they are user-defined.
  29142. if (!isCustomProp) {
  29143. name = finalPropName(origName);
  29144. }
  29145. // Try prefixed name followed by the unprefixed name
  29146. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  29147. // If a hook was provided get the computed value from there
  29148. if (hooks && "get" in hooks) {
  29149. val = hooks.get(elem, true, extra);
  29150. }
  29151. // Otherwise, if a way to get the computed value exists, use that
  29152. if (val === undefined) {
  29153. val = curCSS(elem, name, styles);
  29154. }
  29155. // Convert "normal" to computed value
  29156. if (val === "normal" && name in cssNormalTransform) {
  29157. val = cssNormalTransform[name];
  29158. }
  29159. // Make numeric if forced or a qualifier was provided and val looks numeric
  29160. if (extra === "" || extra) {
  29161. num = parseFloat(val);
  29162. return extra === true || isFinite(num) ? num || 0 : val;
  29163. }
  29164. return val;
  29165. }
  29166. });
  29167. jQuery.each(["height", "width"], function (i, dimension) {
  29168. jQuery.cssHooks[dimension] = {
  29169. get: function get(elem, computed, extra) {
  29170. if (computed) {
  29171. // Certain elements can have dimension info if we invisibly show them
  29172. // but it must have a current display style that would benefit
  29173. return rdisplayswap.test(jQuery.css(elem, "display")) && (
  29174. // Support: Safari 8+
  29175. // Table columns in Safari have non-zero offsetWidth & zero
  29176. // getBoundingClientRect().width unless display is changed.
  29177. // Support: IE <=11 only
  29178. // Running getBoundingClientRect on a disconnected node
  29179. // in IE throws an error.
  29180. !elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function () {
  29181. return getWidthOrHeight(elem, dimension, extra);
  29182. }) : getWidthOrHeight(elem, dimension, extra);
  29183. }
  29184. },
  29185. set: function set(elem, value, extra) {
  29186. var matches,
  29187. styles = getStyles(elem),
  29188. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  29189. subtract = extra && boxModelAdjustment(elem, dimension, extra, isBorderBox, styles);
  29190. // Account for unreliable border-box dimensions by comparing offset* to computed and
  29191. // faking a content-box to get border and padding (gh-3699)
  29192. if (isBorderBox && support.scrollboxSize() === styles.position) {
  29193. subtract -= Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5);
  29194. }
  29195. // Convert to pixels if value adjustment is needed
  29196. if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {
  29197. elem.style[dimension] = value;
  29198. value = jQuery.css(elem, dimension);
  29199. }
  29200. return setPositiveNumber(elem, value, subtract);
  29201. }
  29202. };
  29203. });
  29204. jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {
  29205. if (computed) {
  29206. return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function () {
  29207. return elem.getBoundingClientRect().left;
  29208. })) + "px";
  29209. }
  29210. });
  29211. // These hooks are used by animate to expand properties
  29212. jQuery.each({
  29213. margin: "",
  29214. padding: "",
  29215. border: "Width"
  29216. }, function (prefix, suffix) {
  29217. jQuery.cssHooks[prefix + suffix] = {
  29218. expand: function expand(value) {
  29219. var i = 0,
  29220. expanded = {},
  29221. // Assumes a single number if not a string
  29222. parts = typeof value === "string" ? value.split(" ") : [value];
  29223. for (; i < 4; i++) {
  29224. expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];
  29225. }
  29226. return expanded;
  29227. }
  29228. };
  29229. if (prefix !== "margin") {
  29230. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
  29231. }
  29232. });
  29233. jQuery.fn.extend({
  29234. css: function css(name, value) {
  29235. return access(this, function (elem, name, value) {
  29236. var styles,
  29237. len,
  29238. map = {},
  29239. i = 0;
  29240. if (Array.isArray(name)) {
  29241. styles = getStyles(elem);
  29242. len = name.length;
  29243. for (; i < len; i++) {
  29244. map[name[i]] = jQuery.css(elem, name[i], false, styles);
  29245. }
  29246. return map;
  29247. }
  29248. return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name);
  29249. }, name, value, arguments.length > 1);
  29250. }
  29251. });
  29252. function Tween(elem, options, prop, end, easing) {
  29253. return new Tween.prototype.init(elem, options, prop, end, easing);
  29254. }
  29255. jQuery.Tween = Tween;
  29256. Tween.prototype = {
  29257. constructor: Tween,
  29258. init: function init(elem, options, prop, end, easing, unit) {
  29259. this.elem = elem;
  29260. this.prop = prop;
  29261. this.easing = easing || jQuery.easing._default;
  29262. this.options = options;
  29263. this.start = this.now = this.cur();
  29264. this.end = end;
  29265. this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
  29266. },
  29267. cur: function cur() {
  29268. var hooks = Tween.propHooks[this.prop];
  29269. return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);
  29270. },
  29271. run: function run(percent) {
  29272. var eased,
  29273. hooks = Tween.propHooks[this.prop];
  29274. if (this.options.duration) {
  29275. this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);
  29276. } else {
  29277. this.pos = eased = percent;
  29278. }
  29279. this.now = (this.end - this.start) * eased + this.start;
  29280. if (this.options.step) {
  29281. this.options.step.call(this.elem, this.now, this);
  29282. }
  29283. if (hooks && hooks.set) {
  29284. hooks.set(this);
  29285. } else {
  29286. Tween.propHooks._default.set(this);
  29287. }
  29288. return this;
  29289. }
  29290. };
  29291. Tween.prototype.init.prototype = Tween.prototype;
  29292. Tween.propHooks = {
  29293. _default: {
  29294. get: function get(tween) {
  29295. var result;
  29296. // Use a property on the element directly when it is not a DOM element,
  29297. // or when there is no matching style property that exists.
  29298. if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
  29299. return tween.elem[tween.prop];
  29300. }
  29301. // Passing an empty string as a 3rd parameter to .css will automatically
  29302. // attempt a parseFloat and fallback to a string if the parse fails.
  29303. // Simple values such as "10px" are parsed to Float;
  29304. // complex values such as "rotate(1rad)" are returned as-is.
  29305. result = jQuery.css(tween.elem, tween.prop, "");
  29306. // Empty strings, null, undefined and "auto" are converted to 0.
  29307. return !result || result === "auto" ? 0 : result;
  29308. },
  29309. set: function set(tween) {
  29310. // Use step hook for back compat.
  29311. // Use cssHook if its there.
  29312. // Use .style if available and use plain properties where available.
  29313. if (jQuery.fx.step[tween.prop]) {
  29314. jQuery.fx.step[tween.prop](tween);
  29315. } else if (tween.elem.nodeType === 1 && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
  29316. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
  29317. } else {
  29318. tween.elem[tween.prop] = tween.now;
  29319. }
  29320. }
  29321. }
  29322. };
  29323. // Support: IE <=9 only
  29324. // Panic based approach to setting things on disconnected nodes
  29325. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  29326. set: function set(tween) {
  29327. if (tween.elem.nodeType && tween.elem.parentNode) {
  29328. tween.elem[tween.prop] = tween.now;
  29329. }
  29330. }
  29331. };
  29332. jQuery.easing = {
  29333. linear: function linear(p) {
  29334. return p;
  29335. },
  29336. swing: function swing(p) {
  29337. return 0.5 - Math.cos(p * Math.PI) / 2;
  29338. },
  29339. _default: "swing"
  29340. };
  29341. jQuery.fx = Tween.prototype.init;
  29342. // Back compat <1.8 extension point
  29343. jQuery.fx.step = {};
  29344. var fxNow,
  29345. inProgress,
  29346. rfxtypes = /^(?:toggle|show|hide)$/,
  29347. rrun = /queueHooks$/;
  29348. function schedule() {
  29349. if (inProgress) {
  29350. if (document.hidden === false && window.requestAnimationFrame) {
  29351. window.requestAnimationFrame(schedule);
  29352. } else {
  29353. window.setTimeout(schedule, jQuery.fx.interval);
  29354. }
  29355. jQuery.fx.tick();
  29356. }
  29357. }
  29358. // Animations created synchronously will run synchronously
  29359. function createFxNow() {
  29360. window.setTimeout(function () {
  29361. fxNow = undefined;
  29362. });
  29363. return fxNow = Date.now();
  29364. }
  29365. // Generate parameters to create a standard animation
  29366. function genFx(type, includeWidth) {
  29367. var which,
  29368. i = 0,
  29369. attrs = { height: type };
  29370. // If we include width, step value is 1 to do all cssExpand values,
  29371. // otherwise step value is 2 to skip over Left and Right
  29372. includeWidth = includeWidth ? 1 : 0;
  29373. for (; i < 4; i += 2 - includeWidth) {
  29374. which = cssExpand[i];
  29375. attrs["margin" + which] = attrs["padding" + which] = type;
  29376. }
  29377. if (includeWidth) {
  29378. attrs.opacity = attrs.width = type;
  29379. }
  29380. return attrs;
  29381. }
  29382. function createTween(value, prop, animation) {
  29383. var tween,
  29384. collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]),
  29385. index = 0,
  29386. length = collection.length;
  29387. for (; index < length; index++) {
  29388. if (tween = collection[index].call(animation, prop, value)) {
  29389. // We're done with this property
  29390. return tween;
  29391. }
  29392. }
  29393. }
  29394. function defaultPrefilter(elem, props, opts) {
  29395. var prop,
  29396. value,
  29397. toggle,
  29398. hooks,
  29399. oldfire,
  29400. propTween,
  29401. restoreDisplay,
  29402. display,
  29403. isBox = "width" in props || "height" in props,
  29404. anim = this,
  29405. orig = {},
  29406. style = elem.style,
  29407. hidden = elem.nodeType && isHiddenWithinTree(elem),
  29408. dataShow = dataPriv.get(elem, "fxshow");
  29409. // Queue-skipping animations hijack the fx hooks
  29410. if (!opts.queue) {
  29411. hooks = jQuery._queueHooks(elem, "fx");
  29412. if (hooks.unqueued == null) {
  29413. hooks.unqueued = 0;
  29414. oldfire = hooks.empty.fire;
  29415. hooks.empty.fire = function () {
  29416. if (!hooks.unqueued) {
  29417. oldfire();
  29418. }
  29419. };
  29420. }
  29421. hooks.unqueued++;
  29422. anim.always(function () {
  29423. // Ensure the complete handler is called before this completes
  29424. anim.always(function () {
  29425. hooks.unqueued--;
  29426. if (!jQuery.queue(elem, "fx").length) {
  29427. hooks.empty.fire();
  29428. }
  29429. });
  29430. });
  29431. }
  29432. // Detect show/hide animations
  29433. for (prop in props) {
  29434. value = props[prop];
  29435. if (rfxtypes.test(value)) {
  29436. delete props[prop];
  29437. toggle = toggle || value === "toggle";
  29438. if (value === (hidden ? "hide" : "show")) {
  29439. // Pretend to be hidden if this is a "show" and
  29440. // there is still data from a stopped show/hide
  29441. if (value === "show" && dataShow && dataShow[prop] !== undefined) {
  29442. hidden = true;
  29443. // Ignore all other no-op show/hide data
  29444. } else {
  29445. continue;
  29446. }
  29447. }
  29448. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
  29449. }
  29450. }
  29451. // Bail out if this is a no-op like .hide().hide()
  29452. propTween = !jQuery.isEmptyObject(props);
  29453. if (!propTween && jQuery.isEmptyObject(orig)) {
  29454. return;
  29455. }
  29456. // Restrict "overflow" and "display" styles during box animations
  29457. if (isBox && elem.nodeType === 1) {
  29458. // Support: IE <=9 - 11, Edge 12 - 15
  29459. // Record all 3 overflow attributes because IE does not infer the shorthand
  29460. // from identically-valued overflowX and overflowY and Edge just mirrors
  29461. // the overflowX value there.
  29462. opts.overflow = [style.overflow, style.overflowX, style.overflowY];
  29463. // Identify a display type, preferring old show/hide data over the CSS cascade
  29464. restoreDisplay = dataShow && dataShow.display;
  29465. if (restoreDisplay == null) {
  29466. restoreDisplay = dataPriv.get(elem, "display");
  29467. }
  29468. display = jQuery.css(elem, "display");
  29469. if (display === "none") {
  29470. if (restoreDisplay) {
  29471. display = restoreDisplay;
  29472. } else {
  29473. // Get nonempty value(s) by temporarily forcing visibility
  29474. showHide([elem], true);
  29475. restoreDisplay = elem.style.display || restoreDisplay;
  29476. display = jQuery.css(elem, "display");
  29477. showHide([elem]);
  29478. }
  29479. }
  29480. // Animate inline elements as inline-block
  29481. if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
  29482. if (jQuery.css(elem, "float") === "none") {
  29483. // Restore the original display value at the end of pure show/hide animations
  29484. if (!propTween) {
  29485. anim.done(function () {
  29486. style.display = restoreDisplay;
  29487. });
  29488. if (restoreDisplay == null) {
  29489. display = style.display;
  29490. restoreDisplay = display === "none" ? "" : display;
  29491. }
  29492. }
  29493. style.display = "inline-block";
  29494. }
  29495. }
  29496. }
  29497. if (opts.overflow) {
  29498. style.overflow = "hidden";
  29499. anim.always(function () {
  29500. style.overflow = opts.overflow[0];
  29501. style.overflowX = opts.overflow[1];
  29502. style.overflowY = opts.overflow[2];
  29503. });
  29504. }
  29505. // Implement show/hide animations
  29506. propTween = false;
  29507. for (prop in orig) {
  29508. // General show/hide setup for this element animation
  29509. if (!propTween) {
  29510. if (dataShow) {
  29511. if ("hidden" in dataShow) {
  29512. hidden = dataShow.hidden;
  29513. }
  29514. } else {
  29515. dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
  29516. }
  29517. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  29518. if (toggle) {
  29519. dataShow.hidden = !hidden;
  29520. }
  29521. // Show elements before animating them
  29522. if (hidden) {
  29523. showHide([elem], true);
  29524. }
  29525. /* eslint-disable no-loop-func */
  29526. anim.done(function () {
  29527. /* eslint-enable no-loop-func */
  29528. // The final step of a "hide" animation is actually hiding the element
  29529. if (!hidden) {
  29530. showHide([elem]);
  29531. }
  29532. dataPriv.remove(elem, "fxshow");
  29533. for (prop in orig) {
  29534. jQuery.style(elem, prop, orig[prop]);
  29535. }
  29536. });
  29537. }
  29538. // Per-property setup
  29539. propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  29540. if (!(prop in dataShow)) {
  29541. dataShow[prop] = propTween.start;
  29542. if (hidden) {
  29543. propTween.end = propTween.start;
  29544. propTween.start = 0;
  29545. }
  29546. }
  29547. }
  29548. }
  29549. function propFilter(props, specialEasing) {
  29550. var index, name, easing, value, hooks;
  29551. // camelCase, specialEasing and expand cssHook pass
  29552. for (index in props) {
  29553. name = camelCase(index);
  29554. easing = specialEasing[name];
  29555. value = props[index];
  29556. if (Array.isArray(value)) {
  29557. easing = value[1];
  29558. value = props[index] = value[0];
  29559. }
  29560. if (index !== name) {
  29561. props[name] = value;
  29562. delete props[index];
  29563. }
  29564. hooks = jQuery.cssHooks[name];
  29565. if (hooks && "expand" in hooks) {
  29566. value = hooks.expand(value);
  29567. delete props[name];
  29568. // Not quite $.extend, this won't overwrite existing keys.
  29569. // Reusing 'index' because we have the correct "name"
  29570. for (index in value) {
  29571. if (!(index in props)) {
  29572. props[index] = value[index];
  29573. specialEasing[index] = easing;
  29574. }
  29575. }
  29576. } else {
  29577. specialEasing[name] = easing;
  29578. }
  29579. }
  29580. }
  29581. function Animation(elem, properties, options) {
  29582. var result,
  29583. stopped,
  29584. index = 0,
  29585. length = Animation.prefilters.length,
  29586. deferred = jQuery.Deferred().always(function () {
  29587. // Don't match elem in the :animated selector
  29588. delete tick.elem;
  29589. }),
  29590. tick = function tick() {
  29591. if (stopped) {
  29592. return false;
  29593. }
  29594. var currentTime = fxNow || createFxNow(),
  29595. remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
  29596. // Support: Android 2.3 only
  29597. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  29598. temp = remaining / animation.duration || 0,
  29599. percent = 1 - temp,
  29600. index = 0,
  29601. length = animation.tweens.length;
  29602. for (; index < length; index++) {
  29603. animation.tweens[index].run(percent);
  29604. }
  29605. deferred.notifyWith(elem, [animation, percent, remaining]);
  29606. // If there's more to do, yield
  29607. if (percent < 1 && length) {
  29608. return remaining;
  29609. }
  29610. // If this was an empty animation, synthesize a final progress notification
  29611. if (!length) {
  29612. deferred.notifyWith(elem, [animation, 1, 0]);
  29613. }
  29614. // Resolve the animation and report its conclusion
  29615. deferred.resolveWith(elem, [animation]);
  29616. return false;
  29617. },
  29618. animation = deferred.promise({
  29619. elem: elem,
  29620. props: jQuery.extend({}, properties),
  29621. opts: jQuery.extend(true, {
  29622. specialEasing: {},
  29623. easing: jQuery.easing._default
  29624. }, options),
  29625. originalProperties: properties,
  29626. originalOptions: options,
  29627. startTime: fxNow || createFxNow(),
  29628. duration: options.duration,
  29629. tweens: [],
  29630. createTween: function createTween(prop, end) {
  29631. var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
  29632. animation.tweens.push(tween);
  29633. return tween;
  29634. },
  29635. stop: function stop(gotoEnd) {
  29636. var index = 0,
  29637. // If we are going to the end, we want to run all the tweens
  29638. // otherwise we skip this part
  29639. length = gotoEnd ? animation.tweens.length : 0;
  29640. if (stopped) {
  29641. return this;
  29642. }
  29643. stopped = true;
  29644. for (; index < length; index++) {
  29645. animation.tweens[index].run(1);
  29646. }
  29647. // Resolve when we played the last frame; otherwise, reject
  29648. if (gotoEnd) {
  29649. deferred.notifyWith(elem, [animation, 1, 0]);
  29650. deferred.resolveWith(elem, [animation, gotoEnd]);
  29651. } else {
  29652. deferred.rejectWith(elem, [animation, gotoEnd]);
  29653. }
  29654. return this;
  29655. }
  29656. }),
  29657. props = animation.props;
  29658. propFilter(props, animation.opts.specialEasing);
  29659. for (; index < length; index++) {
  29660. result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
  29661. if (result) {
  29662. if (isFunction(result.stop)) {
  29663. jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
  29664. }
  29665. return result;
  29666. }
  29667. }
  29668. jQuery.map(props, createTween, animation);
  29669. if (isFunction(animation.opts.start)) {
  29670. animation.opts.start.call(elem, animation);
  29671. }
  29672. // Attach callbacks from options
  29673. animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
  29674. jQuery.fx.timer(jQuery.extend(tick, {
  29675. elem: elem,
  29676. anim: animation,
  29677. queue: animation.opts.queue
  29678. }));
  29679. return animation;
  29680. }
  29681. jQuery.Animation = jQuery.extend(Animation, {
  29682. tweeners: {
  29683. "*": [function (prop, value) {
  29684. var tween = this.createTween(prop, value);
  29685. adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
  29686. return tween;
  29687. }]
  29688. },
  29689. tweener: function tweener(props, callback) {
  29690. if (isFunction(props)) {
  29691. callback = props;
  29692. props = ["*"];
  29693. } else {
  29694. props = props.match(rnothtmlwhite);
  29695. }
  29696. var prop,
  29697. index = 0,
  29698. length = props.length;
  29699. for (; index < length; index++) {
  29700. prop = props[index];
  29701. Animation.tweeners[prop] = Animation.tweeners[prop] || [];
  29702. Animation.tweeners[prop].unshift(callback);
  29703. }
  29704. },
  29705. prefilters: [defaultPrefilter],
  29706. prefilter: function prefilter(callback, prepend) {
  29707. if (prepend) {
  29708. Animation.prefilters.unshift(callback);
  29709. } else {
  29710. Animation.prefilters.push(callback);
  29711. }
  29712. }
  29713. });
  29714. jQuery.speed = function (speed, easing, fn) {
  29715. var opt = speed && (typeof speed === "undefined" ? "undefined" : _typeof(speed)) === "object" ? jQuery.extend({}, speed) : {
  29716. complete: fn || !fn && easing || isFunction(speed) && speed,
  29717. duration: speed,
  29718. easing: fn && easing || easing && !isFunction(easing) && easing
  29719. };
  29720. // Go to the end state if fx are off
  29721. if (jQuery.fx.off) {
  29722. opt.duration = 0;
  29723. } else {
  29724. if (typeof opt.duration !== "number") {
  29725. if (opt.duration in jQuery.fx.speeds) {
  29726. opt.duration = jQuery.fx.speeds[opt.duration];
  29727. } else {
  29728. opt.duration = jQuery.fx.speeds._default;
  29729. }
  29730. }
  29731. }
  29732. // Normalize opt.queue - true/undefined/null -> "fx"
  29733. if (opt.queue == null || opt.queue === true) {
  29734. opt.queue = "fx";
  29735. }
  29736. // Queueing
  29737. opt.old = opt.complete;
  29738. opt.complete = function () {
  29739. if (isFunction(opt.old)) {
  29740. opt.old.call(this);
  29741. }
  29742. if (opt.queue) {
  29743. jQuery.dequeue(this, opt.queue);
  29744. }
  29745. };
  29746. return opt;
  29747. };
  29748. jQuery.fn.extend({
  29749. fadeTo: function fadeTo(speed, to, easing, callback) {
  29750. // Show any hidden elements after setting opacity to 0
  29751. return this.filter(isHiddenWithinTree).css("opacity", 0).show()
  29752. // Animate to the value specified
  29753. .end().animate({ opacity: to }, speed, easing, callback);
  29754. },
  29755. animate: function animate(prop, speed, easing, callback) {
  29756. var empty = jQuery.isEmptyObject(prop),
  29757. optall = jQuery.speed(speed, easing, callback),
  29758. doAnimation = function doAnimation() {
  29759. // Operate on a copy of prop so per-property easing won't be lost
  29760. var anim = Animation(this, jQuery.extend({}, prop), optall);
  29761. // Empty animations, or finishing resolves immediately
  29762. if (empty || dataPriv.get(this, "finish")) {
  29763. anim.stop(true);
  29764. }
  29765. };
  29766. doAnimation.finish = doAnimation;
  29767. return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
  29768. },
  29769. stop: function stop(type, clearQueue, gotoEnd) {
  29770. var stopQueue = function stopQueue(hooks) {
  29771. var stop = hooks.stop;
  29772. delete hooks.stop;
  29773. stop(gotoEnd);
  29774. };
  29775. if (typeof type !== "string") {
  29776. gotoEnd = clearQueue;
  29777. clearQueue = type;
  29778. type = undefined;
  29779. }
  29780. if (clearQueue && type !== false) {
  29781. this.queue(type || "fx", []);
  29782. }
  29783. return this.each(function () {
  29784. var dequeue = true,
  29785. index = type != null && type + "queueHooks",
  29786. timers = jQuery.timers,
  29787. data = dataPriv.get(this);
  29788. if (index) {
  29789. if (data[index] && data[index].stop) {
  29790. stopQueue(data[index]);
  29791. }
  29792. } else {
  29793. for (index in data) {
  29794. if (data[index] && data[index].stop && rrun.test(index)) {
  29795. stopQueue(data[index]);
  29796. }
  29797. }
  29798. }
  29799. for (index = timers.length; index--;) {
  29800. if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
  29801. timers[index].anim.stop(gotoEnd);
  29802. dequeue = false;
  29803. timers.splice(index, 1);
  29804. }
  29805. }
  29806. // Start the next in the queue if the last step wasn't forced.
  29807. // Timers currently will call their complete callbacks, which
  29808. // will dequeue but only if they were gotoEnd.
  29809. if (dequeue || !gotoEnd) {
  29810. jQuery.dequeue(this, type);
  29811. }
  29812. });
  29813. },
  29814. finish: function finish(type) {
  29815. if (type !== false) {
  29816. type = type || "fx";
  29817. }
  29818. return this.each(function () {
  29819. var index,
  29820. data = dataPriv.get(this),
  29821. queue = data[type + "queue"],
  29822. hooks = data[type + "queueHooks"],
  29823. timers = jQuery.timers,
  29824. length = queue ? queue.length : 0;
  29825. // Enable finishing flag on private data
  29826. data.finish = true;
  29827. // Empty the queue first
  29828. jQuery.queue(this, type, []);
  29829. if (hooks && hooks.stop) {
  29830. hooks.stop.call(this, true);
  29831. }
  29832. // Look for any active animations, and finish them
  29833. for (index = timers.length; index--;) {
  29834. if (timers[index].elem === this && timers[index].queue === type) {
  29835. timers[index].anim.stop(true);
  29836. timers.splice(index, 1);
  29837. }
  29838. }
  29839. // Look for any animations in the old queue and finish them
  29840. for (index = 0; index < length; index++) {
  29841. if (queue[index] && queue[index].finish) {
  29842. queue[index].finish.call(this);
  29843. }
  29844. }
  29845. // Turn off finishing flag
  29846. delete data.finish;
  29847. });
  29848. }
  29849. });
  29850. jQuery.each(["toggle", "show", "hide"], function (i, name) {
  29851. var cssFn = jQuery.fn[name];
  29852. jQuery.fn[name] = function (speed, easing, callback) {
  29853. return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);
  29854. };
  29855. });
  29856. // Generate shortcuts for custom animations
  29857. jQuery.each({
  29858. slideDown: genFx("show"),
  29859. slideUp: genFx("hide"),
  29860. slideToggle: genFx("toggle"),
  29861. fadeIn: { opacity: "show" },
  29862. fadeOut: { opacity: "hide" },
  29863. fadeToggle: { opacity: "toggle" }
  29864. }, function (name, props) {
  29865. jQuery.fn[name] = function (speed, easing, callback) {
  29866. return this.animate(props, speed, easing, callback);
  29867. };
  29868. });
  29869. jQuery.timers = [];
  29870. jQuery.fx.tick = function () {
  29871. var timer,
  29872. i = 0,
  29873. timers = jQuery.timers;
  29874. fxNow = Date.now();
  29875. for (; i < timers.length; i++) {
  29876. timer = timers[i];
  29877. // Run the timer and safely remove it when done (allowing for external removal)
  29878. if (!timer() && timers[i] === timer) {
  29879. timers.splice(i--, 1);
  29880. }
  29881. }
  29882. if (!timers.length) {
  29883. jQuery.fx.stop();
  29884. }
  29885. fxNow = undefined;
  29886. };
  29887. jQuery.fx.timer = function (timer) {
  29888. jQuery.timers.push(timer);
  29889. jQuery.fx.start();
  29890. };
  29891. jQuery.fx.interval = 13;
  29892. jQuery.fx.start = function () {
  29893. if (inProgress) {
  29894. return;
  29895. }
  29896. inProgress = true;
  29897. schedule();
  29898. };
  29899. jQuery.fx.stop = function () {
  29900. inProgress = null;
  29901. };
  29902. jQuery.fx.speeds = {
  29903. slow: 600,
  29904. fast: 200,
  29905. // Default speed
  29906. _default: 400
  29907. };
  29908. // Based off of the plugin by Clint Helfers, with permission.
  29909. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  29910. jQuery.fn.delay = function (time, type) {
  29911. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  29912. type = type || "fx";
  29913. return this.queue(type, function (next, hooks) {
  29914. var timeout = window.setTimeout(next, time);
  29915. hooks.stop = function () {
  29916. window.clearTimeout(timeout);
  29917. };
  29918. });
  29919. };
  29920. (function () {
  29921. var input = document.createElement("input"),
  29922. select = document.createElement("select"),
  29923. opt = select.appendChild(document.createElement("option"));
  29924. input.type = "checkbox";
  29925. // Support: Android <=4.3 only
  29926. // Default value for a checkbox should be "on"
  29927. support.checkOn = input.value !== "";
  29928. // Support: IE <=11 only
  29929. // Must access selectedIndex to make default options select
  29930. support.optSelected = opt.selected;
  29931. // Support: IE <=11 only
  29932. // An input loses its value after becoming a radio
  29933. input = document.createElement("input");
  29934. input.value = "t";
  29935. input.type = "radio";
  29936. support.radioValue = input.value === "t";
  29937. })();
  29938. var boolHook,
  29939. attrHandle = jQuery.expr.attrHandle;
  29940. jQuery.fn.extend({
  29941. attr: function attr(name, value) {
  29942. return access(this, jQuery.attr, name, value, arguments.length > 1);
  29943. },
  29944. removeAttr: function removeAttr(name) {
  29945. return this.each(function () {
  29946. jQuery.removeAttr(this, name);
  29947. });
  29948. }
  29949. });
  29950. jQuery.extend({
  29951. attr: function attr(elem, name, value) {
  29952. var ret,
  29953. hooks,
  29954. nType = elem.nodeType;
  29955. // Don't get/set attributes on text, comment and attribute nodes
  29956. if (nType === 3 || nType === 8 || nType === 2) {
  29957. return;
  29958. }
  29959. // Fallback to prop when attributes are not supported
  29960. if (typeof elem.getAttribute === "undefined") {
  29961. return jQuery.prop(elem, name, value);
  29962. }
  29963. // Attribute hooks are determined by the lowercase version
  29964. // Grab necessary hook if one is defined
  29965. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  29966. hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined);
  29967. }
  29968. if (value !== undefined) {
  29969. if (value === null) {
  29970. jQuery.removeAttr(elem, name);
  29971. return;
  29972. }
  29973. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  29974. return ret;
  29975. }
  29976. elem.setAttribute(name, value + "");
  29977. return value;
  29978. }
  29979. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  29980. return ret;
  29981. }
  29982. ret = jQuery.find.attr(elem, name);
  29983. // Non-existent attributes return null, we normalize to undefined
  29984. return ret == null ? undefined : ret;
  29985. },
  29986. attrHooks: {
  29987. type: {
  29988. set: function set(elem, value) {
  29989. if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
  29990. var val = elem.value;
  29991. elem.setAttribute("type", value);
  29992. if (val) {
  29993. elem.value = val;
  29994. }
  29995. return value;
  29996. }
  29997. }
  29998. }
  29999. },
  30000. removeAttr: function removeAttr(elem, value) {
  30001. var name,
  30002. i = 0,
  30003. // Attribute names can contain non-HTML whitespace characters
  30004. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  30005. attrNames = value && value.match(rnothtmlwhite);
  30006. if (attrNames && elem.nodeType === 1) {
  30007. while (name = attrNames[i++]) {
  30008. elem.removeAttribute(name);
  30009. }
  30010. }
  30011. }
  30012. });
  30013. // Hooks for boolean attributes
  30014. boolHook = {
  30015. set: function set(elem, value, name) {
  30016. if (value === false) {
  30017. // Remove boolean attributes when set to false
  30018. jQuery.removeAttr(elem, name);
  30019. } else {
  30020. elem.setAttribute(name, name);
  30021. }
  30022. return name;
  30023. }
  30024. };
  30025. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (i, name) {
  30026. var getter = attrHandle[name] || jQuery.find.attr;
  30027. attrHandle[name] = function (elem, name, isXML) {
  30028. var ret,
  30029. handle,
  30030. lowercaseName = name.toLowerCase();
  30031. if (!isXML) {
  30032. // Avoid an infinite loop by temporarily removing this function from the getter
  30033. handle = attrHandle[lowercaseName];
  30034. attrHandle[lowercaseName] = ret;
  30035. ret = getter(elem, name, isXML) != null ? lowercaseName : null;
  30036. attrHandle[lowercaseName] = handle;
  30037. }
  30038. return ret;
  30039. };
  30040. });
  30041. var rfocusable = /^(?:input|select|textarea|button)$/i,
  30042. rclickable = /^(?:a|area)$/i;
  30043. jQuery.fn.extend({
  30044. prop: function prop(name, value) {
  30045. return access(this, jQuery.prop, name, value, arguments.length > 1);
  30046. },
  30047. removeProp: function removeProp(name) {
  30048. return this.each(function () {
  30049. delete this[jQuery.propFix[name] || name];
  30050. });
  30051. }
  30052. });
  30053. jQuery.extend({
  30054. prop: function prop(elem, name, value) {
  30055. var ret,
  30056. hooks,
  30057. nType = elem.nodeType;
  30058. // Don't get/set properties on text, comment and attribute nodes
  30059. if (nType === 3 || nType === 8 || nType === 2) {
  30060. return;
  30061. }
  30062. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  30063. // Fix name and attach hooks
  30064. name = jQuery.propFix[name] || name;
  30065. hooks = jQuery.propHooks[name];
  30066. }
  30067. if (value !== undefined) {
  30068. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  30069. return ret;
  30070. }
  30071. return elem[name] = value;
  30072. }
  30073. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  30074. return ret;
  30075. }
  30076. return elem[name];
  30077. },
  30078. propHooks: {
  30079. tabIndex: {
  30080. get: function get(elem) {
  30081. // Support: IE <=9 - 11 only
  30082. // elem.tabIndex doesn't always return the
  30083. // correct value when it hasn't been explicitly set
  30084. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  30085. // Use proper attribute retrieval(#12072)
  30086. var tabindex = jQuery.find.attr(elem, "tabindex");
  30087. if (tabindex) {
  30088. return parseInt(tabindex, 10);
  30089. }
  30090. if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
  30091. return 0;
  30092. }
  30093. return -1;
  30094. }
  30095. }
  30096. },
  30097. propFix: {
  30098. "for": "htmlFor",
  30099. "class": "className"
  30100. }
  30101. });
  30102. // Support: IE <=11 only
  30103. // Accessing the selectedIndex property
  30104. // forces the browser to respect setting selected
  30105. // on the option
  30106. // The getter ensures a default option is selected
  30107. // when in an optgroup
  30108. // eslint rule "no-unused-expressions" is disabled for this code
  30109. // since it considers such accessions noop
  30110. if (!support.optSelected) {
  30111. jQuery.propHooks.selected = {
  30112. get: function get(elem) {
  30113. /* eslint no-unused-expressions: "off" */
  30114. var parent = elem.parentNode;
  30115. if (parent && parent.parentNode) {
  30116. parent.parentNode.selectedIndex;
  30117. }
  30118. return null;
  30119. },
  30120. set: function set(elem) {
  30121. /* eslint no-unused-expressions: "off" */
  30122. var parent = elem.parentNode;
  30123. if (parent) {
  30124. parent.selectedIndex;
  30125. if (parent.parentNode) {
  30126. parent.parentNode.selectedIndex;
  30127. }
  30128. }
  30129. }
  30130. };
  30131. }
  30132. jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () {
  30133. jQuery.propFix[this.toLowerCase()] = this;
  30134. });
  30135. // Strip and collapse whitespace according to HTML spec
  30136. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  30137. function stripAndCollapse(value) {
  30138. var tokens = value.match(rnothtmlwhite) || [];
  30139. return tokens.join(" ");
  30140. }
  30141. function getClass(elem) {
  30142. return elem.getAttribute && elem.getAttribute("class") || "";
  30143. }
  30144. function classesToArray(value) {
  30145. if (Array.isArray(value)) {
  30146. return value;
  30147. }
  30148. if (typeof value === "string") {
  30149. return value.match(rnothtmlwhite) || [];
  30150. }
  30151. return [];
  30152. }
  30153. jQuery.fn.extend({
  30154. addClass: function addClass(value) {
  30155. var classes,
  30156. elem,
  30157. cur,
  30158. curValue,
  30159. clazz,
  30160. j,
  30161. finalValue,
  30162. i = 0;
  30163. if (isFunction(value)) {
  30164. return this.each(function (j) {
  30165. jQuery(this).addClass(value.call(this, j, getClass(this)));
  30166. });
  30167. }
  30168. classes = classesToArray(value);
  30169. if (classes.length) {
  30170. while (elem = this[i++]) {
  30171. curValue = getClass(elem);
  30172. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  30173. if (cur) {
  30174. j = 0;
  30175. while (clazz = classes[j++]) {
  30176. if (cur.indexOf(" " + clazz + " ") < 0) {
  30177. cur += clazz + " ";
  30178. }
  30179. }
  30180. // Only assign if different to avoid unneeded rendering.
  30181. finalValue = stripAndCollapse(cur);
  30182. if (curValue !== finalValue) {
  30183. elem.setAttribute("class", finalValue);
  30184. }
  30185. }
  30186. }
  30187. }
  30188. return this;
  30189. },
  30190. removeClass: function removeClass(value) {
  30191. var classes,
  30192. elem,
  30193. cur,
  30194. curValue,
  30195. clazz,
  30196. j,
  30197. finalValue,
  30198. i = 0;
  30199. if (isFunction(value)) {
  30200. return this.each(function (j) {
  30201. jQuery(this).removeClass(value.call(this, j, getClass(this)));
  30202. });
  30203. }
  30204. if (!arguments.length) {
  30205. return this.attr("class", "");
  30206. }
  30207. classes = classesToArray(value);
  30208. if (classes.length) {
  30209. while (elem = this[i++]) {
  30210. curValue = getClass(elem);
  30211. // This expression is here for better compressibility (see addClass)
  30212. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  30213. if (cur) {
  30214. j = 0;
  30215. while (clazz = classes[j++]) {
  30216. // Remove *all* instances
  30217. while (cur.indexOf(" " + clazz + " ") > -1) {
  30218. cur = cur.replace(" " + clazz + " ", " ");
  30219. }
  30220. }
  30221. // Only assign if different to avoid unneeded rendering.
  30222. finalValue = stripAndCollapse(cur);
  30223. if (curValue !== finalValue) {
  30224. elem.setAttribute("class", finalValue);
  30225. }
  30226. }
  30227. }
  30228. }
  30229. return this;
  30230. },
  30231. toggleClass: function toggleClass(value, stateVal) {
  30232. var type = typeof value === "undefined" ? "undefined" : _typeof(value),
  30233. isValidValue = type === "string" || Array.isArray(value);
  30234. if (typeof stateVal === "boolean" && isValidValue) {
  30235. return stateVal ? this.addClass(value) : this.removeClass(value);
  30236. }
  30237. if (isFunction(value)) {
  30238. return this.each(function (i) {
  30239. jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);
  30240. });
  30241. }
  30242. return this.each(function () {
  30243. var className, i, self, classNames;
  30244. if (isValidValue) {
  30245. // Toggle individual class names
  30246. i = 0;
  30247. self = jQuery(this);
  30248. classNames = classesToArray(value);
  30249. while (className = classNames[i++]) {
  30250. // Check each className given, space separated list
  30251. if (self.hasClass(className)) {
  30252. self.removeClass(className);
  30253. } else {
  30254. self.addClass(className);
  30255. }
  30256. }
  30257. // Toggle whole class name
  30258. } else if (value === undefined || type === "boolean") {
  30259. className = getClass(this);
  30260. if (className) {
  30261. // Store className if set
  30262. dataPriv.set(this, "__className__", className);
  30263. }
  30264. // If the element has a class name or if we're passed `false`,
  30265. // then remove the whole classname (if there was one, the above saved it).
  30266. // Otherwise bring back whatever was previously saved (if anything),
  30267. // falling back to the empty string if nothing was stored.
  30268. if (this.setAttribute) {
  30269. this.setAttribute("class", className || value === false ? "" : dataPriv.get(this, "__className__") || "");
  30270. }
  30271. }
  30272. });
  30273. },
  30274. hasClass: function hasClass(selector) {
  30275. var className,
  30276. elem,
  30277. i = 0;
  30278. className = " " + selector + " ";
  30279. while (elem = this[i++]) {
  30280. if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) {
  30281. return true;
  30282. }
  30283. }
  30284. return false;
  30285. }
  30286. });
  30287. var rreturn = /\r/g;
  30288. jQuery.fn.extend({
  30289. val: function val(value) {
  30290. var hooks,
  30291. ret,
  30292. valueIsFunction,
  30293. elem = this[0];
  30294. if (!arguments.length) {
  30295. if (elem) {
  30296. hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
  30297. if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
  30298. return ret;
  30299. }
  30300. ret = elem.value;
  30301. // Handle most common string cases
  30302. if (typeof ret === "string") {
  30303. return ret.replace(rreturn, "");
  30304. }
  30305. // Handle cases where value is null/undef or number
  30306. return ret == null ? "" : ret;
  30307. }
  30308. return;
  30309. }
  30310. valueIsFunction = isFunction(value);
  30311. return this.each(function (i) {
  30312. var val;
  30313. if (this.nodeType !== 1) {
  30314. return;
  30315. }
  30316. if (valueIsFunction) {
  30317. val = value.call(this, i, jQuery(this).val());
  30318. } else {
  30319. val = value;
  30320. }
  30321. // Treat null/undefined as ""; convert numbers to string
  30322. if (val == null) {
  30323. val = "";
  30324. } else if (typeof val === "number") {
  30325. val += "";
  30326. } else if (Array.isArray(val)) {
  30327. val = jQuery.map(val, function (value) {
  30328. return value == null ? "" : value + "";
  30329. });
  30330. }
  30331. hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  30332. // If set returns undefined, fall back to normal setting
  30333. if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
  30334. this.value = val;
  30335. }
  30336. });
  30337. }
  30338. });
  30339. jQuery.extend({
  30340. valHooks: {
  30341. option: {
  30342. get: function get(elem) {
  30343. var val = jQuery.find.attr(elem, "value");
  30344. return val != null ? val :
  30345. // Support: IE <=10 - 11 only
  30346. // option.text throws exceptions (#14686, #14858)
  30347. // Strip and collapse whitespace
  30348. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  30349. stripAndCollapse(jQuery.text(elem));
  30350. }
  30351. },
  30352. select: {
  30353. get: function get(elem) {
  30354. var value,
  30355. option,
  30356. i,
  30357. options = elem.options,
  30358. index = elem.selectedIndex,
  30359. one = elem.type === "select-one",
  30360. values = one ? null : [],
  30361. max = one ? index + 1 : options.length;
  30362. if (index < 0) {
  30363. i = max;
  30364. } else {
  30365. i = one ? index : 0;
  30366. }
  30367. // Loop through all the selected options
  30368. for (; i < max; i++) {
  30369. option = options[i];
  30370. // Support: IE <=9 only
  30371. // IE8-9 doesn't update selected after form reset (#2551)
  30372. if ((option.selected || i === index) &&
  30373. // Don't return options that are disabled or in a disabled optgroup
  30374. !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
  30375. // Get the specific value for the option
  30376. value = jQuery(option).val();
  30377. // We don't need an array for one selects
  30378. if (one) {
  30379. return value;
  30380. }
  30381. // Multi-Selects return an array
  30382. values.push(value);
  30383. }
  30384. }
  30385. return values;
  30386. },
  30387. set: function set(elem, value) {
  30388. var optionSet,
  30389. option,
  30390. options = elem.options,
  30391. values = jQuery.makeArray(value),
  30392. i = options.length;
  30393. while (i--) {
  30394. option = options[i];
  30395. /* eslint-disable no-cond-assign */
  30396. if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {
  30397. optionSet = true;
  30398. }
  30399. /* eslint-enable no-cond-assign */
  30400. }
  30401. // Force browsers to behave consistently when non-matching value is set
  30402. if (!optionSet) {
  30403. elem.selectedIndex = -1;
  30404. }
  30405. return values;
  30406. }
  30407. }
  30408. }
  30409. });
  30410. // Radios and checkboxes getter/setter
  30411. jQuery.each(["radio", "checkbox"], function () {
  30412. jQuery.valHooks[this] = {
  30413. set: function set(elem, value) {
  30414. if (Array.isArray(value)) {
  30415. return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
  30416. }
  30417. }
  30418. };
  30419. if (!support.checkOn) {
  30420. jQuery.valHooks[this].get = function (elem) {
  30421. return elem.getAttribute("value") === null ? "on" : elem.value;
  30422. };
  30423. }
  30424. });
  30425. // Return jQuery for attributes-only inclusion
  30426. support.focusin = "onfocusin" in window;
  30427. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  30428. stopPropagationCallback = function stopPropagationCallback(e) {
  30429. e.stopPropagation();
  30430. };
  30431. jQuery.extend(jQuery.event, {
  30432. trigger: function trigger(event, data, elem, onlyHandlers) {
  30433. var i,
  30434. cur,
  30435. tmp,
  30436. bubbleType,
  30437. ontype,
  30438. handle,
  30439. special,
  30440. lastElement,
  30441. eventPath = [elem || document],
  30442. type = hasOwn.call(event, "type") ? event.type : event,
  30443. namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
  30444. cur = lastElement = tmp = elem = elem || document;
  30445. // Don't do events on text and comment nodes
  30446. if (elem.nodeType === 3 || elem.nodeType === 8) {
  30447. return;
  30448. }
  30449. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  30450. if (rfocusMorph.test(type + jQuery.event.triggered)) {
  30451. return;
  30452. }
  30453. if (type.indexOf(".") > -1) {
  30454. // Namespaced trigger; create a regexp to match event type in handle()
  30455. namespaces = type.split(".");
  30456. type = namespaces.shift();
  30457. namespaces.sort();
  30458. }
  30459. ontype = type.indexOf(":") < 0 && "on" + type;
  30460. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  30461. event = event[jQuery.expando] ? event : new jQuery.Event(type, (typeof event === "undefined" ? "undefined" : _typeof(event)) === "object" && event);
  30462. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  30463. event.isTrigger = onlyHandlers ? 2 : 3;
  30464. event.namespace = namespaces.join(".");
  30465. event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
  30466. // Clean up the event in case it is being reused
  30467. event.result = undefined;
  30468. if (!event.target) {
  30469. event.target = elem;
  30470. }
  30471. // Clone any incoming data and prepend the event, creating the handler arg list
  30472. data = data == null ? [event] : jQuery.makeArray(data, [event]);
  30473. // Allow special events to draw outside the lines
  30474. special = jQuery.event.special[type] || {};
  30475. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  30476. return;
  30477. }
  30478. // Determine event propagation path in advance, per W3C events spec (#9951)
  30479. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  30480. if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
  30481. bubbleType = special.delegateType || type;
  30482. if (!rfocusMorph.test(bubbleType + type)) {
  30483. cur = cur.parentNode;
  30484. }
  30485. for (; cur; cur = cur.parentNode) {
  30486. eventPath.push(cur);
  30487. tmp = cur;
  30488. }
  30489. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  30490. if (tmp === (elem.ownerDocument || document)) {
  30491. eventPath.push(tmp.defaultView || tmp.parentWindow || window);
  30492. }
  30493. }
  30494. // Fire handlers on the event path
  30495. i = 0;
  30496. while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
  30497. lastElement = cur;
  30498. event.type = i > 1 ? bubbleType : special.bindType || type;
  30499. // jQuery handler
  30500. handle = (dataPriv.get(cur, "events") || {})[event.type] && dataPriv.get(cur, "handle");
  30501. if (handle) {
  30502. handle.apply(cur, data);
  30503. }
  30504. // Native handler
  30505. handle = ontype && cur[ontype];
  30506. if (handle && handle.apply && acceptData(cur)) {
  30507. event.result = handle.apply(cur, data);
  30508. if (event.result === false) {
  30509. event.preventDefault();
  30510. }
  30511. }
  30512. }
  30513. event.type = type;
  30514. // If nobody prevented the default action, do it now
  30515. if (!onlyHandlers && !event.isDefaultPrevented()) {
  30516. if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
  30517. // Call a native DOM method on the target with the same name as the event.
  30518. // Don't do default actions on window, that's where global variables be (#6170)
  30519. if (ontype && isFunction(elem[type]) && !isWindow(elem)) {
  30520. // Don't re-trigger an onFOO event when we call its FOO() method
  30521. tmp = elem[ontype];
  30522. if (tmp) {
  30523. elem[ontype] = null;
  30524. }
  30525. // Prevent re-triggering of the same event, since we already bubbled it above
  30526. jQuery.event.triggered = type;
  30527. if (event.isPropagationStopped()) {
  30528. lastElement.addEventListener(type, stopPropagationCallback);
  30529. }
  30530. elem[type]();
  30531. if (event.isPropagationStopped()) {
  30532. lastElement.removeEventListener(type, stopPropagationCallback);
  30533. }
  30534. jQuery.event.triggered = undefined;
  30535. if (tmp) {
  30536. elem[ontype] = tmp;
  30537. }
  30538. }
  30539. }
  30540. }
  30541. return event.result;
  30542. },
  30543. // Piggyback on a donor event to simulate a different one
  30544. // Used only for `focus(in | out)` events
  30545. simulate: function simulate(type, elem, event) {
  30546. var e = jQuery.extend(new jQuery.Event(), event, {
  30547. type: type,
  30548. isSimulated: true
  30549. });
  30550. jQuery.event.trigger(e, null, elem);
  30551. }
  30552. });
  30553. jQuery.fn.extend({
  30554. trigger: function trigger(type, data) {
  30555. return this.each(function () {
  30556. jQuery.event.trigger(type, data, this);
  30557. });
  30558. },
  30559. triggerHandler: function triggerHandler(type, data) {
  30560. var elem = this[0];
  30561. if (elem) {
  30562. return jQuery.event.trigger(type, data, elem, true);
  30563. }
  30564. }
  30565. });
  30566. // Support: Firefox <=44
  30567. // Firefox doesn't have focus(in | out) events
  30568. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  30569. //
  30570. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  30571. // focus(in | out) events fire after focus & blur events,
  30572. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  30573. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  30574. if (!support.focusin) {
  30575. jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) {
  30576. // Attach a single capturing handler on the document while someone wants focusin/focusout
  30577. var handler = function handler(event) {
  30578. jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
  30579. };
  30580. jQuery.event.special[fix] = {
  30581. setup: function setup() {
  30582. var doc = this.ownerDocument || this,
  30583. attaches = dataPriv.access(doc, fix);
  30584. if (!attaches) {
  30585. doc.addEventListener(orig, handler, true);
  30586. }
  30587. dataPriv.access(doc, fix, (attaches || 0) + 1);
  30588. },
  30589. teardown: function teardown() {
  30590. var doc = this.ownerDocument || this,
  30591. attaches = dataPriv.access(doc, fix) - 1;
  30592. if (!attaches) {
  30593. doc.removeEventListener(orig, handler, true);
  30594. dataPriv.remove(doc, fix);
  30595. } else {
  30596. dataPriv.access(doc, fix, attaches);
  30597. }
  30598. }
  30599. };
  30600. });
  30601. }
  30602. var location = window.location;
  30603. var nonce = Date.now();
  30604. var rquery = /\?/;
  30605. // Cross-browser xml parsing
  30606. jQuery.parseXML = function (data) {
  30607. var xml;
  30608. if (!data || typeof data !== "string") {
  30609. return null;
  30610. }
  30611. // Support: IE 9 - 11 only
  30612. // IE throws on parseFromString with invalid input.
  30613. try {
  30614. xml = new window.DOMParser().parseFromString(data, "text/xml");
  30615. } catch (e) {
  30616. xml = undefined;
  30617. }
  30618. if (!xml || xml.getElementsByTagName("parsererror").length) {
  30619. jQuery.error("Invalid XML: " + data);
  30620. }
  30621. return xml;
  30622. };
  30623. var rbracket = /\[\]$/,
  30624. rCRLF = /\r?\n/g,
  30625. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  30626. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  30627. function buildParams(prefix, obj, traditional, add) {
  30628. var name;
  30629. if (Array.isArray(obj)) {
  30630. // Serialize array item.
  30631. jQuery.each(obj, function (i, v) {
  30632. if (traditional || rbracket.test(prefix)) {
  30633. // Treat each array item as a scalar.
  30634. add(prefix, v);
  30635. } else {
  30636. // Item is non-scalar (array or object), encode its numeric index.
  30637. buildParams(prefix + "[" + ((typeof v === "undefined" ? "undefined" : _typeof(v)) === "object" && v != null ? i : "") + "]", v, traditional, add);
  30638. }
  30639. });
  30640. } else if (!traditional && toType(obj) === "object") {
  30641. // Serialize object item.
  30642. for (name in obj) {
  30643. buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
  30644. }
  30645. } else {
  30646. // Serialize scalar item.
  30647. add(prefix, obj);
  30648. }
  30649. }
  30650. // Serialize an array of form elements or a set of
  30651. // key/values into a query string
  30652. jQuery.param = function (a, traditional) {
  30653. var prefix,
  30654. s = [],
  30655. add = function add(key, valueOrFunction) {
  30656. // If value is a function, invoke it and use its return value
  30657. var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;
  30658. s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
  30659. };
  30660. // If an array was passed in, assume that it is an array of form elements.
  30661. if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
  30662. // Serialize the form elements
  30663. jQuery.each(a, function () {
  30664. add(this.name, this.value);
  30665. });
  30666. } else {
  30667. // If traditional, encode the "old" way (the way 1.3.2 or older
  30668. // did it), otherwise encode params recursively.
  30669. for (prefix in a) {
  30670. buildParams(prefix, a[prefix], traditional, add);
  30671. }
  30672. }
  30673. // Return the resulting serialization
  30674. return s.join("&");
  30675. };
  30676. jQuery.fn.extend({
  30677. serialize: function serialize() {
  30678. return jQuery.param(this.serializeArray());
  30679. },
  30680. serializeArray: function serializeArray() {
  30681. return this.map(function () {
  30682. // Can add propHook for "elements" to filter or add form elements
  30683. var elements = jQuery.prop(this, "elements");
  30684. return elements ? jQuery.makeArray(elements) : this;
  30685. }).filter(function () {
  30686. var type = this.type;
  30687. // Use .is( ":disabled" ) so that fieldset[disabled] works
  30688. return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));
  30689. }).map(function (i, elem) {
  30690. var val = jQuery(this).val();
  30691. if (val == null) {
  30692. return null;
  30693. }
  30694. if (Array.isArray(val)) {
  30695. return jQuery.map(val, function (val) {
  30696. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  30697. });
  30698. }
  30699. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  30700. }).get();
  30701. }
  30702. });
  30703. var r20 = /%20/g,
  30704. rhash = /#.*$/,
  30705. rantiCache = /([?&])_=[^&]*/,
  30706. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  30707. // #7653, #8125, #8152: local protocol detection
  30708. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  30709. rnoContent = /^(?:GET|HEAD)$/,
  30710. rprotocol = /^\/\//,
  30711. /* Prefilters
  30712. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  30713. * 2) These are called:
  30714. * - BEFORE asking for a transport
  30715. * - AFTER param serialization (s.data is a string if s.processData is true)
  30716. * 3) key is the dataType
  30717. * 4) the catchall symbol "*" can be used
  30718. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  30719. */
  30720. prefilters = {},
  30721. /* Transports bindings
  30722. * 1) key is the dataType
  30723. * 2) the catchall symbol "*" can be used
  30724. * 3) selection will start with transport dataType and THEN go to "*" if needed
  30725. */
  30726. transports = {},
  30727. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  30728. allTypes = "*/".concat("*"),
  30729. // Anchor tag for parsing the document origin
  30730. originAnchor = document.createElement("a");
  30731. originAnchor.href = location.href;
  30732. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  30733. function addToPrefiltersOrTransports(structure) {
  30734. // dataTypeExpression is optional and defaults to "*"
  30735. return function (dataTypeExpression, func) {
  30736. if (typeof dataTypeExpression !== "string") {
  30737. func = dataTypeExpression;
  30738. dataTypeExpression = "*";
  30739. }
  30740. var dataType,
  30741. i = 0,
  30742. dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
  30743. if (isFunction(func)) {
  30744. // For each dataType in the dataTypeExpression
  30745. while (dataType = dataTypes[i++]) {
  30746. // Prepend if requested
  30747. if (dataType[0] === "+") {
  30748. dataType = dataType.slice(1) || "*";
  30749. (structure[dataType] = structure[dataType] || []).unshift(func);
  30750. // Otherwise append
  30751. } else {
  30752. (structure[dataType] = structure[dataType] || []).push(func);
  30753. }
  30754. }
  30755. }
  30756. };
  30757. }
  30758. // Base inspection function for prefilters and transports
  30759. function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
  30760. var inspected = {},
  30761. seekingTransport = structure === transports;
  30762. function inspect(dataType) {
  30763. var selected;
  30764. inspected[dataType] = true;
  30765. jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
  30766. var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
  30767. if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
  30768. options.dataTypes.unshift(dataTypeOrTransport);
  30769. inspect(dataTypeOrTransport);
  30770. return false;
  30771. } else if (seekingTransport) {
  30772. return !(selected = dataTypeOrTransport);
  30773. }
  30774. });
  30775. return selected;
  30776. }
  30777. return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
  30778. }
  30779. // A special extend for ajax options
  30780. // that takes "flat" options (not to be deep extended)
  30781. // Fixes #9887
  30782. function ajaxExtend(target, src) {
  30783. var key,
  30784. deep,
  30785. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  30786. for (key in src) {
  30787. if (src[key] !== undefined) {
  30788. (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
  30789. }
  30790. }
  30791. if (deep) {
  30792. jQuery.extend(true, target, deep);
  30793. }
  30794. return target;
  30795. }
  30796. /* Handles responses to an ajax request:
  30797. * - finds the right dataType (mediates between content-type and expected dataType)
  30798. * - returns the corresponding response
  30799. */
  30800. function ajaxHandleResponses(s, jqXHR, responses) {
  30801. var ct,
  30802. type,
  30803. finalDataType,
  30804. firstDataType,
  30805. contents = s.contents,
  30806. dataTypes = s.dataTypes;
  30807. // Remove auto dataType and get content-type in the process
  30808. while (dataTypes[0] === "*") {
  30809. dataTypes.shift();
  30810. if (ct === undefined) {
  30811. ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  30812. }
  30813. }
  30814. // Check if we're dealing with a known content-type
  30815. if (ct) {
  30816. for (type in contents) {
  30817. if (contents[type] && contents[type].test(ct)) {
  30818. dataTypes.unshift(type);
  30819. break;
  30820. }
  30821. }
  30822. }
  30823. // Check to see if we have a response for the expected dataType
  30824. if (dataTypes[0] in responses) {
  30825. finalDataType = dataTypes[0];
  30826. } else {
  30827. // Try convertible dataTypes
  30828. for (type in responses) {
  30829. if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
  30830. finalDataType = type;
  30831. break;
  30832. }
  30833. if (!firstDataType) {
  30834. firstDataType = type;
  30835. }
  30836. }
  30837. // Or just use first one
  30838. finalDataType = finalDataType || firstDataType;
  30839. }
  30840. // If we found a dataType
  30841. // We add the dataType to the list if needed
  30842. // and return the corresponding response
  30843. if (finalDataType) {
  30844. if (finalDataType !== dataTypes[0]) {
  30845. dataTypes.unshift(finalDataType);
  30846. }
  30847. return responses[finalDataType];
  30848. }
  30849. }
  30850. /* Chain conversions given the request and the original response
  30851. * Also sets the responseXXX fields on the jqXHR instance
  30852. */
  30853. function ajaxConvert(s, response, jqXHR, isSuccess) {
  30854. var conv2,
  30855. current,
  30856. conv,
  30857. tmp,
  30858. prev,
  30859. converters = {},
  30860. // Work with a copy of dataTypes in case we need to modify it for conversion
  30861. dataTypes = s.dataTypes.slice();
  30862. // Create converters map with lowercased keys
  30863. if (dataTypes[1]) {
  30864. for (conv in s.converters) {
  30865. converters[conv.toLowerCase()] = s.converters[conv];
  30866. }
  30867. }
  30868. current = dataTypes.shift();
  30869. // Convert to each sequential dataType
  30870. while (current) {
  30871. if (s.responseFields[current]) {
  30872. jqXHR[s.responseFields[current]] = response;
  30873. }
  30874. // Apply the dataFilter if provided
  30875. if (!prev && isSuccess && s.dataFilter) {
  30876. response = s.dataFilter(response, s.dataType);
  30877. }
  30878. prev = current;
  30879. current = dataTypes.shift();
  30880. if (current) {
  30881. // There's only work to do if current dataType is non-auto
  30882. if (current === "*") {
  30883. current = prev;
  30884. // Convert response if prev dataType is non-auto and differs from current
  30885. } else if (prev !== "*" && prev !== current) {
  30886. // Seek a direct converter
  30887. conv = converters[prev + " " + current] || converters["* " + current];
  30888. // If none found, seek a pair
  30889. if (!conv) {
  30890. for (conv2 in converters) {
  30891. // If conv2 outputs current
  30892. tmp = conv2.split(" ");
  30893. if (tmp[1] === current) {
  30894. // If prev can be converted to accepted input
  30895. conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
  30896. if (conv) {
  30897. // Condense equivalence converters
  30898. if (conv === true) {
  30899. conv = converters[conv2];
  30900. // Otherwise, insert the intermediate dataType
  30901. } else if (converters[conv2] !== true) {
  30902. current = tmp[0];
  30903. dataTypes.unshift(tmp[1]);
  30904. }
  30905. break;
  30906. }
  30907. }
  30908. }
  30909. }
  30910. // Apply converter (if not an equivalence)
  30911. if (conv !== true) {
  30912. // Unless errors are allowed to bubble, catch and return them
  30913. if (conv && s.throws) {
  30914. response = conv(response);
  30915. } else {
  30916. try {
  30917. response = conv(response);
  30918. } catch (e) {
  30919. return {
  30920. state: "parsererror",
  30921. error: conv ? e : "No conversion from " + prev + " to " + current
  30922. };
  30923. }
  30924. }
  30925. }
  30926. }
  30927. }
  30928. }
  30929. return { state: "success", data: response };
  30930. }
  30931. jQuery.extend({
  30932. // Counter for holding the number of active queries
  30933. active: 0,
  30934. // Last-Modified header cache for next request
  30935. lastModified: {},
  30936. etag: {},
  30937. ajaxSettings: {
  30938. url: location.href,
  30939. type: "GET",
  30940. isLocal: rlocalProtocol.test(location.protocol),
  30941. global: true,
  30942. processData: true,
  30943. async: true,
  30944. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  30945. /*
  30946. timeout: 0,
  30947. data: null,
  30948. dataType: null,
  30949. username: null,
  30950. password: null,
  30951. cache: null,
  30952. throws: false,
  30953. traditional: false,
  30954. headers: {},
  30955. */
  30956. accepts: {
  30957. "*": allTypes,
  30958. text: "text/plain",
  30959. html: "text/html",
  30960. xml: "application/xml, text/xml",
  30961. json: "application/json, text/javascript"
  30962. },
  30963. contents: {
  30964. xml: /\bxml\b/,
  30965. html: /\bhtml/,
  30966. json: /\bjson\b/
  30967. },
  30968. responseFields: {
  30969. xml: "responseXML",
  30970. text: "responseText",
  30971. json: "responseJSON"
  30972. },
  30973. // Data converters
  30974. // Keys separate source (or catchall "*") and destination types with a single space
  30975. converters: {
  30976. // Convert anything to text
  30977. "* text": String,
  30978. // Text to html (true = no transformation)
  30979. "text html": true,
  30980. // Evaluate text as a json expression
  30981. "text json": JSON.parse,
  30982. // Parse text as xml
  30983. "text xml": jQuery.parseXML
  30984. },
  30985. // For options that shouldn't be deep extended:
  30986. // you can add your own custom options here if
  30987. // and when you create one that shouldn't be
  30988. // deep extended (see ajaxExtend)
  30989. flatOptions: {
  30990. url: true,
  30991. context: true
  30992. }
  30993. },
  30994. // Creates a full fledged settings object into target
  30995. // with both ajaxSettings and settings fields.
  30996. // If target is omitted, writes into ajaxSettings.
  30997. ajaxSetup: function ajaxSetup(target, settings) {
  30998. return settings ?
  30999. // Building a settings object
  31000. ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
  31001. // Extending ajaxSettings
  31002. ajaxExtend(jQuery.ajaxSettings, target);
  31003. },
  31004. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  31005. ajaxTransport: addToPrefiltersOrTransports(transports),
  31006. // Main method
  31007. ajax: function ajax(url, options) {
  31008. // If url is an object, simulate pre-1.5 signature
  31009. if ((typeof url === "undefined" ? "undefined" : _typeof(url)) === "object") {
  31010. options = url;
  31011. url = undefined;
  31012. }
  31013. // Force options to be an object
  31014. options = options || {};
  31015. var transport,
  31016. // URL without anti-cache param
  31017. cacheURL,
  31018. // Response headers
  31019. responseHeadersString,
  31020. responseHeaders,
  31021. // timeout handle
  31022. timeoutTimer,
  31023. // Url cleanup var
  31024. urlAnchor,
  31025. // Request state (becomes false upon send and true upon completion)
  31026. completed,
  31027. // To know if global events are to be dispatched
  31028. fireGlobals,
  31029. // Loop variable
  31030. i,
  31031. // uncached part of the url
  31032. uncached,
  31033. // Create the final options object
  31034. s = jQuery.ajaxSetup({}, options),
  31035. // Callbacks context
  31036. callbackContext = s.context || s,
  31037. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  31038. globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
  31039. // Deferreds
  31040. deferred = jQuery.Deferred(),
  31041. completeDeferred = jQuery.Callbacks("once memory"),
  31042. // Status-dependent callbacks
  31043. _statusCode = s.statusCode || {},
  31044. // Headers (they are sent all at once)
  31045. requestHeaders = {},
  31046. requestHeadersNames = {},
  31047. // Default abort message
  31048. strAbort = "canceled",
  31049. // Fake xhr
  31050. jqXHR = {
  31051. readyState: 0,
  31052. // Builds headers hashtable if needed
  31053. getResponseHeader: function getResponseHeader(key) {
  31054. var match;
  31055. if (completed) {
  31056. if (!responseHeaders) {
  31057. responseHeaders = {};
  31058. while (match = rheaders.exec(responseHeadersString)) {
  31059. responseHeaders[match[1].toLowerCase()] = match[2];
  31060. }
  31061. }
  31062. match = responseHeaders[key.toLowerCase()];
  31063. }
  31064. return match == null ? null : match;
  31065. },
  31066. // Raw string
  31067. getAllResponseHeaders: function getAllResponseHeaders() {
  31068. return completed ? responseHeadersString : null;
  31069. },
  31070. // Caches the header
  31071. setRequestHeader: function setRequestHeader(name, value) {
  31072. if (completed == null) {
  31073. name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
  31074. requestHeaders[name] = value;
  31075. }
  31076. return this;
  31077. },
  31078. // Overrides response content-type header
  31079. overrideMimeType: function overrideMimeType(type) {
  31080. if (completed == null) {
  31081. s.mimeType = type;
  31082. }
  31083. return this;
  31084. },
  31085. // Status-dependent callbacks
  31086. statusCode: function statusCode(map) {
  31087. var code;
  31088. if (map) {
  31089. if (completed) {
  31090. // Execute the appropriate callbacks
  31091. jqXHR.always(map[jqXHR.status]);
  31092. } else {
  31093. // Lazy-add the new callbacks in a way that preserves old ones
  31094. for (code in map) {
  31095. _statusCode[code] = [_statusCode[code], map[code]];
  31096. }
  31097. }
  31098. }
  31099. return this;
  31100. },
  31101. // Cancel the request
  31102. abort: function abort(statusText) {
  31103. var finalText = statusText || strAbort;
  31104. if (transport) {
  31105. transport.abort(finalText);
  31106. }
  31107. done(0, finalText);
  31108. return this;
  31109. }
  31110. };
  31111. // Attach deferreds
  31112. deferred.promise(jqXHR);
  31113. // Add protocol if not provided (prefilters might expect it)
  31114. // Handle falsy url in the settings object (#10093: consistency with old signature)
  31115. // We also use the url parameter if available
  31116. s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//");
  31117. // Alias method option to type as per ticket #12004
  31118. s.type = options.method || options.type || s.method || s.type;
  31119. // Extract dataTypes list
  31120. s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
  31121. // A cross-domain request is in order when the origin doesn't match the current origin.
  31122. if (s.crossDomain == null) {
  31123. urlAnchor = document.createElement("a");
  31124. // Support: IE <=8 - 11, Edge 12 - 15
  31125. // IE throws exception on accessing the href property if url is malformed,
  31126. // e.g. http://example.com:80x/
  31127. try {
  31128. urlAnchor.href = s.url;
  31129. // Support: IE <=8 - 11 only
  31130. // Anchor's host property isn't correctly set when s.url is relative
  31131. urlAnchor.href = urlAnchor.href;
  31132. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
  31133. } catch (e) {
  31134. // If there is an error parsing the URL, assume it is crossDomain,
  31135. // it can be rejected by the transport if it is invalid
  31136. s.crossDomain = true;
  31137. }
  31138. }
  31139. // Convert data if not already a string
  31140. if (s.data && s.processData && typeof s.data !== "string") {
  31141. s.data = jQuery.param(s.data, s.traditional);
  31142. }
  31143. // Apply prefilters
  31144. inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
  31145. // If request was aborted inside a prefilter, stop there
  31146. if (completed) {
  31147. return jqXHR;
  31148. }
  31149. // We can fire global events as of now if asked to
  31150. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  31151. fireGlobals = jQuery.event && s.global;
  31152. // Watch for a new set of requests
  31153. if (fireGlobals && jQuery.active++ === 0) {
  31154. jQuery.event.trigger("ajaxStart");
  31155. }
  31156. // Uppercase the type
  31157. s.type = s.type.toUpperCase();
  31158. // Determine if request has content
  31159. s.hasContent = !rnoContent.test(s.type);
  31160. // Save the URL in case we're toying with the If-Modified-Since
  31161. // and/or If-None-Match header later on
  31162. // Remove hash to simplify url manipulation
  31163. cacheURL = s.url.replace(rhash, "");
  31164. // More options handling for requests with no content
  31165. if (!s.hasContent) {
  31166. // Remember the hash so we can put it back
  31167. uncached = s.url.slice(cacheURL.length);
  31168. // If data is available and should be processed, append data to url
  31169. if (s.data && (s.processData || typeof s.data === "string")) {
  31170. cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
  31171. // #9682: remove data so that it's not used in an eventual retry
  31172. delete s.data;
  31173. }
  31174. // Add or update anti-cache param if needed
  31175. if (s.cache === false) {
  31176. cacheURL = cacheURL.replace(rantiCache, "$1");
  31177. uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++ + uncached;
  31178. }
  31179. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  31180. s.url = cacheURL + uncached;
  31181. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  31182. } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
  31183. s.data = s.data.replace(r20, "+");
  31184. }
  31185. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  31186. if (s.ifModified) {
  31187. if (jQuery.lastModified[cacheURL]) {
  31188. jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
  31189. }
  31190. if (jQuery.etag[cacheURL]) {
  31191. jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
  31192. }
  31193. }
  31194. // Set the correct header, if data is being sent
  31195. if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
  31196. jqXHR.setRequestHeader("Content-Type", s.contentType);
  31197. }
  31198. // Set the Accepts header for the server, depending on the dataType
  31199. jqXHR.setRequestHeader("Accept", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"]);
  31200. // Check for headers option
  31201. for (i in s.headers) {
  31202. jqXHR.setRequestHeader(i, s.headers[i]);
  31203. }
  31204. // Allow custom headers/mimetypes and early abort
  31205. if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {
  31206. // Abort if not done already and return
  31207. return jqXHR.abort();
  31208. }
  31209. // Aborting is no longer a cancellation
  31210. strAbort = "abort";
  31211. // Install callbacks on deferreds
  31212. completeDeferred.add(s.complete);
  31213. jqXHR.done(s.success);
  31214. jqXHR.fail(s.error);
  31215. // Get transport
  31216. transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
  31217. // If no transport, we auto-abort
  31218. if (!transport) {
  31219. done(-1, "No Transport");
  31220. } else {
  31221. jqXHR.readyState = 1;
  31222. // Send global event
  31223. if (fireGlobals) {
  31224. globalEventContext.trigger("ajaxSend", [jqXHR, s]);
  31225. }
  31226. // If request was aborted inside ajaxSend, stop there
  31227. if (completed) {
  31228. return jqXHR;
  31229. }
  31230. // Timeout
  31231. if (s.async && s.timeout > 0) {
  31232. timeoutTimer = window.setTimeout(function () {
  31233. jqXHR.abort("timeout");
  31234. }, s.timeout);
  31235. }
  31236. try {
  31237. completed = false;
  31238. transport.send(requestHeaders, done);
  31239. } catch (e) {
  31240. // Rethrow post-completion exceptions
  31241. if (completed) {
  31242. throw e;
  31243. }
  31244. // Propagate others as results
  31245. done(-1, e);
  31246. }
  31247. }
  31248. // Callback for when everything is done
  31249. function done(status, nativeStatusText, responses, headers) {
  31250. var isSuccess,
  31251. success,
  31252. error,
  31253. response,
  31254. modified,
  31255. statusText = nativeStatusText;
  31256. // Ignore repeat invocations
  31257. if (completed) {
  31258. return;
  31259. }
  31260. completed = true;
  31261. // Clear timeout if it exists
  31262. if (timeoutTimer) {
  31263. window.clearTimeout(timeoutTimer);
  31264. }
  31265. // Dereference transport for early garbage collection
  31266. // (no matter how long the jqXHR object will be used)
  31267. transport = undefined;
  31268. // Cache response headers
  31269. responseHeadersString = headers || "";
  31270. // Set readyState
  31271. jqXHR.readyState = status > 0 ? 4 : 0;
  31272. // Determine if successful
  31273. isSuccess = status >= 200 && status < 300 || status === 304;
  31274. // Get response data
  31275. if (responses) {
  31276. response = ajaxHandleResponses(s, jqXHR, responses);
  31277. }
  31278. // Convert no matter what (that way responseXXX fields are always set)
  31279. response = ajaxConvert(s, response, jqXHR, isSuccess);
  31280. // If successful, handle type chaining
  31281. if (isSuccess) {
  31282. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  31283. if (s.ifModified) {
  31284. modified = jqXHR.getResponseHeader("Last-Modified");
  31285. if (modified) {
  31286. jQuery.lastModified[cacheURL] = modified;
  31287. }
  31288. modified = jqXHR.getResponseHeader("etag");
  31289. if (modified) {
  31290. jQuery.etag[cacheURL] = modified;
  31291. }
  31292. }
  31293. // if no content
  31294. if (status === 204 || s.type === "HEAD") {
  31295. statusText = "nocontent";
  31296. // if not modified
  31297. } else if (status === 304) {
  31298. statusText = "notmodified";
  31299. // If we have data, let's convert it
  31300. } else {
  31301. statusText = response.state;
  31302. success = response.data;
  31303. error = response.error;
  31304. isSuccess = !error;
  31305. }
  31306. } else {
  31307. // Extract error from statusText and normalize for non-aborts
  31308. error = statusText;
  31309. if (status || !statusText) {
  31310. statusText = "error";
  31311. if (status < 0) {
  31312. status = 0;
  31313. }
  31314. }
  31315. }
  31316. // Set data for the fake xhr object
  31317. jqXHR.status = status;
  31318. jqXHR.statusText = (nativeStatusText || statusText) + "";
  31319. // Success/Error
  31320. if (isSuccess) {
  31321. deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
  31322. } else {
  31323. deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
  31324. }
  31325. // Status-dependent callbacks
  31326. jqXHR.statusCode(_statusCode);
  31327. _statusCode = undefined;
  31328. if (fireGlobals) {
  31329. globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]);
  31330. }
  31331. // Complete
  31332. completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
  31333. if (fireGlobals) {
  31334. globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
  31335. // Handle the global AJAX counter
  31336. if (! --jQuery.active) {
  31337. jQuery.event.trigger("ajaxStop");
  31338. }
  31339. }
  31340. }
  31341. return jqXHR;
  31342. },
  31343. getJSON: function getJSON(url, data, callback) {
  31344. return jQuery.get(url, data, callback, "json");
  31345. },
  31346. getScript: function getScript(url, callback) {
  31347. return jQuery.get(url, undefined, callback, "script");
  31348. }
  31349. });
  31350. jQuery.each(["get", "post"], function (i, method) {
  31351. jQuery[method] = function (url, data, callback, type) {
  31352. // Shift arguments if data argument was omitted
  31353. if (isFunction(data)) {
  31354. type = type || callback;
  31355. callback = data;
  31356. data = undefined;
  31357. }
  31358. // The url can be an options object (which then must have .url)
  31359. return jQuery.ajax(jQuery.extend({
  31360. url: url,
  31361. type: method,
  31362. dataType: type,
  31363. data: data,
  31364. success: callback
  31365. }, jQuery.isPlainObject(url) && url));
  31366. };
  31367. });
  31368. jQuery._evalUrl = function (url) {
  31369. return jQuery.ajax({
  31370. url: url,
  31371. // Make this explicit, since user can override this through ajaxSetup (#11264)
  31372. type: "GET",
  31373. dataType: "script",
  31374. cache: true,
  31375. async: false,
  31376. global: false,
  31377. "throws": true
  31378. });
  31379. };
  31380. jQuery.fn.extend({
  31381. wrapAll: function wrapAll(html) {
  31382. var wrap;
  31383. if (this[0]) {
  31384. if (isFunction(html)) {
  31385. html = html.call(this[0]);
  31386. }
  31387. // The elements to wrap the target around
  31388. wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  31389. if (this[0].parentNode) {
  31390. wrap.insertBefore(this[0]);
  31391. }
  31392. wrap.map(function () {
  31393. var elem = this;
  31394. while (elem.firstElementChild) {
  31395. elem = elem.firstElementChild;
  31396. }
  31397. return elem;
  31398. }).append(this);
  31399. }
  31400. return this;
  31401. },
  31402. wrapInner: function wrapInner(html) {
  31403. if (isFunction(html)) {
  31404. return this.each(function (i) {
  31405. jQuery(this).wrapInner(html.call(this, i));
  31406. });
  31407. }
  31408. return this.each(function () {
  31409. var self = jQuery(this),
  31410. contents = self.contents();
  31411. if (contents.length) {
  31412. contents.wrapAll(html);
  31413. } else {
  31414. self.append(html);
  31415. }
  31416. });
  31417. },
  31418. wrap: function wrap(html) {
  31419. var htmlIsFunction = isFunction(html);
  31420. return this.each(function (i) {
  31421. jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
  31422. });
  31423. },
  31424. unwrap: function unwrap(selector) {
  31425. this.parent(selector).not("body").each(function () {
  31426. jQuery(this).replaceWith(this.childNodes);
  31427. });
  31428. return this;
  31429. }
  31430. });
  31431. jQuery.expr.pseudos.hidden = function (elem) {
  31432. return !jQuery.expr.pseudos.visible(elem);
  31433. };
  31434. jQuery.expr.pseudos.visible = function (elem) {
  31435. return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  31436. };
  31437. jQuery.ajaxSettings.xhr = function () {
  31438. try {
  31439. return new window.XMLHttpRequest();
  31440. } catch (e) {}
  31441. };
  31442. var xhrSuccessStatus = {
  31443. // File protocol always yields status code 0, assume 200
  31444. 0: 200,
  31445. // Support: IE <=9 only
  31446. // #1450: sometimes IE returns 1223 when it should be 204
  31447. 1223: 204
  31448. },
  31449. xhrSupported = jQuery.ajaxSettings.xhr();
  31450. support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
  31451. support.ajax = xhrSupported = !!xhrSupported;
  31452. jQuery.ajaxTransport(function (options) {
  31453. var _callback, errorCallback;
  31454. // Cross domain only allowed if supported through XMLHttpRequest
  31455. if (support.cors || xhrSupported && !options.crossDomain) {
  31456. return {
  31457. send: function send(headers, complete) {
  31458. var i,
  31459. xhr = options.xhr();
  31460. xhr.open(options.type, options.url, options.async, options.username, options.password);
  31461. // Apply custom fields if provided
  31462. if (options.xhrFields) {
  31463. for (i in options.xhrFields) {
  31464. xhr[i] = options.xhrFields[i];
  31465. }
  31466. }
  31467. // Override mime type if needed
  31468. if (options.mimeType && xhr.overrideMimeType) {
  31469. xhr.overrideMimeType(options.mimeType);
  31470. }
  31471. // X-Requested-With header
  31472. // For cross-domain requests, seeing as conditions for a preflight are
  31473. // akin to a jigsaw puzzle, we simply never set it to be sure.
  31474. // (it can always be set on a per-request basis or even using ajaxSetup)
  31475. // For same-domain requests, won't change header if already provided.
  31476. if (!options.crossDomain && !headers["X-Requested-With"]) {
  31477. headers["X-Requested-With"] = "XMLHttpRequest";
  31478. }
  31479. // Set headers
  31480. for (i in headers) {
  31481. xhr.setRequestHeader(i, headers[i]);
  31482. }
  31483. // Callback
  31484. _callback = function callback(type) {
  31485. return function () {
  31486. if (_callback) {
  31487. _callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
  31488. if (type === "abort") {
  31489. xhr.abort();
  31490. } else if (type === "error") {
  31491. // Support: IE <=9 only
  31492. // On a manual native abort, IE9 throws
  31493. // errors on any property access that is not readyState
  31494. if (typeof xhr.status !== "number") {
  31495. complete(0, "error");
  31496. } else {
  31497. complete(
  31498. // File: protocol always yields status 0; see #8605, #14207
  31499. xhr.status, xhr.statusText);
  31500. }
  31501. } else {
  31502. complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText,
  31503. // Support: IE <=9 only
  31504. // IE9 has no XHR2 but throws on binary (trac-11426)
  31505. // For XHR2 non-text, let the caller handle it (gh-2498)
  31506. (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders());
  31507. }
  31508. }
  31509. };
  31510. };
  31511. // Listen to events
  31512. xhr.onload = _callback();
  31513. errorCallback = xhr.onerror = xhr.ontimeout = _callback("error");
  31514. // Support: IE 9 only
  31515. // Use onreadystatechange to replace onabort
  31516. // to handle uncaught aborts
  31517. if (xhr.onabort !== undefined) {
  31518. xhr.onabort = errorCallback;
  31519. } else {
  31520. xhr.onreadystatechange = function () {
  31521. // Check readyState before timeout as it changes
  31522. if (xhr.readyState === 4) {
  31523. // Allow onerror to be called first,
  31524. // but that will not handle a native abort
  31525. // Also, save errorCallback to a variable
  31526. // as xhr.onerror cannot be accessed
  31527. window.setTimeout(function () {
  31528. if (_callback) {
  31529. errorCallback();
  31530. }
  31531. });
  31532. }
  31533. };
  31534. }
  31535. // Create the abort callback
  31536. _callback = _callback("abort");
  31537. try {
  31538. // Do send the request (this may raise an exception)
  31539. xhr.send(options.hasContent && options.data || null);
  31540. } catch (e) {
  31541. // #14683: Only rethrow if this hasn't been notified as an error yet
  31542. if (_callback) {
  31543. throw e;
  31544. }
  31545. }
  31546. },
  31547. abort: function abort() {
  31548. if (_callback) {
  31549. _callback();
  31550. }
  31551. }
  31552. };
  31553. }
  31554. });
  31555. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  31556. jQuery.ajaxPrefilter(function (s) {
  31557. if (s.crossDomain) {
  31558. s.contents.script = false;
  31559. }
  31560. });
  31561. // Install script dataType
  31562. jQuery.ajaxSetup({
  31563. accepts: {
  31564. script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript"
  31565. },
  31566. contents: {
  31567. script: /\b(?:java|ecma)script\b/
  31568. },
  31569. converters: {
  31570. "text script": function textScript(text) {
  31571. jQuery.globalEval(text);
  31572. return text;
  31573. }
  31574. }
  31575. });
  31576. // Handle cache's special case and crossDomain
  31577. jQuery.ajaxPrefilter("script", function (s) {
  31578. if (s.cache === undefined) {
  31579. s.cache = false;
  31580. }
  31581. if (s.crossDomain) {
  31582. s.type = "GET";
  31583. }
  31584. });
  31585. // Bind script tag hack transport
  31586. jQuery.ajaxTransport("script", function (s) {
  31587. // This transport only deals with cross domain requests
  31588. if (s.crossDomain) {
  31589. var script, _callback2;
  31590. return {
  31591. send: function send(_, complete) {
  31592. script = jQuery("<script>").prop({
  31593. charset: s.scriptCharset,
  31594. src: s.url
  31595. }).on("load error", _callback2 = function callback(evt) {
  31596. script.remove();
  31597. _callback2 = null;
  31598. if (evt) {
  31599. complete(evt.type === "error" ? 404 : 200, evt.type);
  31600. }
  31601. });
  31602. // Use native DOM manipulation to avoid our domManip AJAX trickery
  31603. document.head.appendChild(script[0]);
  31604. },
  31605. abort: function abort() {
  31606. if (_callback2) {
  31607. _callback2();
  31608. }
  31609. }
  31610. };
  31611. }
  31612. });
  31613. var oldCallbacks = [],
  31614. rjsonp = /(=)\?(?=&|$)|\?\?/;
  31615. // Default jsonp settings
  31616. jQuery.ajaxSetup({
  31617. jsonp: "callback",
  31618. jsonpCallback: function jsonpCallback() {
  31619. var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce++;
  31620. this[callback] = true;
  31621. return callback;
  31622. }
  31623. });
  31624. // Detect, normalize options and install callbacks for jsonp requests
  31625. jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {
  31626. var callbackName,
  31627. overwritten,
  31628. responseContainer,
  31629. jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? "url" : typeof s.data === "string" && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0 && rjsonp.test(s.data) && "data");
  31630. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  31631. if (jsonProp || s.dataTypes[0] === "jsonp") {
  31632. // Get callback name, remembering preexisting value associated with it
  31633. callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
  31634. // Insert callback into url or form data
  31635. if (jsonProp) {
  31636. s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
  31637. } else if (s.jsonp !== false) {
  31638. s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
  31639. }
  31640. // Use data converter to retrieve json after script execution
  31641. s.converters["script json"] = function () {
  31642. if (!responseContainer) {
  31643. jQuery.error(callbackName + " was not called");
  31644. }
  31645. return responseContainer[0];
  31646. };
  31647. // Force json dataType
  31648. s.dataTypes[0] = "json";
  31649. // Install callback
  31650. overwritten = window[callbackName];
  31651. window[callbackName] = function () {
  31652. responseContainer = arguments;
  31653. };
  31654. // Clean-up function (fires after converters)
  31655. jqXHR.always(function () {
  31656. // If previous value didn't exist - remove it
  31657. if (overwritten === undefined) {
  31658. jQuery(window).removeProp(callbackName);
  31659. // Otherwise restore preexisting value
  31660. } else {
  31661. window[callbackName] = overwritten;
  31662. }
  31663. // Save back as free
  31664. if (s[callbackName]) {
  31665. // Make sure that re-using the options doesn't screw things around
  31666. s.jsonpCallback = originalSettings.jsonpCallback;
  31667. // Save the callback name for future use
  31668. oldCallbacks.push(callbackName);
  31669. }
  31670. // Call if it was a function and we have a response
  31671. if (responseContainer && isFunction(overwritten)) {
  31672. overwritten(responseContainer[0]);
  31673. }
  31674. responseContainer = overwritten = undefined;
  31675. });
  31676. // Delegate to script
  31677. return "script";
  31678. }
  31679. });
  31680. // Support: Safari 8 only
  31681. // In Safari 8 documents created via document.implementation.createHTMLDocument
  31682. // collapse sibling forms: the second one becomes a child of the first one.
  31683. // Because of that, this security measure has to be disabled in Safari 8.
  31684. // https://bugs.webkit.org/show_bug.cgi?id=137337
  31685. support.createHTMLDocument = function () {
  31686. var body = document.implementation.createHTMLDocument("").body;
  31687. body.innerHTML = "<form></form><form></form>";
  31688. return body.childNodes.length === 2;
  31689. }();
  31690. // Argument "data" should be string of html
  31691. // context (optional): If specified, the fragment will be created in this context,
  31692. // defaults to document
  31693. // keepScripts (optional): If true, will include scripts passed in the html string
  31694. jQuery.parseHTML = function (data, context, keepScripts) {
  31695. if (typeof data !== "string") {
  31696. return [];
  31697. }
  31698. if (typeof context === "boolean") {
  31699. keepScripts = context;
  31700. context = false;
  31701. }
  31702. var base, parsed, scripts;
  31703. if (!context) {
  31704. // Stop scripts or inline event handlers from being executed immediately
  31705. // by using document.implementation
  31706. if (support.createHTMLDocument) {
  31707. context = document.implementation.createHTMLDocument("");
  31708. // Set the base href for the created document
  31709. // so any parsed elements with URLs
  31710. // are based on the document's URL (gh-2965)
  31711. base = context.createElement("base");
  31712. base.href = document.location.href;
  31713. context.head.appendChild(base);
  31714. } else {
  31715. context = document;
  31716. }
  31717. }
  31718. parsed = rsingleTag.exec(data);
  31719. scripts = !keepScripts && [];
  31720. // Single tag
  31721. if (parsed) {
  31722. return [context.createElement(parsed[1])];
  31723. }
  31724. parsed = buildFragment([data], context, scripts);
  31725. if (scripts && scripts.length) {
  31726. jQuery(scripts).remove();
  31727. }
  31728. return jQuery.merge([], parsed.childNodes);
  31729. };
  31730. /**
  31731. * Load a url into a page
  31732. */
  31733. jQuery.fn.load = function (url, params, callback) {
  31734. var selector,
  31735. type,
  31736. response,
  31737. self = this,
  31738. off = url.indexOf(" ");
  31739. if (off > -1) {
  31740. selector = stripAndCollapse(url.slice(off));
  31741. url = url.slice(0, off);
  31742. }
  31743. // If it's a function
  31744. if (isFunction(params)) {
  31745. // We assume that it's the callback
  31746. callback = params;
  31747. params = undefined;
  31748. // Otherwise, build a param string
  31749. } else if (params && (typeof params === "undefined" ? "undefined" : _typeof(params)) === "object") {
  31750. type = "POST";
  31751. }
  31752. // If we have elements to modify, make the request
  31753. if (self.length > 0) {
  31754. jQuery.ajax({
  31755. url: url,
  31756. // If "type" variable is undefined, then "GET" method will be used.
  31757. // Make value of this field explicit since
  31758. // user can override it through ajaxSetup method
  31759. type: type || "GET",
  31760. dataType: "html",
  31761. data: params
  31762. }).done(function (responseText) {
  31763. // Save response for use in complete callback
  31764. response = arguments;
  31765. self.html(selector ?
  31766. // If a selector was specified, locate the right elements in a dummy div
  31767. // Exclude scripts to avoid IE 'Permission Denied' errors
  31768. jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
  31769. // Otherwise use the full result
  31770. responseText);
  31771. // If the request succeeds, this function gets "data", "status", "jqXHR"
  31772. // but they are ignored because response was set above.
  31773. // If it fails, this function gets "jqXHR", "status", "error"
  31774. }).always(callback && function (jqXHR, status) {
  31775. self.each(function () {
  31776. callback.apply(this, response || [jqXHR.responseText, status, jqXHR]);
  31777. });
  31778. });
  31779. }
  31780. return this;
  31781. };
  31782. // Attach a bunch of functions for handling common AJAX events
  31783. jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (i, type) {
  31784. jQuery.fn[type] = function (fn) {
  31785. return this.on(type, fn);
  31786. };
  31787. });
  31788. jQuery.expr.pseudos.animated = function (elem) {
  31789. return jQuery.grep(jQuery.timers, function (fn) {
  31790. return elem === fn.elem;
  31791. }).length;
  31792. };
  31793. jQuery.offset = {
  31794. setOffset: function setOffset(elem, options, i) {
  31795. var curPosition,
  31796. curLeft,
  31797. curCSSTop,
  31798. curTop,
  31799. curOffset,
  31800. curCSSLeft,
  31801. calculatePosition,
  31802. position = jQuery.css(elem, "position"),
  31803. curElem = jQuery(elem),
  31804. props = {};
  31805. // Set position first, in-case top/left are set even on static elem
  31806. if (position === "static") {
  31807. elem.style.position = "relative";
  31808. }
  31809. curOffset = curElem.offset();
  31810. curCSSTop = jQuery.css(elem, "top");
  31811. curCSSLeft = jQuery.css(elem, "left");
  31812. calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;
  31813. // Need to be able to calculate position if either
  31814. // top or left is auto and position is either absolute or fixed
  31815. if (calculatePosition) {
  31816. curPosition = curElem.position();
  31817. curTop = curPosition.top;
  31818. curLeft = curPosition.left;
  31819. } else {
  31820. curTop = parseFloat(curCSSTop) || 0;
  31821. curLeft = parseFloat(curCSSLeft) || 0;
  31822. }
  31823. if (isFunction(options)) {
  31824. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  31825. options = options.call(elem, i, jQuery.extend({}, curOffset));
  31826. }
  31827. if (options.top != null) {
  31828. props.top = options.top - curOffset.top + curTop;
  31829. }
  31830. if (options.left != null) {
  31831. props.left = options.left - curOffset.left + curLeft;
  31832. }
  31833. if ("using" in options) {
  31834. options.using.call(elem, props);
  31835. } else {
  31836. curElem.css(props);
  31837. }
  31838. }
  31839. };
  31840. jQuery.fn.extend({
  31841. // offset() relates an element's border box to the document origin
  31842. offset: function offset(options) {
  31843. // Preserve chaining for setter
  31844. if (arguments.length) {
  31845. return options === undefined ? this : this.each(function (i) {
  31846. jQuery.offset.setOffset(this, options, i);
  31847. });
  31848. }
  31849. var rect,
  31850. win,
  31851. elem = this[0];
  31852. if (!elem) {
  31853. return;
  31854. }
  31855. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  31856. // Support: IE <=11 only
  31857. // Running getBoundingClientRect on a
  31858. // disconnected node in IE throws an error
  31859. if (!elem.getClientRects().length) {
  31860. return { top: 0, left: 0 };
  31861. }
  31862. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  31863. rect = elem.getBoundingClientRect();
  31864. win = elem.ownerDocument.defaultView;
  31865. return {
  31866. top: rect.top + win.pageYOffset,
  31867. left: rect.left + win.pageXOffset
  31868. };
  31869. },
  31870. // position() relates an element's margin box to its offset parent's padding box
  31871. // This corresponds to the behavior of CSS absolute positioning
  31872. position: function position() {
  31873. if (!this[0]) {
  31874. return;
  31875. }
  31876. var offsetParent,
  31877. offset,
  31878. doc,
  31879. elem = this[0],
  31880. parentOffset = { top: 0, left: 0 };
  31881. // position:fixed elements are offset from the viewport, which itself always has zero offset
  31882. if (jQuery.css(elem, "position") === "fixed") {
  31883. // Assume position:fixed implies availability of getBoundingClientRect
  31884. offset = elem.getBoundingClientRect();
  31885. } else {
  31886. offset = this.offset();
  31887. // Account for the *real* offset parent, which can be the document or its root element
  31888. // when a statically positioned element is identified
  31889. doc = elem.ownerDocument;
  31890. offsetParent = elem.offsetParent || doc.documentElement;
  31891. while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") {
  31892. offsetParent = offsetParent.parentNode;
  31893. }
  31894. if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
  31895. // Incorporate borders into its offset, since they are outside its content origin
  31896. parentOffset = jQuery(offsetParent).offset();
  31897. parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
  31898. parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
  31899. }
  31900. }
  31901. // Subtract parent offsets and element margins
  31902. return {
  31903. top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
  31904. left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
  31905. };
  31906. },
  31907. // This method will return documentElement in the following cases:
  31908. // 1) For the element inside the iframe without offsetParent, this method will return
  31909. // documentElement of the parent window
  31910. // 2) For the hidden or detached element
  31911. // 3) For body or html element, i.e. in case of the html node - it will return itself
  31912. //
  31913. // but those exceptions were never presented as a real life use-cases
  31914. // and might be considered as more preferable results.
  31915. //
  31916. // This logic, however, is not guaranteed and can change at any point in the future
  31917. offsetParent: function offsetParent() {
  31918. return this.map(function () {
  31919. var offsetParent = this.offsetParent;
  31920. while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
  31921. offsetParent = offsetParent.offsetParent;
  31922. }
  31923. return offsetParent || documentElement;
  31924. });
  31925. }
  31926. });
  31927. // Create scrollLeft and scrollTop methods
  31928. jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) {
  31929. var top = "pageYOffset" === prop;
  31930. jQuery.fn[method] = function (val) {
  31931. return access(this, function (elem, method, val) {
  31932. // Coalesce documents and windows
  31933. var win;
  31934. if (isWindow(elem)) {
  31935. win = elem;
  31936. } else if (elem.nodeType === 9) {
  31937. win = elem.defaultView;
  31938. }
  31939. if (val === undefined) {
  31940. return win ? win[prop] : elem[method];
  31941. }
  31942. if (win) {
  31943. win.scrollTo(!top ? val : win.pageXOffset, top ? val : win.pageYOffset);
  31944. } else {
  31945. elem[method] = val;
  31946. }
  31947. }, method, val, arguments.length);
  31948. };
  31949. });
  31950. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  31951. // Add the top/left cssHooks using jQuery.fn.position
  31952. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  31953. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  31954. // getComputedStyle returns percent when specified for top/left/bottom/right;
  31955. // rather than make the css module depend on the offset module, just check for it here
  31956. jQuery.each(["top", "left"], function (i, prop) {
  31957. jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function (elem, computed) {
  31958. if (computed) {
  31959. computed = curCSS(elem, prop);
  31960. // If curCSS returns percentage, fallback to offset
  31961. return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed;
  31962. }
  31963. });
  31964. });
  31965. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  31966. jQuery.each({ Height: "height", Width: "width" }, function (name, type) {
  31967. jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name }, function (defaultExtra, funcName) {
  31968. // Margin is only for outerHeight, outerWidth
  31969. jQuery.fn[funcName] = function (margin, value) {
  31970. var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
  31971. extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
  31972. return access(this, function (elem, type, value) {
  31973. var doc;
  31974. if (isWindow(elem)) {
  31975. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  31976. return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
  31977. }
  31978. // Get document width or height
  31979. if (elem.nodeType === 9) {
  31980. doc = elem.documentElement;
  31981. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  31982. // whichever is greatest
  31983. return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]);
  31984. }
  31985. return value === undefined ?
  31986. // Get width or height on the element, requesting but not forcing parseFloat
  31987. jQuery.css(elem, type, extra) :
  31988. // Set width or height on the element
  31989. jQuery.style(elem, type, value, extra);
  31990. }, type, chainable ? margin : undefined, chainable);
  31991. };
  31992. });
  31993. });
  31994. jQuery.each(("blur focus focusin focusout resize scroll click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup contextmenu").split(" "), function (i, name) {
  31995. // Handle event binding
  31996. jQuery.fn[name] = function (data, fn) {
  31997. return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name);
  31998. };
  31999. });
  32000. jQuery.fn.extend({
  32001. hover: function hover(fnOver, fnOut) {
  32002. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  32003. }
  32004. });
  32005. jQuery.fn.extend({
  32006. bind: function bind(types, data, fn) {
  32007. return this.on(types, null, data, fn);
  32008. },
  32009. unbind: function unbind(types, fn) {
  32010. return this.off(types, null, fn);
  32011. },
  32012. delegate: function delegate(selector, types, data, fn) {
  32013. return this.on(types, selector, data, fn);
  32014. },
  32015. undelegate: function undelegate(selector, types, fn) {
  32016. // ( namespace ) or ( selector, types [, fn] )
  32017. return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn);
  32018. }
  32019. });
  32020. // Bind a function to a context, optionally partially applying any
  32021. // arguments.
  32022. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  32023. // However, it is not slated for removal any time soon
  32024. jQuery.proxy = function (fn, context) {
  32025. var tmp, args, proxy;
  32026. if (typeof context === "string") {
  32027. tmp = fn[context];
  32028. context = fn;
  32029. fn = tmp;
  32030. }
  32031. // Quick check to determine if target is callable, in the spec
  32032. // this throws a TypeError, but we will just return undefined.
  32033. if (!isFunction(fn)) {
  32034. return undefined;
  32035. }
  32036. // Simulated bind
  32037. args = _slice.call(arguments, 2);
  32038. proxy = function proxy() {
  32039. return fn.apply(context || this, args.concat(_slice.call(arguments)));
  32040. };
  32041. // Set the guid of unique handler to the same of original handler, so it can be removed
  32042. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  32043. return proxy;
  32044. };
  32045. jQuery.holdReady = function (hold) {
  32046. if (hold) {
  32047. jQuery.readyWait++;
  32048. } else {
  32049. jQuery.ready(true);
  32050. }
  32051. };
  32052. jQuery.isArray = Array.isArray;
  32053. jQuery.parseJSON = JSON.parse;
  32054. jQuery.nodeName = nodeName;
  32055. jQuery.isFunction = isFunction;
  32056. jQuery.isWindow = isWindow;
  32057. jQuery.camelCase = camelCase;
  32058. jQuery.type = toType;
  32059. jQuery.now = Date.now;
  32060. jQuery.isNumeric = function (obj) {
  32061. // As of jQuery 3.0, isNumeric is limited to
  32062. // strings and numbers (primitives or objects)
  32063. // that can be coerced to finite numbers (gh-2662)
  32064. var type = jQuery.type(obj);
  32065. return (type === "number" || type === "string") &&
  32066. // parseFloat NaNs numeric-cast false positives ("")
  32067. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  32068. // subtraction forces infinities to NaN
  32069. !isNaN(obj - parseFloat(obj));
  32070. };
  32071. // Register as a named AMD module, since jQuery can be concatenated with other
  32072. // files that may use define, but not via a proper concatenation script that
  32073. // understands anonymous AMD modules. A named AMD is safest and most robust
  32074. // way to register. Lowercase jquery is used because AMD module names are
  32075. // derived from file names, and jQuery is normally delivered in a lowercase
  32076. // file name. Do this after creating the global so that if an AMD module wants
  32077. // to call noConflict to hide this version of jQuery, it will work.
  32078. // Note that for maximum portability, libraries that are not jQuery should
  32079. // declare themselves as anonymous modules, and avoid setting a global if an
  32080. // AMD loader is present. jQuery is a special case. For more information, see
  32081. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  32082. if (true) {
  32083. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  32084. return jQuery;
  32085. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  32086. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  32087. }
  32088. var
  32089. // Map over jQuery in case of overwrite
  32090. _jQuery = window.jQuery,
  32091. // Map over the $ in case of overwrite
  32092. _$ = window.$;
  32093. jQuery.noConflict = function (deep) {
  32094. if (window.$ === jQuery) {
  32095. window.$ = _$;
  32096. }
  32097. if (deep && window.jQuery === jQuery) {
  32098. window.jQuery = _jQuery;
  32099. }
  32100. return jQuery;
  32101. };
  32102. // Expose jQuery and $ identifiers, even in AMD
  32103. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  32104. // and CommonJS for browser emulators (#13566)
  32105. if (!noGlobal) {
  32106. window.jQuery = window.$ = jQuery;
  32107. }
  32108. return jQuery;
  32109. });
  32110. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
  32111. /***/ }),
  32112. /***/ "./node_modules/line-i18n/dist/LanguageService.js":
  32113. /*!********************************************************!*\
  32114. !*** ./node_modules/line-i18n/dist/LanguageService.js ***!
  32115. \********************************************************/
  32116. /*! no static exports found */
  32117. /***/ (function(module, exports, __webpack_require__) {
  32118. "use strict";
  32119. Object.defineProperty(exports, "__esModule", {
  32120. value: true
  32121. });
  32122. var LanguageService = /** @class */function () {
  32123. function LanguageService(lsKey, defaultLang) {
  32124. if (defaultLang === void 0) {
  32125. defaultLang = 'pt';
  32126. }
  32127. this.lsKey = lsKey;
  32128. this.defaultLang = defaultLang;
  32129. this.listeners = [];
  32130. this.document = document;
  32131. this.setupListener();
  32132. }
  32133. LanguageService.prototype.setupListener = function () {
  32134. var _this = this;
  32135. if (this.document !== null) {
  32136. this.document.addEventListener("storage", function (event) {
  32137. var e = event;
  32138. if (e.key === _this.lsKey) {
  32139. _this.listeners.forEach(function (l) {
  32140. return l();
  32141. });
  32142. }
  32143. });
  32144. }
  32145. };
  32146. LanguageService.prototype.getLang = function () {
  32147. var lang = localStorage.getItem(this.lsKey);
  32148. if (lang === null || lang === undefined) {
  32149. console.warn("Internal Error: User language information has not been set. Returning default...");
  32150. return this.getDefaultLang();
  32151. }
  32152. return lang;
  32153. };
  32154. LanguageService.prototype.getDefaultLang = function () {
  32155. return this.defaultLang;
  32156. };
  32157. LanguageService.prototype.registerLanguageChangeListener = function (listener) {
  32158. this.listeners.push(listener);
  32159. };
  32160. return LanguageService;
  32161. }();
  32162. exports.LanguageService = LanguageService;
  32163. /***/ }),
  32164. /***/ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js":
  32165. /*!************************************************************!*\
  32166. !*** ./node_modules/line-i18n/dist/LanguageServiceNoLS.js ***!
  32167. \************************************************************/
  32168. /*! no static exports found */
  32169. /***/ (function(module, exports, __webpack_require__) {
  32170. "use strict";
  32171. Object.defineProperty(exports, "__esModule", {
  32172. value: true
  32173. });
  32174. var LanguageServiceNoLS = /** @class */function () {
  32175. function LanguageServiceNoLS(lang) {
  32176. this.lang = lang;
  32177. this.listeners = [];
  32178. }
  32179. LanguageServiceNoLS.prototype.setupListener = function () {};
  32180. LanguageServiceNoLS.prototype.notifyChange = function () {
  32181. this.listeners.forEach(function (l) {
  32182. return l();
  32183. });
  32184. };
  32185. LanguageServiceNoLS.prototype.setLang = function (lang) {
  32186. this.lang = lang;
  32187. this.notifyChange();
  32188. };
  32189. LanguageServiceNoLS.prototype.getLang = function () {
  32190. return this.lang;
  32191. };
  32192. LanguageServiceNoLS.prototype.getDefaultLang = function () {
  32193. return this.lang;
  32194. };
  32195. LanguageServiceNoLS.prototype.registerLanguageChangeListener = function (listener) {
  32196. this.listeners.push(listener);
  32197. };
  32198. return LanguageServiceNoLS;
  32199. }();
  32200. exports.LanguageServiceNoLS = LanguageServiceNoLS;
  32201. /***/ }),
  32202. /***/ "./node_modules/line-i18n/dist/LocalizedStrings.js":
  32203. /*!*********************************************************!*\
  32204. !*** ./node_modules/line-i18n/dist/LocalizedStrings.js ***!
  32205. \*********************************************************/
  32206. /*! no static exports found */
  32207. /***/ (function(module, exports, __webpack_require__) {
  32208. "use strict";
  32209. Object.defineProperty(exports, "__esModule", {
  32210. value: true
  32211. });
  32212. exports.LocalizedStrings = undefined;
  32213. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  32214. var LocalizedStrings = /** @class */function () {
  32215. function LocalizedStrings(service, i18nData, listenToChange) {
  32216. if (listenToChange === void 0) {
  32217. listenToChange = false;
  32218. }
  32219. var _this = this;
  32220. this.service = service;
  32221. this.i18nData = i18nData;
  32222. this.listenToChange = listenToChange;
  32223. this.document = document;
  32224. if (this.listenToChange) {
  32225. service.registerLanguageChangeListener(function () {
  32226. _this.updateTagText();
  32227. });
  32228. }
  32229. }
  32230. LocalizedStrings.prototype.getString = function (id, type) {
  32231. var i18nObj = this.i18nData[this.service.getLang()];
  32232. if (!!!i18nObj) {
  32233. console.warn("Internal Error. The language set at ivprog.lang is not valid: " + this.service.getLang());
  32234. i18nObj = this.i18nData[this.service.getDefaultLang()];
  32235. }
  32236. if (!!!i18nObj[type]) {
  32237. return "{MISSING_I18N_TYPE_IDENTIFIER}";
  32238. } else if (!!!i18nObj[type][id]) {
  32239. return "{MISSING_I18N_IDENTIFIER}";
  32240. } else {
  32241. return i18nObj[type][id];
  32242. }
  32243. };
  32244. LocalizedStrings.prototype.getOR = function () {
  32245. return this.getUI('join_or');
  32246. };
  32247. LocalizedStrings.prototype.getError = function (id, context) {
  32248. if (context === void 0) {
  32249. context = [];
  32250. }
  32251. var text = this.getString(id, _StringTypes.StringTypes.ERROR);
  32252. return this.processString(text, context);
  32253. };
  32254. LocalizedStrings.prototype.getMessage = function (id, context) {
  32255. if (context === void 0) {
  32256. context = [];
  32257. }
  32258. var text = this.getString(id, _StringTypes.StringTypes.MESSAGE);
  32259. return this.processString(text, context);
  32260. };
  32261. LocalizedStrings.prototype.getUI = function (id, context) {
  32262. if (context === void 0) {
  32263. context = [];
  32264. }
  32265. var text = this.getString(id, _StringTypes.StringTypes.UI);
  32266. return this.processString(text, context);
  32267. };
  32268. LocalizedStrings.prototype.processString = function (text, context) {
  32269. for (var i = 0; i < context.length; i++) {
  32270. var v = context[i];
  32271. text = text.replace('\$' + i, v);
  32272. }
  32273. return text;
  32274. };
  32275. LocalizedStrings.prototype.updateTagText = function (func) {
  32276. var _this = this;
  32277. if (func === void 0) {
  32278. func = null;
  32279. }
  32280. if (this.document !== null) {
  32281. var list = this.document.querySelectorAll("data.i18n");
  32282. list.forEach(function (node) {
  32283. if (func === null) {
  32284. node.innerHTML = _this.processTagTex(node.getAttribute("value"));
  32285. } else {
  32286. node.innerHTML = func(node.getAttribute("value"));
  32287. }
  32288. });
  32289. }
  32290. };
  32291. LocalizedStrings.prototype.processTagTex = function (text) {
  32292. if (text === null) {
  32293. return "<Invalid i18n identifier>";
  32294. }
  32295. var opts = text.split(':');
  32296. var type = opts[0].toLowerCase();
  32297. var id = opts[1];
  32298. if (_StringTypes.StringTypes.ERROR === type) {
  32299. return this.getError(id);
  32300. } else if (_StringTypes.StringTypes.MESSAGE === type) {
  32301. return this.getMessage(id);
  32302. } else if (_StringTypes.StringTypes.UI === type) {
  32303. return this.getUI(id);
  32304. } else {
  32305. console.warn(" A string has been passed to the i18n helper function that was not in the form type:id -> " + text);
  32306. return this.getString(id, type);
  32307. }
  32308. };
  32309. return LocalizedStrings;
  32310. }();
  32311. exports.LocalizedStrings = LocalizedStrings;
  32312. /***/ }),
  32313. /***/ "./node_modules/line-i18n/dist/StringTypes.js":
  32314. /*!****************************************************!*\
  32315. !*** ./node_modules/line-i18n/dist/StringTypes.js ***!
  32316. \****************************************************/
  32317. /*! no static exports found */
  32318. /***/ (function(module, exports, __webpack_require__) {
  32319. "use strict";
  32320. Object.defineProperty(exports, "__esModule", {
  32321. value: true
  32322. });
  32323. var StringTypes = exports.StringTypes = undefined;
  32324. (function (StringTypes) {
  32325. StringTypes["ERROR"] = "error";
  32326. StringTypes["MESSAGE"] = "message";
  32327. StringTypes["UI"] = "ui";
  32328. })(StringTypes || (exports.StringTypes = StringTypes = {}));
  32329. /***/ }),
  32330. /***/ "./node_modules/line-i18n/dist/index.js":
  32331. /*!**********************************************!*\
  32332. !*** ./node_modules/line-i18n/dist/index.js ***!
  32333. \**********************************************/
  32334. /*! no static exports found */
  32335. /***/ (function(module, exports, __webpack_require__) {
  32336. "use strict";
  32337. Object.defineProperty(exports, "__esModule", {
  32338. value: true
  32339. });
  32340. var _LanguageService = __webpack_require__(/*! ./LanguageService */ "./node_modules/line-i18n/dist/LanguageService.js");
  32341. var _LocalizedStrings = __webpack_require__(/*! ./LocalizedStrings */ "./node_modules/line-i18n/dist/LocalizedStrings.js");
  32342. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  32343. var _LanguageServiceNoLS = __webpack_require__(/*! ./LanguageServiceNoLS */ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js");
  32344. exports.default = {
  32345. LanguageService: _LanguageService.LanguageService,
  32346. LanguageServiceNoLS: _LanguageServiceNoLS.LanguageServiceNoLS,
  32347. LocalizedStrings: _LocalizedStrings.LocalizedStrings,
  32348. StringTypes: _StringTypes.StringTypes
  32349. };
  32350. /***/ }),
  32351. /***/ "./node_modules/node-libs-browser/mock/empty.js":
  32352. /*!******************************************************!*\
  32353. !*** ./node_modules/node-libs-browser/mock/empty.js ***!
  32354. \******************************************************/
  32355. /*! no static exports found */
  32356. /***/ (function(module, exports, __webpack_require__) {
  32357. "use strict";
  32358. /***/ }),
  32359. /***/ "./node_modules/webpack/buildin/module.js":
  32360. /*!***********************************!*\
  32361. !*** (webpack)/buildin/module.js ***!
  32362. \***********************************/
  32363. /*! no static exports found */
  32364. /***/ (function(module, exports, __webpack_require__) {
  32365. "use strict";
  32366. module.exports = function (module) {
  32367. if (!module.webpackPolyfill) {
  32368. module.deprecate = function () {};
  32369. module.paths = [];
  32370. // module.parent = undefined by default
  32371. if (!module.children) module.children = [];
  32372. Object.defineProperty(module, "loaded", {
  32373. enumerable: true,
  32374. get: function get() {
  32375. return module.l;
  32376. }
  32377. });
  32378. Object.defineProperty(module, "id", {
  32379. enumerable: true,
  32380. get: function get() {
  32381. return module.i;
  32382. }
  32383. });
  32384. module.webpackPolyfill = 1;
  32385. }
  32386. return module;
  32387. };
  32388. /***/ })
  32389. /******/ });
  32390. //# sourceMappingURL=ivprog.bundle.js.map