diff options
author | liu fengyun <liufengyunchina@gmail.com> | 2016-04-05 23:31:43 +0200 |
---|---|---|
committer | liu fengyun <liufengyunchina@gmail.com> | 2016-04-05 23:31:43 +0200 |
commit | 438cdf65009bee20e09bc9e63eb74a741e1dd72b (patch) | |
tree | d06b5045258e3ac9c2b3b6d211e5217ce017b0c3 | |
parent | d1ffa3e34610422cc8ec8a90c330cae548fa2ba6 (diff) | |
download | dotty-438cdf65009bee20e09bc9e63eb74a741e1dd72b.tar.gz dotty-438cdf65009bee20e09bc9e63eb74a741e1dd72b.tar.bz2 dotty-438cdf65009bee20e09bc9e63eb74a741e1dd72b.zip |
simple integration with jline
-rwxr-xr-x | bin/dotc | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/repl/InteractiveReader.scala | 11 | ||||
-rw-r--r-- | src/dotty/tools/dotc/repl/JLineReader.scala | 15 |
3 files changed, 19 insertions, 9 deletions
@@ -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) +} |