aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/lua
diff options
context:
space:
mode:
authorEduardo Julian2018-07-11 21:17:42 -0400
committerEduardo Julian2018-07-11 21:17:42 -0400
commit0097e306a1e3b53e4cda304aac82b8778036eddf (patch)
treeee97d8986edd1c5d7162986a273fde0079fb5659 /new-luxc/source/luxc/lang/translation/lua
parentf861af6c6bd57677ba4af2ee3275c69b11f68beb (diff)
- Got rid of "lux text replace-once" and "lux text replace-all" extensions.
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/lua')
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux17
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux31
2 files changed, 2 insertions, 46 deletions
diff --git a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux
index b54829a62..67aa5417a 100644
--- a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux
@@ -284,12 +284,6 @@
Binary
(format "(" subjectO " .. " paramO ")"))
-(def: (text//contains? [subjectO paramO])
- Binary
- (|> (lua.apply "string.find" (list subjectO paramO (lua.int 1) (lua.bool true)))
- (lua.= lua.nil)
- lua.not))
-
(def: (text//char [subjectO paramO])
Binary
(runtimeT.text//char subjectO paramO))
@@ -299,15 +293,10 @@
Trinary
(<runtime> subjectO paramO extraO))]
- [text//clip runtimeT.text//clip]
- [text//replace-all runtimeT.text//replace-all]
- [text//replace-once runtimeT.text//replace-once]
+ [text//clip runtimeT.text//clip]
+ [text//index runtimeT.text//index]
)
-(def: (text//index [textO partO startO])
- Trinary
- (runtimeT.text//index textO partO startO))
-
## [[Math]]
(do-template [<name> <method>]
[(def: (<name> inputO)
@@ -451,8 +440,6 @@
(install "index" (trinary text//index))
(install "size" (unary text//size))
(install "hash" (unary text//hash))
- (install "replace-once" (trinary text//replace-once))
- (install "replace-all" (trinary text//replace-all))
(install "char" (binary text//char))
(install "clip" (trinary text//clip))
)))
diff --git a/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux
index 5a0d62225..9e7dc7422 100644
--- a/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux
@@ -201,35 +201,6 @@
(lua.return! none)
(lua.return! (some (lua.apply "string.sub" (list text from to))))))))
-(runtime: (text//replace-once text to-find replacement)
- (let [find-index (lua.apply "string.find" (list text to-find (lua.int 1) (lua.bool true)))]
- (lua.block! (list (lua.local! "findSize" (#.Some (lua.apply "string.len" (list to-find))))
- (lua.local! "parts" (#.Some (lua.array (list))))
- (lua.local! "idx" (#.Some find-index))
- (lua.when! (lua.not (lua.= lua.nil "idx"))
- (let [find-pre (lua.apply "string.sub" (list text (lua.int 1) "idx"))
- find-post (lua.apply "string.sub" (list text "idx" (lua.+ "idx" "findSize")))]
- (lua.block! (list (lua.apply "table.insert" (list "parts" find-pre))
- (lua.apply "table.insert" (list "parts" replacement))
- (lua.set! text find-post)))))
- (lua.apply "table.insert" (list "parts" text))
- (lua.return! (lua.apply "table.concat" (list "parts")))))))
-
-(runtime: (text//replace-all text to-find replacement)
- (let [find-index (lua.apply "string.find" (list text to-find (lua.int 1) (lua.bool true)))]
- (lua.block! (list (lua.local! "findSize" (#.Some (lua.apply "string.len" (list to-find))))
- (lua.local! "parts" (#.Some (lua.array (list))))
- (lua.local! "idx" (#.Some find-index))
- (lua.while! (lua.not (lua.= lua.nil "idx"))
- (let [find-pre (lua.apply "string.sub" (list text (lua.int 1) (lua.- (lua.int 1) "idx")))
- find-post (lua.apply "string.sub" (list text (lua.+ "findSize" "idx")))]
- (lua.block! (list (lua.apply "table.insert" (list "parts" find-pre))
- (lua.apply "table.insert" (list "parts" replacement))
- (lua.set! text find-post)
- (lua.set! "idx" find-index)))))
- (lua.apply "table.insert" (list "parts" text))
- (lua.return! (lua.apply "table.concat" (list "parts")))))))
-
(runtime: (text//char text idx)
(lua.block! (list (lua.local! "char" (#.Some (lua.apply "string.byte" (list text idx))))
(lua.if! (lua.= lua.nil "char")
@@ -249,8 +220,6 @@
Runtime
(format @@text//index
@@text//clip
- @@text//replace-once
- @@text//replace-all
@@text//char
@@text//hash))