diff options
Diffstat (limited to '')
-rw-r--r-- | module/c/preprocessor2.scm | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/module/c/preprocessor2.scm b/module/c/preprocessor2.scm index e4590d41..e63103dc 100644 --- a/module/c/preprocessor2.scm +++ b/module/c/preprocessor2.scm @@ -29,6 +29,7 @@ ;; defined-macro c-search-path handle-preprocessing-tokens + cpp preprocess-string make-default-environment )) @@ -734,7 +735,7 @@ ((pragma) handle-pragma) (else (throw 'propagate "Unknown preprocessing directive: ~s" - (list line-tokens)))))) + (list (unlex line-tokens))))))) (-> environment (op body) (loop remaining-tokens)))))))))) @@ -822,12 +823,16 @@ (value-ref 0))) -(define* (preprocess-string str optional: (environment (make-default-environment))) +;; partial pre-process, useful for running just the preprocessor interactivly +(define* (cpp str optional: (environment (make-default-environment))) (->> str ;;; Phase 1-3 tokenize ;;; 4. Execution of preprocessing directives, all preprocessing directives are then deleted - (handle-preprocessing-tokens environment) + (handle-preprocessing-tokens environment))) + +(define* (preprocess-string str optional: (environment (make-default-environment))) + (->> (cpp str environment) abort* ;;; 5. (something with character sets) ;;; 7. Whitespace tokens are discarded, each preprocessing token is converted into a token |