pAny
Returns a Parser that consumes and returns any single token, failing only when the input is exhausted.
pAny is the unconditional token consumer — it never rejects a token on its own, only failing at end of input. Use it as a wildcard in situations where you need to skip or collect tokens regardless of their value.
Behaviour
| Condition | Result |
|---|---|
| Input is exhausted | Failure — "Unexpected end of input" |
| Token available | Success with that token; index advances by 1 |
Type parameters
Example
val input = ParserInput.of("ab".toList(), Unit)
val result = pAny<Char, Unit>()(input) // Success('a', nextIndex=1, ...)Content copied to clipboard
Return
a Parser that succeeds with the next token or fails at end of input.