aboutsummaryrefslogblamecommitdiff
path: root/src/dotty/tools/dotc/repl/InteractiveReader.scala
blob: 29ecd3c9d671ac08eb717f183538589cedb286dc (plain) (tree)
1
2
3
4
5
6
7
8
9
10









                                       
                                                        
   



                                                      
                                            
         
                       





                                                             
 
package dotty.tools
package dotc
package repl

/** Reads lines from an input stream */
trait InteractiveReader {
  def readLine(prompt: String): String
  val interactive: Boolean
}

/** 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 = {
    try {
      new JLineReader()
    } catch {
      case e =>
        //out.println("jline is not available: " + e) //debug
	      new SimpleReader()
    }
  }
}