boomerang-1.3.4: Library for invertible parsing and printing

Safe HaskellNone




a Boomerang library for working with a String



type StringPrinterParser = StringBoomerangSource

Deprecated: Use StringBoomerang instead


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 rSource

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

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 rSource

run the parser

Returns the first complete parse or a parse error.

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

unparseString :: StringBoomerang () (r :- ()) -> r -> Maybe StringSource

run the printer

 unparseString (rUnit . lit "foo") ()