| |||||||||||||||||
| |||||||||||||||||
Description | |||||||||||||||||
This module manages symbols in local and global scopes. There are four different kind of identifiers: ordinary identifiers (henceforth simply called identifier), tag names (names of struct/union/enum types), labels and structure members. | |||||||||||||||||
Synopsis | |||||||||||||||||
Documentation | |||||||||||||||||
type IdentEntry = Either TypeDef IdentDecl | |||||||||||||||||
All ordinary identifiers map to IdenTyDecl: either a typedef or a object/function/enumerator | |||||||||||||||||
identOfTyDecl :: IdentEntry -> Ident | |||||||||||||||||
type TagEntry = Either TagFwdDecl TagDef | |||||||||||||||||
Tag names map to forward declarations or definitions of struct/union/enum types | |||||||||||||||||
data TagFwdDecl | |||||||||||||||||
| |||||||||||||||||
data DefTable | |||||||||||||||||
| |||||||||||||||||
emptyDefTable :: DefTable | |||||||||||||||||
empty definition table, with all name space maps in global scope | |||||||||||||||||
globalDefs :: DefTable -> GlobalDecls | |||||||||||||||||
get the globally defined entries of a definition table | |||||||||||||||||
enterFunctionScope :: DefTable -> DefTable | |||||||||||||||||
Enter function scope (and the corresponding block scope) | |||||||||||||||||
leaveFunctionScope :: DefTable -> DefTable | |||||||||||||||||
Leave function scope, and return the associated DefTable. Error if not in function scope. | |||||||||||||||||
enterBlockScope :: DefTable -> DefTable | |||||||||||||||||
Enter new block scope | |||||||||||||||||
leaveBlockScope :: DefTable -> DefTable | |||||||||||||||||
Leave innermost block scope | |||||||||||||||||
enterMemberDecl :: DefTable -> DefTable | |||||||||||||||||
Enter new member declaration scope | |||||||||||||||||
leaveMemberDecl :: DefTable -> ([MemberDecl], DefTable) | |||||||||||||||||
Leave innermost member declaration scope | |||||||||||||||||
data DeclarationStatus t | |||||||||||||||||
| |||||||||||||||||
declStatusDescr :: DeclarationStatus t -> String | |||||||||||||||||
defineTypeDef :: Ident -> TypeDef -> DefTable -> (DeclarationStatus IdentEntry, DefTable) | |||||||||||||||||
defineGlobalIdent :: Ident -> IdentDecl -> DefTable -> (DeclarationStatus IdentEntry, DefTable) | |||||||||||||||||
declare/define a global object/function/typeDef returns Redeclared def if there is already an object/function/typeDef in global scope, or DifferentKindRedec def if the old declaration is of a different kind. | |||||||||||||||||
defineScopedIdent :: Ident -> IdentDecl -> DefTable -> (DeclarationStatus IdentEntry, DefTable) | |||||||||||||||||
declare/define a object/function/typeDef with lexical scope returns Redeclared def or DifferentKindRedec def if there is already an object/function/typeDef in the same scope. | |||||||||||||||||
defineScopedIdentWhen :: (IdentDecl -> Bool) -> Ident -> IdentDecl -> DefTable -> (DeclarationStatus IdentEntry, DefTable) | |||||||||||||||||
declare/define a object/function/typeDef with lexical scope, if the given predicate holds on the old entry. returns Keep old_def if the old definition shouldn't be overwritten, and otherwise Redeclared def or DifferentKindRedec def if there is already an object/function/typeDef in the same scope. | |||||||||||||||||
declareTag :: SUERef -> TagFwdDecl -> DefTable -> (DeclarationStatus TagEntry, DefTable) | |||||||||||||||||
declare a tag (fwd decl in case the struct name isn't defined yet) | |||||||||||||||||
defineTag :: SUERef -> TagDef -> DefTable -> (DeclarationStatus TagEntry, DefTable) | |||||||||||||||||
define a tag | |||||||||||||||||
defineLabel :: Ident -> DefTable -> (DeclarationStatus Ident, DefTable) | |||||||||||||||||
define a label Return the old label if it is already defined in this function's scope | |||||||||||||||||
lookupIdent :: Ident -> DefTable -> Maybe IdentEntry | |||||||||||||||||
lookup identifier (object, function, typeDef, enumerator) | |||||||||||||||||
lookupTag :: SUERef -> DefTable -> Maybe TagEntry | |||||||||||||||||
lookup tag | |||||||||||||||||
lookupLabel :: Ident -> DefTable -> Maybe Ident | |||||||||||||||||
lookup label | |||||||||||||||||
lookupIdentInner :: Ident -> DefTable -> Maybe IdentEntry | |||||||||||||||||
lookup an object in the innermost scope | |||||||||||||||||
lookupTagInner :: SUERef -> DefTable -> Maybe TagEntry | |||||||||||||||||
lookup an identifier in the innermost scope | |||||||||||||||||
Produced by Haddock version 2.1.0 |