The part for the GHC_CPP extension to actually process the CPP directives.
See the proposal
This is intended to be integrated into GHC itself, and the work is on this branch
The interface to GHC works as follows
-
A modified lexer recognises and emits two additional token types
- A prepreocessor directive line
- A CPP comment (needed for backward compatibility)
-
We have a preprocessor interposed between the GHC parser and the GHC lexer. This processes the directive lines, and keeps its own state as to whether to pass on or ignore normal tokens.
This part deals with processing the preprocessor directive lines, and providing a state which can answer the question: should this token be ignored or not.