emptyv;": [8709], "emsp13;": [8196], "emsp14;": [8197], "eparsl;": [10723], "eqcirc;": [8790], "equals;": [61], "equest;": [8799], "female;": [9792], "ffilig;": [64259], "ffllig;": [64260], "forall;": [8704], "frac12;": [189], "frac13;": [8531], "frac14;": [188], "frac15;": [8533], "frac16;": [8537], "frac18;": [8539], "frac23;": [8532], "frac25;": [8534], "frac34;": [190], "frac35;": [8535], "frac38;": [8540], "frac45;": [8536], "frac56;": [8538], "frac58;": [8541], "frac78;": [8542], "gacute;": [501], "gammad;": [989], "gbreve;": [287], "gesdot;": [10880], "gesles;": [10900], "gtlPar;": [10645], "gtrarr;": [10616], "gtrdot;": [8919], "gtrsim;": [8819], "hairsp;": [8202], "hamilt;": [8459], "hardcy;": [1098], "hearts;": [9829], "hellip;": [8230], "hercon;": [8889], "homtht;": [8763], "horbar;": [8213], "hslash;": [8463], "hstrok;": [295], "hybull;": [8259], "hyphen;": [8208], "iacute;": [237], "igrave;": [236], "iiiint;": [10764], "iinfin;": [10716], "incare;": [8453], "inodot;": [305], "intcal;": [8890], "iquest;": [191], "isinsv;": [8947], "itilde;": [297], "jsercy;": [1112], "kappav;": [1008], "kcedil;": [311], "kgreen;": [312], "lAtail;": [10523], "lacute;": [314], "lagran;": [8466], "lambda;": [955], "langle;": [10216], "larrfs;": [10525], "larrhk;": [8617], "larrlp;": [8619], "larrpl;": [10553], "larrtl;": [8610], "latail;": [10521], "lbrace;": [123], "lbrack;": [91], "lcaron;": [318], "lcedil;": [316], "ldquor;": [8222], "lesdot;": [10879], "lesges;": [10899], "lfisht;": [10620], "lfloor;": [8970], "lharul;": [10602], "llhard;": [10603], "lmidot;": [320], "lmoust;": [9136], "loplus;": [10797], "lowast;": [8727], "lowbar;": [95], "lparlt;": [10643], "lrhard;": [10605], "lsaquo;": [8249], "lsquor;": [8218], "lstrok;": [322], "lthree;": [8907], "ltimes;": [8905], "ltlarr;": [10614], "ltrPar;": [10646], "mapsto;": [8614], "marker;": [9646], "mcomma;": [10793], "midast;": [42], "midcir;": [10992], "middot;": [183], "minusb;": [8863], "minusd;": [8760], "mnplus;": [8723], "models;": [8871], "mstpos;": [8766], "nVDash;": [8879], "nVdash;": [8878], "nacute;": [324], "nbumpe;": [8783, 824], "ncaron;": [328], "ncedil;": [326], "nearhk;": [10532], "nequiv;": [8802], "nesear;": [10536], "nexist;": [8708], "nltrie;": [8940], "notinE;": [8953, 824], "nparsl;": [11005, 8421], "nprcue;": [8928], "nrarrc;": [10547, 824], "nrarrw;": [8605, 824], "nrtrie;": [8941], "nsccue;": [8929], "nsimeq;": [8772], "ntilde;": [241], "numero;": [8470], "nvDash;": [8877], "nvHarr;": [10500], "nvdash;": [8876], "nvlArr;": [10498], "nvrArr;": [10499], "nwarhk;": [10531], "nwnear;": [10535], "oacute;": [243], "odblac;": [337], "odsold;": [10684], "ograve;": [242], "ominus;": [8854], "origof;": [8886], "oslash;": [248], "otilde;": [245], "otimes;": [8855], "parsim;": [10995], "percnt;": [37], "period;": [46], "permil;": [8240], "phmmat;": [8499], "planck;": [8463], "plankv;": [8463], "plusdo;": [8724], "plusdu;": [10789], "plusmn;": [177], "preceq;": [10927], "primes;": [8473], "prnsim;": [8936], "propto;": [8733], "prurel;": [8880], "puncsp;": [8200], "qprime;": [8279], "rAtail;": [10524], "racute;": [341], "rangle;": [10217], "rarrap;": [10613], "rarrfs;": [10526], "rarrhk;": [8618], "rarrlp;": [8620], "rarrpl;": [10565], "rarrtl;": [8611], "ratail;": [10522], "rbrace;": [125], "rbrack;": [93], "rcaron;": [345], "rcedil;": [343], "rdquor;": [8221], "rfisht;": [10621], "rfloor;": [8971], "rharul;": [10604], "rmoust;": [9137], "roplus;": [10798], "rpargt;": [10644], "rsaquo;": [8250], "rsquor;": [8217], "rthree;": [8908], "rtimes;": [8906], "sacute;": [347], "scaron;": [353], "scedil;": [351], "scnsim;": [8937], "searhk;": [10533], "seswar;": [10537], "sfrown;": [8994], "shchcy;": [1097], "sigmaf;": [962], "sigmav;": [962], "simdot;": [10858], "smashp;": [10803], "softcy;": [1100], "solbar;": [9023], "spades;": [9824], "sqcaps;": [8851, 65024], "sqcups;": [8852, 65024], "sqsube;": [8849], "sqsupe;": [8850], "square;": [9633], "squarf;": [9642], "ssetmn;": [8726], "ssmile;": [8995], "sstarf;": [8902], "subdot;": [10941], "subset;": [8834], "subsim;": [10951], "subsub;": [10965], "subsup;": [10963], "succeq;": [10928], "supdot;": [10942], "supset;": [8835], "supsim;": [10952], "supsub;": [10964], "supsup;": [10966], "swarhk;": [10534], "swnwar;": [10538], "target;": [8982], "tcaron;": [357], "tcedil;": [355], "telrec;": [8981], "there4;": [8756], "thetav;": [977], "thinsp;": [8201], "thksim;": [8764], "timesb;": [8864], "timesd;": [10800], "topbot;": [9014], "topcir;": [10993], "tprime;": [8244], "tridot;": [9708], "tstrok;": [359], "uacute;": [250], "ubreve;": [365], "udblac;": [369], "ufisht;": [10622], "ugrave;": [249], "ulcorn;": [8988], "ulcrop;": [8975], "urcorn;": [8989], "urcrop;": [8974], "utilde;": [361], "vangrt;": [10652], "varphi;": [981], "varrho;": [1009], "veebar;": [8891], "vellip;": [8942], "verbar;": [124], "vsubnE;": [10955, 65024], "vsubne;": [8842, 65024], "vsupnE;": [10956, 65024], "vsupne;": [8843, 65024], "wedbar;": [10847], "wedgeq;": [8793], "weierp;": [8472], "wreath;": [8768], "xoplus;": [10753], "xotime;": [10754], "xsqcup;": [10758], "xuplus;": [10756], "xwedge;": [8896], "yacute;": [253], "zacute;": [378], "zcaron;": [382], "zeetrf;": [8488] } }, { "length": 6, "entities": { "AElig;": [198], "Aacute": [193], "Acirc;": [194], "Agrave": [192], "Alpha;": [913], "Amacr;": [256], "Aogon;": [260], "Aring;": [197], "Atilde": [195], "Breve;": [728], "Ccedil": [199], "Ccirc;": [264], "Colon;": [8759], "Cross;": [10799], "Dashv;": [10980], "Delta;": [916], "Eacute": [201], "Ecirc;": [202], "Egrave": [200], "Emacr;": [274], "Eogon;": [280], "Equal;": [10869], "Gamma;": [915], "Gcirc;": [284], "Hacek;": [711], "Hcirc;": [292], "IJlig;": [306], "Iacute": [205], "Icirc;": [206], "Igrave": [204], "Imacr;": [298], "Iogon;": [302], "Iukcy;": [1030], "Jcirc;": [308], "Jukcy;": [1028], "Kappa;": [922], "Ntilde": [209], "OElig;": [338], "Oacute": [211], "Ocirc;": [212], "Ograve": [210], "Omacr;": [332], "Omega;": [937], "Oslash": [216], "Otilde": [213], "Prime;": [8243], "RBarr;": [10512], "Scirc;": [348], "Sigma;": [931], "THORN;": [222], "TRADE;": [8482], "TSHcy;": [1035], "Theta;": [920], "Tilde;": [8764], "Uacute": [218], "Ubrcy;": [1038], "Ucirc;": [219], "Ugrave": [217], "Umacr;": [362], "Union;": [8899], "Uogon;": [370], "UpTee;": [8869], "Uring;": [366], "VDash;": [8875], "Vdash;": [8873], "Wcirc;": [372], "Wedge;": [8896], "Yacute": [221], "Ycirc;": [374], "aacute": [225], "acirc;": [226], "acute;": [180], "aelig;": [230], "agrave": [224], "aleph;": [8501], "alpha;": [945], "amacr;": [257], "amalg;": [10815], "angle;": [8736], "angrt;": [8735], "angst;": [197], "aogon;": [261], "aring;": [229], "asymp;": [8776], "atilde": [227], "awint;": [10769], "bcong;": [8780], "bdquo;": [8222], "bepsi;": [1014], "blank;": [9251], "blk12;": [9618], "blk14;": [9617], "blk34;": [9619], "block;": [9608], "boxDL;": [9559], "boxDR;": [9556], "boxDl;": [9558], "boxDr;": [9555], "boxHD;": [9574], "boxHU;": [9577], "boxHd;": [9572], "boxHu;": [9575], "boxUL;": [9565], "boxUR;": [9562], "boxUl;": [9564], "boxUr;": [9561], "boxVH;": [9580], "boxVL;": [9571], "boxVR;": [9568], "boxVh;": [9579], "boxVl;": [9570], "boxVr;": [9567], "boxdL;": [9557], "boxdR;": [9554], "boxdl;": [9488], "boxdr;": [9484], "boxhD;": [9573], "boxhU;": [9576], "boxhd;": [9516], "boxhu;": [9524], "boxuL;": [9563], "boxuR;": [9560], "boxul;": [9496], "boxur;": [9492], "boxvH;": [9578], "boxvL;": [9569], "boxvR;": [9566], "boxvh;": [9532], "boxvl;": [9508], "boxvr;": [9500], "breve;": [728], "brvbar": [166], "bsemi;": [8271], "bsime;": [8909], "bsolb;": [10693], "bumpE;": [10926], "bumpe;": [8783], "caret;": [8257], "caron;": [711], "ccaps;": [10829], "ccedil": [231], "ccirc;": [265], "ccups;": [10828], "cedil;": [184], "check;": [10003], "clubs;": [9827], "colon;": [58], "comma;": [44], "crarr;": [8629], "cross;": [10007], "csube;": [10961], "csupe;": [10962], "ctdot;": [8943], "cuepr;": [8926], "cuesc;": [8927], "cupor;": [10821], "curren": [164], "cuvee;": [8910], "cuwed;": [8911], "cwint;": [8753], "dashv;": [8867], "dblac;": [733], "ddarr;": [8650], "delta;": [948], "dharl;": [8643], "dharr;": [8642], "diams;": [9830], "disin;": [8946], "divide": [247], "doteq;": [8784], "dtdot;": [8945], "dtrif;": [9662], "duarr;": [8693], "duhar;": [10607], "eDDot;": [10871], "eacute": [233], "ecirc;": [234], "efDot;": [8786], "egrave": [232], "emacr;": [275], "empty;": [8709], "eogon;": [281], "eplus;": [10865], "epsiv;": [1013], "eqsim;": [8770], "equiv;": [8801], "erDot;": [8787], "erarr;": [10609], "esdot;": [8784], "exist;": [8707], "fflig;": [64256], "filig;": [64257], "fjlig;": [102, 106], "fllig;": [64258], "fltns;": [9649], "forkv;": [10969], "frac12": [189], "frac14": [188], "frac34": [190], "frasl;": [8260], "frown;": [8994], "gamma;": [947], "gcirc;": [285], "gescc;": [10921], "gimel;": [8503], "gneqq;": [8809], "gnsim;": [8935], "grave;": [96], "gsime;": [10894], "gsiml;": [10896], "gtcir;": [10874], "gtdot;": [8919], "harrw;": [8621], "hcirc;": [293], "hoarr;": [8703], "iacute": [237], "icirc;": [238], "iexcl;": [161], "igrave": [236], "iiint;": [8749], "iiota;": [8489], "ijlig;": [307], "imacr;": [299], "image;": [8465], "imath;": [305], "imped;": [437], "infin;": [8734], "iogon;": [303], "iprod;": [10812], "iquest": [191], "isinE;": [8953], "isins;": [8948], "isinv;": [8712], "iukcy;": [1110], "jcirc;": [309], "jmath;": [567], "jukcy;": [1108], "kappa;": [954], "lAarr;": [8666], "lBarr;": [10510], "langd;": [10641], "laquo;": [171], "larrb;": [8676], "lates;": [10925, 65024], "lbarr;": [10508], "lbbrk;": [10098], "lbrke;": [10635], "lceil;": [8968], "ldquo;": [8220], "lescc;": [10920], "lhard;": [8637], "lharu;": [8636], "lhblk;": [9604], "llarr;": [8647], "lltri;": [9722], "lneqq;": [8808], "lnsim;": [8934], "loang;": [10220], "loarr;": [8701], "lobrk;": [10214], "lopar;": [10629], "lrarr;": [8646], "lrhar;": [8651], "lrtri;": [8895], "lsime;": [10893], "lsimg;": [10895], "lsquo;": [8216], "ltcir;": [10873], "ltdot;": [8918], "ltrie;": [8884], "ltrif;": [9666], "mDDot;": [8762], "mdash;": [8212], "micro;": [181], "middot": [183], "minus;": [8722], "mumap;": [8888], "nabla;": [8711], "napid;": [8779, 824], "napos;": [329], "natur;": [9838], "nbump;": [8782, 824], "ncong;": [8775], "ndash;": [8211], "neArr;": [8663], "nearr;": [8599], "nedot;": [8784, 824], "nesim;": [8770, 824], "ngeqq;": [8807, 824], "ngsim;": [8821], "nhArr;": [8654], "nharr;": [8622], "nhpar;": [10994], "nlArr;": [8653], "nlarr;": [8602], "nleqq;": [8806, 824], "nless;": [8814], "nlsim;": [8820], "nltri;": [8938], "notin;": [8713], "notni;": [8716], "npart;": [8706, 824], "nprec;": [8832], "nrArr;": [8655], "nrarr;": [8603], "nrtri;": [8939], "nsime;": [8772], "nsmid;": [8740], "nspar;": [8742], "nsubE;": [10949, 824], "nsube;": [8840], "nsucc;": [8833], "nsupE;": [10950, 824], "nsupe;": [8841], "ntilde": [241], "numsp;": [8199], "nvsim;": [8764, 8402], "nwArr;": [8662], "nwarr;": [8598], "oacute": [243], "ocirc;": [244], "odash;": [8861], "oelig;": [339], "ofcir;": [10687], "ograve": [242], "ohbar;": [10677], "olarr;": [8634], "olcir;": [10686], "oline;": [8254], "omacr;": [333], "omega;": [969], "operp;": [10681], "oplus;": [8853], "orarr;": [8635], "order;": [8500], "oslash": [248], "otilde": [245], "ovbar;": [9021], "parsl;": [11005], "phone;": [9742], "plusb;": [8862], "pluse;": [10866], "plusmn": [177], "pound;": [163], "prcue;": [8828], "prime;": [8242], "prnap;": [10937], "prsim;": [8830], "quest;": [63], "rAarr;": [8667], "rBarr;": [10511], "radic;": [8730], "rangd;": [10642], "range;": [10661], "raquo;": [187], "rarrb;": [8677], "rarrc;": [10547], "rarrw;": [8605], "ratio;": [8758], "rbarr;": [10509], "rbbrk;": [10099], "rbrke;": [10636], "rceil;": [8969], "rdquo;": [8221], "reals;": [8477], "rhard;": [8641], "rharu;": [8640], "rlarr;": [8644], "rlhar;": [8652], "rnmid;": [10990], "roang;": [10221], "roarr;": [8702], "robrk;": [10215], "ropar;": [10630], "rrarr;": [8649], "rsquo;": [8217], "rtrie;": [8885], "rtrif;": [9656], "sbquo;": [8218], "sccue;": [8829], "scirc;": [349], "scnap;": [10938], "scsim;": [8831], "sdotb;": [8865], "sdote;": [10854], "seArr;": [8664], "searr;": [8600], "setmn;": [8726], "sharp;": [9839], "sigma;": [963], "simeq;": [8771], "simgE;": [10912], "simlE;": [10911], "simne;": [8774], "slarr;": [8592], "smile;": [8995], "smtes;": [10924, 65024], "sqcap;": [8851], "sqcup;": [8852], "sqsub;": [8847], "sqsup;": [8848], "srarr;": [8594], "starf;": [9733], "strns;": [175], "subnE;": [10955], "subne;": [8842], "supnE;": [10956], "supne;": [8843], "swArr;": [8665], "swarr;": [8601], "szlig;": [223], "theta;": [952], "thkap;": [8776], "thorn;": [254], "tilde;": [732], "times;": [215], "trade;": [8482], "trisb;": [10701], "tshcy;": [1115], "twixt;": [8812], "uacute": [250], "ubrcy;": [1118], "ucirc;": [251], "udarr;": [8645], "udhar;": [10606], "ugrave": [249], "uharl;": [8639], "uharr;": [8638], "uhblk;": [9600], "ultri;": [9720], "umacr;": [363], "uogon;": [371], "uplus;": [8846], "upsih;": [978], "uring;": [367], "urtri;": [9721], "utdot;": [8944], "utrif;": [9652], "uuarr;": [8648], "vBarv;": [10985], "vDash;": [8872], "varpi;": [982], "vdash;": [8866], "veeeq;": [8794], "vltri;": [8882], "vnsub;": [8834, 8402], "vnsup;": [8835, 8402], "vprop;": [8733], "vrtri;": [8883], "wcirc;": [373], "wedge;": [8743], "xcirc;": [9711], "xdtri;": [9661], "xhArr;": [10234], "xharr;": [10231], "xlArr;": [10232], "xlarr;": [10229], "xodot;": [10752], "xrArr;": [10233], "xrarr;": [10230], "xutri;": [9651], "yacute": [253], "ycirc;": [375] } }, { "length": 5, "entities": { "AElig": [198], "Acirc": [194], "Aopf;": [120120], "Aring": [197], "Ascr;": [119964], "Auml;": [196], "Barv;": [10983], "Beta;": [914], "Bopf;": [120121], "Bscr;": [8492], "CHcy;": [1063], "COPY;": [169], "Cdot;": [266], "Copf;": [8450], "Cscr;": [119966], "DJcy;": [1026], "DScy;": [1029], "DZcy;": [1039], "Darr;": [8609], "Dopf;": [120123], "Dscr;": [119967], "Ecirc": [202], "Edot;": [278], "Eopf;": [120124], "Escr;": [8496], "Esim;": [10867], "Euml;": [203], "Fopf;": [120125], "Fscr;": [8497], "GJcy;": [1027], "Gdot;": [288], "Gopf;": [120126], "Gscr;": [119970], "Hopf;": [8461], "Hscr;": [8459], "IEcy;": [1045], "IOcy;": [1025], "Icirc": [206], "Idot;": [304], "Iopf;": [120128], "Iota;": [921], "Iscr;": [8464], "Iuml;": [207], "Jopf;": [120129], "Jscr;": [119973], "KHcy;": [1061], "KJcy;": [1036], "Kopf;": [120130], "Kscr;": [119974], "LJcy;": [1033], "Lang;": [10218], "Larr;": [8606], "Lopf;": [120131], "Lscr;": [8466], "Mopf;": [120132], "Mscr;": [8499], "NJcy;": [1034], "Nopf;": [8469], "Nscr;": [119977], "Ocirc": [212], "Oopf;": [120134], "Oscr;": [119978], "Ouml;": [214], "Popf;": [8473], "Pscr;": [119979], "QUOT;": [34], "Qopf;": [8474], "Qscr;": [119980], "Rang;": [10219], "Rarr;": [8608], "Ropf;": [8477], "Rscr;": [8475], "SHcy;": [1064], "Sopf;": [120138], "Sqrt;": [8730], "Sscr;": [119982], "Star;": [8902], "THORN": [222], "TScy;": [1062], "Topf;": [120139], "Tscr;": [119983], "Uarr;": [8607], "Ucirc": [219], "Uopf;": [120140], "Upsi;": [978], "Uscr;": [119984], "Uuml;": [220], "Vbar;": [10987], "Vert;": [8214], "Vopf;": [120141], "Vscr;": [119985], "Wopf;": [120142], "Wscr;": [119986], "Xopf;": [120143], "Xscr;": [119987], "YAcy;": [1071], "YIcy;": [1031], "YUcy;": [1070], "Yopf;": [120144], "Yscr;": [119988], "Yuml;": [376], "ZHcy;": [1046], "Zdot;": [379], "Zeta;": [918], "Zopf;": [8484], "Zscr;": [119989], "acirc": [226], "acute": [180], "aelig": [230], "andd;": [10844], "andv;": [10842], "ange;": [10660], "aopf;": [120146], "apid;": [8779], "apos;": [39], "aring": [229], "ascr;": [119990], "auml;": [228], "bNot;": [10989], "bbrk;": [9141], "beta;": [946], "beth;": [8502], "bnot;": [8976], "bopf;": [120147], "boxH;": [9552], "boxV;": [9553], "boxh;": [9472], "boxv;": [9474], "bscr;": [119991], "bsim;": [8765], "bsol;": [92], "bull;": [8226], "bump;": [8782], "caps;": [8745, 65024], "cdot;": [267], "cedil": [184], "cent;": [162], "chcy;": [1095], "cirE;": [10691], "circ;": [710], "cire;": [8791], "comp;": [8705], "cong;": [8773], "copf;": [120148], "copy;": [169], "cscr;": [119992], "csub;": [10959], "csup;": [10960], "cups;": [8746, 65024], "dArr;": [8659], "dHar;": [10597], "darr;": [8595], "dash;": [8208], "diam;": [8900], "djcy;": [1106], "dopf;": [120149], "dscr;": [119993], "dscy;": [1109], "dsol;": [10742], "dtri;": [9663], "dzcy;": [1119], "eDot;": [8785], "ecir;": [8790], "ecirc": [234], "edot;": [279], "emsp;": [8195], "ensp;": [8194], "eopf;": [120150], "epar;": [8917], "epsi;": [949], "escr;": [8495], "esim;": [8770], "euml;": [235], "euro;": [8364], "excl;": [33], "flat;": [9837], "fnof;": [402], "fopf;": [120151], "fork;": [8916], "fscr;": [119995], "gdot;": [289], "geqq;": [8807], "gesl;": [8923, 65024], "gjcy;": [1107], "gnap;": [10890], "gneq;": [10888], "gopf;": [120152], "gscr;": [8458], "gsim;": [8819], "gtcc;": [10919], "gvnE;": [8809, 65024], "hArr;": [8660], "half;": [189], "harr;": [8596], "hbar;": [8463], "hopf;": [120153], "hscr;": [119997], "icirc": [238], "iecy;": [1077], "iexcl": [161], "imof;": [8887], "iocy;": [1105], "iopf;": [120154], "iota;": [953], "iscr;": [119998], "isin;": [8712], "iuml;": [239], "jopf;": [120155], "jscr;": [119999], "khcy;": [1093], "kjcy;": [1116], "kopf;": [120156], "kscr;": [120000], "lArr;": [8656], "lHar;": [10594], "lang;": [10216], "laquo": [171], "larr;": [8592], "late;": [10925], "lcub;": [123], "ldca;": [10550], "ldsh;": [8626], "leqq;": [8806], "lesg;": [8922, 65024], "ljcy;": [1113], "lnap;": [10889], "lneq;": [10887], "lopf;": [120157], "lozf;": [10731], "lpar;": [40], "lscr;": [120001], "lsim;": [8818], "lsqb;": [91], "ltcc;": [10918], "ltri;": [9667], "lvnE;": [8808, 65024], "macr;": [175], "male;": [9794], "malt;": [10016], "micro": [181], "mlcp;": [10971], "mldr;": [8230], "mopf;": [120158], "mscr;": [120002], "nGtv;": [8811, 824], "nLtv;": [8810, 824], "nang;": [8736, 8402], "napE;": [10864, 824], "nbsp;": [160], "ncap;": [10819], "ncup;": [10818], "ngeq;": [8817], "nges;": [10878, 824], "ngtr;": [8815], "nisd;": [8954], "njcy;": [1114], "nldr;": [8229], "nleq;": [8816], "nles;": [10877, 824], "nmid;": [8740], "nopf;": [120159], "npar;": [8742], "npre;": [10927, 824], "nsce;": [10928, 824], "nscr;": [120003], "nsim;": [8769], "nsub;": [8836], "nsup;": [8837], "ntgl;": [8825], "ntlg;": [8824], "nvap;": [8781, 8402], "nvge;": [8805, 8402], "nvgt;": [62, 8402], "nvle;": [8804, 8402], "nvlt;": [60, 8402], "oast;": [8859], "ocir;": [8858], "ocirc": [244], "odiv;": [10808], "odot;": [8857], "ogon;": [731], "oint;": [8750], "omid;": [10678], "oopf;": [120160], "opar;": [10679], "ordf;": [170], "ordm;": [186], "oror;": [10838], "oscr;": [8500], "osol;": [8856], "ouml;": [246], "para;": [182], "part;": [8706], "perp;": [8869], "phiv;": [981], "plus;": [43], "popf;": [120161], "pound": [163], "prap;": [10935], "prec;": [8826], "prnE;": [10933], "prod;": [8719], "prop;": [8733], "pscr;": [120005], "qint;": [10764], "qopf;": [120162], "qscr;": [120006], "quot;": [34], "rArr;": [8658], "rHar;": [10596], "race;": [8765, 817], "rang;": [10217], "raquo": [187], "rarr;": [8594], "rcub;": [125], "rdca;": [10551], "rdsh;": [8627], "real;": [8476], "rect;": [9645], "rhov;": [1009], "ring;": [730], "ropf;": [120163], "rpar;": [41], "rscr;": [120007], "rsqb;": [93], "rtri;": [9657], "scap;": [10936], "scnE;": [10934], "sdot;": [8901], "sect;": [167], "semi;": [59], "sext;": [10038], "shcy;": [1096], "sime;": [8771], "simg;": [10910], "siml;": [10909], "smid;": [8739], "smte;": [10924], "solb;": [10692], "sopf;": [120164], "spar;": [8741], "squf;": [9642], "sscr;": [120008], "star;": [9734], "subE;": [10949], "sube;": [8838], "succ;": [8827], "sung;": [9834], "sup1;": [185], "sup2;": [178], "sup3;": [179], "supE;": [10950], "supe;": [8839], "szlig": [223], "tbrk;": [9140], "tdot;": [8411], "thorn": [254], "times": [215], "tint;": [8749], "toea;": [10536], "topf;": [120165], "tosa;": [10537], "trie;": [8796], "tscr;": [120009], "tscy;": [1094], "uArr;": [8657], "uHar;": [10595], "uarr;": [8593], "ucirc": [251], "uopf;": [120166], "upsi;": [965], "uscr;": [120010], "utri;": [9653], "uuml;": [252], "vArr;": [8661], "vBar;": [10984], "varr;": [8597], "vert;": [124], "vopf;": [120167], "vscr;": [120011], "wopf;": [120168], "wscr;": [120012], "xcap;": [8898], "xcup;": [8899], "xmap;": [10236], "xnis;": [8955], "xopf;": [120169], "xscr;": [120013], "xvee;": [8897], "yacy;": [1103], "yicy;": [1111], "yopf;": [120170], "yscr;": [120014], "yucy;": [1102], "yuml;": [255], "zdot;": [380], "zeta;": [950], "zhcy;": [1078], "zopf;": [120171], "zscr;": [120015], "zwnj;": [8204] } }, { "length": 4, "entities": { "AMP;": [38], "Acy;": [1040], "Afr;": [120068], "And;": [10835], "Auml": [196], "Bcy;": [1041], "Bfr;": [120069], "COPY": [169], "Cap;": [8914], "Cfr;": [8493], "Chi;": [935], "Cup;": [8915], "Dcy;": [1044], "Del;": [8711], "Dfr;": [120071], "Dot;": [168], "ENG;": [330], "ETH;": [208], "Ecy;": [1069], "Efr;": [120072], "Eta;": [919], "Euml": [203], "Fcy;": [1060], "Ffr;": [120073], "Gcy;": [1043], "Gfr;": [120074], "Hat;": [94], "Hfr;": [8460], "Icy;": [1048], "Ifr;": [8465], "Int;": [8748], "Iuml": [207], "Jcy;": [1049], "Jfr;": [120077], "Kcy;": [1050], "Kfr;": [120078], "Lcy;": [1051], "Lfr;": [120079], "Lsh;": [8624], "Map;": [10501], "Mcy;": [1052], "Mfr;": [120080], "Ncy;": [1053], "Nfr;": [120081], "Not;": [10988], "Ocy;": [1054], "Ofr;": [120082], "Ouml": [214], "Pcy;": [1055], "Pfr;": [120083], "Phi;": [934], "Psi;": [936], "QUOT": [34], "Qfr;": [120084], "REG;": [174], "Rcy;": [1056], "Rfr;": [8476], "Rho;": [929], "Rsh;": [8625], "Scy;": [1057], "Sfr;": [120086], "Sub;": [8912], "Sum;": [8721], "Sup;": [8913], "Tab;": [9], "Tau;": [932], "Tcy;": [1058], "Tfr;": [120087], "Ucy;": [1059], "Ufr;": [120088], "Uuml": [220], "Vcy;": [1042], "Vee;": [8897], "Vfr;": [120089], "Wfr;": [120090], "Xfr;": [120091], "Ycy;": [1067], "Yfr;": [120092], "Zcy;": [1047], "Zfr;": [8488], "acE;": [8766, 819], "acd;": [8767], "acy;": [1072], "afr;": [120094], "amp;": [38], "and;": [8743], "ang;": [8736], "apE;": [10864], "ape;": [8778], "ast;": [42], "auml": [228], "bcy;": [1073], "bfr;": [120095], "bne;": [61, 8421], "bot;": [8869], "cap;": [8745], "cent": [162], "cfr;": [120096], "chi;": [967], "cir;": [9675], "copy": [169], "cup;": [8746], "dcy;": [1076], "deg;": [176], "dfr;": [120097], "die;": [168], "div;": [247], "dot;": [729], "ecy;": [1101], "efr;": [120098], "egs;": [10902], "ell;": [8467], "els;": [10901], "eng;": [331], "eta;": [951], "eth;": [240], "euml": [235], "fcy;": [1092], "ffr;": [120099], "gEl;": [10892], "gap;": [10886], "gcy;": [1075], "gel;": [8923], "geq;": [8805], "ges;": [10878], "gfr;": [120100], "ggg;": [8921], "glE;": [10898], "gla;": [10917], "glj;": [10916], "gnE;": [8809], "gne;": [10888], "hfr;": [120101], "icy;": [1080], "iff;": [8660], "ifr;": [120102], "int;": [8747], "iuml": [239], "jcy;": [1081], "jfr;": [120103], "kcy;": [1082], "kfr;": [120104], "lEg;": [10891], "lap;": [10885], "lat;": [10923], "lcy;": [1083], "leg;": [8922], "leq;": [8804], "les;": [10877], "lfr;": [120105], "lgE;": [10897], "lnE;": [8808], "lne;": [10887], "loz;": [9674], "lrm;": [8206], "lsh;": [8624], "macr": [175], "map;": [8614], "mcy;": [1084], "mfr;": [120106], "mho;": [8487], "mid;": [8739], "nGg;": [8921, 824], "nGt;": [8811, 8402], "nLl;": [8920, 824], "nLt;": [8810, 8402], "nap;": [8777], "nbsp": [160], "ncy;": [1085], "nfr;": [120107], "ngE;": [8807, 824], "nge;": [8817], "ngt;": [8815], "nis;": [8956], "niv;": [8715], "nlE;": [8806, 824], "nle;": [8816], "nlt;": [8814], "not;": [172], "npr;": [8832], "nsc;": [8833], "num;": [35], "ocy;": [1086], "ofr;": [120108], "ogt;": [10689], "ohm;": [937], "olt;": [10688], "ord;": [10845], "ordf": [170], "ordm": [186], "orv;": [10843], "ouml": [246], "par;": [8741], "para": [182], "pcy;": [1087], "pfr;": [120109], "phi;": [966], "piv;": [982], "prE;": [10931], "pre;": [10927], "psi;": [968], "qfr;": [120110], "quot": [34], "rcy;": [1088], "reg;": [174], "rfr;": [120111], "rho;": [961], "rlm;": [8207], "rsh;": [8625], "scE;": [10932], "sce;": [10928], "scy;": [1089], "sect": [167], "sfr;": [120112], "shy;": [173], "sim;": [8764], "smt;": [10922], "sol;": [47], "squ;": [9633], "sub;": [8834], "sum;": [8721], "sup1": [185], "sup2": [178], "sup3": [179], "sup;": [8835], "tau;": [964], "tcy;": [1090], "tfr;": [120113], "top;": [8868], "ucy;": [1091], "ufr;": [120114], "uml;": [168], "uuml": [252], "vcy;": [1074], "vee;": [8744], "vfr;": [120115], "wfr;": [120116], "xfr;": [120117], "ycy;": [1099], "yen;": [165], "yfr;": [120118], "yuml": [255], "zcy;": [1079], "zfr;": [120119], "zwj;": [8205] } }, { "length": 3, "entities": { "AMP": [38], "DD;": [8517], "ETH": [208], "GT;": [62], "Gg;": [8921], "Gt;": [8811], "Im;": [8465], "LT;": [60], "Ll;": [8920], "Lt;": [8810], "Mu;": [924], "Nu;": [925], "Or;": [10836], "Pi;": [928], "Pr;": [10939], "REG": [174], "Re;": [8476], "Sc;": [10940], "Xi;": [926], "ac;": [8766], "af;": [8289], "amp": [38], "ap;": [8776], "dd;": [8518], "deg": [176], "ee;": [8519], "eg;": [10906], "el;": [10905], "eth": [240], "gE;": [8807], "ge;": [8805], "gg;": [8811], "gl;": [8823], "gt;": [62], "ic;": [8291], "ii;": [8520], "in;": [8712], "it;": [8290], "lE;": [8806], "le;": [8804], "lg;": [8822], "ll;": [8810], "lt;": [60], "mp;": [8723], "mu;": [956], "ne;": [8800], "ni;": [8715], "not": [172], "nu;": [957], "oS;": [9416], "or;": [8744], "pi;": [960], "pm;": [177], "pr;": [8826], "reg": [174], "rx;": [8478], "sc;": [8827], "shy": [173], "uml": [168], "wp;": [8472], "wr;": [8768], "xi;": [958], "yen": [165] } }, { "length": 2, "entities": { "GT": [62], "LT": [60], "gt": [62], "lt": [60] } }]; const EOF = -1; const NULL = 0x00; const TABULATION = 0x09; const CARRIAGE_RETURN = 0x0D; const LINE_FEED = 0x0A; const FORM_FEED = 0x0C; const SPACE = 0x20; const EXCLAMATION_MARK = 0x21; const QUOTATION_MARK = 0x22; const NUMBER_SIGN = 0x23; const AMPERSAND = 0x26; const APOSTROPHE = 0x27; const HYPHEN_MINUS = 0x2D; const SOLIDUS = 0x2F; const DIGIT_0 = 0x30; const DIGIT_9 = 0x39; const SEMICOLON = 0x3B; const LESS_THAN_SIGN = 0x3C; const EQUALS_SIGN = 0x3D; const GREATER_THAN_SIGN = 0x3E; const QUESTION_MARK = 0x3F; const LATIN_CAPITAL_A = 0x41; const LATIN_CAPITAL_D = 0x44; const LATIN_CAPITAL_F = 0x46; const LATIN_CAPITAL_X = 0x58; const LATIN_CAPITAL_Z = 0x5A; const LEFT_SQUARE_BRACKET = 0x5B; const RIGHT_SQUARE_BRACKET = 0x5D; const GRAVE_ACCENT = 0x60; const LATIN_SMALL_A = 0x61; const LATIN_SMALL_F = 0x66; const LATIN_SMALL_X = 0x78; const LATIN_SMALL_Z = 0x7A; const LEFT_CURLY_BRACKET = 0x7B; const RIGHT_CURLY_BRACKET = 0x7D; const NULL_REPLACEMENT = 0xFFFD; function isWhitespace(cp) { return cp === TABULATION || cp === LINE_FEED || cp === FORM_FEED || cp === CARRIAGE_RETURN || cp === SPACE; } function isUpperLetter(cp) { return cp >= LATIN_CAPITAL_A && cp <= LATIN_CAPITAL_Z; } function isLowerLetter(cp) { return cp >= LATIN_SMALL_A && cp <= LATIN_SMALL_Z; } function isLetter(cp) { return isLowerLetter(cp) || isUpperLetter(cp); } function isDigit(cp) { return cp >= DIGIT_0 && cp <= DIGIT_9; } function isUpperHexDigit(cp) { return cp >= LATIN_CAPITAL_A && cp <= LATIN_CAPITAL_F; } function isLowerHexDigit(cp) { return cp >= LATIN_SMALL_A && cp <= LATIN_SMALL_F; } function isHexDigit(cp) { return isDigit(cp) || isUpperHexDigit(cp) || isLowerHexDigit(cp); } function isControl(cp) { return (cp >= 0 && cp <= 0x1F) || (cp >= 0x7F && cp <= 0x9F); } function isSurrogate(cp) { return cp >= 0xD800 && cp <= 0xDFFF; } function isSurrogatePair(cp) { return cp >= 0xDC00 && cp <= 0xDFFF; } function isNonCharacter(cp) { return ((cp >= 0xFDD0 && cp <= 0xFDEF) || ((cp & 0xFFFE) === 0xFFFE && cp <= 0x10FFFF)); } function toLowerCodePoint(cp) { return cp + 0x0020; } class Tokenizer { constructor(text) { debug("[html] the source code length: %d", text.length); this.text = text; this.gaps = []; this.lineTerminators = []; this.lastCodePoint = NULL; this.offset = -1; this.column = -1; this.line = 1; this.state = "DATA"; this.returnState = "DATA"; this.reconsuming = false; this.buffer = []; this.crStartOffset = -1; this.crCode = 0; this.errors = []; this.committedToken = null; this.provisionalToken = null; this.currentToken = null; this.lastTagOpenToken = null; this.tokenStartOffset = -1; this.tokenStartColumn = -1; this.tokenStartLine = 1; this.namespace = NS.HTML; this.expressionEnabled = false; } nextToken() { let cp = this.lastCodePoint; while (this.committedToken == null && (cp !== EOF || this.reconsuming)) { if (this.provisionalToken != null && !this.isProvisionalState()) { this.commitProvisionalToken(); if (this.committedToken != null) { break; } } if (this.reconsuming) { this.reconsuming = false; cp = this.lastCodePoint; } else { cp = this.consumeNextCodePoint(); } debug("[html] parse", cp, this.state); this.state = this[this.state](cp); } { const token = this.consumeCommittedToken(); if (token != null) { return token; } } assert(cp === EOF); if (this.currentToken != null) { this.endToken(); const token = this.consumeCommittedToken(); if (token != null) { return token; } } return this.currentToken; } consumeCommittedToken() { const token = this.committedToken; this.committedToken = null; return token; } consumeNextCodePoint() { if (this.offset >= this.text.length) { this.lastCodePoint = EOF; return EOF; } this.offset += (this.lastCodePoint >= 0x10000 ? 2 : 1); if (this.offset >= this.text.length) { this.advanceLocation(); this.lastCodePoint = EOF; return EOF; } const cp = this.text.codePointAt(this.offset); if (isSurrogate(this.text.charCodeAt(this.offset)) && !isSurrogatePair(this.text.charCodeAt(this.offset + 1))) { this.reportParseError("surrogate-in-input-stream"); } if (isNonCharacter(cp)) { this.reportParseError("noncharacter-in-input-stream"); } if (isControl(cp) && !isWhitespace(cp) && cp !== NULL) { this.reportParseError("control-character-in-input-stream"); } if (this.lastCodePoint === CARRIAGE_RETURN && cp === LINE_FEED) { this.lastCodePoint = LINE_FEED; this.gaps.push(this.offset); return this.consumeNextCodePoint(); } this.advanceLocation(); this.lastCodePoint = cp; if (cp === CARRIAGE_RETURN) { return LINE_FEED; } return cp; } advanceLocation() { if (this.lastCodePoint === LINE_FEED) { this.lineTerminators.push(this.offset); this.line += 1; this.column = 0; } else { this.column += (this.lastCodePoint >= 0x10000 ? 2 : 1); } } reconsumeAs(state) { this.reconsuming = true; return state; } reportParseError(code) { const error = ParseError.fromCode(code, this.offset, this.line, this.column); this.errors.push(error); debug("[html] syntax error:", error.message); } setStartTokenMark() { this.tokenStartOffset = this.offset; this.tokenStartLine = this.line; this.tokenStartColumn = this.column; } clearStartTokenMark() { this.tokenStartOffset = -1; } startToken(type) { if (this.tokenStartOffset === -1) { this.setStartTokenMark(); } const offset = this.tokenStartOffset; const line = this.tokenStartLine; const column = this.tokenStartColumn; if (this.currentToken != null) { this.endToken(); } this.tokenStartOffset = -1; const token = this.currentToken = { type, range: [offset, -1], loc: { start: { line, column }, end: { line: -1, column: -1 }, }, value: "", }; debug("[html] start token: %d %s", offset, token.type); return this.currentToken; } endToken() { if (this.currentToken == null) { throw new Error("Invalid state"); } if (this.tokenStartOffset === -1) { this.setStartTokenMark(); } const token = this.currentToken; const offset = this.tokenStartOffset; const line = this.tokenStartLine; const column = this.tokenStartColumn; const provisional = this.isProvisionalState(); this.currentToken = null; this.tokenStartOffset = -1; token.range[1] = offset; token.loc.end.line = line; token.loc.end.column = column; if (token.range[0] === offset && !provisional) { debug("[html] abandon token: %j %s %j", token.range, token.type, token.value); return null; } if (provisional) { if (this.provisionalToken != null) { this.commitProvisionalToken(); } this.provisionalToken = token; debug("[html] provisional-commit token: %j %s %j", token.range, token.type, token.value); } else { this.commitToken(token); } return token; } commitToken(token) { assert(this.committedToken == null, "Invalid state: the commited token existed already."); debug("[html] commit token: %j %j %s %j", token.range, token.loc, token.type, token.value); this.committedToken = token; if (token.type === "HTMLTagOpen") { this.lastTagOpenToken = token; } } isProvisionalState() { return this.state.startsWith("RCDATA_") || this.state.startsWith("RAWTEXT_"); } commitProvisionalToken() { assert(this.provisionalToken != null, "Invalid state: the provisional token was not found."); const token = this.provisionalToken; this.provisionalToken = null; if (token.range[0] < token.range[1]) { this.commitToken(token); } } rollbackProvisionalToken() { assert(this.currentToken != null); assert(this.provisionalToken != null); const token = this.currentToken; debug("[html] rollback token: %d %s", token.range[0], token.type); this.currentToken = this.provisionalToken; this.provisionalToken = null; } appendTokenValue(cp, expected) { const token = this.currentToken; if (token == null || (expected != null && token.type !== expected)) { const msg1 = (expected ? `"${expected}" type` : "any token"); const msg2 = (token ? `"${token.type}" type` : "no token"); throw new Error(`Tokenizer: Invalid state. Expected ${msg1}, but got ${msg2}.`); } token.value += String.fromCodePoint(cp); } isAppropriateEndTagOpen() { return (this.currentToken != null && this.lastTagOpenToken != null && this.currentToken.type === "HTMLEndTagOpen" && this.currentToken.value === this.lastTagOpenToken.value); } DATA(cp) { this.clearStartTokenMark(); while (true) { const type = isWhitespace(cp) ? "HTMLWhitespace" : "HTMLText"; if (this.currentToken != null && this.currentToken.type !== type) { this.endToken(); return this.reconsumeAs(this.state); } if (this.currentToken == null) { this.startToken(type); } if (cp === AMPERSAND) { this.returnState = "DATA"; return "CHARACTER_REFERENCE"; } if (cp === LESS_THAN_SIGN) { this.setStartTokenMark(); return "TAG_OPEN"; } if (cp === LEFT_CURLY_BRACKET && this.expressionEnabled) { this.setStartTokenMark(); this.returnState = "DATA"; return "V_EXPRESSION_START"; } if (cp === RIGHT_CURLY_BRACKET && this.expressionEnabled) { this.setStartTokenMark(); this.returnState = "DATA"; return "V_EXPRESSION_END"; } if (cp === EOF) { return "DATA"; } if (cp === NULL) { this.reportParseError("unexpected-null-character"); } this.appendTokenValue(cp, type); cp = this.consumeNextCodePoint(); } } RCDATA(cp) { this.clearStartTokenMark(); while (true) { const type = isWhitespace(cp) ? "HTMLWhitespace" : "HTMLRCDataText"; if (this.currentToken != null && this.currentToken.type !== type) { this.endToken(); return this.reconsumeAs(this.state); } if (this.currentToken == null) { this.startToken(type); } if (cp === AMPERSAND) { this.returnState = "RCDATA"; return "CHARACTER_REFERENCE"; } if (cp === LESS_THAN_SIGN) { this.setStartTokenMark(); return "RCDATA_LESS_THAN_SIGN"; } if (cp === LEFT_CURLY_BRACKET && this.expressionEnabled) { this.setStartTokenMark(); this.returnState = "RCDATA"; return "V_EXPRESSION_START"; } if (cp === RIGHT_CURLY_BRACKET && this.expressionEnabled) { this.setStartTokenMark(); this.returnState = "RCDATA"; return "V_EXPRESSION_END"; } if (cp === EOF) { return "DATA"; } if (cp === NULL) { this.reportParseError("unexpected-null-character"); cp = NULL_REPLACEMENT; } this.appendTokenValue(cp, type); cp = this.consumeNextCodePoint(); } } RAWTEXT(cp) { this.clearStartTokenMark(); while (true) { const type = isWhitespace(cp) ? "HTMLWhitespace" : "HTMLRawText"; if (this.currentToken != null && this.currentToken.type !== type) { this.endToken(); return this.reconsumeAs(this.state); } if (this.currentToken == null) { this.startToken(type); } if (cp === LESS_THAN_SIGN) { this.setStartTokenMark(); return "RAWTEXT_LESS_THAN_SIGN"; } if (cp === LEFT_CURLY_BRACKET && this.expressionEnabled) { this.setStartTokenMark(); this.returnState = "RAWTEXT"; return "V_EXPRESSION_START"; } if (cp === RIGHT_CURLY_BRACKET && this.expressionEnabled) { this.setStartTokenMark(); this.returnState = "RAWTEXT"; return "V_EXPRESSION_END"; } if (cp === EOF) { return "DATA"; } if (cp === NULL) { this.reportParseError("unexpected-null-character"); cp = NULL_REPLACEMENT; } this.appendTokenValue(cp, type); cp = this.consumeNextCodePoint(); } } TAG_OPEN(cp) { if (cp === EXCLAMATION_MARK) { return "MARKUP_DECLARATION_OPEN"; } if (cp === SOLIDUS) { return "END_TAG_OPEN"; } if (isLetter(cp)) { this.startToken("HTMLTagOpen"); return this.reconsumeAs("TAG_NAME"); } if (cp === QUESTION_MARK) { this.reportParseError("unexpected-question-mark-instead-of-tag-name"); this.startToken("HTMLBogusComment"); return this.reconsumeAs("BOGUS_COMMENT"); } if (cp === EOF) { this.clearStartTokenMark(); this.reportParseError("eof-before-tag-name"); this.appendTokenValue(LESS_THAN_SIGN, "HTMLText"); return "DATA"; } this.reportParseError("invalid-first-character-of-tag-name"); this.appendTokenValue(LESS_THAN_SIGN, "HTMLText"); return this.reconsumeAs("DATA"); } END_TAG_OPEN(cp) { if (isLetter(cp)) { this.startToken("HTMLEndTagOpen"); return this.reconsumeAs("TAG_NAME"); } if (cp === GREATER_THAN_SIGN) { this.endToken(); this.reportParseError("missing-end-tag-name"); return "DATA"; } if (cp === EOF) { this.clearStartTokenMark(); this.reportParseError("eof-before-tag-name"); this.appendTokenValue(LESS_THAN_SIGN, "HTMLText"); this.appendTokenValue(SOLIDUS, "HTMLText"); return "DATA"; } this.reportParseError("invalid-first-character-of-tag-name"); this.startToken("HTMLBogusComment"); return this.reconsumeAs("BOGUS_COMMENT"); } TAG_NAME(cp) { while (true) { if (isWhitespace(cp)) { this.endToken(); return "BEFORE_ATTRIBUTE_NAME"; } if (cp === SOLIDUS) { this.endToken(); this.setStartTokenMark(); return "SELF_CLOSING_START_TAG"; } if (cp === GREATER_THAN_SIGN) { this.startToken("HTMLTagClose"); return "DATA"; } if (cp === EOF) { this.reportParseError("eof-in-tag"); return "DATA"; } if (cp === NULL) { this.reportParseError("unexpected-null-character"); cp = NULL_REPLACEMENT; } this.appendTokenValue(isUpperLetter(cp) ? toLowerCodePoint(cp) : cp, null); cp = this.consumeNextCodePoint(); } } RCDATA_LESS_THAN_SIGN(cp) { if (cp === SOLIDUS) { this.buffer = []; return "RCDATA_END_TAG_OPEN"; } this.appendTokenValue(LESS_THAN_SIGN, "HTMLRCDataText"); return this.reconsumeAs("RCDATA"); } RCDATA_END_TAG_OPEN(cp) { if (isLetter(cp)) { this.startToken("HTMLEndTagOpen"); return this.reconsumeAs("RCDATA_END_TAG_NAME"); } this.appendTokenValue(LESS_THAN_SIGN, "HTMLRCDataText"); this.appendTokenValue(SOLIDUS, "HTMLRCDataText"); return this.reconsumeAs("RCDATA"); } RCDATA_END_TAG_NAME(cp) { while (true) { if (isWhitespace(cp) && this.isAppropriateEndTagOpen()) { this.endToken(); return "BEFORE_ATTRIBUTE_NAME"; } if (cp === SOLIDUS && this.isAppropriateEndTagOpen()) { this.endToken(); this.setStartTokenMark(); return "SELF_CLOSING_START_TAG"; } if (cp === GREATER_THAN_SIGN && this.isAppropriateEndTagOpen()) { this.startToken("HTMLTagClose"); return "DATA"; } if (!isLetter(cp)) { this.rollbackProvisionalToken(); this.appendTokenValue(LESS_THAN_SIGN, "HTMLRCDataText"); this.appendTokenValue(SOLIDUS, "HTMLRCDataText"); for (const cp1 of this.buffer) { this.appendTokenValue(cp1, "HTMLRCDataText"); } return this.reconsumeAs("RCDATA"); } this.appendTokenValue(isUpperLetter(cp) ? toLowerCodePoint(cp) : cp, "HTMLEndTagOpen"); this.buffer.push(cp); cp = this.consumeNextCodePoint(); } } RAWTEXT_LESS_THAN_SIGN(cp) { if (cp === SOLIDUS) { this.buffer = []; return "RAWTEXT_END_TAG_OPEN"; } this.appendTokenValue(LESS_THAN_SIGN, "HTMLRawText"); return this.reconsumeAs("RAWTEXT"); } RAWTEXT_END_TAG_OPEN(cp) { if (isLetter(cp)) { this.startToken("HTMLEndTagOpen"); return this.reconsumeAs("RAWTEXT_END_TAG_NAME"); } this.appendTokenValue(LESS_THAN_SIGN, "HTMLRawText"); this.appendTokenValue(SOLIDUS, "HTMLRawText"); return this.reconsumeAs("RAWTEXT"); } RAWTEXT_END_TAG_NAME(cp) { while (true) { if (cp === SOLIDUS && this.isAppropriateEndTagOpen()) { this.endToken(); this.setStartTokenMark(); return "SELF_CLOSING_START_TAG"; } if (cp === GREATER_THAN_SIGN && this.isAppropriateEndTagOpen()) { this.startToken("HTMLTagClose"); return "DATA"; } if (isWhitespace(cp) && this.isAppropriateEndTagOpen()) { this.endToken(); return "BEFORE_ATTRIBUTE_NAME"; } if (!isLetter(cp)) { this.rollbackProvisionalToken(); this.appendTokenValue(LESS_THAN_SIGN, "HTMLRawText"); this.appendTokenValue(SOLIDUS, "HTMLRawText"); for (const cp1 of this.buffer) { this.appendTokenValue(cp1, "HTMLRawText"); } return this.reconsumeAs("RAWTEXT"); } this.appendTokenValue(isUpperLetter(cp) ? toLowerCodePoint(cp) : cp, "HTMLEndTagOpen"); this.buffer.push(cp); cp = this.consumeNextCodePoint(); } } BEFORE_ATTRIBUTE_NAME(cp) { while (isWhitespace(cp)) { cp = this.consumeNextCodePoint(); } if (cp === SOLIDUS || cp === GREATER_THAN_SIGN || cp === EOF) { return this.reconsumeAs("AFTER_ATTRIBUTE_NAME"); } if (cp === EQUALS_SIGN) { this.reportParseError("unexpected-equals-sign-before-attribute-name"); this.startToken("HTMLIdentifier"); this.appendTokenValue(cp, "HTMLIdentifier"); return "ATTRIBUTE_NAME"; } this.startToken("HTMLIdentifier"); return this.reconsumeAs("ATTRIBUTE_NAME"); } ATTRIBUTE_NAME(cp) { while (true) { if (isWhitespace(cp) || cp === SOLIDUS || cp === GREATER_THAN_SIGN || cp === EOF) { this.endToken(); return this.reconsumeAs("AFTER_ATTRIBUTE_NAME"); } if (cp === EQUALS_SIGN) { this.startToken("HTMLAssociation"); return "BEFORE_ATTRIBUTE_VALUE"; } if (cp === NULL) { this.reportParseError("unexpected-null-character"); cp = NULL_REPLACEMENT; } if (cp === QUOTATION_MARK || cp === APOSTROPHE || cp === LESS_THAN_SIGN) { this.reportParseError("unexpected-character-in-attribute-name"); } this.appendTokenValue(isUpperLetter(cp) ? toLowerCodePoint(cp) : cp, "HTMLIdentifier"); cp = this.consumeNextCodePoint(); } } AFTER_ATTRIBUTE_NAME(cp) { while (isWhitespace(cp)) { cp = this.consumeNextCodePoint(); } if (cp === SOLIDUS) { this.setStartTokenMark(); return "SELF_CLOSING_START_TAG"; } if (cp === EQUALS_SIGN) { this.startToken("HTMLAssociation"); return "BEFORE_ATTRIBUTE_VALUE"; } if (cp === GREATER_THAN_SIGN) { this.startToken("HTMLTagClose"); return "DATA"; } if (cp === EOF) { this.reportParseError("eof-in-tag"); return "DATA"; } this.startToken("HTMLIdentifier"); return this.reconsumeAs("ATTRIBUTE_NAME"); } BEFORE_ATTRIBUTE_VALUE(cp) { this.endToken(); while (isWhitespace(cp)) { cp = this.consumeNextCodePoint(); } if (cp === GREATER_THAN_SIGN) { this.reportParseError("missing-attribute-value"); this.startToken("HTMLTagClose"); return "DATA"; } this.startToken("HTMLLiteral"); if (cp === QUOTATION_MARK) { return "ATTRIBUTE_VALUE_DOUBLE_QUOTED"; } if (cp === APOSTROPHE) { return "ATTRIBUTE_VALUE_SINGLE_QUOTED"; } return this.reconsumeAs("ATTRIBUTE_VALUE_UNQUOTED"); } ATTRIBUTE_VALUE_DOUBLE_QUOTED(cp) { while (true) { if (cp === QUOTATION_MARK) { return "AFTER_ATTRIBUTE_VALUE_QUOTED"; } if (cp === AMPERSAND) { this.returnState = "ATTRIBUTE_VALUE_DOUBLE_QUOTED"; return "CHARACTER_REFERENCE"; } if (cp === NULL) { this.reportParseError("unexpected-null-character"); cp = NULL_REPLACEMENT; } if (cp === EOF) { this.reportParseError("eof-in-tag"); return "DATA"; } this.appendTokenValue(cp, "HTMLLiteral"); cp = this.consumeNextCodePoint(); } } ATTRIBUTE_VALUE_SINGLE_QUOTED(cp) { while (true) { if (cp === APOSTROPHE) { return "AFTER_ATTRIBUTE_VALUE_QUOTED"; } if (cp === AMPERSAND) { this.returnState = "ATTRIBUTE_VALUE_SINGLE_QUOTED"; return "CHARACTER_REFERENCE"; } if (cp === NULL) { this.reportParseError("unexpected-null-character"); cp = NULL_REPLACEMENT; } if (cp === EOF) { this.reportParseError("eof-in-tag"); return "DATA"; } this.appendTokenValue(cp, "HTMLLiteral"); cp = this.consumeNextCodePoint(); } } ATTRIBUTE_VALUE_UNQUOTED(cp) { while (true) { if (isWhitespace(cp)) { this.endToken(); return "BEFORE_ATTRIBUTE_NAME"; } if (cp === AMPERSAND) { this.returnState = "ATTRIBUTE_VALUE_UNQUOTED"; return "CHARACTER_REFERENCE"; } if (cp === GREATER_THAN_SIGN) { this.startToken("HTMLTagClose"); return "DATA"; } if (cp === NULL) { this.reportParseError("unexpected-null-character"); cp = NULL_REPLACEMENT; } if (cp === QUOTATION_MARK || cp === APOSTROPHE || cp === LESS_THAN_SIGN || cp === EQUALS_SIGN || cp === GRAVE_ACCENT) { this.reportParseError("unexpected-character-in-unquoted-attribute-value"); } if (cp === EOF) { this.reportParseError("eof-in-tag"); return "DATA"; } this.appendTokenValue(cp, "HTMLLiteral"); cp = this.consumeNextCodePoint(); } } AFTER_ATTRIBUTE_VALUE_QUOTED(cp) { this.endToken(); if (isWhitespace(cp)) { return "BEFORE_ATTRIBUTE_NAME"; } if (cp === SOLIDUS) { this.setStartTokenMark(); return "SELF_CLOSING_START_TAG"; } if (cp === GREATER_THAN_SIGN) { this.startToken("HTMLTagClose"); return "DATA"; } if (cp === EOF) { this.reportParseError("eof-in-tag"); return "DATA"; } this.reportParseError("missing-whitespace-between-attributes"); return this.reconsumeAs("BEFORE_ATTRIBUTE_NAME"); } SELF_CLOSING_START_TAG(cp) { if (cp === GREATER_THAN_SIGN) { this.startToken("HTMLSelfClosingTagClose"); return "DATA"; } if (cp === EOF) { this.reportParseError("eof-in-tag"); return "DATA"; } this.reportParseError("unexpected-solidus-in-tag"); this.clearStartTokenMark(); return this.reconsumeAs("BEFORE_ATTRIBUTE_NAME"); } BOGUS_COMMENT(cp) { while (true) { if (cp === GREATER_THAN_SIGN) { return "DATA"; } if (cp === EOF) { return "DATA"; } if (cp === NULL) { cp = NULL_REPLACEMENT; } this.appendTokenValue(cp, null); cp = this.consumeNextCodePoint(); } } MARKUP_DECLARATION_OPEN(cp) { if (cp === HYPHEN_MINUS && this.text[this.offset + 1] === "-") { this.offset += 1; this.column += 1; this.startToken("HTMLComment"); return "COMMENT_START"; } if (cp === LATIN_CAPITAL_D && this.text.slice(this.offset + 1, this.offset + 7) === "OCTYPE") { this.startToken("HTMLBogusComment"); this.appendTokenValue(cp, "HTMLBogusComment"); return "BOGUS_COMMENT"; } if (cp === LEFT_SQUARE_BRACKET && this.text.slice(this.offset + 1, this.offset + 7) === "CDATA[") { this.offset += 6; this.column += 6; if (this.namespace === NS.HTML) { this.reportParseError("cdata-in-html-content"); this.startToken("HTMLBogusComment").value = "[CDATA["; return "BOGUS_COMMENT"; } this.startToken("HTMLCDataText"); return "CDATA_SECTION"; } this.reportParseError("incorrectly-opened-comment"); this.startToken("HTMLBogusComment"); return this.reconsumeAs("BOGUS_COMMENT"); } COMMENT_START(cp) { if (cp === HYPHEN_MINUS) { return "COMMENT_START_DASH"; } if (cp === GREATER_THAN_SIGN) { this.reportParseError("abrupt-closing-of-empty-comment"); return "DATA"; } return this.reconsumeAs("COMMENT"); } COMMENT_START_DASH(cp) { if (cp === HYPHEN_MINUS) { return "COMMENT_END"; } if (cp === GREATER_THAN_SIGN) { this.reportParseError("abrupt-closing-of-empty-comment"); return "DATA"; } if (cp === EOF) { this.reportParseError("eof-in-comment"); return "DATA"; } this.appendTokenValue(HYPHEN_MINUS, "HTMLComment"); return this.reconsumeAs("COMMENT"); } COMMENT(cp) { while (true) { if (cp === LESS_THAN_SIGN) { this.appendTokenValue(LESS_THAN_SIGN, "HTMLComment"); return "COMMENT_LESS_THAN_SIGN"; } if (cp === HYPHEN_MINUS) { return "COMMENT_END_DASH"; } if (cp === NULL) { this.reportParseError("unexpected-null-character"); cp = NULL_REPLACEMENT; } if (cp === EOF) { this.reportParseError("eof-in-comment"); return "DATA"; } this.appendTokenValue(cp, "HTMLComment"); cp = this.consumeNextCodePoint(); } } COMMENT_LESS_THAN_SIGN(cp) { while (true) { if (cp === EXCLAMATION_MARK) { this.appendTokenValue(cp, "HTMLComment"); return "COMMENT_LESS_THAN_SIGN_BANG"; } if (cp !== LESS_THAN_SIGN) { return this.reconsumeAs("COMMENT"); } this.appendTokenValue(cp, "HTMLComment"); cp = this.consumeNextCodePoint(); } } COMMENT_LESS_THAN_SIGN_BANG(cp) { if (cp === HYPHEN_MINUS) { return "COMMENT_LESS_THAN_SIGN_BANG_DASH"; } return this.reconsumeAs("COMMENT"); } COMMENT_LESS_THAN_SIGN_BANG_DASH(cp) { if (cp === HYPHEN_MINUS) { return "COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH"; } return this.reconsumeAs("COMMENT_END_DASH"); } COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH(cp) { if (cp !== GREATER_THAN_SIGN && cp !== EOF) { this.reportParseError("nested-comment"); } return this.reconsumeAs("COMMENT_END"); } COMMENT_END_DASH(cp) { if (cp === HYPHEN_MINUS) { return "COMMENT_END"; } if (cp === EOF) { this.reportParseError("eof-in-comment"); return "DATA"; } this.appendTokenValue(HYPHEN_MINUS, "HTMLComment"); return this.reconsumeAs("COMMENT"); } COMMENT_END(cp) { while (true) { if (cp === GREATER_THAN_SIGN) { return "DATA"; } if (cp === EXCLAMATION_MARK) { return "COMMENT_END_BANG"; } if (cp === EOF) { this.reportParseError("eof-in-comment"); return "DATA"; } this.appendTokenValue(HYPHEN_MINUS, "HTMLComment"); if (cp !== HYPHEN_MINUS) { return this.reconsumeAs("COMMENT"); } cp = this.consumeNextCodePoint(); } } COMMENT_END_BANG(cp) { if (cp === HYPHEN_MINUS) { this.appendTokenValue(HYPHEN_MINUS, "HTMLComment"); this.appendTokenValue(EXCLAMATION_MARK, "HTMLComment"); return "COMMENT_END_DASH"; } if (cp === GREATER_THAN_SIGN) { this.reportParseError("incorrectly-closed-comment"); return "DATA"; } if (cp === EOF) { this.reportParseError("eof-in-comment"); return "DATA"; } this.appendTokenValue(HYPHEN_MINUS, "HTMLComment"); this.appendTokenValue(EXCLAMATION_MARK, "HTMLComment"); return this.reconsumeAs("COMMENT"); } CDATA_SECTION(cp) { while (true) { if (cp === RIGHT_SQUARE_BRACKET) { return "CDATA_SECTION_BRACKET"; } if (cp === EOF) { this.reportParseError("eof-in-cdata"); return "DATA"; } this.appendTokenValue(cp, "HTMLCDataText"); cp = this.consumeNextCodePoint(); } } CDATA_SECTION_BRACKET(cp) { if (cp === RIGHT_SQUARE_BRACKET) { return "CDATA_SECTION_END"; } this.appendTokenValue(RIGHT_SQUARE_BRACKET, "HTMLCDataText"); return this.reconsumeAs("CDATA_SECTION"); } CDATA_SECTION_END(cp) { while (true) { if (cp === GREATER_THAN_SIGN) { return "DATA"; } if (cp !== RIGHT_SQUARE_BRACKET) { this.appendTokenValue(RIGHT_SQUARE_BRACKET, "HTMLCDataText"); this.appendTokenValue(RIGHT_SQUARE_BRACKET, "HTMLCDataText"); return this.reconsumeAs("CDATA_SECTION"); } this.appendTokenValue(RIGHT_SQUARE_BRACKET, "HTMLCDataText"); cp = this.consumeNextCodePoint(); } } CHARACTER_REFERENCE(cp) { this.crStartOffset = this.offset - 1; this.buffer = [AMPERSAND]; if (isWhitespace(cp) || cp === LESS_THAN_SIGN || cp === EOF) { return this.reconsumeAs("CHARACTER_REFERENCE_END"); } if (cp === NUMBER_SIGN) { this.buffer.push(cp); return "NUMERIC_CHARACTER_REFERENCE"; } return this.reconsumeAs("NAMED_CHARACTER_REFERENCE"); } NAMED_CHARACTER_REFERENCE(cp) { for (const entitySet of entitySets) { const length = entitySet.length; const entities = entitySet.entities; const text = this.text.slice(this.offset, this.offset + length); const codepoints = entities[text]; if (codepoints == null) { continue; } const semi = text.endsWith(";"); const next = this.text.codePointAt(this.offset + 1); this.offset += length - 1; this.column += length - 1; if (this.returnState.startsWith("ATTR") && !semi && next != null && (next === EQUALS_SIGN || isLetter(next) || isDigit(next))) { for (const cp1 of text) { this.buffer.push(cp1.codePointAt(0)); } } else { if (!semi) { this.reportParseError("missing-semicolon-after-character-reference"); } this.buffer = codepoints; } return "CHARACTER_REFERENCE_END"; } for (const cp0 of this.buffer) { this.appendTokenValue(cp0, null); } this.appendTokenValue(cp, null); return "AMBIGUOUS_AMPERSAND"; } AMBIGUOUS_AMPERSAND(cp) { while (isDigit(cp) || isLetter(cp)) { this.appendTokenValue(cp, null); cp = this.consumeNextCodePoint(); } if (cp === SEMICOLON) { this.reportParseError("unknown-named-character-reference"); } return this.reconsumeAs(this.returnState); } NUMERIC_CHARACTER_REFERENCE(cp) { this.crCode = 0; if (cp === LATIN_SMALL_X || cp === LATIN_CAPITAL_X) { this.buffer.push(cp); return "HEXADEMICAL_CHARACTER_REFERENCE_START"; } return this.reconsumeAs("DECIMAL_CHARACTER_REFERENCE_START"); } HEXADEMICAL_CHARACTER_REFERENCE_START(cp) { if (isHexDigit(cp)) { return this.reconsumeAs("HEXADEMICAL_CHARACTER_REFERENCE"); } this.reportParseError("absence-of-digits-in-numeric-character-reference"); return this.reconsumeAs("CHARACTER_REFERENCE_END"); } DECIMAL_CHARACTER_REFERENCE_START(cp) { if (isDigit(cp)) { return this.reconsumeAs("DECIMAL_CHARACTER_REFERENCE"); } this.reportParseError("absence-of-digits-in-numeric-character-reference"); return this.reconsumeAs("CHARACTER_REFERENCE_END"); } HEXADEMICAL_CHARACTER_REFERENCE(cp) { while (true) { if (isDigit(cp)) { this.crCode = 16 * this.crCode + (cp - 0x30); } else if (isUpperHexDigit(cp)) { this.crCode = 16 * this.crCode + (cp - 0x37); } else if (isLowerHexDigit(cp)) { this.crCode = 16 * this.crCode + (cp - 0x57); } else { if (cp === SEMICOLON) { return "NUMERIC_CHARACTER_REFERENCE_END"; } this.reportParseError("missing-semicolon-after-character-reference"); return this.reconsumeAs("NUMERIC_CHARACTER_REFERENCE_END"); } cp = this.consumeNextCodePoint(); } } DECIMAL_CHARACTER_REFERENCE(cp) { while (true) { if (isDigit(cp)) { this.crCode = 10 * this.crCode + (cp - 0x30); } else { if (cp === SEMICOLON) { return "NUMERIC_CHARACTER_REFERENCE_END"; } this.reportParseError("missing-semicolon-after-character-reference"); return this.reconsumeAs("NUMERIC_CHARACTER_REFERENCE_END"); } cp = this.consumeNextCodePoint(); } } NUMERIC_CHARACTER_REFERENCE_END(_cp) { let code = this.crCode; if (code === 0) { this.reportParseError("null-character-reference"); code = NULL_REPLACEMENT; } else if (code > 0x10FFFF) { this.reportParseError("character-reference-outside-unicode-range"); code = NULL_REPLACEMENT; } else if (isSurrogate(code)) { this.reportParseError("surrogate-character-reference"); code = NULL_REPLACEMENT; } else if (isNonCharacter(code)) { this.reportParseError("noncharacter-character-reference"); } else if (code === 0x0D || (isControl(code) && !isWhitespace(code))) { this.reportParseError("control-character-reference"); code = alternativeCR.get(code) || code; } this.buffer = [code]; return this.reconsumeAs("CHARACTER_REFERENCE_END"); } CHARACTER_REFERENCE_END(_cp) { assert(this.currentToken != null); const token = this.currentToken; const len0 = token.value.length; for (const cp1 of this.buffer) { this.appendTokenValue(cp1, null); } const newLength = token.value.length - len0; for (let i = this.crStartOffset + newLength; i < this.offset; ++i) { this.gaps.push(i); } return this.reconsumeAs(this.returnState); } V_EXPRESSION_START(cp) { if (cp === LEFT_CURLY_BRACKET) { this.startToken("VExpressionStart"); this.appendTokenValue(LEFT_CURLY_BRACKET, null); this.appendTokenValue(LEFT_CURLY_BRACKET, null); return this.returnState; } this.appendTokenValue(LEFT_CURLY_BRACKET, null); return this.reconsumeAs(this.returnState); } V_EXPRESSION_END(cp) { if (cp === RIGHT_CURLY_BRACKET) { this.startToken("VExpressionEnd"); this.appendTokenValue(RIGHT_CURLY_BRACKET, null); this.appendTokenValue(RIGHT_CURLY_BRACKET, null); return this.returnState; } this.appendTokenValue(RIGHT_CURLY_BRACKET, null); return this.reconsumeAs(this.returnState); } } function getPossibleTypes(parsedSelector) { switch (parsedSelector.type) { case "identifier": return [parsedSelector.value]; case "matches": { const typesForComponents = parsedSelector.selectors.map(getPossibleTypes); if (typesForComponents.every(Boolean)) { return union.apply(null, typesForComponents); } return null; } case "compound": { const typesForComponents = parsedSelector.selectors.map(getPossibleTypes).filter(typesForComponent => typesForComponent); if (!typesForComponents.length) { return null; } return intersection.apply(null, typesForComponents); } case "child": case "descendant": case "sibling": case "adjacent": return getPossibleTypes(parsedSelector.right); default: return null; } } function countClassAttributes(parsedSelector) { switch (parsedSelector.type) { case "child": case "descendant": case "sibling": case "adjacent": return countClassAttributes(parsedSelector.left) + countClassAttributes(parsedSelector.right); case "compound": case "not": case "matches": return parsedSelector.selectors.reduce((sum, childSelector) => sum + countClassAttributes(childSelector), 0); case "attribute": case "field": case "nth-child": case "nth-last-child": return 1; default: return 0; } } function countIdentifiers(parsedSelector) { switch (parsedSelector.type) { case "child": case "descendant": case "sibling": case "adjacent": return countIdentifiers(parsedSelector.left) + countIdentifiers(parsedSelector.right); case "compound": case "not": case "matches": return parsedSelector.selectors.reduce((sum, childSelector) => sum + countIdentifiers(childSelector), 0); case "identifier": return 1; default: return 0; } } function compareSpecificity(selectorA, selectorB) { return selectorA.attributeCount - selectorB.attributeCount || selectorA.identifierCount - selectorB.identifierCount || (selectorA.rawSelector <= selectorB.rawSelector ? -1 : 1); } function tryParseSelector(rawSelector) { try { return esquery.parse(rawSelector.replace(/:exit$/, "")); } catch (err) { if (typeof err.offset === "number") { throw new Error(`Syntax error in selector "${rawSelector}" at position ${err.offset}: ${err.message}`); } throw err; } } const parseSelector = memoize(rawSelector => { const parsedSelector = tryParseSelector(rawSelector); return { rawSelector, isExit: rawSelector.endsWith(":exit"), parsedSelector, listenerTypes: getPossibleTypes(parsedSelector), attributeCount: countClassAttributes(parsedSelector), identifierCount: countIdentifiers(parsedSelector), }; }); class NodeEventGenerator { constructor(emitter) { this.emitter = emitter; this.currentAncestry = []; this.enterSelectorsByNodeType = new Map(); this.exitSelectorsByNodeType = new Map(); this.anyTypeEnterSelectors = []; this.anyTypeExitSelectors = []; const eventNames = typeof emitter.eventNames === "function" ? emitter.eventNames() : Object.keys(emitter._events); for (const rawSelector of eventNames) { if (typeof rawSelector === "symbol") { continue; } const selector = parseSelector(rawSelector); if (selector.listenerTypes) { for (const nodeType of selector.listenerTypes) { const typeMap = selector.isExit ? this.exitSelectorsByNodeType : this.enterSelectorsByNodeType; let selectors = typeMap.get(nodeType); if (selectors == null) { typeMap.set(nodeType, (selectors = [])); } selectors.push(selector); } } else { (selector.isExit ? this.anyTypeExitSelectors : this.anyTypeEnterSelectors).push(selector); } } this.anyTypeEnterSelectors.sort(compareSpecificity); this.anyTypeExitSelectors.sort(compareSpecificity); for (const selectorList of this.enterSelectorsByNodeType.values()) { selectorList.sort(compareSpecificity); } for (const selectorList of this.exitSelectorsByNodeType.values()) { selectorList.sort(compareSpecificity); } } applySelector(node, selector) { if (esquery.matches(node, selector.parsedSelector, this.currentAncestry)) { this.emitter.emit(selector.rawSelector, node); } } applySelectors(node, isExit) { const selectorsByNodeType = (isExit ? this.exitSelectorsByNodeType : this.enterSelectorsByNodeType).get(node.type) || []; const anyTypeSelectors = isExit ? this.anyTypeExitSelectors : this.anyTypeEnterSelectors; let selectorsByTypeIndex = 0; let anyTypeSelectorsIndex = 0; while (selectorsByTypeIndex < selectorsByNodeType.length || anyTypeSelectorsIndex < anyTypeSelectors.length) { if (selectorsByTypeIndex >= selectorsByNodeType.length || (anyTypeSelectorsIndex < anyTypeSelectors.length && compareSpecificity(anyTypeSelectors[anyTypeSelectorsIndex], selectorsByNodeType[selectorsByTypeIndex]) < 0)) { this.applySelector(node, anyTypeSelectors[anyTypeSelectorsIndex++]); } else { this.applySelector(node, selectorsByNodeType[selectorsByTypeIndex++]); } } } enterNode(node) { if (node.parent) { this.currentAncestry.unshift(node.parent); } this.applySelectors(node, false); } leaveNode(node) { this.applySelectors(node, true); this.currentAncestry.shift(); } } function getStartLocation(token) { return token.range[0]; } function search(tokens, location) { return sortedIndexBy(tokens, { range: [location] }, getStartLocation); } function getFirstIndex(tokens, indexMap, startLoc) { if (startLoc in indexMap) { return indexMap[startLoc]; } if ((startLoc - 1) in indexMap) { const index = indexMap[startLoc - 1]; const token = (index >= 0 && index < tokens.length) ? tokens[index] : null; if (token && token.range[0] >= startLoc) { return index; } return index + 1; } return 0; } function getLastIndex(tokens, indexMap, endLoc) { if (endLoc in indexMap) { return indexMap[endLoc] - 1; } if ((endLoc - 1) in indexMap) { const index = indexMap[endLoc - 1]; const token = (index >= 0 && index < tokens.length) ? tokens[index] : null; if (token && token.range[1] > endLoc) { return index - 1; } return index; } return tokens.length - 1; } class Cursor { constructor() { this.current = null; } getOneToken() { return this.moveNext() ? this.current : null; } getAllTokens() { const tokens = []; while (this.moveNext()) { tokens.push(this.current); } return tokens; } } class BackwardTokenCommentCursor extends Cursor { constructor(tokens, comments, indexMap, startLoc, endLoc) { super(); this.tokens = tokens; this.comments = comments; this.tokenIndex = getLastIndex(tokens, indexMap, endLoc); this.commentIndex = search(comments, endLoc) - 1; this.border = startLoc; } moveNext() { const token = (this.tokenIndex >= 0) ? this.tokens[this.tokenIndex] : null; const comment = (this.commentIndex >= 0) ? this.comments[this.commentIndex] : null; if (token && (!comment || token.range[1] > comment.range[1])) { this.current = token; this.tokenIndex -= 1; } else if (comment) { this.current = comment; this.commentIndex -= 1; } else { this.current = null; } return this.current != null && (this.border === -1 || this.current.range[0] >= this.border); } } class BackwardTokenCursor extends Cursor { constructor(tokens, _comments, indexMap, startLoc, endLoc) { super(); this.tokens = tokens; this.index = getLastIndex(tokens, indexMap, endLoc); this.indexEnd = getFirstIndex(tokens, indexMap, startLoc); } moveNext() { if (this.index >= this.indexEnd) { this.current = this.tokens[this.index]; this.index -= 1; return true; } return false; } getOneToken() { return (this.index >= this.indexEnd) ? this.tokens[this.index] : null; } } class DecorativeCursor extends Cursor { constructor(cursor) { super(); this.cursor = cursor; } moveNext() { const retv = this.cursor.moveNext(); this.current = this.cursor.current; return retv; } } class FilterCursor extends DecorativeCursor { constructor(cursor, predicate) { super(cursor); this.predicate = predicate; } moveNext() { const predicate = this.predicate; while (super.moveNext()) { if (predicate(this.current)) { return true; } } return false; } } class ForwardTokenCommentCursor extends Cursor { constructor(tokens, comments, indexMap, startLoc, endLoc) { super(); this.tokens = tokens; this.comments = comments; this.tokenIndex = getFirstIndex(tokens, indexMap, startLoc); this.commentIndex = search(comments, startLoc); this.border = endLoc; } moveNext() { const token = (this.tokenIndex < this.tokens.length) ? this.tokens[this.tokenIndex] : null; const comment = (this.commentIndex < this.comments.length) ? this.comments[this.commentIndex] : null; if (token && (!comment || token.range[0] < comment.range[0])) { this.current = token; this.tokenIndex += 1; } else if (comment) { this.current = comment; this.commentIndex += 1; } else { this.current = null; } return this.current != null && (this.border === -1 || this.current.range[1] <= this.border); } } class ForwardTokenCursor extends Cursor { constructor(tokens, _comments, indexMap, startLoc, endLoc) { super(); this.tokens = tokens; this.index = getFirstIndex(tokens, indexMap, startLoc); this.indexEnd = getLastIndex(tokens, indexMap, endLoc); } moveNext() { if (this.index <= this.indexEnd) { this.current = this.tokens[this.index]; this.index += 1; return true; } return false; } getOneToken() { return (this.index <= this.indexEnd) ? this.tokens[this.index] : null; } getAllTokens() { return this.tokens.slice(this.index, this.indexEnd + 1); } } class LimitCursor extends DecorativeCursor { constructor(cursor, count) { super(cursor); this.count = count; } moveNext() { if (this.count > 0) { this.count -= 1; return super.moveNext(); } return false; } } class SkipCursor extends DecorativeCursor { constructor(cursor, count) { super(cursor); this.count = count; } moveNext() { while (this.count > 0) { this.count -= 1; if (!super.moveNext()) { return false; } } return super.moveNext(); } } class CursorFactory { constructor(TokenCursor, TokenCommentCursor) { this.TokenCursor = TokenCursor; this.TokenCommentCursor = TokenCommentCursor; } createBaseCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments) { const TokenCursor = includeComments ? this.TokenCommentCursor : this.TokenCursor; return new TokenCursor(tokens, comments, indexMap, startLoc, endLoc); } createCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments, filter, skip, count) { let cursor = this.createBaseCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments); if (filter) { cursor = new FilterCursor(cursor, filter); } if (skip >= 1) { cursor = new SkipCursor(cursor, skip); } if (count >= 0) { cursor = new LimitCursor(cursor, count); } return cursor; } } const forward = new CursorFactory(ForwardTokenCursor, ForwardTokenCommentCursor); const backward = new CursorFactory(BackwardTokenCursor, BackwardTokenCommentCursor); class PaddedTokenCursor extends ForwardTokenCursor { constructor(tokens, comments, indexMap, startLoc, endLoc, beforeCount, afterCount) { super(tokens, comments, indexMap, startLoc, endLoc); this.index = Math.max(0, this.index - beforeCount); this.indexEnd = Math.min(tokens.length - 1, this.indexEnd + afterCount); } } function isCommentToken(token) { return token.type === "Line" || token.type === "Block" || token.type === "Shebang"; } function createIndexMap(tokens, comments) { const map = Object.create(null); let tokenIndex = 0; let commentIndex = 0; let nextStart = 0; let range = null; while (tokenIndex < tokens.length || commentIndex < comments.length) { nextStart = (commentIndex < comments.length) ? comments[commentIndex].range[0] : Number.MAX_SAFE_INTEGER; while (tokenIndex < tokens.length && (range = tokens[tokenIndex].range)[0] < nextStart) { map[range[0]] = tokenIndex; map[range[1] - 1] = tokenIndex; tokenIndex += 1; } nextStart = (tokenIndex < tokens.length) ? tokens[tokenIndex].range[0] : Number.MAX_SAFE_INTEGER; while (commentIndex < comments.length && (range = comments[commentIndex].range)[0] < nextStart) { map[range[0]] = tokenIndex; map[range[1] - 1] = tokenIndex; commentIndex += 1; } } return map; } function createCursorWithSkip(factory, tokens, comments, indexMap, startLoc, endLoc, opts) { let includeComments = false; let skip = 0; let filter = null; if (typeof opts === "number") { skip = opts | 0; } else if (typeof opts === "function") { filter = opts; } else if (opts) { includeComments = Boolean(opts.includeComments); skip = opts.skip || 0; filter = opts.filter || null; } assert(skip >= 0, "options.skip should be zero or a positive integer."); assert(!filter || typeof filter === "function", "options.filter should be a function."); return factory.createCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments, filter, skip, -1); } function createCursorWithCount(factory, tokens, comments, indexMap, startLoc, endLoc, opts) { let includeComments = false; let count = 0; let countExists = false; let filter = null; if (typeof opts === "number") { count = opts | 0; countExists = true; } else if (typeof opts === "function") { filter = opts; } else if (opts) { includeComments = Boolean(opts.includeComments); count = opts.count || 0; countExists = typeof opts.count === "number"; filter = opts.filter || null; } assert(count >= 0, "options.count should be zero or a positive integer."); assert(!filter || typeof filter === "function", "options.filter should be a function."); return factory.createCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments, filter, 0, countExists ? count : -1); } function createCursorWithPadding(tokens, comments, indexMap, startLoc, endLoc, beforeCount, afterCount) { if (typeof beforeCount === "undefined" && typeof afterCount === "undefined") { return new ForwardTokenCursor(tokens, comments, indexMap, startLoc, endLoc); } if (typeof beforeCount === "number" || typeof beforeCount === "undefined") { return new PaddedTokenCursor(tokens, comments, indexMap, startLoc, endLoc, beforeCount || 0, afterCount || 0); } return createCursorWithCount(forward, tokens, comments, indexMap, startLoc, endLoc, beforeCount); } function getAdjacentCommentTokensFromCursor(cursor) { const tokens = []; let currentToken = cursor.getOneToken(); while (currentToken && isCommentToken(currentToken)) { tokens.push(currentToken); currentToken = cursor.getOneToken(); } return tokens; } class TokenStore { constructor(tokens, comments) { this._tokens = tokens; this._comments = comments; this._indexMap = createIndexMap(tokens, comments); } getTokenByRangeStart(offset, options) { const includeComments = Boolean(options && options.includeComments); const token = forward.createBaseCursor(this._tokens, this._comments, this._indexMap, offset, -1, includeComments).getOneToken(); if (token && token.range[0] === offset) { return token; } return null; } getFirstToken(node, options) { return createCursorWithSkip(forward, this._tokens, this._comments, this._indexMap, node.range[0], node.range[1], options).getOneToken(); } getLastToken(node, options) { return createCursorWithSkip(backward, this._tokens, this._comments, this._indexMap, node.range[0], node.range[1], options).getOneToken(); } getTokenBefore(node, options) { return createCursorWithSkip(backward, this._tokens, this._comments, this._indexMap, -1, node.range[0], options).getOneToken(); } getTokenAfter(node, options) { return createCursorWithSkip(forward, this._tokens, this._comments, this._indexMap, node.range[1], -1, options).getOneToken(); } getFirstTokenBetween(left, right, options) { return createCursorWithSkip(forward, this._tokens, this._comments, this._indexMap, left.range[1], right.range[0], options).getOneToken(); } getLastTokenBetween(left, right, options) { return createCursorWithSkip(backward, this._tokens, this._comments, this._indexMap, left.range[1], right.range[0], options).getOneToken(); } getTokenOrCommentBefore(node, skip) { return this.getTokenBefore(node, { includeComments: true, skip }); } getTokenOrCommentAfter(node, skip) { return this.getTokenAfter(node, { includeComments: true, skip }); } getFirstTokens(node, options) { return createCursorWithCount(forward, this._tokens, this._comments, this._indexMap, node.range[0], node.range[1], options).getAllTokens(); } getLastTokens(node, options) { return createCursorWithCount(backward, this._tokens, this._comments, this._indexMap, node.range[0], node.range[1], options).getAllTokens().reverse(); } getTokensBefore(node, options) { return createCursorWithCount(backward, this._tokens, this._comments, this._indexMap, -1, node.range[0], options).getAllTokens().reverse(); } getTokensAfter(node, options) { return createCursorWithCount(forward, this._tokens, this._comments, this._indexMap, node.range[1], -1, options).getAllTokens(); } getFirstTokensBetween(left, right, options) { return createCursorWithCount(forward, this._tokens, this._comments, this._indexMap, left.range[1], right.range[0], options).getAllTokens(); } getLastTokensBetween(left, right, options) { return createCursorWithCount(backward, this._tokens, this._comments, this._indexMap, left.range[1], right.range[0], options).getAllTokens().reverse(); } getTokens(node, beforeCount, afterCount) { return createCursorWithPadding(this._tokens, this._comments, this._indexMap, node.range[0], node.range[1], beforeCount, afterCount).getAllTokens(); } getTokensBetween(left, right, padding) { return createCursorWithPadding(this._tokens, this._comments, this._indexMap, left.range[1], right.range[0], padding, typeof padding === "number" ? padding : undefined).getAllTokens(); } commentsExistBetween(left, right) { const index = search(this._comments, left.range[1]); return (index < this._comments.length && this._comments[index].range[1] <= right.range[0]); } getCommentsBefore(nodeOrToken) { const cursor = createCursorWithCount(backward, this._tokens, this._comments, this._indexMap, -1, nodeOrToken.range[0], { includeComments: true }); return getAdjacentCommentTokensFromCursor(cursor).reverse(); } getCommentsAfter(nodeOrToken) { const cursor = createCursorWithCount(forward, this._tokens, this._comments, this._indexMap, nodeOrToken.range[1], -1, { includeComments: true }); return getAdjacentCommentTokensFromCursor(cursor); } getCommentsInside(node) { return this.getTokens(node, { includeComments: true, filter: isCommentToken, }); } } const emitters = new WeakMap(); const stores = new WeakMap(); function define(rootAST) { return { defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor) { if (scriptVisitor == null) { scriptVisitor = {}; } if (rootAST.templateBody == null) { return scriptVisitor; } let emitter = emitters.get(rootAST); if (emitter == null) { emitters.set(rootAST, (emitter = new EventEmitter())); const programExitHandler = scriptVisitor["Program:exit"]; scriptVisitor["Program:exit"] = function () { try { if (typeof programExitHandler === "function") { programExitHandler.apply(this, arguments); } const generator = new NodeEventGenerator(emitter); traverseNodes(rootAST.templateBody, generator); } finally { scriptVisitor["Program:exit"] = programExitHandler; emitters.delete(rootAST); } }; } for (const selector of Object.keys(templateBodyVisitor)) { emitter.on(selector, templateBodyVisitor[selector]); } return scriptVisitor; }, getTemplateBodyTokenStore() { const ast = rootAST.templateBody; const key = ast || stores; let store = stores.get(key); if (!store) { store = (ast != null) ? new TokenStore(ast.tokens, ast.comments) : new TokenStore([], []); stores.set(key, store); } return store; }, }; } const STARTS_WITH_LT = /^\s*</; function isVueFile(code, options) { const filePath = options.filePath || "unknown.js"; return path.extname(filePath) === ".vue" || STARTS_WITH_LT.test(code); } function isTemplateElement(node) { return node.type === "VElement" && node.name === "template"; } function isScriptElement(node) { return node.type === "VElement" && node.name === "script"; } function isLang(attribute) { return attribute.directive === false && attribute.key.name === "lang"; } function parseForESLint(code, options) { options = Object.assign({ comment: true, ecmaVersion: 2015, loc: true, range: true, tokens: true, }, options || {}); let result; if (!isVueFile(code, options)) { result = parseScript(code, options); } else { const tokenizer = new Tokenizer(code); const rootAST = new Parser(tokenizer, options).parse(); const locationCalcurator = new LocationCalculator(tokenizer.gaps, tokenizer.lineTerminators); const script = rootAST.children.find(isScriptElement); const template = rootAST.children.find(isTemplateElement); const templateLangAttr = template && template.startTag.attributes.find(isLang); const templateLang = (templateLangAttr && templateLangAttr.value && templateLangAttr.value.value) || "html"; const concreteInfo = { tokens: rootAST.tokens, comments: rootAST.comments, errors: rootAST.errors, }; result = (script != null) ? parseScriptElement(script, locationCalcurator, options) : parseScript("", options); result.ast.templateBody = (template != null && templateLang === "html") ? Object.assign(template, concreteInfo) : undefined; } result.services = Object.assign(result.services || {}, define(result.ast)); return result; } function parse(code, options) { return parseForESLint(code, options).ast; } exports.parseForESLint = parseForESLint; exports.parse = parse; exports.AST = index; //# sourceMappingURL=index.js.map kodo - Gogs: Go Git Service

Nenhuma Descrição

Brightcells: f38d3bf980 Caesar Alg 8 anos atrás
..
__init__.py aa31a5f59a Add kodo 8 anos atrás
b64.py aa31a5f59a Add kodo 8 anos atrás
caesar.py f38d3bf980 Caesar Alg 8 anos atrás
rsalg.py aa31a5f59a Add kodo 8 anos atrás