aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/php
diff options
context:
space:
mode:
authorEduardo Julian2018-07-03 18:40:16 -0400
committerEduardo Julian2018-07-03 18:40:16 -0400
commitd3f5e1f4baa667bc2eb72edd542cf5d8cd3924ce (patch)
tree2aa771401cce0d08276abc072b9d31e00a651f29 /new-luxc/source/luxc/lang/translation/php
parentbfd2d6c203042dfddb0ce29db3696365fe213314 (diff)
- Re-named ":!" to ":coerce".
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/php.lux34
-rw-r--r--new-luxc/source/luxc/lang/translation/php/case.jvm.lux10
-rw-r--r--new-luxc/source/luxc/lang/translation/php/eval.jvm.lux32
-rw-r--r--new-luxc/source/luxc/lang/translation/php/expression.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/php/reference.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/php/statement.jvm.lux2
6 files changed, 43 insertions, 43 deletions
diff --git a/new-luxc/source/luxc/lang/translation/php.lux b/new-luxc/source/luxc/lang/translation/php.lux
index 8ee0f9c14..fe4e6095c 100644
--- a/new-luxc/source/luxc/lang/translation/php.lux
+++ b/new-luxc/source/luxc/lang/translation/php.lux
@@ -80,26 +80,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]])
@@ -111,7 +111,7 @@
(function (_ compiler)
(#e.Success [compiler
(|> (get@ #.host compiler)
- (:! Host)
+ (:coerce Host)
(get@ #context)
(let> [name sub]
name))])))
@@ -119,15 +119,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])
@@ -137,7 +137,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])
@@ -147,7 +147,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)
@@ -157,13 +157,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)
@@ -189,7 +189,7 @@
(-> Statement (Meta Any))
(do macro.Monad<Meta>
[module-buffer module-buffer
- #let [_ (Appendable::append [(:! CharSequence (_.code code))]
+ #let [_ (Appendable::append [(:coerce CharSequence (_.code code))]
module-buffer)]]
(load! code)))
@@ -200,7 +200,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) "/" ..module-name)
diff --git a/new-luxc/source/luxc/lang/translation/php/case.jvm.lux b/new-luxc/source/luxc/lang/translation/php/case.jvm.lux
index 3a5eff053..6f78637cf 100644
--- a/new-luxc/source/luxc/lang/translation/php/case.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/php/case.jvm.lux
@@ -39,7 +39,7 @@
(let [method (if tail?
runtimeT.product//right
runtimeT.product//left)]
- (method source (_.int (:! Int idx)))))
+ (method source (_.int (:coerce Int idx)))))
valueO
pathP))))
@@ -114,22 +114,22 @@
[_ (<tag> value)]
(meta/wrap (_.when! (_.not (_.= (|> value <format>) cursor-top))
fail-pm!)))
- ([#.Nat (<| _.int (:! Int))]
+ ([#.Nat (<| _.int (:coerce Int))]
[#.Int _.int]
- [#.Deg (<| _.int (:! Int))]
+ [#.Deg (<| _.int (:coerce Int))]
[#.Bool _.bool]
[#.Frac _.float]
[#.Text _.string])
(^template [<pm> <getter>]
(^code (<pm> (~ [_ (#.Nat idx)])))
- (meta/wrap (push-cursor! (<getter> cursor-top (_.int (:! Int idx))))))
+ (meta/wrap (push-cursor! (<getter> cursor-top (_.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 (|> (_.set! @temp (runtimeT.sum//get cursor-top (_.int (:! Int idx)) <flag>))
+ (meta/wrap (|> (_.set! @temp (runtimeT.sum//get cursor-top (_.int (:coerce Int idx)) <flag>))
(_.then! (_.if! (_.is-null/1 @temp)
fail-pm!
(push-cursor! @temp))))))
diff --git a/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux
index 54ec6abc2..4b954c4f1 100644
--- a/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux
@@ -29,8 +29,8 @@
(intValue [] Integer))
(exception: #export (Unknown-Kind-Of-Host-Object {host-object Object})
- (let [object-class (:! Text (Object::toString [] (Object::getClass [] (:! Object host-object))))
- text-representation (:! Text (Object::toString [] (:! Object host-object)))]
+ (let [object-class (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object host-object))))
+ text-representation (:coerce Text (Object::toString [] (:coerce Object host-object)))]
(format object-class " --- " text-representation)))
(host.import php/runtime/Memory)
@@ -63,18 +63,18 @@
(-> (-> Object (Error Any)) ArrayMemory (Error Any))
(let [size (ArrayMemory::size [] host-object)]
(loop [idx 0
- output (: (Array Any) (array.new (:! Nat size)))]
+ output (: (Array Any) (array.new (:coerce Nat size)))]
(if (i/< size idx)
(let [value (|> host-object
(ArrayMemory::get [(LongMemory::new [idx])])
- (:! ReferenceMemory) (ReferenceMemory::getValue []))]
+ (:coerce ReferenceMemory) (ReferenceMemory::getValue []))]
(if (host.instance? php/runtime/memory/NullMemory value)
(recur (inc idx)
- (array.write (:! Nat idx) (host.null) output))
+ (array.write (:coerce Nat idx) (host.null) output))
(do e.Monad<Error>
[lux-value (lux-object value)]
(recur (inc idx)
- (array.write (:! Nat idx) lux-value output)))))
+ (array.write (:coerce Nat idx) lux-value output)))))
(ex.return output)))))
(def: (variant lux-object host-object)
@@ -83,11 +83,11 @@
[variant-tag (lux-object (ArrayMemory::get [(StringMemory::new [//.variant-tag-field])] host-object))
variant-value (lux-object (ArrayMemory::get [(StringMemory::new [//.variant-value-field])] host-object))]
(wrap (: Any
- [(Long::intValue [] (:! Long variant-tag))
+ [(Long::intValue [] (:coerce Long variant-tag))
(: Any
(if (|> host-object
(ArrayMemory::get [(StringMemory::new [//.variant-flag-field])])
- (:! ReferenceMemory)
+ (:coerce ReferenceMemory)
(ReferenceMemory::getValue [])
(host.instance? php/runtime/memory/NullMemory))
(host.null)
@@ -103,21 +103,21 @@
(ex.return true)
(host.instance? php/runtime/memory/LongMemory host-object)
- (ex.return (LongMemory::toLong [] (:! LongMemory host-object)))
+ (ex.return (LongMemory::toLong [] (:coerce LongMemory host-object)))
(host.instance? php/runtime/memory/DoubleMemory host-object)
- (ex.return (DoubleMemory::toDouble [] (:! DoubleMemory host-object)))
+ (ex.return (DoubleMemory::toDouble [] (:coerce DoubleMemory host-object)))
(host.instance? php/runtime/memory/StringMemory host-object)
- (ex.return (StringMemory::toString [] (:! StringMemory host-object)))
+ (ex.return (StringMemory::toString [] (:coerce StringMemory host-object)))
(host.instance? php/runtime/memory/ReferenceMemory host-object)
- (lux-object (ReferenceMemory::getValue [] (:! ReferenceMemory host-object)))
+ (lux-object (ReferenceMemory::getValue [] (:coerce ReferenceMemory host-object)))
(host.instance? php/runtime/memory/ArrayMemory host-object)
- (if (ArrayMemory::isMap [] (:! ArrayMemory host-object))
- (variant lux-object (:! ArrayMemory host-object))
- (tuple lux-object (:! ArrayMemory host-object)))
+ (if (ArrayMemory::isMap [] (:coerce ArrayMemory host-object))
+ (variant lux-object (:coerce ArrayMemory host-object))
+ (tuple lux-object (:coerce ArrayMemory host-object)))
## else
(ex.throw Unknown-Kind-Of-Host-Object host-object)))
@@ -125,7 +125,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)
((lang.throw Cannot-Evaluate error) compiler)
diff --git a/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux
index 43497c93e..cd67be0f0 100644
--- a/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux
@@ -37,9 +37,9 @@
[_ (<tag> value)]
(|> value <generator>))
([#.Bool primitiveT.translate-bool]
- [#.Nat (<| primitiveT.translate-int (:! Int))]
+ [#.Nat (<| primitiveT.translate-int (:coerce Int))]
[#.Int primitiveT.translate-int]
- [#.Deg (<| primitiveT.translate-int (:! Int))]
+ [#.Deg (<| primitiveT.translate-int (:coerce Int))]
[#.Frac primitiveT.translate-frac]
[#.Text primitiveT.translate-text])
diff --git a/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux
index 9146684e4..4364d87ea 100644
--- a/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux
@@ -12,7 +12,7 @@
(do-template [<register> <prefix>]
[(def: #export <register>
(-> Register Var)
- (|>> (:! Int) %i (format <prefix>) _.var))]
+ (|>> (:coerce Int) %i (format <prefix>) _.var))]
[closure "c"]
[variable "v"])
@@ -21,7 +21,7 @@
(-> Variable Var)
(if (variableL.captured? var)
(closure (variableL.captured-register var))
- (variable (:! Nat var))))
+ (variable (:coerce Nat var))))
(def: #export global
(-> Ident Var)
diff --git a/new-luxc/source/luxc/lang/translation/php/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/php/statement.jvm.lux
index a20e164ca..70a39a575 100644
--- a/new-luxc/source/luxc/lang/translation/php/statement.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/php/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 []))