aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/ruby
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/ruby
parentbfd2d6c203042dfddb0ce29db3696365fe213314 (diff)
- Re-named ":!" to ":coerce".
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby.lux34
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux10
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux30
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby/statement.jvm.lux2
5 files changed, 40 insertions, 40 deletions
diff --git a/new-luxc/source/luxc/lang/translation/ruby.lux b/new-luxc/source/luxc/lang/translation/ruby.lux
index 808d8105c..1ed9f30e1 100644
--- a/new-luxc/source/luxc/lang/translation/ruby.lux
+++ b/new-luxc/source/luxc/lang/translation/ruby.lux
@@ -71,26 +71,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]])
@@ -102,7 +102,7 @@
(function (_ compiler)
(#e.Success [compiler
(|> (get@ #.host compiler)
- (:! Host)
+ (:coerce Host)
(get@ #context)
(let> [name sub]
name))])))
@@ -110,15 +110,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])
@@ -128,7 +128,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])
@@ -138,7 +138,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)
@@ -148,12 +148,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)
@@ -175,7 +175,7 @@
(-> Ruby (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)))
@@ -186,7 +186,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) "/" ruby-module-name)
diff --git a/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux
index d76b2a757..b7b1f131d 100644
--- a/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux
@@ -38,7 +38,7 @@
(let [method (if tail?
runtimeT.product//right
runtimeT.product//left)]
- (method source (ruby.int (:! Int idx)))))
+ (method source (ruby.int (:coerce Int idx)))))
valueO
path))))
@@ -107,22 +107,22 @@
[_ (<tag> value)]
(meta/wrap (ruby.when! (ruby.not (ruby.= (|> value <format>) cursor-top))
(ruby.raise pm-error))))
- ([#.Nat (<| ruby.int (:! Int))]
+ ([#.Nat (<| ruby.int (:coerce Int))]
[#.Int ruby.int]
- [#.Deg (<| ruby.int (:! Int))]
+ [#.Deg (<| ruby.int (:coerce Int))]
[#.Bool ruby.bool]
[#.Frac ruby.float]
[#.Text ruby.string])
(^template [<pm> <getter>]
(^code (<pm> (~ [_ (#.Nat idx)])))
- (meta/wrap (push-cursor! (<getter> cursor-top (ruby.int (:! Int idx))))))
+ (meta/wrap (push-cursor! (<getter> cursor-top (ruby.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 (ruby.block! (list (ruby.set! (list "temp") (runtimeT.sum//get cursor-top (ruby.int (:! Int idx)) <flag>))
+ (meta/wrap (ruby.block! (list (ruby.set! (list "temp") (runtimeT.sum//get cursor-top (ruby.int (:coerce Int idx)) <flag>))
(ruby.if! (ruby.= ruby.nil "temp")
(ruby.raise pm-error)
(push-cursor! "temp"))))))
diff --git a/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux
index 7d43e5460..3c590e8ee 100644
--- a/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux
@@ -37,11 +37,11 @@
(def: (tuple lux-object host-object)
(-> (-> Object (Error Any)) RubyArray (Error Any))
- (let [size (:! Nat (RubyArray::getLength [] host-object))]
+ (let [size (:coerce Nat (RubyArray::getLength [] host-object))]
(loop [idx +0
- output (:! (Array Any) (array.new size))]
+ output (:coerce (Array Any) (array.new size))]
(if (n/< size idx)
- (case (RubyArray::get [(:! Int idx)] host-object)
+ (case (RubyArray::get [(:coerce Int idx)] host-object)
#.None
(recur (inc idx) output)
@@ -56,13 +56,13 @@
(def: (variant lux-object host-object)
(-> (-> Object (Error Any)) RubyHash (Error Any))
- (case [(RubyHash::get [(:! Object //.variant-tag-field)] host-object)
- (RubyHash::get [(:! Object //.variant-flag-field)] host-object)
- (RubyHash::get [(:! Object //.variant-value-field)] host-object)]
+ (case [(RubyHash::get [(:coerce Object //.variant-tag-field)] host-object)
+ (RubyHash::get [(:coerce Object //.variant-flag-field)] host-object)
+ (RubyHash::get [(:coerce Object //.variant-value-field)] host-object)]
(^multi [(#.Some tag) ?flag (#.Some value)]
[(lux-object value)
(#.Some value)])
- (#e.Success [(Long::intValue [] (:! Long tag))
+ (#e.Success [(Long::intValue [] (:coerce Long tag))
(: Any (case ?flag (#.Some _) "" #.None (host.null)))
value])
@@ -81,28 +81,28 @@
(ex.return host-object)
(host.instance? org/jruby/RubyArray host-object)
- (tuple lux-object (:! RubyArray host-object))
+ (tuple lux-object (:coerce RubyArray host-object))
(host.instance? org/jruby/RubyHash host-object)
- (case (variant lux-object (:! RubyHash host-object))
+ (case (variant lux-object (:coerce RubyHash host-object))
(#e.Success value)
(#e.Success value)
_
- (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)))]
(ex.throw Unknown-Kind-Of-Host-Object (format object-class " --- " text-representation))))
## else
- (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)))]
(ex.throw Unknown-Kind-Of-Host-Object (format object-class " --- " text-representation)))
)))
(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"
@@ -111,7 +111,7 @@
((lang.throw Cannot-Evaluate error) compiler))
(#e.Success output)
- (case (lux-object (:! Object output))
+ (case (lux-object (:coerce Object output))
(#e.Success parsed-output)
(exec ## (log! (format "eval #e.Success\n"
## "<< " code))
diff --git a/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux
index 1e76ef9e4..1f05cf2fd 100644
--- a/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/ruby/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/ruby/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/statement.jvm.lux
index 135a09039..83792921d 100644
--- a/new-luxc/source/luxc/lang/translation/ruby/statement.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/ruby/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 []))