module Shrun.Configuration.Args.Parsing.Graph.Sequential ( parseSequential, ) where import Shrun.Configuration.Args.Parsing.Graph.Utils (MParser) import Shrun.Configuration.Args.Parsing.Graph.Utils qualified as Utils import Shrun.Configuration.Data.Graph ( EdgeSequential (EdgeSequentialAnd, EdgeSequentialAny, EdgeSequentialOr), ) import Shrun.Prelude import Text.Megaparsec qualified as MP parseSequential :: MParser EdgeSequential parseSequential :: MParser EdgeSequential parseSequential = String -> MParser EdgeSequential -> MParser EdgeSequential forall a. String -> ParsecT FatalError Text Identity a -> ParsecT FatalError Text Identity a forall e s (m :: Type -> Type) a. MonadParsec e s m => String -> m a -> m a MP.label String label (MParser EdgeSequential -> MParser EdgeSequential) -> MParser EdgeSequential -> MParser EdgeSequential forall a b. (a -> b) -> a -> b $ do [MParser EdgeSequential] -> MParser EdgeSequential forall (t :: Type -> Type) (f :: Type -> Type) a. (Foldable t, Alternative f) => t (f a) -> f a asum [ EdgeSequential EdgeSequentialAnd EdgeSequential -> ParsecT FatalError Text Identity Text -> MParser EdgeSequential forall a b. a -> ParsecT FatalError Text Identity b -> ParsecT FatalError Text Identity a forall (f :: Type -> Type) a b. Functor f => a -> f b -> f a <$ Text -> ParsecT FatalError Text Identity Text Utils.string Text "&&", EdgeSequential EdgeSequentialOr EdgeSequential -> ParsecT FatalError Text Identity Text -> MParser EdgeSequential forall a b. a -> ParsecT FatalError Text Identity b -> ParsecT FatalError Text Identity a forall (f :: Type -> Type) a b. Functor f => a -> f b -> f a <$ Text -> ParsecT FatalError Text Identity Text Utils.string Text "||", EdgeSequential EdgeSequentialAny EdgeSequential -> ParsecT FatalError Text Identity Text -> MParser EdgeSequential forall a b. a -> ParsecT FatalError Text Identity b -> ParsecT FatalError Text Identity a forall (f :: Type -> Type) a b. Functor f => a -> f b -> f a <$ Text -> ParsecT FatalError Text Identity Text Utils.string Text ";;" ] where label :: String label = String "sequential literals (\"&&\", \"||\", \";;\")"