• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Core.Mark类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中YamlDotNet.Core.Mark的典型用法代码示例。如果您正苦于以下问题:C# Mark类的具体用法?C# Mark怎么用?C# Mark使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Mark类属于YamlDotNet.Core命名空间,在下文中一共展示了Mark类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SimpleKey

 /// <summary>
 /// Initializes a new instance of the <see cref="SimpleKey"/> class.
 /// </summary>
 public SimpleKey(bool isPossible, bool isRequired, int tokenNumber, Mark mark)
 {
     this.isPossible = isPossible;
     this.isRequired = isRequired;
     this.tokenNumber = tokenNumber;
     this.mark = mark;
 }
开发者ID:bennidhamma,项目名称:YamlDotNet,代码行数:10,代码来源:SimpleKey.cs


示例2: Region

		public Region(Mark start, Mark end)
		{
			Debug.Assert(start.Line < end.Line || (start.Line == end.Line && start.Column <= end.Column));

			Start = start;
			End = end;
		}
开发者ID:modulexcite,项目名称:YamlDotNet.Editor,代码行数:7,代码来源:Region.cs


示例3: GetNode

		/// <summary>
		/// Gets the node with the specified anchor.
		/// </summary>
		/// <param name="anchor">The anchor.</param>
		/// <param name="throwException">if set to <c>true</c>, the method should throw an exception if there is no node with that anchor.</param>
		/// <param name="start">The start position.</param>
		/// <param name="end">The end position.</param>
		/// <returns></returns>
		public YamlNode GetNode(string anchor, bool throwException, Mark start, Mark end)
		{
			YamlNode target;
			if (anchors.TryGetValue(anchor, out target))
			{
				return target;
			}
			else if (throwException)
			{
				throw new AnchorNotFoundException(start, end, string.Format(CultureInfo.InvariantCulture, "The anchor '{0}' does not exists", anchor));
			}
			else
			{
				return null;
			}
		}
开发者ID:Gwynneth,项目名称:YamlDotNet,代码行数:24,代码来源:DocumentLoadingState.cs


示例4: ScanVersionDirectiveNumber

        /// <summary>
        /// Scan the version number of VERSION-DIRECTIVE.
        ///
        /// Scope:
        ///      %YAML   1.1     # a comment \n
        ///              ^
        ///      %YAML   1.1     # a comment \n
        ///                ^
        /// </summary>
        private int ScanVersionDirectiveNumber(Mark start)
        {
            int value = 0;
            int length = 0;

            // Repeat while the next character is digit.

            while (analyzer.IsDigit())
            {
                // Check if the number is too long.

                if (++length > MaxVersionNumberLength)
                {
                    throw new SyntaxErrorException(start, mark, "While scanning a %YAML directive, find extremely long version number.");
                }

                value = value * 10 + analyzer.AsDigit();

                Skip();
            }

            // Check if the number was present.

            if (length == 0)
            {
                throw new SyntaxErrorException(start, mark, "While scanning a %YAML directive, did not find expected version number.");
            }

            return value;
        }
开发者ID:roji,项目名称:YamlDotNet,代码行数:39,代码来源:Scanner.cs


示例5: ScanUriEscapes

        /// <summary>
        /// Decode an URI-escape sequence corresponding to a single UTF-8 character.
        /// </summary>
        private char ScanUriEscapes(Mark start)
        {
            // Decode the required number of characters.

            List<byte> charBytes = new List<byte>();
            int width = 0;
            do
            {
                // Check for a URI-escaped octet.

                if (!(analyzer.Check('%') && analyzer.IsHex(1) && analyzer.IsHex(2)))
                {
                    throw new SyntaxErrorException(start, mark, "While parsing a tag, did not find URI escaped octet.");
                }

                // Get the octet.

                int octet = (analyzer.AsHex(1) << 4) + analyzer.AsHex(2);

                // If it is the leading octet, determine the length of the UTF-8 sequence.

                if (width == 0)
                {
                    width = (octet & 0x80) == 0x00 ? 1 :
                            (octet & 0xE0) == 0xC0 ? 2 :
                            (octet & 0xF0) == 0xE0 ? 3 :
                            (octet & 0xF8) == 0xF0 ? 4 : 0;

                    if (width == 0)
                    {
                        throw new SyntaxErrorException(start, mark, "While parsing a tag, find an incorrect leading UTF-8 octet.");
                    }
                }
                else
                {
                    // Check if the trailing octet is correct.

                    if ((octet & 0xC0) != 0x80)
                    {
                        throw new SyntaxErrorException(start, mark, "While parsing a tag, find an incorrect trailing UTF-8 octet.");
                    }
                }

                // Copy the octet and move the pointers.

                charBytes.Add((byte)octet);

                Skip();
                Skip();
                Skip();
            }
            while (--width > 0);

            char[] characters = Encoding.UTF8.GetChars(charBytes.ToArray());

            if (characters.Length != 1)
            {
                throw new SyntaxErrorException(start, mark, "While parsing a tag, find an incorrect UTF-8 sequence.");
            }

            return characters[0];
        }
开发者ID:roji,项目名称:YamlDotNet,代码行数:65,代码来源:Scanner.cs


示例6: MaximumRecursionLevelReachedException

 /// <summary>
 /// Initializes a new instance of the <see cref="MaximumRecursionLevelReachedException"/> class.
 /// </summary>
 public MaximumRecursionLevelReachedException(Mark start, Mark end, string message)
     : base(start, end, message)
 {
 }
开发者ID:aaubry,项目名称:YamlDotNet,代码行数:7,代码来源:MaximumRecursionLevelReachedException.cs


示例7: DuplicateAnchorException

 /// <summary>
 /// Initializes a new instance of the <see cref="DuplicateAnchorException"/> class.
 /// </summary>
 public DuplicateAnchorException(Mark start, Mark end, string message)
     : base(start, end, message)
 {
 }
开发者ID:KevinAllenWiegand,项目名称:SaintCoinach,代码行数:7,代码来源:DuplicateAnchorException.cs


示例8: YamlException

 /// <summary>
 /// Initializes a new instance of the <see cref="YamlException"/> class.
 /// </summary>
 public YamlException(Mark start, Mark end, string message, Exception innerException)
     : base(string.Format("({0}) - ({1}): {2}", start, end, message), innerException)
 {
     Start = start;
     End = end;
 }
开发者ID:liujiekm,项目名称:YamlDotNet,代码行数:9,代码来源:YamlException.cs


示例9: SemanticErrorException

		/// <summary>
		/// Initializes a new instance of the <see cref="SemanticErrorException"/> class.
		/// </summary>
		public SemanticErrorException(Mark start, Mark end, string message)
			: base(start, end, message)
		{
		}
开发者ID:Gwynneth,项目名称:YamlDotNet,代码行数:7,代码来源:SemanticErrorException.cs


示例10: ForwardAnchorNotSupportedException

		/// <summary>
		/// Initializes a new instance of the <see cref="AnchorNotFoundException"/> class.
		/// </summary>
		public ForwardAnchorNotSupportedException(Mark start, Mark end, string message)
			: base(start, end, message)
		{
		}
开发者ID:Phrohdoh,项目名称:Projeny,代码行数:7,代码来源:ForwardAnchorNotSupportedException.cs


示例11: ScanUriEscapes

        /// <summary>
        /// Decode an URI-escape sequence corresponding to a single UTF-8 character.
        /// </summary>
        private string ScanUriEscapes(Mark start)
        {
            // Decode the required number of characters.

            byte[] charBytes = null;
            int nextInsertionIndex = 0;
            int width = 0;
            do
            {
                // Check for a URI-escaped octet.

                if (!(analyzer.Check('%') && analyzer.IsHex(1) && analyzer.IsHex(2)))
                {
                    throw new SyntaxErrorException(start, cursor.Mark(), "While parsing a tag, did not find URI escaped octet.");
                }

                // Get the octet.

                int octet = (analyzer.AsHex(1) << 4) + analyzer.AsHex(2);

                // If it is the leading octet, determine the length of the UTF-8 sequence.

                if (width == 0)
                {
                    width = (octet & 0x80) == 0x00 ? 1 :
                            (octet & 0xE0) == 0xC0 ? 2 :
                            (octet & 0xF0) == 0xE0 ? 3 :
                            (octet & 0xF8) == 0xF0 ? 4 : 0;

                    if (width == 0)
                    {
                        throw new SyntaxErrorException(start, cursor.Mark(), "While parsing a tag, find an incorrect leading UTF-8 octet.");
                    }

                    charBytes = new byte[width];
                }
                else
                {
                    // Check if the trailing octet is correct.

                    if ((octet & 0xC0) != 0x80)
                    {
                        throw new SyntaxErrorException(start, cursor.Mark(), "While parsing a tag, find an incorrect trailing UTF-8 octet.");
                    }
                }

                // Copy the octet and move the pointers.

                charBytes[nextInsertionIndex++] = (byte)octet;

                Skip();
                Skip();
                Skip();
            }
            while (--width > 0);

            var result = Encoding.UTF8.GetString(charBytes, 0, nextInsertionIndex);

            if (result.Length == 0 || result.Length > 2)
            {
                throw new SyntaxErrorException(start, cursor.Mark(), "While parsing a tag, find an incorrect UTF-8 sequence.");
            }

            return result;
        }
开发者ID:aaubry,项目名称:YamlDotNet,代码行数:68,代码来源:Scanner.cs


示例12: ScanVersionDirectiveValue

        /// <summary>
        /// Scan the value of VERSION-DIRECTIVE.
        ///
        /// Scope:
        ///      %YAML   1.1     # a comment \n
        ///           ^^^^^^
        /// </summary>
        private Token ScanVersionDirectiveValue(Mark start)
        {
            SkipWhitespaces();

            // Consume the major version number.

            int major = ScanVersionDirectiveNumber(start);

            // Eat '.'.

            if (!analyzer.Check('.'))
            {
                throw new SyntaxErrorException(start, mark, "While scanning a %YAML directive, did not find expected digit or '.' character.");
            }

            Skip();

            // Consume the minor version number.

            int minor = ScanVersionDirectiveNumber(start);

            return new VersionDirective(new Version(major, minor), start, start);
        }
开发者ID:roji,项目名称:YamlDotNet,代码行数:30,代码来源:Scanner.cs


示例13: ScanBlockScalarBreaks

        /// <summary>
        /// Scan intendation spaces and line breaks for a block scalar.  Determine the
        /// intendation level if needed.
        /// </summary>
        private int ScanBlockScalarBreaks(int currentIndent, StringBuilder breaks, Mark start, ref Mark end)
        {
            int maxIndent = 0;

            end = mark;

            // Eat the intendation spaces and line breaks.

            for (; ;)
            {
                // Eat the intendation spaces.

                while ((currentIndent == 0 || mark.Column < currentIndent) && analyzer.IsSpace())
                {
                    Skip();
                }

                if (mark.Column > maxIndent)
                {
                    maxIndent = mark.Column;
                }

                // Check for a tab character messing the intendation.

                if ((currentIndent == 0 || mark.Column < currentIndent) && analyzer.IsTab())
                {
                    throw new SyntaxErrorException(start, mark, "While scanning a block scalar, find a tab character where an intendation space is expected.");
                }

                // Have we find a non-empty line?

                if (!analyzer.IsBreak())
                {
                    break;
                }

                // Consume the line break.

                breaks.Append(ReadLine());

                end = mark;
            }

            // Determine the indentation level if needed.

            if (currentIndent == 0)
            {
                currentIndent = Math.Max(maxIndent, Math.Max(indent + 1, 1));
            }

            return currentIndent;
        }
开发者ID:roji,项目名称:YamlDotNet,代码行数:56,代码来源:Scanner.cs


示例14: RollIndent

        /// <summary>
        /// Push the current indentation level to the stack and set the new level
        /// the current column is greater than the indentation level.  In this case,
        /// append or insert the specified token into the token queue.
        /// </summary>
        private void RollIndent(int column, int number, bool isSequence, Mark position)
        {
            // In the flow context, do nothing.

            if (flowLevel > 0)
            {
                return;
            }

            if (indent < column)
            {

                // Push the current indentation level to the stack and set the new
                // indentation level.

                indents.Push(indent);

                indent = column;

                // Create a token and insert it into the queue.

                Token token;
                if (isSequence)
                {
                    token = new BlockSequenceStart(position, position);
                }
                else
                {
                    token = new BlockMappingStart(position, position);
                }

                if (number == -1)
                {
                    tokens.Enqueue(token);
                }
                else
                {
                    tokens.Insert(number - tokensParsed, token);
                }
            }
        }
开发者ID:roji,项目名称:YamlDotNet,代码行数:46,代码来源:Scanner.cs


示例15: ScanDirectiveName

        /// <summary>
        /// Scan the directive name.
        ///
        /// Scope:
        ///      %YAML   1.1     # a comment \n
        ///       ^^^^
        ///      %TAG    !yaml!  tag:yaml.org,2002:  \n
        ///       ^^^
        /// </summary>
        private string ScanDirectiveName(Mark start)
        {
            StringBuilder name = new StringBuilder();

            // Consume the directive name.

            while (analyzer.IsAlpha())
            {
                name.Append(ReadCurrentCharacter());
            }

            // Check if the name is empty.

            if (name.Length == 0)
            {
                throw new SyntaxErrorException(start, mark, "While scanning a directive, could not find expected directive name.");
            }

            // Check for an blank character after the name.

            if (!analyzer.IsBlankOrBreakOrZero())
            {
                throw new SyntaxErrorException(start, mark, "While scanning a directive, find unexpected non-alphabetical character.");
            }

            return name.ToString();
        }
开发者ID:roji,项目名称:YamlDotNet,代码行数:36,代码来源:Scanner.cs


示例16: AnchorNotFoundException

 /// <summary>
 /// Initializes a new instance of the <see cref="AnchorNotFoundException"/> class.
 /// </summary>
 public AnchorNotFoundException(Mark start, Mark end, string message)
     : base(start, end, message)
 {
 }
开发者ID:KevinAllenWiegand,项目名称:SaintCoinach,代码行数:7,代码来源:AnchorNotFoundException.cs


示例17: ScanTagDirectiveValue

        /// <summary>
        /// Scan the value of a TAG-DIRECTIVE token.
        ///
        /// Scope:
        ///      %TAG    !yaml!  tag:yaml.org,2002:  \n
        ///          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        /// </summary>
        private Token ScanTagDirectiveValue(Mark start)
        {
            SkipWhitespaces();

            // Scan a handle.

            string handle = ScanTagHandle(true, start);

            // Expect a whitespace.

            if (!analyzer.IsBlank())
            {
                throw new SyntaxErrorException(start, mark, "While scanning a %TAG directive, did not find expected whitespace.");
            }

            SkipWhitespaces();

            // Scan a prefix.

            string prefix = ScanTagUri(null, start);

            // Expect a whitespace or line break.

            if (!analyzer.IsBlankOrBreakOrZero())
            {
                throw new SyntaxErrorException(start, mark, "While scanning a %TAG directive, did not find expected whitespace or line break.");
            }

            return new TagDirective(handle, prefix, start, start);
        }
开发者ID:roji,项目名称:YamlDotNet,代码行数:37,代码来源:Scanner.cs


示例18: ScanTagHandle

        /// <summary>
        /// Scan a tag handle.
        /// </summary>
        private string ScanTagHandle(bool isDirective, Mark start)
        {
            // Check the initial '!' character.

            if (!analyzer.Check('!'))
            {
                throw new SyntaxErrorException(start, mark, "While scanning a tag, did not find expected '!'.");
            }

            // Copy the '!' character.

            StringBuilder tagHandle = new StringBuilder();
            tagHandle.Append(ReadCurrentCharacter());

            // Copy all subsequent alphabetical and numerical characters.

            while (analyzer.IsAlpha())
            {
                tagHandle.Append(ReadCurrentCharacter());
            }

            // Check if the trailing character is '!' and copy it.

            if (analyzer.Check('!'))
            {
                tagHandle.Append(ReadCurrentCharacter());
            }
            else
            {

                // It's either the '!' tag or not really a tag handle.  If it's a %TAG
                // directive, it's an error.  If it's a tag token, it must be a part of
                // URI.

                if (isDirective && (tagHandle.Length != 1 || tagHandle[0] != '!'))
                {
                    throw new SyntaxErrorException(start, mark, "While parsing a tag directive, did not find expected '!'.");
                }
            }

            return tagHandle.ToString();
        }
开发者ID:roji,项目名称:YamlDotNet,代码行数:45,代码来源:Scanner.cs


示例19: SyntaxErrorException

		/// <summary>
		/// Initializes a new instance of the <see cref="SyntaxErrorException"/> class.
		/// </summary>
		public SyntaxErrorException(Mark start, Mark end, string message)
			: base(start, end, message)
		{
		}
开发者ID:Phrohdoh,项目名称:Projeny,代码行数:7,代码来源:SyntaxErrorException.cs


示例20: ScanTagUri

        /// <summary>
        /// Scan a tag.
        /// </summary>
        private string ScanTagUri(string head, Mark start)
        {
            StringBuilder tag = new StringBuilder();
            if (head != null && head.Length > 1)
            {
                tag.Append(head.Substring(1));
            }

            // Scan the tag.

            // The set of characters that may appear in URI is as follows:

            //      '0'-'9', 'A'-'Z', 'a'-'z', '_', '-', ';', '/', '?', ':', '@', '&',
            //      '=', '+', '$', ',', '.', '!', '~', '*', '\'', '(', ')', '[', ']',
            //      '%'.

            while (analyzer.IsAlpha() || analyzer.Check(";/?:@&=+$,.!~*'()[]%"))
            {
                // Check if it is a URI-escape sequence.

                if (analyzer.Check('%'))
                {
                    tag.Append(ScanUriEscapes(start));
                }
                else
                {
                    tag.Append(ReadCurrentCharacter());
                }
            }

            // Check if the tag is non-empty.

            if (tag.Length == 0)
            {
                throw new SyntaxErrorException(start, mark, "While parsing a tag, did not find expected tag URI.");
            }

            return tag.ToString();
        }
开发者ID:roji,项目名称:YamlDotNet,代码行数:42,代码来源:Scanner.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Events.ParsingEvent类代码示例发布时间:2022-05-26
下一篇:
C# Y_.EventFacade类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap