aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/php.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/php.lux')
-rw-r--r--new-luxc/source/luxc/lang/translation/php.lux17
1 files changed, 7 insertions, 10 deletions
diff --git a/new-luxc/source/luxc/lang/translation/php.lux b/new-luxc/source/luxc/lang/translation/php.lux
index 4cfcaaa0f..eeaa95309 100644
--- a/new-luxc/source/luxc/lang/translation/php.lux
+++ b/new-luxc/source/luxc/lang/translation/php.lux
@@ -46,9 +46,8 @@
(host.import javax/script/ScriptEngine
(eval [String] #try Object))
-(host.import javax/script/ScriptEngineManager
- (new [])
- (getEngineByName [String] ScriptEngine))
+(host.import org/develnext/jphp/scripting/JPHPScriptEngine
+ (new []))
(type: #export Anchor [Text Register])
@@ -62,16 +61,15 @@
(def: #export init
(IO Host)
- (io (let [interpreter (|> (ScriptEngineManager::new [])
- (ScriptEngineManager::getEngineByName ["jphp"]))]
+ (io (let [interpreter (JPHPScriptEngine::new [])]
{#context ["" +0]
#anchor #.None
#loader (function (_ code)
(do e.Monad<Error>
- [_ (ScriptEngine::eval [(format "<?php " (_.statement code))] interpreter)]
+ [_ (ScriptEngine::eval [(format "<?php " (_.code code))] interpreter)]
(wrap [])))
#interpreter (function (_ code)
- (ScriptEngine::eval [(format "<?php " (_.statement (_.return! code)))] interpreter))
+ (ScriptEngine::eval [(format "<?php " (_.code (_.return! code)))] interpreter))
#module-buffer #.None
#program-buffer (StringBuilder::new [])})))
@@ -168,8 +166,7 @@
(let [runner (|> compiler (get@ #.host) (:! Host) (get@ <field>))]
(case (runner code)
(#e.Error error)
- (exec (log! (:! Text code))
- ((lang.throw Cannot-Execute error) compiler))
+ ((lang.throw Cannot-Execute error) compiler)
(#e.Success output)
(#e.Success [compiler output])))))]
@@ -192,7 +189,7 @@
(-> Statement (Meta Unit))
(do macro.Monad<Meta>
[module-buffer module-buffer
- #let [_ (Appendable::append [(:! CharSequence (_.statement code))]
+ #let [_ (Appendable::append [(:! CharSequence (_.code code))]
module-buffer)]]
(load! code)))