summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CoreBindings.kt2
-rw-r--r--src/LispData.kt2
-rw-r--r--src/LispExecutionContext.kt1
3 files changed, 3 insertions, 2 deletions
diff --git a/src/CoreBindings.kt b/src/CoreBindings.kt
index b90072e..2208b8c 100644
--- a/src/CoreBindings.kt
+++ b/src/CoreBindings.kt
@@ -118,6 +118,7 @@ object CoreBindings {
is LispData.LispString -> thing.string
is LispData.LispHash -> thing.map.asIterable().joinToString(", ", "{", "}") { it.key + ": " + it.value }
is LispData.LispNumber -> thing.value.toString()
+ is LispData.ForeignObject<*> -> "<foreign ${thing.obj}>"
is LispData.LispInterpretedCallable -> "<function ${thing.name ?: "<anonymous>"} ${thing.argNames} ${thing.body.toSource()}>"
}
}
@@ -225,6 +226,7 @@ object CoreBindings {
LispData.LispNil -> LispData.Atom("nil")
is LispData.LispHash -> LispData.Atom("hash")
is LispData.LispNode -> LispData.Atom("ast")
+ is LispData.ForeignObject<*> -> LispData.Atom("foreign")
is LispData.LispNumber -> LispData.Atom("number")
is LispData.LispString -> LispData.Atom("string")
}
diff --git a/src/LispData.kt b/src/LispData.kt
index ea3af32..61c2b76 100644
--- a/src/LispData.kt
+++ b/src/LispData.kt
@@ -8,6 +8,7 @@ sealed class LispData {
data class LispNumber(val value: Double) : LispData()
data class LispNode(val node: LispAst.LispNode) : LispData()
data class LispHash(val map: Map<String, LispData>) : LispData()
+ data class ForeignObject<T : Any?>(val obj: T) : LispData()
class LispList(val elements: List<LispData>) : LispData()
sealed class LispExecutable() : LispData() {
abstract fun execute(
@@ -56,7 +57,6 @@ sealed class LispData {
}
}
-
companion object {
fun externalRawCall(
name: String,
diff --git a/src/LispExecutionContext.kt b/src/LispExecutionContext.kt
index 306e111..0a1dc41 100644
--- a/src/LispExecutionContext.kt
+++ b/src/LispExecutionContext.kt
@@ -36,7 +36,6 @@ class LispExecutionContext() {
return testSuite
}
-
fun registerModule(moduleName: String, program: LispAst.Program) {
if (moduleName in unloadedModules || moduleName in modules) {
error("Cannot register already registered module $moduleName")