-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Arrow parser combinators similar to Parsec -- -- PArrows is an arrows based parsing combinator library written in -- Haskell. The library is similar to Parsec, but arrows allow for more -- future optimizations. -- -- Currently PArrows is only tested with GHC, although making it work -- with Hugs should be easy. @package PArrows @version 0.1.1 module Text.ParserCombinators.PArrow.MD data MD i o MNot :: MD i o -> MD i o MChoice :: [MD i o] -> MD i o MEqual :: Char -> MD i Char MSeq :: MD i t -> MD t o -> MD i o MStar :: MD i o -> MD i [o] MEmpty :: MD i o MPure :: String -> (i -> o) -> MD i o MCSet :: CharSet -> MD i Char MParWire :: MD i1 o1 -> MD i2 o2 -> MD (i1, i2) (o1, o2) MJoin :: MD i o1 -> MD i o2 -> MD i (o1, o2) instance Show (MD i o) instance ArrowPlus MD instance ArrowZero MD instance Arrow MD instance Category MD instance Eq (MD i o) module Text.ParserCombinators.PArrow.Prim -- | Run a parser producing either a list of error messages or output. runParser :: MD i o -> String -> Either [String] o module Text.ParserCombinators.PArrow.ToJavaScript -- | JSCompiler encapsulates the state of the JavaScript compiler. data JSCompiler -- | JSFun encapsulates a reference to a JavaScript function. data JSFun -- | Create a new JavaScript compiler using the suplied string as prefix. -- Returns the compiler and a function for showing function references. newJSCompiler :: String -> IO (JSCompiler, JSFun -> String) -- | Compile a parser into JavaScript. Returns a reference to the top-level -- Parsing function. The generated javascript function expects a String -- and a starting index for parsing. The result will be either the index -- of the rightmost character matched or -1 if the parser failed. compileJS :: JSCompiler -> MD i o -> IO JSFun -- | Dump all bodies of generated JavaScript functions. dumpBodies :: JSCompiler -> IO [(JSFun, String)] module Text.ParserCombinators.PArrow.Combinator -- | Match the empty string. empty :: MD i o -- | Match zero or more occurences of the given parser. many :: MD i o -> MD i [o] -- | Match one or more occurences of the given parser. many1 :: MD i o -> MD i [o] -- | Match if the given parser does not match. notFollowedBy :: MD i o -> MD i o -- | Match one or more occurences of the given parser separated by the -- sepator. sepBy1 :: MD i o -> MD i o' -> MD i [o] -- | Match the given parser n times. count :: Int -> MD i o -> MD i [o] -- | Match the first, middle and last argument, returning the value from -- the middle one. between :: MD i t -> MD t close -> MD t o -> MD i o -- | Match optionally. optional :: MD i o -> MD i (Maybe o) -- | Sequence two parsers and return the result of the first one. (>>!) :: Arrow a => a b c -> a b c' -> a b c module Text.ParserCombinators.PArrow.Char -- | Match a single given character and return it. char :: Char -> MD i Char -- | Match a character. anyChar :: MD i Char -- | Match any character in the given list. anyOf :: [Char] -> MD i Char -- | Match a digit (0..9) digit :: MD i Char -- | Match a letter. letter :: MD i Char -- | Match a letter or a digit. alnum :: MD i Char -- | Match a word character - (alnum or '_') wordChar :: MD i Char -- | Match a word consisting of wordChars. word :: MD i String -- | Match a sequence of whitespace. spaces :: MD i String -- | Match a single whitespace character. white :: MD i Char -- | Match a constant string. string :: String -> MD i String module Text.ParserCombinators.PArrow