uu-parsinglib-2.4.4: Online, error-correcting parser combinators; monadic and applicative interfaces

Text.ParserCombinators.UU.Derived

Synopsis

Documentation

opt :: P st a -> a -> P st aSource

This module contains a large variety of combinators for list-lile structures. the extension _ng indiactes that that varinat is the non-greedy variant. See the Text.ParserCombinators.UU.Examples module for some exmaples of their use.

Optionally recognize parser p.

If p can be recognized, the return value of p is used. Otherwise, the value v is used. Note that opt is greedy, if you do not want this use ... | pure v instead. Furthermore, p should not recognise the empty string, since this would make your parser ambiguous!!

pMaybe :: P st a -> P st (Maybe a)Source

(<$$>) :: (a -> b -> c) -> P st b -> P st (a -> c)Source

(<??>) :: P st a -> P st (a -> a) -> P st aSource

pPacked :: P st b1 -> P st b2 -> P st a -> P st aSource

This can be used to parse x surrounded by l and r.

Example:

 pParens = pPacked pOParen pCParen

pFoldr :: (a -> a1 -> a1, a1) -> P st a -> P st a1Source

pFoldr_ng :: (a -> a1 -> a1, a1) -> P st a -> P st a1Source

pFoldr1 :: (v -> b -> b, b) -> P st v -> P st bSource

pFoldr1_ng :: (v -> b -> b, b) -> P st v -> P st bSource

pFoldrSep :: (v -> b -> b, b) -> P st a -> P st v -> P st bSource

pFoldrSep_ng :: (v -> b -> b, b) -> P st a -> P st v -> P st bSource

pFoldr1Sep :: (a -> b -> b, b) -> P st a1 -> P st a -> P st bSource

pFoldr1Sep_ng :: (a -> b -> b, b) -> P st a1 -> P st a -> P st bSource

list_alg :: (a -> [a] -> [a], [a1])Source

pList :: P st a -> P st [a]Source

pList_ng :: P st a -> P st [a]Source

pList1 :: P st a -> P st [a]Source

pList1_ng :: P st a -> P st [a]Source

pListSep :: P st a1 -> P st a -> P st [a]Source

pListSep_ng :: P st a1 -> P st a -> P st [a]Source

pList1Sep :: P st a1 -> P st a -> P st [a]Source

pList1Sep_ng :: P st a1 -> P st a -> P st [a]Source

pChainr :: P st (c -> c -> c) -> P st c -> P st cSource

pChainr_ng :: P st (c -> c -> c) -> P st c -> P st cSource

pChainl :: P st (c -> c -> c) -> P st c -> P st cSource

pChainl_ng :: P st (c -> c -> c) -> P st c -> P st cSource

pAny :: (a -> P st a1) -> [a] -> P st a1Source

Build a parser for each elemnt in its argument list and tries them all.

pAnySym :: Provides st s s => [s] -> P st sSource

Parses any of the symbols in l.