@@ -31,6 +31,7 @@ import qualified Data.ByteString.Lazy as B
31import qualified Data.ByteString.UTF8 as BU8
31import qualified Data.ByteString.UTF8 as BU8
32import Data.Char (isSpace)
32import Data.Char (isSpace)
33import qualified Data.Map as M
33import qualified Data.Map as M
34+import Data.Maybe (maybe)
34import Data.Text (Text)
35import Data.Text (Text)
35import Data.Version (showVersion)
36import Data.Version (showVersion)
@@ -97,28 +98,30 @@ printWarningsAndErrors verbose BriefErrors warnings errors = do
97 either (const exitFailure) (const (return ())) errors
98 either (const exitFailure) (const (return ())) errors
99briefFormat :: JSONResult -> [String]
100briefFormat :: JSONResult -> [String]
100−briefFormat (JSONResult warnings errors) = concat $
101+briefFormat (JSONResult warnings errors) =
101 (renderError Error <$> errors) <> (renderError Warning <$> warnings)
102 (renderError Error <$> errors) <> (renderError Warning <$> warnings)
103− renderError :: BriefType -> JSONError -> [String]
104+ renderError :: BriefType -> JSONError -> String
104− renderError t (JSONError pos msg _ lnk file _ suggest) =
105+ renderError t (JSONError (Just pos) msg _ lnk (Just file) _ _) =
106 "%s:%d:%d: %s: %s"
107 "%s:%d:%d: %s: %s"
107− (concat file)
108+ file
108− (maybe 0 startLine pos)
109+ (startLine pos)
109− (maybe 0 startColumn pos)
110+ (startColumn pos)
111− (dropWhile isSpace message) :
112+ (combine msg lnk)
112− notes
113+ renderError t (JSONError _ msg _ lnk _ module' _) =
115+ "%s: in module %s - %s"
117+ (maybe "?" (printf "\"%s\"") module')
119+ combine :: String -> String -> String
122+ | otherwise = printf "%s\nSee %s for more information\n" msg' lnk
114− message
124+ msg' = dropWhile isSpace msg
116− | otherwise = printf "%s\nSee %s for more information\n" msg lnk
119− Just (ErrorSuggestion s@(_:_) r) <- suggest =
120− renderError Note (JSONError (r <|> pos) s [] [] file Nothing Nothing)
123compile :: PCCMakeOptions -> IO ()
126compile :: PCCMakeOptions -> IO ()
124compile PCCMakeOptions{..} = do
127compile PCCMakeOptions{..} = do