aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Parsing.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-12-03 19:03:33 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-01-25 17:07:40 +0100
commit38064498d98567340d3456bb130c1da8dccaebb2 (patch)
tree208bb7ce9d6bb917fb86898f39ae9535f0e2d630 /src/Text/Pandoc/Parsing.hs
parent1ed925ac20a5e6f9fae9848e80c29c7bec791ca8 (diff)
downloadpandoc-38064498d98567340d3456bb130c1da8dccaebb2.tar.gz
Parsing: Removed obsolete warnings stuff.
Removed stateWarnings, addWarning, and readWithWarnings.
Diffstat (limited to 'src/Text/Pandoc/Parsing.hs')
-rw-r--r--src/Text/Pandoc/Parsing.hs24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs
index 796d09632..ced20a8c7 100644
--- a/src/Text/Pandoc/Parsing.hs
+++ b/src/Text/Pandoc/Parsing.hs
@@ -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) . (<>)