0

I need an exhaustive list of SyntaxKind that belongs to SyntaxToken, and list of SyntaxKind that belongs to SyntaxNode. The reason is because SyntaxKind contain not only kind that belongs to SyntaxToken, but also kind that belongs to SyntaxNode, and i didn't know how to differentiate it. I need the list because i want to know all possible kind for SyntaxToken, and all possible kind for SyntaxNode. For example, PublicKeyword kind belongs to SyntaxToken, and ClassDeclaration kind belongs to SyntaxNode, and both of them is in SyntaxKind.

I need the list for Roslyn version 3.11.0 (C#9.0) and version 4.9.2 (C#12.0). Can anyone please help me with this? Thank you in advance.

I tried searching but can't find it.

1 Answer 1

2

Thanks to DoctorKrolic in C# discord for this answer. There is method IsAnyToken(SyntaxKind) in Microsoft.CodeAnalysis.CSharp.SyntaxFacts class. The method didn't have any description in the documentation, but it looks like the method return true when the SyntaxKind argument belongs to SyntaxToken, and false otherwise. I can use the method to generate the list of SyntaxKind that belongs to SyntaxToken by looping the SyntaxKind enum and check if it belongs to SyntaxToken or not by using IsAnyToken. SyntaxKind that didn't appear in the generated list means it belongs to SyntaxNode.

Sign up to request clarification or add additional context in comments.

2 Comments

For info: you can accept your own answer to close it.
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.