private static Classification GetClassification(SyntaxKind kind) { var isKeyword = kind.IsKeyword(); var isIdentifier = kind == SyntaxKind.IdentifierToken; var isNumber = kind == SyntaxKind.NumberToken; var isString = kind == SyntaxKind.StringToken; var isComment = kind.IsComment(); if (isKeyword) { return(Classification.Keyword); } else if (isIdentifier) { return(Classification.Identifier); } else if (isNumber) { return(Classification.Number); } else if (isString) { return(Classification.String); } else if (isComment) { return(Classification.Comment); } else { return(Classification.Text); } }
private static Classification GetClassification(SyntaxKind tokenKind) { if (tokenKind.IsKeyword()) { return(Classification.Keyword); } if (tokenKind.IsComment()) { return(Classification.Comment); } return(tokenKind switch { SyntaxKind.IdentifierToken => Classification.Identifier, SyntaxKind.NumberToken => Classification.Number, SyntaxKind.StringToken => Classification.String, _ => Classification.Text });
public static void IsComment(SyntaxKind kind, bool expectedResult) => Assert.That(kind.IsComment(), Is.EqualTo(expectedResult));