Distribution.Parsec.LexerMonad

Cabal-2.4.0.1: A framework for packaging Haskell software

License | BSD3
Maintainer | cabal-devel@haskell.org
Portability | portable
Safe Haskell | None
Language | Haskell2010

Distribution.Parsec.LexerMonad

Description

Synopsis

- type InputStream = ByteString
- data LexState = LexState {
  - curPos :: !Position
  - curInput :: !InputStream
  - curCode :: !StartCode
  - warnings :: [LexWarning]
  }
- data LexResult a = LexResult !LexState a
- newtype Lex a = Lex {
  - unLex :: LexState -> LexResult a
  }
- execLexer :: Lex a -> InputStream -> ([LexWarning], a)
- getPos :: Lex Position
- setPos :: Position -> Lex ()
- adjustPos :: (Position -> Position) -> Lex ()
- getInput :: Lex InputStream
- setInput :: InputStream -> Lex ()
- getStartCode :: Lex Int
- setStartCode :: Int -> Lex ()
- data LexWarning = LexWarning !LexWarningType !Position
- data LexWarningType
  - = LexWarningNBSP
  - | LexWarningBOM
  - | LexWarningTab
- addWarning :: LexWarningType -> Lex ()
- toPWarnings :: [LexWarning] -> [PWarning]

# Documentation

type InputStream = ByteString #

data LexState #

Constructors

LexState |
Fields curPos :: !Position position at current input location curInput :: !InputStream the current input curCode :: !StartCode lexer code warnings :: [LexWarning]

data LexResult a #

Constructors

LexResult !LexState a |

newtype Lex a #

Constructors

Lex |
Fields unLex :: LexState -> LexResult a

Instances

Monad Lex # |
Instance details Defined in Distribution.Parsec.LexerMonad Methods (>>=) :: Lex a -> (a -> Lex b) -> Lex b Source # (>>) :: Lex a -> Lex b -> Lex b Source # return :: a -> Lex a Source # fail :: String -> Lex a Source #
Functor Lex # |
Instance details Defined in Distribution.Parsec.LexerMonad Methods fmap :: (a -> b) -> Lex a -> Lex b Source # (<$) :: a -> Lex b -> Lex a Source #
Applicative Lex # |
Instance details Defined in Distribution.Parsec.LexerMonad Methods pure :: a -> Lex a Source # (<*>) :: Lex (a -> b) -> Lex a -> Lex b Source # liftA2 :: (a -> b -> c) -> Lex a -> Lex b -> Lex c Source # (*>) :: Lex a -> Lex b -> Lex b Source # (<*) :: Lex a -> Lex b -> Lex a Source #

execLexer :: Lex a -> InputStream -> ([LexWarning], a) #

Execute the given lexer on the supplied input stream.

getPos :: Lex Position #

setPos :: Position -> Lex () #

adjustPos :: (Position -> Position) -> Lex () #

getInput :: Lex InputStream #

setInput :: InputStream -> Lex () #

getStartCode :: Lex Int #

setStartCode :: Int -> Lex () #

data LexWarning #

Constructors

LexWarning !LexWarningType !Position |

Instances

Show LexWarning # |
Instance details Defined in Distribution.Parsec.LexerMonad Methods showsPrec :: Int -> LexWarning -> ShowS Source # show :: LexWarning -> String Source # showList :: [LexWarning] -> ShowS Source #

data LexWarningType #

Constructors

LexWarningNBSP | Encountered non breaking space
LexWarningBOM | BOM at the start of the cabal file
LexWarningTab | Leading tags

Instances

Eq LexWarningType # |
Instance details Defined in Distribution.Parsec.LexerMonad Methods (==) :: LexWarningType -> LexWarningType -> Bool # (/=) :: LexWarningType -> LexWarningType -> Bool #
Ord LexWarningType # |
Instance details Defined in Distribution.Parsec.LexerMonad Methods compare :: LexWarningType -> LexWarningType -> Ordering # (<) :: LexWarningType -> LexWarningType -> Bool # (<=) :: LexWarningType -> LexWarningType -> Bool # (>) :: LexWarningType -> LexWarningType -> Bool # (>=) :: LexWarningType -> LexWarningType -> Bool # max :: LexWarningType -> LexWarningType -> LexWarningType # min :: LexWarningType -> LexWarningType -> LexWarningType #
Show LexWarningType # |
Instance details Defined in Distribution.Parsec.LexerMonad Methods showsPrec :: Int -> LexWarningType -> ShowS Source # show :: LexWarningType -> String Source # showList :: [LexWarningType] -> ShowS Source #

addWarning :: LexWarningType -> Lex () #

Add warning at the current position

toPWarnings :: [LexWarning] -> [PWarning] #