Token

data class Token<T : TokenKind>(val kind: T, val startOffset: Int, val endOffset: Int)(source)

Represents a token in a sequence of text.

A token is a meaningful unit of text, such as a keyword, identifier, or operator. It is characterized by its kind, start offset, and end offset.

Parameters

T

The type of the token kind. Must implement TokenKind.

Constructors

Link copied to clipboard
constructor(kind: T, startOffset: Int, endOffset: Int)

Properties

Link copied to clipboard

The exclusive end offset of the token in the original text.

Link copied to clipboard
val kind: T

The kind of the token.

Link copied to clipboard

The inclusive start offset of the token in the original text.

Functions

Link copied to clipboard
open override fun toString(): String