summaryrefslogtreecommitdiff
path: root/src/LispScriptEngine.kt
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-08-10 01:37:33 +0200
committernea <nea@nea.moe>2023-08-10 01:37:33 +0200
commit74371302593ee2ee365e697911c364246f460b63 (patch)
treef4c8e5c4e7f31fbab219425795d967ed8b77e4d0 /src/LispScriptEngine.kt
parent7ce91434a452dc68f39aa34b646e691635c55e07 (diff)
downloadnealisp-74371302593ee2ee365e697911c364246f460b63.tar.gz
nealisp-74371302593ee2ee365e697911c364246f460b63.tar.bz2
nealisp-74371302593ee2ee365e697911c364246f460b63.zip
Add builtins
Diffstat (limited to 'src/LispScriptEngine.kt')
-rw-r--r--src/LispScriptEngine.kt6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/LispScriptEngine.kt b/src/LispScriptEngine.kt
index 3d2db8f..94dd4c6 100644
--- a/src/LispScriptEngine.kt
+++ b/src/LispScriptEngine.kt
@@ -8,11 +8,15 @@ import javax.script.SimpleBindings
class LispScriptEngine(private val factory: LispScriptEngineFactory) : AbstractScriptEngine() {
val executionContext = LispExecutionContext()
+
+ init {
+ executionContext.setupStandardBindings()
+ }
+
override fun eval(script: String, context: ScriptContext): LispData? {
val fileName = context.getAttribute("scriptName") as? String ?: "script.lisp"
val program = LispParser.parse(fileName, script)
val root = executionContext.genBindings()
- CoreBindings.offerAllTo(root)
for ((name, value) in context.getBindings(ScriptContext.ENGINE_SCOPE)) {
when (value) {
is String -> root.setValueLocal(name, LispData.LispString(value))