X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2FInteractiveUI.hs;h=eaf2d2d5596bcbc32bdd36cf8f546ee031afa31f;hb=50d0293555691012f96259de7f8682b94db58517;hp=cf90ae78bac3e1a3a85b50f108d1cc0791a8e3c0;hpb=4edbeb14e25f71824c53c524028d12440928707e;p=ghc-hetmet.git diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs index cf90ae7..eaf2d2d 100644 --- a/ghc/InteractiveUI.hs +++ b/ghc/InteractiveUI.hs @@ -44,7 +44,6 @@ import Name import SrcLoc -- Other random utilities -import CmdLineParser import Digraph import BasicTypes hiding (isTopLevel) import Panic hiding (showException) @@ -655,7 +654,7 @@ runOneCommand eh getCmd = do ml <- lift $ isOptionSet Multiline if ml then do - mb_stmt <- checkInputForLayout stmt getCmd + mb_stmt <- checkInputForLayout stmt 1 getCmd case mb_stmt of Nothing -> return $ Just True Just ml_stmt -> do @@ -667,14 +666,14 @@ runOneCommand eh getCmd = do -- #4316 -- lex the input. If there is an unclosed layout context, request input -checkInputForLayout :: String -> InputT GHCi (Maybe String) +checkInputForLayout :: String -> Int -> InputT GHCi (Maybe String) -> InputT GHCi (Maybe String) -checkInputForLayout stmt getStmt = do +checkInputForLayout stmt line_number getStmt = do dflags' <- lift $ getDynFlags let dflags = xopt_set dflags' Opt_AlternativeLayoutRule st <- lift $ getGHCiState let buf = stringToStringBuffer stmt - loc = mkSrcLoc (fsLit (progname st)) (line_number st) 1 + loc = mkSrcLoc (fsLit (progname st)) line_number 1 pstate = Lexer.mkPState dflags buf loc case Lexer.unP goToEnd pstate of (Lexer.POk _ False) -> return $ Just stmt @@ -697,7 +696,7 @@ checkInputForLayout stmt getStmt = do Nothing -> return Nothing Just str -> if str == "" then return $ Just stmt - else checkInputForLayout (stmt++"\n"++str) getStmt + else checkInputForLayout (stmt++"\n"++str) (line_number+1) getStmt where goToEnd = do eof <- Lexer.nextIsEOF if eof @@ -1562,7 +1561,9 @@ newDynFlags minus_opts = do liftIO $ handleFlagWarnings dflags' warns if (not (null leftovers)) - then ghcError $ errorsToGhcException leftovers + then ghcError . CmdLineError + $ "Some flags have not been recognized: " + ++ (concat . intersperse ", " $ map unLoc leftovers) else return () new_pkgs <- setDynFlags dflags'