packages feed

hothasktags 0.1.1 → 0.2.0

raw patch · 2 files changed

+14/−3 lines, 2 filesdep +cpphsdep ~haskell-src-exts

Dependencies added: cpphs

Dependency ranges changed: haskell-src-exts

Files

Main.hs view
@@ -6,6 +6,7 @@ import System.Environment (getArgs) import System.IO (hPutStrLn, stderr) import qualified Data.Map as Map+import qualified Language.Preprocessor.Cpphs as CPP import Control.Monad (forM, when) import Data.List (sort) import Data.Maybe (fromMaybe)@@ -157,10 +158,19 @@ makeTags :: FilePath -> Map.Map String Defn -> [String] makeTags refFile = map (makeTag refFile) . Map.assocs +haskellSource :: FilePath -> IO String+haskellSource file = do+    contents <- readFile file+    let needsCpp = maybe False (L.CPP `elem`) (L.readExtensions contents)+    if needsCpp+        then CPP.runCpphs CPP.defaultCpphsOptions file contents+        else return contents+    + makeDatabase :: [FilePath] -> IO Database makeDatabase files = do     fmap (Map.fromList . concat) . forM files $ \file -> do-        result <- L.parseFileWithMode (mode file) file+        result <- L.parseFileContentsWithMode (mode file) `fmap` haskellSource file         case result of             L.ParseOk mod@(L.Module _ (Just (L.ModuleHead _ (L.ModuleName _ name) _ _)) _ _ _) -> do                 return [(name, mod)]
hothasktags.cabal view
@@ -1,5 +1,5 @@ name: hothasktags-version: 0.1.1+version: 0.2.0 cabal-version: >= 1.6 && < 2 build-type: Simple author: Luke Palmer <lrpalmer@gmail.com>@@ -30,6 +30,7 @@     build-depends:          base == 4.*,         containers,-        haskell-src-exts >= 1.8 && < 1.10+        haskell-src-exts >= 1.8 && < 1.11,+        cpphs == 1.11.*     main-is: Main.hs     ghc-options: -W