grammatical-parsers-0.5: parsers that combine into grammars
Safe HaskellNone
LanguageHaskell2010

Text.Grampa

Description

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

Synopsis

Parsing methods

failureDescription :: forall s. (Ord s, TextualMonoid s) => s -> ParseFailure 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 parse function to the given grammar-free parser and its input.

Types

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

A type synonym for a fixed grammar record type g with a given parser type p on input streams of type s

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

A type synonym for an endomorphic function on a grammar record type g, whose parsers of type p build grammars of type g', parsing input streams of type s

data ParseFailure s Source #

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

Constructors

ParseFailure Int [Expected s] 

Instances

Instances details
Eq s => Eq (ParseFailure s) Source # 
Instance details

Defined in Text.Grampa.Class

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

Defined in Text.Grampa.Class

data Expected s Source #

Constructors

Expected String 
ExpectedInput s 

Instances

Instances details
Functor Expected Source # 
Instance details

Defined in Text.Grampa.Class

Methods

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

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

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

Defined in Text.Grampa.Class

Methods

(==) :: Expected s -> Expected s -> Bool #

(/=) :: Expected s -> Expected s -> Bool #

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

Defined in Text.Grampa.Class

Methods

compare :: Expected s -> Expected s -> Ordering #

(<) :: Expected s -> Expected s -> Bool #

(<=) :: Expected s -> Expected s -> Bool #

(>) :: Expected s -> Expected s -> Bool #

(>=) :: Expected s -> Expected s -> Bool #

max :: Expected s -> Expected s -> Expected s #

min :: Expected s -> Expected s -> Expected s #

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

Defined in Text.Grampa.Class

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

Defined in Text.Grampa.Class

Methods

showsPrec :: Int -> Expected s -> ShowS #

show :: Expected s -> String #

showList :: [Expected s] -> ShowS #

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
Functor Ambiguous Source # 
Instance details

Defined in Text.Grampa.Class

Methods

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

(<$) :: a -> Ambiguous b -> 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 #

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 #

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

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 #

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

Defined in Text.Grampa.Class

Methods

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

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

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

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

Defined in Text.Grampa.Class

Show a => Show (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 #

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

Defined in Text.Grampa.Class

data Position #

Opaque data type that represents an input position.

Instances

Instances details
Eq Position 
Instance details

Defined in Text.Parser.Input.Position

Read Position 
Instance details

Defined in Text.Parser.Input.Position

Show Position 
Instance details

Defined in Text.Parser.Input.Position

Parser combinators and primitives

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 some, 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

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

FactorialMonoid 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 () #

FactorialMonoid 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 () #

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

MonoidNull 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 () #

MonoidNull 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 => 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 () #

(Applicative m, MonoidNull 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 () #

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

Defined in Text.Grampa.ContextFree.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
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 ())) => 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) => AmbiguousParsing (Fixed p g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.LeftRecursive

Methods

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

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.

Methods

getInput :: m (ParserInput m) #

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

getSourcePos :: m Position #

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 #

InputParsing Parser 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput Parser #

InputParsing ReadP 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput ReadP #

InputParsing (Lazy Get) 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (Lazy Get) #

InputParsing (Strict Get) 
Instance details

Defined in Text.Parser.Input

Associated Types

type ParserInput (Strict Get) #

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

Defined in Text.Parser.Input

Associated Types

type ParserInput (IdentityT m) #

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

Defined in Text.Parser.Input

Associated Types

type ParserInput (ReaderT e m) #

Methods

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

getSourcePos :: ReaderT e m Position #

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

Methods

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

getSourcePos :: StateT s m Position #

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

Methods

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

getSourcePos :: StateT s m Position #

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

Methods

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

getSourcePos :: WriterT w m Position #

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

Methods

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

getSourcePos :: WriterT w m Position #

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

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

Defined in Text.Grampa.ContextFree.Parallel

Associated Types

type ParserInput (Parser g s) #

Methods

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

getSourcePos :: Parser g s Position #

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.ContextFree.Continued

Associated Types

type ParserInput (Parser g s) #

Methods

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

getSourcePos :: Parser g s Position #

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

Methods

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

getSourcePos :: Parser g s Position #

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.ContextFree.SortedMemoizing

Associated Types

type ParserInput (Parser g s) #

Methods

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

getSourcePos :: Parser g s Position #

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.ContextFree.Memoizing

Associated Types

type ParserInput (Parser g s) #

Methods

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

getSourcePos :: Parser g s Position #

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

Methods

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

getSourcePos :: Parser g s Position #

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

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

Methods

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

getSourcePos :: ParsecT s u m Position #

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

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

Defined in Text.Grampa.ContextFree.SortedMemoizing.Transformer

Associated Types

type ParserInput (ParserT m g s) #

Methods

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

getSourcePos :: ParserT m g s Position #

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

(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.ContextFree.LeftRecursive

Associated Types

type ParserInput (Fixed p g s) #

Methods

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

getSourcePos :: Fixed p g s Position #

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

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

Methods

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

getSourcePos :: RWST r w s m Position #

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

Methods

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

getSourcePos :: RWST r w s m Position #

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

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

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

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

(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.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.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)) #

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

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

(Applicative m, 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)) #

(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.ContextFree.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)) #

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

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

(LeftReductive s, FactorialMonoid 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) #

(Applicative m, LeftReductive s, FactorialMonoid 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) #

(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.ContextFree.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 InputParsing m => MultiParsing m where Source #

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

Associated Types

type ResultFunctor m :: * -> * Source #

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

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

type GrammarConstraint m g = Functor g 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) => 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) => 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) => 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 #

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.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 #

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) => 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) => MultiParsing (ParserT m 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.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 #

(Eq s, LeftReductive s, FactorialMonoid s, Alternative (p g s), TailsParsing (p g s), GrammarConstraint (p g s) g, ParserGrammar (p g s) ~ g, Functor (ResultFunctor (p g s)), s ~ ParserInput (p g s), GrammarFunctor (p g s) ~ rl s, FallibleWithExpectations rl, AmbiguousAlternative (GrammarFunctor (p g s))) => MultiParsing (Fixed p g s) Source #

Parser of general context-free grammars, including left recursion.

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

Defined in Text.Grampa.ContextFree.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.

Minimal complete definition

parsingResult, nonTerminal

Associated Types

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

The record of grammar productions associated with the parser

type GrammarFunctor m :: * -> * 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.

Instances

Instances details
(Eq s, LeftReductive s, FactorialMonoid s) => GrammarParsing (Parser g s) Source # 
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 #

(Eq 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 #

(Eq s, LeftReductive s, FactorialMonoid s) => GrammarParsing (Parser g s) Source # 
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 #

(Applicative m, Eq s, LeftReductive s, FactorialMonoid s, Functor g) => GrammarParsing (ParserT m g s) Source # 
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 #

(Eq s, LeftReductive s, FactorialMonoid s, Alternative (p g s), TailsParsing (p g s), GrammarConstraint (p g s) g, ParserGrammar (p g s) ~ g, Functor (ResultFunctor (p g s)), s ~ ParserInput (p g s), GrammarFunctor (p g s) ~ rl s, FallibleWithExpectations rl, AmbiguousAlternative (GrammarFunctor (p g s))) => GrammarParsing (Fixed p g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.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 #

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 (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 => 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, 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 #

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

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 (Unspaced m) 
Instance details

Defined in Text.Parser.Token

CharParsing m => CharParsing (Unlined m) 
Instance details

Defined in Text.Parser.Token

(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 #

TextualMonoid 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 #

(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 #

(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.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.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 #

(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 #

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 #

(Applicative m, 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 #

(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.ContextFree.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 #

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

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, 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 () #

FactorialMonoid 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 () #

FactorialMonoid 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 () #

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

MonoidNull 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 () #

MonoidNull 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 => 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 () #

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

(Applicative m, MonoidNull 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 () #

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

Defined in Text.Grampa.ContextFree.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 () #

(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 #

(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 #

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

Defined in Text.Grampa.ContextFree.Parallel

Methods

lookAhead :: Parser g s a -> Parser g s a #

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

Defined in Text.Grampa.ContextFree.Continued

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 #

MonoidNull s => LookAheadParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.SortedMemoizing

Methods

lookAhead :: Parser g s a -> Parser g s a #

MonoidNull 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 => LookAheadParsing (Parser g s) Source # 
Instance details

Defined in Text.Grampa.PEG.Packrat

Methods

lookAhead :: Parser g s a -> Parser 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 #

(Applicative m, MonoidNull 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 #

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

Defined in Text.Grampa.ContextFree.LeftRecursive

Methods

lookAhead :: Fixed p g s a -> Fixed p g s 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 #

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.