Token

open class Token<out T>(type: T, section: Section?) : Sectional

Object which represents the output of a lexical analysis and input to parsing.

This class (and its subclasses) are the recommended output of a given Lexer of this library. Furthermore, this class and its subclasses are the only inputs accepted by a given Parser of this library.

This implementation does not hold any data, but subclasses may implement any desired contents.

Author

An Tran, AdrianTodt

See also

Parameters

T

The type of the token.

type

The type of the token.

section

The section of the token.

Constructors

Token
Link copied to clipboard
common
fun <out T> Token(type: T, section: Section? = null)

Creates a token with a given type and (optionally) a section.

Functions

equals
Link copied to clipboard
common
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
common
open override fun hashCode(): Int
span
Link copied to clipboard
common
open fun span(other: Sectional): Section?

Creates a section which spans across this and another section.

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

Returns a string representation of this token.

Properties

section
Link copied to clipboard
common
open override val section: Section? = null

The section of this token.

type
Link copied to clipboard
common
val type: T

The type of this token.

Inheritors

StringToken
Link copied to clipboard