diff options
author | nea <nea@nea.moe> | 2023-08-10 01:37:33 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-08-10 01:37:33 +0200 |
commit | 74371302593ee2ee365e697911c364246f460b63 (patch) | |
tree | f4c8e5c4e7f31fbab219425795d967ed8b77e4d0 /src/LispScriptEngine.kt | |
parent | 7ce91434a452dc68f39aa34b646e691635c55e07 (diff) | |
download | nealisp-74371302593ee2ee365e697911c364246f460b63.tar.gz nealisp-74371302593ee2ee365e697911c364246f460b63.tar.bz2 nealisp-74371302593ee2ee365e697911c364246f460b63.zip |
Add builtins
Diffstat (limited to 'src/LispScriptEngine.kt')
-rw-r--r-- | src/LispScriptEngine.kt | 6 |
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)) |