Create some new standard library modules

This commit is contained in:
2020-03-13 13:36:50 +01:00
parent a5fba7e8b1
commit 264100eef1
12 changed files with 82 additions and 18 deletions

View File

View File

@@ -0,0 +1,7 @@
version=0.0.1
pluginVersion=0.1
pluginId=smnp.lang.debug
pluginClass=
pluginProvider=Bartłomiej Pluta
pluginDependencies=

View File

@@ -0,0 +1,9 @@
package io.smnp.ext
import io.smnp.ext.function.CallStackFunction
import org.pf4j.Extension
@Extension
class DebugModule : NativeModuleProvider("smnp.lang.debug") {
override fun functions() = listOf(CallStackFunction())
}

View File

@@ -0,0 +1,15 @@
package io.smnp.ext.function
import io.smnp.callable.function.Function
import io.smnp.callable.function.FunctionDefinitionTool
import io.smnp.callable.signature.Signature
import io.smnp.type.model.Value
class CallStackFunction : Function("callstack") {
override fun define(new: FunctionDefinitionTool) {
new function Signature.simple() body { env, _ ->
env.printCallStack()
Value.void()
}
}
}