aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/lua
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/lua
parentbfd2d6c203042dfddb0ce29db3696365fe213314 (diff)
- Re-named ":!" to ":coerce".
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/lua.lux36
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/case.jvm.lux10
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux20
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/statement.jvm.lux2
5 files changed, 36 insertions, 36 deletions
diff --git a/new-luxc/source/luxc/lang/translation/lua.lux b/new-luxc/source/luxc/lang/translation/lua.lux
index d09746351..307b6a181 100644
--- a/new-luxc/source/luxc/lang/translation/lua.lux
+++ b/new-luxc/source/luxc/lang/translation/lua.lux
@@ -96,7 +96,7 @@
(function (_ code)
(let [lua-function (ChunkLoader::loadTextChunk [variable "lux compilation" code]
loader)]
- ("lux try" (io (DirectCallExecutor::call [state-context (:! Object lua-function) (array.new +0)]
+ ("lux try" (io (DirectCallExecutor::call [state-context (:coerce Object lua-function) (array.new +0)]
executor))))))
#module-buffer #.None
#program-buffer (StringBuilder::new [])}))
@@ -107,26 +107,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]])
@@ -138,7 +138,7 @@
(function (_ compiler)
(#e.Success [compiler
(|> (get@ #.host compiler)
- (:! Host)
+ (:coerce Host)
(get@ #context)
(let> [name sub]
name))])))
@@ -146,15 +146,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])
@@ -164,7 +164,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])
@@ -174,7 +174,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)
@@ -184,12 +184,12 @@
(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))])))
(def: (execute 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-Execute error) compiler)
@@ -211,7 +211,7 @@
(-> Lua (Meta Any))
(do macro.Monad<Meta>
[module-buffer module-buffer
- #let [_ (Appendable::append [(:! CharSequence code)]
+ #let [_ (Appendable::append [(:coerce CharSequence code)]
module-buffer)]]
(execute code)))
@@ -222,7 +222,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) "/" lua-module-name)
diff --git a/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux
index ed084b44d..a72bf0011 100644
--- a/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux
@@ -38,7 +38,7 @@
(let [method (if tail?
runtimeT.product//right
runtimeT.product//left)]
- (method source (lua.int (:! Int idx)))))
+ (method source (lua.int (:coerce Int idx)))))
valueO
path))))
@@ -102,22 +102,22 @@
[_ (<tag> value)]
(meta/wrap (lua.when! (lua.not (lua.= (|> value <format>) cursor-top))
(lua.return! pm-error))))
- ([#.Nat (<| lua.int (:! Int))]
+ ([#.Nat (<| lua.int (:coerce Int))]
[#.Int lua.int]
- [#.Deg (<| lua.int (:! Int))]
+ [#.Deg (<| lua.int (:coerce Int))]
[#.Bool lua.bool]
[#.Frac lua.float]
[#.Text lua.string])
(^template [<pm> <getter>]
(^code (<pm> (~ [_ (#.Nat idx)])))
- (meta/wrap (push-cursor! (<getter> cursor-top (lua.int (:! Int idx))))))
+ (meta/wrap (push-cursor! (<getter> cursor-top (lua.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 (lua.block! (list (lua.set! "temp" (runtimeT.sum//get cursor-top (lua.int (:! Int idx)) <flag>))
+ (meta/wrap (lua.block! (list (lua.set! "temp" (runtimeT.sum//get cursor-top (lua.int (:coerce Int idx)) <flag>))
(lua.if! (lua.= lua.nil "temp")
(lua.return! pm-error)
(push-cursor! "temp"))))))
diff --git a/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux
index 0e413e7ad..0330f79c2 100644
--- a/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux
@@ -45,7 +45,7 @@
(^multi [(#.Some tag) ?flag (#.Some value)]
[(lux-object value)
(#.Some value)])
- (#.Some [(Long::intValue [] (:! Long tag))
+ (#.Some [(Long::intValue [] (:coerce Long tag))
(: Any (case ?flag (#.Some _) "" #.None (host.null)))
value])
@@ -54,17 +54,17 @@
(def: (array lux-object host-object)
(-> (-> Object (Error Any)) DefaultTable (Maybe (Array Object)))
- (let [init-num-keys (:! Nat (Table::rawlen [] host-object))]
+ (let [init-num-keys (:coerce Nat (Table::rawlen [] host-object))]
(loop [num-keys init-num-keys
idx +0
output (: (Array Object)
(array.new init-num-keys))]
(if (n/< num-keys idx)
- (case (Table::get-idx (:! Long (inc idx)) host-object)
+ (case (Table::get-idx (:coerce Long (inc idx)) host-object)
(#.Some member)
(case (lux-object member)
(#e.Success parsed-member)
- (recur num-keys (inc idx) (array.write idx (:! Object parsed-member) output))
+ (recur num-keys (inc idx) (array.write idx (:coerce Object parsed-member) output))
(#e.Error error)
#.None)
@@ -85,10 +85,10 @@
(ex.return host-object)
(host.instance? ByteString host-object)
- (ex.return (ByteString::decode [] (:! ByteString host-object)))
+ (ex.return (ByteString::decode [] (:coerce ByteString host-object)))
(host.instance? DefaultTable host-object)
- (let [host-object (:! DefaultTable host-object)]
+ (let [host-object (:coerce DefaultTable host-object)]
(case (variant lux-object host-object)
(#.Some value)
(ex.return value)
@@ -99,23 +99,23 @@
(ex.return value)
#.None
- (ex.throw Unknown-Kind-Of-Host-Object (format "SECOND " (Object::toString [] (:! Object host-object)))))))
+ (ex.throw Unknown-Kind-Of-Host-Object (format "SECOND " (Object::toString [] (:coerce Object host-object)))))))
## else
- (ex.throw Unknown-Kind-Of-Host-Object (format "FIRST " (Object::toString [] (:! Object host-object))))
+ (ex.throw Unknown-Kind-Of-Host-Object (format "FIRST " (Object::toString [] (:coerce Object host-object))))
))
(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 (format "return " code ";"))
(#e.Error error)
((lang.throw Cannot-Evaluate error) compiler)
(#e.Success output)
(case (lux-object (|> output
- (:! (Array Object))
+ (:coerce (Array Object))
(array.read +0)
maybe.assume))
(#e.Success parsed-output)
diff --git a/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux
index c322e5005..5769f6890 100644
--- a/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux
@@ -16,11 +16,11 @@
(def: #export translate-nat
(-> Nat (Meta Expression))
- (|>> (:! Int) %i meta/wrap))
+ (|>> (:coerce Int) %i meta/wrap))
(def: #export translate-deg
(-> Deg (Meta Expression))
- (|>> (:! Int) %i meta/wrap))
+ (|>> (:coerce Int) %i meta/wrap))
(def: #export translate-frac
(-> Frac (Meta Expression))
diff --git a/new-luxc/source/luxc/lang/translation/lua/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/statement.jvm.lux
index 3a438ae65..8ff9c1ccd 100644
--- a/new-luxc/source/luxc/lang/translation/lua/statement.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/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 []))