diff options
author | Eduardo Julian | 2021-03-12 05:45:44 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-03-12 05:45:44 -0400 |
commit | dff34f01e838475b817803ec856661fe8940e5c0 (patch) | |
tree | d8ddb3b6fd5963fdbdda64a13f2a430242fd7b26 /lux-php | |
parent | 0c75fd67e3fcfbfb09d8c11b6cf396084ce40a15 (diff) |
Almost done with PHP.
Diffstat (limited to 'lux-php')
-rw-r--r-- | lux-php/source/program.lux | 94 |
1 files changed, 6 insertions, 88 deletions
diff --git a/lux-php/source/program.lux b/lux-php/source/program.lux index 29fadec16..14a1646a0 100644 --- a/lux-php/source/program.lux +++ b/lux-php/source/program.lux @@ -222,12 +222,8 @@ (php/runtime/memory/StringMemory::new "")) (def: (lux_structure value) - (-> (Array java/lang/Object) - ## php/runtime/memory/ArrayMemory - php/runtime/Memory - ) + (-> (Array java/lang/Object) php/runtime/Memory) (`` (host.object [] php/runtime/Memory - ## php/runtime/memory/ArrayMemory [program/StructureValue] [{php/runtime/Memory$Type php/runtime/Memory$Type::ARRAY}] ## Methods @@ -240,54 +236,6 @@ java/lang/String (debug.inspect value)) - ## (php/runtime/memory/ArrayMemory - ## [] (get self {key php/runtime/Memory}) - ## php/runtime/Memory - ## (exec - ## (debug.log! (format "{lux_structure#get}" text.new_line - ## (exception.construct ..unknown_kind_of_object key))) - ## (error! "OOPS!"))) - - ## (php/runtime/memory/ArrayMemory - ## [] (getOrCreate self {key php/runtime/Memory}) - ## php/runtime/memory/ReferenceMemory - ## (exec - ## (debug.log! (format "{lux_structure#getOrCreate}" text.new_line - ## (exception.construct ..unknown_kind_of_object key))) - ## (error! "OOPS!"))) - - ## (php/runtime/memory/ArrayMemory - ## [] (getOrCreateAsShortcut self {key php/runtime/Memory}) - ## php/runtime/memory/ReferenceMemory - ## (exec - ## (debug.log! (format "{lux_structure#getOrCreateAsShortcut}" text.new_line - ## (exception.construct ..unknown_kind_of_object key))) - ## (error! "OOPS!"))) - - ## (php/runtime/memory/ArrayMemory - ## [] (getByScalarOrCreateAsShortcut self {key java/lang/Object}) - ## php/runtime/memory/ReferenceMemory - ## (exec - ## (debug.log! (format "{lux_structure#getByScalarOrCreateAsShortcut}" text.new_line - ## (exception.construct ..unknown_kind_of_object key))) - ## (error! "OOPS!"))) - - ## (php/runtime/memory/ArrayMemory - ## [] (getByScalarOrCreate self {key java/lang/Object}) - ## php/runtime/memory/ReferenceMemory - ## (exec - ## (debug.log! (format "{lux_structure#getByScalarOrCreate}" text.new_line - ## (exception.construct ..unknown_kind_of_object key))) - ## (error! "OOPS!"))) - - ## (php/runtime/memory/ArrayMemory - ## [] (getByScalar self {key java/lang/Object}) - ## php/runtime/memory/ReferenceMemory - ## (exec - ## (debug.log! (format "{lux_structure#getByScalar}" text.new_line - ## (exception.construct ..unknown_kind_of_object key))) - ## (error! "OOPS!"))) - (php/runtime/Memory [] (valueOfIndex self {trace php/runtime/env/TraceInfo} @@ -312,16 +260,6 @@ )) (undefined)))) - ## (php/runtime/Memory - ## [] (valueOfIndexAsShortcut self - ## {trace php/runtime/env/TraceInfo} - ## {index php/runtime/Memory}) - ## php/runtime/Memory - ## (exec - ## (debug.log! (format "{lux_structure#valueOfIndexAsShortcut}" text.new_line - ## (exception.construct ..unknown_kind_of_object index))) - ## (error! "OOPS!"))) - (php/runtime/Memory [] (valueOfIndex self {trace php/runtime/env/TraceInfo} @@ -488,14 +426,6 @@ (new [])]) (def: (ensure_macro macro) - ## (-> Macro (Maybe php/runtime/lang/Closure)) - ## (do maybe.monad - ## [object_memory (|> macro - ## (:coerce java/lang/Object) - ## (host.check php/runtime/memory/ObjectMemory))] - ## (|> object_memory - ## php/runtime/memory/ObjectMemory::value - ## (host.check php/runtime/lang/Closure))) (-> Macro (Maybe php/runtime/memory/ObjectMemory)) (|> macro (:coerce java/lang/Object) @@ -540,32 +470,20 @@ (io (let [run! (: (-> (_.Code Any) (Try Any)) (function (recur code) (do try.monad - [output (case (javax/script/ScriptEngine::eval (format "<?php " (_.code code)) ..interpreter) - (#try.Success output) - (#try.Success output) - - (#try.Failure error) - (exec - ("lux io log" "(#try.Failure error)") - ("lux io log" (_.code code)) - (#try.Failure error)))] + [output (javax/script/ScriptEngine::eval (format "<?php " (_.code code)) ..interpreter)] (..read output))))] (: (Host _.Expression _.Statement) (structure (def: (evaluate! context code) (run! (_.return code))) - (def: (execute! code) - (exec - ("lux io log" (_.code code)) - (run! code))) + (def: execute! run!) (def: (define! context input) (let [global (reference.artifact context) @global (_.global global)] (do try.monad - [#let [definition (_.; (_.set @global input)) - _ ("lux io log" (_.code definition))] + [#let [definition (_.; (_.set @global input))] _ (run! definition) value (run! (_.return @global))] (wrap [global value definition])))) @@ -582,7 +500,7 @@ (run! (_.return (_.var (reference.artifact context))))))))))) (def: platform - (IO (Platform _.Location _.Expression _.Statement)) + (IO (Platform [Nat _.Label] _.Expression _.Statement)) (do io.monad [host ..host] (wrap {#platform.&file_system (file.async file.default) @@ -660,7 +578,7 @@ generation.bundle extension/bundle.empty ..program - [_.Location _.Expression _.Statement] + [(& Nat _.Label) _.Expression _.Statement] ..extender service [(packager.package (_.manual "") |