Text.Pandoc.Parsing: Change parseFromString to fail if not all input is

consumed.
This commit is contained in:
Matthew Pickering 2014-12-11 19:14:28 +00:00
parent a5cac0a0c4
commit 58e4e4a608

View file

@ -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