Save and restore position in parseFromString, so that it doesn't
mess up accurate error location reporting.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1049 788f1e2b-df1e-0410-8736-df70ead52e1b
commit11e7ad2259eaac1f126aa6f3f1b992eeaa4c0a20
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>
dateSat 13 Oct 2007, 21:37 (19 years ago)
parent403f5f4
src/Text/Pandoc/Shared.hs+2
@@ -288,10 +288,12 @@ stringAnyCase (x:xs) = do
288288-- | Parse contents of 'str' using 'parser' and return result.
289289parseFromString :: GenParser tok st a -> [tok] -> GenParser tok st a
290290parseFromString parser str = do
291+ oldPos <- getPosition
291292 oldInput <- getInput
292293 setInput str
293294 result <- parser
294295 setInput oldInput
296+ setPosition oldPos
295297 return result
296298
297299-- | Parse raw line block up to and including blank lines.