hledger-lib-1.3: Core data types, parsers and functionality for the hledger accounting tools

Safe Haskell | None
Language | Haskell2010

Hledger.Utils.Parse

Synopsis

- type TextParser m a = ParsecT Dec Text m a
- type JournalStateParser m a = StateT Journal (ParsecT Dec Text m) a
- type JournalParser a = StateT Journal (ParsecT Dec Text Identity) a
- type ErroringJournalParser m a = StateT Journal (ParsecT Dec Text (ExceptT String m)) a
- choice' :: [TextParser m a] -> TextParser m a
- choiceInState :: [StateT s (ParsecT Dec Text m) a] -> StateT s (ParsecT Dec Text m) a
- parsewith :: Parsec e Text a -> Text -> Either (ParseError Char e) a
- parsewithString :: Parsec e String a -> String -> Either (ParseError Char e) a
- parseWithState :: Monad m => st -> StateT st (ParsecT Dec Text m) a -> Text -> m (Either (ParseError Char Dec) a)
- parseWithState' :: (Stream s, ErrorComponent e) => st -> StateT st (ParsecT e s Identity) a -> s -> Either (ParseError (Token s) e) a
- fromparse :: (Show t, Show e) => Either (ParseError t e) a -> a
- parseerror :: (Show t, Show e) => ParseError t e -> a
- showParseError :: (Show t, Show e) => ParseError t e -> String
- showDateParseError :: (Show t, Show e) => ParseError t e -> String
- nonspace :: TextParser m Char
- spacenonewline :: (Stream s, Char ~ Token s) => ParsecT Dec s m Char
- restofline :: TextParser m String
- eolof :: TextParser m ()

# Documentation

type TextParser m a = ParsecT Dec Text m a #

A parser of strict text with generic user state, monad and return type.

type JournalStateParser m a = StateT Journal (ParsecT Dec Text m) a #

type JournalParser a = StateT Journal (ParsecT Dec Text Identity) a #

type ErroringJournalParser m a = StateT Journal (ParsecT Dec Text (ExceptT String m)) a #

A journal parser that runs in IO and can throw an error mid-parse.

choice' :: [TextParser m a] -> TextParser m a #

Backtracking choice, use this when alternatives share a prefix. Consumes no input if all choices fail.

choiceInState :: [StateT s (ParsecT Dec Text m) a] -> StateT s (ParsecT Dec Text m) a #

Backtracking choice, use this when alternatives share a prefix. Consumes no input if all choices fail.

parsewith :: Parsec e Text a -> Text -> Either (ParseError Char e) a #

parsewithString :: Parsec e String a -> String -> Either (ParseError Char e) a #

parseWithState :: Monad m => st -> StateT st (ParsecT Dec Text m) a -> Text -> m (Either (ParseError Char Dec) a) #

parseWithState' :: (Stream s, ErrorComponent e) => st -> StateT st (ParsecT e s Identity) a -> s -> Either (ParseError (Token s) e) a #

fromparse :: (Show t, Show e) => Either (ParseError t e) a -> a #

parseerror :: (Show t, Show e) => ParseError t e -> a #

showParseError :: (Show t, Show e) => ParseError t e -> String #

showDateParseError :: (Show t, Show e) => ParseError t e -> String #

nonspace :: TextParser m Char #

spacenonewline :: (Stream s, Char ~ Token s) => ParsecT Dec s m Char #

restofline :: TextParser m String #

eolof :: TextParser m () #