Distribution.Parsec.Common

Cabal-2.1.0.0: A framework for packaging Haskell software

Safe Haskell | None
Language | Haskell2010

Distribution.Parsec.Common

Contents

- Diagnostics
- Field parser
- Position

Description

Module containing small types

Synopsis

- data PError = PError Position String
- showPError :: FilePath -> PError -> String
- data PWarning = PWarning !PWarnType !Position String
- data PWarnType
  - = PWTOther
  - | PWTUTF
  - | PWTBoolCase
  - | PWTVersionTag
  - | PWTNewSyntax
  - | PWTOldSyntax
  - | PWTDeprecatedField
  - | PWTInvalidSubsection
  - | PWTUnknownField
  - | PWTUnknownSection
  - | PWTTrailingFields
  - | PWTExtraMainIs
  - | PWTExtraTestModule
  - | PWTExtraBenchmarkModule
  - | PWTLexNBSP
  - | PWTLexBOM
  - | PWTQuirkyCabalFile
- showPWarning :: FilePath -> PWarning -> String
- type FieldParser = Parsec String [PWarning]
- data Position = Position !Int !Int
- incPos :: Int -> Position -> Position
- retPos :: Position -> Position
- showPos :: Position -> String
- zeroPos :: Position

# Diagnostics

data PError Source #

Parser error.

Constructors

PError Position String |

Instances

Show PError # |
Instance details Methods showsPrec :: Int -> PError -> ShowS Source # show :: PError -> String Source # showList :: [PError] -> ShowS Source #

showPError :: FilePath -> PError -> String Source #

data PWarning Source #

Parser warning.

Constructors

PWarning !PWarnType !Position String |

Instances

Show PWarning # |
Instance details Methods showsPrec :: Int -> PWarning -> ShowS Source # show :: PWarning -> String Source # showList :: [PWarning] -> ShowS Source #

data PWarnType Source #

Type of parser warning. We do classify warnings.

Different application may decide not to show some, or have fatal behaviour on others

Constructors

PWTOther | Unclassified warning
PWTUTF | Invalid UTF encoding
PWTBoolCase | `true` or `false`, not `True` or `False`
PWTVersionTag | there are version with tags
PWTNewSyntax | New syntax used, but no `cabal-version: >= 1.2` specified
PWTOldSyntax | Old syntax used, and `cabal-version >= 1.2` specified
PWTDeprecatedField |
PWTInvalidSubsection |
PWTUnknownField |
PWTUnknownSection |
PWTTrailingFields |
PWTExtraMainIs | extra main-is field
PWTExtraTestModule | extra test-module field
PWTExtraBenchmarkModule | extra benchmark-module field
PWTLexNBSP |
PWTLexBOM |
PWTQuirkyCabalFile | legacy cabal file that we know how to patch

Instances

Bounded PWarnType # |
Instance details Methods minBound :: PWarnType Source # maxBound :: PWarnType Source #
Enum PWarnType # |
Instance details Methods succ :: PWarnType -> PWarnType Source # pred :: PWarnType -> PWarnType Source # toEnum :: Int -> PWarnType Source # fromEnum :: PWarnType -> Int Source # enumFrom :: PWarnType -> [PWarnType] Source # enumFromThen :: PWarnType -> PWarnType -> [PWarnType] Source # enumFromTo :: PWarnType -> PWarnType -> [PWarnType] Source # enumFromThenTo :: PWarnType -> PWarnType -> PWarnType -> [PWarnType] Source #
Eq PWarnType # |
Instance details Methods (==) :: PWarnType -> PWarnType -> Bool # (/=) :: PWarnType -> PWarnType -> Bool #
Ord PWarnType # |
Instance details Methods compare :: PWarnType -> PWarnType -> Ordering # (<) :: PWarnType -> PWarnType -> Bool # (<=) :: PWarnType -> PWarnType -> Bool # (>) :: PWarnType -> PWarnType -> Bool # (>=) :: PWarnType -> PWarnType -> Bool # max :: PWarnType -> PWarnType -> PWarnType # min :: PWarnType -> PWarnType -> PWarnType #
Show PWarnType # |
Instance details Methods showsPrec :: Int -> PWarnType -> ShowS Source # show :: PWarnType -> String Source # showList :: [PWarnType] -> ShowS Source #

showPWarning :: FilePath -> PWarning -> String Source #

# Field parser

type FieldParser = Parsec String [PWarning] Source #

Field value parsers.

# Position

data Position Source #

1-indexed row and column positions in a file.

Constructors

Position !Int !Int |

Instances

Eq Position # |
Instance details Methods (==) :: Position -> Position -> Bool # (/=) :: Position -> Position -> Bool #
Ord Position # |
Instance details Methods compare :: Position -> Position -> Ordering # (<) :: Position -> Position -> Bool # (<=) :: Position -> Position -> Bool # (>) :: Position -> Position -> Bool # (>=) :: Position -> Position -> Bool # max :: Position -> Position -> Position # min :: Position -> Position -> Position #
Show Position # |
Instance details Methods showsPrec :: Int -> Position -> ShowS Source # show :: Position -> String Source # showList :: [Position] -> ShowS Source #

incPos :: Int -> Position -> Position Source #

Shift position by n columns to the right.

retPos :: Position -> Position Source #

Shift position to beginning of next row.

showPos :: Position -> String Source #

zeroPos :: Position Source #