language-c-0.9.4: 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

Pretty TagFwdDecl Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty Attr Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty Attributes Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty CompTyKind Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty CompType Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty CompTypeRef Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty Decl Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty DeclAttrs Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty EnumType Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty EnumTypeRef Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty Enumerator Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty FunDef Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty FunctionAttrs Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty GlobalDecls Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty IdentDecl Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty Linkage Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty MemberDecl Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty ObjDef Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty ParamDecl Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty Storage Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty TagDef Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty Type Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty TypeDef Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty TypeQuals Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty VarDecl Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty VarName Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty Ident Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty SUERef Source # 
Instance details

Defined in Language.C.Analysis.Debug

Pretty CAlignSpec Source # 
Instance details

Defined in Language.C.Pretty

Pretty CArrSize Source # 
Instance details

Defined in Language.C.Pretty

Pretty CAsmOperand Source # 
Instance details

Defined in Language.C.Pretty

Pretty CAsmStmt Source # 
Instance details

Defined in Language.C.Pretty

Pretty CAttr Source # 
Instance details

Defined in Language.C.Pretty

Pretty CBlockItem Source # 
Instance details

Defined in Language.C.Pretty

Pretty CBuiltin Source # 
Instance details

Defined in Language.C.Pretty

Pretty CConst Source # 
Instance details

Defined in Language.C.Pretty

Pretty CDecl Source # 
Instance details

Defined in Language.C.Pretty

Pretty CDeclSpec Source # 
Instance details

Defined in Language.C.Pretty

Pretty CDeclr Source # 
Instance details

Defined in Language.C.Pretty

Pretty CDesignator Source # 
Instance details

Defined in Language.C.Pretty

Pretty CEnum Source # 
Instance details

Defined in Language.C.Pretty

Pretty CExpr Source # 
Instance details

Defined in Language.C.Pretty

Pretty CExtDecl Source # 
Instance details

Defined in Language.C.Pretty

Pretty CFunDef Source # 
Instance details

Defined in Language.C.Pretty

Pretty CFunSpec Source # 
Instance details

Defined in Language.C.Pretty

Pretty CInit Source # 
Instance details

Defined in Language.C.Pretty

Pretty CStat Source # 
Instance details

Defined in Language.C.Pretty

Pretty CStorageSpec Source # 
Instance details

Defined in Language.C.Pretty

Pretty CStrLit Source # 
Instance details

Defined in Language.C.Pretty

Pretty CStructTag Source # 
Instance details

Defined in Language.C.Pretty

Pretty CStructUnion Source # 
Instance details

Defined in Language.C.Pretty

Pretty CTranslUnit Source # 
Instance details

Defined in Language.C.Pretty

Pretty CTypeQual Source # 
Instance details

Defined in Language.C.Pretty

Pretty CTypeSpec Source # 
Instance details

Defined in Language.C.Pretty

Pretty CAssignOp Source # 
Instance details

Defined in Language.C.Pretty

Pretty CBinaryOp Source # 
Instance details

Defined in Language.C.Pretty

Pretty CUnaryOp Source # 
Instance details

Defined in Language.C.Pretty

(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.