core: parseTheseChars
This commit is contained in:
parent
7dba492535
commit
38c69c0ae3
1 changed files with 13 additions and 0 deletions
|
@ -198,6 +198,19 @@ parseExactChar c = do
|
||||||
EndOfInput => throwParseError "End of input"
|
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
|
### Composition of boolean functions
|
||||||
|
|
||||||
```idris
|
```idris
|
||||||
|
|
Loading…
Add table
Reference in a new issue