aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/python
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/python.lux34
-rw-r--r--new-luxc/source/luxc/lang/translation/python/case.jvm.lux10
-rw-r--r--new-luxc/source/luxc/lang/translation/python/eval.jvm.lux14
-rw-r--r--new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/python/statement.jvm.lux2
5 files changed, 32 insertions, 32 deletions
diff --git a/new-luxc/source/luxc/lang/translation/python.lux b/new-luxc/source/luxc/lang/translation/python.lux
index 3dde69d2a..8dac22fca 100644
--- a/new-luxc/source/luxc/lang/translation/python.lux
+++ b/new-luxc/source/luxc/lang/translation/python.lux
@@ -77,26 +77,26 @@
(Meta Any)
(function (_ compiler)
(#e.Success [(update@ #.host
- (|>> (:! Host)
+ (|>> (:coerce Host)
(set@ #module-buffer (#.Some (StringBuilder::new [])))
- (:! Nothing))
+ (:coerce Nothing))
compiler)
[]])))
(def: #export (with-sub-context expr)
(All [a] (-> (Meta a) (Meta [Text a])))
(function (_ compiler)
- (let [old (:! Host (get@ #.host compiler))
+ (let [old (:coerce Host (get@ #.host compiler))
[old-name old-sub] (get@ #context old)
new-name (format old-name "___" (%i (.int old-sub)))]
(case (expr (set@ #.host
- (:! Nothing (set@ #context [new-name +0] old))
+ (:coerce Nothing (set@ #context [new-name +0] old))
compiler))
(#e.Success [compiler' output])
(#e.Success [(update@ #.host
- (|>> (:! Host)
+ (|>> (:coerce Host)
(set@ #context [old-name (inc old-sub)])
- (:! Nothing))
+ (:coerce Nothing))
compiler')
[new-name output]])
@@ -108,7 +108,7 @@
(function (_ compiler)
(#e.Success [compiler
(|> (get@ #.host compiler)
- (:! Host)
+ (:coerce Host)
(get@ #context)
(let> [name sub]
name))])))
@@ -116,15 +116,15 @@
(def: #export (with-anchor anchor expr)
(All [a] (-> Anchor (Meta a) (Meta a)))
(function (_ compiler)
- (let [old (:! Host (get@ #.host compiler))]
+ (let [old (:coerce Host (get@ #.host compiler))]
(case (expr (set@ #.host
- (:! Nothing (set@ #anchor (#.Some anchor) old))
+ (:coerce Nothing (set@ #anchor (#.Some anchor) old))
compiler))
(#e.Success [compiler' output])
(#e.Success [(update@ #.host
- (|>> (:! Host)
+ (|>> (:coerce Host)
(set@ #anchor (get@ #anchor old))
- (:! Nothing))
+ (:coerce Nothing))
compiler')
output])
@@ -134,7 +134,7 @@
(def: #export anchor
(Meta Anchor)
(function (_ compiler)
- (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor))
+ (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor))
(#.Some anchor)
(#e.Success [compiler anchor])
@@ -144,7 +144,7 @@
(def: #export module-buffer
(Meta StringBuilder)
(function (_ compiler)
- (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer))
+ (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer))
#.None
((lang.throw No-Active-Module-Buffer "") compiler)
@@ -154,13 +154,13 @@
(def: #export program-buffer
(Meta StringBuilder)
(function (_ compiler)
- (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))])))
+ (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))])))
(do-template [<name> <field> <inputT> <outputT>]
[(def: (<name> code)
(-> <inputT> (Meta <outputT>))
(function (_ compiler)
- (let [runner (|> compiler (get@ #.host) (:! Host) (get@ <field>))]
+ (let [runner (|> compiler (get@ #.host) (:coerce Host) (get@ <field>))]
(case (runner code)
(#e.Error error)
((lang.throw Cannot-Execute error) compiler)
@@ -187,7 +187,7 @@
(-> <inputT> (Meta <outputT>))
(do macro.Monad<Meta>
[module-buffer module-buffer
- #let [_ (Appendable::append [(:! CharSequence (<un-wrap> code))]
+ #let [_ (Appendable::append [(:coerce CharSequence (<un-wrap> code))]
module-buffer)]]
(<eval> code)))]
@@ -202,7 +202,7 @@
module-buffer module-buffer
program-buffer program-buffer
#let [module-code (StringBuilder::toString [] module-buffer)
- _ (Appendable::append [(:! CharSequence (format module-code "\n"))]
+ _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))]
program-buffer)]]
(wrap (ioC.write target
(format (lang.normalize-name module) "/" python-module-name)
diff --git a/new-luxc/source/luxc/lang/translation/python/case.jvm.lux b/new-luxc/source/luxc/lang/translation/python/case.jvm.lux
index f51acc402..aedf2a6e1 100644
--- a/new-luxc/source/luxc/lang/translation/python/case.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/case.jvm.lux
@@ -38,7 +38,7 @@
(let [method (if tail?
runtimeT.product//right
runtimeT.product//left)]
- (method source (python.int (:! Int idx)))))
+ (method source (python.int (:coerce Int idx)))))
valueO
pathP))))
@@ -115,23 +115,23 @@
[_ (<tag> value)]
(meta/wrap (python.when! (python.not (python.= (|> value <format>) cursor-top))
fail-pm!)))
- ([#.Nat (<| python.int (:! Int))]
+ ([#.Nat (<| python.int (:coerce Int))]
[#.Int python.int]
- [#.Deg (<| python.int (:! Int))]
+ [#.Deg (<| python.int (:coerce Int))]
[#.Bool python.bool]
[#.Frac python.float]
[#.Text python.string])
(^template [<pm> <getter>]
(^code (<pm> (~ [_ (#.Nat idx)])))
- (meta/wrap (push-cursor! (<getter> cursor-top (python.int (:! Int idx))))))
+ (meta/wrap (push-cursor! (<getter> cursor-top (python.int (:coerce Int idx))))))
(["lux case tuple left" runtimeT.product//left]
["lux case tuple right" runtimeT.product//right])
(^template [<pm> <flag>]
(^code (<pm> (~ [_ (#.Nat idx)])))
(meta/wrap ($_ python.then!
- (python.set! (list $temp) (runtimeT.sum//get cursor-top (python.int (:! Int idx)) <flag>))
+ (python.set! (list $temp) (runtimeT.sum//get cursor-top (python.int (:coerce Int idx)) <flag>))
(python.if! (python.= python.none (@@ $temp))
fail-pm!
(push-cursor! (@@ $temp))))))
diff --git a/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux
index df1e7004c..88fdd3173 100644
--- a/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux
@@ -46,11 +46,11 @@
(def: (tuple lux-object host-object)
(-> (-> PyObject (Error Any)) PyObject (Error Any))
- (let [size (:! Nat (PyObject::__len__ [] host-object))]
+ (let [size (:coerce Nat (PyObject::__len__ [] host-object))]
(loop [idx +0
- output (:! (Array Any) (array.new size))]
+ output (:coerce (Array Any) (array.new size))]
(if (n/< size idx)
- (case (PyObject::__getitem__ [(:! Int idx)] host-object)
+ (case (PyObject::__getitem__ [(:coerce Int idx)] host-object)
(#e.Error error)
(#e.Error error)
@@ -65,7 +65,7 @@
(def: python-type
(-> PyObject Text)
- (|>> (PyObject::getType []) (PyType::getName []) (:! Text)))
+ (|>> (PyObject::getType []) (PyType::getName []) (:coerce Text)))
(def: tag-field (PyString::new [//.variant-tag-field]))
(def: flag-field (PyString::new [//.variant-flag-field]))
@@ -84,9 +84,9 @@
(#e.Success tag)]
[(lux-object value)
(#e.Success value)])
- (#e.Success [(Long::intValue [] (:! Long tag))
+ (#e.Success [(Long::intValue [] (:coerce Long tag))
(: Any
- (case (python-type (:! PyObject flag))
+ (case (python-type (:coerce PyObject flag))
"NoneType"
(host.null)
@@ -127,7 +127,7 @@
(def: #export (eval code)
(-> Expression (Meta Any))
(function (_ compiler)
- (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))]
+ (let [interpreter (|> compiler (get@ #.host) (:coerce //.Host) (get@ #//.interpreter))]
(case (interpreter code)
(#e.Error error)
(exec (log! (format "eval #e.Error\n"
diff --git a/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux
index 7b2ba1786..f1cf731a2 100644
--- a/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux
@@ -13,11 +13,11 @@
(def: #export translate-nat
(-> Nat (Meta Expression))
- (|>> (:! Int) python.int meta/wrap))
+ (|>> (:coerce Int) python.int meta/wrap))
(def: #export translate-deg
(-> Deg (Meta Expression))
- (|>> (:! Int) python.int meta/wrap))
+ (|>> (:coerce Int) python.int meta/wrap))
(def: #export translate-frac
(-> Frac (Meta Expression))
diff --git a/new-luxc/source/luxc/lang/translation/python/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/python/statement.jvm.lux
index 23b51371c..c241afa8a 100644
--- a/new-luxc/source/luxc/lang/translation/python/statement.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/statement.jvm.lux
@@ -34,7 +34,7 @@
(wrap [])
tags
- (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV)))
+ (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV)))
(wrap []))
#let [_ (log! (format "DEF " (%ident def-ident)))]]
(wrap []))