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.
ensureEOF
Link copied to clipboard
common
fun <R> ParserContext<*, *>.ensureEOF(block: () -> R): R
Ensures there's no character files after this block of code.
isDigit
Link copied to clipboard
common
fun Char.isDigit(): Boolean
Returns true if the character is an ASCII digit.
isLetter
Link copied to clipboard
common
fun Char.isLetter(): Boolean
Returns true if the character is an ASCII letter.
isLetterOrDigit
Link copied to clipboard
common
fun Char.isLetterOrDigit(): Boolean
Returns true if the character is an ASCII letter or digit.
makeToken
Link copied to clipboard
common
fun <T> LexerContext<Token<T>>.makeToken(tokenType: T, offset: Int = 1): Token<T>
Creates a token.
fun <T> LexerContext<Token<T>>.makeToken(tokenType: 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.