packages feed

ghc-lib-parser-ex 0.20200901 → 0.20201001

raw patch · 21 files changed

+116/−87 lines, 21 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,5 +1,10 @@ # Changelog for ghc-lib-parser-ex +## 0.20201001 released 2020-09-01+- Update to `ghc-lib-0.20201001`+- `GHCLIB_API_811` -> `GHCLIB_API_HEAD`+- Add support for `GHCLIB_API_900`+ ## 0.20200901 released 2020-09-01 - Update to `ghc-lib-0.20200901` 
README.md view
@@ -27,7 +27,7 @@ ``` Run `stack runhaskell --package extra --package optparse-applicative CI.hs -- --help` for more options. -To run [`hlint`](https://github.com/ndmitchell/hlint) on this repository, `hlint --cpp-include cbits --cpp-define GHCLIB_API_XXX .` (where `XXX` at this time is one of `808`, `810` or `811`).+To run [`hlint`](https://github.com/ndmitchell/hlint) on this repository, `hlint --cpp-include cbits --cpp-define GHCLIB_API_XXX .` (where `XXX` at this time is one of `808`, `810` or `900`).  ## Releasing `ghc-lib-parser-ex` (notes for maintainers) 
cbits/ghclib_api.h view
@@ -6,23 +6,27 @@ #if !defined(GHCLIB_API_H) #  define GHCLIB_API_H -#  if !defined(GHCLIB_API_811) && !defined(GHCLIB_API_810) && !defined(GHCLIB_API_808)+#  if !defined (GHCLIB_API_HEAD) && !defined (GHCLIB_API_900) && !defined (GHCLIB_API_810) && !defined (GHCLIB_API_808) #    if defined(MIN_VERSION_ghc_lib_parser)-#       if !MIN_VERSION_ghc_lib_parser(1,  0,  0)-#         define GHCLIB_API_811-#       elif MIN_VERSION_ghc_lib_parser(8, 10, 0)+#       if !MIN_VERSION_ghc_lib_parser( 1,  0,  0)+#         define GHCLIB_API_HEAD+#       elif MIN_VERSION_ghc_lib_parser(9,  0,  0)+#         define GHCLIB_API_900+#       elif MIN_VERSION_ghc_lib_parser(8, 10,  0) #         define GHCLIB_API_810-#       elif MIN_VERSION_ghc_lib_parser(8,  8, 0)+#       elif MIN_VERSION_ghc_lib_parser(8,  8,  0) #         define GHCLIB_API_808 #       else #         error Unsupported GHC API version #      endif #    else #      if __GLASGOW_HASKELL__   == 811-#        define GHCLIB_API_811+#        define GHCLIB_API_HEAD+#      elif __GLASGOW_HASKELL__ == 900+#        define GHCLIB_API_900 #      elif __GLASGOW_HASKELL__ == 810 #        define GHCLIB_API_810-#      elif __GLASGOW_HASKELL__  == 808+#      elif __GLASGOW_HASKELL__ == 808 #        define GHCLIB_API_808 #      else #        error Unsupported GHC API version
ghc-lib-parser-ex.cabal view
@@ -1,6 +1,6 @@ cabal-version: >= 1.18 name:           ghc-lib-parser-ex-version:        0.20200901+version:        0.20201001 description:    Please see the README on GitHub at <https://github.com/shayne-fletcher/ghc-lib-parser-ex#readme> homepage:       https://github.com/shayne-fletcher/ghc-lib-parser-ex#readme bug-reports:    https://github.com/shayne-fletcher/ghc-lib-parser-ex/issues
src/Language/Haskell/GhclibParserEx/Dump.hs view
@@ -17,7 +17,7 @@  #if !defined(MIN_VERSION_ghc_lib_parser) -- Using native ghc.-#  if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#  if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_810) import GHC.Hs.Dump #  else import HsDumpAst@@ -25,7 +25,7 @@ #else -- Using ghc-lib-parser. Recent versions will include -- GHC.Hs.Dump (it got moved in from ghc-lib on 2020-02-05).-# if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+# if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) import GHC.Hs.Dump #  else -- For simplicity, just assume it's missing from 8.8 ghc-lib-parser@@ -40,7 +40,7 @@ import Name import DataCon import SrcLoc-#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) import GHC.Hs #else import HsSyn
src/Language/Haskell/GhclibParserEx/Fixity.hs view
@@ -16,7 +16,7 @@   , infixr_, infixl_, infix_, fixity   ) where -#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) import GHC.Hs import GHC.Types.Basic import GHC.Types.Name.Reader@@ -39,7 +39,7 @@ import Data.Data hiding (Fixity) import Data.Generics.Uniplate.Data -#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) noExt :: NoExtField noExt = noExtField #endif@@ -59,7 +59,7 @@ -- LPat and Pat have gone through a lot of churn. See -- https://gitlab.haskell.org/ghc/ghc/merge_requests/1925 for details. patFix :: [(String, Fixity)] -> LPat GhcPs -> LPat GhcPs-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) patFix fixities (L loc (ConPat _ op (InfixCon pat1 pat2))) =   L loc (mkConOpPat (getFixities fixities) op (findFixity' (getFixities fixities) op) pat1 pat2) #elif defined (GHCLIB_API_810)@@ -76,26 +76,26 @@   -> Located RdrName -> Fixity   -> LPat GhcPs -> LPat GhcPs   -> Pat GhcPs-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) mkConOpPat fs op2 fix2 p1@(L loc (ConPat _ op1 (InfixCon p11 p12))) p2 #elif defined (GHCLIB_API_810) mkConOpPat fs op2 fix2 p1@(L loc (ConPatIn op1 (InfixCon p11 p12))) p2 #else mkConOpPat fs op2 fix2 p1@(dL->L loc (ConPatIn op1 (InfixCon p11 p12))) p2 #endif-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)   | nofix_error = ConPat noExtField op2 (InfixCon p1 p2) #else   | nofix_error = ConPatIn op2 (InfixCon p1 p2) #endif-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)   | associate_right = ConPat noExtField op1 (InfixCon p11 (L loc (mkConOpPat fs op2 fix2 p12 p2))) #elif defined (GHCLIB_API_810)   | associate_right = ConPatIn op1 (InfixCon p11 (L loc (mkConOpPat fs op2 fix2 p12 p2))) #else   | associate_right = ConPatIn op1 (InfixCon p11 (cL loc (mkConOpPat fs op2 fix2 p12 p2))) #endif-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)   | otherwise = ConPat noExtField op2 (InfixCon p1 p2) #else   | otherwise = ConPatIn op2 (InfixCon p1 p2)@@ -103,7 +103,7 @@   where     fix1 = findFixity' fs op1     (nofix_error, associate_right) = compareFixity fix1 fix2-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) mkConOpPat _ op _ p1 p2 = ConPat noExtField op (InfixCon p1 p2) #else mkConOpPat _ op _ p1 p2 = ConPatIn op (InfixCon p1 p2)@@ -208,12 +208,12 @@ fixity :: FixityDirection -> Int -> [String] -> [(String, Fixity)] fixity a p = map (,Fixity (SourceText "") p a) -#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) fixitiesFromModule :: Located HsModule -> [(String, Fixity)] #else fixitiesFromModule :: Located (HsModule GhcPs) -> [(String, Fixity)] #endif-#if defined(GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) fixitiesFromModule (L _ (HsModule _ _ _ _ decls _ _)) = concatMap f decls #else fixitiesFromModule (L _ (HsModule _ _ _ decls _ _)) = concatMap f decls
src/Language/Haskell/GhclibParserEx/GHC/Driver/Flags.hs view
@@ -3,7 +3,7 @@ #include "ghclib_api.h" module Language.Haskell.GhclibParserEx.GHC.Driver.Flags () where -#if !defined(GHCLIB_API_811)+#if !defined (GHCLIB_API_HEAD) && !defined (GHCLIB_API_900) import DynFlags #endif 
src/Language/Haskell/GhclibParserEx/GHC/Driver/Session.hs view
@@ -14,10 +14,10 @@     , parsePragmasIntoDynFlags   ) where -#if defined(GHCLIB_API_808) || defined(GHCLIB_API_810)+#if defined (GHCLIB_API_808) || defined (GHCLIB_API_810) import qualified GHC.LanguageExtensions as LangExt #endif-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) import GHC.Utils.Panic import GHC.Parser.Header import GHC.Data.StringBuffer
src/Language/Haskell/GhclibParserEx/GHC/Hs.hs view
@@ -9,11 +9,11 @@  ) where -#if defined(GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) import GHC.Hs import GHC.Unit.Module import GHC.Types.SrcLoc-#elif defined(GHCLIB_API_810)+#elif defined (GHCLIB_API_810) import GHC.Hs import Module import SrcLoc@@ -23,7 +23,7 @@ import SrcLoc #endif -#if defined(GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) modName :: Located HsModule -> String #else modName :: Located (HsModule GhcPs) -> String
src/Language/Haskell/GhclibParserEx/GHC/Hs/Binds.hs view
@@ -7,7 +7,7 @@   ) where -#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) import GHC.Hs.Binds import GHC.Hs.Extension #else
src/Language/Haskell/GhclibParserEx/GHC/Hs/Decls.hs view
@@ -7,12 +7,12 @@     isNewType, isForD, isDerivD, isClsDefSig   ) where -#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) import GHC.Hs #else import HsSyn #endif-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) import GHC.Types.SrcLoc #else import SrcLoc
src/Language/Haskell/GhclibParserEx/GHC/Hs/Expr.hs view
@@ -16,12 +16,12 @@   fromChar   ) where -#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) import GHC.Hs #else import HsSyn #endif-#if defined(GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) import GHC.Types.SrcLoc import GHC.Types.Name.Reader import GHC.Types.Name@@ -99,7 +99,7 @@ isParComp = \case ParStmt{} -> True; _ -> False  isMDo :: HsStmtContext Name -> Bool-#if defined(GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) isMDo = \case MDoExpr _ -> True; _ -> False #else isMDo = \case MDoExpr -> True; _ -> False@@ -138,7 +138,7 @@ -- Field has a '_' as in '{foo=_} or is punned e.g. '{foo}'. isFieldWildcard :: LHsRecField GhcPs (LHsExpr GhcPs) -> Bool isFieldWildcard = \case-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)   (L _ HsRecField {hsRecFieldArg=(L _ (HsUnboundVar _ s))}) -> occNameString s == "_" #elif defined (GHCLIB_API_810)   (L _ HsRecField {hsRecFieldArg=(L _ (HsUnboundVar _ _))}) -> True@@ -165,7 +165,7 @@ varToStr _ = ""  strToVar :: String -> LHsExpr GhcPs-#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) strToVar x = noLoc $ HsVar noExtField (noLoc $ mkRdrUnqual (mkVarOcc x)) #else strToVar x = noLoc $ HsVar noExt (noLoc $ mkRdrUnqual (mkVarOcc x))
src/Language/Haskell/GhclibParserEx/GHC/Hs/ExtendInstances.hs view
@@ -18,9 +18,11 @@ -- representations rather than the terms themselves, leads to -- identical results. -#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) import GHC.Utils.Outputable+#  if !defined(GHCLIB_API_900) import GHC.Driver.Ppr+#  endif #else import Outputable #endif@@ -40,7 +42,7 @@ -- string representations. toStr :: Data a => HsExtendInstances a -> String toStr (HsExtendInstances e) =-#if defined(GHCLIB_API_811)+#if defined(GHCLIB_API_HEAD)   showPprUnsafe $ showAstData BlankSrcSpan e #else   showSDocUnsafe $ showAstData BlankSrcSpan e@@ -58,7 +60,7 @@ -- Use 'ppr' for 'Show'. instance Outputable a => Show (HsExtendInstances a) where   show (HsExtendInstances e) =-#if defined(GHCLIB_API_811)+#if defined(GHCLIB_API_HEAD)     showPprUnsafe $ ppr e #else     showSDocUnsafe $ ppr e
src/Language/Haskell/GhclibParserEx/GHC/Hs/ImpExp.hs view
@@ -14,7 +14,7 @@   ) where -#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) import GHC.Hs.ImpExp import GHC.Types.Name.Reader #elif defined (GHCLIB_API_810)@@ -29,7 +29,7 @@ isPatSynIE IEPattern{} = True isPatSynIE _ = False -#if defined(MIN_VERSION_ghc_lib_parser)+#if defined (MIN_VERSION_ghc_lib_parser) #  if !MIN_VERSION_ghc_lib_parser(1,  0,  0) || MIN_VERSION_ghc_lib_parser(8, 10, 0) isImportQualifiedPost :: ImportDeclQualifiedStyle -> Bool isImportQualifiedPost QualifiedPost = True
src/Language/Haskell/GhclibParserEx/GHC/Hs/Pat.hs view
@@ -11,12 +11,12 @@   , isPFieldWildcard, isPWildcard, isPFieldPun, isPatTypeSig, isPBangPat, isPViewPat  ) where -#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) import GHC.Hs #else import HsSyn #endif-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) import GHC.Types.SrcLoc import GHC.Builtin.Types import GHC.Types.Name.Reader@@ -31,7 +31,7 @@ #endif  patToStr :: LPat GhcPs -> String-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) patToStr (L _ (ConPat _ (L _ x) (PrefixCon []))) | occNameString (rdrNameOcc x) == "True" = "True" patToStr (L _ (ConPat _ (L _ x) (PrefixCon []))) | occNameString (rdrNameOcc x) == "False" = "False" patToStr (L _ (ConPat _ (L _ x) (PrefixCon []))) | occNameString (rdrNameOcc x) == "[]" = "[]"@@ -51,41 +51,41 @@ strToPat :: String -> LPat GhcPs strToPat z   | z == "True"  =-#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)   noLoc $ #endif-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)     ConPat noExtField (noLoc true_RDR) (PrefixCon []) #else     ConPatIn (noLoc true_RDR) (PrefixCon []) #endif   | z == "False" =-#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)   noLoc $ #endif-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)     ConPat noExtField (noLoc false_RDR) (PrefixCon []) #else     ConPatIn (noLoc false_RDR) (PrefixCon []) #endif   | z == "[]"    =-#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)   noLoc $ #endif-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)     ConPat noExtField (noLoc $ nameRdrName nilDataConName) (PrefixCon []) #else     ConPatIn (noLoc $ nameRdrName nilDataConName) (PrefixCon []) #endif   | otherwise =-#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)       noLoc $ VarPat noExtField (noLoc $ mkVarUnqual (fsLit z)) #else       VarPat noExt (noLoc $ mkVarUnqual (fsLit z)) #endif  fromPChar :: LPat GhcPs -> Maybe Char-#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) fromPChar (L _ (LitPat _ (HsChar _ x))) = Just x #else fromPChar (dL -> L _ (LitPat _ (HsChar _ x))) = Just x@@ -99,7 +99,7 @@  -- Field has a '_' as in '{foo=_} or is punned e.g. '{foo}'. isPFieldWildcard :: LHsRecField GhcPs (LPat GhcPs) -> Bool-#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) isPFieldWildcard (L _ HsRecField {hsRecFieldArg=L _ WildPat {}}) = True isPFieldWildcard (L _ HsRecField {hsRecPun=True}) = True isPFieldWildcard (L _ HsRecField {}) = False@@ -110,7 +110,7 @@ #endif  isPWildcard :: LPat GhcPs -> Bool-#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) isPWildcard (L _ (WildPat _)) = True #else isPWildcard (dL -> L _ (WildPat _)) = True@@ -118,7 +118,7 @@ isPWildcard _ = False  isPFieldPun :: LHsRecField GhcPs (LPat GhcPs) -> Bool-#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) isPFieldPun (L _ HsRecField {hsRecPun=True}) = True #else isPFieldPun (dL -> L _ HsRecField {hsRecPun=True}) = True@@ -126,7 +126,7 @@ isPFieldPun _ = False  isPatTypeSig, isPBangPat, isPViewPat :: LPat GhcPs -> Bool-#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) isPatTypeSig (L _ SigPat{}) = True; isPatTypeSig _ = False isPBangPat (L _ BangPat{}) = True; isPBangPat _ = False isPViewPat (L _ ViewPat{}) = True; isPViewPat _ = False
src/Language/Haskell/GhclibParserEx/GHC/Hs/Types.hs view
@@ -8,12 +8,12 @@   , isTyQuasiQuote, isUnboxedTuple   ) where -#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) import GHC.Hs #else import HsSyn #endif-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) import GHC.Types.SrcLoc #else import SrcLoc
src/Language/Haskell/GhclibParserEx/GHC/Parser.hs view
@@ -22,12 +22,15 @@   )   where -#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) import GHC.Hs #else import HsSyn #endif-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD)+import GHC.Driver.Config+#endif+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) import GHC.Parser.PostProcess import GHC.Driver.Session import GHC.Data.StringBuffer@@ -60,16 +63,20 @@   where     location = mkRealSrcLoc (mkFastString "<string>") 1 1     buffer = stringToStringBuffer str-    parseState = mkPState flags buffer location--#if defined (GHCLIB_API_811)+    parseState =+#if defined (GHCLIB_API_HEAD)+      initParserState (initParserOpts flags) buffer location+#else+      mkPState flags buffer location+#endif+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) parseModule :: String -> DynFlags -> ParseResult (Located HsModule) #else parseModule :: String -> DynFlags -> ParseResult (Located (HsModule GhcPs)) #endif parseModule = parse Parser.parseModule -#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) parseSignature :: String -> DynFlags -> ParseResult (Located HsModule) #else parseSignature :: String -> DynFlags -> ParseResult (Located (HsModule GhcPs))@@ -89,12 +96,12 @@ parseDeclaration = parse Parser.parseDeclaration  parseExpression :: String -> DynFlags -> ParseResult (LHsExpr GhcPs)-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) parseExpression s flags =   case parse Parser.parseExpression s flags of     POk s e -> unP (runPV . unECP $ e) s     PFailed ps -> PFailed ps-#elif defined (GHCLIB_API_810)+#elif defined (GHCLIB_API_810) || defined (GHCLIB_API_900) parseExpression s flags =   case parse Parser.parseExpression s flags of     POk s e -> unP (runECP_P e) s@@ -118,14 +125,14 @@ parseType :: String -> DynFlags -> ParseResult (LHsType GhcPs) parseType = parse Parser.parseType -#if defined(GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) parseHeader :: String -> DynFlags -> ParseResult (Located HsModule) #else parseHeader :: String -> DynFlags -> ParseResult (Located (HsModule GhcPs)) #endif parseHeader = parse Parser.parseHeader -#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) parseFile :: String           -> DynFlags           -> String@@ -141,4 +148,9 @@   where     location = mkRealSrcLoc (mkFastString filename) 1 1     buffer = stringToStringBuffer str-    parseState = mkPState flags buffer location+    parseState =+#if defined (GHCLIB_API_HEAD)+      initParserState (initParserOpts flags) buffer location+#else+      mkPState flags buffer location+#endif
src/Language/Haskell/GhclibParserEx/GHC/Settings/Config.hs view
@@ -11,7 +11,7 @@   ) where -#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) import GHC.Settings.Config import GHC.Driver.Session import GHC.Utils.Fingerprint@@ -32,7 +32,7 @@  fakeSettings :: Settings fakeSettings = Settings-#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)|| defined (GHCLIB_API_810)   { sGhcNameVersion=ghcNameVersion   , sFileSettings=fileSettings   , sTargetPlatform=platform@@ -49,7 +49,7 @@   } #endif   where-#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)|| defined (GHCLIB_API_810)     toolSettings = ToolSettings {       toolSettings_opt_P_fingerprint=fingerprint0       }@@ -62,7 +62,7 @@ #endif     platform =       Platform{-#if defined(GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)     -- It doesn't matter what values we write here as these fields are     -- not referenced for our purposes. However the fields are strict     -- so we must say something.@@ -73,13 +73,15 @@       , platformIsCrossCompiling=False       , platformLeadingUnderscore=False       , platformTablesNextToCode=False+#  if !defined (GHCLIB_API_900)       , platformConstants=platformConstants+#  endif       , #endif-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD)         platformWordSize=PW8       , platformArchOS=ArchOS {archOS_arch=ArchUnknown, archOS_OS=OSUnknown}-#elif defined (GHCLIB_API_810)+#elif defined (GHCLIB_API_810) || defined (GHCLIB_API_900)         platformWordSize=PW8       , platformMini=PlatformMini {platformMini_arch=ArchUnknown, platformMini_os=OSUnknown} #else@@ -91,7 +93,7 @@     platformConstants =       PlatformConstants{pc_DYNAMIC_BY_DEFAULT=False,pc_WORD_SIZE=8} -#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)|| defined (GHCLIB_API_810) fakeLlvmConfig :: LlvmConfig fakeLlvmConfig = LlvmConfig [] [] #else
src/Language/Haskell/GhclibParserEx/GHC/Types/Name/Reader.hs view
@@ -9,7 +9,7 @@  ) where -#if defined(GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) import GHC.Types.SrcLoc import GHC.Types.Name import GHC.Types.Name.Reader
src/Language/Haskell/GhclibParserEx/GHC/Utils/Outputable.hs view
@@ -8,16 +8,18 @@ ) where -#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) import GHC.Utils.Outputable+#if !defined (GHCLIB_API_900) import GHC.Driver.Ppr+#endif #else import Outputable #endif  unsafePrettyPrint :: Outputable a => a -> String unsafePrettyPrint =-#if defined(GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD)   showPprUnsafe . ppr #else   showSDocUnsafe . ppr
test/Test.hs view
@@ -38,17 +38,19 @@ import Language.Haskell.GhclibParserEx.GHC.Driver.Session import Language.Haskell.GhclibParserEx.GHC.Types.Name.Reader -#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) import GHC.Hs #else import HsSyn #endif-#if defined (GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) import GHC.Types.SrcLoc import GHC.Driver.Session import GHC.Parser.Lexer import GHC.Utils.Outputable+#  if !defined (GHCLIB_API_900) import GHC.Driver.Ppr+#  endif import GHC.Utils.Error import GHC.Types.Name.Reader import GHC.Types.Name.Occurrence@@ -66,7 +68,7 @@ import Bag #endif -#if defined(GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) showSDocUnsafe :: SDoc -> String showSDocUnsafe = showPprUnsafe #endif@@ -100,7 +102,7 @@       let (wrns, errs) = getMessages s flags       when (not (null errs) || not (null wrns)) $         assertFailure (report flags wrns ++ report flags errs)-#if defined (GHCLIB_API_811) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)     PFailed s -> assertFailure (report flags $ snd (getMessages s flags)) #else     PFailed _ loc err -> assertFailure (report flags $ unitBag $ mkPlainErrMsg flags loc err)@@ -160,10 +162,10 @@         Right flags -> chkParseResult report flags $ parseFile foo flags s   ]   where-    flags = unsafeGlobalDynFlags+    flags = defaultDynFlags fakeSettings fakeLlvmConfig     report flags msgs = concat [ showSDoc flags msg | msg <- pprErrMsgBagWithLoc msgs ] -#if defined(GHCLIB_API_811)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) moduleTest :: String -> DynFlags -> (Located HsModule -> IO ()) -> IO () #else moduleTest :: String -> DynFlags -> (Located (HsModule GhcPs) -> IO ()) -> IO ()@@ -344,7 +346,7 @@         Left msg -> assertFailure msg         Right flags -> chkParseResult report flags $ parseFile foo flags s #if defined (MIN_VERSION_ghc_lib_parser)-#  if  !MIN_VERSION_ghc_lib_parser(1,  0,  0) || MIN_VERSION_ghc_lib_parser(8, 10, 0)+#  if !MIN_VERSION_ghc_lib_parser(1,  0,  0) || MIN_VERSION_ghc_lib_parser(8, 10, 0)   , testCase "ImportQualifiedPost" $ do       case parseImport "import Foo qualified" (flags `xopt_set` ImportQualifiedPost) of         POk _ (L _ decl) -> assertBool "expected postpositive" (isImportQualifiedPost . ideclQualified $ decl)@@ -358,7 +360,7 @@ #endif   ]   where-    flags = unsafeGlobalDynFlags+    flags = defaultDynFlags fakeSettings fakeLlvmConfig     report flags msgs = concat [ showSDoc flags msg | msg <- pprErrMsgBagWithLoc msgs ]  nameTests :: TestTree