Parsing: Removed obsolete warnings stuff.

Removed stateWarnings, addWarning, and readWithWarnings.
This commit is contained in:
John MacFarlane 2016-12-03 19:03:33 +01:00
parent 1ed925ac20
commit 38064498d9

View file

@ -67,7 +67,6 @@ module Text.Pandoc.Parsing ( anyLine,
widthsFromIndices,
gridTableWith,
readWith,
readWithWarnings,
readWithM,
testStringWith,
guardEnabled,
@ -165,7 +164,6 @@ module Text.Pandoc.Parsing ( anyLine,
setSourceColumn,
setSourceLine,
newPos,
addWarning,
(<+?>),
extractIdClass
)
@ -895,15 +893,6 @@ readWith :: Parser [Char] st a
-> Either PandocError a
readWith p t inp = runIdentity $ readWithM p t inp
readWithWarnings :: Parser [Char] ParserState a
-> ParserState
-> String
-> Either PandocError (a, [String])
readWithWarnings p = readWith $ do
doc <- p
warnings <- stateWarnings <$> getState
return (doc, warnings)
-- | Parse a string with @parser@ (for testing).
testStringWith :: (Show a)
=> ParserT [Char] ParserState Identity a
@ -940,8 +929,7 @@ data ParserState = ParserState
-- roles), 3) Additional classes (rest of Attr is unused)).
stateCaption :: Maybe Inlines, -- ^ Caption in current environment
stateInHtmlBlock :: Maybe String, -- ^ Tag type of HTML block being parsed
stateMarkdownAttribute :: Bool, -- ^ True if in markdown=1 context
stateWarnings :: [String] -- ^ Warnings generated by the parser
stateMarkdownAttribute :: Bool -- ^ True if in markdown=1 context
}
instance Default ParserState where
@ -1036,8 +1024,8 @@ defaultParserState =
stateRstCustomRoles = M.empty,
stateCaption = Nothing,
stateInHtmlBlock = Nothing,
stateMarkdownAttribute = False,
stateWarnings = []}
stateMarkdownAttribute = False
}
-- | Succeed only if the extension is enabled.
guardEnabled :: (Stream s m a, HasReaderOptions st) => Extension -> ParserT s st m ()
@ -1274,12 +1262,6 @@ applyMacros' target = do
return $ applyMacros macros target
else return target
-- | Append a warning to the log.
addWarning :: Maybe SourcePos -> String -> Parser [Char] ParserState ()
addWarning mbpos msg =
updateState $ \st -> st{
stateWarnings = (msg ++ maybe "" (\pos -> " " ++ show pos) mbpos) :
stateWarnings st }
infixr 5 <+?>
(<+?>) :: (Monoid a) => ParserT s st m a -> ParserT s st m a -> ParserT s st m a
a <+?> b = a >>= flip fmap (try b <|> return mempty) . (<>)