aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/target/python.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/target/python.lux')
-rw-r--r--stdlib/source/lux/target/python.lux17
1 files changed, 15 insertions, 2 deletions
diff --git a/stdlib/source/lux/target/python.lux b/stdlib/source/lux/target/python.lux
index e27ae9b83..1ae1cca64 100644
--- a/stdlib/source/lux/target/python.lux
+++ b/stdlib/source/lux/target/python.lux
@@ -1,5 +1,7 @@
(.module:
[lux (#- Location Code not or and list if cond int comment exec)
+ ["@" target]
+ ["." host]
[abstract
[equivalence (#+ Equivalence)]
[hash (#+ Hash)]
@@ -28,10 +30,21 @@
(-> Text Text)
(text.enclose ["(" ")"]))
+(for {@.old (as_is (host.import: java/lang/CharSequence)
+ (host.import: java/lang/String
+ ["#::."
+ (replace [java/lang/CharSequence java/lang/CharSequence] java/lang/String)]))}
+ (as_is))
+
(def: nest
(-> Text Text)
- (|>> (format text.new_line)
- (text.replace_all text.new_line (format text.new_line text.tab))))
+ (.let [nested_new_line (format text.new_line text.tab)]
+ (for {@.old (|>> (format text.new_line)
+ (:coerce java/lang/String)
+ (java/lang/String::replace (:coerce java/lang/CharSequence text.new_line)
+ (:coerce java/lang/CharSequence nested_new_line)))}
+ (|>> (format text.new_line)
+ (text.replace_all text.new_line nested_new_line)))))
(abstract: #export (Code brand)
Text