Copyright | (C) 2016-2025 David M. Johnson (@dmjio) |
---|---|
License | BSD3-style (see the file LICENSE) |
Maintainer | David M. Johnson <code@dmj.io> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Miso.Util.Parser
Contents
Description
Synopsis
- type Parser token a = ParserT () [token] [] a
- newtype ParserT r token (m :: Type -> Type) a = Parser {
- runParserT :: r -> token -> m (a, token)
- data ParseError a token
- = UnexpectedParse [token]
- | LexicalError LexerError
- | Ambiguous [(a, [token])]
- | NoParses token
- | EmptyStream
- parse :: Parser token a -> [token] -> Either (ParseError a token) a
- satisfy :: (a -> Bool) -> ParserT r [a] [] a
- peek :: Parser a a
- token_ :: Eq token => token -> Parser token token
- errorOut :: errorToken -> ParserT r errorToken [] ()
- allTokens :: ParserT r a [] a
- modifyTokens :: (t -> t) -> ParserT r t [] ()
- askParser :: ParserT r token [] r
Types
newtype ParserT r token (m :: Type -> Type) a Source #
Constructors
Parser | |
Fields
|
Instances
Alternative (ParserT r token []) Source # | |
Applicative (ParserT r token []) Source # | |
Defined in Miso.Util.Parser Methods pure :: a -> ParserT r token [] a # (<*>) :: ParserT r token [] (a -> b) -> ParserT r token [] a -> ParserT r token [] b # liftA2 :: (a -> b -> c) -> ParserT r token [] a -> ParserT r token [] b -> ParserT r token [] c # (*>) :: ParserT r token [] a -> ParserT r token [] b -> ParserT r token [] b # (<*) :: ParserT r token [] a -> ParserT r token [] b -> ParserT r token [] a # | |
Functor (ParserT r token []) Source # | |
Monad (ParserT r token []) Source # | |
MonadFail (ParserT r token []) Source # | |
data ParseError a token Source #
Constructors
UnexpectedParse [token] | |
LexicalError LexerError | |
Ambiguous [(a, [token])] | |
NoParses token | |
EmptyStream |
Instances
(Show a, Show token) => Show (ParseError a token) Source # | |
Defined in Miso.Util.Parser Methods showsPrec :: Int -> ParseError a token -> ShowS # show :: ParseError a token -> String # showList :: [ParseError a token] -> ShowS # | |
(Eq a, Eq token) => Eq (ParseError a token) Source # | |
Defined in Miso.Util.Parser Methods (==) :: ParseError a token -> ParseError a token -> Bool # (/=) :: ParseError a token -> ParseError a token -> Bool # |
Combinators
modifyTokens :: (t -> t) -> ParserT r t [] () Source #