Safe Haskell | None |
---|---|
Language | Haskell2010 |
- parse :: FilePath -> IO (Maybe CTranslUnit)
- debugParse :: Bool -> FilePath -> IO (Maybe CTranslUnit)
- parseFunctions :: FilePath -> IO [CFunctionTemplate]
- printParsedFunctions :: FilePath -> IO ()
- fstCTranslUnit :: CTranslationUnit t -> [CExternalDeclaration t]
- isCFDefExt :: CExternalDeclaration t -> Bool
- fromCFDefExt :: CExternalDeclaration t -> Maybe (CFunctionDef t)
- justFunctions :: [CExternalDeclaration t] -> [CFunctionDef t]
- eitherCFDefExt :: CExternalDeclaration t -> Either (CFunctionDef t) (CExternalDeclaration t)
- fTypeSpec :: CFunctionDef t -> [CDeclarationSpecifier t]
- fDecl :: CFunctionDef t -> CDeclarator t
- fOptDecl :: CFunctionDef t -> [CDeclaration t]
- fStatement :: CFunctionDef t -> CStatement t
- fRest :: CFunctionDef t -> t
- decIdent :: CDeclarator t -> Maybe Ident
- decDerivedDecls :: CDeclarator t -> [CDerivedDeclarator t]
- decStrLit :: CDeclarator t -> Maybe (CStringLiteral t)
- decAttributes :: CDeclarator t -> [CAttribute t]
- decRest :: CDeclarator t -> t
- derivedDeclaratorFunDecl :: CDerivedDeclarator t -> Maybe (Either [Ident] ([CDeclaration t], Bool))
- derivedDeclaratorFunAttrs :: CDerivedDeclarator t -> Maybe [CAttribute t]
- derivedDeclaratorFunRest :: CDerivedDeclarator a -> Maybe a
- unpackIdent :: Ident -> String
- splitTypedVar :: Text -> Maybe (Text, Text)
- splitToNamedVar :: (Text, Text) -> NamedVar
- makeNamedVar :: Text -> Maybe NamedVar
- getFunctionName :: CExternalDeclaration t -> Maybe Ident
- getFunctionNameText :: CExternalDeclaration t -> Maybe Text
- getFunctionReturnType :: Pretty (CDeclarationSpecifier t) => CExternalDeclaration t -> Maybe [String]
- getFunctionReturnTypeText :: Pretty (CDeclarationSpecifier t) => CExternalDeclaration t -> Maybe Text
- getFunctionInputTypes :: CExternalDeclaration t -> Maybe [CDeclaration t]
- getFunctionInputTypesText :: Pretty (CDeclaration t) => CExternalDeclaration t -> Maybe [NamedVar]
- getFunctionBody :: CExternalDeclaration t -> Maybe (CStatement t)
- getFunctionBodyText :: Pretty (CStatement t) => CExternalDeclaration t -> Maybe Text
- mkCFunTempl :: (Pretty (CStatement t), Pretty (CDeclarationSpecifier t), Pretty (CDeclaration t)) => CExternalDeclaration t -> Maybe CFunctionTemplate
- mkCFunTempls :: (Monad m, Pretty (CStatement t), Pretty (CDeclarationSpecifier t), Pretty (CDeclaration t)) => m (Maybe [CExternalDeclaration t]) -> m [CFunctionTemplate]
Documentation
debugParse :: Bool -> FilePath -> IO (Maybe CTranslUnit) Source
parse
, but with debug information
parseFunctions :: FilePath -> IO [CFunctionTemplate] Source
make function templates from a '.c' file
printParsedFunctions :: FilePath -> IO () Source
(For debugging) Print the CFunctionTemplate
s parsed from a file
fstCTranslUnit :: CTranslationUnit t -> [CExternalDeclaration t] Source
isCFDefExt :: CExternalDeclaration t -> Bool Source
fromCFDefExt :: CExternalDeclaration t -> Maybe (CFunctionDef t) Source
justFunctions :: [CExternalDeclaration t] -> [CFunctionDef t] Source
eitherCFDefExt :: CExternalDeclaration t -> Either (CFunctionDef t) (CExternalDeclaration t) Source
fTypeSpec :: CFunctionDef t -> [CDeclarationSpecifier t] Source
`CFunDef [CDeclarationSpecifier a] (CDeclarator a) [CDeclaration a] (CStatement a) a` > CFunDef > [CDeclarationSpecifier a] -- type specifier and qualifier > (CDeclarator a) -- declarator > [CDeclaration a] -- optional declaration list > (CStatement a) -- compound statement a
fDecl :: CFunctionDef t -> CDeclarator t Source
fOptDecl :: CFunctionDef t -> [CDeclaration t] Source
fStatement :: CFunctionDef t -> CStatement t Source
fRest :: CFunctionDef t -> t Source
decIdent :: CDeclarator t -> Maybe Ident Source
decIdent
and following are simple unpackers for a datatype from
Language.C that I wish used record syntax.
`CDeclr (Maybe Ident) [CDerivedDeclarator a] (Maybe (CStringLiteral a)) [CAttribute a] a`
decDerivedDecls :: CDeclarator t -> [CDerivedDeclarator t] Source
decStrLit :: CDeclarator t -> Maybe (CStringLiteral t) Source
decAttributes :: CDeclarator t -> [CAttribute t] Source
decRest :: CDeclarator t -> t Source
derivedDeclaratorFunDecl :: CDerivedDeclarator t -> Maybe (Either [Ident] ([CDeclaration t], Bool)) Source
derivedDeclaratorFunAttrs :: CDerivedDeclarator t -> Maybe [CAttribute t] Source
unpackIdent :: Ident -> String Source
splitTypedVar :: Text -> Maybe (Text, Text) Source
This converts a typed C variable to (type, name), e.g. `"unsigned int x" -> Just ("unsigned int", "x")`. (Returns nothing on empty string.)
splitToNamedVar :: (Text, Text) -> NamedVar Source
makeNamedVar :: Text -> Maybe NamedVar Source
getFunctionReturnType :: Pretty (CDeclarationSpecifier t) => CExternalDeclaration t -> Maybe [String] Source
getFunctionReturnTypeText :: Pretty (CDeclarationSpecifier t) => CExternalDeclaration t -> Maybe Text Source
getFunctionInputTypes :: CExternalDeclaration t -> Maybe [CDeclaration t] Source
getFunctionInputTypesText :: Pretty (CDeclaration t) => CExternalDeclaration t -> Maybe [NamedVar] Source
getFunctionBody :: CExternalDeclaration t -> Maybe (CStatement t) Source
getFunctionBodyText :: Pretty (CStatement t) => CExternalDeclaration t -> Maybe Text Source
mkCFunTempl :: (Pretty (CStatement t), Pretty (CDeclarationSpecifier t), Pretty (CDeclaration t)) => CExternalDeclaration t -> Maybe CFunctionTemplate Source
mkCFunTempls :: (Monad m, Pretty (CStatement t), Pretty (CDeclarationSpecifier t), Pretty (CDeclaration t)) => m (Maybe [CExternalDeclaration t]) -> m [CFunctionTemplate] Source