当前位置: 首页>>代码示例>>C#>>正文


C# Tokenizer.EmitToken方法代码示例

本文整理汇总了C#中Tokenizer.EmitToken方法的典型用法代码示例。如果您正苦于以下问题:C# Tokenizer.EmitToken方法的具体用法?C# Tokenizer.EmitToken怎么用?C# Tokenizer.EmitToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tokenizer的用法示例。


在下文中一共展示了Tokenizer.EmitToken方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Read

 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;
 }
开发者ID:bakera,项目名称:Test,代码行数:29,代码来源:EndTagOpenState.cs

示例2: Read

        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;
            }
        }
开发者ID:bakera,项目名称:Test,代码行数:28,代码来源:AfterDoctypeSystemIdentifierState.cs

示例3: Read

        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;
            }
        }
开发者ID:bakera,项目名称:Test,代码行数:32,代码来源:CommentStartDashState.cs

示例4: Read

        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;
            }
        }
开发者ID:bakera,项目名称:Test,代码行数:34,代码来源:ScriptDataDoubleEscapeStartState.cs

示例5: Read

        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;
            }
        }
开发者ID:bakera,项目名称:Test,代码行数:32,代码来源:ScriptDataEscapedLessThanSignState.cs

示例6: Read

        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;
            }
        }
开发者ID:bakera,项目名称:Test,代码行数:28,代码来源:ScriptDataDoubleEscapedState.cs

示例7: Read

 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);
     }
 }
开发者ID:bakera,项目名称:Test,代码行数:11,代码来源:CharacterReferenceInDataState.cs

示例8: Read

        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;
                }
            }
        }
开发者ID:bakera,项目名称:Test,代码行数:48,代码来源:ScriptDataEscapedEndTagNameState.cs

示例9: Read

 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;
     }
 }
开发者ID:bakera,项目名称:Test,代码行数:16,代码来源:PLAINTEXTState.cs

示例10: Read

 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;
 }
开发者ID:bakera,项目名称:Test,代码行数:30,代码来源:TagOpenState.cs

示例11: Read

        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;
            }
        }
开发者ID:bakera,项目名称:Test,代码行数:30,代码来源:AfterAttributeValueQuotedState.cs

示例12: Read

 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;
     }
 }
开发者ID:bakera,项目名称:Test,代码行数:19,代码来源:RAWTEXTState.cs

示例13: Read

 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;
 }
开发者ID:bakera,项目名称:Test,代码行数:19,代码来源:ScriptDataLessThanSignState.cs

示例14: Read

 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;
 }
开发者ID:bakera,项目名称:Test,代码行数:20,代码来源:RAWTEXTEndTagOpenState.cs

示例15: Read

        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;
            }
        }
开发者ID:bakera,项目名称:Test,代码行数:41,代码来源:AfterDoctypeSystemKeywordState.cs


注:本文中的Tokenizer.EmitToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。