License | BSD-3-Clause |
---|---|
Maintainer | Jamie Willis |
Stability | stable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This module contains combinators that deal with input consumption..
Since: 2.0.0.0
Synopsis
- satisfy :: ParserOps rep => rep (Char -> Bool) -> Parser Char
- char :: Char -> Parser Char
- item :: Parser Char
- string :: String -> Parser String
- token :: String -> Parser String
- oneOf :: [Char] -> Parser Char
- noneOf :: [Char] -> Parser Char
- digit :: Parser Char
- letter :: Parser Char
- letterOrDigit :: Parser Char
Documentation
:: ParserOps rep | |
=> rep (Char -> Bool) | The predicate that a character must satisfy to be parsed |
-> Parser Char | A parser that matches a single character matching the predicate |
Attempts to read a single character matching the provided predicate. If it succeeds, the character will be returned and consumed, otherwise the parser will fail having consumed no input.
Since: 0.1.0.0
char :: Char -> Parser Char Source #
This combinator will attempt to match a given character. If that character is the next input token, the parser succeeds and the character is returned. Otherwise, the combinator will fail having not consumed any input.
Since: 2.0.0.0
Reads any single character. This combinator will only fail if there is no more input remaining. The parsed character is returned.
Since: 2.0.0.0
string :: String -> Parser String Source #
This combinator will attempt match a given string. If the parser fails midway through, this combinator will fail having consumed input. On success, the string itself is returned and input will be consumed.
Since: 2.0.0.0
token :: String -> Parser String Source #
Like string
, excepts parses the given string atomically using try
. Never consumes input on
failure.
Since: 2.0.0.0
oneOf :: [Char] -> Parser Char Source #
This combinator will attempt to match any one of the provided list of characters. If one of those characters is found, it will be returned and the input consumed. If not, the combinator will fail having consumed no input.
Since: 2.0.0.0
noneOf :: [Char] -> Parser Char Source #
This combinator will attempt to not match any one of the provided list of characters. If one of those characters is found, the combinator will fail having consumed no input. If not, it will return the character that was not an element of the provided list.
Since: 2.0.0.0
letter :: Parser Char Source #
Uses isAlpha
to parse a letter, this includes
unicode letters.
Since: 2.0.0.0
letterOrDigit :: Parser Char Source #
Uses isAlphaNum
to parse a letter, this includes
unicode letters, or a digit.
Since: 2.0.0.0