Show / Hide Table of Contents

Class SyntaxFacts

Various helper methods for working with SyntaxKind and SyntaxToken.

Inheritance
System.Object
SyntaxFacts
Namespace: DotLang.CodeAnalysis.Syntax
Assembly: DotLang.dll
Syntax
public static class SyntaxFacts

Methods

| Improve this Doc View Source

GetKind(String)

Returns a SyntaxKind for text that can be parsed or None if text cannot be parsed.

Declaration
public static SyntaxKind GetKind(string text)
Parameters
Type Name Description
System.String text
Returns
Type Description
SyntaxKind
| Improve this Doc View Source

GetText(SyntaxKind)

Returns a text representation of a SyntaxKind for kinds that have a static representation (character literal tokens and keywords), or an empty string for kinds that cannot be statically represented.

Declaration
public static string GetText(this SyntaxKind kind)
Parameters
Type Name Description
SyntaxKind kind
Returns
Type Description
System.String
| Improve this Doc View Source

IsEdge(SyntaxKind)

Determines if a SyntaxKind is an edge. That is, any kind that is one of UndirectedEdgeToken, or DirectedEdgeToken.

Declaration
public static bool IsEdge(this SyntaxKind kind)
Parameters
Type Name Description
SyntaxKind kind
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsEdge(SyntaxToken)

Determines if a SyntaxToken is an edge. That is a token whose Kind is one of UndirectedEdgeToken or DirectedEdgeToken.

Declaration
public static bool IsEdge(this SyntaxToken token)
Parameters
Type Name Description
SyntaxToken token
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsIdentifier(SyntaxKind)

Determines if a SyntaxKind is an identifier. That is, any kind that is one of IdentifierToken, StringLiteralToken, XmlLiteralToken, or NumeralLiteralToken.

Declaration
public static bool IsIdentifier(this SyntaxKind kind)
Parameters
Type Name Description
SyntaxKind kind
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsIdentifier(SyntaxToken)

Determines if a SyntaxToken is an identifier. That is a token whose Kind is one of IdentifierToken, StringLiteralToken, XmlLiteralToken, or NumeralLiteralToken.

Declaration
public static bool IsIdentifier(this SyntaxToken token)
Parameters
Type Name Description
SyntaxToken token
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsIdentifierChar(Char, Boolean)

Determines if a character is a valid identifier character for an IdentifierToken.

Declaration
public static bool IsIdentifierChar(char c, bool firstChar)
Parameters
Type Name Description
System.Char c

The character to validate.

System.Boolean firstChar

Whether or not c is the first character in the potential IdentifierToken.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsTerminalDelimiterChar(Char)

Determines if c is a suitable terminal delimeter such that no explicit ; needs to be inserte dbetween tokens.

Declaration
public static bool IsTerminalDelimiterChar(char c)
Parameters
Type Name Description
System.Char c
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsTrivia(SyntaxKind)

Determines if a SyntaxKind is trivia. That is, any kind that is one of WhiteSpaceTriviaToken, SingleLineCommentTriviaToken, or MultiLineCommentTriviaToken.

Declaration
public static bool IsTrivia(this SyntaxKind kind)
Parameters
Type Name Description
SyntaxKind kind
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsTrivia(SyntaxToken)

Determines if a SyntaxToken is trivia. That is a token whose Kind is one of WhiteSpaceTriviaToken, SingleLineCommentTriviaToken, or MultiLineCommentTriviaToken.

Declaration
public static bool IsTrivia(this SyntaxToken token)
Parameters
Type Name Description
SyntaxToken token
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsValid(SyntaxKind)

Determines if a SyntaxKind is valid. That is, any kind except None.

Declaration
public static bool IsValid(this SyntaxKind kind)
Parameters
Type Name Description
SyntaxKind kind
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsValid(SyntaxToken)

Determines if a SyntaxToken is valid. That is, a token whose Kind is any kind except None.

Declaration
public static bool IsValid(this SyntaxToken token)
Parameters
Type Name Description
SyntaxToken token
Returns
Type Description
System.Boolean
| Improve this Doc View Source

ToIdentifierToken(String)

Declaration
public static SyntaxToken ToIdentifierToken(string id)
Parameters
Type Name Description
System.String id
Returns
Type Description
SyntaxToken
  • Improve this Doc
  • View Source
Back to top Generated by DocFX