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

Text.Trifecta.Combinators

Description

Synopsis

# Documentation

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

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

Minimal complete definition

Methods

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

Retrieve the current position as a Delta.

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

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

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

Grab the remainder of the current line

Instances

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

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

careting :: DeltaParsing m => m Caret Source #

Grab a Caret pointing to the current location.

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

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

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

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) Source #

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

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

Grab a fixit.

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

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

Methods

mark :: m d Source #

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

release :: d -> m () Source #

Seek a previously marked location

Instances