language-c-0.8.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 HaskellNone
LanguageHaskell98

Language.C.Pretty

Contents

Description

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

Synopsis

Pretty Printing

class Pretty p where #

A class of types which can be pretty printed

Minimal complete definition

Nothing

Methods

pretty :: p -> Doc #

pretty print the given value

prettyPrec :: Int -> p -> Doc #

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

Instances
Pretty Ident # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: Ident -> Doc #

prettyPrec :: Int -> Ident -> Doc #

Pretty SUERef # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: SUERef -> Doc #

prettyPrec :: Int -> SUERef -> Doc #

Pretty CUnaryOp # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CUnaryOp -> Doc #

prettyPrec :: Int -> CUnaryOp -> Doc #

Pretty CBinaryOp # 
Instance details

Defined in Language.C.Pretty

Pretty CAssignOp # 
Instance details

Defined in Language.C.Pretty

Pretty CStrLit # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CStrLit -> Doc #

prettyPrec :: Int -> CStrLit -> Doc #

Pretty CConst # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CConst -> Doc #

prettyPrec :: Int -> CConst -> Doc #

Pretty CBuiltin # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CBuiltin -> Doc #

prettyPrec :: Int -> CBuiltin -> Doc #

Pretty CExpr # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CExpr -> Doc #

prettyPrec :: Int -> CExpr -> Doc #

Pretty CAttr # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CAttr -> Doc #

prettyPrec :: Int -> CAttr -> Doc #

Pretty CDesignator # 
Instance details

Defined in Language.C.Pretty

Pretty CInit # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CInit -> Doc #

prettyPrec :: Int -> CInit -> Doc #

Pretty CEnum # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CEnum -> Doc #

prettyPrec :: Int -> CEnum -> Doc #

Pretty CStructTag # 
Instance details

Defined in Language.C.Pretty

Pretty CStructUnion # 
Instance details

Defined in Language.C.Pretty

Pretty CAlignSpec # 
Instance details

Defined in Language.C.Pretty

Pretty CFunSpec # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CFunSpec -> Doc #

prettyPrec :: Int -> CFunSpec -> Doc #

Pretty CTypeQual # 
Instance details

Defined in Language.C.Pretty

Pretty CTypeSpec # 
Instance details

Defined in Language.C.Pretty

Pretty CStorageSpec # 
Instance details

Defined in Language.C.Pretty

Pretty CDeclSpec # 
Instance details

Defined in Language.C.Pretty

Pretty CBlockItem # 
Instance details

Defined in Language.C.Pretty

Pretty CAsmOperand # 
Instance details

Defined in Language.C.Pretty

Pretty CAsmStmt # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CAsmStmt -> Doc #

prettyPrec :: Int -> CAsmStmt -> Doc #

Pretty CStat # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CStat -> Doc #

prettyPrec :: Int -> CStat -> Doc #

Pretty CArrSize # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CArrSize -> Doc #

prettyPrec :: Int -> CArrSize -> Doc #

Pretty CDeclr # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CDeclr -> Doc #

prettyPrec :: Int -> CDeclr -> Doc #

Pretty CDecl # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CDecl -> Doc #

prettyPrec :: Int -> CDecl -> Doc #

Pretty CFunDef # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CFunDef -> Doc #

prettyPrec :: Int -> CFunDef -> Doc #

Pretty CExtDecl # 
Instance details

Defined in Language.C.Pretty

Methods

pretty :: CExtDecl -> Doc #

prettyPrec :: Int -> CExtDecl -> Doc #

Pretty CTranslUnit # 
Instance details

Defined in Language.C.Pretty

Pretty Attributes # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty Attr # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: Attr -> Doc #

prettyPrec :: Int -> Attr -> Doc #

Pretty VarName # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: VarName -> Doc #

prettyPrec :: Int -> VarName -> Doc #

Pretty TypeQuals # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty Enumerator # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty EnumType # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: EnumType -> Doc #

prettyPrec :: Int -> EnumType -> Doc #

Pretty CompTyKind # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty CompType # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: CompType -> Doc #

prettyPrec :: Int -> CompType -> Doc #

Pretty EnumTypeRef # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty CompTypeRef # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty Type # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: Type -> Doc #

prettyPrec :: Int -> Type -> Doc #

Pretty Linkage # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: Linkage -> Doc #

prettyPrec :: Int -> Linkage -> Doc #

Pretty Storage # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: Storage -> Doc #

prettyPrec :: Int -> Storage -> Doc #

Pretty FunctionAttrs # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty DeclAttrs # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty VarDecl # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: VarDecl -> Doc #

prettyPrec :: Int -> VarDecl -> Doc #

Pretty TypeDef # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: TypeDef -> Doc #

prettyPrec :: Int -> TypeDef -> Doc #

Pretty MemberDecl # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty ParamDecl # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty FunDef # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: FunDef -> Doc #

prettyPrec :: Int -> FunDef -> Doc #

Pretty ObjDef # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: ObjDef -> Doc #

prettyPrec :: Int -> ObjDef -> Doc #

Pretty Decl # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: Decl -> Doc #

prettyPrec :: Int -> Decl -> Doc #

Pretty GlobalDecls # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty IdentDecl # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty TagDef # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: TagDef -> Doc #

prettyPrec :: Int -> TagDef -> Doc #

Pretty DefTable # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: DefTable -> Doc #

prettyPrec :: Int -> DefTable -> Doc #

Pretty TagFwdDecl # 
Instance details

Defined in Language.C.Analysis.Debug

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

Defined in Language.C.Analysis.Debug

Methods

pretty :: Either a b -> Doc #

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

Testing

prettyUsingInclude :: CTranslUnit -> Doc #

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.