module Lexer (lexer, parens, integer, reservedOp, reserved, identifier, symbol, whitespace) where

import Control.Monad (void)
import Text.Parsec.Language (haskellStyle)
import Text.Parsec.String (Parser)
import qualified Text.Parsec.Token as P

lexer :: P.TokenParser ()
lexer = P.makeTokenParser haskellStyle

parens :: Parser a -> Parser a
parens = P.parens lexer

integer :: Parser Integer
integer = P.integer lexer

reservedOp :: String -> Parser ()
reservedOp op = void $ P.reservedOp lexer op

reserved :: String -> Parser ()
reserved = P.reserved lexer

identifier :: Parser String
identifier = P.identifier lexer

symbol :: String -> Parser String
symbol = P.symbol lexer

whitespace :: Parser ()
whitespace = P.whiteSpace lexer