diff options
Diffstat (limited to 'chicken-scratch.mod.scm')
-rwxr-xr-x | chicken-scratch.mod.scm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/chicken-scratch.mod.scm b/chicken-scratch.mod.scm index e47ad67..0ba704e 100755 --- a/chicken-scratch.mod.scm +++ b/chicken-scratch.mod.scm | |||
@@ -27,8 +27,7 @@ | |||
27 | (module chicken-scratch | 27 | (module chicken-scratch |
28 | (expand-string | 28 | (expand-string |
29 | expand-port | 29 | expand-port |
30 | def | 30 | def %def/replacer) |
31 | %def/replacer) | ||
32 | 31 | ||
33 | (import scheme | 32 | (import scheme |
34 | (chicken base) | 33 | (chicken base) |
@@ -50,13 +49,16 @@ | |||
50 | (let* ((delim (random-string-not-in str)) | 49 | (let* ((delim (random-string-not-in str)) |
51 | (template (make-concatenated-port | 50 | (template (make-concatenated-port |
52 | (open-input-string (string-append "#<#" delim "\n")) | 51 | (open-input-string (string-append "#<#" delim "\n")) |
53 | (open-input-string (irregex-replace "^#!.*\n" str "")) | 52 | (open-input-string "#(import chicken-scratch)") |
53 | (open-input-string str) | ||
54 | (open-input-string (string-append "\n" delim "\n")))) | 54 | (open-input-string (string-append "\n" delim "\n")))) |
55 | (expanded (open-output-string)) | 55 | (expanded (open-output-string)) |
56 | (output (begin | 56 | (output (begin |
57 | (display (eval (read template)) expanded) | 57 | (display (eval (read template)) expanded) |
58 | (get-output-string expanded)))) | 58 | (get-output-string expanded)))) |
59 | (irregex-replace/all `(seq ,(%def/replacer) (* "\n")) | 59 | (irregex-replace/all `(: (or "#<unspecified>" |
60 | ,(%def/replacer)) | ||
61 | (* whitespace)) | ||
60 | output | 62 | output |
61 | "")))) | 63 | "")))) |
62 | 64 | ||