module Language.Egison.Parser.Pattern.Combinator
( token
, symbol
, parens
)
where
import Control.Monad.Combinators ( between )
import Data.Functor ( void )
import Language.Egison.Parser.Pattern.Prim
( Parse
, Source
, Token
, Tokens
, lexeme
, single
, chunk
)
import qualified Language.Egison.Parser.Pattern.Token
as Token
( parenLeft
, parenRight
)
token :: Source s => Token s -> Parse n v e s ()
token = void . lexeme . single
symbol :: Source s => Tokens s -> Parse n v e s ()
symbol = void . lexeme . chunk
parens :: Source s => Parse n v e s a -> Parse n v e s a
parens = between (token Token.parenLeft) (token Token.parenRight)