token

open fun token(id: Int): Token

Returns the token with absolute id, forcing lexing forward if necessary.

A lazy source reports a released id (already discarded under it.unibo.tuprolog.parser.TokenRetention.RELEASE_COMMITTED) as IllegalArgumentException and an id beyond EOF as IndexOutOfBoundsException; a materialized source reports every id outside its retained range as IndexOutOfBoundsException.

Throws

if id lies beyond EOF, or outside a materialized source's retained range

if id was already released by a lazy source