aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Parser.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-09-29 17:18:32 +0200
committerGitHub <noreply@github.com>2020-09-29 11:18:32 -0400
commita18c3af7f983f3b6d3cd84093c9079031da58468 (patch)
tree9974ddda8d9313cb7a5a9f659de0ef18791ca285 /haddock-api/src/Haddock/Parser.hs
parent37c47822d390b553ce24fe256c9700d5fd83bf9f (diff)
Update for parser (#1234)
Diffstat (limited to 'haddock-api/src/Haddock/Parser.hs')
-rw-r--r--haddock-api/src/Haddock/Parser.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/haddock-api/src/Haddock/Parser.hs b/haddock-api/src/Haddock/Parser.hs
index e1b5c787..366bcd55 100644
--- a/haddock-api/src/Haddock/Parser.hs
+++ b/haddock-api/src/Haddock/Parser.hs
@@ -17,8 +17,9 @@ import qualified Documentation.Haddock.Parser as P
import Documentation.Haddock.Types
import GHC.Driver.Session ( DynFlags )
+import GHC.Driver.Config
import GHC.Data.FastString ( fsLit )
-import GHC.Parser.Lexer ( mkPState, unP, ParseResult(POk) )
+import GHC.Parser.Lexer ( initParserState, unP, ParseResult(POk) )
import GHC.Parser ( parseIdentifier )
import GHC.Types.Name.Reader ( RdrName )
import GHC.Types.SrcLoc ( mkRealSrcLoc, unLoc )
@@ -34,7 +35,7 @@ parseIdent :: DynFlags -> String -> Maybe RdrName
parseIdent dflags str0 =
let buffer = stringToStringBuffer str0
realSrcLc = mkRealSrcLoc (fsLit "<unknown file>") 0 0
- pstate = mkPState dflags buffer realSrcLc
+ pstate = initParserState (initParserOpts dflags) buffer realSrcLc
in case unP parseIdentifier pstate of
POk _ name -> Just (unLoc name)
_ -> Nothing