Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Reporter k a = Reporter {
- unReporter :: forall b. Env k -> State -> (a -> State -> b) -> (State -> b) -> b
- data Env k = Env {
- _envBuf :: !(Buffer k)
- _envEnd :: !Int
- _envFile :: !FilePath
- _envOptions :: !ReportOptions
- _envHidden :: !Bool
- _envCommit :: !Int
- _envContext :: [String]
- _envRefLine :: !Int
- _envRefColumn :: !Int
- data State = State {
- _stOff :: !Int
- _stLine :: !Int
- _stColumn :: !Int
- _stErrOff :: !Int
- _stErrLine :: !Int
- _stErrColumn :: !Int
- _stErrCommit :: !Int
- _stErrors :: [ErrorContext]
- _stReports :: [Report]
- local :: (State -> Env k -> Env k) -> Reporter k a -> Reporter k a
- get :: (Env k -> State -> a) -> Reporter k a
- raiseError :: Env k -> State -> (State -> b) -> Error -> b
- mergeErrorState :: Env k -> State -> State -> State
- data Report = Report {
- _reportFile :: !FilePath
- _reportLine :: !Int
- _reportColumn :: !Int
- _reportErrors :: [ErrorContext]
- runReporter :: Chunk k => Reporter k a -> FilePath -> k -> (Maybe a, [Report])
- runReporterWithOptions :: Chunk k => ReportOptions -> Reporter k a -> FilePath -> k -> (Maybe a, [Report])
- data ErrorContext = ErrorContext {
- _ecErrors :: [Error]
- _ecContext :: [String]
- showReport :: Report -> String
- showErrors :: [ErrorContext] -> String
- data ReportOptions = ReportOptions {}
- defaultReportOptions :: ReportOptions
Documentation
Parser which is optimised for good error reports.
Performance is secondary, since the Reporter
is used
as a fallback to the Acceptor
.
Instances
Env | |
|
State | |
|
local :: (State -> Env k -> Env k) -> Reporter k a -> Reporter k a Source #
Reader monad, modify environment locally
get :: (Env k -> State -> a) -> Reporter k a Source #
Reader monad, get something from the environment
mergeErrorState :: Env k -> State -> State -> State Source #
Merge errors of two states, used when backtracking
Report | |
|
Instances
Eq Report Source # | |
Show Report Source # | |
Generic Report Source # | |
type Rep Report Source # | |
Defined in Text.PariPari.Internal.Reporter type Rep Report = D1 (MetaData "Report" "Text.PariPari.Internal.Reporter" "paripari-0.6.0.1-JCqv7UKAs2N5N8Bslf6KXq" False) (C1 (MetaCons "Report" PrefixI True) ((S1 (MetaSel (Just "_reportFile") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 FilePath) :*: S1 (MetaSel (Just "_reportLine") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Int)) :*: (S1 (MetaSel (Just "_reportColumn") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Int) :*: S1 (MetaSel (Just "_reportErrors") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [ErrorContext])))) |
runReporterWithOptions :: Chunk k => ReportOptions -> Reporter k a -> FilePath -> k -> (Maybe a, [Report]) Source #
Run Reporter
with additional ReportOptions
.
data ErrorContext Source #
ErrorContext | |
|
Instances
showErrors :: [ErrorContext] -> String Source #
Pretty string representation of '[ErrorContext]'.
data ReportOptions Source #