consumeWhile

fun consumeWhile(predicate: (Char) -> Boolean): String?

Consume characters from the cursor while the predicate returns true, and return those characters joined into a String. If the predicate fails on the first character, null will be returned instead.

Note: Once this function has finished consuming characters, it will instruct the cursor to skip any immediate whitespace, which prepares it for normal token parsing - assuming there's anything left to parse.