lentil-1.0.2.0: src/Lentil/Types.hs
-----------------------------------------------------------------------------
-- |
-- Module : Lentil.Types
-- Copyright : © 2015 Francesco Ariis
-- License : GPLv3 (see the LICENSE file)
--
-- Types descriptions
-----------------------------------------------------------------------------
module Lentil.Types where
import qualified Data.List as L
data Issue = Issue { iFile :: FilePath,
iRow :: Row,
iDesc :: Maybe Description,
iTags :: [Tag] }
deriving (Eq, Show)
data Tag = Tag { tagString :: String }
deriving (Show, Eq, Ord)
type Description = String
type Row = Int
-- extension alias, will treat *.fst files as if they were *.snd
type Alias = (String, String)
aliasSign :: String
aliasSign = "%"
-- Flagwords are string (TODO, FIXME, etc.)
type FlagWord = String
-- output format
data Format = TagPop | Pretty | Csv | Comp | Xml
deriving (Show, Eq, Enum, Bounded)
-- comp: as gcc/ghc would output warnings
-- tag delimiters
openDel, closeDel :: Char
openDel = '['
closeDel = ']'
-- eliminate "./" at the beginning of fp if present
prettyFP :: String -> String
prettyFP fp | L.isPrefixOf "./" fp = drop 2 fp
| otherwise = fp
iPPDesc :: Issue -> String
iPPDesc i = maybe "<no description>" id . iDesc $ i