aboutsummaryrefslogtreecommitdiff
path: root/module/c/cpp-environment.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-07-11 01:10:19 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-07-11 01:10:19 +0200
commit35b7888c9b5f217dd2911c0ba93519df36e97922 (patch)
treee8f8945d7bcc65b146006763eda1097e20f8cc4c /module/c/cpp-environment.scm
parentFix #line (diff)
downloadcalp-35b7888c9b5f217dd2911c0ba93519df36e97922.tar.gz
calp-35b7888c9b5f217dd2911c0ba93519df36e97922.tar.xz
Rewrite handel-preprocessing-tokens.
Diffstat (limited to 'module/c/cpp-environment.scm')
-rw-r--r--module/c/cpp-environment.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/module/c/cpp-environment.scm b/module/c/cpp-environment.scm
index 2ad60b56..2a943496 100644
--- a/module/c/cpp-environment.scm
+++ b/module/c/cpp-environment.scm
@@ -19,7 +19,9 @@
enter-active-if
enter-inactive-if
+ flip-flop-if
leave-if
+ in-comment-block?
enter-file
leave-file
@@ -97,9 +99,19 @@
(define (enter-inactive-if environment)
(modify environment cpp-if-status xcons 'inactive-if))
+;; for #else
+(define (flip-flop-if environment)
+ ((if (in-comment-block? environment)
+ enter-active-if
+ enter-inactive-if)
+ (leave-if environment)))
+
(define (leave-if environment)
(modify environment cpp-if-status cdr))
+(define (in-comment-block? environment)
+ (eq? 'inactive-if (get environment cpp-if-status car*)))
+
(define (enter-file environment filename)