ghc-lib-parser-ex 9.4.0.0 → 9.6.0.0
raw patch · 21 files changed
+156/−127 lines, 21 filesdep ~ghcdep ~ghc-lib-parser
Dependency ranges changed: ghc, ghc-lib-parser
Files
- ChangeLog.md +15/−0
- README.md +1/−1
- cbits/ghclib_api.h +6/−1
- ghc-lib-parser-ex.cabal +11/−11
- src/Language/Haskell/GhclibParserEx/Dump.hs +4/−4
- src/Language/Haskell/GhclibParserEx/Fixity.hs +19/−19
- src/Language/Haskell/GhclibParserEx/GHC/Driver/Flags.hs +1/−1
- src/Language/Haskell/GhclibParserEx/GHC/Driver/Session.hs +4/−4
- src/Language/Haskell/GhclibParserEx/GHC/Hs.hs +2/−2
- src/Language/Haskell/GhclibParserEx/GHC/Hs/Binds.hs +1/−1
- src/Language/Haskell/GhclibParserEx/GHC/Hs/Decls.hs +2/−2
- src/Language/Haskell/GhclibParserEx/GHC/Hs/Expr.hs +22/−16
- src/Language/Haskell/GhclibParserEx/GHC/Hs/ExtendInstances.hs +3/−3
- src/Language/Haskell/GhclibParserEx/GHC/Hs/ImpExp.hs +4/−4
- src/Language/Haskell/GhclibParserEx/GHC/Hs/Pat.hs +18/−18
- src/Language/Haskell/GhclibParserEx/GHC/Hs/Type.hs +2/−2
- src/Language/Haskell/GhclibParserEx/GHC/Parser.hs +8/−8
- src/Language/Haskell/GhclibParserEx/GHC/Settings/Config.hs +8/−8
- src/Language/Haskell/GhclibParserEx/GHC/Types/Name/Reader.hs +6/−6
- src/Language/Haskell/GhclibParserEx/GHC/Utils/Outputable.hs +2/−2
- test/Test.hs +17/−14
ChangeLog.md view
@@ -1,5 +1,20 @@ # Changelog for ghc-lib-parser-ex +# 9.6.0.0 released+- Add support for ghc-9.6 series: `GHCLIB_API_906`++## 0.20221201 released+- Update to `ghc-lib-parser-0.20221201`++## 0.20221101 released+- Update to `ghc-lib-parser-0.20221101`++## 0.20221001 released+- Update to `ghc-lib-parser-0.20221001`++## 0.20220901 released+- Update to `ghc-lib-parser-0.20220901`+ ## 9.4.0.0 released - Update to `ghc-lib-parser-9.4.1.20220807`
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`, `900`, `902`, `904` or `HEAD`).+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`, `900`, `902`, `904`, `906` or `HEAD`). ## Releasing `ghc-lib-parser-ex` (notes for maintainers)
cbits/ghclib_api.h view
@@ -7,6 +7,7 @@ # define GHCLIB_API_H # if !(defined (GHCLIB_API_HEAD) \+ || defined (GHCLIB_API_906) \ || defined (GHCLIB_API_904) \ || defined (GHCLIB_API_902) \ || defined (GHCLIB_API_900) \@@ -15,6 +16,8 @@ # if defined(MIN_VERSION_ghc_lib_parser) # if !MIN_VERSION_ghc_lib_parser( 1, 0, 0) # define GHCLIB_API_HEAD+# elif MIN_VERSION_ghc_lib_parser(9, 6, 0)+# define GHCLIB_API_906 # elif MIN_VERSION_ghc_lib_parser(9, 4, 0) # define GHCLIB_API_904 # elif MIN_VERSION_ghc_lib_parser(9, 2, 0)@@ -29,8 +32,10 @@ # error Unsupported GHC API version # endif # else-# if __GLASGOW_HASKELL__ == 905+# if __GLASGOW_HASKELL__ == 907 # define GHCLIB_API_HEAD+# elif __GLASGOW_HASKELL__ == 906+# define GHCLIB_API_906 # elif __GLASGOW_HASKELL__ == 904 # define GHCLIB_API_904 # elif __GLASGOW_HASKELL__ == 902
ghc-lib-parser-ex.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: ghc-lib-parser-ex-version: 9.4.0.0+version: 9.6.0.0 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@@ -59,24 +59,24 @@ uniplate >= 1.5, bytestring >= 0.10.8.2, containers >= 0.5.8.1- if flag(auto) && impl(ghc >= 9.4.0) && impl(ghc < 9.5.0)+ if flag(auto) && impl(ghc >= 9.6.0) && impl(ghc < 9.7.0) build-depends:- ghc == 9.4.*,+ ghc == 9.6.*, ghc-boot-th, ghc-boot else if flag(auto) build-depends:- ghc-lib-parser == 9.4.*+ ghc-lib-parser == 9.6.* else if flag(no-ghc-lib) build-depends:- ghc == 9.4.*,+ ghc == 9.6.*, ghc-boot-th, ghc-boot else build-depends:- ghc-lib-parser == 9.4.*+ ghc-lib-parser == 9.6.* include-dirs: cbits install-includes:@@ -103,22 +103,22 @@ , extra >=1.6 , uniplate >= 1.6.12 , ghc-lib-parser-ex- if flag(auto) && impl(ghc >= 9.4.0) && impl(ghc < 9.5.0)+ if flag(auto) && impl(ghc >= 9.6.0) && impl(ghc < 9.7.0) build-depends:- ghc == 9.4.*,+ ghc == 9.6.*, ghc-boot-th, ghc-boot else if flag(auto) build-depends:- ghc-lib-parser == 9.4.*+ ghc-lib-parser == 9.6.* else if flag(no-ghc-lib) build-depends:- ghc == 9.4.*,+ ghc == 9.6.*, ghc-boot-th, ghc-boot else build-depends:- ghc-lib-parser == 9.4.*+ ghc-lib-parser == 9.6.* default-language: Haskell2010
src/Language/Haskell/GhclibParserEx/Dump.hs view
@@ -13,14 +13,14 @@ module Language.Haskell.GhclibParserEx.Dump( showAstData , BlankSrcSpan(..)-#if defined(GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined(GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) , BlankEpAnnotations(..) #endif ) where #if !defined(MIN_VERSION_ghc_lib_parser) -- Using native ghc.-# if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined(GHCLIB_API_900) || defined (GHCLIB_API_810)+# if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined(GHCLIB_API_900) || defined (GHCLIB_API_810) import GHC.Hs.Dump # else import HsDumpAst@@ -28,7 +28,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_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)+# if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || 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@@ -43,7 +43,7 @@ import Name import DataCon import SrcLoc-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) import GHC.Hs #else import HsSyn
src/Language/Haskell/GhclibParserEx/Fixity.hs view
@@ -16,9 +16,9 @@ , infixr_, infixl_, infix_, fixity ) where -#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) import GHC.Hs-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) import GHC.Types.Fixity import GHC.Types.SourceText #else@@ -64,7 +64,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_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || 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)@@ -78,7 +78,7 @@ mkConOpPat :: [(String, Fixity)]-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) -> LocatedN RdrName #else -> Located RdrName@@ -86,21 +86,21 @@ -> Fixity -> LPat GhcPs -> LPat GhcPs -> Pat GhcPs-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || 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_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) | nofix_error = ConPat noAnn op2 (InfixCon p1 p2) #elif 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_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) | associate_right = ConPat noAnn op1 (InfixCon p11 (L loc (mkConOpPat fs op2 fix2 p12 p2))) #elif defined (GHCLIB_API_900) | associate_right = ConPat noExtField op1 (InfixCon p11 (L loc (mkConOpPat fs op2 fix2 p12 p2)))@@ -109,7 +109,7 @@ #else | associate_right = ConPatIn op1 (InfixCon p11 (cL loc (mkConOpPat fs op2 fix2 p12 p2))) #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) | otherwise = ConPat noAnn op2 (InfixCon p1 p2) #elif defined (GHCLIB_API_900) | otherwise = ConPat noExtField op2 (InfixCon p1 p2)@@ -119,7 +119,7 @@ where fix1 = findFixity' fs op1 (nofix_error, associate_right) = compareFixity fix1 fix2-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) mkConOpPat _ op _ p1 p2 = ConPat noAnn op (InfixCon p1 p2) #elif defined (GHCLIB_API_900) mkConOpPat _ op _ p1 p2 = ConPat noExtField op (InfixCon p1 p2)@@ -129,7 +129,7 @@ mkOpApp :: [(String, Fixity)]-#if defined(GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) -> SrcSpanAnnA #else -> SrcSpan@@ -140,14 +140,14 @@ -> LHsExpr GhcPs -- (e11 `op1` e12) `op2` e2 mkOpApp fs loc e1@(L _ (OpApp x1 e11 op1 e12)) op2 fix2 e2-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) | nofix_error = L loc (OpApp noAnn e1 op2 e2) #else | nofix_error = L loc (OpApp noExt e1 op2 e2) #endif | associate_right = L loc (OpApp x1 e11 op1 (mkOpApp fs loc' e12 op2 fix2 e2 )) where-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) loc'= combineLocsA e12 e2 #else loc'= combineLocs e12 e2@@ -156,18 +156,18 @@ (nofix_error, associate_right) = compareFixity fix1 fix2 -- (- neg_arg) `op` e2 mkOpApp fs loc e1@(L _ (NegApp _ neg_arg neg_name)) op2 fix2 e2-#if defined(GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) | nofix_error = L loc (OpApp noAnn e1 op2 e2) #else | nofix_error = L loc (OpApp noExt e1 op2 e2) #endif-#if defined(GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) | associate_right = L loc (NegApp noAnn (mkOpApp fs loc' neg_arg op2 fix2 e2) neg_name) #else | associate_right = L loc (NegApp noExt (mkOpApp fs loc' neg_arg op2 fix2 e2) neg_name) #endif where-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) loc' = combineLocsA neg_arg e2 #else loc' = combineLocs neg_arg e2@@ -175,7 +175,7 @@ (nofix_error, associate_right) = compareFixity negateFixity fix2 -- e1 `op` - neg_arg mkOpApp _ loc e1 op1 fix1 e2@(L _ NegApp {}) -- NegApp can occur on the right.-#if defined(GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) | not associate_right = L loc (OpApp noAnn e1 op1 e2)-- We *want* right association. #else | not associate_right = L loc (OpApp noExt e1 op1 e2)-- We *want* right association.@@ -183,7 +183,7 @@ where (_, associate_right) = compareFixity fix1 negateFixity -- Default case, no rearrangment.-#if defined(GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) mkOpApp _ loc e1 op _fix e2 = L loc (OpApp noAnn e1 op e2) #else mkOpApp _ loc e1 op _fix e2 = L loc (OpApp noExt e1 op e2)@@ -200,7 +200,7 @@ findFixity :: [(String, Fixity)] -> LHsExpr GhcPs -> Fixity findFixity fs r = askFix fs (getIdent r) -- Expressions. -#if defined(GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) findFixity' :: [(String, Fixity)] -> LocatedN RdrName -> Fixity #else findFixity' :: [(String, Fixity)] -> Located RdrName -> Fixity@@ -267,7 +267,7 @@ #else fixitiesFromModule :: Located (HsModule GhcPs) -> [(String, Fixity)] #endif-#if defined (GHCLIB_API_HEAD)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) fixitiesFromModule (L _ (HsModule _ _ _ _ decls)) = concatMap f decls #elif defined (GHCLIB_API_904) || defined(GHCLIB_API_902) 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_HEAD) || defined(GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900))+#if !(defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_906) || defined(GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)) import DynFlags #endif
src/Language/Haskell/GhclibParserEx/GHC/Driver/Session.hs view
@@ -17,12 +17,12 @@ #if defined (GHCLIB_API_808) || defined (GHCLIB_API_810) import qualified GHC.LanguageExtensions as LangExt #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) import GHC.Utils.Panic import GHC.Parser.Header import GHC.Data.StringBuffer import GHC.Driver.Session-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) import GHC.Types.SourceError #else import GHC.Driver.Types@@ -44,7 +44,7 @@ instance Ord Extension where compare = compare `on` fromEnum #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) import GHC.Driver.Config.Parser #endif @@ -161,7 +161,7 @@ -> IO (Either String DynFlags) parsePragmasIntoDynFlags flags (enable, disable) file str = catchErrors $ do-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) let (_, opts) = getOptions (initParserOpts flags) (stringToStringBuffer str) file #else
src/Language/Haskell/GhclibParserEx/GHC/Hs.hs view
@@ -9,9 +9,9 @@ ) where -#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) import GHC.Hs-# if !defined (GHCLIB_API_HEAD)+# if !defined (GHCLIB_API_HEAD) && !defined (GHCLIB_API_906) import GHC.Unit.Module # endif import GHC.Types.SrcLoc
src/Language/Haskell/GhclibParserEx/GHC/Hs/Binds.hs view
@@ -7,7 +7,7 @@ ) where -#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || 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_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) import GHC.Hs #else import HsSyn #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) import GHC.Types.SrcLoc #else import SrcLoc
src/Language/Haskell/GhclibParserEx/GHC/Hs/Expr.hs view
@@ -16,15 +16,18 @@ fromChar ) where -#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) import GHC.Hs #else import HsSyn #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) import GHC.Types.SourceText #endif+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906)+import Language.Haskell.GhclibParserEx.GHC.Types.Name.Reader+#endif import GHC.Types.SrcLoc import GHC.Types.Name.Reader import GHC.Types.Name@@ -60,7 +63,7 @@ isAnyApp x = isApp x || isOpApp x isLexeme = \case (L _ HsVar{}) -> True; (L _ HsOverLit{}) -> True; (L _ HsLit{}) -> True; _ -> False isLambda = \case (L _ HsLam{}) -> True; _ -> False-#if defined (GHCLIB_API_HEAD)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) isQuasiQuoteExpr = \case (L _ (HsUntypedSplice _ HsQuasiQuote{})) -> True; _ -> False #else isQuasiQuoteExpr = \case (L _ (HsSpliceE _ HsQuasiQuote{})) -> True; _ -> False@@ -74,7 +77,7 @@ (L _ HsLam{}) -> True (L _ ExplicitTuple{}) -> True (L _ ExplicitList{}) -> True-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) (L _ (HsPar _ _ x _)) -> isWHNF x #else (L _ (HsPar _ x)) -> isWHNF x@@ -88,7 +91,7 @@ isLCase = \case (L _ HsLamCase{}) -> True; _ -> False isOverLabel = \case (L _ HsOverLabel{}) -> True; _ -> False -#if defined (GHCLIB_API_HEAD)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) isQuasiQuoteSplice :: HsUntypedSplice GhcPs -> Bool #else isQuasiQuoteSplice :: HsSplice GhcPs -> Bool@@ -96,7 +99,7 @@ isQuasiQuoteSplice = \case HsQuasiQuote{} -> True; _ -> False -#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_901)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_901) isStrictMatch :: HsMatchContext GhcPs -> Bool #else isStrictMatch :: HsMatchContext RdrName -> Bool@@ -104,7 +107,7 @@ isStrictMatch = \case FunRhs{mc_strictness=SrcStrict} -> True; _ -> False -- Field is punned e.g. '{foo}'.-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) isFieldPun :: LHsFieldBind GhcPs (LFieldOcc GhcPs) (LHsExpr GhcPs) -> Bool isFieldPun = \case (L _ HsFieldBind {hfbPun=True}) -> True; _ -> False #else@@ -113,7 +116,7 @@ #endif -- Field puns in updates have a different type to field puns in -- constructions.-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) isFieldPunUpdate :: HsFieldBind (LAmbiguousFieldOcc GhcPs) (LHsExpr GhcPs) -> Bool isFieldPunUpdate = \case HsFieldBind {hfbPun=True} -> True; _ -> False #else@@ -132,7 +135,7 @@ isParComp = \case ParStmt{} -> True; _ -> False -- TODO: Seems `HsStmtContext (HsDoRn p)` on master right now.-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) isMDo :: HsDoFlavour -> Bool isMDo = \case MDoExpr _ -> True; _ -> False isMonadComp :: HsDoFlavour -> Bool@@ -174,7 +177,7 @@ _ -> False isSpliceDecl :: HsExpr GhcPs -> Bool-#if defined (GHCLIB_API_HEAD)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) isSpliceDecl = \case HsTypedSplice{} -> True HsUntypedSplice{} -> True@@ -193,13 +196,16 @@ isTransStmt = \case TransStmt{} -> True; _ -> False -- Field has a '_' as in '{foo=_} or is punned e.g. '{foo}'.-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) isFieldWildcard :: LHsFieldBind GhcPs (LFieldOcc GhcPs) (LHsExpr GhcPs) -> Bool #else isFieldWildcard :: LHsRecField GhcPs (LHsExpr GhcPs) -> Bool #endif isFieldWildcard = \case-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906)+-- Use `Language.Haskell.GhcLibParserEx.GHC.Types.Name.Reader`s `occNameStr` since `HsUnboundVar` now contains a `RdrName` not an `OccName`.+ (L _ HsFieldBind {hfbRHS=(L _ (HsUnboundVar _ s))}) -> occNameStr s == "_"+#elif defined (GHCLIB_API_904) (L _ HsFieldBind {hfbRHS=(L _ (HsUnboundVar _ s))}) -> occNameString s == "_" #elif defined(GHCLIB_API_902) || defined (GHCLIB_API_900) (L _ HsRecField {hsRecFieldArg=(L _ (HsUnboundVar _ s))}) -> occNameString s == "_"@@ -208,7 +214,7 @@ #else (L _ HsRecField {hsRecFieldArg=(L _ (EWildPat _))}) -> True #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) (L _ HsFieldBind {hfbPun=True}) -> True (L _ HsFieldBind {}) -> False #else@@ -221,7 +227,7 @@ isWholeFrac :: HsExpr GhcPs -> Bool -#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) isWholeFrac (HsLit _ (HsRat _ fl@FL{} _)) = denominator (rationalFromFractionalLit fl) == 1 isWholeFrac (HsOverLit _ (OverLit _ (HsFractional fl@FL {}) )) = denominator (rationalFromFractionalLit fl) == 1 #elif defined(GHCLIB_API_902)@@ -242,7 +248,7 @@ varToStr _ = "" strToVar :: String -> LHsExpr GhcPs-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) strToVar x = noLocA $ HsVar noExtField (noLocA $ mkRdrUnqual (mkVarOcc x)) #elif defined (GHCLIB_API_900) || defined (GHCLIB_API_810) strToVar x = noLoc $ HsVar noExtField (noLoc $ mkRdrUnqual (mkVarOcc x))
src/Language/Haskell/GhclibParserEx/GHC/Hs/ExtendInstances.hs view
@@ -18,7 +18,7 @@ -- representations rather than the terms themselves, leads to -- identical results. -#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) import GHC.Utils.Outputable #else import Outputable@@ -39,7 +39,7 @@ -- string representations. toStr :: Data a => HsExtendInstances a -> String toStr (HsExtendInstances e) =-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) showPprUnsafe $ showAstData BlankSrcSpan BlankEpAnnotations e #else showSDocUnsafe $ showAstData BlankSrcSpan e@@ -57,7 +57,7 @@ -- Use 'ppr' for 'Show'. instance Outputable a => Show (HsExtendInstances a) where show (HsExtendInstances e) =-#if defined(GHCLIB_API_HEAD) || defined(GHCLIB_API_902)+#if defined(GHCLIB_API_HEAD) || defined(GHCLIB_API_906) || defined(GHCLIB_API_902) showPprUnsafe $ ppr e #else showSDocUnsafe $ ppr e
src/Language/Haskell/GhclibParserEx/GHC/Hs/ImpExp.hs view
@@ -14,13 +14,13 @@ ) where -#if defined (GHCLIB_API_HEAD)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) import GHC.Hs.Extension (GhcPs) #endif -#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) import GHC.Hs.ImpExp-# if !defined (GHCLIB_API_HEAD)+# if !defined (GHCLIB_API_HEAD) && !defined (GHCLIB_API_906) import GHC.Types.Name.Reader # endif #elif defined (GHCLIB_API_810)@@ -31,7 +31,7 @@ import RdrName #endif -#if defined (GHCLIB_API_HEAD)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) isPatSynIE :: IEWrappedName GhcPs -> Bool #else isPatSynIE :: IEWrappedName RdrName -> Bool
src/Language/Haskell/GhclibParserEx/GHC/Hs/Pat.hs view
@@ -12,12 +12,12 @@ , isSplicePat ) where -#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) import GHC.Hs #else import HsSyn #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) import GHC.Types.SrcLoc import GHC.Builtin.Types import GHC.Types.Name.Reader@@ -32,7 +32,7 @@ #endif patToStr :: LPat GhcPs -> String-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) 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) == "[]" = "[]"@@ -57,12 +57,12 @@ strToPat :: String -> LPat GhcPs strToPat z | z == "True" =-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) noLocA $ #elif defined (GHCLIB_API_900) || defined (GHCLIB_API_810) noLoc $ #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) ConPat noAnn (noLocA true_RDR) (PrefixCon [] []) #elif defined (GHCLIB_API_900) ConPat noExtField (noLoc true_RDR) (PrefixCon [])@@ -70,12 +70,12 @@ ConPatIn (noLoc true_RDR) (PrefixCon []) #endif | z == "False" =-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) noLocA $ #elif defined (GHCLIB_API_900) || defined (GHCLIB_API_810) noLoc $ #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) ConPat noAnn (noLocA false_RDR) (PrefixCon [] []) #elif defined (GHCLIB_API_900) ConPat noExtField (noLoc false_RDR) (PrefixCon [])@@ -83,12 +83,12 @@ ConPatIn (noLoc false_RDR) (PrefixCon []) #endif | z == "[]" =-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) noLocA $ #elif defined (GHCLIB_API_900) || defined (GHCLIB_API_810) noLoc $ #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) ConPat noAnn (noLocA $ nameRdrName nilDataConName) (PrefixCon [] []) #elif defined (GHCLIB_API_900) ConPat noExtField (noLoc $ nameRdrName nilDataConName) (PrefixCon [])@@ -96,7 +96,7 @@ ConPatIn (noLoc $ nameRdrName nilDataConName) (PrefixCon []) #endif | otherwise =-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) noLocA $ VarPat noExtField (noLocA $ mkVarUnqual (fsLit z)) #elif defined (GHCLIB_API_900) || defined (GHCLIB_API_810) noLoc $ VarPat noExtField (noLoc $ mkVarUnqual (fsLit z))@@ -105,7 +105,7 @@ #endif fromPChar :: LPat GhcPs -> Maybe Char-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) fromPChar (L _ (LitPat _ (HsChar _ x))) = Just x #else fromPChar (dL -> L _ (LitPat _ (HsChar _ x))) = Just x@@ -118,12 +118,12 @@ hasPFieldsDotDot _ = False -- Field has a '_' as in '{foo=_} or is punned e.g. '{foo}'.-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) isPFieldWildcard :: LHsFieldBind GhcPs (LFieldOcc GhcPs) (LPat GhcPs) -> Bool #else isPFieldWildcard :: LHsRecField GhcPs (LPat GhcPs) -> Bool #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) isPFieldWildcard (L _ HsFieldBind {hfbRHS=L _ WildPat {}}) = True isPFieldWildcard (L _ HsFieldBind {hfbPun=True}) = True isPFieldWildcard (L _ HsFieldBind {}) = False@@ -138,19 +138,19 @@ #endif isPWildcard :: LPat GhcPs -> Bool-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) isPWildcard (L _ (WildPat _)) = True #else isPWildcard (dL -> L _ (WildPat _)) = True #endif isPWildcard _ = False -#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) isPFieldPun :: LHsFieldBind GhcPs (LFieldOcc GhcPs) (LPat GhcPs) -> Bool #else isPFieldPun :: LHsRecField GhcPs (LPat GhcPs) -> Bool #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) isPFieldPun (L _ HsFieldBind {hfbPun=True}) = True #elif defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) isPFieldPun (L _ HsRecField {hsRecPun=True}) = True@@ -160,7 +160,7 @@ isPFieldPun _ = False isPatTypeSig, isPBangPat, isPViewPat :: LPat GhcPs -> Bool-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || 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@@ -171,7 +171,7 @@ #endif isSplicePat :: LPat GhcPs -> Bool-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) isSplicePat (L _ SplicePat{}) = True; isSplicePat _ = False #else isSplicePat (dL -> L _ SplicePat{}) = True; isSplicePat _ = False
src/Language/Haskell/GhclibParserEx/GHC/Hs/Type.hs view
@@ -9,12 +9,12 @@ , isTyQuasiQuote, isUnboxedTuple, isKindTyApp ) where -#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) import GHC.Hs #else import HsSyn #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) import GHC.Types.SrcLoc #else import SrcLoc
src/Language/Haskell/GhclibParserEx/GHC/Parser.hs view
@@ -22,20 +22,20 @@ ) where -#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) import GHC.Hs #else import HsSyn #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) # if defined (GHCLIB_API_902) import GHC.Driver.Config # endif-# if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+# if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) import GHC.Driver.Config.Parser # endif #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) import GHC.Parser.PostProcess import GHC.Driver.Session import GHC.Data.StringBuffer@@ -69,7 +69,7 @@ location = mkRealSrcLoc (mkFastString "<string>") 1 1 buffer = stringToStringBuffer str parseState =-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) initParserState (initParserOpts flags) buffer location #else mkPState flags buffer location@@ -101,7 +101,7 @@ parseDeclaration = parse Parser.parseDeclaration parseExpression :: String -> DynFlags -> ParseResult (LHsExpr GhcPs)-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) parseExpression s flags = -- The need for annotations here came about first manifested with -- ghc-9.0.1@@ -130,7 +130,7 @@ parseStmt :: String -> DynFlags -> ParseResult (Maybe (LStmt GhcPs (LHsExpr GhcPs))) parseStmt = parse Parser.parseStmt -#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) parseIdentifier :: String -> DynFlags -> ParseResult (LocatedN RdrName) #else parseIdentifier :: String -> DynFlags -> ParseResult (Located RdrName)@@ -164,7 +164,7 @@ location = mkRealSrcLoc (mkFastString filename) 1 1 buffer = stringToStringBuffer str parseState =-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) initParserState (initParserOpts flags) buffer location #else mkPState flags buffer location
src/Language/Haskell/GhclibParserEx/GHC/Settings/Config.hs view
@@ -7,13 +7,13 @@ module Language.Haskell.GhclibParserEx.GHC.Settings.Config( fakeSettings-#if !defined (GHCLIB_API_HEAD)+#if !defined (GHCLIB_API_HEAD) && !defined (GHCLIB_API_906) , fakeLlvmConfig #endif ) where -#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) import GHC.Settings.Config import GHC.Driver.Session import GHC.Utils.Fingerprint@@ -34,12 +34,12 @@ fakeSettings :: Settings fakeSettings = Settings-#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)|| defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)|| defined (GHCLIB_API_810) { sGhcNameVersion=ghcNameVersion , sFileSettings=fileSettings , sTargetPlatform=platform , sPlatformMisc=platformMisc-# if !defined(GHCLIB_API_HEAD) && !defined(GHCLIB_API_904) && !defined(GHCLIB_API_902)+# if !defined(GHCLIB_API_HEAD) && !defined(GHCLIB_API_906) && !defined(GHCLIB_API_904) && !defined(GHCLIB_API_902) , sPlatformConstants=platformConstants # endif , sToolSettings=toolSettings@@ -53,7 +53,7 @@ } #endif where-#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)|| defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)|| defined (GHCLIB_API_810) toolSettings = ToolSettings { toolSettings_opt_P_fingerprint=fingerprint0 }@@ -65,7 +65,7 @@ } #endif platform =-#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) genericPlatform #else Platform{@@ -92,12 +92,12 @@ , platformUnregisterised=True } #endif-#if !defined(GHCLIB_API_HEAD) && !defined(GHCLIB_API_904) && !defined(GHCLIB_API_902)+#if !defined(GHCLIB_API_HEAD) && !defined(GHCLIB_API_906) && !defined(GHCLIB_API_904) && !defined(GHCLIB_API_902) platformConstants = PlatformConstants{pc_DYNAMIC_BY_DEFAULT=False,pc_WORD_SIZE=8} #endif -#if defined (GHCLIB_API_HEAD)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) -- Intentionally empty #elif defined(GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)|| defined (GHCLIB_API_810) fakeLlvmConfig :: LlvmConfig
src/Language/Haskell/GhclibParserEx/GHC/Types/Name/Reader.hs view
@@ -9,11 +9,11 @@ ) where -#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined(GHCLIB_API_904) || defined (GHCLIB_API_902) import GHC.Parser.Annotation #endif -#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined(GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) import GHC.Types.SrcLoc import GHC.Types.Name import GHC.Types.Name.Reader@@ -27,7 +27,7 @@ -- These names may not seem natural here but they work out in -- practice. The use of thse two functions is thoroughly ubiquitous. occNameStr :: RdrName -> String; occNameStr = occNameString . rdrNameOcc-#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined(GHCLIB_API_904) || defined (GHCLIB_API_902) rdrNameStr :: GHC.Parser.Annotation.LocatedN RdrName -> String #else rdrNameStr :: Located RdrName -> String@@ -35,7 +35,7 @@ rdrNameStr = occNameStr . unLoc -- Builtin type or data constructors.-#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined(GHCLIB_API_904) || defined (GHCLIB_API_902) isSpecial :: LocatedN RdrName -> Bool #else isSpecial :: Located RdrName -> Bool@@ -45,7 +45,7 @@ -- Coerce qualified names to unqualified (by discarding the -- qualifier).-#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined(GHCLIB_API_904) || defined (GHCLIB_API_902) unqual :: LocatedN RdrName -> LocatedN RdrName #else unqual :: Located RdrName -> Located RdrName@@ -54,7 +54,7 @@ unqual x = x -- Extract the occ name from a qualified/unqualified reader name.-#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined(GHCLIB_API_904) || defined (GHCLIB_API_902) fromQual :: LocatedN RdrName -> Maybe OccName #else fromQual :: Located RdrName -> Maybe OccName
src/Language/Haskell/GhclibParserEx/GHC/Utils/Outputable.hs view
@@ -8,7 +8,7 @@ ) where -#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) import GHC.Utils.Outputable #else import Outputable@@ -16,7 +16,7 @@ unsafePrettyPrint :: Outputable a => a -> String unsafePrettyPrint =-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) showPprUnsafe . ppr #else showSDocUnsafe . ppr
test/Test.hs view
@@ -17,7 +17,7 @@ import Data.List.Extra import Data.Maybe import Data.Generics.Uniplate.Data-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) import GHC.Data.Bag #if !defined (GHCLIB_API_902) import GHC.Driver.Errors.Types@@ -47,21 +47,21 @@ import Language.Haskell.GhclibParserEx.GHC.Driver.Session import Language.Haskell.GhclibParserEx.GHC.Types.Name.Reader -#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810) import GHC.Hs #else import HsSyn #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) import GHC.Types.SrcLoc import GHC.Driver.Session import GHC.Parser.Lexer-# if !defined (GHCLIB_API_HEAD)+# if !defined (GHCLIB_API_HEAD) && !defined (GHCLIB_API_906) import GHC.Utils.Outputable #endif # if !defined (GHCLIB_API_900) import GHC.Driver.Ppr-# if !defined (GHCLIB_API_HEAD) && !defined (GHCLIB_API_904)+# if !defined (GHCLIB_API_HEAD) && !defined (GHCLIB_API_906) && !defined (GHCLIB_API_904) import GHC.Parser.Errors.Ppr # endif # endif@@ -85,7 +85,7 @@ basicDynFlags :: DynFlags basicDynFlags = defaultDynFlags fakeSettings-#if !defined (GHCLIB_API_HEAD)+#if !defined (GHCLIB_API_HEAD) && !defined (GHCLIB_API_906) fakeLlvmConfig #endif @@ -113,8 +113,11 @@ writeFile relPath contents return relPath -#if defined(GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined(GHCLIB_API_HEAD) || defined(GHCLIB_API_906) report :: DynFlags -> Bag (MsgEnvelope GhcMessage) -> String+report flags msgs = concat [ showSDoc flags msg | msg <- pprMsgEnvelopeBagWithLocDefault msgs ]+#elif defined (GHCLIB_API_904)+report :: DynFlags -> Bag (MsgEnvelope GhcMessage) -> String report flags msgs = concat [ showSDoc flags msg | msg <- pprMsgEnvelopeBagWithLoc msgs ] #elif defined (GHCLIB_API_902) report :: DynFlags -> Bag (MsgEnvelope DecoratedSDoc) -> String@@ -127,7 +130,7 @@ chkParseResult :: DynFlags -> ParseResult a -> IO () chkParseResult flags = \case POk s _ -> do-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) let (wrns, errs) = getPsMessages s #elif defined (GHCLIB_API_902) let (wrns, errs) = getMessages s@@ -135,7 +138,7 @@ let (wrns, errs) = getMessages s flags #endif when (not (null errs) || not (null wrns)) $-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) assertFailure ( report flags (getMessages (GhcPsMessage <$> wrns)) ++ report flags (getMessages (GhcPsMessage <$> errs))@@ -145,7 +148,7 @@ #else assertFailure (report flags wrns ++ report flags errs) #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) PFailed s -> assertFailure (report flags $ getMessages (GhcPsMessage <$> snd (getPsMessages s))) #elif defined (GHCLIB_API_902) PFailed s -> assertFailure (report flags $ fmap pprError (snd (getMessages s)))@@ -254,7 +257,7 @@ exprTest "1 + 2 * 3" flags (\e -> assertBool "parse tree not affected" $-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) showSDocUnsafe (showAstData BlankSrcSpan BlankEpAnnotations e) /= showSDocUnsafe (showAstData BlankSrcSpan BlankEpAnnotations (applyFixities [] e)) #else@@ -266,7 +269,7 @@ case parseDeclaration "f (1 : 2 :[]) = 1" flags of POk _ d -> assertBool "parse tree not affected" $-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) || defined (GHCLIB_API_902) showSDocUnsafe (showAstData BlankSrcSpan BlankEpAnnotations d) /= showSDocUnsafe (showAstData BlankSrcSpan BlankEpAnnotations (applyFixities [] d)) #else@@ -320,12 +323,12 @@ , testCase "isDot" $ test "f . g" $ \case L _ (OpApp _ _ op _) -> assert' $ isDot op; _ -> assertFailure "unexpected" , testCase "isReturn" $ test "return x" $ \case L _ (HsApp _ f _) -> assert' $ isReturn f; _ -> assertFailure "unexpected" , testCase "isReturn" $ test "pure x" $ \case L _ (HsApp _ f _) -> assert' $ isReturn f; _ -> assertFailure "unexpected"-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) , testCase "isSection" $ test "(1 +)" $ \case L _ (HsPar _ _ x _) -> assert' $ isSection x; _ -> assertFailure "unexpected" #else , testCase "isSection" $ test "(1 +)" $ \case L _ (HsPar _ x) -> assert' $ isSection x; _ -> assertFailure "unexpected" #endif-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_904)+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_906) || defined (GHCLIB_API_904) , testCase "isSection" $ test "(+ 1)" $ \case L _ (HsPar _ _ x _) -> assert' $ isSection x; _ -> assertFailure "unexpected" #else , testCase "isSection" $ test "(+ 1)" $ \case L _ (HsPar _ x) -> assert' $ isSection x; _ -> assertFailure "unexpected"