aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-05-24 09:57:40 -0400
committerGitHub <noreply@github.com>2021-05-24 09:57:40 -0400
commitbf4d69edcc8e3928ba7765f85b7a53b96c58d6c5 (patch)
tree40a936078d75d4c6affa7e3dba17cb0e06f841c9 /haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
parent8a5e37f32f772a320fd5f6aa86cc5c9c4d01f7cf (diff)
parent40ba457f6436b7eb2c60e8824e1591526945df2a (diff)
Merge pull request #1394 from adinapoli/wip/adinapoli-align-ps-messages
Align Haddock to use the new Parser diagnostics interface
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs')
-rw-r--r--haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
index f4bc038c..d5ee7420 100644
--- a/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
+++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
@@ -12,9 +12,10 @@ import qualified Data.ByteString as BS
import GHC.Types.SourceText
import GHC.Driver.Session
-import GHC.Utils.Error ( pprLocMsgEnvelope )
+import GHC.Utils.Error ( mkPlainMsgEnvelope, pprLocMsgEnvelope )
import GHC.Data.FastString ( mkFastString )
-import GHC.Parser.Errors.Ppr ( mkParserErr )
+import GHC.Parser.Errors.Ppr ()
+import qualified GHC.Types.Error as E
import GHC.Parser.Lexer as Lexer
( P(..), ParseResult(..), PState(..), Token(..)
, initParserState, lexer, mkParserOpts, getErrorMessages)
@@ -40,7 +41,7 @@ parse
parse dflags fpath bs = case unP (go False []) initState of
POk _ toks -> reverse toks
PFailed pst ->
- let err:_ = bagToList (fmap mkParserErr (getErrorMessages pst)) in
+ let err:_ = bagToList (E.getMessages $ getErrorMessages pst) in
panic $ showSDoc dflags $
text "Hyperlinker parse error:" $$ pprLocMsgEnvelope err
where
@@ -50,6 +51,7 @@ parse dflags fpath bs = case unP (go False []) initState of
start = mkRealSrcLoc (mkFastString fpath) 1 1
pflags = mkParserOpts (warningFlags dflags)
(extensionFlags dflags)
+ (mkPlainMsgEnvelope dflags)
(safeImportsOn dflags)
False -- lex Haddocks as comment tokens
True -- produce comment tokens