language-c-0.9.2: Analysis and generation of C code
CopyrightCopyright (c) 2007 Bertram Felgenhauer
(c) 2008 Benedikt Huber
LicenseBSD-style
Maintainerbenedikt.huber@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.C.Pretty

Description

This module provides a pretty printer for the parse tree (AST).

Synopsis

Pretty Printing

class Pretty p where Source #

A class of types which can be pretty printed

Minimal complete definition

Nothing

Methods

pretty :: p -> Doc Source #

pretty print the given value

prettyPrec :: Int -> p -> Doc Source #

prettyPrec prec p pretty prints p assuming that the surrounding context has a precedence of prec

Instances

Instances details
Pretty DefTable Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: DefTable -> Doc Source #

prettyPrec :: Int -> DefTable -> Doc Source #

Pretty TagFwdDecl Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: TagFwdDecl -> Doc Source #

prettyPrec :: Int -> TagFwdDecl -> Doc Source #

Pretty Attr Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: Attr -> Doc Source #

prettyPrec :: Int -> Attr -> Doc Source #

Pretty Attributes Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: Attributes -> Doc Source #

prettyPrec :: Int -> Attributes -> Doc Source #

Pretty CompTyKind Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: CompTyKind -> Doc Source #

prettyPrec :: Int -> CompTyKind -> Doc Source #

Pretty CompType Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: CompType -> Doc Source #

prettyPrec :: Int -> CompType -> Doc Source #

Pretty CompTypeRef Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: CompTypeRef -> Doc Source #

prettyPrec :: Int -> CompTypeRef -> Doc Source #

Pretty Decl Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: Decl -> Doc Source #

prettyPrec :: Int -> Decl -> Doc Source #

Pretty DeclAttrs Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: DeclAttrs -> Doc Source #

prettyPrec :: Int -> DeclAttrs -> Doc Source #

Pretty EnumType Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: EnumType -> Doc Source #

prettyPrec :: Int -> EnumType -> Doc Source #

Pretty EnumTypeRef Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: EnumTypeRef -> Doc Source #

prettyPrec :: Int -> EnumTypeRef -> Doc Source #

Pretty Enumerator Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: Enumerator -> Doc Source #

prettyPrec :: Int -> Enumerator -> Doc Source #

Pretty FunDef Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: FunDef -> Doc Source #

prettyPrec :: Int -> FunDef -> Doc Source #

Pretty FunctionAttrs Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: FunctionAttrs -> Doc Source #

prettyPrec :: Int -> FunctionAttrs -> Doc Source #

Pretty GlobalDecls Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: GlobalDecls -> Doc Source #

prettyPrec :: Int -> GlobalDecls -> Doc Source #

Pretty IdentDecl Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: IdentDecl -> Doc Source #

prettyPrec :: Int -> IdentDecl -> Doc Source #

Pretty Linkage Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: Linkage -> Doc Source #

prettyPrec :: Int -> Linkage -> Doc Source #

Pretty MemberDecl Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: MemberDecl -> Doc Source #

prettyPrec :: Int -> MemberDecl -> Doc Source #

Pretty ObjDef Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: ObjDef -> Doc Source #

prettyPrec :: Int -> ObjDef -> Doc Source #

Pretty ParamDecl Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: ParamDecl -> Doc Source #

prettyPrec :: Int -> ParamDecl -> Doc Source #

Pretty Storage Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: Storage -> Doc Source #

prettyPrec :: Int -> Storage -> Doc Source #

Pretty TagDef Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: TagDef -> Doc Source #

prettyPrec :: Int -> TagDef -> Doc Source #

Pretty Type Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: Type -> Doc Source #

prettyPrec :: Int -> Type -> Doc Source #

Pretty TypeDef Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: TypeDef -> Doc Source #

prettyPrec :: Int -> TypeDef -> Doc Source #

Pretty TypeQuals Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: TypeQuals -> Doc Source #

prettyPrec :: Int -> TypeQuals -> Doc Source #

Pretty VarDecl Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: VarDecl -> Doc Source #

prettyPrec :: Int -> VarDecl -> Doc Source #

Pretty VarName Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: VarName -> Doc Source #

prettyPrec :: Int -> VarName -> Doc Source #

Pretty Ident Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: Ident -> Doc Source #

prettyPrec :: Int -> Ident -> Doc Source #

Pretty SUERef Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: SUERef -> Doc Source #

prettyPrec :: Int -> SUERef -> Doc Source #

Pretty CAlignSpec Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CAlignSpec -> Doc Source #

prettyPrec :: Int -> CAlignSpec -> Doc Source #

Pretty CArrSize Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CArrSize -> Doc Source #

prettyPrec :: Int -> CArrSize -> Doc Source #

Pretty CAsmOperand Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CAsmOperand -> Doc Source #

prettyPrec :: Int -> CAsmOperand -> Doc Source #

Pretty CAsmStmt Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CAsmStmt -> Doc Source #

prettyPrec :: Int -> CAsmStmt -> Doc Source #

Pretty CAttr Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CAttr -> Doc Source #

prettyPrec :: Int -> CAttr -> Doc Source #

Pretty CBlockItem Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CBlockItem -> Doc Source #

prettyPrec :: Int -> CBlockItem -> Doc Source #

Pretty CBuiltin Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CBuiltin -> Doc Source #

prettyPrec :: Int -> CBuiltin -> Doc Source #

Pretty CConst Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CConst -> Doc Source #

prettyPrec :: Int -> CConst -> Doc Source #

Pretty CDecl Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CDecl -> Doc Source #

prettyPrec :: Int -> CDecl -> Doc Source #

Pretty CDeclSpec Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CDeclSpec -> Doc Source #

prettyPrec :: Int -> CDeclSpec -> Doc Source #

Pretty CDeclr Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CDeclr -> Doc Source #

prettyPrec :: Int -> CDeclr -> Doc Source #

Pretty CDesignator Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CDesignator -> Doc Source #

prettyPrec :: Int -> CDesignator -> Doc Source #

Pretty CEnum Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CEnum -> Doc Source #

prettyPrec :: Int -> CEnum -> Doc Source #

Pretty CExpr Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CExpr -> Doc Source #

prettyPrec :: Int -> CExpr -> Doc Source #

Pretty CExtDecl Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CExtDecl -> Doc Source #

prettyPrec :: Int -> CExtDecl -> Doc Source #

Pretty CFunDef Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CFunDef -> Doc Source #

prettyPrec :: Int -> CFunDef -> Doc Source #

Pretty CFunSpec Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CFunSpec -> Doc Source #

prettyPrec :: Int -> CFunSpec -> Doc Source #

Pretty CInit Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CInit -> Doc Source #

prettyPrec :: Int -> CInit -> Doc Source #

Pretty CStat Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CStat -> Doc Source #

prettyPrec :: Int -> CStat -> Doc Source #

Pretty CStorageSpec Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CStorageSpec -> Doc Source #

prettyPrec :: Int -> CStorageSpec -> Doc Source #

Pretty CStrLit Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CStrLit -> Doc Source #

prettyPrec :: Int -> CStrLit -> Doc Source #

Pretty CStructTag Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CStructTag -> Doc Source #

prettyPrec :: Int -> CStructTag -> Doc Source #

Pretty CStructUnion Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CStructUnion -> Doc Source #

prettyPrec :: Int -> CStructUnion -> Doc Source #

Pretty CTranslUnit Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CTranslUnit -> Doc Source #

prettyPrec :: Int -> CTranslUnit -> Doc Source #

Pretty CTypeQual Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CTypeQual -> Doc Source #

prettyPrec :: Int -> CTypeQual -> Doc Source #

Pretty CTypeSpec Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CTypeSpec -> Doc Source #

prettyPrec :: Int -> CTypeSpec -> Doc Source #

Pretty CAssignOp Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CAssignOp -> Doc Source #

prettyPrec :: Int -> CAssignOp -> Doc Source #

Pretty CBinaryOp Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CBinaryOp -> Doc Source #

prettyPrec :: Int -> CBinaryOp -> Doc Source #

Pretty CUnaryOp Source # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CUnaryOp -> Doc Source #

prettyPrec :: Int -> CUnaryOp -> Doc Source #

(Pretty a, Pretty b) => Pretty (Either a b) Source # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: Either a b -> Doc Source #

prettyPrec :: Int -> Either a b -> Doc Source #

Testing

prettyUsingInclude :: CTranslUnit -> Doc Source #

Pretty print the given tranlation unit, but replace declarations from header files with #include directives.

The resulting file may not compile (because of missing #define directives and similar things), but is very useful for testing, as otherwise the pretty printed file will be cluttered with declarations from system headers.