From: Ian Lynagh Date: Tue, 6 Jul 2010 17:26:11 +0000 (+0000) Subject: Make mkPState and pragState take their arguments in the same order X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=b017f34bebf1588e5e579d7c653413e2a4c2d170 Make mkPState and pragState take their arguments in the same order --- diff --git a/compiler/cmm/CmmParse.y b/compiler/cmm/CmmParse.y index 0ae88e2..7ad1dd5 100644 --- a/compiler/cmm/CmmParse.y +++ b/compiler/cmm/CmmParse.y @@ -1033,7 +1033,7 @@ parseCmmFile dflags filename = do buf <- hGetStringBuffer filename let init_loc = mkSrcLoc (mkFastString filename) 1 1 - init_state = (mkPState buf init_loc dflags) { lex_state = [0] } + init_state = (mkPState dflags buf init_loc) { lex_state = [0] } -- reset the lex_state: the Lexer monad leaves some stuff -- in there we don't want. case unP cmmParse init_state of diff --git a/compiler/main/HeaderInfo.hs b/compiler/main/HeaderInfo.hs index b520098..5a75ed3 100644 --- a/compiler/main/HeaderInfo.hs +++ b/compiler/main/HeaderInfo.hs @@ -57,7 +57,7 @@ getImports :: GhcMonad m => -- ^ The source imports, normal imports, and the module name. getImports dflags buf filename source_filename = do let loc = mkSrcLoc (mkFastString filename) 1 1 - case unP parseHeader (mkPState buf loc dflags) of + case unP parseHeader (mkPState dflags buf loc) of PFailed span err -> parseError span err POk pst rdr_module -> do let _ms@(_warns, errs) = getMessages pst diff --git a/compiler/main/HscMain.lhs b/compiler/main/HscMain.lhs index 76c35ea..933503e 100644 --- a/compiler/main/HscMain.lhs +++ b/compiler/main/HscMain.lhs @@ -186,7 +186,7 @@ hscParse mod_summary = do let loc = mkSrcLoc (mkFastString src_filename) 1 1 - case unP parseModule (mkPState buf loc dflags) of + case unP parseModule (mkPState dflags buf loc) of PFailed span err -> throwOneError (mkPlainErrMsg span err) @@ -996,7 +996,7 @@ hscParseThing parser dflags str let loc = mkSrcLoc (fsLit "") 1 1 - case unP parser (mkPState buf loc dflags) of + case unP parser (mkPState dflags buf loc) of PFailed span err -> do let msg = mkPlainErrMsg span err diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index 460817c..4e96176 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -1816,8 +1816,8 @@ pragState dynflags buf loc = -- create a parse state -- -mkPState :: StringBuffer -> SrcLoc -> DynFlags -> PState -mkPState buf loc flags = +mkPState :: DynFlags -> StringBuffer -> SrcLoc -> PState +mkPState flags buf loc = PState { buffer = buf, dflags = flags, @@ -2201,7 +2201,8 @@ reportLexError loc1 loc2 buf str lexTokenStream :: StringBuffer -> SrcLoc -> DynFlags -> ParseResult [Located Token] lexTokenStream buf loc dflags = unP go initState - where initState = mkPState buf loc (dopt_set (dopt_unset dflags Opt_Haddock) Opt_KeepRawTokenStream) + where dflags' = dopt_set (dopt_unset dflags Opt_Haddock) Opt_KeepRawTokenStream + initState = mkPState dflags' buf loc go = do ltok <- lexer return case ltok of