Package com.github.adriantodt.tartar.extensions.lexer

Types

LexicalNumber
Link copied to clipboard
common
sealed class LexicalNumber

Class which encapsulates the result of the function readNumber.

Functions

processToken
Link copied to clipboard
common
fun <T> LexerContext<in Token<T>>.processToken(type: T, back: Int = 1, length: Int = back, offset: Int = 0)

Emits a token to the lexer, based off the current state of the LexerContext.

fun <T> LexerContext<in StringToken<T>>.processToken(type: T, value: String, back: Int = value.length, length: Int = back, offset: Int = 0)

Emits a token with a value, based off the current state of the LexerContext.

readIdentifier
Link copied to clipboard
common
fun LexerContext<*>.readIdentifier(firstChar: Char? = null): String

Reads a C-like identifier.

readNumber
Link copied to clipboard
common
fun LexerContext<*>.readNumber(c: Char): LexicalNumber

Reads a number.

readString
Link copied to clipboard
common
fun LexerContext<*>.readString(delimiter: Char): String

Reads a String up until a delimiter.

section
Link copied to clipboard
common
fun LexerContext<*>.section(back: Int = 1, length: Int = back, offset: Int = 0): Section

Creates a section, based off the current state of the LexerContext.

token
Link copied to clipboard
common
fun <T> LexerContext<in Token<T>>.token(type: T, back: Int = 1, length: Int = back, offset: Int = 0): Token<T>

Creates a token, based off the current state of the LexerContext.

fun <T> LexerContext<in StringToken<T>>.token(type: T, value: String, back: Int = value.length, length: Int = back, offset: Int = 0): StringToken<T>

Creates a token with a value, based off the current state of the LexerContext.