pChar
Returns a Parser that consumes exactly one Char equal to character, and fails if the next character is different or the input is exhausted.
This is a thin wrapper around pSatisfy with a strict equality predicate.
Type parameters
Example
val openBrace: Parser<Char, Char, Unit> = pChar('{')
val input = ParserInput.of("{...}".toList(), Unit)
when (val result = openBrace(input)) {
is Success -> println("Matched: ${result.value}") // '{'
is Failure -> println(result.message)
}Content copied to clipboard
Return
a Parser that succeeds with character on a match, or fails with a diagnostic message from pSatisfy.
Parameters
character
the exact character to match.