Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class Parsec a where
- parsec :: CabalParsing m => m a
- newtype ParsecParser a = PP {
- unPP :: CabalSpecVersion -> Parsec FieldLineStream [PWarning] a
- runParsecParser :: ParsecParser a -> FilePath -> FieldLineStream -> Either ParseError a
- runParsecParser' :: CabalSpecVersion -> ParsecParser a -> FilePath -> FieldLineStream -> Either ParseError a
- simpleParsec :: Parsec a => String -> Maybe a
- lexemeParsec :: (CabalParsing m, Parsec a) => m a
- eitherParsec :: Parsec a => String -> Either String a
- explicitEitherParsec :: ParsecParser a -> String -> Either String a
- class (CharParsing m, MonadPlus m, MonadFail m) => CabalParsing m where
- parsecWarning :: PWarnType -> String -> m ()
- parsecHaskellString :: m String
- askCabalSpecVersion :: m CabalSpecVersion
- data PWarnType
- = PWTOther
- | PWTUTF
- | PWTBoolCase
- | PWTVersionTag
- | PWTNewSyntax
- | PWTOldSyntax
- | PWTDeprecatedField
- | PWTInvalidSubsection
- | PWTUnknownField
- | PWTUnknownSection
- | PWTTrailingFields
- | PWTExtraMainIs
- | PWTExtraTestModule
- | PWTExtraBenchmarkModule
- | PWTLexNBSP
- | PWTLexBOM
- | PWTLexTab
- | PWTQuirkyCabalFile
- | PWTDoubleDash
- | PWTMultipleSingularField
- | PWTBuildTypeDefault
- data PWarning = PWarning !PWarnType !Position String
- showPWarning :: FilePath -> PWarning -> String
- data PError = PError Position String
- showPError :: FilePath -> PError -> String
- data Position = Position !Int !Int
- incPos :: Int -> Position -> Position
- retPos :: Position -> Position
- showPos :: Position -> String
- zeroPos :: Position
- parsecToken :: CabalParsing m => m String
- parsecToken' :: CabalParsing m => m String
- parsecFilePath :: CabalParsing m => m FilePath
- parsecQuoted :: CabalParsing m => m a -> m a
- parsecMaybeQuoted :: CabalParsing m => m a -> m a
- parsecCommaList :: CabalParsing m => m a -> m [a]
- parsecLeadingCommaList :: CabalParsing m => m a -> m [a]
- parsecOptCommaList :: CabalParsing m => m a -> m [a]
- parsecLeadingOptCommaList :: CabalParsing m => m a -> m [a]
- parsecStandard :: (CabalParsing m, Parsec ver) => (ver -> String -> a) -> m a
- parsecUnqualComponentName :: CabalParsing m => m String
Documentation
Class for parsing with parsec
. Mainly used for .cabal
file fields.
For parsing .cabal
like file structure, see Distribution.Fields.
parsec :: CabalParsing m => m a Source #
Instances
Parsec Bool Source # | |
Defined in Distribution.Parsec parsec :: CabalParsing m => m Bool Source # | |
Parsec Version Source # | |
Defined in Distribution.Types.Version parsec :: CabalParsing m => m Version Source # | |
Parsec VersionRange Source # | |
Defined in Distribution.Types.VersionRange.Internal parsec :: CabalParsing m => m VersionRange Source # | |
Parsec RepoType Source # | |
Defined in Distribution.Types.SourceRepo parsec :: CabalParsing m => m RepoType Source # | |
Parsec RepoKind Source # | |
Defined in Distribution.Types.SourceRepo parsec :: CabalParsing m => m RepoKind Source # | |
Parsec PkgconfigVersion Source # |
|
Defined in Distribution.Types.PkgconfigVersion parsec :: CabalParsing m => m PkgconfigVersion Source # | |
Parsec PkgconfigVersionRange Source # | |
Defined in Distribution.Types.PkgconfigVersionRange parsec :: CabalParsing m => m PkgconfigVersionRange Source # | |
Parsec PkgconfigName Source # | |
Defined in Distribution.Types.PkgconfigName parsec :: CabalParsing m => m PkgconfigName Source # | |
Parsec PkgconfigDependency Source # | |
Defined in Distribution.Types.PkgconfigDependency parsec :: CabalParsing m => m PkgconfigDependency Source # | |
Parsec PackageName Source # | |
Defined in Distribution.Types.PackageName parsec :: CabalParsing m => m PackageName Source # | |
Parsec UnqualComponentName Source # | |
Defined in Distribution.Types.UnqualComponentName parsec :: CabalParsing m => m UnqualComponentName Source # | |
Parsec PackageVersionConstraint Source # | |
Defined in Distribution.Types.PackageVersionConstraint parsec :: CabalParsing m => m PackageVersionConstraint Source # | |
Parsec LibraryVisibility Source # | |
Defined in Distribution.Types.LibraryVisibility parsec :: CabalParsing m => m LibraryVisibility Source # | |
Parsec MungedPackageName Source # |
|
Defined in Distribution.Types.MungedPackageName parsec :: CabalParsing m => m MungedPackageName Source # | |
Parsec ForeignLibType Source # | |
Defined in Distribution.Types.ForeignLibType parsec :: CabalParsing m => m ForeignLibType Source # | |
Parsec ForeignLibOption Source # | |
Defined in Distribution.Types.ForeignLibOption parsec :: CabalParsing m => m ForeignLibOption Source # | |
Parsec ExecutableScope Source # | |
Defined in Distribution.Types.ExecutableScope parsec :: CabalParsing m => m ExecutableScope Source # | |
Parsec ComponentName Source # | |
Defined in Distribution.Types.ComponentName parsec :: CabalParsing m => m ComponentName Source # | |
Parsec ComponentId Source # | |
Defined in Distribution.Types.ComponentId parsec :: CabalParsing m => m ComponentId Source # | |
Parsec BuildType Source # | |
Defined in Distribution.Types.BuildType parsec :: CabalParsing m => m BuildType Source # | |
Parsec AbiHash Source # | |
Defined in Distribution.Types.AbiHash parsec :: CabalParsing m => m AbiHash Source # | |
Parsec Platform Source # | |
Defined in Distribution.System parsec :: CabalParsing m => m Platform Source # | |
Parsec Arch Source # | |
Defined in Distribution.System parsec :: CabalParsing m => m Arch Source # | |
Parsec OS Source # | |
Defined in Distribution.System parsec :: CabalParsing m => m OS Source # | |
Parsec LicenseRef Source # | |
Defined in Distribution.SPDX.LicenseReference parsec :: CabalParsing m => m LicenseRef Source # | |
Parsec LicenseId Source # |
|
Defined in Distribution.SPDX.LicenseId parsec :: CabalParsing m => m LicenseId Source # | |
Parsec LicenseExceptionId Source # | |
Defined in Distribution.SPDX.LicenseExceptionId parsec :: CabalParsing m => m LicenseExceptionId Source # | |
Parsec SimpleLicenseExpression Source # | |
Defined in Distribution.SPDX.LicenseExpression parsec :: CabalParsing m => m SimpleLicenseExpression Source # | |
Parsec LicenseExpression Source # | |
Defined in Distribution.SPDX.LicenseExpression parsec :: CabalParsing m => m LicenseExpression Source # | |
Parsec License Source # |
|
Defined in Distribution.SPDX.License parsec :: CabalParsing m => m License Source # | |
Parsec ModuleName Source # | |
Defined in Distribution.ModuleName parsec :: CabalParsing m => m ModuleName Source # | |
Parsec ModuleRenaming Source # | |
Defined in Distribution.Types.ModuleRenaming parsec :: CabalParsing m => m ModuleRenaming Source # | |
Parsec IncludeRenaming Source # | |
Defined in Distribution.Types.IncludeRenaming parsec :: CabalParsing m => m IncludeRenaming Source # | |
Parsec Mixin Source # | |
Defined in Distribution.Types.Mixin parsec :: CabalParsing m => m Mixin Source # | |
Parsec ModuleReexport Source # | |
Defined in Distribution.Types.ModuleReexport parsec :: CabalParsing m => m ModuleReexport Source # | |
Parsec TestType Source # | |
Defined in Distribution.Types.TestType parsec :: CabalParsing m => m TestType Source # | |
Parsec PackageIdentifier Source # |
Note: Stricter than
|
Defined in Distribution.Types.PackageId parsec :: CabalParsing m => m PackageIdentifier Source # | |
Parsec DefUnitId Source # | |
Defined in Distribution.Types.UnitId parsec :: CabalParsing m => m DefUnitId Source # | |
Parsec UnitId Source # | The textual format for |
Defined in Distribution.Types.UnitId parsec :: CabalParsing m => m UnitId Source # | |
Parsec Module Source # | |
Defined in Distribution.Types.Module parsec :: CabalParsing m => m Module Source # | |
Parsec OpenModule Source # |
|
Defined in Distribution.Backpack parsec :: CabalParsing m => m OpenModule Source # | |
Parsec OpenUnitId Source # |
|
Defined in Distribution.Backpack parsec :: CabalParsing m => m OpenUnitId Source # | |
Parsec ExposedModule Source # | |
Defined in Distribution.Types.ExposedModule parsec :: CabalParsing m => m ExposedModule Source # | |
Parsec MungedPackageId Source # |
|
Defined in Distribution.Types.MungedPackageId parsec :: CabalParsing m => m MungedPackageId Source # | |
Parsec LegacyExeDependency Source # | |
Defined in Distribution.Types.LegacyExeDependency parsec :: CabalParsing m => m LegacyExeDependency Source # | |
Parsec ExeDependency Source # | Examples
|
Defined in Distribution.Types.ExeDependency parsec :: CabalParsing m => m ExeDependency Source # | |
Parsec Dependency Source # |
Spaces around colon are not allowed:
|
Defined in Distribution.Types.Dependency parsec :: CabalParsing m => m Dependency Source # | |
Parsec BenchmarkType Source # | |
Defined in Distribution.Types.BenchmarkType parsec :: CabalParsing m => m BenchmarkType Source # | |
Parsec AbiDependency Source # | |
Defined in Distribution.Types.AbiDependency parsec :: CabalParsing m => m AbiDependency Source # | |
Parsec License Source # | |
Defined in Distribution.License parsec :: CabalParsing m => m License Source # | |
Parsec Extension Source # | |
Defined in Language.Haskell.Extension parsec :: CabalParsing m => m Extension Source # | |
Parsec Language Source # | |
Defined in Language.Haskell.Extension parsec :: CabalParsing m => m Language Source # | |
Parsec AbiTag Source # | |
Defined in Distribution.Compiler parsec :: CabalParsing m => m AbiTag Source # | |
Parsec CompilerId Source # | |
Defined in Distribution.Compiler parsec :: CabalParsing m => m CompilerId Source # | |
Parsec CompilerFlavor Source # | |
Defined in Distribution.Compiler parsec :: CabalParsing m => m CompilerFlavor Source # | |
Parsec LibVersionInfo Source # | |
Defined in Distribution.Types.ForeignLib parsec :: CabalParsing m => m LibVersionInfo Source # | |
Parsec FlagName Source # | |
Defined in Distribution.Types.GenericPackageDescription parsec :: CabalParsing m => m FlagName Source # | |
Parsec FilePathNT Source # | |
Defined in Distribution.Parsec.Newtypes parsec :: CabalParsing m => m FilePathNT Source # | |
Parsec TestedWith Source # | |
Defined in Distribution.Parsec.Newtypes parsec :: CabalParsing m => m TestedWith Source # | |
Parsec SpecLicense Source # | |
Defined in Distribution.Parsec.Newtypes parsec :: CabalParsing m => m SpecLicense Source # | |
Parsec SpecVersion Source # | |
Defined in Distribution.Parsec.Newtypes parsec :: CabalParsing m => m SpecVersion Source # | |
Parsec Token' Source # | |
Defined in Distribution.Parsec.Newtypes parsec :: CabalParsing m => m Token' Source # | |
Parsec Token Source # | |
Defined in Distribution.Parsec.Newtypes parsec :: CabalParsing m => m Token Source # | |
Parsec TestShowDetails Source # | |
Defined in Distribution.Simple.Setup parsec :: CabalParsing m => m TestShowDetails Source # | |
Parsec HaddockTarget Source # | |
Defined in Distribution.Simple.Setup parsec :: CabalParsing m => m HaddockTarget Source # | |
Parsec a => Parsec (Identity a) Source # | |
Defined in Distribution.Parsec parsec :: CabalParsing m => m (Identity a) Source # | |
Parsec a => Parsec (MQuoted a) Source # | |
Defined in Distribution.Parsec.Newtypes parsec :: CabalParsing m => m (MQuoted a) Source # | |
(Newtype a b, Sep sep, Parsec b) => Parsec (List sep b a) Source # | |
Defined in Distribution.Parsec.Newtypes parsec :: CabalParsing m => m (List sep b a) Source # |
newtype ParsecParser a Source #
PP | |
|
Instances
runParsecParser :: ParsecParser a -> FilePath -> FieldLineStream -> Either ParseError a Source #
Run ParsecParser
with cabalSpecLatest
.
runParsecParser' :: CabalSpecVersion -> ParsecParser a -> FilePath -> FieldLineStream -> Either ParseError a Source #
Like runParsecParser
but lets specify CabalSpecVersion
used.
Since: 3.0.0.0
simpleParsec :: Parsec a => String -> Maybe a Source #
Parse a String
with lexemeParsec
.
lexemeParsec :: (CabalParsing m, Parsec a) => m a Source #
parsec
could consume trailing spaces, this function will consume.
eitherParsec :: Parsec a => String -> Either String a Source #
Parse a String
with lexemeParsec
.
explicitEitherParsec :: ParsecParser a -> String -> Either String a Source #
Parse a String
with given ParsecParser
. Trailing whitespace is accepted.
CabalParsing and and diagnostics
class (CharParsing m, MonadPlus m, MonadFail m) => CabalParsing m where Source #
Parsing class which
- can report Cabal parser warnings.
- knows
cabal-version
we work with
parsecWarning :: PWarnType -> String -> m () Source #
parsecHaskellString :: m String Source #
Instances
Warnings
Type of parser warning. We do classify warnings.
Different application may decide not to show some, or have fatal behaviour on others
PWTOther | Unclassified warning |
PWTUTF | Invalid UTF encoding |
PWTBoolCase |
|
PWTVersionTag | there are version with tags |
PWTNewSyntax | New syntax used, but no |
PWTOldSyntax | Old syntax used, and |
PWTDeprecatedField | |
PWTInvalidSubsection | |
PWTUnknownField | |
PWTUnknownSection | |
PWTTrailingFields | |
PWTExtraMainIs | extra main-is field |
PWTExtraTestModule | extra test-module field |
PWTExtraBenchmarkModule | extra benchmark-module field |
PWTLexNBSP | |
PWTLexBOM | |
PWTLexTab | |
PWTQuirkyCabalFile | legacy cabal file that we know how to patch |
PWTDoubleDash | Double dash token, most likely it's a mistake - it's not a comment |
PWTMultipleSingularField | e.g. name or version should be specified only once. |
PWTBuildTypeDefault | Workaround for derive-package having build-type: Default. See https://github.com/haskell/cabal/issues/5020. |
Instances
Parser warning.
Instances
Show PWarning Source # | |
Generic PWarning Source # | |
Binary PWarning Source # | |
NFData PWarning Source # | |
Defined in Distribution.Parsec.Warning | |
type Rep PWarning Source # | |
Defined in Distribution.Parsec.Warning type Rep PWarning = D1 ('MetaData "PWarning" "Distribution.Parsec.Warning" "Cabal-3.0.2.0-inplace" 'False) (C1 ('MetaCons "PWarning" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PWarnType) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Position) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))) |
Errors
Parser error.
Instances
Show PError Source # | |
Generic PError Source # | |
Binary PError Source # | |
NFData PError Source # | |
Defined in Distribution.Parsec.Error | |
type Rep PError Source # | |
Defined in Distribution.Parsec.Error type Rep PError = D1 ('MetaData "PError" "Distribution.Parsec.Error" "Cabal-3.0.2.0-inplace" 'False) (C1 ('MetaCons "PError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Position) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))) |
Position
1-indexed row and column positions in a file.
Instances
Eq Position Source # | |
Ord Position Source # | |
Defined in Distribution.Parsec.Position | |
Show Position Source # | |
Generic Position Source # | |
Binary Position Source # | |
NFData Position Source # | |
Defined in Distribution.Parsec.Position | |
type Rep Position Source # | |
Defined in Distribution.Parsec.Position type Rep Position = D1 ('MetaData "Position" "Distribution.Parsec.Position" "Cabal-3.0.2.0-inplace" 'False) (C1 ('MetaCons "Position" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int))) |
Utilities
parsecToken :: CabalParsing m => m String Source #
[^ ,]
parsecToken' :: CabalParsing m => m String Source #
[^ ]
parsecFilePath :: CabalParsing m => m FilePath Source #
parsecQuoted :: CabalParsing m => m a -> m a Source #
Content isn't unquoted
parsecMaybeQuoted :: CabalParsing m => m a -> m a Source #
parsecMaybeQuoted p =
.parsecQuoted
p | p
parsecCommaList :: CabalParsing m => m a -> m [a] Source #
parsecLeadingCommaList :: CabalParsing m => m a -> m [a] Source #
Like parsecCommaList
but accept leading or trailing comma.
p (comma p)* -- p sepBy
comma
(comma p)* -- leading comma
(p comma)* -- trailing comma
parsecOptCommaList :: CabalParsing m => m a -> m [a] Source #
parsecLeadingOptCommaList :: CabalParsing m => m a -> m [a] Source #
Like parsecOptCommaList
but
- require all or none commas
- accept leading or trailing comma.
p (comma p)* -- p sepBy
comma
(comma p)* -- leading comma
(p comma)* -- trailing comma
p* -- no commas: many p
Since: 3.0.0.0
parsecStandard :: (CabalParsing m, Parsec ver) => (ver -> String -> a) -> m a Source #
Parse a benchmark/test-suite types.
parsecUnqualComponentName :: CabalParsing m => m String Source #