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


C# Char.IsLineBreak方法代码示例

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


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

示例1: StringSQ

        /// <summary>
        /// 4.4.3. Single quoted string state
        /// </summary>
        CssToken StringSQ(Char current)
        {
            while (true)
            {
                switch (current)
                {
                    case Specification.SingleQuote:
                    case Specification.EndOfFile:
                        return CssStringToken.Plain(FlushBuffer());

                    case Specification.FormFeed:
                    case Specification.LineFeed:
                        RaiseErrorOccurred(ErrorCode.LineBreakUnexpected);
                        Back();
                        return (CssStringToken.Plain(FlushBuffer(), true));

                    case Specification.ReverseSolidus:
                        current = Next;

                        if (current.IsLineBreak())
                            _stringBuffer.AppendLine();
                        else if (current != Specification.EndOfFile)
                            _stringBuffer.Append(ConsumeEscape(current));
                        else
                        {
                            RaiseErrorOccurred(ErrorCode.EOF);
                            Back();
                            return(CssStringToken.Plain(FlushBuffer(), true));
                        }

                        break;

                    default:
                        _stringBuffer.Append(current);
                        break;
                }

                current = Next;
            }
        }
开发者ID:jogibear9988,项目名称:AngleSharp,代码行数:43,代码来源:CssTokenizer.cs

示例2: Data


//.........这里部分代码省略.........
                    return CssToken.Delim(current);
                }

                case Specification.Comma:
                    return CssSpecialCharacter.Comma;

                case Specification.Dot:
                {
                    var c = Next;

                    if (c.IsDigit())
                        return NumberStart(Previous);

                    return CssToken.Delim(Previous);
                }

                case Specification.Minus:
                {
                    var c1 = Next;

                    if (c1 == Specification.EndOfFile)
                    {
                        Back();
                    }
                    else
                    {
                        var c2 = Next;
                        Back(2);

                        if (c1.IsDigit() || (c1 == Specification.Dot && c2.IsDigit()))
                            return NumberStart(current);
                        else if (c1.IsNameStart())
                            return IdentStart(current);
                        else if (c1 == Specification.ReverseSolidus && !c2.IsLineBreak() && c2 != Specification.EndOfFile)
                            return IdentStart(current);
                        else if (c1 == Specification.Minus && c2 == Specification.GreaterThan)
                        {
                            Advance(2);

                            if (_ignoreCs)
                                return Data(Next);

                            return CssCommentToken.Close;
                        }
                    }

                    return CssToken.Delim(current);
                }

                case Specification.Solidus:
                    current = Next;

                    if (current == Specification.Asterisk)
                        return Comment(Next);

                    return CssToken.Delim(Previous);

                case Specification.ReverseSolidus:
                    current = Next;

                    if (current.IsLineBreak() || current == Specification.EndOfFile)
                    {
                        RaiseErrorOccurred(current == Specification.EndOfFile ? ErrorCode.EOF : ErrorCode.LineBreakUnexpected);
                        return CssToken.Delim(Previous);
                    }
开发者ID:jogibear9988,项目名称:AngleSharp,代码行数:66,代码来源:CssTokenizer.cs

示例3: IsValidEscape

        /// <summary>
        /// Checks if the current position is the beginning of a valid escape sequence.
        /// </summary>
        /// <returns>The result of the check.</returns>
        Boolean IsValidEscape(Char current)
        {
            if (current != Specification.ReverseSolidus)
                return false;

            current = Next;
            Back();

            if (current == Specification.EndOfFile)
                return false;
            else if (current.IsLineBreak())
                return false;

            return true;
        }
开发者ID:jogibear9988,项目名称:AngleSharp,代码行数:19,代码来源:CssTokenizer.cs

示例4: BackUnsafe

        /// <summary>
        /// Just goes back one character without checking
        /// if the beginning is already reached.
        /// </summary>
        void BackUnsafe()
        {
            _source.Index -= 1;

            if (_source.Index == 0)
            {
                _column = 0;
                _current = Symbols.Null;
                return;
            }

            _current = _source[_source.Index - 1];

            if (_current == Symbols.CarriageReturn)
            {
                BackUnsafe();
                return;
            }

            if (_current.IsLineBreak())
            {
                _column = _columns.Count != 0 ? _columns.Pop() : (UInt16)1;
                _row--;
            }
            else
            {
                _column--;
            }
        }
开发者ID:JBTech,项目名称:AngleSharp,代码行数:33,代码来源:BaseTokenizer.cs

示例5: UrlSQ

        /// <summary>
        /// 4.4.19. URL-single-quoted state
        /// </summary>
        CssToken UrlSQ(Char current, CssTokenType type)
        {
            while (true)
            {
                if (current.IsLineBreak())
                {
                    RaiseErrorOccurred(ErrorCode.LineBreakUnexpected);
                    return UrlBad(Next, type);
                }
                else if (Specification.EndOfFile == current)
                {
                    return CssStringToken.Url(type, FlushBuffer());
                }
                else if (current == Specification.SingleQuote)
                {
                    return UrlEnd(Next, type);
                }
                else if (current == Specification.ReverseSolidus)
                {
                    current = Next;

                    if (current == Specification.EndOfFile)
                    {
                        Back(2);
                        RaiseErrorOccurred(ErrorCode.EOF);
                        return CssStringToken.Url(type, FlushBuffer(), true);
                    }
                    else if (current.IsLineBreak())
                        _stringBuffer.AppendLine();
                    else
                        _stringBuffer.Append(ConsumeEscape(current));
                }
                else
                    _stringBuffer.Append(current);

                current = Next;
            }
        }
开发者ID:jogibear9988,项目名称:AngleSharp,代码行数:41,代码来源:CssTokenizer.cs

示例6: IsValidEscape

        /// <summary>
        /// Checks if the current position is the beginning of a valid escape sequence.
        /// </summary>
        /// <returns>The result of the check.</returns>
        Boolean IsValidEscape(Char current)
        {
            if (current != Symbols.ReverseSolidus)
                return false;

            current = GetNext();
            Back();

            if (current == Symbols.EndOfFile)
                return false;
            else if (current.IsLineBreak())
                return false;

            return true;
        }
开发者ID:JBTech,项目名称:AngleSharp,代码行数:19,代码来源:CssTokenizer.cs

示例7: Data

        /// <summary>
        /// 4.4.1. Data state
        /// </summary>
        CssToken Data(Char current)
        {
            _position = GetCurrentPosition();

            switch (current)
            {
                case Symbols.FormFeed:
                case Symbols.LineFeed:
                case Symbols.CarriageReturn:
                case Symbols.Tab:
                case Symbols.Space:
                    return NewWhitespace(current);

                case Symbols.DoubleQuote:
                    return StringDQ();

                case Symbols.Num:
                    return _valueMode ? ColorLiteral() : HashStart();

                case Symbols.Dollar:
                    current = GetNext();

                    if (current == Symbols.Equality)
                        return NewSuffix();

                    return NewDelimiter(GetPrevious());

                case Symbols.SingleQuote:
                    return StringSQ();

                case Symbols.RoundBracketOpen:
                    return NewOpenRound();

                case Symbols.RoundBracketClose:
                    return NewCloseRound();

                case Symbols.Asterisk:
                    current = GetNext();

                    if (current == Symbols.Equality)
                        return NewSubstring();

                    return NewDelimiter(GetPrevious());

                case Symbols.Plus:
                {
                    var c1 = GetNext();

                    if (c1 != Symbols.EndOfFile)
                    {
                        var c2 = GetNext();
                        Back(2);

                        if (c1.IsDigit() || (c1 == Symbols.Dot && c2.IsDigit()))
                            return NumberStart(current);
                    }
                    else
                        Back();
                        
                    return NewDelimiter(current);
                }

                case Symbols.Comma:
                    return NewComma();

                case Symbols.Dot:
                {
                    var c = GetNext();

                    if (c.IsDigit())
                        return NumberStart(GetPrevious());
                        
                    return NewDelimiter(GetPrevious());
                }

                case Symbols.Minus:
                {
                    var c1 = GetNext();

                    if (c1 != Symbols.EndOfFile)
                    {
                        var c2 = GetNext();
                        Back(2);

                        if (c1.IsDigit() || (c1 == Symbols.Dot && c2.IsDigit()))
                            return NumberStart(current);
                        else if (c1.IsNameStart())
                            return IdentStart(current);
                        else if (c1 == Symbols.ReverseSolidus && !c2.IsLineBreak() && c2 != Symbols.EndOfFile)
                            return IdentStart(current);
                        else if (c1 == Symbols.Minus && c2 == Symbols.GreaterThan)
                        {
                            Advance(2);
                            return NewCloseComment();
                        }
                    }
                    else
//.........这里部分代码省略.........
开发者ID:JBTech,项目名称:AngleSharp,代码行数:101,代码来源:CssTokenizer.cs

示例8: StringSQ

        /// <summary>
        /// 4.4.3. Single quoted string state
        /// </summary>
        CssToken StringSQ(Char current)
        {
            while (true)
            {
                switch (current)
                {
                    case Specification.SQ:
                    case Specification.EOF:
                        return CssStringToken.Plain(FlushBuffer());

                    case Specification.FF:
                    case Specification.LF:
                        RaiseErrorOccurred(ErrorCode.LineBreakUnexpected);
                        _src.Back();
                        return (CssStringToken.Plain(FlushBuffer(), true));

                    case Specification.RSOLIDUS:
                        current = _src.Next;

                        if (current.IsLineBreak())
                            _stringBuffer.AppendLine();
                        else if (current != Specification.EOF)
                            _stringBuffer.Append(ConsumeEscape(current));
                        else
                        {
                            RaiseErrorOccurred(ErrorCode.EOF);
                            _src.Back();
                            return(CssStringToken.Plain(FlushBuffer(), true));
                        }

                        break;

                    default:
                        _stringBuffer.Append(current);
                        break;
                }

                current = _src.Next;
            }
        }
开发者ID:rrsc,项目名称:AngleSharp,代码行数:43,代码来源:CssTokenizer.cs

示例9: BackUnsafe

        /// <summary>
        /// Just goes back one character without checking
        /// if the beginning is already reached.
        /// </summary>
        void BackUnsafe()
        {
            _reader.Index -= 1;

            if (_reader.Index == 0)
            {
                _column = 0;
                _current = Specification.Null;
                return;
            }

            _current = _reader[_reader.Index - 1];

            if (_current.IsLineBreak())
            {
                _column = _collengths.Count != 0 ? _collengths.Pop() : 1;
                _row--;
            }
            else
                _column--;
        }
开发者ID:jogibear9988,项目名称:AngleSharp,代码行数:25,代码来源:SourceManager.cs

示例10: IsValidEscape

        /// <summary>
        /// Checks if the current position is the beginning of a valid escape sequence.
        /// </summary>
        /// <returns>The result of the check.</returns>
        Boolean IsValidEscape(Char current)
        {
            if (current != Specification.RSOLIDUS)
                return false;

            current = _src.Next;
            _src.Back();

            if (current == Specification.EOF)
                return false;
            else if (current.IsLineBreak())
                return false;

            return true;
        }
开发者ID:rrsc,项目名称:AngleSharp,代码行数:19,代码来源:CssTokenizer.cs

示例11: Data


//.........这里部分代码省略.........
                        return CssToken.Delim(current);
                    }

                case Specification.COMMA:
                    return CssSpecialCharacter.Comma;

                case Specification.DOT:
                    {
                        var c = _src.Next;

                        if (c.IsDigit())
                            return NumberStart(_src.Previous);

                        return CssToken.Delim(_src.Previous);
                    }

                case Specification.MINUS:
                    {
                        var c1 = _src.Next;

                        if (c1 == Specification.EOF)
                        {
                            _src.Back();
                        }
                        else
                        {
                            var c2 = _src.Next;
                            _src.Back(2);

                            if (c1.IsDigit() || (c1 == Specification.DOT && c2.IsDigit()))
                                return NumberStart(current);
                            else if (c1.IsNameStart())
                                return IdentStart(current);
                            else if (c1 == Specification.RSOLIDUS && !c2.IsLineBreak() && c2 != Specification.EOF)
                                return IdentStart(current);
                            else if (c1 == Specification.MINUS && c2 == Specification.GT)
                            {
                                _src.Advance(2);

                                if (_ignoreCs)
                                    return Data(_src.Next);

                                return CssCommentToken.Close;
                            }
                        }

                        return CssToken.Delim(current);
                    }

                case Specification.SOLIDUS:
                    current = _src.Next;

                    if (current == Specification.ASTERISK)
                        return Comment(_src.Next);

                    return CssToken.Delim(_src.Previous);

                case Specification.RSOLIDUS:
                    current = _src.Next;

                    if (current.IsLineBreak() || current == Specification.EOF)
                    {
                        RaiseErrorOccurred(current == Specification.EOF ? ErrorCode.EOF : ErrorCode.LineBreakUnexpected);
                        return CssToken.Delim(_src.Previous);
                    }
开发者ID:rrsc,项目名称:AngleSharp,代码行数:66,代码来源:CssTokenizer.cs

示例12: UrlSQ

        /// <summary>
        /// 4.4.19. URL-single-quoted state
        /// </summary>
        CssToken UrlSQ(Char current, CssTokenType type)
        {
            while (true)
            {
                if (current.IsLineBreak())
                {
                    RaiseErrorOccurred(ErrorCode.LineBreakUnexpected);
                    return UrlBad(_src.Next, type);
                }
                else if (Specification.EOF == current)
                {
                    return CssStringToken.Url(type, FlushBuffer());
                }
                else if (current == Specification.SQ)
                {
                    return UrlEnd(_src.Next, type);
                }
                else if (current == Specification.RSOLIDUS)
                {
                    current = _src.Next;

                    if (current == Specification.EOF)
                    {
                        _src.Back(2);
                        RaiseErrorOccurred(ErrorCode.EOF);
                        return CssStringToken.Url(type, FlushBuffer(), true);
                    }
                    else if (current.IsLineBreak())
                        _stringBuffer.AppendLine();
                    else
                        _stringBuffer.Append(ConsumeEscape(current));
                }
                else
                    _stringBuffer.Append(current);

                current = _src.Next;
            }
        }
开发者ID:rrsc,项目名称:AngleSharp,代码行数:41,代码来源:CssTokenizer.cs

示例13: BackUnsafe

        void BackUnsafe()
        {
            _insertion--;

            if (_insertion == 0)
            {
                _column = 0;
                _current = Specification.NULL;
                return;
            }

            _current = _buffer[_insertion - 1];

            if (_current.IsLineBreak())
            {
                _column = _collengths.Count != 0 ? _collengths.Pop() : 1;
                _row--;
            }
            else
                _column--;
        }
开发者ID:Rajbandi,项目名称:AngleSharp,代码行数:21,代码来源:SourceManager.cs

示例14: IsValidEscape

        Boolean IsValidEscape(Char current)
        {
            if (current == Symbols.ReverseSolidus)
            {
                current = GetNext();
                Back();

                return current != Symbols.EndOfFile && !current.IsLineBreak();
            }
                
            return false;
        }
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:12,代码来源:CssTokenizer.cs


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