You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
762 B
Kotlin
16 lines
762 B
Kotlin
package fr.celticinfo.lox
|
|
|
|
/**
|
|
* The Token class represents a token in the Lox language. A token is a meaningful unit of code,
|
|
* such as a keyword, identifier, operator, or literal value.
|
|
*
|
|
* @property type The type of the token, represented as a TokenType.
|
|
* @property lexeme The raw text of the token as it appears in the source code.
|
|
* @property literal The literal value of the token, if it has one. For example, the literal value of a number token is the numeric value it represents.
|
|
* @property line The line number in the source code where the token appears.
|
|
*/
|
|
data class Token(val type: TokenType, val lexeme: String, val literal: Any?, val line: Int) {
|
|
override fun toString(): String {
|
|
return "$type $lexeme $literal $line"
|
|
}
|
|
} |