hothasktags 0.2.2 → 0.3.0
raw patch · 3 files changed
+55/−4 lines, 3 filesdep +filepath
Dependencies added: filepath
Files
- LICENSE +30/−0
- Main.hs +16/−2
- hothasktags.cabal +9/−2
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2010-2013, Luke Palmer++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Luke Palmer nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Main.hs view
@@ -10,6 +10,7 @@ import Control.Monad (forM, when) import Data.List (sort) import Data.Maybe (fromMaybe)+import System.FilePath.Posix (takeFileName) type Database = Map.Map String (L.Module L.SrcSpanInfo) @@ -63,9 +64,11 @@ extractName (L.Ident loc name) = [(name, getLoc loc)] extractName (L.Symbol _ _) = [] -- no symbols for now - getLoc (L.SrcSpanInfo (L.SrcSpan file line _ _ _) _) = Defn file line localDecls _ = Map.empty +getLoc :: L.SrcSpanInfo -> Defn+getLoc (L.SrcSpanInfo (L.SrcSpan file line _ _ _) _) = Defn file line+ thingMembers :: L.Module L.SrcSpanInfo -> String -> [String] thingMembers (L.Module _ _ _ _ decls) name = concatMap extract decls where@@ -117,8 +120,19 @@ exported _ _ = True moduleScope :: Database -> L.Module L.SrcSpanInfo -> Map.Map String Defn-moduleScope db mod@(L.Module _ modhead _ imports _) = localDecls mod `Map.union` Map.unions (map extractImport imports)+moduleScope db mod@(L.Module _ modhead _ imports _) = Map.unions $ moduleItself : localDecls mod : map extractImport imports where++ moduleItself = moduleDecl modhead `Map.union` enclosingFilename mod++ moduleDecl (Just (L.ModuleHead l (L.ModuleName _ name) _ _)) = Map.singleton name (getLoc l)+ moduleDecl _ = Map.empty++ enclosingFilename (L.Module l _ _ _ _) = Map.singleton (filename l) (getLoc l)+ enclosingFilename _ = Map.empty++ filename (L.SrcSpanInfo (L.SrcSpan file _ _ _ _) _) = takeFileName file+ extractImport decl@(L.ImportDecl { L.importModule = L.ModuleName _ name, L.importSpecs = spec }) = Map.unions [ if L.importQualified decl then Map.empty else names,
hothasktags.cabal view
@@ -1,9 +1,10 @@ name: hothasktags-version: 0.2.2-cabal-version: >= 1.6 && < 2+version: 0.3.0+cabal-version: >= 1.6 build-type: Simple author: Luke Palmer <lrpalmer@gmail.com> license: BSD3+license-file: LICENSE maintainer: Luke Palmer <lrpalmer@gmail.com> category: Development synopsis: Generates ctags for Haskell, incorporating import lists and qualified imports@@ -25,11 +26,17 @@ > find . | egrep '\.hs$' | xargs hothasktags > tags . will index all the hs files under the current directory.+ .+ hothasktags does not work with the emacs tag file format. Sorry. homepage: http://github.com/luqui/hothasktags+source-repository head+ type: git+ location: git://github.com/luqui/hothasktags.git executable hothasktags build-depends: base == 4.*, containers,+ filepath, haskell-src-exts >= 1.11 && < 1.14, cpphs >= 1.11 && < 1.15 main-is: Main.hs