Ejemplo n.º 1
0
 public override void Read(Tokenizer t)
 {
     char? c = t.ConsumeChar();
     switch(c){
         case Chars.GREATER_THAN_SIGN:
             OnMessageRaised(new EmptyEndTagError());
             t.ChangeTokenState<DataState>();
             return;
         case null:
             OnMessageRaised(new SuddenlyEndAtTagError());
             t.EmitToken(Chars.LESS_THAN_SIGN);
             t.EmitToken(Chars.SOLIDUS);
             t.UnConsume(1);
             t.ChangeTokenState<DataState>();
             return;
     }
     if(c.IsLatinCapitalLetter()){
         t.CurrentToken = new EndTagToken(){Name = c.ToLower().ToString()};
         t.ChangeTokenState<TagNameState>();
         return;
     } else if(c.IsLatinSmallLetter()){
         t.CurrentToken = new EndTagToken(){Name = c.ToString()};
         t.ChangeTokenState<TagNameState>();
         return;
     }
     OnMessageRaised(new UnknownEndTagError());
     t.ChangeTokenState<BogusCommentState>();
     return;
 }
        public override void Read(Tokenizer t)
        {
            char? c = t.ConsumeChar();

            switch(c){
                case Chars.CHARACTER_TABULATION:
                case Chars.LINE_FEED:
                case Chars.FORM_FEED:
                case Chars.SPACE:
                    return;
                case Chars.GREATER_THAN_SIGN:{
                    t.ChangeTokenState<DataState>();
                    t.EmitToken();
                    return;
                }
                case null:
                    OnMessageRaised(new SuddenlyEndAtDoctypeError());
                    ((DoctypeToken)t.CurrentToken).ForceQuirks = true;
                    t.UnConsume(1);
                    t.ChangeTokenState<DataState>();
                    t.EmitToken();
                    return;
                default:
                    OnMessageRaised(new UnknownIdentifierAfterDoctypeError());
                    t.ChangeTokenState<BogusDoctypeState>();
                    return;
            }
        }
Ejemplo n.º 3
0
        public override void Read(Tokenizer t)
        {
            char? c = t.ConsumeChar();
            switch(c){
                case Chars.HYPHEN_MINUS:
                    t.ChangeTokenState<CommentEndState>();
                    return;
                case Chars.NULL:
                    OnMessageRaised(new NullInCommentError());
                    t.CurrentCommentToken.Append(Chars.HYPHEN_MINUS);
                    t.CurrentCommentToken.Append(Chars.REPLACEMENT_CHARACTER);

                    t.ChangeTokenState<CommentState>();
                    return;
                case Chars.GREATER_THAN_SIGN:
                    OnMessageRaised(new LessHyphenCommentError());
                    t.EmitToken();
                    t.ChangeTokenState<DataState>();
                    return;
                case null:
                    OnMessageRaised(new SuddenlyEndAtCommentError());
                    t.EmitToken();
                    t.UnConsume(1);
                    t.ChangeTokenState<DataState>();
                    return;
                default:
                    t.CurrentCommentToken.Append(Chars.HYPHEN_MINUS);
                    t.CurrentCommentToken.Append(c);
                    t.ChangeTokenState<CommentState>();
                    return;
            }
        }
        public override void Read(Tokenizer t)
        {
            char? c = t.ConsumeChar();

            if(c.IsLatinCapitalLetter()){
                t.TemporaryBuffer += c.ToLower();
                t.EmitToken(c);
                return;
            } else if(c.IsLatinSmallLetter()){
                t.TemporaryBuffer += c;
                t.EmitToken(c);
                return;
            }

            switch(c){
                case Chars.CHARACTER_TABULATION:
                case Chars.LINE_FEED:
                case Chars.FORM_FEED:
                case Chars.SPACE:
                case Chars.SOLIDUS:
                case Chars.GREATER_THAN_SIGN:
                    if(t.TemporaryBuffer.Equals("script", StringComparison.InvariantCulture)){
                        t.ChangeTokenState<ScriptDataDoubleEscapedState>();
                    } else {
                        t.ChangeTokenState<ScriptDataEscapedState>();
                    }
                    t.EmitToken(c);
                    return;
                default:
                    t.UnConsume(1);
                    t.ChangeTokenState<ScriptDataEscapedState>();
                    return;
            }
        }
        public override void Read(Tokenizer t)
        {
            char? c = t.ConsumeChar();

            if(c.IsLatinCapitalLetter()){
                t.TemporaryBuffer = "";
                t.TemporaryBuffer += c.ToLower();
                t.EmitToken(Chars.LESS_THAN_SIGN);
                t.EmitToken(c);
                t.ChangeTokenState<ScriptDataDoubleEscapeStartState>();
                return;
            } else if(c.IsLatinSmallLetter()){
                t.TemporaryBuffer = "";
                t.TemporaryBuffer += c;
                t.EmitToken(Chars.LESS_THAN_SIGN);
                t.EmitToken(c);
                t.ChangeTokenState<ScriptDataDoubleEscapeStartState>();
                return;
            }

            switch(c){
                case Chars.SOLIDUS:
                    t.TemporaryBuffer = "";
                    t.ChangeTokenState<ScriptDataEscapedEndTagOpenState>();
                    return;
                default:
                    t.EmitToken(Chars.LESS_THAN_SIGN);
                    t.UnConsume(1);
                    t.ChangeTokenState<ScriptDataEscapedState>();
                    return;
            }
        }
Ejemplo n.º 6
0
        public override void Read(Tokenizer t)
        {
            char? c = t.ConsumeChar();

            switch(c){
                case Chars.HYPHEN_MINUS:
                    t.ChangeTokenState<ScriptDataDoubleEscapedDashState>();
                    t.EmitToken(Chars.HYPHEN_MINUS);
                    return;
                case Chars.LESS_THAN_SIGN:
                    t.ChangeTokenState<ScriptDataDoubleEscapedLessThanSignState>();
                    t.EmitToken(Chars.LESS_THAN_SIGN);
                    return;
                case Chars.NULL:
                    OnMessageRaised(new NullInScriptError());
                    t.EmitToken(Chars.REPLACEMENT_CHARACTER);
                    return;
                case null:
                    OnMessageRaised(new SuddenlyEndAtScriptError());

                    t.UnConsume(1);
                    t.ChangeTokenState<DataState>();
                    return;
                default:
                    t.EmitToken(c);
                    return;
            }
        }
Ejemplo n.º 7
0
 public override void Read(Tokenizer t)
 {
     t.AdditionalAllowedCharacter = null;
     ReferencedCharacterToken result = ConsumeCharacterReference(t);
     t.ChangeTokenState<DataState>();
     if(result == null){
         t.EmitToken(Chars.AMPERSAND);
     } else {
         t.EmitToken(result);
     }
 }
        public override void Read(Tokenizer t)
        {
            char? c = t.ConsumeChar();

            if(c.IsLatinCapitalLetter()){
                t.CurrentTagToken.Name += c.ToLower();
                t.TemporaryBuffer += c;
                return;
            } else if(c.IsLatinSmallLetter()){
                t.CurrentTagToken.Name += c;
                t.TemporaryBuffer += c;
                return;
            }

            switch(c){
                case Chars.CHARACTER_TABULATION:
                case Chars.LINE_FEED:
                case Chars.FORM_FEED:
                case Chars.SPACE:
                    if(t.IsAppropriateEndTagToken){
                        t.ChangeTokenState<BeforeAttributeNameState>();
                        return;
                    }
                    goto default;
                case Chars.SOLIDUS:
                    if(t.IsAppropriateEndTagToken){
                        t.ChangeTokenState<SelfClosingStartTagState>();
                        return;
                    }
                    goto default;
                case Chars.GREATER_THAN_SIGN:
                    if(t.IsAppropriateEndTagToken){
                        t.EmitToken();
                        t.ChangeTokenState<DataState>();
                        return;
                    }
                    goto default;
                default:{
                    t.EmitToken(Chars.LESS_THAN_SIGN);
                    t.EmitToken(Chars.SOLIDUS);

                    t.EmitToken(t.TemporaryBuffer);
                    t.UnConsume(1);
                    t.ChangeTokenState<ScriptDataEscapedState>();
                    return;
                }
            }
        }
Ejemplo n.º 9
0
 public override void Read(Tokenizer t)
 {
     char? c = t.ConsumeChar();
     switch(c){
         case Chars.NULL:
             OnMessageRaised(new NullInDataError());
             t.EmitToken(Chars.REPLACEMENT_CHARACTER);
             return;
         case null:
             t.EmitToken(new EndOfFileToken());
             return;
         default:
             t.EmitToken(c);
             return;
     }
 }
Ejemplo n.º 10
0
 public override void Read(Tokenizer t)
 {
     char? c = t.ConsumeChar();
     switch(c){
         case Chars.EXCLAMATION_MARK:
             t.ChangeTokenState<MarkupDeclarationOpenState>();
             return;
         case Chars.SOLIDUS:
             t.ChangeTokenState<EndTagOpenState>();
             return;
         case Chars.QUESTION_MARK:
             OnMessageRaised(new ProcessingInstructionError());
             t.ChangeTokenState<BogusCommentState>();
             return;
     }
     if(c.IsLatinCapitalLetter()){
         t.CurrentToken = new StartTagToken(){Name = c.ToLower().ToString()};
         t.ChangeTokenState<TagNameState>();
         return;
     } else if(c.IsLatinSmallLetter()){
         t.CurrentToken = new StartTagToken(){Name = c.ToString()};
         t.ChangeTokenState<TagNameState>();
         return;
     }
     OnMessageRaised(new UnknownMarkupError());
     t.UnConsume(1);
     t.ChangeTokenState<DataState>();
     t.EmitToken(Chars.LESS_THAN_SIGN);
     return;
 }
Ejemplo n.º 11
0
        public override void Read(Tokenizer t)
        {
            char? c = t.ConsumeChar();

            switch(c){
                case Chars.CHARACTER_TABULATION:
                case Chars.LINE_FEED:
                case Chars.FORM_FEED:
                case Chars.SPACE:
                    t.ChangeTokenState<BeforeAttributeNameState>();
                    return;
                case Chars.SOLIDUS:
                    t.ChangeTokenState<SelfClosingStartTagState>();
                    return;
                case Chars.GREATER_THAN_SIGN:
                    t.ChangeTokenState<DataState>();
                    t.EmitToken();
                    return;
                case null:
                    OnMessageRaised(new SuddenlyEndAtAttributeError());
                    t.UnConsume(1);
                    t.ChangeTokenState<DataState>();
                    return;
                default:
                    OnMessageRaised(new MissingSpaceAfterAttributeValueError(c));
                    t.UnConsume(1);
                    t.ChangeTokenState<BeforeAttributeNameState>();
                    return;
            }
        }
Ejemplo n.º 12
0
 public override void Read(Tokenizer t)
 {
     char? c = t.ConsumeChar();
     switch(c){
         case Chars.LESS_THAN_SIGN:
             t.ChangeTokenState<RAWTEXTLessThanSignState>();
             break;
         case Chars.NULL:
             OnMessageRaised(new NullInDataError());
             t.EmitToken(Chars.REPLACEMENT_CHARACTER);
             return;
         case null:
             t.EmitToken(new EndOfFileToken());
             return;
         default:
             t.EmitToken(c);
             return;
     }
 }
Ejemplo n.º 13
0
 public override void Read(Tokenizer t)
 {
     char? c = t.ConsumeChar();
     if(c == Chars.SOLIDUS){
         t.TemporaryBuffer = "";
         t.ChangeTokenState<ScriptDataEndTagOpenState>();
         return;
     }
     if(c == Chars.EXCLAMATION_MARK){
         t.EmitToken(Chars.LESS_THAN_SIGN);
         t.EmitToken(Chars.EXCLAMATION_MARK);
         t.ChangeTokenState<ScriptDataEscapeStartState>();
         return;
     }
     t.EmitToken(Chars.LESS_THAN_SIGN);
     t.UnConsume(1);
     t.ChangeTokenState<ScriptDataState>();
     return;
 }
Ejemplo n.º 14
0
 public override void Read(Tokenizer t)
 {
     char? c = t.ConsumeChar();
     if(c.IsLatinCapitalLetter()){
         t.CurrentToken = new EndTagToken(){Name = c.ToLower().ToString()};
         t.TemporaryBuffer += c;
         t.ChangeTokenState<RAWTEXTEndTagNameState>();
         return;
     } else if(c.IsLatinSmallLetter()){
         t.CurrentToken = new EndTagToken(){Name = c.ToString()};
         t.TemporaryBuffer += c;
         t.ChangeTokenState<RAWTEXTEndTagNameState>();
         return;
     }
     t.EmitToken(Chars.LESS_THAN_SIGN);
     t.EmitToken(Chars.SOLIDUS);
     t.UnConsume(1);
     t.ChangeTokenState<RAWTEXTState>();
     return;
 }
Ejemplo n.º 15
0
        public override void Read(Tokenizer t)
        {
            char? c = t.ConsumeChar();

            switch(c){
                case Chars.CHARACTER_TABULATION:
                case Chars.LINE_FEED:
                case Chars.FORM_FEED:
                case Chars.SPACE:
                    t.ChangeTokenState<BeforeDoctypeSystemIdentifierState>();
                    return;
                case Chars.QUOTATION_MARK:
                    OnMessageRaised(new MissingSpaceBeforeDoctypeIdentifierError());
                    ((DoctypeToken)t.CurrentToken).SystemIdentifier = "";
                    t.ChangeTokenState<DoctypeSystemIdentifierState<DoubleQuoted>>();
                    return;
                case Chars.APOSTROPHE:
                    OnMessageRaised(new MissingSpaceBeforeDoctypeIdentifierError());
                    ((DoctypeToken)t.CurrentToken).SystemIdentifier = "";
                    t.ChangeTokenState<DoctypePublicIdentifierState<SingleQuoted>>();
                    return;
                case Chars.GREATER_THAN_SIGN:
                    OnMessageRaised(new MissingSystemIdentifierError());
                    ((DoctypeToken)t.CurrentToken).ForceQuirks = true;
                    t.ChangeTokenState<DataState>();
                    t.EmitToken();
                    return;
                case null:
                    OnMessageRaised(new SuddenlyEndAtDoctypeError());
                    ((DoctypeToken)t.CurrentToken).ForceQuirks = true;
                    t.UnConsume(1);
                    t.ChangeTokenState<DataState>();
                    t.EmitToken();
                    return;
                default:
                    OnMessageRaised(new MissingQuoteIdentifierError());
                    ((DoctypeToken)t.CurrentToken).ForceQuirks = true;
                    t.ChangeTokenState<BogusDoctypeState>();
                    return;
            }
        }
Ejemplo n.º 16
0
        public override void Read(Tokenizer t)
        {
            char? c = t.ConsumeChar();

            switch(c){
                case Chars.CHARACTER_TABULATION:
                case Chars.LINE_FEED:
                case Chars.FORM_FEED:
                case Chars.SPACE:
                    return;
                case Chars.NULL:
                    OnMessageRaised(new NullInDoctypeError());
                    t.ChangeTokenState<DoctypeNameState>();
                    t.CurrentToken = new DoctypeToken(){Name = Chars.REPLACEMENT_CHARACTER.ToString()};
                    return;
                case Chars.GREATER_THAN_SIGN:
                    OnMessageRaised(new EmptyDoctypeError());
                    t.ChangeTokenState<DataState>();
                    t.EmitToken(new DoctypeToken(){ForceQuirks = true});
                    return;
                case null:{
                    OnMessageRaised(new SuddenlyEndAtDoctypeError());
                    t.UnConsume(1);
                    t.ChangeTokenState<DataState>();
                    t.EmitToken(new DoctypeToken(){ForceQuirks = true});
                    return;
                }
                default:{
                    DoctypeToken result = new DoctypeToken();
                    if(c.IsLatinCapitalLetter()){
                        result.Name = c.ToLower().ToString();
                    } else {
                        result.Name = c.ToString();
                    }
                    t.CurrentToken = result;
                    t.ChangeTokenState<DoctypeNameState>();
                    return;
                }
            }
        }
Ejemplo n.º 17
0
        public override void Read(Tokenizer t)
        {
            char? c = t.ConsumeChar();

            switch(c){
                case Chars.CHARACTER_TABULATION:
                case Chars.LINE_FEED:
                case Chars.FORM_FEED:
                case Chars.SPACE:
                    return;
                case Chars.SOLIDUS:
                    t.ChangeTokenState<SelfClosingStartTagState>();
                    return;
                case Chars.EQUALS_SIGN:
                    t.ChangeTokenState<BeforeAttributeValueState>();
                    return;
                case Chars.GREATER_THAN_SIGN:
                    t.ChangeTokenState<DataState>();
                    t.EmitToken();
                    return;
                case Chars.NULL:
                    if(t.CurrentTagToken.FixAttribute() == false){
                        OnMessageRaised(new DuplicateAttributeError(t.CurrentTagToken.CurrentAttribute.Name));
                        t.CurrentTagToken.CurrentAttribute = null;
                    }
                    OnMessageRaised(new NullInAttributeNameError());
                    t.CurrentTagToken.CreateAttribute(Chars.REPLACEMENT_CHARACTER, "");
                    return;
                case Chars.QUOTATION_MARK:
                case Chars.APOSTROPHE:
                case Chars.LESS_THAN_SIGN:
                    OnMessageRaised(new InvaridCharAtAfterAttributeNameError(c,  t.CurrentTagToken.CurrentAttribute.Name));
                    goto default;
                case null:
                    OnMessageRaised(new SuddenlyEndAtAttributeError());
                    t.UnConsume(1);
                    t.ChangeTokenState<DataState>();
                    return;
                default:
                    if(t.CurrentTagToken.FixAttribute() == false){
                        OnMessageRaised(new DuplicateAttributeError(t.CurrentTagToken.CurrentAttribute.Name));
                        t.CurrentTagToken.CurrentAttribute = null;
                    }
                    if(c.IsLatinCapitalLetter()){
                        t.CurrentTagToken.CreateAttribute(c.ToLower(), "");
                    } else {
                        t.CurrentTagToken.CreateAttribute(c, "");
                    }
                    t.ChangeTokenState<AttributeNameState>();
                    return;
            }
        }
Ejemplo n.º 18
0
        public override void Read(Tokenizer t)
        {
            char? c = t.ConsumeChar();

            switch(c){
                case Chars.CHARACTER_TABULATION:
                case Chars.LINE_FEED:
                case Chars.FORM_FEED:
                case Chars.SPACE:
                    return;
                case Chars.GREATER_THAN_SIGN:
                    t.ChangeTokenState<DataState>();
                    t.EmitToken();
                    return;
                case null:{
                    OnMessageRaised(new SuddenlyEndAtDoctypeError());
                    DoctypeToken result = (DoctypeToken)t.CurrentToken;
                    result.ForceQuirks = true;
                    t.UnConsume(1);
                    t.ChangeTokenState<DataState>();
                    t.EmitToken();
                    return;
                }
                default:
                    if(IsStringMatch(t, DoctypePublicId)){
                        t.ChangeTokenState<AfterDoctypePublicKeywordState>();
                        return;
                    }
                    if(IsStringMatch(t, DoctypeSystemId)){
                        t.ChangeTokenState<AfterDoctypeSystemKeywordState>();
                        return;
                    } else {
                        OnMessageRaised(new UnknownIdentifierInDoctypeError());
                        ((DoctypeToken)t.CurrentToken).ForceQuirks = true;
                        t.ChangeTokenState<BogusDoctypeState>();
                        return;
                    }
            }
        }
Ejemplo n.º 19
0
 public override void Read(Tokenizer t)
 {
     char? c = t.ConsumeChar();
     if(c == Chars.SOLIDUS){
         t.TemporaryBuffer = "";
         t.ChangeTokenState<RAWTEXTEndTagOpenState>();
         return;
     }
     t.EmitToken(Chars.LESS_THAN_SIGN);
     t.UnConsume(1);
     t.ChangeTokenState<RAWTEXTState>();
     return;
 }
Ejemplo n.º 20
0
 public override void Read(Tokenizer t)
 {
     char? c = t.ConsumeChar();
     switch(c){
         case Chars.AMPERSAND:
             t.ChangeTokenState<CharacterReferenceInDataState>();
             break;
         case Chars.LESS_THAN_SIGN:
             t.ChangeTokenState<TagOpenState>();
             break;
         case Chars.NULL:
             OnMessageRaised(new NullInDataError());
             t.EmitToken(c);
             return;
         case null:
             t.EmitToken(new EndOfFileToken());
             return;
         default:
             t.EmitToken(c);
             return;
     }
 }
Ejemplo n.º 21
0
 public override void Read(Tokenizer t)
 {
     char? c = t.ConsumeChar();
     switch(c){
         case Chars.HYPHEN_MINUS:
             t.EmitToken(Chars.HYPHEN_MINUS);
             t.ChangeTokenState<ScriptDataEscapedDashDashState>();
             return;
         default:
             t.UnConsume(1);
             t.ChangeTokenState<ScriptDataState>();
             return;
     }
 }
Ejemplo n.º 22
0
        /*
        Consume every character up to and including the first U+003E GREATER-THAN SIGN character (>) or the end of the file (EOF), whichever comes first. Emit a comment token whose data is the concatenation of all the characters starting from and including the character that caused the state machine to switch into the bogus comment state, up to and including the character immediately before the last consumed character (i.e. up to the character just before the U+003E or EOF character), but with any U+0000 NULL characters replaced by U+FFFD REPLACEMENT CHARACTER characters. (If the comment was started by the end of the file (EOF), the token is empty.)

        Switch to the data state.

        If the end of the file was reached, reconsume the EOF character.
        */
        public override void Read(Tokenizer t)
        {
            if(!(t.CurrentToken is CommentToken)){
                t.CurrentToken = new CommentToken();
                t.CurrentCommentToken.Append(t.CurrentInputChar);
            }
            char? c = t.ConsumeChar();
            switch(c){
                case Chars.GREATER_THAN_SIGN:{
                    t.EmitToken();
                    t.ChangeTokenState<DataState>();
                    return;
                }
                case null:
                    t.UnConsume(1);
                    t.EmitToken();
                    t.ChangeTokenState<DataState>();
                    return;
                default:
                    t.CurrentCommentToken.Append(c);
                    return;
            }
        }
Ejemplo n.º 23
0
        public override void Read(Tokenizer t)
        {
            char? c = t.ConsumeChar();

            switch(c){
                case Chars.CHARACTER_TABULATION:
                case Chars.LINE_FEED:
                case Chars.FORM_FEED:
                case Chars.SPACE:
                    t.ChangeTokenState<AfterDoctypeNameState>();
                    return;
                case Chars.GREATER_THAN_SIGN:
                    t.ChangeTokenState<DataState>();
                    t.EmitToken();
                    return;
                case Chars.NULL:
                    OnMessageRaised(new NullInDoctypeError());
                    ((DoctypeToken)t.CurrentToken).Name += Chars.REPLACEMENT_CHARACTER;
                    return;
                case null:
                    OnMessageRaised(new SuddenlyEndAtDoctypeError());
                    ((DoctypeToken)t.CurrentToken).ForceQuirks = true;
                    t.UnConsume(1);
                    t.ChangeTokenState<DataState>();
                    t.EmitToken();
                    return;
                default:{
                    DoctypeToken result = (DoctypeToken)t.CurrentToken;
                    if(c.IsLatinCapitalLetter()){
                        result.Name += c.ToLower();
                    } else {
                        result.Name += c;
                    }
                    return;
                }
            }
        }
Ejemplo n.º 24
0
 public override void Read(Tokenizer t)
 {
     char? c = t.ConsumeChar();
     switch(c){
         case Chars.RIGHT_SQUARE_BRACKET:
             if(IsStringMatch(t, CDATASectionEndId)){
                 t.ChangeTokenState<DataState>();
                 return;
             }
             break;
         case null:
             t.UnConsume(1);
             t.ChangeTokenState<DataState>();
             return;
     }
     t.EmitToken(c);
 }
Ejemplo n.º 25
0
 public override void Read(Tokenizer t)
 {
     char? c = t.ConsumeChar();
     switch(c){
         case Chars.GREATER_THAN_SIGN:{
             t.ChangeTokenState<DataState>();
             return;
         }
         case null:
             t.UnConsume(1);
             t.ChangeTokenState<DataState>();
             t.EmitToken();
             return;
         default:
             return;
     }
 }
Ejemplo n.º 26
0
        public override void Read(Tokenizer t)
        {
            char? c = t.ConsumeChar();

            switch(c){
                case Chars.CHARACTER_TABULATION:
                case Chars.LINE_FEED:
                case Chars.FORM_FEED:
                case Chars.SPACE:
                    return;
                case Chars.QUOTATION_MARK:
                    t.ChangeTokenState<AttributeValueState<DoubleQuoted>>();
                    return;
                case Chars.AMPERSAND:
                    t.ChangeTokenState<AttributeValueUnQuotedState>();
                    return;
                case Chars.APOSTROPHE:
                    t.ChangeTokenState<AttributeValueState<SingleQuoted>>();
                    return;
                case Chars.NULL:
                    OnMessageRaised(new NullInAttributeValueError());
                    t.CurrentTagToken.CurrentAttribute.Value += Chars.REPLACEMENT_CHARACTER;
                    t.ChangeTokenState<AttributeValueUnQuotedState>();
                    return;
                case Chars.GREATER_THAN_SIGN:
                    OnMessageRaised(new MissingAttributeValueError());
                    t.ChangeTokenState<DataState>();
                    t.EmitToken();
                    return;
                case Chars.LESS_THAN_SIGN:
                case Chars.EQUALS_SIGN:
                case Chars.GRAVE_ACCENT:
                    OnMessageRaised(new InvalidCharInUnquotedAttributeValueError(c));
                    goto default;
                case null:
                    OnMessageRaised(new SuddenlyEndAtAttributeError());
                    t.UnConsume(1);
                    t.ChangeTokenState<DataState>();
                    return;
                default:
                    t.CurrentTagToken.CurrentAttribute.Value += c;
                    t.ChangeTokenState<AttributeValueUnQuotedState>();
                    return;
            }
        }
Ejemplo n.º 27
0
 public override void Read(Tokenizer t)
 {
     char? c = t.ConsumeChar();
     switch(c){
         case Chars.GREATER_THAN_SIGN:
             ((TagToken)t.CurrentToken).SelfClosing = true;
             t.EmitToken();
             t.ChangeTokenState<DataState>();
             return;
         case null:
             OnMessageRaised(new SuddenlyEndAtScriptError());
             t.UnConsume(1);
             t.ChangeTokenState<DataState>();
             return;
         default:
             OnMessageRaised(new InvaridAttributeInSelfClosingTagError());
             t.UnConsume(1);
             t.ChangeTokenState<BeforeAttributeNameState>();
             return;
     }
 }
Ejemplo n.º 28
0
        public override void Read(Tokenizer t)
        {
            char? c = t.ConsumeChar();

            switch(c){
                case Chars.CHARACTER_TABULATION:
                case Chars.LINE_FEED:
                case Chars.FORM_FEED:
                case Chars.SPACE:
                    t.ChangeTokenState<BeforeAttributeNameState>();
                    return;
                case Chars.SOLIDUS:
                    t.ChangeTokenState<SelfClosingStartTagState>();
                    return;
                case Chars.GREATER_THAN_SIGN:
                    t.ChangeTokenState<DataState>();
                    t.EmitToken();
                    return;
                case Chars.NULL:
                    OnMessageRaised(new NullInElementNameError());
                    t.CurrentTagToken.Name += Chars.REPLACEMENT_CHARACTER;
                    return;
                case null:
                    OnMessageRaised(new SuddenlyEndAtTagError());
                    t.UnConsume(1);
                    t.ChangeTokenState<DataState>();
                    return;
                default:{
                    TagToken result = (TagToken)t.CurrentToken;
                    if(c.IsLatinCapitalLetter()){
                        result.Name += c.ToLower();
                    } else {
                        result.Name += c;
                    }
                    return;
                }
            }
        }
Ejemplo n.º 29
0
 public override void Read(Tokenizer t)
 {
     char? c = t.ConsumeChar();
     switch(c){
         case Chars.CHARACTER_TABULATION:
         case Chars.LINE_FEED:
         case Chars.FORM_FEED:
         case Chars.SPACE:
             t.ChangeTokenState<BeforeDoctypeNameState>();
             return;
         case null:
             OnMessageRaised(new SuddenlyEndAtAttributeError());
             t.UnConsume(1);
             t.ChangeTokenState<DataState>();
             t.EmitToken(new DoctypeToken(){ForceQuirks = true});
             return;
         default:
             OnMessageRaised(new MissingSpaceBeforeDoctypeIdentifierError());
             t.UnConsume(1);
             t.ChangeTokenState<BeforeDoctypeNameState>();
             return;
     }
 }