module Agda.Syntax.Concrete.Operators.Parser.Monad
( MemoKey(..)
, Parser
, parse
, token
, sat
, tok
, annotate
, memoise
, memoiseIfPrinting
, grammar
) where
import Data.Hashable
import GHC.Generics (Generic)
import Text.PrettyPrint.HughesPJ
import Agda.Syntax.Common
import qualified Agda.Utils.Parser.MemoisedCPS as Parser
data MemoKey = NodeK (Either Integer Integer)
| PostLeftsK (Either Integer Integer)
| PreRightsK (Either Integer Integer)
| TopK
| AppK
| NonfixK
deriving (Eq, Show, Generic)
instance Hashable MemoKey
type Parser tok a =
#ifdef DEBUG
Parser.ParserWithGrammar
#else
Parser.Parser
#endif
MemoKey tok (MaybePlaceholder tok) a
parse :: forall tok a. Parser tok a -> [MaybePlaceholder tok] -> [a]
parse = Parser.parse
token :: Parser tok (MaybePlaceholder tok)
token = Parser.token
sat :: (MaybePlaceholder tok -> Bool) ->
Parser tok (MaybePlaceholder tok)
sat = Parser.sat
tok :: (Eq tok, Show tok) =>
MaybePlaceholder tok -> Parser tok (MaybePlaceholder tok)
tok = Parser.tok
annotate :: (Doc -> Doc) -> Parser tok a -> Parser tok a
annotate = Parser.annotate
memoise :: MemoKey -> Parser tok tok -> Parser tok tok
memoise = Parser.memoise
memoiseIfPrinting :: MemoKey -> Parser tok tok -> Parser tok tok
memoiseIfPrinting = Parser.memoiseIfPrinting
grammar :: Parser tok a -> Doc
grammar = Parser.grammar