SyntaxToken Class

A token node.

public class SyntaxToken : SyntaxNode
Inheritance
SyntaxNode SyntaxToken

Constructors

NameDescription
SyntaxToken()Creates a new instance of SyntaxToken
SyntaxToken(TokenKind, string?)Creates a new instance of SyntaxToken

SyntaxToken overloads

SyntaxToken()

SyntaxToken.cs

Creates a new instance of SyntaxToken

public SyntaxToken()

SyntaxToken(TokenKind, string?)

SyntaxToken.cs

Creates a new instance of SyntaxToken

public SyntaxToken(TokenKind tokenKind, string? text)
Parameters
tokenKind TokenKind
The type of token
text string?
The associated textual representation

Properties

NameDescription
ChildrenCountGets the number of children.
TextGets or sets the associated text
TokenKindGets or sets the kind of token.

ChildrenCount

SyntaxToken.cs

Gets the number of children.

public override int ChildrenCount { get; }

Property value

int

Gets or sets the associated text

public string? Text { get; set; }

Property value

string?

Gets or sets the kind of token.

public TokenKind TokenKind { get; set; }

Property value

TokenKind

Methods

NameDescription
Accept(SyntaxVisitor)Allow to visit this instance with the specified visitor.
GetChildImpl(int)Gets a child at the specified index.
ToDebuggerDisplay()Returns a debugger-friendly display string for this node.

Accept(SyntaxVisitor)

SyntaxToken.cs

Allow to visit this instance with the specified visitor.

public override void Accept(SyntaxVisitor visitor)

Parameters

visitor SyntaxVisitor
The visitor

GetChildImpl(int)

SyntaxToken.cs

Gets a child at the specified index.

protected override SyntaxNode? GetChildImpl(int index)

Parameters

index int
Index of the child

Returns

SyntaxNode? A child at the specified index

Remarks

The index is safe to use

ToDebuggerDisplay()

SyntaxToken.cs

Returns a debugger-friendly display string for this node.

protected override string ToDebuggerDisplay()

Returns

string A display string used by the debugger.