summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/EvalLoop.scala
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2005-12-19 13:49:03 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2005-12-19 13:49:03 +0000
commitac849228490d5a0e2d3f048d649297d5c59b6ade (patch)
tree6314f2c06f37e67dec5827c3f94e25cf844a085c /src/compiler/scala/tools/nsc/EvalLoop.scala
parentd6c0efe5b4b89a0337f1cdcdabf8c607d81f4ae1 (diff)
downloadscala-ac849228490d5a0e2d3f048d649297d5c59b6ade.tar.gz
scala-ac849228490d5a0e2d3f048d649297d5c59b6ade.tar.bz2
scala-ac849228490d5a0e2d3f048d649297d5c59b6ade.zip
Switching to the new build system and to the ne...
Switching to the new build system and to the new build system. This is a MAJOR commit, so be careful when updating.
Diffstat (limited to 'src/compiler/scala/tools/nsc/EvalLoop.scala')
-rw-r--r--src/compiler/scala/tools/nsc/EvalLoop.scala19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/EvalLoop.scala b/src/compiler/scala/tools/nsc/EvalLoop.scala
new file mode 100644
index 0000000000..240547491a
--- /dev/null
+++ b/src/compiler/scala/tools/nsc/EvalLoop.scala
@@ -0,0 +1,19 @@
+package scala.tools.nsc;
+
+import java.io._;
+
+trait EvalLoop {
+
+ def prompt: String;
+
+ def loop(action: (String) => Unit): unit = {
+ val in = new BufferedReader(new InputStreamReader(System.in));
+ System.out.print(prompt);
+ var line = in.readLine();
+ while (line != null && line.length() > 0) {
+ action(line);
+ System.out.print(prompt);
+ line = in.readLine();
+ }
+ }
+}