| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Agda.Syntax.Concrete.Operators.Parser.Monad
Description
The parser monad used by the operator parser
Synopsis
- data MemoKey
- data PrecedenceKey
- type Parser tok a = Parser MemoKey tok (MaybePlaceholder tok) a
- parse :: Parser tok a -> [MaybePlaceholder tok] -> [a]
- sat' :: (MaybePlaceholder tok -> Maybe a) -> Parser tok a
- sat :: (MaybePlaceholder tok -> Bool) -> Parser tok (MaybePlaceholder tok)
- 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
- pattern LeftPK :: PrecedenceLevel -> PrecedenceKey
- pattern RightPK :: PrecedenceLevel -> PrecedenceKey
Documentation
Memoisation keys.
Constructors
| NodeK !PrecedenceKey | |
| PostLeftsK !PrecedenceKey | |
| PreRightsK !PrecedenceKey | |
| TopK | |
| AppK | |
| NonfixK |
Instances
data PrecedenceKey Source #
Instances
| Show PrecedenceKey Source # | |
Defined in Agda.Syntax.Concrete.Operators.Parser.Monad Methods showsPrec :: Int -> PrecedenceKey -> ShowS # show :: PrecedenceKey -> String # showList :: [PrecedenceKey] -> ShowS # | |
| Eq PrecedenceKey Source # | |
Defined in Agda.Syntax.Concrete.Operators.Parser.Monad Methods (==) :: PrecedenceKey -> PrecedenceKey -> Bool # (/=) :: PrecedenceKey -> PrecedenceKey -> Bool # | |
| Hashable PrecedenceKey Source # | |
Defined in Agda.Syntax.Concrete.Operators.Parser.Monad | |
parse :: Parser tok a -> [MaybePlaceholder tok] -> [a] Source #
Runs the parser.
sat' :: (MaybePlaceholder tok -> Maybe a) -> Parser tok a Source #
Parses a token satisfying the given predicate. The computed value is returned.
sat :: (MaybePlaceholder tok -> Bool) -> Parser tok (MaybePlaceholder tok) Source #
Parses a token satisfying the given predicate.
doc :: Doc -> Parser tok a -> Parser tok a Source #
Uses the given document as the printed representation of the
given parser. The document's precedence is taken to be atomP.
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.)
memoiseIfPrinting :: MemoKey -> Parser tok tok -> Parser tok tok Source #
Memoises the given parser, but only if printing, not if parsing.
Every memoised parser must be annotated with a unique key. (Parametrised parsers must use distinct keys for distinct inputs.)
grammar :: Parser tok a -> Doc Source #
Tries to print the parser, or returns empty, depending on the
implementation. This function might not terminate.
pattern LeftPK :: PrecedenceLevel -> PrecedenceKey Source #
pattern RightPK :: PrecedenceLevel -> PrecedenceKey Source #