ContextImpl

inner class ContextImpl(source: Source, output: (T) -> Unit) : LexerContext<T>

Types

CollectingContext
Link copied to clipboard
common
inner class CollectingContext(collection: MutableCollection<T>) : LexerContext<T>

Functions

hasNext
Link copied to clipboard
common
open override fun hasNext(): Boolean
Checks if there's more characters ahead.
match
Link copied to clipboard
common
open override fun match(expect: Char): Boolean
Peeks the next character and, if equals the expected character, consumes it.
next
Link copied to clipboard
common
open override fun next(): Char
Returns the next character of the reader.
nextString
Link copied to clipboard
common
open override fun nextString(length: Int): String
Returns a predefined length of characters of the reader, as a String.
parseOnce
Link copied to clipboard
common
open override fun parseOnce(): List<T>
Lexes once and return the processed tokens.
peek
Link copied to clipboard
common
open override fun peek(): Char
Peeks the next character of the reader.
open override fun peek(distance: Int): Char
Peeks a character a distance far away of the reader.
peekString
Link copied to clipboard
common
open override fun peekString(length: Int): String
Peeks a string with a predefined length of the reader.
process
Link copied to clipboard
common
open override fun process(token: T)
Calls the Lexer.parse's token consumer.
use
Link copied to clipboard
common
fun <R> use(block: (LexerImpl.ContextImpl<T>) -> R): R

Properties

curr
Link copied to clipboard
common
var curr: Char
index
Link copied to clipboard
common
open override var index: Int = 0
The current index.
read
Link copied to clipboard
common
var read: Int = 0
reader
Link copied to clipboard
common
open override val reader: StringReader
This context' reader.
source
Link copied to clipboard
common
open override val source: Source
The original source of this context.