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


C# AstNode.GetNextSibling方法代码示例

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


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

示例1: GetGlobalNewLinesFor

		int GetGlobalNewLinesFor(AstNode child)
		{
			if (child.NextSibling == null)
				// last node in the document => no extra newlines
				return 0;
			if (child.NextSibling.Role == Roles.RBrace)
				// Last node in a block => no extra newlines, it's handled later by FixClosingBrace()
				return 0;

			int newLines = 1;
			var nextSibling = child.GetNextSibling(NoWhitespacePredicate);
			if (nextSibling is PreProcessorDirective) {
				var directive = (PreProcessorDirective)nextSibling;
				if (directive.Type == PreProcessorDirectiveType.Endif)
					return -1;
				if (directive.Type == PreProcessorDirectiveType.Undef)
					return -1;
			}
			if ((child is UsingDeclaration || child is UsingAliasDeclaration) && !(nextSibling is UsingDeclaration || nextSibling is UsingAliasDeclaration)) {
				newLines += policy.BlankLinesAfterUsings;
			} else if ((child is TypeDeclaration) && (nextSibling is TypeDeclaration)) {
				newLines += policy.BlankLinesBetweenTypes;
			}

			return newLines;
		}
开发者ID:Bubeee,项目名称:NRefactory,代码行数:26,代码来源:FormattingVisitor_Global.cs

示例2: InsertUsingAfter

		static bool InsertUsingAfter (AstNode node)
		{
			return node is NewLineNode && IsCommentOrUsing (node.GetNextSibling (s => !(s is NewLineNode))) ||
				IsCommentOrUsing (node);
		}
开发者ID:segaman,项目名称:monodevelop,代码行数:5,代码来源:CSharpCodeGenerator.cs

示例3: GetTypeLevelNewLinesFor

        int GetTypeLevelNewLinesFor(AstNode child)
        {
            var blankLines = 1;
            var nextSibling = child.GetNextSibling(NoWhitespacePredicate);
            if (child is PreProcessorDirective || child is Comment)
                return 1;
            if (child is EventDeclaration) {
                if (nextSibling is EventDeclaration) {
                    blankLines += policy.BlankLinesBetweenEventFields;
                    return blankLines;
                }
            }

            if (child is FieldDeclaration || child is FixedFieldDeclaration) {
                if (nextSibling is FieldDeclaration || nextSibling is FixedFieldDeclaration) {
                    blankLines += policy.BlankLinesBetweenFields;
                    return blankLines;
                }
            }

            if (child is TypeDeclaration) {
                if (nextSibling is TypeDeclaration) {
                    blankLines += policy.BlankLinesBetweenTypes;
                    return blankLines;
                }
            }

            if (nextSibling.Role == Roles.TypeMemberRole)
                blankLines += policy.BlankLinesBetweenMembers;
            return blankLines;
        }
开发者ID:JoostK,项目名称:NRefactory,代码行数:31,代码来源:FormattingVisitor_Global.cs

示例4: GetGlobalNewLinesFor

        int GetGlobalNewLinesFor(AstNode child)
        {
            int newLines = 1;
            var nextSibling = child.GetNextSibling(NoWhitespacePredicate);
            if ((child is UsingDeclaration || child is UsingAliasDeclaration) && !(nextSibling is UsingDeclaration || nextSibling is UsingAliasDeclaration)) {
                newLines += policy.BlankLinesAfterUsings;
            } else if ((child is TypeDeclaration) && (nextSibling is TypeDeclaration)) {
                newLines += policy.BlankLinesBetweenTypes;
            }

            return newLines;
        }
开发者ID:JoostK,项目名称:NRefactory,代码行数:12,代码来源:FormattingVisitor_Global.cs

示例5: GetTypeLevelNewLinesFor

        int GetTypeLevelNewLinesFor(AstNode child)
        {
            var blankLines = 1;
            var nextSibling = child.GetNextSibling(NoWhitespacePredicate);
            if (child is PreProcessorDirective) {
                var directive = (PreProcessorDirective)child;
                if (directive.Type == PreProcessorDirectiveType.Region)
                    blankLines += policy.BlankLinesInsideRegion;
                if (directive.Type == PreProcessorDirectiveType.Endregion)
                    blankLines += policy.BlankLinesAroundRegion;
                return blankLines;
            }

            if (nextSibling is PreProcessorDirective) {
                var directive = (PreProcessorDirective)nextSibling;
                if (directive.Type == PreProcessorDirectiveType.Region)
                    blankLines += policy.BlankLinesAroundRegion;
                if (directive.Type == PreProcessorDirectiveType.Endregion)
                    blankLines += policy.BlankLinesInsideRegion;
                if (directive.Type == PreProcessorDirectiveType.Endif)
                    return -1;
                if (directive.Type == PreProcessorDirectiveType.Undef)
                    return -1;
                return blankLines;
            }
            if (child.Role == Roles.LBrace)
                return 1;
            if (child is Comment)
                return 1;
            if (child is EventDeclaration) {
                if (nextSibling is EventDeclaration) {
                    blankLines += policy.BlankLinesBetweenEventFields;
                    return blankLines;
                }
            }

            if (child is FieldDeclaration || child is FixedFieldDeclaration) {
                if (nextSibling is FieldDeclaration || nextSibling is FixedFieldDeclaration) {
                    blankLines += policy.BlankLinesBetweenFields;
                    return blankLines;
                }
            }

            if (child is TypeDeclaration) {
                if (nextSibling is TypeDeclaration) {
                    blankLines += policy.BlankLinesBetweenTypes;
                    return blankLines;
                }
            }

            if (nextSibling.Role == Roles.TypeMemberRole)
                blankLines += policy.BlankLinesBetweenMembers;
            return blankLines;
        }
开发者ID:porcus,项目名称:NRefactory,代码行数:54,代码来源:FormattingVisitor_Global.cs

示例6: GetGlobalNewLinesFor

        int GetGlobalNewLinesFor(AstNode child)
        {
            int newLines = 1;
            var nextSibling = child.GetNextSibling(NoWhitespacePredicate);
            if (nextSibling is PreProcessorDirective) {
                var directive = (PreProcessorDirective)nextSibling;
                if (directive.Type == PreProcessorDirectiveType.Endif)
                    return -1;
                if (directive.Type == PreProcessorDirectiveType.Undef)
                    return -1;
            }
            if ((child is UsingDeclaration || child is UsingAliasDeclaration) && !(nextSibling is UsingDeclaration || nextSibling is UsingAliasDeclaration)) {
                newLines += policy.BlankLinesAfterUsings;
            } else if ((child is TypeDeclaration) && (nextSibling is TypeDeclaration)) {
                newLines += policy.BlankLinesBetweenTypes;
            }

            return newLines;
        }
开发者ID:porcus,项目名称:NRefactory,代码行数:19,代码来源:FormattingVisitor_Global.cs


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