boomerang-1.4.8: Library for invertible parsing and printing
Safe HaskellNone
LanguageHaskell2010

Text.Boomerang.String

Description

a Boomerang library for working with a String

Synopsis

Types

type StringPrinterParser = StringBoomerang Source #

Deprecated: Use StringBoomerang instead

Combinators

alpha :: StringBoomerang r (Char :- r) Source #

matches alphabetic Unicode characters (lower-case, upper-case and title-case letters, plus letters of caseless scripts and modifiers letters). (Uses isAlpha)

anyChar :: StringBoomerang r (Char :- r) Source #

any character

char :: Char -> StringBoomerang r (Char :- r) Source #

matches the specified character

digit :: StringBoomerang r (Char :- r) Source #

ascii digits '0'..'9'

int :: StringBoomerang r (Int :- r) Source #

matches an Int

lit :: String -> StringBoomerang r r Source #

a constant string

satisfy :: (Char -> Bool) -> StringBoomerang r (Char :- r) Source #

statisfy a Char predicate

space :: StringBoomerang r (Char :- r) Source #

matches white-space characters in the Latin-1 range. (Uses isSpace)

Running the Boomerang

isComplete :: String -> Bool Source #

Predicate to test if we have parsed all the strings. Typically used as argument to parse1

see also: parseStrings

parseString :: StringBoomerang () (r :- ()) -> String -> Either StringError r Source #

run the parser

Returns the first complete parse or a parse error.

parseString (rUnit . lit "foo") ["foo"]

unparseString :: StringBoomerang () (r :- ()) -> r -> Maybe String Source #

run the printer

unparseString (rUnit . lit "foo") ()

Orphan instances