diff --git a/src/Parser/Interface.md b/src/Parser/Interface.md index f9bc23b..fe13c13 100644 --- a/src/Parser/Interface.md +++ b/src/Parser/Interface.md @@ -198,6 +198,19 @@ parseExactChar c = do EndOfInput => throwParseError "End of input" ``` +Attempt to parse one of a list of chars + +```idris +export +parseTheseChars : List Char -> Parser Char +parseTheseChars cs = do + result <- parseChar (\x => any (== x) cs) id + case result of + GotChar char => pure char + GotError err => throwParseError "Got \{show err} Expected one of \{show cs}" + EndOfInput => throwParseError "End of input" +``` + ### Composition of boolean functions ```idris