From ca238f9c89d3156842b0a3d5fe24a5d69b2eedb0 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 6 Apr 2018 08:32:41 -0400 Subject: - Adapted new-luxc's code to latest stdlib changes. --- .../luxc/lang/translation/python/eval.jvm.lux | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/python/eval.jvm.lux') diff --git a/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux index bc6e1a342..164d088df 100644 --- a/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux @@ -11,6 +11,16 @@ (lang (host [python #+ Expression Statement]))) [//]) +(do-template [] + [(exception: #export ( {message Text}) + message)] + + [Not-A-Variant] + [Unknown-Kind-Of-Host-Object] + [Null-Has-No-Lux-Representation] + [Cannot-Evaluate] + ) + (host.import java/lang/Object (toString [] String) (getClass [] (Class Object))) @@ -57,8 +67,6 @@ (-> PyObject Text) (|>> (PyObject::getType []) (PyType::getName []) (:! Text))) -(exception: #export Not-A-Variant) - (def: tag-field (PyString::new [//.variant-tag-field])) (def: flag-field (PyString::new [//.variant-flag-field])) (def: value-field (PyString::new [//.variant-value-field])) @@ -89,9 +97,6 @@ _ (ex.throw Not-A-Variant (Object::toString [] host-object)))) -(exception: #export Unknown-Kind-Of-Host-Object) -(exception: #export Null-Has-No-Lux-Representation) - (def: (lux-object host-object) (-> PyObject (Error Top)) (case (python-type host-object) @@ -119,11 +124,9 @@ type (ex.throw Unknown-Kind-Of-Host-Object (format type " " (Object::toString [] host-object))))) -(exception: #export Cannot-Evaluate) - (def: #export (eval code) (-> Expression (Meta Top)) - (function [compiler] + (function (_ compiler) (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] (case (interpreter code) (#e.Error error) @@ -136,7 +139,7 @@ (case (lux-object output) (#e.Success parsed-output) (exec ## (log! (format "eval #e.Success\n" - ## "<< " (python.expression code))) + ## "<< " (python.expression code))) (#e.Success [compiler parsed-output])) (#e.Error error) -- cgit v1.2.3