TokenRegexPattern
constructor(name: String, wrap: (TokenData) -> Token, regex: String, groupNames: List<String> = emptyList(), walker: (TokenData, CharSequence) -> WalkedToken?? = 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, receives the TokenData from the regex match and the remaining source after the match, then produces a WalkedToken containing a fully typed token and the number of additional characters consumed, or null to reject the match (e.g., when a block function call determines it is actually inline-level content). Used when regex alone cannot capture complex tokens (e.g., balanced delimiters in function call arguments)