diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-07-13 11:47:22 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-07-13 11:47:22 +0200 |
commit | eb5f5dd3f3f408ccb9f62303f031efc8454fd5de (patch) | |
tree | 500c176dc33dbfd6a099d774c71a9d0b32fc4f28 /module/c/preprocessor2.scm | |
parent | Fix _Pragma, and non-standard pragma directives. (diff) | |
download | calp-eb5f5dd3f3f408ccb9f62303f031efc8454fd5de.tar.gz calp-eb5f5dd3f3f408ccb9f62303f031efc8454fd5de.tar.xz |
Resolve #ifdef, #ifndef, #else, #endif.
Diffstat (limited to 'module/c/preprocessor2.scm')
-rw-r--r-- | module/c/preprocessor2.scm | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/module/c/preprocessor2.scm b/module/c/preprocessor2.scm index 2677c42e..28d11901 100644 --- a/module/c/preprocessor2.scm +++ b/module/c/preprocessor2.scm @@ -633,12 +633,18 @@ ((if) resolve-for-if) ((ifdef) (lambda (env body) - (if (in-environment? env (identifier-token? (car body))) - enter-active-if enter-inactive-if))) + ((if (in-environment? env (identifier-token? (car body))) + enter-active-if enter-inactive-if) + env))) ((ifndef) (lambda (env body) - (if (in-environment? env (identifier-token? (car body))) - enter-inactive-if enter-active-if))) + ((if (in-environment? env (identifier-token? (car body))) + enter-inactive-if enter-active-if) + env))) + ;; NOTE possibly validate that body is empty for endif and else + ((endif) (lambda (env _) (leave-if env))) + ((else) (lambda (env _) (flip-flop-if env))) + ;; ((elif) (lambda )) ((define) resolve-define) ((undef) (lambda (env body) (remove-identifier env (identifier-token? (car body))))) ((line) handle-line-directive) |