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 :: P (Maybe (LStmt GhcPs (LHsExpr GhcPs)))
fullStatement = P (Maybe
     (GenLocated
        SrcSpanAnnA
        (StmtLR GhcPs GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs)))))
parseStmt

fullImport :: P (LImportDecl GhcPs)
fullImport :: P (LImportDecl GhcPs)
fullImport = P (GenLocated SrcSpanAnnA (ImportDecl GhcPs))
parseImport

fullDeclaration :: P (OrdList (LHsDecl GhcPs))
fullDeclaration :: P (OrdList (LHsDecl GhcPs))
fullDeclaration = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. a -> OrdList a
unitOL P (GenLocated SrcSpanAnnA (HsDecl GhcPs))
parseDeclaration

fullExpression :: P (LHsExpr GhcPs)
fullExpression :: P (LHsExpr GhcPs)
fullExpression = P ECP
parseExpression forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \ECP
p -> forall a. PV a -> P a
runPV forall a b. (a -> b) -> a -> b
$ ECP -> forall b. DisambECP b => PV (LocatedA b)
unECP ECP
p

fullTypeSignature :: P (Located (OrdList (LHsDecl GhcPs)))
fullTypeSignature :: P (Located (OrdList (LHsDecl GhcPs)))
fullTypeSignature = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall e. e -> Located e
noLoc forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> OrdList a
unitOL) P (GenLocated SrcSpanAnnA (HsDecl GhcPs))
parseTypeSignature

fullModule :: P (Located HsModule)
fullModule :: P (Located HsModule)
fullModule = P (Located HsModule)
parseModule