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

Text.Grampa.ContextFree.Parallel

Synopsis

Documentation

data FailureInfo s Source #

Constructors

FailureInfo Int [Expected s] 

Instances

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

Defined in Text.Grampa.Internal

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

Defined in Text.Grampa.Internal

Semigroup (FailureInfo s) Source # 
Instance details

Defined in Text.Grampa.Internal

Monoid (FailureInfo s) Source # 
Instance details

Defined in Text.Grampa.Internal

data ResultList s r Source #

Constructors

ResultList !(BinTree (ResultInfo s r)) !(FailureInfo s) 

Instances

Instances details
Functor (ResultList s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Methods

fmap :: (a -> b) -> ResultList s a -> ResultList s b #

(<$) :: a -> ResultList s b -> ResultList s a #

Show s => Show1 (ResultList s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Methods

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

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

(Show s, Show r) => Show (ResultList s r) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Methods

showsPrec :: Int -> ResultList s r -> ShowS #

show :: ResultList s r -> String #

showList :: [ResultList s r] -> ShowS #

Semigroup (ResultList s r) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Methods

(<>) :: ResultList s r -> ResultList s r -> ResultList s r #

sconcat :: NonEmpty (ResultList s r) -> ResultList s r #

stimes :: Integral b => b -> ResultList s r -> ResultList s r #

Monoid (ResultList s r) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Methods

mempty :: ResultList s r #

mappend :: ResultList s r -> ResultList s r -> ResultList s r #

mconcat :: [ResultList s r] -> ResultList s r #

data Parser (g :: (* -> *) -> *) s r Source #

Parser type for context-free grammars using a parallel parsing algorithm with no result sharing nor left recursion support.

Instances

Instances details
Monad (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Methods

(>>=) :: Parser g s a -> (a -> Parser g s b) -> Parser g s b #

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

return :: a -> Parser g s a #

Functor (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Methods

fmap :: (a -> b) -> Parser g s a -> Parser g s b #

(<$) :: a -> Parser g s b -> Parser g s a #

Applicative (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Methods

pure :: a -> Parser g s a #

(<*>) :: Parser g s (a -> b) -> Parser g s a -> Parser g s b #

liftA2 :: (a -> b -> c) -> Parser g s a -> Parser g s b -> Parser g s c #

(*>) :: Parser g s a -> Parser g s b -> Parser g s b #

(<*) :: Parser g s a -> Parser g s b -> Parser g s a #

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

Defined in Text.Grampa.ContextFree.Parallel

Methods

empty :: Parser g s a #

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

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

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

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

Defined in Text.Grampa.ContextFree.Parallel

Methods

mzero :: Parser g s a #

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

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

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

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

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 #

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 #

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

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

Semigroup x => Semigroup (Parser g s x) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Methods

(<>) :: Parser g s x -> Parser g s x -> Parser g s x #

sconcat :: NonEmpty (Parser g s x) -> Parser g s x #

stimes :: Integral b => b -> Parser g s x -> Parser g s x #

Monoid x => Monoid (Parser g s x) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

Methods

mempty :: Parser g s x #

mappend :: Parser g s x -> Parser g s x -> Parser g s x #

mconcat :: [Parser g s x] -> Parser g s x #

type ParserInput (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

type ParserInput (Parser g s) = s
type ResultFunctor (Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

type GrammarConstraint (Parser g1 s) g2 Source # 
Instance details

Defined in Text.Grampa.ContextFree.Parallel

type GrammarConstraint (Parser g1 s) g2 = Functor g2

fromResultList :: (Eq s, FactorialMonoid s) => s -> ResultList s r -> ParseResults s [(s, r)] Source #