module Data.GI.GIR.Function
( Function(..)
, parseFunction
) where
import Data.Text (Text)
import Data.GI.GIR.Callable (Callable(..), parseCallable)
import Data.GI.GIR.Parser
data Function = Function {
Function -> ParseError
fnSymbol :: Text
, Function -> Maybe ParseError
fnMovedTo :: Maybe Text
, Function -> Callable
fnCallable :: Callable
} deriving Int -> Function -> ShowS
[Function] -> ShowS
Function -> String
(Int -> Function -> ShowS)
-> (Function -> String) -> ([Function] -> ShowS) -> Show Function
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Function -> ShowS
showsPrec :: Int -> Function -> ShowS
$cshow :: Function -> String
show :: Function -> String
$cshowList :: [Function] -> ShowS
showList :: [Function] -> ShowS
Show
parseFunction :: Parser (Name, Function)
parseFunction :: Parser (Name, Function)
parseFunction = do
Name
name <- Parser Name
parseName
Maybe ParseError
shadows <- Name -> Parser (Maybe ParseError)
queryAttr Name
"shadows"
let exposedName :: Name
exposedName = case Maybe ParseError
shadows of
Just ParseError
n -> Name
name {name :: ParseError
name = ParseError
n}
Maybe ParseError
Nothing -> Name
name
Callable
callable <- Parser Callable
parseCallable
ParseError
symbol <- GIRXMLNamespace -> Name -> Parser ParseError
getAttrWithNamespace GIRXMLNamespace
CGIRNS Name
"identifier"
Maybe ParseError
movedTo <- Name -> Parser (Maybe ParseError)
queryAttr Name
"moved-to"
(Name, Function) -> Parser (Name, Function)
forall a. a -> ReaderT ParseContext (Except ParseError) a
forall (m :: * -> *) a. Monad m => a -> m a
return ((Name, Function) -> Parser (Name, Function))
-> (Name, Function) -> Parser (Name, Function)
forall a b. (a -> b) -> a -> b
$ (Name
exposedName,
Function {
fnSymbol :: ParseError
fnSymbol = ParseError
symbol
, fnCallable :: Callable
fnCallable = Callable
callable
, fnMovedTo :: Maybe ParseError
fnMovedTo = Maybe ParseError
movedTo
})