| language-c-0.3.1.1: Analysis and generation of C code | Contents | Index

Language.C.Pretty

Portability | portable
Stability | experimental
Maintainer | benedikt.huber@gmail.com

Contents

Pretty Printing
Testing

Description
This module provides a pretty printer for the parse tree (Language.C.Syntax.AST).
Synopsis

class Pretty p where

pretty :: p -> Doc
prettyPrec :: Int -> p -> Doc

prettyUsingInclude :: CTranslUnit -> Doc

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 |
Pretty CBinaryOp |
Pretty CAssignOp |
Pretty Ident |
Pretty SUERef |
Pretty CStrLit |
Pretty CConst |
Pretty CBuiltin |
Pretty CExpr |
Pretty CAttr |
Pretty CDesignator |
Pretty CInit |
Pretty CEnum |
Pretty CStructTag |
Pretty CStructUnion |
Pretty CTypeQual |
Pretty CTypeSpec |
Pretty CStorageSpec |
Pretty CDeclSpec |
Pretty CBlockItem |
Pretty CAsmOperand |
Pretty CAsmStmt |
Pretty CStat |
Pretty CArrSize |
Pretty CDeclr |
Pretty CDecl |
Pretty CFunDef |
Pretty CExtDecl |
Pretty CTranslUnit |
Pretty Attributes |
Pretty Attr |
Pretty VarName |
Pretty TypeQuals |
Pretty Enumerator |
Pretty EnumType |
Pretty CompType |
Pretty Type |
Pretty Linkage |
Pretty Storage |
Pretty DeclAttrs |
Pretty VarDecl |
Pretty TypeDef |
Pretty MemberDecl |
Pretty ParamDecl |
Pretty FunDef |
Pretty ObjDef |
Pretty Decl |
Pretty GlobalDecls |
Pretty IdentDecl |
Pretty TagDef |
Pretty (Either VarDecl FunDef) |
Pretty (Either VarDecl ObjDef) |

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 usefull for testing, as otherwise the pretty printed file will be cluttered with declarations from system headers.
Produced by Haddock version 2.7.2