diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/text.lux | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux index 6bc7d5ebd..1c54218f9 100644 --- a/stdlib/source/lux/data/text.lux +++ b/stdlib/source/lux/data/text.lux @@ -198,32 +198,32 @@ (def: #export (replace_all pattern replacement template) (-> Text Text Text Text) (for {@.old - (:coerce Text - ("jvm invokevirtual:java.lang.String:replace:java.lang.CharSequence,java.lang.CharSequence" - (:coerce (primitive "java.lang.String") template) - (:coerce (primitive "java.lang.CharSequence") pattern) - (:coerce (primitive "java.lang.CharSequence") replacement))) + (:as Text + ("jvm invokevirtual:java.lang.String:replace:java.lang.CharSequence,java.lang.CharSequence" + (:as (primitive "java.lang.String") template) + (:as (primitive "java.lang.CharSequence") pattern) + (:as (primitive "java.lang.CharSequence") replacement))) @.jvm - (:coerce Text - ("jvm member invoke virtual" [] "java.lang.String" "replace" [] - (:coerce (primitive "java.lang.String") template) - ["Ljava/lang/CharSequence;" (:coerce (primitive "java.lang.CharSequence") pattern)] - ["Ljava/lang/CharSequence;" (:coerce (primitive "java.lang.CharSequence") replacement)])) + (:as Text + ("jvm member invoke virtual" [] "java.lang.String" "replace" [] + (:as (primitive "java.lang.String") template) + ["Ljava/lang/CharSequence;" (:as (primitive "java.lang.CharSequence") pattern)] + ["Ljava/lang/CharSequence;" (:as (primitive "java.lang.CharSequence") replacement)])) ## TODO: Comment/turn-off when generating a JS compiler using a JVM-based compiler because Nashorn's implementation of "replaceAll" is incorrect. @.js - (:coerce Text - ("js object do" "replaceAll" template [pattern replacement])) + (:as Text + ("js object do" "replaceAll" template [pattern replacement])) @.python - (:coerce Text - ("python object do" "replace" template pattern replacement)) + (:as Text + ("python object do" "replace" template pattern replacement)) ## TODO @.lua @.ruby - (:coerce Text - ("ruby object do" "gsub" template pattern replacement)) + (:as Text + ("ruby object do" "gsub" template pattern replacement)) @.php - (:coerce Text - ("php apply" (:assume ("php constant" "str_replace")) - pattern replacement template)) + (:as Text + ("php apply" (:assume ("php constant" "str_replace")) + pattern replacement template)) ## TODO @.scheme ## TODO @.common_lisp ## TODO @.r @@ -271,16 +271,16 @@ (: (primitive "java.lang.String")) "jvm invokevirtual:java.lang.String:hashCode:" "jvm convert int-to-long" - (:coerce Nat)) + (:as Nat)) @.jvm (|> input - (:coerce (primitive "java.lang.String")) + (:as (primitive "java.lang.String")) ("jvm member invoke virtual" [] "java.lang.String" "hashCode" []) "jvm conversion int-to-long" "jvm object cast" (: (primitive "java.lang.Long")) - (:coerce Nat))} + (:as Nat))} ## Platform-independent default. (let [length ("lux text size" input)] (loop [idx 0 @@ -335,45 +335,45 @@ (def: #export (lower_case value) (-> Text Text) (for {@.old - (:coerce Text - ("jvm invokevirtual:java.lang.String:toLowerCase:" - (:coerce (primitive "java.lang.String") value))) + (:as Text + ("jvm invokevirtual:java.lang.String:toLowerCase:" + (:as (primitive "java.lang.String") value))) @.jvm - (:coerce Text - ("jvm member invoke virtual" [] "java.lang.String" "toLowerCase" [] - (:coerce (primitive "java.lang.String") value))) + (:as Text + ("jvm member invoke virtual" [] "java.lang.String" "toLowerCase" [] + (:as (primitive "java.lang.String") value))) @.js - (:coerce Text - ("js object do" "toLowerCase" value [])) + (:as Text + ("js object do" "toLowerCase" value [])) @.python - (:coerce Text - ("python object do" "lower" value)) + (:as Text + ("python object do" "lower" value)) @.lua - (:coerce Text - ("lua apply" ("lua constant" "string.lower") value)) + (:as Text + ("lua apply" ("lua constant" "string.lower") value)) @.ruby - (:coerce Text - ("ruby object do" "downcase" value))})) + (:as Text + ("ruby object do" "downcase" value))})) (def: #export (upper_case value) (-> Text Text) (for {@.old - (:coerce Text - ("jvm invokevirtual:java.lang.String:toUpperCase:" - (:coerce (primitive "java.lang.String") value))) + (:as Text + ("jvm invokevirtual:java.lang.String:toUpperCase:" + (:as (primitive "java.lang.String") value))) @.jvm - (:coerce Text - ("jvm member invoke virtual" [] "java.lang.String" "toUpperCase" [] - (:coerce (primitive "java.lang.String") value))) + (:as Text + ("jvm member invoke virtual" [] "java.lang.String" "toUpperCase" [] + (:as (primitive "java.lang.String") value))) @.js - (:coerce Text - ("js object do" "toUpperCase" value [])) + (:as Text + ("js object do" "toUpperCase" value [])) @.python - (:coerce Text - ("python object do" "upper" value)) + (:as Text + ("python object do" "upper" value)) @.lua - (:coerce Text - ("lua apply" ("lua constant" "string.upper") value)) + (:as Text + ("lua apply" ("lua constant" "string.upper") value)) @.ruby - (:coerce Text - ("ruby object do" "upcase" value))})) + (:as Text + ("ruby object do" "upcase" value))})) |