aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/js
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/js
parentf861af6c6bd57677ba4af2ee3275c69b11f68beb (diff)
- Got rid of "lux text replace-once" and "lux text replace-all" extensions.
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/js')
-rw-r--r--new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux36
-rw-r--r--new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux7
2 files changed, 9 insertions, 34 deletions
diff --git a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux
index d9e64d4a1..05cd0137b 100644
--- a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux
@@ -270,22 +270,13 @@
(format "String.fromCharCode" "(" (int//to-frac inputJS) ")"))
## [[Text]]
-(do-template [<name> <op>]
- [(def: (<name> inputJS)
- Unary
- (format inputJS <op>))]
-
- [text//size ".length"]
- )
-
-(do-template [<name> <method>]
- [(def: (<name> [subjectJS paramJS])
- Binary
- (format subjectJS "." <method> "(" paramJS ")"))]
+(def: (text//size inputJS)
+ Unary
+ (format inputJS ".length"))
- [text//concat "concat"]
- [text//contains? "includes"]
- )
+(def: (text//concat [subjectJS paramJS])
+ Binary
+ (format subjectJS "." "concat" "(" paramJS ")"))
(def: (text//char [subjectJS paramJS])
Binary
@@ -296,18 +287,11 @@
Trinary
(format <runtime> "(" subjectJS "," paramJS "," extraJS ")"))]
- [text//clip runtimeT.text//clip]
- [text//replace-all runtimeT.text//replace-all]
+ [text//clip runtimeT.text//clip]
+ [text//index runtimeT.text//index]
+
)
-(def: (text//replace-once [subjectJS paramJS extraJS])
- Trinary
- (format subjectJS ".replace(" paramJS "," extraJS ")"))
-
-(def: (text//index [textJS partJS startJS])
- Trinary
- (format runtimeT.text//index "(" textJS "," partJS "," startJS ")"))
-
## [[Math]]
(do-template [<name> <method>]
[(def: (<name> inputJS)
@@ -466,8 +450,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/js/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux
index 6039a33c7..267a3e637 100644
--- a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux
@@ -580,12 +580,6 @@
"}")
"})"))
-(runtime: text//replace-all "replaceAll"
- (format "(function " @ "(text,toFind,replaceWith) {"
- "var reEscaped = toFind.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');"
- "return text.replace(new RegExp(reEscaped, 'g'), replaceWith);"
- "})"))
-
(runtime: text//char "textChar"
(format "(function " @ "(text,idx) {"
"var result = text.charCodeAt(idx.L);"
@@ -610,7 +604,6 @@
Runtime
(format __text//index
__text//clip
- __text//replace-all
__text//char
__text//hash))