Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Fixed p g s a
- type Parser = Fixed Parser
- data SeparatedParser p (g :: (* -> *) -> *) s a
- = FrontParser (p g s a)
- | CycleParser {
- cycleParser :: p g s a
- backParser :: p g s a
- appendResultsArrow :: ResultAppend p g s a
- dependencies :: g (Const Bool)
- | BackParser {
- backParser :: p g s a
- class FallibleWithExpectations f where
- hasSuccess :: f s a -> Bool
- failureOf :: f s a -> FailureInfo s
- failWith :: FailureInfo s -> f s a
- expectations :: f s a -> [Expected s]
- longest :: Fixed Parser g s a -> Fixed Parser g [(s, g (ResultList g s))] a
- peg :: Fixed Parser g [(s, g (ResultList g s))] a -> Fixed Parser g s a
- terminalPEG :: Monoid s => Fixed Parser g s a -> Fixed Parser g s a
- liftPositive :: p g s a -> Fixed p g s a
- liftPure :: Alternative (p g s) => p g s a -> Fixed p g s a
- mapPrimitive :: (p g s a -> p g s a) -> Fixed p g s a -> Fixed p g s a
- parseSeparated :: forall p g rl s. (Apply g, Foldable g, Eq s, FactorialMonoid s, LeftReductive s, TailsParsing (p g s), GrammarConstraint (p g s) g, GrammarFunctor (p g s) ~ rl s, FallibleWithExpectations rl, s ~ ParserInput (p g s)) => g (SeparatedParser p g s) -> s -> [(s, g (GrammarFunctor (p g s)))]
- separated :: forall p g s. (Alternative (p g s), Apply g, Distributive g, Traversable g, AmbiguousAlternative (GrammarFunctor (p g s))) => g (Fixed p g s) -> g (SeparatedParser p g s)
Documentation
Instances
data SeparatedParser p (g :: (* -> *) -> *) s a Source #
FrontParser (p g s a) | |
CycleParser | |
| |
BackParser | |
|
class FallibleWithExpectations f where Source #
hasSuccess :: f s a -> Bool Source #
failureOf :: f s a -> FailureInfo s Source #
failWith :: FailureInfo s -> f s a Source #
expectations :: f s a -> [Expected s] Source #
Instances
FallibleWithExpectations (ResultList g) Source # | |
Defined in Text.Grampa.ContextFree.LeftRecursive hasSuccess :: ResultList g s a -> Bool Source # failureOf :: ResultList g s a -> FailureInfo s Source # failWith :: FailureInfo s -> ResultList g s a Source # expectations :: ResultList g s a -> [Expected s] Source # | |
FallibleWithExpectations (ResultListT m g) Source # | |
Defined in Text.Grampa.ContextFree.LeftRecursive.Transformer hasSuccess :: ResultListT m g s a -> Bool Source # failureOf :: ResultListT m g s a -> FailureInfo s Source # failWith :: FailureInfo s -> ResultListT m g s a Source # expectations :: ResultListT m g s a -> [Expected s] Source # |
longest :: Fixed Parser g s a -> Fixed Parser g [(s, g (ResultList g s))] a Source #
Turns a context-free parser into a backtracking PEG parser that consumes the longest possible prefix of the list
of input tails, opposite of peg
peg :: Fixed Parser g [(s, g (ResultList g s))] a -> Fixed Parser g s a Source #
Turns a backtracking PEG parser of the list of input tails into a context-free parser, opposite of longest
terminalPEG :: Monoid s => Fixed Parser g s a -> Fixed Parser g s a Source #
Turns a backtracking PEG parser into a context-free parser
liftPositive :: p g s a -> Fixed p g s a Source #
Lifts a primitive positive parser (i.e., one that always consumes some input) into a left-recursive one
liftPure :: Alternative (p g s) => p g s a -> Fixed p g s a Source #
Lifts a primitive pure parser (i.e., one that consumes no input) into a left-recursive one
mapPrimitive :: (p g s a -> p g s a) -> Fixed p g s a -> Fixed p g s a Source #
parseSeparated :: forall p g rl s. (Apply g, Foldable g, Eq s, FactorialMonoid s, LeftReductive s, TailsParsing (p g s), GrammarConstraint (p g s) g, GrammarFunctor (p g s) ~ rl s, FallibleWithExpectations rl, s ~ ParserInput (p g s)) => g (SeparatedParser p g s) -> s -> [(s, g (GrammarFunctor (p g s)))] Source #
Parse the given input using a context-free grammar separated into two parts: the first specifying all the left-recursive productions, the second all others. The first function argument specifies the left-recursive dependencies among the grammar productions.
separated :: forall p g s. (Alternative (p g s), Apply g, Distributive g, Traversable g, AmbiguousAlternative (GrammarFunctor (p g s))) => g (Fixed p g s) -> g (SeparatedParser p g s) Source #