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: ClosureFunction<LexerContext<T>, Char, Unit>)
Configures the lexer to execute a specific block of code when match.
invoke
Link copied to clipboard
common
open operator fun Char.invoke(block: ClosureFunction<LexerContext<T>, Char, Unit> = {})
Configures the lexer to execute a specific block of code when this character matches.
open operator fun String.invoke(block: ClosureFunction<LexerContext<T>, Char, Unit> = {})
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(char: Char): LexerDSL<T>
Returns a matcher for a character.
abstract fun matching(block: CharPredicate): LexerDSL<T>
Returns a matcher for a predicate.
abstract fun matching(string: String): LexerDSL<T>
Returns a matcher for a sequence of characters.
open fun matching(char: Char, block: Closure<LexerDSL<T>, Unit>)
Returns a matcher for a characters and configures it.
open fun matching(string: String, block: Closure<LexerDSL<T>, Unit>)
Returns a matcher for a sequence of characters and configures it.

Inheritors

MatcherImpl
Link copied to clipboard