aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-10-13 21:37:06 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-10-13 21:37:06 +0000
commit11e7ad2259eaac1f126aa6f3f1b992eeaa4c0a20 (patch)
tree66e2fe73e1698f8e98989f41c9b4488d8dc5f902
parent403f5f47288f5c65d5354fded1a2164185b1178c (diff)
downloadpandoc-11e7ad2259eaac1f126aa6f3f1b992eeaa4c0a20.tar.gz
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
-rw-r--r--src/Text/Pandoc/Shared.hs2
1 files changed, 2 insertions, 0 deletions
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.