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 'new-luxc/source/luxc/lang/translation/ruby')
-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
4 files changed, 23 insertions, 23 deletions
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 []))