File: design

package info (click to toggle)
cpphs 1.18.5-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 812 kB
  • ctags: 21
  • sloc: haskell: 1,707; sh: 120; makefile: 49; ansic: 11
file content (29 lines) | stat: -rwxr-xr-x 1,098 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Design for hspp

First pass:
-----------
  * traverse the file,
      - processing #if's and #ifdef's
      - reading #include's and recursively doing this pass on them
      - leaving #line's behind
      - whilst taking account of #define's and #undef's
  * only needs to look at lines beginning with a #
  * should discard C-style comments?  (no)
  * DO NOT gather the #define's for macros - their sequence matters!

pass1 :: SymTab -> String -> String

Second pass:
------------
  * traverse the residual file,
      - keeping track of #define'd macros
      - expanding #define'd macros when an instance is encountered
  * needs a whitespace-preserving tokeniser with odd rules to
    cover e.g. token concatenation.  Within Haskell, quotation marks start
    strings, haskell comments are preserved.  Within a cpp directive,
    quotation marks do not start a string, and C-style comments are
    converted to whitespace.
  * Line continuation characters are tricky; probably should only
    be recognised within a macro definition, not in ordinary code.

pass2 :: SymTab -> String -> String