diff options
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang/translation.lux | 8 | ||||
-rw-r--r-- | new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux | 15 |
2 files changed, 16 insertions, 7 deletions
diff --git a/new-luxc/source/luxc/lang/translation.lux b/new-luxc/source/luxc/lang/translation.lux index 6726470cc..62b56783c 100644 --- a/new-luxc/source/luxc/lang/translation.lux +++ b/new-luxc/source/luxc/lang/translation.lux @@ -145,10 +145,10 @@ _ (&module;flag-compiled! module-name)] (wrap output))) -(def: parse - (Meta Code) +(def: (parse current-module) + (-> Text (Meta Code)) (function [compiler] - (case (&syntax;parse (get@ #;source compiler)) + (case (&syntax;parse current-module (get@ #;source compiler)) (#e;Error error) (#e;Error error) @@ -171,7 +171,7 @@ file-content] (exhaust (do @ - [code parse + [code (parse module-name) #let [[cursor _] code]] (&;with-cursor cursor (translate code)))))))] diff --git a/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux index 2cdf65e32..e680c46e8 100644 --- a/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux @@ -423,8 +423,16 @@ [text//clip ($i;CHECKCAST "java.lang.String") jvm-intI jvm-intI ($i;INVOKESTATIC hostL;runtime-class "text_clip" ($t;method (list $String $t;int $t;int) (#;Some $Object-Array) (list)) false)] - [text//replace ($i;CHECKCAST "java.lang.String") ($i;CHECKCAST "java.lang.String") ($i;CHECKCAST "java.lang.String") - ($i;INVOKEVIRTUAL "java.lang.String" "replace" ($t;method (list $CharSequence $CharSequence) (#;Some $String) (list)) false)] + [text//replace-once ($i;CHECKCAST "java.lang.String") + (<| ($i;INVOKESTATIC "java.util.regex.Pattern" "quote" ($t;method (list $String) (#;Some $String) (list)) false) + ($i;CHECKCAST "java.lang.String")) + ($i;CHECKCAST "java.lang.String") + ($i;INVOKEVIRTUAL "java.lang.String" "replaceFirst" ($t;method (list $String $String) (#;Some $String) (list)) false)] + [text//replace-all ($i;CHECKCAST "java.lang.String") + (<| ($i;INVOKESTATIC "java.util.regex.Pattern" "quote" ($t;method (list $String) (#;Some $String) (list)) false) + ($i;CHECKCAST "java.lang.String")) + ($i;CHECKCAST "java.lang.String") + ($i;INVOKEVIRTUAL "java.lang.String" "replaceAll" ($t;method (list $String $String) (#;Some $String) (list)) false)] ) (def: index-method $;Method ($t;method (list $String $t;int) (#;Some $t;int) (list))) @@ -674,7 +682,8 @@ (install "text index" (trinary text//index)) (install "text size" (unary text//size)) (install "text hash" (unary text//hash)) - (install "text replace" (trinary text//replace)) + (install "text replace-once" (trinary text//replace-once)) + (install "text replace-all" (trinary text//replace-all)) (install "text char" (binary text//char)) (install "text clip" (trinary text//clip)) )) |