TokenRegexPattern

constructor(name: String, wrap: (TokenData) -> Token, regex: Regex, groupNames: List<String> = emptyList(), walker: (CharSequence) -> WalkerParser<*>? = null)

Parameters

name

name of this pattern. A name should not contain special characters (including underscores) in order to prevent Regex compilation errors

wrap

a function that wraps a general token into its specific wrapper

regex

regex pattern to match

groupNames

names of the named groups that appear the regex pattern

walker

if present, upon being captured, produces a WalkerParser that scans the given CharSequence source in case regex does not suffice to capture complex tokens