Tokeniser.prototype.entityNameMatch = /^(thetasym;|Epsilon;|Omicron;|Upsilon;|alefsym;|epsilon;|omicron;|upsilon;|Aacute;|Agrave;|Atilde;|Ccedil;|Dagger;|Eacute;|Egrave;|Iacute;|Igrave;|Lambda;|Ntilde;|Oacute;|Ograve;|Oslash;|Otilde;|Scaron;|Uacute;|Ugrave;|Yacute;|aacute;|agrave;|atilde;|brvbar;|ccedil;|curren;|dagger;|divide;|eacute;|egrave;|forall;|frac12;|frac14;|frac34;|hearts;|hellip;|iacute;|igrave;|iquest;|lambda;|lfloor;|lowast;|lsaquo;|middot;|ntilde;|oacute;|ograve;|oslash;|otilde;|otimes;|permil;|plusmn;|rfloor;|rsaquo;|scaron;|sigmaf;|spades;|there4;|thinsp;|uacute;|ugrave;|weierp;|yacute;|AElig;|Aacute|Acirc;|Agrave|Alpha;|Aring;|Atilde|Ccedil|Delta;|Eacute|Ecirc;|Egrave|Gamma;|Iacute|Icirc;|Igrave|Kappa;|Ntilde|OElig;|Oacute|Ocirc;|Ograve|Omega;|Oslash|Otilde|Prime;|Sigma;|THORN;|TRADE;|Theta;|Uacute|Ucirc;|Ugrave|Yacute|aacute|acirc;|acute;|aelig;|agrave|alpha;|aring;|asymp;|atilde|bdquo;|brvbar|ccedil|cedil;|clubs;|crarr;|curren|delta;|diams;|divide|eacute|ecirc;|egrave|empty;|equiv;|exist;|frac12|frac14|frac34|frasl;|gamma;|iacute|icirc;|iexcl;|igrave|image;|infin;|iquest|kappa;|laquo;|lceil;|ldquo;|lsquo;|mdash;|micro;|middot|minus;|nabla;|ndash;|notin;|ntilde|oacute|ocirc;|oelig;|ograve|oline;|omega;|oplus;|oslash|otilde|plusmn|pound;|prime;|radic;|raquo;|rceil;|rdquo;|rsquo;|sbquo;|sigma;|szlig;|theta;|thorn;|tilde;|times;|trade;|uacute|ucirc;|ugrave|upsih;|yacute|AElig|Acirc|Aring|Auml;|Beta;|COPY;|Ecirc|Euml;|Icirc|Iota;|Iuml;|Ocirc|Ouml;|QUOT;|THORN|Ucirc|Uuml;|Yuml;|Zeta;|acirc|acute|aelig|apos;|aring|auml;|beta;|bull;|cedil|cent;|circ;|cong;|copy;|dArr;|darr;|ecirc|emsp;|ensp;|euml;|euro;|fnof;|hArr;|harr;|icirc|iexcl|iota;|isin;|iuml;|lArr;|lang;|laquo|larr;|macr;|micro|nbsp;|nsub;|ocirc|ordf;|ordm;|ouml;|para;|part;|perp;|pound|prod;|prop;|quot;|rArr;|rang;|raquo|rarr;|real;|sdot;|sect;|sube;|sup1;|sup2;|sup3;|supe;|szlig|thorn|times|uArr;|uarr;|ucirc|uuml;|yuml;|zeta;|zwnj;|AMP;|Auml|COPY|Chi;|ETH;|Eta;|Euml|Iuml|Ouml|Phi;|Psi;|QUOT|REG;|Rho;|Tau;|Uuml|amp;|and;|ang;|auml|cap;|cent|chi;|copy|cup;|deg;|eta;|eth;|euml|int;|iuml|loz;|lrm;|macr|nbsp|not;|ordf|ordm|ouml|para|phi;|piv;|psi;|quot|reg;|rho;|rlm;|sect|shy;|sim;|sub;|sum;|sup1|sup2|sup3|sup;|tau;|uml;|uuml|yen;|yuml|zwj;|AMP|ETH|GT;|LT;|Mu;|Nu;|Pi;|REG|Xi;|amp|deg|eth|ge;|gt;|le;|lt;|mu;|ne;|ni;|not|nu;|or;|pi;|reg|shy|uml|xi;|yen|GT|LT|gt|lt)/;

Tokeniser.prototype.entityNameMatchAttr = /^(?:Aacute|Agrave|Atilde|Ccedil|Eacute|Egrave|Iacute|Igrave|Ntilde|Oacute|Ograve|Oslash|Otilde|Uacute|Ugrave|Yacute|aacute|agrave|atilde|brvbar|ccedil|curren|divide|eacute|egrave|frac12|frac14|frac34|iacute|igrave|iquest|middot|ntilde|oacute|ograve|oslash|otilde|plusmn|uacute|ugrave|yacute|AElig|Acirc|Aring|Ecirc|Icirc|Ocirc|THORN|Ucirc|acirc|acute|aelig|aring|cedil|ecirc|icirc|iexcl|laquo|micro|ocirc|pound|raquo|szlig|thorn|times|ucirc|Auml|COPY|Euml|Iuml|Ouml|QUOT|Uuml|auml|cent|copy|euml|iuml|macr|nbsp|ordf|ordm|ouml|para|quot|sect|sup1|sup2|sup3|uuml|yuml|AMP|ETH|REG|amp|deg|eth|not|reg|shy|uml|yen|GT|LT|gt|lt)(?:[^0-9A-Za-z]|$)/;

Tokeniser.prototype.entityNameValues = { "AElig": 0x00C6, "AElig;": 0x00C6, "AMP": 0x0026, "AMP;": 0x0026, "Aacute": 0x00C1, "Aacute;": 0x00C1, "Acirc": 0x00C2, "Acirc;": 0x00C2, "Agrave": 0x00C0, "Agrave;": 0x00C0, "Alpha;": 0x0391, "Aring": 0x00C5, "Aring;": 0x00C5, "Atilde": 0x00C3, "Atilde;": 0x00C3, "Auml": 0x00C4, "Auml;": 0x00C4, "Beta;": 0x0392, "COPY": 0x00A9, "COPY;": 0x00A9, "Ccedil": 0x00C7, "Ccedil;": 0x00C7, "Chi;": 0x03A7, "Dagger;": 0x2021, "Delta;": 0x0394, "ETH": 0x00D0, "ETH;": 0x00D0, "Eacute": 0x00C9, "Eacute;": 0x00C9, "Ecirc": 0x00CA, "Ecirc;": 0x00CA, "Egrave": 0x00C8, "Egrave;": 0x00C8, "Epsilon;": 0x0395, "Eta;": 0x0397, "Euml": 0x00CB, "Euml;": 0x00CB, "GT": 0x003E, "GT;": 0x003E, "Gamma;": 0x0393, "Iacute": 0x00CD, "Iacute;": 0x00CD, "Icirc": 0x00CE, "Icirc;": 0x00CE, "Igrave": 0x00CC, "Igrave;": 0x00CC, "Iota;": 0x0399, "Iuml": 0x00CF, "Iuml;": 0x00CF, "Kappa;": 0x039A, "LT": 0x003C, "LT;": 0x003C, "Lambda;": 0x039B, "Mu;": 0x039C, "Ntilde": 0x00D1, "Ntilde;": 0x00D1, "Nu;": 0x039D, "OElig;": 0x0152, "Oacute": 0x00D3, "Oacute;": 0x00D3, "Ocirc": 0x00D4, "Ocirc;": 0x00D4, "Ograve": 0x00D2, "Ograve;": 0x00D2, "Omega;": 0x03A9, "Omicron;": 0x039F, "Oslash": 0x00D8, "Oslash;": 0x00D8, "Otilde": 0x00D5, "Otilde;": 0x00D5, "Ouml": 0x00D6, "Ouml;": 0x00D6, "Phi;": 0x03A6, "Pi;": 0x03A0, "Prime;": 0x2033, "Psi;": 0x03A8, "QUOT": 0x0022, "QUOT;": 0x0022, "REG": 0x00AE, "REG;": 0x00AE, "Rho;": 0x03A1, "Scaron;": 0x0160, "Sigma;": 0x03A3, "THORN": 0x00DE, "THORN;": 0x00DE, "TRADE;": 0x2122, "Tau;": 0x03A4, "Theta;": 0x0398, "Uacute": 0x00DA, "Uacute;": 0x00DA, "Ucirc": 0x00DB, "Ucirc;": 0x00DB, "Ugrave": 0x00D9, "Ugrave;": 0x00D9, "Upsilon;": 0x03A5, "Uuml": 0x00DC, "Uuml;": 0x00DC, "Xi;": 0x039E, "Yacute": 0x00DD, "Yacute;": 0x00DD, "Yuml;": 0x0178, "Zeta;": 0x0396, "aacute": 0x00E1, "aacute;": 0x00E1, "acirc": 0x00E2, "acirc;": 0x00E2, "acute": 0x00B4, "acute;": 0x00B4, "aelig": 0x00E6, "aelig;": 0x00E6, "agrave": 0x00E0, "agrave;": 0x00E0, "alefsym;": 0x2135, "alpha;": 0x03B1, "amp": 0x0026, "amp;": 0x0026, "and;": 0x2227, "ang;": 0x2220, "apos;": 0x0027, "aring": 0x00E5, "aring;": 0x00E5, "asymp;": 0x2248, "atilde": 0x00E3, "atilde;": 0x00E3, "auml": 0x00E4, "auml;": 0x00E4, "bdquo;": 0x201E, "beta;": 0x03B2, "brvbar": 0x00A6, "brvbar;": 0x00A6, "bull;": 0x2022, "cap;": 0x2229, "ccedil": 0x00E7, "ccedil;": 0x00E7, "cedil": 0x00B8, "cedil;": 0x00B8, "cent": 0x00A2, "cent;": 0x00A2, "chi;": 0x03C7, "circ;": 0x02C6, "clubs;": 0x2663, "cong;": 0x2245, "copy": 0x00A9, "copy;": 0x00A9, "crarr;": 0x21B5, "cup;": 0x222A, "curren": 0x00A4, "curren;": 0x00A4, "dArr;": 0x21D3, "dagger;": 0x2020, "darr;": 0x2193, "deg": 0x00B0, "deg;": 0x00B0, "delta;": 0x03B4, "diams;": 0x2666, "divide": 0x00F7, "divide;": 0x00F7, "eacute": 0x00E9, "eacute;": 0x00E9, "ecirc": 0x00EA, "ecirc;": 0x00EA, "egrave": 0x00E8, "egrave;": 0x00E8, "empty;": 0x2205, "emsp;": 0x2003, "ensp;": 0x2002, "epsilon;": 0x03B5, "equiv;": 0x2261, "eta;": 0x03B7, "eth": 0x00F0, "eth;": 0x00F0, "euml": 0x00EB, "euml;": 0x00EB, "euro;": 0x20AC, "exist;": 0x2203, "fnof;": 0x0192, "forall;": 0x2200, "frac12": 0x00BD, "frac12;": 0x00BD, "frac14": 0x00BC, "frac14;": 0x00BC, "frac34": 0x00BE, "frac34;": 0x00BE, "frasl;": 0x2044, "gamma;": 0x03B3, "ge;": 0x2265, "gt": 0x003E, "gt;": 0x003E, "hArr;": 0x21D4, "harr;": 0x2194, "hearts;": 0x2665, "hellip;": 0x2026, "iacute": 0x00ED, "iacute;": 0x00ED, "icirc": 0x00EE, "icirc;": 0x00EE, "iexcl": 0x00A1, "iexcl;": 0x00A1, "igrave": 0x00EC, "igrave;": 0x00EC, "image;": 0x2111, "infin;": 0x221E, "int;": 0x222B, "iota;": 0x03B9, "iquest": 0x00BF, "iquest;": 0x00BF, "isin;": 0x2208, "iuml": 0x00EF, "iuml;": 0x00EF, "kappa;": 0x03BA, "lArr;": 0x21D0, "lambda;": 0x03BB, "lang;": 0x3008, "laquo": 0x00AB, "laquo;": 0x00AB, "larr;": 0x2190, "lceil;": 0x2308, "ldquo;": 0x201C, "le;": 0x2264, "lfloor;": 0x230A, "lowast;": 0x2217, "loz;": 0x25CA, "lrm;": 0x200E, "lsaquo;": 0x2039, "lsquo;": 0x2018, "lt": 0x003C, "lt;": 0x003C, "macr": 0x00AF, "macr;": 0x00AF, "mdash;": 0x2014, "micro": 0x00B5, "micro;": 0x00B5, "middot": 0x00B7, "middot;": 0x00B7, "minus;": 0x2212, "mu;": 0x03BC, "nabla;": 0x2207, "nbsp": 0x00A0, "nbsp;": 0x00A0, "ndash;": 0x2013, "ne;": 0x2260, "ni;": 0x220B, "not": 0x00AC, "not;": 0x00AC, "notin;": 0x2209, "nsub;": 0x2284, "ntilde": 0x00F1, "ntilde;": 0x00F1, "nu;": 0x03BD, "oacute": 0x00F3, "oacute;": 0x00F3, "ocirc": 0x00F4, "ocirc;": 0x00F4, "oelig;": 0x0153, "ograve": 0x00F2, "ograve;": 0x00F2, "oline;": 0x203E, "omega;": 0x03C9, "omicron;": 0x03BF, "oplus;": 0x2295, "or;": 0x2228, "ordf": 0x00AA, "ordf;": 0x00AA, "ordm": 0x00BA, "ordm;": 0x00BA, "oslash": 0x00F8, "oslash;": 0x00F8, "otilde": 0x00F5, "otilde;": 0x00F5, "otimes;": 0x2297, "ouml": 0x00F6, "ouml;": 0x00F6, "para": 0x00B6, "para;": 0x00B6, "part;": 0x2202, "permil;": 0x2030, "perp;": 0x22A5, "phi;": 0x03C6, "pi;": 0x03C0, "piv;": 0x03D6, "plusmn": 0x00B1, "plusmn;": 0x00B1, "pound": 0x00A3, "pound;": 0x00A3, "prime;": 0x2032, "prod;": 0x220F, "prop;": 0x221D, "psi;": 0x03C8, "quot": 0x0022, "quot;": 0x0022, "rArr;": 0x21D2, "radic;": 0x221A, "rang;": 0x3009, "raquo": 0x00BB, "raquo;": 0x00BB, "rarr;": 0x2192, "rceil;": 0x2309, "rdquo;": 0x201D, "real;": 0x211C, "reg": 0x00AE, "reg;": 0x00AE, "rfloor;": 0x230B, "rho;": 0x03C1, "rlm;": 0x200F, "rsaquo;": 0x203A, "rsquo;": 0x2019, "sbquo;": 0x201A, "scaron;": 0x0161, "sdot;": 0x22C5, "sect": 0x00A7, "sect;": 0x00A7, "shy": 0x00AD, "shy;": 0x00AD, "sigma;": 0x03C3, "sigmaf;": 0x03C2, "sim;": 0x223C, "spades;": 0x2660, "sub;": 0x2282, "sube;": 0x2286, "sum;": 0x2211, "sup1": 0x00B9, "sup1;": 0x00B9, "sup2": 0x00B2, "sup2;": 0x00B2, "sup3": 0x00B3, "sup3;": 0x00B3, "sup;": 0x2283, "supe;": 0x2287, "szlig": 0x00DF, "szlig;": 0x00DF, "tau;": 0x03C4, "there4;": 0x2234, "theta;": 0x03B8, "thetasym;": 0x03D1, "thinsp;": 0x2009, "thorn": 0x00FE, "thorn;": 0x00FE, "tilde;": 0x02DC, "times": 0x00D7, "times;": 0x00D7, "trade;": 0x2122, "uArr;": 0x21D1, "uacute": 0x00FA, "uacute;": 0x00FA, "uarr;": 0x2191, "ucirc": 0x00FB, "ucirc;": 0x00FB, "ugrave": 0x00F9, "ugrave;": 0x00F9, "uml": 0x00A8, "uml;": 0x00A8, "upsih;": 0x03D2, "upsilon;": 0x03C5, "uuml": 0x00FC, "uuml;": 0x00FC, "weierp;": 0x2118, "xi;": 0x03BE, "yacute": 0x00FD, "yacute;": 0x00FD, "yen": 0x00A5, "yen;": 0x00A5, "yuml": 0x00FF, "yuml;": 0x00FF, "zeta;": 0x03B6, "zwj;": 0x200D, "zwnj;": 0x200C };

Tokeniser.prototype.entityMap = { 0x000D: 0x000A, 0x0080: 0x20AC, 0x0081: 0xFFFD, 0x0082: 0x201A, 0x0083: 0x0192, 0x0084: 0x201E, 0x0085: 0x2026, 0x0086: 0x2020, 0x0087: 0x2021, 0x0088: 0x02C6, 0x0089: 0x2030, 0x008A: 0x0160, 0x008B: 0x2039, 0x008C: 0x0152, 0x008D: 0xFFFD, 0x008E: 0x017D, 0x008F: 0xFFFD, 0x0090: 0xFFFD, 0x0091: 0x2018, 0x0092: 0x2019, 0x0093: 0x201C, 0x0094: 0x201D, 0x0095: 0x2022, 0x0096: 0x2013, 0x0097: 0x2014, 0x0098: 0x02DC, 0x0099: 0x2122, 0x009A: 0x0161, 0x009B: 0x203A, 0x009C: 0x0153, 0x009D: 0xFFFD, 0x009E: 0x017E, 0x009F: 0x0178 };

var DataState = 0;
var EntityDataState = 1;
var TagOpenState = 2;
var CloseTagOpenState = 3;
var TagNameState = 4;
var BeforeAttributeNameState = 5;
var AttributeNameState = 6;
var AfterAttributeNameState = 7;
var BeforeAttributeValueState = 8;
var AttributeValueDoubleQuotedState = 9;
var AttributeValueSingleQuotedState = 10;
var AttributeValueUnquotedState = 11;
var EntityInAttributeValueState_DoubleQuoted = 12;
var EntityInAttributeValueState_SingleQuoted = 13;
var EntityInAttributeValueState_Unquoted = 14;
var BogusCommentState = 15;
var BogusCommentState_Continue = 16;
var MarkupDeclarationOpenState = 17;
var CommentStartState = 18;
var CommentStartDashState = 19;
var CommentState = 20;
var CommentEndDashState = 21;
var CommentEndState = 22;
var DoctypeState = 23;
var BeforeDoctypeNameState = 24;
var DoctypeNameState = 25;
var AfterDoctypeNameState = 26;
var BeforeDoctypePublicIdentifierState = 27;
var DoctypePublicIdentifierDoubleQuotedState = 28;
var DoctypePublicIdentifierSingleQuotedState = 29;
var AfterDoctypePublicIdentifierState = 30;
var BeforeDoctypeSystemIdentifierState = 31;
var DoctypeSystemIdentifierDoubleQuotedState = 32;
var DoctypeSystemIdentifierSingleQuotedState = 33;
var AfterDoctypeSystemIdentifierState = 34;
var BogusDoctypeState = 35;

var PCDATA = 0;
var RCDATA = 1;
var CDATA = 2;
var PLAINTEXT = 3;

Tokeniser.prototype.run = function ()
{
    while (true)
    {
        switch (this.machineState)
        {
        case DataState:
        {
            this.currentCharacter = this.consumeCharacter();
            if (this.currentCharacter == 38 && (this.contentModel == PCDATA || this.contentModel == RCDATA))
            {
                this.machineState = EntityDataState;
            }
            else
            if (this.currentCharacter == 45)
            {
                if ((this.contentModel == RCDATA || this.contentModel == CDATA) && !this.escapeFlag && this.getOldCharacter(1) == 45 && this.getOldCharacter(2) == 33 && this.getOldCharacter(3) == 60)
                {
                    this.escapeFlag = true;
                    this.emitCharacterToken(this.currentCharacter);
                }
                else
                {
                    this.emitCharacterToken(this.currentCharacter);
                }
            }
            else
            if (this.currentCharacter == 60 && this.contentModel == PCDATA)
            {
                this.machineState = TagOpenState;
            }
            else
            if (this.currentCharacter == 60 && (this.contentModel == RCDATA || this.contentModel == CDATA) && !this.escapeFlag)
            {
                this.machineState = TagOpenState;
            }
            else
            if (this.currentCharacter == 62)
            {
                if ((this.contentModel == RCDATA || this.contentModel == CDATA) && this.escapeFlag && this.getOldCharacter(1) == 45 && this.getOldCharacter(2) == 45)
                {
                    this.escapeFlag = false;
                    this.emitCharacterToken(this.currentCharacter);
                }
                else
                {
                    this.emitCharacterToken(this.currentCharacter);
                }
            }
            else
            if (this.currentCharacter == this.Char_EOF)
            {
                this.emitEOFToken();
                return;
            }
            else
            if (true)
            {
                this.emitCharacterToken(this.currentCharacter);
            }
            break;
        }
        
        case EntityDataState:
        {
            var hasConsumableEntity_ = this.hasConsumableEntity(false);
            if (!(hasConsumableEntity_))
            {
                this.emitCharacterToken(38);
                this.machineState = DataState;
            }
            else
            if (true)
            {
                this.consumeAndEmitEntity();
                this.machineState = DataState;
            }
            break;
        }
        
        case TagOpenState:
        {
            this.currentCharacter = this.consumeCharacter();
            if (this.contentModel == RCDATA || this.contentModel == CDATA)
            {
                if (this.currentCharacter == 47)
                {
                    this.machineState = CloseTagOpenState;
                }
                else
                {
                    this.emitCharacterToken(60);
                    this.reconsumeCharacter(this.currentCharacter);
                    this.machineState = DataState;
                }
            }
            else
            if (this.contentModel == PCDATA && this.currentCharacter == 33)
            {
                this.machineState = MarkupDeclarationOpenState;
            }
            else
            if (this.contentModel == PCDATA && this.currentCharacter == 47)
            {
                this.machineState = CloseTagOpenState;
            }
            else
            if (this.contentModel == PCDATA && (this.currentCharacter >= 65 && this.currentCharacter <= 90))
            {
                this.createStartTagToken();
                this.appendToTagTokenName(this.currentCharacter + 32);
                this.machineState = TagNameState;
            }
            else
            if (this.contentModel == PCDATA && (this.currentCharacter >= 97 && this.currentCharacter <= 122))
            {
                this.createStartTagToken();
                this.appendToTagTokenName(this.currentCharacter);
                this.machineState = TagNameState;
            }
            else
            if (this.contentModel == PCDATA && this.currentCharacter == 62)
            {
                this.parseError("Character '>' in TagOpenState");
                this.emitCharacterToken(60);
                this.emitCharacterToken(62);
                this.machineState = DataState;
            }
            else
            if (this.contentModel == PCDATA && this.currentCharacter == 63)
            {
                this.parseError("Character '?' in TagOpenState");
                this.machineState = BogusCommentState;
            }
            else
            if (this.contentModel == PCDATA && true)
            {
                this.parseError("Unexpected character in TagOpenState");
                this.emitCharacterToken(60);
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
            }
            break;
        }
        
        case CloseTagOpenState:
        {
            this.currentCharacter = this.consumeCharacter();
            var isEndOfCData_ = this.isEndOfCData();
            if ((this.contentModel == RCDATA || this.contentModel == CDATA) && !(isEndOfCData_))
            {
                this.emitCharacterToken(60);
                this.emitCharacterToken(47);
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
            }
            else
            if ((this.contentModel == PCDATA || isEndOfCData_) && (this.currentCharacter >= 65 && this.currentCharacter <= 90))
            {
                this.createEndTagToken();
                this.appendToTagTokenName(this.currentCharacter + 32);
                this.machineState = TagNameState;
            }
            else
            if ((this.contentModel == PCDATA || isEndOfCData_) && (this.currentCharacter >= 97 && this.currentCharacter <= 122))
            {
                this.createEndTagToken();
                this.appendToTagTokenName(this.currentCharacter);
                this.machineState = TagNameState;
            }
            else
            if ((this.contentModel == PCDATA || isEndOfCData_) && this.currentCharacter == 62)
            {
                this.parseError("Character '>' in CloseTagOpenState");
                this.machineState = DataState;
            }
            else
            if ((this.contentModel == PCDATA || isEndOfCData_) && this.currentCharacter == this.Char_EOF)
            {
                this.parseError("EOF in CloseTagOpenState");
                this.emitCharacterToken(60);
                this.emitCharacterToken(47);
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
            }
            else
            if ((this.contentModel == PCDATA || isEndOfCData_) && true)
            {
                this.parseError("Unexpected character in CloseTagOpenState");
                this.machineState = BogusCommentState;
            }
            break;
        }
        
        case TagNameState:
        {
            this.currentCharacter = this.consumeCharacter();
            if (this.currentCharacter == 9 || this.currentCharacter == 10 || this.currentCharacter == 11 || this.currentCharacter == 12 || this.currentCharacter == 32)
            {
                this.machineState = BeforeAttributeNameState;
            }
            else
            if (this.currentCharacter == 62)
            {
                this.parseErrorIfEndTagWithAttributes();
                this.emitCurrentTagToken();
                this.machineState = DataState;
            }
            else
            if (this.currentCharacter >= 65 && this.currentCharacter <= 90)
            {
                this.appendToTagTokenName(this.currentCharacter + 32);
            }
            else
            if (this.currentCharacter == this.Char_EOF)
            {
                this.parseError("EOF in TagNameState");
                this.parseErrorIfEndTagWithAttributes();
                this.emitCurrentTagToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
            }
            else
            if (this.currentCharacter == 47)
            {
                this.parseErrorIfNonpermittedSlash();
                this.machineState = BeforeAttributeNameState;
            }
            else
            if (true)
            {
                this.appendToTagTokenName(this.currentCharacter);
            }
            break;
        }
        
        case BeforeAttributeNameState:
        {
            this.currentCharacter = this.consumeCharacter();
            if (this.currentCharacter == 9 || this.currentCharacter == 10 || this.currentCharacter == 11 || this.currentCharacter == 12 || this.currentCharacter == 32)
            {
            }
            else
            if (this.currentCharacter == 62)
            {
                this.parseErrorIfEndTagWithAttributes();
                this.emitCurrentTagToken();
                this.machineState = DataState;
            }
            else
            if (this.currentCharacter >= 65 && this.currentCharacter <= 90)
            {
                this.createTagTokenAttribute();
                this.appendToTagTokenAttributeName(this.currentCharacter + 32);
                this.machineState = AttributeNameState;
            }
            else
            if (this.currentCharacter == 47)
            {
                this.parseErrorIfNonpermittedSlash();
            }
            else
            if (this.currentCharacter == this.Char_EOF)
            {
                this.parseError("EOF in BeforeAttributeNameState");
                this.parseErrorIfEndTagWithAttributes();
                this.emitCurrentTagToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
            }
            else
            if (true)
            {
                this.createTagTokenAttribute();
                this.appendToTagTokenAttributeName(this.currentCharacter);
                this.machineState = AttributeNameState;
            }
            break;
        }
        
        case AttributeNameState:
        {
            this.currentCharacter = this.consumeCharacter();
            if (this.currentCharacter == 9 || this.currentCharacter == 10 || this.currentCharacter == 11 || this.currentCharacter == 12 || this.currentCharacter == 32)
            {
                this.handleDuplicateAttributes();
                this.machineState = AfterAttributeNameState;
            }
            else
            if (this.currentCharacter == 61)
            {
                this.handleDuplicateAttributes();
                this.machineState = BeforeAttributeValueState;
            }
            else
            if (this.currentCharacter == 62)
            {
                this.handleDuplicateAttributes();
                this.parseErrorIfEndTagWithAttributes();
                this.emitCurrentTagToken();
                this.machineState = DataState;
            }
            else
            if (this.currentCharacter >= 65 && this.currentCharacter <= 90)
            {
                this.appendToTagTokenAttributeName(this.currentCharacter + 32);
            }
            else
            if (this.currentCharacter == 47)
            {
                this.parseErrorIfNonpermittedSlash();
                this.handleDuplicateAttributes();
                this.machineState = BeforeAttributeNameState;
            }
            else
            if (this.currentCharacter == this.Char_EOF)
            {
                this.parseError("EOF in AttributeNameState");
                this.handleDuplicateAttributes();
                this.parseErrorIfEndTagWithAttributes();
                this.emitCurrentTagToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
            }
            else
            if (true)
            {
                this.appendToTagTokenAttributeName(this.currentCharacter);
            }
            break;
        }
        
        case AfterAttributeNameState:
        {
            this.currentCharacter = this.consumeCharacter();
            if (this.currentCharacter == 9 || this.currentCharacter == 10 || this.currentCharacter == 11 || this.currentCharacter == 12 || this.currentCharacter == 32)
            {
            }
            else
            if (this.currentCharacter == 61)
            {
                this.machineState = BeforeAttributeValueState;
            }
            else
            if (this.currentCharacter == 62)
            {
                this.parseErrorIfEndTagWithAttributes();
                this.emitCurrentTagToken();
                this.machineState = DataState;
            }
            else
            if (this.currentCharacter >= 65 && this.currentCharacter <= 90)
            {
                this.createTagTokenAttribute();
                this.appendToTagTokenAttributeName(this.currentCharacter + 32);
                this.machineState = AttributeNameState;
            }
            else
            if (this.currentCharacter == 47)
            {
                this.parseErrorIfNonpermittedSlash();
                this.machineState = BeforeAttributeNameState;
            }
            else
            if (this.currentCharacter == this.Char_EOF)
            {
                this.parseError("EOF in AfterAttributeNameState");
                this.parseErrorIfEndTagWithAttributes();
                this.emitCurrentTagToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
            }
            else
            if (true)
            {
                this.createTagTokenAttribute();
                this.appendToTagTokenAttributeName(this.currentCharacter);
                this.machineState = AttributeNameState;
            }
            break;
        }
        
        case BeforeAttributeValueState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 9:
            case 10:
            case 11:
            case 12:
            case 32:
            {
                break;
            }
            
            case 34:
            {
                this.machineState = AttributeValueDoubleQuotedState;
                break;
            }
            
            case 38:
            {
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = AttributeValueUnquotedState;
                break;
            }
            
            case 39:
            {
                this.machineState = AttributeValueSingleQuotedState;
                break;
            }
            
            case 62:
            {
                this.parseErrorIfEndTagWithAttributes();
                this.emitCurrentTagToken();
                this.machineState = DataState;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in BeforeAttributeValueState");
                this.parseErrorIfEndTagWithAttributes();
                this.emitCurrentTagToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.appendToTagTokenAttributeValue(this.currentCharacter);
                this.machineState = AttributeValueUnquotedState;
                break;
            }
            
            }
            break;
        }
        
        case AttributeValueDoubleQuotedState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 34:
            {
                this.machineState = BeforeAttributeNameState;
                break;
            }
            
            case 38:
            {
                this.machineState = EntityInAttributeValueState_DoubleQuoted;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in AttributeValueDoubleQuotedState");
                this.parseErrorIfEndTagWithAttributes();
                this.emitCurrentTagToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.appendToTagTokenAttributeValue(this.currentCharacter);
                break;
            }
            
            }
            break;
        }
        
        case AttributeValueSingleQuotedState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 39:
            {
                this.machineState = BeforeAttributeNameState;
                break;
            }
            
            case 38:
            {
                this.machineState = EntityInAttributeValueState_SingleQuoted;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in AttributeValueSingleQuotedState");
                this.parseErrorIfEndTagWithAttributes();
                this.emitCurrentTagToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.appendToTagTokenAttributeValue(this.currentCharacter);
                break;
            }
            
            }
            break;
        }
        
        case AttributeValueUnquotedState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 9:
            case 10:
            case 11:
            case 12:
            case 32:
            {
                this.machineState = BeforeAttributeNameState;
                break;
            }
            
            case 38:
            {
                this.machineState = EntityInAttributeValueState_Unquoted;
                break;
            }
            
            case 62:
            {
                this.parseErrorIfEndTagWithAttributes();
                this.emitCurrentTagToken();
                this.machineState = DataState;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in AttributeValueUnquotedState");
                this.parseErrorIfEndTagWithAttributes();
                this.emitCurrentTagToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.appendToTagTokenAttributeValue(this.currentCharacter);
                break;
            }
            
            }
            break;
        }
        
        case EntityInAttributeValueState_DoubleQuoted:
        {
            var hasConsumableEntity_ = this.hasConsumableEntity(true);
            if (!(hasConsumableEntity_))
            {
                this.appendToTagTokenAttributeValue(38);
                this.machineState = AttributeValueDoubleQuotedState;
            }
            else
            if (true)
            {
                this.consumeAndAppendEntity();
                this.machineState = AttributeValueDoubleQuotedState;
            }
            break;
        }
        
        case EntityInAttributeValueState_SingleQuoted:
        {
            var hasConsumableEntity_ = this.hasConsumableEntity(true);
            if (!(hasConsumableEntity_))
            {
                this.appendToTagTokenAttributeValue(38);
                this.machineState = AttributeValueSingleQuotedState;
            }
            else
            if (true)
            {
                this.consumeAndAppendEntity();
                this.machineState = AttributeValueSingleQuotedState;
            }
            break;
        }
        
        case EntityInAttributeValueState_Unquoted:
        {
            var hasConsumableEntity_ = this.hasConsumableEntity(true);
            if (!(hasConsumableEntity_))
            {
                this.appendToTagTokenAttributeValue(38);
                this.machineState = AttributeValueUnquotedState;
            }
            else
            if (true)
            {
                this.consumeAndAppendEntity();
                this.machineState = AttributeValueUnquotedState;
            }
            break;
        }
        
        case BogusCommentState:
        {
            switch (this.currentCharacter)
            {
            case 0:
            {
                this.createCommentToken();
                this.emitCurrentCommentToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            case 62:
            {
                this.createCommentToken();
                this.emitCurrentCommentToken();
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.createCommentToken();
                this.appendToCommentToken(this.currentCharacter);
                this.machineState = BogusCommentState_Continue;
                break;
            }
            
            }
            break;
        }
        
        case BogusCommentState_Continue:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 0:
            {
                this.emitCurrentCommentToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            case 62:
            {
                this.emitCurrentCommentToken();
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.appendToCommentToken(this.currentCharacter);
                break;
            }
            
            }
            break;
        }
        
        case MarkupDeclarationOpenState:
        {
            this.currentCharacter = this.consumeCharacter();
            if (this.isFollowedBy("--"))
            {
                this.currentCharacter = this.consumeCharacter();
                this.createCommentToken();
                this.machineState = CommentStartState;
            }
            else
            if (!(this.isFollowedBy("--")) && this.isFollowedBy("doctype"))
            {
                this.currentCharacter = this.consumeCharacter();
                this.currentCharacter = this.consumeCharacter();
                this.currentCharacter = this.consumeCharacter();
                this.currentCharacter = this.consumeCharacter();
                this.currentCharacter = this.consumeCharacter();
                this.currentCharacter = this.consumeCharacter();
                this.machineState = DoctypeState;
            }
            else
            if (true)
            {
                this.parseError("Unexpected character in MarkupDeclarationOpenState");
                this.machineState = BogusCommentState;
            }
            break;
        }
        
        case CommentStartState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 45:
            {
                this.machineState = CommentStartDashState;
                break;
            }
            
            case 62:
            {
                this.parseError("Character '>' in CommentStartState");
                this.emitCurrentCommentToken();
                this.machineState = DataState;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in CommentStartState");
                this.emitCurrentCommentToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.appendToCommentToken(this.currentCharacter);
                this.machineState = CommentState;
                break;
            }
            
            }
            break;
        }
        
        case CommentStartDashState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 45:
            {
                this.machineState = CommentEndState;
                break;
            }
            
            case 62:
            {
                this.parseError("Character '>' in CommentStartDashState");
                this.emitCurrentCommentToken();
                this.machineState = DataState;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in CommentStartDashState");
                this.emitCurrentCommentToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.appendToCommentToken(45);
                this.appendToCommentToken(this.currentCharacter);
                this.machineState = CommentState;
                break;
            }
            
            }
            break;
        }
        
        case CommentState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 45:
            {
                this.machineState = CommentEndDashState;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in CommentState");
                this.emitCurrentCommentToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.appendToCommentToken(this.currentCharacter);
                break;
            }
            
            }
            break;
        }
        
        case CommentEndDashState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 45:
            {
                this.machineState = CommentEndState;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in CommentEndDashState");
                this.emitCurrentCommentToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.appendToCommentToken(45);
                this.appendToCommentToken(this.currentCharacter);
                this.machineState = CommentState;
                break;
            }
            
            }
            break;
        }
        
        case CommentEndState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 62:
            {
                this.emitCurrentCommentToken();
                this.machineState = DataState;
                break;
            }
            
            case 45:
            {
                this.parseError("Character '-' in CommentEndState");
                this.appendToCommentToken(45);
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in CommentEndState");
                this.emitCurrentCommentToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.parseError("Unexpected character in CommentEndState");
                this.appendToCommentToken(45);
                this.appendToCommentToken(45);
                this.appendToCommentToken(this.currentCharacter);
                this.machineState = CommentState;
                break;
            }
            
            }
            break;
        }
        
        case DoctypeState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 9:
            case 10:
            case 11:
            case 12:
            case 32:
            {
                this.machineState = BeforeDoctypeNameState;
                break;
            }
            
            default:
            {
                this.parseError("Unexpected character in DoctypeState");
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = BeforeDoctypeNameState;
                break;
            }
            
            }
            break;
        }
        
        case BeforeDoctypeNameState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 9:
            case 10:
            case 11:
            case 12:
            case 32:
            {
                break;
            }
            
            case 62:
            {
                this.parseError("Character '>' in BeforeDoctypeNameState");
                this.createDoctypeToken();
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.machineState = DataState;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in BeforeDoctypeNameState");
                this.createDoctypeToken();
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.createDoctypeToken();
                this.appendToDoctypeTokenName(this.currentCharacter);
                this.machineState = DoctypeNameState;
                break;
            }
            
            }
            break;
        }
        
        case DoctypeNameState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 9:
            case 10:
            case 11:
            case 12:
            case 32:
            {
                this.machineState = AfterDoctypeNameState;
                break;
            }
            
            case 62:
            {
                this.emitCurrentDoctypeToken();
                this.machineState = DataState;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in DoctypeNameState");
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.appendToDoctypeTokenName(this.currentCharacter);
                break;
            }
            
            }
            break;
        }
        
        case AfterDoctypeNameState:
        {
            this.currentCharacter = this.consumeCharacter();
            if (this.currentCharacter == 9 || this.currentCharacter == 10 || this.currentCharacter == 11 || this.currentCharacter == 12 || this.currentCharacter == 32)
            {
            }
            else
            if (this.currentCharacter == 62)
            {
                this.emitCurrentDoctypeToken();
                this.machineState = DataState;
            }
            else
            if (this.currentCharacter == this.Char_EOF)
            {
                this.parseError("EOF in AfterDoctypeNameState");
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
            }
            else
            if (this.isFollowedBy("public"))
            {
                this.currentCharacter = this.consumeCharacter();
                this.currentCharacter = this.consumeCharacter();
                this.currentCharacter = this.consumeCharacter();
                this.currentCharacter = this.consumeCharacter();
                this.currentCharacter = this.consumeCharacter();
                this.machineState = BeforeDoctypePublicIdentifierState;
            }
            else
            if (this.isFollowedBy("system"))
            {
                this.currentCharacter = this.consumeCharacter();
                this.currentCharacter = this.consumeCharacter();
                this.currentCharacter = this.consumeCharacter();
                this.currentCharacter = this.consumeCharacter();
                this.currentCharacter = this.consumeCharacter();
                this.machineState = BeforeDoctypeSystemIdentifierState;
            }
            else
            if (true)
            {
                this.parseError("Unexpected character in AfterDoctypeNameState");
                this.machineState = BogusDoctypeState;
            }
            break;
        }
        
        case BeforeDoctypePublicIdentifierState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 9:
            case 10:
            case 11:
            case 12:
            case 32:
            {
                break;
            }
            
            case 34:
            {
                this.setDoctypeTokenPubIdEmpty();
                this.machineState = DoctypePublicIdentifierDoubleQuotedState;
                break;
            }
            
            case 39:
            {
                this.setDoctypeTokenPubIdEmpty();
                this.machineState = DoctypePublicIdentifierSingleQuotedState;
                break;
            }
            
            case 62:
            {
                this.parseError("Character '>' in BeforeDoctypePublicIdentifierState");
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.machineState = DataState;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in BeforeDoctypePublicIdentifierState");
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.parseError("Unexpected character in BeforeDoctypePublicIdentifierState");
                this.machineState = BogusDoctypeState;
                break;
            }
            
            }
            break;
        }
        
        case DoctypePublicIdentifierDoubleQuotedState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 34:
            {
                this.machineState = AfterDoctypePublicIdentifierState;
                break;
            }
            
            case 62:
            {
                this.parseError("Character '>' in DoctypePublicIdentifierDoubleQuotedState");
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.machineState = DataState;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in DoctypePublicIdentifierDoubleQuotedState");
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.appendToDoctypeTokenPubId(this.currentCharacter);
                break;
            }
            
            }
            break;
        }
        
        case DoctypePublicIdentifierSingleQuotedState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 39:
            {
                this.machineState = AfterDoctypePublicIdentifierState;
                break;
            }
            
            case 62:
            {
                this.parseError("Character '>' in DoctypePublicIdentifierSingleQuotedState");
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.machineState = DataState;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in DoctypePublicIdentifierSingleQuotedState");
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.appendToDoctypeTokenPubId(this.currentCharacter);
                break;
            }
            
            }
            break;
        }
        
        case AfterDoctypePublicIdentifierState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 9:
            case 10:
            case 11:
            case 12:
            case 32:
            {
                break;
            }
            
            case 34:
            {
                this.setDoctypeTokenSysIdEmpty();
                this.machineState = DoctypeSystemIdentifierDoubleQuotedState;
                break;
            }
            
            case 39:
            {
                this.setDoctypeTokenSysIdEmpty();
                this.machineState = DoctypeSystemIdentifierSingleQuotedState;
                break;
            }
            
            case 62:
            {
                this.emitCurrentDoctypeToken();
                this.machineState = DataState;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in AfterDoctypePublicIdentifierState");
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.parseError("Unexpected character in AfterDoctypePublicIdentifierState");
                this.machineState = BogusDoctypeState;
                break;
            }
            
            }
            break;
        }
        
        case BeforeDoctypeSystemIdentifierState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 9:
            case 10:
            case 11:
            case 12:
            case 32:
            {
                break;
            }
            
            case 34:
            {
                this.setDoctypeTokenSysIdEmpty();
                this.machineState = DoctypeSystemIdentifierDoubleQuotedState;
                break;
            }
            
            case 39:
            {
                this.setDoctypeTokenSysIdEmpty();
                this.machineState = DoctypeSystemIdentifierSingleQuotedState;
                break;
            }
            
            case 62:
            {
                this.parseError("Character '>' in BeforeDoctypeSystemIdentifierState");
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.machineState = DataState;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in BeforeDoctypeSystemIdentifierState");
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.parseError("Unexpected character in BeforeDoctypeSystemIdentifierState");
                this.machineState = BogusDoctypeState;
                break;
            }
            
            }
            break;
        }
        
        case DoctypeSystemIdentifierDoubleQuotedState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 34:
            {
                this.machineState = AfterDoctypeSystemIdentifierState;
                break;
            }
            
            case 62:
            {
                this.parseError("Character '>' in DoctypeSystemIdentifierDoubleQuotedState");
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.machineState = DataState;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in DoctypeSystemIdentifierDoubleQuotedState");
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.appendToDoctypeTokenSysId(this.currentCharacter);
                break;
            }
            
            }
            break;
        }
        
        case DoctypeSystemIdentifierSingleQuotedState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 39:
            {
                this.machineState = AfterDoctypeSystemIdentifierState;
                break;
            }
            
            case 62:
            {
                this.parseError("Character '>' in DoctypeSystemIdentifierSingleQuotedState");
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.machineState = DataState;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in DoctypeSystemIdentifierSingleQuotedState");
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.appendToDoctypeTokenSysId(this.currentCharacter);
                break;
            }
            
            }
            break;
        }
        
        case AfterDoctypeSystemIdentifierState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 9:
            case 10:
            case 11:
            case 12:
            case 32:
            {
                break;
            }
            
            case 62:
            {
                this.emitCurrentDoctypeToken();
                this.machineState = DataState;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in AfterDoctypeSystemIdentifierState");
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                this.parseError("Unexpected character in AfterDoctypeSystemIdentifierState");
                this.machineState = BogusDoctypeState;
                break;
            }
            
            }
            break;
        }
        
        case BogusDoctypeState:
        {
            this.currentCharacter = this.consumeCharacter();
            switch (this.currentCharacter)
            {
            case 62:
            {
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.machineState = DataState;
                break;
            }
            
            case 0:
            {
                this.parseError("EOF in BogusDoctypeState");
                this.setDoctypeTokenIncorrect();
                this.emitCurrentDoctypeToken();
                this.reconsumeCharacter(this.currentCharacter);
                this.machineState = DataState;
                break;
            }
            
            default:
            {
                break;
            }
            
            }
            break;
        }
        
        }
    }
};
