aboutsummaryrefslogtreecommitdiff
path: root/lux-lua
diff options
context:
space:
mode:
authorEduardo Julian2019-04-12 21:47:02 -0400
committerEduardo Julian2019-04-12 21:47:02 -0400
commitd2d6e69133ccfe7b2ee1723d1785e8cb3458678d (patch)
tree58868bcd846167022cd151f165836912d9ef45bc /lux-lua
parentf2937706edb6887c5eb1a6a0b6668b1334f5ef3b (diff)
Added some debugging machinery.
Diffstat (limited to 'lux-lua')
-rw-r--r--lux-lua/source/program.lux58
1 files changed, 1 insertions, 57 deletions
diff --git a/lux-lua/source/program.lux b/lux-lua/source/program.lux
index c49f15a4a..13d6862b0 100644
--- a/lux-lua/source/program.lux
+++ b/lux-lua/source/program.lux
@@ -44,71 +44,15 @@
(import: #long java/lang/String)
-(import: #long (java/lang/Class a)
- (getCanonicalName [] java/lang/String))
+(import: #long (java/lang/Class a))
(import: #long java/lang/Object
- (new [])
(toString [] java/lang/String)
(getClass [] (java/lang/Class java/lang/Object)))
-(import: #long java/lang/Integer
- (longValue [] java/lang/Long))
-
(import: #long java/lang/Long
(intValue [] java/lang/Integer))
-(import: #long java/lang/Number
- (intValue [] java/lang/Integer)
- (longValue [] long)
- (doubleValue [] double))
-
-(def: (inspect object)
- (-> java/lang/Object Text)
- (<| (case (host.check java/lang/Boolean object)
- (#.Some value)
- (%b value)
- #.None)
- (case (host.check java/lang/String object)
- (#.Some value)
- (%t value)
- #.None)
- (case (host.check java/lang/Long object)
- (#.Some value)
- (%i (.int value))
- #.None)
- (case (host.check java/lang/Number object)
- (#.Some value)
- (%f (java/lang/Number::doubleValue value))
- #.None)
- (case (host.check (Array java/lang/Object) object)
- (#.Some value)
- (let [value (:coerce (Array java/lang/Object) value)]
- (case (array.read 0 value)
- (^multi (#.Some tag)
- [(host.check java/lang/Integer tag)
- (#.Some tag)]
- [[(array.read 1 value)
- (array.read 2 value)]
- [last?
- (#.Some choice)]])
- (let [last? (case last?
- (#.Some _) #1
- #.None #0)]
- (|> (format (%n (.nat (java/lang/Integer::longValue tag)))
- " " (%b last?)
- " " (inspect choice))
- (text.enclose ["(" ")"])))
-
- _
- (|> value
- array.to-list
- (list@map inspect)
- (text.join-with " ")
- (text.enclose ["[" "]"]))))
- #.None)
- (java/lang/Object::toString object)))
-
(import: #long net/sandius/rembulan/StateContext)
(import: #long net/sandius/rembulan/impl/StateContexts