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

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 CUnaryOp # 

Methods

pretty :: CUnaryOp -> Doc #

prettyPrec :: Int -> CUnaryOp -> Doc #

Pretty CBinaryOp # 
Pretty CAssignOp # 
Pretty CStrLit # 

Methods

pretty :: CStrLit -> Doc #

prettyPrec :: Int -> CStrLit -> Doc #

Pretty CConst # 

Methods

pretty :: CConst -> Doc #

prettyPrec :: Int -> CConst -> Doc #

Pretty CBuiltin # 

Methods

pretty :: CBuiltin -> Doc #

prettyPrec :: Int -> CBuiltin -> Doc #

Pretty CExpr # 

Methods

pretty :: CExpr -> Doc #

prettyPrec :: Int -> CExpr -> Doc #

Pretty CAttr # 

Methods

pretty :: CAttr -> Doc #

prettyPrec :: Int -> CAttr -> Doc #

Pretty CDesignator # 
Pretty CInit # 

Methods

pretty :: CInit -> Doc #

prettyPrec :: Int -> CInit -> Doc #

Pretty CEnum # 

Methods

pretty :: CEnum -> Doc #

prettyPrec :: Int -> CEnum -> Doc #

Pretty CStructTag # 
Pretty CStructUnion # 
Pretty CAlignSpec # 
Pretty CFunSpec # 

Methods

pretty :: CFunSpec -> Doc #

prettyPrec :: Int -> CFunSpec -> Doc #

Pretty CTypeQual # 
Pretty CTypeSpec # 
Pretty CStorageSpec # 
Pretty CDeclSpec # 
Pretty CBlockItem # 
Pretty CAsmOperand # 
Pretty CAsmStmt # 

Methods

pretty :: CAsmStmt -> Doc #

prettyPrec :: Int -> CAsmStmt -> Doc #

Pretty CStat # 

Methods

pretty :: CStat -> Doc #

prettyPrec :: Int -> CStat -> Doc #

Pretty CArrSize # 

Methods

pretty :: CArrSize -> Doc #

prettyPrec :: Int -> CArrSize -> Doc #

Pretty CDeclr # 

Methods

pretty :: CDeclr -> Doc #

prettyPrec :: Int -> CDeclr -> Doc #

Pretty CDecl # 

Methods

pretty :: CDecl -> Doc #

prettyPrec :: Int -> CDecl -> Doc #

Pretty CFunDef # 

Methods

pretty :: CFunDef -> Doc #

prettyPrec :: Int -> CFunDef -> Doc #

Pretty CExtDecl # 

Methods

pretty :: CExtDecl -> Doc #

prettyPrec :: Int -> CExtDecl -> Doc #

Pretty CTranslUnit # 

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.