Skip to content

Commit

Permalink
Text.Pandoc.Parsing: Change parseFromString to fail if not all input is
Browse files Browse the repository at this point in the history
consumed.
  • Loading branch information
mpickering committed Dec 15, 2014
1 parent a5cac0a commit 58e4e4a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Text/Pandoc/Parsing.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 58e4e4a

Please sign in to comment.