Regex

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

A Lexeme that matches input against a regular expression regex.

The regex is matched at the current position using Regex.matchAt. Only matches starting exactly at the current position are accepted.

Constructors

Link copied to clipboard
constructor(regex: Regex, name: String? = null)

Properties

Link copied to clipboard
open override val defaultFactory: (CharSequence) -> Token.Generic

A default Token factory that creates new instances of T for matches of this Lexeme, given the CharSequence which captures the Token (equal to Token.value).

Link copied to clipboard
open override val name: String?

An optional name for this Lexeme

Link copied to clipboard

The regular expression to match

Functions

Link copied to clipboard
override fun match(): LexemeMatch<Token.Generic>?
Link copied to clipboard
open override fun toString(): String