Copyright | Isaac Jones 2003-2005 |
---|---|
License | BSD3 |
Maintainer | cabal-devel@haskell.org |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This defined parsers and partial pretty printers for the .cabal
format.
Synopsis
- parseGenericPackageDescription :: ByteString -> ParseResult GenericPackageDescription
- parseGenericPackageDescriptionMaybe :: ByteString -> Maybe GenericPackageDescription
- data ParseResult a
- runParseResult :: ParseResult a -> ([PWarning], Either (Maybe Version, NonEmpty PError) a)
- scanSpecVersion :: ByteString -> Maybe Version
- parseHookedBuildInfo :: ByteString -> ParseResult HookedBuildInfo
Package descriptions
parseGenericPackageDescription :: ByteString -> ParseResult GenericPackageDescription Source #
Parses the given file into a GenericPackageDescription
.
In Cabal 1.2 the syntax for package descriptions was changed to a format with sections and possibly indented property descriptions.
parseGenericPackageDescriptionMaybe :: ByteString -> Maybe GenericPackageDescription Source #
Maybe
variant of parseGenericPackageDescription
Parsing
data ParseResult a Source #
A monad with failure and accumulating errors and warnings.
Instances
Applicative ParseResult Source # | |
Defined in Distribution.Fields.ParseResult pure :: a -> ParseResult a # (<*>) :: ParseResult (a -> b) -> ParseResult a -> ParseResult b # liftA2 :: (a -> b -> c) -> ParseResult a -> ParseResult b -> ParseResult c # (*>) :: ParseResult a -> ParseResult b -> ParseResult b # (<*) :: ParseResult a -> ParseResult b -> ParseResult a # | |
Functor ParseResult Source # | |
Defined in Distribution.Fields.ParseResult fmap :: (a -> b) -> ParseResult a -> ParseResult b # (<$) :: a -> ParseResult b -> ParseResult a # | |
Monad ParseResult Source # | |
Defined in Distribution.Fields.ParseResult (>>=) :: ParseResult a -> (a -> ParseResult b) -> ParseResult b # (>>) :: ParseResult a -> ParseResult b -> ParseResult b # return :: a -> ParseResult a # |
runParseResult :: ParseResult a -> ([PWarning], Either (Maybe Version, NonEmpty PError) a) Source #
Destruct a ParseResult
into the emitted warnings and either
a successful value or
list of errors and possibly recovered a spec-version declaration.
New-style spec-version
scanSpecVersion :: ByteString -> Maybe Version Source #
Quickly scan new-style spec-version
A new-style spec-version declaration begins the .cabal file and follow the following case-insensitive grammar (expressed in RFC5234 ABNF):
newstyle-spec-version-decl = "cabal-version" *WS ":" *WS newstyle-pec-version *WS spec-version = NUM "." NUM [ "." NUM ] NUM = DIGIT0 / DIGITP 1*DIGIT0 DIGIT0 = %x30-39 DIGITP = %x31-39 WS = %20