blob: e11fbf5cc1e00387da3693ad63c5ffa9327f29ad (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package dotty.tools
package dotc
package repl
import core.Contexts.Context
/** This object defines the type of interpreter results */
object Interpreter {
/** A result from interpreting one line of input. */
abstract sealed class Result
/** The line was interpreted successfully. */
case object Success extends Result
/** The line was erroneous in some way. */
case object Error extends Result
/** The input was incomplete. The caller should request more input.
*/
case object Incomplete extends Result
}
/** The exported functionality of the interpreter */
trait Interpreter {
import Interpreter._
/** Interpret one line of input. All feedback, including parse errors and
* evaluation results, are printed via the context's reporter. Values
* defined are available for future interpreted strings.
*/
def interpret(line: String)(implicit ctx: Context): Result
/** Tries to bind an id to a value, returns the outcome of trying to bind */
def bind(id: String, boundType: String, value: AnyRef)(implicit ctx: Context): Result
/** Suppress output during evaluation of `operation`. */
def beQuietDuring[T](operation: => T): T
/** Suppresses output and saves it for `lastOutput` to collect */
def delayOutputDuring[T](operation: => T): T
/** Gets the last output not printed immediately */
def lastOutput(): List[String]
}
|