Copyright | 2004 Malcolm Wallace |
---|---|
License | LGPL |
Maintainer | Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk> |
Stability | experimental |
Portability | All |
Safe Haskell | Safe-Inferred |
Language | Haskell98 |
Language.Preprocessor.Cpphs.HashDefine
Description
What structures are declared in a #define.
Synopsis
- 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 # | |
Defined in Language.Preprocessor.Cpphs.HashDefine | |
Show HashDefine # | |
Defined in Language.Preprocessor.Cpphs.HashDefine Methods showsPrec :: Int -> HashDefine -> ShowS show :: HashDefine -> String showList :: [HashDefine] -> ShowS |
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.