pipes-attoparsec-0.1.0.1: Utilities to convert an Attoparsec parser into a pipe Pipe.

Safe HaskellNone

Control.Proxy.Attoparsec.Types

Contents

Description

This module exports common types used throughout Control.Proxy.Attoparsec.*

Synopsis

Proxy control

data ParserStatus a Source

Status of a parsing Proxy.

Constructors

Parsing

There is a Parser running and waiting for more a input.

Receiving (Resume, a) from upstream would feed input a to the Parser waiting for more input.

Fields

psLength :: Int

Length of input consumed so far.

Failed

A Parser has failed parsing.

Receiving (Resume, a) from upstream would feed input a to a newly started Parser.

Fields

psLeftover :: a

Input not yet consumed when the failure occurred.

psError :: ParserError

Error found while parsing.

Instances

Eq a => Eq (ParserStatus a) 
Show a => Show (ParserStatus a) 

data SupplyUse Source

Indicates how should a parsing Proxy use new input.

Constructors

Start

Start a new parser and fed any new input to it.

Resume

Resume feeding any new input to the current parser waiting for input.

type ParserSupply a = (SupplyUse, a)Source

Input supplied to a parsing Proxy.

The SupplyUse value indicates how the a input chunk should be used.

Error types

data BadInput Source

Reasons for an input value to be unnaceptable.

Constructors

InputTooLong 

Fields

itlLength :: Int

Length of the input.

MalformedInput 

Fields

miParserErrror :: ParserError

Error found while parsing.

Instances

Attoparsec integration

class Eq a => AttoparsecInput a whereSource

A class for valid Attoparsec input types.

Methods

parse :: Parser a b -> a -> IResult a bSource

Run a Parser with input a.

null :: a -> BoolSource

Tests whether a is empty.

drop :: Int -> a -> aSource

Skips the first n elements from a and returns the rest.

length :: a -> IntSource

Number of elements in a.

data ParserError Source

Constructors

ParserError 

Fields

errorContexts :: [String]

Contexts where the error occurred.

errorMessage :: String

Error message.