TokenBasedTokenInputStream

open class TokenBasedTokenInputStream<TT : TokenType, T : Token<TT>>(val tokens: Array<T>, val map: PositionMap) : TokenInputStream<TT, T> (source)

A TokenBasedTokenInputStream provides the Tokens for a Parser. It is created by a lexer

Parameters

TT

the TokenType of the Tokens

T

the Tokens

map

the PositionMap of the Tokens

  • @since 0.1.0

Constructors

Link copied to clipboard
constructor(tokens: Array<T>, map: PositionMap)

Properties

Link copied to clipboard
open override val actual: T

Get the actual Token from the TokenBasedTokenInputStream without increasing the position

Link copied to clipboard
open val actualEnd: Int

Returns the end of the actual token

Link copied to clipboard

Checks if the actual token without changing the actual token

Link copied to clipboard
open val actualStart: Int

Returns the start of the actual token

Link copied to clipboard
open val actualType: TT

Returns the type of the actual token

Link copied to clipboard
open val actualValue: String?

Returns the value of the actual

Link copied to clipboard
open override val map: PositionMap

The PositionMap of the Tokens

Link copied to clipboard
open override var position: Int

The position of the TokenBasedTokenInputStream

Link copied to clipboard
open override val size: Int
Link copied to clipboard
open override val source: String

The source of the TokenBasedTokenInputStream

Link copied to clipboard
open val tokens: Array<T>

The tokenTypes that are contained in the TokenBasedTokenInputStream

Functions

Link copied to clipboard
open operator fun get(position: Int): T

Get a specific token from the TokenBasedTokenInputStream

Link copied to clipboard
open fun getEnd(position: Int): Int

Get the end of specific token from the TokenBasedTokenInputStream by it's position

Link copied to clipboard
open fun getHasValue(position: Int): Boolean

Check if specific token from the TokenBasedTokenInputStream has a value (by it's position)

Link copied to clipboard
open fun getStart(position: Int): Int

Get the start of specific token from the TokenBasedTokenInputStream by its position

Link copied to clipboard
open fun getType(position: Int): TT

Get the type of specific token from the TokenBasedTokenInputStream by its position

Link copied to clipboard
open fun getValue(position: Int): String?

Get the value of specific token from the TokenBasedTokenInputStream by it's position

Link copied to clipboard
open override fun has(num: Int): Boolean

Check if the TokenBasedTokenInputStream has a specific amount of Tokens left

Link copied to clipboard
open operator override fun hasNext(): Boolean

Check if the TokenBasedTokenInputStream has a next Token

Link copied to clipboard
open operator override fun next(): T

Get the next Token from the TokenBasedTokenInputStream

Link copied to clipboard
open fun nextType(): TT

Returns the type of the next token of the TokenInputStream (and skips)

Link copied to clipboard
open fun nextValue(): String?

Returns the next token of the TokenInputStream

Link copied to clipboard
open override fun peek(): T

Get the next Token from the TokenBasedTokenInputStream without increasing the position

open override fun peek(offset: Int): T

Get a specific Token from the TokenBasedTokenInputStream without increasing the position

Link copied to clipboard
open fun peekEnd(): Int

Returns the end of the next token without changing the actual token

open fun peekEnd(offset: Int): Int

Peek the token end at the given index

Link copied to clipboard
open fun peekHasValue(): Boolean

Checks if the next token of the TokenInputStream has a value without skipping

open fun peekHasValue(offset: Int): Boolean

Checks if the token at the given offset of the TokenInputStream has a value without changing the actual token

Link copied to clipboard
open fun peekStart(): Int

Returns the start of the next token without changing the actual token

open fun peekStart(offset: Int): Int

Peek the token start at the given index

Link copied to clipboard
open fun peekType(): TT

Returns the type of the next token without changing the actual token

open fun peekType(offset: Int): TT

Peek the token type at the given index

Link copied to clipboard
open fun peekValue(): String?

Returns the value of the next token without changing the actual token

open fun peekValue(offset: Int): String?

Peek the token value at the given index

Link copied to clipboard
fun reset()

Reset the TokenBasedTokenInputStream to the start

Link copied to clipboard
open override fun skip()

Skip the next Token from the TokenBasedTokenInputStream

open override fun skip(amount: Int)

Skip a specific amount of Tokens from the TokenBasedTokenInputStream

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