ghc-parser 0.2.5.0 → 0.2.6.0
raw patch · 3 files changed
+54/−4 lines, 3 filesdep ~ghcPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ghc
API changes (from Hackage documentation)
Files
- generic-src/Language/Haskell/GHC/Parser.hs +10/−2
- ghc-parser.cabal +4/−2
- src-9.8/Language/Haskell/GHC/HappyParser.hs +40/−0
generic-src/Language/Haskell/GHC/Parser.hs view
@@ -29,9 +29,15 @@ import Data.List (intercalate, findIndex, isInfixOf) import Data.Char (isAlphaNum) -#if MIN_VERSION_ghc(9,6,0)+#if MIN_VERSION_ghc(9,8,0) import GHC.Driver.Config.Parser (initParserOpts) import GHC.Parser.Errors.Types (PsMessage(..))+import GHC.Types.Error (defaultDiagnosticOpts, getMessages, MsgEnvelope(..))+import GHC.Utils.Error (diagnosticMessage, formatBulleted)+import GHC.Utils.Outputable (defaultSDocContext, renderWithContext)+#elif MIN_VERSION_ghc(9,6,0)+import GHC.Driver.Config.Parser (initParserOpts)+import GHC.Parser.Errors.Types (PsMessage(..)) import GHC.Types.Error (getMessages, MsgEnvelope(..)) import GHC.Utils.Error (diagnosticMessage, defaultDiagnosticOpts, formatBulleted) import GHC.Utils.Outputable (defaultSDocContext, renderWithContext)@@ -229,7 +235,9 @@ Parsed result -- Convert the bag of errors into an error string.-#if MIN_VERSION_ghc(9,6,0)+#if MIN_VERSION_ghc(9,8,0)+ printErrorBag bag = joinLines . map (renderWithContext defaultSDocContext . formatBulleted . diagnosticMessage (defaultDiagnosticOpts @PsMessage) . errMsgDiagnostic) $ bagToList bag+#elif MIN_VERSION_ghc(9,6,0) printErrorBag bag = joinLines . map (renderWithContext defaultSDocContext . formatBulleted defaultSDocContext . diagnosticMessage (defaultDiagnosticOpts @PsMessage) . errMsgDiagnostic) $ bagToList bag #elif MIN_VERSION_ghc(9,4,0) printErrorBag bag = joinLines . map (show . formatBulleted defaultSDocContext . diagnosticMessage . errMsgDiagnostic) $ bagToList bag
ghc-parser.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: ghc-parser-version: 0.2.5.0+version: 0.2.6.0 synopsis: Haskell source parser from GHC. -- description: homepage: https://github.com/IHaskell/IHaskell@@ -23,7 +23,7 @@ -- other-modules: -- other-extensions: build-depends: base >=4.9 && < 5,- ghc >=8.0 && <9.7+ ghc >=8.0 && <9.9 if impl(ghc >= 8.0) && impl(ghc < 8.4) hs-source-dirs: generic-src src-8.0@@ -39,6 +39,8 @@ hs-source-dirs: generic-src src-9.4 if impl(ghc >= 9.6) && impl(ghc < 9.8) hs-source-dirs: generic-src src-9.6+ if impl(ghc >= 9.8) && impl(ghc < 9.10)+ hs-source-dirs: generic-src src-9.8 default-language: Haskell2010
+ src-9.8/Language/Haskell/GHC/HappyParser.hs view
@@ -0,0 +1,40 @@+module Language.Haskell.GHC.HappyParser+ ( fullStatement+ , fullImport+ , fullDeclaration+ , fullExpression+ , fullTypeSignature+ , fullModule+ ) where++import GHC.Parser+import GHC.Types.SrcLoc++-- compiler/hsSyn+import GHC.Hs++-- compiler/utils+import GHC.Data.OrdList++-- compiler/parser+import GHC.Parser.Lexer++import GHC.Parser.PostProcess (ECP(..), runPV)++fullStatement :: P (Maybe (LStmt GhcPs (LHsExpr GhcPs)))+fullStatement = parseStmt++fullImport :: P (LImportDecl GhcPs)+fullImport = parseImport++fullDeclaration :: P (OrdList (LHsDecl GhcPs))+fullDeclaration = fmap unitOL parseDeclaration++fullExpression :: P (LHsExpr GhcPs)+fullExpression = parseExpression >>= \p -> runPV $ unECP p++fullTypeSignature :: P (Located (OrdList (LHsDecl GhcPs)))+fullTypeSignature = fmap (noLoc . unitOL) parseTypeSignature++fullModule :: P (Located (HsModule GhcPs))+fullModule = parseModule