git.iko.soy/typeable/pandoc
on master help sign in
Parsing: Removed obsolete warnings stuff.
3806449John MacFarlane
src/Text/Pandoc/Parsing.hs+3−21
@@ -67,7 +67,6 @@ module Text.Pandoc.Parsing ( anyLine,
67 widthsFromIndices,
67 widthsFromIndices,
68 gridTableWith,
68 gridTableWith,
69 readWith,
69 readWith,
70− readWithWarnings,
71 readWithM,
70 readWithM,
72 testStringWith,
71 testStringWith,
73 guardEnabled,
72 guardEnabled,
@@ -165,7 +164,6 @@ module Text.Pandoc.Parsing ( anyLine,
165 setSourceColumn,
164 setSourceColumn,
166 setSourceLine,
165 setSourceLine,
167 newPos,
166 newPos,
168− addWarning,
169 (<+?>),
167 (<+?>),
170 extractIdClass
168 extractIdClass
171 )
169 )
@@ -895,15 +893,6 @@ readWith :: Parser [Char] st a
895 -> Either PandocError a
893 -> Either PandocError a
896readWith p t inp = runIdentity $ readWithM p t inp
894readWith p t inp = runIdentity $ readWithM p t inp
897
895
898−readWithWarnings :: Parser [Char] ParserState a
899− -> ParserState
900− -> String
901− -> Either PandocError (a, [String])
902−readWithWarnings p = readWith $ do
903− doc <- p
904− warnings <- stateWarnings <$> getState
905− return (doc, warnings)
906−
907-- | Parse a string with @parser@ (for testing).
896-- | Parse a string with @parser@ (for testing).
908testStringWith :: (Show a)
897testStringWith :: (Show a)
909 => ParserT [Char] ParserState Identity a
898 => ParserT [Char] ParserState Identity a
@@ -940,8 +929,7 @@ data ParserState = ParserState
940 -- roles), 3) Additional classes (rest of Attr is unused)).
929 -- roles), 3) Additional classes (rest of Attr is unused)).
941 stateCaption :: Maybe Inlines, -- ^ Caption in current environment
930 stateCaption :: Maybe Inlines, -- ^ Caption in current environment
942 stateInHtmlBlock :: Maybe String, -- ^ Tag type of HTML block being parsed
931 stateInHtmlBlock :: Maybe String, -- ^ Tag type of HTML block being parsed
943− stateMarkdownAttribute :: Bool, -- ^ True if in markdown=1 context
932+ stateMarkdownAttribute :: Bool -- ^ True if in markdown=1 context
944− stateWarnings :: [String] -- ^ Warnings generated by the parser
945 }
933 }
946
934
947instance Default ParserState where
935instance Default ParserState where
@@ -1036,8 +1024,8 @@ defaultParserState =
1036 stateRstCustomRoles = M.empty,
1024 stateRstCustomRoles = M.empty,
1037 stateCaption = Nothing,
1025 stateCaption = Nothing,
1038 stateInHtmlBlock = Nothing,
1026 stateInHtmlBlock = Nothing,
1039− stateMarkdownAttribute = False,
1027+ stateMarkdownAttribute = False
1040− stateWarnings = []}
1028+ }
1041
1029
1042-- | Succeed only if the extension is enabled.
1030-- | Succeed only if the extension is enabled.
1043guardEnabled :: (Stream s m a, HasReaderOptions st) => Extension -> ParserT s st m ()
1031guardEnabled :: (Stream s m a, HasReaderOptions st) => Extension -> ParserT s st m ()
@@ -1274,12 +1262,6 @@ applyMacros' target = do
1274 return $ applyMacros macros target
1262 return $ applyMacros macros target
1275 else return target
1263 else return target
1276
1264
1277−-- | Append a warning to the log.
1278−addWarning :: Maybe SourcePos -> String -> Parser [Char] ParserState ()
1279−addWarning mbpos msg =
1280− updateState $ \st -> st{
1281− stateWarnings = (msg ++ maybe "" (\pos -> " " ++ show pos) mbpos) :
1282− stateWarnings st }
1283infixr 5 <+?>
1265infixr 5 <+?>
1284(<+?>) :: (Monoid a) => ParserT s st m a -> ParserT s st m a -> ParserT s st m a
1266(<+?>) :: (Monoid a) => ParserT s st m a -> ParserT s st m a -> ParserT s st m a
1285a <+?> b = a >>= flip fmap (try b <|> return mempty) . (<>)
1267a <+?> b = a >>= flip fmap (try b <|> return mempty) . (<>)