boomerang-1.4.9: Library for invertible parsing and printing
Safe HaskellSafe-Inferred
LanguageHaskell2010

Text.Boomerang.Error

Description

An Error handling scheme that can be used with Boomerang

Synopsis

Documentation

data ErrorMsg Source #

Constructors

SysUnExpect String 
EOI String 
UnExpect String 
Expect String 
Message String 

Instances

Instances details
Data ErrorMsg Source # 
Instance details

Defined in Text.Boomerang.Error

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ErrorMsg -> c ErrorMsg

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ErrorMsg

toConstr :: ErrorMsg -> Constr

dataTypeOf :: ErrorMsg -> DataType

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ErrorMsg)

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ErrorMsg)

gmapT :: (forall b. Data b => b -> b) -> ErrorMsg -> ErrorMsg

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ErrorMsg -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ErrorMsg -> r

gmapQ :: (forall d. Data d => d -> u) -> ErrorMsg -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> ErrorMsg -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ErrorMsg -> m ErrorMsg

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ErrorMsg -> m ErrorMsg

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ErrorMsg -> m ErrorMsg

Read ErrorMsg Source # 
Instance details

Defined in Text.Boomerang.Error

Methods

readsPrec :: Int -> ReadS ErrorMsg

readList :: ReadS [ErrorMsg]

readPrec :: ReadPrec ErrorMsg

readListPrec :: ReadPrec [ErrorMsg]

Show ErrorMsg Source # 
Instance details

Defined in Text.Boomerang.Error

Methods

showsPrec :: Int -> ErrorMsg -> ShowS

show :: ErrorMsg -> String

showList :: [ErrorMsg] -> ShowS

Eq ErrorMsg Source # 
Instance details

Defined in Text.Boomerang.Error

Methods

(==) :: ErrorMsg -> ErrorMsg -> Bool

(/=) :: ErrorMsg -> ErrorMsg -> Bool

Ord ErrorMsg Source # 
Instance details

Defined in Text.Boomerang.Error

Methods

compare :: ErrorMsg -> ErrorMsg -> Ordering

(<) :: ErrorMsg -> ErrorMsg -> Bool

(<=) :: ErrorMsg -> ErrorMsg -> Bool

(>) :: ErrorMsg -> ErrorMsg -> Bool

(>=) :: ErrorMsg -> ErrorMsg -> Bool

max :: ErrorMsg -> ErrorMsg -> ErrorMsg

min :: ErrorMsg -> ErrorMsg -> ErrorMsg

messageString :: ErrorMsg -> String Source #

extract the String from an ErrorMsg. Note: the resulting String will not include any information about what constructor it came from.

data ParserError pos Source #

Constructors

ParserError (Maybe pos) [ErrorMsg] 

Instances

Instances details
InitialPosition StringError Source # 
Instance details

Defined in Text.Boomerang.String

InitialPosition StringsError Source # 
Instance details

Defined in Text.Boomerang.Strings

InitialPosition TextsError Source # 
Instance details

Defined in Text.Boomerang.Texts

Data pos => Data (ParserError pos) Source # 
Instance details

Defined in Text.Boomerang.Error

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ParserError pos -> c (ParserError pos)

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ParserError pos)

toConstr :: ParserError pos -> Constr

dataTypeOf :: ParserError pos -> DataType

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ParserError pos))

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ParserError pos))

gmapT :: (forall b. Data b => b -> b) -> ParserError pos -> ParserError pos

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ParserError pos -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ParserError pos -> r

gmapQ :: (forall d. Data d => d -> u) -> ParserError pos -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> ParserError pos -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ParserError pos -> m (ParserError pos)

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ParserError pos -> m (ParserError pos)

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ParserError pos -> m (ParserError pos)

Show pos => Show (ParserError pos) Source # 
Instance details

Defined in Text.Boomerang.Error

Methods

showsPrec :: Int -> ParserError pos -> ShowS

show :: ParserError pos -> String

showList :: [ParserError pos] -> ShowS

ErrorPosition (ParserError p) Source # 
Instance details

Defined in Text.Boomerang.Error

Methods

getPosition :: ParserError p -> Maybe (Pos (ParserError p)) Source #

Eq pos => Eq (ParserError pos) Source # 
Instance details

Defined in Text.Boomerang.Error

Methods

(==) :: ParserError pos -> ParserError pos -> Bool

(/=) :: ParserError pos -> ParserError pos -> Bool

Ord pos => Ord (ParserError pos) Source # 
Instance details

Defined in Text.Boomerang.Error

Methods

compare :: ParserError pos -> ParserError pos -> Ordering

(<) :: ParserError pos -> ParserError pos -> Bool

(<=) :: ParserError pos -> ParserError pos -> Bool

(>) :: ParserError pos -> ParserError pos -> Bool

(>=) :: ParserError pos -> ParserError pos -> Bool

max :: ParserError pos -> ParserError pos -> ParserError pos

min :: ParserError pos -> ParserError pos -> ParserError pos

Error (ParserError p) Source # 
Instance details

Defined in Text.Boomerang.Error

Methods

noMsg :: ParserError p

strMsg :: String -> ParserError p

a ~ b => IsString (Boomerang StringError String a b) 
Instance details

Defined in Text.Boomerang.String

Methods

fromString :: String -> Boomerang StringError String a b

a ~ b => IsString (Boomerang StringsError [String] a b) 
Instance details

Defined in Text.Boomerang.Strings

Methods

fromString :: String -> Boomerang StringsError [String] a b

a ~ b => IsString (Boomerang TextsError [Text] a b) 
Instance details

Defined in Text.Boomerang.Texts

Methods

fromString :: String -> Boomerang TextsError [Text] a b

type Pos (ParserError p) Source # 
Instance details

Defined in Text.Boomerang.Error

type Pos (ParserError p) = p

mkParserError :: pos -> [ErrorMsg] -> [Either (ParserError pos) a] Source #

lift a pos and '[ErrorMsg]' into a parse error

This is intended to be used inside a Parser like this:

Parser $ \tok pos -> mkParserError pos [Message "just some error..."]

(<?>) :: Boomerang (ParserError p) tok a b -> String -> Boomerang (ParserError p) tok a b infix 0 Source #

annotate a parse error with an additional Expect message

satisfy isUpper <?> 'an uppercase character'

condenseErrors :: Ord pos => [ParserError pos] -> ParserError pos Source #

condense the ParserErrors with the highest parse position into a single ParserError

showErrorMessages :: String -> String -> String -> String -> String -> [ErrorMsg] -> String Source #

Helper function for turning '[ErrorMsg]' into a user-friendly String

showParserError Source #

Arguments

:: (pos -> String)

function to turn the error position into a String

-> ParserError pos

the ParserError

-> String 

turn a parse error into a user-friendly error message