language-c-0.7.0: 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 Source #

A class of types which can be pretty printed

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

Pretty CUnaryOp Source # 
Pretty CBinaryOp Source # 
Pretty CAssignOp Source # 
Pretty CStrLit Source # 
Pretty CConst Source # 
Pretty CBuiltin Source # 
Pretty CExpr Source # 
Pretty CAttr Source # 
Pretty CDesignator Source # 
Pretty CInit Source # 
Pretty CEnum Source # 
Pretty CStructTag Source # 
Pretty CStructUnion Source # 
Pretty CAlignSpec Source # 
Pretty CFunSpec Source # 
Pretty CTypeQual Source # 
Pretty CTypeSpec Source # 
Pretty CStorageSpec Source # 
Pretty CDeclSpec Source # 
Pretty CBlockItem Source # 
Pretty CAsmOperand Source # 
Pretty CAsmStmt Source # 
Pretty CStat Source # 
Pretty CArrSize Source # 
Pretty CDeclr Source # 
Pretty CDecl Source # 
Pretty CFunDef Source # 
Pretty CExtDecl Source # 
Pretty CTranslUnit 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.