Skip to content

TokenReader<TKind>.TryConsume Method

Overloads

Name Description
TryConsume(TKind, Token<TKind>) If the token at the current position is of the specified kind then it is returned and the reader advanced, otherwise the stream does not move.
TryConsume(TKind) If the token at the current position is of the specified kind then the reader advances, otherwise the reader does not move.

TryConsume(TKind, Token<TKind>)

If the token at the current position is of the specified kind then it is returned and the reader advanced, otherwise the stream does not move.

public bool TryConsume(TKind kind, out Token<TKind> token);

View source

Parameters

Name Type Description
kind TKind The kind of token to consume.
token Token<TKind> The consumed token if it was of the specified kind, the default token value otherwise.

Returns

Boolean

true if a token was consumed, false otherwise.

TryConsume(TKind)

If the token at the current position is of the specified kind then the reader advances, otherwise the reader does not move.

public bool TryConsume(TKind kind);

View source

Parameters

Name Type Description
kind TKind The kind of token to consume.

Returns

Boolean

true if a token was consumed, false otherwise.