Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class Parsec a where
- newtype ParsecParser a = PP {
- unPP :: CabalSpecVersion -> Parsec FieldLineStream [PWarning] a
- runParsecParser :: 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) => CabalParsing m where
- data PWarnType
- = PWTOther
- | PWTUTF
- | PWTBoolCase
- | PWTVersionTag
- | PWTNewSyntax
- | PWTOldSyntax
- | PWTDeprecatedField
- | PWTInvalidSubsection
- | PWTUnknownField
- | PWTUnknownSection
- | PWTTrailingFields
- | PWTExtraMainIs
- | PWTExtraTestModule
- | PWTExtraBenchmarkModule
- | PWTLexNBSP
- | PWTLexBOM
- | PWTLexTab
- | PWTQuirkyCabalFile
- | PWTDoubleDash
- | PWTMultipleSingularField
- | PWTBuildTypeDefault
- | PWTVersionLeadingZeros
- 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]
- 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.
parsec :: CabalParsing m => m a #
Instances
newtype ParsecParser a #
PP | |
|
Instances
runParsecParser :: ParsecParser a -> FilePath -> FieldLineStream -> Either ParseError a #
Run ParsecParser
with cabalSpecLatest
.
simpleParsec :: Parsec a => String -> Maybe a #
Parse a String
with lexemeParsec
.
lexemeParsec :: (CabalParsing m, Parsec a) => m a #
parsec
could consume trailing spaces, this function will consume.
eitherParsec :: Parsec a => String -> Either String a #
Parse a String
with lexemeParsec
.
explicitEitherParsec :: ParsecParser a -> String -> Either String a #
Parse a String
with given ParsecParser
. Trailing whitespace is accepted.
CabalParsing & warnings
class (CharParsing m, MonadPlus m) => CabalParsing m where #
Parsing class which
- can report Cabal parser warnings.
- knows
cabal-version
we work with
parsecWarning :: PWarnType -> String -> m () #
parsecHaskellString :: m String #
Instances
CabalParsing ParsecParser # | |
Defined in Distribution.Parsec.Class | |
t ~ Char => CabalParsing (Parser r t) # | |
Defined in Distribution.Parsec.Class parsecWarning :: PWarnType -> String -> Parser r t () # parsecHaskellString :: Parser r t String # |
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. |
PWTVersionLeadingZeros | See https://github.com/haskell-infra/hackage-trustees/issues/128 |
Instances
Utilities
parsecToken :: CabalParsing m => m String #
[^ ,]
parsecToken' :: CabalParsing m => m String #
[^ ]
parsecFilePath :: CabalParsing m => m FilePath #
parsecQuoted :: CabalParsing m => m a -> m a #
Content isn't unquoted
parsecMaybeQuoted :: CabalParsing m => m a -> m a #
parsecMaybeQuoted p =
.parsecQuoted
p | p
parsecCommaList :: CabalParsing m => m a -> m [a] #
parsecLeadingCommaList :: CabalParsing m => m a -> m [a] #
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] #
parsecStandard :: (CabalParsing m, Parsec ver) => (ver -> String -> a) -> m a #
Parse a benchmark/test-suite types.
parsecUnqualComponentName :: CabalParsing m => m String #