All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jetbrains.kotlinx.jupyter.repl.InternalEvaluator.kt Maven / Gradle / Ivy

Go to download

Implementation of REPL compiler and preprocessor for Jupyter dialect of Kotlin (IDE-compatible)

There is a newer version: 0.12.0-290
Show newest version
package org.jetbrains.kotlinx.jupyter.repl

import org.jetbrains.kotlinx.jupyter.api.Code
import org.jetbrains.kotlinx.jupyter.api.VariableState
import org.jetbrains.kotlinx.jupyter.config.JupyterCompilingOptions
import org.jetbrains.kotlinx.jupyter.repl.execution.EvaluatorWorkflowListener
import org.jetbrains.kotlinx.jupyter.repl.result.InternalEvalResult
import org.jetbrains.kotlinx.jupyter.repl.result.SerializedCompiledScriptsData
import kotlin.reflect.KClass

interface InternalEvaluator {
    var executionLogging: ExecutedCodeLogging
    var writeCompiledClasses: Boolean
    var serializeScriptData: Boolean

    val lastKClass: KClass<*>
    val lastClassLoader: ClassLoader

    val variablesHolder: Map

    val cellVariables: Map>

    /**
     * Executes code snippet
     * @throws IllegalStateException if this method was invoked recursively
     */
    fun eval(
        code: Code,
        compilingOptions: JupyterCompilingOptions = JupyterCompilingOptions.DEFAULT,
        evaluatorWorkflowListener: EvaluatorWorkflowListener? = null,
    ): InternalEvalResult

    /**
     * Pop a serialized form of recently added compiled scripts
     *
     * This operation is stateful: second call of this method in a row always
     * returns empty data or null
     */
    fun popAddedCompiledScripts(): SerializedCompiledScriptsData = SerializedCompiledScriptsData.EMPTY
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy