Copyright | Copyright (c) 2007 Bertram Felgenhauer (c) 2008 Benedikt Huber |
---|---|
License | BSD-style |
Maintainer | benedikt.huber@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
This module provides a pretty printer for the parse tree
(AST
).
- class Pretty p where
- pretty :: p -> Doc
- prettyPrec :: Int -> p -> Doc
- prettyUsingInclude :: CTranslUnit -> Doc
Pretty Printing
A class of types which can be pretty printed
Nothing
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
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.