| Copyright | (c) Artem Mavrin 2021 |
|---|---|
| License | BSD3 |
| Maintainer | artemvmavrin@gmail.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | Safe |
| Language | Haskell2010 |
AutoProof.Internal.Utils.Parser.Char
Description
Defines character- and string-related parsers.
Documentation
charIf :: (Char -> Bool) -> Parser Char Source #
Parse a single character if it satisfies a predicate
Examples
>>>runParser (charIf isDigit) "123"Just ("23",'1')
>>>runParser (charIf isDigit) "abc"Nothing
char :: Char -> Parser Char Source #
Parse a specific character.
Examples
>>>runParser (char 'a') "abc"Just ("bc",'a')
>>>runParser (char 'a') "def"Nothing
anyChar :: Parser Char Source #
Parse any character.
Examples
>>>runParser anyChar "abc"Just ("bc",'a')
>>>runParser anyChar ""Nothing
spaces :: Parser String Source #
Parse zero or more spaces.
Examples
>>>runParser spaces " 123"Just ("123"," ")
>>>runParser spaces "123"Just ("123","")
>>>runParser spaces ""Just ("","")