Token

data class Token(val id: Int, val kind: TokenKind, val channel: TokenChannel, val span: SourceSpan, val payload: TokenPayload? = null) : Representable

A lossless lexical token.

Raw spelling is obtained from span through the owning it.unibo.tuprolog.parser.sources.LexedSource. toRepresentation instead returns normalized content and is not a substitute for source extraction.

Constructors

Link copied to clipboard
constructor(id: Int, kind: TokenKind, channel: TokenChannel, span: SourceSpan, payload: TokenPayload? = null)

Properties

Link copied to clipboard

whether this token participates in grammar parsing

Link copied to clipboard
val id: Int

absolute, monotonically increasing token identifier

Link copied to clipboard

operator-independent lexical category

Link copied to clipboard

decoded or variable token data, when applicable

Link copied to clipboard

end-exclusive range in the complete source

Functions

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

Returns the token's fixed spelling or normalized payload representation.