aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Interface/Create.hs
diff options
context:
space:
mode:
authorDavid Waern <davve@dtek.chalmers.se>2007-10-02 01:05:19 +0000
committerDavid Waern <davve@dtek.chalmers.se>2007-10-02 01:05:19 +0000
commitfe2f0cc0e8fda4b4cfe6ea64083c91dbfec2cadb (patch)
tree93a9dd60b44238b0baeceba991870bd30bc56ff6 /src/Haddock/Interface/Create.hs
parenteda2c60c5040c6869d3de3e130e07fd6cca590a4 (diff)
Improve parsing of doc options
Diffstat (limited to 'src/Haddock/Interface/Create.hs')
-rw-r--r--src/Haddock/Interface/Create.hs27
1 files changed, 6 insertions, 21 deletions
diff --git a/src/Haddock/Interface/Create.hs b/src/Haddock/Interface/Create.hs
index 61f2d51c..df952ad8 100644
--- a/src/Haddock/Interface/Create.hs
+++ b/src/Haddock/Interface/Create.hs
@@ -107,28 +107,13 @@ createInterface ghcMod flags modMap = do
mkDocOpts :: Maybe String -> [Flag] -> Module -> ErrMsgM [DocOption]
mkDocOpts mbOpts flags mod = do
opts <- case mbOpts of
- Just opts -> processOptions opts
+ Just opts -> case words $ replace ',' ' ' opts of
+ [] -> tell ["No option supplied to DOC_OPTION/doc_option"] >> return []
+ xs -> liftM catMaybes (mapM parseOption xs)
Nothing -> return []
- let opts' = if Flag_HideModule (moduleString mod) `elem` flags
- then OptHide : opts
- else opts
- return opts'
-
-
-processOptions_ str = let (opts, msg) = runWriter (processOptions str)
- in print msg >> return opts
-
-
-processOptions :: String -> ErrMsgM [DocOption]
-processOptions str = do
- case break (== ',') str of
- (this, ',':rest) -> do
- opt <- parseOption this
- opts <- processOptions rest
- return (maybeToList opt ++ opts)
- (this, _)
- | all isSpace this -> return []
- | otherwise -> do opt <- parseOption this; return (maybeToList opt)
+ if Flag_HideModule (moduleString mod) `elem` flags
+ then return $ OptHide : opts
+ else return opts
parseOption :: String -> ErrMsgM (Maybe DocOption)