-- | Parsing of bitfields, a.k.a. flags. They are represented in the
-- same way as enums, so this is a thin wrapper over that code.
module Data.GI.GIR.Flags
    ( Flags(..)
    , parseFlags
    ) where

import Data.GI.GIR.Enum (Enumeration, parseEnum)
import Data.GI.GIR.Parser

data Flags = Flags Enumeration
    deriving Int -> Flags -> ShowS
[Flags] -> ShowS
Flags -> String
(Int -> Flags -> ShowS)
-> (Flags -> String) -> ([Flags] -> ShowS) -> Show Flags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Flags -> ShowS
showsPrec :: Int -> Flags -> ShowS
$cshow :: Flags -> String
show :: Flags -> String
$cshowList :: [Flags] -> ShowS
showList :: [Flags] -> ShowS
Show

parseFlags :: Parser (Name, Flags)
parseFlags :: Parser (Name, Flags)
parseFlags = do
  (Name
n, Enumeration
enum) <- Parser (Name, Enumeration)
parseEnum
  (Name, Flags) -> Parser (Name, Flags)
forall a. a -> ReaderT ParseContext (Except ParseError) a
forall (m :: * -> *) a. Monad m => a -> m a
return (Name
n, Enumeration -> Flags
Flags Enumeration
enum)