ghc-exactprint-1.7.0.1: ExactPrint for GHC

Safe Haskell | Safe-Inferred
Language | Haskell2010

Language.Haskell.GHC.ExactPrint.Preprocess

Description

This module provides support for CPP, interpreter directives and line pragmas.

Synopsis

- stripLinePragmas :: String -> (String, [LEpaComment])
- getCppTokensAsComments :: GhcMonad m => CppOptions -> FilePath -> m [LEpaComment]
- getPreprocessedSrcDirect :: GhcMonad m => CppOptions -> FilePath -> m (String, DynFlags)
- readFileGhc :: FilePath -> IO String
- data CppOptions = CppOptions {
  - cppDefine :: [String]
  - cppInclude :: [FilePath]
  - cppFile :: [FilePath]
  }
- defaultCppOptions :: CppOptions
- showErrorMessages :: Diagnostic a => Messages a -> String

# Documentation

stripLinePragmas :: String -> (String, [LEpaComment]) #

Remove GHC style line pragams (`{-# LINE .. #-}`) and convert them into comments.

getCppTokensAsComments #

Arguments

:: GhcMonad m |
=> CppOptions | Preprocessor Options
-> FilePath | Path to source file
-> m [LEpaComment] |

Replacement for original `getRichTokenStream` which will return the tokens for a file processed by CPP. See bug http://ghc.haskell.org/trac/ghc/ticket/8265

getPreprocessedSrcDirect :: GhcMonad m => CppOptions -> FilePath -> m (String, DynFlags) #

readFileGhc :: FilePath -> IO String #

data CppOptions #

Constructors

CppOptions |

Fields

- cppDefine :: [String]

  CPP #define macros

- cppInclude :: [FilePath]

  CPP Includes directory

- cppFile :: [FilePath]

  CPP pre-include file

defaultCppOptions :: CppOptions #

showErrorMessages :: Diagnostic a => Messages a -> String #