cpphs

PortabilityAll
Stabilityexperimental
MaintainerMalcolm Wallace <Malcolm.Wallace@cs.york.ac.uk>
Safe HaskellSafe-Inferred

Language.Preprocessor.Cpphs.HashDefine

Description

What structures are declared in a #define.

Synopsis

Documentation

data HashDefine

Constructors

LineDrop 

Fields

name :: String
 
Pragma 

Fields

name :: String
 
AntiDefined 

Fields

name :: String
 
linebreaks :: Int
 
SymbolReplacement 

Fields

name :: String
 
replacement :: String
 
linebreaks :: Int
 
MacroExpansion 

Fields

name :: String
 
arguments :: [String]
 
expansion :: [(ArgOrText, String)]
 
linebreaks :: Int
 

Instances

data ArgOrText

Macro expansion text is divided into sections, each of which is classified as one of three kinds: a formal argument (Arg), plain text (Text), or a stringised formal argument (Str).

Constructors

Arg 
Text 
Str 

Instances

Eq ArgOrText 
Show ArgOrText 

expandMacro :: HashDefine -> [String] -> Bool -> String

Expand an instance of a macro. Precondition: got a match on the macro name.

parseHashDefine :: Bool -> [String] -> Maybe HashDefine

Parse a #define, or #undef, ignoring other # directives

simplifyHashDefines :: [HashDefine] -> [(String, String)]

Pretty-print hash defines to a simpler format, as key-value pairs.