summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala
diff options
context:
space:
mode:
authorLex Spoon <lex@lexspoon.org>2007-07-17 11:31:53 +0000
committerLex Spoon <lex@lexspoon.org>2007-07-17 11:31:53 +0000
commit51ff43f81193caed211017c3b92644b7a33667f5 (patch)
tree6a29ab0efb606756b526a0010678d6237d56d536 /src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala
parenta840917b32e1c0f25b846f48bd0f12088fe170b2 (diff)
downloadscala-51ff43f81193caed211017c3b92644b7a33667f5.tar.gz
scala-51ff43f81193caed211017c3b92644b7a33667f5.tar.bz2
scala-51ff43f81193caed211017c3b92644b7a33667f5.zip
Support jline in the interactive shell.
Diffstat (limited to 'src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala')
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala
new file mode 100644
index 0000000000..eb3c475d26
--- /dev/null
+++ b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala
@@ -0,0 +1,32 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2007 LAMP/EPFL
+ * @author Stepan Koltsov
+ */
+// $Id$
+
+package scala.tools.nsc.interpreter
+
+/** Reads lines from an input stream */
+trait InteractiveReader {
+ def readLine(prompt: String): String
+ val interactive: Boolean
+}
+
+
+
+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()
+ }
+ }
+
+
+}