summaryrefslogtreecommitdiff
path: root/modules/language/python/compile.scm
diff options
context:
space:
mode:
authorStefan Israelsson Tampe <stefan.itampe@gmail.com>2018-03-21 20:27:34 +0100
committerStefan Israelsson Tampe <stefan.itampe@gmail.com>2018-03-21 20:27:34 +0100
commitdc9f37567dae95b4eedcb967fa1b2add3fad86c2 (patch)
tree2309ea04c319749dae4f476c5bba058194650d10 /modules/language/python/compile.scm
parentebd4217a508490554aa0419de3720be6156be5df (diff)
parent083cdb005f11b69ce5642960e724ddf281f41032 (diff)
Merge branch 'master' of gitlab.com:python-on-guile/python-on-guile
Diffstat (limited to 'modules/language/python/compile.scm')
-rw-r--r--modules/language/python/compile.scm32
1 files changed, 22 insertions, 10 deletions
diff --git a/modules/language/python/compile.scm b/modules/language/python/compile.scm
index 8fe13cf..b00f304 100644
--- a/modules/language/python/compile.scm
+++ b/modules/language/python/compile.scm
@@ -14,6 +14,7 @@
#:use-module (language python bytes)
#:use-module (language python number)
#:use-module (language python def)
+ #:use-module (language python module)
#:use-module ((language python with) #:select ())
#:use-module (ice-9 pretty-print)
#:export (comp))
@@ -27,7 +28,6 @@
(define-inlinable (F x) `(@@ (language python for) ,x))
(define-inlinable (E x) `(@@ (language python exceptions) ,x))
(define-inlinable (L x) `(@@ (language python list) ,x))
-(define-inlinable (A x) `(@@ (language python array) ,x))
(define-inlinable (S x) `(@@ (language python string) ,x))
(define-inlinable (B x) `(@@ (language python bytes) ,x))
(define-inlinable (Se x) `(@@ (language python set) ,x))
@@ -338,6 +338,7 @@
((isspace) (S 'py-isspace))
((isupper) (S 'py-isupper))
((istitle) (S 'py-istitle))
+ ((isidentifier) (S 'py-identifier))
((join) (S 'py-join ))
((ljust) (S 'py-join ))
((rljust) (S 'py-rljust ))
@@ -822,9 +823,19 @@
((_ (#:from (() . nm) . #f))
`(use-modules (language python module ,@(map (lambda (nm) (exp vs nm))
nm))))
+ ((_ (#:from (() . nm) . l))
+ `(use-modules ((language python module ,@(map (lambda (nm) (exp vs nm))
+ nm))
+ #:select ,(map (lambda (x)
+ (match x
+ ((a . #f)
+ (exp vs a))
+ ((a . b)
+ (cons (exp vs a) (exp vs b)))))
+ l))))
+
((_ (#:name ((ids ...) . as)) ...)
- (pk x)
`(begin
,@(map
(lambda (ids as)
@@ -836,20 +847,21 @@
((#:test (#:power #f ,as ())))
(#:assign
((#:verb
- ((@ (language python module) Module)
- ',(reverse (append '(language python module) path))
- ',(reverse path)))))))
-
+ ((@ (language python module) import)
+ ((@ (language python module) Module)
+ ',(reverse (append '(language python module) path))
+ ',(reverse path))
+ ,(exp vs as)))))))
(exp
vs
`(#:expr-stmt
((#:test (#:power #f ,(car ids) ())))
(#:assign
((#:verb
- (((@ (language python module) import)
- ((@ (language python module) Module)
- ',(append '(language python module) path))
- ,(exp vs (car ids))))))))))))
+ ((@ (language python module) import)
+ ((@ (language python module) Module)
+ ',(append '(language python module) path))
+ ,(exp vs (car ids)))))))))))
ids as))))
(#:for