Safe Haskell | None |
---|---|
Language | Haskell2010 |
The parser monad used by the operator parser
- data MemoKey
- type Parser tok a = Parser MemoKey tok (MaybePlaceholder tok) a
- parse :: forall tok a. Parser tok a -> [MaybePlaceholder tok] -> [a]
- token :: Parser tok (MaybePlaceholder tok)
- sat :: (MaybePlaceholder tok -> Bool) -> Parser tok (MaybePlaceholder tok)
- tok :: (Eq tok, Show tok) => MaybePlaceholder tok -> Parser tok (MaybePlaceholder tok)
- annotate :: (Doc -> Doc) -> Parser tok a -> Parser tok a
- memoise :: MemoKey -> Parser tok tok -> Parser tok tok
- memoiseIfPrinting :: MemoKey -> Parser tok tok -> Parser tok tok
- grammar :: Parser tok a -> Doc
Documentation
Memoisation keys.
parse :: forall tok a. Parser tok a -> [MaybePlaceholder tok] -> [a] Source #
Runs the parser.
token :: Parser tok (MaybePlaceholder tok) Source #
Parses a single token.
sat :: (MaybePlaceholder tok -> Bool) -> Parser tok (MaybePlaceholder tok) Source #
Parses a token satisfying the given predicate.
tok :: (Eq tok, Show tok) => MaybePlaceholder tok -> Parser tok (MaybePlaceholder tok) Source #
Parses a given token.
annotate :: (Doc -> Doc) -> Parser tok a -> Parser tok a Source #
Uses the given function to modify the printed representation (if any) of the given parser.
memoise :: MemoKey -> Parser tok tok -> Parser tok tok Source #
Memoises the given parser.
Every memoised parser must be annotated with a unique key. (Parametrised parsers must use distinct keys for distinct inputs.)