-- Copyright 2019 Evan Laforge
-- This program is distributed under the terms of the GNU General Public
-- License 3.0, see COPYING or http://www.gnu.org/licenses/gpl-3.0.txt

-- | This is a re-export module for parsing.
module Util.P (
    module Util.P
    , module Text.Megaparsec, module Text.Megaparsec.Char
) where
import           Prelude hiding (takeWhile)
import           Data.Text (Text)

import           Text.Megaparsec
import           Text.Megaparsec.Char


noneOfC :: Ord e => [Char] -> ParsecT e Text m Char
noneOfC :: forall e (m :: * -> *). Ord e => [Char] -> ParsecT e Text m Char
noneOfC [Char]
cs = (Token Text -> Bool) -> ParsecT e Text m (Token Text)
forall e s (m :: * -> *).
MonadParsec e s m =>
(Token s -> Bool) -> m (Token s)
satisfy (Char -> [Char] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`notElem` [Char]
cs)

oneOfC :: Ord e => [Char] -> ParsecT e Text m Char
oneOfC :: forall e (m :: * -> *). Ord e => [Char] -> ParsecT e Text m Char
oneOfC [Char]
cs = (Token Text -> Bool) -> ParsecT e Text m (Token Text)
forall e s (m :: * -> *).
MonadParsec e s m =>
(Token s -> Bool) -> m (Token s)
satisfy (Char -> [Char] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Char]
cs)

takeWhile :: MonadParsec e s m => (Token s -> Bool) -> m (Tokens s)
takeWhile :: forall e s (m :: * -> *).
MonadParsec e s m =>
(Token s -> Bool) -> m (Tokens s)
takeWhile = Maybe [Char] -> (Token s -> Bool) -> m (Tokens s)
forall e s (m :: * -> *).
MonadParsec e s m =>
Maybe [Char] -> (Token s -> Bool) -> m (Tokens s)
takeWhileP Maybe [Char]
forall a. Maybe a
Nothing

takeWhile1 :: MonadParsec e s m => (Token s -> Bool) -> m (Tokens s)
takeWhile1 :: forall e s (m :: * -> *).
MonadParsec e s m =>
(Token s -> Bool) -> m (Tokens s)
takeWhile1 = Maybe [Char] -> (Token s -> Bool) -> m (Tokens s)
forall e s (m :: * -> *).
MonadParsec e s m =>
Maybe [Char] -> (Token s -> Bool) -> m (Tokens s)
takeWhile1P Maybe [Char]
forall a. Maybe a
Nothing