提交 f2876f67 编写于 作者: C Cyrus Najmabadi

Add regions

上级 7c8ff856
......@@ -189,6 +189,8 @@ public static void GetPartsOfConditionalAccessExpression(this ISyntaxFactsServic
#region ISyntaxKinds forwarding methods
#region trivia
public static bool IsEndOfLineTrivia(this ISyntaxFactsService syntaxFacts, SyntaxTrivia trivia)
=> trivia.RawKind == syntaxFacts.SyntaxKinds.EndOfLineTrivia;
......@@ -198,26 +200,42 @@ public static bool IsWhitespaceTrivia(this ISyntaxFactsService syntaxFacts, Synt
public static bool IsSkippedTokensTrivia(this ISyntaxFactsService syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)
=> node?.RawKind == syntaxFacts.SyntaxKinds.SkippedTokensTrivia;
#endregion
#region keywords
public static bool IsAwaitKeyword(this ISyntaxFactsService syntaxFacts, SyntaxToken token)
=> token.RawKind == syntaxFacts.SyntaxKinds.AwaitKeyword;
public static bool IsGlobalNamespaceKeyword(this ISyntaxFactsService syntaxFacts, SyntaxToken token)
=> token.RawKind == syntaxFacts.SyntaxKinds.GlobalKeyword;
#endregion
#region literal tokens
public static bool IsCharacterLiteral(this ISyntaxFactsService syntaxFacts, SyntaxToken token)
=> token.RawKind == syntaxFacts.SyntaxKinds.CharacterLiteralToken;
public static bool IsStringLiteral(this ISyntaxFactsService syntaxFacts, SyntaxToken token)
=> token.RawKind == syntaxFacts.SyntaxKinds.StringLiteralToken;
#endregion
#region tokens
public static bool IsIdentifier(this ISyntaxFactsService syntaxFacts, SyntaxToken token)
=> token.RawKind == syntaxFacts.SyntaxKinds.IdentifierToken;
public static bool IsGlobalNamespaceKeyword(this ISyntaxFactsService syntaxFacts, SyntaxToken token)
=> token.RawKind == syntaxFacts.SyntaxKinds.GlobalKeyword;
public static bool IsHashToken(this ISyntaxFactsService syntaxFacts, SyntaxToken token)
=> token.RawKind == syntaxFacts.SyntaxKinds.HashToken;
public static bool IsInterpolatedStringTextToken(this ISyntaxFactsService syntaxFacts, SyntaxToken token)
=> token.RawKind == syntaxFacts.SyntaxKinds.InterpolatedStringTextToken;
public static bool IsStringLiteral(this ISyntaxFactsService syntaxFacts, SyntaxToken token)
=> token.RawKind == syntaxFacts.SyntaxKinds.StringLiteralToken;
#endregion
#region names
public static bool IsGenericName(this ISyntaxFactsService syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)
=> node?.RawKind == syntaxFacts.SyntaxKinds.GenericName;
......@@ -228,9 +246,17 @@ public static bool IsIdentifierName(this ISyntaxFactsService syntaxFacts, [NotNu
public static bool IsQualifiedName(this ISyntaxFactsService syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)
=> node?.RawKind == syntaxFacts.SyntaxKinds.QualifiedName;
#endregion
#region types
public static bool IsTupleType(this ISyntaxFactsService syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)
=> node?.RawKind == syntaxFacts.SyntaxKinds.TupleType;
#endregion
#region literal expressions
public static bool IsCharacterLiteralExpression(this ISyntaxFactsService syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)
=> node?.RawKind == syntaxFacts.SyntaxKinds.CharacterLiteralExpression;
......@@ -249,6 +275,10 @@ public static bool IsStringLiteralExpression(this ISyntaxFactsService syntaxFact
public static bool IsTrueLiteralExpression(this ISyntaxFactsService syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)
=> node?.RawKind == syntaxFacts.SyntaxKinds.TrueLiteralExpression;
#endregion
#region
public static bool IsAwaitExpression(this ISyntaxFactsService syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)
=> node?.RawKind == syntaxFacts.SyntaxKinds.AwaitExpression;
......@@ -288,6 +318,10 @@ public static bool IsThisExpression(this ISyntaxFactsService syntaxFacts, [NotNu
public static bool IsTupleExpression(this ISyntaxFactsService syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)
=> node?.RawKind == syntaxFacts.SyntaxKinds.TupleExpression;
#endregion
#region statements
public static bool IsExpressionStatement(this ISyntaxFactsService syntaxFacts, [NotNullWhen(true)] SyntaxNode? node)
=> node?.RawKind == syntaxFacts.SyntaxKinds.ExpressionStatement;
......@@ -306,6 +340,10 @@ public static bool IsReturnStatement(this ISyntaxFactsService syntaxFacts, [NotN
public static bool IsUsingStatement(this ISyntaxFactsService syntaxFacts, [NotNullWhen(true)] SyntaxNode node)
=> node?.RawKind == syntaxFacts.SyntaxKinds.UsingStatement;
#endregion
#region members/declarations
public static bool IsAttribute(this ISyntaxFactsService syntaxFacts, [NotNullWhen(true)] SyntaxNode node)
=> node?.RawKind == syntaxFacts.SyntaxKinds.Attribute;
......@@ -322,5 +360,7 @@ public static bool IsTypeArgumentList(this ISyntaxFactsService syntaxFacts, [Not
=> node?.RawKind == syntaxFacts.SyntaxKinds.TypeArgumentList;
#endregion
#endregion
}
}
......@@ -16,26 +16,58 @@ internal interface ISyntaxKindsService : ILanguageService
{
TSyntaxKind Convert<TSyntaxKind>(int kind) where TSyntaxKind : struct;
#region trivia
int ConflictMarkerTrivia { get; }
int DisabledTextTrivia { get; }
int EndOfLineTrivia { get; }
int SkippedTokensTrivia { get; }
int WhitespaceTrivia { get; }
#endregion
#region keywords
int AwaitKeyword { get; }
int GlobalKeyword { get; }
int IfKeyword { get; }
#endregion
#region literal tokens
int CharacterLiteralToken { get; }
int StringLiteralToken { get; }
#endregion
#region tokens
int DotToken { get; }
int EndOfFileToken { get; }
int HashToken { get; }
int IdentifierToken { get; }
int InterpolatedStringTextToken { get; }
int QuestionToken { get; }
int StringLiteralToken { get; }
int IfKeyword { get; }
#endregion
#region names
int GenericName { get; }
int IdentifierName { get; }
int QualifiedName { get; }
#endregion
#region types
int TupleType { get; }
#endregion
#region literal expressions
int CharacterLiteralExpression { get; }
int DefaultLiteralExpression { get; }
int FalseLiteralExpression { get; }
......@@ -43,6 +75,10 @@ internal interface ISyntaxKindsService : ILanguageService
int StringLiteralExpression { get; }
int TrueLiteralExpression { get; }
#endregion
#region expressions
int AnonymousObjectCreationExpression { get; }
int AwaitExpression { get; }
int BaseExpression { get; }
......@@ -70,12 +106,9 @@ internal interface ISyntaxKindsService : ILanguageService
int ThisExpression { get; }
int TupleExpression { get; }
int EndOfFileToken { get; }
int AwaitKeyword { get; }
int IdentifierToken { get; }
int GlobalKeyword { get; }
int IncompleteMember { get; }
int HashToken { get; }
#endregion
#region statements
int ExpressionStatement { get; }
int ForEachStatement { get; }
......@@ -84,11 +117,18 @@ internal interface ISyntaxKindsService : ILanguageService
int ReturnStatement { get; }
int UsingStatement { get; }
#endregion
#region members/declarations
int Attribute { get; }
int Parameter { get; }
int TypeConstraint { get; }
int VariableDeclarator { get; }
int IncompleteMember { get; }
int TypeArgumentList { get; }
#endregion
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册