diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2014-12-11 19:14:28 +0000 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2014-12-15 21:35:46 +0000 |
commit | 58e4e4a608de489f993c36234048014d93b39116 (patch) | |
tree | 2cd3e20cf191fe6d0a21cca56f799cfeba37335a /src/Text/Pandoc | |
parent | a5cac0a0c401b0d5c901ac734c877f6a32bddb40 (diff) | |
download | pandoc-58e4e4a608de489f993c36234048014d93b39116.tar.gz |
Text.Pandoc.Parsing: Change parseFromString to fail if not all input is
consumed.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Parsing.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs index 18f38e564..28ea2bd2f 100644 --- a/src/Text/Pandoc/Parsing.hs +++ b/src/Text/Pandoc/Parsing.hs @@ -314,12 +314,14 @@ stringAnyCase (x:xs) = do return (firstChar:rest) -- | Parse contents of 'str' using 'parser' and return result. -parseFromString :: Stream s m t => ParserT s st m a -> s -> ParserT s st m a +parseFromString :: Monad m => ParserT String st m a -> String -> ParserT String st m a parseFromString parser str = do oldPos <- getPosition oldInput <- getInput setInput str result <- parser + spaces + eof setInput oldInput setPosition oldPos return result |