From cd71a864ad5be13ed6ec6d046e0a2cb1087bdf94 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 10 Sep 2021 01:21:23 -0400 Subject: Migrated variants to the new syntax. --- lux-python/source/program.lux | 56 +++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'lux-python') diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux index afb244311..4aa41e066 100644 --- a/lux-python/source/program.lux +++ b/lux-python/source/program.lux @@ -128,17 +128,17 @@ (array.empty size))] (if (n.< size idx) (case (org/python/core/PyObject::__getitem__ (.int idx) host_object) - (#try.Failure try) - (#try.Failure try) + {#try.Failure try} + {#try.Failure try} - (#try.Success value) + {#try.Success value} (case (read value) - (#try.Failure try) - (#try.Failure try) + {#try.Failure try} + {#try.Failure try} - (#try.Success lux_value) + {#try.Success lux_value} (recur (++ idx) (array.write! idx lux_value output)))) - (#try.Success output))))) + {#try.Success output})))) (exception: (unknown_kind_of_object [object java/lang/Object]) (exception.report @@ -149,26 +149,26 @@ (case [(org/python/core/PyObject::__getitem__ +0 host_object) (org/python/core/PyObject::__getitem__ +1 host_object) (org/python/core/PyObject::__getitem__ +2 host_object)] - (^or [(#try.Failure try) _ _] - [_ (#try.Failure try) _] - [_ _ (#try.Failure try)]) - (#try.Failure try) + (^or [{#try.Failure try} _ _] + [_ {#try.Failure try} _] + [_ _ {#try.Failure try}]) + {#try.Failure try} - (^multi [(#try.Success tag) (#try.Success flag) (#try.Success value)] + (^multi [{#try.Success tag} {#try.Success flag} {#try.Success value}] [(read tag) - (#try.Success tag)] + {#try.Success tag}] [(read value) - (#try.Success value)]) - (#try.Success [tag + {#try.Success value}]) + {#try.Success [tag (: Any (case (ffi.check org/python/core/PyNone (:as java/lang/Object flag)) - (#.Some _) + {#.Some _} (:as Any (ffi.null)) #.None (:as Any synthesis.unit))) - value]) + value]} _ (exception.except ..unknown_kind_of_object [(:as java/lang/Object host_object)]))) @@ -177,8 +177,8 @@ Translator (`` (<| (~~ (template [ ] [(case (ffi.check (:as host_object)) - (#.Some host_object) - (#try.Success (`` (|> host_object (~~ (template.spliced ))))) + {#.Some host_object} + {#try.Success (`` (|> host_object (~~ (template.spliced ))))} _)] @@ -198,7 +198,7 @@ )) (~~ (template [ ] [(case (ffi.check host_object) - (#.Some host_object) + {#.Some host_object} (<| (:as org/python/core/PyObject) host_object) _)] @@ -207,7 +207,7 @@ [org/python/core/PyList (..read_tuple read)] )) ... (exception.except ..unknown_kind_of_object [(:as java/lang/Object host_object)]) - (#try.Success host_object)))) + {#try.Success host_object}))) (exception: (cannot_apply_a_non_function [object java/lang/Object]) (exception.report @@ -249,16 +249,16 @@ (def: (expander macro inputs lux) Expander (case (ensure_macro macro) - (#.Some macro) + {#.Some macro} (case (..call_macro inputs lux macro) - (#try.Success output) + {#try.Success output} (|> output (:as org/python/core/PyObject) ..read (:as (Try (Try [Lux (List Code)])))) - (#try.Failure error) - (#try.Failure error)) + {#try.Failure error} + {#try.Failure error}) #.None (exception.except ..cannot_apply_a_non_function (:as java/lang/Object macro)))))] @@ -268,7 +268,7 @@ @.python (def: (expander macro inputs lux) Expander - (#try.Success ((:as Macro' macro) inputs lux)))])) + {#try.Success ((:as Macro' macro) inputs lux)})])) (with_expansions [ (def: host (IO (Host (_.Expression Any) (_.Statement Any))) @@ -281,10 +281,10 @@ execute! (: (-> (_.Statement Any) (Try Any)) (function (execute! input) (case (org/python/util/PythonInterpreter::exec (_.code input) interpreter) - (#try.Failure error) + {#try.Failure error} (if (text.contains? "maximum recursion depth exceeded" error) (execute! input) - (#try.Failure error)) + {#try.Failure error}) output output)))] -- cgit v1.2.3