summaryrefslogtreecommitdiff
path: root/modules/language/python/compile.scm
diff options
context:
space:
mode:
Diffstat (limited to 'modules/language/python/compile.scm')
-rw-r--r--modules/language/python/compile.scm15
1 files changed, 14 insertions, 1 deletions
diff --git a/modules/language/python/compile.scm b/modules/language/python/compile.scm
index 5dbd3e6..af9e137 100644
--- a/modules/language/python/compile.scm
+++ b/modules/language/python/compile.scm
@@ -18,6 +18,7 @@
#:use-module (language python dir)
#:use-module (language python procedure)
#:use-module (language python bool)
+ #:use-module ((language python format2) #:select (perform-formatters init-formatters))
#:use-module ((language python with) #:select ())
#:use-module (ice-9 pretty-print)
#:export (comp))
@@ -25,6 +26,7 @@
(define-syntax-rule (aif it p x y) (let ((it p)) (if it x y)))
(define-inlinable (C x) `(@@ (language python compile) ,x))
+(define-inlinable (F2 x) `(@@ (language python format2) ,x))
(define-inlinable (N x) `(@@ (language python number) ,x))
(define-inlinable (Y x) `(@@ (language python yield) ,x))
(define-inlinable (T x) `(@@ (language python try) ,x))
@@ -748,6 +750,12 @@
(cons (N 'py-/) (map (g vs exp) l))))
(#:%
+ ((_ s a)
+ (let ((s (exp vs s))
+ (a (exp vs a)))
+ (if (string? s)
+ (list (F2 'format) s a)
+ (list (N 'py-mod) s a))))
((_ . l)
(cons (N 'py-mod) (map (g vs exp) l))))
@@ -1491,8 +1499,10 @@
,@start
,(C 'clear-warning-data)
(fluid-set! (@@ (system base message) %dont-warn-list) '())
+ (,(C 'init-formatters))
,@(map (lambda (s) `(,(C 'var) ,s)) globs)
,@(map (g globs exp) x)
+ (,(C 'perform-formatters))
(,(C 'export-all)))))
(begin
(if (fluid-ref (@@ (system base compile) %in-compile))
@@ -1502,13 +1512,16 @@
(if (pair? start)
(set! x (cdr x)))
- (let ((globs (get-globals x)))
+ (let ((globs (get-globals x))
+ (res (gensym "res")))
`(begin
,@start
,(C 'clear-warning-data)
(fluid-set! (@@ (system base message) %dont-warn-list) '())
,@(map (lambda (s) `(,(C 'var) ,s)) globs)
,@(map (g globs exp) x))))))
+
+
(define-syntax-parameter break