| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Text.Boomerang.Error
Description
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
Constructors
| ParserError (Maybe pos) [ErrorMsg] |
Instances
| InitialPosition StringError | |
| InitialPosition StringsError | |
| InitialPosition TextsError | |
| Eq pos => Eq (ParserError pos) | |
| Data pos => Data (ParserError pos) | |
| Ord pos => Ord (ParserError pos) | |
| Show pos => Show (ParserError pos) | |
| Error (ParserError p) | |
| ErrorPosition (ParserError p) | |
| Typeable (* -> *) ParserError | |
| (~) * a b => IsString (Boomerang StringError String a b) | |
| (~) * a b => IsString (Boomerang StringsError [String] a b) | |
| (~) * a b => IsString (Boomerang TextsError [Text] a b) | |
| 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
Arguments
| :: (pos -> String) | function to turn the error position into a |
| -> ParserError pos | the |
| -> String |
turn a parse error into a user-friendly error message