From 1c052b0e301f27f7ed4c682b86aae33b3450cc45 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 10 Apr 2002 16:28:05 +0000 Subject: [haddock @ 2002-04-10 16:28:05 by simonmar] Parse errors in doc strings are now reported as warnings rather that causing the whole thing to fall over. It still needs cleaning up (the warning is emitted with trace) but this will do for the time being. --- src/Main.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index 796f4939..19941ed1 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -465,12 +465,16 @@ formatDocString :: (String -> Maybe HsQName) -> DocString -> (Doc,[String]) formatDocString lookup string = format parseParas lookup string -format :: ([Token] -> ParsedDoc) +format :: ([Token] -> Either String ParsedDoc) -> (String -> Maybe HsQName) -> DocString -> (Doc, [String]) format parse lookup string - = runRn lookup $ resolveDoc $ parse $ tokenise $ string + = case parse (tokenise string) of + Left error -> trace ("Warning: parse error in doc string beginning:\n\ + \ " ++ take 40 string) (DocEmpty, []) + Right doc -> runRn lookup (resolveDoc doc) + -- --------------------------------------------------------------------------- -- Looking up names in documentation -- cgit v1.2.3