Portability | ghc |
---|---|
Stability | experimental |
Maintainer | jwlato@gmail.com |
Safe Haskell | None |
Abstract syntax of C source and header files.
The tree structure is based on the grammar in Appendix A of K&R. The abstract syntax simplifies the concrete syntax by merging similar concrete constructs into a single type of abstract tree structure: declarations are merged with structure declarations, parameter declarations and type names, and declarators are merged with abstract declarators.
With K&R we refer to ``The C Programming Language'', second edition, Brain W. Kernighan and Dennis M. Ritchie, Prentice Hall, 1988. The AST supports all of C99 http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf and several GNU extensions http://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html.
- type CTranslUnit = CTranslationUnit NodeInfo
- type CExtDecl = CExternalDeclaration NodeInfo
- data CTranslationUnit a = CTranslUnit [CExternalDeclaration a] a
- data CExternalDeclaration a
- = CDeclExt (CDeclaration a)
- | CFDefExt (CFunctionDef a)
- | ObjCIfaceExt (ObjCInterface a)
- | ObjCImplExt (ObjCImplementation a)
- | ObjCClassExt (ObjCClassListDef a)
- | ObjCProtoExt (ObjCProtocolDec a)
- | ObjCCatExt (ObjCCategoryDec a)
- | ObjCCatImplExt (ObjCCategoryImplementation a)
- | CAsmExt (CStringLiteral a) a
- type CFunDef = CFunctionDef NodeInfo
- type CDecl = CDeclaration NodeInfo
- type CStructUnion = CStructureUnion NodeInfo
- type CEnum = CEnumeration NodeInfo
- data CFunctionDef a = CFunDef [CDeclarationSpecifier a] (CDeclarator a) [CDeclaration a] (CStatement a) a
- data CDeclaration a = CDecl [CDeclarationSpecifier a] [(Maybe (CDeclarator a), Maybe (CInitializer a), Maybe (CExpression a))] a
- data CStructTag
- = CStructTag
- | CUnionTag
- data CStructureUnion a = CStruct !CStructTag (Maybe Ident) (Maybe [CDeclaration a]) [CAttribute a] a
- data CEnumeration a = CEnum (Maybe Ident) (Maybe [(Ident, Maybe (CExpression a))]) [CAttribute a] a
- type ObjCIface = ObjCInterface NodeInfo
- type ObjCClassDef = ObjCClassListDef NodeInfo
- type ObjCProtoNm = ObjCProtocolName NodeInfo
- type ObjCInstanceVarBlock = ObjCInstanceVariableBlock NodeInfo
- type ObjCVisSpec = ObjCVisibilitySpec NodeInfo
- type ObjCPropDecl = ObjCPropertyDeclaration NodeInfo
- type ObjCSel = ObjCSelector NodeInfo
- type ObjCMethodSel = ObjCMethodSelector NodeInfo
- type ObjCMethodDecl = ObjCMethodDeclaration NodeInfo
- type ObjCProtoDec = ObjCProtocolDec NodeInfo
- type ObjCProtoDeclBlock = ObjCProtocolDeclBlock NodeInfo
- type ObjCCatDec = ObjCCategoryDec NodeInfo
- type ObjCImpl = ObjCImplementation NodeInfo
- type ObjCCatImpl = ObjCCategoryImplementation NodeInfo
- type ObjCMethodDef = ObjCMethodDefinition NodeInfo
- type ObjCImplDef = ObjCImplementationDefinition NodeInfo
- data ObjCInterface a = ObjCIface (ObjCClassDeclarator a) (Maybe (ObjCClassName a)) [ObjCProtocolName a] [ObjCInstanceVariableBlock a] [ObjCInterfaceDeclaration a] [CAttribute a] a
- data ObjCClassListDef a = ObjCClassDef [ObjCClassDeclarator a] a
- data ObjCProtocolName a = ObjCProtoNm !Ident a
- data ObjCInstanceVariableBlock a = ObjCInstanceVarBlock (Maybe (ObjCVisibilitySpec a)) [CDeclaration a] a
- data ObjCVisibilitySpec a = ObjCVisSpec !ObjCVisType a
- data ObjCVisType
- data ObjCPropertyDeclaration a = ObjCPropDecl [ObjCPropertyModifier a] (CDeclaration a) a
- data ObjCSelector a
- = ObjCSel Ident a
- | ObjCInSel a
- | ObjCOutSel a
- data ObjCMethodSelector a
- = ObjCUnaryMethod (ObjCSelector a) a
- | ObjCMethod [ObjCKeywordDeclarator a] (Maybe ([CDeclaration a], Bool)) a
- | ObjCEllipseMethod [ObjCKeywordDeclarator a] a
- data ObjCMethodType
- data ObjCMethodDeclaration a = ObjCMethodDecl !ObjCMethodType (Maybe (CDeclaration a)) (ObjCMethodSelector a) [CAttribute a] a
- data ObjCProtocolDec a
- = ObjCForwardProtoDec [Ident] [CAttribute a] a
- | ObjCProtoDec !Ident [ObjCProtocolName a] [ObjCProtocolDeclBlock a] [CAttribute a] a
- data ObjCProtocolDeclBlock a
- data ObjCCategoryDec a = ObjCCatDec !Ident !Ident [ObjCProtocolName a] [ObjCInterfaceDeclaration a] [CAttribute a] a
- data ObjCImplementation a = ObjCImpl (ObjCClassName a) (Maybe (ObjCClassName a)) [ObjCInstanceVariableBlock a] [ObjCImplementationDefinition a] a
- data ObjCCategoryImplementation a = ObjCCatImpl !Ident !Ident [ObjCImplementationDefinition a] a
- data ObjCMethodDefinition a = ObjCMethodDef !ObjCMethodType (Maybe (CDeclaration a)) (ObjCMethodSelector a) [CDeclaration a] (CStatement a) a
- data ObjCImplementationDefinition a
- = ObjCImplDec (CDeclaration a)
- | ObjCImplMethod (ObjCMethodDefinition a)
- | ObjCImplFun (CFunctionDef a)
- type CDeclSpec = CDeclarationSpecifier NodeInfo
- partitionDeclSpecs :: [CDeclarationSpecifier a] -> ([CStorageSpecifier a], [CAttribute a], [CTypeQualifier a], [CTypeSpecifier a], Bool)
- type CStorageSpec = CStorageSpecifier NodeInfo
- type CTypeSpec = CTypeSpecifier NodeInfo
- isSUEDef :: CTypeSpecifier a -> Bool
- type CTypeQual = CTypeQualifier NodeInfo
- type CAttr = CAttribute NodeInfo
- data CDeclarationSpecifier a
- = CStorageSpec (CStorageSpecifier a)
- | CTypeSpec (CTypeSpecifier a)
- | CTypeQual (CTypeQualifier a)
- data CStorageSpecifier a
- data CTypeSpecifier a
- = CVoidType a
- | CCharType a
- | CShortType a
- | CIntType a
- | CLongType a
- | CFloatType a
- | CDoubleType a
- | CSignedType a
- | CUnsigType a
- | CBoolType a
- | CComplexType a
- | CSUType (CStructureUnion a) a
- | CEnumType (CEnumeration a) a
- | CTypeDef !Ident a
- | CTypeOfExpr (CExpression a) a
- | CTypeOfType (CDeclaration a) a
- | ObjCClassProto !Ident [ObjCProtocolName a] a
- | ObjCTypeProto !Ident [ObjCProtocolName a] a
- data CTypeQualifier a
- = CConstQual a
- | CVolatQual a
- | CRestrQual a
- | CInlineQual a
- | CAttrQual (CAttribute a)
- | ObjCProtoQual (ObjCProtoQualifier a)
- data CAttribute a = CAttr !Ident [CExpression a] a
- type ObjCPropMod = ObjCPropertyModifier NodeInfo
- type ObjCProtoQual = ObjCProtoQualifier NodeInfo
- data ObjCPropertyModifier a = ObjCPropMod !Ident (Maybe Ident) a
- data ObjCProtoQualifier a
- = ObjCInQual a
- | ObjCOutQual a
- | ObjCInOutQual a
- | ObjCBycopyQual a
- | ObjCOnewayQual a
- type CDeclr = CDeclarator NodeInfo
- type CDerivedDeclr = CDerivedDeclarator NodeInfo
- type CArrSize = CArraySize NodeInfo
- data CDeclarator a = CDeclr (Maybe Ident) [CDerivedDeclarator a] (Maybe (CStringLiteral a)) [CAttribute a] a
- data CDerivedDeclarator a
- = CPtrDeclr [CTypeQualifier a] a
- | CBlkDeclr [CTypeQualifier a] a
- | CArrDeclr [CTypeQualifier a] (CArraySize a) a
- | CFunDeclr (Either [Ident] ([CDeclaration a], Bool)) [CAttribute a] a
- data CArraySize a
- = CNoArrSize !Bool
- | CArrSize !Bool (CExpression a)
- type ObjCClassNm = ObjCClassName NodeInfo
- type ObjCClassDeclr = ObjCClassDeclarator NodeInfo
- type ObjCIfaceDecl = ObjCInterfaceDeclaration NodeInfo
- type ObjCKeyDeclr = ObjCKeywordDeclarator NodeInfo
- data ObjCClassName a = ObjCClassNm !Ident a
- data ObjCClassDeclarator a = ObjCClassDeclr !Ident a
- data ObjCInterfaceDeclaration a
- = ObjCIfaceDecl (CDeclaration a) a
- | ObjCIfaceMethodDecl (ObjCMethodDeclaration a) a
- | ObjCIfacePropDecl (ObjCPropertyDeclaration a) a
- data ObjCKeywordDeclarator a = ObjCKeyDeclr (Maybe (ObjCSelector a)) (Maybe (CDeclaration a)) !Ident a
- type CInit = CInitializer NodeInfo
- type CInitList = CInitializerList NodeInfo
- type CDesignator = CPartDesignator NodeInfo
- data CInitializer a
- = CInitExpr (CExpression a) a
- | CInitList (CInitializerList a) a
- type CInitializerList a = [([CPartDesignator a], CInitializer a)]
- data CPartDesignator a
- = CArrDesig (CExpression a) a
- | CMemberDesig !Ident a
- | CRangeDesig (CExpression a) (CExpression a) a
- type CStat = CStatement NodeInfo
- type CBlockItem = CCompoundBlockItem NodeInfo
- type CAsmStmt = CAssemblyStatement NodeInfo
- type CAsmOperand = CAssemblyOperand NodeInfo
- data CStatement a
- = CLabel !Ident (CStatement a) [CAttribute a] a
- | CCase (CExpression a) (CStatement a) a
- | CCases (CExpression a) (CExpression a) (CStatement a) a
- | CDefault (CStatement a) a
- | CExpr (Maybe (CExpression a)) a
- | CCompound [Ident] [CCompoundBlockItem a] a
- | CIf (CExpression a) (CStatement a) (Maybe (CStatement a)) a
- | CSwitch (CExpression a) (CStatement a) a
- | CWhile (CExpression a) (CStatement a) Bool a
- | CFor (Either (Maybe (CExpression a)) (CDeclaration a)) (Maybe (CExpression a)) (Maybe (CExpression a)) (CStatement a) a
- | CGoto !Ident a
- | CGotoPtr (CExpression a) a
- | CCont a
- | CBreak a
- | CReturn (Maybe (CExpression a)) a
- | CAsm (CAssemblyStatement a) a
- data CCompoundBlockItem a
- = CBlockStmt (CStatement a)
- | CBlockDecl (CDeclaration a)
- | CNestedFunDef (CFunctionDef a)
- data CAssemblyStatement a = CAsmStmt (Maybe (CTypeQualifier a)) (CStringLiteral a) [CAssemblyOperand a] [CAssemblyOperand a] [CStringLiteral a] a
- data CAssemblyOperand a = CAsmOperand (Maybe Ident) (CStringLiteral a) (CExpression a) a
- type CExpr = CExpression NodeInfo
- data CExpression a
- = CComma [CExpression a] a
- | CAssign !CAssignOp (CExpression a) (CExpression a) a
- | CCond (CExpression a) (Maybe (CExpression a)) (CExpression a) a
- | CBinary CBinaryOp (CExpression a) (CExpression a) a
- | CCast (CDeclaration a) (CExpression a) a
- | CUnary CUnaryOp (CExpression a) a
- | CSizeofExpr (CExpression a) a
- | CSizeofType (CDeclaration a) a
- | CAlignofExpr (CExpression a) a
- | CAlignofType (CDeclaration a) a
- | CComplexReal (CExpression a) a
- | CComplexImag (CExpression a) a
- | CIndex (CExpression a) (CExpression a) a
- | CCall (CExpression a) [CExpression a] a
- | CMember (CExpression a) !Ident !Bool a
- | CVar !Ident a
- | CConst (CConstant a)
- | CCompoundLit (CDeclaration a) (CInitializerList a) a
- | CStatExpr (CStatement a) a
- | CLabAddrExpr !Ident a
- | CBuiltinExpr (CBuiltinThing a)
- | CBlockExpr ([CDeclaration a], Bool) (CStatement a) a
- | ObjCMessageExpr (ObjCMessageExpression a) a
- | ObjCSelectorExpr (ObjCSelectorName a) a
- | ObjCProtoExpr Ident a
- | ObjCEncodeExpr (CDeclaration a) a
- | ObjCConst (ObjCConstant a)
- data CAssignOp
- data CBinaryOp
- data CUnaryOp
- = CPreIncOp
- | CPreDecOp
- | CPostIncOp
- | CPostDecOp
- | CAdrOp
- | CIndOp
- | CPlusOp
- | CMinOp
- | CCompOp
- | CNegOp
- type CBuiltin = CBuiltinThing NodeInfo
- data CBuiltinThing a
- = CBuiltinVaArg (CExpression a) (CDeclaration a) a
- | CBuiltinOffsetOf (CDeclaration a) [CPartDesignator a] a
- | CBuiltinTypesCompatible (CDeclaration a) (CDeclaration a) a
- type ObjCMsgExpr = ObjCMessageExpression NodeInfo
- type ObjCMsgSel = ObjCMessageSelector NodeInfo
- type ObjCKeyArg = ObjCKeywordArg NodeInfo
- type ObjCSelName = ObjCSelectorName NodeInfo
- type ObjCSelKeyName = ObjCSelectorKeyName NodeInfo
- data ObjCMessageExpression a
- = ObjCMsgExpr (CExpression a) (ObjCMessageSelector a) a
- | ObjCMsgClass (ObjCClassName a) (ObjCMessageSelector a) a
- | ObjCMsgSup (ObjCMessageSelector a) a
- data ObjCMessageSelector a
- = ObjCMsgSel (ObjCSelector a) a
- | ObjCKeyArgs [ObjCKeywordArg a] a
- data ObjCKeywordArg a = ObjCKeyArg (ObjCSelectorKeyName a) (CExpression a) a
- data ObjCSelectorName a
- = ObjCSelPlain (ObjCSelector a) a
- | ObjCSelKeys [ObjCSelectorKeyName a] a
- data ObjCSelectorKeyName a = ObjCSelKeyName (Maybe (ObjCSelector a)) a
- type CConst = CConstant NodeInfo
- type CStrLit = CStringLiteral NodeInfo
- cstringOfLit :: CStringLiteral a -> CString
- liftStrLit :: CStringLiteral a -> CConstant a
- data CConstant a
- = CIntConst CInteger a
- | CCharConst CChar a
- | CFloatConst CFloat a
- | CStrConst CString a
- data CStringLiteral a = CStrLit CString a
- type ObjCConst = ObjCConstant NodeInfo
- data ObjCConstant a = ObjCStrConst CString a
C translation units
type CTranslUnit = CTranslationUnit NodeInfoSource
Complete C tranlsation unit (C99 6.9, K&R A10)
A complete C translation unit, for example representing a C header or source file. It consists of a list of external (i.e. toplevel) declarations.
type CExtDecl = CExternalDeclaration NodeInfoSource
External C declaration (C99 6.9, K&R A10)
Either a toplevel declaration, function definition, class, category, protocol, or external assembler.
data CTranslationUnit a Source
Functor CTranslationUnit | |
Typeable1 CTranslationUnit | |
Annotated CTranslationUnit | |
Pretty CTranslUnit | |
Data a => Data (CTranslationUnit a) | |
Show a => Show (CTranslationUnit a) | |
CNode t1 => Pos (CTranslationUnit t1) | |
CNode t1 => CNode (CTranslationUnit t1) |
data CExternalDeclaration a Source
Functor CExternalDeclaration | |
Typeable1 CExternalDeclaration | |
Annotated CExternalDeclaration | |
Pretty CExtDecl | |
Data a => Data (CExternalDeclaration a) | |
Show a => Show (CExternalDeclaration a) | |
CNode t1 => Pos (CExternalDeclaration t1) | |
CNode t1 => CNode (CExternalDeclaration t1) |
Declarations
type CFunDef = CFunctionDef NodeInfoSource
C function definition (C99 6.9.1, K&R A10.1)
A function definition is of the form CFunDef specifiers declarator decllist? stmt
.
-
specifiers
are the type and storage-class specifiers of the function. The only storage-class specifiers allowed are extern and static. - The
declarator
must be such that the declared identifier has function type. The return type shall be void or an object type other than array type. - The optional declaration list
decllist
is for old-style function declarations. - The statement
stmt
is a compound statement.
type CDecl = CDeclaration NodeInfoSource
C declarations (K&R A8, C99 6.7), including structure declarations, parameter declarations and type names.
A declaration is of the form CDecl specifiers init-declarator-list
, where the form of the declarator list's
elements depends on the kind of declaration:
1) Toplevel declarations (K&R A8, C99 6.7 declaration)
- C99 requires that there is at least one specifier, though this is merely a syntactic restriction
- at most one storage class specifier is allowed per declaration
- the elements of the non-empty
init-declarator-list
are of the form(Just declr, init?, Nothing)
. The declaratordeclr
has to be present and non-abstract and the initialization expression is optional.
2) Structure declarations (K&R A8.3, C99 6.7.2.1 struct-declaration)
Those are the declarations of a structure's members.
- do not allow storage specifiers
- in strict C99, the list of declarators has to be non-empty
- the elements of
init-declarator-list
are either of the form(Just declr, Nothing, size?)
, representing a member with optional bit-field size, or of the form(Nothing, Nothing, Just size)
, for unnamed bitfields.declr
has to be non-abstract. - no member of a structure shall have incomplete type
3) Parameter declarations (K&R A8.6.3, C99 6.7.5 parameter-declaration)
-
init-declarator-list
must contain at most one triple of the form(Just declr, Nothing, Nothing)
, i.e. consist of a single declarator, which is allowed to be abstract (i.e. unnamed).
4) Type names (A8.8, C99 6.7.6)
- do not allow storage specifiers
-
init-declarator-list
must contain at most one triple of the form(Just declr, Nothing, Nothing)
. wheredeclr
is an abstract declarator (i.e. doesn't contain a declared identifier)
type CStructUnion = CStructureUnion NodeInfoSource
C structure or union specifiers (K&R A8.3, C99 6.7.2.1)
CStruct tag identifier struct-decls c-attrs
represents a struct or union specifier (depending on tag
).
- either
identifier
or the declaration liststruct-decls
(or both) have to be present.
Example: in struct foo x;
, the identifier is present, in struct { int y; } x
the declaration list, and
in struct foo { int y; } x;
both of them.
-
c-attrs
is a list of__attribute__
annotations associated with the struct or union specifier
type CEnum = CEnumeration NodeInfoSource
C enumeration specifier (K&R A8.4, C99 6.7.2.2)
CEnum identifier enumerator-list attrs
represent as enum specifier
- Either the identifier or the enumerator-list (or both) have to be present.
- If
enumerator-list
is present, it has to be non-empty. - The enumerator list is of the form
(enumeration-constant, enumeration-value?)
, where the latter is an optional constant integral expression. -
attrs
is a list of__attribute__
annotations associated with the enumeration specifier
data CFunctionDef a Source
CFunDef [CDeclarationSpecifier a] (CDeclarator a) [CDeclaration a] (CStatement a) a |
Functor CFunctionDef | |
Typeable1 CFunctionDef | |
Annotated CFunctionDef | |
Pretty CFunDef | |
Data a => Data (CFunctionDef a) | |
Show a => Show (CFunctionDef a) | |
CNode t1 => Pos (CFunctionDef t1) | |
CNode t1 => CNode (CFunctionDef t1) |
data CDeclaration a Source
CDecl [CDeclarationSpecifier a] [(Maybe (CDeclarator a), Maybe (CInitializer a), Maybe (CExpression a))] a |
Functor CDeclaration | |
Typeable1 CDeclaration | |
Annotated CDeclaration | |
Pretty CDecl | |
Data a => Data (CDeclaration a) | |
Show a => Show (CDeclaration a) | |
CNode t1 => Pos (CDeclaration t1) | |
CNode t1 => CNode (CDeclaration t1) |
data CStructTag Source
A tag to determine wheter we refer to a struct
or union
, see CStructUnion
.
data CStructureUnion a Source
CStruct !CStructTag (Maybe Ident) (Maybe [CDeclaration a]) [CAttribute a] a |
Functor CStructureUnion | |
Typeable1 CStructureUnion | |
Annotated CStructureUnion | |
Pretty CStructUnion | |
Data a => Data (CStructureUnion a) | |
Show a => Show (CStructureUnion a) | |
CNode t1 => Pos (CStructureUnion t1) | |
CNode t1 => CNode (CStructureUnion t1) |
data CEnumeration a Source
CEnum (Maybe Ident) (Maybe [(Ident, Maybe (CExpression a))]) [CAttribute a] a |
Functor CEnumeration | |
Typeable1 CEnumeration | |
Annotated CEnumeration | |
Pretty CEnum | |
Data a => Data (CEnumeration a) | |
Show a => Show (CEnumeration a) | |
CNode t1 => Pos (CEnumeration t1) | |
CNode t1 => CNode (CEnumeration t1) |
Objective-C extensions
type ObjCIface = ObjCInterface NodeInfoSource
type ObjCSel = ObjCSelector NodeInfoSource
data ObjCInterface a Source
Interface declaration, '@interface'
ObjCIface (ObjCClassDeclarator a) (Maybe (ObjCClassName a)) [ObjCProtocolName a] [ObjCInstanceVariableBlock a] [ObjCInterfaceDeclaration a] [CAttribute a] a |
Functor ObjCInterface | |
Typeable1 ObjCInterface | |
Annotated ObjCInterface | |
Pretty ObjCIface | |
Data a => Data (ObjCInterface a) | |
Show a => Show (ObjCInterface a) | |
CNode t1 => Pos (ObjCInterface t1) | |
CNode t1 => CNode (ObjCInterface t1) |
data ObjCClassListDef a Source
Functor ObjCClassListDef | |
Typeable1 ObjCClassListDef | |
Annotated ObjCClassListDef | |
Pretty ObjCClassDef | |
Data a => Data (ObjCClassListDef a) | |
Show a => Show (ObjCClassListDef a) | |
CNode t1 => Pos (ObjCClassListDef t1) | |
CNode t1 => CNode (ObjCClassListDef t1) |
data ObjCProtocolName a Source
ObjCProtoNm !Ident a |
Functor ObjCProtocolName | |
Typeable1 ObjCProtocolName | |
Annotated ObjCProtocolName | |
Pretty ObjCProtoNm | |
Data a => Data (ObjCProtocolName a) | |
Show a => Show (ObjCProtocolName a) | |
CNode t1 => Pos (ObjCProtocolName t1) | |
CNode t1 => CNode (ObjCProtocolName t1) |
data ObjCInstanceVariableBlock a Source
ObjCInstanceVarBlock (Maybe (ObjCVisibilitySpec a)) [CDeclaration a] a |
Functor ObjCInstanceVariableBlock | |
Typeable1 ObjCInstanceVariableBlock | |
Annotated ObjCInstanceVariableBlock | |
Pretty ObjCInstanceVarBlock | |
Data a => Data (ObjCInstanceVariableBlock a) | |
Show a => Show (ObjCInstanceVariableBlock a) | |
CNode t1 => Pos (ObjCInstanceVariableBlock t1) | |
CNode t1 => CNode (ObjCInstanceVariableBlock t1) |
data ObjCVisibilitySpec a Source
Functor ObjCVisibilitySpec | |
Typeable1 ObjCVisibilitySpec | |
Annotated ObjCVisibilitySpec | |
Pretty ObjCVisSpec | |
Data a => Data (ObjCVisibilitySpec a) | |
Show a => Show (ObjCVisibilitySpec a) | |
CNode t1 => Pos (ObjCVisibilitySpec t1) | |
CNode t1 => CNode (ObjCVisibilitySpec t1) |
data ObjCVisType Source
Available visibility specifications.
data ObjCPropertyDeclaration a Source
ObjCPropDecl [ObjCPropertyModifier a] (CDeclaration a) a |
Functor ObjCPropertyDeclaration | |
Typeable1 ObjCPropertyDeclaration | |
Annotated ObjCPropertyDeclaration | |
Pretty ObjCPropDecl | |
Data a => Data (ObjCPropertyDeclaration a) | |
Show a => Show (ObjCPropertyDeclaration a) | |
CNode t1 => Pos (ObjCPropertyDeclaration t1) | |
CNode t1 => CNode (ObjCPropertyDeclaration t1) |
data ObjCSelector a Source
ObjCSel Ident a | |
ObjCInSel a | |
ObjCOutSel a |
Functor ObjCSelector | |
Typeable1 ObjCSelector | |
Annotated ObjCSelector | |
Pretty ObjCSel | |
Data a => Data (ObjCSelector a) | |
Show a => Show (ObjCSelector a) | |
CNode t1 => Pos (ObjCSelector t1) | |
CNode t1 => CNode (ObjCSelector t1) |
data ObjCMethodSelector a Source
ObjCUnaryMethod (ObjCSelector a) a | |
ObjCMethod [ObjCKeywordDeclarator a] (Maybe ([CDeclaration a], Bool)) a | |
ObjCEllipseMethod [ObjCKeywordDeclarator a] a |
Functor ObjCMethodSelector | |
Typeable1 ObjCMethodSelector | |
Annotated ObjCMethodSelector | |
Pretty ObjCMethodSel | |
Data a => Data (ObjCMethodSelector a) | |
Show a => Show (ObjCMethodSelector a) | |
CNode t1 => Pos (ObjCMethodSelector t1) | |
CNode t1 => CNode (ObjCMethodSelector t1) |
data ObjCMethodType Source
data ObjCMethodDeclaration a Source
ObjCMethodDecl !ObjCMethodType (Maybe (CDeclaration a)) (ObjCMethodSelector a) [CAttribute a] a |
Functor ObjCMethodDeclaration | |
Typeable1 ObjCMethodDeclaration | |
Annotated ObjCMethodDeclaration | |
Pretty ObjCMethodDecl | |
Data a => Data (ObjCMethodDeclaration a) | |
Show a => Show (ObjCMethodDeclaration a) | |
CNode t1 => Pos (ObjCMethodDeclaration t1) | |
CNode t1 => CNode (ObjCMethodDeclaration t1) |
data ObjCProtocolDec a Source
Objective-C protocol declaration
ObjCForwardProtoDec [Ident] [CAttribute a] a | |
ObjCProtoDec !Ident [ObjCProtocolName a] [ObjCProtocolDeclBlock a] [CAttribute a] a |
Functor ObjCProtocolDec | |
Typeable1 ObjCProtocolDec | |
Annotated ObjCProtocolDec | |
Pretty ObjCProtoDec | |
Data a => Data (ObjCProtocolDec a) | |
Show a => Show (ObjCProtocolDec a) | |
CNode t1 => Pos (ObjCProtocolDec t1) | |
CNode t1 => CNode (ObjCProtocolDec t1) |
data ObjCProtocolDeclBlock a Source
ObjCProtoDeclBlock [ObjCInterfaceDeclaration a] a | |
ObjCReqProtoBlock [ObjCInterfaceDeclaration a] a | |
ObjCOptProtoBlock [ObjCInterfaceDeclaration a] a |
Functor ObjCProtocolDeclBlock | |
Typeable1 ObjCProtocolDeclBlock | |
Annotated ObjCProtocolDeclBlock | |
Pretty ObjCProtoDeclBlock | |
Data a => Data (ObjCProtocolDeclBlock a) | |
Show a => Show (ObjCProtocolDeclBlock a) | |
CNode t1 => Pos (ObjCProtocolDeclBlock t1) | |
CNode t1 => CNode (ObjCProtocolDeclBlock t1) |
data ObjCCategoryDec a Source
Objective-C Category definition ('@interface')
ObjCCatDec !Ident !Ident [ObjCProtocolName a] [ObjCInterfaceDeclaration a] [CAttribute a] a |
Functor ObjCCategoryDec | |
Typeable1 ObjCCategoryDec | |
Annotated ObjCCategoryDec | |
Pretty ObjCCatDec | |
Data a => Data (ObjCCategoryDec a) | |
Show a => Show (ObjCCategoryDec a) | |
CNode t1 => Pos (ObjCCategoryDec t1) | |
CNode t1 => CNode (ObjCCategoryDec t1) |
data ObjCImplementation a Source
Implementation declaration, '@implementation'
ObjCImpl (ObjCClassName a) (Maybe (ObjCClassName a)) [ObjCInstanceVariableBlock a] [ObjCImplementationDefinition a] a |
Functor ObjCImplementation | |
Typeable1 ObjCImplementation | |
Annotated ObjCImplementation | |
Pretty ObjCImpl | |
Data a => Data (ObjCImplementation a) | |
Show a => Show (ObjCImplementation a) | |
CNode t1 => Pos (ObjCImplementation t1) | |
CNode t1 => CNode (ObjCImplementation t1) |
data ObjCCategoryImplementation a Source
Objective-C Category implementation '@implementation'
Functor ObjCCategoryImplementation | |
Typeable1 ObjCCategoryImplementation | |
Annotated ObjCCategoryImplementation | |
Pretty ObjCCatImpl | |
Data a => Data (ObjCCategoryImplementation a) | |
Show a => Show (ObjCCategoryImplementation a) | |
CNode t1 => Pos (ObjCCategoryImplementation t1) | |
CNode t1 => CNode (ObjCCategoryImplementation t1) |
data ObjCMethodDefinition a Source
ObjCMethodDef !ObjCMethodType (Maybe (CDeclaration a)) (ObjCMethodSelector a) [CDeclaration a] (CStatement a) a |
Functor ObjCMethodDefinition | |
Typeable1 ObjCMethodDefinition | |
Annotated ObjCMethodDefinition | |
Pretty ObjCMethodDef | |
Data a => Data (ObjCMethodDefinition a) | |
Show a => Show (ObjCMethodDefinition a) | |
CNode t1 => Pos (ObjCMethodDefinition t1) | |
CNode t1 => CNode (ObjCMethodDefinition t1) |
data ObjCImplementationDefinition a Source
Functor ObjCImplementationDefinition | |
Typeable1 ObjCImplementationDefinition | |
Annotated ObjCImplementationDefinition | |
Pretty ObjCImplDef | |
Data a => Data (ObjCImplementationDefinition a) | |
Show a => Show (ObjCImplementationDefinition a) | |
CNode t1 => Pos (ObjCImplementationDefinition t1) | |
CNode t1 => CNode (ObjCImplementationDefinition t1) |
Declaration attributes
type CDeclSpec = CDeclarationSpecifier NodeInfoSource
C declaration specifiers and qualifiers
Declaration specifiers include at most one storage-class specifier (C99 6.7.1), type specifiers (6.7.2) and type qualifiers (6.7.3).
partitionDeclSpecs :: [CDeclarationSpecifier a] -> ([CStorageSpecifier a], [CAttribute a], [CTypeQualifier a], [CTypeSpecifier a], Bool)Source
Separate the declaration specifiers
Note that inline isn't actually a type qualifier, but a function specifier.
__attribute__
of a declaration qualify declarations or declarators (but not types),
and are therefore separated as well.
type CStorageSpec = CStorageSpecifier NodeInfoSource
C storage class specifier (and typedefs) (K&R A8.1, C99 6.7.1)
type CTypeSpec = CTypeSpecifier NodeInfoSource
C type specifier (K&R A8.2, C99 6.7.2)
Type specifiers are either basic types such as char
or int
,
struct
, union
or enum
specifiers or typedef names.
As a GNU extension, a typeof
expression also is a type specifier.
Objective-C class names and specifiers of the form 'typdefname Protocols' are also allowed.
isSUEDef :: CTypeSpecifier a -> BoolSource
returns True
if the given typespec is a struct, union or enum definition
type CTypeQual = CTypeQualifier NodeInfoSource
C type qualifiers (K&R A8.2, C99 6.7.3), function specifiers (C99 6.7.4), and attributes.
const
, volatile
and restrict
type qualifiers and inline
function specifier.
Additionally, __attribute__
annotations for declarations and declarators.
type CAttr = CAttribute NodeInfoSource
__attribute__
annotations
Those are of the form CAttr attribute-name attribute-parameters
,
and serve as generic properties of some syntax tree elements.
data CDeclarationSpecifier a Source
CStorageSpec (CStorageSpecifier a) | storage-class specifier or typedef |
CTypeSpec (CTypeSpecifier a) | type name |
CTypeQual (CTypeQualifier a) | type qualifier |
Functor CDeclarationSpecifier | |
Typeable1 CDeclarationSpecifier | |
Annotated CDeclarationSpecifier | |
Pretty CDeclSpec | |
Data a => Data (CDeclarationSpecifier a) | |
Show a => Show (CDeclarationSpecifier a) | |
CNode t1 => Pos (CDeclarationSpecifier t1) | |
CNode t1 => CNode (CDeclarationSpecifier t1) |
data CStorageSpecifier a Source
CAuto a | auto |
CRegister a | register |
CStatic a | static |
CExtern a | extern |
CTypedef a | typedef |
CThread a | GNUC thread local storage |
Functor CStorageSpecifier | |
Typeable1 CStorageSpecifier | |
Annotated CStorageSpecifier | |
Pretty CStorageSpec | |
Eq a => Eq (CStorageSpecifier a) | |
Data a => Data (CStorageSpecifier a) | |
Ord a => Ord (CStorageSpecifier a) | |
Show a => Show (CStorageSpecifier a) | |
CNode t1 => Pos (CStorageSpecifier t1) | |
CNode t1 => CNode (CStorageSpecifier t1) |
data CTypeSpecifier a Source
CVoidType a | |
CCharType a | |
CShortType a | |
CIntType a | |
CLongType a | |
CFloatType a | |
CDoubleType a | |
CSignedType a | |
CUnsigType a | |
CBoolType a | |
CComplexType a | |
CSUType (CStructureUnion a) a | Struct or Union specifier |
CEnumType (CEnumeration a) a | Enumeration specifier |
CTypeDef !Ident a | Typedef name |
CTypeOfExpr (CExpression a) a | typeof(expr) |
CTypeOfType (CDeclaration a) a | typeof(type) |
ObjCClassProto !Ident [ObjCProtocolName a] a | class name with protocol list |
ObjCTypeProto !Ident [ObjCProtocolName a] a | Typedef name with protocol list |
Functor CTypeSpecifier | |
Typeable1 CTypeSpecifier | |
Annotated CTypeSpecifier | |
Pretty CTypeSpec | |
Data a => Data (CTypeSpecifier a) | |
Show a => Show (CTypeSpecifier a) | |
CNode t1 => Pos (CTypeSpecifier t1) | |
CNode t1 => CNode (CTypeSpecifier t1) |
data CTypeQualifier a Source
CConstQual a | |
CVolatQual a | |
CRestrQual a | |
CInlineQual a | |
CAttrQual (CAttribute a) | |
ObjCProtoQual (ObjCProtoQualifier a) |
Functor CTypeQualifier | |
Typeable1 CTypeQualifier | |
Annotated CTypeQualifier | |
Pretty CTypeQual | |
Data a => Data (CTypeQualifier a) | |
Show a => Show (CTypeQualifier a) | |
CNode t1 => Pos (CTypeQualifier t1) | |
CNode t1 => CNode (CTypeQualifier t1) |
data CAttribute a Source
CAttr !Ident [CExpression a] a |
Functor CAttribute | |
Typeable1 CAttribute | |
Annotated CAttribute | |
Pretty CAttr | |
Data a => Data (CAttribute a) | |
Show a => Show (CAttribute a) | |
CNode t1 => Pos (CAttribute t1) | |
CNode t1 => CNode (CAttribute t1) |
Objective-C extensions
data ObjCPropertyModifier a Source
ObjCPropMod !Ident (Maybe Ident) a |
Functor ObjCPropertyModifier | |
Typeable1 ObjCPropertyModifier | |
Annotated ObjCPropertyModifier | |
Pretty ObjCPropMod | |
Data a => Data (ObjCPropertyModifier a) | |
Show a => Show (ObjCPropertyModifier a) | |
CNode t1 => Pos (ObjCPropertyModifier t1) | |
CNode t1 => CNode (ObjCPropertyModifier t1) |
data ObjCProtoQualifier a Source
Functor ObjCProtoQualifier | |
Typeable1 ObjCProtoQualifier | |
Annotated ObjCProtoQualifier | |
Pretty ObjCProtoQual | |
Data a => Data (ObjCProtoQualifier a) | |
Show a => Show (ObjCProtoQualifier a) | |
CNode t1 => Pos (ObjCProtoQualifier t1) | |
CNode t1 => CNode (ObjCProtoQualifier t1) |
Declarators
type CDeclr = CDeclarator NodeInfoSource
C declarator (K&R A8.5, C99 6.7.5) and abstract declarator (K&R A8.8, C99 6.7.6)
A declarator declares a single object, function, or type. It is always associated with
a declaration (CDecl
), which specifies the declaration's type and the additional storage qualifiers and
attributes, which apply to the declared object.
A declarator is of the form CDeclr name? indirections asm-name? attrs _
, where
name
is the name of the declared object (missing for abstract declarators),
declquals
is a set of additional declaration specifiers,
asm-name
is the optional assembler name and attributes is a set of
attrs is a set of __attribute__
annotations for the declared object.
indirections
is a set of pointer, array and function declarators, which modify the type of the declared object as
described below. If the declaration specifies the non-derived type T
,
and we have indirections = [D1, D2, ..., Dn]
than the declared object has type
(D1
, where
indirect
(D2 indirect
... (Dn indirect
T)))
-
(CPtrDeclr attrs)
is attributed pointer to Tindirect
T -
(CFunDeclr attrs)
is attributed function returning Tindirect
T -
(CArrayDeclr attrs)
is attributed array of elemements of type Tindirect
T
Examples (simplified attributes):
- x is an int
int x; CDeclr "x" []
- x is a restrict pointer to a const pointer to int
const int * const * restrict x; CDeclr "x" [CPtrDeclr [restrict], CPtrDeclr [const]]
- f is an function return a constant pointer to int
int* const f(); CDeclr "f" [CFunDeclr [],CPtrDeclr [const]]
- f is a constant pointer to a function returning int
int (* const f)(); ==> CDeclr "f" [CPtrDeclr [const], CFunDeclr []]
type CDerivedDeclr = CDerivedDeclarator NodeInfoSource
Derived declarators, see CDeclr
Indirections are qualified using type-qualifiers and generic attributes, and additionally
- The size of an array is either a constant expression, variable length (
*
) or missing; in the last case, the type of the array is incomplete. The qualifier static is allowed for function arguments only, indicating that the supplied argument is an array of at least the given size. - New style parameter lists have the form
Right (declarations, isVariadic)
, old style parameter lists have the formLeft (parameter-names)
type CArrSize = CArraySize NodeInfoSource
Size of an array
data CDeclarator a Source
CDeclr (Maybe Ident) [CDerivedDeclarator a] (Maybe (CStringLiteral a)) [CAttribute a] a |
Functor CDeclarator | |
Typeable1 CDeclarator | |
Annotated CDeclarator | |
Pretty CDeclr | |
Data a => Data (CDeclarator a) | |
Show a => Show (CDeclarator a) | |
CNode t1 => Pos (CDeclarator t1) | |
CNode t1 => CNode (CDeclarator t1) |
data CDerivedDeclarator a Source
CPtrDeclr [CTypeQualifier a] a | Pointer declarator |
CBlkDeclr [CTypeQualifier a] a | Block declarator |
CArrDeclr [CTypeQualifier a] (CArraySize a) a | Array declarator |
CFunDeclr (Either [Ident] ([CDeclaration a], Bool)) [CAttribute a] a | Function declarator |
Functor CDerivedDeclarator | |
Typeable1 CDerivedDeclarator | |
Annotated CDerivedDeclarator | |
Data a => Data (CDerivedDeclarator a) | |
Show a => Show (CDerivedDeclarator a) | |
CNode t1 => Pos (CDerivedDeclarator t1) | |
CNode t1 => CNode (CDerivedDeclarator t1) |
data CArraySize a Source
CNoArrSize !Bool | CUnknownSize isCompleteType |
CArrSize !Bool (CExpression a) | CArrSize isStatic expr |
Functor CArraySize | |
Typeable1 CArraySize | |
Pretty CArrSize | |
Data a => Data (CArraySize a) | |
Show a => Show (CArraySize a) |
Objective-C Extensions
data ObjCClassName a Source
ObjCClassNm !Ident a |
Functor ObjCClassName | |
Typeable1 ObjCClassName | |
Annotated ObjCClassName | |
Pretty ObjCClassNm | |
Data a => Data (ObjCClassName a) | |
Show a => Show (ObjCClassName a) | |
CNode t1 => Pos (ObjCClassName t1) | |
CNode t1 => CNode (ObjCClassName t1) |
data ObjCClassDeclarator a Source
Functor ObjCClassDeclarator | |
Typeable1 ObjCClassDeclarator | |
Annotated ObjCClassDeclarator | |
Pretty ObjCClassDeclr | |
Data a => Data (ObjCClassDeclarator a) | |
Show a => Show (ObjCClassDeclarator a) | |
CNode t1 => Pos (ObjCClassDeclarator t1) | |
CNode t1 => CNode (ObjCClassDeclarator t1) |
data ObjCInterfaceDeclaration a Source
ObjCIfaceDecl (CDeclaration a) a | |
ObjCIfaceMethodDecl (ObjCMethodDeclaration a) a | |
ObjCIfacePropDecl (ObjCPropertyDeclaration a) a |
Functor ObjCInterfaceDeclaration | |
Typeable1 ObjCInterfaceDeclaration | |
Annotated ObjCInterfaceDeclaration | |
Pretty ObjCIfaceDecl | |
Data a => Data (ObjCInterfaceDeclaration a) | |
Show a => Show (ObjCInterfaceDeclaration a) | |
CNode t1 => Pos (ObjCInterfaceDeclaration t1) | |
CNode t1 => CNode (ObjCInterfaceDeclaration t1) |
data ObjCKeywordDeclarator a Source
ObjCKeyDeclr (Maybe (ObjCSelector a)) (Maybe (CDeclaration a)) !Ident a |
Functor ObjCKeywordDeclarator | |
Typeable1 ObjCKeywordDeclarator | |
Annotated ObjCKeywordDeclarator | |
Pretty ObjCKeyDeclr | |
Data a => Data (ObjCKeywordDeclarator a) | |
Show a => Show (ObjCKeywordDeclarator a) | |
CNode t1 => Pos (ObjCKeywordDeclarator t1) | |
CNode t1 => CNode (ObjCKeywordDeclarator t1) |
Initialization
type CInit = CInitializer NodeInfoSource
C initialization (K&R A8.7, C99 6.7.8)
Initializers are either assignment expressions or initializer lists (surrounded in curly braces), whose elements are themselves initializers, paired with an optional list of designators.
type CInitList = CInitializerList NodeInfoSource
Initializer List
The members of an initializer list are of the form (designator-list,initializer)
.
The designator-list
specifies one member of the compound type which is initialized.
It is allowed to be empty - in this case the initializer refers to the
''next'' member of the compound type (see C99 6.7.8).
Examples (simplified expressions and identifiers):
-- int x[3][4] = { [0][3] = 4, [2] = 5, 8 }; -- corresponds to the assignments -- x[0][3] = 4; x[2][0] = 5; x[2][1] = 8; let init1 = ([CArrDesig 0, CArrDesig 3], CInitExpr 4) init2 = ([CArrDesig 2] , CInitExpr 5) init3 = ([] , CInitExpr 8) in CInitList [init1, init2, init3]
-- struct { struct { int a[2]; int b[2]; int c[2]; } s; } x = { .s = { {2,3} , .c[0] = 1 } }; -- corresponds to the assignments -- x.s.a[0] = 2; x.s.a[1] = 3; x.s.c[0] = 1; let init_s_0 = CInitList [ ([], CInitExpr 2), ([], CInitExpr 3)] init_s = CInitList [ ([], init_s_0), ([CMemberDesig "c", CArrDesig 0], CInitExpr 1) ] in CInitList [(CMemberDesig "s", init_s)]
type CDesignator = CPartDesignator NodeInfoSource
Designators
A designator specifies a member of an object, either an element or range of an array, or the named member of a struct / union.
data CInitializer a Source
CInitExpr (CExpression a) a | assignment expression |
CInitList (CInitializerList a) a | initialization list (see |
Functor CInitializer | |
Typeable1 CInitializer | |
Annotated CInitializer | |
Pretty CInit | |
Data a => Data (CInitializer a) | |
Show a => Show (CInitializer a) | |
CNode t1 => Pos (CInitializer t1) | |
CNode t1 => CNode (CInitializer t1) |
type CInitializerList a = [([CPartDesignator a], CInitializer a)]Source
data CPartDesignator a Source
CArrDesig (CExpression a) a | array position designator |
CMemberDesig !Ident a | member designator |
CRangeDesig (CExpression a) (CExpression a) a | array range designator |
Functor CPartDesignator | |
Typeable1 CPartDesignator | |
Annotated CPartDesignator | |
Pretty CDesignator | |
Data a => Data (CPartDesignator a) | |
Show a => Show (CPartDesignator a) | |
CNode t1 => Pos (CPartDesignator t1) | |
CNode t1 => CNode (CPartDesignator t1) |
Statements
type CStat = CStatement NodeInfoSource
C statement (K&R A9, C99 6.8)
type CBlockItem = CCompoundBlockItem NodeInfoSource
C99 Block items
Things that may appear in compound statements: either statements, declarations or nested function definitions.
type CAsmStmt = CAssemblyStatement NodeInfoSource
GNU Assembler statement
CAssemblyStatement type-qual? asm-expr out-ops in-ops clobbers _
is an inline assembler statement.
The only type-qualifier (if any) allowed is volatile.
asm-expr
is the actual assembler epxression (a string), out-ops
and in-ops
are the input
and output operands of the statement.
clobbers
is a list of registers which are clobbered when executing the assembler statement
type CAsmOperand = CAssemblyOperand NodeInfoSource
Assembler operand
CAsmOperand argName? constraintExpr arg
specifies an operand for an assembler
statement.
data CStatement a Source
CLabel !Ident (CStatement a) [CAttribute a] a | An (attributed) label followed by a statement |
CCase (CExpression a) (CStatement a) a | A statement of the form |
CCases (CExpression a) (CExpression a) (CStatement a) a | A case range of the form |
CDefault (CStatement a) a | The default case |
CExpr (Maybe (CExpression a)) a | A simple statement, that is in C: evaluating an expression with side-effects and discarding the result. |
CCompound [Ident] [CCompoundBlockItem a] a | compound statement |
CIf (CExpression a) (CStatement a) (Maybe (CStatement a)) a | conditional statement |
CSwitch (CExpression a) (CStatement a) a | switch statement |
CWhile (CExpression a) (CStatement a) Bool a | while or do-while statement |
CFor (Either (Maybe (CExpression a)) (CDeclaration a)) (Maybe (CExpression a)) (Maybe (CExpression a)) (CStatement a) a | for statement |
CGoto !Ident a | goto statement |
CGotoPtr (CExpression a) a | computed goto |
CCont a | continue statement |
CBreak a | break statement |
CReturn (Maybe (CExpression a)) a | return statement |
CAsm (CAssemblyStatement a) a | assembly statement |
Functor CStatement | |
Typeable1 CStatement | |
Annotated CStatement | |
Pretty CStat | |
Data a => Data (CStatement a) | |
Show a => Show (CStatement a) | |
CNode t1 => Pos (CStatement t1) | |
CNode t1 => CNode (CStatement t1) |
data CCompoundBlockItem a Source
CBlockStmt (CStatement a) | A statement |
CBlockDecl (CDeclaration a) | A local declaration |
CNestedFunDef (CFunctionDef a) | A nested function (GNU C) |
Functor CCompoundBlockItem | |
Typeable1 CCompoundBlockItem | |
Annotated CCompoundBlockItem | |
Pretty CBlockItem | |
Data a => Data (CCompoundBlockItem a) | |
Show a => Show (CCompoundBlockItem a) | |
CNode t1 => Pos (CCompoundBlockItem t1) | |
CNode t1 => CNode (CCompoundBlockItem t1) |
data CAssemblyStatement a Source
CAsmStmt (Maybe (CTypeQualifier a)) (CStringLiteral a) [CAssemblyOperand a] [CAssemblyOperand a] [CStringLiteral a] a |
Functor CAssemblyStatement | |
Typeable1 CAssemblyStatement | |
Annotated CAssemblyStatement | |
Pretty CAsmStmt | |
Data a => Data (CAssemblyStatement a) | |
Show a => Show (CAssemblyStatement a) | |
CNode t1 => Pos (CAssemblyStatement t1) | |
CNode t1 => CNode (CAssemblyStatement t1) |
data CAssemblyOperand a Source
CAsmOperand (Maybe Ident) (CStringLiteral a) (CExpression a) a |
Functor CAssemblyOperand | |
Typeable1 CAssemblyOperand | |
Annotated CAssemblyOperand | |
Pretty CAsmOperand | |
Data a => Data (CAssemblyOperand a) | |
Show a => Show (CAssemblyOperand a) | |
CNode t1 => Pos (CAssemblyOperand t1) | |
CNode t1 => CNode (CAssemblyOperand t1) |
Expressions
type CExpr = CExpression NodeInfoSource
C expression (K&R A7)
- these can be arbitrary expression, as the argument of
sizeof
can be arbitrary, even if appearing in a constant expression - GNU C extensions:
alignof
,__real
,__imag
,({ stmt-expr })
,&& label
and built-ins * objective-C style code blocks
data CExpression a Source
Functor CExpression | |
Typeable1 CExpression | |
Annotated CExpression | |
Pretty CExpr | |
Data a => Data (CExpression a) | |
Show a => Show (CExpression a) | |
CNode t1 => Pos (CExpression t1) | |
CNode t1 => CNode (CExpression t1) |
C assignment operators (K&R A7.17)
C binary operators (K&R A7.6-15)
C unary operator (K&R A7.3-4)
CPreIncOp | prefix increment operator |
CPreDecOp | prefix decrement operator |
CPostIncOp | postfix increment operator |
CPostDecOp | postfix decrement operator |
CAdrOp | address operator |
CIndOp | indirection operator |
CPlusOp | prefix plus |
CMinOp | prefix minus |
CCompOp | one's complement |
CNegOp | logical negation |
type CBuiltin = CBuiltinThing NodeInfoSource
GNU Builtins, which cannot be typed in C99
data CBuiltinThing a Source
CBuiltinVaArg (CExpression a) (CDeclaration a) a | (expr, type) |
CBuiltinOffsetOf (CDeclaration a) [CPartDesignator a] a | (type, designator-list) |
CBuiltinTypesCompatible (CDeclaration a) (CDeclaration a) a | (type,type) |
Functor CBuiltinThing | |
Typeable1 CBuiltinThing | |
Annotated CBuiltinThing | |
Pretty CBuiltin | |
Data a => Data (CBuiltinThing a) | |
Show a => Show (CBuiltinThing a) | |
CNode t1 => Pos (CBuiltinThing t1) | |
CNode t1 => CNode (CBuiltinThing t1) |
Objective-C Extensions
data ObjCMessageExpression a Source
ObjCMsgExpr (CExpression a) (ObjCMessageSelector a) a | |
ObjCMsgClass (ObjCClassName a) (ObjCMessageSelector a) a | |
ObjCMsgSup (ObjCMessageSelector a) a |
Functor ObjCMessageExpression | |
Typeable1 ObjCMessageExpression | |
Annotated ObjCMessageExpression | |
Pretty ObjCMsgExpr | |
Data a => Data (ObjCMessageExpression a) | |
Show a => Show (ObjCMessageExpression a) | |
CNode t1 => Pos (ObjCMessageExpression t1) | |
CNode t1 => CNode (ObjCMessageExpression t1) |
data ObjCMessageSelector a Source
ObjCMsgSel (ObjCSelector a) a | |
ObjCKeyArgs [ObjCKeywordArg a] a |
Functor ObjCMessageSelector | |
Typeable1 ObjCMessageSelector | |
Annotated ObjCMessageSelector | |
Pretty ObjCMsgSel | |
Data a => Data (ObjCMessageSelector a) | |
Show a => Show (ObjCMessageSelector a) | |
CNode t1 => Pos (ObjCMessageSelector t1) | |
CNode t1 => CNode (ObjCMessageSelector t1) |
data ObjCKeywordArg a Source
ObjCKeyArg (ObjCSelectorKeyName a) (CExpression a) a |
Functor ObjCKeywordArg | |
Typeable1 ObjCKeywordArg | |
Annotated ObjCKeywordArg | |
Pretty ObjCKeyArg | |
Data a => Data (ObjCKeywordArg a) | |
Show a => Show (ObjCKeywordArg a) | |
CNode t1 => Pos (ObjCKeywordArg t1) | |
CNode t1 => CNode (ObjCKeywordArg t1) |
data ObjCSelectorName a Source
ObjCSelPlain (ObjCSelector a) a | |
ObjCSelKeys [ObjCSelectorKeyName a] a |
Functor ObjCSelectorName | |
Typeable1 ObjCSelectorName | |
Annotated ObjCSelectorName | |
Pretty ObjCSelName | |
Data a => Data (ObjCSelectorName a) | |
Show a => Show (ObjCSelectorName a) | |
CNode t1 => Pos (ObjCSelectorName t1) | |
CNode t1 => CNode (ObjCSelectorName t1) |
data ObjCSelectorKeyName a Source
ObjCSelKeyName (Maybe (ObjCSelector a)) a |
Functor ObjCSelectorKeyName | |
Typeable1 ObjCSelectorKeyName | |
Annotated ObjCSelectorKeyName | |
Pretty ObjCSelKeyName | |
Data a => Data (ObjCSelectorKeyName a) | |
Show a => Show (ObjCSelectorKeyName a) | |
CNode t1 => Pos (ObjCSelectorKeyName t1) | |
CNode t1 => CNode (ObjCSelectorKeyName t1) |
Constants
type CStrLit = CStringLiteral NodeInfoSource
Attributed string literals
cstringOfLit :: CStringLiteral a -> CStringSource
liftStrLit :: CStringLiteral a -> CConstant aSource
Lift a string literal to a C constant
data CStringLiteral a Source
Functor CStringLiteral | |
Typeable1 CStringLiteral | |
Annotated CStringLiteral | |
Pretty CStrLit | |
Data a => Data (CStringLiteral a) | |
Show a => Show (CStringLiteral a) | |
CNode t1 => Pos (CStringLiteral t1) | |
CNode t1 => CNode (CStringLiteral t1) |
Objective-C Extensions
type ObjCConst = ObjCConstant NodeInfoSource
Objective-C constant (NSString)
data ObjCConstant a Source
Functor ObjCConstant | |
Typeable1 ObjCConstant | |
Annotated ObjCConstant | |
Pretty ObjCConst | |
Data a => Data (ObjCConstant a) | |
Show a => Show (ObjCConstant a) | |
CNode t1 => Pos (ObjCConstant t1) | |
CNode t1 => CNode (ObjCConstant t1) |