Modulecpphs-1.20.9.1Haskell98
Language.Preprocessor.Cpphs
Include the interface that is exported
- 4 types
- 24 values
- Packagecpphs-1.20.9.1
- Exports28
- LanguageHaskell98
- LicenceLicenseRef-LGPL
- SourceCpphs.hs
cppIfdef Run a first pass of cpp, evaluating #ifdef's and processing #include's, whilst taking account of #define's and #undef's as we encounter them.
tokenise is, broadly-speaking, Prelude.words, except that: * the input is already divided into lines * each word-like "token" is categorised as one of {Ident,Other,Cmd} * #define's are parsed and returned out-of-band using the Cmd variant * All whitespace is preserved intact as tokens. * C-comments are converted to white-space (depending on first param) * Parens and commas are tokens in their own right. * Any cpp line continuations are respected. No errors can be raised. The inverse of tokenise is (concatMap deWordStyle).
Each token is classified as one of Ident, Other, or Cmd: * Ident is a word that could potentially match a macro name. * Cmd is a complete cpp directive (#define etc). * Other is anything else.
macroPass Walk through the document, replacing calls of macros with the expanded RHS.
Walk through the document, replacing calls of macros with the expanded RHS. Additionally returns the active symbol table after processing.
Cpphs options structure.
Constructors
Instances1Show
Show CpphsOptionsDefined in cpphs-1.20.9.1 · Language.Preprocessor.Cpphs.Options
Options representable as Booleans.
Constructors
BoolOptionsmacros :: BoolLeave #define and #undef in output of ifdef?
locations :: BoolPlace #line droppings in output?
hashline :: BoolWrite #line or {-# LINE #-} ?
pragma :: BoolKeep #pragma in final output?
stripEol :: BoolRemove C eol (//) comments everywhere?
stripC89 :: BoolRemove C inline (/**/) comments everywhere?
lang :: BoolLex input as Haskell code?
ansi :: BoolPermit stringise # and catenate ## operators?
layout :: BoolRetain newlines in macro expansions?
literate :: BoolRemove literate markup?
warnings :: BoolIssue warnings?
Instances1Show
Show BoolOptionsDefined in cpphs-1.20.9.1 · Language.Preprocessor.Cpphs.Options
Parse all command-line options.
Default options.
Default settings of boolean options.
Project the directory of the filename.
Source positions contain a filename, line, column, and an inclusion point, which is itself another source position, recursively.
Constructor. Argument is filename.
Increment row number, reset column to 1.
Increment row number by given quantity.
cpp-style printing of file position
Conversion from a cpp-style "#line" to haskell-style pragma.
Update position with a new row, and possible filename.
Project the filename.
Project the line number.
Increment column number by given quantity.
Increment column number, tab stops are every 8 chars.
haskell-style printing of file position
Sigh. Mixing Windows filepaths with unix is bad. Make sure there is a canonical path separator.