Hets - the Heterogeneous Tool Set

Copyright(c) Christian Maeder DFKI GmbH 2010
LicenseGPLv2 or higher, see LICENSE.txt
MaintainerChristian.Maeder@dfki.de
Stabilityprovisional
Portabilityportable
Safe HaskellSafe

Common.Parsec

Contents

Description

frequently useful shortcuts mainly for character parsers

Synopsis

monad shortcuts

(<<) :: Monad m => m a -> m b -> m a infixl 1 Source #

forget :: Monad m => m a -> m () Source #

pair :: Monad m => m a -> m b -> m (a, b) Source #

(<:>) :: Monad m => m a -> m [a] -> m [a] infixr 5 Source #

(<++>) :: Monad m => m [a] -> m [a] -> m [a] infixr 5 Source #

(>->) :: Monad m => m a -> (a -> b) -> m b infixl 4 Source #

single :: Monad m => m a -> m [a] Source #

flat :: Monad m => m [[a]] -> m [a] Source #

enclosedBy :: Monad m => m [a] -> m a -> m [a] Source #

parsec shortcuts

optionL :: GenParser tok st [a] -> GenParser tok st [a] Source #

parse an optional list

tryString :: String -> CharParser st String Source #

shortcut for try . string

nestedComment :: String -> String -> CharParser st String Source #

nested comments, open and closing strings must have at least one char

quotedLit :: Char -> CharParser st String Source #

a literal enclosed in quotes and a backslash as escape character

stringLit :: CharParser st String Source #

text in double quotes

sQuoted :: CharParser st String Source #

text in single quotes

plainBlock :: String -> String -> CharParser st String Source #

non-nested block

reserved :: [String] -> CharParser st String -> CharParser st String Source #

reject keywords

sneakAhead :: CharParser st a -> CharParser st (Either ParseError a) Source #

Similar to lookAhead, but runs the parser in an isolated sandbox. The function is monadic but in a read-only manner. Useful if lookAhead taints error messages.