aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/repl/InterpreterLoop.scala
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-04-27 12:00:29 +0200
committerFelix Mulder <felix.mulder@gmail.com>2016-04-28 11:00:39 +0200
commitd04984596c6abfa27b217b12a42caca26f0c269f (patch)
tree5657a2a1da905954fbab71f49a9cb477f7a690e7 /src/dotty/tools/dotc/repl/InterpreterLoop.scala
parent96cedcdcd82148f091989836eb4959b2c3ec3382 (diff)
downloaddotty-d04984596c6abfa27b217b12a42caca26f0c269f.tar.gz
dotty-d04984596c6abfa27b217b12a42caca26f0c269f.tar.bz2
dotty-d04984596c6abfa27b217b12a42caca26f0c269f.zip
Add multiline support using ammonite multilineFilter
Diffstat (limited to 'src/dotty/tools/dotc/repl/InterpreterLoop.scala')
-rw-r--r--src/dotty/tools/dotc/repl/InterpreterLoop.scala24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/dotty/tools/dotc/repl/InterpreterLoop.scala b/src/dotty/tools/dotc/repl/InterpreterLoop.scala
index 4ac9602e7..64414fec3 100644
--- a/src/dotty/tools/dotc/repl/InterpreterLoop.scala
+++ b/src/dotty/tools/dotc/repl/InterpreterLoop.scala
@@ -24,10 +24,10 @@ import scala.concurrent.ExecutionContext.Implicits.global
class InterpreterLoop(compiler: Compiler, config: REPL.Config)(implicit ctx: Context) {
import config._
- private var in = input
-
val interpreter = compiler.asInstanceOf[Interpreter]
+ private var in = input(interpreter)
+
/** The context class loader at the time this object was created */
protected val originalClassLoader =
Thread.currentThread.getContextClassLoader
@@ -74,10 +74,10 @@ class InterpreterLoop(compiler: Compiler, config: REPL.Config)(implicit ctx: Con
* line of input to be entered.
*/
def firstLine(): String = {
- val futLine = Future(in.readLine(prompt))
+ val line = in.readLine(prompt)
interpreter.beQuietDuring(
interpreter.interpret("val theAnswerToLifeInTheUniverseAndEverything = 21 * 2"))
- Await.result(futLine, Duration.Inf)
+ line
}
/** The main read-eval-print loop for the interpreter. It calls
@@ -178,23 +178,11 @@ class InterpreterLoop(compiler: Compiler, config: REPL.Config)(implicit ctx: Con
* read, go ahead and interpret it. Return the full string
* to be recorded for replay, if any.
*/
- def interpretStartingWith(code: String): Option[String] = {
+ def interpretStartingWith(code: String): Option[String] =
interpreter.interpret(code) match {
case Interpreter.Success => Some(code)
- case Interpreter.Error => None
- case Interpreter.Incomplete =>
- if (in.interactive && code.endsWith("\n\n")) {
- output.println("You typed two blank lines. Starting a new command.")
- None
- } else {
- val nextLine = in.readLine(continuationPrompt)
- if (nextLine == null)
- None // end of file
- else
- interpretStartingWith(code + "\n" + nextLine)
- }
+ case _ => None
}
- }
/*
def loadFiles(settings: Settings) {
settings match {