From 0097e306a1e3b53e4cda304aac82b8778036eddf Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 11 Jul 2018 21:17:42 -0400 Subject: - Got rid of "lux text replace-once" and "lux text replace-all" extensions. --- luxc/src/lux/analyser/proc/common.clj | 25 ------------------------ luxc/src/lux/compiler/jvm/proc/common.clj | 32 ------------------------------- 2 files changed, 57 deletions(-) (limited to 'luxc') diff --git a/luxc/src/lux/analyser/proc/common.clj b/luxc/src/lux/analyser/proc/common.clj index 243308799..4d2f40277 100644 --- a/luxc/src/lux/analyser/proc/common.clj +++ b/luxc/src/lux/analyser/proc/common.clj @@ -60,17 +60,6 @@ ^:private analyse-text-index "index" (&/$Apply &type/Nat &type/Maybe) ) -(defn ^:private analyse-text-contains? [analyse exo-type ?values] - (|do [:let [(&/$Cons text (&/$Cons part (&/$Nil))) ?values] - =text (&&/analyse-1 analyse &type/Text text) - =part (&&/analyse-1 analyse &type/Text part) - _ (&type/check exo-type &type/Bool) - _cursor &/cursor] - (return (&/|list (&&/|meta exo-type _cursor - (&&/$proc (&/T ["text" "contains?"]) - (&/|list =text =part) - (&/|list))))))) - (defn ^:private analyse-text-clip [analyse exo-type ?values] (|do [:let [(&/$Cons text (&/$Cons from (&/$Cons to (&/$Nil)))) ?values] =text (&&/analyse-1 analyse &type/Text text) @@ -83,18 +72,6 @@ (&/|list =text =from =to) (&/|list))))))) -(defn ^:private analyse-text-replace-all [analyse exo-type ?values] - (|do [:let [(&/$Cons text (&/$Cons to-find (&/$Cons replace-with (&/$Nil)))) ?values] - =text (&&/analyse-1 analyse &type/Text text) - =to-find (&&/analyse-1 analyse &type/Text to-find) - =replace-with (&&/analyse-1 analyse &type/Text replace-with) - _ (&type/check exo-type &type/Text) - _cursor &/cursor] - (return (&/|list (&&/|meta exo-type _cursor - (&&/$proc (&/T ["text" "replace-all"]) - (&/|list =text =to-find =replace-with) - (&/|list))))))) - (do-template [ ] (defn [analyse exo-type ?values] (|do [:let [(&/$Cons text (&/$Nil)) ?values] @@ -449,9 +426,7 @@ "lux text index" (analyse-text-index analyse exo-type ?values) "lux text size" (analyse-text-size analyse exo-type ?values) "lux text hash" (analyse-text-hash analyse exo-type ?values) - "lux text replace-all" (analyse-text-replace-all analyse exo-type ?values) "lux text char" (analyse-text-char analyse exo-type ?values) - "lux text contains?" (analyse-text-contains? analyse exo-type ?values) "lux array new" (analyse-array-new analyse exo-type ?values) "lux array get" (analyse-array-get analyse exo-type ?values) diff --git a/luxc/src/lux/compiler/jvm/proc/common.clj b/luxc/src/lux/compiler/jvm/proc/common.clj index aca1921fe..244e7baa8 100644 --- a/luxc/src/lux/compiler/jvm/proc/common.clj +++ b/luxc/src/lux/compiler/jvm/proc/common.clj @@ -408,36 +408,6 @@ ^:private compile-text-hash "java/lang/Object" "hashCode" ) -(defn ^:private compile-text-replace-all [compile ?values special-args] - (|do [:let [(&/$Cons ?text (&/$Cons ?pattern (&/$Cons ?replacement (&/$Nil)))) ?values] - ^MethodVisitor *writer* &/get-writer - _ (compile ?text) - :let [_ (doto *writer* - (.visitTypeInsn Opcodes/CHECKCAST "java/lang/String"))] - _ (compile ?pattern) - :let [_ (doto *writer* - (.visitTypeInsn Opcodes/CHECKCAST "java/lang/String"))] - _ (compile ?replacement) - :let [_ (doto *writer* - (.visitTypeInsn Opcodes/CHECKCAST "java/lang/String"))] - :let [_ (doto *writer* - (.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/String" "replace" "(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;"))]] - (return nil))) - -(defn ^:private compile-text-contains? [compile ?values special-args] - (|do [:let [(&/$Cons ?text (&/$Cons ?sub (&/$Nil))) ?values] - ^MethodVisitor *writer* &/get-writer - _ (compile ?text) - :let [_ (doto *writer* - (.visitTypeInsn Opcodes/CHECKCAST "java/lang/String"))] - _ (compile ?sub) - :let [_ (doto *writer* - (.visitTypeInsn Opcodes/CHECKCAST "java/lang/String"))] - :let [_ (doto *writer* - (.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/String" "contains" "(Ljava/lang/CharSequence;)Z") - &&/wrap-boolean)]] - (return nil))) - (defn ^:private compile-text-char [compile ?values special-args] (|do [:let [(&/$Cons ?text (&/$Cons ?idx (&/$Nil))) ?values] ^MethodVisitor *writer* &/get-writer @@ -657,9 +627,7 @@ "index" (compile-text-index compile ?values special-args) "size" (compile-text-size compile ?values special-args) "hash" (compile-text-hash compile ?values special-args) - "replace-all" (compile-text-replace-all compile ?values special-args) "char" (compile-text-char compile ?values special-args) - "contains?" (compile-text-contains? compile ?values special-args) ) "i64" -- cgit v1.2.3