Commit 2081c717 authored by Vaibhav Sagar's avatar Vaibhav Sagar

ghc-parser: update

parent d4a754b3
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveFunctor #-}
module Language.Haskell.GHC.Parser (
-- Parser handling
......@@ -29,7 +30,11 @@ import Data.Char (isAlphaNum)
import Bag
import ErrUtils hiding (ErrMsg)
import FastString
#if MIN_VERSION_ghc(8,4,0)
import GHC hiding (Located, Parsed)
#else
import GHC hiding (Located)
#endif
import Lexer
import OrdList
import Outputable hiding ((<>))
......@@ -89,13 +94,21 @@ runParser flags (Parser parser) str =
toParseOut $ unP parser parseState
where
toParseOut :: ParseResult a -> ParseOutput a
#if MIN_VERSION_ghc(8,4,0)
toParseOut (PFailed _ span@(RealSrcSpan realSpan) err) =
#else
toParseOut (PFailed span@(RealSrcSpan realSpan) err) =
#endif
let errMsg = printErrorBag $ unitBag $ mkPlainErrMsg flags span err
line = srcLocLine $ realSrcSpanStart realSpan
col = srcLocCol $ realSrcSpanStart realSpan
in Failure errMsg $ Loc line col
#if MIN_VERSION_ghc(8,4,0)
toParseOut (PFailed _ span err) =
#else
toParseOut (PFailed span err) =
#endif
let errMsg = printErrorBag $ unitBag $ mkPlainErrMsg flags span err
in Failure errMsg $ Loc 0 0
......
......@@ -33,7 +33,7 @@ library
-- other-modules:
-- other-extensions:
build-depends: base >=4.6 && < 5,
ghc >=7.6 && <8.3
ghc >=7.6 && <8.5
if impl(ghc >= 7.6) && impl(ghc < 7.8)
hs-source-dirs: generic-src src-7.6
......@@ -47,6 +47,10 @@ library
if impl(ghc < 8.0)
hs-source-dirs: generic-src src-7.10
else
hs-source-dirs: generic-src src-8.0
if impl(ghc >= 8.0) && impl(ghc < 8.4)
hs-source-dirs: generic-src src-8.0
else
hs-source-dirs: generic-src src-8.4
default-language: Haskell2010
module Language.Haskell.GHC.HappyParser
( fullStatement
, fullImport
, fullDeclaration
, fullExpression
, fullTypeSignature
, fullModule
) where
import Parser
import SrcLoc
-- compiler/hsSyn
import HsSyn
-- compiler/utils
import OrdList
-- compiler/parser
import RdrHsSyn
import Lexer
-- compiler/basicTypes
import RdrName
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
fullTypeSignature :: P (Located (OrdList (LHsDecl GhcPs)))
fullTypeSignature = fmap (noLoc . unitOL) parseTypeSignature
fullModule :: P (Located (HsModule GhcPs))
fullModule = parseModule
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment