trifecta-1.6.2.1: A modern parser combinator library with convenient diagnostics

Copyright(c) Edward Kmett 2011-2015
LicenseBSD3
Maintainerekmett@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Text.Trifecta.Combinators

Description

 

Synopsis

Documentation

class (MonadPlus m, TokenParsing m) => DeltaParsing m where #

This class provides parsers with easy access to:

1) the current line contents. 2) the current position as a Delta. 3) the ability to use sliced on any parser.

Minimal complete definition

line, position, slicedWith

Methods

line :: m ByteString #

Retrieve the contents of the current line (from the beginning of the line)

position :: m Delta #

Retrieve the current position as a Delta.

slicedWith :: (a -> ByteString -> r) -> m a -> m r #

Run a parser, grabbing all of the text between its start and end points

rend :: m Rendering #

Retrieve a Rendering of the current line noting this position, but not placing a Caret there.

restOfLine :: m ByteString #

Grab the remainder of the current line

Instances

DeltaParsing Parser # 
(MonadPlus m, DeltaParsing m) => DeltaParsing (IdentityT * m) # 
(MonadPlus m, DeltaParsing m) => DeltaParsing (StateT s m) # 

Methods

line :: StateT s m ByteString #

position :: StateT s m Delta #

slicedWith :: (a -> ByteString -> r) -> StateT s m a -> StateT s m r #

rend :: StateT s m Rendering #

restOfLine :: StateT s m ByteString #

(MonadPlus m, DeltaParsing m) => DeltaParsing (StateT s m) # 

Methods

line :: StateT s m ByteString #

position :: StateT s m Delta #

slicedWith :: (a -> ByteString -> r) -> StateT s m a -> StateT s m r #

rend :: StateT s m Rendering #

restOfLine :: StateT s m ByteString #

(MonadPlus m, DeltaParsing m, Monoid w) => DeltaParsing (WriterT w m) # 
(MonadPlus m, DeltaParsing m, Monoid w) => DeltaParsing (WriterT w m) # 
(MonadPlus m, DeltaParsing m) => DeltaParsing (ReaderT * e m) # 

Methods

line :: ReaderT * e m ByteString #

position :: ReaderT * e m Delta #

slicedWith :: (a -> ByteString -> r) -> ReaderT * e m a -> ReaderT * e m r #

rend :: ReaderT * e m Rendering #

restOfLine :: ReaderT * e m ByteString #

(MonadPlus m, DeltaParsing m, Monoid w) => DeltaParsing (RWST r w s m) # 

Methods

line :: RWST r w s m ByteString #

position :: RWST r w s m Delta #

slicedWith :: (a -> ByteString -> r) -> RWST r w s m a -> RWST r w s m r #

rend :: RWST r w s m Rendering #

restOfLine :: RWST r w s m ByteString #

(MonadPlus m, DeltaParsing m, Monoid w) => DeltaParsing (RWST r w s m) # 

Methods

line :: RWST r w s m ByteString #

position :: RWST r w s m Delta #

slicedWith :: (a -> ByteString -> r) -> RWST r w s m a -> RWST r w s m r #

rend :: RWST r w s m Rendering #

restOfLine :: RWST r w s m ByteString #

sliced :: DeltaParsing m => m a -> m ByteString #

Run a parser, grabbing all of the text between its start and end points and discarding the original result

careting :: DeltaParsing m => m Caret #

Grab a Caret pointing to the current location.

careted :: DeltaParsing m => m a -> m (Careted a) #

Parse a Careted result. Pointing the Caret to where you start.

spanning :: DeltaParsing m => m a -> m Span #

Discard the result of a parse, returning a Span from where we start to where it ended parsing.

spanned :: DeltaParsing m => m a -> m (Spanned a) #

Parse a Spanned result. The Span starts here and runs to the last position parsed.

fixiting :: DeltaParsing m => m ByteString -> m Fixit #

Grab a fixit.

class (DeltaParsing m, HasDelta d) => MarkParsing d m | m -> d where #

This class is a refinement of DeltaParsing that adds the ability to mark your position in the input and return there for further parsing later.

Minimal complete definition

mark, release

Methods

mark :: m d #

mark the current location so it can be used in constructing a span, or for later seeking

release :: d -> m () #

Seek a previously marked location

Instances

MarkParsing Delta Parser # 

Methods

mark :: Parser Delta #

release :: Delta -> Parser () #

(MonadPlus m, MarkParsing d m) => MarkParsing d (IdentityT * m) # 

Methods

mark :: IdentityT * m d #

release :: d -> IdentityT * m () #

(MonadPlus m, MarkParsing d m, Monoid w) => MarkParsing d (WriterT w m) # 

Methods

mark :: WriterT w m d #

release :: d -> WriterT w m () #

(MonadPlus m, MarkParsing d m, Monoid w) => MarkParsing d (WriterT w m) # 

Methods

mark :: WriterT w m d #

release :: d -> WriterT w m () #

(MonadPlus m, MarkParsing d m) => MarkParsing d (StateT s m) # 

Methods

mark :: StateT s m d #

release :: d -> StateT s m () #

(MonadPlus m, MarkParsing d m) => MarkParsing d (StateT s m) # 

Methods

mark :: StateT s m d #

release :: d -> StateT s m () #

(MonadPlus m, MarkParsing d m) => MarkParsing d (ReaderT * e m) # 

Methods

mark :: ReaderT * e m d #

release :: d -> ReaderT * e m () #

(MonadPlus m, MarkParsing d m, Monoid w) => MarkParsing d (RWST r w s m) # 

Methods

mark :: RWST r w s m d #

release :: d -> RWST r w s m () #

(MonadPlus m, MarkParsing d m, Monoid w) => MarkParsing d (RWST r w s m) # 

Methods

mark :: RWST r w s m d #

release :: d -> RWST r w s m () #