Copyright | 2010-11 University of Marburg, 2012 Kei Hibino |
---|---|
License | BSD3 |
Maintainer | ex8k.hibino@gmail.com |
Stability | experimental |
Portability | unknown |
Safe Haskell | None |
Language | Haskell98 |
This module contains combinators for classes defined in Text.Syntax.Poly.Classes.
- this :: (Syntax tok delta, Eq tok) => tok -> delta ()
- list :: (Syntax tok delta, Eq tok) => [tok] -> delta ()
- none :: AbstractSyntax delta => delta [alpha]
- many :: AbstractSyntax delta => delta alpha -> delta [alpha]
- some :: AbstractSyntax delta => delta alpha -> delta [alpha]
- replicate :: AbstractSyntax delta => Int -> delta alpha -> delta [alpha]
- sepBy :: AbstractSyntax delta => delta alpha -> delta () -> delta [alpha]
- sepBy1 :: AbstractSyntax delta => delta alpha -> delta () -> delta [alpha]
- chainl1 :: AbstractSyntax delta => delta alpha -> delta beta -> Iso (alpha, (beta, alpha)) alpha -> delta alpha
- count :: (Eq beta, Enum beta, AbstractSyntax delta) => delta () -> delta beta
- skipMany :: AbstractSyntax delta => delta alpha -> delta ()
- skipSome :: AbstractSyntax delta => delta alpha -> delta alpha
- (*>) :: AbstractSyntax delta => delta () -> delta alpha -> delta alpha
- (<*) :: AbstractSyntax delta => delta alpha -> delta () -> delta alpha
- between :: AbstractSyntax delta => delta () -> delta () -> delta alpha -> delta alpha
- (<+>) :: AbstractSyntax delta => delta alpha -> delta beta -> delta (Either alpha beta)
- choice :: AbstractSyntax delta => [delta alpha] -> delta alpha
- optional :: AbstractSyntax delta => delta alpha -> delta (Maybe alpha)
- bool :: AbstractSyntax delta => delta () -> delta Bool
- (<$?>) :: AbstractSyntax delta => Iso (a, b) a -> delta (a, Maybe b) -> delta a
- (<?$>) :: AbstractSyntax delta => Iso (a, b) b -> delta (Maybe a, b) -> delta b
- format :: (Syntax tok delta, Eq tok) => [tok] -> delta ()
Lexemes
this :: (Syntax tok delta, Eq tok) => tok -> delta () Source
The this
combinator parses/prints a fixed token
list :: (Syntax tok delta, Eq tok) => [tok] -> delta () Source
The list
combinator parses/prints a fixed token list and consumes/produces a unit value.
Repetition
none :: AbstractSyntax delta => delta [alpha] Source
none
parses/prints empty tokens stream consume/produces a empty list.
many :: AbstractSyntax delta => delta alpha -> delta [alpha] Source
The many
combinator is used to repeat syntax.
many p
repeats the passed syntax p
zero or more than zero times.
some :: AbstractSyntax delta => delta alpha -> delta [alpha] Source
The some
combinator is used to repeat syntax.
some p
repeats the passed syntax p
more than zero times.
replicate :: AbstractSyntax delta => Int -> delta alpha -> delta [alpha] Source
The replicate
combinator is used to repeat syntax.
replicate n p
repeats the passwd syntax p
n
times.
sepBy :: AbstractSyntax delta => delta alpha -> delta () -> delta [alpha] Source
The sepBy
combinator separates syntax into delimited list.
sepBy p d
is p
list syntax delimited by d
syntax.
sepBy1 :: AbstractSyntax delta => delta alpha -> delta () -> delta [alpha] Source
The sepBy1
combinator separates syntax into delimited non-empty list.
sepBy p d
is p
list syntax delimited by d
syntax.
chainl1 :: AbstractSyntax delta => delta alpha -> delta beta -> Iso (alpha, (beta, alpha)) alpha -> delta alpha Source
The chainl1
combinator is used to parse a
left-associative chain of infix operators.
count :: (Eq beta, Enum beta, AbstractSyntax delta) => delta () -> delta beta Source
The count
combinator counts fixed syntax.
Skipping
skipMany :: AbstractSyntax delta => delta alpha -> delta () Source
The skipMany p
parse the passed syntax p
zero or more than zero times, and print nothing.
skipSome :: AbstractSyntax delta => delta alpha -> delta alpha Source
The skipSome v p
parse the passed syntax p
more than zero times, and print p
.
Sequencing
(*>) :: AbstractSyntax delta => delta () -> delta alpha -> delta alpha infixl 7 Source
This variant of <*>
ignores its left result.
In contrast to its counterpart derived from the Applicative
class, the ignored
parts have type `delta ()` rather than `delta beta` because otherwise information relevant
for pretty-printing would be lost.
(<*) :: AbstractSyntax delta => delta alpha -> delta () -> delta alpha infixl 7 Source
This variant of <*>
ignores its right result.
In contrast to its counterpart derived from the Applicative
class, the ignored
parts have type `delta ()` rather than `delta beta` because otherwise information relevant
for pretty-printing would be lost.
between :: AbstractSyntax delta => delta () -> delta () -> delta alpha -> delta alpha Source
Alternation
(<+>) :: AbstractSyntax delta => delta alpha -> delta beta -> delta (Either alpha beta) infixl 4 Source
The <+>
combinator choose one of two syntax.
choice :: AbstractSyntax delta => [delta alpha] -> delta alpha Source
choice
a syntax from list.
optional :: AbstractSyntax delta => delta alpha -> delta (Maybe alpha) Source
The optional
combinator may parse / print passed syntax.
bool :: AbstractSyntax delta => delta () -> delta Bool Source
The bool
combinator parse / print passed syntax or not.
(<$?>) :: AbstractSyntax delta => Iso (a, b) a -> delta (a, Maybe b) -> delta a infix 5 Source
May append not to repeat prefix syntax.
(<?$>) :: AbstractSyntax delta => Iso (a, b) b -> delta (Maybe a, b) -> delta b infix 5 Source
May prepend not to repeat suffix syntax.