parsley-2.0.0.1: A fast parser combinator library backed by Typed Template Haskell
LicenseBSD-3-Clause
MaintainerJamie Willis
Stabilitystable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Parsley.Char

Description

This module contains combinators that deal with input consumption..

Since: 2.0.0.0

Synopsis

Documentation

satisfy Source #

Arguments

:: 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

item :: Parser Char Source #

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

digit :: Parser Char Source #

Reads a digit (0 through 9).

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