Skip to content

Commit

Permalink
simple integration with jline
Browse files Browse the repository at this point in the history
  • Loading branch information
liufengyun committed Apr 5, 2016
1 parent d1ffa3e commit 438cdf6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bin/dotc
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand Down
11 changes: 3 additions & 8 deletions src/dotty/tools/dotc/repl/InteractiveReader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
*/

}
15 changes: 15 additions & 0 deletions src/dotty/tools/dotc/repl/JLineReader.scala
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit 438cdf6

Please sign in to comment.