LexerDSL

interface LexerDSL<T>

A builder of Lexers, as a domain-specific language (DSL).

Author

AdrianTodt

Parameters

T

The type of tokens the lexer generates.

Functions

configure
Link copied to clipboard
common
abstract fun configure(block: MatchFunction<T>)

Configures the lexer to execute a specific block of code when match.

invoke
Link copied to clipboard
common
open operator fun Char.invoke(block: MatchFunction<T> = {})

Configures the lexer to execute a specific block of code when this character matches.

open operator fun String.invoke(block: MatchFunction<T> = {})

Configures the lexer to execute a specific block of code when this sequence of characters matches.

matching
Link copied to clipboard
common
abstract fun matching(block: CharPredicate): LexerDSL<T>

Returns a matcher for a predicate.

abstract fun matching(char: Char): LexerDSL<T>

Returns a matcher for a character.

abstract fun matching(string: String): LexerDSL<T>

Returns a matcher for a sequence of characters.

open fun matching(char: Char, block: LexerConfig<T>)

Returns a matcher for a characters and configures it.

open fun matching(string: String, block: LexerConfig<T>)

Returns a matcher for a sequence of characters and configures it.