on master help sign in
Use iWarn some more
commit0a7fe41d98a1821b6a28726a66d2dc4342f00a37 authorJason Felice <jason.m.felice@gmail.com> dateMon 11 Dec 2017, 15:19 (9 years ago) parentfb4c5e4
2 files changed+5−4
src/Idris/Main.hs+4−3 src/Idris/Parser.hs+1−1
src/Idris/Main.hs+4−3
@@ -31,6 +31,7 @@ import Idris.REPL.Parser
3131import IRTS.CodegenCommon
3232
3333import Util.System
34+import qualified Util.Pretty
3435
3536import Control.Category
3637import Control.DeepSeq
@@ -195,7 +196,7 @@ idrisMain opts =
195196 mapM_ (\str -> do ist <- getIState
196197 c <- colourise
197198 case parseExpr ist str of
198− Left err -> do iputStrLn . show . fixColour c . parseErrorDoc $ err
199+ Left err -> do iWarn (errorExtent err) (Util.Pretty.text $ errorMessage err)
199200 runIO $ exitWith (ExitFailure 1)
200201 Right e -> process "" (Eval e))
201202 exprs
@@ -272,7 +273,7 @@ execScript :: String -> Idris ()
272273execScript expr = do i <- getIState
273274 c <- colourise
274275 case parseExpr i expr of
275− Left err -> do iputStrLn . show . fixColour c . parseErrorDoc $ err
276+ Left err -> do iWarn (errorExtent err) (Util.Pretty.text $ errorMessage err)
276277 runIO $ exitWith (ExitFailure 1)
277278 Right term -> do ctxt <- getContext
278279 (tm, _) <- elabVal (recinfo (fileFC "toplevel")) ERHS term
@@ -299,7 +300,7 @@ initScript = do script <- runIO $ getIdrisInitScript
299300 runInit h
300301 processLine i cmd input clr =
301302 case parseCmd i input cmd of
302− Left err -> runIO . print . fixColour clr . parseErrorDoc $ err
303+ Left err -> iWarn (errorExtent err) (Util.Pretty.text $ errorMessage err)
303304 Right (Right Reload) -> iPrintError "Init scripts cannot reload the file"
304305 Right (Right (Load f _)) -> iPrintError "Init scripts cannot load files"
305306 Right (Right (ModImport f)) -> iPrintError "Init scripts cannot import modules"
src/Idris/Parser.hs+1−1
@@ -13,7 +13,7 @@ Maintainer : The Idris Community.
1313{-# OPTIONS_GHC -fwarn-unused-imports #-}
1414
1515module Idris.Parser(IdrisParser(..), ImportInfo(..), addReplSyntax, clearParserWarnings,
16− decl, fixColour, loadFromIFile, loadModule, name, opChars, parseElabShellStep, parseConst, parseExpr, parseImports, parseTactic,
16+ decl, errorExtent, errorMessage, fixColour, loadFromIFile, loadModule, name, opChars, parseElabShellStep, parseConst, parseExpr, parseImports, parseTactic,
1717 runparser, ParseError, parseErrorDoc) where
1818
1919import Idris.AbsSyntax hiding (namespace, params)