123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857 |
- (function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
- (factory((global.buble = {})));
- }(this, (function (exports) { 'use strict';
- var reservedWords = {
- 3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
- 5: "class enum extends super const export import",
- 6: "enum",
- strict: "implements interface let package private protected public static yield",
- strictBind: "eval arguments"
- };
- var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";
- var keywords = {
- 5: ecma5AndLessKeywords,
- 6: ecma5AndLessKeywords + " const class extends export import super"
- };
- var keywordRelationalOperator = /^in(stanceof)?$/;
- var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08bd\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fef\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7b9\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab65\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
- var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2-\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
- var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
- var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
- nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
- var astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,477,28,11,0,9,21,190,52,76,44,33,24,27,35,30,0,12,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,26,230,43,117,63,32,0,257,0,11,39,8,0,22,0,12,39,3,3,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,270,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,68,12,0,67,12,65,1,31,6129,15,754,9486,286,82,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,60,67,1213,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,15,7472,3104,541];
- var astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,525,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,4,9,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,280,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,239];
- function isInAstralSet(code, set) {
- var pos = 0x10000;
- for (var i = 0; i < set.length; i += 2) {
- pos += set[i];
- if (pos > code) { return false }
- pos += set[i + 1];
- if (pos >= code) { return true }
- }
- }
- function isIdentifierStart(code, astral) {
- if (code < 65) { return code === 36 }
- if (code < 91) { return true }
- if (code < 97) { return code === 95 }
- if (code < 123) { return true }
- if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)) }
- if (astral === false) { return false }
- return isInAstralSet(code, astralIdentifierStartCodes)
- }
- function isIdentifierChar(code, astral) {
- if (code < 48) { return code === 36 }
- if (code < 58) { return true }
- if (code < 65) { return false }
- if (code < 91) { return true }
- if (code < 97) { return code === 95 }
- if (code < 123) { return true }
- if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)) }
- if (astral === false) { return false }
- return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)
- }
- var TokenType = function TokenType(label, conf) {
- if ( conf === void 0 ) conf = {};
- this.label = label;
- this.keyword = conf.keyword;
- this.beforeExpr = !!conf.beforeExpr;
- this.startsExpr = !!conf.startsExpr;
- this.isLoop = !!conf.isLoop;
- this.isAssign = !!conf.isAssign;
- this.prefix = !!conf.prefix;
- this.postfix = !!conf.postfix;
- this.binop = conf.binop || null;
- this.updateContext = null;
- };
- function binop(name, prec) {
- return new TokenType(name, {beforeExpr: true, binop: prec})
- }
- var beforeExpr = {beforeExpr: true};
- var startsExpr = {startsExpr: true};
- var keywords$1 = {};
- function kw(name, options) {
- if ( options === void 0 ) options = {};
- options.keyword = name;
- return keywords$1[name] = new TokenType(name, options)
- }
- var types = {
- num: new TokenType("num", startsExpr),
- regexp: new TokenType("regexp", startsExpr),
- string: new TokenType("string", startsExpr),
- name: new TokenType("name", startsExpr),
- eof: new TokenType("eof"),
-
- bracketL: new TokenType("[", {beforeExpr: true, startsExpr: true}),
- bracketR: new TokenType("]"),
- braceL: new TokenType("{", {beforeExpr: true, startsExpr: true}),
- braceR: new TokenType("}"),
- parenL: new TokenType("(", {beforeExpr: true, startsExpr: true}),
- parenR: new TokenType(")"),
- comma: new TokenType(",", beforeExpr),
- semi: new TokenType(";", beforeExpr),
- colon: new TokenType(":", beforeExpr),
- dot: new TokenType("."),
- question: new TokenType("?", beforeExpr),
- arrow: new TokenType("=>", beforeExpr),
- template: new TokenType("template"),
- invalidTemplate: new TokenType("invalidTemplate"),
- ellipsis: new TokenType("...", beforeExpr),
- backQuote: new TokenType("`", startsExpr),
- dollarBraceL: new TokenType("${", {beforeExpr: true, startsExpr: true}),
-
-
-
-
-
-
-
-
-
-
-
-
-
- eq: new TokenType("=", {beforeExpr: true, isAssign: true}),
- assign: new TokenType("_=", {beforeExpr: true, isAssign: true}),
- incDec: new TokenType("++/--", {prefix: true, postfix: true, startsExpr: true}),
- prefix: new TokenType("!/~", {beforeExpr: true, prefix: true, startsExpr: true}),
- logicalOR: binop("||", 1),
- logicalAND: binop("&&", 2),
- bitwiseOR: binop("|", 3),
- bitwiseXOR: binop("^", 4),
- bitwiseAND: binop("&", 5),
- equality: binop("==/!=/===/!==", 6),
- relational: binop("</>/<=/>=", 7),
- bitShift: binop("<</>>/>>>", 8),
- plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),
- modulo: binop("%", 10),
- star: binop("*", 10),
- slash: binop("/", 10),
- starstar: new TokenType("**", {beforeExpr: true}),
-
- _break: kw("break"),
- _case: kw("case", beforeExpr),
- _catch: kw("catch"),
- _continue: kw("continue"),
- _debugger: kw("debugger"),
- _default: kw("default", beforeExpr),
- _do: kw("do", {isLoop: true, beforeExpr: true}),
- _else: kw("else", beforeExpr),
- _finally: kw("finally"),
- _for: kw("for", {isLoop: true}),
- _function: kw("function", startsExpr),
- _if: kw("if"),
- _return: kw("return", beforeExpr),
- _switch: kw("switch"),
- _throw: kw("throw", beforeExpr),
- _try: kw("try"),
- _var: kw("var"),
- _const: kw("const"),
- _while: kw("while", {isLoop: true}),
- _with: kw("with"),
- _new: kw("new", {beforeExpr: true, startsExpr: true}),
- _this: kw("this", startsExpr),
- _super: kw("super", startsExpr),
- _class: kw("class", startsExpr),
- _extends: kw("extends", beforeExpr),
- _export: kw("export"),
- _import: kw("import"),
- _null: kw("null", startsExpr),
- _true: kw("true", startsExpr),
- _false: kw("false", startsExpr),
- _in: kw("in", {beforeExpr: true, binop: 7}),
- _instanceof: kw("instanceof", {beforeExpr: true, binop: 7}),
- _typeof: kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true}),
- _void: kw("void", {beforeExpr: true, prefix: true, startsExpr: true}),
- _delete: kw("delete", {beforeExpr: true, prefix: true, startsExpr: true})
- };
- var lineBreak = /\r\n?|\n|\u2028|\u2029/;
- var lineBreakG = new RegExp(lineBreak.source, "g");
- function isNewLine(code, ecma2019String) {
- return code === 10 || code === 13 || (!ecma2019String && (code === 0x2028 || code === 0x2029))
- }
- var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
- var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
- var ref = Object.prototype;
- var hasOwnProperty = ref.hasOwnProperty;
- var toString = ref.toString;
- function has(obj, propName) {
- return hasOwnProperty.call(obj, propName)
- }
- var isArray = Array.isArray || (function (obj) { return (
- toString.call(obj) === "[object Array]"
- ); });
- var Position = function Position(line, col) {
- this.line = line;
- this.column = col;
- };
- Position.prototype.offset = function offset (n) {
- return new Position(this.line, this.column + n)
- };
- var SourceLocation = function SourceLocation(p, start, end) {
- this.start = start;
- this.end = end;
- if (p.sourceFile !== null) { this.source = p.sourceFile; }
- };
- function getLineInfo(input, offset) {
- for (var line = 1, cur = 0;;) {
- lineBreakG.lastIndex = cur;
- var match = lineBreakG.exec(input);
- if (match && match.index < offset) {
- ++line;
- cur = match.index + match[0].length;
- } else {
- return new Position(line, offset - cur)
- }
- }
- }
- var defaultOptions = {
-
-
-
-
- ecmaVersion: 7,
-
-
-
- sourceType: "script",
-
-
-
-
-
- onInsertedSemicolon: null,
-
-
- onTrailingComma: null,
-
-
-
-
- allowReserved: null,
-
-
- allowReturnOutsideFunction: false,
-
-
- allowImportExportEverywhere: false,
-
-
- allowAwaitOutsideFunction: false,
-
-
- allowHashBang: false,
-
-
-
-
- locations: false,
-
-
-
-
-
- onToken: null,
-
-
-
-
-
-
-
-
-
-
- onComment: null,
-
-
-
-
-
-
-
-
- ranges: false,
-
-
-
-
-
- program: null,
-
-
- sourceFile: null,
-
-
- directSourceFile: null,
-
-
- preserveParens: false,
- plugins: {}
- };
- function getOptions(opts) {
- var options = {};
- for (var opt in defaultOptions)
- { options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt]; }
- if (options.ecmaVersion >= 2015)
- { options.ecmaVersion -= 2009; }
- if (options.allowReserved == null)
- { options.allowReserved = options.ecmaVersion < 5; }
- if (isArray(options.onToken)) {
- var tokens = options.onToken;
- options.onToken = function (token) { return tokens.push(token); };
- }
- if (isArray(options.onComment))
- { options.onComment = pushComment(options, options.onComment); }
- return options
- }
- function pushComment(options, array) {
- return function(block, text, start, end, startLoc, endLoc) {
- var comment = {
- type: block ? "Block" : "Line",
- value: text,
- start: start,
- end: end
- };
- if (options.locations)
- { comment.loc = new SourceLocation(this, startLoc, endLoc); }
- if (options.ranges)
- { comment.range = [start, end]; }
- array.push(comment);
- }
- }
- var plugins = {};
- function keywordRegexp(words) {
- return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$")
- }
- var Parser = function Parser(options, input, startPos) {
- this.options = options = getOptions(options);
- this.sourceFile = options.sourceFile;
- this.keywords = keywordRegexp(keywords[options.ecmaVersion >= 6 ? 6 : 5]);
- var reserved = "";
- if (!options.allowReserved) {
- for (var v = options.ecmaVersion;; v--)
- { if (reserved = reservedWords[v]) { break } }
- if (options.sourceType === "module") { reserved += " await"; }
- }
- this.reservedWords = keywordRegexp(reserved);
- var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict;
- this.reservedWordsStrict = keywordRegexp(reservedStrict);
- this.reservedWordsStrictBind = keywordRegexp(reservedStrict + " " + reservedWords.strictBind);
- this.input = String(input);
-
-
-
- this.containsEsc = false;
-
- this.loadPlugins(options.plugins);
-
-
- if (startPos) {
- this.pos = startPos;
- this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1;
- this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
- } else {
- this.pos = this.lineStart = 0;
- this.curLine = 1;
- }
-
-
- this.type = types.eof;
-
- this.value = null;
-
- this.start = this.end = this.pos;
-
-
- this.startLoc = this.endLoc = this.curPosition();
-
- this.lastTokEndLoc = this.lastTokStartLoc = null;
- this.lastTokStart = this.lastTokEnd = this.pos;
-
-
-
- this.context = this.initialContext();
- this.exprAllowed = true;
-
- this.inModule = options.sourceType === "module";
- this.strict = this.inModule || this.strictDirective(this.pos);
-
- this.potentialArrowAt = -1;
-
- this.inFunction = this.inGenerator = this.inAsync = false;
-
- this.yieldPos = this.awaitPos = 0;
-
- this.labels = [];
-
- if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!")
- { this.skipLineComment(2); }
-
- this.scopeStack = [];
- this.enterFunctionScope();
-
- this.regexpState = null;
- };
- Parser.prototype.isKeyword = function isKeyword (word) { return this.keywords.test(word) };
- Parser.prototype.isReservedWord = function isReservedWord (word) { return this.reservedWords.test(word) };
- Parser.prototype.extend = function extend (name, f) {
- this[name] = f(this[name]);
- };
- Parser.prototype.loadPlugins = function loadPlugins (pluginConfigs) {
- var this$1 = this;
- for (var name in pluginConfigs) {
- var plugin = plugins[name];
- if (!plugin) { throw new Error("Plugin '" + name + "' not found") }
- plugin(this$1, pluginConfigs[name]);
- }
- };
- Parser.prototype.parse = function parse () {
- var node = this.options.program || this.startNode();
- this.nextToken();
- return this.parseTopLevel(node)
- };
- var pp = Parser.prototype;
- var literal = /^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)"|;)/;
- pp.strictDirective = function(start) {
- var this$1 = this;
- for (;;) {
- skipWhiteSpace.lastIndex = start;
- start += skipWhiteSpace.exec(this$1.input)[0].length;
- var match = literal.exec(this$1.input.slice(start));
- if (!match) { return false }
- if ((match[1] || match[2]) === "use strict") { return true }
- start += match[0].length;
- }
- };
- pp.eat = function(type) {
- if (this.type === type) {
- this.next();
- return true
- } else {
- return false
- }
- };
- pp.isContextual = function(name) {
- return this.type === types.name && this.value === name && !this.containsEsc
- };
- pp.eatContextual = function(name) {
- if (!this.isContextual(name)) { return false }
- this.next();
- return true
- };
- pp.expectContextual = function(name) {
- if (!this.eatContextual(name)) { this.unexpected(); }
- };
- pp.canInsertSemicolon = function() {
- return this.type === types.eof ||
- this.type === types.braceR ||
- lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
- };
- pp.insertSemicolon = function() {
- if (this.canInsertSemicolon()) {
- if (this.options.onInsertedSemicolon)
- { this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }
- return true
- }
- };
- pp.semicolon = function() {
- if (!this.eat(types.semi) && !this.insertSemicolon()) { this.unexpected(); }
- };
- pp.afterTrailingComma = function(tokType, notNext) {
- if (this.type === tokType) {
- if (this.options.onTrailingComma)
- { this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
- if (!notNext)
- { this.next(); }
- return true
- }
- };
- pp.expect = function(type) {
- this.eat(type) || this.unexpected();
- };
- pp.unexpected = function(pos) {
- this.raise(pos != null ? pos : this.start, "Unexpected token");
- };
- function DestructuringErrors() {
- this.shorthandAssign =
- this.trailingComma =
- this.parenthesizedAssign =
- this.parenthesizedBind =
- this.doubleProto =
- -1;
- }
- pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
- if (!refDestructuringErrors) { return }
- if (refDestructuringErrors.trailingComma > -1)
- { this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
- var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;
- if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
- };
- pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
- if (!refDestructuringErrors) { return false }
- var shorthandAssign = refDestructuringErrors.shorthandAssign;
- var doubleProto = refDestructuringErrors.doubleProto;
- if (!andThrow) { return shorthandAssign >= 0 || doubleProto >= 0 }
- if (shorthandAssign >= 0)
- { this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns"); }
- if (doubleProto >= 0)
- { this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); }
- };
- pp.checkYieldAwaitInDefaultParams = function() {
- if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))
- { this.raise(this.yieldPos, "Yield expression cannot be a default value"); }
- if (this.awaitPos)
- { this.raise(this.awaitPos, "Await expression cannot be a default value"); }
- };
- pp.isSimpleAssignTarget = function(expr) {
- if (expr.type === "ParenthesizedExpression")
- { return this.isSimpleAssignTarget(expr.expression) }
- return expr.type === "Identifier" || expr.type === "MemberExpression"
- };
- var pp$1 = Parser.prototype;
- pp$1.parseTopLevel = function(node) {
- var this$1 = this;
- var exports = {};
- if (!node.body) { node.body = []; }
- while (this.type !== types.eof) {
- var stmt = this$1.parseStatement(true, true, exports);
- node.body.push(stmt);
- }
- this.adaptDirectivePrologue(node.body);
- this.next();
- if (this.options.ecmaVersion >= 6) {
- node.sourceType = this.options.sourceType;
- }
- return this.finishNode(node, "Program")
- };
- var loopLabel = {kind: "loop"};
- var switchLabel = {kind: "switch"};
- pp$1.isLet = function() {
- if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
- skipWhiteSpace.lastIndex = this.pos;
- var skip = skipWhiteSpace.exec(this.input);
- var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
- if (nextCh === 91 || nextCh === 123) { return true }
- if (isIdentifierStart(nextCh, true)) {
- var pos = next + 1;
- while (isIdentifierChar(this.input.charCodeAt(pos), true)) { ++pos; }
- var ident = this.input.slice(next, pos);
- if (!keywordRelationalOperator.test(ident)) { return true }
- }
- return false
- };
- pp$1.isAsyncFunction = function() {
- if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
- { return false }
- skipWhiteSpace.lastIndex = this.pos;
- var skip = skipWhiteSpace.exec(this.input);
- var next = this.pos + skip[0].length;
- return !lineBreak.test(this.input.slice(this.pos, next)) &&
- this.input.slice(next, next + 8) === "function" &&
- (next + 8 === this.input.length || !isIdentifierChar(this.input.charAt(next + 8)))
- };
- pp$1.parseStatement = function(declaration, topLevel, exports) {
- var starttype = this.type, node = this.startNode(), kind;
- if (this.isLet()) {
- starttype = types._var;
- kind = "let";
- }
-
-
-
- switch (starttype) {
- case types._break: case types._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
- case types._debugger: return this.parseDebuggerStatement(node)
- case types._do: return this.parseDoStatement(node)
- case types._for: return this.parseForStatement(node)
- case types._function:
- if (!declaration && this.options.ecmaVersion >= 6) { this.unexpected(); }
- return this.parseFunctionStatement(node, false)
- case types._class:
- if (!declaration) { this.unexpected(); }
- return this.parseClass(node, true)
- case types._if: return this.parseIfStatement(node)
- case types._return: return this.parseReturnStatement(node)
- case types._switch: return this.parseSwitchStatement(node)
- case types._throw: return this.parseThrowStatement(node)
- case types._try: return this.parseTryStatement(node)
- case types._const: case types._var:
- kind = kind || this.value;
- if (!declaration && kind !== "var") { this.unexpected(); }
- return this.parseVarStatement(node, kind)
- case types._while: return this.parseWhileStatement(node)
- case types._with: return this.parseWithStatement(node)
- case types.braceL: return this.parseBlock()
- case types.semi: return this.parseEmptyStatement(node)
- case types._export:
- case types._import:
- if (!this.options.allowImportExportEverywhere) {
- if (!topLevel)
- { this.raise(this.start, "'import' and 'export' may only appear at the top level"); }
- if (!this.inModule)
- { this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
- }
- return starttype === types._import ? this.parseImport(node) : this.parseExport(node, exports)
-
-
-
-
-
- default:
- if (this.isAsyncFunction()) {
- if (!declaration) { this.unexpected(); }
- this.next();
- return this.parseFunctionStatement(node, true)
- }
- var maybeName = this.value, expr = this.parseExpression();
- if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon))
- { return this.parseLabeledStatement(node, maybeName, expr) }
- else { return this.parseExpressionStatement(node, expr) }
- }
- };
- pp$1.parseBreakContinueStatement = function(node, keyword) {
- var this$1 = this;
- var isBreak = keyword === "break";
- this.next();
- if (this.eat(types.semi) || this.insertSemicolon()) { node.label = null; }
- else if (this.type !== types.name) { this.unexpected(); }
- else {
- node.label = this.parseIdent();
- this.semicolon();
- }
-
-
- var i = 0;
- for (; i < this.labels.length; ++i) {
- var lab = this$1.labels[i];
- if (node.label == null || lab.name === node.label.name) {
- if (lab.kind != null && (isBreak || lab.kind === "loop")) { break }
- if (node.label && isBreak) { break }
- }
- }
- if (i === this.labels.length) { this.raise(node.start, "Unsyntactic " + keyword); }
- return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
- };
- pp$1.parseDebuggerStatement = function(node) {
- this.next();
- this.semicolon();
- return this.finishNode(node, "DebuggerStatement")
- };
- pp$1.parseDoStatement = function(node) {
- this.next();
- this.labels.push(loopLabel);
- node.body = this.parseStatement(false);
- this.labels.pop();
- this.expect(types._while);
- node.test = this.parseParenExpression();
- if (this.options.ecmaVersion >= 6)
- { this.eat(types.semi); }
- else
- { this.semicolon(); }
- return this.finishNode(node, "DoWhileStatement")
- };
- pp$1.parseForStatement = function(node) {
- this.next();
- var awaitAt = (this.options.ecmaVersion >= 9 && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction)) && this.eatContextual("await")) ? this.lastTokStart : -1;
- this.labels.push(loopLabel);
- this.enterLexicalScope();
- this.expect(types.parenL);
- if (this.type === types.semi) {
- if (awaitAt > -1) { this.unexpected(awaitAt); }
- return this.parseFor(node, null)
- }
- var isLet = this.isLet();
- if (this.type === types._var || this.type === types._const || isLet) {
- var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
- this.next();
- this.parseVar(init$1, true, kind);
- this.finishNode(init$1, "VariableDeclaration");
- if ((this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1 &&
- !(kind !== "var" && init$1.declarations[0].init)) {
- if (this.options.ecmaVersion >= 9) {
- if (this.type === types._in) {
- if (awaitAt > -1) { this.unexpected(awaitAt); }
- } else { node.await = awaitAt > -1; }
- }
- return this.parseForIn(node, init$1)
- }
- if (awaitAt > -1) { this.unexpected(awaitAt); }
- return this.parseFor(node, init$1)
- }
- var refDestructuringErrors = new DestructuringErrors;
- var init = this.parseExpression(true, refDestructuringErrors);
- if (this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
- if (this.options.ecmaVersion >= 9) {
- if (this.type === types._in) {
- if (awaitAt > -1) { this.unexpected(awaitAt); }
- } else { node.await = awaitAt > -1; }
- }
- this.toAssignable(init, false, refDestructuringErrors);
- this.checkLVal(init);
- return this.parseForIn(node, init)
- } else {
- this.checkExpressionErrors(refDestructuringErrors, true);
- }
- if (awaitAt > -1) { this.unexpected(awaitAt); }
- return this.parseFor(node, init)
- };
- pp$1.parseFunctionStatement = function(node, isAsync) {
- this.next();
- return this.parseFunction(node, true, false, isAsync)
- };
- pp$1.parseIfStatement = function(node) {
- this.next();
- node.test = this.parseParenExpression();
-
- node.consequent = this.parseStatement(!this.strict && this.type === types._function);
- node.alternate = this.eat(types._else) ? this.parseStatement(!this.strict && this.type === types._function) : null;
- return this.finishNode(node, "IfStatement")
- };
- pp$1.parseReturnStatement = function(node) {
- if (!this.inFunction && !this.options.allowReturnOutsideFunction)
- { this.raise(this.start, "'return' outside of function"); }
- this.next();
-
-
-
- if (this.eat(types.semi) || this.insertSemicolon()) { node.argument = null; }
- else { node.argument = this.parseExpression(); this.semicolon(); }
- return this.finishNode(node, "ReturnStatement")
- };
- pp$1.parseSwitchStatement = function(node) {
- var this$1 = this;
- this.next();
- node.discriminant = this.parseParenExpression();
- node.cases = [];
- this.expect(types.braceL);
- this.labels.push(switchLabel);
- this.enterLexicalScope();
-
-
-
- var cur;
- for (var sawDefault = false; this.type !== types.braceR;) {
- if (this$1.type === types._case || this$1.type === types._default) {
- var isCase = this$1.type === types._case;
- if (cur) { this$1.finishNode(cur, "SwitchCase"); }
- node.cases.push(cur = this$1.startNode());
- cur.consequent = [];
- this$1.next();
- if (isCase) {
- cur.test = this$1.parseExpression();
- } else {
- if (sawDefault) { this$1.raiseRecoverable(this$1.lastTokStart, "Multiple default clauses"); }
- sawDefault = true;
- cur.test = null;
- }
- this$1.expect(types.colon);
- } else {
- if (!cur) { this$1.unexpected(); }
- cur.consequent.push(this$1.parseStatement(true));
- }
- }
- this.exitLexicalScope();
- if (cur) { this.finishNode(cur, "SwitchCase"); }
- this.next();
- this.labels.pop();
- return this.finishNode(node, "SwitchStatement")
- };
- pp$1.parseThrowStatement = function(node) {
- this.next();
- if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
- { this.raise(this.lastTokEnd, "Illegal newline after throw"); }
- node.argument = this.parseExpression();
- this.semicolon();
- return this.finishNode(node, "ThrowStatement")
- };
- var empty = [];
- pp$1.parseTryStatement = function(node) {
- this.next();
- node.block = this.parseBlock();
- node.handler = null;
- if (this.type === types._catch) {
- var clause = this.startNode();
- this.next();
- if (this.eat(types.parenL)) {
- clause.param = this.parseBindingAtom();
- this.enterLexicalScope();
- this.checkLVal(clause.param, "let");
- this.expect(types.parenR);
- } else {
- if (this.options.ecmaVersion < 10) { this.unexpected(); }
- clause.param = null;
- this.enterLexicalScope();
- }
- clause.body = this.parseBlock(false);
- this.exitLexicalScope();
- node.handler = this.finishNode(clause, "CatchClause");
- }
- node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
- if (!node.handler && !node.finalizer)
- { this.raise(node.start, "Missing catch or finally clause"); }
- return this.finishNode(node, "TryStatement")
- };
- pp$1.parseVarStatement = function(node, kind) {
- this.next();
- this.parseVar(node, false, kind);
- this.semicolon();
- return this.finishNode(node, "VariableDeclaration")
- };
- pp$1.parseWhileStatement = function(node) {
- this.next();
- node.test = this.parseParenExpression();
- this.labels.push(loopLabel);
- node.body = this.parseStatement(false);
- this.labels.pop();
- return this.finishNode(node, "WhileStatement")
- };
- pp$1.parseWithStatement = function(node) {
- if (this.strict) { this.raise(this.start, "'with' in strict mode"); }
- this.next();
- node.object = this.parseParenExpression();
- node.body = this.parseStatement(false);
- return this.finishNode(node, "WithStatement")
- };
- pp$1.parseEmptyStatement = function(node) {
- this.next();
- return this.finishNode(node, "EmptyStatement")
- };
- pp$1.parseLabeledStatement = function(node, maybeName, expr) {
- var this$1 = this;
- for (var i$1 = 0, list = this$1.labels; i$1 < list.length; i$1 += 1)
- {
- var label = list[i$1];
- if (label.name === maybeName)
- { this$1.raise(expr.start, "Label '" + maybeName + "' is already declared");
- } }
- var kind = this.type.isLoop ? "loop" : this.type === types._switch ? "switch" : null;
- for (var i = this.labels.length - 1; i >= 0; i--) {
- var label$1 = this$1.labels[i];
- if (label$1.statementStart === node.start) {
-
- label$1.statementStart = this$1.start;
- label$1.kind = kind;
- } else { break }
- }
- this.labels.push({name: maybeName, kind: kind, statementStart: this.start});
- node.body = this.parseStatement(true);
- if (node.body.type === "ClassDeclaration" ||
- node.body.type === "VariableDeclaration" && node.body.kind !== "var" ||
- node.body.type === "FunctionDeclaration" && (this.strict || node.body.generator || node.body.async))
- { this.raiseRecoverable(node.body.start, "Invalid labeled declaration"); }
- this.labels.pop();
- node.label = expr;
- return this.finishNode(node, "LabeledStatement")
- };
- pp$1.parseExpressionStatement = function(node, expr) {
- node.expression = expr;
- this.semicolon();
- return this.finishNode(node, "ExpressionStatement")
- };
- pp$1.parseBlock = function(createNewLexicalScope) {
- var this$1 = this;
- if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
- var node = this.startNode();
- node.body = [];
- this.expect(types.braceL);
- if (createNewLexicalScope) {
- this.enterLexicalScope();
- }
- while (!this.eat(types.braceR)) {
- var stmt = this$1.parseStatement(true);
- node.body.push(stmt);
- }
- if (createNewLexicalScope) {
- this.exitLexicalScope();
- }
- return this.finishNode(node, "BlockStatement")
- };
- pp$1.parseFor = function(node, init) {
- node.init = init;
- this.expect(types.semi);
- node.test = this.type === types.semi ? null : this.parseExpression();
- this.expect(types.semi);
- node.update = this.type === types.parenR ? null : this.parseExpression();
- this.expect(types.parenR);
- this.exitLexicalScope();
- node.body = this.parseStatement(false);
- this.labels.pop();
- return this.finishNode(node, "ForStatement")
- };
- pp$1.parseForIn = function(node, init) {
- var type = this.type === types._in ? "ForInStatement" : "ForOfStatement";
- this.next();
- if (type === "ForInStatement") {
- if (init.type === "AssignmentPattern" ||
- (init.type === "VariableDeclaration" && init.declarations[0].init != null &&
- (this.strict || init.declarations[0].id.type !== "Identifier")))
- { this.raise(init.start, "Invalid assignment in for-in loop head"); }
- }
- node.left = init;
- node.right = type === "ForInStatement" ? this.parseExpression() : this.parseMaybeAssign();
- this.expect(types.parenR);
- this.exitLexicalScope();
- node.body = this.parseStatement(false);
- this.labels.pop();
- return this.finishNode(node, type)
- };
- pp$1.parseVar = function(node, isFor, kind) {
- var this$1 = this;
- node.declarations = [];
- node.kind = kind;
- for (;;) {
- var decl = this$1.startNode();
- this$1.parseVarId(decl, kind);
- if (this$1.eat(types.eq)) {
- decl.init = this$1.parseMaybeAssign(isFor);
- } else if (kind === "const" && !(this$1.type === types._in || (this$1.options.ecmaVersion >= 6 && this$1.isContextual("of")))) {
- this$1.unexpected();
- } else if (decl.id.type !== "Identifier" && !(isFor && (this$1.type === types._in || this$1.isContextual("of")))) {
- this$1.raise(this$1.lastTokEnd, "Complex binding patterns require an initialization value");
- } else {
- decl.init = null;
- }
- node.declarations.push(this$1.finishNode(decl, "VariableDeclarator"));
- if (!this$1.eat(types.comma)) { break }
- }
- return node
- };
- pp$1.parseVarId = function(decl, kind) {
- decl.id = this.parseBindingAtom(kind);
- this.checkLVal(decl.id, kind, false);
- };
- pp$1.parseFunction = function(node, isStatement, allowExpressionBody, isAsync) {
- this.initFunction(node);
- if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync)
- { node.generator = this.eat(types.star); }
- if (this.options.ecmaVersion >= 8)
- { node.async = !!isAsync; }
- if (isStatement) {
- node.id = isStatement === "nullableID" && this.type !== types.name ? null : this.parseIdent();
- if (node.id) {
- this.checkLVal(node.id, this.inModule && !this.inFunction ? "let" : "var");
- }
- }
- var oldInGen = this.inGenerator, oldInAsync = this.inAsync,
- oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldInFunc = this.inFunction;
- this.inGenerator = node.generator;
- this.inAsync = node.async;
- this.yieldPos = 0;
- this.awaitPos = 0;
- this.inFunction = true;
- this.enterFunctionScope();
- if (!isStatement)
- { node.id = this.type === types.name ? this.parseIdent() : null; }
- this.parseFunctionParams(node);
- this.parseFunctionBody(node, allowExpressionBody);
- this.inGenerator = oldInGen;
- this.inAsync = oldInAsync;
- this.yieldPos = oldYieldPos;
- this.awaitPos = oldAwaitPos;
- this.inFunction = oldInFunc;
- return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression")
- };
- pp$1.parseFunctionParams = function(node) {
- this.expect(types.parenL);
- node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
- this.checkYieldAwaitInDefaultParams();
- };
- pp$1.parseClass = function(node, isStatement) {
- var this$1 = this;
- this.next();
- this.parseClassId(node, isStatement);
- this.parseClassSuper(node);
- var classBody = this.startNode();
- var hadConstructor = false;
- classBody.body = [];
- this.expect(types.braceL);
- while (!this.eat(types.braceR)) {
- var member = this$1.parseClassMember(classBody);
- if (member && member.type === "MethodDefinition" && member.kind === "constructor") {
- if (hadConstructor) { this$1.raise(member.start, "Duplicate constructor in the same class"); }
- hadConstructor = true;
- }
- }
- node.body = this.finishNode(classBody, "ClassBody");
- return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
- };
- pp$1.parseClassMember = function(classBody) {
- var this$1 = this;
- if (this.eat(types.semi)) { return null }
- var method = this.startNode();
- var tryContextual = function (k, noLineBreak) {
- if ( noLineBreak === void 0 ) noLineBreak = false;
- var start = this$1.start, startLoc = this$1.startLoc;
- if (!this$1.eatContextual(k)) { return false }
- if (this$1.type !== types.parenL && (!noLineBreak || !this$1.canInsertSemicolon())) { return true }
- if (method.key) { this$1.unexpected(); }
- method.computed = false;
- method.key = this$1.startNodeAt(start, startLoc);
- method.key.name = k;
- this$1.finishNode(method.key, "Identifier");
- return false
- };
- method.kind = "method";
- method.static = tryContextual("static");
- var isGenerator = this.eat(types.star);
- var isAsync = false;
- if (!isGenerator) {
- if (this.options.ecmaVersion >= 8 && tryContextual("async", true)) {
- isAsync = true;
- isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
- } else if (tryContextual("get")) {
- method.kind = "get";
- } else if (tryContextual("set")) {
- method.kind = "set";
- }
- }
- if (!method.key) { this.parsePropertyName(method); }
- var key = method.key;
- if (!method.computed && !method.static && (key.type === "Identifier" && key.name === "constructor" ||
- key.type === "Literal" && key.value === "constructor")) {
- if (method.kind !== "method") { this.raise(key.start, "Constructor can't have get/set modifier"); }
- if (isGenerator) { this.raise(key.start, "Constructor can't be a generator"); }
- if (isAsync) { this.raise(key.start, "Constructor can't be an async method"); }
- method.kind = "constructor";
- } else if (method.static && key.type === "Identifier" && key.name === "prototype") {
- this.raise(key.start, "Classes may not have a static property named prototype");
- }
- this.parseClassMethod(classBody, method, isGenerator, isAsync);
- if (method.kind === "get" && method.value.params.length !== 0)
- { this.raiseRecoverable(method.value.start, "getter should have no params"); }
- if (method.kind === "set" && method.value.params.length !== 1)
- { this.raiseRecoverable(method.value.start, "setter should have exactly one param"); }
- if (method.kind === "set" && method.value.params[0].type === "RestElement")
- { this.raiseRecoverable(method.value.params[0].start, "Setter cannot use rest params"); }
- return method
- };
- pp$1.parseClassMethod = function(classBody, method, isGenerator, isAsync) {
- method.value = this.parseMethod(isGenerator, isAsync);
- classBody.body.push(this.finishNode(method, "MethodDefinition"));
- };
- pp$1.parseClassId = function(node, isStatement) {
- node.id = this.type === types.name ? this.parseIdent() : isStatement === true ? this.unexpected() : null;
- };
- pp$1.parseClassSuper = function(node) {
- node.superClass = this.eat(types._extends) ? this.parseExprSubscripts() : null;
- };
- pp$1.parseExport = function(node, exports) {
- var this$1 = this;
- this.next();
-
- if (this.eat(types.star)) {
- this.expectContextual("from");
- if (this.type !== types.string) { this.unexpected(); }
- node.source = this.parseExprAtom();
- this.semicolon();
- return this.finishNode(node, "ExportAllDeclaration")
- }
- if (this.eat(types._default)) {
- this.checkExport(exports, "default", this.lastTokStart);
- var isAsync;
- if (this.type === types._function || (isAsync = this.isAsyncFunction())) {
- var fNode = this.startNode();
- this.next();
- if (isAsync) { this.next(); }
- node.declaration = this.parseFunction(fNode, "nullableID", false, isAsync);
- } else if (this.type === types._class) {
- var cNode = this.startNode();
- node.declaration = this.parseClass(cNode, "nullableID");
- } else {
- node.declaration = this.parseMaybeAssign();
- this.semicolon();
- }
- return this.finishNode(node, "ExportDefaultDeclaration")
- }
-
- if (this.shouldParseExportStatement()) {
- node.declaration = this.parseStatement(true);
- if (node.declaration.type === "VariableDeclaration")
- { this.checkVariableExport(exports, node.declaration.declarations); }
- else
- { this.checkExport(exports, node.declaration.id.name, node.declaration.id.start); }
- node.specifiers = [];
- node.source = null;
- } else {
- node.declaration = null;
- node.specifiers = this.parseExportSpecifiers(exports);
- if (this.eatContextual("from")) {
- if (this.type !== types.string) { this.unexpected(); }
- node.source = this.parseExprAtom();
- } else {
-
- for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
- var spec = list[i];
- this$1.checkUnreserved(spec.local);
- }
- node.source = null;
- }
- this.semicolon();
- }
- return this.finishNode(node, "ExportNamedDeclaration")
- };
- pp$1.checkExport = function(exports, name, pos) {
- if (!exports) { return }
- if (has(exports, name))
- { this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
- exports[name] = true;
- };
- pp$1.checkPatternExport = function(exports, pat) {
- var this$1 = this;
- var type = pat.type;
- if (type === "Identifier")
- { this.checkExport(exports, pat.name, pat.start); }
- else if (type === "ObjectPattern")
- { for (var i = 0, list = pat.properties; i < list.length; i += 1)
- {
- var prop = list[i];
- this$1.checkPatternExport(exports, prop);
- } }
- else if (type === "ArrayPattern")
- { for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
- var elt = list$1[i$1];
- if (elt) { this$1.checkPatternExport(exports, elt); }
- } }
- else if (type === "Property")
- { this.checkPatternExport(exports, pat.value); }
- else if (type === "AssignmentPattern")
- { this.checkPatternExport(exports, pat.left); }
- else if (type === "RestElement")
- { this.checkPatternExport(exports, pat.argument); }
- else if (type === "ParenthesizedExpression")
- { this.checkPatternExport(exports, pat.expression); }
- };
- pp$1.checkVariableExport = function(exports, decls) {
- var this$1 = this;
- if (!exports) { return }
- for (var i = 0, list = decls; i < list.length; i += 1)
- {
- var decl = list[i];
- this$1.checkPatternExport(exports, decl.id);
- }
- };
- pp$1.shouldParseExportStatement = function() {
- return this.type.keyword === "var" ||
- this.type.keyword === "const" ||
- this.type.keyword === "class" ||
- this.type.keyword === "function" ||
- this.isLet() ||
- this.isAsyncFunction()
- };
- pp$1.parseExportSpecifiers = function(exports) {
- var this$1 = this;
- var nodes = [], first = true;
-
- this.expect(types.braceL);
- while (!this.eat(types.braceR)) {
- if (!first) {
- this$1.expect(types.comma);
- if (this$1.afterTrailingComma(types.braceR)) { break }
- } else { first = false; }
- var node = this$1.startNode();
- node.local = this$1.parseIdent(true);
- node.exported = this$1.eatContextual("as") ? this$1.parseIdent(true) : node.local;
- this$1.checkExport(exports, node.exported.name, node.exported.start);
- nodes.push(this$1.finishNode(node, "ExportSpecifier"));
- }
- return nodes
- };
- pp$1.parseImport = function(node) {
- this.next();
-
- if (this.type === types.string) {
- node.specifiers = empty;
- node.source = this.parseExprAtom();
- } else {
- node.specifiers = this.parseImportSpecifiers();
- this.expectContextual("from");
- node.source = this.type === types.string ? this.parseExprAtom() : this.unexpected();
- }
- this.semicolon();
- return this.finishNode(node, "ImportDeclaration")
- };
- pp$1.parseImportSpecifiers = function() {
- var this$1 = this;
- var nodes = [], first = true;
- if (this.type === types.name) {
-
- var node = this.startNode();
- node.local = this.parseIdent();
- this.checkLVal(node.local, "let");
- nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
- if (!this.eat(types.comma)) { return nodes }
- }
- if (this.type === types.star) {
- var node$1 = this.startNode();
- this.next();
- this.expectContextual("as");
- node$1.local = this.parseIdent();
- this.checkLVal(node$1.local, "let");
- nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
- return nodes
- }
- this.expect(types.braceL);
- while (!this.eat(types.braceR)) {
- if (!first) {
- this$1.expect(types.comma);
- if (this$1.afterTrailingComma(types.braceR)) { break }
- } else { first = false; }
- var node$2 = this$1.startNode();
- node$2.imported = this$1.parseIdent(true);
- if (this$1.eatContextual("as")) {
- node$2.local = this$1.parseIdent();
- } else {
- this$1.checkUnreserved(node$2.imported);
- node$2.local = node$2.imported;
- }
- this$1.checkLVal(node$2.local, "let");
- nodes.push(this$1.finishNode(node$2, "ImportSpecifier"));
- }
- return nodes
- };
- pp$1.adaptDirectivePrologue = function(statements) {
- for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
- statements[i].directive = statements[i].expression.raw.slice(1, -1);
- }
- };
- pp$1.isDirectiveCandidate = function(statement) {
- return (
- statement.type === "ExpressionStatement" &&
- statement.expression.type === "Literal" &&
- typeof statement.expression.value === "string" &&
-
- (this.input[statement.start] === "\"" || this.input[statement.start] === "'")
- )
- };
- var pp$2 = Parser.prototype;
- pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
- var this$1 = this;
- if (this.options.ecmaVersion >= 6 && node) {
- switch (node.type) {
- case "Identifier":
- if (this.inAsync && node.name === "await")
- { this.raise(node.start, "Can not use 'await' as identifier inside an async function"); }
- break
- case "ObjectPattern":
- case "ArrayPattern":
- case "RestElement":
- break
- case "ObjectExpression":
- node.type = "ObjectPattern";
- if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
- for (var i = 0, list = node.properties; i < list.length; i += 1) {
- var prop = list[i];
- this$1.toAssignable(prop, isBinding);
-
-
-
-
-
- if (
- prop.type === "RestElement" &&
- (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")
- ) {
- this$1.raise(prop.argument.start, "Unexpected token");
- }
- }
- break
- case "Property":
-
- if (node.kind !== "init") { this.raise(node.key.start, "Object pattern can't contain getter or setter"); }
- this.toAssignable(node.value, isBinding);
- break
- case "ArrayExpression":
- node.type = "ArrayPattern";
- if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
- this.toAssignableList(node.elements, isBinding);
- break
- case "SpreadElement":
- node.type = "RestElement";
- this.toAssignable(node.argument, isBinding);
- if (node.argument.type === "AssignmentPattern")
- { this.raise(node.argument.start, "Rest elements cannot have a default value"); }
- break
- case "AssignmentExpression":
- if (node.operator !== "=") { this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); }
- node.type = "AssignmentPattern";
- delete node.operator;
- this.toAssignable(node.left, isBinding);
-
- case "AssignmentPattern":
- break
- case "ParenthesizedExpression":
- this.toAssignable(node.expression, isBinding);
- break
- case "MemberExpression":
- if (!isBinding) { break }
- default:
- this.raise(node.start, "Assigning to rvalue");
- }
- } else if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
- return node
- };
- pp$2.toAssignableList = function(exprList, isBinding) {
- var this$1 = this;
- var end = exprList.length;
- for (var i = 0; i < end; i++) {
- var elt = exprList[i];
- if (elt) { this$1.toAssignable(elt, isBinding); }
- }
- if (end) {
- var last = exprList[end - 1];
- if (this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier")
- { this.unexpected(last.argument.start); }
- }
- return exprList
- };
- pp$2.parseSpread = function(refDestructuringErrors) {
- var node = this.startNode();
- this.next();
- node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
- return this.finishNode(node, "SpreadElement")
- };
- pp$2.parseRestBinding = function() {
- var node = this.startNode();
- this.next();
-
- if (this.options.ecmaVersion === 6 && this.type !== types.name)
- { this.unexpected(); }
- node.argument = this.parseBindingAtom();
- return this.finishNode(node, "RestElement")
- };
- pp$2.parseBindingAtom = function() {
- if (this.options.ecmaVersion >= 6) {
- switch (this.type) {
- case types.bracketL:
- var node = this.startNode();
- this.next();
- node.elements = this.parseBindingList(types.bracketR, true, true);
- return this.finishNode(node, "ArrayPattern")
- case types.braceL:
- return this.parseObj(true)
- }
- }
- return this.parseIdent()
- };
- pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
- var this$1 = this;
- var elts = [], first = true;
- while (!this.eat(close)) {
- if (first) { first = false; }
- else { this$1.expect(types.comma); }
- if (allowEmpty && this$1.type === types.comma) {
- elts.push(null);
- } else if (allowTrailingComma && this$1.afterTrailingComma(close)) {
- break
- } else if (this$1.type === types.ellipsis) {
- var rest = this$1.parseRestBinding();
- this$1.parseBindingListItem(rest);
- elts.push(rest);
- if (this$1.type === types.comma) { this$1.raise(this$1.start, "Comma is not permitted after the rest element"); }
- this$1.expect(close);
- break
- } else {
- var elem = this$1.parseMaybeDefault(this$1.start, this$1.startLoc);
- this$1.parseBindingListItem(elem);
- elts.push(elem);
- }
- }
- return elts
- };
- pp$2.parseBindingListItem = function(param) {
- return param
- };
- pp$2.parseMaybeDefault = function(startPos, startLoc, left) {
- left = left || this.parseBindingAtom();
- if (this.options.ecmaVersion < 6 || !this.eat(types.eq)) { return left }
- var node = this.startNodeAt(startPos, startLoc);
- node.left = left;
- node.right = this.parseMaybeAssign();
- return this.finishNode(node, "AssignmentPattern")
- };
- pp$2.checkLVal = function(expr, bindingType, checkClashes) {
- var this$1 = this;
- switch (expr.type) {
- case "Identifier":
- if (this.strict && this.reservedWordsStrictBind.test(expr.name))
- { this.raiseRecoverable(expr.start, (bindingType ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); }
- if (checkClashes) {
- if (has(checkClashes, expr.name))
- { this.raiseRecoverable(expr.start, "Argument name clash"); }
- checkClashes[expr.name] = true;
- }
- if (bindingType && bindingType !== "none") {
- if (
- bindingType === "var" && !this.canDeclareVarName(expr.name) ||
- bindingType !== "var" && !this.canDeclareLexicalName(expr.name)
- ) {
- this.raiseRecoverable(expr.start, ("Identifier '" + (expr.name) + "' has already been declared"));
- }
- if (bindingType === "var") {
- this.declareVarName(expr.name);
- } else {
- this.declareLexicalName(expr.name);
- }
- }
- break
- case "MemberExpression":
- if (bindingType) { this.raiseRecoverable(expr.start, "Binding member expression"); }
- break
- case "ObjectPattern":
- for (var i = 0, list = expr.properties; i < list.length; i += 1)
- {
- var prop = list[i];
- this$1.checkLVal(prop, bindingType, checkClashes);
- }
- break
- case "Property":
-
- this.checkLVal(expr.value, bindingType, checkClashes);
- break
- case "ArrayPattern":
- for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) {
- var elem = list$1[i$1];
- if (elem) { this$1.checkLVal(elem, bindingType, checkClashes); }
- }
- break
- case "AssignmentPattern":
- this.checkLVal(expr.left, bindingType, checkClashes);
- break
- case "RestElement":
- this.checkLVal(expr.argument, bindingType, checkClashes);
- break
- case "ParenthesizedExpression":
- this.checkLVal(expr.expression, bindingType, checkClashes);
- break
- default:
- this.raise(expr.start, (bindingType ? "Binding" : "Assigning to") + " rvalue");
- }
- };
- var pp$3 = Parser.prototype;
- pp$3.checkPropClash = function(prop, propHash, refDestructuringErrors) {
- if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
- { return }
- if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
- { return }
- var key = prop.key;
- var name;
- switch (key.type) {
- case "Identifier": name = key.name; break
- case "Literal": name = String(key.value); break
- default: return
- }
- var kind = prop.kind;
- if (this.options.ecmaVersion >= 6) {
- if (name === "__proto__" && kind === "init") {
- if (propHash.proto) {
- if (refDestructuringErrors && refDestructuringErrors.doubleProto < 0) { refDestructuringErrors.doubleProto = key.start; }
-
- else { this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); }
- }
- propHash.proto = true;
- }
- return
- }
- name = "$" + name;
- var other = propHash[name];
- if (other) {
- var redefinition;
- if (kind === "init") {
- redefinition = this.strict && other.init || other.get || other.set;
- } else {
- redefinition = other.init || other[kind];
- }
- if (redefinition)
- { this.raiseRecoverable(key.start, "Redefinition of property"); }
- } else {
- other = propHash[name] = {
- init: false,
- get: false,
- set: false
- };
- }
- other[kind] = true;
- };
- pp$3.parseExpression = function(noIn, refDestructuringErrors) {
- var this$1 = this;
- var startPos = this.start, startLoc = this.startLoc;
- var expr = this.parseMaybeAssign(noIn, refDestructuringErrors);
- if (this.type === types.comma) {
- var node = this.startNodeAt(startPos, startLoc);
- node.expressions = [expr];
- while (this.eat(types.comma)) { node.expressions.push(this$1.parseMaybeAssign(noIn, refDestructuringErrors)); }
- return this.finishNode(node, "SequenceExpression")
- }
- return expr
- };
- pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
- if (this.inGenerator && this.isContextual("yield")) { return this.parseYield() }
- var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1;
- if (refDestructuringErrors) {
- oldParenAssign = refDestructuringErrors.parenthesizedAssign;
- oldTrailingComma = refDestructuringErrors.trailingComma;
- refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
- } else {
- refDestructuringErrors = new DestructuringErrors;
- ownDestructuringErrors = true;
- }
- var startPos = this.start, startLoc = this.startLoc;
- if (this.type === types.parenL || this.type === types.name)
- { this.potentialArrowAt = this.start; }
- var left = this.parseMaybeConditional(noIn, refDestructuringErrors);
- if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); }
- if (this.type.isAssign) {
- var node = this.startNodeAt(startPos, startLoc);
- node.operator = this.value;
- node.left = this.type === types.eq ? this.toAssignable(left, false, refDestructuringErrors) : left;
- if (!ownDestructuringErrors) { DestructuringErrors.call(refDestructuringErrors); }
- refDestructuringErrors.shorthandAssign = -1;
- this.checkLVal(left);
- this.next();
- node.right = this.parseMaybeAssign(noIn);
- return this.finishNode(node, "AssignmentExpression")
- } else {
- if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
- }
- if (oldParenAssign > -1) { refDestructuringErrors.parenthesizedAssign = oldParenAssign; }
- if (oldTrailingComma > -1) { refDestructuringErrors.trailingComma = oldTrailingComma; }
- return left
- };
- pp$3.parseMaybeConditional = function(noIn, refDestructuringErrors) {
- var startPos = this.start, startLoc = this.startLoc;
- var expr = this.parseExprOps(noIn, refDestructuringErrors);
- if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
- if (this.eat(types.question)) {
- var node = this.startNodeAt(startPos, startLoc);
- node.test = expr;
- node.consequent = this.parseMaybeAssign();
- this.expect(types.colon);
- node.alternate = this.parseMaybeAssign(noIn);
- return this.finishNode(node, "ConditionalExpression")
- }
- return expr
- };
- pp$3.parseExprOps = function(noIn, refDestructuringErrors) {
- var startPos = this.start, startLoc = this.startLoc;
- var expr = this.parseMaybeUnary(refDestructuringErrors, false);
- if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
- return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, noIn)
- };
- pp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {
- var prec = this.type.binop;
- if (prec != null && (!noIn || this.type !== types._in)) {
- if (prec > minPrec) {
- var logical = this.type === types.logicalOR || this.type === types.logicalAND;
- var op = this.value;
- this.next();
- var startPos = this.start, startLoc = this.startLoc;
- var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn);
- var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical);
- return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn)
- }
- }
- return left
- };
- pp$3.buildBinary = function(startPos, startLoc, left, right, op, logical) {
- var node = this.startNodeAt(startPos, startLoc);
- node.left = left;
- node.operator = op;
- node.right = right;
- return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression")
- };
- pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
- var this$1 = this;
- var startPos = this.start, startLoc = this.startLoc, expr;
- if (this.isContextual("await") && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction))) {
- expr = this.parseAwait();
- sawUnary = true;
- } else if (this.type.prefix) {
- var node = this.startNode(), update = this.type === types.incDec;
- node.operator = this.value;
- node.prefix = true;
- this.next();
- node.argument = this.parseMaybeUnary(null, true);
- this.checkExpressionErrors(refDestructuringErrors, true);
- if (update) { this.checkLVal(node.argument); }
- else if (this.strict && node.operator === "delete" &&
- node.argument.type === "Identifier")
- { this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); }
- else { sawUnary = true; }
- expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
- } else {
- expr = this.parseExprSubscripts(refDestructuringErrors);
- if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
- while (this.type.postfix && !this.canInsertSemicolon()) {
- var node$1 = this$1.startNodeAt(startPos, startLoc);
- node$1.operator = this$1.value;
- node$1.prefix = false;
- node$1.argument = expr;
- this$1.checkLVal(expr);
- this$1.next();
- expr = this$1.finishNode(node$1, "UpdateExpression");
- }
- }
- if (!sawUnary && this.eat(types.starstar))
- { return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), "**", false) }
- else
- { return expr }
- };
- pp$3.parseExprSubscripts = function(refDestructuringErrors) {
- var startPos = this.start, startLoc = this.startLoc;
- var expr = this.parseExprAtom(refDestructuringErrors);
- var skipArrowSubscripts = expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")";
- if (this.checkExpressionErrors(refDestructuringErrors) || skipArrowSubscripts) { return expr }
- var result = this.parseSubscripts(expr, startPos, startLoc);
- if (refDestructuringErrors && result.type === "MemberExpression") {
- if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; }
- if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; }
- }
- return result
- };
- pp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) {
- var this$1 = this;
- var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
- this.lastTokEnd === base.end && !this.canInsertSemicolon() && this.input.slice(base.start, base.end) === "async";
- for (var computed = (void 0);;) {
- if ((computed = this$1.eat(types.bracketL)) || this$1.eat(types.dot)) {
- var node = this$1.startNodeAt(startPos, startLoc);
- node.object = base;
- node.property = computed ? this$1.parseExpression() : this$1.parseIdent(true);
- node.computed = !!computed;
- if (computed) { this$1.expect(types.bracketR); }
- base = this$1.finishNode(node, "MemberExpression");
- } else if (!noCalls && this$1.eat(types.parenL)) {
- var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this$1.yieldPos, oldAwaitPos = this$1.awaitPos;
- this$1.yieldPos = 0;
- this$1.awaitPos = 0;
- var exprList = this$1.parseExprList(types.parenR, this$1.options.ecmaVersion >= 8, false, refDestructuringErrors);
- if (maybeAsyncArrow && !this$1.canInsertSemicolon() && this$1.eat(types.arrow)) {
- this$1.checkPatternErrors(refDestructuringErrors, false);
- this$1.checkYieldAwaitInDefaultParams();
- this$1.yieldPos = oldYieldPos;
- this$1.awaitPos = oldAwaitPos;
- return this$1.parseArrowExpression(this$1.startNodeAt(startPos, startLoc), exprList, true)
- }
- this$1.checkExpressionErrors(refDestructuringErrors, true);
- this$1.yieldPos = oldYieldPos || this$1.yieldPos;
- this$1.awaitPos = oldAwaitPos || this$1.awaitPos;
- var node$1 = this$1.startNodeAt(startPos, startLoc);
- node$1.callee = base;
- node$1.arguments = exprList;
- base = this$1.finishNode(node$1, "CallExpression");
- } else if (this$1.type === types.backQuote) {
- var node$2 = this$1.startNodeAt(startPos, startLoc);
- node$2.tag = base;
- node$2.quasi = this$1.parseTemplate({isTagged: true});
- base = this$1.finishNode(node$2, "TaggedTemplateExpression");
- } else {
- return base
- }
- }
- };
- pp$3.parseExprAtom = function(refDestructuringErrors) {
- var node, canBeArrow = this.potentialArrowAt === this.start;
- switch (this.type) {
- case types._super:
- if (!this.inFunction)
- { this.raise(this.start, "'super' outside of function or class"); }
- node = this.startNode();
- this.next();
-
-
-
-
-
-
- if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL)
- { this.unexpected(); }
- return this.finishNode(node, "Super")
- case types._this:
- node = this.startNode();
- this.next();
- return this.finishNode(node, "ThisExpression")
- case types.name:
- var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
- var id = this.parseIdent(this.type !== types.name);
- if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types._function))
- { return this.parseFunction(this.startNodeAt(startPos, startLoc), false, false, true) }
- if (canBeArrow && !this.canInsertSemicolon()) {
- if (this.eat(types.arrow))
- { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false) }
- if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc) {
- id = this.parseIdent();
- if (this.canInsertSemicolon() || !this.eat(types.arrow))
- { this.unexpected(); }
- return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true)
- }
- }
- return id
- case types.regexp:
- var value = this.value;
- node = this.parseLiteral(value.value);
- node.regex = {pattern: value.pattern, flags: value.flags};
- return node
- case types.num: case types.string:
- return this.parseLiteral(this.value)
- case types._null: case types._true: case types._false:
- node = this.startNode();
- node.value = this.type === types._null ? null : this.type === types._true;
- node.raw = this.type.keyword;
- this.next();
- return this.finishNode(node, "Literal")
- case types.parenL:
- var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow);
- if (refDestructuringErrors) {
- if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
- { refDestructuringErrors.parenthesizedAssign = start; }
- if (refDestructuringErrors.parenthesizedBind < 0)
- { refDestructuringErrors.parenthesizedBind = start; }
- }
- return expr
- case types.bracketL:
- node = this.startNode();
- this.next();
- node.elements = this.parseExprList(types.bracketR, true, true, refDestructuringErrors);
- return this.finishNode(node, "ArrayExpression")
- case types.braceL:
- return this.parseObj(false, refDestructuringErrors)
- case types._function:
- node = this.startNode();
- this.next();
- return this.parseFunction(node, false)
- case types._class:
- return this.parseClass(this.startNode(), false)
- case types._new:
- return this.parseNew()
- case types.backQuote:
- return this.parseTemplate()
- default:
- this.unexpected();
- }
- };
- pp$3.parseLiteral = function(value) {
- var node = this.startNode();
- node.value = value;
- node.raw = this.input.slice(this.start, this.end);
- this.next();
- return this.finishNode(node, "Literal")
- };
- pp$3.parseParenExpression = function() {
- this.expect(types.parenL);
- var val = this.parseExpression();
- this.expect(types.parenR);
- return val
- };
- pp$3.parseParenAndDistinguishExpression = function(canBeArrow) {
- var this$1 = this;
- var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
- if (this.options.ecmaVersion >= 6) {
- this.next();
- var innerStartPos = this.start, innerStartLoc = this.startLoc;
- var exprList = [], first = true, lastIsComma = false;
- var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart;
- this.yieldPos = 0;
- this.awaitPos = 0;
- while (this.type !== types.parenR) {
- first ? first = false : this$1.expect(types.comma);
- if (allowTrailingComma && this$1.afterTrailingComma(types.parenR, true)) {
- lastIsComma = true;
- break
- } else if (this$1.type === types.ellipsis) {
- spreadStart = this$1.start;
- exprList.push(this$1.parseParenItem(this$1.parseRestBinding()));
- if (this$1.type === types.comma) { this$1.raise(this$1.start, "Comma is not permitted after the rest element"); }
- break
- } else {
- exprList.push(this$1.parseMaybeAssign(false, refDestructuringErrors, this$1.parseParenItem));
- }
- }
- var innerEndPos = this.start, innerEndLoc = this.startLoc;
- this.expect(types.parenR);
- if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
- this.checkPatternErrors(refDestructuringErrors, false);
- this.checkYieldAwaitInDefaultParams();
- this.yieldPos = oldYieldPos;
- this.awaitPos = oldAwaitPos;
- return this.parseParenArrowList(startPos, startLoc, exprList)
- }
- if (!exprList.length || lastIsComma) { this.unexpected(this.lastTokStart); }
- if (spreadStart) { this.unexpected(spreadStart); }
- this.checkExpressionErrors(refDestructuringErrors, true);
- this.yieldPos = oldYieldPos || this.yieldPos;
- this.awaitPos = oldAwaitPos || this.awaitPos;
- if (exprList.length > 1) {
- val = this.startNodeAt(innerStartPos, innerStartLoc);
- val.expressions = exprList;
- this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
- } else {
- val = exprList[0];
- }
- } else {
- val = this.parseParenExpression();
- }
- if (this.options.preserveParens) {
- var par = this.startNodeAt(startPos, startLoc);
- par.expression = val;
- return this.finishNode(par, "ParenthesizedExpression")
- } else {
- return val
- }
- };
- pp$3.parseParenItem = function(item) {
- return item
- };
- pp$3.parseParenArrowList = function(startPos, startLoc, exprList) {
- return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList)
- };
- var empty$1 = [];
- pp$3.parseNew = function() {
- var node = this.startNode();
- var meta = this.parseIdent(true);
- if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) {
- node.meta = meta;
- var containsEsc = this.containsEsc;
- node.property = this.parseIdent(true);
- if (node.property.name !== "target" || containsEsc)
- { this.raiseRecoverable(node.property.start, "The only valid meta property for new is new.target"); }
- if (!this.inFunction)
- { this.raiseRecoverable(node.start, "new.target can only be used in functions"); }
- return this.finishNode(node, "MetaProperty")
- }
- var startPos = this.start, startLoc = this.startLoc;
- node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
- if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false); }
- else { node.arguments = empty$1; }
- return this.finishNode(node, "NewExpression")
- };
- pp$3.parseTemplateElement = function(ref) {
- var isTagged = ref.isTagged;
- var elem = this.startNode();
- if (this.type === types.invalidTemplate) {
- if (!isTagged) {
- this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
- }
- elem.value = {
- raw: this.value,
- cooked: null
- };
- } else {
- elem.value = {
- raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"),
- cooked: this.value
- };
- }
- this.next();
- elem.tail = this.type === types.backQuote;
- return this.finishNode(elem, "TemplateElement")
- };
- pp$3.parseTemplate = function(ref) {
- var this$1 = this;
- if ( ref === void 0 ) ref = {};
- var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;
- var node = this.startNode();
- this.next();
- node.expressions = [];
- var curElt = this.parseTemplateElement({isTagged: isTagged});
- node.quasis = [curElt];
- while (!curElt.tail) {
- if (this$1.type === types.eof) { this$1.raise(this$1.pos, "Unterminated template literal"); }
- this$1.expect(types.dollarBraceL);
- node.expressions.push(this$1.parseExpression());
- this$1.expect(types.braceR);
- node.quasis.push(curElt = this$1.parseTemplateElement({isTagged: isTagged}));
- }
- this.next();
- return this.finishNode(node, "TemplateLiteral")
- };
- pp$3.isAsyncProp = function(prop) {
- return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
- (this.type === types.name || this.type === types.num || this.type === types.string || this.type === types.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types.star)) &&
- !lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
- };
- pp$3.parseObj = function(isPattern, refDestructuringErrors) {
- var this$1 = this;
- var node = this.startNode(), first = true, propHash = {};
- node.properties = [];
- this.next();
- while (!this.eat(types.braceR)) {
- if (!first) {
- this$1.expect(types.comma);
- if (this$1.afterTrailingComma(types.braceR)) { break }
- } else { first = false; }
- var prop = this$1.parseProperty(isPattern, refDestructuringErrors);
- if (!isPattern) { this$1.checkPropClash(prop, propHash, refDestructuringErrors); }
- node.properties.push(prop);
- }
- return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
- };
- pp$3.parseProperty = function(isPattern, refDestructuringErrors) {
- var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
- if (this.options.ecmaVersion >= 9 && this.eat(types.ellipsis)) {
- if (isPattern) {
- prop.argument = this.parseIdent(false);
- if (this.type === types.comma) {
- this.raise(this.start, "Comma is not permitted after the rest element");
- }
- return this.finishNode(prop, "RestElement")
- }
-
- if (this.type === types.parenL && refDestructuringErrors) {
- if (refDestructuringErrors.parenthesizedAssign < 0) {
- refDestructuringErrors.parenthesizedAssign = this.start;
- }
- if (refDestructuringErrors.parenthesizedBind < 0) {
- refDestructuringErrors.parenthesizedBind = this.start;
- }
- }
-
- prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
-
- if (this.type === types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
- refDestructuringErrors.trailingComma = this.start;
- }
-
- return this.finishNode(prop, "SpreadElement")
- }
- if (this.options.ecmaVersion >= 6) {
- prop.method = false;
- prop.shorthand = false;
- if (isPattern || refDestructuringErrors) {
- startPos = this.start;
- startLoc = this.startLoc;
- }
- if (!isPattern)
- { isGenerator = this.eat(types.star); }
- }
- var containsEsc = this.containsEsc;
- this.parsePropertyName(prop);
- if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
- isAsync = true;
- isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
- this.parsePropertyName(prop, refDestructuringErrors);
- } else {
- isAsync = false;
- }
- this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc);
- return this.finishNode(prop, "Property")
- };
- pp$3.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
- if ((isGenerator || isAsync) && this.type === types.colon)
- { this.unexpected(); }
- if (this.eat(types.colon)) {
- prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
- prop.kind = "init";
- } else if (this.options.ecmaVersion >= 6 && this.type === types.parenL) {
- if (isPattern) { this.unexpected(); }
- prop.kind = "init";
- prop.method = true;
- prop.value = this.parseMethod(isGenerator, isAsync);
- } else if (!isPattern && !containsEsc &&
- this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
- (prop.key.name === "get" || prop.key.name === "set") &&
- (this.type !== types.comma && this.type !== types.braceR)) {
- if (isGenerator || isAsync) { this.unexpected(); }
- prop.kind = prop.key.name;
- this.parsePropertyName(prop);
- prop.value = this.parseMethod(false);
- var paramCount = prop.kind === "get" ? 0 : 1;
- if (prop.value.params.length !== paramCount) {
- var start = prop.value.start;
- if (prop.kind === "get")
- { this.raiseRecoverable(start, "getter should have no params"); }
- else
- { this.raiseRecoverable(start, "setter should have exactly one param"); }
- } else {
- if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
- { this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
- }
- } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
- this.checkUnreserved(prop.key);
- prop.kind = "init";
- if (isPattern) {
- prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);
- } else if (this.type === types.eq && refDestructuringErrors) {
- if (refDestructuringErrors.shorthandAssign < 0)
- { refDestructuringErrors.shorthandAssign = this.start; }
- prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);
- } else {
- prop.value = prop.key;
- }
- prop.shorthand = true;
- } else { this.unexpected(); }
- };
- pp$3.parsePropertyName = function(prop) {
- if (this.options.ecmaVersion >= 6) {
- if (this.eat(types.bracketL)) {
- prop.computed = true;
- prop.key = this.parseMaybeAssign();
- this.expect(types.bracketR);
- return prop.key
- } else {
- prop.computed = false;
- }
- }
- return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(true)
- };
- pp$3.initFunction = function(node) {
- node.id = null;
- if (this.options.ecmaVersion >= 6) {
- node.generator = false;
- node.expression = false;
- }
- if (this.options.ecmaVersion >= 8)
- { node.async = false; }
- };
- pp$3.parseMethod = function(isGenerator, isAsync) {
- var node = this.startNode(), oldInGen = this.inGenerator, oldInAsync = this.inAsync,
- oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldInFunc = this.inFunction;
- this.initFunction(node);
- if (this.options.ecmaVersion >= 6)
- { node.generator = isGenerator; }
- if (this.options.ecmaVersion >= 8)
- { node.async = !!isAsync; }
- this.inGenerator = node.generator;
- this.inAsync = node.async;
- this.yieldPos = 0;
- this.awaitPos = 0;
- this.inFunction = true;
- this.enterFunctionScope();
- this.expect(types.parenL);
- node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
- this.checkYieldAwaitInDefaultParams();
- this.parseFunctionBody(node, false);
- this.inGenerator = oldInGen;
- this.inAsync = oldInAsync;
- this.yieldPos = oldYieldPos;
- this.awaitPos = oldAwaitPos;
- this.inFunction = oldInFunc;
- return this.finishNode(node, "FunctionExpression")
- };
- pp$3.parseArrowExpression = function(node, params, isAsync) {
- var oldInGen = this.inGenerator, oldInAsync = this.inAsync,
- oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldInFunc = this.inFunction;
- this.enterFunctionScope();
- this.initFunction(node);
- if (this.options.ecmaVersion >= 8)
- { node.async = !!isAsync; }
- this.inGenerator = false;
- this.inAsync = node.async;
- this.yieldPos = 0;
- this.awaitPos = 0;
- this.inFunction = true;
- node.params = this.toAssignableList(params, true);
- this.parseFunctionBody(node, true);
- this.inGenerator = oldInGen;
- this.inAsync = oldInAsync;
- this.yieldPos = oldYieldPos;
- this.awaitPos = oldAwaitPos;
- this.inFunction = oldInFunc;
- return this.finishNode(node, "ArrowFunctionExpression")
- };
- pp$3.parseFunctionBody = function(node, isArrowFunction) {
- var isExpression = isArrowFunction && this.type !== types.braceL;
- var oldStrict = this.strict, useStrict = false;
- if (isExpression) {
- node.body = this.parseMaybeAssign();
- node.expression = true;
- this.checkParams(node, false);
- } else {
- var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);
- if (!oldStrict || nonSimple) {
- useStrict = this.strictDirective(this.end);
-
-
-
- if (useStrict && nonSimple)
- { this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list"); }
- }
-
-
- var oldLabels = this.labels;
- this.labels = [];
- if (useStrict) { this.strict = true; }
-
-
- this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && this.isSimpleParamList(node.params));
- node.body = this.parseBlock(false);
- node.expression = false;
- this.adaptDirectivePrologue(node.body.body);
- this.labels = oldLabels;
- }
- this.exitFunctionScope();
- if (this.strict && node.id) {
-
- this.checkLVal(node.id, "none");
- }
- this.strict = oldStrict;
- };
- pp$3.isSimpleParamList = function(params) {
- for (var i = 0, list = params; i < list.length; i += 1)
- {
- var param = list[i];
- if (param.type !== "Identifier") { return false
- } }
- return true
- };
- pp$3.checkParams = function(node, allowDuplicates) {
- var this$1 = this;
- var nameHash = {};
- for (var i = 0, list = node.params; i < list.length; i += 1)
- {
- var param = list[i];
- this$1.checkLVal(param, "var", allowDuplicates ? null : nameHash);
- }
- };
- pp$3.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
- var this$1 = this;
- var elts = [], first = true;
- while (!this.eat(close)) {
- if (!first) {
- this$1.expect(types.comma);
- if (allowTrailingComma && this$1.afterTrailingComma(close)) { break }
- } else { first = false; }
- var elt = (void 0);
- if (allowEmpty && this$1.type === types.comma)
- { elt = null; }
- else if (this$1.type === types.ellipsis) {
- elt = this$1.parseSpread(refDestructuringErrors);
- if (refDestructuringErrors && this$1.type === types.comma && refDestructuringErrors.trailingComma < 0)
- { refDestructuringErrors.trailingComma = this$1.start; }
- } else {
- elt = this$1.parseMaybeAssign(false, refDestructuringErrors);
- }
- elts.push(elt);
- }
- return elts
- };
- pp$3.checkUnreserved = function(ref) {
- var start = ref.start;
- var end = ref.end;
- var name = ref.name;
- if (this.inGenerator && name === "yield")
- { this.raiseRecoverable(start, "Can not use 'yield' as identifier inside a generator"); }
- if (this.inAsync && name === "await")
- { this.raiseRecoverable(start, "Can not use 'await' as identifier inside an async function"); }
- if (this.isKeyword(name))
- { this.raise(start, ("Unexpected keyword '" + name + "'")); }
- if (this.options.ecmaVersion < 6 &&
- this.input.slice(start, end).indexOf("\\") !== -1) { return }
- var re = this.strict ? this.reservedWordsStrict : this.reservedWords;
- if (re.test(name)) {
- if (!this.inAsync && name === "await")
- { this.raiseRecoverable(start, "Can not use keyword 'await' outside an async function"); }
- this.raiseRecoverable(start, ("The keyword '" + name + "' is reserved"));
- }
- };
- pp$3.parseIdent = function(liberal, isBinding) {
- var node = this.startNode();
- if (liberal && this.options.allowReserved === "never") { liberal = false; }
- if (this.type === types.name) {
- node.name = this.value;
- } else if (this.type.keyword) {
- node.name = this.type.keyword;
-
-
-
-
- if ((node.name === "class" || node.name === "function") &&
- (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
- this.context.pop();
- }
- } else {
- this.unexpected();
- }
- this.next();
- this.finishNode(node, "Identifier");
- if (!liberal) { this.checkUnreserved(node); }
- return node
- };
- pp$3.parseYield = function() {
- if (!this.yieldPos) { this.yieldPos = this.start; }
- var node = this.startNode();
- this.next();
- if (this.type === types.semi || this.canInsertSemicolon() || (this.type !== types.star && !this.type.startsExpr)) {
- node.delegate = false;
- node.argument = null;
- } else {
- node.delegate = this.eat(types.star);
- node.argument = this.parseMaybeAssign();
- }
- return this.finishNode(node, "YieldExpression")
- };
- pp$3.parseAwait = function() {
- if (!this.awaitPos) { this.awaitPos = this.start; }
- var node = this.startNode();
- this.next();
- node.argument = this.parseMaybeUnary(null, true);
- return this.finishNode(node, "AwaitExpression")
- };
- var pp$4 = Parser.prototype;
- pp$4.raise = function(pos, message) {
- var loc = getLineInfo(this.input, pos);
- message += " (" + loc.line + ":" + loc.column + ")";
- var err = new SyntaxError(message);
- err.pos = pos; err.loc = loc; err.raisedAt = this.pos;
- throw err
- };
- pp$4.raiseRecoverable = pp$4.raise;
- pp$4.curPosition = function() {
- if (this.options.locations) {
- return new Position(this.curLine, this.pos - this.lineStart)
- }
- };
- var pp$5 = Parser.prototype;
- var assign = Object.assign || function(target) {
- var sources = [], len = arguments.length - 1;
- while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
- for (var i = 0, list = sources; i < list.length; i += 1) {
- var source = list[i];
- for (var key in source) {
- if (has(source, key)) {
- target[key] = source[key];
- }
- }
- }
- return target
- };
- pp$5.enterFunctionScope = function() {
-
-
-
-
- this.scopeStack.push({var: {}, lexical: {}, childVar: {}, parentLexical: {}});
- };
- pp$5.exitFunctionScope = function() {
- this.scopeStack.pop();
- };
- pp$5.enterLexicalScope = function() {
- var parentScope = this.scopeStack[this.scopeStack.length - 1];
- var childScope = {var: {}, lexical: {}, childVar: {}, parentLexical: {}};
- this.scopeStack.push(childScope);
- assign(childScope.parentLexical, parentScope.lexical, parentScope.parentLexical);
- };
- pp$5.exitLexicalScope = function() {
- var childScope = this.scopeStack.pop();
- var parentScope = this.scopeStack[this.scopeStack.length - 1];
- assign(parentScope.childVar, childScope.var, childScope.childVar);
- };
- pp$5.canDeclareVarName = function(name) {
- var currentScope = this.scopeStack[this.scopeStack.length - 1];
- return !has(currentScope.lexical, name) && !has(currentScope.parentLexical, name)
- };
- pp$5.canDeclareLexicalName = function(name) {
- var currentScope = this.scopeStack[this.scopeStack.length - 1];
- return !has(currentScope.lexical, name) && !has(currentScope.var, name) && !has(currentScope.childVar, name)
- };
- pp$5.declareVarName = function(name) {
- this.scopeStack[this.scopeStack.length - 1].var[name] = true;
- };
- pp$5.declareLexicalName = function(name) {
- this.scopeStack[this.scopeStack.length - 1].lexical[name] = true;
- };
- var Node = function Node(parser, pos, loc) {
- this.type = "";
- this.start = pos;
- this.end = 0;
- if (parser.options.locations)
- { this.loc = new SourceLocation(parser, loc); }
- if (parser.options.directSourceFile)
- { this.sourceFile = parser.options.directSourceFile; }
- if (parser.options.ranges)
- { this.range = [pos, 0]; }
- };
- var pp$6 = Parser.prototype;
- pp$6.startNode = function() {
- return new Node(this, this.start, this.startLoc)
- };
- pp$6.startNodeAt = function(pos, loc) {
- return new Node(this, pos, loc)
- };
- function finishNodeAt(node, type, pos, loc) {
- node.type = type;
- node.end = pos;
- if (this.options.locations)
- { node.loc.end = loc; }
- if (this.options.ranges)
- { node.range[1] = pos; }
- return node
- }
- pp$6.finishNode = function(node, type) {
- return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
- };
- pp$6.finishNodeAt = function(node, type, pos, loc) {
- return finishNodeAt.call(this, node, type, pos, loc)
- };
- var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
- this.token = token;
- this.isExpr = !!isExpr;
- this.preserveSpace = !!preserveSpace;
- this.override = override;
- this.generator = !!generator;
- };
- var types$1 = {
- b_stat: new TokContext("{", false),
- b_expr: new TokContext("{", true),
- b_tmpl: new TokContext("${", false),
- p_stat: new TokContext("(", false),
- p_expr: new TokContext("(", true),
- q_tmpl: new TokContext("`", true, true, function (p) { return p.tryReadTemplateToken(); }),
- f_stat: new TokContext("function", false),
- f_expr: new TokContext("function", true),
- f_expr_gen: new TokContext("function", true, false, null, true),
- f_gen: new TokContext("function", false, false, null, true)
- };
- var pp$7 = Parser.prototype;
- pp$7.initialContext = function() {
- return [types$1.b_stat]
- };
- pp$7.braceIsBlock = function(prevType) {
- var parent = this.curContext();
- if (parent === types$1.f_expr || parent === types$1.f_stat)
- { return true }
- if (prevType === types.colon && (parent === types$1.b_stat || parent === types$1.b_expr))
- { return !parent.isExpr }
-
-
-
- if (prevType === types._return || prevType === types.name && this.exprAllowed)
- { return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
- if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow)
- { return true }
- if (prevType === types.braceL)
- { return parent === types$1.b_stat }
- if (prevType === types._var || prevType === types.name)
- { return false }
- return !this.exprAllowed
- };
- pp$7.inGeneratorContext = function() {
- var this$1 = this;
- for (var i = this.context.length - 1; i >= 1; i--) {
- var context = this$1.context[i];
- if (context.token === "function")
- { return context.generator }
- }
- return false
- };
- pp$7.updateContext = function(prevType) {
- var update, type = this.type;
- if (type.keyword && prevType === types.dot)
- { this.exprAllowed = false; }
- else if (update = type.updateContext)
- { update.call(this, prevType); }
- else
- { this.exprAllowed = type.beforeExpr; }
- };
- types.parenR.updateContext = types.braceR.updateContext = function() {
- if (this.context.length === 1) {
- this.exprAllowed = true;
- return
- }
- var out = this.context.pop();
- if (out === types$1.b_stat && this.curContext().token === "function") {
- out = this.context.pop();
- }
- this.exprAllowed = !out.isExpr;
- };
- types.braceL.updateContext = function(prevType) {
- this.context.push(this.braceIsBlock(prevType) ? types$1.b_stat : types$1.b_expr);
- this.exprAllowed = true;
- };
- types.dollarBraceL.updateContext = function() {
- this.context.push(types$1.b_tmpl);
- this.exprAllowed = true;
- };
- types.parenL.updateContext = function(prevType) {
- var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;
- this.context.push(statementParens ? types$1.p_stat : types$1.p_expr);
- this.exprAllowed = true;
- };
- types.incDec.updateContext = function() {
-
- };
- types._function.updateContext = types._class.updateContext = function(prevType) {
- if (prevType.beforeExpr && prevType !== types.semi && prevType !== types._else &&
- !((prevType === types.colon || prevType === types.braceL) && this.curContext() === types$1.b_stat))
- { this.context.push(types$1.f_expr); }
- else
- { this.context.push(types$1.f_stat); }
- this.exprAllowed = false;
- };
- types.backQuote.updateContext = function() {
- if (this.curContext() === types$1.q_tmpl)
- { this.context.pop(); }
- else
- { this.context.push(types$1.q_tmpl); }
- this.exprAllowed = false;
- };
- types.star.updateContext = function(prevType) {
- if (prevType === types._function) {
- var index = this.context.length - 1;
- if (this.context[index] === types$1.f_expr)
- { this.context[index] = types$1.f_expr_gen; }
- else
- { this.context[index] = types$1.f_gen; }
- }
- this.exprAllowed = true;
- };
- types.name.updateContext = function(prevType) {
- var allowed = false;
- if (this.options.ecmaVersion >= 6 && prevType !== types.dot) {
- if (this.value === "of" && !this.exprAllowed ||
- this.value === "yield" && this.inGeneratorContext())
- { allowed = true; }
- }
- this.exprAllowed = allowed;
- };
- var data = {
- "$LONE": [
- "ASCII",
- "ASCII_Hex_Digit",
- "AHex",
- "Alphabetic",
- "Alpha",
- "Any",
- "Assigned",
- "Bidi_Control",
- "Bidi_C",
- "Bidi_Mirrored",
- "Bidi_M",
- "Case_Ignorable",
- "CI",
- "Cased",
- "Changes_When_Casefolded",
- "CWCF",
- "Changes_When_Casemapped",
- "CWCM",
- "Changes_When_Lowercased",
- "CWL",
- "Changes_When_NFKC_Casefolded",
- "CWKCF",
- "Changes_When_Titlecased",
- "CWT",
- "Changes_When_Uppercased",
- "CWU",
- "Dash",
- "Default_Ignorable_Code_Point",
- "DI",
- "Deprecated",
- "Dep",
- "Diacritic",
- "Dia",
- "Emoji",
- "Emoji_Component",
- "Emoji_Modifier",
- "Emoji_Modifier_Base",
- "Emoji_Presentation",
- "Extender",
- "Ext",
- "Grapheme_Base",
- "Gr_Base",
- "Grapheme_Extend",
- "Gr_Ext",
- "Hex_Digit",
- "Hex",
- "IDS_Binary_Operator",
- "IDSB",
- "IDS_Trinary_Operator",
- "IDST",
- "ID_Continue",
- "IDC",
- "ID_Start",
- "IDS",
- "Ideographic",
- "Ideo",
- "Join_Control",
- "Join_C",
- "Logical_Order_Exception",
- "LOE",
- "Lowercase",
- "Lower",
- "Math",
- "Noncharacter_Code_Point",
- "NChar",
- "Pattern_Syntax",
- "Pat_Syn",
- "Pattern_White_Space",
- "Pat_WS",
- "Quotation_Mark",
- "QMark",
- "Radical",
- "Regional_Indicator",
- "RI",
- "Sentence_Terminal",
- "STerm",
- "Soft_Dotted",
- "SD",
- "Terminal_Punctuation",
- "Term",
- "Unified_Ideograph",
- "UIdeo",
- "Uppercase",
- "Upper",
- "Variation_Selector",
- "VS",
- "White_Space",
- "space",
- "XID_Continue",
- "XIDC",
- "XID_Start",
- "XIDS"
- ],
- "General_Category": [
- "Cased_Letter",
- "LC",
- "Close_Punctuation",
- "Pe",
- "Connector_Punctuation",
- "Pc",
- "Control",
- "Cc",
- "cntrl",
- "Currency_Symbol",
- "Sc",
- "Dash_Punctuation",
- "Pd",
- "Decimal_Number",
- "Nd",
- "digit",
- "Enclosing_Mark",
- "Me",
- "Final_Punctuation",
- "Pf",
- "Format",
- "Cf",
- "Initial_Punctuation",
- "Pi",
- "Letter",
- "L",
- "Letter_Number",
- "Nl",
- "Line_Separator",
- "Zl",
- "Lowercase_Letter",
- "Ll",
- "Mark",
- "M",
- "Combining_Mark",
- "Math_Symbol",
- "Sm",
- "Modifier_Letter",
- "Lm",
- "Modifier_Symbol",
- "Sk",
- "Nonspacing_Mark",
- "Mn",
- "Number",
- "N",
- "Open_Punctuation",
- "Ps",
- "Other",
- "C",
- "Other_Letter",
- "Lo",
- "Other_Number",
- "No",
- "Other_Punctuation",
- "Po",
- "Other_Symbol",
- "So",
- "Paragraph_Separator",
- "Zp",
- "Private_Use",
- "Co",
- "Punctuation",
- "P",
- "punct",
- "Separator",
- "Z",
- "Space_Separator",
- "Zs",
- "Spacing_Mark",
- "Mc",
- "Surrogate",
- "Cs",
- "Symbol",
- "S",
- "Titlecase_Letter",
- "Lt",
- "Unassigned",
- "Cn",
- "Uppercase_Letter",
- "Lu"
- ],
- "Script": [
- "Adlam",
- "Adlm",
- "Ahom",
- "Anatolian_Hieroglyphs",
- "Hluw",
- "Arabic",
- "Arab",
- "Armenian",
- "Armn",
- "Avestan",
- "Avst",
- "Balinese",
- "Bali",
- "Bamum",
- "Bamu",
- "Bassa_Vah",
- "Bass",
- "Batak",
- "Batk",
- "Bengali",
- "Beng",
- "Bhaiksuki",
- "Bhks",
- "Bopomofo",
- "Bopo",
- "Brahmi",
- "Brah",
- "Braille",
- "Brai",
- "Buginese",
- "Bugi",
- "Buhid",
- "Buhd",
- "Canadian_Aboriginal",
- "Cans",
- "Carian",
- "Cari",
- "Caucasian_Albanian",
- "Aghb",
- "Chakma",
- "Cakm",
- "Cham",
- "Cherokee",
- "Cher",
- "Common",
- "Zyyy",
- "Coptic",
- "Copt",
- "Qaac",
- "Cuneiform",
- "Xsux",
- "Cypriot",
- "Cprt",
- "Cyrillic",
- "Cyrl",
- "Deseret",
- "Dsrt",
- "Devanagari",
- "Deva",
- "Duployan",
- "Dupl",
- "Egyptian_Hieroglyphs",
- "Egyp",
- "Elbasan",
- "Elba",
- "Ethiopic",
- "Ethi",
- "Georgian",
- "Geor",
- "Glagolitic",
- "Glag",
- "Gothic",
- "Goth",
- "Grantha",
- "Gran",
- "Greek",
- "Grek",
- "Gujarati",
- "Gujr",
- "Gurmukhi",
- "Guru",
- "Han",
- "Hani",
- "Hangul",
- "Hang",
- "Hanunoo",
- "Hano",
- "Hatran",
- "Hatr",
- "Hebrew",
- "Hebr",
- "Hiragana",
- "Hira",
- "Imperial_Aramaic",
- "Armi",
- "Inherited",
- "Zinh",
- "Qaai",
- "Inscriptional_Pahlavi",
- "Phli",
- "Inscriptional_Parthian",
- "Prti",
- "Javanese",
- "Java",
- "Kaithi",
- "Kthi",
- "Kannada",
- "Knda",
- "Katakana",
- "Kana",
- "Kayah_Li",
- "Kali",
- "Kharoshthi",
- "Khar",
- "Khmer",
- "Khmr",
- "Khojki",
- "Khoj",
- "Khudawadi",
- "Sind",
- "Lao",
- "Laoo",
- "Latin",
- "Latn",
- "Lepcha",
- "Lepc",
- "Limbu",
- "Limb",
- "Linear_A",
- "Lina",
- "Linear_B",
- "Linb",
- "Lisu",
- "Lycian",
- "Lyci",
- "Lydian",
- "Lydi",
- "Mahajani",
- "Mahj",
- "Malayalam",
- "Mlym",
- "Mandaic",
- "Mand",
- "Manichaean",
- "Mani",
- "Marchen",
- "Marc",
- "Masaram_Gondi",
- "Gonm",
- "Meetei_Mayek",
- "Mtei",
- "Mende_Kikakui",
- "Mend",
- "Meroitic_Cursive",
- "Merc",
- "Meroitic_Hieroglyphs",
- "Mero",
- "Miao",
- "Plrd",
- "Modi",
- "Mongolian",
- "Mong",
- "Mro",
- "Mroo",
- "Multani",
- "Mult",
- "Myanmar",
- "Mymr",
- "Nabataean",
- "Nbat",
- "New_Tai_Lue",
- "Talu",
- "Newa",
- "Nko",
- "Nkoo",
- "Nushu",
- "Nshu",
- "Ogham",
- "Ogam",
- "Ol_Chiki",
- "Olck",
- "Old_Hungarian",
- "Hung",
- "Old_Italic",
- "Ital",
- "Old_North_Arabian",
- "Narb",
- "Old_Permic",
- "Perm",
- "Old_Persian",
- "Xpeo",
- "Old_South_Arabian",
- "Sarb",
- "Old_Turkic",
- "Orkh",
- "Oriya",
- "Orya",
- "Osage",
- "Osge",
- "Osmanya",
- "Osma",
- "Pahawh_Hmong",
- "Hmng",
- "Palmyrene",
- "Palm",
- "Pau_Cin_Hau",
- "Pauc",
- "Phags_Pa",
- "Phag",
- "Phoenician",
- "Phnx",
- "Psalter_Pahlavi",
- "Phlp",
- "Rejang",
- "Rjng",
- "Runic",
- "Runr",
- "Samaritan",
- "Samr",
- "Saurashtra",
- "Saur",
- "Sharada",
- "Shrd",
- "Shavian",
- "Shaw",
- "Siddham",
- "Sidd",
- "SignWriting",
- "Sgnw",
- "Sinhala",
- "Sinh",
- "Sora_Sompeng",
- "Sora",
- "Soyombo",
- "Soyo",
- "Sundanese",
- "Sund",
- "Syloti_Nagri",
- "Sylo",
- "Syriac",
- "Syrc",
- "Tagalog",
- "Tglg",
- "Tagbanwa",
- "Tagb",
- "Tai_Le",
- "Tale",
- "Tai_Tham",
- "Lana",
- "Tai_Viet",
- "Tavt",
- "Takri",
- "Takr",
- "Tamil",
- "Taml",
- "Tangut",
- "Tang",
- "Telugu",
- "Telu",
- "Thaana",
- "Thaa",
- "Thai",
- "Tibetan",
- "Tibt",
- "Tifinagh",
- "Tfng",
- "Tirhuta",
- "Tirh",
- "Ugaritic",
- "Ugar",
- "Vai",
- "Vaii",
- "Warang_Citi",
- "Wara",
- "Yi",
- "Yiii",
- "Zanabazar_Square",
- "Zanb"
- ]
- };
- Array.prototype.push.apply(data.$LONE, data.General_Category);
- data.gc = data.General_Category;
- data.sc = data.Script_Extensions = data.scx = data.Script;
- var pp$9 = Parser.prototype;
- var RegExpValidationState = function RegExpValidationState(parser) {
- this.parser = parser;
- this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "");
- this.source = "";
- this.flags = "";
- this.start = 0;
- this.switchU = false;
- this.switchN = false;
- this.pos = 0;
- this.lastIntValue = 0;
- this.lastStringValue = "";
- this.lastAssertionIsQuantifiable = false;
- this.numCapturingParens = 0;
- this.maxBackReference = 0;
- this.groupNames = [];
- this.backReferenceNames = [];
- };
- RegExpValidationState.prototype.reset = function reset (start, pattern, flags) {
- var unicode = flags.indexOf("u") !== -1;
- this.start = start | 0;
- this.source = pattern + "";
- this.flags = flags;
- this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
- this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
- };
- RegExpValidationState.prototype.raise = function raise (message) {
- this.parser.raiseRecoverable(this.start, ("Invalid regular expression: /" + (this.source) + "/: " + message));
- };
- RegExpValidationState.prototype.at = function at (i) {
- var s = this.source;
- var l = s.length;
- if (i >= l) {
- return -1
- }
- var c = s.charCodeAt(i);
- if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
- return c
- }
- return (c << 10) + s.charCodeAt(i + 1) - 0x35FDC00
- };
- RegExpValidationState.prototype.nextIndex = function nextIndex (i) {
- var s = this.source;
- var l = s.length;
- if (i >= l) {
- return l
- }
- var c = s.charCodeAt(i);
- if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
- return i + 1
- }
- return i + 2
- };
- RegExpValidationState.prototype.current = function current () {
- return this.at(this.pos)
- };
- RegExpValidationState.prototype.lookahead = function lookahead () {
- return this.at(this.nextIndex(this.pos))
- };
- RegExpValidationState.prototype.advance = function advance () {
- this.pos = this.nextIndex(this.pos);
- };
- RegExpValidationState.prototype.eat = function eat (ch) {
- if (this.current() === ch) {
- this.advance();
- return true
- }
- return false
- };
- function codePointToString$1(ch) {
- if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
- ch -= 0x10000;
- return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
- }
- pp$9.validateRegExpFlags = function(state) {
- var this$1 = this;
- var validFlags = state.validFlags;
- var flags = state.flags;
- for (var i = 0; i < flags.length; i++) {
- var flag = flags.charAt(i);
- if (validFlags.indexOf(flag) === -1) {
- this$1.raise(state.start, "Invalid regular expression flag");
- }
- if (flags.indexOf(flag, i + 1) > -1) {
- this$1.raise(state.start, "Duplicate regular expression flag");
- }
- }
- };
- pp$9.validateRegExpPattern = function(state) {
- this.regexp_pattern(state);
-
-
-
-
-
- if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames.length > 0) {
- state.switchN = true;
- this.regexp_pattern(state);
- }
- };
- pp$9.regexp_pattern = function(state) {
- state.pos = 0;
- state.lastIntValue = 0;
- state.lastStringValue = "";
- state.lastAssertionIsQuantifiable = false;
- state.numCapturingParens = 0;
- state.maxBackReference = 0;
- state.groupNames.length = 0;
- state.backReferenceNames.length = 0;
- this.regexp_disjunction(state);
- if (state.pos !== state.source.length) {
-
- if (state.eat(0x29 )) {
- state.raise("Unmatched ')'");
- }
- if (state.eat(0x5D ) || state.eat(0x7D )) {
- state.raise("Lone quantifier brackets");
- }
- }
- if (state.maxBackReference > state.numCapturingParens) {
- state.raise("Invalid escape");
- }
- for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {
- var name = list[i];
- if (state.groupNames.indexOf(name) === -1) {
- state.raise("Invalid named capture referenced");
- }
- }
- };
- pp$9.regexp_disjunction = function(state) {
- var this$1 = this;
- this.regexp_alternative(state);
- while (state.eat(0x7C )) {
- this$1.regexp_alternative(state);
- }
-
- if (this.regexp_eatQuantifier(state, true)) {
- state.raise("Nothing to repeat");
- }
- if (state.eat(0x7B )) {
- state.raise("Lone quantifier brackets");
- }
- };
- pp$9.regexp_alternative = function(state) {
- while (state.pos < state.source.length && this.regexp_eatTerm(state))
- { }
- };
- pp$9.regexp_eatTerm = function(state) {
- if (this.regexp_eatAssertion(state)) {
-
-
-
- if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) {
-
- if (state.switchU) {
- state.raise("Invalid quantifier");
- }
- }
- return true
- }
- if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) {
- this.regexp_eatQuantifier(state);
- return true
- }
- return false
- };
- pp$9.regexp_eatAssertion = function(state) {
- var start = state.pos;
- state.lastAssertionIsQuantifiable = false;
-
- if (state.eat(0x5E ) || state.eat(0x24 )) {
- return true
- }
-
- if (state.eat(0x5C )) {
- if (state.eat(0x42 ) || state.eat(0x62 )) {
- return true
- }
- state.pos = start;
- }
-
- if (state.eat(0x28 ) && state.eat(0x3F )) {
- var lookbehind = false;
- if (this.options.ecmaVersion >= 9) {
- lookbehind = state.eat(0x3C );
- }
- if (state.eat(0x3D ) || state.eat(0x21 )) {
- this.regexp_disjunction(state);
- if (!state.eat(0x29 )) {
- state.raise("Unterminated group");
- }
- state.lastAssertionIsQuantifiable = !lookbehind;
- return true
- }
- }
- state.pos = start;
- return false
- };
- pp$9.regexp_eatQuantifier = function(state, noError) {
- if ( noError === void 0 ) noError = false;
- if (this.regexp_eatQuantifierPrefix(state, noError)) {
- state.eat(0x3F );
- return true
- }
- return false
- };
- pp$9.regexp_eatQuantifierPrefix = function(state, noError) {
- return (
- state.eat(0x2A ) ||
- state.eat(0x2B ) ||
- state.eat(0x3F ) ||
- this.regexp_eatBracedQuantifier(state, noError)
- )
- };
- pp$9.regexp_eatBracedQuantifier = function(state, noError) {
- var start = state.pos;
- if (state.eat(0x7B )) {
- var min = 0, max = -1;
- if (this.regexp_eatDecimalDigits(state)) {
- min = state.lastIntValue;
- if (state.eat(0x2C ) && this.regexp_eatDecimalDigits(state)) {
- max = state.lastIntValue;
- }
- if (state.eat(0x7D )) {
-
- if (max !== -1 && max < min && !noError) {
- state.raise("numbers out of order in {} quantifier");
- }
- return true
- }
- }
- if (state.switchU && !noError) {
- state.raise("Incomplete quantifier");
- }
- state.pos = start;
- }
- return false
- };
- pp$9.regexp_eatAtom = function(state) {
- return (
- this.regexp_eatPatternCharacters(state) ||
- state.eat(0x2E ) ||
- this.regexp_eatReverseSolidusAtomEscape(state) ||
- this.regexp_eatCharacterClass(state) ||
- this.regexp_eatUncapturingGroup(state) ||
- this.regexp_eatCapturingGroup(state)
- )
- };
- pp$9.regexp_eatReverseSolidusAtomEscape = function(state) {
- var start = state.pos;
- if (state.eat(0x5C )) {
- if (this.regexp_eatAtomEscape(state)) {
- return true
- }
- state.pos = start;
- }
- return false
- };
- pp$9.regexp_eatUncapturingGroup = function(state) {
- var start = state.pos;
- if (state.eat(0x28 )) {
- if (state.eat(0x3F ) && state.eat(0x3A )) {
- this.regexp_disjunction(state);
- if (state.eat(0x29 )) {
- return true
- }
- state.raise("Unterminated group");
- }
- state.pos = start;
- }
- return false
- };
- pp$9.regexp_eatCapturingGroup = function(state) {
- if (state.eat(0x28 )) {
- if (this.options.ecmaVersion >= 9) {
- this.regexp_groupSpecifier(state);
- } else if (state.current() === 0x3F ) {
- state.raise("Invalid group");
- }
- this.regexp_disjunction(state);
- if (state.eat(0x29 )) {
- state.numCapturingParens += 1;
- return true
- }
- state.raise("Unterminated group");
- }
- return false
- };
- pp$9.regexp_eatExtendedAtom = function(state) {
- return (
- state.eat(0x2E ) ||
- this.regexp_eatReverseSolidusAtomEscape(state) ||
- this.regexp_eatCharacterClass(state) ||
- this.regexp_eatUncapturingGroup(state) ||
- this.regexp_eatCapturingGroup(state) ||
- this.regexp_eatInvalidBracedQuantifier(state) ||
- this.regexp_eatExtendedPatternCharacter(state)
- )
- };
- pp$9.regexp_eatInvalidBracedQuantifier = function(state) {
- if (this.regexp_eatBracedQuantifier(state, true)) {
- state.raise("Nothing to repeat");
- }
- return false
- };
- pp$9.regexp_eatSyntaxCharacter = function(state) {
- var ch = state.current();
- if (isSyntaxCharacter(ch)) {
- state.lastIntValue = ch;
- state.advance();
- return true
- }
- return false
- };
- function isSyntaxCharacter(ch) {
- return (
- ch === 0x24 ||
- ch >= 0x28 && ch <= 0x2B ||
- ch === 0x2E ||
- ch === 0x3F ||
- ch >= 0x5B && ch <= 0x5E ||
- ch >= 0x7B && ch <= 0x7D
- )
- }
- pp$9.regexp_eatPatternCharacters = function(state) {
- var start = state.pos;
- var ch = 0;
- while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
- state.advance();
- }
- return state.pos !== start
- };
- pp$9.regexp_eatExtendedPatternCharacter = function(state) {
- var ch = state.current();
- if (
- ch !== -1 &&
- ch !== 0x24 &&
- !(ch >= 0x28 && ch <= 0x2B ) &&
- ch !== 0x2E &&
- ch !== 0x3F &&
- ch !== 0x5B &&
- ch !== 0x5E &&
- ch !== 0x7C
- ) {
- state.advance();
- return true
- }
- return false
- };
- pp$9.regexp_groupSpecifier = function(state) {
- if (state.eat(0x3F )) {
- if (this.regexp_eatGroupName(state)) {
- if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
- state.raise("Duplicate capture group name");
- }
- state.groupNames.push(state.lastStringValue);
- return
- }
- state.raise("Invalid group");
- }
- };
- pp$9.regexp_eatGroupName = function(state) {
- state.lastStringValue = "";
- if (state.eat(0x3C )) {
- if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E )) {
- return true
- }
- state.raise("Invalid capture group name");
- }
- return false
- };
- pp$9.regexp_eatRegExpIdentifierName = function(state) {
- state.lastStringValue = "";
- if (this.regexp_eatRegExpIdentifierStart(state)) {
- state.lastStringValue += codePointToString$1(state.lastIntValue);
- while (this.regexp_eatRegExpIdentifierPart(state)) {
- state.lastStringValue += codePointToString$1(state.lastIntValue);
- }
- return true
- }
- return false
- };
- pp$9.regexp_eatRegExpIdentifierStart = function(state) {
- var start = state.pos;
- var ch = state.current();
- state.advance();
- if (ch === 0x5C && this.regexp_eatRegExpUnicodeEscapeSequence(state)) {
- ch = state.lastIntValue;
- }
- if (isRegExpIdentifierStart(ch)) {
- state.lastIntValue = ch;
- return true
- }
- state.pos = start;
- return false
- };
- function isRegExpIdentifierStart(ch) {
- return isIdentifierStart(ch, true) || ch === 0x24 || ch === 0x5F
- }
- pp$9.regexp_eatRegExpIdentifierPart = function(state) {
- var start = state.pos;
- var ch = state.current();
- state.advance();
- if (ch === 0x5C && this.regexp_eatRegExpUnicodeEscapeSequence(state)) {
- ch = state.lastIntValue;
- }
- if (isRegExpIdentifierPart(ch)) {
- state.lastIntValue = ch;
- return true
- }
- state.pos = start;
- return false
- };
- function isRegExpIdentifierPart(ch) {
- return isIdentifierChar(ch, true) || ch === 0x24 || ch === 0x5F || ch === 0x200C || ch === 0x200D
- }
- pp$9.regexp_eatAtomEscape = function(state) {
- if (
- this.regexp_eatBackReference(state) ||
- this.regexp_eatCharacterClassEscape(state) ||
- this.regexp_eatCharacterEscape(state) ||
- (state.switchN && this.regexp_eatKGroupName(state))
- ) {
- return true
- }
- if (state.switchU) {
-
- if (state.current() === 0x63 ) {
- state.raise("Invalid unicode escape");
- }
- state.raise("Invalid escape");
- }
- return false
- };
- pp$9.regexp_eatBackReference = function(state) {
- var start = state.pos;
- if (this.regexp_eatDecimalEscape(state)) {
- var n = state.lastIntValue;
- if (state.switchU) {
-
- if (n > state.maxBackReference) {
- state.maxBackReference = n;
- }
- return true
- }
- if (n <= state.numCapturingParens) {
- return true
- }
- state.pos = start;
- }
- return false
- };
- pp$9.regexp_eatKGroupName = function(state) {
- if (state.eat(0x6B )) {
- if (this.regexp_eatGroupName(state)) {
- state.backReferenceNames.push(state.lastStringValue);
- return true
- }
- state.raise("Invalid named reference");
- }
- return false
- };
- pp$9.regexp_eatCharacterEscape = function(state) {
- return (
- this.regexp_eatControlEscape(state) ||
- this.regexp_eatCControlLetter(state) ||
- this.regexp_eatZero(state) ||
- this.regexp_eatHexEscapeSequence(state) ||
- this.regexp_eatRegExpUnicodeEscapeSequence(state) ||
- (!state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state)) ||
- this.regexp_eatIdentityEscape(state)
- )
- };
- pp$9.regexp_eatCControlLetter = function(state) {
- var start = state.pos;
- if (state.eat(0x63 )) {
- if (this.regexp_eatControlLetter(state)) {
- return true
- }
- state.pos = start;
- }
- return false
- };
- pp$9.regexp_eatZero = function(state) {
- if (state.current() === 0x30 && !isDecimalDigit(state.lookahead())) {
- state.lastIntValue = 0;
- state.advance();
- return true
- }
- return false
- };
- pp$9.regexp_eatControlEscape = function(state) {
- var ch = state.current();
- if (ch === 0x74 ) {
- state.lastIntValue = 0x09;
- state.advance();
- return true
- }
- if (ch === 0x6E ) {
- state.lastIntValue = 0x0A;
- state.advance();
- return true
- }
- if (ch === 0x76 ) {
- state.lastIntValue = 0x0B;
- state.advance();
- return true
- }
- if (ch === 0x66 ) {
- state.lastIntValue = 0x0C;
- state.advance();
- return true
- }
- if (ch === 0x72 ) {
- state.lastIntValue = 0x0D;
- state.advance();
- return true
- }
- return false
- };
- pp$9.regexp_eatControlLetter = function(state) {
- var ch = state.current();
- if (isControlLetter(ch)) {
- state.lastIntValue = ch % 0x20;
- state.advance();
- return true
- }
- return false
- };
- function isControlLetter(ch) {
- return (
- (ch >= 0x41 && ch <= 0x5A ) ||
- (ch >= 0x61 && ch <= 0x7A )
- )
- }
- pp$9.regexp_eatRegExpUnicodeEscapeSequence = function(state) {
- var start = state.pos;
- if (state.eat(0x75 )) {
- if (this.regexp_eatFixedHexDigits(state, 4)) {
- var lead = state.lastIntValue;
- if (state.switchU && lead >= 0xD800 && lead <= 0xDBFF) {
- var leadSurrogateEnd = state.pos;
- if (state.eat(0x5C ) && state.eat(0x75 ) && this.regexp_eatFixedHexDigits(state, 4)) {
- var trail = state.lastIntValue;
- if (trail >= 0xDC00 && trail <= 0xDFFF) {
- state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
- return true
- }
- }
- state.pos = leadSurrogateEnd;
- state.lastIntValue = lead;
- }
- return true
- }
- if (
- state.switchU &&
- state.eat(0x7B ) &&
- this.regexp_eatHexDigits(state) &&
- state.eat(0x7D ) &&
- isValidUnicode(state.lastIntValue)
- ) {
- return true
- }
- if (state.switchU) {
- state.raise("Invalid unicode escape");
- }
- state.pos = start;
- }
- return false
- };
- function isValidUnicode(ch) {
- return ch >= 0 && ch <= 0x10FFFF
- }
- pp$9.regexp_eatIdentityEscape = function(state) {
- if (state.switchU) {
- if (this.regexp_eatSyntaxCharacter(state)) {
- return true
- }
- if (state.eat(0x2F )) {
- state.lastIntValue = 0x2F;
- return true
- }
- return false
- }
- var ch = state.current();
- if (ch !== 0x63 && (!state.switchN || ch !== 0x6B )) {
- state.lastIntValue = ch;
- state.advance();
- return true
- }
- return false
- };
- pp$9.regexp_eatDecimalEscape = function(state) {
- state.lastIntValue = 0;
- var ch = state.current();
- if (ch >= 0x31 && ch <= 0x39 ) {
- do {
- state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 );
- state.advance();
- } while ((ch = state.current()) >= 0x30 && ch <= 0x39 )
- return true
- }
- return false
- };
- pp$9.regexp_eatCharacterClassEscape = function(state) {
- var ch = state.current();
- if (isCharacterClassEscape(ch)) {
- state.lastIntValue = -1;
- state.advance();
- return true
- }
- if (
- state.switchU &&
- this.options.ecmaVersion >= 9 &&
- (ch === 0x50 || ch === 0x70 )
- ) {
- state.lastIntValue = -1;
- state.advance();
- if (
- state.eat(0x7B ) &&
- this.regexp_eatUnicodePropertyValueExpression(state) &&
- state.eat(0x7D )
- ) {
- return true
- }
- state.raise("Invalid property name");
- }
- return false
- };
- function isCharacterClassEscape(ch) {
- return (
- ch === 0x64 ||
- ch === 0x44 ||
- ch === 0x73 ||
- ch === 0x53 ||
- ch === 0x77 ||
- ch === 0x57
- )
- }
- pp$9.regexp_eatUnicodePropertyValueExpression = function(state) {
- var start = state.pos;
-
- if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D )) {
- var name = state.lastStringValue;
- if (this.regexp_eatUnicodePropertyValue(state)) {
- var value = state.lastStringValue;
- this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
- return true
- }
- }
- state.pos = start;
-
- if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
- var nameOrValue = state.lastStringValue;
- this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue);
- return true
- }
- return false
- };
- pp$9.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
- if (!data.hasOwnProperty(name) || data[name].indexOf(value) === -1) {
- state.raise("Invalid property name");
- }
- };
- pp$9.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
- if (data.$LONE.indexOf(nameOrValue) === -1) {
- state.raise("Invalid property name");
- }
- };
- pp$9.regexp_eatUnicodePropertyName = function(state) {
- var ch = 0;
- state.lastStringValue = "";
- while (isUnicodePropertyNameCharacter(ch = state.current())) {
- state.lastStringValue += codePointToString$1(ch);
- state.advance();
- }
- return state.lastStringValue !== ""
- };
- function isUnicodePropertyNameCharacter(ch) {
- return isControlLetter(ch) || ch === 0x5F
- }
- pp$9.regexp_eatUnicodePropertyValue = function(state) {
- var ch = 0;
- state.lastStringValue = "";
- while (isUnicodePropertyValueCharacter(ch = state.current())) {
- state.lastStringValue += codePointToString$1(ch);
- state.advance();
- }
- return state.lastStringValue !== ""
- };
- function isUnicodePropertyValueCharacter(ch) {
- return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch)
- }
- pp$9.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
- return this.regexp_eatUnicodePropertyValue(state)
- };
- pp$9.regexp_eatCharacterClass = function(state) {
- if (state.eat(0x5B )) {
- state.eat(0x5E );
- this.regexp_classRanges(state);
- if (state.eat(0x5D )) {
- return true
- }
-
- state.raise("Unterminated character class");
- }
- return false
- };
- pp$9.regexp_classRanges = function(state) {
- var this$1 = this;
- while (this.regexp_eatClassAtom(state)) {
- var left = state.lastIntValue;
- if (state.eat(0x2D ) && this$1.regexp_eatClassAtom(state)) {
- var right = state.lastIntValue;
- if (state.switchU && (left === -1 || right === -1)) {
- state.raise("Invalid character class");
- }
- if (left !== -1 && right !== -1 && left > right) {
- state.raise("Range out of order in character class");
- }
- }
- }
- };
- pp$9.regexp_eatClassAtom = function(state) {
- var start = state.pos;
- if (state.eat(0x5C )) {
- if (this.regexp_eatClassEscape(state)) {
- return true
- }
- if (state.switchU) {
-
- var ch$1 = state.current();
- if (ch$1 === 0x63 || isOctalDigit(ch$1)) {
- state.raise("Invalid class escape");
- }
- state.raise("Invalid escape");
- }
- state.pos = start;
- }
- var ch = state.current();
- if (ch !== 0x5D ) {
- state.lastIntValue = ch;
- state.advance();
- return true
- }
- return false
- };
- pp$9.regexp_eatClassEscape = function(state) {
- var start = state.pos;
- if (state.eat(0x62 )) {
- state.lastIntValue = 0x08;
- return true
- }
- if (state.switchU && state.eat(0x2D )) {
- state.lastIntValue = 0x2D;
- return true
- }
- if (!state.switchU && state.eat(0x63 )) {
- if (this.regexp_eatClassControlLetter(state)) {
- return true
- }
- state.pos = start;
- }
- return (
- this.regexp_eatCharacterClassEscape(state) ||
- this.regexp_eatCharacterEscape(state)
- )
- };
- pp$9.regexp_eatClassControlLetter = function(state) {
- var ch = state.current();
- if (isDecimalDigit(ch) || ch === 0x5F ) {
- state.lastIntValue = ch % 0x20;
- state.advance();
- return true
- }
- return false
- };
- pp$9.regexp_eatHexEscapeSequence = function(state) {
- var start = state.pos;
- if (state.eat(0x78 )) {
- if (this.regexp_eatFixedHexDigits(state, 2)) {
- return true
- }
- if (state.switchU) {
- state.raise("Invalid escape");
- }
- state.pos = start;
- }
- return false
- };
- pp$9.regexp_eatDecimalDigits = function(state) {
- var start = state.pos;
- var ch = 0;
- state.lastIntValue = 0;
- while (isDecimalDigit(ch = state.current())) {
- state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 );
- state.advance();
- }
- return state.pos !== start
- };
- function isDecimalDigit(ch) {
- return ch >= 0x30 && ch <= 0x39
- }
- pp$9.regexp_eatHexDigits = function(state) {
- var start = state.pos;
- var ch = 0;
- state.lastIntValue = 0;
- while (isHexDigit(ch = state.current())) {
- state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
- state.advance();
- }
- return state.pos !== start
- };
- function isHexDigit(ch) {
- return (
- (ch >= 0x30 && ch <= 0x39 ) ||
- (ch >= 0x41 && ch <= 0x46 ) ||
- (ch >= 0x61 && ch <= 0x66 )
- )
- }
- function hexToInt(ch) {
- if (ch >= 0x41 && ch <= 0x46 ) {
- return 10 + (ch - 0x41 )
- }
- if (ch >= 0x61 && ch <= 0x66 ) {
- return 10 + (ch - 0x61 )
- }
- return ch - 0x30
- }
- pp$9.regexp_eatLegacyOctalEscapeSequence = function(state) {
- if (this.regexp_eatOctalDigit(state)) {
- var n1 = state.lastIntValue;
- if (this.regexp_eatOctalDigit(state)) {
- var n2 = state.lastIntValue;
- if (n1 <= 3 && this.regexp_eatOctalDigit(state)) {
- state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue;
- } else {
- state.lastIntValue = n1 * 8 + n2;
- }
- } else {
- state.lastIntValue = n1;
- }
- return true
- }
- return false
- };
- pp$9.regexp_eatOctalDigit = function(state) {
- var ch = state.current();
- if (isOctalDigit(ch)) {
- state.lastIntValue = ch - 0x30;
- state.advance();
- return true
- }
- state.lastIntValue = 0;
- return false
- };
- function isOctalDigit(ch) {
- return ch >= 0x30 && ch <= 0x37
- }
- pp$9.regexp_eatFixedHexDigits = function(state, length) {
- var start = state.pos;
- state.lastIntValue = 0;
- for (var i = 0; i < length; ++i) {
- var ch = state.current();
- if (!isHexDigit(ch)) {
- state.pos = start;
- return false
- }
- state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
- state.advance();
- }
- return true
- };
- var Token = function Token(p) {
- this.type = p.type;
- this.value = p.value;
- this.start = p.start;
- this.end = p.end;
- if (p.options.locations)
- { this.loc = new SourceLocation(p, p.startLoc, p.endLoc); }
- if (p.options.ranges)
- { this.range = [p.start, p.end]; }
- };
- var pp$8 = Parser.prototype;
- pp$8.next = function() {
- if (this.options.onToken)
- { this.options.onToken(new Token(this)); }
- this.lastTokEnd = this.end;
- this.lastTokStart = this.start;
- this.lastTokEndLoc = this.endLoc;
- this.lastTokStartLoc = this.startLoc;
- this.nextToken();
- };
- pp$8.getToken = function() {
- this.next();
- return new Token(this)
- };
- if (typeof Symbol !== "undefined")
- { pp$8[Symbol.iterator] = function() {
- var this$1 = this;
- return {
- next: function () {
- var token = this$1.getToken();
- return {
- done: token.type === types.eof,
- value: token
- }
- }
- }
- }; }
- pp$8.curContext = function() {
- return this.context[this.context.length - 1]
- };
- pp$8.nextToken = function() {
- var curContext = this.curContext();
- if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }
- this.start = this.pos;
- if (this.options.locations) { this.startLoc = this.curPosition(); }
- if (this.pos >= this.input.length) { return this.finishToken(types.eof) }
- if (curContext.override) { return curContext.override(this) }
- else { this.readToken(this.fullCharCodeAtPos()); }
- };
- pp$8.readToken = function(code) {
-
-
- if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 )
- { return this.readWord() }
- return this.getTokenFromCode(code)
- };
- pp$8.fullCharCodeAtPos = function() {
- var code = this.input.charCodeAt(this.pos);
- if (code <= 0xd7ff || code >= 0xe000) { return code }
- var next = this.input.charCodeAt(this.pos + 1);
- return (code << 10) + next - 0x35fdc00
- };
- pp$8.skipBlockComment = function() {
- var this$1 = this;
- var startLoc = this.options.onComment && this.curPosition();
- var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
- if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
- this.pos = end + 2;
- if (this.options.locations) {
- lineBreakG.lastIndex = start;
- var match;
- while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {
- ++this$1.curLine;
- this$1.lineStart = match.index + match[0].length;
- }
- }
- if (this.options.onComment)
- { this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,
- startLoc, this.curPosition()); }
- };
- pp$8.skipLineComment = function(startSkip) {
- var this$1 = this;
- var start = this.pos;
- var startLoc = this.options.onComment && this.curPosition();
- var ch = this.input.charCodeAt(this.pos += startSkip);
- while (this.pos < this.input.length && !isNewLine(ch)) {
- ch = this$1.input.charCodeAt(++this$1.pos);
- }
- if (this.options.onComment)
- { this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,
- startLoc, this.curPosition()); }
- };
- pp$8.skipSpace = function() {
- var this$1 = this;
- loop: while (this.pos < this.input.length) {
- var ch = this$1.input.charCodeAt(this$1.pos);
- switch (ch) {
- case 32: case 160:
- ++this$1.pos;
- break
- case 13:
- if (this$1.input.charCodeAt(this$1.pos + 1) === 10) {
- ++this$1.pos;
- }
- case 10: case 8232: case 8233:
- ++this$1.pos;
- if (this$1.options.locations) {
- ++this$1.curLine;
- this$1.lineStart = this$1.pos;
- }
- break
- case 47:
- switch (this$1.input.charCodeAt(this$1.pos + 1)) {
- case 42:
- this$1.skipBlockComment();
- break
- case 47:
- this$1.skipLineComment(2);
- break
- default:
- break loop
- }
- break
- default:
- if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
- ++this$1.pos;
- } else {
- break loop
- }
- }
- }
- };
- pp$8.finishToken = function(type, val) {
- this.end = this.pos;
- if (this.options.locations) { this.endLoc = this.curPosition(); }
- var prevType = this.type;
- this.type = type;
- this.value = val;
- this.updateContext(prevType);
- };
- pp$8.readToken_dot = function() {
- var next = this.input.charCodeAt(this.pos + 1);
- if (next >= 48 && next <= 57) { return this.readNumber(true) }
- var next2 = this.input.charCodeAt(this.pos + 2);
- if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) {
- this.pos += 3;
- return this.finishToken(types.ellipsis)
- } else {
- ++this.pos;
- return this.finishToken(types.dot)
- }
- };
- pp$8.readToken_slash = function() {
- var next = this.input.charCodeAt(this.pos + 1);
- if (this.exprAllowed) { ++this.pos; return this.readRegexp() }
- if (next === 61) { return this.finishOp(types.assign, 2) }
- return this.finishOp(types.slash, 1)
- };
- pp$8.readToken_mult_modulo_exp = function(code) {
- var next = this.input.charCodeAt(this.pos + 1);
- var size = 1;
- var tokentype = code === 42 ? types.star : types.modulo;
-
- if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
- ++size;
- tokentype = types.starstar;
- next = this.input.charCodeAt(this.pos + 2);
- }
- if (next === 61) { return this.finishOp(types.assign, size + 1) }
- return this.finishOp(tokentype, size)
- };
- pp$8.readToken_pipe_amp = function(code) {
- var next = this.input.charCodeAt(this.pos + 1);
- if (next === code) { return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2) }
- if (next === 61) { return this.finishOp(types.assign, 2) }
- return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)
- };
- pp$8.readToken_caret = function() {
- var next = this.input.charCodeAt(this.pos + 1);
- if (next === 61) { return this.finishOp(types.assign, 2) }
- return this.finishOp(types.bitwiseXOR, 1)
- };
- pp$8.readToken_plus_min = function(code) {
- var next = this.input.charCodeAt(this.pos + 1);
- if (next === code) {
- if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
- (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {
-
- this.skipLineComment(3);
- this.skipSpace();
- return this.nextToken()
- }
- return this.finishOp(types.incDec, 2)
- }
- if (next === 61) { return this.finishOp(types.assign, 2) }
- return this.finishOp(types.plusMin, 1)
- };
- pp$8.readToken_lt_gt = function(code) {
- var next = this.input.charCodeAt(this.pos + 1);
- var size = 1;
- if (next === code) {
- size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
- if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }
- return this.finishOp(types.bitShift, size)
- }
- if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
- this.input.charCodeAt(this.pos + 3) === 45) {
-
- this.skipLineComment(4);
- this.skipSpace();
- return this.nextToken()
- }
- if (next === 61) { size = 2; }
- return this.finishOp(types.relational, size)
- };
- pp$8.readToken_eq_excl = function(code) {
- var next = this.input.charCodeAt(this.pos + 1);
- if (next === 61) { return this.finishOp(types.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
- if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) {
- this.pos += 2;
- return this.finishToken(types.arrow)
- }
- return this.finishOp(code === 61 ? types.eq : types.prefix, 1)
- };
- pp$8.getTokenFromCode = function(code) {
- switch (code) {
-
-
- case 46:
- return this.readToken_dot()
-
- case 40: ++this.pos; return this.finishToken(types.parenL)
- case 41: ++this.pos; return this.finishToken(types.parenR)
- case 59: ++this.pos; return this.finishToken(types.semi)
- case 44: ++this.pos; return this.finishToken(types.comma)
- case 91: ++this.pos; return this.finishToken(types.bracketL)
- case 93: ++this.pos; return this.finishToken(types.bracketR)
- case 123: ++this.pos; return this.finishToken(types.braceL)
- case 125: ++this.pos; return this.finishToken(types.braceR)
- case 58: ++this.pos; return this.finishToken(types.colon)
- case 63: ++this.pos; return this.finishToken(types.question)
- case 96:
- if (this.options.ecmaVersion < 6) { break }
- ++this.pos;
- return this.finishToken(types.backQuote)
- case 48:
- var next = this.input.charCodeAt(this.pos + 1);
- if (next === 120 || next === 88) { return this.readRadixNumber(16) }
- if (this.options.ecmaVersion >= 6) {
- if (next === 111 || next === 79) { return this.readRadixNumber(8) }
- if (next === 98 || next === 66) { return this.readRadixNumber(2) }
- }
-
-
- case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57:
- return this.readNumber(false)
-
- case 34: case 39:
- return this.readString(code)
-
-
-
-
- case 47:
- return this.readToken_slash()
- case 37: case 42:
- return this.readToken_mult_modulo_exp(code)
- case 124: case 38:
- return this.readToken_pipe_amp(code)
- case 94:
- return this.readToken_caret()
- case 43: case 45:
- return this.readToken_plus_min(code)
- case 60: case 62:
- return this.readToken_lt_gt(code)
- case 61: case 33:
- return this.readToken_eq_excl(code)
- case 126:
- return this.finishOp(types.prefix, 1)
- }
- this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
- };
- pp$8.finishOp = function(type, size) {
- var str = this.input.slice(this.pos, this.pos + size);
- this.pos += size;
- return this.finishToken(type, str)
- };
- pp$8.readRegexp = function() {
- var this$1 = this;
- var escaped, inClass, start = this.pos;
- for (;;) {
- if (this$1.pos >= this$1.input.length) { this$1.raise(start, "Unterminated regular expression"); }
- var ch = this$1.input.charAt(this$1.pos);
- if (lineBreak.test(ch)) { this$1.raise(start, "Unterminated regular expression"); }
- if (!escaped) {
- if (ch === "[") { inClass = true; }
- else if (ch === "]" && inClass) { inClass = false; }
- else if (ch === "/" && !inClass) { break }
- escaped = ch === "\\";
- } else { escaped = false; }
- ++this$1.pos;
- }
- var pattern = this.input.slice(start, this.pos);
- ++this.pos;
- var flagsStart = this.pos;
- var flags = this.readWord1();
- if (this.containsEsc) { this.unexpected(flagsStart); }
-
- var state = this.regexpState || (this.regexpState = new RegExpValidationState(this));
- state.reset(start, pattern, flags);
- this.validateRegExpFlags(state);
- this.validateRegExpPattern(state);
-
- var value = null;
- try {
- value = new RegExp(pattern, flags);
- } catch (e) {
-
-
- }
- return this.finishToken(types.regexp, {pattern: pattern, flags: flags, value: value})
- };
- pp$8.readInt = function(radix, len) {
- var this$1 = this;
- var start = this.pos, total = 0;
- for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {
- var code = this$1.input.charCodeAt(this$1.pos), val = (void 0);
- if (code >= 97) { val = code - 97 + 10; }
- else if (code >= 65) { val = code - 65 + 10; }
- else if (code >= 48 && code <= 57) { val = code - 48; }
- else { val = Infinity; }
- if (val >= radix) { break }
- ++this$1.pos;
- total = total * radix + val;
- }
- if (this.pos === start || len != null && this.pos - start !== len) { return null }
- return total
- };
- pp$8.readRadixNumber = function(radix) {
- this.pos += 2;
- var val = this.readInt(radix);
- if (val == null) { this.raise(this.start + 2, "Expected number in radix " + radix); }
- if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
- return this.finishToken(types.num, val)
- };
- pp$8.readNumber = function(startsWithDot) {
- var start = this.pos;
- if (!startsWithDot && this.readInt(10) === null) { this.raise(start, "Invalid number"); }
- var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
- if (octal && this.strict) { this.raise(start, "Invalid number"); }
- if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }
- var next = this.input.charCodeAt(this.pos);
- if (next === 46 && !octal) {
- ++this.pos;
- this.readInt(10);
- next = this.input.charCodeAt(this.pos);
- }
- if ((next === 69 || next === 101) && !octal) {
- next = this.input.charCodeAt(++this.pos);
- if (next === 43 || next === 45) { ++this.pos; }
- if (this.readInt(10) === null) { this.raise(start, "Invalid number"); }
- }
- if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
- var str = this.input.slice(start, this.pos);
- var val = octal ? parseInt(str, 8) : parseFloat(str);
- return this.finishToken(types.num, val)
- };
- pp$8.readCodePoint = function() {
- var ch = this.input.charCodeAt(this.pos), code;
- if (ch === 123) {
- if (this.options.ecmaVersion < 6) { this.unexpected(); }
- var codePos = ++this.pos;
- code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos);
- ++this.pos;
- if (code > 0x10FFFF) { this.invalidStringToken(codePos, "Code point out of bounds"); }
- } else {
- code = this.readHexChar(4);
- }
- return code
- };
- function codePointToString(code) {
-
- if (code <= 0xFFFF) { return String.fromCharCode(code) }
- code -= 0x10000;
- return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
- }
- pp$8.readString = function(quote) {
- var this$1 = this;
- var out = "", chunkStart = ++this.pos;
- for (;;) {
- if (this$1.pos >= this$1.input.length) { this$1.raise(this$1.start, "Unterminated string constant"); }
- var ch = this$1.input.charCodeAt(this$1.pos);
- if (ch === quote) { break }
- if (ch === 92) {
- out += this$1.input.slice(chunkStart, this$1.pos);
- out += this$1.readEscapedChar(false);
- chunkStart = this$1.pos;
- } else {
- if (isNewLine(ch, this$1.options.ecmaVersion >= 10)) { this$1.raise(this$1.start, "Unterminated string constant"); }
- ++this$1.pos;
- }
- }
- out += this.input.slice(chunkStart, this.pos++);
- return this.finishToken(types.string, out)
- };
- var INVALID_TEMPLATE_ESCAPE_ERROR = {};
- pp$8.tryReadTemplateToken = function() {
- this.inTemplateElement = true;
- try {
- this.readTmplToken();
- } catch (err) {
- if (err === INVALID_TEMPLATE_ESCAPE_ERROR) {
- this.readInvalidTemplateToken();
- } else {
- throw err
- }
- }
- this.inTemplateElement = false;
- };
- pp$8.invalidStringToken = function(position, message) {
- if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
- throw INVALID_TEMPLATE_ESCAPE_ERROR
- } else {
- this.raise(position, message);
- }
- };
- pp$8.readTmplToken = function() {
- var this$1 = this;
- var out = "", chunkStart = this.pos;
- for (;;) {
- if (this$1.pos >= this$1.input.length) { this$1.raise(this$1.start, "Unterminated template"); }
- var ch = this$1.input.charCodeAt(this$1.pos);
- if (ch === 96 || ch === 36 && this$1.input.charCodeAt(this$1.pos + 1) === 123) {
- if (this$1.pos === this$1.start && (this$1.type === types.template || this$1.type === types.invalidTemplate)) {
- if (ch === 36) {
- this$1.pos += 2;
- return this$1.finishToken(types.dollarBraceL)
- } else {
- ++this$1.pos;
- return this$1.finishToken(types.backQuote)
- }
- }
- out += this$1.input.slice(chunkStart, this$1.pos);
- return this$1.finishToken(types.template, out)
- }
- if (ch === 92) {
- out += this$1.input.slice(chunkStart, this$1.pos);
- out += this$1.readEscapedChar(true);
- chunkStart = this$1.pos;
- } else if (isNewLine(ch)) {
- out += this$1.input.slice(chunkStart, this$1.pos);
- ++this$1.pos;
- switch (ch) {
- case 13:
- if (this$1.input.charCodeAt(this$1.pos) === 10) { ++this$1.pos; }
- case 10:
- out += "\n";
- break
- default:
- out += String.fromCharCode(ch);
- break
- }
- if (this$1.options.locations) {
- ++this$1.curLine;
- this$1.lineStart = this$1.pos;
- }
- chunkStart = this$1.pos;
- } else {
- ++this$1.pos;
- }
- }
- };
- pp$8.readInvalidTemplateToken = function() {
- var this$1 = this;
- for (; this.pos < this.input.length; this.pos++) {
- switch (this$1.input[this$1.pos]) {
- case "\\":
- ++this$1.pos;
- break
- case "$":
- if (this$1.input[this$1.pos + 1] !== "{") {
- break
- }
-
- case "`":
- return this$1.finishToken(types.invalidTemplate, this$1.input.slice(this$1.start, this$1.pos))
-
- }
- }
- this.raise(this.start, "Unterminated template");
- };
- pp$8.readEscapedChar = function(inTemplate) {
- var ch = this.input.charCodeAt(++this.pos);
- ++this.pos;
- switch (ch) {
- case 110: return "\n"
- case 114: return "\r"
- case 120: return String.fromCharCode(this.readHexChar(2))
- case 117: return codePointToString(this.readCodePoint())
- case 116: return "\t"
- case 98: return "\b"
- case 118: return "\u000b"
- case 102: return "\f"
- case 13: if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; }
- case 10:
- if (this.options.locations) { this.lineStart = this.pos; ++this.curLine; }
- return ""
- default:
- if (ch >= 48 && ch <= 55) {
- var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0];
- var octal = parseInt(octalStr, 8);
- if (octal > 255) {
- octalStr = octalStr.slice(0, -1);
- octal = parseInt(octalStr, 8);
- }
- this.pos += octalStr.length - 1;
- ch = this.input.charCodeAt(this.pos);
- if ((octalStr !== "0" || ch === 56 || ch === 57) && (this.strict || inTemplate)) {
- this.invalidStringToken(
- this.pos - 1 - octalStr.length,
- inTemplate
- ? "Octal literal in template string"
- : "Octal literal in strict mode"
- );
- }
- return String.fromCharCode(octal)
- }
- return String.fromCharCode(ch)
- }
- };
- pp$8.readHexChar = function(len) {
- var codePos = this.pos;
- var n = this.readInt(16, len);
- if (n === null) { this.invalidStringToken(codePos, "Bad character escape sequence"); }
- return n
- };
- pp$8.readWord1 = function() {
- var this$1 = this;
- this.containsEsc = false;
- var word = "", first = true, chunkStart = this.pos;
- var astral = this.options.ecmaVersion >= 6;
- while (this.pos < this.input.length) {
- var ch = this$1.fullCharCodeAtPos();
- if (isIdentifierChar(ch, astral)) {
- this$1.pos += ch <= 0xffff ? 1 : 2;
- } else if (ch === 92) {
- this$1.containsEsc = true;
- word += this$1.input.slice(chunkStart, this$1.pos);
- var escStart = this$1.pos;
- if (this$1.input.charCodeAt(++this$1.pos) !== 117)
- { this$1.invalidStringToken(this$1.pos, "Expecting Unicode escape sequence \\uXXXX"); }
- ++this$1.pos;
- var esc = this$1.readCodePoint();
- if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
- { this$1.invalidStringToken(escStart, "Invalid Unicode escape"); }
- word += codePointToString(esc);
- chunkStart = this$1.pos;
- } else {
- break
- }
- first = false;
- }
- return word + this.input.slice(chunkStart, this.pos)
- };
- pp$8.readWord = function() {
- var word = this.readWord1();
- var type = types.name;
- if (this.keywords.test(word)) {
- if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword " + word); }
- type = keywords$1[word];
- }
- return this.finishToken(type, word)
- };
- var version = "5.7.3";
- function parse(input, options) {
- return new Parser(options, input).parse()
- }
- function parseExpressionAt(input, pos, options) {
- var p = new Parser(options, input, pos);
- p.nextToken();
- return p.parseExpression()
- }
- function tokenizer(input, options) {
- return new Parser(options, input)
- }
- var parse_dammit;
- var LooseParser;
- var pluginsLoose;
- function addLooseExports(parse, Parser$$1, plugins$$1) {
- parse_dammit = parse;
- LooseParser = Parser$$1;
- pluginsLoose = plugins$$1;
- }
- var acorn = Object.freeze({
- version: version,
- parse: parse,
- parseExpressionAt: parseExpressionAt,
- tokenizer: tokenizer,
- get parse_dammit () { return parse_dammit; },
- get LooseParser () { return LooseParser; },
- get pluginsLoose () { return pluginsLoose; },
- addLooseExports: addLooseExports,
- Parser: Parser,
- plugins: plugins,
- defaultOptions: defaultOptions,
- Position: Position,
- SourceLocation: SourceLocation,
- getLineInfo: getLineInfo,
- Node: Node,
- TokenType: TokenType,
- tokTypes: types,
- keywordTypes: keywords$1,
- TokContext: TokContext,
- tokContexts: types$1,
- isIdentifierChar: isIdentifierChar,
- isIdentifierStart: isIdentifierStart,
- Token: Token,
- isNewLine: isNewLine,
- lineBreak: lineBreak,
- lineBreakG: lineBreakG,
- nonASCIIwhitespace: nonASCIIwhitespace
- });
- var xhtml = {
- quot: '\u0022',
- amp: '&',
- apos: '\u0027',
- lt: '<',
- gt: '>',
- nbsp: '\u00A0',
- iexcl: '\u00A1',
- cent: '\u00A2',
- pound: '\u00A3',
- curren: '\u00A4',
- yen: '\u00A5',
- brvbar: '\u00A6',
- sect: '\u00A7',
- uml: '\u00A8',
- copy: '\u00A9',
- ordf: '\u00AA',
- laquo: '\u00AB',
- not: '\u00AC',
- shy: '\u00AD',
- reg: '\u00AE',
- macr: '\u00AF',
- deg: '\u00B0',
- plusmn: '\u00B1',
- sup2: '\u00B2',
- sup3: '\u00B3',
- acute: '\u00B4',
- micro: '\u00B5',
- para: '\u00B6',
- middot: '\u00B7',
- cedil: '\u00B8',
- sup1: '\u00B9',
- ordm: '\u00BA',
- raquo: '\u00BB',
- frac14: '\u00BC',
- frac12: '\u00BD',
- frac34: '\u00BE',
- iquest: '\u00BF',
- Agrave: '\u00C0',
- Aacute: '\u00C1',
- Acirc: '\u00C2',
- Atilde: '\u00C3',
- Auml: '\u00C4',
- Aring: '\u00C5',
- AElig: '\u00C6',
- Ccedil: '\u00C7',
- Egrave: '\u00C8',
- Eacute: '\u00C9',
- Ecirc: '\u00CA',
- Euml: '\u00CB',
- Igrave: '\u00CC',
- Iacute: '\u00CD',
- Icirc: '\u00CE',
- Iuml: '\u00CF',
- ETH: '\u00D0',
- Ntilde: '\u00D1',
- Ograve: '\u00D2',
- Oacute: '\u00D3',
- Ocirc: '\u00D4',
- Otilde: '\u00D5',
- Ouml: '\u00D6',
- times: '\u00D7',
- Oslash: '\u00D8',
- Ugrave: '\u00D9',
- Uacute: '\u00DA',
- Ucirc: '\u00DB',
- Uuml: '\u00DC',
- Yacute: '\u00DD',
- THORN: '\u00DE',
- szlig: '\u00DF',
- agrave: '\u00E0',
- aacute: '\u00E1',
- acirc: '\u00E2',
- atilde: '\u00E3',
- auml: '\u00E4',
- aring: '\u00E5',
- aelig: '\u00E6',
- ccedil: '\u00E7',
- egrave: '\u00E8',
- eacute: '\u00E9',
- ecirc: '\u00EA',
- euml: '\u00EB',
- igrave: '\u00EC',
- iacute: '\u00ED',
- icirc: '\u00EE',
- iuml: '\u00EF',
- eth: '\u00F0',
- ntilde: '\u00F1',
- ograve: '\u00F2',
- oacute: '\u00F3',
- ocirc: '\u00F4',
- otilde: '\u00F5',
- ouml: '\u00F6',
- divide: '\u00F7',
- oslash: '\u00F8',
- ugrave: '\u00F9',
- uacute: '\u00FA',
- ucirc: '\u00FB',
- uuml: '\u00FC',
- yacute: '\u00FD',
- thorn: '\u00FE',
- yuml: '\u00FF',
- OElig: '\u0152',
- oelig: '\u0153',
- Scaron: '\u0160',
- scaron: '\u0161',
- Yuml: '\u0178',
- fnof: '\u0192',
- circ: '\u02C6',
- tilde: '\u02DC',
- Alpha: '\u0391',
- Beta: '\u0392',
- Gamma: '\u0393',
- Delta: '\u0394',
- Epsilon: '\u0395',
- Zeta: '\u0396',
- Eta: '\u0397',
- Theta: '\u0398',
- Iota: '\u0399',
- Kappa: '\u039A',
- Lambda: '\u039B',
- Mu: '\u039C',
- Nu: '\u039D',
- Xi: '\u039E',
- Omicron: '\u039F',
- Pi: '\u03A0',
- Rho: '\u03A1',
- Sigma: '\u03A3',
- Tau: '\u03A4',
- Upsilon: '\u03A5',
- Phi: '\u03A6',
- Chi: '\u03A7',
- Psi: '\u03A8',
- Omega: '\u03A9',
- alpha: '\u03B1',
- beta: '\u03B2',
- gamma: '\u03B3',
- delta: '\u03B4',
- epsilon: '\u03B5',
- zeta: '\u03B6',
- eta: '\u03B7',
- theta: '\u03B8',
- iota: '\u03B9',
- kappa: '\u03BA',
- lambda: '\u03BB',
- mu: '\u03BC',
- nu: '\u03BD',
- xi: '\u03BE',
- omicron: '\u03BF',
- pi: '\u03C0',
- rho: '\u03C1',
- sigmaf: '\u03C2',
- sigma: '\u03C3',
- tau: '\u03C4',
- upsilon: '\u03C5',
- phi: '\u03C6',
- chi: '\u03C7',
- psi: '\u03C8',
- omega: '\u03C9',
- thetasym: '\u03D1',
- upsih: '\u03D2',
- piv: '\u03D6',
- ensp: '\u2002',
- emsp: '\u2003',
- thinsp: '\u2009',
- zwnj: '\u200C',
- zwj: '\u200D',
- lrm: '\u200E',
- rlm: '\u200F',
- ndash: '\u2013',
- mdash: '\u2014',
- lsquo: '\u2018',
- rsquo: '\u2019',
- sbquo: '\u201A',
- ldquo: '\u201C',
- rdquo: '\u201D',
- bdquo: '\u201E',
- dagger: '\u2020',
- Dagger: '\u2021',
- bull: '\u2022',
- hellip: '\u2026',
- permil: '\u2030',
- prime: '\u2032',
- Prime: '\u2033',
- lsaquo: '\u2039',
- rsaquo: '\u203A',
- oline: '\u203E',
- frasl: '\u2044',
- euro: '\u20AC',
- image: '\u2111',
- weierp: '\u2118',
- real: '\u211C',
- trade: '\u2122',
- alefsym: '\u2135',
- larr: '\u2190',
- uarr: '\u2191',
- rarr: '\u2192',
- darr: '\u2193',
- harr: '\u2194',
- crarr: '\u21B5',
- lArr: '\u21D0',
- uArr: '\u21D1',
- rArr: '\u21D2',
- dArr: '\u21D3',
- hArr: '\u21D4',
- forall: '\u2200',
- part: '\u2202',
- exist: '\u2203',
- empty: '\u2205',
- nabla: '\u2207',
- isin: '\u2208',
- notin: '\u2209',
- ni: '\u220B',
- prod: '\u220F',
- sum: '\u2211',
- minus: '\u2212',
- lowast: '\u2217',
- radic: '\u221A',
- prop: '\u221D',
- infin: '\u221E',
- ang: '\u2220',
- and: '\u2227',
- or: '\u2228',
- cap: '\u2229',
- cup: '\u222A',
- 'int': '\u222B',
- there4: '\u2234',
- sim: '\u223C',
- cong: '\u2245',
- asymp: '\u2248',
- ne: '\u2260',
- equiv: '\u2261',
- le: '\u2264',
- ge: '\u2265',
- sub: '\u2282',
- sup: '\u2283',
- nsub: '\u2284',
- sube: '\u2286',
- supe: '\u2287',
- oplus: '\u2295',
- otimes: '\u2297',
- perp: '\u22A5',
- sdot: '\u22C5',
- lceil: '\u2308',
- rceil: '\u2309',
- lfloor: '\u230A',
- rfloor: '\u230B',
- lang: '\u2329',
- rang: '\u232A',
- loz: '\u25CA',
- spades: '\u2660',
- clubs: '\u2663',
- hearts: '\u2665',
- diams: '\u2666'
- };
- var hexNumber = /^[\da-fA-F]+$/;
- var decimalNumber = /^\d+$/;
- var inject = function(acorn) {
- var tt = acorn.tokTypes;
- var tc = acorn.tokContexts;
- tc.j_oTag = new acorn.TokContext('<tag', false);
- tc.j_cTag = new acorn.TokContext('</tag', false);
- tc.j_expr = new acorn.TokContext('<tag>...</tag>', true, true);
- tt.jsxName = new acorn.TokenType('jsxName');
- tt.jsxText = new acorn.TokenType('jsxText', {beforeExpr: true});
- tt.jsxTagStart = new acorn.TokenType('jsxTagStart');
- tt.jsxTagEnd = new acorn.TokenType('jsxTagEnd');
- tt.jsxTagStart.updateContext = function() {
- this.context.push(tc.j_expr);
- this.context.push(tc.j_oTag);
- this.exprAllowed = false;
- };
- tt.jsxTagEnd.updateContext = function(prevType) {
- var out = this.context.pop();
- if (out === tc.j_oTag && prevType === tt.slash || out === tc.j_cTag) {
- this.context.pop();
- this.exprAllowed = this.curContext() === tc.j_expr;
- } else {
- this.exprAllowed = true;
- }
- };
- var pp = acorn.Parser.prototype;
-
- pp.jsx_readToken = function() {
- var out = '', chunkStart = this.pos;
- for (;;) {
- if (this.pos >= this.input.length)
- this.raise(this.start, 'Unterminated JSX contents');
- var ch = this.input.charCodeAt(this.pos);
- switch (ch) {
- case 60:
- case 123:
- if (this.pos === this.start) {
- if (ch === 60 && this.exprAllowed) {
- ++this.pos;
- return this.finishToken(tt.jsxTagStart);
- }
- return this.getTokenFromCode(ch);
- }
- out += this.input.slice(chunkStart, this.pos);
- return this.finishToken(tt.jsxText, out);
- case 38:
- out += this.input.slice(chunkStart, this.pos);
- out += this.jsx_readEntity();
- chunkStart = this.pos;
- break;
- default:
- if (acorn.isNewLine(ch)) {
- out += this.input.slice(chunkStart, this.pos);
- out += this.jsx_readNewLine(true);
- chunkStart = this.pos;
- } else {
- ++this.pos;
- }
- }
- }
- };
- pp.jsx_readNewLine = function(normalizeCRLF) {
- var ch = this.input.charCodeAt(this.pos);
- var out;
- ++this.pos;
- if (ch === 13 && this.input.charCodeAt(this.pos) === 10) {
- ++this.pos;
- out = normalizeCRLF ? '\n' : '\r\n';
- } else {
- out = String.fromCharCode(ch);
- }
- if (this.options.locations) {
- ++this.curLine;
- this.lineStart = this.pos;
- }
- return out;
- };
- pp.jsx_readString = function(quote) {
- var out = '', chunkStart = ++this.pos;
- for (;;) {
- if (this.pos >= this.input.length)
- this.raise(this.start, 'Unterminated string constant');
- var ch = this.input.charCodeAt(this.pos);
- if (ch === quote) break;
- if (ch === 38) {
- out += this.input.slice(chunkStart, this.pos);
- out += this.jsx_readEntity();
- chunkStart = this.pos;
- } else if (acorn.isNewLine(ch)) {
- out += this.input.slice(chunkStart, this.pos);
- out += this.jsx_readNewLine(false);
- chunkStart = this.pos;
- } else {
- ++this.pos;
- }
- }
- out += this.input.slice(chunkStart, this.pos++);
- return this.finishToken(tt.string, out);
- };
- pp.jsx_readEntity = function() {
- var str = '', count = 0, entity;
- var ch = this.input[this.pos];
- if (ch !== '&')
- this.raise(this.pos, 'Entity must start with an ampersand');
- var startPos = ++this.pos;
- while (this.pos < this.input.length && count++ < 10) {
- ch = this.input[this.pos++];
- if (ch === ';') {
- if (str[0] === '#') {
- if (str[1] === 'x') {
- str = str.substr(2);
- if (hexNumber.test(str))
- entity = String.fromCharCode(parseInt(str, 16));
- } else {
- str = str.substr(1);
- if (decimalNumber.test(str))
- entity = String.fromCharCode(parseInt(str, 10));
- }
- } else {
- entity = xhtml[str];
- }
- break;
- }
- str += ch;
- }
- if (!entity) {
- this.pos = startPos;
- return '&';
- }
- return entity;
- };
-
-
-
-
-
-
- pp.jsx_readWord = function() {
- var ch, start = this.pos;
- do {
- ch = this.input.charCodeAt(++this.pos);
- } while (acorn.isIdentifierChar(ch) || ch === 45);
- return this.finishToken(tt.jsxName, this.input.slice(start, this.pos));
- };
-
- function getQualifiedJSXName(object) {
- if (!object)
- return object;
- if (object.type === 'JSXIdentifier')
- return object.name;
- if (object.type === 'JSXNamespacedName')
- return object.namespace.name + ':' + object.name.name;
- if (object.type === 'JSXMemberExpression')
- return getQualifiedJSXName(object.object) + '.' +
- getQualifiedJSXName(object.property);
- }
-
- pp.jsx_parseIdentifier = function() {
- var node = this.startNode();
- if (this.type === tt.jsxName)
- node.name = this.value;
- else if (this.type.keyword)
- node.name = this.type.keyword;
- else
- this.unexpected();
- this.next();
- return this.finishNode(node, 'JSXIdentifier');
- };
-
- pp.jsx_parseNamespacedName = function() {
- var startPos = this.start, startLoc = this.startLoc;
- var name = this.jsx_parseIdentifier();
- if (!this.options.plugins.jsx.allowNamespaces || !this.eat(tt.colon)) return name;
- var node = this.startNodeAt(startPos, startLoc);
- node.namespace = name;
- node.name = this.jsx_parseIdentifier();
- return this.finishNode(node, 'JSXNamespacedName');
- };
-
-
- pp.jsx_parseElementName = function() {
- if (this.type === tt.jsxTagEnd)
- return '';
- var startPos = this.start, startLoc = this.startLoc;
- var node = this.jsx_parseNamespacedName();
- if (this.type === tt.dot && node.type === 'JSXNamespacedName' && !this.options.plugins.jsx.allowNamespacedObjects) {
- this.unexpected();
- }
- while (this.eat(tt.dot)) {
- var newNode = this.startNodeAt(startPos, startLoc);
- newNode.object = node;
- newNode.property = this.jsx_parseIdentifier();
- node = this.finishNode(newNode, 'JSXMemberExpression');
- }
- return node;
- };
-
- pp.jsx_parseAttributeValue = function() {
- switch (this.type) {
- case tt.braceL:
- var node = this.jsx_parseExpressionContainer();
- if (node.expression.type === 'JSXEmptyExpression')
- this.raise(node.start, 'JSX attributes must only be assigned a non-empty expression');
- return node;
- case tt.jsxTagStart:
- case tt.string:
- return this.parseExprAtom();
- default:
- this.raise(this.start, 'JSX value should be either an expression or a quoted JSX text');
- }
- };
-
-
-
- pp.jsx_parseEmptyExpression = function() {
- var node = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc);
- return this.finishNodeAt(node, 'JSXEmptyExpression', this.start, this.startLoc);
- };
-
- pp.jsx_parseExpressionContainer = function() {
- var node = this.startNode();
- this.next();
- node.expression = this.type === tt.braceR
- ? this.jsx_parseEmptyExpression()
- : this.parseExpression();
- this.expect(tt.braceR);
- return this.finishNode(node, 'JSXExpressionContainer');
- };
-
- pp.jsx_parseAttribute = function() {
- var node = this.startNode();
- if (this.eat(tt.braceL)) {
- this.expect(tt.ellipsis);
- node.argument = this.parseMaybeAssign();
- this.expect(tt.braceR);
- return this.finishNode(node, 'JSXSpreadAttribute');
- }
- node.name = this.jsx_parseNamespacedName();
- node.value = this.eat(tt.eq) ? this.jsx_parseAttributeValue() : null;
- return this.finishNode(node, 'JSXAttribute');
- };
-
- pp.jsx_parseOpeningElementAt = function(startPos, startLoc) {
- var node = this.startNodeAt(startPos, startLoc);
- node.attributes = [];
- var nodeName = this.jsx_parseElementName();
- if (nodeName) node.name = nodeName;
- while (this.type !== tt.slash && this.type !== tt.jsxTagEnd)
- node.attributes.push(this.jsx_parseAttribute());
- node.selfClosing = this.eat(tt.slash);
- this.expect(tt.jsxTagEnd);
- return this.finishNode(node, nodeName ? 'JSXOpeningElement' : 'JSXOpeningFragment');
- };
-
- pp.jsx_parseClosingElementAt = function(startPos, startLoc) {
- var node = this.startNodeAt(startPos, startLoc);
- var nodeName = this.jsx_parseElementName();
- if (nodeName) node.name = nodeName;
- this.expect(tt.jsxTagEnd);
- return this.finishNode(node, nodeName ? 'JSXClosingElement' : 'JSXClosingFragment');
- };
-
-
- pp.jsx_parseElementAt = function(startPos, startLoc) {
- var node = this.startNodeAt(startPos, startLoc);
- var children = [];
- var openingElement = this.jsx_parseOpeningElementAt(startPos, startLoc);
- var closingElement = null;
- if (!openingElement.selfClosing) {
- contents: for (;;) {
- switch (this.type) {
- case tt.jsxTagStart:
- startPos = this.start; startLoc = this.startLoc;
- this.next();
- if (this.eat(tt.slash)) {
- closingElement = this.jsx_parseClosingElementAt(startPos, startLoc);
- break contents;
- }
- children.push(this.jsx_parseElementAt(startPos, startLoc));
- break;
- case tt.jsxText:
- children.push(this.parseExprAtom());
- break;
- case tt.braceL:
- children.push(this.jsx_parseExpressionContainer());
- break;
- default:
- this.unexpected();
- }
- }
- if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
- this.raise(
- closingElement.start,
- 'Expected corresponding JSX closing tag for <' + getQualifiedJSXName(openingElement.name) + '>');
- }
- }
- node.openingElement = openingElement;
- node.closingElement = closingElement;
- node.children = children;
- if (this.type === tt.relational && this.value === "<") {
- this.raise(this.start, "Adjacent JSX elements must be wrapped in an enclosing tag");
- }
- return this.finishNode(node, openingElement.name ? 'JSXElement' : 'JSXFragment');
- };
-
- pp.jsx_parseText = function(value) {
- var node = this.parseLiteral(value);
- node.type = "JSXText";
- return node;
- };
-
- pp.jsx_parseElement = function() {
- var startPos = this.start, startLoc = this.startLoc;
- this.next();
- return this.jsx_parseElementAt(startPos, startLoc);
- };
- acorn.plugins.jsx = function(instance, opts) {
- if (!opts) {
- return;
- }
- if (typeof opts !== 'object') {
- opts = {};
- }
- instance.options.plugins.jsx = {
- allowNamespaces: opts.allowNamespaces !== false,
- allowNamespacedObjects: !!opts.allowNamespacedObjects
- };
- instance.extend('parseExprAtom', function(inner) {
- return function(refShortHandDefaultPos) {
- if (this.type === tt.jsxText)
- return this.jsx_parseText(this.value);
- else if (this.type === tt.jsxTagStart)
- return this.jsx_parseElement();
- else
- return inner.call(this, refShortHandDefaultPos);
- };
- });
- instance.extend('readToken', function(inner) {
- return function(code) {
- var context = this.curContext();
- if (context === tc.j_expr) return this.jsx_readToken();
- if (context === tc.j_oTag || context === tc.j_cTag) {
- if (acorn.isIdentifierStart(code)) return this.jsx_readWord();
- if (code == 62) {
- ++this.pos;
- return this.finishToken(tt.jsxTagEnd);
- }
- if ((code === 34 || code === 39) && context == tc.j_oTag)
- return this.jsx_readString(code);
- }
- if (code === 60 && this.exprAllowed && this.input.charCodeAt(this.pos + 1) !== 33) {
- ++this.pos;
- return this.finishToken(tt.jsxTagStart);
- }
- return inner.call(this, code);
- };
- });
- instance.extend('updateContext', function(inner) {
- return function(prevType) {
- if (this.type == tt.braceL) {
- var curContext = this.curContext();
- if (curContext == tc.j_oTag) this.context.push(tc.b_expr);
- else if (curContext == tc.j_expr) this.context.push(tc.b_tmpl);
- else inner.call(this, prevType);
- this.exprAllowed = true;
- } else if (this.type === tt.slash && prevType === tt.jsxTagStart) {
- this.context.length -= 2;
- this.context.push(tc.j_cTag);
- this.exprAllowed = false;
- } else {
- return inner.call(this, prevType);
- }
- };
- });
- };
- return acorn;
- };
- var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
- function commonjsRequire () {
- throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
- }
- function unwrapExports (x) {
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
- }
- function createCommonjsModule(fn, module) {
- return module = { exports: {} }, fn(module, module.exports), module.exports;
- }
- var inject$1 = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports['default'] = injectDynamicImport;
- var DynamicImportKey = exports.DynamicImportKey = 'Import';
- function injectDynamicImport(acorn) {
- var tt = acorn.tokTypes;
-
- tt._import.startsExpr = true;
- function parseDynamicImport() {
- var node = this.startNode();
- this.next();
- if (this.type !== tt.parenL) {
- this.unexpected();
- }
- return this.finishNode(node, DynamicImportKey);
- }
- function peekNext() {
- return this.input[this.pos];
- }
-
- acorn.plugins.dynamicImport = function () {
- function dynamicImportPlugin(instance) {
- instance.extend('parseStatement', function (nextMethod) {
- return function () {
- function parseStatement() {
- var node = this.startNode();
- if (this.type === tt._import) {
- var nextToken = peekNext.call(this);
- if (nextToken === tt.parenL.label) {
- var expr = this.parseExpression();
- return this.parseExpressionStatement(node, expr);
- }
- }
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- return nextMethod.apply(this, args);
- }
- return parseStatement;
- }();
- });
- instance.extend('parseExprAtom', function (nextMethod) {
- return function () {
- function parseExprAtom(refDestructuringErrors) {
- if (this.type === tt._import) {
- return parseDynamicImport.call(this);
- }
- return nextMethod.call(this, refDestructuringErrors);
- }
- return parseExprAtom;
- }();
- });
- }
- return dynamicImportPlugin;
- }();
- return acorn;
- }
- });
- var acornDynamicImport = unwrapExports(inject$1);
- var inject_1 = inject$1.DynamicImportKey;
- var integerToChar = {};
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split( '' ).forEach( function ( char, i ) {
- integerToChar[ i ] = char;
- });
- function encode ( value ) {
- var result;
- if ( typeof value === 'number' ) {
- result = encodeInteger( value );
- } else {
- result = '';
- for ( var i = 0; i < value.length; i += 1 ) {
- result += encodeInteger( value[i] );
- }
- }
- return result;
- }
- function encodeInteger ( num ) {
- var result = '';
- if ( num < 0 ) {
- num = ( -num << 1 ) | 1;
- } else {
- num <<= 1;
- }
- do {
- var clamped = num & 31;
- num >>= 5;
- if ( num > 0 ) {
- clamped |= 32;
- }
- result += integerToChar[ clamped ];
- } while ( num > 0 );
- return result;
- }
- function Chunk ( start, end, content ) {
- this.start = start;
- this.end = end;
- this.original = content;
- this.intro = '';
- this.outro = '';
- this.content = content;
- this.storeName = false;
- this.edited = false;
-
- Object.defineProperties( this, {
- previous: { writable: true, value: null },
- next: { writable: true, value: null }
- });
- }
- Chunk.prototype = {
- appendLeft: function appendLeft ( content ) {
- this.outro += content;
- },
- appendRight: function appendRight ( content ) {
- this.intro = this.intro + content;
- },
- clone: function clone () {
- var chunk = new Chunk( this.start, this.end, this.original );
- chunk.intro = this.intro;
- chunk.outro = this.outro;
- chunk.content = this.content;
- chunk.storeName = this.storeName;
- chunk.edited = this.edited;
- return chunk;
- },
- contains: function contains ( index ) {
- return this.start < index && index < this.end;
- },
- eachNext: function eachNext ( fn ) {
- var chunk = this;
- while ( chunk ) {
- fn( chunk );
- chunk = chunk.next;
- }
- },
- eachPrevious: function eachPrevious ( fn ) {
- var chunk = this;
- while ( chunk ) {
- fn( chunk );
- chunk = chunk.previous;
- }
- },
- edit: function edit ( content, storeName, contentOnly ) {
- this.content = content;
- if ( !contentOnly ) {
- this.intro = '';
- this.outro = '';
- }
- this.storeName = storeName;
- this.edited = true;
- return this;
- },
- prependLeft: function prependLeft ( content ) {
- this.outro = content + this.outro;
- },
- prependRight: function prependRight ( content ) {
- this.intro = content + this.intro;
- },
- split: function split ( index ) {
- var sliceIndex = index - this.start;
- var originalBefore = this.original.slice( 0, sliceIndex );
- var originalAfter = this.original.slice( sliceIndex );
- this.original = originalBefore;
- var newChunk = new Chunk( index, this.end, originalAfter );
- newChunk.outro = this.outro;
- this.outro = '';
- this.end = index;
- if ( this.edited ) {
-
- newChunk.edit( '', false );
- this.content = '';
- } else {
- this.content = originalBefore;
- }
- newChunk.next = this.next;
- if ( newChunk.next ) { newChunk.next.previous = newChunk; }
- newChunk.previous = this;
- this.next = newChunk;
- return newChunk;
- },
- toString: function toString () {
- return this.intro + this.content + this.outro;
- },
- trimEnd: function trimEnd ( rx ) {
- this.outro = this.outro.replace( rx, '' );
- if ( this.outro.length ) { return true; }
- var trimmed = this.content.replace( rx, '' );
- if ( trimmed.length ) {
- if ( trimmed !== this.content ) {
- this.split( this.start + trimmed.length ).edit( '', false );
- }
- return true;
- } else {
- this.edit( '', false );
- this.intro = this.intro.replace( rx, '' );
- if ( this.intro.length ) { return true; }
- }
- },
- trimStart: function trimStart ( rx ) {
- this.intro = this.intro.replace( rx, '' );
- if ( this.intro.length ) { return true; }
- var trimmed = this.content.replace( rx, '' );
- if ( trimmed.length ) {
- if ( trimmed !== this.content ) {
- this.split( this.end - trimmed.length );
- this.edit( '', false );
- }
- return true;
- } else {
- this.edit( '', false );
- this.outro = this.outro.replace( rx, '' );
- if ( this.outro.length ) { return true; }
- }
- }
- };
- var _btoa;
- if ( typeof window !== 'undefined' && typeof window.btoa === 'function' ) {
- _btoa = window.btoa;
- } else if ( typeof Buffer === 'function' ) {
- _btoa = function (str) { return new Buffer( str ).toString( 'base64' ); };
- } else {
- _btoa = function () {
- throw new Error( 'Unsupported environment: `window.btoa` or `Buffer` should be supported.' );
- };
- }
- var btoa = _btoa;
- function SourceMap ( properties ) {
- this.version = 3;
- this.file = properties.file;
- this.sources = properties.sources;
- this.sourcesContent = properties.sourcesContent;
- this.names = properties.names;
- this.mappings = properties.mappings;
- }
- SourceMap.prototype = {
- toString: function toString () {
- return JSON.stringify( this );
- },
- toUrl: function toUrl () {
- return 'data:application/json;charset=utf-8;base64,' + btoa( this.toString() );
- }
- };
- function guessIndent ( code ) {
- var lines = code.split( '\n' );
- var tabbed = lines.filter( function (line) { return /^\t+/.test( line ); } );
- var spaced = lines.filter( function (line) { return /^ {2,}/.test( line ); } );
- if ( tabbed.length === 0 && spaced.length === 0 ) {
- return null;
- }
-
-
-
- if ( tabbed.length >= spaced.length ) {
- return '\t';
- }
-
- var min = spaced.reduce( function ( previous, current ) {
- var numSpaces = /^ +/.exec( current )[0].length;
- return Math.min( numSpaces, previous );
- }, Infinity );
- return new Array( min + 1 ).join( ' ' );
- }
- function getRelativePath ( from, to ) {
- var fromParts = from.split( /[\/\\]/ );
- var toParts = to.split( /[\/\\]/ );
- fromParts.pop();
- while ( fromParts[0] === toParts[0] ) {
- fromParts.shift();
- toParts.shift();
- }
- if ( fromParts.length ) {
- var i = fromParts.length;
- while ( i-- ) { fromParts[i] = '..'; }
- }
- return fromParts.concat( toParts ).join( '/' );
- }
- var toString$1 = Object.prototype.toString;
- function isObject ( thing ) {
- return toString$1.call( thing ) === '[object Object]';
- }
- function getLocator ( source ) {
- var originalLines = source.split( '\n' );
- var start = 0;
- var lineRanges = originalLines.map( function ( line, i ) {
- var end = start + line.length + 1;
- var range = { start: start, end: end, line: i };
- start = end;
- return range;
- });
- var i = 0;
- function rangeContains ( range, index ) {
- return range.start <= index && index < range.end;
- }
- function getLocation ( range, index ) {
- return { line: range.line, column: index - range.start };
- }
- return function locate ( index ) {
- var range = lineRanges[i];
- var d = index >= range.end ? 1 : -1;
- while ( range ) {
- if ( rangeContains( range, index ) ) { return getLocation( range, index ); }
- i += d;
- range = lineRanges[i];
- }
- };
- }
- function Mappings ( hires ) {
- var this$1 = this;
- var offsets = {
- generatedCodeColumn: 0,
- sourceIndex: 0,
- sourceCodeLine: 0,
- sourceCodeColumn: 0,
- sourceCodeName: 0
- };
- var generatedCodeLine = 0;
- var generatedCodeColumn = 0;
- this.raw = [];
- var rawSegments = this.raw[ generatedCodeLine ] = [];
- var pending = null;
- this.addEdit = function ( sourceIndex, content, original, loc, nameIndex ) {
- if ( content.length ) {
- rawSegments.push([
- generatedCodeColumn,
- sourceIndex,
- loc.line,
- loc.column,
- nameIndex ]);
- } else if ( pending ) {
- rawSegments.push( pending );
- }
- this$1.advance( content );
- pending = null;
- };
- this.addUneditedChunk = function ( sourceIndex, chunk, original, loc, sourcemapLocations ) {
- var originalCharIndex = chunk.start;
- var first = true;
- while ( originalCharIndex < chunk.end ) {
- if ( hires || first || sourcemapLocations[ originalCharIndex ] ) {
- rawSegments.push([
- generatedCodeColumn,
- sourceIndex,
- loc.line,
- loc.column,
- -1
- ]);
- }
- if ( original[ originalCharIndex ] === '\n' ) {
- loc.line += 1;
- loc.column = 0;
- generatedCodeLine += 1;
- this$1.raw[ generatedCodeLine ] = rawSegments = [];
- generatedCodeColumn = 0;
- } else {
- loc.column += 1;
- generatedCodeColumn += 1;
- }
- originalCharIndex += 1;
- first = false;
- }
- pending = [
- generatedCodeColumn,
- sourceIndex,
- loc.line,
- loc.column,
- -1 ];
- };
- this.advance = function (str) {
- if ( !str ) { return; }
- var lines = str.split( '\n' );
- var lastLine = lines.pop();
- if ( lines.length ) {
- generatedCodeLine += lines.length;
- this$1.raw[ generatedCodeLine ] = rawSegments = [];
- generatedCodeColumn = lastLine.length;
- } else {
- generatedCodeColumn += lastLine.length;
- }
- };
- this.encode = function () {
- return this$1.raw.map( function (segments) {
- var generatedCodeColumn = 0;
- return segments.map( function (segment) {
- var arr = [
- segment[0] - generatedCodeColumn,
- segment[1] - offsets.sourceIndex,
- segment[2] - offsets.sourceCodeLine,
- segment[3] - offsets.sourceCodeColumn
- ];
- generatedCodeColumn = segment[0];
- offsets.sourceIndex = segment[1];
- offsets.sourceCodeLine = segment[2];
- offsets.sourceCodeColumn = segment[3];
- if ( ~segment[4] ) {
- arr.push( segment[4] - offsets.sourceCodeName );
- offsets.sourceCodeName = segment[4];
- }
- return encode( arr );
- }).join( ',' );
- }).join( ';' );
- };
- }
- var warned = {
- insertLeft: false,
- insertRight: false,
- storeName: false
- };
- function MagicString$1 ( string, options ) {
- if ( options === void 0 ) options = {};
- var chunk = new Chunk( 0, string.length, string );
- Object.defineProperties( this, {
- original: { writable: true, value: string },
- outro: { writable: true, value: '' },
- intro: { writable: true, value: '' },
- firstChunk: { writable: true, value: chunk },
- lastChunk: { writable: true, value: chunk },
- lastSearchedChunk: { writable: true, value: chunk },
- byStart: { writable: true, value: {} },
- byEnd: { writable: true, value: {} },
- filename: { writable: true, value: options.filename },
- indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
- sourcemapLocations: { writable: true, value: {} },
- storedNames: { writable: true, value: {} },
- indentStr: { writable: true, value: guessIndent( string ) }
- });
- this.byStart[ 0 ] = chunk;
- this.byEnd[ string.length ] = chunk;
- }
- MagicString$1.prototype = {
- addSourcemapLocation: function addSourcemapLocation ( char ) {
- this.sourcemapLocations[ char ] = true;
- },
- append: function append ( content ) {
- if ( typeof content !== 'string' ) { throw new TypeError( 'outro content must be a string' ); }
- this.outro += content;
- return this;
- },
- appendLeft: function appendLeft ( index, content ) {
- if ( typeof content !== 'string' ) { throw new TypeError( 'inserted content must be a string' ); }
- this._split( index );
- var chunk = this.byEnd[ index ];
- if ( chunk ) {
- chunk.appendLeft( content );
- } else {
- this.intro += content;
- }
- return this;
- },
- appendRight: function appendRight ( index, content ) {
- if ( typeof content !== 'string' ) { throw new TypeError( 'inserted content must be a string' ); }
- this._split( index );
- var chunk = this.byStart[ index ];
- if ( chunk ) {
- chunk.appendRight( content );
- } else {
- this.outro += content;
- }
- return this;
- },
- clone: function clone () {
- var cloned = new MagicString$1( this.original, { filename: this.filename });
- var originalChunk = this.firstChunk;
- var clonedChunk = cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone();
- while ( originalChunk ) {
- cloned.byStart[ clonedChunk.start ] = clonedChunk;
- cloned.byEnd[ clonedChunk.end ] = clonedChunk;
- var nextOriginalChunk = originalChunk.next;
- var nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
- if ( nextClonedChunk ) {
- clonedChunk.next = nextClonedChunk;
- nextClonedChunk.previous = clonedChunk;
- clonedChunk = nextClonedChunk;
- }
- originalChunk = nextOriginalChunk;
- }
- cloned.lastChunk = clonedChunk;
- if ( this.indentExclusionRanges ) {
- cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
- }
- Object.keys( this.sourcemapLocations ).forEach( function (loc) {
- cloned.sourcemapLocations[ loc ] = true;
- });
- return cloned;
- },
- generateMap: function generateMap ( options ) {
- var this$1 = this;
- options = options || {};
- var sourceIndex = 0;
- var names = Object.keys( this.storedNames );
- var mappings = new Mappings( options.hires );
- var locate = getLocator( this.original );
- if ( this.intro ) {
- mappings.advance( this.intro );
- }
- this.firstChunk.eachNext( function (chunk) {
- var loc = locate( chunk.start );
- if ( chunk.intro.length ) { mappings.advance( chunk.intro ); }
- if ( chunk.edited ) {
- mappings.addEdit( sourceIndex, chunk.content, chunk.original, loc, chunk.storeName ? names.indexOf( chunk.original ) : -1 );
- } else {
- mappings.addUneditedChunk( sourceIndex, chunk, this$1.original, loc, this$1.sourcemapLocations );
- }
- if ( chunk.outro.length ) { mappings.advance( chunk.outro ); }
- });
- var map = new SourceMap({
- file: ( options.file ? options.file.split( /[\/\\]/ ).pop() : null ),
- sources: [ options.source ? getRelativePath( options.file || '', options.source ) : null ],
- sourcesContent: options.includeContent ? [ this.original ] : [ null ],
- names: names,
- mappings: mappings.encode()
- });
- return map;
- },
- getIndentString: function getIndentString () {
- return this.indentStr === null ? '\t' : this.indentStr;
- },
- indent: function indent ( indentStr, options ) {
- var this$1 = this;
- var pattern = /^[^\r\n]/gm;
- if ( isObject( indentStr ) ) {
- options = indentStr;
- indentStr = undefined;
- }
- indentStr = indentStr !== undefined ? indentStr : ( this.indentStr || '\t' );
- if ( indentStr === '' ) { return this; }
- options = options || {};
-
- var isExcluded = {};
- if ( options.exclude ) {
- var exclusions = typeof options.exclude[0] === 'number' ? [ options.exclude ] : options.exclude;
- exclusions.forEach( function (exclusion) {
- for ( var i = exclusion[0]; i < exclusion[1]; i += 1 ) {
- isExcluded[i] = true;
- }
- });
- }
- var shouldIndentNextCharacter = options.indentStart !== false;
- var replacer = function (match) {
- if ( shouldIndentNextCharacter ) { return ("" + indentStr + match); }
- shouldIndentNextCharacter = true;
- return match;
- };
- this.intro = this.intro.replace( pattern, replacer );
- var charIndex = 0;
- var chunk = this.firstChunk;
- while ( chunk ) {
- var end = chunk.end;
- if ( chunk.edited ) {
- if ( !isExcluded[ charIndex ] ) {
- chunk.content = chunk.content.replace( pattern, replacer );
- if ( chunk.content.length ) {
- shouldIndentNextCharacter = chunk.content[ chunk.content.length - 1 ] === '\n';
- }
- }
- } else {
- charIndex = chunk.start;
- while ( charIndex < end ) {
- if ( !isExcluded[ charIndex ] ) {
- var char = this$1.original[ charIndex ];
- if ( char === '\n' ) {
- shouldIndentNextCharacter = true;
- } else if ( char !== '\r' && shouldIndentNextCharacter ) {
- shouldIndentNextCharacter = false;
- if ( charIndex === chunk.start ) {
- chunk.prependRight( indentStr );
- } else {
- this$1._splitChunk( chunk, charIndex );
- chunk = chunk.next;
- chunk.prependRight( indentStr );
- }
- }
- }
- charIndex += 1;
- }
- }
- charIndex = chunk.end;
- chunk = chunk.next;
- }
- this.outro = this.outro.replace( pattern, replacer );
- return this;
- },
- insert: function insert () {
- throw new Error( 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)' );
- },
- insertLeft: function insertLeft ( index, content ) {
- if ( !warned.insertLeft ) {
- console.warn( 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead' );
- warned.insertLeft = true;
- }
- return this.appendLeft( index, content );
- },
- insertRight: function insertRight ( index, content ) {
- if ( !warned.insertRight ) {
- console.warn( 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead' );
- warned.insertRight = true;
- }
- return this.prependRight( index, content );
- },
- move: function move ( start, end, index ) {
- if ( index >= start && index <= end ) { throw new Error( 'Cannot move a selection inside itself' ); }
- this._split( start );
- this._split( end );
- this._split( index );
- var first = this.byStart[ start ];
- var last = this.byEnd[ end ];
- var oldLeft = first.previous;
- var oldRight = last.next;
- var newRight = this.byStart[ index ];
- if ( !newRight && last === this.lastChunk ) { return this; }
- var newLeft = newRight ? newRight.previous : this.lastChunk;
- if ( oldLeft ) { oldLeft.next = oldRight; }
- if ( oldRight ) { oldRight.previous = oldLeft; }
- if ( newLeft ) { newLeft.next = first; }
- if ( newRight ) { newRight.previous = last; }
- if ( !first.previous ) { this.firstChunk = last.next; }
- if ( !last.next ) {
- this.lastChunk = first.previous;
- this.lastChunk.next = null;
- }
- first.previous = newLeft;
- last.next = newRight || null;
- if ( !newLeft ) { this.firstChunk = first; }
- if ( !newRight ) { this.lastChunk = last; }
- return this;
- },
- overwrite: function overwrite ( start, end, content, options ) {
- var this$1 = this;
- if ( typeof content !== 'string' ) { throw new TypeError( 'replacement content must be a string' ); }
- while ( start < 0 ) { start += this$1.original.length; }
- while ( end < 0 ) { end += this$1.original.length; }
- if ( end > this.original.length ) { throw new Error( 'end is out of bounds' ); }
- if ( start === end ) { throw new Error( 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead' ); }
- this._split( start );
- this._split( end );
- if ( options === true ) {
- if ( !warned.storeName ) {
- console.warn( 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string' );
- warned.storeName = true;
- }
- options = { storeName: true };
- }
- var storeName = options !== undefined ? options.storeName : false;
- var contentOnly = options !== undefined ? options.contentOnly : false;
- if ( storeName ) {
- var original = this.original.slice( start, end );
- this.storedNames[ original ] = true;
- }
- var first = this.byStart[ start ];
- var last = this.byEnd[ end ];
- if ( first ) {
- if ( end > first.end && first.next !== this.byStart[ first.end ] ) {
- throw new Error( 'Cannot overwrite across a split point' );
- }
- first.edit( content, storeName, contentOnly );
- if ( first !== last ) {
- var chunk = first.next;
- while ( chunk !== last ) {
- chunk.edit( '', false );
- chunk = chunk.next;
- }
- chunk.edit( '', false );
- }
- }
- else {
-
- var newChunk = new Chunk( start, end, '' ).edit( content, storeName );
-
- last.next = newChunk;
- newChunk.previous = last;
- }
- return this;
- },
- prepend: function prepend ( content ) {
- if ( typeof content !== 'string' ) { throw new TypeError( 'outro content must be a string' ); }
- this.intro = content + this.intro;
- return this;
- },
- prependLeft: function prependLeft ( index, content ) {
- if ( typeof content !== 'string' ) { throw new TypeError( 'inserted content must be a string' ); }
- this._split( index );
- var chunk = this.byEnd[ index ];
- if ( chunk ) {
- chunk.prependLeft( content );
- } else {
- this.intro = content + this.intro;
- }
- return this;
- },
- prependRight: function prependRight ( index, content ) {
- if ( typeof content !== 'string' ) { throw new TypeError( 'inserted content must be a string' ); }
- this._split( index );
- var chunk = this.byStart[ index ];
- if ( chunk ) {
- chunk.prependRight( content );
- } else {
- this.outro = content + this.outro;
- }
- return this;
- },
- remove: function remove ( start, end ) {
- var this$1 = this;
- while ( start < 0 ) { start += this$1.original.length; }
- while ( end < 0 ) { end += this$1.original.length; }
- if ( start === end ) { return this; }
- if ( start < 0 || end > this.original.length ) { throw new Error( 'Character is out of bounds' ); }
- if ( start > end ) { throw new Error( 'end must be greater than start' ); }
- this._split( start );
- this._split( end );
- var chunk = this.byStart[ start ];
- while ( chunk ) {
- chunk.intro = '';
- chunk.outro = '';
- chunk.edit( '' );
- chunk = end > chunk.end ? this$1.byStart[ chunk.end ] : null;
- }
- return this;
- },
- slice: function slice ( start, end ) {
- var this$1 = this;
- if ( start === void 0 ) start = 0;
- if ( end === void 0 ) end = this.original.length;
- while ( start < 0 ) { start += this$1.original.length; }
- while ( end < 0 ) { end += this$1.original.length; }
- var result = '';
-
- var chunk = this.firstChunk;
- while ( chunk && ( chunk.start > start || chunk.end <= start ) ) {
-
- if ( chunk.start < end && chunk.end >= end ) {
- return result;
- }
- chunk = chunk.next;
- }
- if ( chunk && chunk.edited && chunk.start !== start ) { throw new Error(("Cannot use replaced character " + start + " as slice start anchor.")); }
- var startChunk = chunk;
- while ( chunk ) {
- if ( chunk.intro && ( startChunk !== chunk || chunk.start === start ) ) {
- result += chunk.intro;
- }
- var containsEnd = chunk.start < end && chunk.end >= end;
- if ( containsEnd && chunk.edited && chunk.end !== end ) { throw new Error(("Cannot use replaced character " + end + " as slice end anchor.")); }
- var sliceStart = startChunk === chunk ? start - chunk.start : 0;
- var sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
- result += chunk.content.slice( sliceStart, sliceEnd );
- if ( chunk.outro && ( !containsEnd || chunk.end === end ) ) {
- result += chunk.outro;
- }
- if ( containsEnd ) {
- break;
- }
- chunk = chunk.next;
- }
- return result;
- },
-
- snip: function snip ( start, end ) {
- var clone = this.clone();
- clone.remove( 0, start );
- clone.remove( end, clone.original.length );
- return clone;
- },
- _split: function _split ( index ) {
- var this$1 = this;
- if ( this.byStart[ index ] || this.byEnd[ index ] ) { return; }
- var chunk = this.lastSearchedChunk;
- var searchForward = index > chunk.end;
- while ( true ) {
- if ( chunk.contains( index ) ) { return this$1._splitChunk( chunk, index ); }
- chunk = searchForward ?
- this$1.byStart[ chunk.end ] :
- this$1.byEnd[ chunk.start ];
- }
- },
- _splitChunk: function _splitChunk ( chunk, index ) {
- if ( chunk.edited && chunk.content.length ) {
- var loc = getLocator( this.original )( index );
- throw new Error( ("Cannot split a chunk that has already been edited (" + (loc.line) + ":" + (loc.column) + " – \"" + (chunk.original) + "\")") );
- }
- var newChunk = chunk.split( index );
- this.byEnd[ index ] = chunk;
- this.byStart[ index ] = newChunk;
- this.byEnd[ newChunk.end ] = newChunk;
- if ( chunk === this.lastChunk ) { this.lastChunk = newChunk; }
- this.lastSearchedChunk = chunk;
- return true;
- },
- toString: function toString () {
- var str = this.intro;
- var chunk = this.firstChunk;
- while ( chunk ) {
- str += chunk.toString();
- chunk = chunk.next;
- }
- return str + this.outro;
- },
- trimLines: function trimLines () {
- return this.trim('[\\r\\n]');
- },
- trim: function trim ( charType ) {
- return this.trimStart( charType ).trimEnd( charType );
- },
- trimEnd: function trimEnd ( charType ) {
- var this$1 = this;
- var rx = new RegExp( ( charType || '\\s' ) + '+$' );
- this.outro = this.outro.replace( rx, '' );
- if ( this.outro.length ) { return this; }
- var chunk = this.lastChunk;
- do {
- var end = chunk.end;
- var aborted = chunk.trimEnd( rx );
-
- if ( chunk.end !== end ) {
- if ( this$1.lastChunk === chunk ) {
- this$1.lastChunk = chunk.next;
- }
- this$1.byEnd[ chunk.end ] = chunk;
- this$1.byStart[ chunk.next.start ] = chunk.next;
- this$1.byEnd[ chunk.next.end ] = chunk.next;
- }
- if ( aborted ) { return this$1; }
- chunk = chunk.previous;
- } while ( chunk );
- return this;
- },
- trimStart: function trimStart ( charType ) {
- var this$1 = this;
- var rx = new RegExp( '^' + ( charType || '\\s' ) + '+' );
- this.intro = this.intro.replace( rx, '' );
- if ( this.intro.length ) { return this; }
- var chunk = this.firstChunk;
- do {
- var end = chunk.end;
- var aborted = chunk.trimStart( rx );
- if ( chunk.end !== end ) {
-
- if ( chunk === this$1.lastChunk ) { this$1.lastChunk = chunk.next; }
- this$1.byEnd[ chunk.end ] = chunk;
- this$1.byStart[ chunk.next.start ] = chunk.next;
- this$1.byEnd[ chunk.next.end ] = chunk.next;
- }
- if ( aborted ) { return this$1; }
- chunk = chunk.next;
- } while ( chunk );
- return this;
- }
- };
- function toJSON(node) {
- var obj = {};
- Object.keys(node).forEach(function (key) {
- if (
- key === 'parent' ||
- key === 'program' ||
- key === 'keys' ||
- key === '__wrapped'
- )
- { return; }
- if (Array.isArray(node[key])) {
- obj[key] = node[key].map(toJSON);
- } else if (node[key] && node[key].toJSON) {
- obj[key] = node[key].toJSON();
- } else {
- obj[key] = node[key];
- }
- });
- return obj;
- }
- var Node$1 = function Node () {};
- Node$1.prototype.ancestor = function ancestor (level) {
- var node = this;
- while (level--) {
- node = node.parent;
- if (!node) { return null; }
- }
- return node;
- };
- Node$1.prototype.contains = function contains (node) {
- while (node) {
- if (node === this) { return true; }
- node = node.parent;
- }
- return false;
- };
- Node$1.prototype.findLexicalBoundary = function findLexicalBoundary () {
- return this.parent.findLexicalBoundary();
- };
- Node$1.prototype.findNearest = function findNearest (type) {
- if (typeof type === 'string') { type = new RegExp(("^" + type + "$")); }
- if (type.test(this.type)) { return this; }
- return this.parent.findNearest(type);
- };
- Node$1.prototype.unparenthesizedParent = function unparenthesizedParent () {
- var node = this.parent;
- while (node && node.type === 'ParenthesizedExpression') {
- node = node.parent;
- }
- return node;
- };
- Node$1.prototype.unparenthesize = function unparenthesize () {
- var node = this;
- while (node.type === 'ParenthesizedExpression') {
- node = node.expression;
- }
- return node;
- };
- Node$1.prototype.findScope = function findScope (functionScope) {
- return this.parent.findScope(functionScope);
- };
- Node$1.prototype.getIndentation = function getIndentation () {
- return this.parent.getIndentation();
- };
- Node$1.prototype.initialise = function initialise (transforms) {
- for (var i = 0, list = this.keys; i < list.length; i += 1) {
- var key = list[i];
- var value = this[key];
- if (Array.isArray(value)) {
- value.forEach(function (node) { return node && node.initialise(transforms); });
- } else if (value && typeof value === 'object') {
- value.initialise(transforms);
- }
- }
- };
- Node$1.prototype.toJSON = function toJSON$1 () {
- return toJSON(this);
- };
- Node$1.prototype.toString = function toString () {
- return this.program.magicString.original.slice(this.start, this.end);
- };
- Node$1.prototype.transpile = function transpile (code, transforms) {
- for (var i = 0, list = this.keys; i < list.length; i += 1) {
- var key = list[i];
- var value = this[key];
- if (Array.isArray(value)) {
- value.forEach(function (node) { return node && node.transpile(code, transforms); });
- } else if (value && typeof value === 'object') {
- value.transpile(code, transforms);
- }
- }
- };
- function extractNames(node) {
- var names = [];
- extractors[node.type](names, node);
- return names;
- }
- var extractors = {
- Identifier: function Identifier(names, node) {
- names.push(node);
- },
- ObjectPattern: function ObjectPattern(names, node) {
- for (var i = 0, list = node.properties; i < list.length; i += 1) {
- var prop = list[i];
- extractors[prop.type](names, prop);
- }
- },
- Property: function Property(names, node) {
- extractors[node.value.type](names, node.value);
- },
- ArrayPattern: function ArrayPattern(names, node) {
- for (var i = 0, list = node.elements; i < list.length; i += 1) {
- var element = list[i];
- if (element) { extractors[element.type](names, element); }
- }
- },
- RestElement: function RestElement(names, node) {
- extractors[node.argument.type](names, node.argument);
- },
- AssignmentPattern: function AssignmentPattern(names, node) {
- extractors[node.left.type](names, node.left);
- }
- };
- var reserved = Object.create(null);
- 'do if in for let new try var case else enum eval null this true void with await break catch class const false super throw while yield delete export import public return static switch typeof default extends finally package private continue debugger function arguments interface protected implements instanceof'
- .split(' ')
- .forEach(function (word) { return (reserved[word] = true); });
- function Scope(options) {
- options = options || {};
- this.parent = options.parent;
- this.isBlockScope = !!options.block;
- this.createDeclarationCallback = options.declare;
- var scope = this;
- while (scope.isBlockScope) { scope = scope.parent; }
- this.functionScope = scope;
- this.identifiers = [];
- this.declarations = Object.create(null);
- this.references = Object.create(null);
- this.blockScopedDeclarations = this.isBlockScope ? null : Object.create(null);
- this.aliases = Object.create(null);
- }
- Scope.prototype = {
- addDeclaration: function addDeclaration(node, kind) {
- for (var i = 0, list = extractNames(node); i < list.length; i += 1) {
- var identifier = list[i];
- var name = identifier.name;
- var declaration = { name: name, node: identifier, kind: kind, instances: [] };
- this.declarations[name] = declaration;
- if (this.isBlockScope) {
- if (!this.functionScope.blockScopedDeclarations[name])
- { this.functionScope.blockScopedDeclarations[name] = []; }
- this.functionScope.blockScopedDeclarations[name].push(declaration);
- }
- }
- },
- addReference: function addReference(identifier) {
- if (this.consolidated) {
- this.consolidateReference(identifier);
- } else {
- this.identifiers.push(identifier);
- }
- },
- consolidate: function consolidate() {
- for (var i = 0; i < this.identifiers.length; i += 1) {
-
- var identifier = this.identifiers[i];
- this.consolidateReference(identifier);
- }
- this.consolidated = true;
- },
- consolidateReference: function consolidateReference(identifier) {
- var declaration = this.declarations[identifier.name];
- if (declaration) {
- declaration.instances.push(identifier);
- } else {
- this.references[identifier.name] = true;
- if (this.parent) { this.parent.addReference(identifier); }
- }
- },
- contains: function contains(name) {
- return (
- this.declarations[name] ||
- (this.parent ? this.parent.contains(name) : false)
- );
- },
- createIdentifier: function createIdentifier(base) {
- if (typeof base === 'number') { base = base.toString(); }
- base = base
- .replace(/\s/g, '')
- .replace(/\[([^\]]+)\]/g, '_$1')
- .replace(/[^a-zA-Z0-9_$]/g, '_')
- .replace(/_{2,}/, '_');
- var name = base;
- var counter = 1;
- while (
- this.declarations[name] ||
- this.references[name] ||
- this.aliases[name] ||
- name in reserved
- ) {
- name = base + "$" + (counter++);
- }
- this.aliases[name] = true;
- return name;
- },
- createDeclaration: function createDeclaration(base) {
- var id = this.createIdentifier(base);
- this.createDeclarationCallback(id);
- return id;
- },
- findDeclaration: function findDeclaration(name) {
- return (
- this.declarations[name] ||
- (this.parent && this.parent.findDeclaration(name))
- );
- },
-
- resolveName: function resolveName(name) {
- var declaration = this.findDeclaration(name);
- return declaration ? declaration.name : name;
- }
- };
- function locate(source, index) {
- var lines = source.split('\n');
- var len = lines.length;
- var lineStart = 0;
- var i;
- for (i = 0; i < len; i += 1) {
- var line = lines[i];
- var lineEnd = lineStart + line.length + 1;
- if (lineEnd > index) {
- return { line: i + 1, column: index - lineStart, char: i };
- }
- lineStart = lineEnd;
- }
- throw new Error('Could not determine location of character');
- }
- function pad(num, len) {
- var result = String(num);
- return result + repeat(' ', len - result.length);
- }
- function repeat(str, times) {
- var result = '';
- while (times--) { result += str; }
- return result;
- }
- function getSnippet(source, loc, length) {
- if ( length === void 0 ) length = 1;
- var first = Math.max(loc.line - 5, 0);
- var last = loc.line;
- var numDigits = String(last).length;
- var lines = source.split('\n').slice(first, last);
- var lastLine = lines[lines.length - 1];
- var offset = lastLine.slice(0, loc.column).replace(/\t/g, ' ').length;
- var snippet = lines
- .map(function (line, i) { return ((pad(i + first + 1, numDigits)) + " : " + (line.replace(/\t/g, ' '))); })
- .join('\n');
- snippet += '\n' + repeat(' ', numDigits + 3 + offset) + repeat('^', length);
- return snippet;
- }
- var CompileError = (function (Error) {
- function CompileError(message, node) {
- Error.call(this, message);
- this.name = 'CompileError';
- if (!node) {
- return;
- }
- var source = node.program.magicString.original;
- var loc = locate(source, node.start);
- this.message = message + " (" + (loc.line) + ":" + (loc.column) + ")";
- this.stack = new Error().stack.replace(
- new RegExp((".+new " + (this.name) + ".+\\n"), 'm'),
- ''
- );
- this.loc = loc;
- this.snippet = getSnippet(source, loc, node.end - node.start);
- }
- if ( Error ) CompileError.__proto__ = Error;
- CompileError.prototype = Object.create( Error && Error.prototype );
- CompileError.prototype.constructor = CompileError;
- CompileError.prototype.toString = function toString () {
- return ((this.name) + ": " + (this.message) + "\n" + (this.snippet));
- };
- return CompileError;
- }(Error));
- function findIndex(array, fn) {
- for (var i = 0; i < array.length; i += 1) {
- if (fn(array[i], i)) { return i; }
- }
- return -1;
- }
- var handlers = {
- Identifier: destructureIdentifier,
- AssignmentPattern: destructureAssignmentPattern,
- ArrayPattern: destructureArrayPattern,
- ObjectPattern: destructureObjectPattern
- };
- function destructure(
- code,
- createIdentifier,
- resolveName,
- node,
- ref,
- inline,
- statementGenerators
- ) {
- handlers[node.type](code, createIdentifier, resolveName, node, ref, inline, statementGenerators);
- }
- function destructureIdentifier(
- code,
- createIdentifier,
- resolveName,
- node,
- ref,
- inline,
- statementGenerators
- ) {
- statementGenerators.push(function (start, prefix, suffix) {
- code.overwrite(node.start, node.end, (inline ? prefix : (prefix + "var ")) + resolveName(node) + " = " + ref + suffix);
- code.move(node.start, node.end, start);
- });
- }
- function destructureMemberExpression(
- code,
- createIdentifier,
- resolveName,
- node,
- ref,
- inline,
- statementGenerators
- ) {
- statementGenerators.push(function (start, prefix, suffix) {
- code.prependRight(node.start, inline ? prefix : (prefix + "var "));
- code.appendLeft(node.end, (" = " + ref + suffix));
- code.move(node.start, node.end, start);
- });
- }
- function destructureAssignmentPattern(
- code,
- createIdentifier,
- resolveName,
- node,
- ref,
- inline,
- statementGenerators
- ) {
- var isIdentifier = node.left.type === 'Identifier';
- var name = isIdentifier ? node.left.name : ref;
- if (!inline) {
- statementGenerators.push(function (start, prefix, suffix) {
- code.prependRight(
- node.left.end,
- (prefix + "if ( " + name + " === void 0 ) " + name)
- );
- code.move(node.left.end, node.right.end, start);
- code.appendLeft(node.right.end, suffix);
- });
- }
- if (!isIdentifier) {
- destructure(code, createIdentifier, resolveName, node.left, ref, inline, statementGenerators);
- }
- }
- function destructureArrayPattern(
- code,
- createIdentifier,
- resolveName,
- node,
- ref,
- inline,
- statementGenerators
- ) {
- var c = node.start;
- node.elements.forEach(function (element, i) {
- if (!element) { return; }
- if (element.type === 'RestElement') {
- handleProperty(
- code,
- createIdentifier,
- resolveName,
- c,
- element.argument,
- (ref + ".slice(" + i + ")"),
- inline,
- statementGenerators
- );
- } else {
- handleProperty(
- code,
- createIdentifier,
- resolveName,
- c,
- element,
- (ref + "[" + i + "]"),
- inline,
- statementGenerators
- );
- }
- c = element.end;
- });
- code.remove(c, node.end);
- }
- function destructureObjectPattern(
- code,
- createIdentifier,
- resolveName,
- node,
- ref,
- inline,
- statementGenerators
- ) {
- var this$1 = this;
- var c = node.start;
- var nonRestKeys = [];
- node.properties.forEach(function (prop) {
- var value;
- var content;
- if (prop.type === 'Property') {
- var isComputedKey = prop.computed || prop.key.type !== 'Identifier';
- var key = isComputedKey
- ? code.slice(prop.key.start, prop.key.end)
- : prop.key.name;
- value = isComputedKey ? (ref + "[" + key + "]") : (ref + "." + key);
- content = prop.value;
- nonRestKeys.push(isComputedKey ? key : '"' + key + '"');
- } else if (prop.type === 'RestElement') {
- content = prop.argument;
- value = createIdentifier('rest');
- statementGenerators.push(function (start, prefix, suffix) {
- var helper = prop.program.getObjectWithoutPropertiesHelper(code);
- code.overwrite(
- prop.start,
- (c = prop.argument.start),
- (inline ? prefix : (prefix + "var ")) + value + " = " + helper + "( " + ref + ", [" + (nonRestKeys.join(', ')) + "] )" + suffix
- );
- code.move(prop.start, c, start);
- });
- } else {
- throw new CompileError(
- this$1,
- ("Unexpected node of type " + (prop.type) + " in object pattern")
- );
- }
- handleProperty(code, createIdentifier, resolveName, c, content, value, inline, statementGenerators);
- c = prop.end;
- });
- code.remove(c, node.end);
- }
- function handleProperty(
- code,
- createIdentifier,
- resolveName,
- c,
- node,
- value,
- inline,
- statementGenerators
- ) {
- switch (node.type) {
- case 'Identifier': {
- code.remove(c, node.start);
- destructureIdentifier(
- code,
- createIdentifier,
- resolveName,
- node,
- value,
- inline,
- statementGenerators
- );
- break;
- }
- case 'MemberExpression':
- code.remove(c, node.start);
- destructureMemberExpression(
- code,
- createIdentifier,
- resolveName,
- node,
- value,
- true,
- statementGenerators
- );
- break;
- case 'AssignmentPattern': {
- var name;
- var isIdentifier = node.left.type === 'Identifier';
- if (isIdentifier) {
- name = resolveName(node.left);
- } else {
- name = createIdentifier(value);
- }
- statementGenerators.push(function (start, prefix, suffix) {
- if (inline) {
- code.prependRight(
- node.right.start,
- (name + " = " + value + ", " + name + " = " + name + " === void 0 ? ")
- );
- code.appendLeft(node.right.end, (" : " + name + suffix));
- } else {
- code.prependRight(
- node.right.start,
- (prefix + "var " + name + " = " + value + "; if ( " + name + " === void 0 ) " + name + " = ")
- );
- code.appendLeft(node.right.end, suffix);
- }
- code.move(node.right.start, node.right.end, start);
- });
- if (isIdentifier) {
- code.remove(c, node.right.start);
- } else {
- code.remove(c, node.left.start);
- code.remove(node.left.end, node.right.start);
- handleProperty(
- code,
- createIdentifier,
- resolveName,
- c,
- node.left,
- name,
- inline,
- statementGenerators
- );
- }
- break;
- }
- case 'ObjectPattern': {
- code.remove(c, (c = node.start));
- var ref = value;
- if (node.properties.length > 1) {
- ref = createIdentifier(value);
- statementGenerators.push(function (start, prefix, suffix) {
-
-
- code.prependRight(node.start, (inline ? '' : (prefix + "var ")) + ref + " = ");
- code.overwrite(node.start, (c = node.start + 1), value);
- code.appendLeft(c, suffix);
- code.overwrite(
- node.start,
- (c = node.start + 1),
- (inline ? '' : (prefix + "var ")) + ref + " = " + value + suffix
- );
- code.move(node.start, c, start);
- });
- }
- destructureObjectPattern(
- code,
- createIdentifier,
- resolveName,
- node,
- ref,
- inline,
- statementGenerators
- );
- break;
- }
- case 'ArrayPattern': {
- code.remove(c, (c = node.start));
- if (node.elements.filter(Boolean).length > 1) {
- var ref$1 = createIdentifier(value);
- statementGenerators.push(function (start, prefix, suffix) {
- code.prependRight(node.start, (inline ? '' : (prefix + "var ")) + ref$1 + " = ");
- code.overwrite(node.start, (c = node.start + 1), value, {
- contentOnly: true
- });
- code.appendLeft(c, suffix);
- code.move(node.start, c, start);
- });
- node.elements.forEach(function (element, i) {
- if (!element) { return; }
- if (element.type === 'RestElement') {
- handleProperty(
- code,
- createIdentifier,
- resolveName,
- c,
- element.argument,
- (ref$1 + ".slice(" + i + ")"),
- inline,
- statementGenerators
- );
- } else {
- handleProperty(
- code,
- createIdentifier,
- resolveName,
- c,
- element,
- (ref$1 + "[" + i + "]"),
- inline,
- statementGenerators
- );
- }
- c = element.end;
- });
- } else {
- var index = findIndex(node.elements, Boolean);
- var element = node.elements[index];
- if (element.type === 'RestElement') {
- handleProperty(
- code,
- createIdentifier,
- resolveName,
- c,
- element.argument,
- (value + ".slice(" + index + ")"),
- inline,
- statementGenerators
- );
- } else {
- handleProperty(
- code,
- createIdentifier,
- resolveName,
- c,
- element,
- (value + "[" + index + "]"),
- inline,
- statementGenerators
- );
- }
- c = element.end;
- }
- code.remove(c, node.end);
- break;
- }
- default: {
- throw new Error(("Unexpected node type in destructuring (" + (node.type) + ")"));
- }
- }
- }
- function isUseStrict(node) {
- if (!node) { return false; }
- if (node.type !== 'ExpressionStatement') { return false; }
- if (node.expression.type !== 'Literal') { return false; }
- return node.expression.value === 'use strict';
- }
- var BlockStatement = (function (Node) {
- function BlockStatement () {
- Node.apply(this, arguments);
- }
- if ( Node ) BlockStatement.__proto__ = Node;
- BlockStatement.prototype = Object.create( Node && Node.prototype );
- BlockStatement.prototype.constructor = BlockStatement;
- BlockStatement.prototype.createScope = function createScope () {
- var this$1 = this;
- this.parentIsFunction = /Function/.test(this.parent.type);
- this.isFunctionBlock = this.parentIsFunction || this.parent.type === 'Root';
- this.scope = new Scope({
- block: !this.isFunctionBlock,
- parent: this.parent.findScope(false),
- declare: function (id) { return this$1.createdDeclarations.push(id); }
- });
- if (this.parentIsFunction) {
- this.parent.params.forEach(function (node) {
- this$1.scope.addDeclaration(node, 'param');
- });
- }
- };
- BlockStatement.prototype.initialise = function initialise (transforms) {
- this.thisAlias = null;
- this.argumentsAlias = null;
- this.defaultParameters = [];
- this.createdDeclarations = [];
-
-
-
-
- if (!this.scope) { this.createScope(); }
- this.body.forEach(function (node) { return node.initialise(transforms); });
- this.scope.consolidate();
- };
- BlockStatement.prototype.findLexicalBoundary = function findLexicalBoundary () {
- if (this.type === 'Program') { return this; }
- if (/^Function/.test(this.parent.type)) { return this; }
- return this.parent.findLexicalBoundary();
- };
- BlockStatement.prototype.findScope = function findScope (functionScope) {
- if (functionScope && !this.isFunctionBlock)
- { return this.parent.findScope(functionScope); }
- return this.scope;
- };
- BlockStatement.prototype.getArgumentsAlias = function getArgumentsAlias () {
- if (!this.argumentsAlias) {
- this.argumentsAlias = this.scope.createIdentifier('arguments');
- }
- return this.argumentsAlias;
- };
- BlockStatement.prototype.getArgumentsArrayAlias = function getArgumentsArrayAlias () {
- if (!this.argumentsArrayAlias) {
- this.argumentsArrayAlias = this.scope.createIdentifier('argsArray');
- }
- return this.argumentsArrayAlias;
- };
- BlockStatement.prototype.getThisAlias = function getThisAlias () {
- if (!this.thisAlias) {
- this.thisAlias = this.scope.createIdentifier('this');
- }
- return this.thisAlias;
- };
- BlockStatement.prototype.getIndentation = function getIndentation () {
- if (this.indentation === undefined) {
- var source = this.program.magicString.original;
- var useOuter = this.synthetic || !this.body.length;
- var c = useOuter ? this.start : this.body[0].start;
- while (c && source[c] !== '\n') { c -= 1; }
- this.indentation = '';
-
- while (true) {
- c += 1;
- var char = source[c];
- if (char !== ' ' && char !== '\t') { break; }
- this.indentation += char;
- }
- var indentString = this.program.magicString.getIndentString();
-
- var parent = this.parent;
- while (parent) {
- if (parent.kind === 'constructor' && !parent.parent.parent.superClass) {
- this.indentation = this.indentation.replace(indentString, '');
- }
- parent = parent.parent;
- }
- if (useOuter) { this.indentation += indentString; }
- }
- return this.indentation;
- };
- BlockStatement.prototype.transpile = function transpile (code, transforms) {
- var this$1 = this;
- var indentation = this.getIndentation();
- var introStatementGenerators = [];
- if (this.argumentsAlias) {
- introStatementGenerators.push(function (start, prefix, suffix) {
- var assignment = prefix + "var " + (this$1.argumentsAlias) + " = arguments" + suffix;
- code.appendLeft(start, assignment);
- });
- }
- if (this.thisAlias) {
- introStatementGenerators.push(function (start, prefix, suffix) {
- var assignment = prefix + "var " + (this$1.thisAlias) + " = this" + suffix;
- code.appendLeft(start, assignment);
- });
- }
- if (this.argumentsArrayAlias) {
- introStatementGenerators.push(function (start, prefix, suffix) {
- var i = this$1.scope.createIdentifier('i');
- var assignment = prefix + "var " + i + " = arguments.length, " + (this$1.argumentsArrayAlias) + " = Array(" + i + ");\n" + indentation + "while ( " + i + "-- ) " + (this$1.argumentsArrayAlias) + "[" + i + "] = arguments[" + i + "]" + suffix;
- code.appendLeft(start, assignment);
- });
- }
- if (/Function/.test(this.parent.type)) {
- this.transpileParameters(
- this.parent.params,
- code,
- transforms,
- indentation,
- introStatementGenerators
- );
- } else if ('CatchClause' === this.parent.type) {
- this.transpileParameters(
- [this.parent.param],
- code,
- transforms,
- indentation,
- introStatementGenerators
- );
- }
- if (transforms.letConst && this.isFunctionBlock) {
- this.transpileBlockScopedIdentifiers(code);
- }
- Node.prototype.transpile.call(this, code, transforms);
- if (this.createdDeclarations.length) {
- introStatementGenerators.push(function (start, prefix, suffix) {
- var assignment = prefix + "var " + (this$1.createdDeclarations.join(', ')) + suffix;
- code.appendLeft(start, assignment);
- });
- }
- if (this.synthetic) {
- if (this.parent.type === 'ArrowFunctionExpression') {
- var expr = this.body[0];
- if (introStatementGenerators.length) {
- code
- .appendLeft(this.start, "{")
- .prependRight(this.end, ((this.parent.getIndentation()) + "}"));
- code.prependRight(expr.start, ("\n" + indentation + "return "));
- code.appendLeft(expr.end, ";\n");
- } else if (transforms.arrow) {
- code.prependRight(expr.start, "{ return ");
- code.appendLeft(expr.end, "; }");
- }
- } else if (introStatementGenerators.length) {
- code.prependRight(this.start, "{").appendLeft(this.end, "}");
- }
- }
- var start;
- if (isUseStrict(this.body[0])) {
- start = this.body[0].end;
- } else if (this.synthetic || this.parent.type === 'Root') {
- start = this.start;
- } else {
- start = this.start + 1;
- }
- var prefix = "\n" + indentation;
- var suffix = ';';
- introStatementGenerators.forEach(function (fn, i) {
- if (i === introStatementGenerators.length - 1) { suffix = ";\n"; }
- fn(start, prefix, suffix);
- });
- };
- BlockStatement.prototype.transpileParameters = function transpileParameters (params, code, transforms, indentation, introStatementGenerators) {
- var this$1 = this;
- params.forEach(function (param) {
- if (
- param.type === 'AssignmentPattern' &&
- param.left.type === 'Identifier'
- ) {
- if (transforms.defaultParameter) {
- introStatementGenerators.push(function (start, prefix, suffix) {
- var lhs = prefix + "if ( " + (param.left.name) + " === void 0 ) " + (param.left.name);
- code
- .prependRight(param.left.end, lhs)
- .move(param.left.end, param.right.end, start)
- .appendLeft(param.right.end, suffix);
- });
- }
- } else if (param.type === 'RestElement') {
- if (transforms.spreadRest) {
- introStatementGenerators.push(function (start, prefix, suffix) {
- var penultimateParam = params[params.length - 2];
- if (penultimateParam) {
- code.remove(
- penultimateParam ? penultimateParam.end : param.start,
- param.end
- );
- } else {
- var start$1 = param.start,
- end = param.end;
- while (/\s/.test(code.original[start$1 - 1])) { start$1 -= 1; }
- while (/\s/.test(code.original[end])) { end += 1; }
- code.remove(start$1, end);
- }
- var name = param.argument.name;
- var len = this$1.scope.createIdentifier('len');
- var count = params.length - 1;
- if (count) {
- code.prependRight(
- start,
- (prefix + "var " + name + " = [], " + len + " = arguments.length - " + count + ";\n" + indentation + "while ( " + len + "-- > 0 ) " + name + "[ " + len + " ] = arguments[ " + len + " + " + count + " ]" + suffix)
- );
- } else {
- code.prependRight(
- start,
- (prefix + "var " + name + " = [], " + len + " = arguments.length;\n" + indentation + "while ( " + len + "-- ) " + name + "[ " + len + " ] = arguments[ " + len + " ]" + suffix)
- );
- }
- });
- }
- } else if (param.type !== 'Identifier') {
- if (transforms.parameterDestructuring) {
- var ref = this$1.scope.createIdentifier('ref');
- destructure(
- code,
- function (id) { return this$1.scope.createIdentifier(id); },
- function (ref) {
- var name = ref.name;
- return this$1.scope.resolveName(name);
- },
- param,
- ref,
- false,
- introStatementGenerators
- );
- code.prependRight(param.start, ref);
- }
- }
- });
- };
- BlockStatement.prototype.transpileBlockScopedIdentifiers = function transpileBlockScopedIdentifiers (code) {
- var this$1 = this;
- Object.keys(this.scope.blockScopedDeclarations).forEach(function (name) {
- var declarations = this$1.scope.blockScopedDeclarations[name];
- for (var i$2 = 0, list$2 = declarations; i$2 < list$2.length; i$2 += 1) {
- var declaration = list$2[i$2];
- var cont = false;
- if (declaration.kind === 'for.let') {
-
- var forStatement = declaration.node.findNearest('ForStatement');
- if (forStatement.shouldRewriteAsFunction) {
- var outerAlias = this$1.scope.createIdentifier(name);
- var innerAlias = forStatement.reassigned[name]
- ? this$1.scope.createIdentifier(name)
- : name;
- declaration.name = outerAlias;
- code.overwrite(
- declaration.node.start,
- declaration.node.end,
- outerAlias,
- { storeName: true }
- );
- forStatement.aliases[name] = {
- outer: outerAlias,
- inner: innerAlias
- };
- for (var i = 0, list = declaration.instances; i < list.length; i += 1) {
- var identifier = list[i];
- var alias = forStatement.body.contains(identifier)
- ? innerAlias
- : outerAlias;
- if (name !== alias) {
- code.overwrite(identifier.start, identifier.end, alias, {
- storeName: true
- });
- }
- }
- cont = true;
- }
- }
- if (!cont) {
- var alias$1 = this$1.scope.createIdentifier(name);
- if (name !== alias$1) {
- declaration.name = alias$1;
- code.overwrite(
- declaration.node.start,
- declaration.node.end,
- alias$1,
- { storeName: true }
- );
- for (var i$1 = 0, list$1 = declaration.instances; i$1 < list$1.length; i$1 += 1) {
- var identifier$1 = list$1[i$1];
- identifier$1.rewritten = true;
- code.overwrite(identifier$1.start, identifier$1.end, alias$1, {
- storeName: true
- });
- }
- }
- }
- }
- });
- };
- return BlockStatement;
- }(Node$1));
- function isArguments(node) {
- return node.type === 'Identifier' && node.name === 'arguments';
- }
- function spread(
- code,
- elements,
- start,
- argumentsArrayAlias,
- isNew
- ) {
- var i = elements.length;
- var firstSpreadIndex = -1;
- while (i--) {
- var element$1 = elements[i];
- if (element$1 && element$1.type === 'SpreadElement') {
- if (isArguments(element$1.argument)) {
- code.overwrite(
- element$1.argument.start,
- element$1.argument.end,
- argumentsArrayAlias
- );
- }
- firstSpreadIndex = i;
- }
- }
- if (firstSpreadIndex === -1) { return false; }
- if (isNew) {
- for (i = 0; i < elements.length; i += 1) {
- var element$2 = elements[i];
- if (element$2.type === 'SpreadElement') {
- code.remove(element$2.start, element$2.argument.start);
- } else {
- code.prependRight(element$2.start, '[');
- code.prependRight(element$2.end, ']');
- }
- }
- return true;
- }
- var element = elements[firstSpreadIndex];
- var previousElement = elements[firstSpreadIndex - 1];
- if (!previousElement) {
- code.remove(start, element.start);
- code.overwrite(element.end, elements[1].start, '.concat( ');
- } else {
- code.overwrite(previousElement.end, element.start, ' ].concat( ');
- }
- for (i = firstSpreadIndex; i < elements.length; i += 1) {
- element = elements[i];
- if (element) {
- if (element.type === 'SpreadElement') {
- code.remove(element.start, element.argument.start);
- } else {
- code.appendLeft(element.start, '[');
- code.appendLeft(element.end, ']');
- }
- }
- }
- return true;
- }
- var ArrayExpression = (function (Node) {
- function ArrayExpression () {
- Node.apply(this, arguments);
- }
- if ( Node ) ArrayExpression.__proto__ = Node;
- ArrayExpression.prototype = Object.create( Node && Node.prototype );
- ArrayExpression.prototype.constructor = ArrayExpression;
- ArrayExpression.prototype.initialise = function initialise (transforms) {
- if (transforms.spreadRest && this.elements.length) {
- var lexicalBoundary = this.findLexicalBoundary();
- var i = this.elements.length;
- while (i--) {
- var element = this.elements[i];
- if (
- element &&
- element.type === 'SpreadElement' &&
- isArguments(element.argument)
- ) {
- this.argumentsArrayAlias = lexicalBoundary.getArgumentsArrayAlias();
- }
- }
- }
- Node.prototype.initialise.call(this, transforms);
- };
- ArrayExpression.prototype.transpile = function transpile (code, transforms) {
- Node.prototype.transpile.call(this, code, transforms);
- if (transforms.spreadRest) {
-
- if (this.elements.length) {
- var lastElement = this.elements[this.elements.length - 1];
- if (
- lastElement &&
- /\s*,/.test(code.original.slice(lastElement.end, this.end))
- ) {
- code.overwrite(lastElement.end, this.end - 1, ' ');
- }
- }
- if (this.elements.length === 1) {
- var element = this.elements[0];
- if (element && element.type === 'SpreadElement') {
-
- if (isArguments(element.argument)) {
- code.overwrite(
- this.start,
- this.end,
- ("[].concat( " + (this.argumentsArrayAlias) + " )")
- );
- } else {
- code.overwrite(this.start, element.argument.start, '[].concat( ');
- code.overwrite(element.end, this.end, ' )');
- }
- }
- } else {
- var hasSpreadElements = spread(
- code,
- this.elements,
- this.start,
- this.argumentsArrayAlias
- );
- if (hasSpreadElements) {
- code.overwrite(this.end - 1, this.end, ')');
- }
- }
- }
- };
- return ArrayExpression;
- }(Node$1));
- function removeTrailingComma(code, c) {
- while (code.original[c] !== ')') {
- if (code.original[c] === ',') {
- code.remove(c, c + 1);
- return;
- }
- if (code.original[c] === '/') {
- c = code.original.indexOf(code.original[c + 1] === '/' ? '\n' : '*/', c) + 1;
- }
- c += 1;
- }
- }
- var ArrowFunctionExpression = (function (Node) {
- function ArrowFunctionExpression () {
- Node.apply(this, arguments);
- }
- if ( Node ) ArrowFunctionExpression.__proto__ = Node;
- ArrowFunctionExpression.prototype = Object.create( Node && Node.prototype );
- ArrowFunctionExpression.prototype.constructor = ArrowFunctionExpression;
- ArrowFunctionExpression.prototype.initialise = function initialise (transforms) {
- this.body.createScope();
- Node.prototype.initialise.call(this, transforms);
- };
- ArrowFunctionExpression.prototype.transpile = function transpile (code, transforms) {
- var naked = this.params.length === 1 && this.start === this.params[0].start;
- if (transforms.arrow || this.needsArguments(transforms)) {
-
- var charIndex = this.body.start;
- while (code.original[charIndex] !== '=') {
- charIndex -= 1;
- }
- code.remove(charIndex, this.body.start);
- Node.prototype.transpile.call(this, code, transforms);
-
- if (naked) {
- code.prependRight(this.params[0].start, '(');
- code.appendLeft(this.params[0].end, ')');
- }
-
- if (this.parent && this.parent.type === 'ExpressionStatement') {
-
- code.prependRight(this.start, '!function');
- } else {
- code.prependRight(this.start, 'function ');
- }
- } else {
- Node.prototype.transpile.call(this, code, transforms);
- }
- if (transforms.trailingFunctionCommas && this.params.length && !naked) {
- removeTrailingComma(code, this.params[this.params.length - 1].end);
- }
- };
-
- ArrowFunctionExpression.prototype.needsArguments = function needsArguments (transforms) {
- return (
- transforms.spreadRest &&
- this.params.filter(function (param) { return param.type === 'RestElement'; }).length > 0
- );
- };
- return ArrowFunctionExpression;
- }(Node$1));
- function checkConst(identifier, scope) {
- var declaration = scope.findDeclaration(identifier.name);
- if (declaration && declaration.kind === 'const') {
- throw new CompileError(((identifier.name) + " is read-only"), identifier);
- }
- }
- var AssignmentExpression = (function (Node) {
- function AssignmentExpression () {
- Node.apply(this, arguments);
- }
- if ( Node ) AssignmentExpression.__proto__ = Node;
- AssignmentExpression.prototype = Object.create( Node && Node.prototype );
- AssignmentExpression.prototype.constructor = AssignmentExpression;
- AssignmentExpression.prototype.initialise = function initialise (transforms) {
- if (this.left.type === 'Identifier') {
- var declaration = this.findScope(false).findDeclaration(this.left.name);
-
- var statement = declaration && declaration.node.ancestor(3);
- if (
- statement &&
- statement.type === 'ForStatement' &&
- statement.body.contains(this)
- ) {
- statement.reassigned[this.left.name] = true;
- }
- }
- Node.prototype.initialise.call(this, transforms);
- };
- AssignmentExpression.prototype.transpile = function transpile (code, transforms) {
- if (this.left.type === 'Identifier') {
-
-
- checkConst(this.left, this.findScope(false));
- }
- if (this.operator === '**=' && transforms.exponentiation) {
- this.transpileExponentiation(code, transforms);
- } else if (/Pattern/.test(this.left.type) && transforms.destructuring) {
- this.transpileDestructuring(code, transforms);
- }
- Node.prototype.transpile.call(this, code, transforms);
- };
- AssignmentExpression.prototype.transpileDestructuring = function transpileDestructuring (code) {
- var this$1 = this;
- var writeScope = this.findScope(true);
- var lookupScope = this.findScope(false);
- var assign = writeScope.createDeclaration('assign');
- code.appendRight(this.left.end, ("(" + assign));
- code.appendLeft(this.right.end, ', ');
- var statementGenerators = [];
- destructure(
- code,
- function (id) { return writeScope.createDeclaration(id); },
- function (node) {
- var name = lookupScope.resolveName(node.name);
- checkConst(node, lookupScope);
- return name;
- },
- this.left,
- assign,
- true,
- statementGenerators
- );
- var suffix = ', ';
- statementGenerators.forEach(function (fn, j) {
- if (j === statementGenerators.length - 1) {
- suffix = '';
- }
- fn(this$1.end, '', suffix);
- });
- if (this.unparenthesizedParent().type === 'ExpressionStatement') {
-
- code.appendRight(this.end, ")");
- } else {
-
- code.appendRight(this.end, (", " + assign + ")"));
- }
- };
- AssignmentExpression.prototype.transpileExponentiation = function transpileExponentiation (code) {
- var scope = this.findScope(false);
-
- var charIndex = this.left.end;
- while (code.original[charIndex] !== '*') { charIndex += 1; }
- code.remove(charIndex, charIndex + 2);
-
-
-
- var base;
- var left = this.left.unparenthesize();
- if (left.type === 'Identifier') {
- base = scope.resolveName(left.name);
- } else if (left.type === 'MemberExpression') {
- var object;
- var needsObjectVar = false;
- var property;
- var needsPropertyVar = false;
- var statement = this.findNearest(/(?:Statement|Declaration)$/);
- var i0 = statement.getIndentation();
- if (left.property.type === 'Identifier') {
- property = left.computed
- ? scope.resolveName(left.property.name)
- : left.property.name;
- } else {
- property = scope.createDeclaration('property');
- needsPropertyVar = true;
- }
- if (left.object.type === 'Identifier') {
- object = scope.resolveName(left.object.name);
- } else {
- object = scope.createDeclaration('object');
- needsObjectVar = true;
- }
- if (left.start === statement.start) {
- if (needsObjectVar && needsPropertyVar) {
- code.prependRight(statement.start, (object + " = "));
- code.overwrite(
- left.object.end,
- left.property.start,
- (";\n" + i0 + property + " = ")
- );
- code.overwrite(
- left.property.end,
- left.end,
- (";\n" + i0 + object + "[" + property + "]")
- );
- } else if (needsObjectVar) {
- code.prependRight(statement.start, (object + " = "));
- code.appendLeft(left.object.end, (";\n" + i0));
- code.appendLeft(left.object.end, object);
- } else if (needsPropertyVar) {
- code.prependRight(left.property.start, (property + " = "));
- code.appendLeft(left.property.end, (";\n" + i0));
- code.move(left.property.start, left.property.end, this.start);
- code.appendLeft(left.object.end, ("[" + property + "]"));
- code.remove(left.object.end, left.property.start);
- code.remove(left.property.end, left.end);
- }
- } else {
- if (needsObjectVar && needsPropertyVar) {
- code.prependRight(left.start, ("( " + object + " = "));
- code.overwrite(
- left.object.end,
- left.property.start,
- (", " + property + " = ")
- );
- code.overwrite(
- left.property.end,
- left.end,
- (", " + object + "[" + property + "]")
- );
- } else if (needsObjectVar) {
- code.prependRight(left.start, ("( " + object + " = "));
- code.appendLeft(left.object.end, (", " + object));
- } else if (needsPropertyVar) {
- code.prependRight(left.property.start, ("( " + property + " = "));
- code.appendLeft(left.property.end, ", ");
- code.move(left.property.start, left.property.end, left.start);
- code.overwrite(left.object.end, left.property.start, ("[" + property + "]"));
- code.remove(left.property.end, left.end);
- }
- if (needsPropertyVar) {
- code.appendLeft(this.end, " )");
- }
- }
- base =
- object +
- (left.computed || needsPropertyVar ? ("[" + property + "]") : ("." + property));
- }
- code.prependRight(this.right.start, ("Math.pow( " + base + ", "));
- code.appendLeft(this.right.end, " )");
- };
- return AssignmentExpression;
- }(Node$1));
- var BinaryExpression = (function (Node) {
- function BinaryExpression () {
- Node.apply(this, arguments);
- }
- if ( Node ) BinaryExpression.__proto__ = Node;
- BinaryExpression.prototype = Object.create( Node && Node.prototype );
- BinaryExpression.prototype.constructor = BinaryExpression;
- BinaryExpression.prototype.transpile = function transpile (code, transforms) {
- if (this.operator === '**' && transforms.exponentiation) {
- code.prependRight(this.start, "Math.pow( ");
- code.overwrite(this.left.end, this.right.start, ", ");
- code.appendLeft(this.end, " )");
- }
- Node.prototype.transpile.call(this, code, transforms);
- };
- return BinaryExpression;
- }(Node$1));
- var loopStatement = /(?:For(?:In|Of)?|While)Statement/;
- var BreakStatement = (function (Node) {
- function BreakStatement () {
- Node.apply(this, arguments);
- }
- if ( Node ) BreakStatement.__proto__ = Node;
- BreakStatement.prototype = Object.create( Node && Node.prototype );
- BreakStatement.prototype.constructor = BreakStatement;
- BreakStatement.prototype.initialise = function initialise () {
- var loop = this.findNearest(loopStatement);
- var switchCase = this.findNearest('SwitchCase');
- if (loop && (!switchCase || loop.depth > switchCase.depth)) {
- loop.canBreak = true;
- this.loop = loop;
- }
- };
- BreakStatement.prototype.transpile = function transpile (code) {
- if (this.loop && this.loop.shouldRewriteAsFunction) {
- if (this.label)
- { throw new CompileError(
- 'Labels are not currently supported in a loop with locally-scoped variables',
- this
- ); }
- code.overwrite(this.start, this.start + 5, "return 'break'");
- }
- };
- return BreakStatement;
- }(Node$1));
- var names = 'Infinity,undefined,NaN,isFinite,isNaN,' +
- 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
- 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
- 'require,' +
- 'arguments,' +
- '_h,_c';
- var hash = Object.create(null);
- names.split(',').forEach(function (name) {
- hash[name] = true;
- });
- var isDeclaration = function (type) { return /Declaration$/.test(type); };
- var isFunction = function (type) { return /Function(Expression|Declaration)$/.test(type); };
- function shouldPrependVm (identifier) {
- if (
- identifier.program.inWith > 0 &&
-
- !(isDeclaration(identifier.parent.type) && identifier.parent.id === identifier) &&
-
- !(isFunction(identifier.parent.type) && identifier.parent.params.indexOf(identifier) > -1) &&
-
- !(identifier.parent.type === 'Property' && identifier.parent.key === identifier && !identifier.parent.computed) &&
-
- !(identifier.parent.type === 'MemberExpression' && identifier.parent.property === identifier && !identifier.parent.computed) &&
-
- !(identifier.parent.type === 'ArrayPattern') &&
-
- !(identifier.parent.parent.type === 'ObjectPattern') &&
-
- !hash[identifier.name] &&
-
- !identifier.findScope(false).contains(identifier.name)
- ) {
- return true;
- }
- }
- var CallExpression = (function (Node) {
- function CallExpression () {
- Node.apply(this, arguments);
- }
- if ( Node ) CallExpression.__proto__ = Node;
- CallExpression.prototype = Object.create( Node && Node.prototype );
- CallExpression.prototype.constructor = CallExpression;
- CallExpression.prototype.initialise = function initialise (transforms) {
- if (transforms.spreadRest && this.arguments.length > 1) {
- var lexicalBoundary = this.findLexicalBoundary();
- var i = this.arguments.length;
- while (i--) {
- var arg = this.arguments[i];
- if (arg.type === 'SpreadElement' && isArguments(arg.argument)) {
- this.argumentsArrayAlias = lexicalBoundary.getArgumentsArrayAlias();
- }
- }
- }
- Node.prototype.initialise.call(this, transforms);
- };
- CallExpression.prototype.transpile = function transpile (code, transforms) {
- if (transforms.spreadRest && this.arguments.length) {
- var hasSpreadElements = false;
- var context;
- var firstArgument = this.arguments[0];
- if (this.arguments.length === 1) {
- if (firstArgument.type === 'SpreadElement') {
- code.remove(firstArgument.start, firstArgument.argument.start);
- hasSpreadElements = true;
- }
- } else {
- hasSpreadElements = spread(
- code,
- this.arguments,
- firstArgument.start,
- this.argumentsArrayAlias
- );
- }
- if (hasSpreadElements) {
-
-
- var _super = null;
- if (this.callee.type === 'Super') {
- _super = this.callee;
- } else if (
- this.callee.type === 'MemberExpression' &&
- this.callee.object.type === 'Super'
- ) {
- _super = this.callee.object;
- }
- if ( !_super && this.callee.type === 'MemberExpression' ) {
- if ( this.callee.object.type === 'Identifier' ) {
- var callee = this.callee.object;
- context = shouldPrependVm(callee) ? ("_vm." + (callee.name)) : callee.name;
- } else {
- context = this.findScope(true).createDeclaration('ref');
- var callExpression = this.callee.object;
- code.prependRight(callExpression.start, ("(" + context + " = "));
- code.appendLeft(callExpression.end, ")");
- }
- } else {
- context = 'void 0';
- }
- code.appendLeft(this.callee.end, '.apply');
- if (_super) {
- _super.noCall = true;
- if (this.arguments.length > 1) {
- if (firstArgument.type !== 'SpreadElement') {
- code.prependRight(firstArgument.start, "[ ");
- }
- code.appendLeft(
- this.arguments[this.arguments.length - 1].end,
- ' )'
- );
- }
- } else if (this.arguments.length === 1) {
- code.prependRight(firstArgument.start, (context + ", "));
- } else {
- if (firstArgument.type === 'SpreadElement') {
- code.appendLeft(firstArgument.start, (context + ", "));
- } else {
- code.appendLeft(firstArgument.start, (context + ", [ "));
- }
- code.appendLeft(this.arguments[this.arguments.length - 1].end, ' )');
- }
- }
- }
- if (transforms.trailingFunctionCommas && this.arguments.length) {
- removeTrailingComma(code, this.arguments[this.arguments.length - 1].end);
- }
- Node.prototype.transpile.call(this, code, transforms);
- };
- return CallExpression;
- }(Node$1));
- var ClassBody = (function (Node) {
- function ClassBody () {
- Node.apply(this, arguments);
- }
- if ( Node ) ClassBody.__proto__ = Node;
- ClassBody.prototype = Object.create( Node && Node.prototype );
- ClassBody.prototype.constructor = ClassBody;
- ClassBody.prototype.transpile = function transpile (code, transforms, inFunctionExpression, superName) {
- var this$1 = this;
- if (transforms.classes) {
- var name = this.parent.name;
- var indentStr = code.getIndentString();
- var i0 =
- this.getIndentation() + (inFunctionExpression ? indentStr : '');
- var i1 = i0 + indentStr;
- var constructorIndex = findIndex(
- this.body,
- function (node) { return node.kind === 'constructor'; }
- );
- var constructor = this.body[constructorIndex];
- var introBlock = '';
- var outroBlock = '';
- if (this.body.length) {
- code.remove(this.start, this.body[0].start);
- code.remove(this.body[this.body.length - 1].end, this.end);
- } else {
- code.remove(this.start, this.end);
- }
- if (constructor) {
- constructor.value.body.isConstructorBody = true;
- var previousMethod = this.body[constructorIndex - 1];
- var nextMethod = this.body[constructorIndex + 1];
- // ensure constructor is first
- if (constructorIndex > 0) {
- code.remove(previousMethod.end, constructor.start);
- code.move(
- constructor.start,
- nextMethod ? nextMethod.start : this.end - 1,
- this.body[0].start
- );
- }
- if (!inFunctionExpression) { code.appendLeft(constructor.end, ';'); }
- }
- var namedFunctions =
- this.program.options.namedFunctionExpressions !== false;
- var namedConstructor =
- namedFunctions ||
- this.parent.superClass ||
- this.parent.type !== 'ClassDeclaration';
- if (this.parent.superClass) {
- var inheritanceBlock = "if ( " + superName + " ) " + name + ".__proto__ = " + superName + ";\n" + i0 + name + ".prototype = Object.create( " + superName + " && " + superName + ".prototype );\n" + i0 + name + ".prototype.constructor = " + name + ";";
- if (constructor) {
- introBlock += "\n\n" + i0 + inheritanceBlock;
- } else {
- var fn =
- "function " + name + " () {" +
- (superName
- ? ("\n" + i1 + superName + ".apply(this, arguments);\n" + i0 + "}")
- : "}") +
- (inFunctionExpression ? '' : ';') +
- (this.body.length ? ("\n\n" + i0) : '');
- inheritanceBlock = fn + inheritanceBlock;
- introBlock += inheritanceBlock + "\n\n" + i0;
- }
- } else if (!constructor) {
- var fn$1 = 'function ' + (namedConstructor ? name + ' ' : '') + '() {}';
- if (this.parent.type === 'ClassDeclaration') { fn$1 += ';'; }
- if (this.body.length) { fn$1 += "\n\n" + i0; }
- introBlock += fn$1;
- }
- var scope = this.findScope(false);
- var prototypeGettersAndSetters = [];
- var staticGettersAndSetters = [];
- var prototypeAccessors;
- var staticAccessors;
- this.body.forEach(function (method, i) {
- if (method.kind === 'constructor') {
- var constructorName = namedConstructor ? ' ' + name : '';
- code.overwrite(
- method.key.start,
- method.key.end,
- ("function" + constructorName)
- );
- return;
- }
- if (method.static) {
- var len = code.original[method.start + 6] == ' ' ? 7 : 6;
- code.remove(method.start, method.start + len);
- }
- var isAccessor = method.kind !== 'method';
- var lhs;
- var methodName = method.key.name;
- if (
- reserved[methodName] ||
- method.value.body.scope.references[methodName]
- ) {
- methodName = scope.createIdentifier(methodName);
- }
-
- var fake_computed = false;
- if (!method.computed && method.key.type === 'Literal') {
- fake_computed = true;
- method.computed = true;
- }
- if (isAccessor) {
- if (method.computed) {
- throw new Error(
- 'Computed accessor properties are not currently supported'
- );
- }
- code.remove(method.start, method.key.start);
- if (method.static) {
- if (!~staticGettersAndSetters.indexOf(method.key.name))
- { staticGettersAndSetters.push(method.key.name); }
- if (!staticAccessors)
- { staticAccessors = scope.createIdentifier('staticAccessors'); }
- lhs = "" + staticAccessors;
- } else {
- if (!~prototypeGettersAndSetters.indexOf(method.key.name))
- { prototypeGettersAndSetters.push(method.key.name); }
- if (!prototypeAccessors)
- { prototypeAccessors = scope.createIdentifier('prototypeAccessors'); }
- lhs = "" + prototypeAccessors;
- }
- } else {
- lhs = method.static ? ("" + name) : (name + ".prototype");
- }
- if (!method.computed) { lhs += '.'; }
- var insertNewlines =
- (constructorIndex > 0 && i === constructorIndex + 1) ||
- (i === 0 && constructorIndex === this$1.body.length - 1);
- if (insertNewlines) { lhs = "\n\n" + i0 + lhs; }
- var c = method.key.end;
- if (method.computed) {
- if (fake_computed) {
- code.prependRight(method.key.start, '[');
- code.appendLeft(method.key.end, ']');
- } else {
- while (code.original[c] !== ']') { c += 1; }
- c += 1;
- }
- }
- var funcName =
- method.computed || isAccessor || !namedFunctions
- ? ''
- : (methodName + " ");
- var rhs =
- (isAccessor ? ("." + (method.kind)) : '') +
- " = function" +
- (method.value.generator ? '* ' : ' ') +
- funcName;
- code.remove(c, method.value.start);
- code.prependRight(method.value.start, rhs);
- code.appendLeft(method.end, ';');
- if (method.value.generator) { code.remove(method.start, method.key.start); }
- code.prependRight(method.start, lhs);
- });
- if (prototypeGettersAndSetters.length || staticGettersAndSetters.length) {
- var intro = [];
- var outro = [];
- if (prototypeGettersAndSetters.length) {
- intro.push(
- ("var " + prototypeAccessors + " = { " + (prototypeGettersAndSetters
- .map(function (name) { return (name + ": { configurable: true }"); })
- .join(',')) + " };")
- );
- outro.push(
- ("Object.defineProperties( " + name + ".prototype, " + prototypeAccessors + " );")
- );
- }
- if (staticGettersAndSetters.length) {
- intro.push(
- ("var " + staticAccessors + " = { " + (staticGettersAndSetters
- .map(function (name) { return (name + ": { configurable: true }"); })
- .join(',')) + " };")
- );
- outro.push(("Object.defineProperties( " + name + ", " + staticAccessors + " );"));
- }
- if (constructor) { introBlock += "\n\n" + i0; }
- introBlock += intro.join(("\n" + i0));
- if (!constructor) { introBlock += "\n\n" + i0; }
- outroBlock += "\n\n" + i0 + outro.join(("\n" + i0));
- }
- if (constructor) {
- code.appendLeft(constructor.end, introBlock);
- } else {
- code.prependRight(this.start, introBlock);
- }
- code.appendLeft(this.end, outroBlock);
- }
- Node.prototype.transpile.call(this, code, transforms);
- };
- return ClassBody;
- }(Node$1));
- function deindent(node, code) {
- var start = node.start;
- var end = node.end;
- var indentStr = code.getIndentString();
- var indentStrLen = indentStr.length;
- var indentStart = start - indentStrLen;
- if (
- !node.program.indentExclusions[indentStart] &&
- code.original.slice(indentStart, start) === indentStr
- ) {
- code.remove(indentStart, start);
- }
- var pattern = new RegExp(indentStr + '\\S', 'g');
- var slice = code.original.slice(start, end);
- var match;
- while ((match = pattern.exec(slice))) {
- var removeStart = start + match.index;
- if (!node.program.indentExclusions[removeStart]) {
- code.remove(removeStart, removeStart + indentStrLen);
- }
- }
- }
- var ClassDeclaration = (function (Node) {
- function ClassDeclaration () {
- Node.apply(this, arguments);
- }
- if ( Node ) ClassDeclaration.__proto__ = Node;
- ClassDeclaration.prototype = Object.create( Node && Node.prototype );
- ClassDeclaration.prototype.constructor = ClassDeclaration;
- ClassDeclaration.prototype.initialise = function initialise (transforms) {
- if (this.id) {
- this.name = this.id.name;
- this.findScope(true).addDeclaration(this.id, 'class');
- } else {
- this.name = this.findScope(true).createIdentifier("defaultExport");
- }
- Node.prototype.initialise.call(this, transforms);
- };
- ClassDeclaration.prototype.transpile = function transpile (code, transforms) {
- if (transforms.classes) {
- if (!this.superClass) { deindent(this.body, code); }
- var superName =
- this.superClass && (this.superClass.name || 'superclass');
- var i0 = this.getIndentation();
- var i1 = i0 + code.getIndentString();
-
-
- var isExportDefaultDeclaration = this.parent.type === 'ExportDefaultDeclaration';
- if (isExportDefaultDeclaration) {
- code.remove(this.parent.start, this.start);
- }
- var c = this.start;
- if (this.id) {
- code.overwrite(c, this.id.start, 'var ');
- c = this.id.end;
- } else {
- code.prependLeft(c, ("var " + (this.name)));
- }
- if (this.superClass) {
- if (this.superClass.end === this.body.start) {
- code.remove(c, this.superClass.start);
- code.appendLeft(c, (" = (function (" + superName + ") {\n" + i1));
- } else {
- code.overwrite(c, this.superClass.start, ' = ');
- code.overwrite(
- this.superClass.end,
- this.body.start,
- ("(function (" + superName + ") {\n" + i1)
- );
- }
- } else {
- if (c === this.body.start) {
- code.appendLeft(c, ' = ');
- } else {
- code.overwrite(c, this.body.start, ' = ');
- }
- }
- this.body.transpile(code, transforms, !!this.superClass, superName);
- var syntheticDefaultExport =
- isExportDefaultDeclaration
- ? ("\n\n" + i0 + "export default " + (this.name) + ";")
- : '';
- if (this.superClass) {
- code.appendLeft(this.end, ("\n\n" + i1 + "return " + (this.name) + ";\n" + i0 + "}("));
- code.move(this.superClass.start, this.superClass.end, this.end);
- code.prependRight(this.end, ("));" + syntheticDefaultExport));
- } else if (syntheticDefaultExport) {
- code.prependRight(this.end, syntheticDefaultExport);
- }
- } else {
- this.body.transpile(code, transforms, false, null);
- }
- };
- return ClassDeclaration;
- }(Node$1));
- var ClassExpression = (function (Node) {
- function ClassExpression () {
- Node.apply(this, arguments);
- }
- if ( Node ) ClassExpression.__proto__ = Node;
- ClassExpression.prototype = Object.create( Node && Node.prototype );
- ClassExpression.prototype.constructor = ClassExpression;
- ClassExpression.prototype.initialise = function initialise (transforms) {
- this.name = ( this.id
- ? this.id.name
- : this.parent.type === 'VariableDeclarator'
- ? this.parent.id.name
- : this.parent.type !== 'AssignmentExpression'
- ? null
- : this.parent.left.type === 'Identifier'
- ? this.parent.left.name
- : this.parent.left.type === 'MemberExpression'
- ? this.parent.left.property.name
- : null ) || this.findScope(true).createIdentifier('anonymous');
- Node.prototype.initialise.call(this, transforms);
- };
- ClassExpression.prototype.transpile = function transpile (code, transforms) {
- if (transforms.classes) {
- var superName =
- this.superClass && (this.superClass.name || 'superclass');
- var i0 = this.getIndentation();
- var i1 = i0 + code.getIndentString();
- if (this.superClass) {
- code.remove(this.start, this.superClass.start);
- code.remove(this.superClass.end, this.body.start);
- code.appendLeft(this.start, ("(function (" + superName + ") {\n" + i1));
- } else {
- code.overwrite(this.start, this.body.start, ("(function () {\n" + i1));
- }
- this.body.transpile(code, transforms, true, superName);
- var outro = "\n\n" + i1 + "return " + (this.name) + ";\n" + i0 + "}(";
- if (this.superClass) {
- code.appendLeft(this.end, outro);
- code.move(this.superClass.start, this.superClass.end, this.end);
- code.prependRight(this.end, '))');
- } else {
- code.appendLeft(this.end, ("\n\n" + i1 + "return " + (this.name) + ";\n" + i0 + "}())"));
- }
- } else {
- this.body.transpile(code, transforms, false);
- }
- };
- return ClassExpression;
- }(Node$1));
- var ContinueStatement = (function (Node) {
- function ContinueStatement () {
- Node.apply(this, arguments);
- }
- if ( Node ) ContinueStatement.__proto__ = Node;
- ContinueStatement.prototype = Object.create( Node && Node.prototype );
- ContinueStatement.prototype.constructor = ContinueStatement;
- ContinueStatement.prototype.transpile = function transpile (code) {
- var loop = this.findNearest(loopStatement);
- if (loop.shouldRewriteAsFunction) {
- if (this.label)
- { throw new CompileError(
- 'Labels are not currently supported in a loop with locally-scoped variables',
- this
- ); }
- code.overwrite(this.start, this.start + 8, 'return');
- }
- };
- return ContinueStatement;
- }(Node$1));
- var ExportDefaultDeclaration = (function (Node) {
- function ExportDefaultDeclaration () {
- Node.apply(this, arguments);
- }
- if ( Node ) ExportDefaultDeclaration.__proto__ = Node;
- ExportDefaultDeclaration.prototype = Object.create( Node && Node.prototype );
- ExportDefaultDeclaration.prototype.constructor = ExportDefaultDeclaration;
- ExportDefaultDeclaration.prototype.initialise = function initialise (transforms) {
- if (transforms.moduleExport)
- { throw new CompileError('export is not supported', this); }
- Node.prototype.initialise.call(this, transforms);
- };
- return ExportDefaultDeclaration;
- }(Node$1));
- var ExportNamedDeclaration = (function (Node) {
- function ExportNamedDeclaration () {
- Node.apply(this, arguments);
- }
- if ( Node ) ExportNamedDeclaration.__proto__ = Node;
- ExportNamedDeclaration.prototype = Object.create( Node && Node.prototype );
- ExportNamedDeclaration.prototype.constructor = ExportNamedDeclaration;
- ExportNamedDeclaration.prototype.initialise = function initialise (transforms) {
- if (transforms.moduleExport)
- { throw new CompileError('export is not supported', this); }
- Node.prototype.initialise.call(this, transforms);
- };
- return ExportNamedDeclaration;
- }(Node$1));
- var LoopStatement = (function (Node) {
- function LoopStatement () {
- Node.apply(this, arguments);
- }
- if ( Node ) LoopStatement.__proto__ = Node;
- LoopStatement.prototype = Object.create( Node && Node.prototype );
- LoopStatement.prototype.constructor = LoopStatement;
- LoopStatement.prototype.findScope = function findScope (functionScope) {
- return functionScope || !this.createdScope
- ? this.parent.findScope(functionScope)
- : this.body.scope;
- };
- LoopStatement.prototype.initialise = function initialise (transforms) {
- this.body.createScope();
- this.createdScope = true;
-
- this.reassigned = Object.create(null);
- this.aliases = Object.create(null);
- Node.prototype.initialise.call(this, transforms);
- if (transforms.letConst) {
-
-
- var names = Object.keys(this.body.scope.declarations);
- var i = names.length;
- while (i--) {
- var name = names[i];
- var declaration = this.body.scope.declarations[name];
- var j = declaration.instances.length;
- while (j--) {
- var instance = declaration.instances[j];
- var nearestFunctionExpression = instance.findNearest(/Function/);
- if (
- nearestFunctionExpression &&
- nearestFunctionExpression.depth > this.depth
- ) {
- this.shouldRewriteAsFunction = true;
- break;
- }
- }
- if (this.shouldRewriteAsFunction) { break; }
- }
- }
- };
- LoopStatement.prototype.transpile = function transpile (code, transforms) {
- var needsBlock =
- this.type != 'ForOfStatement' &&
- (this.body.type !== 'BlockStatement' ||
- (this.body.type === 'BlockStatement' && this.body.synthetic));
- if (this.shouldRewriteAsFunction) {
- var i0 = this.getIndentation();
- var i1 = i0 + code.getIndentString();
- var argString = this.args ? (" " + (this.args.join(', ')) + " ") : '';
- var paramString = this.params ? (" " + (this.params.join(', ')) + " ") : '';
- var functionScope = this.findScope(true);
- var loop = functionScope.createIdentifier('loop');
- var before =
- "var " + loop + " = function (" + paramString + ") " +
- (this.body.synthetic ? ("{\n" + i0 + (code.getIndentString())) : '');
- var after = (this.body.synthetic ? ("\n" + i0 + "}") : '') + ";\n\n" + i0;
- code.prependRight(this.body.start, before);
- code.appendLeft(this.body.end, after);
- code.move(this.start, this.body.start, this.body.end);
- if (this.canBreak || this.canReturn) {
- var returned = functionScope.createIdentifier('returned');
- var insert = "{\n" + i1 + "var " + returned + " = " + loop + "(" + argString + ");\n";
- if (this.canBreak)
- { insert += "\n" + i1 + "if ( " + returned + " === 'break' ) break;"; }
- if (this.canReturn)
- { insert += "\n" + i1 + "if ( " + returned + " ) return " + returned + ".v;"; }
- insert += "\n" + i0 + "}";
- code.prependRight(this.body.end, insert);
- } else {
- var callExpression = loop + "(" + argString + ");";
- if (this.type === 'DoWhileStatement') {
- code.overwrite(
- this.start,
- this.body.start,
- ("do {\n" + i1 + callExpression + "\n" + i0 + "}")
- );
- } else {
- code.prependRight(this.body.end, callExpression);
- }
- }
- } else if (needsBlock) {
- code.appendLeft(this.body.start, '{ ');
- code.prependRight(this.body.end, ' }');
- }
- Node.prototype.transpile.call(this, code, transforms);
- };
- return LoopStatement;
- }(Node$1));
- var ForStatement = (function (LoopStatement$$1) {
- function ForStatement () {
- LoopStatement$$1.apply(this, arguments);
- }
- if ( LoopStatement$$1 ) ForStatement.__proto__ = LoopStatement$$1;
- ForStatement.prototype = Object.create( LoopStatement$$1 && LoopStatement$$1.prototype );
- ForStatement.prototype.constructor = ForStatement;
- ForStatement.prototype.findScope = function findScope (functionScope) {
- return functionScope || !this.createdScope
- ? this.parent.findScope(functionScope)
- : this.body.scope;
- };
- ForStatement.prototype.transpile = function transpile (code, transforms) {
- var this$1 = this;
- var i1 = this.getIndentation() + code.getIndentString();
- if (this.shouldRewriteAsFunction) {
-
- var names =
- this.init.type === 'VariableDeclaration'
- ? [].concat.apply(
- [],
- this.init.declarations.map(function (declarator) { return extractNames(declarator.id); }
- )
- )
- : [];
- var aliases = this.aliases;
- this.args = names.map(
- function (name) { return (name in this$1.aliases ? this$1.aliases[name].outer : name); }
- );
- this.params = names.map(
- function (name) { return (name in this$1.aliases ? this$1.aliases[name].inner : name); }
- );
- var updates = Object.keys(this.reassigned).map(
- function (name) { return ((aliases[name].outer) + " = " + (aliases[name].inner) + ";"); }
- );
- if (updates.length) {
- if (this.body.synthetic) {
- code.appendLeft(this.body.body[0].end, ("; " + (updates.join(" "))));
- } else {
- var lastStatement = this.body.body[this.body.body.length - 1];
- code.appendLeft(
- lastStatement.end,
- ("\n\n" + i1 + (updates.join(("\n" + i1))))
- );
- }
- }
- }
- LoopStatement$$1.prototype.transpile.call(this, code, transforms);
- };
- return ForStatement;
- }(LoopStatement));
- var ForInStatement = (function (LoopStatement$$1) {
- function ForInStatement () {
- LoopStatement$$1.apply(this, arguments);
- }
- if ( LoopStatement$$1 ) ForInStatement.__proto__ = LoopStatement$$1;
- ForInStatement.prototype = Object.create( LoopStatement$$1 && LoopStatement$$1.prototype );
- ForInStatement.prototype.constructor = ForInStatement;
- ForInStatement.prototype.findScope = function findScope (functionScope) {
- return functionScope || !this.createdScope
- ? this.parent.findScope(functionScope)
- : this.body.scope;
- };
- ForInStatement.prototype.transpile = function transpile (code, transforms) {
- var this$1 = this;
- var hasDeclaration = this.left.type === 'VariableDeclaration';
- if (this.shouldRewriteAsFunction) {
-
- var names =
- hasDeclaration
- ? [].concat.apply(
- [],
- this.left.declarations.map(function (declarator) { return extractNames(declarator.id); }
- )
- )
- : [];
- this.args = names.map(
- function (name) { return (name in this$1.aliases ? this$1.aliases[name].outer : name); }
- );
- this.params = names.map(
- function (name) { return (name in this$1.aliases ? this$1.aliases[name].inner : name); }
- );
- }
- LoopStatement$$1.prototype.transpile.call(this, code, transforms);
- var maybePattern = hasDeclaration ? this.left.declarations[0].id : this.left;
- if (maybePattern.type !== 'Identifier') {
- this.destructurePattern(code, maybePattern, hasDeclaration);
- }
- };
- ForInStatement.prototype.destructurePattern = function destructurePattern (code, pattern, isDeclaration) {
- var scope = this.findScope(true);
- var i0 = this.getIndentation();
- var i1 = i0 + code.getIndentString();
- var ref = scope.createIdentifier('ref');
- var bodyStart = this.body.body.length ? this.body.body[0].start : this.body.start + 1;
- code.move(pattern.start, pattern.end, bodyStart);
- code.prependRight(pattern.end, isDeclaration ? ref : ("var " + ref));
- var statementGenerators = [];
- destructure(
- code,
- function (id) { return scope.createIdentifier(id); },
- function (ref) {
- var name = ref.name;
- return scope.resolveName(name);
- },
- pattern,
- ref,
- false,
- statementGenerators
- );
- var suffix = ";\n" + i1;
- statementGenerators.forEach(function (fn, i) {
- if (i === statementGenerators.length - 1) {
- suffix = ";\n\n" + i1;
- }
- fn(bodyStart, '', suffix);
- });
- };
- return ForInStatement;
- }(LoopStatement));
- var ForOfStatement = (function (LoopStatement$$1) {
- function ForOfStatement () {
- LoopStatement$$1.apply(this, arguments);
- }
- if ( LoopStatement$$1 ) ForOfStatement.__proto__ = LoopStatement$$1;
- ForOfStatement.prototype = Object.create( LoopStatement$$1 && LoopStatement$$1.prototype );
- ForOfStatement.prototype.constructor = ForOfStatement;
- ForOfStatement.prototype.initialise = function initialise (transforms) {
- if (transforms.forOf && !transforms.dangerousForOf)
- { throw new CompileError(
- "for...of statements are not supported. Use `transforms: { forOf: false }` to skip transformation and disable this error, or `transforms: { dangerousForOf: true }` if you know what you're doing",
- this
- ); }
- LoopStatement$$1.prototype.initialise.call(this, transforms);
- };
- ForOfStatement.prototype.transpile = function transpile (code, transforms) {
- LoopStatement$$1.prototype.transpile.call(this, code, transforms);
- if (!transforms.dangerousForOf) { return; }
-
- if (!this.body.body[0]) {
- if (
- this.left.type === 'VariableDeclaration' &&
- this.left.kind === 'var'
- ) {
- code.remove(this.start, this.left.start);
- code.appendLeft(this.left.end, ';');
- code.remove(this.left.end, this.end);
- } else {
- code.remove(this.start, this.end);
- }
- return;
- }
- var scope = this.findScope(true);
- var i0 = this.getIndentation();
- var i1 = i0 + code.getIndentString();
- var key = scope.createIdentifier('i');
- var list = scope.createIdentifier('list');
- if (this.body.synthetic) {
- code.prependRight(this.left.start, ("{\n" + i1));
- code.appendLeft(this.body.body[0].end, ("\n" + i0 + "}"));
- }
- var bodyStart = this.body.body[0].start;
- code.remove(this.left.end, this.right.start);
- code.move(this.left.start, this.left.end, bodyStart);
- code.prependRight(this.right.start, ("var " + key + " = 0, " + list + " = "));
- code.appendLeft(this.right.end, ("; " + key + " < " + list + ".length; " + key + " += 1"));
- var isDeclaration = this.left.type === 'VariableDeclaration';
- var maybeDestructuring = isDeclaration ? this.left.declarations[0].id : this.left;
- if (maybeDestructuring.type !== 'Identifier') {
- var statementGenerators = [];
- var ref = scope.createIdentifier('ref');
- destructure(
- code,
- function (id) { return scope.createIdentifier(id); },
- function (ref) {
- var name = ref.name;
- return scope.resolveName(name);
- },
- maybeDestructuring,
- ref,
- !isDeclaration,
- statementGenerators
- );
- var suffix = ";\n" + i1;
- statementGenerators.forEach(function (fn, i) {
- if (i === statementGenerators.length - 1) {
- suffix = ";\n\n" + i1;
- }
- fn(bodyStart, '', suffix);
- });
- if (isDeclaration) {
- code.appendLeft(this.left.start + this.left.kind.length + 1, ref);
- code.appendLeft(this.left.end, (" = " + list + "[" + key + "];\n" + i1));
- } else {
- code.appendLeft(this.left.end, ("var " + ref + " = " + list + "[" + key + "];\n" + i1));
- }
- } else {
- code.appendLeft(this.left.end, (" = " + list + "[" + key + "];\n\n" + i1));
- }
- };
- return ForOfStatement;
- }(LoopStatement));
- var FunctionDeclaration = (function (Node) {
- function FunctionDeclaration () {
- Node.apply(this, arguments);
- }
- if ( Node ) FunctionDeclaration.__proto__ = Node;
- FunctionDeclaration.prototype = Object.create( Node && Node.prototype );
- FunctionDeclaration.prototype.constructor = FunctionDeclaration;
- FunctionDeclaration.prototype.initialise = function initialise (transforms) {
- if (this.generator && transforms.generator) {
- throw new CompileError('Generators are not supported', this);
- }
- this.body.createScope();
- if (this.id) {
- this.findScope(true).addDeclaration(this.id, 'function');
- }
- Node.prototype.initialise.call(this, transforms);
- };
- FunctionDeclaration.prototype.transpile = function transpile (code, transforms) {
- Node.prototype.transpile.call(this, code, transforms);
- if (transforms.trailingFunctionCommas && this.params.length) {
- removeTrailingComma(code, this.params[this.params.length - 1].end);
- }
- };
- return FunctionDeclaration;
- }(Node$1));
- var FunctionExpression = (function (Node) {
- function FunctionExpression () {
- Node.apply(this, arguments);
- }
- if ( Node ) FunctionExpression.__proto__ = Node;
- FunctionExpression.prototype = Object.create( Node && Node.prototype );
- FunctionExpression.prototype.constructor = FunctionExpression;
- FunctionExpression.prototype.initialise = function initialise (transforms) {
- if (this.generator && transforms.generator) {
- throw new CompileError('Generators are not supported', this);
- }
- this.body.createScope();
- if (this.id) {
-
- this.body.scope.addDeclaration(this.id, 'function');
- }
- Node.prototype.initialise.call(this, transforms);
- var parent = this.parent;
- var methodName;
- if (
- transforms.conciseMethodProperty &&
- parent.type === 'Property' &&
- parent.kind === 'init' &&
- parent.method &&
- parent.key.type === 'Identifier'
- ) {
-
- methodName = parent.key.name;
- } else if (
- transforms.classes &&
- parent.type === 'MethodDefinition' &&
- parent.kind === 'method' &&
- parent.key.type === 'Identifier'
- ) {
-
- methodName = parent.key.name;
- } else if (this.id && this.id.type === 'Identifier') {
-
- methodName = this.id.alias || this.id.name;
- }
- if (methodName) {
- for (var i$1 = 0, list$1 = this.params; i$1 < list$1.length; i$1 += 1) {
- var param = list$1[i$1];
- if (param.type === 'Identifier' && methodName === param.name) {
-
-
-
- var scope = this.body.scope;
- var declaration = scope.declarations[methodName];
- var alias = scope.createIdentifier(methodName);
- param.alias = alias;
- for (var i = 0, list = declaration.instances; i < list.length; i += 1) {
- var identifier = list[i];
- identifier.alias = alias;
- }
- break;
- }
- }
- }
- };
- FunctionExpression.prototype.transpile = function transpile (code, transforms) {
- Node.prototype.transpile.call(this, code, transforms);
- if (transforms.trailingFunctionCommas && this.params.length) {
- removeTrailingComma(code, this.params[this.params.length - 1].end);
- }
- };
- return FunctionExpression;
- }(Node$1));
- function isReference(node, parent) {
- if (node.type === 'MemberExpression') {
- return !node.computed && isReference(node.object, node);
- }
- if (node.type === 'Identifier') {
-
-
-
- if (!parent) { return true; }
- if (/(Function|Class)Expression/.test(parent.type)) { return false; }
- if (parent.type === 'VariableDeclarator') { return node === parent.init; }
-
- if (
- parent.type === 'MemberExpression' ||
- parent.type === 'MethodDefinition'
- ) {
- return parent.computed || node === parent.object;
- }
- if (parent.type === 'ArrayPattern') { return false; }
-
- if (parent.type === 'Property') {
- if (parent.parent.type === 'ObjectPattern') { return false; }
- return parent.computed || node === parent.value;
- }
-
- if (parent.type === 'MethodDefinition') { return false; }
-
- if (parent.type === 'ExportSpecifier' && node !== parent.local)
- { return false; }
- return true;
- }
- }
- var Identifier = (function (Node) {
- function Identifier () {
- Node.apply(this, arguments);
- }
- if ( Node ) Identifier.__proto__ = Node;
- Identifier.prototype = Object.create( Node && Node.prototype );
- Identifier.prototype.constructor = Identifier;
- Identifier.prototype.findScope = function findScope (functionScope) {
- if (this.parent.params && ~this.parent.params.indexOf(this)) {
- return this.parent.body.scope;
- }
- if (this.parent.type === 'FunctionExpression' && this === this.parent.id) {
- return this.parent.body.scope;
- }
- return this.parent.findScope(functionScope);
- };
- Identifier.prototype.initialise = function initialise (transforms) {
- if (isReference(this, this.parent)) {
- if (
- transforms.arrow &&
- this.name === 'arguments' &&
- !this.findScope(false).contains(this.name)
- ) {
- var lexicalBoundary = this.findLexicalBoundary();
- var arrowFunction = this.findNearest('ArrowFunctionExpression');
- var loop = this.findNearest(loopStatement);
- if (arrowFunction && arrowFunction.depth > lexicalBoundary.depth) {
- this.alias = lexicalBoundary.getArgumentsAlias();
- }
- if (
- loop &&
- loop.body.contains(this) &&
- loop.depth > lexicalBoundary.depth
- ) {
- this.alias = lexicalBoundary.getArgumentsAlias();
- }
- }
- this.findScope(false).addReference(this);
- }
- };
- Identifier.prototype.transpile = function transpile (code) {
- if (this.alias) {
- code.overwrite(this.start, this.end, this.alias, {
- storeName: true,
- contentOnly: true
- });
- }
- if (shouldPrependVm(this)) {
- code.overwrite(this.start, this.end, ("_vm." + (this.name)), {
- storeName: true,
- contentOnly: true
- });
- }
- };
- return Identifier;
- }(Node$1));
- var IfStatement = (function (Node) {
- function IfStatement () {
- Node.apply(this, arguments);
- }
- if ( Node ) IfStatement.__proto__ = Node;
- IfStatement.prototype = Object.create( Node && Node.prototype );
- IfStatement.prototype.constructor = IfStatement;
- IfStatement.prototype.initialise = function initialise (transforms) {
- Node.prototype.initialise.call(this, transforms);
- };
- IfStatement.prototype.transpile = function transpile (code, transforms) {
- if (
- this.consequent.type !== 'BlockStatement' ||
- (this.consequent.type === 'BlockStatement' && this.consequent.synthetic)
- ) {
- code.appendLeft(this.consequent.start, '{ ');
- code.prependRight(this.consequent.end, ' }');
- }
- if (
- this.alternate &&
- this.alternate.type !== 'IfStatement' &&
- (this.alternate.type !== 'BlockStatement' ||
- (this.alternate.type === 'BlockStatement' && this.alternate.synthetic))
- ) {
- code.appendLeft(this.alternate.start, '{ ');
- code.prependRight(this.alternate.end, ' }');
- }
- Node.prototype.transpile.call(this, code, transforms);
- };
- return IfStatement;
- }(Node$1));
- var ImportDeclaration = (function (Node) {
- function ImportDeclaration () {
- Node.apply(this, arguments);
- }
- if ( Node ) ImportDeclaration.__proto__ = Node;
- ImportDeclaration.prototype = Object.create( Node && Node.prototype );
- ImportDeclaration.prototype.constructor = ImportDeclaration;
- ImportDeclaration.prototype.initialise = function initialise (transforms) {
- if (transforms.moduleImport)
- { throw new CompileError('import is not supported', this); }
- Node.prototype.initialise.call(this, transforms);
- };
- return ImportDeclaration;
- }(Node$1));
- var ImportDefaultSpecifier = (function (Node) {
- function ImportDefaultSpecifier () {
- Node.apply(this, arguments);
- }
- if ( Node ) ImportDefaultSpecifier.__proto__ = Node;
- ImportDefaultSpecifier.prototype = Object.create( Node && Node.prototype );
- ImportDefaultSpecifier.prototype.constructor = ImportDefaultSpecifier;
- ImportDefaultSpecifier.prototype.initialise = function initialise (transforms) {
- this.findScope(true).addDeclaration(this.local, 'import');
- Node.prototype.initialise.call(this, transforms);
- };
- return ImportDefaultSpecifier;
- }(Node$1));
- var ImportSpecifier = (function (Node) {
- function ImportSpecifier () {
- Node.apply(this, arguments);
- }
- if ( Node ) ImportSpecifier.__proto__ = Node;
- ImportSpecifier.prototype = Object.create( Node && Node.prototype );
- ImportSpecifier.prototype.constructor = ImportSpecifier;
- ImportSpecifier.prototype.initialise = function initialise (transforms) {
- this.findScope(true).addDeclaration(this.local, 'import');
- Node.prototype.initialise.call(this, transforms);
- };
- return ImportSpecifier;
- }(Node$1));
- var hasDashes = function (val) { return /-/.test(val); };
- var formatKey = function (key) { return (hasDashes(key) ? ("'" + key + "'") : key); };
- var formatVal = function (val) { return (val ? '' : 'true'); };
- var JSXAttribute = (function (Node) {
- function JSXAttribute () {
- Node.apply(this, arguments);
- }
- if ( Node ) JSXAttribute.__proto__ = Node;
- JSXAttribute.prototype = Object.create( Node && Node.prototype );
- JSXAttribute.prototype.constructor = JSXAttribute;
- JSXAttribute.prototype.transpile = function transpile (code, transforms) {
- var ref = this.name;
- var start = ref.start;
- var name = ref.name;
-
- var end = this.value ? this.value.start : this.name.end;
- code.overwrite(start, end, ((formatKey(name)) + ": " + (formatVal(this.value))));
- Node.prototype.transpile.call(this, code, transforms);
- };
- return JSXAttribute;
- }(Node$1));
- function containsNewLine(node) {
- return (
- node.type === 'JSXText' && !/\S/.test(node.value) && /\n/.test(node.value)
- );
- }
- var JSXClosingElement = (function (Node) {
- function JSXClosingElement () {
- Node.apply(this, arguments);
- }
- if ( Node ) JSXClosingElement.__proto__ = Node;
- JSXClosingElement.prototype = Object.create( Node && Node.prototype );
- JSXClosingElement.prototype.constructor = JSXClosingElement;
- JSXClosingElement.prototype.transpile = function transpile (code) {
- var spaceBeforeParen = true;
- var lastChild = this.parent.children[this.parent.children.length - 1];
-
-
-
- if (
- (lastChild && containsNewLine(lastChild)) ||
- this.parent.openingElement.attributes.length
- ) {
- spaceBeforeParen = false;
- }
- code.overwrite(this.start, this.end, spaceBeforeParen ? ' )' : ')');
- };
- return JSXClosingElement;
- }(Node$1));
- function containsNewLine$1(node) {
- return (
- node.type === 'JSXText' && !/\S/.test(node.value) && /\n/.test(node.value)
- );
- }
- var JSXClosingFragment = (function (Node) {
- function JSXClosingFragment () {
- Node.apply(this, arguments);
- }
- if ( Node ) JSXClosingFragment.__proto__ = Node;
- JSXClosingFragment.prototype = Object.create( Node && Node.prototype );
- JSXClosingFragment.prototype.constructor = JSXClosingFragment;
- JSXClosingFragment.prototype.transpile = function transpile (code) {
- var spaceBeforeParen = true;
- var lastChild = this.parent.children[this.parent.children.length - 1];
-
- if (lastChild && containsNewLine$1(lastChild)) {
- spaceBeforeParen = false;
- }
- code.overwrite(this.start, this.end, spaceBeforeParen ? ' )' : ')');
- };
- return JSXClosingFragment;
- }(Node$1));
- function normalise(str, removeTrailingWhitespace) {
- str = str.replace(/\u00a0/g, ' ');
- if (removeTrailingWhitespace && /\n/.test(str)) {
- str = str.replace(/\s+$/, '');
- }
- str = str
- .replace(/^\n\r?\s+/, '')
- .replace(/\s*\n\r?\s*/gm, ' ');
-
- return JSON.stringify(str);
- }
- var JSXElement = (function (Node) {
- function JSXElement () {
- Node.apply(this, arguments);
- }
- if ( Node ) JSXElement.__proto__ = Node;
- JSXElement.prototype = Object.create( Node && Node.prototype );
- JSXElement.prototype.constructor = JSXElement;
- JSXElement.prototype.transpile = function transpile (code, transforms) {
- Node.prototype.transpile.call(this, code, transforms);
- var children = this.children.filter(function (child) {
- if (child.type !== 'JSXText') { return true; }
-
- return /\S/.test(child.raw) || !/\n/.test(child.raw);
- });
- if (children.length) {
- var c = this.openingElement.end;
- var i;
- for (i = 0; i < children.length; i += 1) {
- var child = children[i];
- if (
- child.type === 'JSXExpressionContainer' &&
- child.expression.type === 'JSXEmptyExpression'
- ) {
-
- } else {
- var tail =
- code.original[c] === '\n' && child.type !== 'JSXText' ? '' : ' ';
- code.appendLeft(c, ("," + tail));
- }
- if (child.type === 'JSXText') {
- var str = normalise(child.value, i === children.length - 1);
- code.overwrite(child.start, child.end, str);
- }
- c = child.end;
- }
- }
- };
- return JSXElement;
- }(Node$1));
- var JSXExpressionContainer = (function (Node) {
- function JSXExpressionContainer () {
- Node.apply(this, arguments);
- }
- if ( Node ) JSXExpressionContainer.__proto__ = Node;
- JSXExpressionContainer.prototype = Object.create( Node && Node.prototype );
- JSXExpressionContainer.prototype.constructor = JSXExpressionContainer;
- JSXExpressionContainer.prototype.transpile = function transpile (code, transforms) {
- code.remove(this.start, this.expression.start);
- code.remove(this.expression.end, this.end);
- Node.prototype.transpile.call(this, code, transforms);
- };
- return JSXExpressionContainer;
- }(Node$1));
- var JSXFragment = (function (JSXElement$$1) {
- function JSXFragment () {
- JSXElement$$1.apply(this, arguments);
- }if ( JSXElement$$1 ) JSXFragment.__proto__ = JSXElement$$1;
- JSXFragment.prototype = Object.create( JSXElement$$1 && JSXElement$$1.prototype );
- JSXFragment.prototype.constructor = JSXFragment;
-
- return JSXFragment;
- }(JSXElement));
- var JSXOpeningElement = (function (Node) {
- function JSXOpeningElement () {
- Node.apply(this, arguments);
- }
- if ( Node ) JSXOpeningElement.__proto__ = Node;
- JSXOpeningElement.prototype = Object.create( Node && Node.prototype );
- JSXOpeningElement.prototype.constructor = JSXOpeningElement;
- JSXOpeningElement.prototype.transpile = function transpile (code, transforms) {
- Node.prototype.transpile.call(this, code, transforms);
- code.overwrite(this.start, this.name.start, ((this.program.jsx) + "( "));
- var html =
- this.name.type === 'JSXIdentifier' &&
- this.name.name[0] === this.name.name[0].toLowerCase();
- if (html) { code.prependRight(this.name.start, "'"); }
- var len = this.attributes.length;
- var c = this.name.end;
- if (len) {
- var i;
- var hasSpread = false;
- for (i = 0; i < len; i += 1) {
- if (this.attributes[i].type === 'JSXSpreadAttribute') {
- hasSpread = true;
- break;
- }
- }
- c = this.attributes[0].end;
- for (i = 0; i < len; i += 1) {
- var attr = this.attributes[i];
- if (i > 0) {
- if (attr.start === c) { code.prependRight(c, ', '); }
- else { code.overwrite(c, attr.start, ', '); }
- }
- if (hasSpread && attr.type !== 'JSXSpreadAttribute') {
- var lastAttr = this.attributes[i - 1];
- var nextAttr = this.attributes[i + 1];
- if (!lastAttr || lastAttr.type === 'JSXSpreadAttribute') {
- code.prependRight(attr.start, '{ ');
- }
- if (!nextAttr || nextAttr.type === 'JSXSpreadAttribute') {
- code.appendLeft(attr.end, ' }');
- }
- }
- c = attr.end;
- }
- var after;
- var before;
- if (hasSpread) {
- if (len === 1) {
- before = html ? "'," : ',';
- } else {
- if (!this.program.options.objectAssign) {
- throw new CompileError(
- "Mixed JSX attributes ending in spread requires specified objectAssign option with 'Object.assign' or polyfill helper.",
- this
- );
- }
- before = html
- ? ("', " + (this.program.options.objectAssign) + "({},")
- : (", " + (this.program.options.objectAssign) + "({},");
- after = ')';
- }
- } else {
- before = html ? "', {" : ', {';
- after = ' }';
- }
- code.prependRight(this.name.end, before);
- if (after) {
- code.appendLeft(this.attributes[len - 1].end, after);
- }
- } else {
- code.appendLeft(this.name.end, html ? "', null" : ", null");
- c = this.name.end;
- }
- if (this.selfClosing) {
- code.overwrite(c, this.end, this.attributes.length ? ")" : " )");
- } else {
- code.remove(c, this.end);
- }
- };
- return JSXOpeningElement;
- }(Node$1));
- var JSXOpeningFragment = (function (Node) {
- function JSXOpeningFragment () {
- Node.apply(this, arguments);
- }
- if ( Node ) JSXOpeningFragment.__proto__ = Node;
- JSXOpeningFragment.prototype = Object.create( Node && Node.prototype );
- JSXOpeningFragment.prototype.constructor = JSXOpeningFragment;
- JSXOpeningFragment.prototype.transpile = function transpile (code, transforms) {
- code.overwrite(this.start, this.end, ((this.program.jsx) + "( React.Fragment, null"));
- };
- return JSXOpeningFragment;
- }(Node$1));
- var JSXSpreadAttribute = (function (Node) {
- function JSXSpreadAttribute () {
- Node.apply(this, arguments);
- }
- if ( Node ) JSXSpreadAttribute.__proto__ = Node;
- JSXSpreadAttribute.prototype = Object.create( Node && Node.prototype );
- JSXSpreadAttribute.prototype.constructor = JSXSpreadAttribute;
- JSXSpreadAttribute.prototype.transpile = function transpile (code, transforms) {
- code.remove(this.start, this.argument.start);
- code.remove(this.argument.end, this.end);
- Node.prototype.transpile.call(this, code, transforms);
- };
- return JSXSpreadAttribute;
- }(Node$1));
- var regjsgen = createCommonjsModule(function (module, exports) {
- (function() {
- var objectTypes = {
- 'function': true,
- 'object': true
- };
-
- var root = (objectTypes[typeof window] && window) || this;
-
- var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports;
-
- var hasFreeModule = objectTypes['object'] && module && !module.nodeType;
-
- var freeGlobal = freeExports && hasFreeModule && typeof commonjsGlobal == 'object' && commonjsGlobal;
- if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
- root = freeGlobal;
- }
-
- var hasOwnProperty = Object.prototype.hasOwnProperty;
-
-
-
- function fromCodePoint() {
- var codePoint = Number(arguments[0]);
- if (
- !isFinite(codePoint) ||
- codePoint < 0 ||
- codePoint > 0x10FFFF ||
- Math.floor(codePoint) != codePoint
- ) {
- throw RangeError('Invalid code point: ' + codePoint);
- }
- if (codePoint <= 0xFFFF) {
-
- return String.fromCharCode(codePoint);
- } else {
-
-
- codePoint -= 0x10000;
- var highSurrogate = (codePoint >> 10) + 0xD800;
- var lowSurrogate = (codePoint % 0x400) + 0xDC00;
- return String.fromCharCode(highSurrogate, lowSurrogate);
- }
- }
-
-
- var assertTypeRegexMap = {};
- function assertType(type, expected) {
- if (expected.indexOf('|') == -1) {
- if (type == expected) {
- return;
- }
- throw Error('Invalid node type: ' + type + '; expected type: ' + expected);
- }
- expected = hasOwnProperty.call(assertTypeRegexMap, expected)
- ? assertTypeRegexMap[expected]
- : (assertTypeRegexMap[expected] = RegExp('^(?:' + expected + ')$'));
- if (expected.test(type)) {
- return;
- }
- throw Error('Invalid node type: ' + type + '; expected types: ' + expected);
- }
-
-
- function generate(node) {
- var type = node.type;
- if (hasOwnProperty.call(generators, type)) {
- return generators[type](node);
- }
- throw Error('Invalid node type: ' + type);
- }
-
- function generateAlternative(node) {
- assertType(node.type, 'alternative');
- var terms = node.body,
- i = -1,
- length = terms.length,
- result = '';
- while (++i < length) {
- result += generateTerm(terms[i]);
- }
- return result;
- }
- function generateAnchor(node) {
- assertType(node.type, 'anchor');
- switch (node.kind) {
- case 'start':
- return '^';
- case 'end':
- return '$';
- case 'boundary':
- return '\\b';
- case 'not-boundary':
- return '\\B';
- default:
- throw Error('Invalid assertion');
- }
- }
- function generateAtom(node) {
- assertType(node.type, 'anchor|characterClass|characterClassEscape|dot|group|reference|value');
- return generate(node);
- }
- function generateCharacterClass(node) {
- assertType(node.type, 'characterClass');
- var classRanges = node.body,
- i = -1,
- length = classRanges.length,
- result = '';
- if (node.negative) {
- result += '^';
- }
- while (++i < length) {
- result += generateClassAtom(classRanges[i]);
- }
- return '[' + result + ']';
- }
- function generateCharacterClassEscape(node) {
- assertType(node.type, 'characterClassEscape');
- return '\\' + node.value;
- }
- function generateUnicodePropertyEscape(node) {
- assertType(node.type, 'unicodePropertyEscape');
- return '\\' + (node.negative ? 'P' : 'p') + '{' + node.value + '}';
- }
- function generateCharacterClassRange(node) {
- assertType(node.type, 'characterClassRange');
- var min = node.min,
- max = node.max;
- if (min.type == 'characterClassRange' || max.type == 'characterClassRange') {
- throw Error('Invalid character class range');
- }
- return generateClassAtom(min) + '-' + generateClassAtom(max);
- }
- function generateClassAtom(node) {
- assertType(node.type, 'anchor|characterClassEscape|characterClassRange|dot|value');
- return generate(node);
- }
- function generateDisjunction(node) {
- assertType(node.type, 'disjunction');
- var body = node.body,
- i = -1,
- length = body.length,
- result = '';
- while (++i < length) {
- if (i != 0) {
- result += '|';
- }
- result += generate(body[i]);
- }
- return result;
- }
- function generateDot(node) {
- assertType(node.type, 'dot');
- return '.';
- }
- function generateGroup(node) {
- assertType(node.type, 'group');
- var result = '';
- switch (node.behavior) {
- case 'normal':
- if (node.name) {
- result += '?<' + generateIdentifier(node.name) + '>';
- }
- break;
- case 'ignore':
- result += '?:';
- break;
- case 'lookahead':
- result += '?=';
- break;
- case 'negativeLookahead':
- result += '?!';
- break;
- case 'lookbehind':
- result += '?<=';
- break;
- case 'negativeLookbehind':
- result += '?<!';
- break;
- default:
- throw Error('Invalid behaviour: ' + node.behaviour);
- }
- var body = node.body,
- i = -1,
- length = body.length;
- while (++i < length) {
- result += generate(body[i]);
- }
- return '(' + result + ')';
- }
- function generateIdentifier(node) {
- assertType(node.type, 'identifier');
- return node.value;
- }
- function generateQuantifier(node) {
- assertType(node.type, 'quantifier');
- var quantifier = '',
- min = node.min,
- max = node.max;
- if (max == null) {
- if (min == 0) {
- quantifier = '*';
- } else if (min == 1) {
- quantifier = '+';
- } else {
- quantifier = '{' + min + ',}';
- }
- } else if (min == max) {
- quantifier = '{' + min + '}';
- } else if (min == 0 && max == 1) {
- quantifier = '?';
- } else {
- quantifier = '{' + min + ',' + max + '}';
- }
- if (!node.greedy) {
- quantifier += '?';
- }
- return generateAtom(node.body[0]) + quantifier;
- }
- function generateReference(node) {
- assertType(node.type, 'reference');
- if (node.matchIndex) {
- return '\\' + node.matchIndex;
- }
- if (node.name) {
- return '\\k<' + generateIdentifier(node.name) + '>';
- }
- throw new Error('Unknown reference type');
- }
- function generateTerm(node) {
- assertType(node.type, 'anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|unicodePropertyEscape|value');
- return generate(node);
- }
- function generateValue(node) {
- assertType(node.type, 'value');
- var kind = node.kind,
- codePoint = node.codePoint;
- if (typeof codePoint != 'number') {
- throw new Error('Invalid code point: ' + codePoint);
- }
- switch (kind) {
- case 'controlLetter':
- return '\\c' + fromCodePoint(codePoint + 64);
- case 'hexadecimalEscape':
- return '\\x' + ('00' + codePoint.toString(16).toUpperCase()).slice(-2);
- case 'identifier':
- return '\\' + fromCodePoint(codePoint);
- case 'null':
- return '\\' + codePoint;
- case 'octal':
- return '\\' + codePoint.toString(8);
- case 'singleEscape':
- switch (codePoint) {
- case 0x0008:
- return '\\b';
- case 0x0009:
- return '\\t';
- case 0x000A:
- return '\\n';
- case 0x000B:
- return '\\v';
- case 0x000C:
- return '\\f';
- case 0x000D:
- return '\\r';
- default:
- throw Error('Invalid code point: ' + codePoint);
- }
- case 'symbol':
- return fromCodePoint(codePoint);
- case 'unicodeEscape':
- return '\\u' + ('0000' + codePoint.toString(16).toUpperCase()).slice(-4);
- case 'unicodeCodePointEscape':
- return '\\u{' + codePoint.toString(16).toUpperCase() + '}';
- default:
- throw Error('Unsupported node kind: ' + kind);
- }
- }
-
-
- var generators = {
- 'alternative': generateAlternative,
- 'anchor': generateAnchor,
- 'characterClass': generateCharacterClass,
- 'characterClassEscape': generateCharacterClassEscape,
- 'characterClassRange': generateCharacterClassRange,
- 'unicodePropertyEscape': generateUnicodePropertyEscape,
- 'disjunction': generateDisjunction,
- 'dot': generateDot,
- 'group': generateGroup,
- 'quantifier': generateQuantifier,
- 'reference': generateReference,
- 'value': generateValue
- };
-
-
- var regjsgen = {
- 'generate': generate
- };
-
- if (typeof undefined == 'function' && typeof undefined.amd == 'object' && undefined.amd) {
-
- undefined(function() {
- return regjsgen;
- });
- root.regjsgen = regjsgen;
- }
-
- else if (freeExports && hasFreeModule) {
-
- freeExports.generate = generate;
- }
- else {
-
- root.regjsgen = regjsgen;
- }
- }.call(commonjsGlobal));
- });
- var parser = createCommonjsModule(function (module) {
- (function() {
- var fromCodePoint = String.fromCodePoint || (function() {
-
-
- var stringFromCharCode = String.fromCharCode;
- var floor = Math.floor;
- return function fromCodePoint() {
- var MAX_SIZE = 0x4000;
- var codeUnits = [];
- var highSurrogate;
- var lowSurrogate;
- var index = -1;
- var length = arguments.length;
- if (!length) {
- return '';
- }
- var result = '';
- while (++index < length) {
- var codePoint = Number(arguments[index]);
- if (
- !isFinite(codePoint) ||
- codePoint < 0 ||
- codePoint > 0x10FFFF ||
- floor(codePoint) != codePoint
- ) {
- throw RangeError('Invalid code point: ' + codePoint);
- }
- if (codePoint <= 0xFFFF) {
- codeUnits.push(codePoint);
- } else {
-
- codePoint -= 0x10000;
- highSurrogate = (codePoint >> 10) + 0xD800;
- lowSurrogate = (codePoint % 0x400) + 0xDC00;
- codeUnits.push(highSurrogate, lowSurrogate);
- }
- if (index + 1 == length || codeUnits.length > MAX_SIZE) {
- result += stringFromCharCode.apply(null, codeUnits);
- codeUnits.length = 0;
- }
- }
- return result;
- };
- }());
- function parse(str, flags, features) {
- if (!features) {
- features = {};
- }
- function addRaw(node) {
- node.raw = str.substring(node.range[0], node.range[1]);
- return node;
- }
- function updateRawStart(node, start) {
- node.range[0] = start;
- return addRaw(node);
- }
- function createAnchor(kind, rawLength) {
- return addRaw({
- type: 'anchor',
- kind: kind,
- range: [
- pos - rawLength,
- pos
- ]
- });
- }
- function createValue(kind, codePoint, from, to) {
- return addRaw({
- type: 'value',
- kind: kind,
- codePoint: codePoint,
- range: [from, to]
- });
- }
- function createEscaped(kind, codePoint, value, fromOffset) {
- fromOffset = fromOffset || 0;
- return createValue(kind, codePoint, pos - (value.length + fromOffset), pos);
- }
- function createCharacter(matches) {
- var _char = matches[0];
- var first = _char.charCodeAt(0);
- if (hasUnicodeFlag) {
- var second;
- if (_char.length === 1 && first >= 0xD800 && first <= 0xDBFF) {
- second = lookahead().charCodeAt(0);
- if (second >= 0xDC00 && second <= 0xDFFF) {
-
- pos++;
- return createValue(
- 'symbol',
- (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000,
- pos - 2, pos);
- }
- }
- }
- return createValue('symbol', first, pos - 1, pos);
- }
- function createDisjunction(alternatives, from, to) {
- return addRaw({
- type: 'disjunction',
- body: alternatives,
- range: [
- from,
- to
- ]
- });
- }
- function createDot() {
- return addRaw({
- type: 'dot',
- range: [
- pos - 1,
- pos
- ]
- });
- }
- function createCharacterClassEscape(value) {
- return addRaw({
- type: 'characterClassEscape',
- value: value,
- range: [
- pos - 2,
- pos
- ]
- });
- }
- function createReference(matchIndex) {
- return addRaw({
- type: 'reference',
- matchIndex: parseInt(matchIndex, 10),
- range: [
- pos - 1 - matchIndex.length,
- pos
- ]
- });
- }
- function createNamedReference(name) {
- return addRaw({
- type: 'reference',
- name: name,
- range: [
- name.range[0] - 3,
- pos
- ]
- });
- }
- function createGroup(behavior, disjunction, from, to) {
- return addRaw({
- type: 'group',
- behavior: behavior,
- body: disjunction,
- range: [
- from,
- to
- ]
- });
- }
- function createQuantifier(min, max, from, to) {
- if (to == null) {
- from = pos - 1;
- to = pos;
- }
- return addRaw({
- type: 'quantifier',
- min: min,
- max: max,
- greedy: true,
- body: null,
- range: [
- from,
- to
- ]
- });
- }
- function createAlternative(terms, from, to) {
- return addRaw({
- type: 'alternative',
- body: terms,
- range: [
- from,
- to
- ]
- });
- }
- function createCharacterClass(classRanges, negative, from, to) {
- return addRaw({
- type: 'characterClass',
- body: classRanges,
- negative: negative,
- range: [
- from,
- to
- ]
- });
- }
- function createClassRange(min, max, from, to) {
-
- if (min.codePoint > max.codePoint) {
- bail('invalid range in character class', min.raw + '-' + max.raw, from, to);
- }
- return addRaw({
- type: 'characterClassRange',
- min: min,
- max: max,
- range: [
- from,
- to
- ]
- });
- }
- function flattenBody(body) {
- if (body.type === 'alternative') {
- return body.body;
- } else {
- return [body];
- }
- }
- function incr(amount) {
- amount = (amount || 1);
- var res = str.substring(pos, pos + amount);
- pos += (amount || 1);
- return res;
- }
- function skip(value) {
- if (!match(value)) {
- bail('character', value);
- }
- }
- function match(value) {
- if (str.indexOf(value, pos) === pos) {
- return incr(value.length);
- }
- }
- function lookahead() {
- return str[pos];
- }
- function current(value) {
- return str.indexOf(value, pos) === pos;
- }
- function next(value) {
- return str[pos + 1] === value;
- }
- function matchReg(regExp) {
- var subStr = str.substring(pos);
- var res = subStr.match(regExp);
- if (res) {
- res.range = [];
- res.range[0] = pos;
- incr(res[0].length);
- res.range[1] = pos;
- }
- return res;
- }
- function parseDisjunction() {
-
-
-
- var res = [], from = pos;
- res.push(parseAlternative());
- while (match('|')) {
- res.push(parseAlternative());
- }
- if (res.length === 1) {
- return res[0];
- }
- return createDisjunction(res, from, pos);
- }
- function parseAlternative() {
- var res = [], from = pos;
- var term;
-
-
-
- while (term = parseTerm()) {
- res.push(term);
- }
- if (res.length === 1) {
- return res[0];
- }
- return createAlternative(res, from, pos);
- }
- function parseTerm() {
-
-
-
-
- if (pos >= str.length || current('|') || current(')')) {
- return null;
- }
- var anchor = parseAnchor();
- if (anchor) {
- return anchor;
- }
- var atom = parseAtom();
- if (!atom) {
- bail('Expected atom');
- }
- var quantifier = parseQuantifier() || false;
- if (quantifier) {
- quantifier.body = flattenBody(atom);
-
-
- updateRawStart(quantifier, atom.range[0]);
- return quantifier;
- }
- return atom;
- }
- function parseGroup(matchA, typeA, matchB, typeB) {
- var type = null, from = pos;
- if (match(matchA)) {
- type = typeA;
- } else if (match(matchB)) {
- type = typeB;
- } else {
- return false;
- }
- return finishGroup(type, from);
- }
- function finishGroup(type, from) {
- var body = parseDisjunction();
- if (!body) {
- bail('Expected disjunction');
- }
- skip(')');
- var group = createGroup(type, flattenBody(body), from, pos);
- if (type == 'normal') {
-
-
-
- if (firstIteration) {
- closedCaptureCounter++;
- }
- }
- return group;
- }
- function parseAnchor() {
-
-
-
-
-
-
-
- if (match('^')) {
- return createAnchor('start', 1 );
- } else if (match('$')) {
- return createAnchor('end', 1 );
- } else if (match('\\b')) {
- return createAnchor('boundary', 2 );
- } else if (match('\\B')) {
- return createAnchor('not-boundary', 2 );
- } else {
- return parseGroup('(?=', 'lookahead', '(?!', 'negativeLookahead');
- }
- }
- function parseQuantifier() {
-
-
-
-
-
-
-
-
-
-
-
- var res, from = pos;
- var quantifier;
- var min, max;
- if (match('*')) {
- quantifier = createQuantifier(0);
- }
- else if (match('+')) {
- quantifier = createQuantifier(1);
- }
- else if (match('?')) {
- quantifier = createQuantifier(0, 1);
- }
- else if (res = matchReg(/^\{([0-9]+)\}/)) {
- min = parseInt(res[1], 10);
- quantifier = createQuantifier(min, min, res.range[0], res.range[1]);
- }
- else if (res = matchReg(/^\{([0-9]+),\}/)) {
- min = parseInt(res[1], 10);
- quantifier = createQuantifier(min, undefined, res.range[0], res.range[1]);
- }
- else if (res = matchReg(/^\{([0-9]+),([0-9]+)\}/)) {
- min = parseInt(res[1], 10);
- max = parseInt(res[2], 10);
- if (min > max) {
- bail('numbers out of order in {} quantifier', '', from, pos);
- }
- quantifier = createQuantifier(min, max, res.range[0], res.range[1]);
- }
- if (quantifier) {
- if (match('?')) {
- quantifier.greedy = false;
- quantifier.range[1] += 1;
- }
- }
- return quantifier;
- }
- function parseAtom() {
-
-
-
-
-
-
-
- var res;
-
-
-
- if (res = matchReg(/^[^^$\\.*+?(){[|]/)) {
-
- return createCharacter(res);
- }
- else if (match('.')) {
-
- return createDot();
- }
- else if (match('\\')) {
-
- res = parseAtomEscape();
- if (!res) {
- if (!hasUnicodeFlag && lookahead() == 'c') {
-
-
- return createValue('symbol', 92, pos - 1, pos);
- }
- bail('atomEscape');
- }
- return res;
- }
- else if (res = parseCharacterClass()) {
- return res;
- }
- else if (features.lookbehind && (res = parseGroup('(?<=', 'lookbehind', '(?<!', 'negativeLookbehind'))) {
- return res;
- }
- else if (features.namedGroups && match("(?<")) {
- var name = parseIdentifier();
- skip(">");
- var group = finishGroup("normal", name.range[0] - 3);
- group.name = name;
- return group;
- }
- else {
-
-
- return parseGroup('(?:', 'ignore', '(', 'normal');
- }
- }
- function parseUnicodeSurrogatePairEscape(firstEscape) {
- if (hasUnicodeFlag) {
- var first, second;
- if (firstEscape.kind == 'unicodeEscape' &&
- (first = firstEscape.codePoint) >= 0xD800 && first <= 0xDBFF &&
- current('\\') && next('u') ) {
- var prevPos = pos;
- pos++;
- var secondEscape = parseClassEscape();
- if (secondEscape.kind == 'unicodeEscape' &&
- (second = secondEscape.codePoint) >= 0xDC00 && second <= 0xDFFF) {
-
- firstEscape.range[1] = secondEscape.range[1];
- firstEscape.codePoint = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
- firstEscape.type = 'value';
- firstEscape.kind = 'unicodeCodePointEscape';
- addRaw(firstEscape);
- }
- else {
- pos = prevPos;
- }
- }
- }
- return firstEscape;
- }
- function parseClassEscape() {
- return parseAtomEscape(true);
- }
- function parseAtomEscape(insideCharacterClass) {
-
-
-
-
-
- var res, from = pos;
- res = parseDecimalEscape() || parseNamedReference();
- if (res) {
- return res;
- }
-
- if (insideCharacterClass) {
- if (match('b')) {
-
-
-
- return createEscaped('singleEscape', 0x0008, '\\b');
- } else if (match('B')) {
- bail('\\B not possible inside of CharacterClass', '', from);
- } else if (!hasUnicodeFlag && (res = matchReg(/^c([0-9])/))) {
-
-
- return createEscaped('controlLetter', res[1] + 16, res[1], 2);
- }
- }
- res = parseCharacterEscape();
- return res;
- }
- function parseDecimalEscape() {
-
-
-
- var res, match;
- if (res = matchReg(/^(?!0)\d+/)) {
- match = res[0];
- var refIdx = parseInt(res[0], 10);
- if (refIdx <= closedCaptureCounter) {
-
-
- return createReference(res[0]);
- } else {
-
-
-
-
-
-
- backrefDenied.push(refIdx);
-
-
-
- incr(-res[0].length);
- if (res = matchReg(/^[0-7]{1,3}/)) {
- return createEscaped('octal', parseInt(res[0], 8), res[0], 1);
- } else {
-
-
-
-
-
- res = createCharacter(matchReg(/^[89]/));
- return updateRawStart(res, res.range[0] - 1);
- }
- }
- }
-
-
-
-
-
-
-
- else if (res = matchReg(/^[0-7]{1,3}/)) {
- match = res[0];
- if (/^0{1,3}$/.test(match)) {
-
- return createEscaped('null', 0x0000, '0', match.length + 1);
- } else {
- return createEscaped('octal', parseInt(match, 8), match, 1);
- }
- } else if (res = matchReg(/^[dDsSwW]/)) {
- return createCharacterClassEscape(res[0]);
- }
- return false;
- }
- function parseNamedReference() {
- if (features.namedGroups && matchReg(/^k<(?=.*?>)/)) {
- var name = parseIdentifier();
- skip('>');
- return createNamedReference(name);
- }
- }
- function parseRegExpUnicodeEscapeSequence() {
- var res;
- if (res = matchReg(/^u([0-9a-fA-F]{4})/)) {
-
- return parseUnicodeSurrogatePairEscape(
- createEscaped('unicodeEscape', parseInt(res[1], 16), res[1], 2)
- );
- } else if (hasUnicodeFlag && (res = matchReg(/^u\{([0-9a-fA-F]+)\}/))) {
-
- return createEscaped('unicodeCodePointEscape', parseInt(res[1], 16), res[1], 4);
- }
- }
- function parseCharacterEscape() {
-
-
-
-
-
-
- var res;
- var from = pos;
- if (res = matchReg(/^[fnrtv]/)) {
-
- var codePoint = 0;
- switch (res[0]) {
- case 't': codePoint = 0x009; break;
- case 'n': codePoint = 0x00A; break;
- case 'v': codePoint = 0x00B; break;
- case 'f': codePoint = 0x00C; break;
- case 'r': codePoint = 0x00D; break;
- }
- return createEscaped('singleEscape', codePoint, '\\' + res[0]);
- } else if (res = matchReg(/^c([a-zA-Z])/)) {
-
- return createEscaped('controlLetter', res[1].charCodeAt(0) % 32, res[1], 2);
- } else if (res = matchReg(/^x([0-9a-fA-F]{2})/)) {
-
- return createEscaped('hexadecimalEscape', parseInt(res[1], 16), res[1], 2);
- } else if (res = parseRegExpUnicodeEscapeSequence()) {
- if (!res || res.codePoint > 0x10FFFF) {
- bail('Invalid escape sequence', null, from, pos);
- }
- return res;
- } else if (features.unicodePropertyEscape && hasUnicodeFlag && (res = matchReg(/^([pP])\{([^\}]+)\}/))) {
-
- return addRaw({
- type: 'unicodePropertyEscape',
- negative: res[1] === 'P',
- value: res[2],
- range: [res.range[0] - 1, res.range[1]],
- raw: res[0]
- });
- } else {
-
- return parseIdentityEscape();
- }
- }
- function parseIdentifierAtom(check) {
- var ch = lookahead();
- var from = pos;
- if (ch === '\\') {
- incr();
- var esc = parseRegExpUnicodeEscapeSequence();
- if (!esc || !check(esc.codePoint)) {
- bail('Invalid escape sequence', null, from, pos);
- }
- return fromCodePoint(esc.codePoint);
- }
- var code = ch.charCodeAt(0);
- if (code >= 0xD800 && code <= 0xDBFF) {
- ch += str[pos + 1];
- var second = ch.charCodeAt(1);
- if (second >= 0xDC00 && second <= 0xDFFF) {
-
- code = (code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
- }
- }
- if (!check(code)) return;
- incr();
- if (code > 0xFFFF) incr();
- return ch;
- }
- function parseIdentifier() {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var start = pos;
- var res = parseIdentifierAtom(isIdentifierStart);
- if (!res) {
- bail('Invalid identifier');
- }
- var ch;
- while (ch = parseIdentifierAtom(isIdentifierPart)) {
- res += ch;
- }
- return addRaw({
- type: 'identifier',
- value: res,
- range: [start, pos]
- });
- }
- function isIdentifierStart(ch) {
-
- var NonAsciiIdentifierStart = /[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFF1]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
- return (ch === 36) || (ch === 95) ||
- (ch >= 65 && ch <= 90) ||
- (ch >= 97 && ch <= 122) ||
- ((ch >= 0x80) && NonAsciiIdentifierStart.test(fromCodePoint(ch)));
- }
-
- function isIdentifierPart(ch) {
-
- var NonAsciiIdentifierPartOnly = /[0-9_\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDD30-\uDD39\uDF46-\uDF50]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC66-\uDC6F\uDC7F-\uDC82\uDCB0-\uDCBA\uDCF0-\uDCF9\uDD00-\uDD02\uDD27-\uDD34\uDD36-\uDD3F\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDD0-\uDDD9\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC50-\uDC59\uDC5E\uDCB0-\uDCC3\uDCD0-\uDCD9\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDE50-\uDE59\uDEAB-\uDEB7\uDEC0-\uDEC9\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC2C-\uDC3A\uDCE0-\uDCE9\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC50-\uDC59\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD50-\uDD59\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDDA0-\uDDA9\uDEF3-\uDEF6]|\uD81A[\uDE60-\uDE69\uDEF0-\uDEF4\uDF30-\uDF36\uDF50-\uDF59]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A\uDD50-\uDD59]|\uDB40[\uDD00-\uDDEF]/;
- return isIdentifierStart(ch) ||
- (ch >= 48 && ch <= 57) ||
- ((ch >= 0x80) && NonAsciiIdentifierPartOnly.test(fromCodePoint(ch)));
- }
- function parseIdentityEscape() {
-
-
- var tmp;
- if (lookahead() !== 'c') {
- tmp = incr();
- return createEscaped('identifier', tmp.charCodeAt(0), tmp, 1);
- }
- return null;
- }
- function parseCharacterClass() {
-
-
-
- var res, from = pos;
- if (res = matchReg(/^\[\^/)) {
- res = parseClassRanges();
- skip(']');
- return createCharacterClass(res, true, from, pos);
- } else if (match('[')) {
- res = parseClassRanges();
- skip(']');
- return createCharacterClass(res, false, from, pos);
- }
- return null;
- }
- function parseClassRanges() {
-
-
-
- var res;
- if (current(']')) {
-
- return [];
- } else {
- res = parseNonemptyClassRanges();
- if (!res) {
- bail('nonEmptyClassRanges');
- }
- return res;
- }
- }
- function parseHelperClassRanges(atom) {
- var from, to, res;
- if (current('-') && !next(']')) {
-
- skip('-');
- res = parseClassAtom();
- if (!res) {
- bail('classAtom');
- }
- to = pos;
- var classRanges = parseClassRanges();
- if (!classRanges) {
- bail('classRanges');
- }
- from = atom.range[0];
- if (classRanges.type === 'empty') {
- return [createClassRange(atom, res, from, to)];
- }
- return [createClassRange(atom, res, from, to)].concat(classRanges);
- }
- res = parseNonemptyClassRangesNoDash();
- if (!res) {
- bail('nonEmptyClassRangesNoDash');
- }
- return [atom].concat(res);
- }
- function parseNonemptyClassRanges() {
-
-
-
-
- var atom = parseClassAtom();
- if (!atom) {
- bail('classAtom');
- }
- if (current(']')) {
-
- return [atom];
- }
-
-
- return parseHelperClassRanges(atom);
- }
- function parseNonemptyClassRangesNoDash() {
-
-
-
-
- var res = parseClassAtom();
- if (!res) {
- bail('classAtom');
- }
- if (current(']')) {
-
- return res;
- }
-
-
- return parseHelperClassRanges(res);
- }
- function parseClassAtom() {
-
-
-
- if (match('-')) {
- return createCharacter('-');
- } else {
- return parseClassAtomNoDash();
- }
- }
- function parseClassAtomNoDash() {
-
-
-
- var res;
- if (res = matchReg(/^[^\\\]-]/)) {
- return createCharacter(res[0]);
- } else if (match('\\')) {
- res = parseClassEscape();
- if (!res) {
- bail('classEscape');
- }
- return parseUnicodeSurrogatePairEscape(res);
- }
- }
- function bail(message, details, from, to) {
- from = from == null ? pos : from;
- to = to == null ? from : to;
- var contextStart = Math.max(0, from - 10);
- var contextEnd = Math.min(to + 10, str.length);
-
-
-
- var context = ' ' + str.substring(contextStart, contextEnd);
- var pointer = ' ' + new Array(from - contextStart + 1).join(' ') + '^';
- throw SyntaxError(message + ' at position ' + from + (details ? ': ' + details : '') + '\n' + context + '\n' + pointer);
- }
- var backrefDenied = [];
- var closedCaptureCounter = 0;
- var firstIteration = true;
- var hasUnicodeFlag = (flags || "").indexOf("u") !== -1;
- var pos = 0;
-
- str = String(str);
- if (str === '') {
- str = '(?:)';
- }
- var result = parseDisjunction();
- if (result.range[1] !== str.length) {
- bail('Could not parse entire input - got stuck', '', result.range[1]);
- }
-
-
-
-
-
-
-
-
- for (var i = 0; i < backrefDenied.length; i++) {
- if (backrefDenied[i] <= closedCaptureCounter) {
-
- pos = 0;
- firstIteration = false;
- return parseDisjunction();
- }
- }
- return result;
- }
- var regjsparser = {
- parse: parse
- };
- if ('object' !== 'undefined' && module.exports) {
- module.exports = regjsparser;
- } else {
- window.regjsparser = regjsparser;
- }
- }());
- });
- var regenerate = createCommonjsModule(function (module, exports) {
- (function(root) {
-
- var freeExports = 'object' == 'object' && exports;
-
- var freeModule = 'object' == 'object' && module &&
- module.exports == freeExports && module;
-
-
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal;
- if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
- root = freeGlobal;
- }
-
- var ERRORS = {
- 'rangeOrder': 'A range\u2019s `stop` value must be greater than or equal ' +
- 'to the `start` value.',
- 'codePointRange': 'Invalid code point value. Code points range from ' +
- 'U+000000 to U+10FFFF.'
- };
-
- var HIGH_SURROGATE_MIN = 0xD800;
- var HIGH_SURROGATE_MAX = 0xDBFF;
- var LOW_SURROGATE_MIN = 0xDC00;
- var LOW_SURROGATE_MAX = 0xDFFF;
-
-
- var regexNull = /\\x00([^0123456789]|$)/g;
- var object = {};
- var hasOwnProperty = object.hasOwnProperty;
- var extend = function(destination, source) {
- var key;
- for (key in source) {
- if (hasOwnProperty.call(source, key)) {
- destination[key] = source[key];
- }
- }
- return destination;
- };
- var forEach = function(array, callback) {
- var index = -1;
- var length = array.length;
- while (++index < length) {
- callback(array[index], index);
- }
- };
- var toString = object.toString;
- var isArray = function(value) {
- return toString.call(value) == '[object Array]';
- };
- var isNumber = function(value) {
- return typeof value == 'number' ||
- toString.call(value) == '[object Number]';
- };
-
-
- var zeroes = '0000';
- var pad = function(number, totalCharacters) {
- var string = String(number);
- return string.length < totalCharacters
- ? (zeroes + string).slice(-totalCharacters)
- : string;
- };
- var hex = function(number) {
- return Number(number).toString(16).toUpperCase();
- };
- var slice = [].slice;
-
- var dataFromCodePoints = function(codePoints) {
- var index = -1;
- var length = codePoints.length;
- var max = length - 1;
- var result = [];
- var isStart = true;
- var tmp;
- var previous = 0;
- while (++index < length) {
- tmp = codePoints[index];
- if (isStart) {
- result.push(tmp);
- previous = tmp;
- isStart = false;
- } else {
- if (tmp == previous + 1) {
- if (index != max) {
- previous = tmp;
- continue;
- } else {
- isStart = true;
- result.push(tmp + 1);
- }
- } else {
-
- result.push(previous + 1, tmp);
- previous = tmp;
- }
- }
- }
- if (!isStart) {
- result.push(tmp + 1);
- }
- return result;
- };
- var dataRemove = function(data, codePoint) {
-
- var index = 0;
- var start;
- var end;
- var length = data.length;
- while (index < length) {
- start = data[index];
- end = data[index + 1];
- if (codePoint >= start && codePoint < end) {
-
- if (codePoint == start) {
- if (end == start + 1) {
-
- data.splice(index, 2);
- return data;
- } else {
-
- data[index] = codePoint + 1;
- return data;
- }
- } else if (codePoint == end - 1) {
-
- data[index + 1] = codePoint;
- return data;
- } else {
-
- data.splice(index, 2, start, codePoint, codePoint + 1, end);
- return data;
- }
- }
- index += 2;
- }
- return data;
- };
- var dataRemoveRange = function(data, rangeStart, rangeEnd) {
- if (rangeEnd < rangeStart) {
- throw Error(ERRORS.rangeOrder);
- }
-
- var index = 0;
- var start;
- var end;
- while (index < data.length) {
- start = data[index];
- end = data[index + 1] - 1;
-
- if (start > rangeEnd) {
- return data;
- }
-
-
-
-
- if (rangeStart <= start && rangeEnd >= end) {
-
- data.splice(index, 2);
- continue;
- }
-
-
-
- if (rangeStart >= start && rangeEnd < end) {
- if (rangeStart == start) {
-
- data[index] = rangeEnd + 1;
- data[index + 1] = end + 1;
- return data;
- }
-
- data.splice(index, 2, start, rangeStart, rangeEnd + 1, end + 1);
- return data;
- }
-
-
- if (rangeStart >= start && rangeStart <= end) {
-
- data[index + 1] = rangeStart;
-
-
-
-
- }
-
-
- else if (rangeEnd >= start && rangeEnd <= end) {
-
- data[index] = rangeEnd + 1;
- return data;
- }
- index += 2;
- }
- return data;
- };
- var dataAdd = function(data, codePoint) {
-
- var index = 0;
- var start;
- var end;
- var lastIndex = null;
- var length = data.length;
- if (codePoint < 0x0 || codePoint > 0x10FFFF) {
- throw RangeError(ERRORS.codePointRange);
- }
- while (index < length) {
- start = data[index];
- end = data[index + 1];
-
- if (codePoint >= start && codePoint < end) {
- return data;
- }
- if (codePoint == start - 1) {
-
- data[index] = codePoint;
- return data;
- }
-
-
-
- if (start > codePoint) {
- data.splice(
- lastIndex != null ? lastIndex + 2 : 0,
- 0,
- codePoint,
- codePoint + 1
- );
- return data;
- }
- if (codePoint == end) {
-
-
- if (codePoint + 1 == data[index + 2]) {
- data.splice(index, 4, start, data[index + 3]);
- return data;
- }
-
- data[index + 1] = codePoint + 1;
- return data;
- }
- lastIndex = index;
- index += 2;
- }
-
- data.push(codePoint, codePoint + 1);
- return data;
- };
- var dataAddData = function(dataA, dataB) {
-
- var index = 0;
- var start;
- var end;
- var data = dataA.slice();
- var length = dataB.length;
- while (index < length) {
- start = dataB[index];
- end = dataB[index + 1] - 1;
- if (start == end) {
- data = dataAdd(data, start);
- } else {
- data = dataAddRange(data, start, end);
- }
- index += 2;
- }
- return data;
- };
- var dataRemoveData = function(dataA, dataB) {
-
- var index = 0;
- var start;
- var end;
- var data = dataA.slice();
- var length = dataB.length;
- while (index < length) {
- start = dataB[index];
- end = dataB[index + 1] - 1;
- if (start == end) {
- data = dataRemove(data, start);
- } else {
- data = dataRemoveRange(data, start, end);
- }
- index += 2;
- }
- return data;
- };
- var dataAddRange = function(data, rangeStart, rangeEnd) {
- if (rangeEnd < rangeStart) {
- throw Error(ERRORS.rangeOrder);
- }
- if (
- rangeStart < 0x0 || rangeStart > 0x10FFFF ||
- rangeEnd < 0x0 || rangeEnd > 0x10FFFF
- ) {
- throw RangeError(ERRORS.codePointRange);
- }
-
- var index = 0;
- var start;
- var end;
- var added = false;
- var length = data.length;
- while (index < length) {
- start = data[index];
- end = data[index + 1];
- if (added) {
-
-
-
- if (start == rangeEnd + 1) {
- data.splice(index - 1, 2);
- return data;
- }
-
- if (start > rangeEnd) {
- return data;
- }
-
-
-
- if (start >= rangeStart && start <= rangeEnd) {
-
- if (end > rangeStart && end - 1 <= rangeEnd) {
-
-
- data.splice(index, 2);
- index -= 2;
-
-
- } else {
-
-
-
-
- data.splice(index - 1, 2);
- index -= 2;
- }
-
- }
- }
- else if (start == rangeEnd + 1) {
- data[index] = rangeStart;
- return data;
- }
-
- else if (start > rangeEnd) {
- data.splice(index, 0, rangeStart, rangeEnd + 1);
- return data;
- }
- else if (rangeStart >= start && rangeStart < end && rangeEnd + 1 <= end) {
-
-
- return data;
- }
- else if (
-
- (rangeStart >= start && rangeStart < end) ||
-
- end == rangeStart
- ) {
-
- data[index + 1] = rangeEnd + 1;
-
-
- added = true;
-
- }
- else if (rangeStart <= start && rangeEnd + 1 >= end) {
-
- data[index] = rangeStart;
- data[index + 1] = rangeEnd + 1;
- added = true;
- }
- index += 2;
- }
-
-
- if (!added) {
- data.push(rangeStart, rangeEnd + 1);
- }
- return data;
- };
- var dataContains = function(data, codePoint) {
- var index = 0;
- var length = data.length;
-
- var start = data[index];
- var end = data[length - 1];
- if (length >= 2) {
- if (codePoint < start || codePoint > end) {
- return false;
- }
- }
-
- while (index < length) {
- start = data[index];
- end = data[index + 1];
- if (codePoint >= start && codePoint < end) {
- return true;
- }
- index += 2;
- }
- return false;
- };
- var dataIntersection = function(data, codePoints) {
- var index = 0;
- var length = codePoints.length;
- var codePoint;
- var result = [];
- while (index < length) {
- codePoint = codePoints[index];
- if (dataContains(data, codePoint)) {
- result.push(codePoint);
- }
- ++index;
- }
- return dataFromCodePoints(result);
- };
- var dataIsEmpty = function(data) {
- return !data.length;
- };
- var dataIsSingleton = function(data) {
-
- return data.length == 2 && data[0] + 1 == data[1];
- };
- var dataToArray = function(data) {
-
- var index = 0;
- var start;
- var end;
- var result = [];
- var length = data.length;
- while (index < length) {
- start = data[index];
- end = data[index + 1];
- while (start < end) {
- result.push(start);
- ++start;
- }
- index += 2;
- }
- return result;
- };
-
-
- var floor = Math.floor;
- var highSurrogate = function(codePoint) {
- return parseInt(
- floor((codePoint - 0x10000) / 0x400) + HIGH_SURROGATE_MIN,
- 10
- );
- };
- var lowSurrogate = function(codePoint) {
- return parseInt(
- (codePoint - 0x10000) % 0x400 + LOW_SURROGATE_MIN,
- 10
- );
- };
- var stringFromCharCode = String.fromCharCode;
- var codePointToString = function(codePoint) {
- var string;
-
-
-
-
- if (codePoint == 0x09) {
- string = '\\t';
- }
-
-
-
-
- else if (codePoint == 0x0A) {
- string = '\\n';
- }
- else if (codePoint == 0x0C) {
- string = '\\f';
- }
- else if (codePoint == 0x0D) {
- string = '\\r';
- }
- else if (codePoint == 0x2D) {
-
-
-
-
-
- string = '\\x2D';
- }
- else if (codePoint == 0x5C) {
- string = '\\\\';
- }
- else if (
- codePoint == 0x24 ||
- (codePoint >= 0x28 && codePoint <= 0x2B) ||
- codePoint == 0x2E || codePoint == 0x2F ||
- codePoint == 0x3F ||
- (codePoint >= 0x5B && codePoint <= 0x5E) ||
- (codePoint >= 0x7B && codePoint <= 0x7D)
- ) {
-
-
-
-
-
-
-
- string = '\\' + stringFromCharCode(codePoint);
- }
- else if (codePoint >= 0x20 && codePoint <= 0x7E) {
-
-
-
-
-
-
-
- string = stringFromCharCode(codePoint);
- }
- else if (codePoint <= 0xFF) {
- string = '\\x' + pad(hex(codePoint), 2);
- }
- else {
-
- string = '\\u' + pad(hex(codePoint), 4);
- }
-
-
-
-
-
-
- return string;
- };
- var codePointToStringUnicode = function(codePoint) {
- if (codePoint <= 0xFFFF) {
- return codePointToString(codePoint);
- }
- return '\\u{' + codePoint.toString(16).toUpperCase() + '}';
- };
- var symbolToCodePoint = function(symbol) {
- var length = symbol.length;
- var first = symbol.charCodeAt(0);
- var second;
- if (
- first >= HIGH_SURROGATE_MIN && first <= HIGH_SURROGATE_MAX &&
- length > 1
- ) {
-
-
- second = symbol.charCodeAt(1);
-
- return (first - HIGH_SURROGATE_MIN) * 0x400 +
- second - LOW_SURROGATE_MIN + 0x10000;
- }
- return first;
- };
- var createBMPCharacterClasses = function(data) {
-
- var result = '';
- var index = 0;
- var start;
- var end;
- var length = data.length;
- if (dataIsSingleton(data)) {
- return codePointToString(data[0]);
- }
- while (index < length) {
- start = data[index];
- end = data[index + 1] - 1;
- if (start == end) {
- result += codePointToString(start);
- } else if (start + 1 == end) {
- result += codePointToString(start) + codePointToString(end);
- } else {
- result += codePointToString(start) + '-' + codePointToString(end);
- }
- index += 2;
- }
- return '[' + result + ']';
- };
- var createUnicodeCharacterClasses = function(data) {
-
- var result = '';
- var index = 0;
- var start;
- var end;
- var length = data.length;
- if (dataIsSingleton(data)) {
- return codePointToStringUnicode(data[0]);
- }
- while (index < length) {
- start = data[index];
- end = data[index + 1] - 1;
- if (start == end) {
- result += codePointToStringUnicode(start);
- } else if (start + 1 == end) {
- result += codePointToStringUnicode(start) + codePointToStringUnicode(end);
- } else {
- result += codePointToStringUnicode(start) + '-' + codePointToStringUnicode(end);
- }
- index += 2;
- }
- return '[' + result + ']';
- };
- var splitAtBMP = function(data) {
-
- var loneHighSurrogates = [];
- var loneLowSurrogates = [];
- var bmp = [];
- var astral = [];
- var index = 0;
- var start;
- var end;
- var length = data.length;
- while (index < length) {
- start = data[index];
- end = data[index + 1] - 1;
- if (start < HIGH_SURROGATE_MIN) {
-
-
- if (end < HIGH_SURROGATE_MIN) {
- bmp.push(start, end + 1);
- }
-
-
- if (end >= HIGH_SURROGATE_MIN && end <= HIGH_SURROGATE_MAX) {
- bmp.push(start, HIGH_SURROGATE_MIN);
- loneHighSurrogates.push(HIGH_SURROGATE_MIN, end + 1);
- }
-
-
- if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) {
- bmp.push(start, HIGH_SURROGATE_MIN);
- loneHighSurrogates.push(HIGH_SURROGATE_MIN, HIGH_SURROGATE_MAX + 1);
- loneLowSurrogates.push(LOW_SURROGATE_MIN, end + 1);
- }
-
-
- if (end > LOW_SURROGATE_MAX) {
- bmp.push(start, HIGH_SURROGATE_MIN);
- loneHighSurrogates.push(HIGH_SURROGATE_MIN, HIGH_SURROGATE_MAX + 1);
- loneLowSurrogates.push(LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1);
- if (end <= 0xFFFF) {
- bmp.push(LOW_SURROGATE_MAX + 1, end + 1);
- } else {
- bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1);
- astral.push(0xFFFF + 1, end + 1);
- }
- }
- } else if (start >= HIGH_SURROGATE_MIN && start <= HIGH_SURROGATE_MAX) {
-
-
- if (end >= HIGH_SURROGATE_MIN && end <= HIGH_SURROGATE_MAX) {
- loneHighSurrogates.push(start, end + 1);
- }
-
-
- if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) {
- loneHighSurrogates.push(start, HIGH_SURROGATE_MAX + 1);
- loneLowSurrogates.push(LOW_SURROGATE_MIN, end + 1);
- }
-
-
- if (end > LOW_SURROGATE_MAX) {
- loneHighSurrogates.push(start, HIGH_SURROGATE_MAX + 1);
- loneLowSurrogates.push(LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1);
- if (end <= 0xFFFF) {
- bmp.push(LOW_SURROGATE_MAX + 1, end + 1);
- } else {
- bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1);
- astral.push(0xFFFF + 1, end + 1);
- }
- }
- } else if (start >= LOW_SURROGATE_MIN && start <= LOW_SURROGATE_MAX) {
-
-
- if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) {
- loneLowSurrogates.push(start, end + 1);
- }
-
-
- if (end > LOW_SURROGATE_MAX) {
- loneLowSurrogates.push(start, LOW_SURROGATE_MAX + 1);
- if (end <= 0xFFFF) {
- bmp.push(LOW_SURROGATE_MAX + 1, end + 1);
- } else {
- bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1);
- astral.push(0xFFFF + 1, end + 1);
- }
- }
- } else if (start > LOW_SURROGATE_MAX && start <= 0xFFFF) {
-
-
- if (end <= 0xFFFF) {
- bmp.push(start, end + 1);
- } else {
- bmp.push(start, 0xFFFF + 1);
- astral.push(0xFFFF + 1, end + 1);
- }
- } else {
-
- astral.push(start, end + 1);
- }
- index += 2;
- }
- return {
- 'loneHighSurrogates': loneHighSurrogates,
- 'loneLowSurrogates': loneLowSurrogates,
- 'bmp': bmp,
- 'astral': astral
- };
- };
- var optimizeSurrogateMappings = function(surrogateMappings) {
- var result = [];
- var tmpLow = [];
- var addLow = false;
- var mapping;
- var nextMapping;
- var highSurrogates;
- var lowSurrogates;
- var nextHighSurrogates;
- var nextLowSurrogates;
- var index = -1;
- var length = surrogateMappings.length;
- while (++index < length) {
- mapping = surrogateMappings[index];
- nextMapping = surrogateMappings[index + 1];
- if (!nextMapping) {
- result.push(mapping);
- continue;
- }
- highSurrogates = mapping[0];
- lowSurrogates = mapping[1];
- nextHighSurrogates = nextMapping[0];
- nextLowSurrogates = nextMapping[1];
-
- tmpLow = lowSurrogates;
- while (
- nextHighSurrogates &&
- highSurrogates[0] == nextHighSurrogates[0] &&
- highSurrogates[1] == nextHighSurrogates[1]
- ) {
-
- if (dataIsSingleton(nextLowSurrogates)) {
- tmpLow = dataAdd(tmpLow, nextLowSurrogates[0]);
- } else {
- tmpLow = dataAddRange(
- tmpLow,
- nextLowSurrogates[0],
- nextLowSurrogates[1] - 1
- );
- }
- ++index;
- mapping = surrogateMappings[index];
- highSurrogates = mapping[0];
- lowSurrogates = mapping[1];
- nextMapping = surrogateMappings[index + 1];
- nextHighSurrogates = nextMapping && nextMapping[0];
- nextLowSurrogates = nextMapping && nextMapping[1];
- addLow = true;
- }
- result.push([
- highSurrogates,
- addLow ? tmpLow : lowSurrogates
- ]);
- addLow = false;
- }
- return optimizeByLowSurrogates(result);
- };
- var optimizeByLowSurrogates = function(surrogateMappings) {
- if (surrogateMappings.length == 1) {
- return surrogateMappings;
- }
- var index = -1;
- var innerIndex = -1;
- while (++index < surrogateMappings.length) {
- var mapping = surrogateMappings[index];
- var lowSurrogates = mapping[1];
- var lowSurrogateStart = lowSurrogates[0];
- var lowSurrogateEnd = lowSurrogates[1];
- innerIndex = index;
- while (++innerIndex < surrogateMappings.length) {
- var otherMapping = surrogateMappings[innerIndex];
- var otherLowSurrogates = otherMapping[1];
- var otherLowSurrogateStart = otherLowSurrogates[0];
- var otherLowSurrogateEnd = otherLowSurrogates[1];
- if (
- lowSurrogateStart == otherLowSurrogateStart &&
- lowSurrogateEnd == otherLowSurrogateEnd
- ) {
-
- if (dataIsSingleton(otherMapping[0])) {
- mapping[0] = dataAdd(mapping[0], otherMapping[0][0]);
- } else {
- mapping[0] = dataAddRange(
- mapping[0],
- otherMapping[0][0],
- otherMapping[0][1] - 1
- );
- }
-
- surrogateMappings.splice(innerIndex, 1);
- --innerIndex;
- }
- }
- }
- return surrogateMappings;
- };
- var surrogateSet = function(data) {
-
- if (!data.length) {
- return [];
- }
-
- var index = 0;
- var start;
- var end;
- var startHigh;
- var startLow;
- var endHigh;
- var endLow;
- var surrogateMappings = [];
- var length = data.length;
- while (index < length) {
- start = data[index];
- end = data[index + 1] - 1;
- startHigh = highSurrogate(start);
- startLow = lowSurrogate(start);
- endHigh = highSurrogate(end);
- endLow = lowSurrogate(end);
- var startsWithLowestLowSurrogate = startLow == LOW_SURROGATE_MIN;
- var endsWithHighestLowSurrogate = endLow == LOW_SURROGATE_MAX;
- var complete = false;
-
-
- if (
- startHigh == endHigh ||
- startsWithLowestLowSurrogate && endsWithHighestLowSurrogate
- ) {
- surrogateMappings.push([
- [startHigh, endHigh + 1],
- [startLow, endLow + 1]
- ]);
- complete = true;
- } else {
- surrogateMappings.push([
- [startHigh, startHigh + 1],
- [startLow, LOW_SURROGATE_MAX + 1]
- ]);
- }
-
-
- if (!complete && startHigh + 1 < endHigh) {
- if (endsWithHighestLowSurrogate) {
-
- surrogateMappings.push([
- [startHigh + 1, endHigh + 1],
- [LOW_SURROGATE_MIN, endLow + 1]
- ]);
- complete = true;
- } else {
- surrogateMappings.push([
- [startHigh + 1, endHigh],
- [LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1]
- ]);
- }
- }
-
- if (!complete) {
- surrogateMappings.push([
- [endHigh, endHigh + 1],
- [LOW_SURROGATE_MIN, endLow + 1]
- ]);
- }
- index += 2;
- }
-
-
-
-
-
-
-
-
-
-
- return optimizeSurrogateMappings(surrogateMappings);
- };
- var createSurrogateCharacterClasses = function(surrogateMappings) {
- var result = [];
- forEach(surrogateMappings, function(surrogateMapping) {
- var highSurrogates = surrogateMapping[0];
- var lowSurrogates = surrogateMapping[1];
- result.push(
- createBMPCharacterClasses(highSurrogates) +
- createBMPCharacterClasses(lowSurrogates)
- );
- });
- return result.join('|');
- };
- var createCharacterClassesFromData = function(data, bmpOnly, hasUnicodeFlag) {
- if (hasUnicodeFlag) {
- return createUnicodeCharacterClasses(data);
- }
- var result = [];
- var parts = splitAtBMP(data);
- var loneHighSurrogates = parts.loneHighSurrogates;
- var loneLowSurrogates = parts.loneLowSurrogates;
- var bmp = parts.bmp;
- var astral = parts.astral;
- var hasLoneHighSurrogates = !dataIsEmpty(loneHighSurrogates);
- var hasLoneLowSurrogates = !dataIsEmpty(loneLowSurrogates);
- var surrogateMappings = surrogateSet(astral);
- if (bmpOnly) {
- bmp = dataAddData(bmp, loneHighSurrogates);
- hasLoneHighSurrogates = false;
- bmp = dataAddData(bmp, loneLowSurrogates);
- hasLoneLowSurrogates = false;
- }
- if (!dataIsEmpty(bmp)) {
-
-
- result.push(createBMPCharacterClasses(bmp));
- }
- if (surrogateMappings.length) {
-
-
- result.push(createSurrogateCharacterClasses(surrogateMappings));
- }
-
- if (hasLoneHighSurrogates) {
- result.push(
- createBMPCharacterClasses(loneHighSurrogates) +
-
- '(?![\\uDC00-\\uDFFF])'
- );
- }
- if (hasLoneLowSurrogates) {
- result.push(
-
-
-
- '(?:[^\\uD800-\\uDBFF]|^)' +
- createBMPCharacterClasses(loneLowSurrogates)
- );
- }
- return result.join('|');
- };
-
-
-
-
- var regenerate = function(value) {
- if (arguments.length > 1) {
- value = slice.call(arguments);
- }
- if (this instanceof regenerate) {
- this.data = [];
- return value ? this.add(value) : this;
- }
- return (new regenerate).add(value);
- };
- regenerate.version = '1.3.3';
- var proto = regenerate.prototype;
- extend(proto, {
- 'add': function(value) {
- var $this = this;
- if (value == null) {
- return $this;
- }
- if (value instanceof regenerate) {
-
- $this.data = dataAddData($this.data, value.data);
- return $this;
- }
- if (arguments.length > 1) {
- value = slice.call(arguments);
- }
- if (isArray(value)) {
- forEach(value, function(item) {
- $this.add(item);
- });
- return $this;
- }
- $this.data = dataAdd(
- $this.data,
- isNumber(value) ? value : symbolToCodePoint(value)
- );
- return $this;
- },
- 'remove': function(value) {
- var $this = this;
- if (value == null) {
- return $this;
- }
- if (value instanceof regenerate) {
-
- $this.data = dataRemoveData($this.data, value.data);
- return $this;
- }
- if (arguments.length > 1) {
- value = slice.call(arguments);
- }
- if (isArray(value)) {
- forEach(value, function(item) {
- $this.remove(item);
- });
- return $this;
- }
- $this.data = dataRemove(
- $this.data,
- isNumber(value) ? value : symbolToCodePoint(value)
- );
- return $this;
- },
- 'addRange': function(start, end) {
- var $this = this;
- $this.data = dataAddRange($this.data,
- isNumber(start) ? start : symbolToCodePoint(start),
- isNumber(end) ? end : symbolToCodePoint(end)
- );
- return $this;
- },
- 'removeRange': function(start, end) {
- var $this = this;
- var startCodePoint = isNumber(start) ? start : symbolToCodePoint(start);
- var endCodePoint = isNumber(end) ? end : symbolToCodePoint(end);
- $this.data = dataRemoveRange(
- $this.data,
- startCodePoint,
- endCodePoint
- );
- return $this;
- },
- 'intersection': function(argument) {
- var $this = this;
-
-
- var array = argument instanceof regenerate ?
- dataToArray(argument.data) :
- argument;
- $this.data = dataIntersection($this.data, array);
- return $this;
- },
- 'contains': function(codePoint) {
- return dataContains(
- this.data,
- isNumber(codePoint) ? codePoint : symbolToCodePoint(codePoint)
- );
- },
- 'clone': function() {
- var set = new regenerate;
- set.data = this.data.slice(0);
- return set;
- },
- 'toString': function(options) {
- var result = createCharacterClassesFromData(
- this.data,
- options ? options.bmpOnly : false,
- options ? options.hasUnicodeFlag : false
- );
- if (!result) {
-
-
-
- return '[]';
- }
-
- return result.replace(regexNull, '\\0$1');
- },
- 'toRegExp': function(flags) {
- var pattern = this.toString(
- flags && flags.indexOf('u') != -1 ?
- { 'hasUnicodeFlag': true } :
- null
- );
- return RegExp(pattern, flags || '');
- },
- 'valueOf': function() {
- return dataToArray(this.data);
- }
- });
- proto.toArray = proto.valueOf;
-
-
- if (
- typeof undefined == 'function' &&
- typeof undefined.amd == 'object' &&
- undefined.amd
- ) {
- undefined(function() {
- return regenerate;
- });
- } else if (freeExports && !freeExports.nodeType) {
- if (freeModule) {
- freeModule.exports = regenerate;
- } else {
- freeExports.regenerate = regenerate;
- }
- } else {
- root.regenerate = regenerate;
- }
- }(commonjsGlobal));
- });
- var unicodeCanonicalPropertyNamesEcmascript = new Set([
-
- 'General_Category',
- 'Script',
- 'Script_Extensions',
-
- 'Alphabetic',
- 'Any',
- 'ASCII',
- 'ASCII_Hex_Digit',
- 'Assigned',
- 'Bidi_Control',
- 'Bidi_Mirrored',
- 'Case_Ignorable',
- 'Cased',
- 'Changes_When_Casefolded',
- 'Changes_When_Casemapped',
- 'Changes_When_Lowercased',
- 'Changes_When_NFKC_Casefolded',
- 'Changes_When_Titlecased',
- 'Changes_When_Uppercased',
- 'Dash',
- 'Default_Ignorable_Code_Point',
- 'Deprecated',
- 'Diacritic',
- 'Emoji',
- 'Emoji_Component',
- 'Emoji_Modifier',
- 'Emoji_Modifier_Base',
- 'Emoji_Presentation',
- 'Extended_Pictographic',
- 'Extender',
- 'Grapheme_Base',
- 'Grapheme_Extend',
- 'Hex_Digit',
- 'ID_Continue',
- 'ID_Start',
- 'Ideographic',
- 'IDS_Binary_Operator',
- 'IDS_Trinary_Operator',
- 'Join_Control',
- 'Logical_Order_Exception',
- 'Lowercase',
- 'Math',
- 'Noncharacter_Code_Point',
- 'Pattern_Syntax',
- 'Pattern_White_Space',
- 'Quotation_Mark',
- 'Radical',
- 'Regional_Indicator',
- 'Sentence_Terminal',
- 'Soft_Dotted',
- 'Terminal_Punctuation',
- 'Unified_Ideograph',
- 'Uppercase',
- 'Variation_Selector',
- 'White_Space',
- 'XID_Continue',
- 'XID_Start'
- ]);
- var unicodePropertyAliasesEcmascript = new Map([
- ['scx', 'Script_Extensions'],
- ['sc', 'Script'],
- ['gc', 'General_Category'],
- ['AHex', 'ASCII_Hex_Digit'],
- ['Alpha', 'Alphabetic'],
- ['Bidi_C', 'Bidi_Control'],
- ['Bidi_M', 'Bidi_Mirrored'],
- ['Cased', 'Cased'],
- ['CI', 'Case_Ignorable'],
- ['CWCF', 'Changes_When_Casefolded'],
- ['CWCM', 'Changes_When_Casemapped'],
- ['CWKCF', 'Changes_When_NFKC_Casefolded'],
- ['CWL', 'Changes_When_Lowercased'],
- ['CWT', 'Changes_When_Titlecased'],
- ['CWU', 'Changes_When_Uppercased'],
- ['Dash', 'Dash'],
- ['Dep', 'Deprecated'],
- ['DI', 'Default_Ignorable_Code_Point'],
- ['Dia', 'Diacritic'],
- ['Ext', 'Extender'],
- ['Gr_Base', 'Grapheme_Base'],
- ['Gr_Ext', 'Grapheme_Extend'],
- ['Hex', 'Hex_Digit'],
- ['IDC', 'ID_Continue'],
- ['Ideo', 'Ideographic'],
- ['IDS', 'ID_Start'],
- ['IDSB', 'IDS_Binary_Operator'],
- ['IDST', 'IDS_Trinary_Operator'],
- ['Join_C', 'Join_Control'],
- ['LOE', 'Logical_Order_Exception'],
- ['Lower', 'Lowercase'],
- ['Math', 'Math'],
- ['NChar', 'Noncharacter_Code_Point'],
- ['Pat_Syn', 'Pattern_Syntax'],
- ['Pat_WS', 'Pattern_White_Space'],
- ['QMark', 'Quotation_Mark'],
- ['Radical', 'Radical'],
- ['RI', 'Regional_Indicator'],
- ['SD', 'Soft_Dotted'],
- ['STerm', 'Sentence_Terminal'],
- ['Term', 'Terminal_Punctuation'],
- ['UIdeo', 'Unified_Ideograph'],
- ['Upper', 'Uppercase'],
- ['VS', 'Variation_Selector'],
- ['WSpace', 'White_Space'],
- ['space', 'White_Space'],
- ['XIDC', 'XID_Continue'],
- ['XIDS', 'XID_Start']
- ]);
- var matchProperty = function(property) {
- if (unicodeCanonicalPropertyNamesEcmascript.has(property)) {
- return property;
- }
- if (unicodePropertyAliasesEcmascript.has(property)) {
- return unicodePropertyAliasesEcmascript.get(property);
- }
- throw new Error(("Unknown property: " + property));
- };
- var unicodeMatchPropertyEcmascript = matchProperty;
- var mappings = new Map([
- ['General_Category', new Map([
- ['C', 'Other'],
- ['Cc', 'Control'],
- ['cntrl', 'Control'],
- ['Cf', 'Format'],
- ['Cn', 'Unassigned'],
- ['Co', 'Private_Use'],
- ['Cs', 'Surrogate'],
- ['L', 'Letter'],
- ['LC', 'Cased_Letter'],
- ['Ll', 'Lowercase_Letter'],
- ['Lm', 'Modifier_Letter'],
- ['Lo', 'Other_Letter'],
- ['Lt', 'Titlecase_Letter'],
- ['Lu', 'Uppercase_Letter'],
- ['M', 'Mark'],
- ['Combining_Mark', 'Mark'],
- ['Mc', 'Spacing_Mark'],
- ['Me', 'Enclosing_Mark'],
- ['Mn', 'Nonspacing_Mark'],
- ['N', 'Number'],
- ['Nd', 'Decimal_Number'],
- ['digit', 'Decimal_Number'],
- ['Nl', 'Letter_Number'],
- ['No', 'Other_Number'],
- ['P', 'Punctuation'],
- ['punct', 'Punctuation'],
- ['Pc', 'Connector_Punctuation'],
- ['Pd', 'Dash_Punctuation'],
- ['Pe', 'Close_Punctuation'],
- ['Pf', 'Final_Punctuation'],
- ['Pi', 'Initial_Punctuation'],
- ['Po', 'Other_Punctuation'],
- ['Ps', 'Open_Punctuation'],
- ['S', 'Symbol'],
- ['Sc', 'Currency_Symbol'],
- ['Sk', 'Modifier_Symbol'],
- ['Sm', 'Math_Symbol'],
- ['So', 'Other_Symbol'],
- ['Z', 'Separator'],
- ['Zl', 'Line_Separator'],
- ['Zp', 'Paragraph_Separator'],
- ['Zs', 'Space_Separator'],
- ['Other', 'Other'],
- ['Control', 'Control'],
- ['Format', 'Format'],
- ['Unassigned', 'Unassigned'],
- ['Private_Use', 'Private_Use'],
- ['Surrogate', 'Surrogate'],
- ['Letter', 'Letter'],
- ['Cased_Letter', 'Cased_Letter'],
- ['Lowercase_Letter', 'Lowercase_Letter'],
- ['Modifier_Letter', 'Modifier_Letter'],
- ['Other_Letter', 'Other_Letter'],
- ['Titlecase_Letter', 'Titlecase_Letter'],
- ['Uppercase_Letter', 'Uppercase_Letter'],
- ['Mark', 'Mark'],
- ['Spacing_Mark', 'Spacing_Mark'],
- ['Enclosing_Mark', 'Enclosing_Mark'],
- ['Nonspacing_Mark', 'Nonspacing_Mark'],
- ['Number', 'Number'],
- ['Decimal_Number', 'Decimal_Number'],
- ['Letter_Number', 'Letter_Number'],
- ['Other_Number', 'Other_Number'],
- ['Punctuation', 'Punctuation'],
- ['Connector_Punctuation', 'Connector_Punctuation'],
- ['Dash_Punctuation', 'Dash_Punctuation'],
- ['Close_Punctuation', 'Close_Punctuation'],
- ['Final_Punctuation', 'Final_Punctuation'],
- ['Initial_Punctuation', 'Initial_Punctuation'],
- ['Other_Punctuation', 'Other_Punctuation'],
- ['Open_Punctuation', 'Open_Punctuation'],
- ['Symbol', 'Symbol'],
- ['Currency_Symbol', 'Currency_Symbol'],
- ['Modifier_Symbol', 'Modifier_Symbol'],
- ['Math_Symbol', 'Math_Symbol'],
- ['Other_Symbol', 'Other_Symbol'],
- ['Separator', 'Separator'],
- ['Line_Separator', 'Line_Separator'],
- ['Paragraph_Separator', 'Paragraph_Separator'],
- ['Space_Separator', 'Space_Separator']
- ])],
- ['Script', new Map([
- ['Adlm', 'Adlam'],
- ['Aghb', 'Caucasian_Albanian'],
- ['Ahom', 'Ahom'],
- ['Arab', 'Arabic'],
- ['Armi', 'Imperial_Aramaic'],
- ['Armn', 'Armenian'],
- ['Avst', 'Avestan'],
- ['Bali', 'Balinese'],
- ['Bamu', 'Bamum'],
- ['Bass', 'Bassa_Vah'],
- ['Batk', 'Batak'],
- ['Beng', 'Bengali'],
- ['Bhks', 'Bhaiksuki'],
- ['Bopo', 'Bopomofo'],
- ['Brah', 'Brahmi'],
- ['Brai', 'Braille'],
- ['Bugi', 'Buginese'],
- ['Buhd', 'Buhid'],
- ['Cakm', 'Chakma'],
- ['Cans', 'Canadian_Aboriginal'],
- ['Cari', 'Carian'],
- ['Cham', 'Cham'],
- ['Cher', 'Cherokee'],
- ['Copt', 'Coptic'],
- ['Qaac', 'Coptic'],
- ['Cprt', 'Cypriot'],
- ['Cyrl', 'Cyrillic'],
- ['Deva', 'Devanagari'],
- ['Dogr', 'Dogra'],
- ['Dsrt', 'Deseret'],
- ['Dupl', 'Duployan'],
- ['Egyp', 'Egyptian_Hieroglyphs'],
- ['Elba', 'Elbasan'],
- ['Ethi', 'Ethiopic'],
- ['Geor', 'Georgian'],
- ['Glag', 'Glagolitic'],
- ['Gong', 'Gunjala_Gondi'],
- ['Gonm', 'Masaram_Gondi'],
- ['Goth', 'Gothic'],
- ['Gran', 'Grantha'],
- ['Grek', 'Greek'],
- ['Gujr', 'Gujarati'],
- ['Guru', 'Gurmukhi'],
- ['Hang', 'Hangul'],
- ['Hani', 'Han'],
- ['Hano', 'Hanunoo'],
- ['Hatr', 'Hatran'],
- ['Hebr', 'Hebrew'],
- ['Hira', 'Hiragana'],
- ['Hluw', 'Anatolian_Hieroglyphs'],
- ['Hmng', 'Pahawh_Hmong'],
- ['Hrkt', 'Katakana_Or_Hiragana'],
- ['Hung', 'Old_Hungarian'],
- ['Ital', 'Old_Italic'],
- ['Java', 'Javanese'],
- ['Kali', 'Kayah_Li'],
- ['Kana', 'Katakana'],
- ['Khar', 'Kharoshthi'],
- ['Khmr', 'Khmer'],
- ['Khoj', 'Khojki'],
- ['Knda', 'Kannada'],
- ['Kthi', 'Kaithi'],
- ['Lana', 'Tai_Tham'],
- ['Laoo', 'Lao'],
- ['Latn', 'Latin'],
- ['Lepc', 'Lepcha'],
- ['Limb', 'Limbu'],
- ['Lina', 'Linear_A'],
- ['Linb', 'Linear_B'],
- ['Lisu', 'Lisu'],
- ['Lyci', 'Lycian'],
- ['Lydi', 'Lydian'],
- ['Mahj', 'Mahajani'],
- ['Maka', 'Makasar'],
- ['Mand', 'Mandaic'],
- ['Mani', 'Manichaean'],
- ['Marc', 'Marchen'],
- ['Medf', 'Medefaidrin'],
- ['Mend', 'Mende_Kikakui'],
- ['Merc', 'Meroitic_Cursive'],
- ['Mero', 'Meroitic_Hieroglyphs'],
- ['Mlym', 'Malayalam'],
- ['Modi', 'Modi'],
- ['Mong', 'Mongolian'],
- ['Mroo', 'Mro'],
- ['Mtei', 'Meetei_Mayek'],
- ['Mult', 'Multani'],
- ['Mymr', 'Myanmar'],
- ['Narb', 'Old_North_Arabian'],
- ['Nbat', 'Nabataean'],
- ['Newa', 'Newa'],
- ['Nkoo', 'Nko'],
- ['Nshu', 'Nushu'],
- ['Ogam', 'Ogham'],
- ['Olck', 'Ol_Chiki'],
- ['Orkh', 'Old_Turkic'],
- ['Orya', 'Oriya'],
- ['Osge', 'Osage'],
- ['Osma', 'Osmanya'],
- ['Palm', 'Palmyrene'],
- ['Pauc', 'Pau_Cin_Hau'],
- ['Perm', 'Old_Permic'],
- ['Phag', 'Phags_Pa'],
- ['Phli', 'Inscriptional_Pahlavi'],
- ['Phlp', 'Psalter_Pahlavi'],
- ['Phnx', 'Phoenician'],
- ['Plrd', 'Miao'],
- ['Prti', 'Inscriptional_Parthian'],
- ['Rjng', 'Rejang'],
- ['Rohg', 'Hanifi_Rohingya'],
- ['Runr', 'Runic'],
- ['Samr', 'Samaritan'],
- ['Sarb', 'Old_South_Arabian'],
- ['Saur', 'Saurashtra'],
- ['Sgnw', 'SignWriting'],
- ['Shaw', 'Shavian'],
- ['Shrd', 'Sharada'],
- ['Sidd', 'Siddham'],
- ['Sind', 'Khudawadi'],
- ['Sinh', 'Sinhala'],
- ['Sogd', 'Sogdian'],
- ['Sogo', 'Old_Sogdian'],
- ['Sora', 'Sora_Sompeng'],
- ['Soyo', 'Soyombo'],
- ['Sund', 'Sundanese'],
- ['Sylo', 'Syloti_Nagri'],
- ['Syrc', 'Syriac'],
- ['Tagb', 'Tagbanwa'],
- ['Takr', 'Takri'],
- ['Tale', 'Tai_Le'],
- ['Talu', 'New_Tai_Lue'],
- ['Taml', 'Tamil'],
- ['Tang', 'Tangut'],
- ['Tavt', 'Tai_Viet'],
- ['Telu', 'Telugu'],
- ['Tfng', 'Tifinagh'],
- ['Tglg', 'Tagalog'],
- ['Thaa', 'Thaana'],
- ['Thai', 'Thai'],
- ['Tibt', 'Tibetan'],
- ['Tirh', 'Tirhuta'],
- ['Ugar', 'Ugaritic'],
- ['Vaii', 'Vai'],
- ['Wara', 'Warang_Citi'],
- ['Xpeo', 'Old_Persian'],
- ['Xsux', 'Cuneiform'],
- ['Yiii', 'Yi'],
- ['Zanb', 'Zanabazar_Square'],
- ['Zinh', 'Inherited'],
- ['Qaai', 'Inherited'],
- ['Zyyy', 'Common'],
- ['Zzzz', 'Unknown'],
- ['Adlam', 'Adlam'],
- ['Caucasian_Albanian', 'Caucasian_Albanian'],
- ['Arabic', 'Arabic'],
- ['Imperial_Aramaic', 'Imperial_Aramaic'],
- ['Armenian', 'Armenian'],
- ['Avestan', 'Avestan'],
- ['Balinese', 'Balinese'],
- ['Bamum', 'Bamum'],
- ['Bassa_Vah', 'Bassa_Vah'],
- ['Batak', 'Batak'],
- ['Bengali', 'Bengali'],
- ['Bhaiksuki', 'Bhaiksuki'],
- ['Bopomofo', 'Bopomofo'],
- ['Brahmi', 'Brahmi'],
- ['Braille', 'Braille'],
- ['Buginese', 'Buginese'],
- ['Buhid', 'Buhid'],
- ['Chakma', 'Chakma'],
- ['Canadian_Aboriginal', 'Canadian_Aboriginal'],
- ['Carian', 'Carian'],
- ['Cherokee', 'Cherokee'],
- ['Coptic', 'Coptic'],
- ['Cypriot', 'Cypriot'],
- ['Cyrillic', 'Cyrillic'],
- ['Devanagari', 'Devanagari'],
- ['Dogra', 'Dogra'],
- ['Deseret', 'Deseret'],
- ['Duployan', 'Duployan'],
- ['Egyptian_Hieroglyphs', 'Egyptian_Hieroglyphs'],
- ['Elbasan', 'Elbasan'],
- ['Ethiopic', 'Ethiopic'],
- ['Georgian', 'Georgian'],
- ['Glagolitic', 'Glagolitic'],
- ['Gunjala_Gondi', 'Gunjala_Gondi'],
- ['Masaram_Gondi', 'Masaram_Gondi'],
- ['Gothic', 'Gothic'],
- ['Grantha', 'Grantha'],
- ['Greek', 'Greek'],
- ['Gujarati', 'Gujarati'],
- ['Gurmukhi', 'Gurmukhi'],
- ['Hangul', 'Hangul'],
- ['Han', 'Han'],
- ['Hanunoo', 'Hanunoo'],
- ['Hatran', 'Hatran'],
- ['Hebrew', 'Hebrew'],
- ['Hiragana', 'Hiragana'],
- ['Anatolian_Hieroglyphs', 'Anatolian_Hieroglyphs'],
- ['Pahawh_Hmong', 'Pahawh_Hmong'],
- ['Katakana_Or_Hiragana', 'Katakana_Or_Hiragana'],
- ['Old_Hungarian', 'Old_Hungarian'],
- ['Old_Italic', 'Old_Italic'],
- ['Javanese', 'Javanese'],
- ['Kayah_Li', 'Kayah_Li'],
- ['Katakana', 'Katakana'],
- ['Kharoshthi', 'Kharoshthi'],
- ['Khmer', 'Khmer'],
- ['Khojki', 'Khojki'],
- ['Kannada', 'Kannada'],
- ['Kaithi', 'Kaithi'],
- ['Tai_Tham', 'Tai_Tham'],
- ['Lao', 'Lao'],
- ['Latin', 'Latin'],
- ['Lepcha', 'Lepcha'],
- ['Limbu', 'Limbu'],
- ['Linear_A', 'Linear_A'],
- ['Linear_B', 'Linear_B'],
- ['Lycian', 'Lycian'],
- ['Lydian', 'Lydian'],
- ['Mahajani', 'Mahajani'],
- ['Makasar', 'Makasar'],
- ['Mandaic', 'Mandaic'],
- ['Manichaean', 'Manichaean'],
- ['Marchen', 'Marchen'],
- ['Medefaidrin', 'Medefaidrin'],
- ['Mende_Kikakui', 'Mende_Kikakui'],
- ['Meroitic_Cursive', 'Meroitic_Cursive'],
- ['Meroitic_Hieroglyphs', 'Meroitic_Hieroglyphs'],
- ['Malayalam', 'Malayalam'],
- ['Mongolian', 'Mongolian'],
- ['Mro', 'Mro'],
- ['Meetei_Mayek', 'Meetei_Mayek'],
- ['Multani', 'Multani'],
- ['Myanmar', 'Myanmar'],
- ['Old_North_Arabian', 'Old_North_Arabian'],
- ['Nabataean', 'Nabataean'],
- ['Nko', 'Nko'],
- ['Nushu', 'Nushu'],
- ['Ogham', 'Ogham'],
- ['Ol_Chiki', 'Ol_Chiki'],
- ['Old_Turkic', 'Old_Turkic'],
- ['Oriya', 'Oriya'],
- ['Osage', 'Osage'],
- ['Osmanya', 'Osmanya'],
- ['Palmyrene', 'Palmyrene'],
- ['Pau_Cin_Hau', 'Pau_Cin_Hau'],
- ['Old_Permic', 'Old_Permic'],
- ['Phags_Pa', 'Phags_Pa'],
- ['Inscriptional_Pahlavi', 'Inscriptional_Pahlavi'],
- ['Psalter_Pahlavi', 'Psalter_Pahlavi'],
- ['Phoenician', 'Phoenician'],
- ['Miao', 'Miao'],
- ['Inscriptional_Parthian', 'Inscriptional_Parthian'],
- ['Rejang', 'Rejang'],
- ['Hanifi_Rohingya', 'Hanifi_Rohingya'],
- ['Runic', 'Runic'],
- ['Samaritan', 'Samaritan'],
- ['Old_South_Arabian', 'Old_South_Arabian'],
- ['Saurashtra', 'Saurashtra'],
- ['SignWriting', 'SignWriting'],
- ['Shavian', 'Shavian'],
- ['Sharada', 'Sharada'],
- ['Siddham', 'Siddham'],
- ['Khudawadi', 'Khudawadi'],
- ['Sinhala', 'Sinhala'],
- ['Sogdian', 'Sogdian'],
- ['Old_Sogdian', 'Old_Sogdian'],
- ['Sora_Sompeng', 'Sora_Sompeng'],
- ['Soyombo', 'Soyombo'],
- ['Sundanese', 'Sundanese'],
- ['Syloti_Nagri', 'Syloti_Nagri'],
- ['Syriac', 'Syriac'],
- ['Tagbanwa', 'Tagbanwa'],
- ['Takri', 'Takri'],
- ['Tai_Le', 'Tai_Le'],
- ['New_Tai_Lue', 'New_Tai_Lue'],
- ['Tamil', 'Tamil'],
- ['Tangut', 'Tangut'],
- ['Tai_Viet', 'Tai_Viet'],
- ['Telugu', 'Telugu'],
- ['Tifinagh', 'Tifinagh'],
- ['Tagalog', 'Tagalog'],
- ['Thaana', 'Thaana'],
- ['Tibetan', 'Tibetan'],
- ['Tirhuta', 'Tirhuta'],
- ['Ugaritic', 'Ugaritic'],
- ['Vai', 'Vai'],
- ['Warang_Citi', 'Warang_Citi'],
- ['Old_Persian', 'Old_Persian'],
- ['Cuneiform', 'Cuneiform'],
- ['Yi', 'Yi'],
- ['Zanabazar_Square', 'Zanabazar_Square'],
- ['Inherited', 'Inherited'],
- ['Common', 'Common'],
- ['Unknown', 'Unknown']
- ])],
- ['Script_Extensions', new Map([
- ['Adlm', 'Adlam'],
- ['Aghb', 'Caucasian_Albanian'],
- ['Ahom', 'Ahom'],
- ['Arab', 'Arabic'],
- ['Armi', 'Imperial_Aramaic'],
- ['Armn', 'Armenian'],
- ['Avst', 'Avestan'],
- ['Bali', 'Balinese'],
- ['Bamu', 'Bamum'],
- ['Bass', 'Bassa_Vah'],
- ['Batk', 'Batak'],
- ['Beng', 'Bengali'],
- ['Bhks', 'Bhaiksuki'],
- ['Bopo', 'Bopomofo'],
- ['Brah', 'Brahmi'],
- ['Brai', 'Braille'],
- ['Bugi', 'Buginese'],
- ['Buhd', 'Buhid'],
- ['Cakm', 'Chakma'],
- ['Cans', 'Canadian_Aboriginal'],
- ['Cari', 'Carian'],
- ['Cham', 'Cham'],
- ['Cher', 'Cherokee'],
- ['Copt', 'Coptic'],
- ['Qaac', 'Coptic'],
- ['Cprt', 'Cypriot'],
- ['Cyrl', 'Cyrillic'],
- ['Deva', 'Devanagari'],
- ['Dogr', 'Dogra'],
- ['Dsrt', 'Deseret'],
- ['Dupl', 'Duployan'],
- ['Egyp', 'Egyptian_Hieroglyphs'],
- ['Elba', 'Elbasan'],
- ['Ethi', 'Ethiopic'],
- ['Geor', 'Georgian'],
- ['Glag', 'Glagolitic'],
- ['Gong', 'Gunjala_Gondi'],
- ['Gonm', 'Masaram_Gondi'],
- ['Goth', 'Gothic'],
- ['Gran', 'Grantha'],
- ['Grek', 'Greek'],
- ['Gujr', 'Gujarati'],
- ['Guru', 'Gurmukhi'],
- ['Hang', 'Hangul'],
- ['Hani', 'Han'],
- ['Hano', 'Hanunoo'],
- ['Hatr', 'Hatran'],
- ['Hebr', 'Hebrew'],
- ['Hira', 'Hiragana'],
- ['Hluw', 'Anatolian_Hieroglyphs'],
- ['Hmng', 'Pahawh_Hmong'],
- ['Hrkt', 'Katakana_Or_Hiragana'],
- ['Hung', 'Old_Hungarian'],
- ['Ital', 'Old_Italic'],
- ['Java', 'Javanese'],
- ['Kali', 'Kayah_Li'],
- ['Kana', 'Katakana'],
- ['Khar', 'Kharoshthi'],
- ['Khmr', 'Khmer'],
- ['Khoj', 'Khojki'],
- ['Knda', 'Kannada'],
- ['Kthi', 'Kaithi'],
- ['Lana', 'Tai_Tham'],
- ['Laoo', 'Lao'],
- ['Latn', 'Latin'],
- ['Lepc', 'Lepcha'],
- ['Limb', 'Limbu'],
- ['Lina', 'Linear_A'],
- ['Linb', 'Linear_B'],
- ['Lisu', 'Lisu'],
- ['Lyci', 'Lycian'],
- ['Lydi', 'Lydian'],
- ['Mahj', 'Mahajani'],
- ['Maka', 'Makasar'],
- ['Mand', 'Mandaic'],
- ['Mani', 'Manichaean'],
- ['Marc', 'Marchen'],
- ['Medf', 'Medefaidrin'],
- ['Mend', 'Mende_Kikakui'],
- ['Merc', 'Meroitic_Cursive'],
- ['Mero', 'Meroitic_Hieroglyphs'],
- ['Mlym', 'Malayalam'],
- ['Modi', 'Modi'],
- ['Mong', 'Mongolian'],
- ['Mroo', 'Mro'],
- ['Mtei', 'Meetei_Mayek'],
- ['Mult', 'Multani'],
- ['Mymr', 'Myanmar'],
- ['Narb', 'Old_North_Arabian'],
- ['Nbat', 'Nabataean'],
- ['Newa', 'Newa'],
- ['Nkoo', 'Nko'],
- ['Nshu', 'Nushu'],
- ['Ogam', 'Ogham'],
- ['Olck', 'Ol_Chiki'],
- ['Orkh', 'Old_Turkic'],
- ['Orya', 'Oriya'],
- ['Osge', 'Osage'],
- ['Osma', 'Osmanya'],
- ['Palm', 'Palmyrene'],
- ['Pauc', 'Pau_Cin_Hau'],
- ['Perm', 'Old_Permic'],
- ['Phag', 'Phags_Pa'],
- ['Phli', 'Inscriptional_Pahlavi'],
- ['Phlp', 'Psalter_Pahlavi'],
- ['Phnx', 'Phoenician'],
- ['Plrd', 'Miao'],
- ['Prti', 'Inscriptional_Parthian'],
- ['Rjng', 'Rejang'],
- ['Rohg', 'Hanifi_Rohingya'],
- ['Runr', 'Runic'],
- ['Samr', 'Samaritan'],
- ['Sarb', 'Old_South_Arabian'],
- ['Saur', 'Saurashtra'],
- ['Sgnw', 'SignWriting'],
- ['Shaw', 'Shavian'],
- ['Shrd', 'Sharada'],
- ['Sidd', 'Siddham'],
- ['Sind', 'Khudawadi'],
- ['Sinh', 'Sinhala'],
- ['Sogd', 'Sogdian'],
- ['Sogo', 'Old_Sogdian'],
- ['Sora', 'Sora_Sompeng'],
- ['Soyo', 'Soyombo'],
- ['Sund', 'Sundanese'],
- ['Sylo', 'Syloti_Nagri'],
- ['Syrc', 'Syriac'],
- ['Tagb', 'Tagbanwa'],
- ['Takr', 'Takri'],
- ['Tale', 'Tai_Le'],
- ['Talu', 'New_Tai_Lue'],
- ['Taml', 'Tamil'],
- ['Tang', 'Tangut'],
- ['Tavt', 'Tai_Viet'],
- ['Telu', 'Telugu'],
- ['Tfng', 'Tifinagh'],
- ['Tglg', 'Tagalog'],
- ['Thaa', 'Thaana'],
- ['Thai', 'Thai'],
- ['Tibt', 'Tibetan'],
- ['Tirh', 'Tirhuta'],
- ['Ugar', 'Ugaritic'],
- ['Vaii', 'Vai'],
- ['Wara', 'Warang_Citi'],
- ['Xpeo', 'Old_Persian'],
- ['Xsux', 'Cuneiform'],
- ['Yiii', 'Yi'],
- ['Zanb', 'Zanabazar_Square'],
- ['Zinh', 'Inherited'],
- ['Qaai', 'Inherited'],
- ['Zyyy', 'Common'],
- ['Zzzz', 'Unknown'],
- ['Adlam', 'Adlam'],
- ['Caucasian_Albanian', 'Caucasian_Albanian'],
- ['Arabic', 'Arabic'],
- ['Imperial_Aramaic', 'Imperial_Aramaic'],
- ['Armenian', 'Armenian'],
- ['Avestan', 'Avestan'],
- ['Balinese', 'Balinese'],
- ['Bamum', 'Bamum'],
- ['Bassa_Vah', 'Bassa_Vah'],
- ['Batak', 'Batak'],
- ['Bengali', 'Bengali'],
- ['Bhaiksuki', 'Bhaiksuki'],
- ['Bopomofo', 'Bopomofo'],
- ['Brahmi', 'Brahmi'],
- ['Braille', 'Braille'],
- ['Buginese', 'Buginese'],
- ['Buhid', 'Buhid'],
- ['Chakma', 'Chakma'],
- ['Canadian_Aboriginal', 'Canadian_Aboriginal'],
- ['Carian', 'Carian'],
- ['Cherokee', 'Cherokee'],
- ['Coptic', 'Coptic'],
- ['Cypriot', 'Cypriot'],
- ['Cyrillic', 'Cyrillic'],
- ['Devanagari', 'Devanagari'],
- ['Dogra', 'Dogra'],
- ['Deseret', 'Deseret'],
- ['Duployan', 'Duployan'],
- ['Egyptian_Hieroglyphs', 'Egyptian_Hieroglyphs'],
- ['Elbasan', 'Elbasan'],
- ['Ethiopic', 'Ethiopic'],
- ['Georgian', 'Georgian'],
- ['Glagolitic', 'Glagolitic'],
- ['Gunjala_Gondi', 'Gunjala_Gondi'],
- ['Masaram_Gondi', 'Masaram_Gondi'],
- ['Gothic', 'Gothic'],
- ['Grantha', 'Grantha'],
- ['Greek', 'Greek'],
- ['Gujarati', 'Gujarati'],
- ['Gurmukhi', 'Gurmukhi'],
- ['Hangul', 'Hangul'],
- ['Han', 'Han'],
- ['Hanunoo', 'Hanunoo'],
- ['Hatran', 'Hatran'],
- ['Hebrew', 'Hebrew'],
- ['Hiragana', 'Hiragana'],
- ['Anatolian_Hieroglyphs', 'Anatolian_Hieroglyphs'],
- ['Pahawh_Hmong', 'Pahawh_Hmong'],
- ['Katakana_Or_Hiragana', 'Katakana_Or_Hiragana'],
- ['Old_Hungarian', 'Old_Hungarian'],
- ['Old_Italic', 'Old_Italic'],
- ['Javanese', 'Javanese'],
- ['Kayah_Li', 'Kayah_Li'],
- ['Katakana', 'Katakana'],
- ['Kharoshthi', 'Kharoshthi'],
- ['Khmer', 'Khmer'],
- ['Khojki', 'Khojki'],
- ['Kannada', 'Kannada'],
- ['Kaithi', 'Kaithi'],
- ['Tai_Tham', 'Tai_Tham'],
- ['Lao', 'Lao'],
- ['Latin', 'Latin'],
- ['Lepcha', 'Lepcha'],
- ['Limbu', 'Limbu'],
- ['Linear_A', 'Linear_A'],
- ['Linear_B', 'Linear_B'],
- ['Lycian', 'Lycian'],
- ['Lydian', 'Lydian'],
- ['Mahajani', 'Mahajani'],
- ['Makasar', 'Makasar'],
- ['Mandaic', 'Mandaic'],
- ['Manichaean', 'Manichaean'],
- ['Marchen', 'Marchen'],
- ['Medefaidrin', 'Medefaidrin'],
- ['Mende_Kikakui', 'Mende_Kikakui'],
- ['Meroitic_Cursive', 'Meroitic_Cursive'],
- ['Meroitic_Hieroglyphs', 'Meroitic_Hieroglyphs'],
- ['Malayalam', 'Malayalam'],
- ['Mongolian', 'Mongolian'],
- ['Mro', 'Mro'],
- ['Meetei_Mayek', 'Meetei_Mayek'],
- ['Multani', 'Multani'],
- ['Myanmar', 'Myanmar'],
- ['Old_North_Arabian', 'Old_North_Arabian'],
- ['Nabataean', 'Nabataean'],
- ['Nko', 'Nko'],
- ['Nushu', 'Nushu'],
- ['Ogham', 'Ogham'],
- ['Ol_Chiki', 'Ol_Chiki'],
- ['Old_Turkic', 'Old_Turkic'],
- ['Oriya', 'Oriya'],
- ['Osage', 'Osage'],
- ['Osmanya', 'Osmanya'],
- ['Palmyrene', 'Palmyrene'],
- ['Pau_Cin_Hau', 'Pau_Cin_Hau'],
- ['Old_Permic', 'Old_Permic'],
- ['Phags_Pa', 'Phags_Pa'],
- ['Inscriptional_Pahlavi', 'Inscriptional_Pahlavi'],
- ['Psalter_Pahlavi', 'Psalter_Pahlavi'],
- ['Phoenician', 'Phoenician'],
- ['Miao', 'Miao'],
- ['Inscriptional_Parthian', 'Inscriptional_Parthian'],
- ['Rejang', 'Rejang'],
- ['Hanifi_Rohingya', 'Hanifi_Rohingya'],
- ['Runic', 'Runic'],
- ['Samaritan', 'Samaritan'],
- ['Old_South_Arabian', 'Old_South_Arabian'],
- ['Saurashtra', 'Saurashtra'],
- ['SignWriting', 'SignWriting'],
- ['Shavian', 'Shavian'],
- ['Sharada', 'Sharada'],
- ['Siddham', 'Siddham'],
- ['Khudawadi', 'Khudawadi'],
- ['Sinhala', 'Sinhala'],
- ['Sogdian', 'Sogdian'],
- ['Old_Sogdian', 'Old_Sogdian'],
- ['Sora_Sompeng', 'Sora_Sompeng'],
- ['Soyombo', 'Soyombo'],
- ['Sundanese', 'Sundanese'],
- ['Syloti_Nagri', 'Syloti_Nagri'],
- ['Syriac', 'Syriac'],
- ['Tagbanwa', 'Tagbanwa'],
- ['Takri', 'Takri'],
- ['Tai_Le', 'Tai_Le'],
- ['New_Tai_Lue', 'New_Tai_Lue'],
- ['Tamil', 'Tamil'],
- ['Tangut', 'Tangut'],
- ['Tai_Viet', 'Tai_Viet'],
- ['Telugu', 'Telugu'],
- ['Tifinagh', 'Tifinagh'],
- ['Tagalog', 'Tagalog'],
- ['Thaana', 'Thaana'],
- ['Tibetan', 'Tibetan'],
- ['Tirhuta', 'Tirhuta'],
- ['Ugaritic', 'Ugaritic'],
- ['Vai', 'Vai'],
- ['Warang_Citi', 'Warang_Citi'],
- ['Old_Persian', 'Old_Persian'],
- ['Cuneiform', 'Cuneiform'],
- ['Yi', 'Yi'],
- ['Zanabazar_Square', 'Zanabazar_Square'],
- ['Inherited', 'Inherited'],
- ['Common', 'Common'],
- ['Unknown', 'Unknown']
- ])]
- ]);
- var matchPropertyValue = function(property, value) {
- var aliasToValue = mappings.get(property);
- if (!aliasToValue) {
- throw new Error(("Unknown property `" + property + "`."));
- }
- var canonicalValue = aliasToValue.get(value);
- if (canonicalValue) {
- return canonicalValue;
- }
- throw new Error(
- ("Unknown value `" + value + "` for property `" + property + "`.")
- );
- };
- var unicodeMatchPropertyValueEcmascript = matchPropertyValue;
- var iuMappings = new Map([
- [0x4B, 0x212A],
- [0x53, 0x17F],
- [0x6B, 0x212A],
- [0x73, 0x17F],
- [0xB5, 0x39C],
- [0xC5, 0x212B],
- [0xDF, 0x1E9E],
- [0xE5, 0x212B],
- [0x17F, 0x53],
- [0x1C4, 0x1C5],
- [0x1C5, 0x1C4],
- [0x1C7, 0x1C8],
- [0x1C8, 0x1C7],
- [0x1CA, 0x1CB],
- [0x1CB, 0x1CA],
- [0x1F1, 0x1F2],
- [0x1F2, 0x1F1],
- [0x26A, 0xA7AE],
- [0x29D, 0xA7B2],
- [0x345, 0x1FBE],
- [0x392, 0x3D0],
- [0x395, 0x3F5],
- [0x398, 0x3F4],
- [0x399, 0x1FBE],
- [0x39A, 0x3F0],
- [0x39C, 0xB5],
- [0x3A0, 0x3D6],
- [0x3A1, 0x3F1],
- [0x3A3, 0x3C2],
- [0x3A6, 0x3D5],
- [0x3A9, 0x2126],
- [0x3B8, 0x3F4],
- [0x3C2, 0x3A3],
- [0x3C9, 0x2126],
- [0x3D0, 0x392],
- [0x3D1, 0x3F4],
- [0x3D5, 0x3A6],
- [0x3D6, 0x3A0],
- [0x3F0, 0x39A],
- [0x3F1, 0x3A1],
- [0x3F4, [
- 0x398,
- 0x3D1,
- 0x3B8
- ]],
- [0x3F5, 0x395],
- [0x412, 0x1C80],
- [0x414, 0x1C81],
- [0x41E, 0x1C82],
- [0x421, 0x1C83],
- [0x422, 0x1C85],
- [0x42A, 0x1C86],
- [0x432, 0x1C80],
- [0x434, 0x1C81],
- [0x43E, 0x1C82],
- [0x441, 0x1C83],
- [0x442, [
- 0x1C84,
- 0x1C85
- ]],
- [0x44A, 0x1C86],
- [0x462, 0x1C87],
- [0x463, 0x1C87],
- [0x10D0, 0x1C90],
- [0x10D1, 0x1C91],
- [0x10D2, 0x1C92],
- [0x10D3, 0x1C93],
- [0x10D4, 0x1C94],
- [0x10D5, 0x1C95],
- [0x10D6, 0x1C96],
- [0x10D7, 0x1C97],
- [0x10D8, 0x1C98],
- [0x10D9, 0x1C99],
- [0x10DA, 0x1C9A],
- [0x10DB, 0x1C9B],
- [0x10DC, 0x1C9C],
- [0x10DD, 0x1C9D],
- [0x10DE, 0x1C9E],
- [0x10DF, 0x1C9F],
- [0x10E0, 0x1CA0],
- [0x10E1, 0x1CA1],
- [0x10E2, 0x1CA2],
- [0x10E3, 0x1CA3],
- [0x10E4, 0x1CA4],
- [0x10E5, 0x1CA5],
- [0x10E6, 0x1CA6],
- [0x10E7, 0x1CA7],
- [0x10E8, 0x1CA8],
- [0x10E9, 0x1CA9],
- [0x10EA, 0x1CAA],
- [0x10EB, 0x1CAB],
- [0x10EC, 0x1CAC],
- [0x10ED, 0x1CAD],
- [0x10EE, 0x1CAE],
- [0x10EF, 0x1CAF],
- [0x10F0, 0x1CB0],
- [0x10F1, 0x1CB1],
- [0x10F2, 0x1CB2],
- [0x10F3, 0x1CB3],
- [0x10F4, 0x1CB4],
- [0x10F5, 0x1CB5],
- [0x10F6, 0x1CB6],
- [0x10F7, 0x1CB7],
- [0x10F8, 0x1CB8],
- [0x10F9, 0x1CB9],
- [0x10FA, 0x1CBA],
- [0x10FD, 0x1CBD],
- [0x10FE, 0x1CBE],
- [0x10FF, 0x1CBF],
- [0x13A0, 0xAB70],
- [0x13A1, 0xAB71],
- [0x13A2, 0xAB72],
- [0x13A3, 0xAB73],
- [0x13A4, 0xAB74],
- [0x13A5, 0xAB75],
- [0x13A6, 0xAB76],
- [0x13A7, 0xAB77],
- [0x13A8, 0xAB78],
- [0x13A9, 0xAB79],
- [0x13AA, 0xAB7A],
- [0x13AB, 0xAB7B],
- [0x13AC, 0xAB7C],
- [0x13AD, 0xAB7D],
- [0x13AE, 0xAB7E],
- [0x13AF, 0xAB7F],
- [0x13B0, 0xAB80],
- [0x13B1, 0xAB81],
- [0x13B2, 0xAB82],
- [0x13B3, 0xAB83],
- [0x13B4, 0xAB84],
- [0x13B5, 0xAB85],
- [0x13B6, 0xAB86],
- [0x13B7, 0xAB87],
- [0x13B8, 0xAB88],
- [0x13B9, 0xAB89],
- [0x13BA, 0xAB8A],
- [0x13BB, 0xAB8B],
- [0x13BC, 0xAB8C],
- [0x13BD, 0xAB8D],
- [0x13BE, 0xAB8E],
- [0x13BF, 0xAB8F],
- [0x13C0, 0xAB90],
- [0x13C1, 0xAB91],
- [0x13C2, 0xAB92],
- [0x13C3, 0xAB93],
- [0x13C4, 0xAB94],
- [0x13C5, 0xAB95],
- [0x13C6, 0xAB96],
- [0x13C7, 0xAB97],
- [0x13C8, 0xAB98],
- [0x13C9, 0xAB99],
- [0x13CA, 0xAB9A],
- [0x13CB, 0xAB9B],
- [0x13CC, 0xAB9C],
- [0x13CD, 0xAB9D],
- [0x13CE, 0xAB9E],
- [0x13CF, 0xAB9F],
- [0x13D0, 0xABA0],
- [0x13D1, 0xABA1],
- [0x13D2, 0xABA2],
- [0x13D3, 0xABA3],
- [0x13D4, 0xABA4],
- [0x13D5, 0xABA5],
- [0x13D6, 0xABA6],
- [0x13D7, 0xABA7],
- [0x13D8, 0xABA8],
- [0x13D9, 0xABA9],
- [0x13DA, 0xABAA],
- [0x13DB, 0xABAB],
- [0x13DC, 0xABAC],
- [0x13DD, 0xABAD],
- [0x13DE, 0xABAE],
- [0x13DF, 0xABAF],
- [0x13E0, 0xABB0],
- [0x13E1, 0xABB1],
- [0x13E2, 0xABB2],
- [0x13E3, 0xABB3],
- [0x13E4, 0xABB4],
- [0x13E5, 0xABB5],
- [0x13E6, 0xABB6],
- [0x13E7, 0xABB7],
- [0x13E8, 0xABB8],
- [0x13E9, 0xABB9],
- [0x13EA, 0xABBA],
- [0x13EB, 0xABBB],
- [0x13EC, 0xABBC],
- [0x13ED, 0xABBD],
- [0x13EE, 0xABBE],
- [0x13EF, 0xABBF],
- [0x13F0, 0x13F8],
- [0x13F1, 0x13F9],
- [0x13F2, 0x13FA],
- [0x13F3, 0x13FB],
- [0x13F4, 0x13FC],
- [0x13F5, 0x13FD],
- [0x13F8, 0x13F0],
- [0x13F9, 0x13F1],
- [0x13FA, 0x13F2],
- [0x13FB, 0x13F3],
- [0x13FC, 0x13F4],
- [0x13FD, 0x13F5],
- [0x1C80, [
- 0x412,
- 0x432
- ]],
- [0x1C81, [
- 0x414,
- 0x434
- ]],
- [0x1C82, [
- 0x41E,
- 0x43E
- ]],
- [0x1C83, [
- 0x421,
- 0x441
- ]],
- [0x1C84, [
- 0x1C85,
- 0x442
- ]],
- [0x1C85, [
- 0x422,
- 0x1C84,
- 0x442
- ]],
- [0x1C86, [
- 0x42A,
- 0x44A
- ]],
- [0x1C87, [
- 0x462,
- 0x463
- ]],
- [0x1C88, [
- 0xA64A,
- 0xA64B
- ]],
- [0x1C90, 0x10D0],
- [0x1C91, 0x10D1],
- [0x1C92, 0x10D2],
- [0x1C93, 0x10D3],
- [0x1C94, 0x10D4],
- [0x1C95, 0x10D5],
- [0x1C96, 0x10D6],
- [0x1C97, 0x10D7],
- [0x1C98, 0x10D8],
- [0x1C99, 0x10D9],
- [0x1C9A, 0x10DA],
- [0x1C9B, 0x10DB],
- [0x1C9C, 0x10DC],
- [0x1C9D, 0x10DD],
- [0x1C9E, 0x10DE],
- [0x1C9F, 0x10DF],
- [0x1CA0, 0x10E0],
- [0x1CA1, 0x10E1],
- [0x1CA2, 0x10E2],
- [0x1CA3, 0x10E3],
- [0x1CA4, 0x10E4],
- [0x1CA5, 0x10E5],
- [0x1CA6, 0x10E6],
- [0x1CA7, 0x10E7],
- [0x1CA8, 0x10E8],
- [0x1CA9, 0x10E9],
- [0x1CAA, 0x10EA],
- [0x1CAB, 0x10EB],
- [0x1CAC, 0x10EC],
- [0x1CAD, 0x10ED],
- [0x1CAE, 0x10EE],
- [0x1CAF, 0x10EF],
- [0x1CB0, 0x10F0],
- [0x1CB1, 0x10F1],
- [0x1CB2, 0x10F2],
- [0x1CB3, 0x10F3],
- [0x1CB4, 0x10F4],
- [0x1CB5, 0x10F5],
- [0x1CB6, 0x10F6],
- [0x1CB7, 0x10F7],
- [0x1CB8, 0x10F8],
- [0x1CB9, 0x10F9],
- [0x1CBA, 0x10FA],
- [0x1CBD, 0x10FD],
- [0x1CBE, 0x10FE],
- [0x1CBF, 0x10FF],
- [0x1E60, 0x1E9B],
- [0x1E9B, 0x1E60],
- [0x1E9E, 0xDF],
- [0x1F80, 0x1F88],
- [0x1F81, 0x1F89],
- [0x1F82, 0x1F8A],
- [0x1F83, 0x1F8B],
- [0x1F84, 0x1F8C],
- [0x1F85, 0x1F8D],
- [0x1F86, 0x1F8E],
- [0x1F87, 0x1F8F],
- [0x1F88, 0x1F80],
- [0x1F89, 0x1F81],
- [0x1F8A, 0x1F82],
- [0x1F8B, 0x1F83],
- [0x1F8C, 0x1F84],
- [0x1F8D, 0x1F85],
- [0x1F8E, 0x1F86],
- [0x1F8F, 0x1F87],
- [0x1F90, 0x1F98],
- [0x1F91, 0x1F99],
- [0x1F92, 0x1F9A],
- [0x1F93, 0x1F9B],
- [0x1F94, 0x1F9C],
- [0x1F95, 0x1F9D],
- [0x1F96, 0x1F9E],
- [0x1F97, 0x1F9F],
- [0x1F98, 0x1F90],
- [0x1F99, 0x1F91],
- [0x1F9A, 0x1F92],
- [0x1F9B, 0x1F93],
- [0x1F9C, 0x1F94],
- [0x1F9D, 0x1F95],
- [0x1F9E, 0x1F96],
- [0x1F9F, 0x1F97],
- [0x1FA0, 0x1FA8],
- [0x1FA1, 0x1FA9],
- [0x1FA2, 0x1FAA],
- [0x1FA3, 0x1FAB],
- [0x1FA4, 0x1FAC],
- [0x1FA5, 0x1FAD],
- [0x1FA6, 0x1FAE],
- [0x1FA7, 0x1FAF],
- [0x1FA8, 0x1FA0],
- [0x1FA9, 0x1FA1],
- [0x1FAA, 0x1FA2],
- [0x1FAB, 0x1FA3],
- [0x1FAC, 0x1FA4],
- [0x1FAD, 0x1FA5],
- [0x1FAE, 0x1FA6],
- [0x1FAF, 0x1FA7],
- [0x1FB3, 0x1FBC],
- [0x1FBC, 0x1FB3],
- [0x1FBE, [
- 0x345,
- 0x399
- ]],
- [0x1FC3, 0x1FCC],
- [0x1FCC, 0x1FC3],
- [0x1FF3, 0x1FFC],
- [0x1FFC, 0x1FF3],
- [0x2126, [
- 0x3A9,
- 0x3C9
- ]],
- [0x212A, 0x4B],
- [0x212B, [
- 0xC5,
- 0xE5
- ]],
- [0xA64A, 0x1C88],
- [0xA64B, 0x1C88],
- [0xA7AE, 0x26A],
- [0xA7B2, 0x29D],
- [0xA7B3, 0xAB53],
- [0xA7B4, 0xA7B5],
- [0xA7B5, 0xA7B4],
- [0xA7B6, 0xA7B7],
- [0xA7B7, 0xA7B6],
- [0xA7B8, 0xA7B9],
- [0xA7B9, 0xA7B8],
- [0xAB53, 0xA7B3],
- [0xAB70, 0x13A0],
- [0xAB71, 0x13A1],
- [0xAB72, 0x13A2],
- [0xAB73, 0x13A3],
- [0xAB74, 0x13A4],
- [0xAB75, 0x13A5],
- [0xAB76, 0x13A6],
- [0xAB77, 0x13A7],
- [0xAB78, 0x13A8],
- [0xAB79, 0x13A9],
- [0xAB7A, 0x13AA],
- [0xAB7B, 0x13AB],
- [0xAB7C, 0x13AC],
- [0xAB7D, 0x13AD],
- [0xAB7E, 0x13AE],
- [0xAB7F, 0x13AF],
- [0xAB80, 0x13B0],
- [0xAB81, 0x13B1],
- [0xAB82, 0x13B2],
- [0xAB83, 0x13B3],
- [0xAB84, 0x13B4],
- [0xAB85, 0x13B5],
- [0xAB86, 0x13B6],
- [0xAB87, 0x13B7],
- [0xAB88, 0x13B8],
- [0xAB89, 0x13B9],
- [0xAB8A, 0x13BA],
- [0xAB8B, 0x13BB],
- [0xAB8C, 0x13BC],
- [0xAB8D, 0x13BD],
- [0xAB8E, 0x13BE],
- [0xAB8F, 0x13BF],
- [0xAB90, 0x13C0],
- [0xAB91, 0x13C1],
- [0xAB92, 0x13C2],
- [0xAB93, 0x13C3],
- [0xAB94, 0x13C4],
- [0xAB95, 0x13C5],
- [0xAB96, 0x13C6],
- [0xAB97, 0x13C7],
- [0xAB98, 0x13C8],
- [0xAB99, 0x13C9],
- [0xAB9A, 0x13CA],
- [0xAB9B, 0x13CB],
- [0xAB9C, 0x13CC],
- [0xAB9D, 0x13CD],
- [0xAB9E, 0x13CE],
- [0xAB9F, 0x13CF],
- [0xABA0, 0x13D0],
- [0xABA1, 0x13D1],
- [0xABA2, 0x13D2],
- [0xABA3, 0x13D3],
- [0xABA4, 0x13D4],
- [0xABA5, 0x13D5],
- [0xABA6, 0x13D6],
- [0xABA7, 0x13D7],
- [0xABA8, 0x13D8],
- [0xABA9, 0x13D9],
- [0xABAA, 0x13DA],
- [0xABAB, 0x13DB],
- [0xABAC, 0x13DC],
- [0xABAD, 0x13DD],
- [0xABAE, 0x13DE],
- [0xABAF, 0x13DF],
- [0xABB0, 0x13E0],
- [0xABB1, 0x13E1],
- [0xABB2, 0x13E2],
- [0xABB3, 0x13E3],
- [0xABB4, 0x13E4],
- [0xABB5, 0x13E5],
- [0xABB6, 0x13E6],
- [0xABB7, 0x13E7],
- [0xABB8, 0x13E8],
- [0xABB9, 0x13E9],
- [0xABBA, 0x13EA],
- [0xABBB, 0x13EB],
- [0xABBC, 0x13EC],
- [0xABBD, 0x13ED],
- [0xABBE, 0x13EE],
- [0xABBF, 0x13EF],
- [0x10400, 0x10428],
- [0x10401, 0x10429],
- [0x10402, 0x1042A],
- [0x10403, 0x1042B],
- [0x10404, 0x1042C],
- [0x10405, 0x1042D],
- [0x10406, 0x1042E],
- [0x10407, 0x1042F],
- [0x10408, 0x10430],
- [0x10409, 0x10431],
- [0x1040A, 0x10432],
- [0x1040B, 0x10433],
- [0x1040C, 0x10434],
- [0x1040D, 0x10435],
- [0x1040E, 0x10436],
- [0x1040F, 0x10437],
- [0x10410, 0x10438],
- [0x10411, 0x10439],
- [0x10412, 0x1043A],
- [0x10413, 0x1043B],
- [0x10414, 0x1043C],
- [0x10415, 0x1043D],
- [0x10416, 0x1043E],
- [0x10417, 0x1043F],
- [0x10418, 0x10440],
- [0x10419, 0x10441],
- [0x1041A, 0x10442],
- [0x1041B, 0x10443],
- [0x1041C, 0x10444],
- [0x1041D, 0x10445],
- [0x1041E, 0x10446],
- [0x1041F, 0x10447],
- [0x10420, 0x10448],
- [0x10421, 0x10449],
- [0x10422, 0x1044A],
- [0x10423, 0x1044B],
- [0x10424, 0x1044C],
- [0x10425, 0x1044D],
- [0x10426, 0x1044E],
- [0x10427, 0x1044F],
- [0x10428, 0x10400],
- [0x10429, 0x10401],
- [0x1042A, 0x10402],
- [0x1042B, 0x10403],
- [0x1042C, 0x10404],
- [0x1042D, 0x10405],
- [0x1042E, 0x10406],
- [0x1042F, 0x10407],
- [0x10430, 0x10408],
- [0x10431, 0x10409],
- [0x10432, 0x1040A],
- [0x10433, 0x1040B],
- [0x10434, 0x1040C],
- [0x10435, 0x1040D],
- [0x10436, 0x1040E],
- [0x10437, 0x1040F],
- [0x10438, 0x10410],
- [0x10439, 0x10411],
- [0x1043A, 0x10412],
- [0x1043B, 0x10413],
- [0x1043C, 0x10414],
- [0x1043D, 0x10415],
- [0x1043E, 0x10416],
- [0x1043F, 0x10417],
- [0x10440, 0x10418],
- [0x10441, 0x10419],
- [0x10442, 0x1041A],
- [0x10443, 0x1041B],
- [0x10444, 0x1041C],
- [0x10445, 0x1041D],
- [0x10446, 0x1041E],
- [0x10447, 0x1041F],
- [0x10448, 0x10420],
- [0x10449, 0x10421],
- [0x1044A, 0x10422],
- [0x1044B, 0x10423],
- [0x1044C, 0x10424],
- [0x1044D, 0x10425],
- [0x1044E, 0x10426],
- [0x1044F, 0x10427],
- [0x104B0, 0x104D8],
- [0x104B1, 0x104D9],
- [0x104B2, 0x104DA],
- [0x104B3, 0x104DB],
- [0x104B4, 0x104DC],
- [0x104B5, 0x104DD],
- [0x104B6, 0x104DE],
- [0x104B7, 0x104DF],
- [0x104B8, 0x104E0],
- [0x104B9, 0x104E1],
- [0x104BA, 0x104E2],
- [0x104BB, 0x104E3],
- [0x104BC, 0x104E4],
- [0x104BD, 0x104E5],
- [0x104BE, 0x104E6],
- [0x104BF, 0x104E7],
- [0x104C0, 0x104E8],
- [0x104C1, 0x104E9],
- [0x104C2, 0x104EA],
- [0x104C3, 0x104EB],
- [0x104C4, 0x104EC],
- [0x104C5, 0x104ED],
- [0x104C6, 0x104EE],
- [0x104C7, 0x104EF],
- [0x104C8, 0x104F0],
- [0x104C9, 0x104F1],
- [0x104CA, 0x104F2],
- [0x104CB, 0x104F3],
- [0x104CC, 0x104F4],
- [0x104CD, 0x104F5],
- [0x104CE, 0x104F6],
- [0x104CF, 0x104F7],
- [0x104D0, 0x104F8],
- [0x104D1, 0x104F9],
- [0x104D2, 0x104FA],
- [0x104D3, 0x104FB],
- [0x104D8, 0x104B0],
- [0x104D9, 0x104B1],
- [0x104DA, 0x104B2],
- [0x104DB, 0x104B3],
- [0x104DC, 0x104B4],
- [0x104DD, 0x104B5],
- [0x104DE, 0x104B6],
- [0x104DF, 0x104B7],
- [0x104E0, 0x104B8],
- [0x104E1, 0x104B9],
- [0x104E2, 0x104BA],
- [0x104E3, 0x104BB],
- [0x104E4, 0x104BC],
- [0x104E5, 0x104BD],
- [0x104E6, 0x104BE],
- [0x104E7, 0x104BF],
- [0x104E8, 0x104C0],
- [0x104E9, 0x104C1],
- [0x104EA, 0x104C2],
- [0x104EB, 0x104C3],
- [0x104EC, 0x104C4],
- [0x104ED, 0x104C5],
- [0x104EE, 0x104C6],
- [0x104EF, 0x104C7],
- [0x104F0, 0x104C8],
- [0x104F1, 0x104C9],
- [0x104F2, 0x104CA],
- [0x104F3, 0x104CB],
- [0x104F4, 0x104CC],
- [0x104F5, 0x104CD],
- [0x104F6, 0x104CE],
- [0x104F7, 0x104CF],
- [0x104F8, 0x104D0],
- [0x104F9, 0x104D1],
- [0x104FA, 0x104D2],
- [0x104FB, 0x104D3],
- [0x10C80, 0x10CC0],
- [0x10C81, 0x10CC1],
- [0x10C82, 0x10CC2],
- [0x10C83, 0x10CC3],
- [0x10C84, 0x10CC4],
- [0x10C85, 0x10CC5],
- [0x10C86, 0x10CC6],
- [0x10C87, 0x10CC7],
- [0x10C88, 0x10CC8],
- [0x10C89, 0x10CC9],
- [0x10C8A, 0x10CCA],
- [0x10C8B, 0x10CCB],
- [0x10C8C, 0x10CCC],
- [0x10C8D, 0x10CCD],
- [0x10C8E, 0x10CCE],
- [0x10C8F, 0x10CCF],
- [0x10C90, 0x10CD0],
- [0x10C91, 0x10CD1],
- [0x10C92, 0x10CD2],
- [0x10C93, 0x10CD3],
- [0x10C94, 0x10CD4],
- [0x10C95, 0x10CD5],
- [0x10C96, 0x10CD6],
- [0x10C97, 0x10CD7],
- [0x10C98, 0x10CD8],
- [0x10C99, 0x10CD9],
- [0x10C9A, 0x10CDA],
- [0x10C9B, 0x10CDB],
- [0x10C9C, 0x10CDC],
- [0x10C9D, 0x10CDD],
- [0x10C9E, 0x10CDE],
- [0x10C9F, 0x10CDF],
- [0x10CA0, 0x10CE0],
- [0x10CA1, 0x10CE1],
- [0x10CA2, 0x10CE2],
- [0x10CA3, 0x10CE3],
- [0x10CA4, 0x10CE4],
- [0x10CA5, 0x10CE5],
- [0x10CA6, 0x10CE6],
- [0x10CA7, 0x10CE7],
- [0x10CA8, 0x10CE8],
- [0x10CA9, 0x10CE9],
- [0x10CAA, 0x10CEA],
- [0x10CAB, 0x10CEB],
- [0x10CAC, 0x10CEC],
- [0x10CAD, 0x10CED],
- [0x10CAE, 0x10CEE],
- [0x10CAF, 0x10CEF],
- [0x10CB0, 0x10CF0],
- [0x10CB1, 0x10CF1],
- [0x10CB2, 0x10CF2],
- [0x10CC0, 0x10C80],
- [0x10CC1, 0x10C81],
- [0x10CC2, 0x10C82],
- [0x10CC3, 0x10C83],
- [0x10CC4, 0x10C84],
- [0x10CC5, 0x10C85],
- [0x10CC6, 0x10C86],
- [0x10CC7, 0x10C87],
- [0x10CC8, 0x10C88],
- [0x10CC9, 0x10C89],
- [0x10CCA, 0x10C8A],
- [0x10CCB, 0x10C8B],
- [0x10CCC, 0x10C8C],
- [0x10CCD, 0x10C8D],
- [0x10CCE, 0x10C8E],
- [0x10CCF, 0x10C8F],
- [0x10CD0, 0x10C90],
- [0x10CD1, 0x10C91],
- [0x10CD2, 0x10C92],
- [0x10CD3, 0x10C93],
- [0x10CD4, 0x10C94],
- [0x10CD5, 0x10C95],
- [0x10CD6, 0x10C96],
- [0x10CD7, 0x10C97],
- [0x10CD8, 0x10C98],
- [0x10CD9, 0x10C99],
- [0x10CDA, 0x10C9A],
- [0x10CDB, 0x10C9B],
- [0x10CDC, 0x10C9C],
- [0x10CDD, 0x10C9D],
- [0x10CDE, 0x10C9E],
- [0x10CDF, 0x10C9F],
- [0x10CE0, 0x10CA0],
- [0x10CE1, 0x10CA1],
- [0x10CE2, 0x10CA2],
- [0x10CE3, 0x10CA3],
- [0x10CE4, 0x10CA4],
- [0x10CE5, 0x10CA5],
- [0x10CE6, 0x10CA6],
- [0x10CE7, 0x10CA7],
- [0x10CE8, 0x10CA8],
- [0x10CE9, 0x10CA9],
- [0x10CEA, 0x10CAA],
- [0x10CEB, 0x10CAB],
- [0x10CEC, 0x10CAC],
- [0x10CED, 0x10CAD],
- [0x10CEE, 0x10CAE],
- [0x10CEF, 0x10CAF],
- [0x10CF0, 0x10CB0],
- [0x10CF1, 0x10CB1],
- [0x10CF2, 0x10CB2],
- [0x118A0, 0x118C0],
- [0x118A1, 0x118C1],
- [0x118A2, 0x118C2],
- [0x118A3, 0x118C3],
- [0x118A4, 0x118C4],
- [0x118A5, 0x118C5],
- [0x118A6, 0x118C6],
- [0x118A7, 0x118C7],
- [0x118A8, 0x118C8],
- [0x118A9, 0x118C9],
- [0x118AA, 0x118CA],
- [0x118AB, 0x118CB],
- [0x118AC, 0x118CC],
- [0x118AD, 0x118CD],
- [0x118AE, 0x118CE],
- [0x118AF, 0x118CF],
- [0x118B0, 0x118D0],
- [0x118B1, 0x118D1],
- [0x118B2, 0x118D2],
- [0x118B3, 0x118D3],
- [0x118B4, 0x118D4],
- [0x118B5, 0x118D5],
- [0x118B6, 0x118D6],
- [0x118B7, 0x118D7],
- [0x118B8, 0x118D8],
- [0x118B9, 0x118D9],
- [0x118BA, 0x118DA],
- [0x118BB, 0x118DB],
- [0x118BC, 0x118DC],
- [0x118BD, 0x118DD],
- [0x118BE, 0x118DE],
- [0x118BF, 0x118DF],
- [0x118C0, 0x118A0],
- [0x118C1, 0x118A1],
- [0x118C2, 0x118A2],
- [0x118C3, 0x118A3],
- [0x118C4, 0x118A4],
- [0x118C5, 0x118A5],
- [0x118C6, 0x118A6],
- [0x118C7, 0x118A7],
- [0x118C8, 0x118A8],
- [0x118C9, 0x118A9],
- [0x118CA, 0x118AA],
- [0x118CB, 0x118AB],
- [0x118CC, 0x118AC],
- [0x118CD, 0x118AD],
- [0x118CE, 0x118AE],
- [0x118CF, 0x118AF],
- [0x118D0, 0x118B0],
- [0x118D1, 0x118B1],
- [0x118D2, 0x118B2],
- [0x118D3, 0x118B3],
- [0x118D4, 0x118B4],
- [0x118D5, 0x118B5],
- [0x118D6, 0x118B6],
- [0x118D7, 0x118B7],
- [0x118D8, 0x118B8],
- [0x118D9, 0x118B9],
- [0x118DA, 0x118BA],
- [0x118DB, 0x118BB],
- [0x118DC, 0x118BC],
- [0x118DD, 0x118BD],
- [0x118DE, 0x118BE],
- [0x118DF, 0x118BF],
- [0x16E40, 0x16E60],
- [0x16E41, 0x16E61],
- [0x16E42, 0x16E62],
- [0x16E43, 0x16E63],
- [0x16E44, 0x16E64],
- [0x16E45, 0x16E65],
- [0x16E46, 0x16E66],
- [0x16E47, 0x16E67],
- [0x16E48, 0x16E68],
- [0x16E49, 0x16E69],
- [0x16E4A, 0x16E6A],
- [0x16E4B, 0x16E6B],
- [0x16E4C, 0x16E6C],
- [0x16E4D, 0x16E6D],
- [0x16E4E, 0x16E6E],
- [0x16E4F, 0x16E6F],
- [0x16E50, 0x16E70],
- [0x16E51, 0x16E71],
- [0x16E52, 0x16E72],
- [0x16E53, 0x16E73],
- [0x16E54, 0x16E74],
- [0x16E55, 0x16E75],
- [0x16E56, 0x16E76],
- [0x16E57, 0x16E77],
- [0x16E58, 0x16E78],
- [0x16E59, 0x16E79],
- [0x16E5A, 0x16E7A],
- [0x16E5B, 0x16E7B],
- [0x16E5C, 0x16E7C],
- [0x16E5D, 0x16E7D],
- [0x16E5E, 0x16E7E],
- [0x16E5F, 0x16E7F],
- [0x16E60, 0x16E40],
- [0x16E61, 0x16E41],
- [0x16E62, 0x16E42],
- [0x16E63, 0x16E43],
- [0x16E64, 0x16E44],
- [0x16E65, 0x16E45],
- [0x16E66, 0x16E46],
- [0x16E67, 0x16E47],
- [0x16E68, 0x16E48],
- [0x16E69, 0x16E49],
- [0x16E6A, 0x16E4A],
- [0x16E6B, 0x16E4B],
- [0x16E6C, 0x16E4C],
- [0x16E6D, 0x16E4D],
- [0x16E6E, 0x16E4E],
- [0x16E6F, 0x16E4F],
- [0x16E70, 0x16E50],
- [0x16E71, 0x16E51],
- [0x16E72, 0x16E52],
- [0x16E73, 0x16E53],
- [0x16E74, 0x16E54],
- [0x16E75, 0x16E55],
- [0x16E76, 0x16E56],
- [0x16E77, 0x16E57],
- [0x16E78, 0x16E58],
- [0x16E79, 0x16E59],
- [0x16E7A, 0x16E5A],
- [0x16E7B, 0x16E5B],
- [0x16E7C, 0x16E5C],
- [0x16E7D, 0x16E5D],
- [0x16E7E, 0x16E5E],
- [0x16E7F, 0x16E5F],
- [0x1E900, 0x1E922],
- [0x1E901, 0x1E923],
- [0x1E902, 0x1E924],
- [0x1E903, 0x1E925],
- [0x1E904, 0x1E926],
- [0x1E905, 0x1E927],
- [0x1E906, 0x1E928],
- [0x1E907, 0x1E929],
- [0x1E908, 0x1E92A],
- [0x1E909, 0x1E92B],
- [0x1E90A, 0x1E92C],
- [0x1E90B, 0x1E92D],
- [0x1E90C, 0x1E92E],
- [0x1E90D, 0x1E92F],
- [0x1E90E, 0x1E930],
- [0x1E90F, 0x1E931],
- [0x1E910, 0x1E932],
- [0x1E911, 0x1E933],
- [0x1E912, 0x1E934],
- [0x1E913, 0x1E935],
- [0x1E914, 0x1E936],
- [0x1E915, 0x1E937],
- [0x1E916, 0x1E938],
- [0x1E917, 0x1E939],
- [0x1E918, 0x1E93A],
- [0x1E919, 0x1E93B],
- [0x1E91A, 0x1E93C],
- [0x1E91B, 0x1E93D],
- [0x1E91C, 0x1E93E],
- [0x1E91D, 0x1E93F],
- [0x1E91E, 0x1E940],
- [0x1E91F, 0x1E941],
- [0x1E920, 0x1E942],
- [0x1E921, 0x1E943],
- [0x1E922, 0x1E900],
- [0x1E923, 0x1E901],
- [0x1E924, 0x1E902],
- [0x1E925, 0x1E903],
- [0x1E926, 0x1E904],
- [0x1E927, 0x1E905],
- [0x1E928, 0x1E906],
- [0x1E929, 0x1E907],
- [0x1E92A, 0x1E908],
- [0x1E92B, 0x1E909],
- [0x1E92C, 0x1E90A],
- [0x1E92D, 0x1E90B],
- [0x1E92E, 0x1E90C],
- [0x1E92F, 0x1E90D],
- [0x1E930, 0x1E90E],
- [0x1E931, 0x1E90F],
- [0x1E932, 0x1E910],
- [0x1E933, 0x1E911],
- [0x1E934, 0x1E912],
- [0x1E935, 0x1E913],
- [0x1E936, 0x1E914],
- [0x1E937, 0x1E915],
- [0x1E938, 0x1E916],
- [0x1E939, 0x1E917],
- [0x1E93A, 0x1E918],
- [0x1E93B, 0x1E919],
- [0x1E93C, 0x1E91A],
- [0x1E93D, 0x1E91B],
- [0x1E93E, 0x1E91C],
- [0x1E93F, 0x1E91D],
- [0x1E940, 0x1E91E],
- [0x1E941, 0x1E91F],
- [0x1E942, 0x1E920],
- [0x1E943, 0x1E921]
- ]);
- var REGULAR = new Map([
- ['d', regenerate()
- .addRange(0x30, 0x39)],
- ['D', regenerate()
- .addRange(0x0, 0x2F)
- .addRange(0x3A, 0xFFFF)],
- ['s', regenerate(0x20, 0xA0, 0x1680, 0x202F, 0x205F, 0x3000, 0xFEFF)
- .addRange(0x9, 0xD)
- .addRange(0x2000, 0x200A)
- .addRange(0x2028, 0x2029)],
- ['S', regenerate()
- .addRange(0x0, 0x8)
- .addRange(0xE, 0x1F)
- .addRange(0x21, 0x9F)
- .addRange(0xA1, 0x167F)
- .addRange(0x1681, 0x1FFF)
- .addRange(0x200B, 0x2027)
- .addRange(0x202A, 0x202E)
- .addRange(0x2030, 0x205E)
- .addRange(0x2060, 0x2FFF)
- .addRange(0x3001, 0xFEFE)
- .addRange(0xFF00, 0xFFFF)],
- ['w', regenerate(0x5F)
- .addRange(0x30, 0x39)
- .addRange(0x41, 0x5A)
- .addRange(0x61, 0x7A)],
- ['W', regenerate(0x60)
- .addRange(0x0, 0x2F)
- .addRange(0x3A, 0x40)
- .addRange(0x5B, 0x5E)
- .addRange(0x7B, 0xFFFF)]
- ]);
- var UNICODE = new Map([
- ['d', regenerate()
- .addRange(0x30, 0x39)],
- ['D', regenerate()
- .addRange(0x0, 0x2F)
- .addRange(0x3A, 0x10FFFF)],
- ['s', regenerate(0x20, 0xA0, 0x1680, 0x202F, 0x205F, 0x3000, 0xFEFF)
- .addRange(0x9, 0xD)
- .addRange(0x2000, 0x200A)
- .addRange(0x2028, 0x2029)],
- ['S', regenerate()
- .addRange(0x0, 0x8)
- .addRange(0xE, 0x1F)
- .addRange(0x21, 0x9F)
- .addRange(0xA1, 0x167F)
- .addRange(0x1681, 0x1FFF)
- .addRange(0x200B, 0x2027)
- .addRange(0x202A, 0x202E)
- .addRange(0x2030, 0x205E)
- .addRange(0x2060, 0x2FFF)
- .addRange(0x3001, 0xFEFE)
- .addRange(0xFF00, 0x10FFFF)],
- ['w', regenerate(0x5F)
- .addRange(0x30, 0x39)
- .addRange(0x41, 0x5A)
- .addRange(0x61, 0x7A)],
- ['W', regenerate(0x60)
- .addRange(0x0, 0x2F)
- .addRange(0x3A, 0x40)
- .addRange(0x5B, 0x5E)
- .addRange(0x7B, 0x10FFFF)]
- ]);
- var UNICODE_IGNORE_CASE = new Map([
- ['d', regenerate()
- .addRange(0x30, 0x39)],
- ['D', regenerate()
- .addRange(0x0, 0x2F)
- .addRange(0x3A, 0x10FFFF)],
- ['s', regenerate(0x20, 0xA0, 0x1680, 0x202F, 0x205F, 0x3000, 0xFEFF)
- .addRange(0x9, 0xD)
- .addRange(0x2000, 0x200A)
- .addRange(0x2028, 0x2029)],
- ['S', regenerate()
- .addRange(0x0, 0x8)
- .addRange(0xE, 0x1F)
- .addRange(0x21, 0x9F)
- .addRange(0xA1, 0x167F)
- .addRange(0x1681, 0x1FFF)
- .addRange(0x200B, 0x2027)
- .addRange(0x202A, 0x202E)
- .addRange(0x2030, 0x205E)
- .addRange(0x2060, 0x2FFF)
- .addRange(0x3001, 0xFEFE)
- .addRange(0xFF00, 0x10FFFF)],
- ['w', regenerate(0x5F, 0x17F, 0x212A)
- .addRange(0x30, 0x39)
- .addRange(0x41, 0x5A)
- .addRange(0x61, 0x7A)],
- ['W', regenerate(0x60)
- .addRange(0x0, 0x2F)
- .addRange(0x3A, 0x40)
- .addRange(0x5B, 0x5E)
- .addRange(0x7B, 0x17E)
- .addRange(0x180, 0x2129)
- .addRange(0x212B, 0x10FFFF)]
- ]);
- var characterClassEscapeSets = {
- REGULAR: REGULAR,
- UNICODE: UNICODE,
- UNICODE_IGNORE_CASE: UNICODE_IGNORE_CASE
- };
- var rewritePattern_1 = createCommonjsModule(function (module) {
- var generate = regjsgen.generate;
- var parse = parser.parse;
- var UNICODE_SET = regenerate().addRange(0x0, 0x10FFFF);
- var BMP_SET = regenerate().addRange(0x0, 0xFFFF);
- var DOT_SET_UNICODE = UNICODE_SET.clone()
- .remove(
-
- 0x000A,
- 0x000D,
- 0x2028,
- 0x2029
- );
- var DOT_SET = DOT_SET_UNICODE.clone()
- .intersection(BMP_SET);
- var getCharacterClassEscapeSet = function (character, unicode, ignoreCase) {
- if (unicode) {
- if (ignoreCase) {
- return characterClassEscapeSets.UNICODE_IGNORE_CASE.get(character);
- }
- return characterClassEscapeSets.UNICODE.get(character);
- }
- return characterClassEscapeSets.REGULAR.get(character);
- };
- var getDotSet = function (unicode, dotAll) {
- if (dotAll) {
- return unicode ? UNICODE_SET : BMP_SET;
- }
- return unicode ? DOT_SET_UNICODE : DOT_SET;
- };
- var getUnicodePropertyValueSet = function (property, value) {
- var path = value ?
- (property + "/" + value) :
- ("Binary_Property/" + property);
- try {
- return commonjsRequire(("regenerate-unicode-properties/" + path + ".js"));
- } catch (exception) {
- throw new Error(
- "Failed to recognize value `" + value + "` for property " +
- "`" + property + "`."
- );
- }
- };
- var handleLoneUnicodePropertyNameOrValue = function (value) {
-
-
- try {
- var property$1 = 'General_Category';
- var category = unicodeMatchPropertyValueEcmascript(property$1, value);
- return getUnicodePropertyValueSet(property$1, category);
- } catch (exception) {}
-
-
- var property = unicodeMatchPropertyEcmascript(value);
- return getUnicodePropertyValueSet(property);
- };
- var getUnicodePropertyEscapeSet = function (value, isNegative) {
- var parts = value.split('=');
- var firstPart = parts[0];
- var set;
- if (parts.length == 1) {
- set = handleLoneUnicodePropertyNameOrValue(firstPart);
- } else {
-
- var property = unicodeMatchPropertyEcmascript(firstPart);
- var value$1 = unicodeMatchPropertyValueEcmascript(property, parts[1]);
- set = getUnicodePropertyValueSet(property, value$1);
- }
- if (isNegative) {
- return UNICODE_SET.clone().remove(set);
- }
- return set.clone();
- };
- // Given a range of code points, add any case-folded code points in that range
- // to a set.
- regenerate.prototype.iuAddRange = function(min, max) {
- var $this = this;
- do {
- var folded = caseFold(min);
- if (folded) {
- $this.add(folded);
- }
- } while (++min <= max);
- return $this;
- };
- var update = function (item, pattern) {
- var tree = parse(pattern, config.useUnicodeFlag ? 'u' : '');
- switch (tree.type) {
- case 'characterClass':
- case 'group':
- case 'value':
-
- break;
- default:
-
- tree = wrap(tree, pattern);
- }
- Object.assign(item, tree);
- };
- var wrap = function (tree, pattern) {
-
- return {
- 'type': 'group',
- 'behavior': 'ignore',
- 'body': [tree],
- 'raw': ("(?:" + pattern + ")")
- };
- };
- var caseFold = function (codePoint) {
- return iuMappings.get(codePoint) || false;
- };
- var processCharacterClass = function (characterClassItem, regenerateOptions) {
- var set = regenerate();
- for (var i = 0, list = characterClassItem.body; i < list.length; i += 1) {
- var item = list[i];
- switch (item.type) {
- case 'value':
- set.add(item.codePoint);
- if (config.ignoreCase && config.unicode && !config.useUnicodeFlag) {
- var folded = caseFold(item.codePoint);
- if (folded) {
- set.add(folded);
- }
- }
- break;
- case 'characterClassRange':
- var min = item.min.codePoint;
- var max = item.max.codePoint;
- set.addRange(min, max);
- if (config.ignoreCase && config.unicode && !config.useUnicodeFlag) {
- set.iuAddRange(min, max);
- }
- break;
- case 'characterClassEscape':
- set.add(getCharacterClassEscapeSet(
- item.value,
- config.unicode,
- config.ignoreCase
- ));
- break;
- case 'unicodePropertyEscape':
- set.add(getUnicodePropertyEscapeSet(item.value, item.negative));
- break;
- // The `default` clause is only here as a safeguard; it should never be
- // reached. Code coverage tools should ignore it.
- /* istanbul ignore next */
- default:
- throw new Error(("Unknown term type: " + (item.type)));
- }
- }
- if (characterClassItem.negative) {
- set = (config.unicode ? UNICODE_SET : BMP_SET).clone().remove(set);
- }
- update(characterClassItem, set.toString(regenerateOptions));
- return characterClassItem;
- };
- var updateNamedReference = function (item, index) {
- delete item.name;
- item.matchIndex = index;
- };
- var assertNoUnmatchedReferences = function (groups) {
- var unmatchedReferencesNames = Object.keys(groups.unmatchedReferences);
- if (unmatchedReferencesNames.length > 0) {
- throw new Error(("Unknown group names: " + unmatchedReferencesNames));
- }
- };
- var processTerm = function (item, regenerateOptions, groups) {
- switch (item.type) {
- case 'dot':
- update(
- item,
- getDotSet(config.unicode, config.dotAll).toString(regenerateOptions)
- );
- break;
- case 'characterClass':
- item = processCharacterClass(item, regenerateOptions);
- break;
- case 'unicodePropertyEscape':
- update(
- item,
- getUnicodePropertyEscapeSet(item.value, item.negative)
- .toString(regenerateOptions)
- );
- break;
- case 'characterClassEscape':
- update(
- item,
- getCharacterClassEscapeSet(
- item.value,
- config.unicode,
- config.ignoreCase
- ).toString(regenerateOptions)
- );
- break;
- case 'group':
- groups.lastIndex++;
- if (item.name) {
- var name = item.name.value;
- if (groups.names[name]) {
- throw new Error(
- ("Multiple groups with the same name (" + name + ") are not allowed.")
- );
- }
- var index = groups.lastIndex;
- delete item.name;
- groups.names[name] = index;
- if (groups.onNamedGroup) {
- groups.onNamedGroup.call(null, name, index);
- }
- if (groups.unmatchedReferences[name]) {
- groups.unmatchedReferences[name].forEach(function (reference) {
- updateNamedReference(reference, index);
- });
- delete groups.unmatchedReferences[name];
- }
- }
-
- case 'alternative':
- case 'disjunction':
- case 'quantifier':
- item.body = item.body.map(function (term) {
- return processTerm(term, regenerateOptions, groups);
- });
- break;
- case 'value':
- var codePoint = item.codePoint;
- var set = regenerate(codePoint);
- if (config.ignoreCase && config.unicode && !config.useUnicodeFlag) {
- var folded = caseFold(codePoint);
- if (folded) {
- set.add(folded);
- }
- }
- update(item, set.toString(regenerateOptions));
- break;
- case 'reference':
- if (item.name) {
- var name$1 = item.name.value;
- var index$1 = groups.names[name$1];
- if (index$1) {
- updateNamedReference(item, index$1);
- break;
- }
- if (!groups.unmatchedReferences[name$1]) {
- groups.unmatchedReferences[name$1] = [];
- }
-
- groups.unmatchedReferences[name$1].push(item);
- }
- break;
- case 'anchor':
- case 'empty':
- case 'group':
-
- break;
-
-
-
- default:
- throw new Error(("Unknown term type: " + (item.type)));
- }
- return item;
- };
- var config = {
- 'ignoreCase': false,
- 'unicode': false,
- 'dotAll': false,
- 'useUnicodeFlag': false
- };
- var rewritePattern = function (pattern, flags, options) {
- var regjsparserFeatures = {
- 'unicodePropertyEscape': options && options.unicodePropertyEscape,
- 'namedGroups': options && options.namedGroup,
- 'lookbehind': options && options.lookbehind
- };
- config.ignoreCase = flags && flags.includes('i');
- config.unicode = flags && flags.includes('u');
- var supportDotAllFlag = options && options.dotAllFlag;
- config.dotAll = supportDotAllFlag && flags && flags.includes('s');
- config.useUnicodeFlag = options && options.useUnicodeFlag;
- var regenerateOptions = {
- 'hasUnicodeFlag': config.useUnicodeFlag,
- 'bmpOnly': !config.unicode
- };
- var groups = {
- 'onNamedGroup': options && options.onNamedGroup,
- 'lastIndex': 0,
- 'names': Object.create(null),
- 'unmatchedReferences': Object.create(null)
- };
- var tree = parse(pattern, flags, regjsparserFeatures);
-
- processTerm(tree, regenerateOptions, groups);
- assertNoUnmatchedReferences(groups);
- return generate(tree);
- };
- module.exports = rewritePattern;
- });
- var Literal = (function (Node) {
- function Literal () {
- Node.apply(this, arguments);
- }
- if ( Node ) Literal.__proto__ = Node;
- Literal.prototype = Object.create( Node && Node.prototype );
- Literal.prototype.constructor = Literal;
- Literal.prototype.initialise = function initialise () {
- if (typeof this.value === 'string') {
- this.program.indentExclusionElements.push(this);
- }
- };
- Literal.prototype.transpile = function transpile (code, transforms) {
- if (transforms.numericLiteral) {
- var leading = this.raw.slice(0, 2);
- if (leading === '0b' || leading === '0o') {
- code.overwrite(this.start, this.end, String(this.value), {
- storeName: true,
- contentOnly: true
- });
- }
- }
- if (this.regex) {
- var ref = this.regex;
- var pattern = ref.pattern;
- var flags = ref.flags;
- if (transforms.stickyRegExp && /y/.test(flags))
- { throw new CompileError(
- 'Regular expression sticky flag is not supported',
- this
- ); }
- if (transforms.unicodeRegExp && /u/.test(flags)) {
- code.overwrite(
- this.start,
- this.end,
- ("/" + (rewritePattern_1(pattern, flags)) + "/" + (flags.replace('u', ''))),
- {
- contentOnly: true
- }
- );
- }
- }
- };
- return Literal;
- }(Node$1));
- var MemberExpression = (function (Node) {
- function MemberExpression () {
- Node.apply(this, arguments);
- }
- if ( Node ) MemberExpression.__proto__ = Node;
- MemberExpression.prototype = Object.create( Node && Node.prototype );
- MemberExpression.prototype.constructor = MemberExpression;
- MemberExpression.prototype.transpile = function transpile (code, transforms) {
- if (transforms.reservedProperties && reserved[this.property.name]) {
- code.overwrite(this.object.end, this.property.start, "['");
- code.appendLeft(this.property.end, "']");
- }
- Node.prototype.transpile.call(this, code, transforms);
- };
- return MemberExpression;
- }(Node$1));
- var NewExpression = (function (Node) {
- function NewExpression () {
- Node.apply(this, arguments);
- }
- if ( Node ) NewExpression.__proto__ = Node;
- NewExpression.prototype = Object.create( Node && Node.prototype );
- NewExpression.prototype.constructor = NewExpression;
- NewExpression.prototype.initialise = function initialise (transforms) {
- if (transforms.spreadRest && this.arguments.length) {
- var lexicalBoundary = this.findLexicalBoundary();
- var i = this.arguments.length;
- while (i--) {
- var arg = this.arguments[i];
- if (arg.type === 'SpreadElement' && isArguments(arg.argument)) {
- this.argumentsArrayAlias = lexicalBoundary.getArgumentsArrayAlias();
- break;
- }
- }
- }
- Node.prototype.initialise.call(this, transforms);
- };
- NewExpression.prototype.transpile = function transpile (code, transforms) {
- Node.prototype.transpile.call(this, code, transforms);
- if (transforms.spreadRest && this.arguments.length) {
- var firstArgument = this.arguments[0];
- var isNew = true;
- var hasSpreadElements = spread(
- code,
- this.arguments,
- firstArgument.start,
- this.argumentsArrayAlias,
- isNew
- );
- if (hasSpreadElements) {
- code.prependRight(
- this.start + 'new'.length,
- ' (Function.prototype.bind.apply('
- );
- code.overwrite(
- this.callee.end,
- firstArgument.start,
- ', [ null ].concat( '
- );
- code.appendLeft(this.end, ' ))');
- }
- }
- if (this.arguments.length) {
- removeTrailingComma(code, this.arguments[this.arguments.length - 1].end);
- }
- };
- return NewExpression;
- }(Node$1));
- var ObjectExpression = (function (Node) {
- function ObjectExpression () {
- Node.apply(this, arguments);
- }
- if ( Node ) ObjectExpression.__proto__ = Node;
- ObjectExpression.prototype = Object.create( Node && Node.prototype );
- ObjectExpression.prototype.constructor = ObjectExpression;
- ObjectExpression.prototype.transpile = function transpile (code, transforms) {
- Node.prototype.transpile.call(this, code, transforms);
- var firstPropertyStart = this.start + 1;
- var regularPropertyCount = 0;
- var spreadPropertyCount = 0;
- var computedPropertyCount = 0;
- var firstSpreadProperty = null;
- var firstComputedProperty = null;
- for (var i = 0; i < this.properties.length; ++i) {
- var prop = this.properties[i];
- if (prop.type === 'SpreadElement') {
- spreadPropertyCount += 1;
- if (firstSpreadProperty === null) { firstSpreadProperty = i; }
- } else if (prop.computed) {
- computedPropertyCount += 1;
- if (firstComputedProperty === null) { firstComputedProperty = i; }
- } else if (prop.type === 'Property') {
- regularPropertyCount += 1;
- }
- }
- if (spreadPropertyCount) {
- if (!this.program.options.objectAssign) {
- throw new CompileError(
- "Object spread operator requires specified objectAssign option with 'Object.assign' or polyfill helper.",
- this
- );
- }
-
- var i$1 = this.properties.length;
- if (regularPropertyCount && !computedPropertyCount) {
- while (i$1--) {
- var prop$1 = this.properties[i$1];
- if (prop$1.type === 'Property' && !prop$1.computed) {
- var lastProp = this.properties[i$1 - 1];
- var nextProp = this.properties[i$1 + 1];
- if (
- !lastProp ||
- lastProp.type !== 'Property' ||
- lastProp.computed
- ) {
- code.prependRight(prop$1.start, '{');
- }
- if (
- !nextProp ||
- nextProp.type !== 'Property' ||
- nextProp.computed
- ) {
- code.appendLeft(prop$1.end, '}');
- }
- }
- }
- }
-
- firstPropertyStart = this.properties[0].start;
- if (!computedPropertyCount) {
- code.overwrite(
- this.start,
- firstPropertyStart,
- ((this.program.options.objectAssign) + "({}, ")
- );
- code.overwrite(
- this.properties[this.properties.length - 1].end,
- this.end,
- ')'
- );
- } else if (this.properties[0].type === 'SpreadElement') {
- code.overwrite(
- this.start,
- firstPropertyStart,
- ((this.program.options.objectAssign) + "({}, ")
- );
- code.remove(this.end - 1, this.end);
- code.appendRight(this.end, ')');
- } else {
- code.prependLeft(this.start, ((this.program.options.objectAssign) + "("));
- code.appendRight(this.end, ')');
- }
- }
- if (computedPropertyCount && transforms.computedProperty) {
- var i0 = this.getIndentation();
- var isSimpleAssignment;
- var name;
- if (
- this.parent.type === 'VariableDeclarator' &&
- this.parent.parent.declarations.length === 1 &&
- this.parent.id.type === 'Identifier'
- ) {
- isSimpleAssignment = true;
- name = this.parent.id.alias || this.parent.id.name;
- } else if (
- this.parent.type === 'AssignmentExpression' &&
- this.parent.parent.type === 'ExpressionStatement' &&
- this.parent.left.type === 'Identifier'
- ) {
- isSimpleAssignment = true;
- name = this.parent.left.alias || this.parent.left.name;
- } else if (
- this.parent.type === 'AssignmentPattern' &&
- this.parent.left.type === 'Identifier'
- ) {
- isSimpleAssignment = true;
- name = this.parent.left.alias || this.parent.left.name;
- }
- if (spreadPropertyCount) { isSimpleAssignment = false; }
-
- name = this.findScope(false).resolveName(name);
- var start = firstPropertyStart;
- var end = this.end;
- if (isSimpleAssignment) {
-
- } else {
- if (
- firstSpreadProperty === null ||
- firstComputedProperty < firstSpreadProperty
- ) {
- name = this.findScope(true).createDeclaration('_obj');
- code.prependRight(this.start, ("( " + name + " = "));
- } else { name = null; }
- }
- var len = this.properties.length;
- var lastComputedProp;
- var sawNonComputedProperty = false;
- var isFirst = true;
- for (var i$2 = 0; i$2 < len; i$2 += 1) {
- var prop$2 = this.properties[i$2];
- var moveStart = i$2 > 0 ? this.properties[i$2 - 1].end : start;
- if (
- prop$2.type === 'Property' &&
- (prop$2.computed || (lastComputedProp && !spreadPropertyCount))
- ) {
- if (i$2 === 0) { moveStart = this.start + 1; }
- lastComputedProp = prop$2;
- if (!name) {
- name = this.findScope(true).createDeclaration('_obj');
- var propId = name + (prop$2.computed ? '' : '.');
- code.appendRight(prop$2.start, ("( " + name + " = {}, " + propId));
- } else {
- var propId$1 =
- (isSimpleAssignment ? (";\n" + i0 + name) : (", " + name)) +
- (prop$2.key.type === 'Literal' || prop$2.computed ? '' : '.');
- if (moveStart < prop$2.start) {
- code.overwrite(moveStart, prop$2.start, propId$1);
- } else {
- code.prependRight(prop$2.start, propId$1);
- }
- }
- var c = prop$2.key.end;
- if (prop$2.computed) {
- while (code.original[c] !== ']') { c += 1; }
- c += 1;
- }
- if (prop$2.key.type === 'Literal' && !prop$2.computed) {
- code.overwrite(
- prop$2.start,
- prop$2.key.end + 1,
- '[' + code.slice(prop$2.start, prop$2.key.end) + '] = '
- );
- } else if (prop$2.shorthand || (prop$2.method && !prop$2.computed && transforms.conciseMethodProperty)) {
-
- code.overwrite(
- prop$2.key.start,
- prop$2.key.end,
- code.slice(prop$2.key.start, prop$2.key.end).replace(/:/, ' =')
- );
- } else {
- if (prop$2.value.start > c) { code.remove(c, prop$2.value.start); }
- code.prependLeft(c, ' = ');
- }
-
-
- if (prop$2.method && (prop$2.computed || !transforms.conciseMethodProperty)) {
- if (prop$2.value.generator) { code.remove(prop$2.start, prop$2.key.start); }
- code.prependRight(prop$2.value.start, ("function" + (prop$2.value.generator ? '*' : '') + " "));
- }
- } else if (prop$2.type === 'SpreadElement') {
- if (name && i$2 > 0) {
- if (!lastComputedProp) {
- lastComputedProp = this.properties[i$2 - 1];
- }
- code.appendLeft(lastComputedProp.end, (", " + name + " )"));
- lastComputedProp = null;
- name = null;
- }
- } else {
- if (!isFirst && spreadPropertyCount) {
-
- code.prependRight(prop$2.start, '{');
- code.appendLeft(prop$2.end, '}');
- }
- sawNonComputedProperty = true;
- }
- if (isFirst && (prop$2.type === 'SpreadElement' || prop$2.computed)) {
- var beginEnd = sawNonComputedProperty
- ? this.properties[this.properties.length - 1].end
- : this.end - 1;
-
- if (code.original[beginEnd] == ',') { ++beginEnd; }
- var closing = code.slice(beginEnd, end);
- code.prependLeft(moveStart, closing);
- code.remove(beginEnd, end);
- isFirst = false;
- }
-
- var c$1 = prop$2.end;
- if (i$2 < len - 1 && !sawNonComputedProperty) {
- while (code.original[c$1] !== ',') { c$1 += 1; }
- } else if (i$2 == len - 1) { c$1 = this.end; }
- code.remove(prop$2.end, c$1);
- }
-
- if (computedPropertyCount === len) {
- code.remove(this.properties[len - 1].end, this.end - 1);
- }
- if (!isSimpleAssignment && name) {
- code.appendLeft(lastComputedProp.end, (", " + name + " )"));
- }
- }
- };
- return ObjectExpression;
- }(Node$1));
- var Property = (function (Node) {
- function Property () {
- Node.apply(this, arguments);
- }
- if ( Node ) Property.__proto__ = Node;
- Property.prototype = Object.create( Node && Node.prototype );
- Property.prototype.constructor = Property;
- Property.prototype.transpile = function transpile (code, transforms) {
- Node.prototype.transpile.call(this, code, transforms);
- if (
- transforms.conciseMethodProperty &&
- !this.computed &&
- this.parent.type !== 'ObjectPattern'
- ) {
- if (this.shorthand) {
- code.prependRight(this.start, ((this.key.name) + ": " + (this.shouldPrefix() ? '_vm.' : '')));
- } else if (this.method) {
- var name = '';
- if (this.program.options.namedFunctionExpressions !== false) {
- if (
- this.key.type === 'Literal' &&
- typeof this.key.value === 'number'
- ) {
- name = '';
- } else if (this.key.type === 'Identifier') {
- if (
- reserved[this.key.name] ||
- !/^[a-z_$][a-z0-9_$]*$/i.test(this.key.name) ||
- this.value.body.scope.references[this.key.name]
- ) {
- name = this.findScope(true).createIdentifier(this.key.name);
- } else {
- name = this.key.name;
- }
- } else {
- name = this.findScope(true).createIdentifier(this.key.value);
- }
- name = ' ' + name;
- }
- if (this.value.generator) { code.remove(this.start, this.key.start); }
- code.appendLeft(
- this.key.end,
- (": function" + (this.value.generator ? '*' : '') + name)
- );
- }
- }
- if (transforms.reservedProperties && reserved[this.key.name]) {
- code.prependRight(this.key.start, "'");
- code.appendLeft(this.key.end, "'");
- }
- };
- Property.prototype.shouldPrefix = function shouldPrefix () {
- if (
- this.program.inWith > 0 &&
- !hash[this.key.name] &&
- !this.findScope(false).contains(this.key.name)
- ) {
- return true
- }
- return false
- };
- return Property;
- }(Node$1));
- var ReturnStatement = (function (Node) {
- function ReturnStatement () {
- Node.apply(this, arguments);
- }
- if ( Node ) ReturnStatement.__proto__ = Node;
- ReturnStatement.prototype = Object.create( Node && Node.prototype );
- ReturnStatement.prototype.constructor = ReturnStatement;
- ReturnStatement.prototype.initialise = function initialise (transforms) {
- this.loop = this.findNearest(loopStatement);
- this.nearestFunction = this.findNearest(/Function/);
- if (
- this.loop &&
- (!this.nearestFunction || this.loop.depth > this.nearestFunction.depth)
- ) {
- this.loop.canReturn = true;
- this.shouldWrap = true;
- }
- if (this.argument) { this.argument.initialise(transforms); }
- };
- ReturnStatement.prototype.transpile = function transpile (code, transforms) {
- var shouldWrap =
- this.shouldWrap && this.loop && this.loop.shouldRewriteAsFunction;
- if (this.argument) {
- if (shouldWrap) { code.prependRight(this.argument.start, "{ v: "); }
- this.argument.transpile(code, transforms);
- if (shouldWrap) { code.appendLeft(this.argument.end, " }"); }
- } else if (shouldWrap) {
- code.appendLeft(this.start + 6, ' {}');
- }
- };
- return ReturnStatement;
- }(Node$1));
- var SpreadElement = (function (Node) {
- function SpreadElement () {
- Node.apply(this, arguments);
- }
- if ( Node ) SpreadElement.__proto__ = Node;
- SpreadElement.prototype = Object.create( Node && Node.prototype );
- SpreadElement.prototype.constructor = SpreadElement;
- SpreadElement.prototype.transpile = function transpile (code, transforms) {
- if (this.parent.type == 'ObjectExpression') {
- code.remove(this.start, this.argument.start);
- code.remove(this.argument.end, this.end);
- }
- Node.prototype.transpile.call(this, code, transforms);
- };
- return SpreadElement;
- }(Node$1));
- var Super = (function (Node) {
- function Super () {
- Node.apply(this, arguments);
- }
- if ( Node ) Super.__proto__ = Node;
- Super.prototype = Object.create( Node && Node.prototype );
- Super.prototype.constructor = Super;
- Super.prototype.initialise = function initialise (transforms) {
- if (transforms.classes) {
- this.method = this.findNearest('MethodDefinition');
- if (!this.method)
- { throw new CompileError('use of super outside class method', this); }
- var parentClass = this.findNearest('ClassBody').parent;
- this.superClassName =
- parentClass.superClass && (parentClass.superClass.name || 'superclass');
- if (!this.superClassName)
- { throw new CompileError('super used in base class', this); }
- this.isCalled =
- this.parent.type === 'CallExpression' && this === this.parent.callee;
- if (this.method.kind !== 'constructor' && this.isCalled) {
- throw new CompileError(
- 'super() not allowed outside class constructor',
- this
- );
- }
- this.isMember = this.parent.type === 'MemberExpression';
- if (!this.isCalled && !this.isMember) {
- throw new CompileError(
- 'Unexpected use of `super` (expected `super(...)` or `super.*`)',
- this
- );
- }
- }
- if (transforms.arrow) {
- var lexicalBoundary = this.findLexicalBoundary();
- var arrowFunction = this.findNearest('ArrowFunctionExpression');
- var loop = this.findNearest(loopStatement);
- if (arrowFunction && arrowFunction.depth > lexicalBoundary.depth) {
- this.thisAlias = lexicalBoundary.getThisAlias();
- }
- if (
- loop &&
- loop.body.contains(this) &&
- loop.depth > lexicalBoundary.depth
- ) {
- this.thisAlias = lexicalBoundary.getThisAlias();
- }
- }
- };
- Super.prototype.transpile = function transpile (code, transforms) {
- if (transforms.classes) {
- var expression =
- this.isCalled || this.method.static
- ? this.superClassName
- : ((this.superClassName) + ".prototype");
- code.overwrite(this.start, this.end, expression, {
- storeName: true,
- contentOnly: true
- });
- var callExpression = this.isCalled ? this.parent : this.parent.parent;
- if (callExpression && callExpression.type === 'CallExpression') {
- if (!this.noCall) {
-
- code.appendLeft(callExpression.callee.end, '.call');
- }
- var thisAlias = this.thisAlias || 'this';
- if (callExpression.arguments.length) {
- code.appendLeft(callExpression.arguments[0].start, (thisAlias + ", "));
- } else {
- code.appendLeft(callExpression.end - 1, ("" + thisAlias));
- }
- }
- }
- };
- return Super;
- }(Node$1));
- var TaggedTemplateExpression = (function (Node) {
- function TaggedTemplateExpression () {
- Node.apply(this, arguments);
- }
- if ( Node ) TaggedTemplateExpression.__proto__ = Node;
- TaggedTemplateExpression.prototype = Object.create( Node && Node.prototype );
- TaggedTemplateExpression.prototype.constructor = TaggedTemplateExpression;
- TaggedTemplateExpression.prototype.initialise = function initialise (transforms) {
- if (
- transforms.templateString &&
- !transforms.dangerousTaggedTemplateString
- ) {
- throw new CompileError(
- "Tagged template strings are not supported. Use `transforms: { templateString: false }` to skip transformation and disable this error, or `transforms: { dangerousTaggedTemplateString: true }` if you know what you're doing",
- this
- );
- }
- Node.prototype.initialise.call(this, transforms);
- };
- TaggedTemplateExpression.prototype.transpile = function transpile (code, transforms) {
- if (transforms.templateString && transforms.dangerousTaggedTemplateString) {
- var ordered = this.quasi.expressions
- .concat(this.quasi.quasis)
- .sort(function (a, b) { return a.start - b.start; });
- var program = this.program;
- var rootScope = program.body.scope;
-
- var templateStrings = this.quasi.quasis.map(function (quasi) { return JSON.stringify(quasi.value.cooked); }
- ).join(', ');
- var templateObject = this.program.templateLiteralQuasis[templateStrings];
- if (!templateObject) {
- templateObject = rootScope.createIdentifier('templateObject');
- code.prependRight(this.program.prependAt, ("var " + templateObject + " = Object.freeze([" + templateStrings + "]);\n"));
- this.program.templateLiteralQuasis[templateStrings] = templateObject;
- }
- code.overwrite(
- this.tag.end,
- ordered[0].start,
- ("(" + templateObject)
- );
- var lastIndex = ordered[0].start;
- ordered.forEach(function (node) {
- if (node.type === 'TemplateElement') {
- code.remove(lastIndex, node.end);
- } else {
- code.overwrite(lastIndex, node.start, ', ');
- }
- lastIndex = node.end;
- });
- code.overwrite(lastIndex, this.end, ')');
- }
- Node.prototype.transpile.call(this, code, transforms);
- };
- return TaggedTemplateExpression;
- }(Node$1));
- var TemplateElement = (function (Node) {
- function TemplateElement () {
- Node.apply(this, arguments);
- }
- if ( Node ) TemplateElement.__proto__ = Node;
- TemplateElement.prototype = Object.create( Node && Node.prototype );
- TemplateElement.prototype.constructor = TemplateElement;
- TemplateElement.prototype.initialise = function initialise () {
- this.program.indentExclusionElements.push(this);
- };
- return TemplateElement;
- }(Node$1));
- var TemplateLiteral = (function (Node) {
- function TemplateLiteral () {
- Node.apply(this, arguments);
- }
- if ( Node ) TemplateLiteral.__proto__ = Node;
- TemplateLiteral.prototype = Object.create( Node && Node.prototype );
- TemplateLiteral.prototype.constructor = TemplateLiteral;
- TemplateLiteral.prototype.transpile = function transpile (code, transforms) {
- Node.prototype.transpile.call(this, code, transforms);
- if (
- transforms.templateString &&
- this.parent.type !== 'TaggedTemplateExpression'
- ) {
- var ordered = this.expressions
- .concat(this.quasis)
- .sort(function (a, b) { return a.start - b.start || a.end - b.end; })
- .filter(function (node, i) {
-
- if (node.type !== 'TemplateElement') { return true; }
-
- if (node.value.raw) { return true; }
-
- return !i;
- });
-
-
-
-
- if (ordered.length >= 3) {
- var first = ordered[0];
- var third = ordered[2];
- if (
- first.type === 'TemplateElement' &&
- first.value.raw === '' &&
- third.type === 'TemplateElement'
- ) {
- ordered.shift();
- }
- }
- var parenthesise =
- (this.quasis.length !== 1 || this.expressions.length !== 0) &&
- this.parent.type !== 'TemplateLiteral' &&
- this.parent.type !== 'AssignmentExpression' &&
- this.parent.type !== 'AssignmentPattern' &&
- this.parent.type !== 'VariableDeclarator' &&
- (this.parent.type !== 'BinaryExpression' ||
- this.parent.operator !== '+');
- if (parenthesise) { code.appendRight(this.start, '('); }
- var lastIndex = this.start;
- ordered.forEach(function (node, i) {
- var prefix = i === 0 ? (parenthesise ? '(' : '') : ' + ';
- if (node.type === 'TemplateElement') {
- code.overwrite(
- lastIndex,
- node.end,
- prefix + JSON.stringify(node.value.cooked)
- );
- } else {
- var parenthesise$1 = node.type !== 'Identifier';
- if (parenthesise$1) { prefix += '('; }
- code.remove(lastIndex, node.start);
- if (prefix) { code.prependRight(node.start, prefix); }
- if (parenthesise$1) { code.appendLeft(node.end, ')'); }
- }
- lastIndex = node.end;
- });
- if (parenthesise) { code.appendLeft(lastIndex, ')'); }
- code.overwrite(lastIndex, this.end, "", { contentOnly: true } );
- }
- };
- return TemplateLiteral;
- }(Node$1));
- var ThisExpression = (function (Node) {
- function ThisExpression () {
- Node.apply(this, arguments);
- }
- if ( Node ) ThisExpression.__proto__ = Node;
- ThisExpression.prototype = Object.create( Node && Node.prototype );
- ThisExpression.prototype.constructor = ThisExpression;
- ThisExpression.prototype.initialise = function initialise (transforms) {
- if (transforms.arrow) {
- var lexicalBoundary = this.findLexicalBoundary();
- var arrowFunction = this.findNearest('ArrowFunctionExpression');
- var loop = this.findNearest(loopStatement);
- if (
- (arrowFunction && arrowFunction.depth > lexicalBoundary.depth) ||
- (loop &&
- loop.body.contains(this) &&
- loop.depth > lexicalBoundary.depth) ||
- (loop && loop.right && loop.right.contains(this))
- ) {
- this.alias = lexicalBoundary.getThisAlias();
- }
- }
- };
- ThisExpression.prototype.transpile = function transpile (code) {
- if (this.alias) {
- code.overwrite(this.start, this.end, this.alias, {
- storeName: true,
- contentOnly: true
- });
- }
- };
- return ThisExpression;
- }(Node$1));
- var UpdateExpression = (function (Node) {
- function UpdateExpression () {
- Node.apply(this, arguments);
- }
- if ( Node ) UpdateExpression.__proto__ = Node;
- UpdateExpression.prototype = Object.create( Node && Node.prototype );
- UpdateExpression.prototype.constructor = UpdateExpression;
- UpdateExpression.prototype.initialise = function initialise (transforms) {
- if (this.argument.type === 'Identifier') {
- var declaration = this.findScope(false).findDeclaration(
- this.argument.name
- );
-
- var statement = declaration && declaration.node.ancestor(3);
- if (
- statement &&
- statement.type === 'ForStatement' &&
- statement.body.contains(this)
- ) {
- statement.reassigned[this.argument.name] = true;
- }
- }
- Node.prototype.initialise.call(this, transforms);
- };
- UpdateExpression.prototype.transpile = function transpile (code, transforms) {
- if (this.argument.type === 'Identifier') {
-
-
- checkConst(this.argument, this.findScope(false));
- }
- Node.prototype.transpile.call(this, code, transforms);
- };
- return UpdateExpression;
- }(Node$1));
- var VariableDeclaration = (function (Node) {
- function VariableDeclaration () {
- Node.apply(this, arguments);
- }
- if ( Node ) VariableDeclaration.__proto__ = Node;
- VariableDeclaration.prototype = Object.create( Node && Node.prototype );
- VariableDeclaration.prototype.constructor = VariableDeclaration;
- VariableDeclaration.prototype.initialise = function initialise (transforms) {
- this.scope = this.findScope(this.kind === 'var');
- this.declarations.forEach(function (declarator) { return declarator.initialise(transforms); });
- };
- VariableDeclaration.prototype.transpile = function transpile (code, transforms) {
- var this$1 = this;
- var i0 = this.getIndentation();
- var kind = this.kind;
- if (transforms.letConst && kind !== 'var') {
- kind = 'var';
- code.overwrite(this.start, this.start + this.kind.length, kind, {
- storeName: true
- });
- }
- if (transforms.destructuring && this.parent.type !== 'ForOfStatement' && this.parent.type !== 'ForInStatement') {
- var c = this.start;
- var lastDeclaratorIsPattern;
- this.declarations.forEach(function (declarator, i) {
- declarator.transpile(code, transforms);
- if (declarator.id.type === 'Identifier') {
- if (i > 0 && this$1.declarations[i - 1].id.type !== 'Identifier') {
- code.overwrite(c, declarator.id.start, "var ");
- }
- } else {
- var inline = loopStatement.test(this$1.parent.type);
- if (i === 0) {
- code.remove(c, declarator.id.start);
- } else {
- code.overwrite(c, declarator.id.start, (";\n" + i0));
- }
- var simple =
- declarator.init.type === 'Identifier' && !declarator.init.rewritten;
- var name = simple
- ? (declarator.init.alias || declarator.init.name)
- : declarator.findScope(true).createIdentifier('ref');
- c = declarator.start;
- var statementGenerators = [];
- if (simple) {
- code.remove(declarator.id.end, declarator.end);
- } else {
- statementGenerators.push(function (start, prefix, suffix) {
- code.prependRight(declarator.id.end, ("var " + name));
- code.appendLeft(declarator.init.end, ("" + suffix));
- code.move(declarator.id.end, declarator.end, start);
- });
- }
- var scope = declarator.findScope(false);
- destructure(
- code,
- function (id) { return scope.createIdentifier(id); },
- function (ref) {
- var name = ref.name;
- return scope.resolveName(name);
- },
- declarator.id,
- name,
- inline,
- statementGenerators
- );
- var prefix = inline ? 'var ' : '';
- var suffix = inline ? ", " : (";\n" + i0);
- statementGenerators.forEach(function (fn, j) {
- if (
- i === this$1.declarations.length - 1 &&
- j === statementGenerators.length - 1
- ) {
- suffix = inline ? '' : ';';
- }
- fn(declarator.start, j === 0 ? prefix : '', suffix);
- });
- }
- c = declarator.end;
- lastDeclaratorIsPattern = declarator.id.type !== 'Identifier';
- });
- if (lastDeclaratorIsPattern && this.end > c) {
- code.overwrite(c, this.end, '', { contentOnly: true });
- }
- } else {
- this.declarations.forEach(function (declarator) {
- declarator.transpile(code, transforms);
- });
- }
- };
- return VariableDeclaration;
- }(Node$1));
- var VariableDeclarator = (function (Node) {
- function VariableDeclarator () {
- Node.apply(this, arguments);
- }
- if ( Node ) VariableDeclarator.__proto__ = Node;
- VariableDeclarator.prototype = Object.create( Node && Node.prototype );
- VariableDeclarator.prototype.constructor = VariableDeclarator;
- VariableDeclarator.prototype.initialise = function initialise (transforms) {
- var kind = this.parent.kind;
- if (kind === 'let' && this.parent.parent.type === 'ForStatement') {
- kind = 'for.let';
- }
- this.parent.scope.addDeclaration(this.id, kind);
- Node.prototype.initialise.call(this, transforms);
- };
- VariableDeclarator.prototype.transpile = function transpile (code, transforms) {
- if (!this.init && transforms.letConst && this.parent.kind !== 'var') {
- var inLoop = this.findNearest(
- /Function|^For(In|Of)?Statement|^(?:Do)?WhileStatement/
- );
- if (
- inLoop &&
- !/Function/.test(inLoop.type) &&
- !this.isLeftDeclaratorOfLoop()
- ) {
- code.appendLeft(this.id.end, ' = (void 0)');
- }
- }
- if (this.id) { this.id.transpile(code, transforms); }
- if (this.init) { this.init.transpile(code, transforms); }
- };
- VariableDeclarator.prototype.isLeftDeclaratorOfLoop = function isLeftDeclaratorOfLoop () {
- return (
- this.parent &&
- this.parent.type === 'VariableDeclaration' &&
- this.parent.parent &&
- (this.parent.parent.type === 'ForInStatement' ||
- this.parent.parent.type === 'ForOfStatement') &&
- this.parent.parent.left &&
- this.parent.parent.left.declarations[0] === this
- );
- };
- return VariableDeclarator;
- }(Node$1));
- var WithStatement = (function (Node) {
- function WithStatement () {
- Node.apply(this, arguments);
- }
- if ( Node ) WithStatement.__proto__ = Node;
- WithStatement.prototype = Object.create( Node && Node.prototype );
- WithStatement.prototype.constructor = WithStatement;
- WithStatement.prototype.transpile = function transpile (code, transforms) {
- if (transforms.stripWith) {
- this.program.inWith = (this.program.inWith || 0) + 1;
-
- code.remove(this.start, this.body.start + 1);
- code.remove(this.end - 1, this.end);
- if (transforms.stripWithFunctional) {
- code.prependRight(this.start, "var _c=_vm._c;");
- } else {
- code.prependRight(this.start, "var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;");
- }
- Node.prototype.transpile.call(this, code, transforms);
- this.program.inWith--;
- } else {
- Node.prototype.transpile.call(this, code, transforms);
- }
- };
- return WithStatement;
- }(Node$1));
- var types$2 = {
- ArrayExpression: ArrayExpression,
- ArrowFunctionExpression: ArrowFunctionExpression,
- AssignmentExpression: AssignmentExpression,
- BinaryExpression: BinaryExpression,
- BreakStatement: BreakStatement,
- CallExpression: CallExpression,
- ClassBody: ClassBody,
- ClassDeclaration: ClassDeclaration,
- ClassExpression: ClassExpression,
- ContinueStatement: ContinueStatement,
- DoWhileStatement: LoopStatement,
- ExportNamedDeclaration: ExportNamedDeclaration,
- ExportDefaultDeclaration: ExportDefaultDeclaration,
- ForStatement: ForStatement,
- ForInStatement: ForInStatement,
- ForOfStatement: ForOfStatement,
- FunctionDeclaration: FunctionDeclaration,
- FunctionExpression: FunctionExpression,
- Identifier: Identifier,
- IfStatement: IfStatement,
- ImportDeclaration: ImportDeclaration,
- ImportDefaultSpecifier: ImportDefaultSpecifier,
- ImportSpecifier: ImportSpecifier,
- JSXAttribute: JSXAttribute,
- JSXClosingElement: JSXClosingElement,
- JSXClosingFragment: JSXClosingFragment,
- JSXElement: JSXElement,
- JSXExpressionContainer: JSXExpressionContainer,
- JSXFragment: JSXFragment,
- JSXOpeningElement: JSXOpeningElement,
- JSXOpeningFragment: JSXOpeningFragment,
- JSXSpreadAttribute: JSXSpreadAttribute,
- Literal: Literal,
- MemberExpression: MemberExpression,
- NewExpression: NewExpression,
- ObjectExpression: ObjectExpression,
- Property: Property,
- ReturnStatement: ReturnStatement,
- SpreadElement: SpreadElement,
- Super: Super,
- TaggedTemplateExpression: TaggedTemplateExpression,
- TemplateElement: TemplateElement,
- TemplateLiteral: TemplateLiteral,
- ThisExpression: ThisExpression,
- UpdateExpression: UpdateExpression,
- VariableDeclaration: VariableDeclaration,
- VariableDeclarator: VariableDeclarator,
- WhileStatement: LoopStatement,
- WithStatement: WithStatement
- };
- var keys = {
- Program: ['body'],
- Literal: []
- };
- var statementsWithBlocks = {
- IfStatement: 'consequent',
- ForStatement: 'body',
- ForInStatement: 'body',
- ForOfStatement: 'body',
- WhileStatement: 'body',
- DoWhileStatement: 'body',
- ArrowFunctionExpression: 'body'
- };
- function wrap(raw, parent) {
- if (!raw) { return; }
- if ('length' in raw) {
- var i = raw.length;
- while (i--) { wrap(raw[i], parent); }
- return;
- }
-
-
- if (raw.__wrapped) { return; }
- raw.__wrapped = true;
- if (!keys[raw.type]) {
- keys[raw.type] = Object.keys(raw).filter(
- function (key) { return typeof raw[key] === 'object'; }
- );
- }
-
- var bodyType = statementsWithBlocks[raw.type];
- if (bodyType && raw[bodyType].type !== 'BlockStatement') {
- var expression = raw[bodyType];
-
-
- raw[bodyType] = {
- start: expression.start,
- end: expression.end,
- type: 'BlockStatement',
- body: [expression],
- synthetic: true
- };
- }
- raw.parent = parent;
- raw.program = parent.program || parent;
- raw.depth = parent.depth + 1;
- raw.keys = keys[raw.type];
- raw.indentation = undefined;
- for (var i$1 = 0, list = keys[raw.type]; i$1 < list.length; i$1 += 1) {
- var key = list[i$1];
- wrap(raw[key], raw);
- }
- raw.program.magicString.addSourcemapLocation(raw.start);
- raw.program.magicString.addSourcemapLocation(raw.end);
- var type =
- (raw.type === 'BlockStatement' ? BlockStatement : types$2[raw.type]) || Node$1;
- raw.__proto__ = type.prototype;
- }
- function Program(source, ast, transforms, options) {
- this.type = 'Root';
-
- this.jsx = options.jsx || 'React.createElement';
- this.options = options;
- this.source = source;
- this.magicString = new MagicString$1(source);
- this.ast = ast;
- this.depth = 0;
- wrap((this.body = ast), this);
- this.body.__proto__ = BlockStatement.prototype;
- this.templateLiteralQuasis = Object.create(null);
- for (var i = 0; i < this.body.body.length; ++i) {
- if (!this.body.body[i].directive) {
- this.prependAt = this.body.body[i].start;
- break;
- }
- }
- this.objectWithoutPropertiesHelper = null;
- this.indentExclusionElements = [];
- this.body.initialise(transforms);
- this.indentExclusions = Object.create(null);
- for (var i$2 = 0, list = this.indentExclusionElements; i$2 < list.length; i$2 += 1) {
- var node = list[i$2];
- for (var i$1 = node.start; i$1 < node.end; i$1 += 1) {
- this.indentExclusions[i$1] = true;
- }
- }
- this.body.transpile(this.magicString, transforms);
- }
- Program.prototype = {
- export: function export$1(options) {
- if ( options === void 0 ) options = {};
- return {
- code: this.magicString.toString(),
- map: this.magicString.generateMap({
- file: options.file,
- source: options.source,
- includeContent: options.includeContent !== false
- })
- };
- },
- findNearest: function findNearest() {
- return null;
- },
- findScope: function findScope() {
- return null;
- },
- getObjectWithoutPropertiesHelper: function getObjectWithoutPropertiesHelper(code) {
- if (!this.objectWithoutPropertiesHelper) {
- this.objectWithoutPropertiesHelper = this.body.scope.createIdentifier('objectWithoutProperties');
- code.prependLeft(this.prependAt, "function " + (this.objectWithoutPropertiesHelper) + " (obj, exclude) { " +
- "var target = {}; for (var k in obj) " +
- "if (Object.prototype.hasOwnProperty.call(obj, k) && exclude.indexOf(k) === -1) " +
- "target[k] = obj[k]; return target; }\n"
- );
- }
- return this.objectWithoutPropertiesHelper;
- }
- };
- var matrix = {
- chrome: {
- 48: 305357,
- 49: 326143,
- 50: 391679,
- 51: 391679,
- 52: 522751,
- 53: 522751,
- 54: 522751,
- 55: 522751,
- 56: 522751,
- 57: 522751,
- 58: 1047039,
- 59: 1047039,
- 60: 1047039,
- 61: 1047039,
- 62: 1047039,
- 63: 1047039
- },
- firefox: {
- 43: 325853,
- 44: 326109,
- 45: 326111,
- 46: 391647,
- 47: 391679,
- 48: 391679,
- 49: 387583,
- 50: 387583,
- 51: 387583,
- 52: 1047039,
- 53: 1047039,
- 54: 1047039,
- 55: 1047039,
- 56: 1047039,
- 57: 1047039,
- 58: 1047039
- },
- safari: {
- 8: 262148,
- 9: 301166,
- 10: 915967,
- '10.1': 1047039,
- 11: 1047039
- },
- ie: {
- 8: 0,
- 9: 262144,
- 10: 262144,
- 11: 262400
- },
- edge: {
- 12: 305485,
- 13: 387535,
- 14: 1042943,
- 15: 1042943,
- 16: 1042943
- },
- node: {
- '0.10': 262144,
- '0.12': 262208,
- 4: 297167,
- 5: 297167,
- 6: 391679,
- 8: 1047039,
- '8.3': 1047039,
- '8.7': 1047039
- }
- };
- var features = [
- 'arrow',
- 'classes',
- 'computedProperty',
- 'conciseMethodProperty',
- 'defaultParameter',
- 'destructuring',
- 'forOf',
- 'generator',
- 'letConst',
- 'moduleExport',
- 'moduleImport',
- 'numericLiteral',
- 'parameterDestructuring',
- 'spreadRest',
- 'stickyRegExp',
- 'templateString',
- 'unicodeRegExp',
-
- 'exponentiation',
-
-
- 'reservedProperties',
- 'trailingFunctionCommas'
- ];
- var version$1 = "0.19.3";
- var ref$1 = [inject, acornDynamicImport].reduce(
- function (final, plugin) { return plugin(final); },
- acorn
- );
- var parse$1 = ref$1.parse;
- var dangerousTransforms = ['dangerousTaggedTemplateString', 'dangerousForOf'];
- function target(target) {
- var targets = Object.keys(target);
- var bitmask = targets.length
- ? 1048575
- : 262144;
- Object.keys(target).forEach(function (environment) {
- var versions = matrix[environment];
- if (!versions)
- { throw new Error(
- ("Unknown environment '" + environment + "'. Please raise an issue at https://github.com/Rich-Harris/buble/issues")
- ); }
- var targetVersion = target[environment];
- if (!(targetVersion in versions))
- { throw new Error(
- ("Support data exists for the following versions of " + environment + ": " + (Object.keys(
- versions
- ).join(
- ', '
- )) + ". Please raise an issue at https://github.com/Rich-Harris/buble/issues")
- ); }
- var support = versions[targetVersion];
- bitmask &= support;
- });
- var transforms = Object.create(null);
- features.forEach(function (name, i) {
- transforms[name] = !(bitmask & (1 << i));
- });
- dangerousTransforms.forEach(function (name) {
- transforms[name] = false;
- });
- transforms.stripWith = false;
- transforms.stripWithFunctional = false;
- return transforms;
- }
- function transform ( source, options ) {
- if ( options === void 0 ) options = {};
- var transforms = target( options.target || {} );
- Object.keys( options.transforms || {} ).forEach( function (name) {
- if ( name === 'modules' ) {
- if ( !( 'moduleImport' in options.transforms ) ) { transforms.moduleImport = options.transforms.modules; }
- if ( !( 'moduleExport' in options.transforms ) ) { transforms.moduleExport = options.transforms.modules; }
- return;
- }
- if ( !( name in transforms ) ) { throw new Error( ("Unknown transform '" + name + "'") ); }
- transforms[ name ] = options.transforms[ name ];
- });
- if (transforms.stripWith) {
-
-
- transforms.conciseMethodProperty = true;
- }
- var ast;
- var jsx = null;
- try {
- ast = parse$1(source, {
- ecmaVersion: 9,
- preserveParens: true,
- sourceType: transforms.stripWith ? 'script' : 'module',
- onComment: function (block, text) {
- if (!jsx) {
- var match = /@jsx\s+([^\s]+)/.exec(text);
- if (match) { jsx = match[1]; }
- }
- },
- plugins: {
- jsx: true,
- dynamicImport: true
- }
- });
- options.jsx = jsx || options.jsx;
- } catch (err) {
- err.snippet = getSnippet(source, err.loc);
- err.toString = function () { return ((err.name) + ": " + (err.message) + "\n" + (err.snippet)); };
- throw err;
- }
- return new Program( source, ast, transforms, options ).export( options );
- }
- exports.target = target;
- exports.transform = transform;
- exports.VERSION = version$1;
- Object.defineProperty(exports, '__esModule', { value: true });
- })));
|