index.js 221 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079
  1. /*! @author Toru Nagashima <https://github.com/mysticatea> */
  2. 'use strict';
  3. Object.defineProperty(exports, '__esModule', { value: true });
  4. var ast = /*#__PURE__*/Object.freeze({
  5. });
  6. function isIdStart(cp) {
  7. if (cp < 0x41)
  8. return false;
  9. if (cp < 0x5b)
  10. return true;
  11. if (cp < 0x61)
  12. return false;
  13. if (cp < 0x7b)
  14. return true;
  15. return isLargeIdStart(cp);
  16. }
  17. function isIdContinue(cp) {
  18. if (cp < 0x30)
  19. return false;
  20. if (cp < 0x3a)
  21. return true;
  22. if (cp < 0x41)
  23. return false;
  24. if (cp < 0x5b)
  25. return true;
  26. if (cp === 0x5f)
  27. return true;
  28. if (cp < 0x61)
  29. return false;
  30. if (cp < 0x7b)
  31. return true;
  32. return isLargeIdStart(cp) || isLargeIdContinue(cp);
  33. }
  34. function isLargeIdStart(cp) {
  35. if (cp < 0x30a1) {
  36. if (cp < 0xec0) {
  37. if (cp < 0xa35) {
  38. if (cp < 0x6e5) {
  39. if (cp < 0x37a) {
  40. if (cp < 0x294) {
  41. if (cp < 0xf8) {
  42. if (cp === 0xaa)
  43. return true;
  44. if (cp === 0xb5)
  45. return true;
  46. if (cp === 0xba)
  47. return true;
  48. if (cp < 0xc0)
  49. return false;
  50. if (cp < 0xd7)
  51. return true;
  52. if (cp < 0xd8)
  53. return false;
  54. if (cp < 0xf7)
  55. return true;
  56. return false;
  57. }
  58. if (cp < 0x1bb)
  59. return true;
  60. if (cp === 0x1bb)
  61. return true;
  62. if (cp < 0x1bc)
  63. return false;
  64. if (cp < 0x1c0)
  65. return true;
  66. if (cp < 0x1c0)
  67. return false;
  68. if (cp < 0x1c4)
  69. return true;
  70. if (cp < 0x1c4)
  71. return false;
  72. if (cp < 0x294)
  73. return true;
  74. return false;
  75. }
  76. if (cp < 0x2ec) {
  77. if (cp === 0x294)
  78. return true;
  79. if (cp < 0x295)
  80. return false;
  81. if (cp < 0x2b0)
  82. return true;
  83. if (cp < 0x2b0)
  84. return false;
  85. if (cp < 0x2c2)
  86. return true;
  87. if (cp < 0x2c6)
  88. return false;
  89. if (cp < 0x2d2)
  90. return true;
  91. if (cp < 0x2e0)
  92. return false;
  93. if (cp < 0x2e5)
  94. return true;
  95. return false;
  96. }
  97. if (cp === 0x2ec)
  98. return true;
  99. if (cp === 0x2ee)
  100. return true;
  101. if (cp < 0x370)
  102. return false;
  103. if (cp < 0x374)
  104. return true;
  105. if (cp === 0x374)
  106. return true;
  107. if (cp < 0x376)
  108. return false;
  109. if (cp < 0x378)
  110. return true;
  111. return false;
  112. }
  113. if (cp < 0x531) {
  114. if (cp < 0x38c) {
  115. if (cp === 0x37a)
  116. return true;
  117. if (cp < 0x37b)
  118. return false;
  119. if (cp < 0x37e)
  120. return true;
  121. if (cp === 0x37f)
  122. return true;
  123. if (cp === 0x386)
  124. return true;
  125. if (cp < 0x388)
  126. return false;
  127. if (cp < 0x38b)
  128. return true;
  129. return false;
  130. }
  131. if (cp === 0x38c)
  132. return true;
  133. if (cp < 0x38e)
  134. return false;
  135. if (cp < 0x3a2)
  136. return true;
  137. if (cp < 0x3a3)
  138. return false;
  139. if (cp < 0x3f6)
  140. return true;
  141. if (cp < 0x3f7)
  142. return false;
  143. if (cp < 0x482)
  144. return true;
  145. if (cp < 0x48a)
  146. return false;
  147. if (cp < 0x530)
  148. return true;
  149. return false;
  150. }
  151. if (cp < 0x620) {
  152. if (cp < 0x531)
  153. return false;
  154. if (cp < 0x557)
  155. return true;
  156. if (cp === 0x559)
  157. return true;
  158. if (cp < 0x560)
  159. return false;
  160. if (cp < 0x589)
  161. return true;
  162. if (cp < 0x5d0)
  163. return false;
  164. if (cp < 0x5eb)
  165. return true;
  166. if (cp < 0x5ef)
  167. return false;
  168. if (cp < 0x5f3)
  169. return true;
  170. return false;
  171. }
  172. if (cp < 0x640)
  173. return true;
  174. if (cp === 0x640)
  175. return true;
  176. if (cp < 0x641)
  177. return false;
  178. if (cp < 0x64b)
  179. return true;
  180. if (cp < 0x66e)
  181. return false;
  182. if (cp < 0x670)
  183. return true;
  184. if (cp < 0x671)
  185. return false;
  186. if (cp < 0x6d4)
  187. return true;
  188. if (cp === 0x6d5)
  189. return true;
  190. return false;
  191. }
  192. if (cp < 0x950) {
  193. if (cp < 0x7fa) {
  194. if (cp < 0x712) {
  195. if (cp < 0x6e5)
  196. return false;
  197. if (cp < 0x6e7)
  198. return true;
  199. if (cp < 0x6ee)
  200. return false;
  201. if (cp < 0x6f0)
  202. return true;
  203. if (cp < 0x6fa)
  204. return false;
  205. if (cp < 0x6fd)
  206. return true;
  207. if (cp === 0x6ff)
  208. return true;
  209. if (cp === 0x710)
  210. return true;
  211. return false;
  212. }
  213. if (cp < 0x730)
  214. return true;
  215. if (cp < 0x74d)
  216. return false;
  217. if (cp < 0x7a6)
  218. return true;
  219. if (cp === 0x7b1)
  220. return true;
  221. if (cp < 0x7ca)
  222. return false;
  223. if (cp < 0x7eb)
  224. return true;
  225. if (cp < 0x7f4)
  226. return false;
  227. if (cp < 0x7f6)
  228. return true;
  229. return false;
  230. }
  231. if (cp < 0x840) {
  232. if (cp === 0x7fa)
  233. return true;
  234. if (cp < 0x800)
  235. return false;
  236. if (cp < 0x816)
  237. return true;
  238. if (cp === 0x81a)
  239. return true;
  240. if (cp === 0x824)
  241. return true;
  242. if (cp === 0x828)
  243. return true;
  244. return false;
  245. }
  246. if (cp < 0x859)
  247. return true;
  248. if (cp < 0x860)
  249. return false;
  250. if (cp < 0x86b)
  251. return true;
  252. if (cp < 0x8a0)
  253. return false;
  254. if (cp < 0x8b5)
  255. return true;
  256. if (cp < 0x8b6)
  257. return false;
  258. if (cp < 0x8be)
  259. return true;
  260. if (cp < 0x904)
  261. return false;
  262. if (cp < 0x93a)
  263. return true;
  264. if (cp === 0x93d)
  265. return true;
  266. return false;
  267. }
  268. if (cp < 0x9bd) {
  269. if (cp < 0x98f) {
  270. if (cp === 0x950)
  271. return true;
  272. if (cp < 0x958)
  273. return false;
  274. if (cp < 0x962)
  275. return true;
  276. if (cp === 0x971)
  277. return true;
  278. if (cp < 0x972)
  279. return false;
  280. if (cp < 0x981)
  281. return true;
  282. if (cp < 0x985)
  283. return false;
  284. if (cp < 0x98d)
  285. return true;
  286. return false;
  287. }
  288. if (cp < 0x991)
  289. return true;
  290. if (cp < 0x993)
  291. return false;
  292. if (cp < 0x9a9)
  293. return true;
  294. if (cp < 0x9aa)
  295. return false;
  296. if (cp < 0x9b1)
  297. return true;
  298. if (cp === 0x9b2)
  299. return true;
  300. if (cp < 0x9b6)
  301. return false;
  302. if (cp < 0x9ba)
  303. return true;
  304. return false;
  305. }
  306. if (cp < 0x9fc) {
  307. if (cp === 0x9bd)
  308. return true;
  309. if (cp === 0x9ce)
  310. return true;
  311. if (cp < 0x9dc)
  312. return false;
  313. if (cp < 0x9de)
  314. return true;
  315. if (cp < 0x9df)
  316. return false;
  317. if (cp < 0x9e2)
  318. return true;
  319. if (cp < 0x9f0)
  320. return false;
  321. if (cp < 0x9f2)
  322. return true;
  323. return false;
  324. }
  325. if (cp === 0x9fc)
  326. return true;
  327. if (cp < 0xa05)
  328. return false;
  329. if (cp < 0xa0b)
  330. return true;
  331. if (cp < 0xa0f)
  332. return false;
  333. if (cp < 0xa11)
  334. return true;
  335. if (cp < 0xa13)
  336. return false;
  337. if (cp < 0xa29)
  338. return true;
  339. if (cp < 0xa2a)
  340. return false;
  341. if (cp < 0xa31)
  342. return true;
  343. if (cp < 0xa32)
  344. return false;
  345. if (cp < 0xa34)
  346. return true;
  347. return false;
  348. }
  349. if (cp < 0xc60) {
  350. if (cp < 0xb3d) {
  351. if (cp < 0xab5) {
  352. if (cp < 0xa85) {
  353. if (cp < 0xa35)
  354. return false;
  355. if (cp < 0xa37)
  356. return true;
  357. if (cp < 0xa38)
  358. return false;
  359. if (cp < 0xa3a)
  360. return true;
  361. if (cp < 0xa59)
  362. return false;
  363. if (cp < 0xa5d)
  364. return true;
  365. if (cp === 0xa5e)
  366. return true;
  367. if (cp < 0xa72)
  368. return false;
  369. if (cp < 0xa75)
  370. return true;
  371. return false;
  372. }
  373. if (cp < 0xa8e)
  374. return true;
  375. if (cp < 0xa8f)
  376. return false;
  377. if (cp < 0xa92)
  378. return true;
  379. if (cp < 0xa93)
  380. return false;
  381. if (cp < 0xaa9)
  382. return true;
  383. if (cp < 0xaaa)
  384. return false;
  385. if (cp < 0xab1)
  386. return true;
  387. if (cp < 0xab2)
  388. return false;
  389. if (cp < 0xab4)
  390. return true;
  391. return false;
  392. }
  393. if (cp < 0xb05) {
  394. if (cp < 0xab5)
  395. return false;
  396. if (cp < 0xaba)
  397. return true;
  398. if (cp === 0xabd)
  399. return true;
  400. if (cp === 0xad0)
  401. return true;
  402. if (cp < 0xae0)
  403. return false;
  404. if (cp < 0xae2)
  405. return true;
  406. if (cp === 0xaf9)
  407. return true;
  408. return false;
  409. }
  410. if (cp < 0xb0d)
  411. return true;
  412. if (cp < 0xb0f)
  413. return false;
  414. if (cp < 0xb11)
  415. return true;
  416. if (cp < 0xb13)
  417. return false;
  418. if (cp < 0xb29)
  419. return true;
  420. if (cp < 0xb2a)
  421. return false;
  422. if (cp < 0xb31)
  423. return true;
  424. if (cp < 0xb32)
  425. return false;
  426. if (cp < 0xb34)
  427. return true;
  428. if (cp < 0xb35)
  429. return false;
  430. if (cp < 0xb3a)
  431. return true;
  432. return false;
  433. }
  434. if (cp < 0xb9e) {
  435. if (cp < 0xb85) {
  436. if (cp === 0xb3d)
  437. return true;
  438. if (cp < 0xb5c)
  439. return false;
  440. if (cp < 0xb5e)
  441. return true;
  442. if (cp < 0xb5f)
  443. return false;
  444. if (cp < 0xb62)
  445. return true;
  446. if (cp === 0xb71)
  447. return true;
  448. if (cp === 0xb83)
  449. return true;
  450. return false;
  451. }
  452. if (cp < 0xb8b)
  453. return true;
  454. if (cp < 0xb8e)
  455. return false;
  456. if (cp < 0xb91)
  457. return true;
  458. if (cp < 0xb92)
  459. return false;
  460. if (cp < 0xb96)
  461. return true;
  462. if (cp < 0xb99)
  463. return false;
  464. if (cp < 0xb9b)
  465. return true;
  466. if (cp === 0xb9c)
  467. return true;
  468. return false;
  469. }
  470. if (cp < 0xc05) {
  471. if (cp < 0xb9e)
  472. return false;
  473. if (cp < 0xba0)
  474. return true;
  475. if (cp < 0xba3)
  476. return false;
  477. if (cp < 0xba5)
  478. return true;
  479. if (cp < 0xba8)
  480. return false;
  481. if (cp < 0xbab)
  482. return true;
  483. if (cp < 0xbae)
  484. return false;
  485. if (cp < 0xbba)
  486. return true;
  487. if (cp === 0xbd0)
  488. return true;
  489. return false;
  490. }
  491. if (cp < 0xc0d)
  492. return true;
  493. if (cp < 0xc0e)
  494. return false;
  495. if (cp < 0xc11)
  496. return true;
  497. if (cp < 0xc12)
  498. return false;
  499. if (cp < 0xc29)
  500. return true;
  501. if (cp < 0xc2a)
  502. return false;
  503. if (cp < 0xc3a)
  504. return true;
  505. if (cp === 0xc3d)
  506. return true;
  507. if (cp < 0xc58)
  508. return false;
  509. if (cp < 0xc5b)
  510. return true;
  511. return false;
  512. }
  513. if (cp < 0xdb3) {
  514. if (cp < 0xcf1) {
  515. if (cp < 0xcaa) {
  516. if (cp < 0xc60)
  517. return false;
  518. if (cp < 0xc62)
  519. return true;
  520. if (cp === 0xc80)
  521. return true;
  522. if (cp < 0xc85)
  523. return false;
  524. if (cp < 0xc8d)
  525. return true;
  526. if (cp < 0xc8e)
  527. return false;
  528. if (cp < 0xc91)
  529. return true;
  530. if (cp < 0xc92)
  531. return false;
  532. if (cp < 0xca9)
  533. return true;
  534. return false;
  535. }
  536. if (cp < 0xcb4)
  537. return true;
  538. if (cp < 0xcb5)
  539. return false;
  540. if (cp < 0xcba)
  541. return true;
  542. if (cp === 0xcbd)
  543. return true;
  544. if (cp === 0xcde)
  545. return true;
  546. if (cp < 0xce0)
  547. return false;
  548. if (cp < 0xce2)
  549. return true;
  550. return false;
  551. }
  552. if (cp < 0xd4e) {
  553. if (cp < 0xcf1)
  554. return false;
  555. if (cp < 0xcf3)
  556. return true;
  557. if (cp < 0xd05)
  558. return false;
  559. if (cp < 0xd0d)
  560. return true;
  561. if (cp < 0xd0e)
  562. return false;
  563. if (cp < 0xd11)
  564. return true;
  565. if (cp < 0xd12)
  566. return false;
  567. if (cp < 0xd3b)
  568. return true;
  569. if (cp === 0xd3d)
  570. return true;
  571. return false;
  572. }
  573. if (cp === 0xd4e)
  574. return true;
  575. if (cp < 0xd54)
  576. return false;
  577. if (cp < 0xd57)
  578. return true;
  579. if (cp < 0xd5f)
  580. return false;
  581. if (cp < 0xd62)
  582. return true;
  583. if (cp < 0xd7a)
  584. return false;
  585. if (cp < 0xd80)
  586. return true;
  587. if (cp < 0xd85)
  588. return false;
  589. if (cp < 0xd97)
  590. return true;
  591. if (cp < 0xd9a)
  592. return false;
  593. if (cp < 0xdb2)
  594. return true;
  595. return false;
  596. }
  597. if (cp < 0xe8a) {
  598. if (cp < 0xe40) {
  599. if (cp < 0xdb3)
  600. return false;
  601. if (cp < 0xdbc)
  602. return true;
  603. if (cp === 0xdbd)
  604. return true;
  605. if (cp < 0xdc0)
  606. return false;
  607. if (cp < 0xdc7)
  608. return true;
  609. if (cp < 0xe01)
  610. return false;
  611. if (cp < 0xe31)
  612. return true;
  613. if (cp < 0xe32)
  614. return false;
  615. if (cp < 0xe34)
  616. return true;
  617. return false;
  618. }
  619. if (cp < 0xe46)
  620. return true;
  621. if (cp === 0xe46)
  622. return true;
  623. if (cp < 0xe81)
  624. return false;
  625. if (cp < 0xe83)
  626. return true;
  627. if (cp === 0xe84)
  628. return true;
  629. if (cp < 0xe87)
  630. return false;
  631. if (cp < 0xe89)
  632. return true;
  633. return false;
  634. }
  635. if (cp < 0xea5) {
  636. if (cp === 0xe8a)
  637. return true;
  638. if (cp === 0xe8d)
  639. return true;
  640. if (cp < 0xe94)
  641. return false;
  642. if (cp < 0xe98)
  643. return true;
  644. if (cp < 0xe99)
  645. return false;
  646. if (cp < 0xea0)
  647. return true;
  648. if (cp < 0xea1)
  649. return false;
  650. if (cp < 0xea4)
  651. return true;
  652. return false;
  653. }
  654. if (cp === 0xea5)
  655. return true;
  656. if (cp === 0xea7)
  657. return true;
  658. if (cp < 0xeaa)
  659. return false;
  660. if (cp < 0xeac)
  661. return true;
  662. if (cp < 0xead)
  663. return false;
  664. if (cp < 0xeb1)
  665. return true;
  666. if (cp < 0xeb2)
  667. return false;
  668. if (cp < 0xeb4)
  669. return true;
  670. if (cp === 0xebd)
  671. return true;
  672. return false;
  673. }
  674. if (cp < 0x1ce9) {
  675. if (cp < 0x166f) {
  676. if (cp < 0x10fd) {
  677. if (cp < 0x105a) {
  678. if (cp < 0xf49) {
  679. if (cp < 0xec0)
  680. return false;
  681. if (cp < 0xec5)
  682. return true;
  683. if (cp === 0xec6)
  684. return true;
  685. if (cp < 0xedc)
  686. return false;
  687. if (cp < 0xee0)
  688. return true;
  689. if (cp === 0xf00)
  690. return true;
  691. if (cp < 0xf40)
  692. return false;
  693. if (cp < 0xf48)
  694. return true;
  695. return false;
  696. }
  697. if (cp < 0xf6d)
  698. return true;
  699. if (cp < 0xf88)
  700. return false;
  701. if (cp < 0xf8d)
  702. return true;
  703. if (cp < 0x1000)
  704. return false;
  705. if (cp < 0x102b)
  706. return true;
  707. if (cp === 0x103f)
  708. return true;
  709. if (cp < 0x1050)
  710. return false;
  711. if (cp < 0x1056)
  712. return true;
  713. return false;
  714. }
  715. if (cp < 0x108e) {
  716. if (cp < 0x105a)
  717. return false;
  718. if (cp < 0x105e)
  719. return true;
  720. if (cp === 0x1061)
  721. return true;
  722. if (cp < 0x1065)
  723. return false;
  724. if (cp < 0x1067)
  725. return true;
  726. if (cp < 0x106e)
  727. return false;
  728. if (cp < 0x1071)
  729. return true;
  730. if (cp < 0x1075)
  731. return false;
  732. if (cp < 0x1082)
  733. return true;
  734. return false;
  735. }
  736. if (cp === 0x108e)
  737. return true;
  738. if (cp < 0x10a0)
  739. return false;
  740. if (cp < 0x10c6)
  741. return true;
  742. if (cp === 0x10c7)
  743. return true;
  744. if (cp === 0x10cd)
  745. return true;
  746. if (cp < 0x10d0)
  747. return false;
  748. if (cp < 0x10fb)
  749. return true;
  750. if (cp === 0x10fc)
  751. return true;
  752. return false;
  753. }
  754. if (cp < 0x12b8) {
  755. if (cp < 0x125a) {
  756. if (cp < 0x10fd)
  757. return false;
  758. if (cp < 0x1100)
  759. return true;
  760. if (cp < 0x1100)
  761. return false;
  762. if (cp < 0x1249)
  763. return true;
  764. if (cp < 0x124a)
  765. return false;
  766. if (cp < 0x124e)
  767. return true;
  768. if (cp < 0x1250)
  769. return false;
  770. if (cp < 0x1257)
  771. return true;
  772. if (cp === 0x1258)
  773. return true;
  774. return false;
  775. }
  776. if (cp < 0x125e)
  777. return true;
  778. if (cp < 0x1260)
  779. return false;
  780. if (cp < 0x1289)
  781. return true;
  782. if (cp < 0x128a)
  783. return false;
  784. if (cp < 0x128e)
  785. return true;
  786. if (cp < 0x1290)
  787. return false;
  788. if (cp < 0x12b1)
  789. return true;
  790. if (cp < 0x12b2)
  791. return false;
  792. if (cp < 0x12b6)
  793. return true;
  794. return false;
  795. }
  796. if (cp < 0x1312) {
  797. if (cp < 0x12b8)
  798. return false;
  799. if (cp < 0x12bf)
  800. return true;
  801. if (cp === 0x12c0)
  802. return true;
  803. if (cp < 0x12c2)
  804. return false;
  805. if (cp < 0x12c6)
  806. return true;
  807. if (cp < 0x12c8)
  808. return false;
  809. if (cp < 0x12d7)
  810. return true;
  811. if (cp < 0x12d8)
  812. return false;
  813. if (cp < 0x1311)
  814. return true;
  815. return false;
  816. }
  817. if (cp < 0x1316)
  818. return true;
  819. if (cp < 0x1318)
  820. return false;
  821. if (cp < 0x135b)
  822. return true;
  823. if (cp < 0x1380)
  824. return false;
  825. if (cp < 0x1390)
  826. return true;
  827. if (cp < 0x13a0)
  828. return false;
  829. if (cp < 0x13f6)
  830. return true;
  831. if (cp < 0x13f8)
  832. return false;
  833. if (cp < 0x13fe)
  834. return true;
  835. if (cp < 0x1401)
  836. return false;
  837. if (cp < 0x166d)
  838. return true;
  839. return false;
  840. }
  841. if (cp < 0x18b0) {
  842. if (cp < 0x176e) {
  843. if (cp < 0x1700) {
  844. if (cp < 0x166f)
  845. return false;
  846. if (cp < 0x1680)
  847. return true;
  848. if (cp < 0x1681)
  849. return false;
  850. if (cp < 0x169b)
  851. return true;
  852. if (cp < 0x16a0)
  853. return false;
  854. if (cp < 0x16eb)
  855. return true;
  856. if (cp < 0x16ee)
  857. return false;
  858. if (cp < 0x16f1)
  859. return true;
  860. if (cp < 0x16f1)
  861. return false;
  862. if (cp < 0x16f9)
  863. return true;
  864. return false;
  865. }
  866. if (cp < 0x170d)
  867. return true;
  868. if (cp < 0x170e)
  869. return false;
  870. if (cp < 0x1712)
  871. return true;
  872. if (cp < 0x1720)
  873. return false;
  874. if (cp < 0x1732)
  875. return true;
  876. if (cp < 0x1740)
  877. return false;
  878. if (cp < 0x1752)
  879. return true;
  880. if (cp < 0x1760)
  881. return false;
  882. if (cp < 0x176d)
  883. return true;
  884. return false;
  885. }
  886. if (cp < 0x1843) {
  887. if (cp < 0x176e)
  888. return false;
  889. if (cp < 0x1771)
  890. return true;
  891. if (cp < 0x1780)
  892. return false;
  893. if (cp < 0x17b4)
  894. return true;
  895. if (cp === 0x17d7)
  896. return true;
  897. if (cp === 0x17dc)
  898. return true;
  899. if (cp < 0x1820)
  900. return false;
  901. if (cp < 0x1843)
  902. return true;
  903. return false;
  904. }
  905. if (cp === 0x1843)
  906. return true;
  907. if (cp < 0x1844)
  908. return false;
  909. if (cp < 0x1879)
  910. return true;
  911. if (cp < 0x1880)
  912. return false;
  913. if (cp < 0x1885)
  914. return true;
  915. if (cp < 0x1885)
  916. return false;
  917. if (cp < 0x1887)
  918. return true;
  919. if (cp < 0x1887)
  920. return false;
  921. if (cp < 0x18a9)
  922. return true;
  923. if (cp === 0x18aa)
  924. return true;
  925. return false;
  926. }
  927. if (cp < 0x1b45) {
  928. if (cp < 0x19b0) {
  929. if (cp < 0x18b0)
  930. return false;
  931. if (cp < 0x18f6)
  932. return true;
  933. if (cp < 0x1900)
  934. return false;
  935. if (cp < 0x191f)
  936. return true;
  937. if (cp < 0x1950)
  938. return false;
  939. if (cp < 0x196e)
  940. return true;
  941. if (cp < 0x1970)
  942. return false;
  943. if (cp < 0x1975)
  944. return true;
  945. if (cp < 0x1980)
  946. return false;
  947. if (cp < 0x19ac)
  948. return true;
  949. return false;
  950. }
  951. if (cp < 0x19ca)
  952. return true;
  953. if (cp < 0x1a00)
  954. return false;
  955. if (cp < 0x1a17)
  956. return true;
  957. if (cp < 0x1a20)
  958. return false;
  959. if (cp < 0x1a55)
  960. return true;
  961. if (cp === 0x1aa7)
  962. return true;
  963. if (cp < 0x1b05)
  964. return false;
  965. if (cp < 0x1b34)
  966. return true;
  967. return false;
  968. }
  969. if (cp < 0x1c4d) {
  970. if (cp < 0x1b45)
  971. return false;
  972. if (cp < 0x1b4c)
  973. return true;
  974. if (cp < 0x1b83)
  975. return false;
  976. if (cp < 0x1ba1)
  977. return true;
  978. if (cp < 0x1bae)
  979. return false;
  980. if (cp < 0x1bb0)
  981. return true;
  982. if (cp < 0x1bba)
  983. return false;
  984. if (cp < 0x1be6)
  985. return true;
  986. if (cp < 0x1c00)
  987. return false;
  988. if (cp < 0x1c24)
  989. return true;
  990. return false;
  991. }
  992. if (cp < 0x1c50)
  993. return true;
  994. if (cp < 0x1c5a)
  995. return false;
  996. if (cp < 0x1c78)
  997. return true;
  998. if (cp < 0x1c78)
  999. return false;
  1000. if (cp < 0x1c7e)
  1001. return true;
  1002. if (cp < 0x1c80)
  1003. return false;
  1004. if (cp < 0x1c89)
  1005. return true;
  1006. if (cp < 0x1c90)
  1007. return false;
  1008. if (cp < 0x1cbb)
  1009. return true;
  1010. if (cp < 0x1cbd)
  1011. return false;
  1012. if (cp < 0x1cc0)
  1013. return true;
  1014. return false;
  1015. }
  1016. if (cp < 0x212f) {
  1017. if (cp < 0x1fc2) {
  1018. if (cp < 0x1f18) {
  1019. if (cp < 0x1d6b) {
  1020. if (cp < 0x1ce9)
  1021. return false;
  1022. if (cp < 0x1ced)
  1023. return true;
  1024. if (cp < 0x1cee)
  1025. return false;
  1026. if (cp < 0x1cf2)
  1027. return true;
  1028. if (cp < 0x1cf5)
  1029. return false;
  1030. if (cp < 0x1cf7)
  1031. return true;
  1032. if (cp < 0x1d00)
  1033. return false;
  1034. if (cp < 0x1d2c)
  1035. return true;
  1036. if (cp < 0x1d2c)
  1037. return false;
  1038. if (cp < 0x1d6b)
  1039. return true;
  1040. return false;
  1041. }
  1042. if (cp < 0x1d78)
  1043. return true;
  1044. if (cp === 0x1d78)
  1045. return true;
  1046. if (cp < 0x1d79)
  1047. return false;
  1048. if (cp < 0x1d9b)
  1049. return true;
  1050. if (cp < 0x1d9b)
  1051. return false;
  1052. if (cp < 0x1dc0)
  1053. return true;
  1054. if (cp < 0x1e00)
  1055. return false;
  1056. if (cp < 0x1f16)
  1057. return true;
  1058. return false;
  1059. }
  1060. if (cp < 0x1f5b) {
  1061. if (cp < 0x1f18)
  1062. return false;
  1063. if (cp < 0x1f1e)
  1064. return true;
  1065. if (cp < 0x1f20)
  1066. return false;
  1067. if (cp < 0x1f46)
  1068. return true;
  1069. if (cp < 0x1f48)
  1070. return false;
  1071. if (cp < 0x1f4e)
  1072. return true;
  1073. if (cp < 0x1f50)
  1074. return false;
  1075. if (cp < 0x1f58)
  1076. return true;
  1077. if (cp === 0x1f59)
  1078. return true;
  1079. return false;
  1080. }
  1081. if (cp === 0x1f5b)
  1082. return true;
  1083. if (cp === 0x1f5d)
  1084. return true;
  1085. if (cp < 0x1f5f)
  1086. return false;
  1087. if (cp < 0x1f7e)
  1088. return true;
  1089. if (cp < 0x1f80)
  1090. return false;
  1091. if (cp < 0x1fb5)
  1092. return true;
  1093. if (cp < 0x1fb6)
  1094. return false;
  1095. if (cp < 0x1fbd)
  1096. return true;
  1097. if (cp === 0x1fbe)
  1098. return true;
  1099. return false;
  1100. }
  1101. if (cp < 0x2102) {
  1102. if (cp < 0x1ff2) {
  1103. if (cp < 0x1fc2)
  1104. return false;
  1105. if (cp < 0x1fc5)
  1106. return true;
  1107. if (cp < 0x1fc6)
  1108. return false;
  1109. if (cp < 0x1fcd)
  1110. return true;
  1111. if (cp < 0x1fd0)
  1112. return false;
  1113. if (cp < 0x1fd4)
  1114. return true;
  1115. if (cp < 0x1fd6)
  1116. return false;
  1117. if (cp < 0x1fdc)
  1118. return true;
  1119. if (cp < 0x1fe0)
  1120. return false;
  1121. if (cp < 0x1fed)
  1122. return true;
  1123. return false;
  1124. }
  1125. if (cp < 0x1ff5)
  1126. return true;
  1127. if (cp < 0x1ff6)
  1128. return false;
  1129. if (cp < 0x1ffd)
  1130. return true;
  1131. if (cp === 0x2071)
  1132. return true;
  1133. if (cp === 0x207f)
  1134. return true;
  1135. if (cp < 0x2090)
  1136. return false;
  1137. if (cp < 0x209d)
  1138. return true;
  1139. return false;
  1140. }
  1141. if (cp < 0x2119) {
  1142. if (cp === 0x2102)
  1143. return true;
  1144. if (cp === 0x2107)
  1145. return true;
  1146. if (cp < 0x210a)
  1147. return false;
  1148. if (cp < 0x2114)
  1149. return true;
  1150. if (cp === 0x2115)
  1151. return true;
  1152. if (cp === 0x2118)
  1153. return true;
  1154. return false;
  1155. }
  1156. if (cp < 0x211e)
  1157. return true;
  1158. if (cp === 0x2124)
  1159. return true;
  1160. if (cp === 0x2126)
  1161. return true;
  1162. if (cp === 0x2128)
  1163. return true;
  1164. if (cp < 0x212a)
  1165. return false;
  1166. if (cp < 0x212e)
  1167. return true;
  1168. if (cp === 0x212e)
  1169. return true;
  1170. return false;
  1171. }
  1172. if (cp < 0x2d80) {
  1173. if (cp < 0x2c30) {
  1174. if (cp < 0x214e) {
  1175. if (cp < 0x212f)
  1176. return false;
  1177. if (cp < 0x2135)
  1178. return true;
  1179. if (cp < 0x2135)
  1180. return false;
  1181. if (cp < 0x2139)
  1182. return true;
  1183. if (cp === 0x2139)
  1184. return true;
  1185. if (cp < 0x213c)
  1186. return false;
  1187. if (cp < 0x2140)
  1188. return true;
  1189. if (cp < 0x2145)
  1190. return false;
  1191. if (cp < 0x214a)
  1192. return true;
  1193. return false;
  1194. }
  1195. if (cp === 0x214e)
  1196. return true;
  1197. if (cp < 0x2160)
  1198. return false;
  1199. if (cp < 0x2183)
  1200. return true;
  1201. if (cp < 0x2183)
  1202. return false;
  1203. if (cp < 0x2185)
  1204. return true;
  1205. if (cp < 0x2185)
  1206. return false;
  1207. if (cp < 0x2189)
  1208. return true;
  1209. if (cp < 0x2c00)
  1210. return false;
  1211. if (cp < 0x2c2f)
  1212. return true;
  1213. return false;
  1214. }
  1215. if (cp < 0x2cf2) {
  1216. if (cp < 0x2c30)
  1217. return false;
  1218. if (cp < 0x2c5f)
  1219. return true;
  1220. if (cp < 0x2c60)
  1221. return false;
  1222. if (cp < 0x2c7c)
  1223. return true;
  1224. if (cp < 0x2c7c)
  1225. return false;
  1226. if (cp < 0x2c7e)
  1227. return true;
  1228. if (cp < 0x2c7e)
  1229. return false;
  1230. if (cp < 0x2ce5)
  1231. return true;
  1232. if (cp < 0x2ceb)
  1233. return false;
  1234. if (cp < 0x2cef)
  1235. return true;
  1236. return false;
  1237. }
  1238. if (cp < 0x2cf4)
  1239. return true;
  1240. if (cp < 0x2d00)
  1241. return false;
  1242. if (cp < 0x2d26)
  1243. return true;
  1244. if (cp === 0x2d27)
  1245. return true;
  1246. if (cp === 0x2d2d)
  1247. return true;
  1248. if (cp < 0x2d30)
  1249. return false;
  1250. if (cp < 0x2d68)
  1251. return true;
  1252. if (cp === 0x2d6f)
  1253. return true;
  1254. return false;
  1255. }
  1256. if (cp < 0x3006) {
  1257. if (cp < 0x2dc0) {
  1258. if (cp < 0x2d80)
  1259. return false;
  1260. if (cp < 0x2d97)
  1261. return true;
  1262. if (cp < 0x2da0)
  1263. return false;
  1264. if (cp < 0x2da7)
  1265. return true;
  1266. if (cp < 0x2da8)
  1267. return false;
  1268. if (cp < 0x2daf)
  1269. return true;
  1270. if (cp < 0x2db0)
  1271. return false;
  1272. if (cp < 0x2db7)
  1273. return true;
  1274. if (cp < 0x2db8)
  1275. return false;
  1276. if (cp < 0x2dbf)
  1277. return true;
  1278. return false;
  1279. }
  1280. if (cp < 0x2dc7)
  1281. return true;
  1282. if (cp < 0x2dc8)
  1283. return false;
  1284. if (cp < 0x2dcf)
  1285. return true;
  1286. if (cp < 0x2dd0)
  1287. return false;
  1288. if (cp < 0x2dd7)
  1289. return true;
  1290. if (cp < 0x2dd8)
  1291. return false;
  1292. if (cp < 0x2ddf)
  1293. return true;
  1294. if (cp === 0x3005)
  1295. return true;
  1296. return false;
  1297. }
  1298. if (cp < 0x303b) {
  1299. if (cp === 0x3006)
  1300. return true;
  1301. if (cp === 0x3007)
  1302. return true;
  1303. if (cp < 0x3021)
  1304. return false;
  1305. if (cp < 0x302a)
  1306. return true;
  1307. if (cp < 0x3031)
  1308. return false;
  1309. if (cp < 0x3036)
  1310. return true;
  1311. if (cp < 0x3038)
  1312. return false;
  1313. if (cp < 0x303b)
  1314. return true;
  1315. return false;
  1316. }
  1317. if (cp === 0x303b)
  1318. return true;
  1319. if (cp === 0x303c)
  1320. return true;
  1321. if (cp < 0x3041)
  1322. return false;
  1323. if (cp < 0x3097)
  1324. return true;
  1325. if (cp < 0x309b)
  1326. return false;
  1327. if (cp < 0x309d)
  1328. return true;
  1329. if (cp < 0x309d)
  1330. return false;
  1331. if (cp < 0x309f)
  1332. return true;
  1333. if (cp === 0x309f)
  1334. return true;
  1335. return false;
  1336. }
  1337. if (cp < 0x10b60) {
  1338. if (cp < 0xd7b0) {
  1339. if (cp < 0xa882) {
  1340. if (cp < 0xa67f) {
  1341. if (cp < 0xa015) {
  1342. if (cp < 0x31a0) {
  1343. if (cp < 0x30a1)
  1344. return false;
  1345. if (cp < 0x30fb)
  1346. return true;
  1347. if (cp < 0x30fc)
  1348. return false;
  1349. if (cp < 0x30ff)
  1350. return true;
  1351. if (cp === 0x30ff)
  1352. return true;
  1353. if (cp < 0x3105)
  1354. return false;
  1355. if (cp < 0x3130)
  1356. return true;
  1357. if (cp < 0x3131)
  1358. return false;
  1359. if (cp < 0x318f)
  1360. return true;
  1361. return false;
  1362. }
  1363. if (cp < 0x31bb)
  1364. return true;
  1365. if (cp < 0x31f0)
  1366. return false;
  1367. if (cp < 0x3200)
  1368. return true;
  1369. if (cp < 0x3400)
  1370. return false;
  1371. if (cp < 0x4db6)
  1372. return true;
  1373. if (cp < 0x4e00)
  1374. return false;
  1375. if (cp < 0x9ff0)
  1376. return true;
  1377. if (cp < 0xa000)
  1378. return false;
  1379. if (cp < 0xa015)
  1380. return true;
  1381. return false;
  1382. }
  1383. if (cp < 0xa60c) {
  1384. if (cp === 0xa015)
  1385. return true;
  1386. if (cp < 0xa016)
  1387. return false;
  1388. if (cp < 0xa48d)
  1389. return true;
  1390. if (cp < 0xa4d0)
  1391. return false;
  1392. if (cp < 0xa4f8)
  1393. return true;
  1394. if (cp < 0xa4f8)
  1395. return false;
  1396. if (cp < 0xa4fe)
  1397. return true;
  1398. if (cp < 0xa500)
  1399. return false;
  1400. if (cp < 0xa60c)
  1401. return true;
  1402. return false;
  1403. }
  1404. if (cp === 0xa60c)
  1405. return true;
  1406. if (cp < 0xa610)
  1407. return false;
  1408. if (cp < 0xa620)
  1409. return true;
  1410. if (cp < 0xa62a)
  1411. return false;
  1412. if (cp < 0xa62c)
  1413. return true;
  1414. if (cp < 0xa640)
  1415. return false;
  1416. if (cp < 0xa66e)
  1417. return true;
  1418. if (cp === 0xa66e)
  1419. return true;
  1420. return false;
  1421. }
  1422. if (cp < 0xa78b) {
  1423. if (cp < 0xa717) {
  1424. if (cp === 0xa67f)
  1425. return true;
  1426. if (cp < 0xa680)
  1427. return false;
  1428. if (cp < 0xa69c)
  1429. return true;
  1430. if (cp < 0xa69c)
  1431. return false;
  1432. if (cp < 0xa69e)
  1433. return true;
  1434. if (cp < 0xa6a0)
  1435. return false;
  1436. if (cp < 0xa6e6)
  1437. return true;
  1438. if (cp < 0xa6e6)
  1439. return false;
  1440. if (cp < 0xa6f0)
  1441. return true;
  1442. return false;
  1443. }
  1444. if (cp < 0xa720)
  1445. return true;
  1446. if (cp < 0xa722)
  1447. return false;
  1448. if (cp < 0xa770)
  1449. return true;
  1450. if (cp === 0xa770)
  1451. return true;
  1452. if (cp < 0xa771)
  1453. return false;
  1454. if (cp < 0xa788)
  1455. return true;
  1456. if (cp === 0xa788)
  1457. return true;
  1458. return false;
  1459. }
  1460. if (cp < 0xa7fa) {
  1461. if (cp < 0xa78b)
  1462. return false;
  1463. if (cp < 0xa78f)
  1464. return true;
  1465. if (cp === 0xa78f)
  1466. return true;
  1467. if (cp < 0xa790)
  1468. return false;
  1469. if (cp < 0xa7ba)
  1470. return true;
  1471. if (cp === 0xa7f7)
  1472. return true;
  1473. if (cp < 0xa7f8)
  1474. return false;
  1475. if (cp < 0xa7fa)
  1476. return true;
  1477. return false;
  1478. }
  1479. if (cp === 0xa7fa)
  1480. return true;
  1481. if (cp < 0xa7fb)
  1482. return false;
  1483. if (cp < 0xa802)
  1484. return true;
  1485. if (cp < 0xa803)
  1486. return false;
  1487. if (cp < 0xa806)
  1488. return true;
  1489. if (cp < 0xa807)
  1490. return false;
  1491. if (cp < 0xa80b)
  1492. return true;
  1493. if (cp < 0xa80c)
  1494. return false;
  1495. if (cp < 0xa823)
  1496. return true;
  1497. if (cp < 0xa840)
  1498. return false;
  1499. if (cp < 0xa874)
  1500. return true;
  1501. return false;
  1502. }
  1503. if (cp < 0xaab1) {
  1504. if (cp < 0xa9e6) {
  1505. if (cp < 0xa930) {
  1506. if (cp < 0xa882)
  1507. return false;
  1508. if (cp < 0xa8b4)
  1509. return true;
  1510. if (cp < 0xa8f2)
  1511. return false;
  1512. if (cp < 0xa8f8)
  1513. return true;
  1514. if (cp === 0xa8fb)
  1515. return true;
  1516. if (cp < 0xa8fd)
  1517. return false;
  1518. if (cp < 0xa8ff)
  1519. return true;
  1520. if (cp < 0xa90a)
  1521. return false;
  1522. if (cp < 0xa926)
  1523. return true;
  1524. return false;
  1525. }
  1526. if (cp < 0xa947)
  1527. return true;
  1528. if (cp < 0xa960)
  1529. return false;
  1530. if (cp < 0xa97d)
  1531. return true;
  1532. if (cp < 0xa984)
  1533. return false;
  1534. if (cp < 0xa9b3)
  1535. return true;
  1536. if (cp === 0xa9cf)
  1537. return true;
  1538. if (cp < 0xa9e0)
  1539. return false;
  1540. if (cp < 0xa9e5)
  1541. return true;
  1542. return false;
  1543. }
  1544. if (cp < 0xaa44) {
  1545. if (cp === 0xa9e6)
  1546. return true;
  1547. if (cp < 0xa9e7)
  1548. return false;
  1549. if (cp < 0xa9f0)
  1550. return true;
  1551. if (cp < 0xa9fa)
  1552. return false;
  1553. if (cp < 0xa9ff)
  1554. return true;
  1555. if (cp < 0xaa00)
  1556. return false;
  1557. if (cp < 0xaa29)
  1558. return true;
  1559. if (cp < 0xaa40)
  1560. return false;
  1561. if (cp < 0xaa43)
  1562. return true;
  1563. return false;
  1564. }
  1565. if (cp < 0xaa4c)
  1566. return true;
  1567. if (cp < 0xaa60)
  1568. return false;
  1569. if (cp < 0xaa70)
  1570. return true;
  1571. if (cp === 0xaa70)
  1572. return true;
  1573. if (cp < 0xaa71)
  1574. return false;
  1575. if (cp < 0xaa77)
  1576. return true;
  1577. if (cp === 0xaa7a)
  1578. return true;
  1579. if (cp < 0xaa7e)
  1580. return false;
  1581. if (cp < 0xaab0)
  1582. return true;
  1583. return false;
  1584. }
  1585. if (cp < 0xab01) {
  1586. if (cp < 0xaadb) {
  1587. if (cp === 0xaab1)
  1588. return true;
  1589. if (cp < 0xaab5)
  1590. return false;
  1591. if (cp < 0xaab7)
  1592. return true;
  1593. if (cp < 0xaab9)
  1594. return false;
  1595. if (cp < 0xaabe)
  1596. return true;
  1597. if (cp === 0xaac0)
  1598. return true;
  1599. if (cp === 0xaac2)
  1600. return true;
  1601. return false;
  1602. }
  1603. if (cp < 0xaadd)
  1604. return true;
  1605. if (cp === 0xaadd)
  1606. return true;
  1607. if (cp < 0xaae0)
  1608. return false;
  1609. if (cp < 0xaaeb)
  1610. return true;
  1611. if (cp === 0xaaf2)
  1612. return true;
  1613. if (cp < 0xaaf3)
  1614. return false;
  1615. if (cp < 0xaaf5)
  1616. return true;
  1617. return false;
  1618. }
  1619. if (cp < 0xab30) {
  1620. if (cp < 0xab01)
  1621. return false;
  1622. if (cp < 0xab07)
  1623. return true;
  1624. if (cp < 0xab09)
  1625. return false;
  1626. if (cp < 0xab0f)
  1627. return true;
  1628. if (cp < 0xab11)
  1629. return false;
  1630. if (cp < 0xab17)
  1631. return true;
  1632. if (cp < 0xab20)
  1633. return false;
  1634. if (cp < 0xab27)
  1635. return true;
  1636. if (cp < 0xab28)
  1637. return false;
  1638. if (cp < 0xab2f)
  1639. return true;
  1640. return false;
  1641. }
  1642. if (cp < 0xab5b)
  1643. return true;
  1644. if (cp < 0xab5c)
  1645. return false;
  1646. if (cp < 0xab60)
  1647. return true;
  1648. if (cp < 0xab60)
  1649. return false;
  1650. if (cp < 0xab66)
  1651. return true;
  1652. if (cp < 0xab70)
  1653. return false;
  1654. if (cp < 0xabc0)
  1655. return true;
  1656. if (cp < 0xabc0)
  1657. return false;
  1658. if (cp < 0xabe3)
  1659. return true;
  1660. if (cp < 0xac00)
  1661. return false;
  1662. if (cp < 0xd7a4)
  1663. return true;
  1664. return false;
  1665. }
  1666. if (cp < 0x1032d) {
  1667. if (cp < 0xff41) {
  1668. if (cp < 0xfb3e) {
  1669. if (cp < 0xfb13) {
  1670. if (cp < 0xd7b0)
  1671. return false;
  1672. if (cp < 0xd7c7)
  1673. return true;
  1674. if (cp < 0xd7cb)
  1675. return false;
  1676. if (cp < 0xd7fc)
  1677. return true;
  1678. if (cp < 0xf900)
  1679. return false;
  1680. if (cp < 0xfa6e)
  1681. return true;
  1682. if (cp < 0xfa70)
  1683. return false;
  1684. if (cp < 0xfada)
  1685. return true;
  1686. if (cp < 0xfb00)
  1687. return false;
  1688. if (cp < 0xfb07)
  1689. return true;
  1690. return false;
  1691. }
  1692. if (cp < 0xfb18)
  1693. return true;
  1694. if (cp === 0xfb1d)
  1695. return true;
  1696. if (cp < 0xfb1f)
  1697. return false;
  1698. if (cp < 0xfb29)
  1699. return true;
  1700. if (cp < 0xfb2a)
  1701. return false;
  1702. if (cp < 0xfb37)
  1703. return true;
  1704. if (cp < 0xfb38)
  1705. return false;
  1706. if (cp < 0xfb3d)
  1707. return true;
  1708. return false;
  1709. }
  1710. if (cp < 0xfd50) {
  1711. if (cp === 0xfb3e)
  1712. return true;
  1713. if (cp < 0xfb40)
  1714. return false;
  1715. if (cp < 0xfb42)
  1716. return true;
  1717. if (cp < 0xfb43)
  1718. return false;
  1719. if (cp < 0xfb45)
  1720. return true;
  1721. if (cp < 0xfb46)
  1722. return false;
  1723. if (cp < 0xfbb2)
  1724. return true;
  1725. if (cp < 0xfbd3)
  1726. return false;
  1727. if (cp < 0xfd3e)
  1728. return true;
  1729. return false;
  1730. }
  1731. if (cp < 0xfd90)
  1732. return true;
  1733. if (cp < 0xfd92)
  1734. return false;
  1735. if (cp < 0xfdc8)
  1736. return true;
  1737. if (cp < 0xfdf0)
  1738. return false;
  1739. if (cp < 0xfdfc)
  1740. return true;
  1741. if (cp < 0xfe70)
  1742. return false;
  1743. if (cp < 0xfe75)
  1744. return true;
  1745. if (cp < 0xfe76)
  1746. return false;
  1747. if (cp < 0xfefd)
  1748. return true;
  1749. if (cp < 0xff21)
  1750. return false;
  1751. if (cp < 0xff3b)
  1752. return true;
  1753. return false;
  1754. }
  1755. if (cp < 0x10000) {
  1756. if (cp < 0xffa0) {
  1757. if (cp < 0xff41)
  1758. return false;
  1759. if (cp < 0xff5b)
  1760. return true;
  1761. if (cp < 0xff66)
  1762. return false;
  1763. if (cp < 0xff70)
  1764. return true;
  1765. if (cp === 0xff70)
  1766. return true;
  1767. if (cp < 0xff71)
  1768. return false;
  1769. if (cp < 0xff9e)
  1770. return true;
  1771. if (cp < 0xff9e)
  1772. return false;
  1773. if (cp < 0xffa0)
  1774. return true;
  1775. return false;
  1776. }
  1777. if (cp < 0xffbf)
  1778. return true;
  1779. if (cp < 0xffc2)
  1780. return false;
  1781. if (cp < 0xffc8)
  1782. return true;
  1783. if (cp < 0xffca)
  1784. return false;
  1785. if (cp < 0xffd0)
  1786. return true;
  1787. if (cp < 0xffd2)
  1788. return false;
  1789. if (cp < 0xffd8)
  1790. return true;
  1791. if (cp < 0xffda)
  1792. return false;
  1793. if (cp < 0xffdd)
  1794. return true;
  1795. return false;
  1796. }
  1797. if (cp < 0x10050) {
  1798. if (cp < 0x10000)
  1799. return false;
  1800. if (cp < 0x1000c)
  1801. return true;
  1802. if (cp < 0x1000d)
  1803. return false;
  1804. if (cp < 0x10027)
  1805. return true;
  1806. if (cp < 0x10028)
  1807. return false;
  1808. if (cp < 0x1003b)
  1809. return true;
  1810. if (cp < 0x1003c)
  1811. return false;
  1812. if (cp < 0x1003e)
  1813. return true;
  1814. if (cp < 0x1003f)
  1815. return false;
  1816. if (cp < 0x1004e)
  1817. return true;
  1818. return false;
  1819. }
  1820. if (cp < 0x1005e)
  1821. return true;
  1822. if (cp < 0x10080)
  1823. return false;
  1824. if (cp < 0x100fb)
  1825. return true;
  1826. if (cp < 0x10140)
  1827. return false;
  1828. if (cp < 0x10175)
  1829. return true;
  1830. if (cp < 0x10280)
  1831. return false;
  1832. if (cp < 0x1029d)
  1833. return true;
  1834. if (cp < 0x102a0)
  1835. return false;
  1836. if (cp < 0x102d1)
  1837. return true;
  1838. if (cp < 0x10300)
  1839. return false;
  1840. if (cp < 0x10320)
  1841. return true;
  1842. return false;
  1843. }
  1844. if (cp < 0x10837) {
  1845. if (cp < 0x10450) {
  1846. if (cp < 0x10380) {
  1847. if (cp < 0x1032d)
  1848. return false;
  1849. if (cp < 0x10341)
  1850. return true;
  1851. if (cp === 0x10341)
  1852. return true;
  1853. if (cp < 0x10342)
  1854. return false;
  1855. if (cp < 0x1034a)
  1856. return true;
  1857. if (cp === 0x1034a)
  1858. return true;
  1859. if (cp < 0x10350)
  1860. return false;
  1861. if (cp < 0x10376)
  1862. return true;
  1863. return false;
  1864. }
  1865. if (cp < 0x1039e)
  1866. return true;
  1867. if (cp < 0x103a0)
  1868. return false;
  1869. if (cp < 0x103c4)
  1870. return true;
  1871. if (cp < 0x103c8)
  1872. return false;
  1873. if (cp < 0x103d0)
  1874. return true;
  1875. if (cp < 0x103d1)
  1876. return false;
  1877. if (cp < 0x103d6)
  1878. return true;
  1879. if (cp < 0x10400)
  1880. return false;
  1881. if (cp < 0x10450)
  1882. return true;
  1883. return false;
  1884. }
  1885. if (cp < 0x10600) {
  1886. if (cp < 0x10450)
  1887. return false;
  1888. if (cp < 0x1049e)
  1889. return true;
  1890. if (cp < 0x104b0)
  1891. return false;
  1892. if (cp < 0x104d4)
  1893. return true;
  1894. if (cp < 0x104d8)
  1895. return false;
  1896. if (cp < 0x104fc)
  1897. return true;
  1898. if (cp < 0x10500)
  1899. return false;
  1900. if (cp < 0x10528)
  1901. return true;
  1902. if (cp < 0x10530)
  1903. return false;
  1904. if (cp < 0x10564)
  1905. return true;
  1906. return false;
  1907. }
  1908. if (cp < 0x10737)
  1909. return true;
  1910. if (cp < 0x10740)
  1911. return false;
  1912. if (cp < 0x10756)
  1913. return true;
  1914. if (cp < 0x10760)
  1915. return false;
  1916. if (cp < 0x10768)
  1917. return true;
  1918. if (cp < 0x10800)
  1919. return false;
  1920. if (cp < 0x10806)
  1921. return true;
  1922. if (cp === 0x10808)
  1923. return true;
  1924. if (cp < 0x1080a)
  1925. return false;
  1926. if (cp < 0x10836)
  1927. return true;
  1928. return false;
  1929. }
  1930. if (cp < 0x109be) {
  1931. if (cp < 0x108e0) {
  1932. if (cp < 0x10837)
  1933. return false;
  1934. if (cp < 0x10839)
  1935. return true;
  1936. if (cp === 0x1083c)
  1937. return true;
  1938. if (cp < 0x1083f)
  1939. return false;
  1940. if (cp < 0x10856)
  1941. return true;
  1942. if (cp < 0x10860)
  1943. return false;
  1944. if (cp < 0x10877)
  1945. return true;
  1946. if (cp < 0x10880)
  1947. return false;
  1948. if (cp < 0x1089f)
  1949. return true;
  1950. return false;
  1951. }
  1952. if (cp < 0x108f3)
  1953. return true;
  1954. if (cp < 0x108f4)
  1955. return false;
  1956. if (cp < 0x108f6)
  1957. return true;
  1958. if (cp < 0x10900)
  1959. return false;
  1960. if (cp < 0x10916)
  1961. return true;
  1962. if (cp < 0x10920)
  1963. return false;
  1964. if (cp < 0x1093a)
  1965. return true;
  1966. if (cp < 0x10980)
  1967. return false;
  1968. if (cp < 0x109b8)
  1969. return true;
  1970. return false;
  1971. }
  1972. if (cp < 0x10a60) {
  1973. if (cp < 0x109be)
  1974. return false;
  1975. if (cp < 0x109c0)
  1976. return true;
  1977. if (cp === 0x10a00)
  1978. return true;
  1979. if (cp < 0x10a10)
  1980. return false;
  1981. if (cp < 0x10a14)
  1982. return true;
  1983. if (cp < 0x10a15)
  1984. return false;
  1985. if (cp < 0x10a18)
  1986. return true;
  1987. if (cp < 0x10a19)
  1988. return false;
  1989. if (cp < 0x10a36)
  1990. return true;
  1991. return false;
  1992. }
  1993. if (cp < 0x10a7d)
  1994. return true;
  1995. if (cp < 0x10a80)
  1996. return false;
  1997. if (cp < 0x10a9d)
  1998. return true;
  1999. if (cp < 0x10ac0)
  2000. return false;
  2001. if (cp < 0x10ac8)
  2002. return true;
  2003. if (cp < 0x10ac9)
  2004. return false;
  2005. if (cp < 0x10ae5)
  2006. return true;
  2007. if (cp < 0x10b00)
  2008. return false;
  2009. if (cp < 0x10b36)
  2010. return true;
  2011. if (cp < 0x10b40)
  2012. return false;
  2013. if (cp < 0x10b56)
  2014. return true;
  2015. return false;
  2016. }
  2017. if (cp < 0x16e40) {
  2018. if (cp < 0x11580) {
  2019. if (cp < 0x11213) {
  2020. if (cp < 0x11083) {
  2021. if (cp < 0x10d00) {
  2022. if (cp < 0x10b60)
  2023. return false;
  2024. if (cp < 0x10b73)
  2025. return true;
  2026. if (cp < 0x10b80)
  2027. return false;
  2028. if (cp < 0x10b92)
  2029. return true;
  2030. if (cp < 0x10c00)
  2031. return false;
  2032. if (cp < 0x10c49)
  2033. return true;
  2034. if (cp < 0x10c80)
  2035. return false;
  2036. if (cp < 0x10cb3)
  2037. return true;
  2038. if (cp < 0x10cc0)
  2039. return false;
  2040. if (cp < 0x10cf3)
  2041. return true;
  2042. return false;
  2043. }
  2044. if (cp < 0x10d24)
  2045. return true;
  2046. if (cp < 0x10f00)
  2047. return false;
  2048. if (cp < 0x10f1d)
  2049. return true;
  2050. if (cp === 0x10f27)
  2051. return true;
  2052. if (cp < 0x10f30)
  2053. return false;
  2054. if (cp < 0x10f46)
  2055. return true;
  2056. if (cp < 0x11003)
  2057. return false;
  2058. if (cp < 0x11038)
  2059. return true;
  2060. return false;
  2061. }
  2062. if (cp < 0x11176) {
  2063. if (cp < 0x11083)
  2064. return false;
  2065. if (cp < 0x110b0)
  2066. return true;
  2067. if (cp < 0x110d0)
  2068. return false;
  2069. if (cp < 0x110e9)
  2070. return true;
  2071. if (cp < 0x11103)
  2072. return false;
  2073. if (cp < 0x11127)
  2074. return true;
  2075. if (cp === 0x11144)
  2076. return true;
  2077. if (cp < 0x11150)
  2078. return false;
  2079. if (cp < 0x11173)
  2080. return true;
  2081. return false;
  2082. }
  2083. if (cp === 0x11176)
  2084. return true;
  2085. if (cp < 0x11183)
  2086. return false;
  2087. if (cp < 0x111b3)
  2088. return true;
  2089. if (cp < 0x111c1)
  2090. return false;
  2091. if (cp < 0x111c5)
  2092. return true;
  2093. if (cp === 0x111da)
  2094. return true;
  2095. if (cp === 0x111dc)
  2096. return true;
  2097. if (cp < 0x11200)
  2098. return false;
  2099. if (cp < 0x11212)
  2100. return true;
  2101. return false;
  2102. }
  2103. if (cp < 0x1132a) {
  2104. if (cp < 0x1129f) {
  2105. if (cp < 0x11213)
  2106. return false;
  2107. if (cp < 0x1122c)
  2108. return true;
  2109. if (cp < 0x11280)
  2110. return false;
  2111. if (cp < 0x11287)
  2112. return true;
  2113. if (cp === 0x11288)
  2114. return true;
  2115. if (cp < 0x1128a)
  2116. return false;
  2117. if (cp < 0x1128e)
  2118. return true;
  2119. if (cp < 0x1128f)
  2120. return false;
  2121. if (cp < 0x1129e)
  2122. return true;
  2123. return false;
  2124. }
  2125. if (cp < 0x112a9)
  2126. return true;
  2127. if (cp < 0x112b0)
  2128. return false;
  2129. if (cp < 0x112df)
  2130. return true;
  2131. if (cp < 0x11305)
  2132. return false;
  2133. if (cp < 0x1130d)
  2134. return true;
  2135. if (cp < 0x1130f)
  2136. return false;
  2137. if (cp < 0x11311)
  2138. return true;
  2139. if (cp < 0x11313)
  2140. return false;
  2141. if (cp < 0x11329)
  2142. return true;
  2143. return false;
  2144. }
  2145. if (cp < 0x1135d) {
  2146. if (cp < 0x1132a)
  2147. return false;
  2148. if (cp < 0x11331)
  2149. return true;
  2150. if (cp < 0x11332)
  2151. return false;
  2152. if (cp < 0x11334)
  2153. return true;
  2154. if (cp < 0x11335)
  2155. return false;
  2156. if (cp < 0x1133a)
  2157. return true;
  2158. if (cp === 0x1133d)
  2159. return true;
  2160. if (cp === 0x11350)
  2161. return true;
  2162. return false;
  2163. }
  2164. if (cp < 0x11362)
  2165. return true;
  2166. if (cp < 0x11400)
  2167. return false;
  2168. if (cp < 0x11435)
  2169. return true;
  2170. if (cp < 0x11447)
  2171. return false;
  2172. if (cp < 0x1144b)
  2173. return true;
  2174. if (cp < 0x11480)
  2175. return false;
  2176. if (cp < 0x114b0)
  2177. return true;
  2178. if (cp < 0x114c4)
  2179. return false;
  2180. if (cp < 0x114c6)
  2181. return true;
  2182. if (cp === 0x114c7)
  2183. return true;
  2184. return false;
  2185. }
  2186. if (cp < 0x11d00) {
  2187. if (cp < 0x11a0b) {
  2188. if (cp < 0x11700) {
  2189. if (cp < 0x11580)
  2190. return false;
  2191. if (cp < 0x115af)
  2192. return true;
  2193. if (cp < 0x115d8)
  2194. return false;
  2195. if (cp < 0x115dc)
  2196. return true;
  2197. if (cp < 0x11600)
  2198. return false;
  2199. if (cp < 0x11630)
  2200. return true;
  2201. if (cp === 0x11644)
  2202. return true;
  2203. if (cp < 0x11680)
  2204. return false;
  2205. if (cp < 0x116ab)
  2206. return true;
  2207. return false;
  2208. }
  2209. if (cp < 0x1171b)
  2210. return true;
  2211. if (cp < 0x11800)
  2212. return false;
  2213. if (cp < 0x1182c)
  2214. return true;
  2215. if (cp < 0x118a0)
  2216. return false;
  2217. if (cp < 0x118e0)
  2218. return true;
  2219. if (cp === 0x118ff)
  2220. return true;
  2221. if (cp === 0x11a00)
  2222. return true;
  2223. return false;
  2224. }
  2225. if (cp < 0x11a9d) {
  2226. if (cp < 0x11a0b)
  2227. return false;
  2228. if (cp < 0x11a33)
  2229. return true;
  2230. if (cp === 0x11a3a)
  2231. return true;
  2232. if (cp === 0x11a50)
  2233. return true;
  2234. if (cp < 0x11a5c)
  2235. return false;
  2236. if (cp < 0x11a84)
  2237. return true;
  2238. if (cp < 0x11a86)
  2239. return false;
  2240. if (cp < 0x11a8a)
  2241. return true;
  2242. return false;
  2243. }
  2244. if (cp === 0x11a9d)
  2245. return true;
  2246. if (cp < 0x11ac0)
  2247. return false;
  2248. if (cp < 0x11af9)
  2249. return true;
  2250. if (cp < 0x11c00)
  2251. return false;
  2252. if (cp < 0x11c09)
  2253. return true;
  2254. if (cp < 0x11c0a)
  2255. return false;
  2256. if (cp < 0x11c2f)
  2257. return true;
  2258. if (cp === 0x11c40)
  2259. return true;
  2260. if (cp < 0x11c72)
  2261. return false;
  2262. if (cp < 0x11c90)
  2263. return true;
  2264. return false;
  2265. }
  2266. if (cp < 0x12400) {
  2267. if (cp < 0x11d67) {
  2268. if (cp < 0x11d00)
  2269. return false;
  2270. if (cp < 0x11d07)
  2271. return true;
  2272. if (cp < 0x11d08)
  2273. return false;
  2274. if (cp < 0x11d0a)
  2275. return true;
  2276. if (cp < 0x11d0b)
  2277. return false;
  2278. if (cp < 0x11d31)
  2279. return true;
  2280. if (cp === 0x11d46)
  2281. return true;
  2282. if (cp < 0x11d60)
  2283. return false;
  2284. if (cp < 0x11d66)
  2285. return true;
  2286. return false;
  2287. }
  2288. if (cp < 0x11d69)
  2289. return true;
  2290. if (cp < 0x11d6a)
  2291. return false;
  2292. if (cp < 0x11d8a)
  2293. return true;
  2294. if (cp === 0x11d98)
  2295. return true;
  2296. if (cp < 0x11ee0)
  2297. return false;
  2298. if (cp < 0x11ef3)
  2299. return true;
  2300. if (cp < 0x12000)
  2301. return false;
  2302. if (cp < 0x1239a)
  2303. return true;
  2304. return false;
  2305. }
  2306. if (cp < 0x16a40) {
  2307. if (cp < 0x12400)
  2308. return false;
  2309. if (cp < 0x1246f)
  2310. return true;
  2311. if (cp < 0x12480)
  2312. return false;
  2313. if (cp < 0x12544)
  2314. return true;
  2315. if (cp < 0x13000)
  2316. return false;
  2317. if (cp < 0x1342f)
  2318. return true;
  2319. if (cp < 0x14400)
  2320. return false;
  2321. if (cp < 0x14647)
  2322. return true;
  2323. if (cp < 0x16800)
  2324. return false;
  2325. if (cp < 0x16a39)
  2326. return true;
  2327. return false;
  2328. }
  2329. if (cp < 0x16a5f)
  2330. return true;
  2331. if (cp < 0x16ad0)
  2332. return false;
  2333. if (cp < 0x16aee)
  2334. return true;
  2335. if (cp < 0x16b00)
  2336. return false;
  2337. if (cp < 0x16b30)
  2338. return true;
  2339. if (cp < 0x16b40)
  2340. return false;
  2341. if (cp < 0x16b44)
  2342. return true;
  2343. if (cp < 0x16b63)
  2344. return false;
  2345. if (cp < 0x16b78)
  2346. return true;
  2347. if (cp < 0x16b7d)
  2348. return false;
  2349. if (cp < 0x16b90)
  2350. return true;
  2351. return false;
  2352. }
  2353. if (cp < 0x1d7c4) {
  2354. if (cp < 0x1d4bd) {
  2355. if (cp < 0x1bc70) {
  2356. if (cp < 0x17000) {
  2357. if (cp < 0x16e40)
  2358. return false;
  2359. if (cp < 0x16e80)
  2360. return true;
  2361. if (cp < 0x16f00)
  2362. return false;
  2363. if (cp < 0x16f45)
  2364. return true;
  2365. if (cp === 0x16f50)
  2366. return true;
  2367. if (cp < 0x16f93)
  2368. return false;
  2369. if (cp < 0x16fa0)
  2370. return true;
  2371. if (cp < 0x16fe0)
  2372. return false;
  2373. if (cp < 0x16fe2)
  2374. return true;
  2375. return false;
  2376. }
  2377. if (cp < 0x187f2)
  2378. return true;
  2379. if (cp < 0x18800)
  2380. return false;
  2381. if (cp < 0x18af3)
  2382. return true;
  2383. if (cp < 0x1b000)
  2384. return false;
  2385. if (cp < 0x1b11f)
  2386. return true;
  2387. if (cp < 0x1b170)
  2388. return false;
  2389. if (cp < 0x1b2fc)
  2390. return true;
  2391. if (cp < 0x1bc00)
  2392. return false;
  2393. if (cp < 0x1bc6b)
  2394. return true;
  2395. return false;
  2396. }
  2397. if (cp < 0x1d49e) {
  2398. if (cp < 0x1bc70)
  2399. return false;
  2400. if (cp < 0x1bc7d)
  2401. return true;
  2402. if (cp < 0x1bc80)
  2403. return false;
  2404. if (cp < 0x1bc89)
  2405. return true;
  2406. if (cp < 0x1bc90)
  2407. return false;
  2408. if (cp < 0x1bc9a)
  2409. return true;
  2410. if (cp < 0x1d400)
  2411. return false;
  2412. if (cp < 0x1d455)
  2413. return true;
  2414. if (cp < 0x1d456)
  2415. return false;
  2416. if (cp < 0x1d49d)
  2417. return true;
  2418. return false;
  2419. }
  2420. if (cp < 0x1d4a0)
  2421. return true;
  2422. if (cp === 0x1d4a2)
  2423. return true;
  2424. if (cp < 0x1d4a5)
  2425. return false;
  2426. if (cp < 0x1d4a7)
  2427. return true;
  2428. if (cp < 0x1d4a9)
  2429. return false;
  2430. if (cp < 0x1d4ad)
  2431. return true;
  2432. if (cp < 0x1d4ae)
  2433. return false;
  2434. if (cp < 0x1d4ba)
  2435. return true;
  2436. if (cp === 0x1d4bb)
  2437. return true;
  2438. return false;
  2439. }
  2440. if (cp < 0x1d552) {
  2441. if (cp < 0x1d51e) {
  2442. if (cp < 0x1d4bd)
  2443. return false;
  2444. if (cp < 0x1d4c4)
  2445. return true;
  2446. if (cp < 0x1d4c5)
  2447. return false;
  2448. if (cp < 0x1d506)
  2449. return true;
  2450. if (cp < 0x1d507)
  2451. return false;
  2452. if (cp < 0x1d50b)
  2453. return true;
  2454. if (cp < 0x1d50d)
  2455. return false;
  2456. if (cp < 0x1d515)
  2457. return true;
  2458. if (cp < 0x1d516)
  2459. return false;
  2460. if (cp < 0x1d51d)
  2461. return true;
  2462. return false;
  2463. }
  2464. if (cp < 0x1d53a)
  2465. return true;
  2466. if (cp < 0x1d53b)
  2467. return false;
  2468. if (cp < 0x1d53f)
  2469. return true;
  2470. if (cp < 0x1d540)
  2471. return false;
  2472. if (cp < 0x1d545)
  2473. return true;
  2474. if (cp === 0x1d546)
  2475. return true;
  2476. if (cp < 0x1d54a)
  2477. return false;
  2478. if (cp < 0x1d551)
  2479. return true;
  2480. return false;
  2481. }
  2482. if (cp < 0x1d716) {
  2483. if (cp < 0x1d552)
  2484. return false;
  2485. if (cp < 0x1d6a6)
  2486. return true;
  2487. if (cp < 0x1d6a8)
  2488. return false;
  2489. if (cp < 0x1d6c1)
  2490. return true;
  2491. if (cp < 0x1d6c2)
  2492. return false;
  2493. if (cp < 0x1d6db)
  2494. return true;
  2495. if (cp < 0x1d6dc)
  2496. return false;
  2497. if (cp < 0x1d6fb)
  2498. return true;
  2499. if (cp < 0x1d6fc)
  2500. return false;
  2501. if (cp < 0x1d715)
  2502. return true;
  2503. return false;
  2504. }
  2505. if (cp < 0x1d735)
  2506. return true;
  2507. if (cp < 0x1d736)
  2508. return false;
  2509. if (cp < 0x1d74f)
  2510. return true;
  2511. if (cp < 0x1d750)
  2512. return false;
  2513. if (cp < 0x1d76f)
  2514. return true;
  2515. if (cp < 0x1d770)
  2516. return false;
  2517. if (cp < 0x1d789)
  2518. return true;
  2519. if (cp < 0x1d78a)
  2520. return false;
  2521. if (cp < 0x1d7a9)
  2522. return true;
  2523. if (cp < 0x1d7aa)
  2524. return false;
  2525. if (cp < 0x1d7c3)
  2526. return true;
  2527. return false;
  2528. }
  2529. if (cp < 0x1ee5b) {
  2530. if (cp < 0x1ee39) {
  2531. if (cp < 0x1ee21) {
  2532. if (cp < 0x1d7c4)
  2533. return false;
  2534. if (cp < 0x1d7cc)
  2535. return true;
  2536. if (cp < 0x1e800)
  2537. return false;
  2538. if (cp < 0x1e8c5)
  2539. return true;
  2540. if (cp < 0x1e900)
  2541. return false;
  2542. if (cp < 0x1e944)
  2543. return true;
  2544. if (cp < 0x1ee00)
  2545. return false;
  2546. if (cp < 0x1ee04)
  2547. return true;
  2548. if (cp < 0x1ee05)
  2549. return false;
  2550. if (cp < 0x1ee20)
  2551. return true;
  2552. return false;
  2553. }
  2554. if (cp < 0x1ee23)
  2555. return true;
  2556. if (cp === 0x1ee24)
  2557. return true;
  2558. if (cp === 0x1ee27)
  2559. return true;
  2560. if (cp < 0x1ee29)
  2561. return false;
  2562. if (cp < 0x1ee33)
  2563. return true;
  2564. if (cp < 0x1ee34)
  2565. return false;
  2566. if (cp < 0x1ee38)
  2567. return true;
  2568. return false;
  2569. }
  2570. if (cp < 0x1ee4b) {
  2571. if (cp === 0x1ee39)
  2572. return true;
  2573. if (cp === 0x1ee3b)
  2574. return true;
  2575. if (cp === 0x1ee42)
  2576. return true;
  2577. if (cp === 0x1ee47)
  2578. return true;
  2579. if (cp === 0x1ee49)
  2580. return true;
  2581. return false;
  2582. }
  2583. if (cp === 0x1ee4b)
  2584. return true;
  2585. if (cp < 0x1ee4d)
  2586. return false;
  2587. if (cp < 0x1ee50)
  2588. return true;
  2589. if (cp < 0x1ee51)
  2590. return false;
  2591. if (cp < 0x1ee53)
  2592. return true;
  2593. if (cp === 0x1ee54)
  2594. return true;
  2595. if (cp === 0x1ee57)
  2596. return true;
  2597. if (cp === 0x1ee59)
  2598. return true;
  2599. return false;
  2600. }
  2601. if (cp < 0x1ee80) {
  2602. if (cp < 0x1ee67) {
  2603. if (cp === 0x1ee5b)
  2604. return true;
  2605. if (cp === 0x1ee5d)
  2606. return true;
  2607. if (cp === 0x1ee5f)
  2608. return true;
  2609. if (cp < 0x1ee61)
  2610. return false;
  2611. if (cp < 0x1ee63)
  2612. return true;
  2613. if (cp === 0x1ee64)
  2614. return true;
  2615. return false;
  2616. }
  2617. if (cp < 0x1ee6b)
  2618. return true;
  2619. if (cp < 0x1ee6c)
  2620. return false;
  2621. if (cp < 0x1ee73)
  2622. return true;
  2623. if (cp < 0x1ee74)
  2624. return false;
  2625. if (cp < 0x1ee78)
  2626. return true;
  2627. if (cp < 0x1ee79)
  2628. return false;
  2629. if (cp < 0x1ee7d)
  2630. return true;
  2631. if (cp === 0x1ee7e)
  2632. return true;
  2633. return false;
  2634. }
  2635. if (cp < 0x20000) {
  2636. if (cp < 0x1ee80)
  2637. return false;
  2638. if (cp < 0x1ee8a)
  2639. return true;
  2640. if (cp < 0x1ee8b)
  2641. return false;
  2642. if (cp < 0x1ee9c)
  2643. return true;
  2644. if (cp < 0x1eea1)
  2645. return false;
  2646. if (cp < 0x1eea4)
  2647. return true;
  2648. if (cp < 0x1eea5)
  2649. return false;
  2650. if (cp < 0x1eeaa)
  2651. return true;
  2652. if (cp < 0x1eeab)
  2653. return false;
  2654. if (cp < 0x1eebc)
  2655. return true;
  2656. return false;
  2657. }
  2658. if (cp < 0x2a6d7)
  2659. return true;
  2660. if (cp < 0x2a700)
  2661. return false;
  2662. if (cp < 0x2b735)
  2663. return true;
  2664. if (cp < 0x2b740)
  2665. return false;
  2666. if (cp < 0x2b81e)
  2667. return true;
  2668. if (cp < 0x2b820)
  2669. return false;
  2670. if (cp < 0x2cea2)
  2671. return true;
  2672. if (cp < 0x2ceb0)
  2673. return false;
  2674. if (cp < 0x2ebe1)
  2675. return true;
  2676. if (cp < 0x2f800)
  2677. return false;
  2678. if (cp < 0x2fa1e)
  2679. return true;
  2680. return false;
  2681. }
  2682. function isLargeIdContinue(cp) {
  2683. if (cp < 0x1cd0) {
  2684. if (cp < 0xd82) {
  2685. if (cp < 0xa83) {
  2686. if (cp < 0x93b) {
  2687. if (cp < 0x6ea) {
  2688. if (cp < 0x5c7) {
  2689. if (cp === 0xb7)
  2690. return true;
  2691. if (cp < 0x300)
  2692. return false;
  2693. if (cp < 0x370)
  2694. return true;
  2695. if (cp === 0x387)
  2696. return true;
  2697. if (cp < 0x483)
  2698. return false;
  2699. if (cp < 0x488)
  2700. return true;
  2701. if (cp < 0x591)
  2702. return false;
  2703. if (cp < 0x5be)
  2704. return true;
  2705. if (cp === 0x5bf)
  2706. return true;
  2707. if (cp < 0x5c1)
  2708. return false;
  2709. if (cp < 0x5c3)
  2710. return true;
  2711. if (cp < 0x5c4)
  2712. return false;
  2713. if (cp < 0x5c6)
  2714. return true;
  2715. return false;
  2716. }
  2717. if (cp === 0x5c7)
  2718. return true;
  2719. if (cp < 0x610)
  2720. return false;
  2721. if (cp < 0x61b)
  2722. return true;
  2723. if (cp < 0x64b)
  2724. return false;
  2725. if (cp < 0x660)
  2726. return true;
  2727. if (cp < 0x660)
  2728. return false;
  2729. if (cp < 0x66a)
  2730. return true;
  2731. if (cp === 0x670)
  2732. return true;
  2733. if (cp < 0x6d6)
  2734. return false;
  2735. if (cp < 0x6dd)
  2736. return true;
  2737. if (cp < 0x6df)
  2738. return false;
  2739. if (cp < 0x6e5)
  2740. return true;
  2741. if (cp < 0x6e7)
  2742. return false;
  2743. if (cp < 0x6e9)
  2744. return true;
  2745. return false;
  2746. }
  2747. if (cp < 0x816) {
  2748. if (cp < 0x6ea)
  2749. return false;
  2750. if (cp < 0x6ee)
  2751. return true;
  2752. if (cp < 0x6f0)
  2753. return false;
  2754. if (cp < 0x6fa)
  2755. return true;
  2756. if (cp === 0x711)
  2757. return true;
  2758. if (cp < 0x730)
  2759. return false;
  2760. if (cp < 0x74b)
  2761. return true;
  2762. if (cp < 0x7a6)
  2763. return false;
  2764. if (cp < 0x7b1)
  2765. return true;
  2766. if (cp < 0x7c0)
  2767. return false;
  2768. if (cp < 0x7ca)
  2769. return true;
  2770. if (cp < 0x7eb)
  2771. return false;
  2772. if (cp < 0x7f4)
  2773. return true;
  2774. if (cp === 0x7fd)
  2775. return true;
  2776. return false;
  2777. }
  2778. if (cp < 0x81a)
  2779. return true;
  2780. if (cp < 0x81b)
  2781. return false;
  2782. if (cp < 0x824)
  2783. return true;
  2784. if (cp < 0x825)
  2785. return false;
  2786. if (cp < 0x828)
  2787. return true;
  2788. if (cp < 0x829)
  2789. return false;
  2790. if (cp < 0x82e)
  2791. return true;
  2792. if (cp < 0x859)
  2793. return false;
  2794. if (cp < 0x85c)
  2795. return true;
  2796. if (cp < 0x8d3)
  2797. return false;
  2798. if (cp < 0x8e2)
  2799. return true;
  2800. if (cp < 0x8e3)
  2801. return false;
  2802. if (cp < 0x903)
  2803. return true;
  2804. if (cp === 0x903)
  2805. return true;
  2806. if (cp === 0x93a)
  2807. return true;
  2808. return false;
  2809. }
  2810. if (cp < 0x9cd) {
  2811. if (cp < 0x962) {
  2812. if (cp === 0x93b)
  2813. return true;
  2814. if (cp === 0x93c)
  2815. return true;
  2816. if (cp < 0x93e)
  2817. return false;
  2818. if (cp < 0x941)
  2819. return true;
  2820. if (cp < 0x941)
  2821. return false;
  2822. if (cp < 0x949)
  2823. return true;
  2824. if (cp < 0x949)
  2825. return false;
  2826. if (cp < 0x94d)
  2827. return true;
  2828. if (cp === 0x94d)
  2829. return true;
  2830. if (cp < 0x94e)
  2831. return false;
  2832. if (cp < 0x950)
  2833. return true;
  2834. if (cp < 0x951)
  2835. return false;
  2836. if (cp < 0x958)
  2837. return true;
  2838. return false;
  2839. }
  2840. if (cp < 0x964)
  2841. return true;
  2842. if (cp < 0x966)
  2843. return false;
  2844. if (cp < 0x970)
  2845. return true;
  2846. if (cp === 0x981)
  2847. return true;
  2848. if (cp < 0x982)
  2849. return false;
  2850. if (cp < 0x984)
  2851. return true;
  2852. if (cp === 0x9bc)
  2853. return true;
  2854. if (cp < 0x9be)
  2855. return false;
  2856. if (cp < 0x9c1)
  2857. return true;
  2858. if (cp < 0x9c1)
  2859. return false;
  2860. if (cp < 0x9c5)
  2861. return true;
  2862. if (cp < 0x9c7)
  2863. return false;
  2864. if (cp < 0x9c9)
  2865. return true;
  2866. if (cp < 0x9cb)
  2867. return false;
  2868. if (cp < 0x9cd)
  2869. return true;
  2870. return false;
  2871. }
  2872. if (cp < 0xa3e) {
  2873. if (cp === 0x9cd)
  2874. return true;
  2875. if (cp === 0x9d7)
  2876. return true;
  2877. if (cp < 0x9e2)
  2878. return false;
  2879. if (cp < 0x9e4)
  2880. return true;
  2881. if (cp < 0x9e6)
  2882. return false;
  2883. if (cp < 0x9f0)
  2884. return true;
  2885. if (cp === 0x9fe)
  2886. return true;
  2887. if (cp < 0xa01)
  2888. return false;
  2889. if (cp < 0xa03)
  2890. return true;
  2891. if (cp === 0xa03)
  2892. return true;
  2893. if (cp === 0xa3c)
  2894. return true;
  2895. return false;
  2896. }
  2897. if (cp < 0xa41)
  2898. return true;
  2899. if (cp < 0xa41)
  2900. return false;
  2901. if (cp < 0xa43)
  2902. return true;
  2903. if (cp < 0xa47)
  2904. return false;
  2905. if (cp < 0xa49)
  2906. return true;
  2907. if (cp < 0xa4b)
  2908. return false;
  2909. if (cp < 0xa4e)
  2910. return true;
  2911. if (cp === 0xa51)
  2912. return true;
  2913. if (cp < 0xa66)
  2914. return false;
  2915. if (cp < 0xa70)
  2916. return true;
  2917. if (cp < 0xa70)
  2918. return false;
  2919. if (cp < 0xa72)
  2920. return true;
  2921. if (cp === 0xa75)
  2922. return true;
  2923. if (cp < 0xa81)
  2924. return false;
  2925. if (cp < 0xa83)
  2926. return true;
  2927. return false;
  2928. }
  2929. if (cp < 0xc00) {
  2930. if (cp < 0xb41) {
  2931. if (cp < 0xae2) {
  2932. if (cp === 0xa83)
  2933. return true;
  2934. if (cp === 0xabc)
  2935. return true;
  2936. if (cp < 0xabe)
  2937. return false;
  2938. if (cp < 0xac1)
  2939. return true;
  2940. if (cp < 0xac1)
  2941. return false;
  2942. if (cp < 0xac6)
  2943. return true;
  2944. if (cp < 0xac7)
  2945. return false;
  2946. if (cp < 0xac9)
  2947. return true;
  2948. if (cp === 0xac9)
  2949. return true;
  2950. if (cp < 0xacb)
  2951. return false;
  2952. if (cp < 0xacd)
  2953. return true;
  2954. if (cp === 0xacd)
  2955. return true;
  2956. return false;
  2957. }
  2958. if (cp < 0xae4)
  2959. return true;
  2960. if (cp < 0xae6)
  2961. return false;
  2962. if (cp < 0xaf0)
  2963. return true;
  2964. if (cp < 0xafa)
  2965. return false;
  2966. if (cp < 0xb00)
  2967. return true;
  2968. if (cp === 0xb01)
  2969. return true;
  2970. if (cp < 0xb02)
  2971. return false;
  2972. if (cp < 0xb04)
  2973. return true;
  2974. if (cp === 0xb3c)
  2975. return true;
  2976. if (cp === 0xb3e)
  2977. return true;
  2978. if (cp === 0xb3f)
  2979. return true;
  2980. if (cp === 0xb40)
  2981. return true;
  2982. return false;
  2983. }
  2984. if (cp < 0xb82) {
  2985. if (cp < 0xb41)
  2986. return false;
  2987. if (cp < 0xb45)
  2988. return true;
  2989. if (cp < 0xb47)
  2990. return false;
  2991. if (cp < 0xb49)
  2992. return true;
  2993. if (cp < 0xb4b)
  2994. return false;
  2995. if (cp < 0xb4d)
  2996. return true;
  2997. if (cp === 0xb4d)
  2998. return true;
  2999. if (cp === 0xb56)
  3000. return true;
  3001. if (cp === 0xb57)
  3002. return true;
  3003. if (cp < 0xb62)
  3004. return false;
  3005. if (cp < 0xb64)
  3006. return true;
  3007. if (cp < 0xb66)
  3008. return false;
  3009. if (cp < 0xb70)
  3010. return true;
  3011. return false;
  3012. }
  3013. if (cp === 0xb82)
  3014. return true;
  3015. if (cp < 0xbbe)
  3016. return false;
  3017. if (cp < 0xbc0)
  3018. return true;
  3019. if (cp === 0xbc0)
  3020. return true;
  3021. if (cp < 0xbc1)
  3022. return false;
  3023. if (cp < 0xbc3)
  3024. return true;
  3025. if (cp < 0xbc6)
  3026. return false;
  3027. if (cp < 0xbc9)
  3028. return true;
  3029. if (cp < 0xbca)
  3030. return false;
  3031. if (cp < 0xbcd)
  3032. return true;
  3033. if (cp === 0xbcd)
  3034. return true;
  3035. if (cp === 0xbd7)
  3036. return true;
  3037. if (cp < 0xbe6)
  3038. return false;
  3039. if (cp < 0xbf0)
  3040. return true;
  3041. return false;
  3042. }
  3043. if (cp < 0xcc7) {
  3044. if (cp < 0xc62) {
  3045. if (cp === 0xc00)
  3046. return true;
  3047. if (cp < 0xc01)
  3048. return false;
  3049. if (cp < 0xc04)
  3050. return true;
  3051. if (cp === 0xc04)
  3052. return true;
  3053. if (cp < 0xc3e)
  3054. return false;
  3055. if (cp < 0xc41)
  3056. return true;
  3057. if (cp < 0xc41)
  3058. return false;
  3059. if (cp < 0xc45)
  3060. return true;
  3061. if (cp < 0xc46)
  3062. return false;
  3063. if (cp < 0xc49)
  3064. return true;
  3065. if (cp < 0xc4a)
  3066. return false;
  3067. if (cp < 0xc4e)
  3068. return true;
  3069. if (cp < 0xc55)
  3070. return false;
  3071. if (cp < 0xc57)
  3072. return true;
  3073. return false;
  3074. }
  3075. if (cp < 0xc64)
  3076. return true;
  3077. if (cp < 0xc66)
  3078. return false;
  3079. if (cp < 0xc70)
  3080. return true;
  3081. if (cp === 0xc81)
  3082. return true;
  3083. if (cp < 0xc82)
  3084. return false;
  3085. if (cp < 0xc84)
  3086. return true;
  3087. if (cp === 0xcbc)
  3088. return true;
  3089. if (cp === 0xcbe)
  3090. return true;
  3091. if (cp === 0xcbf)
  3092. return true;
  3093. if (cp < 0xcc0)
  3094. return false;
  3095. if (cp < 0xcc5)
  3096. return true;
  3097. if (cp === 0xcc6)
  3098. return true;
  3099. return false;
  3100. }
  3101. if (cp < 0xd3b) {
  3102. if (cp < 0xcc7)
  3103. return false;
  3104. if (cp < 0xcc9)
  3105. return true;
  3106. if (cp < 0xcca)
  3107. return false;
  3108. if (cp < 0xccc)
  3109. return true;
  3110. if (cp < 0xccc)
  3111. return false;
  3112. if (cp < 0xcce)
  3113. return true;
  3114. if (cp < 0xcd5)
  3115. return false;
  3116. if (cp < 0xcd7)
  3117. return true;
  3118. if (cp < 0xce2)
  3119. return false;
  3120. if (cp < 0xce4)
  3121. return true;
  3122. if (cp < 0xce6)
  3123. return false;
  3124. if (cp < 0xcf0)
  3125. return true;
  3126. if (cp < 0xd00)
  3127. return false;
  3128. if (cp < 0xd02)
  3129. return true;
  3130. if (cp < 0xd02)
  3131. return false;
  3132. if (cp < 0xd04)
  3133. return true;
  3134. return false;
  3135. }
  3136. if (cp < 0xd3d)
  3137. return true;
  3138. if (cp < 0xd3e)
  3139. return false;
  3140. if (cp < 0xd41)
  3141. return true;
  3142. if (cp < 0xd41)
  3143. return false;
  3144. if (cp < 0xd45)
  3145. return true;
  3146. if (cp < 0xd46)
  3147. return false;
  3148. if (cp < 0xd49)
  3149. return true;
  3150. if (cp < 0xd4a)
  3151. return false;
  3152. if (cp < 0xd4d)
  3153. return true;
  3154. if (cp === 0xd4d)
  3155. return true;
  3156. if (cp === 0xd57)
  3157. return true;
  3158. if (cp < 0xd62)
  3159. return false;
  3160. if (cp < 0xd64)
  3161. return true;
  3162. if (cp < 0xd66)
  3163. return false;
  3164. if (cp < 0xd70)
  3165. return true;
  3166. return false;
  3167. }
  3168. if (cp < 0x17e0) {
  3169. if (cp < 0x1038) {
  3170. if (cp < 0xf18) {
  3171. if (cp < 0xe31) {
  3172. if (cp < 0xd82)
  3173. return false;
  3174. if (cp < 0xd84)
  3175. return true;
  3176. if (cp === 0xdca)
  3177. return true;
  3178. if (cp < 0xdcf)
  3179. return false;
  3180. if (cp < 0xdd2)
  3181. return true;
  3182. if (cp < 0xdd2)
  3183. return false;
  3184. if (cp < 0xdd5)
  3185. return true;
  3186. if (cp === 0xdd6)
  3187. return true;
  3188. if (cp < 0xdd8)
  3189. return false;
  3190. if (cp < 0xde0)
  3191. return true;
  3192. if (cp < 0xde6)
  3193. return false;
  3194. if (cp < 0xdf0)
  3195. return true;
  3196. if (cp < 0xdf2)
  3197. return false;
  3198. if (cp < 0xdf4)
  3199. return true;
  3200. return false;
  3201. }
  3202. if (cp === 0xe31)
  3203. return true;
  3204. if (cp < 0xe34)
  3205. return false;
  3206. if (cp < 0xe3b)
  3207. return true;
  3208. if (cp < 0xe47)
  3209. return false;
  3210. if (cp < 0xe4f)
  3211. return true;
  3212. if (cp < 0xe50)
  3213. return false;
  3214. if (cp < 0xe5a)
  3215. return true;
  3216. if (cp === 0xeb1)
  3217. return true;
  3218. if (cp < 0xeb4)
  3219. return false;
  3220. if (cp < 0xeba)
  3221. return true;
  3222. if (cp < 0xebb)
  3223. return false;
  3224. if (cp < 0xebd)
  3225. return true;
  3226. if (cp < 0xec8)
  3227. return false;
  3228. if (cp < 0xece)
  3229. return true;
  3230. if (cp < 0xed0)
  3231. return false;
  3232. if (cp < 0xeda)
  3233. return true;
  3234. return false;
  3235. }
  3236. if (cp < 0xf80) {
  3237. if (cp < 0xf18)
  3238. return false;
  3239. if (cp < 0xf1a)
  3240. return true;
  3241. if (cp < 0xf20)
  3242. return false;
  3243. if (cp < 0xf2a)
  3244. return true;
  3245. if (cp === 0xf35)
  3246. return true;
  3247. if (cp === 0xf37)
  3248. return true;
  3249. if (cp === 0xf39)
  3250. return true;
  3251. if (cp < 0xf3e)
  3252. return false;
  3253. if (cp < 0xf40)
  3254. return true;
  3255. if (cp < 0xf71)
  3256. return false;
  3257. if (cp < 0xf7f)
  3258. return true;
  3259. if (cp === 0xf7f)
  3260. return true;
  3261. return false;
  3262. }
  3263. if (cp < 0xf85)
  3264. return true;
  3265. if (cp < 0xf86)
  3266. return false;
  3267. if (cp < 0xf88)
  3268. return true;
  3269. if (cp < 0xf8d)
  3270. return false;
  3271. if (cp < 0xf98)
  3272. return true;
  3273. if (cp < 0xf99)
  3274. return false;
  3275. if (cp < 0xfbd)
  3276. return true;
  3277. if (cp === 0xfc6)
  3278. return true;
  3279. if (cp < 0x102b)
  3280. return false;
  3281. if (cp < 0x102d)
  3282. return true;
  3283. if (cp < 0x102d)
  3284. return false;
  3285. if (cp < 0x1031)
  3286. return true;
  3287. if (cp === 0x1031)
  3288. return true;
  3289. if (cp < 0x1032)
  3290. return false;
  3291. if (cp < 0x1038)
  3292. return true;
  3293. return false;
  3294. }
  3295. if (cp < 0x1090) {
  3296. if (cp < 0x1062) {
  3297. if (cp === 0x1038)
  3298. return true;
  3299. if (cp < 0x1039)
  3300. return false;
  3301. if (cp < 0x103b)
  3302. return true;
  3303. if (cp < 0x103b)
  3304. return false;
  3305. if (cp < 0x103d)
  3306. return true;
  3307. if (cp < 0x103d)
  3308. return false;
  3309. if (cp < 0x103f)
  3310. return true;
  3311. if (cp < 0x1040)
  3312. return false;
  3313. if (cp < 0x104a)
  3314. return true;
  3315. if (cp < 0x1056)
  3316. return false;
  3317. if (cp < 0x1058)
  3318. return true;
  3319. if (cp < 0x1058)
  3320. return false;
  3321. if (cp < 0x105a)
  3322. return true;
  3323. if (cp < 0x105e)
  3324. return false;
  3325. if (cp < 0x1061)
  3326. return true;
  3327. return false;
  3328. }
  3329. if (cp < 0x1065)
  3330. return true;
  3331. if (cp < 0x1067)
  3332. return false;
  3333. if (cp < 0x106e)
  3334. return true;
  3335. if (cp < 0x1071)
  3336. return false;
  3337. if (cp < 0x1075)
  3338. return true;
  3339. if (cp === 0x1082)
  3340. return true;
  3341. if (cp < 0x1083)
  3342. return false;
  3343. if (cp < 0x1085)
  3344. return true;
  3345. if (cp < 0x1085)
  3346. return false;
  3347. if (cp < 0x1087)
  3348. return true;
  3349. if (cp < 0x1087)
  3350. return false;
  3351. if (cp < 0x108d)
  3352. return true;
  3353. if (cp === 0x108d)
  3354. return true;
  3355. if (cp === 0x108f)
  3356. return true;
  3357. return false;
  3358. }
  3359. if (cp < 0x1772) {
  3360. if (cp < 0x1090)
  3361. return false;
  3362. if (cp < 0x109a)
  3363. return true;
  3364. if (cp < 0x109a)
  3365. return false;
  3366. if (cp < 0x109d)
  3367. return true;
  3368. if (cp === 0x109d)
  3369. return true;
  3370. if (cp < 0x135d)
  3371. return false;
  3372. if (cp < 0x1360)
  3373. return true;
  3374. if (cp < 0x1369)
  3375. return false;
  3376. if (cp < 0x1372)
  3377. return true;
  3378. if (cp < 0x1712)
  3379. return false;
  3380. if (cp < 0x1715)
  3381. return true;
  3382. if (cp < 0x1732)
  3383. return false;
  3384. if (cp < 0x1735)
  3385. return true;
  3386. if (cp < 0x1752)
  3387. return false;
  3388. if (cp < 0x1754)
  3389. return true;
  3390. return false;
  3391. }
  3392. if (cp < 0x1774)
  3393. return true;
  3394. if (cp < 0x17b4)
  3395. return false;
  3396. if (cp < 0x17b6)
  3397. return true;
  3398. if (cp === 0x17b6)
  3399. return true;
  3400. if (cp < 0x17b7)
  3401. return false;
  3402. if (cp < 0x17be)
  3403. return true;
  3404. if (cp < 0x17be)
  3405. return false;
  3406. if (cp < 0x17c6)
  3407. return true;
  3408. if (cp === 0x17c6)
  3409. return true;
  3410. if (cp < 0x17c7)
  3411. return false;
  3412. if (cp < 0x17c9)
  3413. return true;
  3414. if (cp < 0x17c9)
  3415. return false;
  3416. if (cp < 0x17d4)
  3417. return true;
  3418. if (cp === 0x17dd)
  3419. return true;
  3420. return false;
  3421. }
  3422. if (cp < 0x1b04) {
  3423. if (cp < 0x1a1b) {
  3424. if (cp < 0x1930) {
  3425. if (cp < 0x17e0)
  3426. return false;
  3427. if (cp < 0x17ea)
  3428. return true;
  3429. if (cp < 0x180b)
  3430. return false;
  3431. if (cp < 0x180e)
  3432. return true;
  3433. if (cp < 0x1810)
  3434. return false;
  3435. if (cp < 0x181a)
  3436. return true;
  3437. if (cp === 0x18a9)
  3438. return true;
  3439. if (cp < 0x1920)
  3440. return false;
  3441. if (cp < 0x1923)
  3442. return true;
  3443. if (cp < 0x1923)
  3444. return false;
  3445. if (cp < 0x1927)
  3446. return true;
  3447. if (cp < 0x1927)
  3448. return false;
  3449. if (cp < 0x1929)
  3450. return true;
  3451. if (cp < 0x1929)
  3452. return false;
  3453. if (cp < 0x192c)
  3454. return true;
  3455. return false;
  3456. }
  3457. if (cp < 0x1932)
  3458. return true;
  3459. if (cp === 0x1932)
  3460. return true;
  3461. if (cp < 0x1933)
  3462. return false;
  3463. if (cp < 0x1939)
  3464. return true;
  3465. if (cp < 0x1939)
  3466. return false;
  3467. if (cp < 0x193c)
  3468. return true;
  3469. if (cp < 0x1946)
  3470. return false;
  3471. if (cp < 0x1950)
  3472. return true;
  3473. if (cp < 0x19d0)
  3474. return false;
  3475. if (cp < 0x19da)
  3476. return true;
  3477. if (cp === 0x19da)
  3478. return true;
  3479. if (cp < 0x1a17)
  3480. return false;
  3481. if (cp < 0x1a19)
  3482. return true;
  3483. if (cp < 0x1a19)
  3484. return false;
  3485. if (cp < 0x1a1b)
  3486. return true;
  3487. return false;
  3488. }
  3489. if (cp < 0x1a63) {
  3490. if (cp === 0x1a1b)
  3491. return true;
  3492. if (cp === 0x1a55)
  3493. return true;
  3494. if (cp === 0x1a56)
  3495. return true;
  3496. if (cp === 0x1a57)
  3497. return true;
  3498. if (cp < 0x1a58)
  3499. return false;
  3500. if (cp < 0x1a5f)
  3501. return true;
  3502. if (cp === 0x1a60)
  3503. return true;
  3504. if (cp === 0x1a61)
  3505. return true;
  3506. if (cp === 0x1a62)
  3507. return true;
  3508. return false;
  3509. }
  3510. if (cp < 0x1a65)
  3511. return true;
  3512. if (cp < 0x1a65)
  3513. return false;
  3514. if (cp < 0x1a6d)
  3515. return true;
  3516. if (cp < 0x1a6d)
  3517. return false;
  3518. if (cp < 0x1a73)
  3519. return true;
  3520. if (cp < 0x1a73)
  3521. return false;
  3522. if (cp < 0x1a7d)
  3523. return true;
  3524. if (cp === 0x1a7f)
  3525. return true;
  3526. if (cp < 0x1a80)
  3527. return false;
  3528. if (cp < 0x1a8a)
  3529. return true;
  3530. if (cp < 0x1a90)
  3531. return false;
  3532. if (cp < 0x1a9a)
  3533. return true;
  3534. if (cp < 0x1ab0)
  3535. return false;
  3536. if (cp < 0x1abe)
  3537. return true;
  3538. if (cp < 0x1b00)
  3539. return false;
  3540. if (cp < 0x1b04)
  3541. return true;
  3542. return false;
  3543. }
  3544. if (cp < 0x1baa) {
  3545. if (cp < 0x1b43) {
  3546. if (cp === 0x1b04)
  3547. return true;
  3548. if (cp === 0x1b34)
  3549. return true;
  3550. if (cp === 0x1b35)
  3551. return true;
  3552. if (cp < 0x1b36)
  3553. return false;
  3554. if (cp < 0x1b3b)
  3555. return true;
  3556. if (cp === 0x1b3b)
  3557. return true;
  3558. if (cp === 0x1b3c)
  3559. return true;
  3560. if (cp < 0x1b3d)
  3561. return false;
  3562. if (cp < 0x1b42)
  3563. return true;
  3564. if (cp === 0x1b42)
  3565. return true;
  3566. return false;
  3567. }
  3568. if (cp < 0x1b45)
  3569. return true;
  3570. if (cp < 0x1b50)
  3571. return false;
  3572. if (cp < 0x1b5a)
  3573. return true;
  3574. if (cp < 0x1b6b)
  3575. return false;
  3576. if (cp < 0x1b74)
  3577. return true;
  3578. if (cp < 0x1b80)
  3579. return false;
  3580. if (cp < 0x1b82)
  3581. return true;
  3582. if (cp === 0x1b82)
  3583. return true;
  3584. if (cp === 0x1ba1)
  3585. return true;
  3586. if (cp < 0x1ba2)
  3587. return false;
  3588. if (cp < 0x1ba6)
  3589. return true;
  3590. if (cp < 0x1ba6)
  3591. return false;
  3592. if (cp < 0x1ba8)
  3593. return true;
  3594. if (cp < 0x1ba8)
  3595. return false;
  3596. if (cp < 0x1baa)
  3597. return true;
  3598. return false;
  3599. }
  3600. if (cp < 0x1bee) {
  3601. if (cp === 0x1baa)
  3602. return true;
  3603. if (cp < 0x1bab)
  3604. return false;
  3605. if (cp < 0x1bae)
  3606. return true;
  3607. if (cp < 0x1bb0)
  3608. return false;
  3609. if (cp < 0x1bba)
  3610. return true;
  3611. if (cp === 0x1be6)
  3612. return true;
  3613. if (cp === 0x1be7)
  3614. return true;
  3615. if (cp < 0x1be8)
  3616. return false;
  3617. if (cp < 0x1bea)
  3618. return true;
  3619. if (cp < 0x1bea)
  3620. return false;
  3621. if (cp < 0x1bed)
  3622. return true;
  3623. if (cp === 0x1bed)
  3624. return true;
  3625. return false;
  3626. }
  3627. if (cp === 0x1bee)
  3628. return true;
  3629. if (cp < 0x1bef)
  3630. return false;
  3631. if (cp < 0x1bf2)
  3632. return true;
  3633. if (cp < 0x1bf2)
  3634. return false;
  3635. if (cp < 0x1bf4)
  3636. return true;
  3637. if (cp < 0x1c24)
  3638. return false;
  3639. if (cp < 0x1c2c)
  3640. return true;
  3641. if (cp < 0x1c2c)
  3642. return false;
  3643. if (cp < 0x1c34)
  3644. return true;
  3645. if (cp < 0x1c34)
  3646. return false;
  3647. if (cp < 0x1c36)
  3648. return true;
  3649. if (cp < 0x1c36)
  3650. return false;
  3651. if (cp < 0x1c38)
  3652. return true;
  3653. if (cp < 0x1c40)
  3654. return false;
  3655. if (cp < 0x1c4a)
  3656. return true;
  3657. if (cp < 0x1c50)
  3658. return false;
  3659. if (cp < 0x1c5a)
  3660. return true;
  3661. return false;
  3662. }
  3663. if (cp < 0x1123e) {
  3664. if (cp < 0xaab7) {
  3665. if (cp < 0xa8b4) {
  3666. if (cp < 0x2d7f) {
  3667. if (cp < 0x1cf8) {
  3668. if (cp < 0x1cd0)
  3669. return false;
  3670. if (cp < 0x1cd3)
  3671. return true;
  3672. if (cp < 0x1cd4)
  3673. return false;
  3674. if (cp < 0x1ce1)
  3675. return true;
  3676. if (cp === 0x1ce1)
  3677. return true;
  3678. if (cp < 0x1ce2)
  3679. return false;
  3680. if (cp < 0x1ce9)
  3681. return true;
  3682. if (cp === 0x1ced)
  3683. return true;
  3684. if (cp < 0x1cf2)
  3685. return false;
  3686. if (cp < 0x1cf4)
  3687. return true;
  3688. if (cp === 0x1cf4)
  3689. return true;
  3690. if (cp === 0x1cf7)
  3691. return true;
  3692. return false;
  3693. }
  3694. if (cp < 0x1cfa)
  3695. return true;
  3696. if (cp < 0x1dc0)
  3697. return false;
  3698. if (cp < 0x1dfa)
  3699. return true;
  3700. if (cp < 0x1dfb)
  3701. return false;
  3702. if (cp < 0x1e00)
  3703. return true;
  3704. if (cp < 0x203f)
  3705. return false;
  3706. if (cp < 0x2041)
  3707. return true;
  3708. if (cp === 0x2054)
  3709. return true;
  3710. if (cp < 0x20d0)
  3711. return false;
  3712. if (cp < 0x20dd)
  3713. return true;
  3714. if (cp === 0x20e1)
  3715. return true;
  3716. if (cp < 0x20e5)
  3717. return false;
  3718. if (cp < 0x20f1)
  3719. return true;
  3720. if (cp < 0x2cef)
  3721. return false;
  3722. if (cp < 0x2cf2)
  3723. return true;
  3724. return false;
  3725. }
  3726. if (cp < 0xa69e) {
  3727. if (cp === 0x2d7f)
  3728. return true;
  3729. if (cp < 0x2de0)
  3730. return false;
  3731. if (cp < 0x2e00)
  3732. return true;
  3733. if (cp < 0x302a)
  3734. return false;
  3735. if (cp < 0x302e)
  3736. return true;
  3737. if (cp < 0x302e)
  3738. return false;
  3739. if (cp < 0x3030)
  3740. return true;
  3741. if (cp < 0x3099)
  3742. return false;
  3743. if (cp < 0x309b)
  3744. return true;
  3745. if (cp < 0xa620)
  3746. return false;
  3747. if (cp < 0xa62a)
  3748. return true;
  3749. if (cp === 0xa66f)
  3750. return true;
  3751. if (cp < 0xa674)
  3752. return false;
  3753. if (cp < 0xa67e)
  3754. return true;
  3755. return false;
  3756. }
  3757. if (cp < 0xa6a0)
  3758. return true;
  3759. if (cp < 0xa6f0)
  3760. return false;
  3761. if (cp < 0xa6f2)
  3762. return true;
  3763. if (cp === 0xa802)
  3764. return true;
  3765. if (cp === 0xa806)
  3766. return true;
  3767. if (cp === 0xa80b)
  3768. return true;
  3769. if (cp < 0xa823)
  3770. return false;
  3771. if (cp < 0xa825)
  3772. return true;
  3773. if (cp < 0xa825)
  3774. return false;
  3775. if (cp < 0xa827)
  3776. return true;
  3777. if (cp === 0xa827)
  3778. return true;
  3779. if (cp < 0xa880)
  3780. return false;
  3781. if (cp < 0xa882)
  3782. return true;
  3783. return false;
  3784. }
  3785. if (cp < 0xa9d0) {
  3786. if (cp < 0xa952) {
  3787. if (cp < 0xa8b4)
  3788. return false;
  3789. if (cp < 0xa8c4)
  3790. return true;
  3791. if (cp < 0xa8c4)
  3792. return false;
  3793. if (cp < 0xa8c6)
  3794. return true;
  3795. if (cp < 0xa8d0)
  3796. return false;
  3797. if (cp < 0xa8da)
  3798. return true;
  3799. if (cp < 0xa8e0)
  3800. return false;
  3801. if (cp < 0xa8f2)
  3802. return true;
  3803. if (cp === 0xa8ff)
  3804. return true;
  3805. if (cp < 0xa900)
  3806. return false;
  3807. if (cp < 0xa90a)
  3808. return true;
  3809. if (cp < 0xa926)
  3810. return false;
  3811. if (cp < 0xa92e)
  3812. return true;
  3813. if (cp < 0xa947)
  3814. return false;
  3815. if (cp < 0xa952)
  3816. return true;
  3817. return false;
  3818. }
  3819. if (cp < 0xa954)
  3820. return true;
  3821. if (cp < 0xa980)
  3822. return false;
  3823. if (cp < 0xa983)
  3824. return true;
  3825. if (cp === 0xa983)
  3826. return true;
  3827. if (cp === 0xa9b3)
  3828. return true;
  3829. if (cp < 0xa9b4)
  3830. return false;
  3831. if (cp < 0xa9b6)
  3832. return true;
  3833. if (cp < 0xa9b6)
  3834. return false;
  3835. if (cp < 0xa9ba)
  3836. return true;
  3837. if (cp < 0xa9ba)
  3838. return false;
  3839. if (cp < 0xa9bc)
  3840. return true;
  3841. if (cp === 0xa9bc)
  3842. return true;
  3843. if (cp < 0xa9bd)
  3844. return false;
  3845. if (cp < 0xa9c1)
  3846. return true;
  3847. return false;
  3848. }
  3849. if (cp < 0xaa43) {
  3850. if (cp < 0xa9d0)
  3851. return false;
  3852. if (cp < 0xa9da)
  3853. return true;
  3854. if (cp === 0xa9e5)
  3855. return true;
  3856. if (cp < 0xa9f0)
  3857. return false;
  3858. if (cp < 0xa9fa)
  3859. return true;
  3860. if (cp < 0xaa29)
  3861. return false;
  3862. if (cp < 0xaa2f)
  3863. return true;
  3864. if (cp < 0xaa2f)
  3865. return false;
  3866. if (cp < 0xaa31)
  3867. return true;
  3868. if (cp < 0xaa31)
  3869. return false;
  3870. if (cp < 0xaa33)
  3871. return true;
  3872. if (cp < 0xaa33)
  3873. return false;
  3874. if (cp < 0xaa35)
  3875. return true;
  3876. if (cp < 0xaa35)
  3877. return false;
  3878. if (cp < 0xaa37)
  3879. return true;
  3880. return false;
  3881. }
  3882. if (cp === 0xaa43)
  3883. return true;
  3884. if (cp === 0xaa4c)
  3885. return true;
  3886. if (cp === 0xaa4d)
  3887. return true;
  3888. if (cp < 0xaa50)
  3889. return false;
  3890. if (cp < 0xaa5a)
  3891. return true;
  3892. if (cp === 0xaa7b)
  3893. return true;
  3894. if (cp === 0xaa7c)
  3895. return true;
  3896. if (cp === 0xaa7d)
  3897. return true;
  3898. if (cp === 0xaab0)
  3899. return true;
  3900. if (cp < 0xaab2)
  3901. return false;
  3902. if (cp < 0xaab5)
  3903. return true;
  3904. return false;
  3905. }
  3906. if (cp < 0x10d30) {
  3907. if (cp < 0xfe00) {
  3908. if (cp < 0xabe3) {
  3909. if (cp < 0xaab7)
  3910. return false;
  3911. if (cp < 0xaab9)
  3912. return true;
  3913. if (cp < 0xaabe)
  3914. return false;
  3915. if (cp < 0xaac0)
  3916. return true;
  3917. if (cp === 0xaac1)
  3918. return true;
  3919. if (cp === 0xaaeb)
  3920. return true;
  3921. if (cp < 0xaaec)
  3922. return false;
  3923. if (cp < 0xaaee)
  3924. return true;
  3925. if (cp < 0xaaee)
  3926. return false;
  3927. if (cp < 0xaaf0)
  3928. return true;
  3929. if (cp === 0xaaf5)
  3930. return true;
  3931. if (cp === 0xaaf6)
  3932. return true;
  3933. return false;
  3934. }
  3935. if (cp < 0xabe5)
  3936. return true;
  3937. if (cp === 0xabe5)
  3938. return true;
  3939. if (cp < 0xabe6)
  3940. return false;
  3941. if (cp < 0xabe8)
  3942. return true;
  3943. if (cp === 0xabe8)
  3944. return true;
  3945. if (cp < 0xabe9)
  3946. return false;
  3947. if (cp < 0xabeb)
  3948. return true;
  3949. if (cp === 0xabec)
  3950. return true;
  3951. if (cp === 0xabed)
  3952. return true;
  3953. if (cp < 0xabf0)
  3954. return false;
  3955. if (cp < 0xabfa)
  3956. return true;
  3957. if (cp === 0xfb1e)
  3958. return true;
  3959. return false;
  3960. }
  3961. if (cp < 0x10376) {
  3962. if (cp < 0xfe00)
  3963. return false;
  3964. if (cp < 0xfe10)
  3965. return true;
  3966. if (cp < 0xfe20)
  3967. return false;
  3968. if (cp < 0xfe30)
  3969. return true;
  3970. if (cp < 0xfe33)
  3971. return false;
  3972. if (cp < 0xfe35)
  3973. return true;
  3974. if (cp < 0xfe4d)
  3975. return false;
  3976. if (cp < 0xfe50)
  3977. return true;
  3978. if (cp < 0xff10)
  3979. return false;
  3980. if (cp < 0xff1a)
  3981. return true;
  3982. if (cp === 0xff3f)
  3983. return true;
  3984. if (cp === 0x101fd)
  3985. return true;
  3986. if (cp === 0x102e0)
  3987. return true;
  3988. return false;
  3989. }
  3990. if (cp < 0x1037b)
  3991. return true;
  3992. if (cp < 0x104a0)
  3993. return false;
  3994. if (cp < 0x104aa)
  3995. return true;
  3996. if (cp < 0x10a01)
  3997. return false;
  3998. if (cp < 0x10a04)
  3999. return true;
  4000. if (cp < 0x10a05)
  4001. return false;
  4002. if (cp < 0x10a07)
  4003. return true;
  4004. if (cp < 0x10a0c)
  4005. return false;
  4006. if (cp < 0x10a10)
  4007. return true;
  4008. if (cp < 0x10a38)
  4009. return false;
  4010. if (cp < 0x10a3b)
  4011. return true;
  4012. if (cp === 0x10a3f)
  4013. return true;
  4014. if (cp < 0x10ae5)
  4015. return false;
  4016. if (cp < 0x10ae7)
  4017. return true;
  4018. if (cp < 0x10d24)
  4019. return false;
  4020. if (cp < 0x10d28)
  4021. return true;
  4022. return false;
  4023. }
  4024. if (cp < 0x1112d) {
  4025. if (cp < 0x11082) {
  4026. if (cp < 0x10d30)
  4027. return false;
  4028. if (cp < 0x10d3a)
  4029. return true;
  4030. if (cp < 0x10f46)
  4031. return false;
  4032. if (cp < 0x10f51)
  4033. return true;
  4034. if (cp === 0x11000)
  4035. return true;
  4036. if (cp === 0x11001)
  4037. return true;
  4038. if (cp === 0x11002)
  4039. return true;
  4040. if (cp < 0x11038)
  4041. return false;
  4042. if (cp < 0x11047)
  4043. return true;
  4044. if (cp < 0x11066)
  4045. return false;
  4046. if (cp < 0x11070)
  4047. return true;
  4048. if (cp < 0x1107f)
  4049. return false;
  4050. if (cp < 0x11082)
  4051. return true;
  4052. return false;
  4053. }
  4054. if (cp === 0x11082)
  4055. return true;
  4056. if (cp < 0x110b0)
  4057. return false;
  4058. if (cp < 0x110b3)
  4059. return true;
  4060. if (cp < 0x110b3)
  4061. return false;
  4062. if (cp < 0x110b7)
  4063. return true;
  4064. if (cp < 0x110b7)
  4065. return false;
  4066. if (cp < 0x110b9)
  4067. return true;
  4068. if (cp < 0x110b9)
  4069. return false;
  4070. if (cp < 0x110bb)
  4071. return true;
  4072. if (cp < 0x110f0)
  4073. return false;
  4074. if (cp < 0x110fa)
  4075. return true;
  4076. if (cp < 0x11100)
  4077. return false;
  4078. if (cp < 0x11103)
  4079. return true;
  4080. if (cp < 0x11127)
  4081. return false;
  4082. if (cp < 0x1112c)
  4083. return true;
  4084. if (cp === 0x1112c)
  4085. return true;
  4086. return false;
  4087. }
  4088. if (cp < 0x111bf) {
  4089. if (cp < 0x1112d)
  4090. return false;
  4091. if (cp < 0x11135)
  4092. return true;
  4093. if (cp < 0x11136)
  4094. return false;
  4095. if (cp < 0x11140)
  4096. return true;
  4097. if (cp < 0x11145)
  4098. return false;
  4099. if (cp < 0x11147)
  4100. return true;
  4101. if (cp === 0x11173)
  4102. return true;
  4103. if (cp < 0x11180)
  4104. return false;
  4105. if (cp < 0x11182)
  4106. return true;
  4107. if (cp === 0x11182)
  4108. return true;
  4109. if (cp < 0x111b3)
  4110. return false;
  4111. if (cp < 0x111b6)
  4112. return true;
  4113. if (cp < 0x111b6)
  4114. return false;
  4115. if (cp < 0x111bf)
  4116. return true;
  4117. return false;
  4118. }
  4119. if (cp < 0x111c1)
  4120. return true;
  4121. if (cp < 0x111c9)
  4122. return false;
  4123. if (cp < 0x111cd)
  4124. return true;
  4125. if (cp < 0x111d0)
  4126. return false;
  4127. if (cp < 0x111da)
  4128. return true;
  4129. if (cp < 0x1122c)
  4130. return false;
  4131. if (cp < 0x1122f)
  4132. return true;
  4133. if (cp < 0x1122f)
  4134. return false;
  4135. if (cp < 0x11232)
  4136. return true;
  4137. if (cp < 0x11232)
  4138. return false;
  4139. if (cp < 0x11234)
  4140. return true;
  4141. if (cp === 0x11234)
  4142. return true;
  4143. if (cp === 0x11235)
  4144. return true;
  4145. if (cp < 0x11236)
  4146. return false;
  4147. if (cp < 0x11238)
  4148. return true;
  4149. return false;
  4150. }
  4151. if (cp < 0x11a33) {
  4152. if (cp < 0x115af) {
  4153. if (cp < 0x11435) {
  4154. if (cp < 0x1133e) {
  4155. if (cp === 0x1123e)
  4156. return true;
  4157. if (cp === 0x112df)
  4158. return true;
  4159. if (cp < 0x112e0)
  4160. return false;
  4161. if (cp < 0x112e3)
  4162. return true;
  4163. if (cp < 0x112e3)
  4164. return false;
  4165. if (cp < 0x112eb)
  4166. return true;
  4167. if (cp < 0x112f0)
  4168. return false;
  4169. if (cp < 0x112fa)
  4170. return true;
  4171. if (cp < 0x11300)
  4172. return false;
  4173. if (cp < 0x11302)
  4174. return true;
  4175. if (cp < 0x11302)
  4176. return false;
  4177. if (cp < 0x11304)
  4178. return true;
  4179. if (cp < 0x1133b)
  4180. return false;
  4181. if (cp < 0x1133d)
  4182. return true;
  4183. return false;
  4184. }
  4185. if (cp < 0x11340)
  4186. return true;
  4187. if (cp === 0x11340)
  4188. return true;
  4189. if (cp < 0x11341)
  4190. return false;
  4191. if (cp < 0x11345)
  4192. return true;
  4193. if (cp < 0x11347)
  4194. return false;
  4195. if (cp < 0x11349)
  4196. return true;
  4197. if (cp < 0x1134b)
  4198. return false;
  4199. if (cp < 0x1134e)
  4200. return true;
  4201. if (cp === 0x11357)
  4202. return true;
  4203. if (cp < 0x11362)
  4204. return false;
  4205. if (cp < 0x11364)
  4206. return true;
  4207. if (cp < 0x11366)
  4208. return false;
  4209. if (cp < 0x1136d)
  4210. return true;
  4211. if (cp < 0x11370)
  4212. return false;
  4213. if (cp < 0x11375)
  4214. return true;
  4215. return false;
  4216. }
  4217. if (cp < 0x114b0) {
  4218. if (cp < 0x11435)
  4219. return false;
  4220. if (cp < 0x11438)
  4221. return true;
  4222. if (cp < 0x11438)
  4223. return false;
  4224. if (cp < 0x11440)
  4225. return true;
  4226. if (cp < 0x11440)
  4227. return false;
  4228. if (cp < 0x11442)
  4229. return true;
  4230. if (cp < 0x11442)
  4231. return false;
  4232. if (cp < 0x11445)
  4233. return true;
  4234. if (cp === 0x11445)
  4235. return true;
  4236. if (cp === 0x11446)
  4237. return true;
  4238. if (cp < 0x11450)
  4239. return false;
  4240. if (cp < 0x1145a)
  4241. return true;
  4242. if (cp === 0x1145e)
  4243. return true;
  4244. return false;
  4245. }
  4246. if (cp < 0x114b3)
  4247. return true;
  4248. if (cp < 0x114b3)
  4249. return false;
  4250. if (cp < 0x114b9)
  4251. return true;
  4252. if (cp === 0x114b9)
  4253. return true;
  4254. if (cp === 0x114ba)
  4255. return true;
  4256. if (cp < 0x114bb)
  4257. return false;
  4258. if (cp < 0x114bf)
  4259. return true;
  4260. if (cp < 0x114bf)
  4261. return false;
  4262. if (cp < 0x114c1)
  4263. return true;
  4264. if (cp === 0x114c1)
  4265. return true;
  4266. if (cp < 0x114c2)
  4267. return false;
  4268. if (cp < 0x114c4)
  4269. return true;
  4270. if (cp < 0x114d0)
  4271. return false;
  4272. if (cp < 0x114da)
  4273. return true;
  4274. return false;
  4275. }
  4276. if (cp < 0x116ae) {
  4277. if (cp < 0x11633) {
  4278. if (cp < 0x115af)
  4279. return false;
  4280. if (cp < 0x115b2)
  4281. return true;
  4282. if (cp < 0x115b2)
  4283. return false;
  4284. if (cp < 0x115b6)
  4285. return true;
  4286. if (cp < 0x115b8)
  4287. return false;
  4288. if (cp < 0x115bc)
  4289. return true;
  4290. if (cp < 0x115bc)
  4291. return false;
  4292. if (cp < 0x115be)
  4293. return true;
  4294. if (cp === 0x115be)
  4295. return true;
  4296. if (cp < 0x115bf)
  4297. return false;
  4298. if (cp < 0x115c1)
  4299. return true;
  4300. if (cp < 0x115dc)
  4301. return false;
  4302. if (cp < 0x115de)
  4303. return true;
  4304. if (cp < 0x11630)
  4305. return false;
  4306. if (cp < 0x11633)
  4307. return true;
  4308. return false;
  4309. }
  4310. if (cp < 0x1163b)
  4311. return true;
  4312. if (cp < 0x1163b)
  4313. return false;
  4314. if (cp < 0x1163d)
  4315. return true;
  4316. if (cp === 0x1163d)
  4317. return true;
  4318. if (cp === 0x1163e)
  4319. return true;
  4320. if (cp < 0x1163f)
  4321. return false;
  4322. if (cp < 0x11641)
  4323. return true;
  4324. if (cp < 0x11650)
  4325. return false;
  4326. if (cp < 0x1165a)
  4327. return true;
  4328. if (cp === 0x116ab)
  4329. return true;
  4330. if (cp === 0x116ac)
  4331. return true;
  4332. if (cp === 0x116ad)
  4333. return true;
  4334. return false;
  4335. }
  4336. if (cp < 0x11726) {
  4337. if (cp < 0x116ae)
  4338. return false;
  4339. if (cp < 0x116b0)
  4340. return true;
  4341. if (cp < 0x116b0)
  4342. return false;
  4343. if (cp < 0x116b6)
  4344. return true;
  4345. if (cp === 0x116b6)
  4346. return true;
  4347. if (cp === 0x116b7)
  4348. return true;
  4349. if (cp < 0x116c0)
  4350. return false;
  4351. if (cp < 0x116ca)
  4352. return true;
  4353. if (cp < 0x1171d)
  4354. return false;
  4355. if (cp < 0x11720)
  4356. return true;
  4357. if (cp < 0x11720)
  4358. return false;
  4359. if (cp < 0x11722)
  4360. return true;
  4361. if (cp < 0x11722)
  4362. return false;
  4363. if (cp < 0x11726)
  4364. return true;
  4365. return false;
  4366. }
  4367. if (cp === 0x11726)
  4368. return true;
  4369. if (cp < 0x11727)
  4370. return false;
  4371. if (cp < 0x1172c)
  4372. return true;
  4373. if (cp < 0x11730)
  4374. return false;
  4375. if (cp < 0x1173a)
  4376. return true;
  4377. if (cp < 0x1182c)
  4378. return false;
  4379. if (cp < 0x1182f)
  4380. return true;
  4381. if (cp < 0x1182f)
  4382. return false;
  4383. if (cp < 0x11838)
  4384. return true;
  4385. if (cp === 0x11838)
  4386. return true;
  4387. if (cp < 0x11839)
  4388. return false;
  4389. if (cp < 0x1183b)
  4390. return true;
  4391. if (cp < 0x118e0)
  4392. return false;
  4393. if (cp < 0x118ea)
  4394. return true;
  4395. if (cp < 0x11a01)
  4396. return false;
  4397. if (cp < 0x11a0b)
  4398. return true;
  4399. return false;
  4400. }
  4401. if (cp < 0x11d97) {
  4402. if (cp < 0x11ca9) {
  4403. if (cp < 0x11a97) {
  4404. if (cp < 0x11a33)
  4405. return false;
  4406. if (cp < 0x11a39)
  4407. return true;
  4408. if (cp === 0x11a39)
  4409. return true;
  4410. if (cp < 0x11a3b)
  4411. return false;
  4412. if (cp < 0x11a3f)
  4413. return true;
  4414. if (cp === 0x11a47)
  4415. return true;
  4416. if (cp < 0x11a51)
  4417. return false;
  4418. if (cp < 0x11a57)
  4419. return true;
  4420. if (cp < 0x11a57)
  4421. return false;
  4422. if (cp < 0x11a59)
  4423. return true;
  4424. if (cp < 0x11a59)
  4425. return false;
  4426. if (cp < 0x11a5c)
  4427. return true;
  4428. if (cp < 0x11a8a)
  4429. return false;
  4430. if (cp < 0x11a97)
  4431. return true;
  4432. return false;
  4433. }
  4434. if (cp === 0x11a97)
  4435. return true;
  4436. if (cp < 0x11a98)
  4437. return false;
  4438. if (cp < 0x11a9a)
  4439. return true;
  4440. if (cp === 0x11c2f)
  4441. return true;
  4442. if (cp < 0x11c30)
  4443. return false;
  4444. if (cp < 0x11c37)
  4445. return true;
  4446. if (cp < 0x11c38)
  4447. return false;
  4448. if (cp < 0x11c3e)
  4449. return true;
  4450. if (cp === 0x11c3e)
  4451. return true;
  4452. if (cp === 0x11c3f)
  4453. return true;
  4454. if (cp < 0x11c50)
  4455. return false;
  4456. if (cp < 0x11c5a)
  4457. return true;
  4458. if (cp < 0x11c92)
  4459. return false;
  4460. if (cp < 0x11ca8)
  4461. return true;
  4462. return false;
  4463. }
  4464. if (cp < 0x11d3c) {
  4465. if (cp === 0x11ca9)
  4466. return true;
  4467. if (cp < 0x11caa)
  4468. return false;
  4469. if (cp < 0x11cb1)
  4470. return true;
  4471. if (cp === 0x11cb1)
  4472. return true;
  4473. if (cp < 0x11cb2)
  4474. return false;
  4475. if (cp < 0x11cb4)
  4476. return true;
  4477. if (cp === 0x11cb4)
  4478. return true;
  4479. if (cp < 0x11cb5)
  4480. return false;
  4481. if (cp < 0x11cb7)
  4482. return true;
  4483. if (cp < 0x11d31)
  4484. return false;
  4485. if (cp < 0x11d37)
  4486. return true;
  4487. if (cp === 0x11d3a)
  4488. return true;
  4489. return false;
  4490. }
  4491. if (cp < 0x11d3e)
  4492. return true;
  4493. if (cp < 0x11d3f)
  4494. return false;
  4495. if (cp < 0x11d46)
  4496. return true;
  4497. if (cp === 0x11d47)
  4498. return true;
  4499. if (cp < 0x11d50)
  4500. return false;
  4501. if (cp < 0x11d5a)
  4502. return true;
  4503. if (cp < 0x11d8a)
  4504. return false;
  4505. if (cp < 0x11d8f)
  4506. return true;
  4507. if (cp < 0x11d90)
  4508. return false;
  4509. if (cp < 0x11d92)
  4510. return true;
  4511. if (cp < 0x11d93)
  4512. return false;
  4513. if (cp < 0x11d95)
  4514. return true;
  4515. if (cp === 0x11d95)
  4516. return true;
  4517. if (cp === 0x11d96)
  4518. return true;
  4519. return false;
  4520. }
  4521. if (cp < 0x1d242) {
  4522. if (cp < 0x16f51) {
  4523. if (cp === 0x11d97)
  4524. return true;
  4525. if (cp < 0x11da0)
  4526. return false;
  4527. if (cp < 0x11daa)
  4528. return true;
  4529. if (cp < 0x11ef3)
  4530. return false;
  4531. if (cp < 0x11ef5)
  4532. return true;
  4533. if (cp < 0x11ef5)
  4534. return false;
  4535. if (cp < 0x11ef7)
  4536. return true;
  4537. if (cp < 0x16a60)
  4538. return false;
  4539. if (cp < 0x16a6a)
  4540. return true;
  4541. if (cp < 0x16af0)
  4542. return false;
  4543. if (cp < 0x16af5)
  4544. return true;
  4545. if (cp < 0x16b30)
  4546. return false;
  4547. if (cp < 0x16b37)
  4548. return true;
  4549. if (cp < 0x16b50)
  4550. return false;
  4551. if (cp < 0x16b5a)
  4552. return true;
  4553. return false;
  4554. }
  4555. if (cp < 0x16f7f)
  4556. return true;
  4557. if (cp < 0x16f8f)
  4558. return false;
  4559. if (cp < 0x16f93)
  4560. return true;
  4561. if (cp < 0x1bc9d)
  4562. return false;
  4563. if (cp < 0x1bc9f)
  4564. return true;
  4565. if (cp < 0x1d165)
  4566. return false;
  4567. if (cp < 0x1d167)
  4568. return true;
  4569. if (cp < 0x1d167)
  4570. return false;
  4571. if (cp < 0x1d16a)
  4572. return true;
  4573. if (cp < 0x1d16d)
  4574. return false;
  4575. if (cp < 0x1d173)
  4576. return true;
  4577. if (cp < 0x1d17b)
  4578. return false;
  4579. if (cp < 0x1d183)
  4580. return true;
  4581. if (cp < 0x1d185)
  4582. return false;
  4583. if (cp < 0x1d18c)
  4584. return true;
  4585. if (cp < 0x1d1aa)
  4586. return false;
  4587. if (cp < 0x1d1ae)
  4588. return true;
  4589. return false;
  4590. }
  4591. if (cp < 0x1e000) {
  4592. if (cp < 0x1d242)
  4593. return false;
  4594. if (cp < 0x1d245)
  4595. return true;
  4596. if (cp < 0x1d7ce)
  4597. return false;
  4598. if (cp < 0x1d800)
  4599. return true;
  4600. if (cp < 0x1da00)
  4601. return false;
  4602. if (cp < 0x1da37)
  4603. return true;
  4604. if (cp < 0x1da3b)
  4605. return false;
  4606. if (cp < 0x1da6d)
  4607. return true;
  4608. if (cp === 0x1da75)
  4609. return true;
  4610. if (cp === 0x1da84)
  4611. return true;
  4612. if (cp < 0x1da9b)
  4613. return false;
  4614. if (cp < 0x1daa0)
  4615. return true;
  4616. if (cp < 0x1daa1)
  4617. return false;
  4618. if (cp < 0x1dab0)
  4619. return true;
  4620. return false;
  4621. }
  4622. if (cp < 0x1e007)
  4623. return true;
  4624. if (cp < 0x1e008)
  4625. return false;
  4626. if (cp < 0x1e019)
  4627. return true;
  4628. if (cp < 0x1e01b)
  4629. return false;
  4630. if (cp < 0x1e022)
  4631. return true;
  4632. if (cp < 0x1e023)
  4633. return false;
  4634. if (cp < 0x1e025)
  4635. return true;
  4636. if (cp < 0x1e026)
  4637. return false;
  4638. if (cp < 0x1e02b)
  4639. return true;
  4640. if (cp < 0x1e8d0)
  4641. return false;
  4642. if (cp < 0x1e8d7)
  4643. return true;
  4644. if (cp < 0x1e944)
  4645. return false;
  4646. if (cp < 0x1e94b)
  4647. return true;
  4648. if (cp < 0x1e950)
  4649. return false;
  4650. if (cp < 0x1e95a)
  4651. return true;
  4652. if (cp < 0xe0100)
  4653. return false;
  4654. if (cp < 0xe01f0)
  4655. return true;
  4656. return false;
  4657. }
  4658. const PropertyData = {
  4659. $LONE: new Set([
  4660. "ASCII",
  4661. "ASCII_Hex_Digit",
  4662. "AHex",
  4663. "Alphabetic",
  4664. "Alpha",
  4665. "Any",
  4666. "Assigned",
  4667. "Bidi_Control",
  4668. "Bidi_C",
  4669. "Bidi_Mirrored",
  4670. "Bidi_M",
  4671. "Case_Ignorable",
  4672. "CI",
  4673. "Cased",
  4674. "Changes_When_Casefolded",
  4675. "CWCF",
  4676. "Changes_When_Casemapped",
  4677. "CWCM",
  4678. "Changes_When_Lowercased",
  4679. "CWL",
  4680. "Changes_When_NFKC_Casefolded",
  4681. "CWKCF",
  4682. "Changes_When_Titlecased",
  4683. "CWT",
  4684. "Changes_When_Uppercased",
  4685. "CWU",
  4686. "Dash",
  4687. "Default_Ignorable_Code_Point",
  4688. "DI",
  4689. "Deprecated",
  4690. "Dep",
  4691. "Diacritic",
  4692. "Dia",
  4693. "Emoji",
  4694. "Emoji_Component",
  4695. "Emoji_Modifier",
  4696. "Emoji_Modifier_Base",
  4697. "Emoji_Presentation",
  4698. "Extender",
  4699. "Ext",
  4700. "Grapheme_Base",
  4701. "Gr_Base",
  4702. "Grapheme_Extend",
  4703. "Gr_Ext",
  4704. "Hex_Digit",
  4705. "Hex",
  4706. "IDS_Binary_Operator",
  4707. "IDSB",
  4708. "IDS_Trinary_Operator",
  4709. "IDST",
  4710. "ID_Continue",
  4711. "IDC",
  4712. "ID_Start",
  4713. "IDS",
  4714. "Ideographic",
  4715. "Ideo",
  4716. "Join_Control",
  4717. "Join_C",
  4718. "Logical_Order_Exception",
  4719. "LOE",
  4720. "Lowercase",
  4721. "Lower",
  4722. "Math",
  4723. "Noncharacter_Code_Point",
  4724. "NChar",
  4725. "Pattern_Syntax",
  4726. "Pat_Syn",
  4727. "Pattern_White_Space",
  4728. "Pat_WS",
  4729. "Quotation_Mark",
  4730. "QMark",
  4731. "Radical",
  4732. "Regional_Indicator",
  4733. "RI",
  4734. "Sentence_Terminal",
  4735. "STerm",
  4736. "Soft_Dotted",
  4737. "SD",
  4738. "Terminal_Punctuation",
  4739. "Term",
  4740. "Unified_Ideograph",
  4741. "UIdeo",
  4742. "Uppercase",
  4743. "Upper",
  4744. "Variation_Selector",
  4745. "VS",
  4746. "White_Space",
  4747. "space",
  4748. "XID_Continue",
  4749. "XIDC",
  4750. "XID_Start",
  4751. "XIDS",
  4752. ]),
  4753. General_Category: new Set([
  4754. "Cased_Letter",
  4755. "LC",
  4756. "Close_Punctuation",
  4757. "Pe",
  4758. "Connector_Punctuation",
  4759. "Pc",
  4760. "Control",
  4761. "Cc",
  4762. "cntrl",
  4763. "Currency_Symbol",
  4764. "Sc",
  4765. "Dash_Punctuation",
  4766. "Pd",
  4767. "Decimal_Number",
  4768. "Nd",
  4769. "digit",
  4770. "Enclosing_Mark",
  4771. "Me",
  4772. "Final_Punctuation",
  4773. "Pf",
  4774. "Format",
  4775. "Cf",
  4776. "Initial_Punctuation",
  4777. "Pi",
  4778. "Letter",
  4779. "L",
  4780. "Letter_Number",
  4781. "Nl",
  4782. "Line_Separator",
  4783. "Zl",
  4784. "Lowercase_Letter",
  4785. "Ll",
  4786. "Mark",
  4787. "M",
  4788. "Combining_Mark",
  4789. "Math_Symbol",
  4790. "Sm",
  4791. "Modifier_Letter",
  4792. "Lm",
  4793. "Modifier_Symbol",
  4794. "Sk",
  4795. "Nonspacing_Mark",
  4796. "Mn",
  4797. "Number",
  4798. "N",
  4799. "Open_Punctuation",
  4800. "Ps",
  4801. "Other",
  4802. "C",
  4803. "Other_Letter",
  4804. "Lo",
  4805. "Other_Number",
  4806. "No",
  4807. "Other_Punctuation",
  4808. "Po",
  4809. "Other_Symbol",
  4810. "So",
  4811. "Paragraph_Separator",
  4812. "Zp",
  4813. "Private_Use",
  4814. "Co",
  4815. "Punctuation",
  4816. "P",
  4817. "punct",
  4818. "Separator",
  4819. "Z",
  4820. "Space_Separator",
  4821. "Zs",
  4822. "Spacing_Mark",
  4823. "Mc",
  4824. "Surrogate",
  4825. "Cs",
  4826. "Symbol",
  4827. "S",
  4828. "Titlecase_Letter",
  4829. "Lt",
  4830. "Unassigned",
  4831. "Cn",
  4832. "Uppercase_Letter",
  4833. "Lu",
  4834. ]),
  4835. Script: new Set([
  4836. "Adlam",
  4837. "Adlm",
  4838. "Ahom",
  4839. "Anatolian_Hieroglyphs",
  4840. "Hluw",
  4841. "Arabic",
  4842. "Arab",
  4843. "Armenian",
  4844. "Armn",
  4845. "Avestan",
  4846. "Avst",
  4847. "Balinese",
  4848. "Bali",
  4849. "Bamum",
  4850. "Bamu",
  4851. "Bassa_Vah",
  4852. "Bass",
  4853. "Batak",
  4854. "Batk",
  4855. "Bengali",
  4856. "Beng",
  4857. "Bhaiksuki",
  4858. "Bhks",
  4859. "Bopomofo",
  4860. "Bopo",
  4861. "Brahmi",
  4862. "Brah",
  4863. "Braille",
  4864. "Brai",
  4865. "Buginese",
  4866. "Bugi",
  4867. "Buhid",
  4868. "Buhd",
  4869. "Canadian_Aboriginal",
  4870. "Cans",
  4871. "Carian",
  4872. "Cari",
  4873. "Caucasian_Albanian",
  4874. "Aghb",
  4875. "Chakma",
  4876. "Cakm",
  4877. "Cham",
  4878. "Cherokee",
  4879. "Cher",
  4880. "Common",
  4881. "Zyyy",
  4882. "Coptic",
  4883. "Copt",
  4884. "Qaac",
  4885. "Cuneiform",
  4886. "Xsux",
  4887. "Cypriot",
  4888. "Cprt",
  4889. "Cyrillic",
  4890. "Cyrl",
  4891. "Deseret",
  4892. "Dsrt",
  4893. "Devanagari",
  4894. "Deva",
  4895. "Duployan",
  4896. "Dupl",
  4897. "Egyptian_Hieroglyphs",
  4898. "Egyp",
  4899. "Elbasan",
  4900. "Elba",
  4901. "Ethiopic",
  4902. "Ethi",
  4903. "Georgian",
  4904. "Geor",
  4905. "Glagolitic",
  4906. "Glag",
  4907. "Gothic",
  4908. "Goth",
  4909. "Grantha",
  4910. "Gran",
  4911. "Greek",
  4912. "Grek",
  4913. "Gujarati",
  4914. "Gujr",
  4915. "Gurmukhi",
  4916. "Guru",
  4917. "Han",
  4918. "Hani",
  4919. "Hangul",
  4920. "Hang",
  4921. "Hanunoo",
  4922. "Hano",
  4923. "Hatran",
  4924. "Hatr",
  4925. "Hebrew",
  4926. "Hebr",
  4927. "Hiragana",
  4928. "Hira",
  4929. "Imperial_Aramaic",
  4930. "Armi",
  4931. "Inherited",
  4932. "Zinh",
  4933. "Qaai",
  4934. "Inscriptional_Pahlavi",
  4935. "Phli",
  4936. "Inscriptional_Parthian",
  4937. "Prti",
  4938. "Javanese",
  4939. "Java",
  4940. "Kaithi",
  4941. "Kthi",
  4942. "Kannada",
  4943. "Knda",
  4944. "Katakana",
  4945. "Kana",
  4946. "Kayah_Li",
  4947. "Kali",
  4948. "Kharoshthi",
  4949. "Khar",
  4950. "Khmer",
  4951. "Khmr",
  4952. "Khojki",
  4953. "Khoj",
  4954. "Khudawadi",
  4955. "Sind",
  4956. "Lao",
  4957. "Laoo",
  4958. "Latin",
  4959. "Latn",
  4960. "Lepcha",
  4961. "Lepc",
  4962. "Limbu",
  4963. "Limb",
  4964. "Linear_A",
  4965. "Lina",
  4966. "Linear_B",
  4967. "Linb",
  4968. "Lisu",
  4969. "Lycian",
  4970. "Lyci",
  4971. "Lydian",
  4972. "Lydi",
  4973. "Mahajani",
  4974. "Mahj",
  4975. "Malayalam",
  4976. "Mlym",
  4977. "Mandaic",
  4978. "Mand",
  4979. "Manichaean",
  4980. "Mani",
  4981. "Marchen",
  4982. "Marc",
  4983. "Masaram_Gondi",
  4984. "Gonm",
  4985. "Meetei_Mayek",
  4986. "Mtei",
  4987. "Mende_Kikakui",
  4988. "Mend",
  4989. "Meroitic_Cursive",
  4990. "Merc",
  4991. "Meroitic_Hieroglyphs",
  4992. "Mero",
  4993. "Miao",
  4994. "Plrd",
  4995. "Modi",
  4996. "Mongolian",
  4997. "Mong",
  4998. "Mro",
  4999. "Mroo",
  5000. "Multani",
  5001. "Mult",
  5002. "Myanmar",
  5003. "Mymr",
  5004. "Nabataean",
  5005. "Nbat",
  5006. "New_Tai_Lue",
  5007. "Talu",
  5008. "Newa",
  5009. "Nko",
  5010. "Nkoo",
  5011. "Nushu",
  5012. "Nshu",
  5013. "Ogham",
  5014. "Ogam",
  5015. "Ol_Chiki",
  5016. "Olck",
  5017. "Old_Hungarian",
  5018. "Hung",
  5019. "Old_Italic",
  5020. "Ital",
  5021. "Old_North_Arabian",
  5022. "Narb",
  5023. "Old_Permic",
  5024. "Perm",
  5025. "Old_Persian",
  5026. "Xpeo",
  5027. "Old_South_Arabian",
  5028. "Sarb",
  5029. "Old_Turkic",
  5030. "Orkh",
  5031. "Oriya",
  5032. "Orya",
  5033. "Osage",
  5034. "Osge",
  5035. "Osmanya",
  5036. "Osma",
  5037. "Pahawh_Hmong",
  5038. "Hmng",
  5039. "Palmyrene",
  5040. "Palm",
  5041. "Pau_Cin_Hau",
  5042. "Pauc",
  5043. "Phags_Pa",
  5044. "Phag",
  5045. "Phoenician",
  5046. "Phnx",
  5047. "Psalter_Pahlavi",
  5048. "Phlp",
  5049. "Rejang",
  5050. "Rjng",
  5051. "Runic",
  5052. "Runr",
  5053. "Samaritan",
  5054. "Samr",
  5055. "Saurashtra",
  5056. "Saur",
  5057. "Sharada",
  5058. "Shrd",
  5059. "Shavian",
  5060. "Shaw",
  5061. "Siddham",
  5062. "Sidd",
  5063. "SignWriting",
  5064. "Sgnw",
  5065. "Sinhala",
  5066. "Sinh",
  5067. "Sora_Sompeng",
  5068. "Sora",
  5069. "Soyombo",
  5070. "Soyo",
  5071. "Sundanese",
  5072. "Sund",
  5073. "Syloti_Nagri",
  5074. "Sylo",
  5075. "Syriac",
  5076. "Syrc",
  5077. "Tagalog",
  5078. "Tglg",
  5079. "Tagbanwa",
  5080. "Tagb",
  5081. "Tai_Le",
  5082. "Tale",
  5083. "Tai_Tham",
  5084. "Lana",
  5085. "Tai_Viet",
  5086. "Tavt",
  5087. "Takri",
  5088. "Takr",
  5089. "Tamil",
  5090. "Taml",
  5091. "Tangut",
  5092. "Tang",
  5093. "Telugu",
  5094. "Telu",
  5095. "Thaana",
  5096. "Thaa",
  5097. "Thai",
  5098. "Tibetan",
  5099. "Tibt",
  5100. "Tifinagh",
  5101. "Tfng",
  5102. "Tirhuta",
  5103. "Tirh",
  5104. "Ugaritic",
  5105. "Ugar",
  5106. "Vai",
  5107. "Vaii",
  5108. "Warang_Citi",
  5109. "Wara",
  5110. "Yi",
  5111. "Yiii",
  5112. "Zanabazar_Square",
  5113. "Zanb",
  5114. ]),
  5115. };
  5116. PropertyData.gc = PropertyData.General_Category;
  5117. PropertyData.sc = PropertyData.Script_Extensions = PropertyData.scx =
  5118. PropertyData.Script;
  5119. const Backspace = 0x08;
  5120. const CharacterTabulation = 0x09;
  5121. const LineFeed = 0x0a;
  5122. const LineTabulation = 0x0b;
  5123. const FormFeed = 0x0c;
  5124. const CarriageReturn = 0x0d;
  5125. const ExclamationMark = 0x21;
  5126. const DollarSign = 0x24;
  5127. const LeftParenthesis = 0x28;
  5128. const RightParenthesis = 0x29;
  5129. const Asterisk = 0x2a;
  5130. const PlusSign = 0x2b;
  5131. const Comma = 0x2c;
  5132. const HyphenMinus = 0x2d;
  5133. const FullStop = 0x2e;
  5134. const Solidus = 0x2f;
  5135. const DigitZero = 0x30;
  5136. const DigitOne = 0x31;
  5137. const DigitSeven = 0x37;
  5138. const DigitNine = 0x39;
  5139. const Colon = 0x3a;
  5140. const LessThanSign = 0x3c;
  5141. const EqualsSign = 0x3d;
  5142. const GreaterThanSign = 0x3e;
  5143. const QuestionMark = 0x3f;
  5144. const LatinCapitalLetterA = 0x41;
  5145. const LatinCapitalLetterB = 0x42;
  5146. const LatinCapitalLetterD = 0x44;
  5147. const LatinCapitalLetterF = 0x46;
  5148. const LatinCapitalLetterP = 0x50;
  5149. const LatinCapitalLetterS = 0x53;
  5150. const LatinCapitalLetterW = 0x57;
  5151. const LatinCapitalLetterZ = 0x5a;
  5152. const LowLine = 0x5f;
  5153. const LatinSmallLetterA = 0x61;
  5154. const LatinSmallLetterB = 0x62;
  5155. const LatinSmallLetterC = 0x63;
  5156. const LatinSmallLetterD = 0x64;
  5157. const LatinSmallLetterF = 0x66;
  5158. const LatinSmallLetterG = 0x67;
  5159. const LatinSmallLetterI = 0x69;
  5160. const LatinSmallLetterK = 0x6b;
  5161. const LatinSmallLetterM = 0x6d;
  5162. const LatinSmallLetterN = 0x6e;
  5163. const LatinSmallLetterP = 0x70;
  5164. const LatinSmallLetterR = 0x72;
  5165. const LatinSmallLetterS = 0x73;
  5166. const LatinSmallLetterT = 0x74;
  5167. const LatinSmallLetterU = 0x75;
  5168. const LatinSmallLetterV = 0x76;
  5169. const LatinSmallLetterW = 0x77;
  5170. const LatinSmallLetterX = 0x78;
  5171. const LatinSmallLetterY = 0x79;
  5172. const LatinSmallLetterZ = 0x7a;
  5173. const LeftSquareBracket = 0x5b;
  5174. const ReverseSolidus = 0x5c;
  5175. const RightSquareBracket = 0x5d;
  5176. const CircumflexAccent = 0x5e;
  5177. const LeftCurlyBracket = 0x7b;
  5178. const VerticalLine = 0x7c;
  5179. const RightCurlyBracket = 0x7d;
  5180. const ZeroWidthNonJoiner = 0x200c;
  5181. const ZeroWidthJoiner = 0x200d;
  5182. const LineSeparator = 0x2028;
  5183. const ParagraphSeparator = 0x2029;
  5184. const MinCodePoint = 0x00;
  5185. const MaxCodePoint = 0x10ffff;
  5186. function isLatinLetter(code) {
  5187. return ((code >= LatinCapitalLetterA && code <= LatinCapitalLetterZ) ||
  5188. (code >= LatinSmallLetterA && code <= LatinSmallLetterZ));
  5189. }
  5190. function isDecimalDigit(code) {
  5191. return code >= DigitZero && code <= DigitNine;
  5192. }
  5193. function isOctalDigit(code) {
  5194. return code >= DigitZero && code <= DigitSeven;
  5195. }
  5196. function isHexDigit(code) {
  5197. return ((code >= DigitZero && code <= DigitNine) ||
  5198. (code >= LatinCapitalLetterA && code <= LatinCapitalLetterF) ||
  5199. (code >= LatinSmallLetterA && code <= LatinSmallLetterF));
  5200. }
  5201. function isLineTerminator(code) {
  5202. return (code === LineFeed ||
  5203. code === CarriageReturn ||
  5204. code === LineSeparator ||
  5205. code === ParagraphSeparator);
  5206. }
  5207. function isValidUnicode(code) {
  5208. return code >= MinCodePoint && code <= MaxCodePoint;
  5209. }
  5210. function digitToInt(code) {
  5211. if (code >= LatinSmallLetterA && code <= LatinSmallLetterF) {
  5212. return code - LatinSmallLetterA + 10;
  5213. }
  5214. if (code >= LatinCapitalLetterA && code <= LatinCapitalLetterF) {
  5215. return code - LatinCapitalLetterA + 10;
  5216. }
  5217. return code - DigitZero;
  5218. }
  5219. const legacyImpl = {
  5220. at(s, end, i) {
  5221. return i < end ? s.charCodeAt(i) : -1;
  5222. },
  5223. width(c) {
  5224. return 1;
  5225. },
  5226. };
  5227. const unicodeImpl = {
  5228. at(s, end, i) {
  5229. return i < end ? s.codePointAt(i) : -1;
  5230. },
  5231. width(c) {
  5232. return c > 0xffff ? 2 : 1;
  5233. },
  5234. };
  5235. class Reader {
  5236. constructor() {
  5237. this._impl = legacyImpl;
  5238. this._s = "";
  5239. this._i = 0;
  5240. this._end = 0;
  5241. this._cp1 = -1;
  5242. this._w1 = 1;
  5243. this._cp2 = -1;
  5244. this._w2 = 1;
  5245. this._cp3 = -1;
  5246. this._w3 = 1;
  5247. this._cp4 = -1;
  5248. }
  5249. get source() {
  5250. return this._s;
  5251. }
  5252. get index() {
  5253. return this._i;
  5254. }
  5255. get currentCodePoint() {
  5256. return this._cp1;
  5257. }
  5258. get nextCodePoint() {
  5259. return this._cp2;
  5260. }
  5261. get nextCodePoint2() {
  5262. return this._cp3;
  5263. }
  5264. get nextCodePoint3() {
  5265. return this._cp4;
  5266. }
  5267. reset(source, start, end, uFlag) {
  5268. this._impl = uFlag ? unicodeImpl : legacyImpl;
  5269. this._s = source;
  5270. this._end = end;
  5271. this.rewind(start);
  5272. }
  5273. rewind(index) {
  5274. const impl = this._impl;
  5275. this._i = index;
  5276. this._cp1 = impl.at(this._s, this._end, index);
  5277. this._w1 = impl.width(this._cp1);
  5278. this._cp2 = impl.at(this._s, this._end, index + this._w1);
  5279. this._w2 = impl.width(this._cp2);
  5280. this._cp3 = impl.at(this._s, this._end, index + this._w1 + this._w2);
  5281. this._w3 = impl.width(this._cp3);
  5282. this._cp4 = impl.at(this._s, this._end, index + this._w1 + this._w2 + this._w3);
  5283. }
  5284. advance() {
  5285. if (this._cp1 !== -1) {
  5286. const impl = this._impl;
  5287. this._i += this._w1;
  5288. this._cp1 = this._cp2;
  5289. this._w1 = this._w2;
  5290. this._cp2 = this._cp3;
  5291. this._w2 = impl.width(this._cp2);
  5292. this._cp3 = this._cp4;
  5293. this._w3 = impl.width(this._cp3);
  5294. this._cp4 = impl.at(this._s, this._end, this._i + this._w1 + this._w2 + this._w3);
  5295. }
  5296. }
  5297. eat(cp) {
  5298. if (this._cp1 === cp) {
  5299. this.advance();
  5300. return true;
  5301. }
  5302. return false;
  5303. }
  5304. eat2(cp1, cp2) {
  5305. if (this._cp1 === cp1 && this._cp2 === cp2) {
  5306. this.advance();
  5307. this.advance();
  5308. return true;
  5309. }
  5310. return false;
  5311. }
  5312. eat3(cp1, cp2, cp3) {
  5313. if (this._cp1 === cp1 && this._cp2 === cp2 && this._cp3 === cp3) {
  5314. this.advance();
  5315. this.advance();
  5316. this.advance();
  5317. return true;
  5318. }
  5319. return false;
  5320. }
  5321. }
  5322. class RegExpSyntaxError extends SyntaxError {
  5323. constructor(source, uFlag, index, message) {
  5324. if (source) {
  5325. if (source[0] !== "/") {
  5326. source = `/${source}/${uFlag ? "u" : ""}`;
  5327. }
  5328. source = `: ${source}`;
  5329. }
  5330. super(`Invalid regular expression${source}: ${message}`);
  5331. this.index = index;
  5332. }
  5333. }
  5334. function isSyntaxCharacter(cp) {
  5335. return (cp === CircumflexAccent ||
  5336. cp === DollarSign ||
  5337. cp === ReverseSolidus ||
  5338. cp === FullStop ||
  5339. cp === Asterisk ||
  5340. cp === PlusSign ||
  5341. cp === QuestionMark ||
  5342. cp === LeftParenthesis ||
  5343. cp === RightParenthesis ||
  5344. cp === LeftSquareBracket ||
  5345. cp === RightSquareBracket ||
  5346. cp === LeftCurlyBracket ||
  5347. cp === RightCurlyBracket ||
  5348. cp === VerticalLine);
  5349. }
  5350. function isRegExpIdentifierStart(cp) {
  5351. return isIdStart(cp) || cp === DollarSign || cp === LowLine;
  5352. }
  5353. function isRegExpIdentifierPart(cp) {
  5354. return (isIdContinue(cp) ||
  5355. cp === DollarSign ||
  5356. cp === LowLine ||
  5357. cp === ZeroWidthNonJoiner ||
  5358. cp === ZeroWidthJoiner);
  5359. }
  5360. function isUnicodePropertyNameCharacter(cp) {
  5361. return isLatinLetter(cp) || cp === LowLine;
  5362. }
  5363. function isUnicodePropertyValueCharacter(cp) {
  5364. return isUnicodePropertyNameCharacter(cp) || isDecimalDigit(cp);
  5365. }
  5366. function isValidUnicodeProperty(name, value) {
  5367. return PropertyData.hasOwnProperty(name) && PropertyData[name].has(value);
  5368. }
  5369. function isValidUnicodePropertyName(name) {
  5370. return PropertyData.$LONE.has(name);
  5371. }
  5372. class RegExpValidator {
  5373. constructor(options) {
  5374. this._reader = new Reader();
  5375. this._uFlag = false;
  5376. this._nFlag = false;
  5377. this._lastIntValue = 0;
  5378. this._lastMinValue = 0;
  5379. this._lastMaxValue = 0;
  5380. this._lastStrValue = "";
  5381. this._lastKeyValue = "";
  5382. this._lastValValue = "";
  5383. this._lastAssertionIsQuantifiable = false;
  5384. this._numCapturingParens = 0;
  5385. this._groupNames = new Set();
  5386. this._backreferenceNames = new Set();
  5387. this._options = options || {};
  5388. }
  5389. validateLiteral(source, start = 0, end = source.length) {
  5390. this._uFlag = this._nFlag = false;
  5391. this.reset(source, start, end);
  5392. this.onLiteralEnter(start);
  5393. if (this.eat(Solidus) && this.eatRegExpBody() && this.eat(Solidus)) {
  5394. const flagStart = this.index;
  5395. const uFlag = source.indexOf("u", flagStart) !== -1;
  5396. this.validateFlags(source, flagStart, end);
  5397. this.validatePattern(source, start + 1, flagStart - 1, uFlag);
  5398. }
  5399. else if (start >= end) {
  5400. this.raise("Empty");
  5401. }
  5402. else {
  5403. const c = String.fromCodePoint(this.currentCodePoint);
  5404. this.raise(`Unexpected character '${c}'`);
  5405. }
  5406. this.onLiteralLeave(start, end);
  5407. }
  5408. validateFlags(source, start = 0, end = source.length) {
  5409. const existingFlags = new Set();
  5410. let global = false;
  5411. let ignoreCase = false;
  5412. let multiline = false;
  5413. let sticky = false;
  5414. let unicode = false;
  5415. let dotAll = false;
  5416. for (let i = start; i < end; ++i) {
  5417. const flag = source.charCodeAt(i);
  5418. if (existingFlags.has(flag)) {
  5419. this.raise(`Duplicated flag '${source[i]}'`);
  5420. }
  5421. existingFlags.add(flag);
  5422. if (flag === LatinSmallLetterG) {
  5423. global = true;
  5424. }
  5425. else if (flag === LatinSmallLetterI) {
  5426. ignoreCase = true;
  5427. }
  5428. else if (flag === LatinSmallLetterM) {
  5429. multiline = true;
  5430. }
  5431. else if (flag === LatinSmallLetterU && this.ecmaVersion >= 2015) {
  5432. unicode = true;
  5433. }
  5434. else if (flag === LatinSmallLetterY && this.ecmaVersion >= 2015) {
  5435. sticky = true;
  5436. }
  5437. else if (flag === LatinSmallLetterS && this.ecmaVersion >= 2018) {
  5438. dotAll = true;
  5439. }
  5440. else {
  5441. this.raise(`Invalid flag '${source[i]}'`);
  5442. }
  5443. }
  5444. this.onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll);
  5445. }
  5446. validatePattern(source, start = 0, end = source.length, uFlag = false) {
  5447. this._uFlag = uFlag && this.ecmaVersion >= 2015;
  5448. this._nFlag = uFlag && this.ecmaVersion >= 2018;
  5449. this.reset(source, start, end);
  5450. this.pattern();
  5451. if (!this._nFlag &&
  5452. this.ecmaVersion >= 2018 &&
  5453. this._groupNames.size > 0) {
  5454. this._nFlag = true;
  5455. this.rewind(start);
  5456. this.pattern();
  5457. }
  5458. }
  5459. get strict() {
  5460. return Boolean(this._options.strict || this._uFlag);
  5461. }
  5462. get ecmaVersion() {
  5463. return this._options.ecmaVersion || 2018;
  5464. }
  5465. onLiteralEnter(start) {
  5466. if (this._options.onLiteralEnter) {
  5467. this._options.onLiteralEnter(start);
  5468. }
  5469. }
  5470. onLiteralLeave(start, end) {
  5471. if (this._options.onLiteralLeave) {
  5472. this._options.onLiteralLeave(start, end);
  5473. }
  5474. }
  5475. onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll) {
  5476. if (this._options.onFlags) {
  5477. this._options.onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll);
  5478. }
  5479. }
  5480. onPatternEnter(start) {
  5481. if (this._options.onPatternEnter) {
  5482. this._options.onPatternEnter(start);
  5483. }
  5484. }
  5485. onPatternLeave(start, end) {
  5486. if (this._options.onPatternLeave) {
  5487. this._options.onPatternLeave(start, end);
  5488. }
  5489. }
  5490. onDisjunctionEnter(start) {
  5491. if (this._options.onDisjunctionEnter) {
  5492. this._options.onDisjunctionEnter(start);
  5493. }
  5494. }
  5495. onDisjunctionLeave(start, end) {
  5496. if (this._options.onDisjunctionLeave) {
  5497. this._options.onDisjunctionLeave(start, end);
  5498. }
  5499. }
  5500. onAlternativeEnter(start, index) {
  5501. if (this._options.onAlternativeEnter) {
  5502. this._options.onAlternativeEnter(start, index);
  5503. }
  5504. }
  5505. onAlternativeLeave(start, end, index) {
  5506. if (this._options.onAlternativeLeave) {
  5507. this._options.onAlternativeLeave(start, end, index);
  5508. }
  5509. }
  5510. onGroupEnter(start) {
  5511. if (this._options.onGroupEnter) {
  5512. this._options.onGroupEnter(start);
  5513. }
  5514. }
  5515. onGroupLeave(start, end) {
  5516. if (this._options.onGroupLeave) {
  5517. this._options.onGroupLeave(start, end);
  5518. }
  5519. }
  5520. onCapturingGroupEnter(start, name) {
  5521. if (this._options.onCapturingGroupEnter) {
  5522. this._options.onCapturingGroupEnter(start, name);
  5523. }
  5524. }
  5525. onCapturingGroupLeave(start, end, name) {
  5526. if (this._options.onCapturingGroupLeave) {
  5527. this._options.onCapturingGroupLeave(start, end, name);
  5528. }
  5529. }
  5530. onQuantifier(start, end, min, max, greedy) {
  5531. if (this._options.onQuantifier) {
  5532. this._options.onQuantifier(start, end, min, max, greedy);
  5533. }
  5534. }
  5535. onLookaroundAssertionEnter(start, kind, negate) {
  5536. if (this._options.onLookaroundAssertionEnter) {
  5537. this._options.onLookaroundAssertionEnter(start, kind, negate);
  5538. }
  5539. }
  5540. onLookaroundAssertionLeave(start, end, kind, negate) {
  5541. if (this._options.onLookaroundAssertionLeave) {
  5542. this._options.onLookaroundAssertionLeave(start, end, kind, negate);
  5543. }
  5544. }
  5545. onEdgeAssertion(start, end, kind) {
  5546. if (this._options.onEdgeAssertion) {
  5547. this._options.onEdgeAssertion(start, end, kind);
  5548. }
  5549. }
  5550. onWordBoundaryAssertion(start, end, kind, negate) {
  5551. if (this._options.onWordBoundaryAssertion) {
  5552. this._options.onWordBoundaryAssertion(start, end, kind, negate);
  5553. }
  5554. }
  5555. onAnyCharacterSet(start, end, kind) {
  5556. if (this._options.onAnyCharacterSet) {
  5557. this._options.onAnyCharacterSet(start, end, kind);
  5558. }
  5559. }
  5560. onEscapeCharacterSet(start, end, kind, negate) {
  5561. if (this._options.onEscapeCharacterSet) {
  5562. this._options.onEscapeCharacterSet(start, end, kind, negate);
  5563. }
  5564. }
  5565. onUnicodePropertyCharacterSet(start, end, kind, key, value, negate) {
  5566. if (this._options.onUnicodePropertyCharacterSet) {
  5567. this._options.onUnicodePropertyCharacterSet(start, end, kind, key, value, negate);
  5568. }
  5569. }
  5570. onCharacter(start, end, value) {
  5571. if (this._options.onCharacter) {
  5572. this._options.onCharacter(start, end, value);
  5573. }
  5574. }
  5575. onBackreference(start, end, ref) {
  5576. if (this._options.onBackreference) {
  5577. this._options.onBackreference(start, end, ref);
  5578. }
  5579. }
  5580. onCharacterClassEnter(start, negate) {
  5581. if (this._options.onCharacterClassEnter) {
  5582. this._options.onCharacterClassEnter(start, negate);
  5583. }
  5584. }
  5585. onCharacterClassLeave(start, end, negate) {
  5586. if (this._options.onCharacterClassLeave) {
  5587. this._options.onCharacterClassLeave(start, end, negate);
  5588. }
  5589. }
  5590. onCharacterClassRange(start, end, min, max) {
  5591. if (this._options.onCharacterClassRange) {
  5592. this._options.onCharacterClassRange(start, end, min, max);
  5593. }
  5594. }
  5595. get source() {
  5596. return this._reader.source;
  5597. }
  5598. get index() {
  5599. return this._reader.index;
  5600. }
  5601. get currentCodePoint() {
  5602. return this._reader.currentCodePoint;
  5603. }
  5604. get nextCodePoint() {
  5605. return this._reader.nextCodePoint;
  5606. }
  5607. get nextCodePoint2() {
  5608. return this._reader.nextCodePoint2;
  5609. }
  5610. get nextCodePoint3() {
  5611. return this._reader.nextCodePoint3;
  5612. }
  5613. reset(source, start, end) {
  5614. this._reader.reset(source, start, end, this._uFlag);
  5615. }
  5616. rewind(index) {
  5617. this._reader.rewind(index);
  5618. }
  5619. advance() {
  5620. this._reader.advance();
  5621. }
  5622. eat(cp) {
  5623. return this._reader.eat(cp);
  5624. }
  5625. eat2(cp1, cp2) {
  5626. return this._reader.eat2(cp1, cp2);
  5627. }
  5628. eat3(cp1, cp2, cp3) {
  5629. return this._reader.eat3(cp1, cp2, cp3);
  5630. }
  5631. raise(message) {
  5632. throw new RegExpSyntaxError(this.source, this._uFlag, this.index, message);
  5633. }
  5634. eatRegExpBody() {
  5635. const start = this.index;
  5636. let inClass = false;
  5637. let escaped = false;
  5638. for (;;) {
  5639. const cp = this.currentCodePoint;
  5640. if (cp === -1 || isLineTerminator(cp)) {
  5641. const kind = inClass ? "character class" : "regular expression";
  5642. this.raise(`Unterminated ${kind}`);
  5643. }
  5644. if (escaped) {
  5645. escaped = false;
  5646. }
  5647. else if (cp === ReverseSolidus) {
  5648. escaped = true;
  5649. }
  5650. else if (cp === LeftSquareBracket) {
  5651. inClass = true;
  5652. }
  5653. else if (cp === RightSquareBracket) {
  5654. inClass = false;
  5655. }
  5656. else if ((cp === Solidus && !inClass) ||
  5657. (cp === Asterisk && this.index === start)) {
  5658. break;
  5659. }
  5660. this.advance();
  5661. }
  5662. return this.index !== start;
  5663. }
  5664. pattern() {
  5665. const start = this.index;
  5666. this._numCapturingParens = this.countCapturingParens();
  5667. this._groupNames.clear();
  5668. this._backreferenceNames.clear();
  5669. this.onPatternEnter(start);
  5670. this.disjunction();
  5671. const cp = this.currentCodePoint;
  5672. if (this.currentCodePoint !== -1) {
  5673. if (cp === RightParenthesis) {
  5674. this.raise("Unmatched ')'");
  5675. }
  5676. if (cp === ReverseSolidus) {
  5677. this.raise("\\ at end of pattern");
  5678. }
  5679. if (cp === RightSquareBracket || cp === RightCurlyBracket) {
  5680. this.raise("Lone quantifier brackets");
  5681. }
  5682. const c = String.fromCodePoint(cp);
  5683. this.raise(`Unexpected character '${c}'`);
  5684. }
  5685. for (const name of this._backreferenceNames) {
  5686. if (!this._groupNames.has(name)) {
  5687. this.raise("Invalid named capture referenced");
  5688. }
  5689. }
  5690. this.onPatternLeave(start, this.index);
  5691. }
  5692. countCapturingParens() {
  5693. const start = this.index;
  5694. let inClass = false;
  5695. let escaped = false;
  5696. let count = 0;
  5697. let cp = 0;
  5698. while ((cp = this.currentCodePoint) !== -1) {
  5699. if (escaped) {
  5700. escaped = false;
  5701. }
  5702. else if (cp === ReverseSolidus) {
  5703. escaped = true;
  5704. }
  5705. else if (cp === LeftSquareBracket) {
  5706. inClass = true;
  5707. }
  5708. else if (cp === RightSquareBracket) {
  5709. inClass = false;
  5710. }
  5711. else if (cp === LeftParenthesis &&
  5712. !inClass &&
  5713. (this.nextCodePoint !== QuestionMark ||
  5714. (this.nextCodePoint2 === LessThanSign &&
  5715. this.nextCodePoint3 !== EqualsSign &&
  5716. this.nextCodePoint3 !== ExclamationMark))) {
  5717. count += 1;
  5718. }
  5719. this.advance();
  5720. }
  5721. this.rewind(start);
  5722. return count;
  5723. }
  5724. disjunction() {
  5725. const start = this.index;
  5726. let i = 0;
  5727. this.onDisjunctionEnter(start);
  5728. this.alternative(i++);
  5729. while (this.eat(VerticalLine)) {
  5730. this.alternative(i++);
  5731. }
  5732. if (this.eatQuantifier(true)) {
  5733. this.raise("Nothing to repeat");
  5734. }
  5735. if (this.eat(LeftCurlyBracket)) {
  5736. this.raise("Lone quantifier brackets");
  5737. }
  5738. this.onDisjunctionLeave(start, this.index);
  5739. }
  5740. alternative(i) {
  5741. const start = this.index;
  5742. this.onAlternativeEnter(start, i);
  5743. while (this.currentCodePoint !== -1 && this.eatTerm()) {
  5744. }
  5745. this.onAlternativeLeave(start, this.index, i);
  5746. }
  5747. eatTerm() {
  5748. if (this.eatAssertion()) {
  5749. if (this._lastAssertionIsQuantifiable) {
  5750. this.eatQuantifier();
  5751. }
  5752. return true;
  5753. }
  5754. if (this.strict ? this.eatAtom() : this.eatExtendedAtom()) {
  5755. this.eatQuantifier();
  5756. return true;
  5757. }
  5758. return false;
  5759. }
  5760. eatAssertion() {
  5761. const start = this.index;
  5762. this._lastAssertionIsQuantifiable = false;
  5763. if (this.eat(CircumflexAccent)) {
  5764. this.onEdgeAssertion(start, this.index, "start");
  5765. return true;
  5766. }
  5767. if (this.eat(DollarSign)) {
  5768. this.onEdgeAssertion(start, this.index, "end");
  5769. return true;
  5770. }
  5771. if (this.eat2(ReverseSolidus, LatinCapitalLetterB)) {
  5772. this.onWordBoundaryAssertion(start, this.index, "word", true);
  5773. return true;
  5774. }
  5775. if (this.eat2(ReverseSolidus, LatinSmallLetterB)) {
  5776. this.onWordBoundaryAssertion(start, this.index, "word", false);
  5777. return true;
  5778. }
  5779. if (this.eat2(LeftParenthesis, QuestionMark)) {
  5780. const lookbehind = this.ecmaVersion >= 2018 && this.eat(LessThanSign);
  5781. let negate = false;
  5782. if (this.eat(EqualsSign) || (negate = this.eat(ExclamationMark))) {
  5783. const kind = lookbehind ? "lookbehind" : "lookahead";
  5784. this.onLookaroundAssertionEnter(start, kind, negate);
  5785. this.disjunction();
  5786. if (!this.eat(RightParenthesis)) {
  5787. this.raise("Unterminated group");
  5788. }
  5789. this._lastAssertionIsQuantifiable = !lookbehind && !this.strict;
  5790. this.onLookaroundAssertionLeave(start, this.index, kind, negate);
  5791. return true;
  5792. }
  5793. this.rewind(start);
  5794. }
  5795. return false;
  5796. }
  5797. eatQuantifier(noError = false) {
  5798. const start = this.index;
  5799. let min = 0;
  5800. let max = 0;
  5801. let greedy = false;
  5802. if (this.eat(Asterisk)) {
  5803. min = 0;
  5804. max = Number.POSITIVE_INFINITY;
  5805. }
  5806. else if (this.eat(PlusSign)) {
  5807. min = 1;
  5808. max = Number.POSITIVE_INFINITY;
  5809. }
  5810. else if (this.eat(QuestionMark)) {
  5811. min = 0;
  5812. max = 1;
  5813. }
  5814. else if (this.eatBracedQuantifier(noError)) {
  5815. min = this._lastMinValue;
  5816. max = this._lastMaxValue;
  5817. }
  5818. else {
  5819. return false;
  5820. }
  5821. greedy = !this.eat(QuestionMark);
  5822. if (!noError) {
  5823. this.onQuantifier(start, this.index, min, max, greedy);
  5824. }
  5825. return true;
  5826. }
  5827. eatBracedQuantifier(noError) {
  5828. const start = this.index;
  5829. if (this.eat(LeftCurlyBracket)) {
  5830. this._lastMinValue = 0;
  5831. this._lastMaxValue = Number.POSITIVE_INFINITY;
  5832. if (this.eatDecimalDigits()) {
  5833. this._lastMinValue = this._lastMaxValue = this._lastIntValue;
  5834. if (this.eat(Comma)) {
  5835. this._lastMaxValue = this.eatDecimalDigits()
  5836. ? this._lastIntValue
  5837. : Number.POSITIVE_INFINITY;
  5838. }
  5839. if (this.eat(RightCurlyBracket)) {
  5840. if (!noError && this._lastMaxValue < this._lastMinValue) {
  5841. this.raise("numbers out of order in {} quantifier");
  5842. }
  5843. return true;
  5844. }
  5845. }
  5846. if (!noError && this.strict) {
  5847. this.raise("Incomplete quantifier");
  5848. }
  5849. this.rewind(start);
  5850. }
  5851. return false;
  5852. }
  5853. eatAtom() {
  5854. return (this.eatPatternCharacter() ||
  5855. this.eatDot() ||
  5856. this.eatReverseSolidusAtomEscape() ||
  5857. this.eatCharacterClass() ||
  5858. this.eatUncapturingGroup() ||
  5859. this.eatCapturingGroup());
  5860. }
  5861. eatDot() {
  5862. if (this.eat(FullStop)) {
  5863. this.onAnyCharacterSet(this.index - 1, this.index, "any");
  5864. return true;
  5865. }
  5866. return false;
  5867. }
  5868. eatReverseSolidusAtomEscape() {
  5869. const start = this.index;
  5870. if (this.eat(ReverseSolidus)) {
  5871. if (this.eatAtomEscape()) {
  5872. return true;
  5873. }
  5874. this.rewind(start);
  5875. }
  5876. return false;
  5877. }
  5878. eatUncapturingGroup() {
  5879. const start = this.index;
  5880. if (this.eat3(LeftParenthesis, QuestionMark, Colon)) {
  5881. this.onGroupEnter(start);
  5882. this.disjunction();
  5883. if (!this.eat(RightParenthesis)) {
  5884. this.raise("Unterminated group");
  5885. }
  5886. this.onGroupLeave(start, this.index);
  5887. return true;
  5888. }
  5889. return false;
  5890. }
  5891. eatCapturingGroup() {
  5892. const start = this.index;
  5893. if (this.eat(LeftParenthesis)) {
  5894. this._lastStrValue = "";
  5895. if (this.ecmaVersion >= 2018) {
  5896. this.groupSpecifier();
  5897. }
  5898. else if (this.currentCodePoint === QuestionMark) {
  5899. this.raise("Invalid group");
  5900. }
  5901. const name = this._lastStrValue || null;
  5902. this.onCapturingGroupEnter(start, name);
  5903. this.disjunction();
  5904. if (!this.eat(RightParenthesis)) {
  5905. this.raise("Unterminated group");
  5906. }
  5907. this.onCapturingGroupLeave(start, this.index, name);
  5908. return true;
  5909. }
  5910. return false;
  5911. }
  5912. eatExtendedAtom() {
  5913. return (this.eatDot() ||
  5914. this.eatReverseSolidusAtomEscape() ||
  5915. this.eatReverseSolidusFollowedByC() ||
  5916. this.eatCharacterClass() ||
  5917. this.eatUncapturingGroup() ||
  5918. this.eatCapturingGroup() ||
  5919. this.eatInvalidBracedQuantifier() ||
  5920. this.eatExtendedPatternCharacter());
  5921. }
  5922. eatReverseSolidusFollowedByC() {
  5923. if (this.currentCodePoint === ReverseSolidus &&
  5924. this.nextCodePoint === LatinSmallLetterC) {
  5925. this._lastIntValue = this.currentCodePoint;
  5926. this.advance();
  5927. this.onCharacter(this.index - 1, this.index, ReverseSolidus);
  5928. return true;
  5929. }
  5930. return false;
  5931. }
  5932. eatInvalidBracedQuantifier() {
  5933. if (this.eatBracedQuantifier(true)) {
  5934. this.raise("Nothing to repeat");
  5935. }
  5936. return false;
  5937. }
  5938. eatSyntaxCharacter() {
  5939. if (isSyntaxCharacter(this.currentCodePoint)) {
  5940. this._lastIntValue = this.currentCodePoint;
  5941. this.advance();
  5942. return true;
  5943. }
  5944. return false;
  5945. }
  5946. eatPatternCharacter() {
  5947. const start = this.index;
  5948. const cp = this.currentCodePoint;
  5949. if (cp !== -1 && !isSyntaxCharacter(cp)) {
  5950. this.advance();
  5951. this.onCharacter(start, this.index, cp);
  5952. return true;
  5953. }
  5954. return false;
  5955. }
  5956. eatExtendedPatternCharacter() {
  5957. const start = this.index;
  5958. const cp = this.currentCodePoint;
  5959. if (cp !== -1 &&
  5960. cp !== CircumflexAccent &&
  5961. cp !== DollarSign &&
  5962. cp !== ReverseSolidus &&
  5963. cp !== FullStop &&
  5964. cp !== Asterisk &&
  5965. cp !== PlusSign &&
  5966. cp !== QuestionMark &&
  5967. cp !== LeftParenthesis &&
  5968. cp !== RightParenthesis &&
  5969. cp !== LeftSquareBracket &&
  5970. cp !== VerticalLine) {
  5971. this.advance();
  5972. this.onCharacter(start, this.index, cp);
  5973. return true;
  5974. }
  5975. return false;
  5976. }
  5977. groupSpecifier() {
  5978. this._lastStrValue = "";
  5979. if (this.eat(QuestionMark)) {
  5980. if (this.eatGroupName()) {
  5981. if (!this._groupNames.has(this._lastStrValue)) {
  5982. this._groupNames.add(this._lastStrValue);
  5983. return;
  5984. }
  5985. this.raise("Duplicate capture group name");
  5986. }
  5987. this.raise("Invalid group");
  5988. }
  5989. }
  5990. eatGroupName() {
  5991. this._lastStrValue = "";
  5992. if (this.eat(LessThanSign)) {
  5993. if (this.eatRegExpIdentifierName() && this.eat(GreaterThanSign)) {
  5994. return true;
  5995. }
  5996. this.raise("Invalid capture group name");
  5997. }
  5998. return false;
  5999. }
  6000. eatRegExpIdentifierName() {
  6001. this._lastStrValue = "";
  6002. if (this.eatRegExpIdentifierStart()) {
  6003. this._lastStrValue += String.fromCodePoint(this._lastIntValue);
  6004. while (this.eatRegExpIdentifierPart()) {
  6005. this._lastStrValue += String.fromCodePoint(this._lastIntValue);
  6006. }
  6007. return true;
  6008. }
  6009. return false;
  6010. }
  6011. eatRegExpIdentifierStart() {
  6012. const start = this.index;
  6013. let cp = this.currentCodePoint;
  6014. this.advance();
  6015. if (cp === ReverseSolidus && this.eatRegExpUnicodeEscapeSequence()) {
  6016. cp = this._lastIntValue;
  6017. }
  6018. if (isRegExpIdentifierStart(cp)) {
  6019. this._lastIntValue = cp;
  6020. return true;
  6021. }
  6022. if (this.index !== start) {
  6023. this.rewind(start);
  6024. }
  6025. return false;
  6026. }
  6027. eatRegExpIdentifierPart() {
  6028. const start = this.index;
  6029. let cp = this.currentCodePoint;
  6030. this.advance();
  6031. if (cp === ReverseSolidus && this.eatRegExpUnicodeEscapeSequence()) {
  6032. cp = this._lastIntValue;
  6033. }
  6034. if (isRegExpIdentifierPart(cp)) {
  6035. this._lastIntValue = cp;
  6036. return true;
  6037. }
  6038. if (this.index !== start) {
  6039. this.rewind(start);
  6040. }
  6041. return false;
  6042. }
  6043. eatAtomEscape() {
  6044. if (this.eatBackreference() ||
  6045. this.eatCharacterClassEscape() ||
  6046. this.eatCharacterEscape() ||
  6047. (this._nFlag && this.eatKGroupName())) {
  6048. return true;
  6049. }
  6050. if (this.strict || this._uFlag) {
  6051. this.raise("Invalid escape");
  6052. }
  6053. return false;
  6054. }
  6055. eatBackreference() {
  6056. const start = this.index;
  6057. if (this.eatDecimalEscape()) {
  6058. const n = this._lastIntValue;
  6059. if (n <= this._numCapturingParens) {
  6060. this.onBackreference(start - 1, this.index, n);
  6061. return true;
  6062. }
  6063. if (this.strict) {
  6064. this.raise("Invalid escape");
  6065. }
  6066. this.rewind(start);
  6067. }
  6068. return false;
  6069. }
  6070. eatKGroupName() {
  6071. const start = this.index;
  6072. if (this.eat(LatinSmallLetterK)) {
  6073. if (this.eatGroupName()) {
  6074. const groupName = this._lastStrValue;
  6075. this._backreferenceNames.add(groupName);
  6076. this.onBackreference(start - 1, this.index, groupName);
  6077. return true;
  6078. }
  6079. this.raise("Invalid named reference");
  6080. }
  6081. return false;
  6082. }
  6083. eatCharacterEscape() {
  6084. const start = this.index;
  6085. if (this.eatControlEscape() ||
  6086. this.eatCControlLetter() ||
  6087. this.eatZero() ||
  6088. this.eatHexEscapeSequence() ||
  6089. this.eatRegExpUnicodeEscapeSequence() ||
  6090. (!this.strict && this.eatLegacyOctalEscapeSequence()) ||
  6091. this.eatIdentityEscape()) {
  6092. this.onCharacter(start - 1, this.index, this._lastIntValue);
  6093. return true;
  6094. }
  6095. return false;
  6096. }
  6097. eatCControlLetter() {
  6098. const start = this.index;
  6099. if (this.eat(LatinSmallLetterC)) {
  6100. if (this.eatControlLetter()) {
  6101. return true;
  6102. }
  6103. this.rewind(start);
  6104. }
  6105. return false;
  6106. }
  6107. eatZero() {
  6108. if (this.currentCodePoint === DigitZero &&
  6109. !isDecimalDigit(this.nextCodePoint)) {
  6110. this._lastIntValue = 0;
  6111. this.advance();
  6112. return true;
  6113. }
  6114. return false;
  6115. }
  6116. eatControlEscape() {
  6117. if (this.eat(LatinSmallLetterT)) {
  6118. this._lastIntValue = CharacterTabulation;
  6119. return true;
  6120. }
  6121. if (this.eat(LatinSmallLetterN)) {
  6122. this._lastIntValue = LineFeed;
  6123. return true;
  6124. }
  6125. if (this.eat(LatinSmallLetterV)) {
  6126. this._lastIntValue = LineTabulation;
  6127. return true;
  6128. }
  6129. if (this.eat(LatinSmallLetterF)) {
  6130. this._lastIntValue = FormFeed;
  6131. return true;
  6132. }
  6133. if (this.eat(LatinSmallLetterR)) {
  6134. this._lastIntValue = CarriageReturn;
  6135. return true;
  6136. }
  6137. return false;
  6138. }
  6139. eatControlLetter() {
  6140. const cp = this.currentCodePoint;
  6141. if (isLatinLetter(cp)) {
  6142. this.advance();
  6143. this._lastIntValue = cp % 0x20;
  6144. return true;
  6145. }
  6146. return false;
  6147. }
  6148. eatRegExpUnicodeEscapeSequence() {
  6149. const start = this.index;
  6150. if (this.eat(LatinSmallLetterU)) {
  6151. if (this.eatFixedHexDigits(4)) {
  6152. const lead = this._lastIntValue;
  6153. if (this._uFlag && lead >= 0xd800 && lead <= 0xdbff) {
  6154. const leadSurrogateEnd = this.index;
  6155. if (this.eat(ReverseSolidus) &&
  6156. this.eat(LatinSmallLetterU) &&
  6157. this.eatFixedHexDigits(4)) {
  6158. const trail = this._lastIntValue;
  6159. if (trail >= 0xdc00 && trail <= 0xdfff) {
  6160. this._lastIntValue =
  6161. (lead - 0xd800) * 0x400 +
  6162. (trail - 0xdc00) +
  6163. 0x10000;
  6164. return true;
  6165. }
  6166. }
  6167. this.rewind(leadSurrogateEnd);
  6168. this._lastIntValue = lead;
  6169. }
  6170. return true;
  6171. }
  6172. if (this._uFlag &&
  6173. this.eat(LeftCurlyBracket) &&
  6174. this.eatHexDigits() &&
  6175. this.eat(RightCurlyBracket) &&
  6176. isValidUnicode(this._lastIntValue)) {
  6177. return true;
  6178. }
  6179. if (this.strict || this._uFlag) {
  6180. this.raise("Invalid unicode escape");
  6181. }
  6182. this.rewind(start);
  6183. }
  6184. return false;
  6185. }
  6186. eatIdentityEscape() {
  6187. if (this._uFlag) {
  6188. if (this.eatSyntaxCharacter()) {
  6189. return true;
  6190. }
  6191. if (this.eat(Solidus)) {
  6192. this._lastIntValue = Solidus;
  6193. return true;
  6194. }
  6195. return false;
  6196. }
  6197. if (this.isValidIdentityEscape(this.currentCodePoint)) {
  6198. this._lastIntValue = this.currentCodePoint;
  6199. this.advance();
  6200. return true;
  6201. }
  6202. return false;
  6203. }
  6204. isValidIdentityEscape(cp) {
  6205. if (cp === -1) {
  6206. return false;
  6207. }
  6208. if (this.strict) {
  6209. return !isIdContinue(cp);
  6210. }
  6211. return (cp !== LatinSmallLetterC &&
  6212. (!this._nFlag || cp !== LatinSmallLetterK));
  6213. }
  6214. eatDecimalEscape() {
  6215. this._lastIntValue = 0;
  6216. let cp = this.currentCodePoint;
  6217. if (cp >= DigitOne && cp <= DigitNine) {
  6218. do {
  6219. this._lastIntValue = 10 * this._lastIntValue + (cp - DigitZero);
  6220. this.advance();
  6221. } while ((cp = this.currentCodePoint) >= DigitZero &&
  6222. cp <= DigitNine);
  6223. return true;
  6224. }
  6225. return false;
  6226. }
  6227. eatCharacterClassEscape() {
  6228. const start = this.index;
  6229. if (this.eat(LatinSmallLetterD)) {
  6230. this._lastIntValue = -1;
  6231. this.onEscapeCharacterSet(start - 1, this.index, "digit", false);
  6232. return true;
  6233. }
  6234. if (this.eat(LatinCapitalLetterD)) {
  6235. this._lastIntValue = -1;
  6236. this.onEscapeCharacterSet(start - 1, this.index, "digit", true);
  6237. return true;
  6238. }
  6239. if (this.eat(LatinSmallLetterS)) {
  6240. this._lastIntValue = -1;
  6241. this.onEscapeCharacterSet(start - 1, this.index, "space", false);
  6242. return true;
  6243. }
  6244. if (this.eat(LatinCapitalLetterS)) {
  6245. this._lastIntValue = -1;
  6246. this.onEscapeCharacterSet(start - 1, this.index, "space", true);
  6247. return true;
  6248. }
  6249. if (this.eat(LatinSmallLetterW)) {
  6250. this._lastIntValue = -1;
  6251. this.onEscapeCharacterSet(start - 1, this.index, "word", false);
  6252. return true;
  6253. }
  6254. if (this.eat(LatinCapitalLetterW)) {
  6255. this._lastIntValue = -1;
  6256. this.onEscapeCharacterSet(start - 1, this.index, "word", true);
  6257. return true;
  6258. }
  6259. let negate = false;
  6260. if (this._uFlag &&
  6261. this.ecmaVersion >= 2018 &&
  6262. (this.eat(LatinSmallLetterP) ||
  6263. (negate = this.eat(LatinCapitalLetterP)))) {
  6264. this._lastIntValue = -1;
  6265. if (this.eat(LeftCurlyBracket) &&
  6266. this.eatUnicodePropertyValueExpression() &&
  6267. this.eat(RightCurlyBracket)) {
  6268. this.onUnicodePropertyCharacterSet(start - 1, this.index, "property", this._lastKeyValue, this._lastValValue || null, negate);
  6269. return true;
  6270. }
  6271. this.raise("Invalid property name");
  6272. }
  6273. return false;
  6274. }
  6275. eatUnicodePropertyValueExpression() {
  6276. const start = this.index;
  6277. if (this.eatUnicodePropertyName() && this.eat(EqualsSign)) {
  6278. this._lastKeyValue = this._lastStrValue;
  6279. if (this.eatUnicodePropertyValue()) {
  6280. this._lastValValue = this._lastStrValue;
  6281. if (isValidUnicodeProperty(this._lastKeyValue, this._lastValValue)) {
  6282. return true;
  6283. }
  6284. this.raise("Invalid property name");
  6285. }
  6286. }
  6287. this.rewind(start);
  6288. if (this.eatLoneUnicodePropertyNameOrValue()) {
  6289. const nameOrValue = this._lastStrValue;
  6290. if (isValidUnicodeProperty("General_Category", nameOrValue)) {
  6291. this._lastKeyValue = "General_Category";
  6292. this._lastValValue = nameOrValue;
  6293. return true;
  6294. }
  6295. if (isValidUnicodePropertyName(nameOrValue)) {
  6296. this._lastKeyValue = nameOrValue;
  6297. this._lastValValue = "";
  6298. return true;
  6299. }
  6300. this.raise("Invalid property name");
  6301. }
  6302. return false;
  6303. }
  6304. eatUnicodePropertyName() {
  6305. this._lastStrValue = "";
  6306. while (isUnicodePropertyNameCharacter(this.currentCodePoint)) {
  6307. this._lastStrValue += String.fromCodePoint(this.currentCodePoint);
  6308. this.advance();
  6309. }
  6310. return this._lastStrValue !== "";
  6311. }
  6312. eatUnicodePropertyValue() {
  6313. this._lastStrValue = "";
  6314. while (isUnicodePropertyValueCharacter(this.currentCodePoint)) {
  6315. this._lastStrValue += String.fromCodePoint(this.currentCodePoint);
  6316. this.advance();
  6317. }
  6318. return this._lastStrValue !== "";
  6319. }
  6320. eatLoneUnicodePropertyNameOrValue() {
  6321. return this.eatUnicodePropertyValue();
  6322. }
  6323. eatCharacterClass() {
  6324. const start = this.index;
  6325. if (this.eat(LeftSquareBracket)) {
  6326. const negate = this.eat(CircumflexAccent);
  6327. this.onCharacterClassEnter(start, negate);
  6328. this.classRanges();
  6329. if (!this.eat(RightSquareBracket)) {
  6330. this.raise("Unterminated character class");
  6331. }
  6332. this.onCharacterClassLeave(start, this.index, negate);
  6333. return true;
  6334. }
  6335. return false;
  6336. }
  6337. classRanges() {
  6338. let start = this.index;
  6339. while (this.eatClassAtom()) {
  6340. const left = this._lastIntValue;
  6341. const hyphenStart = this.index;
  6342. if (this.eat(HyphenMinus)) {
  6343. this.onCharacter(hyphenStart, this.index, HyphenMinus);
  6344. if (this.eatClassAtom()) {
  6345. const right = this._lastIntValue;
  6346. if (left === -1 || right === -1) {
  6347. if (this.strict) {
  6348. this.raise("Invalid character class");
  6349. }
  6350. }
  6351. else if (left > right) {
  6352. this.raise("Range out of order in character class");
  6353. }
  6354. else {
  6355. this.onCharacterClassRange(start, this.index, left, right);
  6356. }
  6357. }
  6358. }
  6359. start = this.index;
  6360. }
  6361. }
  6362. eatClassAtom() {
  6363. const start = this.index;
  6364. if (this.eat(ReverseSolidus)) {
  6365. if (this.eatClassEscape()) {
  6366. return true;
  6367. }
  6368. if (this._uFlag) {
  6369. this.raise("Invalid escape");
  6370. }
  6371. this.rewind(start);
  6372. }
  6373. const cp = this.currentCodePoint;
  6374. if (cp !== -1 && cp !== RightSquareBracket) {
  6375. this.advance();
  6376. this._lastIntValue = cp;
  6377. this.onCharacter(start, this.index, cp);
  6378. return true;
  6379. }
  6380. return false;
  6381. }
  6382. eatClassEscape() {
  6383. const start = this.index;
  6384. if (this.eat(LatinSmallLetterB)) {
  6385. this._lastIntValue = Backspace;
  6386. this.onCharacter(start - 1, this.index, Backspace);
  6387. return true;
  6388. }
  6389. if (this._uFlag && this.eat(HyphenMinus)) {
  6390. this._lastIntValue = HyphenMinus;
  6391. this.onCharacter(start - 1, this.index, HyphenMinus);
  6392. return true;
  6393. }
  6394. if (!this._uFlag && this.eat(LatinSmallLetterC)) {
  6395. if (this.eatClassControlLetter()) {
  6396. this.onCharacter(start - 1, this.index, this._lastIntValue);
  6397. return true;
  6398. }
  6399. this.rewind(start);
  6400. }
  6401. return this.eatCharacterClassEscape() || this.eatCharacterEscape();
  6402. }
  6403. eatClassControlLetter() {
  6404. const cp = this.currentCodePoint;
  6405. if (isDecimalDigit(cp) || cp === LowLine) {
  6406. this.advance();
  6407. this._lastIntValue = cp % 0x20;
  6408. return true;
  6409. }
  6410. return false;
  6411. }
  6412. eatHexEscapeSequence() {
  6413. const start = this.index;
  6414. if (this.eat(LatinSmallLetterX)) {
  6415. if (this.eatFixedHexDigits(2)) {
  6416. return true;
  6417. }
  6418. if (this._uFlag) {
  6419. this.raise("Invalid escape");
  6420. }
  6421. this.rewind(start);
  6422. }
  6423. return false;
  6424. }
  6425. eatDecimalDigits() {
  6426. const start = this.index;
  6427. this._lastIntValue = 0;
  6428. while (isDecimalDigit(this.currentCodePoint)) {
  6429. this._lastIntValue =
  6430. 10 * this._lastIntValue + digitToInt(this.currentCodePoint);
  6431. this.advance();
  6432. }
  6433. return this.index !== start;
  6434. }
  6435. eatHexDigits() {
  6436. const start = this.index;
  6437. this._lastIntValue = 0;
  6438. while (isHexDigit(this.currentCodePoint)) {
  6439. this._lastIntValue =
  6440. 16 * this._lastIntValue + digitToInt(this.currentCodePoint);
  6441. this.advance();
  6442. }
  6443. return this.index !== start;
  6444. }
  6445. eatLegacyOctalEscapeSequence() {
  6446. if (this.eatOctalDigit()) {
  6447. const n1 = this._lastIntValue;
  6448. if (this.eatOctalDigit()) {
  6449. const n2 = this._lastIntValue;
  6450. if (n1 <= 3 && this.eatOctalDigit()) {
  6451. this._lastIntValue = n1 * 64 + n2 * 8 + this._lastIntValue;
  6452. }
  6453. else {
  6454. this._lastIntValue = n1 * 8 + n2;
  6455. }
  6456. }
  6457. else {
  6458. this._lastIntValue = n1;
  6459. }
  6460. return true;
  6461. }
  6462. return false;
  6463. }
  6464. eatOctalDigit() {
  6465. const cp = this.currentCodePoint;
  6466. if (isOctalDigit(cp)) {
  6467. this.advance();
  6468. this._lastIntValue = cp - DigitZero;
  6469. return true;
  6470. }
  6471. this._lastIntValue = 0;
  6472. return false;
  6473. }
  6474. eatFixedHexDigits(length) {
  6475. const start = this.index;
  6476. this._lastIntValue = 0;
  6477. for (let i = 0; i < length; ++i) {
  6478. const cp = this.currentCodePoint;
  6479. if (!isHexDigit(cp)) {
  6480. this.rewind(start);
  6481. return false;
  6482. }
  6483. this._lastIntValue = 16 * this._lastIntValue + digitToInt(cp);
  6484. this.advance();
  6485. }
  6486. return true;
  6487. }
  6488. }
  6489. const DummyPattern = {};
  6490. const DummyFlags = {};
  6491. const DummyCapturingGroup = {};
  6492. class RegExpParserState {
  6493. constructor(options) {
  6494. this._node = DummyPattern;
  6495. this._flags = DummyFlags;
  6496. this._backreferences = [];
  6497. this._capturingGroups = [];
  6498. this.source = "";
  6499. this.strict = Boolean(options && options.strict);
  6500. this.ecmaVersion = (options && options.ecmaVersion) || 2018;
  6501. }
  6502. get pattern() {
  6503. if (this._node.type !== "Pattern") {
  6504. throw new Error("UnknownError");
  6505. }
  6506. return this._node;
  6507. }
  6508. get flags() {
  6509. if (this._flags.type !== "Flags") {
  6510. throw new Error("UnknownError");
  6511. }
  6512. return this._flags;
  6513. }
  6514. onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll) {
  6515. this._flags = {
  6516. type: "Flags",
  6517. parent: null,
  6518. start,
  6519. end,
  6520. raw: this.source.slice(start, end),
  6521. global,
  6522. ignoreCase,
  6523. multiline,
  6524. unicode,
  6525. sticky,
  6526. dotAll,
  6527. };
  6528. }
  6529. onPatternEnter(start) {
  6530. this._node = {
  6531. type: "Pattern",
  6532. parent: null,
  6533. start,
  6534. end: start,
  6535. raw: "",
  6536. alternatives: [],
  6537. };
  6538. this._backreferences.length = 0;
  6539. this._capturingGroups.length = 0;
  6540. }
  6541. onPatternLeave(start, end) {
  6542. this._node.end = end;
  6543. this._node.raw = this.source.slice(start, end);
  6544. for (const reference of this._backreferences) {
  6545. const ref = reference.ref;
  6546. const group = typeof ref === "number"
  6547. ? this._capturingGroups[ref - 1]
  6548. : this._capturingGroups.find(g => g.name === ref);
  6549. reference.resolved = group;
  6550. group.references.push(reference);
  6551. }
  6552. }
  6553. onAlternativeEnter(start) {
  6554. const parent = this._node;
  6555. if (parent.type !== "Assertion" &&
  6556. parent.type !== "CapturingGroup" &&
  6557. parent.type !== "Group" &&
  6558. parent.type !== "Pattern") {
  6559. throw new Error("UnknownError");
  6560. }
  6561. this._node = {
  6562. type: "Alternative",
  6563. parent,
  6564. start,
  6565. end: start,
  6566. raw: "",
  6567. elements: [],
  6568. };
  6569. parent.alternatives.push(this._node);
  6570. }
  6571. onAlternativeLeave(start, end) {
  6572. const node = this._node;
  6573. if (node.type !== "Alternative") {
  6574. throw new Error("UnknownError");
  6575. }
  6576. node.end = end;
  6577. node.raw = this.source.slice(start, end);
  6578. this._node = node.parent;
  6579. }
  6580. onGroupEnter(start) {
  6581. const parent = this._node;
  6582. if (parent.type !== "Alternative") {
  6583. throw new Error("UnknownError");
  6584. }
  6585. this._node = {
  6586. type: "Group",
  6587. parent,
  6588. start,
  6589. end: start,
  6590. raw: "",
  6591. alternatives: [],
  6592. };
  6593. parent.elements.push(this._node);
  6594. }
  6595. onGroupLeave(start, end) {
  6596. const node = this._node;
  6597. if (node.type !== "Group" || node.parent.type !== "Alternative") {
  6598. throw new Error("UnknownError");
  6599. }
  6600. node.end = end;
  6601. node.raw = this.source.slice(start, end);
  6602. this._node = node.parent;
  6603. }
  6604. onCapturingGroupEnter(start, name) {
  6605. const parent = this._node;
  6606. if (parent.type !== "Alternative") {
  6607. throw new Error("UnknownError");
  6608. }
  6609. this._node = {
  6610. type: "CapturingGroup",
  6611. parent,
  6612. start,
  6613. end: start,
  6614. raw: "",
  6615. name,
  6616. alternatives: [],
  6617. references: [],
  6618. };
  6619. parent.elements.push(this._node);
  6620. this._capturingGroups.push(this._node);
  6621. }
  6622. onCapturingGroupLeave(start, end) {
  6623. const node = this._node;
  6624. if (node.type !== "CapturingGroup" ||
  6625. node.parent.type !== "Alternative") {
  6626. throw new Error("UnknownError");
  6627. }
  6628. node.end = end;
  6629. node.raw = this.source.slice(start, end);
  6630. this._node = node.parent;
  6631. }
  6632. onQuantifier(start, end, min, max, greedy) {
  6633. const parent = this._node;
  6634. if (parent.type !== "Alternative") {
  6635. throw new Error("UnknownError");
  6636. }
  6637. const element = parent.elements.pop();
  6638. if (element == null ||
  6639. element.type === "Quantifier" ||
  6640. (element.type === "Assertion" && element.kind !== "lookahead")) {
  6641. throw new Error("UnknownError");
  6642. }
  6643. const node = {
  6644. type: "Quantifier",
  6645. parent,
  6646. start: element.start,
  6647. end,
  6648. raw: this.source.slice(element.start, end),
  6649. min,
  6650. max,
  6651. greedy,
  6652. element,
  6653. };
  6654. parent.elements.push(node);
  6655. element.parent = node;
  6656. }
  6657. onLookaroundAssertionEnter(start, kind, negate) {
  6658. const parent = this._node;
  6659. if (parent.type !== "Alternative") {
  6660. throw new Error("UnknownError");
  6661. }
  6662. this._node = {
  6663. type: "Assertion",
  6664. parent,
  6665. start,
  6666. end: start,
  6667. raw: "",
  6668. kind,
  6669. negate,
  6670. alternatives: [],
  6671. };
  6672. parent.elements.push(this._node);
  6673. }
  6674. onLookaroundAssertionLeave(start, end) {
  6675. const node = this._node;
  6676. if (node.type !== "Assertion" || node.parent.type !== "Alternative") {
  6677. throw new Error("UnknownError");
  6678. }
  6679. node.end = end;
  6680. node.raw = this.source.slice(start, end);
  6681. this._node = node.parent;
  6682. }
  6683. onEdgeAssertion(start, end, kind) {
  6684. const parent = this._node;
  6685. if (parent.type !== "Alternative") {
  6686. throw new Error("UnknownError");
  6687. }
  6688. parent.elements.push({
  6689. type: "Assertion",
  6690. parent,
  6691. start,
  6692. end,
  6693. raw: this.source.slice(start, end),
  6694. kind,
  6695. });
  6696. }
  6697. onWordBoundaryAssertion(start, end, kind, negate) {
  6698. const parent = this._node;
  6699. if (parent.type !== "Alternative") {
  6700. throw new Error("UnknownError");
  6701. }
  6702. parent.elements.push({
  6703. type: "Assertion",
  6704. parent,
  6705. start,
  6706. end,
  6707. raw: this.source.slice(start, end),
  6708. kind,
  6709. negate,
  6710. });
  6711. }
  6712. onAnyCharacterSet(start, end, kind) {
  6713. const parent = this._node;
  6714. if (parent.type !== "Alternative") {
  6715. throw new Error("UnknownError");
  6716. }
  6717. parent.elements.push({
  6718. type: "CharacterSet",
  6719. parent,
  6720. start,
  6721. end,
  6722. raw: this.source.slice(start, end),
  6723. kind,
  6724. });
  6725. }
  6726. onEscapeCharacterSet(start, end, kind, negate) {
  6727. const parent = this._node;
  6728. if (parent.type !== "Alternative" && parent.type !== "CharacterClass") {
  6729. throw new Error("UnknownError");
  6730. }
  6731. parent.elements.push({
  6732. type: "CharacterSet",
  6733. parent,
  6734. start,
  6735. end,
  6736. raw: this.source.slice(start, end),
  6737. kind,
  6738. negate,
  6739. });
  6740. }
  6741. onUnicodePropertyCharacterSet(start, end, kind, key, value, negate) {
  6742. const parent = this._node;
  6743. if (parent.type !== "Alternative" && parent.type !== "CharacterClass") {
  6744. throw new Error("UnknownError");
  6745. }
  6746. parent.elements.push({
  6747. type: "CharacterSet",
  6748. parent,
  6749. start,
  6750. end,
  6751. raw: this.source.slice(start, end),
  6752. kind,
  6753. key,
  6754. value,
  6755. negate,
  6756. });
  6757. }
  6758. onCharacter(start, end, value) {
  6759. const parent = this._node;
  6760. if (parent.type !== "Alternative" && parent.type !== "CharacterClass") {
  6761. throw new Error("UnknownError");
  6762. }
  6763. parent.elements.push({
  6764. type: "Character",
  6765. parent,
  6766. start,
  6767. end,
  6768. raw: this.source.slice(start, end),
  6769. value,
  6770. });
  6771. }
  6772. onBackreference(start, end, ref) {
  6773. const parent = this._node;
  6774. if (parent.type !== "Alternative") {
  6775. throw new Error("UnknownError");
  6776. }
  6777. const node = {
  6778. type: "Backreference",
  6779. parent,
  6780. start,
  6781. end,
  6782. raw: this.source.slice(start, end),
  6783. ref,
  6784. resolved: DummyCapturingGroup,
  6785. };
  6786. parent.elements.push(node);
  6787. this._backreferences.push(node);
  6788. }
  6789. onCharacterClassEnter(start, negate) {
  6790. const parent = this._node;
  6791. if (parent.type !== "Alternative") {
  6792. throw new Error("UnknownError");
  6793. }
  6794. this._node = {
  6795. type: "CharacterClass",
  6796. parent,
  6797. start,
  6798. end: start,
  6799. raw: "",
  6800. negate,
  6801. elements: [],
  6802. };
  6803. parent.elements.push(this._node);
  6804. }
  6805. onCharacterClassLeave(start, end) {
  6806. const node = this._node;
  6807. if (node.type !== "CharacterClass" ||
  6808. node.parent.type !== "Alternative") {
  6809. throw new Error("UnknownError");
  6810. }
  6811. node.end = end;
  6812. node.raw = this.source.slice(start, end);
  6813. this._node = node.parent;
  6814. }
  6815. onCharacterClassRange(start, end) {
  6816. const parent = this._node;
  6817. if (parent.type !== "CharacterClass") {
  6818. throw new Error("UnknownError");
  6819. }
  6820. const elements = parent.elements;
  6821. const max = elements.pop();
  6822. const hyphen = elements.pop();
  6823. const min = elements.pop();
  6824. if (!min ||
  6825. !max ||
  6826. !hyphen ||
  6827. min.type !== "Character" ||
  6828. max.type !== "Character" ||
  6829. hyphen.type !== "Character" ||
  6830. hyphen.value !== HyphenMinus) {
  6831. throw new Error("UnknownError");
  6832. }
  6833. const node = {
  6834. type: "CharacterClassRange",
  6835. parent,
  6836. start,
  6837. end,
  6838. raw: this.source.slice(start, end),
  6839. min,
  6840. max,
  6841. };
  6842. min.parent = node;
  6843. max.parent = node;
  6844. elements.push(node);
  6845. }
  6846. }
  6847. class RegExpParser {
  6848. constructor(options) {
  6849. this._state = new RegExpParserState(options);
  6850. this._validator = new RegExpValidator(this._state);
  6851. }
  6852. parseLiteral(source, start = 0, end = source.length) {
  6853. this._state.source = source;
  6854. this._validator.validateLiteral(source, start, end);
  6855. const pattern = this._state.pattern;
  6856. const flags = this._state.flags;
  6857. const literal = {
  6858. type: "RegExpLiteral",
  6859. parent: null,
  6860. start,
  6861. end,
  6862. raw: source,
  6863. pattern,
  6864. flags,
  6865. };
  6866. pattern.parent = literal;
  6867. flags.parent = literal;
  6868. return literal;
  6869. }
  6870. parseFlags(source, start = 0, end = source.length) {
  6871. this._state.source = source;
  6872. this._validator.validateFlags(source, start, end);
  6873. return this._state.flags;
  6874. }
  6875. parsePattern(source, start = 0, end = source.length, uFlag = false) {
  6876. this._state.source = source;
  6877. this._validator.validatePattern(source, start, end, uFlag);
  6878. return this._state.pattern;
  6879. }
  6880. }
  6881. class RegExpVisitor {
  6882. constructor(handlers) {
  6883. this._handlers = handlers;
  6884. }
  6885. visit(node) {
  6886. switch (node.type) {
  6887. case "Alternative":
  6888. this.visitAlternative(node);
  6889. break;
  6890. case "Assertion":
  6891. this.visitAssertion(node);
  6892. break;
  6893. case "Backreference":
  6894. this.visitBackreference(node);
  6895. break;
  6896. case "CapturingGroup":
  6897. this.visitCapturingGroup(node);
  6898. break;
  6899. case "Character":
  6900. this.visitCharacter(node);
  6901. break;
  6902. case "CharacterClass":
  6903. this.visitCharacterClass(node);
  6904. break;
  6905. case "CharacterClassRange":
  6906. this.visitCharacterClassRange(node);
  6907. break;
  6908. case "CharacterSet":
  6909. this.visitCharacterSet(node);
  6910. break;
  6911. case "Flags":
  6912. this.visitFlags(node);
  6913. break;
  6914. case "Group":
  6915. this.visitGroup(node);
  6916. break;
  6917. case "Pattern":
  6918. this.visitPattern(node);
  6919. break;
  6920. case "Quantifier":
  6921. this.visitQuantifier(node);
  6922. break;
  6923. case "RegExpLiteral":
  6924. this.visitRegExpLiteral(node);
  6925. break;
  6926. default:
  6927. throw new Error(`Unknown type: ${node.type}`);
  6928. }
  6929. }
  6930. visitAlternative(node) {
  6931. if (this._handlers.onAlternativeEnter) {
  6932. this._handlers.onAlternativeEnter(node);
  6933. }
  6934. node.elements.forEach(this.visit, this);
  6935. if (this._handlers.onAlternativeLeave) {
  6936. this._handlers.onAlternativeLeave(node);
  6937. }
  6938. }
  6939. visitAssertion(node) {
  6940. if (this._handlers.onAssertionEnter) {
  6941. this._handlers.onAssertionEnter(node);
  6942. }
  6943. if (node.kind === "lookahead" || node.kind === "lookbehind") {
  6944. node.alternatives.forEach(this.visit, this);
  6945. }
  6946. if (this._handlers.onAssertionLeave) {
  6947. this._handlers.onAssertionLeave(node);
  6948. }
  6949. }
  6950. visitBackreference(node) {
  6951. if (this._handlers.onBackreferenceEnter) {
  6952. this._handlers.onBackreferenceEnter(node);
  6953. }
  6954. if (this._handlers.onBackreferenceLeave) {
  6955. this._handlers.onBackreferenceLeave(node);
  6956. }
  6957. }
  6958. visitCapturingGroup(node) {
  6959. if (this._handlers.onCapturingGroupEnter) {
  6960. this._handlers.onCapturingGroupEnter(node);
  6961. }
  6962. node.alternatives.forEach(this.visit, this);
  6963. if (this._handlers.onCapturingGroupLeave) {
  6964. this._handlers.onCapturingGroupLeave(node);
  6965. }
  6966. }
  6967. visitCharacter(node) {
  6968. if (this._handlers.onCharacterEnter) {
  6969. this._handlers.onCharacterEnter(node);
  6970. }
  6971. if (this._handlers.onCharacterLeave) {
  6972. this._handlers.onCharacterLeave(node);
  6973. }
  6974. }
  6975. visitCharacterClass(node) {
  6976. if (this._handlers.onCharacterClassEnter) {
  6977. this._handlers.onCharacterClassEnter(node);
  6978. }
  6979. node.elements.forEach(this.visit, this);
  6980. if (this._handlers.onCharacterClassLeave) {
  6981. this._handlers.onCharacterClassLeave(node);
  6982. }
  6983. }
  6984. visitCharacterClassRange(node) {
  6985. if (this._handlers.onCharacterClassRangeEnter) {
  6986. this._handlers.onCharacterClassRangeEnter(node);
  6987. }
  6988. this.visitCharacter(node.min);
  6989. this.visitCharacter(node.max);
  6990. if (this._handlers.onCharacterClassRangeLeave) {
  6991. this._handlers.onCharacterClassRangeLeave(node);
  6992. }
  6993. }
  6994. visitCharacterSet(node) {
  6995. if (this._handlers.onCharacterSetEnter) {
  6996. this._handlers.onCharacterSetEnter(node);
  6997. }
  6998. if (this._handlers.onCharacterSetLeave) {
  6999. this._handlers.onCharacterSetLeave(node);
  7000. }
  7001. }
  7002. visitFlags(node) {
  7003. if (this._handlers.onFlagsEnter) {
  7004. this._handlers.onFlagsEnter(node);
  7005. }
  7006. if (this._handlers.onFlagsLeave) {
  7007. this._handlers.onFlagsLeave(node);
  7008. }
  7009. }
  7010. visitGroup(node) {
  7011. if (this._handlers.onGroupEnter) {
  7012. this._handlers.onGroupEnter(node);
  7013. }
  7014. node.alternatives.forEach(this.visit, this);
  7015. if (this._handlers.onGroupLeave) {
  7016. this._handlers.onGroupLeave(node);
  7017. }
  7018. }
  7019. visitPattern(node) {
  7020. if (this._handlers.onPatternEnter) {
  7021. this._handlers.onPatternEnter(node);
  7022. }
  7023. node.alternatives.forEach(this.visit, this);
  7024. if (this._handlers.onPatternLeave) {
  7025. this._handlers.onPatternLeave(node);
  7026. }
  7027. }
  7028. visitQuantifier(node) {
  7029. if (this._handlers.onQuantifierEnter) {
  7030. this._handlers.onQuantifierEnter(node);
  7031. }
  7032. this.visit(node.element);
  7033. if (this._handlers.onQuantifierLeave) {
  7034. this._handlers.onQuantifierLeave(node);
  7035. }
  7036. }
  7037. visitRegExpLiteral(node) {
  7038. if (this._handlers.onRegExpLiteralEnter) {
  7039. this._handlers.onRegExpLiteralEnter(node);
  7040. }
  7041. this.visitPattern(node.pattern);
  7042. this.visitFlags(node.flags);
  7043. if (this._handlers.onRegExpLiteralLeave) {
  7044. this._handlers.onRegExpLiteralLeave(node);
  7045. }
  7046. }
  7047. }
  7048. function parseRegExpLiteral(source, options) {
  7049. return new RegExpParser(options).parseLiteral(String(source));
  7050. }
  7051. function validateRegExpLiteral(source, options) {
  7052. return new RegExpValidator(options).validateLiteral(source);
  7053. }
  7054. function visitRegExpAST(node, handlers) {
  7055. new RegExpVisitor(handlers).visit(node);
  7056. }
  7057. exports.AST = ast;
  7058. exports.RegExpParser = RegExpParser;
  7059. exports.RegExpValidator = RegExpValidator;
  7060. exports.parseRegExpLiteral = parseRegExpLiteral;
  7061. exports.validateRegExpLiteral = validateRegExpLiteral;
  7062. exports.visitRegExpAST = visitRegExpAST;
  7063. //# sourceMappingURL=index.js.map