hpp-0.6.4: A Haskell pre-processor
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hpp.Config

Description

Preprocessor Configuration

Synopsis

Documentation

newtype TimeString Source #

A String representing a time.

Constructors

TimeString 

Instances

Instances details
Eq TimeString Source # 
Instance details

Defined in Hpp.Config

Ord TimeString Source # 
Instance details

Defined in Hpp.Config

Show TimeString Source # 
Instance details

Defined in Hpp.Config

newtype DateString Source #

A String representing a date.

Constructors

DateString 

Instances

Instances details
Eq DateString Source # 
Instance details

Defined in Hpp.Config

Ord DateString Source # 
Instance details

Defined in Hpp.Config

Show DateString Source # 
Instance details

Defined in Hpp.Config

data ConfigF f Source #

Pre-processor configuration parameterized over a functor. This is used to normalize partial configurations, ConfigF Maybe, and configurations suitable for the pre-processor logic, ConfigF Identity. Specifically, the source file name of the file being processed must be set.

Constructors

Config 

Fields

  • curFileNameF :: f FilePath

    Name of the file being preprocessed. Hpp will update this as new files are included. The user must set it manually for the starting input file.

  • includePathsF :: f [FilePath]

    Paths to be searched for included files.

  • spliceLongLinesF :: f Bool

    A backslash as the last character of a line causes the next line to be appended to the current one eliding the newline character present in the source input.

  • eraseCCommentsF :: f Bool

    Erase line comments (starting with //) and block comments (delimited by /* and */).

  • inhibitLinemarkersF :: f Bool

    Do not emit #line directives.

  • replaceTrigraphsF :: f Bool

    Replace trigraph sequences (each of which starts with two consecutive question marks ("??") with the characters they encode.

  • prepDateF :: f DateString

    Format string for __DATE__.

  • prepTimeF :: f TimeString

    Format string for __TIME__.

Instances

Instances details
Show (ConfigF Identity) Source # 
Instance details

Defined in Hpp.Config

type Config = ConfigF Identity Source #

A fully-populated configuration for the pre-processor.

realizeConfig :: ConfigF Maybe -> Maybe Config Source #

Ensure that required configuration fields are supplied.

curFileName :: Config -> FilePath Source #

Extract the current file name from a configuration.

includePaths :: Config -> [FilePath] Source #

Extract the include paths name from a configuration.

spliceLongLines :: Config -> Bool Source #

Determine if continued long lines should be spliced.

eraseCComments :: Config -> Bool Source #

Determine if C-style comments should be erased.

inhibitLinemarkers :: Config -> Bool Source #

Determine if generation of linemarkers should be inhibited.

replaceTrigraphs :: Config -> Bool Source #

Determine if trigraph sequences should be replaced.

prepDate :: Config -> DateString Source #

The date the pre-processor was run on.

prepTime :: Config -> TimeString Source #

The time of the active pre-processor invocation.

defaultConfigF :: ConfigF Maybe Source #

A default configuration with no current file name set. Note that long line splicing is enabled, C++-style comments are erased, #line markers are inhibited, and trigraph replacement is disabled.

formatPrepDate :: UTCTime -> DateString Source #

Format a date according to the C spec.

formatPrepTime :: UTCTime -> TimeString Source #

Format a time according to the C spec.

defaultConfigFNow :: IO (ConfigF Maybe) Source #

A default preprocessor configuration with date and time stamps taken from the current system time.

Lens-like accessors for Config

spliceLongLinesL :: Functor f => (Bool -> f Bool) -> Config -> f Config Source #

Lens for the "splice long lines" option (prepend a line ending with a backslash to the next line).

eraseCCommentsL :: Functor f => (Bool -> f Bool) -> Config -> f Config Source #

Lens for the "erase C-style comments" option (comments delimited by /* and */).

inhibitLinemarkersL :: Functor f => (Bool -> f Bool) -> Config -> f Config Source #

Lens for the "inhibit line markers" option. Option to disable the emission of #line pragmas in the output.

replaceTrigraphsL :: Functor f => (Bool -> f Bool) -> Config -> f Config Source #

Lens for the "replace trigraphs" option.