aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/target/python.lux
diff options
context:
space:
mode:
authorEduardo Julian2021-02-01 04:59:32 -0400
committerEduardo Julian2021-02-01 04:59:32 -0400
commit3d457763e34d4dd1992427b3918b351ac684adb7 (patch)
tree5e6ead8ab0c360d6c3eca5765b6be0be782709e2 /stdlib/source/lux/target/python.lux
parent1797521191746640e761cc1b4973d46b8c403dee (diff)
Improved compilation of loops and pattern-matching for Python.
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/target/python.lux17
1 files changed, 13 insertions, 4 deletions
diff --git a/stdlib/source/lux/target/python.lux b/stdlib/source/lux/target/python.lux
index 700dff481..e38694d08 100644
--- a/stdlib/source/lux/target/python.lux
+++ b/stdlib/source/lux/target/python.lux
@@ -339,18 +339,25 @@
(template [<keyword> <0>]
[(def: #export <0>
- Statement
+ (Statement Any)
(:abstraction <keyword>))]
["break" break]
["continue" continue]
)
- (def: #export (while test body!)
- (-> (Expression Any) (Statement Any) Loop)
+ (def: #export (while test body! else!)
+ (-> (Expression Any) (Statement Any) (Maybe (Statement Any)) Loop)
(:abstraction
(format "while " (:representation test) ":"
- (..nest (:representation body!)))))
+ (..nest (:representation body!))
+ (case else!
+ (#.Some else!)
+ (format text.new_line "else:"
+ (..nest (:representation else!)))
+
+ #.None
+ ""))))
(def: #export (for_in var inputs body!)
(-> SVar (Expression Any) (Statement Any) Loop)
@@ -461,6 +468,8 @@
["int"]
["len"]
["chr"]
+ ["unichr"]
+ ["unicode"]
["repr"]
["__import__"]
["Exception"]]]