grammatical-parsers-0.7.1: parsers that combine into grammars
Safe HaskellSafe-Inferred
LanguageHaskell2010

Text.Grampa

Description

A collection of parsing algorithms with a common interface, operating on grammars represented as records with rank-2 field types.

Synopsis

Applying parsers

failureDescription :: forall s pos. (Ord s, TextualMonoid s, Position pos) => s -> ParseFailure pos s -> Int -> s Source #

Given the textual parse input, the parse failure on the input, and the number of lines preceding the failure to show, produce a human-readable failure description.

simply :: (Only r (p (Only r) s) -> s -> Only r f) -> p (Only r) s r -> s -> f r Source #

Apply the given parsing function (typically parseComplete or parsePrefix) to the given grammar-agnostic parser and its input. A typical invocation might be

getCompose $ simply parsePrefix myParser myInput

Types

type Grammar (g :: (Type -> Type) -> Type) p s = g (p g s) Source #

Fixed grammar record type g with a given parser type p on input streams of type s

type GrammarBuilder (g :: (Type -> Type) -> Type) (g' :: (Type -> Type) -> Type) (p :: ((Type -> Type) -> Type) -> Type -> Type -> Type) (s :: Type) = g (p g' s) -> g (p g' s) Source #

A GrammarBuilder g g' p s is an endomorphic function on a grammar g, whose parsers of type p build grammars of type g', parsing input streams of type s. The first grammar g may be a building block for the final grammar g'.

type GrammarOverlay (g :: (Type -> Type) -> Type) (m :: Type -> Type) = g m -> g m -> g m Source #

A grammar overlay is a function that takes a final grammar self and the parent grammar super and builds a new grammar from them. Use overlay to apply a colection of overlays on top of a base grammar.

data ParseFailure pos s Source #

A ParseFailure contains the offset of the parse failure and the list of things expected at that offset.

Constructors

ParseFailure 

Fields

Instances

Instances details
Functor (ParseFailure pos) Source # 
Instance details

Defined in Text.Grampa.Class

Methods

fmap :: (a -> b) -> ParseFailure pos a -> ParseFailure pos b #

(<$) :: a -> ParseFailure pos b -> ParseFailure pos a #

Ord s => Monoid (ParseFailure Pos s) Source # 
Instance details

Defined in Text.Grampa.Class

(Ord pos, Ord s) => Semigroup (ParseFailure pos s) Source # 
Instance details

Defined in Text.Grampa.Class

Methods

(<>) :: ParseFailure pos s -> ParseFailure pos s -> ParseFailure pos s #

sconcat :: NonEmpty (ParseFailure pos s) -> ParseFailure pos s #

stimes :: Integral b => b -> ParseFailure pos s -> ParseFailure pos s #

(Show pos, Show s) => Show (ParseFailure pos s) Source # 
Instance details

Defined in Text.Grampa.Class

Methods

showsPrec :: Int -> ParseFailure pos s -> ShowS #

show :: ParseFailure pos s -> String #

showList :: [ParseFailure pos s] -> ShowS #

(Eq pos, Eq s) => Eq (ParseFailure pos s) Source # 
Instance details

Defined in Text.Grampa.Class

Methods

(==) :: ParseFailure pos s -> ParseFailure pos s -> Bool #

(/=) :: ParseFailure pos s -> ParseFailure pos s -> Bool #

data FailureDescription s Source #

An expected or erroneous input can be described using String or using the input type

Instances

Instances details
Functor FailureDescription Source # 
Instance details

Defined in Text.Grampa.Class

Ord s => Monoid (FailureDescription s) Source # 
Instance details

Defined in Text.Grampa.Class

Ord s => Semigroup (FailureDescription s) Source # 
Instance details

Defined in Text.Grampa.Class

Read s => Read (FailureDescription s) Source # 
Instance details

Defined in Text.Grampa.Class

Show s => Show (FailureDescription s) Source # 
Instance details

Defined in Text.Grampa.Class

Eq s => Eq (FailureDescription s) Source # 
Instance details

Defined in Text.Grampa.Class

Ord s => Ord (FailureDescription s) Source # 
Instance details

Defined in Text.Grampa.Class

newtype Ambiguous a Source #

An Ambiguous parse result, produced by the ambiguous combinator, contains a NonEmpty list of alternative results.

Constructors

Ambiguous 

Fields

Instances

Instances details
Foldable Ambiguous Source # 
Instance details

Defined in Text.Grampa.Class

Methods

fold :: Monoid m => Ambiguous m -> m #

foldMap :: Monoid m => (a -> m) -> Ambiguous a -> m #

foldMap' :: Monoid m => (a -> m) -> Ambiguous a -> m #

foldr :: (a -> b -> b) -> b -> Ambiguous a -> b #

foldr' :: (a -> b -> b) -> b -> Ambiguous a -> b #

foldl :: (b -> a -> b) -> b -> Ambiguous a -> b #

foldl' :: (b -> a -> b) -> b -> Ambiguous a -> b #

foldr1 :: (a -> a -> a) -> Ambiguous a -> a #

foldl1 :: (a -> a -> a) -> Ambiguous a -> a #

toList :: Ambiguous a -> [a] #

null :: Ambiguous a -> Bool #

length :: Ambiguous a -> Int #

elem :: Eq a => a -> Ambiguous a -> Bool #

maximum :: Ord a => Ambiguous a -> a #

minimum :: Ord a => Ambiguous a -> a #

sum :: Num a => Ambiguous a -> a #

product :: Num a => Ambiguous a -> a #

Show1 Ambiguous Source # 
Instance details

Defined in Text.Grampa.Class

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Ambiguous a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Ambiguous a] -> ShowS #

Traversable Ambiguous Source # 
Instance details

Defined in Text.Grampa.Class

Methods

traverse :: Applicative f => (a -> f b) -> Ambiguous a -> f (Ambiguous b) #

sequenceA :: Applicative f => Ambiguous (f a) -> f (Ambiguous a) #

mapM :: Monad m => (a -> m b) -> Ambiguous a -> m (Ambiguous b) #

sequence :: Monad m => Ambiguous (m a) -> m (Ambiguous a) #

Applicative Ambiguous Source # 
Instance details

Defined in Text.Grampa.Class

Methods

pure :: a -> Ambiguous a #

(<*>) :: Ambiguous (a -> b) -> Ambiguous a -> Ambiguous b #

liftA2 :: (a -> b -> c) -> Ambiguous a -> Ambiguous b -> Ambiguous c #

(*>) :: Ambiguous a -> Ambiguous b -> Ambiguous b #

(<*) :: Ambiguous a -> Ambiguous b -> Ambiguous a #

Functor Ambiguous Source # 
Instance details

Defined in Text.Grampa.Class

Methods

fmap :: (a -> b) -> Ambiguous a -> Ambiguous b #

(<$) :: a -> Ambiguous b -> Ambiguous a #

Monad Ambiguous Source # 
Instance details

Defined in Text.Grampa.Class

Methods

(>>=) :: Ambiguous a -> (a -> Ambiguous b) -> Ambiguous b #

(>>) :: Ambiguous a -> Ambiguous b -> Ambiguous b #

return :: a -> Ambiguous a #

Data a => Data (Ambiguous a) Source # 
Instance details

Defined in Text.Grampa.Class

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Ambiguous a -> c (Ambiguous a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Ambiguous a) #

toConstr :: Ambiguous a -> Constr #

dataTypeOf :: Ambiguous a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Ambiguous a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Ambiguous a)) #

gmapT :: (forall b. Data b => b -> b) -> Ambiguous a -> Ambiguous a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Ambiguous a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Ambiguous a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Ambiguous a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Ambiguous a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Ambiguous a -> m (Ambiguous a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Ambiguous a -> m (Ambiguous a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Ambiguous a -> m (Ambiguous a) #

Monoid a => Monoid (Ambiguous a) Source # 
Instance details

Defined in Text.Grampa.Class

Semigroup a => Semigroup (Ambiguous a) Source # 
Instance details

Defined in Text.Grampa.Class

Methods

(<>) :: Ambiguous a -> Ambiguous a -> Ambiguous a #

sconcat :: NonEmpty (Ambiguous a) -> Ambiguous a #

stimes :: Integral b => b -> Ambiguous a -> Ambiguous a #

Show a => Show (Ambiguous a) Source # 
Instance details

Defined in Text.Grampa.Class

Eq a => Eq (Ambiguous a) Source # 
Instance details

Defined in Text.Grampa.Class

Methods

(==) :: Ambiguous a -> Ambiguous a -> Bool #

(/=) :: Ambiguous a -> Ambiguous a -> Bool #

Ord a => Ord (Ambiguous a) Source # 
Instance details

Defined in Text.Grampa.Class

AmbiguityDecidable (Ambiguous a) Source # 
Instance details

Defined in Text.Grampa.Internal

Methods

ambiguityWitness :: Maybe (AmbiguityWitness (Ambiguous a))

type Pos = Down Int Source #

A position in the input is represented as the length of its remainder.

Classes

Parsing

class Parsing m => DeterministicParsing (m :: Type -> Type) where #

Combinator methods for constructing deterministic parsers, i.e., parsers that can succeed with only a single result.

Minimal complete definition

Nothing

Methods

(<<|>) :: m a -> m a -> m a infixl 3 #

Left-biased choice: if the left alternative succeeds, the right one is never tried.

takeOptional :: m a -> m (Maybe a) #

Like optional, but never succeeds with Nothing if the argument parser can succeed.

takeMany :: m a -> m [a] #

Like many, but always consuming the longest matching sequence of input.

takeSome :: m a -> m [a] #

Like some, but always consuming the longest matching sequence of input.

concatAll :: Monoid a => m a -> m a #

Like concatMany, but always consuming the longest matching sequence of input.

skipAll :: m a -> m () #

Like skipMany, but always consuming the longest matching sequence of input.

Instances

Instances details
DeterministicParsing Parser 
Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: Parser a -> Parser a -> Parser a #

takeOptional :: Parser a -> Parser (Maybe a) #

takeMany :: Parser a -> Parser [a] #

takeSome :: Parser a -> Parser [a] #

concatAll :: Monoid a => Parser a -> Parser a #

skipAll :: Parser a -> Parser () #

DeterministicParsing Parser 
Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: Parser a -> Parser a -> Parser a #

takeOptional :: Parser a -> Parser (Maybe a) #

takeMany :: Parser a -> Parser [a] #

takeSome :: Parser a -> Parser [a] #

concatAll :: Monoid a => Parser a -> Parser a #

skipAll :: Parser a -> Parser () #

DeterministicParsing ReadP 
Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: ReadP a -> ReadP a -> ReadP a #

takeOptional :: ReadP a -> ReadP (Maybe a) #

takeMany :: ReadP a -> ReadP [a] #

takeSome :: ReadP a -> ReadP [a] #

concatAll :: Monoid a => ReadP a -> ReadP a #

skipAll :: ReadP a -> ReadP () #

DeterministicParsing (Lazy Get) 
Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: Lazy Get a -> Lazy Get a -> Lazy Get a #

takeOptional :: Lazy Get a -> Lazy Get (Maybe a) #

takeMany :: Lazy Get a -> Lazy Get [a] #

takeSome :: Lazy Get a -> Lazy Get [a] #

concatAll :: Monoid a => Lazy Get a -> Lazy Get a #

skipAll :: Lazy Get a -> Lazy Get () #

DeterministicParsing (Strict Get) 
Instance details

Defined in Text.Parser.Deterministic

(FactorialMonoid s, Ord s) => DeterministicParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Continued

Methods

(<<|>) :: Parser g s a -> Parser g s a -> Parser g s a #

takeOptional :: Parser g s a -> Parser g s (Maybe a) #

takeMany :: Parser g s a -> Parser g s [a] #

takeSome :: Parser g s a -> Parser g s [a] #

concatAll :: Monoid a => Parser g s a -> Parser g s a #

skipAll :: Parser g s a -> Parser g s () #

(MonoidNull s, Ord s) => DeterministicParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Memoizing

Methods

(<<|>) :: Parser g s a -> Parser g s a -> Parser g s a #

takeOptional :: Parser g s a -> Parser g s (Maybe a) #

takeMany :: Parser g s a -> Parser g s [a] #

takeSome :: Parser g s a -> Parser g s [a] #

concatAll :: Monoid a => Parser g s a -> Parser g s a #

skipAll :: Parser g s a -> Parser g s () #

(FactorialMonoid s, Ord s) => DeterministicParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Methods

(<<|>) :: Parser g s a -> Parser g s a -> Parser g s a #

takeOptional :: Parser g s a -> Parser g s (Maybe a) #

takeMany :: Parser g s a -> Parser g s [a] #

takeSome :: Parser g s a -> Parser g s [a] #

concatAll :: Monoid a => Parser g s a -> Parser g s a #

skipAll :: Parser g s a -> Parser g s () #

(MonoidNull s, Ord s) => DeterministicParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing

Methods

(<<|>) :: Parser g s a -> Parser g s a -> Parser g s a #

takeOptional :: Parser g s a -> Parser g s (Maybe a) #

takeMany :: Parser g s a -> Parser g s [a] #

takeSome :: Parser g s a -> Parser g s [a] #

concatAll :: Monoid a => Parser g s a -> Parser g s a #

skipAll :: Parser g s a -> Parser g s () #

FactorialMonoid s => DeterministicParsing (Parser g s) Source #

Every PEG parser is deterministic all the time.

Instance details

Defined in Text.Grampa.PEG.Backtrack

Methods

(<<|>) :: Parser g s a -> Parser g s a -> Parser g s a #

takeOptional :: Parser g s a -> Parser g s (Maybe a) #

takeMany :: Parser g s a -> Parser g s [a] #

takeSome :: Parser g s a -> Parser g s [a] #

concatAll :: Monoid a => Parser g s a -> Parser g s a #

skipAll :: Parser g s a -> Parser g s () #

FactorialMonoid s => DeterministicParsing (Parser g s) Source #

Every PEG parser is deterministic all the time.

Instance details

Defined in Text.Grampa.PEG.Packrat

Methods

(<<|>) :: Parser g s a -> Parser g s a -> Parser g s a #

takeOptional :: Parser g s a -> Parser g s (Maybe a) #

takeMany :: Parser g s a -> Parser g s [a] #

takeSome :: Parser g s a -> Parser g s [a] #

concatAll :: Monoid a => Parser g s a -> Parser g s a #

skipAll :: Parser g s a -> Parser g s () #

(Monad m, DeterministicParsing m) => DeterministicParsing (IdentityT m) 
Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: IdentityT m a -> IdentityT m a -> IdentityT m a #

takeOptional :: IdentityT m a -> IdentityT m (Maybe a) #

takeMany :: IdentityT m a -> IdentityT m [a] #

takeSome :: IdentityT m a -> IdentityT m [a] #

concatAll :: Monoid a => IdentityT m a -> IdentityT m a #

skipAll :: IdentityT m a -> IdentityT m () #

(MonadPlus m, DeterministicParsing m) => DeterministicParsing (ReaderT e m) 
Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: ReaderT e m a -> ReaderT e m a -> ReaderT e m a #

takeOptional :: ReaderT e m a -> ReaderT e m (Maybe a) #

takeMany :: ReaderT e m a -> ReaderT e m [a] #

takeSome :: ReaderT e m a -> ReaderT e m [a] #

concatAll :: Monoid a => ReaderT e m a -> ReaderT e m a #

skipAll :: ReaderT e m a -> ReaderT e m () #

(MonadPlus m, DeterministicParsing m, Monoid w) => DeterministicParsing (StateT w m) 
Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: StateT w m a -> StateT w m a -> StateT w m a #

takeOptional :: StateT w m a -> StateT w m (Maybe a) #

takeMany :: StateT w m a -> StateT w m [a] #

takeSome :: StateT w m a -> StateT w m [a] #

concatAll :: Monoid a => StateT w m a -> StateT w m a #

skipAll :: StateT w m a -> StateT w m () #

(MonadPlus m, DeterministicParsing m, Monoid w) => DeterministicParsing (StateT w m) 
Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: StateT w m a -> StateT w m a -> StateT w m a #

takeOptional :: StateT w m a -> StateT w m (Maybe a) #

takeMany :: StateT w m a -> StateT w m [a] #

takeSome :: StateT w m a -> StateT w m [a] #

concatAll :: Monoid a => StateT w m a -> StateT w m a #

skipAll :: StateT w m a -> StateT w m () #

(MonadPlus m, DeterministicParsing m, Monoid w) => DeterministicParsing (WriterT w m) 
Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: WriterT w m a -> WriterT w m a -> WriterT w m a #

takeOptional :: WriterT w m a -> WriterT w m (Maybe a) #

takeMany :: WriterT w m a -> WriterT w m [a] #

takeSome :: WriterT w m a -> WriterT w m [a] #

concatAll :: Monoid a => WriterT w m a -> WriterT w m a #

skipAll :: WriterT w m a -> WriterT w m () #

(MonadPlus m, DeterministicParsing m, Monoid w) => DeterministicParsing (WriterT w m) 
Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: WriterT w m a -> WriterT w m a -> WriterT w m a #

takeOptional :: WriterT w m a -> WriterT w m (Maybe a) #

takeMany :: WriterT w m a -> WriterT w m [a] #

takeSome :: WriterT w m a -> WriterT w m [a] #

concatAll :: Monoid a => WriterT w m a -> WriterT w m a #

skipAll :: WriterT w m a -> WriterT w m () #

(Applicative m, MonoidNull s, Ord s) => DeterministicParsing (ParserT m g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing.Transformer

Methods

(<<|>) :: ParserT m g s a -> ParserT m g s a -> ParserT m g s a #

takeOptional :: ParserT m g s a -> ParserT m g s (Maybe a) #

takeMany :: ParserT m g s a -> ParserT m g s [a] #

takeSome :: ParserT m g s a -> ParserT m g s [a] #

concatAll :: Monoid a => ParserT m g s a -> ParserT m g s a #

skipAll :: ParserT m g s a -> ParserT m g s () #

(Apply g, InputParsing (Fixed p g s), DeterministicParsing (p g s)) => DeterministicParsing (Fixed p g s) Source # 
Instance details

Defined in Text.Grampa.Internal.LeftRecursive

Methods

(<<|>) :: Fixed p g s a -> Fixed p g s a -> Fixed p g s a #

takeOptional :: Fixed p g s a -> Fixed p g s (Maybe a) #

takeMany :: Fixed p g s a -> Fixed p g s [a] #

takeSome :: Fixed p g s a -> Fixed p g s [a] #

concatAll :: Monoid a => Fixed p g s a -> Fixed p g s a #

skipAll :: Fixed p g s a -> Fixed p g s () #

(MonadPlus m, DeterministicParsing m, Monoid w) => DeterministicParsing (RWST r w s m) 
Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: RWST r w s m a -> RWST r w s m a -> RWST r w s m a #

takeOptional :: RWST r w s m a -> RWST r w s m (Maybe a) #

takeMany :: RWST r w s m a -> RWST r w s m [a] #

takeSome :: RWST r w s m a -> RWST r w s m [a] #

concatAll :: Monoid a => RWST r w s m a -> RWST r w s m a #

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

(MonadPlus m, DeterministicParsing m, Monoid w) => DeterministicParsing (RWST r w s m) 
Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: RWST r w s m a -> RWST r w s m a -> RWST r w s m a #

takeOptional :: RWST r w s m a -> RWST r w s m (Maybe a) #

takeMany :: RWST r w s m a -> RWST r w s m [a] #

takeSome :: RWST r w s m a -> RWST r w s m [a] #

concatAll :: Monoid a => RWST r w s m a -> RWST r w s m a #

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

class Alternative m => AmbiguousParsing m where Source #

Parsers that can produce alternative parses and collect them into an Ambiguous node

Methods

ambiguous :: m a -> m (Ambiguous a) Source #

Collect all alternative parses of the same length into a NonEmpty list of results.

Instances

Instances details
Ord s => AmbiguousParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing

Methods

ambiguous :: Parser g s a -> Parser g s (Ambiguous a) Source #

(Applicative m, Eq (m ()), Ord s) => AmbiguousParsing (ParserT m g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing.Transformer

Methods

ambiguous :: ParserT m g s a -> ParserT m g s (Ambiguous a) Source #

(AmbiguousParsing (p g s), Apply g) => AmbiguousParsing (Fixed p g s) Source # 
Instance details

Defined in Text.Grampa.Internal.LeftRecursive

Methods

ambiguous :: Fixed p g s a -> Fixed p g s (Ambiguous a) Source #

class Alternative m => CommittedParsing m where Source #

Parsers that can temporarily package and delay failure, in a way dual to Parsec's try combinator. Where Parsec would require something like

alternatives  =  try intro1 *> expected1
             <|> try intro2 *> expected2
             <|> fallback

you can instead say

alternatives = admit  $  intro1 *> commit expected1
                     <|> intro2 *> commit expected2
                     <|> commit fallback

A parsing failure inside an intro parser leaves the other alternatives open, a failure inside an expected parser bubbles up and out of the whole admit block.

Associated Types

type CommittedResults m :: Type -> Type Source #

Methods

commit :: m a -> m (CommittedResults m a) Source #

Commits the argument parser to success.

admit :: m (CommittedResults m a) -> m a Source #

Admits a possible defeat of the argument parser.

Instances

Instances details
(FactorialMonoid s, Ord s) => CommittedParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Continued

Associated Types

type CommittedResults (Parser g s) :: Type -> Type Source #

Methods

commit :: Parser g s a -> Parser g s (CommittedResults (Parser g s) a) Source #

admit :: Parser g s (CommittedResults (Parser g s) a) -> Parser g s a Source #

(FactorialMonoid s, Ord s) => CommittedParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Associated Types

type CommittedResults (Parser g s) :: Type -> Type Source #

Methods

commit :: Parser g s a -> Parser g s (CommittedResults (Parser g s) a) Source #

admit :: Parser g s (CommittedResults (Parser g s) a) -> Parser g s a Source #

Ord s => CommittedParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing

Associated Types

type CommittedResults (Parser g s) :: Type -> Type Source #

Methods

commit :: Parser g s a -> Parser g s (CommittedResults (Parser g s) a) Source #

admit :: Parser g s (CommittedResults (Parser g s) a) -> Parser g s a Source #

FactorialMonoid s => CommittedParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.PEG.Backtrack

Associated Types

type CommittedResults (Parser g s) :: Type -> Type Source #

Methods

commit :: Parser g s a -> Parser g s (CommittedResults (Parser g s) a) Source #

admit :: Parser g s (CommittedResults (Parser g s) a) -> Parser g s a Source #

FactorialMonoid s => CommittedParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.PEG.Packrat

Associated Types

type CommittedResults (Parser g s) :: Type -> Type Source #

Methods

commit :: Parser g s a -> Parser g s (CommittedResults (Parser g s) a) Source #

admit :: Parser g s (CommittedResults (Parser g s) a) -> Parser g s a Source #

(Applicative m, Traversable m, Ord s) => CommittedParsing (ParserT m g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing.Transformer

Associated Types

type CommittedResults (ParserT m g s) :: Type -> Type Source #

Methods

commit :: ParserT m g s a -> ParserT m g s (CommittedResults (ParserT m g s) a) Source #

admit :: ParserT m g s (CommittedResults (ParserT m g s) a) -> ParserT m g s a Source #

(Apply g, CommittedParsing (p g s), CommittedResults (p g s) ~ ParseResults s) => CommittedParsing (Fixed p g s) Source # 
Instance details

Defined in Text.Grampa.Internal.LeftRecursive

Associated Types

type CommittedResults (Fixed p g s) :: Type -> Type Source #

Methods

commit :: Fixed p g s a -> Fixed p g s (CommittedResults (Fixed p g s) a) Source #

admit :: Fixed p g s (CommittedResults (Fixed p g s) a) -> Fixed p g s a Source #

class InputParsing m => TraceableParsing m where Source #

Minimal complete definition

traceInput

Methods

traceInput :: (ParserInput m -> String) -> m a -> m a Source #

traceAs :: Show (ParserInput m) => String -> m a -> m a Source #

Instances

Instances details
(InputParsing (Parser g s), FactorialMonoid s) => TraceableParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Continued

Methods

traceInput :: (ParserInput (Parser g s) -> String) -> Parser g s a -> Parser g s a Source #

traceAs :: Show (ParserInput (Parser g s)) => String -> Parser g s a -> Parser g s a Source #

InputParsing (Parser g s) => TraceableParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Memoizing

Methods

traceInput :: (ParserInput (Parser g s) -> String) -> Parser g s a -> Parser g s a Source #

traceAs :: Show (ParserInput (Parser g s)) => String -> Parser g s a -> Parser g s a Source #

(FactorialMonoid s, InputParsing (Parser g s)) => TraceableParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Methods

traceInput :: (ParserInput (Parser g s) -> String) -> Parser g s a -> Parser g s a Source #

traceAs :: Show (ParserInput (Parser g s)) => String -> Parser g s a -> Parser g s a Source #

(InputParsing (Parser g s), FactorialMonoid s) => TraceableParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing

Methods

traceInput :: (ParserInput (Parser g s) -> String) -> Parser g s a -> Parser g s a Source #

traceAs :: Show (ParserInput (Parser g s)) => String -> Parser g s a -> Parser g s a Source #

(InputParsing (Parser g s), FactorialMonoid s) => TraceableParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.PEG.Backtrack

Methods

traceInput :: (ParserInput (Parser g s) -> String) -> Parser g s a -> Parser g s a Source #

traceAs :: Show (ParserInput (Parser g s)) => String -> Parser g s a -> Parser g s a Source #

(InputParsing (Parser g s), FactorialMonoid s) => TraceableParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.PEG.Packrat

Methods

traceInput :: (ParserInput (Parser g s) -> String) -> Parser g s a -> Parser g s a Source #

traceAs :: Show (ParserInput (Parser g s)) => String -> Parser g s a -> Parser g s a Source #

(InputParsing (ParserT m g s), FactorialMonoid s) => TraceableParsing (ParserT m g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing.Transformer

Methods

traceInput :: (ParserInput (ParserT m g s) -> String) -> ParserT m g s a -> ParserT m g s a Source #

traceAs :: Show (ParserInput (ParserT m g s)) => String -> ParserT m g s a -> ParserT m g s a Source #

(Apply g, LeftReductive s, FactorialMonoid s, Show s, TraceableParsing (p g s), ParserInput (p g s) ~ s) => TraceableParsing (Fixed p g s) Source # 
Instance details

Defined in Text.Grampa.Internal.LeftRecursive

Methods

traceInput :: (ParserInput (Fixed p g s) -> String) -> Fixed p g s a -> Fixed p g s a Source #

traceAs :: Show (ParserInput (Fixed p g s)) => String -> Fixed p g s a -> Fixed p g s a Source #

class (DeterministicParsing m, InputCharParsing m, TokenParsing m) => LexicalParsing m where Source #

If a grammar is Lexical, its parsers can instantiate the TokenParsing class.

Minimal complete definition

Nothing

Methods

lexicalWhiteSpace :: m () Source #

Always succeeds, consuming all white space and comments

someLexicalSpace :: m () Source #

Consumes all whitespace and comments, failing if there are none

lexicalComment :: m () Source #

Consumes a single comment, defaults to empty

lexicalSemicolon :: m Char Source #

Consumes a single semicolon and any trailing whitespace, returning the character |';'|. The method can be overridden for automatic semicolon insertion, but if it succeeds on semicolon or white space input it must consume it.

lexicalToken :: m a -> m a Source #

Applies the argument parser and consumes the trailing lexicalWhitespace

identifierToken :: m (ParserInput m) -> m (ParserInput m) Source #

Applies the argument parser, determines whether its result is a legal identifier, and consumes the trailing lexicalWhitespace

isIdentifierStartChar :: Char -> Bool Source #

Determines whether the given character can start an identifier token, allows only a letter or underscore by default

isIdentifierFollowChar :: Char -> Bool Source #

Determines whether the given character can be any part of an identifier token, also allows numbers

identifier :: m (ParserInput m) Source #

Parses a valid identifier and consumes the trailing lexicalWhitespace

keyword :: ParserInput m -> m () Source #

Parses the argument word whole, not followed by any identifier character, and consumes the trailing lexicalWhitespace

Grammars

class InputParsing m => MultiParsing m where Source #

Choose one of the instances of this class to parse with.

Associated Types

type ResultFunctor m :: Type -> Type Source #

Some parser types produce a single result, others a list of results.

type GrammarConstraint m (g :: (Type -> Type) -> Type) :: Constraint Source #

Methods

parseComplete :: (ParserInput m ~ s, GrammarConstraint m g, Eq s, FactorialMonoid s) => g m -> s -> g (ResultFunctor m) Source #

Given a rank-2 record of parsers and input, produce a record of parses of the complete input.

parsePrefix :: (ParserInput m ~ s, GrammarConstraint m g, Eq s, FactorialMonoid s) => g m -> s -> g (Compose (ResultFunctor m) ((,) s)) Source #

Given a rank-2 record of parsers and input, produce a record of prefix parses paired with the remaining input suffix.

Instances

Instances details
(LeftReductive s, FactorialMonoid s, Ord s) => MultiParsing (Parser g s) Source #

Continuation-passing context-free parser

parseComplete :: (Rank2.Functor g, FactorialMonoid s) =>
                 g (Continued.Parser g s) -> s -> g (ParseResults s)
Instance details

Defined in Text.Grampa.ContextFree.Continued

Associated Types

type ResultFunctor (Parser g s) :: Type -> Type Source #

type GrammarConstraint (Parser g s) g Source #

Methods

parseComplete :: (ParserInput (Parser g s) ~ s0, GrammarConstraint (Parser g s) g0, Eq s0, FactorialMonoid s0) => g0 (Parser g s) -> s0 -> g0 (ResultFunctor (Parser g s)) Source #

parsePrefix :: (ParserInput (Parser g s) ~ s0, GrammarConstraint (Parser g s) g0, Eq s0, FactorialMonoid s0) => g0 (Parser g s) -> s0 -> g0 (Compose (ResultFunctor (Parser g s)) ((,) s0)) Source #

(LeftReductive s, FactorialMonoid s, Ord s) => MultiParsing (Parser g s) Source #

Memoizing parser guarantees O(n²) performance for grammars with unambiguous productions, but provides no left recursion support.

parseComplete :: (Rank2.Functor g, FactorialMonoid s) =>
                 g (Memoizing.Parser g s) -> s -> g (Compose (ParseResults s) [])
Instance details

Defined in Text.Grampa.ContextFree.Memoizing

Associated Types

type ResultFunctor (Parser g s) :: Type -> Type Source #

type GrammarConstraint (Parser g s) g Source #

Methods

parseComplete :: (ParserInput (Parser g s) ~ s0, GrammarConstraint (Parser g s) g0, Eq s0, FactorialMonoid s0) => g0 (Parser g s) -> s0 -> g0 (ResultFunctor (Parser g s)) Source #

parsePrefix :: (ParserInput (Parser g s) ~ s0, GrammarConstraint (Parser g s) g0, Eq s0, FactorialMonoid s0) => g0 (Parser g s) -> s0 -> g0 (Compose (ResultFunctor (Parser g s)) ((,) s0)) Source #

(LeftReductive s, FactorialMonoid s, Ord s) => MultiParsing (Parser g s) Source #

Parallel parser produces a list of all possible parses.

parseComplete :: (Rank2.Functor g, Eq s, FactorialMonoid s) =>
                 g (Parallel.Parser g s) -> s -> g (Compose (ParseResults s) [])
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Associated Types

type ResultFunctor (Parser g s) :: Type -> Type Source #

type GrammarConstraint (Parser g s) g Source #

Methods

parseComplete :: (ParserInput (Parser g s) ~ s0, GrammarConstraint (Parser g s) g0, Eq s0, FactorialMonoid s0) => g0 (Parser g s) -> s0 -> g0 (ResultFunctor (Parser g s)) Source #

parsePrefix :: (ParserInput (Parser g s) ~ s0, GrammarConstraint (Parser g s) g0, Eq s0, FactorialMonoid s0) => g0 (Parser g s) -> s0 -> g0 (Compose (ResultFunctor (Parser g s)) ((,) s0)) Source #

(LeftReductive s, FactorialMonoid s, Ord s) => MultiParsing (Parser g s) Source #

Memoizing parser guarantees O(n²) performance for grammars with unambiguous productions. Can be wrapped with Fixed to provide left recursion support.

parseComplete :: (Rank2.Functor g, FactorialMonoid s) =>
                 g (Memoizing.Parser g s) -> s -> g (Compose (ParseResults s) [])
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing

Associated Types

type ResultFunctor (Parser g s) :: Type -> Type Source #

type GrammarConstraint (Parser g s) g Source #

Methods

parseComplete :: (ParserInput (Parser g s) ~ s0, GrammarConstraint (Parser g s) g0, Eq s0, FactorialMonoid s0) => g0 (Parser g s) -> s0 -> g0 (ResultFunctor (Parser g s)) Source #

parsePrefix :: (ParserInput (Parser g s) ~ s0, GrammarConstraint (Parser g s) g0, Eq s0, FactorialMonoid s0) => g0 (Parser g s) -> s0 -> g0 (Compose (ResultFunctor (Parser g s)) ((,) s0)) Source #

(LeftReductive s, FactorialMonoid s) => MultiParsing (Parser g s) Source #

Backtracking PEG parser

parseComplete :: (Rank2.Functor g, FactorialMonoid s) =>
                 g (Backtrack.Parser g s) -> s -> g (ParseResults s)
Instance details

Defined in Text.Grampa.PEG.Backtrack

Associated Types

type ResultFunctor (Parser g s) :: Type -> Type Source #

type GrammarConstraint (Parser g s) g Source #

Methods

parseComplete :: (ParserInput (Parser g s) ~ s0, GrammarConstraint (Parser g s) g0, Eq s0, FactorialMonoid s0) => g0 (Parser g s) -> s0 -> g0 (ResultFunctor (Parser g s)) Source #

parsePrefix :: (ParserInput (Parser g s) ~ s0, GrammarConstraint (Parser g s) g0, Eq s0, FactorialMonoid s0) => g0 (Parser g s) -> s0 -> g0 (Compose (ResultFunctor (Parser g s)) ((,) s0)) Source #

(LeftReductive s, FactorialMonoid s) => MultiParsing (Parser g s) Source #

Packrat parser

parseComplete :: (Rank2.Functor g, FactorialMonoid s) =>
                 g (Packrat.Parser g s) -> s -> g (ParseResults s)
Instance details

Defined in Text.Grampa.PEG.Packrat

Associated Types

type ResultFunctor (Parser g s) :: Type -> Type Source #

type GrammarConstraint (Parser g s) g Source #

Methods

parseComplete :: (ParserInput (Parser g s) ~ s0, GrammarConstraint (Parser g s) g0, Eq s0, FactorialMonoid s0) => g0 (Parser g s) -> s0 -> g0 (ResultFunctor (Parser g s)) Source #

parsePrefix :: (ParserInput (Parser g s) ~ s0, GrammarConstraint (Parser g s) g0, Eq s0, FactorialMonoid s0) => g0 (Parser g s) -> s0 -> g0 (Compose (ResultFunctor (Parser g s)) ((,) s0)) Source #

(Applicative m, LeftReductive s, FactorialMonoid s, Ord s) => MultiParsing (ParserT m g s) Source #

Memoizing parser that carries an applicative computation. Can be wrapped with Fixed to provide left recursion support.

parseComplete :: (Rank2.Functor g, FactorialMonoid s) =>
                 g (Memoizing.Parser g s) -> s -> g (Compose (ParseResults s) [])
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing.Transformer

Associated Types

type ResultFunctor (ParserT m g s) :: Type -> Type Source #

type GrammarConstraint (ParserT m g s) g Source #

Methods

parseComplete :: (ParserInput (ParserT m g s) ~ s0, GrammarConstraint (ParserT m g s) g0, Eq s0, FactorialMonoid s0) => g0 (ParserT m g s) -> s0 -> g0 (ResultFunctor (ParserT m g s)) Source #

parsePrefix :: (ParserInput (ParserT m g s) ~ s0, GrammarConstraint (ParserT m g s) g0, Eq s0, FactorialMonoid s0) => g0 (ParserT m g s) -> s0 -> g0 (Compose (ResultFunctor (ParserT m g s)) ((,) s0)) Source #

(Apply g, GrammarFunctor (p g s) ~ f s, LeftRecParsing p g s f) => MultiParsing (Fixed p g s) Source #

Parser transformer for left-recursive grammars.

parseComplete :: (Rank2.Apply g, Rank2.Traversable g, FactorialMonoid s) =>
                 g (LeftRecursive.Parser g s) -> s -> g (Compose (ParseResults s) [])
Instance details

Defined in Text.Grampa.Internal.LeftRecursive

Associated Types

type ResultFunctor (Fixed p g s) :: Type -> Type Source #

type GrammarConstraint (Fixed p g s) g Source #

Methods

parseComplete :: (ParserInput (Fixed p g s) ~ s0, GrammarConstraint (Fixed p g s) g0, Eq s0, FactorialMonoid s0) => g0 (Fixed p g s) -> s0 -> g0 (ResultFunctor (Fixed p g s)) Source #

parsePrefix :: (ParserInput (Fixed p g s) ~ s0, GrammarConstraint (Fixed p g s) g0, Eq s0, FactorialMonoid s0) => g0 (Fixed p g s) -> s0 -> g0 (Compose (ResultFunctor (Fixed p g s)) ((,) s0)) Source #

class MultiParsing m => GrammarParsing m where Source #

Parsers that belong to this class can memoize the parse results to avoid exponential performance complexity.

Associated Types

type ParserGrammar m :: (Type -> Type) -> Type Source #

The record of grammar productions associated with the parser

type GrammarFunctor m :: Type -> Type Source #

For internal use by notTerminal

Methods

parsingResult :: ParserInput m -> GrammarFunctor m a -> ResultFunctor m (ParserInput m, a) Source #

Converts the intermediate to final parsing result.

nonTerminal :: (g ~ ParserGrammar m, GrammarConstraint m g) => (g (GrammarFunctor m) -> GrammarFunctor m a) -> m a Source #

Used to reference a grammar production, only necessary from outside the grammar itself

selfReferring :: (g ~ ParserGrammar m, GrammarConstraint m g, Distributive g) => g m Source #

Construct a grammar whose every production refers to itself.

fixGrammar :: (g ~ ParserGrammar m, GrammarConstraint m g, Distributive g) => (g m -> g m) -> g m Source #

Convert a self-referring grammar function to a grammar.

recursive :: m a -> m a Source #

Mark a parser that relies on primitive recursion to prevent an infinite loop in fixGrammar.

chainRecursive Source #

Arguments

:: (g ~ ParserGrammar m, f ~ GrammarFunctor m, GrammarConstraint m g) 
=> (f a -> g f -> g f)

setter for the parsed results of each iteration

-> m a

the non-recursive base case

-> m a

the recursive case to iterate

-> m a 

Convert a left-recursive parser to a non-left-recursive one. For example, you can replace the left-recursive production

foo = BinOp <$> foo <*> bar <|> baz

in the field foo of grammar g with

foo = chainRecursive (\x g-> g{foo = x}) baz (BinOp <$> foo <*> bar)

This method works on individual parsers left-recursive on themselves, not on grammars with mutually left-recursive productions. Use Text.Grampa.ContextFree.Memoizing.LeftRecursive for the latter.

chainLongestRecursive Source #

Arguments

:: (g ~ ParserGrammar m, f ~ GrammarFunctor m, GrammarConstraint m g) 
=> (f a -> g f -> g f)

setter for the parsed results of each iteration

-> m a

the non-recursive base case

-> m a

the recursive case to iterate

-> m a 

Line chainRecursive but produces only the longest possible parse. The modified example

foo = chainLongestRecursive (\x g-> g{foo = x}) baz (BinOp <$> foo <*> bar)

would be equivalent to the left-recursive production with biased choice

foo = BinOp <$> foo <*> bar <<|> baz

Instances

Instances details
(Ord s, LeftReductive s, FactorialMonoid s) => GrammarParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Memoizing

Associated Types

type ParserGrammar (Parser g s) :: (Type -> Type) -> Type Source #

type GrammarFunctor (Parser g s) :: Type -> Type Source #

Methods

parsingResult :: ParserInput (Parser g s) -> GrammarFunctor (Parser g s) a -> ResultFunctor (Parser g s) (ParserInput (Parser g s), a) Source #

nonTerminal :: (g0 ~ ParserGrammar (Parser g s), GrammarConstraint (Parser g s) g0) => (g0 (GrammarFunctor (Parser g s)) -> GrammarFunctor (Parser g s) a) -> Parser g s a Source #

selfReferring :: (g0 ~ ParserGrammar (Parser g s), GrammarConstraint (Parser g s) g0, Distributive g0) => g0 (Parser g s) Source #

fixGrammar :: (g0 ~ ParserGrammar (Parser g s), GrammarConstraint (Parser g s) g0, Distributive g0) => (g0 (Parser g s) -> g0 (Parser g s)) -> g0 (Parser g s) Source #

recursive :: Parser g s a -> Parser g s a Source #

chainRecursive :: (g0 ~ ParserGrammar (Parser g s), f ~ GrammarFunctor (Parser g s), GrammarConstraint (Parser g s) g0) => (f a -> g0 f -> g0 f) -> Parser g s a -> Parser g s a -> Parser g s a Source #

chainLongestRecursive :: (g0 ~ ParserGrammar (Parser g s), f ~ GrammarFunctor (Parser g s), GrammarConstraint (Parser g s) g0) => (f a -> g0 f -> g0 f) -> Parser g s a -> Parser g s a -> Parser g s a Source #

(Ord s, LeftReductive s, FactorialMonoid s) => GrammarParsing (Parser g s) Source #

Memoizing parser guarantees O(n²) performance for grammars with unambiguous productions. Can be wrapped with Fixed to provide left recursion support.

Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing

Associated Types

type ParserGrammar (Parser g s) :: (Type -> Type) -> Type Source #

type GrammarFunctor (Parser g s) :: Type -> Type Source #

Methods

parsingResult :: ParserInput (Parser g s) -> GrammarFunctor (Parser g s) a -> ResultFunctor (Parser g s) (ParserInput (Parser g s), a) Source #

nonTerminal :: (g0 ~ ParserGrammar (Parser g s), GrammarConstraint (Parser g s) g0) => (g0 (GrammarFunctor (Parser g s)) -> GrammarFunctor (Parser g s) a) -> Parser g s a Source #

selfReferring :: (g0 ~ ParserGrammar (Parser g s), GrammarConstraint (Parser g s) g0, Distributive g0) => g0 (Parser g s) Source #

fixGrammar :: (g0 ~ ParserGrammar (Parser g s), GrammarConstraint (Parser g s) g0, Distributive g0) => (g0 (Parser g s) -> g0 (Parser g s)) -> g0 (Parser g s) Source #

recursive :: Parser g s a -> Parser g s a Source #

chainRecursive :: (g0 ~ ParserGrammar (Parser g s), f ~ GrammarFunctor (Parser g s), GrammarConstraint (Parser g s) g0) => (f a -> g0 f -> g0 f) -> Parser g s a -> Parser g s a -> Parser g s a Source #

chainLongestRecursive :: (g0 ~ ParserGrammar (Parser g s), f ~ GrammarFunctor (Parser g s), GrammarConstraint (Parser g s) g0) => (f a -> g0 f -> g0 f) -> Parser g s a -> Parser g s a -> Parser g s a Source #

(Eq s, LeftReductive s, FactorialMonoid s) => GrammarParsing (Parser g s) Source #

Packrat parser

Instance details

Defined in Text.Grampa.PEG.Packrat

Associated Types

type ParserGrammar (Parser g s) :: (Type -> Type) -> Type Source #

type GrammarFunctor (Parser g s) :: Type -> Type Source #

Methods

parsingResult :: ParserInput (Parser g s) -> GrammarFunctor (Parser g s) a -> ResultFunctor (Parser g s) (ParserInput (Parser g s), a) Source #

nonTerminal :: (g0 ~ ParserGrammar (Parser g s), GrammarConstraint (Parser g s) g0) => (g0 (GrammarFunctor (Parser g s)) -> GrammarFunctor (Parser g s) a) -> Parser g s a Source #

selfReferring :: (g0 ~ ParserGrammar (Parser g s), GrammarConstraint (Parser g s) g0, Distributive g0) => g0 (Parser g s) Source #

fixGrammar :: (g0 ~ ParserGrammar (Parser g s), GrammarConstraint (Parser g s) g0, Distributive g0) => (g0 (Parser g s) -> g0 (Parser g s)) -> g0 (Parser g s) Source #

recursive :: Parser g s a -> Parser g s a Source #

chainRecursive :: (g0 ~ ParserGrammar (Parser g s), f ~ GrammarFunctor (Parser g s), GrammarConstraint (Parser g s) g0) => (f a -> g0 f -> g0 f) -> Parser g s a -> Parser g s a -> Parser g s a Source #

chainLongestRecursive :: (g0 ~ ParserGrammar (Parser g s), f ~ GrammarFunctor (Parser g s), GrammarConstraint (Parser g s) g0) => (f a -> g0 f -> g0 f) -> Parser g s a -> Parser g s a -> Parser g s a Source #

(Applicative m, Ord s, LeftReductive s, FactorialMonoid s) => GrammarParsing (ParserT m g s) Source #

Memoizing parser that carries an applicative computation. Can be wrapped with Fixed to provide left recursion support.

Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing.Transformer

Associated Types

type ParserGrammar (ParserT m g s) :: (Type -> Type) -> Type Source #

type GrammarFunctor (ParserT m g s) :: Type -> Type Source #

Methods

parsingResult :: ParserInput (ParserT m g s) -> GrammarFunctor (ParserT m g s) a -> ResultFunctor (ParserT m g s) (ParserInput (ParserT m g s), a) Source #

nonTerminal :: (g0 ~ ParserGrammar (ParserT m g s), GrammarConstraint (ParserT m g s) g0) => (g0 (GrammarFunctor (ParserT m g s)) -> GrammarFunctor (ParserT m g s) a) -> ParserT m g s a Source #

selfReferring :: (g0 ~ ParserGrammar (ParserT m g s), GrammarConstraint (ParserT m g s) g0, Distributive g0) => g0 (ParserT m g s) Source #

fixGrammar :: (g0 ~ ParserGrammar (ParserT m g s), GrammarConstraint (ParserT m g s) g0, Distributive g0) => (g0 (ParserT m g s) -> g0 (ParserT m g s)) -> g0 (ParserT m g s) Source #

recursive :: ParserT m g s a -> ParserT m g s a Source #

chainRecursive :: (g0 ~ ParserGrammar (ParserT m g s), f ~ GrammarFunctor (ParserT m g s), GrammarConstraint (ParserT m g s) g0) => (f a -> g0 f -> g0 f) -> ParserT m g s a -> ParserT m g s a -> ParserT m g s a Source #

chainLongestRecursive :: (g0 ~ ParserGrammar (ParserT m g s), f ~ GrammarFunctor (ParserT m g s), GrammarConstraint (ParserT m g s) g0) => (f a -> g0 f -> g0 f) -> ParserT m g s a -> ParserT m g s a -> ParserT m g s a Source #

(Apply g, GrammarFunctor (p g s) ~ f s, LeftRecParsing p g s f) => GrammarParsing (Fixed p g s) Source #

Parser transformer for left-recursive grammars.

Instance details

Defined in Text.Grampa.Internal.LeftRecursive

Associated Types

type ParserGrammar (Fixed p g s) :: (Type -> Type) -> Type Source #

type GrammarFunctor (Fixed p g s) :: Type -> Type Source #

Methods

parsingResult :: ParserInput (Fixed p g s) -> GrammarFunctor (Fixed p g s) a -> ResultFunctor (Fixed p g s) (ParserInput (Fixed p g s), a) Source #

nonTerminal :: (g0 ~ ParserGrammar (Fixed p g s), GrammarConstraint (Fixed p g s) g0) => (g0 (GrammarFunctor (Fixed p g s)) -> GrammarFunctor (Fixed p g s) a) -> Fixed p g s a Source #

selfReferring :: (g0 ~ ParserGrammar (Fixed p g s), GrammarConstraint (Fixed p g s) g0, Distributive g0) => g0 (Fixed p g s) Source #

fixGrammar :: (g0 ~ ParserGrammar (Fixed p g s), GrammarConstraint (Fixed p g s) g0, Distributive g0) => (g0 (Fixed p g s) -> g0 (Fixed p g s)) -> g0 (Fixed p g s) Source #

recursive :: Fixed p g s a -> Fixed p g s a Source #

chainRecursive :: (g0 ~ ParserGrammar (Fixed p g s), f ~ GrammarFunctor (Fixed p g s), GrammarConstraint (Fixed p g s) g0) => (f a -> g0 f -> g0 f) -> Fixed p g s a -> Fixed p g s a -> Fixed p g s a Source #

chainLongestRecursive :: (g0 ~ ParserGrammar (Fixed p g s), f ~ GrammarFunctor (Fixed p g s), GrammarConstraint (Fixed p g s) g0) => (f a -> g0 f -> g0 f) -> Fixed p g s a -> Fixed p g s a -> Fixed p g s a Source #

overlay :: (GrammarParsing m, g ~ ParserGrammar m, GrammarConstraint m g, Distributive g, Foldable f) => (g m -> g m) -> f (GrammarOverlay g m) -> g m Source #

Layers a sequence of GrammarOverlay on top of a base GrammarBuilder to produce a new grammar.

From the input-parsers library

class LookAheadParsing m => InputParsing (m :: Type -> Type) where #

Methods for parsing monoidal inputs

Minimal complete definition

getInput, take

Associated Types

type ParserInput (m :: Type -> Type) #

The type of the input stream that the parser m expects to parse.

type ParserPosition (m :: Type -> Type) #

type ParserPosition (m :: Type -> Type) = Down Int

Methods

getInput :: m (ParserInput m) #

Always sucessful parser that returns the entire remaining input without consuming it.

getSourcePos :: m (ParserPosition m) #

Retrieve the Position reached by the parser in the input source.

anyToken :: m (ParserInput m) #

A parser that accepts any single atomic prefix of the input stream.

anyToken == satisfy (const True)
anyToken == take 1

take :: Int -> m (ParserInput m) #

A parser that accepts exactly the given number of input atoms.

take n == count n anyToken

satisfy :: (ParserInput m -> Bool) -> m (ParserInput m) #

A parser that accepts an input atom only if it satisfies the given predicate.

notSatisfy :: (ParserInput m -> Bool) -> m () #

A parser that succeeds exactly when satisfy doesn't, equivalent to notFollowedBy . satisfy

scan :: state -> (state -> ParserInput m -> Maybe state) -> m (ParserInput m) #

A stateful scanner. The predicate modifies a state argument, and each transformed state is passed to successive invocations of the predicate on each token of the input until one returns Nothing or the input ends.

This parser does not fail. It will return an empty string if the predicate returns Nothing on the first character.

Note: Because this parser does not fail, do not use it with combinators such as many, because such parsers loop until a failure occurs. Careless use will thus result in an infinite loop.

string :: ParserInput m -> m (ParserInput m) #

A parser that consumes and returns the given prefix of the input.

takeWhile :: (ParserInput m -> Bool) -> m (ParserInput m) #

A parser accepting the longest sequence of input atoms that match the given predicate; an optimized version of concat . many . satisfy.

Note: Because this parser does not fail, do not use it with combinators such as many, because such parsers loop until a failure occurs. Careless use will thus result in an infinite loop.

takeWhile1 :: (ParserInput m -> Bool) -> m (ParserInput m) #

A parser accepting the longest non-empty sequence of input atoms that match the given predicate; an optimized version of concat . some . satisfy.

Instances

Instances details
InputParsing Parser 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput Parser #

type ParserPosition Parser #

InputParsing Parser 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput Parser #

type ParserPosition Parser #

InputParsing ReadP 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput ReadP #

type ParserPosition ReadP #

InputParsing (Lazy Get) 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (Lazy Get) #

type ParserPosition (Lazy Get) #

InputParsing (Strict Get) 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (Strict Get) #

type ParserPosition (Strict Get) #

(LeftReductive s, FactorialMonoid s, Ord s) => InputParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Continued

Associated Types

type ParserInput (Parser g s) #

type ParserPosition (Parser g s) #

Methods

getInput :: Parser g s (ParserInput (Parser g s)) #

getSourcePos :: Parser g s (ParserPosition (Parser g s)) #

anyToken :: Parser g s (ParserInput (Parser g s)) #

take :: Int -> Parser g s (ParserInput (Parser g s)) #

satisfy :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

notSatisfy :: (ParserInput (Parser g s) -> Bool) -> Parser g s () #

scan :: state -> (state -> ParserInput (Parser g s) -> Maybe state) -> Parser g s (ParserInput (Parser g s)) #

string :: ParserInput (Parser g s) -> Parser g s (ParserInput (Parser g s)) #

takeWhile :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

takeWhile1 :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

(LeftReductive s, FactorialMonoid s, Ord s) => InputParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Memoizing

Associated Types

type ParserInput (Parser g s) #

type ParserPosition (Parser g s) #

Methods

getInput :: Parser g s (ParserInput (Parser g s)) #

getSourcePos :: Parser g s (ParserPosition (Parser g s)) #

anyToken :: Parser g s (ParserInput (Parser g s)) #

take :: Int -> Parser g s (ParserInput (Parser g s)) #

satisfy :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

notSatisfy :: (ParserInput (Parser g s) -> Bool) -> Parser g s () #

scan :: state -> (state -> ParserInput (Parser g s) -> Maybe state) -> Parser g s (ParserInput (Parser g s)) #

string :: ParserInput (Parser g s) -> Parser g s (ParserInput (Parser g s)) #

takeWhile :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

takeWhile1 :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

(LeftReductive s, FactorialMonoid s, Ord s) => InputParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Associated Types

type ParserInput (Parser g s) #

type ParserPosition (Parser g s) #

Methods

getInput :: Parser g s (ParserInput (Parser g s)) #

getSourcePos :: Parser g s (ParserPosition (Parser g s)) #

anyToken :: Parser g s (ParserInput (Parser g s)) #

take :: Int -> Parser g s (ParserInput (Parser g s)) #

satisfy :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

notSatisfy :: (ParserInput (Parser g s) -> Bool) -> Parser g s () #

scan :: state -> (state -> ParserInput (Parser g s) -> Maybe state) -> Parser g s (ParserInput (Parser g s)) #

string :: ParserInput (Parser g s) -> Parser g s (ParserInput (Parser g s)) #

takeWhile :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

takeWhile1 :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

(LeftReductive s, FactorialMonoid s, Ord s) => InputParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing

Associated Types

type ParserInput (Parser g s) #

type ParserPosition (Parser g s) #

Methods

getInput :: Parser g s (ParserInput (Parser g s)) #

getSourcePos :: Parser g s (ParserPosition (Parser g s)) #

anyToken :: Parser g s (ParserInput (Parser g s)) #

take :: Int -> Parser g s (ParserInput (Parser g s)) #

satisfy :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

notSatisfy :: (ParserInput (Parser g s) -> Bool) -> Parser g s () #

scan :: state -> (state -> ParserInput (Parser g s) -> Maybe state) -> Parser g s (ParserInput (Parser g s)) #

string :: ParserInput (Parser g s) -> Parser g s (ParserInput (Parser g s)) #

takeWhile :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

takeWhile1 :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

(LeftReductive s, FactorialMonoid s) => InputParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.PEG.Backtrack

Associated Types

type ParserInput (Parser g s) #

type ParserPosition (Parser g s) #

Methods

getInput :: Parser g s (ParserInput (Parser g s)) #

getSourcePos :: Parser g s (ParserPosition (Parser g s)) #

anyToken :: Parser g s (ParserInput (Parser g s)) #

take :: Int -> Parser g s (ParserInput (Parser g s)) #

satisfy :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

notSatisfy :: (ParserInput (Parser g s) -> Bool) -> Parser g s () #

scan :: state -> (state -> ParserInput (Parser g s) -> Maybe state) -> Parser g s (ParserInput (Parser g s)) #

string :: ParserInput (Parser g s) -> Parser g s (ParserInput (Parser g s)) #

takeWhile :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

takeWhile1 :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

(LeftReductive s, FactorialMonoid s) => InputParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.PEG.Packrat

Associated Types

type ParserInput (Parser g s) #

type ParserPosition (Parser g s) #

Methods

getInput :: Parser g s (ParserInput (Parser g s)) #

getSourcePos :: Parser g s (ParserPosition (Parser g s)) #

anyToken :: Parser g s (ParserInput (Parser g s)) #

take :: Int -> Parser g s (ParserInput (Parser g s)) #

satisfy :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

notSatisfy :: (ParserInput (Parser g s) -> Bool) -> Parser g s () #

scan :: state -> (state -> ParserInput (Parser g s) -> Maybe state) -> Parser g s (ParserInput (Parser g s)) #

string :: ParserInput (Parser g s) -> Parser g s (ParserInput (Parser g s)) #

takeWhile :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

takeWhile1 :: (ParserInput (Parser g s) -> Bool) -> Parser g s (ParserInput (Parser g s)) #

(Monad m, InputParsing m) => InputParsing (IdentityT m) 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (IdentityT m) #

type ParserPosition (IdentityT m) #

(MonadPlus m, InputParsing m) => InputParsing (ReaderT e m) 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (ReaderT e m) #

type ParserPosition (ReaderT e m) #

Methods

getInput :: ReaderT e m (ParserInput (ReaderT e m)) #

getSourcePos :: ReaderT e m (ParserPosition (ReaderT e m)) #

anyToken :: ReaderT e m (ParserInput (ReaderT e m)) #

take :: Int -> ReaderT e m (ParserInput (ReaderT e m)) #

satisfy :: (ParserInput (ReaderT e m) -> Bool) -> ReaderT e m (ParserInput (ReaderT e m)) #

notSatisfy :: (ParserInput (ReaderT e m) -> Bool) -> ReaderT e m () #

scan :: state -> (state -> ParserInput (ReaderT e m) -> Maybe state) -> ReaderT e m (ParserInput (ReaderT e m)) #

string :: ParserInput (ReaderT e m) -> ReaderT e m (ParserInput (ReaderT e m)) #

takeWhile :: (ParserInput (ReaderT e m) -> Bool) -> ReaderT e m (ParserInput (ReaderT e m)) #

takeWhile1 :: (ParserInput (ReaderT e m) -> Bool) -> ReaderT e m (ParserInput (ReaderT e m)) #

(MonadPlus m, InputParsing m) => InputParsing (StateT s m) 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (StateT s m) #

type ParserPosition (StateT s m) #

Methods

getInput :: StateT s m (ParserInput (StateT s m)) #

getSourcePos :: StateT s m (ParserPosition (StateT s m)) #

anyToken :: StateT s m (ParserInput (StateT s m)) #

take :: Int -> StateT s m (ParserInput (StateT s m)) #

satisfy :: (ParserInput (StateT s m) -> Bool) -> StateT s m (ParserInput (StateT s m)) #

notSatisfy :: (ParserInput (StateT s m) -> Bool) -> StateT s m () #

scan :: state -> (state -> ParserInput (StateT s m) -> Maybe state) -> StateT s m (ParserInput (StateT s m)) #

string :: ParserInput (StateT s m) -> StateT s m (ParserInput (StateT s m)) #

takeWhile :: (ParserInput (StateT s m) -> Bool) -> StateT s m (ParserInput (StateT s m)) #

takeWhile1 :: (ParserInput (StateT s m) -> Bool) -> StateT s m (ParserInput (StateT s m)) #

(MonadPlus m, InputParsing m) => InputParsing (StateT s m) 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (StateT s m) #

type ParserPosition (StateT s m) #

Methods

getInput :: StateT s m (ParserInput (StateT s m)) #

getSourcePos :: StateT s m (ParserPosition (StateT s m)) #

anyToken :: StateT s m (ParserInput (StateT s m)) #

take :: Int -> StateT s m (ParserInput (StateT s m)) #

satisfy :: (ParserInput (StateT s m) -> Bool) -> StateT s m (ParserInput (StateT s m)) #

notSatisfy :: (ParserInput (StateT s m) -> Bool) -> StateT s m () #

scan :: state -> (state -> ParserInput (StateT s m) -> Maybe state) -> StateT s m (ParserInput (StateT s m)) #

string :: ParserInput (StateT s m) -> StateT s m (ParserInput (StateT s m)) #

takeWhile :: (ParserInput (StateT s m) -> Bool) -> StateT s m (ParserInput (StateT s m)) #

takeWhile1 :: (ParserInput (StateT s m) -> Bool) -> StateT s m (ParserInput (StateT s m)) #

(MonadPlus m, InputParsing m, Monoid w) => InputParsing (WriterT w m) 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (WriterT w m) #

type ParserPosition (WriterT w m) #

Methods

getInput :: WriterT w m (ParserInput (WriterT w m)) #

getSourcePos :: WriterT w m (ParserPosition (WriterT w m)) #

anyToken :: WriterT w m (ParserInput (WriterT w m)) #

take :: Int -> WriterT w m (ParserInput (WriterT w m)) #

satisfy :: (ParserInput (WriterT w m) -> Bool) -> WriterT w m (ParserInput (WriterT w m)) #

notSatisfy :: (ParserInput (WriterT w m) -> Bool) -> WriterT w m () #

scan :: state -> (state -> ParserInput (WriterT w m) -> Maybe state) -> WriterT w m (ParserInput (WriterT w m)) #

string :: ParserInput (WriterT w m) -> WriterT w m (ParserInput (WriterT w m)) #

takeWhile :: (ParserInput (WriterT w m) -> Bool) -> WriterT w m (ParserInput (WriterT w m)) #

takeWhile1 :: (ParserInput (WriterT w m) -> Bool) -> WriterT w m (ParserInput (WriterT w m)) #

(MonadPlus m, InputParsing m, Monoid w) => InputParsing (WriterT w m) 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (WriterT w m) #

type ParserPosition (WriterT w m) #

Methods

getInput :: WriterT w m (ParserInput (WriterT w m)) #

getSourcePos :: WriterT w m (ParserPosition (WriterT w m)) #

anyToken :: WriterT w m (ParserInput (WriterT w m)) #

take :: Int -> WriterT w m (ParserInput (WriterT w m)) #

satisfy :: (ParserInput (WriterT w m) -> Bool) -> WriterT w m (ParserInput (WriterT w m)) #

notSatisfy :: (ParserInput (WriterT w m) -> Bool) -> WriterT w m () #

scan :: state -> (state -> ParserInput (WriterT w m) -> Maybe state) -> WriterT w m (ParserInput (WriterT w m)) #

string :: ParserInput (WriterT w m) -> WriterT w m (ParserInput (WriterT w m)) #

takeWhile :: (ParserInput (WriterT w m) -> Bool) -> WriterT w m (ParserInput (WriterT w m)) #

takeWhile1 :: (ParserInput (WriterT w m) -> Bool) -> WriterT w m (ParserInput (WriterT w m)) #

(Applicative m, LeftReductive s, FactorialMonoid s, Ord s) => InputParsing (ParserT m g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing.Transformer

Associated Types

type ParserInput (ParserT m g s) #

type ParserPosition (ParserT m g s) #

Methods

getInput :: ParserT m g s (ParserInput (ParserT m g s)) #

getSourcePos :: ParserT m g s (ParserPosition (ParserT m g s)) #

anyToken :: ParserT m g s (ParserInput (ParserT m g s)) #

take :: Int -> ParserT m g s (ParserInput (ParserT m g s)) #

satisfy :: (ParserInput (ParserT m g s) -> Bool) -> ParserT m g s (ParserInput (ParserT m g s)) #

notSatisfy :: (ParserInput (ParserT m g s) -> Bool) -> ParserT m g s () #

scan :: state -> (state -> ParserInput (ParserT m g s) -> Maybe state) -> ParserT m g s (ParserInput (ParserT m g s)) #

string :: ParserInput (ParserT m g s) -> ParserT m g s (ParserInput (ParserT m g s)) #

takeWhile :: (ParserInput (ParserT m g s) -> Bool) -> ParserT m g s (ParserInput (ParserT m g s)) #

takeWhile1 :: (ParserInput (ParserT m g s) -> Bool) -> ParserT m g s (ParserInput (ParserT m g s)) #

(Apply g, LeftReductive s, FactorialMonoid s, InputParsing (p g s), ParserInput (p g s) ~ s) => InputParsing (Fixed p g s) Source # 
Instance details

Defined in Text.Grampa.Internal.LeftRecursive

Associated Types

type ParserInput (Fixed p g s) #

type ParserPosition (Fixed p g s) #

Methods

getInput :: Fixed p g s (ParserInput (Fixed p g s)) #

getSourcePos :: Fixed p g s (ParserPosition (Fixed p g s)) #

anyToken :: Fixed p g s (ParserInput (Fixed p g s)) #

take :: Int -> Fixed p g s (ParserInput (Fixed p g s)) #

satisfy :: (ParserInput (Fixed p g s) -> Bool) -> Fixed p g s (ParserInput (Fixed p g s)) #

notSatisfy :: (ParserInput (Fixed p g s) -> Bool) -> Fixed p g s () #

scan :: state -> (state -> ParserInput (Fixed p g s) -> Maybe state) -> Fixed p g s (ParserInput (Fixed p g s)) #

string :: ParserInput (Fixed p g s) -> Fixed p g s (ParserInput (Fixed p g s)) #

takeWhile :: (ParserInput (Fixed p g s) -> Bool) -> Fixed p g s (ParserInput (Fixed p g s)) #

takeWhile1 :: (ParserInput (Fixed p g s) -> Bool) -> Fixed p g s (ParserInput (Fixed p g s)) #

(FactorialMonoid s, LeftReductive s, Show s, Stream s m t, Show t) => InputParsing (ParsecT s u m) 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (ParsecT s u m) #

type ParserPosition (ParsecT s u m) #

Methods

getInput :: ParsecT s u m (ParserInput (ParsecT s u m)) #

getSourcePos :: ParsecT s u m (ParserPosition (ParsecT s u m)) #

anyToken :: ParsecT s u m (ParserInput (ParsecT s u m)) #

take :: Int -> ParsecT s u m (ParserInput (ParsecT s u m)) #

satisfy :: (ParserInput (ParsecT s u m) -> Bool) -> ParsecT s u m (ParserInput (ParsecT s u m)) #

notSatisfy :: (ParserInput (ParsecT s u m) -> Bool) -> ParsecT s u m () #

scan :: state -> (state -> ParserInput (ParsecT s u m) -> Maybe state) -> ParsecT s u m (ParserInput (ParsecT s u m)) #

string :: ParserInput (ParsecT s u m) -> ParsecT s u m (ParserInput (ParsecT s u m)) #

takeWhile :: (ParserInput (ParsecT s u m) -> Bool) -> ParsecT s u m (ParserInput (ParsecT s u m)) #

takeWhile1 :: (ParserInput (ParsecT s u m) -> Bool) -> ParsecT s u m (ParserInput (ParsecT s u m)) #

(MonadPlus m, InputParsing m, Monoid w) => InputParsing (RWST r w s m) 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (RWST r w s m) #

type ParserPosition (RWST r w s m) #

Methods

getInput :: RWST r w s m (ParserInput (RWST r w s m)) #

getSourcePos :: RWST r w s m (ParserPosition (RWST r w s m)) #

anyToken :: RWST r w s m (ParserInput (RWST r w s m)) #

take :: Int -> RWST r w s m (ParserInput (RWST r w s m)) #

satisfy :: (ParserInput (RWST r w s m) -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) #

notSatisfy :: (ParserInput (RWST r w s m) -> Bool) -> RWST r w s m () #

scan :: state -> (state -> ParserInput (RWST r w s m) -> Maybe state) -> RWST r w s m (ParserInput (RWST r w s m)) #

string :: ParserInput (RWST r w s m) -> RWST r w s m (ParserInput (RWST r w s m)) #

takeWhile :: (ParserInput (RWST r w s m) -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) #

takeWhile1 :: (ParserInput (RWST r w s m) -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) #

(MonadPlus m, InputParsing m, Monoid w) => InputParsing (RWST r w s m) 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (RWST r w s m) #

type ParserPosition (RWST r w s m) #

Methods

getInput :: RWST r w s m (ParserInput (RWST r w s m)) #

getSourcePos :: RWST r w s m (ParserPosition (RWST r w s m)) #

anyToken :: RWST r w s m (ParserInput (RWST r w s m)) #

take :: Int -> RWST r w s m (ParserInput (RWST r w s m)) #

satisfy :: (ParserInput (RWST r w s m) -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) #

notSatisfy :: (ParserInput (RWST r w s m) -> Bool) -> RWST r w s m () #

scan :: state -> (state -> ParserInput (RWST r w s m) -> Maybe state) -> RWST r w s m (ParserInput (RWST r w s m)) #

string :: ParserInput (RWST r w s m) -> RWST r w s m (ParserInput (RWST r w s m)) #

takeWhile :: (ParserInput (RWST r w s m) -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) #

takeWhile1 :: (ParserInput (RWST r w s m) -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) #

class (CharParsing m, InputParsing m) => InputCharParsing (m :: Type -> Type) where #

Methods for parsing textual monoid inputs

Minimal complete definition

satisfyCharInput

Methods

satisfyCharInput :: (Char -> Bool) -> m (ParserInput m) #

Specialization of satisfy on textual inputs, accepting an input character only if it satisfies the given predicate, and returning the input atom that represents the character. Equivalent to fmap singleton . Char.satisfy

notSatisfyChar :: (Char -> Bool) -> m () #

A parser that succeeds exactly when satisfy doesn't, equivalent to notFollowedBy . Char.satisfy

scanChars :: state -> (state -> Char -> Maybe state) -> m (ParserInput m) #

Stateful scanner like scan, but specialized for TextualMonoid inputs.

takeCharsWhile :: (Char -> Bool) -> m (ParserInput m) #

Specialization of takeWhile on TextualMonoid inputs, accepting the longest sequence of input characters that match the given predicate; an optimized version of fmap fromString . many . Char.satisfy.

Note: Because this parser does not fail, do not use it with combinators such as many, because such parsers loop until a failure occurs. Careless use will thus result in an infinite loop.

takeCharsWhile1 :: (Char -> Bool) -> m (ParserInput m) #

Specialization of takeWhile1 on TextualMonoid inputs, accepting the longest sequence of input characters that match the given predicate; an optimized version of fmap fromString . some . Char.satisfy.

Instances

Instances details
InputCharParsing Parser 
Instance details

Defined in Text.Parser.Input

InputCharParsing Parser 
Instance details

Defined in Text.Parser.Input

InputCharParsing ReadP 
Instance details

Defined in Text.Parser.Input

(Ord s, Show s, TextualMonoid s) => InputCharParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Continued

Methods

satisfyCharInput :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

notSatisfyChar :: (Char -> Bool) -> Parser g s () #

scanChars :: state -> (state -> Char -> Maybe state) -> Parser g s (ParserInput (Parser g s)) #

takeCharsWhile :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

takeCharsWhile1 :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

(Ord s, Show s, TextualMonoid s) => InputCharParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Memoizing

Methods

satisfyCharInput :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

notSatisfyChar :: (Char -> Bool) -> Parser g s () #

scanChars :: state -> (state -> Char -> Maybe state) -> Parser g s (ParserInput (Parser g s)) #

takeCharsWhile :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

takeCharsWhile1 :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

(Ord s, TextualMonoid s) => InputCharParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Methods

satisfyCharInput :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

notSatisfyChar :: (Char -> Bool) -> Parser g s () #

scanChars :: state -> (state -> Char -> Maybe state) -> Parser g s (ParserInput (Parser g s)) #

takeCharsWhile :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

takeCharsWhile1 :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

(Ord s, Show s, TextualMonoid s) => InputCharParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing

Methods

satisfyCharInput :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

notSatisfyChar :: (Char -> Bool) -> Parser g s () #

scanChars :: state -> (state -> Char -> Maybe state) -> Parser g s (ParserInput (Parser g s)) #

takeCharsWhile :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

takeCharsWhile1 :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

(Show s, TextualMonoid s) => InputCharParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.PEG.Backtrack

Methods

satisfyCharInput :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

notSatisfyChar :: (Char -> Bool) -> Parser g s () #

scanChars :: state -> (state -> Char -> Maybe state) -> Parser g s (ParserInput (Parser g s)) #

takeCharsWhile :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

takeCharsWhile1 :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

(Show s, TextualMonoid s) => InputCharParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.PEG.Packrat

Methods

satisfyCharInput :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

notSatisfyChar :: (Char -> Bool) -> Parser g s () #

scanChars :: state -> (state -> Char -> Maybe state) -> Parser g s (ParserInput (Parser g s)) #

takeCharsWhile :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

takeCharsWhile1 :: (Char -> Bool) -> Parser g s (ParserInput (Parser g s)) #

(MonadPlus m, InputCharParsing m) => InputCharParsing (IdentityT m) 
Instance details

Defined in Text.Parser.Input

(MonadPlus m, InputCharParsing m) => InputCharParsing (ReaderT e m) 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> ReaderT e m (ParserInput (ReaderT e m)) #

notSatisfyChar :: (Char -> Bool) -> ReaderT e m () #

scanChars :: state -> (state -> Char -> Maybe state) -> ReaderT e m (ParserInput (ReaderT e m)) #

takeCharsWhile :: (Char -> Bool) -> ReaderT e m (ParserInput (ReaderT e m)) #

takeCharsWhile1 :: (Char -> Bool) -> ReaderT e m (ParserInput (ReaderT e m)) #

(MonadPlus m, InputCharParsing m) => InputCharParsing (StateT s m) 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> StateT s m (ParserInput (StateT s m)) #

notSatisfyChar :: (Char -> Bool) -> StateT s m () #

scanChars :: state -> (state -> Char -> Maybe state) -> StateT s m (ParserInput (StateT s m)) #

takeCharsWhile :: (Char -> Bool) -> StateT s m (ParserInput (StateT s m)) #

takeCharsWhile1 :: (Char -> Bool) -> StateT s m (ParserInput (StateT s m)) #

(MonadPlus m, InputCharParsing m) => InputCharParsing (StateT s m) 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> StateT s m (ParserInput (StateT s m)) #

notSatisfyChar :: (Char -> Bool) -> StateT s m () #

scanChars :: state -> (state -> Char -> Maybe state) -> StateT s m (ParserInput (StateT s m)) #

takeCharsWhile :: (Char -> Bool) -> StateT s m (ParserInput (StateT s m)) #

takeCharsWhile1 :: (Char -> Bool) -> StateT s m (ParserInput (StateT s m)) #

(MonadPlus m, InputCharParsing m, Monoid w) => InputCharParsing (WriterT w m) 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> WriterT w m (ParserInput (WriterT w m)) #

notSatisfyChar :: (Char -> Bool) -> WriterT w m () #

scanChars :: state -> (state -> Char -> Maybe state) -> WriterT w m (ParserInput (WriterT w m)) #

takeCharsWhile :: (Char -> Bool) -> WriterT w m (ParserInput (WriterT w m)) #

takeCharsWhile1 :: (Char -> Bool) -> WriterT w m (ParserInput (WriterT w m)) #

(MonadPlus m, InputCharParsing m, Monoid w) => InputCharParsing (WriterT w m) 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> WriterT w m (ParserInput (WriterT w m)) #

notSatisfyChar :: (Char -> Bool) -> WriterT w m () #

scanChars :: state -> (state -> Char -> Maybe state) -> WriterT w m (ParserInput (WriterT w m)) #

takeCharsWhile :: (Char -> Bool) -> WriterT w m (ParserInput (WriterT w m)) #

takeCharsWhile1 :: (Char -> Bool) -> WriterT w m (ParserInput (WriterT w m)) #

(Applicative m, Ord s, Show s, TextualMonoid s) => InputCharParsing (ParserT m g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing.Transformer

Methods

satisfyCharInput :: (Char -> Bool) -> ParserT m g s (ParserInput (ParserT m g s)) #

notSatisfyChar :: (Char -> Bool) -> ParserT m g s () #

scanChars :: state -> (state -> Char -> Maybe state) -> ParserT m g s (ParserInput (ParserT m g s)) #

takeCharsWhile :: (Char -> Bool) -> ParserT m g s (ParserInput (ParserT m g s)) #

takeCharsWhile1 :: (Char -> Bool) -> ParserT m g s (ParserInput (ParserT m g s)) #

(Apply g, Show s, TextualMonoid s, InputCharParsing (p g s), ParserInput (p g s) ~ s) => InputCharParsing (Fixed p g s) Source # 
Instance details

Defined in Text.Grampa.Internal.LeftRecursive

Methods

satisfyCharInput :: (Char -> Bool) -> Fixed p g s (ParserInput (Fixed p g s)) #

notSatisfyChar :: (Char -> Bool) -> Fixed p g s () #

scanChars :: state -> (state -> Char -> Maybe state) -> Fixed p g s (ParserInput (Fixed p g s)) #

takeCharsWhile :: (Char -> Bool) -> Fixed p g s (ParserInput (Fixed p g s)) #

takeCharsWhile1 :: (Char -> Bool) -> Fixed p g s (ParserInput (Fixed p g s)) #

(TextualMonoid s, Show s, Stream s m Char) => InputCharParsing (ParsecT s u m) 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> ParsecT s u m (ParserInput (ParsecT s u m)) #

notSatisfyChar :: (Char -> Bool) -> ParsecT s u m () #

scanChars :: state -> (state -> Char -> Maybe state) -> ParsecT s u m (ParserInput (ParsecT s u m)) #

takeCharsWhile :: (Char -> Bool) -> ParsecT s u m (ParserInput (ParsecT s u m)) #

takeCharsWhile1 :: (Char -> Bool) -> ParsecT s u m (ParserInput (ParsecT s u m)) #

(MonadPlus m, InputCharParsing m, Monoid w) => InputCharParsing (RWST r w s m) 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) #

notSatisfyChar :: (Char -> Bool) -> RWST r w s m () #

scanChars :: state -> (state -> Char -> Maybe state) -> RWST r w s m (ParserInput (RWST r w s m)) #

takeCharsWhile :: (Char -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) #

takeCharsWhile1 :: (Char -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) #

(MonadPlus m, InputCharParsing m, Monoid w) => InputCharParsing (RWST r w s m) 
Instance details

Defined in Text.Parser.Input

Methods

satisfyCharInput :: (Char -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) #

notSatisfyChar :: (Char -> Bool) -> RWST r w s m () #

scanChars :: state -> (state -> Char -> Maybe state) -> RWST r w s m (ParserInput (RWST r w s m)) #

takeCharsWhile :: (Char -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) #

takeCharsWhile1 :: (Char -> Bool) -> RWST r w s m (ParserInput (RWST r w s m)) #

class InputParsing m => ConsumedInputParsing (m :: Type -> Type) where #

Parsers that keep track of the consumed input.

Methods

match :: m a -> m (ParserInput m, a) #

Return both the result of a parse and the portion of the input that the argument parser consumed.

Instances

Instances details
ConsumedInputParsing Parser 
Instance details

Defined in Text.Parser.Input

Methods

match :: Parser a -> Parser (ParserInput Parser, a) #

ConsumedInputParsing Parser 
Instance details

Defined in Text.Parser.Input

Methods

match :: Parser a -> Parser (ParserInput Parser, a) #

ConsumedInputParsing ReadP 
Instance details

Defined in Text.Parser.Input

Methods

match :: ReadP a -> ReadP (ParserInput ReadP, a) #

ConsumedInputParsing (Lazy Get) 
Instance details

Defined in Text.Parser.Input

Methods

match :: Lazy Get a -> Lazy Get (ParserInput (Lazy Get), a) #

ConsumedInputParsing (Strict Get) 
Instance details

Defined in Text.Parser.Input

Methods

match :: Strict Get a -> Strict Get (ParserInput (Strict Get), a) #

(LeftReductive s, FactorialMonoid s, Ord s) => ConsumedInputParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing

Methods

match :: Parser g s a -> Parser g s (ParserInput (Parser g s), a) #

(Monad m, ConsumedInputParsing m) => ConsumedInputParsing (IdentityT m) 
Instance details

Defined in Text.Parser.Input

Methods

match :: IdentityT m a -> IdentityT m (ParserInput (IdentityT m), a) #

(MonadPlus m, ConsumedInputParsing m) => ConsumedInputParsing (ReaderT e m) 
Instance details

Defined in Text.Parser.Input

Methods

match :: ReaderT e m a -> ReaderT e m (ParserInput (ReaderT e m), a) #

(MonadPlus m, ConsumedInputParsing m) => ConsumedInputParsing (StateT s m) 
Instance details

Defined in Text.Parser.Input

Methods

match :: StateT s m a -> StateT s m (ParserInput (StateT s m), a) #

(MonadPlus m, ConsumedInputParsing m) => ConsumedInputParsing (StateT s m) 
Instance details

Defined in Text.Parser.Input

Methods

match :: StateT s m a -> StateT s m (ParserInput (StateT s m), a) #

(MonadPlus m, ConsumedInputParsing m, Monoid w) => ConsumedInputParsing (WriterT w m) 
Instance details

Defined in Text.Parser.Input

Methods

match :: WriterT w m a -> WriterT w m (ParserInput (WriterT w m), a) #

(MonadPlus m, ConsumedInputParsing m, Monoid w) => ConsumedInputParsing (WriterT w m) 
Instance details

Defined in Text.Parser.Input

Methods

match :: WriterT w m a -> WriterT w m (ParserInput (WriterT w m), a) #

(Applicative m, LeftReductive s, FactorialMonoid s, Ord s) => ConsumedInputParsing (ParserT m g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing.Transformer

Methods

match :: ParserT m g s a -> ParserT m g s (ParserInput (ParserT m g s), a) #

(Apply g, LeftReductive s, FactorialMonoid s, ConsumedInputParsing (p g s), ParserInput (p g s) ~ s) => ConsumedInputParsing (Fixed p g s) Source # 
Instance details

Defined in Text.Grampa.Internal.LeftRecursive

Methods

match :: Fixed p g s a -> Fixed p g s (ParserInput (Fixed p g s), a) #

(MonadPlus m, ConsumedInputParsing m, Monoid w) => ConsumedInputParsing (RWST r w s m) 
Instance details

Defined in Text.Parser.Input

Methods

match :: RWST r w s m a -> RWST r w s m (ParserInput (RWST r w s m), a) #

(MonadPlus m, ConsumedInputParsing m, Monoid w) => ConsumedInputParsing (RWST r w s m) 
Instance details

Defined in Text.Parser.Input

Methods

match :: RWST r w s m a -> RWST r w s m (ParserInput (RWST r w s m), a) #

class Ord p => Position p where #

A class for representing position values. The methods satisfy these laws:

move (distance pos1 pos2) pos1 == pos2
(pos1 < pos2) == (distance pos1 pos2 > 0)

Methods

distance :: p -> p -> Int #

Distance from the first position to the second

move :: Int -> p -> p #

Move the position by the given distance.

offset :: FactorialMonoid s => s -> p -> Int #

Map the position into its offset from the beginning of the full input.

Instances

Instances details
Position Int 
Instance details

Defined in Text.Parser.Input.Position

Methods

distance :: Int -> Int -> Int #

move :: Int -> Int -> Int #

offset :: FactorialMonoid s => s -> Int -> Int #

Position a => Position (Down a) 
Instance details

Defined in Text.Parser.Input.Position

Methods

distance :: Down a -> Down a -> Int #

move :: Int -> Down a -> Down a #

offset :: FactorialMonoid s => s -> Down a -> Int #

From the parsers library

class Parsing m => CharParsing (m :: Type -> Type) where #

Additional functionality needed to parse character streams.

Minimal complete definition

Nothing

Methods

char :: Char -> m Char #

char c parses a single character c. Returns the parsed character (i.e. c).

e.g.

semiColon = char ';'

notChar :: Char -> m Char #

notChar c parses any single character other than c. Returns the parsed character.

anyChar :: m Char #

This parser succeeds for any character. Returns the parsed character.

Instances

Instances details
CharParsing ReadP 
Instance details

Defined in Text.Parser.Char

Chunk t => CharParsing (Parser t) 
Instance details

Defined in Text.Parser.Char

CharParsing f => CharParsing (Lazy f) 
Instance details

Defined in Text.Parser.Wrapper

Methods

satisfy :: (Char -> Bool) -> Lazy f Char #

char :: Char -> Lazy f Char #

notChar :: Char -> Lazy f Char #

anyChar :: Lazy f Char #

string :: String -> Lazy f String #

text :: Text -> Lazy f Text #

CharParsing f => CharParsing (Strict f) 
Instance details

Defined in Text.Parser.Wrapper

CharParsing m => CharParsing (Unhighlighted m) 
Instance details

Defined in Text.Parser.Token

CharParsing m => CharParsing (Unlined m) 
Instance details

Defined in Text.Parser.Token

CharParsing m => CharParsing (Unspaced m) 
Instance details

Defined in Text.Parser.Token

(Ord s, Show s, TextualMonoid s) => CharParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Continued

Methods

satisfy :: (Char -> Bool) -> Parser g s Char #

char :: Char -> Parser g s Char #

notChar :: Char -> Parser g s Char #

anyChar :: Parser g s Char #

string :: String -> Parser g s String #

text :: Text -> Parser g s Text #

(Ord s, Show s, TextualMonoid s) => CharParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Memoizing

Methods

satisfy :: (Char -> Bool) -> Parser g s Char #

char :: Char -> Parser g s Char #

notChar :: Char -> Parser g s Char #

anyChar :: Parser g s Char #

string :: String -> Parser g s String #

text :: Text -> Parser g s Text #

(TextualMonoid s, Ord s) => CharParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Methods

satisfy :: (Char -> Bool) -> Parser g s Char #

char :: Char -> Parser g s Char #

notChar :: Char -> Parser g s Char #

anyChar :: Parser g s Char #

string :: String -> Parser g s String #

text :: Text -> Parser g s Text #

(Ord s, Show s, TextualMonoid s) => CharParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing

Methods

satisfy :: (Char -> Bool) -> Parser g s Char #

char :: Char -> Parser g s Char #

notChar :: Char -> Parser g s Char #

anyChar :: Parser g s Char #

string :: String -> Parser g s String #

text :: Text -> Parser g s Text #

(Show s, TextualMonoid s) => CharParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.PEG.Backtrack

Methods

satisfy :: (Char -> Bool) -> Parser g s Char #

char :: Char -> Parser g s Char #

notChar :: Char -> Parser g s Char #

anyChar :: Parser g s Char #

string :: String -> Parser g s String #

text :: Text -> Parser g s Text #

(Show s, TextualMonoid s) => CharParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.PEG.Packrat

Methods

satisfy :: (Char -> Bool) -> Parser g s Char #

char :: Char -> Parser g s Char #

notChar :: Char -> Parser g s Char #

anyChar :: Parser g s Char #

string :: String -> Parser g s String #

text :: Text -> Parser g s Text #

(CharParsing m, MonadPlus m) => CharParsing (IdentityT m) 
Instance details

Defined in Text.Parser.Char

(CharParsing m, MonadPlus m) => CharParsing (ReaderT e m) 
Instance details

Defined in Text.Parser.Char

Methods

satisfy :: (Char -> Bool) -> ReaderT e m Char #

char :: Char -> ReaderT e m Char #

notChar :: Char -> ReaderT e m Char #

anyChar :: ReaderT e m Char #

string :: String -> ReaderT e m String #

text :: Text -> ReaderT e m Text #

(CharParsing m, MonadPlus m) => CharParsing (StateT s m) 
Instance details

Defined in Text.Parser.Char

Methods

satisfy :: (Char -> Bool) -> StateT s m Char #

char :: Char -> StateT s m Char #

notChar :: Char -> StateT s m Char #

anyChar :: StateT s m Char #

string :: String -> StateT s m String #

text :: Text -> StateT s m Text #

(CharParsing m, MonadPlus m) => CharParsing (StateT s m) 
Instance details

Defined in Text.Parser.Char

Methods

satisfy :: (Char -> Bool) -> StateT s m Char #

char :: Char -> StateT s m Char #

notChar :: Char -> StateT s m Char #

anyChar :: StateT s m Char #

string :: String -> StateT s m String #

text :: Text -> StateT s m Text #

(CharParsing m, MonadPlus m, Monoid w) => CharParsing (WriterT w m) 
Instance details

Defined in Text.Parser.Char

Methods

satisfy :: (Char -> Bool) -> WriterT w m Char #

char :: Char -> WriterT w m Char #

notChar :: Char -> WriterT w m Char #

anyChar :: WriterT w m Char #

string :: String -> WriterT w m String #

text :: Text -> WriterT w m Text #

(CharParsing m, MonadPlus m, Monoid w) => CharParsing (WriterT w m) 
Instance details

Defined in Text.Parser.Char

Methods

satisfy :: (Char -> Bool) -> WriterT w m Char #

char :: Char -> WriterT w m Char #

notChar :: Char -> WriterT w m Char #

anyChar :: WriterT w m Char #

string :: String -> WriterT w m String #

text :: Text -> WriterT w m Text #

(Applicative m, Ord s, Show s, TextualMonoid s) => CharParsing (ParserT m g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing.Transformer

Methods

satisfy :: (Char -> Bool) -> ParserT m g s Char #

char :: Char -> ParserT m g s Char #

notChar :: Char -> ParserT m g s Char #

anyChar :: ParserT m g s Char #

string :: String -> ParserT m g s String #

text :: Text -> ParserT m g s Text #

(Apply g, CharParsing (p g s), InputCharParsing (Fixed p g s), TextualMonoid s, s ~ ParserInput (Fixed p g s), Show s) => CharParsing (Fixed p g s) Source # 
Instance details

Defined in Text.Grampa.Internal.LeftRecursive

Methods

satisfy :: (Char -> Bool) -> Fixed p g s Char #

char :: Char -> Fixed p g s Char #

notChar :: Char -> Fixed p g s Char #

anyChar :: Fixed p g s Char #

string :: String -> Fixed p g s String #

text :: Text -> Fixed p g s Text #

Stream s m Char => CharParsing (ParsecT s u m) 
Instance details

Defined in Text.Parser.Char

Methods

satisfy :: (Char -> Bool) -> ParsecT s u m Char #

char :: Char -> ParsecT s u m Char #

notChar :: Char -> ParsecT s u m Char #

anyChar :: ParsecT s u m Char #

string :: String -> ParsecT s u m String #

text :: Text -> ParsecT s u m Text #

(CharParsing m, MonadPlus m, Monoid w) => CharParsing (RWST r w s m) 
Instance details

Defined in Text.Parser.Char

Methods

satisfy :: (Char -> Bool) -> RWST r w s m Char #

char :: Char -> RWST r w s m Char #

notChar :: Char -> RWST r w s m Char #

anyChar :: RWST r w s m Char #

string :: String -> RWST r w s m String #

text :: Text -> RWST r w s m Text #

(CharParsing m, MonadPlus m, Monoid w) => CharParsing (RWST r w s m) 
Instance details

Defined in Text.Parser.Char

Methods

satisfy :: (Char -> Bool) -> RWST r w s m Char #

char :: Char -> RWST r w s m Char #

notChar :: Char -> RWST r w s m Char #

anyChar :: RWST r w s m Char #

string :: String -> RWST r w s m String #

text :: Text -> RWST r w s m Text #

class Alternative m => Parsing (m :: Type -> Type) where #

Additional functionality needed to describe parsers independent of input type.

Minimal complete definition

try, (<?>), notFollowedBy

Methods

(<?>) :: m a -> String -> m a infixr 0 #

Give a parser a name

skipMany :: m a -> m () #

A version of many that discards its input. Specialized because it can often be implemented more cheaply.

skipSome :: m a -> m () #

skipSome p applies the parser p one or more times, skipping its result. (aka skipMany1 in parsec)

unexpected :: String -> m a #

Used to emit an error on an unexpected token

notFollowedBy :: Show a => m a -> m () #

notFollowedBy p only succeeds when parser p fails. This parser does not consume any input. This parser can be used to implement the 'longest match' rule. For example, when recognizing keywords (for example let), we want to make sure that a keyword is not followed by a legal identifier character, in which case the keyword is actually an identifier (for example lets). We can program this behaviour as follows:

 keywordLet  = try $ string "let" <* notFollowedBy alphaNum

Instances

Instances details
Parsing ReadP 
Instance details

Defined in Text.Parser.Combinators

Methods

try :: ReadP a -> ReadP a #

(<?>) :: ReadP a -> String -> ReadP a #

skipMany :: ReadP a -> ReadP () #

skipSome :: ReadP a -> ReadP () #

unexpected :: String -> ReadP a #

eof :: ReadP () #

notFollowedBy :: Show a => ReadP a -> ReadP () #

Parsing Get 
Instance details

Defined in Text.Parser.Combinators

Methods

try :: Get a -> Get a #

(<?>) :: Get a -> String -> Get a #

skipMany :: Get a -> Get () #

skipSome :: Get a -> Get () #

unexpected :: String -> Get a #

eof :: Get () #

notFollowedBy :: Show a => Get a -> Get () #

Chunk t => Parsing (Parser t) 
Instance details

Defined in Text.Parser.Combinators

Methods

try :: Parser t a -> Parser t a #

(<?>) :: Parser t a -> String -> Parser t a #

skipMany :: Parser t a -> Parser t () #

skipSome :: Parser t a -> Parser t () #

unexpected :: String -> Parser t a #

eof :: Parser t () #

notFollowedBy :: Show a => Parser t a -> Parser t () #

Parsing f => Parsing (Lazy f) 
Instance details

Defined in Text.Parser.Wrapper

Methods

try :: Lazy f a -> Lazy f a #

(<?>) :: Lazy f a -> String -> Lazy f a #

skipMany :: Lazy f a -> Lazy f () #

skipSome :: Lazy f a -> Lazy f () #

unexpected :: String -> Lazy f a #

eof :: Lazy f () #

notFollowedBy :: Show a => Lazy f a -> Lazy f () #

Parsing f => Parsing (Strict f) 
Instance details

Defined in Text.Parser.Wrapper

Methods

try :: Strict f a -> Strict f a #

(<?>) :: Strict f a -> String -> Strict f a #

skipMany :: Strict f a -> Strict f () #

skipSome :: Strict f a -> Strict f () #

unexpected :: String -> Strict f a #

eof :: Strict f () #

notFollowedBy :: Show a => Strict f a -> Strict f () #

Parsing m => Parsing (Unhighlighted m) 
Instance details

Defined in Text.Parser.Token

Parsing m => Parsing (Unlined m) 
Instance details

Defined in Text.Parser.Token

Methods

try :: Unlined m a -> Unlined m a #

(<?>) :: Unlined m a -> String -> Unlined m a #

skipMany :: Unlined m a -> Unlined m () #

skipSome :: Unlined m a -> Unlined m () #

unexpected :: String -> Unlined m a #

eof :: Unlined m () #

notFollowedBy :: Show a => Unlined m a -> Unlined m () #

Parsing m => Parsing (Unspaced m) 
Instance details

Defined in Text.Parser.Token

Methods

try :: Unspaced m a -> Unspaced m a #

(<?>) :: Unspaced m a -> String -> Unspaced m a #

skipMany :: Unspaced m a -> Unspaced m () #

skipSome :: Unspaced m a -> Unspaced m () #

unexpected :: String -> Unspaced m a #

eof :: Unspaced m () #

notFollowedBy :: Show a => Unspaced m a -> Unspaced m () #

(FactorialMonoid s, Ord s) => Parsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Continued

Methods

try :: Parser g s a -> Parser g s a #

(<?>) :: Parser g s a -> String -> Parser g s a #

skipMany :: Parser g s a -> Parser g s () #

skipSome :: Parser g s a -> Parser g s () #

unexpected :: String -> Parser g s a #

eof :: Parser g s () #

notFollowedBy :: Show a => Parser g s a -> Parser g s () #

(MonoidNull s, Ord s) => Parsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Memoizing

Methods

try :: Parser g s a -> Parser g s a #

(<?>) :: Parser g s a -> String -> Parser g s a #

skipMany :: Parser g s a -> Parser g s () #

skipSome :: Parser g s a -> Parser g s () #

unexpected :: String -> Parser g s a #

eof :: Parser g s () #

notFollowedBy :: Show a => Parser g s a -> Parser g s () #

(FactorialMonoid s, Ord s) => Parsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Methods

try :: Parser g s a -> Parser g s a #

(<?>) :: Parser g s a -> String -> Parser g s a #

skipMany :: Parser g s a -> Parser g s () #

skipSome :: Parser g s a -> Parser g s () #

unexpected :: String -> Parser g s a #

eof :: Parser g s () #

notFollowedBy :: Show a => Parser g s a -> Parser g s () #

(MonoidNull s, Ord s) => Parsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing

Methods

try :: Parser g s a -> Parser g s a #

(<?>) :: Parser g s a -> String -> Parser g s a #

skipMany :: Parser g s a -> Parser g s () #

skipSome :: Parser g s a -> Parser g s () #

unexpected :: String -> Parser g s a #

eof :: Parser g s () #

notFollowedBy :: Show a => Parser g s a -> Parser g s () #

FactorialMonoid s => Parsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.PEG.Backtrack

Methods

try :: Parser g s a -> Parser g s a #

(<?>) :: Parser g s a -> String -> Parser g s a #

skipMany :: Parser g s a -> Parser g s () #

skipSome :: Parser g s a -> Parser g s () #

unexpected :: String -> Parser g s a #

eof :: Parser g s () #

notFollowedBy :: Show a => Parser g s a -> Parser g s () #

FactorialMonoid s => Parsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.PEG.Packrat

Methods

try :: Parser g s a -> Parser g s a #

(<?>) :: Parser g s a -> String -> Parser g s a #

skipMany :: Parser g s a -> Parser g s () #

skipSome :: Parser g s a -> Parser g s () #

unexpected :: String -> Parser g s a #

eof :: Parser g s () #

notFollowedBy :: Show a => Parser g s a -> Parser g s () #

(Parsing m, Monad m) => Parsing (IdentityT m) 
Instance details

Defined in Text.Parser.Combinators

Methods

try :: IdentityT m a -> IdentityT m a #

(<?>) :: IdentityT m a -> String -> IdentityT m a #

skipMany :: IdentityT m a -> IdentityT m () #

skipSome :: IdentityT m a -> IdentityT m () #

unexpected :: String -> IdentityT m a #

eof :: IdentityT m () #

notFollowedBy :: Show a => IdentityT m a -> IdentityT m () #

(Parsing m, MonadPlus m) => Parsing (ReaderT e m) 
Instance details

Defined in Text.Parser.Combinators

Methods

try :: ReaderT e m a -> ReaderT e m a #

(<?>) :: ReaderT e m a -> String -> ReaderT e m a #

skipMany :: ReaderT e m a -> ReaderT e m () #

skipSome :: ReaderT e m a -> ReaderT e m () #

unexpected :: String -> ReaderT e m a #

eof :: ReaderT e m () #

notFollowedBy :: Show a => ReaderT e m a -> ReaderT e m () #

(Parsing m, MonadPlus m) => Parsing (StateT s m) 
Instance details

Defined in Text.Parser.Combinators

Methods

try :: StateT s m a -> StateT s m a #

(<?>) :: StateT s m a -> String -> StateT s m a #

skipMany :: StateT s m a -> StateT s m () #

skipSome :: StateT s m a -> StateT s m () #

unexpected :: String -> StateT s m a #

eof :: StateT s m () #

notFollowedBy :: Show a => StateT s m a -> StateT s m () #

(Parsing m, MonadPlus m) => Parsing (StateT s m) 
Instance details

Defined in Text.Parser.Combinators

Methods

try :: StateT s m a -> StateT s m a #

(<?>) :: StateT s m a -> String -> StateT s m a #

skipMany :: StateT s m a -> StateT s m () #

skipSome :: StateT s m a -> StateT s m () #

unexpected :: String -> StateT s m a #

eof :: StateT s m () #

notFollowedBy :: Show a => StateT s m a -> StateT s m () #

(Parsing m, MonadPlus m, Monoid w) => Parsing (WriterT w m) 
Instance details

Defined in Text.Parser.Combinators

Methods

try :: WriterT w m a -> WriterT w m a #

(<?>) :: WriterT w m a -> String -> WriterT w m a #

skipMany :: WriterT w m a -> WriterT w m () #

skipSome :: WriterT w m a -> WriterT w m () #

unexpected :: String -> WriterT w m a #

eof :: WriterT w m () #

notFollowedBy :: Show a => WriterT w m a -> WriterT w m () #

(Parsing m, MonadPlus m, Monoid w) => Parsing (WriterT w m) 
Instance details

Defined in Text.Parser.Combinators

Methods

try :: WriterT w m a -> WriterT w m a #

(<?>) :: WriterT w m a -> String -> WriterT w m a #

skipMany :: WriterT w m a -> WriterT w m () #

skipSome :: WriterT w m a -> WriterT w m () #

unexpected :: String -> WriterT w m a #

eof :: WriterT w m () #

notFollowedBy :: Show a => WriterT w m a -> WriterT w m () #

(Applicative m, MonoidNull s, Ord s) => Parsing (ParserT m g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing.Transformer

Methods

try :: ParserT m g s a -> ParserT m g s a #

(<?>) :: ParserT m g s a -> String -> ParserT m g s a #

skipMany :: ParserT m g s a -> ParserT m g s () #

skipSome :: ParserT m g s a -> ParserT m g s () #

unexpected :: String -> ParserT m g s a #

eof :: ParserT m g s () #

notFollowedBy :: Show a => ParserT m g s a -> ParserT m g s () #

(Apply g, Parsing (p g s), InputParsing (Fixed p g s)) => Parsing (Fixed p g s) Source # 
Instance details

Defined in Text.Grampa.Internal.LeftRecursive

Methods

try :: Fixed p g s a -> Fixed p g s a #

(<?>) :: Fixed p g s a -> String -> Fixed p g s a #

skipMany :: Fixed p g s a -> Fixed p g s () #

skipSome :: Fixed p g s a -> Fixed p g s () #

unexpected :: String -> Fixed p g s a #

eof :: Fixed p g s () #

notFollowedBy :: Show a => Fixed p g s a -> Fixed p g s () #

(Stream s m t, Show t) => Parsing (ParsecT s u m) 
Instance details

Defined in Text.Parser.Combinators

Methods

try :: ParsecT s u m a -> ParsecT s u m a #

(<?>) :: ParsecT s u m a -> String -> ParsecT s u m a #

skipMany :: ParsecT s u m a -> ParsecT s u m () #

skipSome :: ParsecT s u m a -> ParsecT s u m () #

unexpected :: String -> ParsecT s u m a #

eof :: ParsecT s u m () #

notFollowedBy :: Show a => ParsecT s u m a -> ParsecT s u m () #

(Parsing m, MonadPlus m, Monoid w) => Parsing (RWST r w s m) 
Instance details

Defined in Text.Parser.Combinators

Methods

try :: RWST r w s m a -> RWST r w s m a #

(<?>) :: RWST r w s m a -> String -> RWST r w s m a #

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

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

unexpected :: String -> RWST r w s m a #

eof :: RWST r w s m () #

notFollowedBy :: Show a => RWST r w s m a -> RWST r w s m () #

(Parsing m, MonadPlus m, Monoid w) => Parsing (RWST r w s m) 
Instance details

Defined in Text.Parser.Combinators

Methods

try :: RWST r w s m a -> RWST r w s m a #

(<?>) :: RWST r w s m a -> String -> RWST r w s m a #

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

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

unexpected :: String -> RWST r w s m a #

eof :: RWST r w s m () #

notFollowedBy :: Show a => RWST r w s m a -> RWST r w s m () #

class Parsing m => LookAheadParsing (m :: Type -> Type) where #

Additional functionality needed to describe parsers independent of input type.

Methods

lookAhead :: m a -> m a #

lookAhead p parses p without consuming any input.

Instances

Instances details
LookAheadParsing ReadP 
Instance details

Defined in Text.Parser.LookAhead

Methods

lookAhead :: ReadP a -> ReadP a #

LookAheadParsing Get 
Instance details

Defined in Text.Parser.LookAhead

Methods

lookAhead :: Get a -> Get a #

Chunk i => LookAheadParsing (Parser i) 
Instance details

Defined in Text.Parser.LookAhead

Methods

lookAhead :: Parser i a -> Parser i a #

LookAheadParsing f => LookAheadParsing (Lazy f) 
Instance details

Defined in Text.Parser.Wrapper

Methods

lookAhead :: Lazy f a -> Lazy f a #

LookAheadParsing f => LookAheadParsing (Strict f) 
Instance details

Defined in Text.Parser.Wrapper

Methods

lookAhead :: Strict f a -> Strict f a #

(FactorialMonoid s, Ord s) => LookAheadParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Continued

Methods

lookAhead :: Parser g s a -> Parser g s a #

(MonoidNull s, Ord s) => LookAheadParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Memoizing

Methods

lookAhead :: Parser g s a -> Parser g s a #

(FactorialMonoid s, Ord s) => LookAheadParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Methods

lookAhead :: Parser g s a -> Parser g s a #

(MonoidNull s, Ord s) => LookAheadParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing

Methods

lookAhead :: Parser g s a -> Parser g s a #

FactorialMonoid s => LookAheadParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.PEG.Backtrack

Methods

lookAhead :: Parser g s a -> Parser g s a #

FactorialMonoid s => LookAheadParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.PEG.Packrat

Methods

lookAhead :: Parser g s a -> Parser g s a #

(LookAheadParsing m, Monad m) => LookAheadParsing (IdentityT m) 
Instance details

Defined in Text.Parser.LookAhead

Methods

lookAhead :: IdentityT m a -> IdentityT m a #

(LookAheadParsing m, MonadPlus m) => LookAheadParsing (ReaderT e m) 
Instance details

Defined in Text.Parser.LookAhead

Methods

lookAhead :: ReaderT e m a -> ReaderT e m a #

(LookAheadParsing m, MonadPlus m) => LookAheadParsing (StateT s m) 
Instance details

Defined in Text.Parser.LookAhead

Methods

lookAhead :: StateT s m a -> StateT s m a #

(LookAheadParsing m, MonadPlus m) => LookAheadParsing (StateT s m) 
Instance details

Defined in Text.Parser.LookAhead

Methods

lookAhead :: StateT s m a -> StateT s m a #

(LookAheadParsing m, MonadPlus m, Monoid w) => LookAheadParsing (WriterT w m) 
Instance details

Defined in Text.Parser.LookAhead

Methods

lookAhead :: WriterT w m a -> WriterT w m a #

(LookAheadParsing m, MonadPlus m, Monoid w) => LookAheadParsing (WriterT w m) 
Instance details

Defined in Text.Parser.LookAhead

Methods

lookAhead :: WriterT w m a -> WriterT w m a #

(Applicative m, MonoidNull s, Ord s) => LookAheadParsing (ParserT m g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing.Transformer

Methods

lookAhead :: ParserT m g s a -> ParserT m g s a #

(Apply g, LookAheadParsing (p g s), InputParsing (Fixed p g s)) => LookAheadParsing (Fixed p g s) Source # 
Instance details

Defined in Text.Grampa.Internal.LeftRecursive

Methods

lookAhead :: Fixed p g s a -> Fixed p g s a #

(Stream s m t, Show t) => LookAheadParsing (ParsecT s u m) 
Instance details

Defined in Text.Parser.LookAhead

Methods

lookAhead :: ParsecT s u m a -> ParsecT s u m a #

(LookAheadParsing m, MonadPlus m, Monoid w) => LookAheadParsing (RWST r w s m) 
Instance details

Defined in Text.Parser.LookAhead

Methods

lookAhead :: RWST r w s m a -> RWST r w s m a #

(LookAheadParsing m, MonadPlus m, Monoid w) => LookAheadParsing (RWST r w s m) 
Instance details

Defined in Text.Parser.LookAhead

Methods

lookAhead :: RWST r w s m a -> RWST r w s m a #

class CharParsing m => TokenParsing (m :: Type -> Type) where #

Additional functionality that is needed to tokenize input while ignoring whitespace.

Minimal complete definition

Nothing

Methods

someSpace :: m () #

Usually, someSpace consists of one or more occurrences of a space. Some parsers may choose to recognize line comments or block (multi line) comments as white space as well.

nesting :: m a -> m a #

Called when we enter a nested pair of symbols. Overloadable to enable disabling layout

semi :: m Char #

The token parser |semi| parses the character ';' and skips any trailing white space. Returns the character ';'. Overloadable to permit automatic semicolon insertion or Haskell-style layout.

highlight :: Highlight -> m a -> m a #

Tag a region of parsed text with a bit of semantic information. Most parsers won't use this, but it is indispensible for highlighters.

token :: m a -> m a #

token p first applies parser p and then the whiteSpace parser, returning the value of p. Every lexical token (token) is defined using token, this way every parse starts at a point without white space. Parsers that use token are called token parsers in this document.

The only point where the whiteSpace parser should be called explicitly is the start of the main parser in order to skip any leading white space.

Alternatively, one might define token as first parsing whiteSpace and then parser p. By parsing whiteSpace first, the parser is able to return before parsing additional whiteSpace, improving laziness.

mainParser  = sum <$ whiteSpace <*> many (token digit) <* eof

Instances

Instances details
TokenParsing ReadP 
Instance details

Defined in Text.Parser.Token

Methods

someSpace :: ReadP () #

nesting :: ReadP a -> ReadP a #

semi :: ReadP Char #

highlight :: Highlight -> ReadP a -> ReadP a #

token :: ReadP a -> ReadP a #

Chunk t => TokenParsing (Parser t) 
Instance details

Defined in Text.Parser.Token

Methods

someSpace :: Parser t () #

nesting :: Parser t a -> Parser t a #

semi :: Parser t Char #

highlight :: Highlight -> Parser t a -> Parser t a #

token :: Parser t a -> Parser t a #

TokenParsing f => TokenParsing (Lazy f) 
Instance details

Defined in Text.Parser.Wrapper

Methods

someSpace :: Lazy f () #

nesting :: Lazy f a -> Lazy f a #

semi :: Lazy f Char #

highlight :: Highlight -> Lazy f a -> Lazy f a #

token :: Lazy f a -> Lazy f a #

TokenParsing f => TokenParsing (Strict f) 
Instance details

Defined in Text.Parser.Wrapper

Methods

someSpace :: Strict f () #

nesting :: Strict f a -> Strict f a #

semi :: Strict f Char #

highlight :: Highlight -> Strict f a -> Strict f a #

token :: Strict f a -> Strict f a #

TokenParsing m => TokenParsing (Unhighlighted m) 
Instance details

Defined in Text.Parser.Token

TokenParsing m => TokenParsing (Unlined m) 
Instance details

Defined in Text.Parser.Token

Methods

someSpace :: Unlined m () #

nesting :: Unlined m a -> Unlined m a #

semi :: Unlined m Char #

highlight :: Highlight -> Unlined m a -> Unlined m a #

token :: Unlined m a -> Unlined m a #

TokenParsing m => TokenParsing (Unspaced m) 
Instance details

Defined in Text.Parser.Token

Methods

someSpace :: Unspaced m () #

nesting :: Unspaced m a -> Unspaced m a #

semi :: Unspaced m Char #

highlight :: Highlight -> Unspaced m a -> Unspaced m a #

token :: Unspaced m a -> Unspaced m a #

(TokenParsing m, MonadPlus m) => TokenParsing (IdentityT m) 
Instance details

Defined in Text.Parser.Token

(TokenParsing m, MonadPlus m) => TokenParsing (ReaderT e m) 
Instance details

Defined in Text.Parser.Token

Methods

someSpace :: ReaderT e m () #

nesting :: ReaderT e m a -> ReaderT e m a #

semi :: ReaderT e m Char #

highlight :: Highlight -> ReaderT e m a -> ReaderT e m a #

token :: ReaderT e m a -> ReaderT e m a #

(TokenParsing m, MonadPlus m) => TokenParsing (StateT s m) 
Instance details

Defined in Text.Parser.Token

Methods

someSpace :: StateT s m () #

nesting :: StateT s m a -> StateT s m a #

semi :: StateT s m Char #

highlight :: Highlight -> StateT s m a -> StateT s m a #

token :: StateT s m a -> StateT s m a #

(TokenParsing m, MonadPlus m) => TokenParsing (StateT s m) 
Instance details

Defined in Text.Parser.Token

Methods

someSpace :: StateT s m () #

nesting :: StateT s m a -> StateT s m a #

semi :: StateT s m Char #

highlight :: Highlight -> StateT s m a -> StateT s m a #

token :: StateT s m a -> StateT s m a #

(TokenParsing m, MonadPlus m, Monoid w) => TokenParsing (WriterT w m) 
Instance details

Defined in Text.Parser.Token

Methods

someSpace :: WriterT w m () #

nesting :: WriterT w m a -> WriterT w m a #

semi :: WriterT w m Char #

highlight :: Highlight -> WriterT w m a -> WriterT w m a #

token :: WriterT w m a -> WriterT w m a #

(TokenParsing m, MonadPlus m, Monoid w) => TokenParsing (WriterT w m) 
Instance details

Defined in Text.Parser.Token

Methods

someSpace :: WriterT w m () #

nesting :: WriterT w m a -> WriterT w m a #

semi :: WriterT w m Char #

highlight :: Highlight -> WriterT w m a -> WriterT w m a #

token :: WriterT w m a -> WriterT w m a #

Stream s m Char => TokenParsing (ParsecT s u m) 
Instance details

Defined in Text.Parser.Token

Methods

someSpace :: ParsecT s u m () #

nesting :: ParsecT s u m a -> ParsecT s u m a #

semi :: ParsecT s u m Char #

highlight :: Highlight -> ParsecT s u m a -> ParsecT s u m a #

token :: ParsecT s u m a -> ParsecT s u m a #

(TokenParsing m, MonadPlus m, Monoid w) => TokenParsing (RWST r w s m) 
Instance details

Defined in Text.Parser.Token

Methods

someSpace :: RWST r w s m () #

nesting :: RWST r w s m a -> RWST r w s m a #

semi :: RWST r w s m Char #

highlight :: Highlight -> RWST r w s m a -> RWST r w s m a #

token :: RWST r w s m a -> RWST r w s m a #

(TokenParsing m, MonadPlus m, Monoid w) => TokenParsing (RWST r w s m) 
Instance details

Defined in Text.Parser.Token

Methods

someSpace :: RWST r w s m () #

nesting :: RWST r w s m a -> RWST r w s m a #

semi :: RWST r w s m Char #

highlight :: Highlight -> RWST r w s m a -> RWST r w s m a #

token :: RWST r w s m a -> RWST r w s m a #

Other combinators

concatMany :: (Alternative p, Monoid a) => p a -> p a Source #

Zero or more argument occurrences like many, with concatenated monoidal results.

concatSome :: (Alternative p, Semigroup a) => p a -> p a Source #

One or more argument occurrences like some, with concatenated monoidal results.