Token

data class Token(val string: String, val startsAt: Int, val endsAt: Int, val tokenType: TokenType)

A Token is a data class representing a token found through the tokenization process of a Lexer and the matching process of a TokenMatcher. It has information on where the token begins, where it ends, its type, and what it actually represents.

Constructors

Link copied to clipboard
constructor(string: String, startsAt: Int, endsAt: Int, tokenType: TokenType)

Properties

Link copied to clipboard
val endsAt: Int

The index after string ends in the original string (i.e. exclusive).

Link copied to clipboard

The index where string starts in the original string.

Link copied to clipboard

The string this token represents. This is exactly what was match and, as such, is a substring of the original lexed string

Link copied to clipboard

The token type this token corresponds to