Parser

ghc-8.2.2: The GHC API

Safe Haskell | None
Language | Haskell2010

Parser

Description

This module provides the generated Happy parser for Haskell. It exports a number of parsers which may be used in any library that uses the GHC API. A common usage pattern is to initialize the parser state with a given string and then parse that string:

        runParser :: DynFlags -> String -> P a -> ParseResult a
        runParser flags str parser = unP parser parseState
        where
          filename = "<interactive>"
          location = mkRealSrcLoc (mkFastString filename) 1 1
          buffer = stringToStringBuffer str
          parseState = mkPState flags buffer location

# Documentation

parseModule :: P (Located (HsModule RdrName)) Source #

parseSignature :: P (Located (HsModule RdrName)) Source #

parseImport :: P (LImportDecl RdrName) Source #

parseStatement :: P (LStmt RdrName (LHsExpr RdrName)) Source #

parseBackpack :: P [LHsUnit PackageName] Source #

parseDeclaration :: P (LHsDecl RdrName) Source #

parseExpression :: P (LHsExpr RdrName) Source #

parsePattern :: P (LPat RdrName) Source #

parseTypeSignature :: P (LHsDecl RdrName) Source #

parseStmt :: P (Maybe (LStmt RdrName (LHsExpr RdrName))) Source #

parseIdentifier :: P (Located RdrName) Source #

parseType :: P (LHsType RdrName) Source #

parseHeader :: P (Located (HsModule RdrName)) Source #