Package com.github.adriantodt.tartar.extensions

Types

LexicalNumber
Link copied to clipboard
common
sealed class LexicalNumber

Result of readNumber.

Functions

eatMulti
Link copied to clipboard
common
fun <T> ParserContext<T, *>.eatMulti(vararg types: T): List<Token<T>>

Eats tokens in a row. Returns a list, which can be used with a destructuring declaration.

ensureEOF
Link copied to clipboard
common
fun <R> ParserContext<*, *>.ensureEOF(block: () -> R): R

Ensures there's no character files after this block of code.

makeToken
Link copied to clipboard
common
fun <T> LexerContext<Token<T>>.makeToken(type: T, offset: Int = 1): Token<T>
fun <T> LexerContext<Token<T>>.makeToken(type: T, string: String, offset: Int = 0): Token<T>

Creates a token.

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(offset: Int, length: Int = 0): Section

Creates a section.