Class ParsedToken<T>

Represents a parsed token with a specific type and associated data. Provides utility methods for checking the token type and converting it to a string.

Type Parameters

  • T extends ParsedTokenType

    The specific ParsedTokenType associated with this token.

Constructors

Properties

data: IParsedTokenData<T> = ...

The data associated with the parsed token, structured based on its type.

token: IToken

The raw token (IToken) associated with this parsed token.

type: T

The type of the token (ParsedTokenType).

Methods

  • Converts the token to a formatted string representation.

    Parameters

    • indent: number = 2

      The indentation level for nested tokens (default is 2 spaces).

    Returns string

    A string representing the token and its associated data.