aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliu fengyun <liufengyunchina@gmail.com>2016-04-05 23:31:43 +0200
committerliu fengyun <liufengyunchina@gmail.com>2016-04-05 23:31:43 +0200
commit438cdf65009bee20e09bc9e63eb74a741e1dd72b (patch)
treed06b5045258e3ac9c2b3b6d211e5217ce017b0c3
parentd1ffa3e34610422cc8ec8a90c330cae548fa2ba6 (diff)
downloaddotty-438cdf65009bee20e09bc9e63eb74a741e1dd72b.tar.gz
dotty-438cdf65009bee20e09bc9e63eb74a741e1dd72b.tar.bz2
dotty-438cdf65009bee20e09bc9e63eb74a741e1dd72b.zip
simple integration with jline
-rwxr-xr-xbin/dotc2
-rw-r--r--src/dotty/tools/dotc/repl/InteractiveReader.scala11
-rw-r--r--src/dotty/tools/dotc/repl/JLineReader.scala15
3 files changed, 19 insertions, 9 deletions
diff --git a/bin/dotc b/bin/dotc
index 5798e0523..f6c1db6c1 100755
--- a/bin/dotc
+++ b/bin/dotc
@@ -38,7 +38,7 @@ unset verbose quiet cygwin toolcp colors saved_stty CDPATH
CompilerMain=dotty.tools.dotc.Main
FromTasty=dotty.tools.dotc.FromTasty
-ReplMain=test.DottyRepl
+ReplMain=dotty.tools.dotc.repl.Main
diff --git a/src/dotty/tools/dotc/repl/InteractiveReader.scala b/src/dotty/tools/dotc/repl/InteractiveReader.scala
index 96c55ebd0..29ecd3c9d 100644
--- a/src/dotty/tools/dotc/repl/InteractiveReader.scala
+++ b/src/dotty/tools/dotc/repl/InteractiveReader.scala
@@ -8,24 +8,19 @@ trait InteractiveReader {
val interactive: Boolean
}
-/** TODO Enable jline support.
- * The current Scala REPL know how to do this flexibly.
+/** The current Scala REPL know how to do this flexibly.
*/
object InteractiveReader {
/** Create an interactive reader. Uses JLine if the
* library is available, but otherwise uses a
* SimpleReader. */
- def createDefault(): InteractiveReader = new SimpleReader()
- /*
- {
+ def createDefault(): InteractiveReader = {
try {
- new JLineReader
+ new JLineReader()
} catch {
case e =>
//out.println("jline is not available: " + e) //debug
new SimpleReader()
}
}
-*/
-
}
diff --git a/src/dotty/tools/dotc/repl/JLineReader.scala b/src/dotty/tools/dotc/repl/JLineReader.scala
new file mode 100644
index 000000000..592b19df5
--- /dev/null
+++ b/src/dotty/tools/dotc/repl/JLineReader.scala
@@ -0,0 +1,15 @@
+package dotty.tools
+package dotc
+package repl
+
+import jline.console.ConsoleReader
+
+/** Adaptor for JLine
+ */
+class JLineReader extends InteractiveReader {
+ val reader = new ConsoleReader()
+
+ val interactive = true
+
+ def readLine(prompt: String) = reader.readLine(prompt)
+}