core: parseExactChar
This commit is contained in:
parent
40dd87a4f3
commit
7dba492535
1 changed files with 13 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue