@@ -66,6 +66,7 @@ module Text.Pandoc.Parsing ( anyLine,
66 gridTableWith,
66 gridTableWith,
68 returnWarnings,
68 returnWarnings,
69 readWithM,
70 readWithM,
70 testStringWith,
71 testStringWith,
71 guardEnabled,
72 guardEnabled,
@@ -873,6 +874,10 @@ returnWarnings p = do
873 warnings <- stateWarnings <$> getState
874 warnings <- stateWarnings <$> getState
874 return (doc, warnings)
875 return (doc, warnings)
877+-- | Return the final internal state with the result of a parser
878+returnState :: (Stream s m c) => ParsecT s st m a -> ParsecT s st m (a, st)
879+returnState p = (,) <$> p <*> getState
876-- | Parse a string with @parser@ (for testing).
881-- | Parse a string with @parser@ (for testing).
877testStringWith :: (Show a, Stream [Char] Identity Char)
882testStringWith :: (Show a, Stream [Char] Identity Char)
878 => ParserT [Char] ParserState Identity a
883 => ParserT [Char] ParserState Identity a