Skip to content

SourceReader.ReadToken Method

Definition

Creates a Token<TKind> of the specified kind and length starting at the current position, advancing the reader over it. Stops at the end of the file if it is reached first, shortening the token accordingly.

public Token<TKind> ReadToken<TKind>(TKind kind, int length)
   where TKind : struct, Enum;

View source

Type Parameters

Name Description
TKind The type of the enum that identifies the different kinds of token.

Parameters

Name Type Description
kind TKind The kind of the token.
length Int32 The length of the token.

Returns

Token<TKind>

A new Token<TKind> instance.