summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Infra
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2014-08-22 00:30:33 +0000
committerhallgren <hallgren@chalmers.se>2014-08-22 00:30:33 +0000
commit8dfaf2ef65915e7ac91139155d60df85ed66adbb (patch)
tree3f034a8530ca80348d67560093638bd413e2f517 /src/compiler/GF/Infra
parent21f429caf8c8cb4248457c16abaf0ad4f51c974a (diff)
Command line flag -s/-q now silences all warnings
These flags now do what the say.
Diffstat (limited to 'src/compiler/GF/Infra')
-rw-r--r--src/compiler/GF/Infra/CheckM.hs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/compiler/GF/Infra/CheckM.hs b/src/compiler/GF/Infra/CheckM.hs
index 80f2409fa..43c43ba27 100644
--- a/src/compiler/GF/Infra/CheckM.hs
+++ b/src/compiler/GF/Infra/CheckM.hs
@@ -13,7 +13,7 @@
-----------------------------------------------------------------------------
module GF.Infra.CheckM
- (Check, CheckResult, Message, runCheck,
+ (Check, CheckResult, Message, runCheck, runCheck',
checkError, checkCond, checkWarn, checkWarnings, checkAccumError,
checkIn, checkInModule, checkMap, checkMapRecover,
parallelCheck, accumulateError, commitCheck,
@@ -23,6 +23,7 @@ import GF.Data.Operations
--import GF.Infra.Ident
--import GF.Grammar.Grammar(msrc) -- ,Context
import GF.Infra.Location(ppLocation,sourcePath)
+import GF.Infra.Option(Options,noOptions,verbAtLeast,Verbosity(..))
import qualified Data.Map as Map
import GF.Text.Pretty
@@ -98,15 +99,19 @@ commitCheck c =
list = vcat . reverse
-- | Run an error check, report errors and warnings
-runCheck :: ErrorMonad m => Check a -> m (a,String)
-runCheck c =
+runCheck c = runCheck' noOptions c
+
+-- | Run an error check, report errors and (optionally) warnings
+runCheck' :: ErrorMonad m => Options -> Check a -> m (a,String)
+runCheck' opts c =
case unCheck c {-[]-} ([],[]) of
- (([],ws),Success v) -> return (v,render (list ws))
+ (([],ws),Success v) -> return (v,render (wlist ws))
(msgs ,Success v) -> bad msgs
((es,ws),Fail e) -> bad ((e:es),ws)
where
- bad (es,ws) = raise (render $ list ws $$ list es)
+ bad (es,ws) = raise (render $ wlist ws $$ list es)
list = vcat . reverse
+ wlist ws = if verbAtLeast opts Normal then list ws else empty
parallelCheck :: [Check a] -> Check [a]
parallelCheck cs =