Safe Haskell | None |
---|
a Boomerang
library for working with '[String]'
- type StringsError = ParserError MajorMinorPos
- (</>) :: Boomerang StringsError [String] b c -> Boomerang StringsError [String] a b -> Boomerang StringsError [String] a c
- alpha :: Boomerang StringsError [String] r (Char :- r)
- anyChar :: Boomerang StringsError [String] r (Char :- r)
- anyString :: Boomerang StringsError [String] r (String :- r)
- char :: Char -> Boomerang StringsError [String] r (Char :- r)
- digit :: Boomerang StringsError [String] r (Char :- r)
- eos :: Boomerang StringsError [String] r r
- int :: Boomerang StringsError [String] r (Int :- r)
- integer :: Boomerang StringsError [String] r (Integer :- r)
- lit :: String -> Boomerang StringsError [String] r r
- readshow :: (Read a, Show a) => Boomerang StringsError [String] r (a :- r)
- satisfy :: (Char -> Bool) -> Boomerang StringsError [String] r (Char :- r)
- satisfyStr :: (String -> Bool) -> Boomerang StringsError [String] r (String :- r)
- space :: Boomerang StringsError [String] r (Char :- r)
- isComplete :: [String] -> Bool
- parseStrings :: Boomerang StringsError [String] () (r :- ()) -> [String] -> Either StringsError r
- unparseStrings :: Boomerang e [String] () (r :- ()) -> r -> Maybe [String]
Types
Combinators
(</>) :: Boomerang StringsError [String] b c -> Boomerang StringsError [String] a b -> Boomerang StringsError [String] a cSource
equivalent to f . eos . g
alpha :: Boomerang StringsError [String] 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
)
eos :: Boomerang StringsError [String] r rSource
end of string
int :: Boomerang StringsError [String] r (Int :- r)Source
matches an Int
Note that the combinator (rPair . int . int)
is ill-defined because the parse can not tell where it is supposed to split the sequence of digits to produced two ints.
integer :: Boomerang StringsError [String] r (Integer :- r)Source
matches an Integer
Note that the combinator (rPair . integer . integer)
is ill-defined because the parse can not tell where it is supposed to split the sequence of digits to produced two ints.
readshow :: (Read a, Show a) => Boomerang StringsError [String] r (a :- r)Source
lift 'Read'/'Show' to a Boomerang
There are a few restrictions here:
satisfy :: (Char -> Bool) -> Boomerang StringsError [String] r (Char :- r)Source
statisfy a Char
predicate
satisfyStr :: (String -> Bool) -> Boomerang StringsError [String] r (String :- r)Source
space :: Boomerang StringsError [String] 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
parseStrings :: Boomerang StringsError [String] () (r :- ()) -> [String] -> Either StringsError rSource
run the parser
Returns the first complete parse or a parse error.
parseStrings (rUnit . lit "foo") ["foo"]