BasicLexemes

A collection of commonly used Lexeme implementations.

BasicLexemes provides predefined lexeme classes for matching common patterns such as individual characters, character ranges, strings, regular expressions, and whitespace.

All Lexemes in this object produce Token.Generic tokens unless otherwise specified.

Types

Link copied to clipboard

A Lexeme that matches 1 character, indiscriminately.

Link copied to clipboard
open class Char(val c: Char, name: String? = null) : AbstractLexeme<Token.Generic>

A Lexeme that matches a single specific character c. Matches produced by this Lexeme always have a length of 1.

Link copied to clipboard
open class CharChoice(chars: Char, name: String? = null) : AbstractLexeme<Token.Generic>

A Lexeme that matches any one of several specified chars. Matches produced by this Lexeme always have a length of 1.

Link copied to clipboard
open class CharPredicate(val predicate: (Char) -> Boolean, name: String? = null) : AbstractLexeme<Token.Generic>

A Lexeme that matches a single character satisfying a predicate. Matches produced by this Lexeme always have a length of 1.

Link copied to clipboard
open class CharRange(val range: CharRange, name: String? = null) : AbstractLexeme<Token.Generic>

A Lexeme that matches any character within a specified range. Matches produced by this Lexeme always have a length of 1.

Link copied to clipboard
open class CharSequence(val str: CharSequence, name: String? = null) : AbstractLexeme<Token.Generic>

A Lexeme that matches a specific character sequence or String literal str.

Link copied to clipboard
open class CharSequencePredicate(name: String? = null, val predicate: (CharSequence) -> Int) : AbstractLexeme<Token.Generic>

A Lexeme that matches any character sequence satisfying predicate.

Link copied to clipboard
open class Regex(val regex: Regex, name: String? = null) : AbstractLexeme<Token.Generic>

A Lexeme that matches input against a regular expression regex.

Link copied to clipboard

A Lexeme that matches a single kotlin.Char.isWhitespace character.