uulib-0.9.24: Haskell Utrecht Tools Library

Safe HaskellNone
LanguageHaskell98

UU.Parsing.Derived

Contents

Synopsis

Checking

acceptsepsilon :: IsParser p s => p v -> Bool Source #

Checks if the parser accepts epsilon.

mnz :: IsParser p s => p v -> t -> String -> t Source #

Prelude defs

(<..>) :: IsParser p s => s -> s -> p s infixl 5 Source #

Parses the specified range, see also pRange.

Example:

pDig = 'a' <..> 'z'

pExcept :: (IsParser p s, Symbol s, Ord s, Eq (SymbolR s)) => (s, s, s) -> [s] -> p s Source #

opt :: IsParser p s => p a -> a -> p a infixl 2 Source #

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 ... | pSucceed v instead. Furthermore, p should not recognise the empty string.

Sequential compositions

asList :: IsParser p s => Expecting s -> p v -> p v Source #

asList1 :: IsParser p s => Expecting s -> p v -> p v Source #

asOpt :: IsParser p s => Expecting s -> p v -> p v Source #

(<+>) :: IsParser p s => p a -> p b -> p (a, b) infixl 4 Source #

Parses the sequence of pa and pb, and combines them as a tuple.

(<**>) :: Applicative f => f a -> f (a -> b) -> f b infixl 4 #

A variant of <*> with the arguments reversed.

(<$$>) :: IsParser p s => (a -> b -> c) -> p b -> p (a -> c) Source #

(<??>) :: IsParser p s => p a -> p (a -> a) -> p a infixl 4 Source #

(<?>) :: IsParser p s => p v -> String -> p v infixl 2 Source #

pPacked :: IsParser p s => p a -> p b1 -> p b -> p b Source #

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

Example:

pParens = pPacked pOParen pCParen

Iterating parsers

pFoldr_ng :: IsParser p s => (a -> a1 -> a1, a1) -> p a -> p a1 Source #

pFoldr_gr :: IsParser p s => (a -> b -> b, b) -> p a -> p b Source #

pFoldr :: IsParser p s => (a -> b -> b, b) -> p a -> p b Source #

pFoldr1_ng :: IsParser p s => (v -> b -> b, b) -> p v -> p b Source #

pFoldr1_gr :: IsParser p s => (v -> b -> b, b) -> p v -> p b Source #

pFoldr1 :: IsParser p s => (v -> b -> b, b) -> p v -> p b Source #

pFoldrSep_ng :: IsParser p s => (v -> b -> b, b) -> p a -> p v -> p b Source #

pFoldrSep_gr :: IsParser p s => (v -> b -> b, b) -> p a -> p v -> p b Source #

pFoldrSep :: IsParser p s => (v -> b -> b, b) -> p a -> p v -> p b Source #

pFoldr1Sep_ng :: IsParser p s => (a -> b -> b, b) -> p a1 -> p a -> p b Source #

pFoldr1Sep_gr :: IsParser p s => (a -> b -> b, b) -> p a1 -> p a -> p b Source #

pFoldr1Sep :: IsParser p s => (a -> b -> b, b) -> p a1 -> p a -> p b Source #

pList_ng :: IsParser p s => p a -> p [a] Source #

pList_gr :: IsParser p s => p a -> p [a] Source #

pList :: IsParser p s => p a -> p [a] Source #

pList1_ng :: IsParser p s => p a -> p [a] Source #

pList1_gr :: IsParser p s => p a -> p [a] Source #

pList1 :: IsParser p s => p a -> p [a] Source #

pListSep_ng :: IsParser p s => p a1 -> p a -> p [a] Source #

pListSep_gr :: IsParser p s => p a1 -> p a -> p [a] Source #

pListSep :: IsParser p s => p a -> p a1 -> p [a1] Source #

pList1Sep_ng :: IsParser p s => p a1 -> p a -> p [a] Source #

pList1Sep_gr :: IsParser p s => p a1 -> p a -> p [a] Source #

pList1Sep :: IsParser p s => p a -> p a1 -> p [a1] Source #

pChainr_ng :: IsParser p s => p (a -> a -> a) -> p a -> p a Source #

pChainr_gr :: IsParser p s => p (c -> c -> c) -> p c -> p c Source #

pChainr :: IsParser p s => p (c -> c -> c) -> p c -> p c Source #

pChainl_ng :: IsParser p s => p (c -> c -> c) -> p c -> p c Source #

pChainl_gr :: IsParser p s => p (c -> c -> c) -> p c -> p c Source #

pChainl :: IsParser p s => p (c -> c -> c) -> p c -> p c Source #

Misc

pAny :: IsParser p s => (a -> p a1) -> [a] -> p a1 Source #

Parses using any of the parsers in the list l.

Warning: l may not be an empty list.

pAnySym :: IsParser p s => [s] -> p s Source #

Parses any of the symbols in l.

pToks :: IsParser p s => [s] -> p [s] Source #

pLocate :: IsParser p s => [[s]] -> p [s] Source #