X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fghci%2FGhciTags.hs;h=95d0d61547e8ad3953fd2e8a9a1f5d3a5d0f3e30;hb=aa9a4f1053d3c554629a2ec25955e7530c95b892;hp=6aa4829fe50a82e7f0e7292c00023e964948d42e;hpb=881b72ecf360a38455ac9391ffa69039377aae25;p=ghc-hetmet.git diff --git a/compiler/ghci/GhciTags.hs b/compiler/ghci/GhciTags.hs index 6aa4829..95d0d61 100644 --- a/compiler/ghci/GhciTags.hs +++ b/compiler/ghci/GhciTags.hs @@ -19,7 +19,7 @@ import Name (nameOccName) import OccName (pprOccName) import Data.Maybe -import Control.Exception +import Panic import Data.List import Control.Monad import System.IO @@ -59,7 +59,7 @@ createTagsFile session tagskind tagFile = do is_interpreted <- GHC.moduleIsInterpreted session m -- should we just skip these? when (not is_interpreted) $ - throwDyn (CmdLineError ("module '" + ghcError (CmdLineError ("module '" ++ GHC.moduleNameString (GHC.moduleName m) ++ "' is not interpreted")) mbModInfo <- GHC.getModuleInfo session m @@ -113,19 +113,16 @@ collateAndWriteTags ETags file tagInfos = do -- etags style, Emacs/XEmacs tagGroups <- mapM tagFileGroup groups IO.try (writeFile file $ concat tagGroups) where - tagFileGroup [] = throwDyn (CmdLineError "empty tag file group??") + tagFileGroup [] = ghcError (CmdLineError "empty tag file group??") tagFileGroup group@((_,fileName,_,_):_) = do file <- readFile fileName -- need to get additional info from sources.. let byLine (_,_,l1,_) (_,_,l2,_) = l1 <= l2 sortedGroup = sortLe byLine group tags = unlines $ perFile sortedGroup 1 0 $ lines file return $ "\x0c\n" ++ fileName ++ "," ++ show (length tags) ++ "\n" ++ tags - perFile (tagInfo@(_tag, _file, lNo, _colNo):tags) count pos (line:lines) - | lNo > count = - perFile (tagInfo:tags) (count+1) (pos+length line) lines - perFile (tagInfo@(_tag, _file, lNo, _colNo):tags) count pos lines@(line:_) - | lNo == count = - showETag tagInfo line pos : perFile tags count pos lines + perFile (tagInfo@(_tag, _file, lNo, _colNo):tags) count pos lines@(line:lines') + | lNo > count = perFile (tagInfo:tags) (count+1) (pos+length line) lines' + | lNo == count = showETag tagInfo line pos : perFile tags count pos lines perFile _ _ _ _ = [] -- simple ctags format, for Vim et al