From 11e7ad2259eaac1f126aa6f3f1b992eeaa4c0a20 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sat, 13 Oct 2007 21:37:06 +0000 Subject: 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 --- src/Text/Pandoc/Shared.hs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 553a93f28..593311b01 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -288,10 +288,12 @@ stringAnyCase (x:xs) = do -- | Parse contents of 'str' using 'parser' and return result. parseFromString :: GenParser tok st a -> [tok] -> GenParser tok st a parseFromString parser str = do + oldPos <- getPosition oldInput <- getInput setInput str result <- parser setInput oldInput + setPosition oldPos return result -- | Parse raw line block up to and including blank lines. -- cgit v1.2.3