miso
Copyright(C) 2016-2025 David M. Johnson (@dmjio)
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.Util.Parser

Description

 
Synopsis

Types

type Parser token a = ParserT () [token] [] a Source #

newtype ParserT r token (m :: Type -> Type) a Source #

Constructors

Parser 

Fields

Instances

Instances details
Alternative (ParserT r token []) Source # 
Instance details

Defined in Miso.Util.Parser

Methods

empty :: ParserT r token [] a #

(<|>) :: ParserT r token [] a -> ParserT r token [] a -> ParserT r token [] a #

some :: ParserT r token [] a -> ParserT r token [] [a] #

many :: ParserT r token [] a -> ParserT r token [] [a] #

Applicative (ParserT r token []) Source # 
Instance details

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 # 
Instance details

Defined in Miso.Util.Parser

Methods

fmap :: (a -> b) -> ParserT r token [] a -> ParserT r token [] b #

(<$) :: a -> ParserT r token [] b -> ParserT r token [] a #

Monad (ParserT r token []) Source # 
Instance details

Defined in Miso.Util.Parser

Methods

(>>=) :: ParserT r token [] a -> (a -> ParserT r token [] b) -> ParserT r token [] b #

(>>) :: ParserT r token [] a -> ParserT r token [] b -> ParserT r token [] b #

return :: a -> ParserT r token [] a #

MonadFail (ParserT r token []) Source # 
Instance details

Defined in Miso.Util.Parser

Methods

fail :: String -> ParserT r token [] a #

data ParseError a token Source #

Constructors

UnexpectedParse [token] 
LexicalError LexerError 
Ambiguous [(a, [token])] 
NoParses token 
EmptyStream 

Instances

Instances details
(Show a, Show token) => Show (ParseError a token) Source # 
Instance details

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 # 
Instance details

Defined in Miso.Util.Parser

Methods

(==) :: ParseError a token -> ParseError a token -> Bool #

(/=) :: ParseError a token -> ParseError a token -> Bool #

Combinators

parse :: Parser token a -> [token] -> Either (ParseError a token) a Source #

satisfy :: (a -> Bool) -> ParserT r [a] [] a Source #

token_ :: Eq token => token -> Parser token token Source #

errorOut :: errorToken -> ParserT r errorToken [] () Source #

modifyTokens :: (t -> t) -> ParserT r t [] () Source #

askParser :: ParserT r token [] r Source #