Portability | All |
---|---|
Stability | experimental |
Maintainer | Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk> |
Safe Haskell | Safe-Inferred |
Language.Preprocessor.Cpphs.HashDefine
Description
What structures are declared in a #define.
- data HashDefine
- = LineDrop {
- name :: String
- | Pragma {
- name :: String
- | AntiDefined {
- name :: String
- linebreaks :: Int
- | SymbolReplacement {
- name :: String
- replacement :: String
- linebreaks :: Int
- | MacroExpansion {
- name :: String
- arguments :: [String]
- expansion :: [(ArgOrText, String)]
- linebreaks :: Int
- = LineDrop {
- data ArgOrText
- expandMacro :: HashDefine -> [String] -> Bool -> String
- parseHashDefine :: Bool -> [String] -> Maybe HashDefine
- simplifyHashDefines :: [HashDefine] -> [(String, String)]
Documentation
data HashDefine
Constructors
LineDrop | |
Fields
| |
Pragma | |
Fields
| |
AntiDefined | |
Fields
| |
SymbolReplacement | |
Fields
| |
MacroExpansion | |
Fields
|
Instances
Eq HashDefine | |
Show HashDefine |
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).
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.