summaryrefslogblamecommitdiff
path: root/src/compiler/scala/tools/nsc/EvalLoop.scala
blob: ea58f8b9b0769db62fbd86c16ded77d4a24c3147 (plain) (tree)
1
2
3
4
5
6
7
8
9
                            
                                




                          
 
                
 
                    
 
                                      

                               
                                              

                  

     
 
 
/* NSC -- new Scala compiler
 * Copyright 2005-2007 LAMP/EPFL
 * @author  Martin Odersky
 */
// $Id$

package scala.tools.nsc

trait EvalLoop {

  def prompt: String

  def loop(action: (String) => Unit) {
    Console.print(prompt)
    val line = Console.readLine
    if ((line ne null) && line.length() > 0) {
      action(line)
      loop(action)
    }
  }

}