Safe Haskell | None |
---|---|
Language | Haskell98 |
An Error handling scheme that can be used with Boomerang
- data ErrorMsg
- messageString :: ErrorMsg -> String
- data ParserError pos = ParserError (Maybe pos) [ErrorMsg]
- mkParserError :: pos -> [ErrorMsg] -> [Either (ParserError pos) a]
- (<?>) :: Boomerang (ParserError p) tok a b -> String -> Boomerang (ParserError p) tok a b
- condenseErrors :: Ord pos => [ParserError pos] -> ParserError pos
- showErrorMessages :: String -> String -> String -> String -> String -> [ErrorMsg] -> String
- showParserError :: (pos -> String) -> ParserError pos -> String
Documentation
messageString :: ErrorMsg -> String Source #
data ParserError pos Source #
ParserError (Maybe pos) [ErrorMsg] |
Eq pos => Eq (ParserError pos) Source # | |
Data pos => Data (ParserError pos) Source # | |
Ord pos => Ord (ParserError pos) Source # | |
Show pos => Show (ParserError pos) Source # | |
Error (ParserError p) Source # | |
ErrorPosition (ParserError p) Source # | |
type Pos (ParserError p) Source # | |
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 ParserError
s 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
:: (pos -> String) | function to turn the error position into a |
-> ParserError pos | the |
-> String |
turn a parse error into a user-friendly error message