本文整理汇总了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;
}
示例2: InsertUsingAfter
static bool InsertUsingAfter (AstNode node)
{
return node is NewLineNode && IsCommentOrUsing (node.GetNextSibling (s => !(s is NewLineNode))) ||
IsCommentOrUsing (node);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}