diff --git a/src/Parser/Interface.md b/src/Parser/Interface.md index 4535ee0..f9bc23b 100644 --- a/src/Parser/Interface.md +++ b/src/Parser/Interface.md @@ -185,6 +185,19 @@ parseString' : Parser (List1 Char) -> Parser String parseString' x = parseString $ map forget x ``` +Attempt to parse a specified character + +```idris +export +parseExactChar : Char -> Parser Char +parseExactChar c = do + result <- parseChar (== c) id + case result of + GotChar char => pure char + GotError err => throwParseError "Got \{show err} Expected \{show c}" + EndOfInput => throwParseError "End of input" +``` + ### Composition of boolean functions ```idris