summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/interpreter/package.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-01-29 01:43:10 +0000
committerPaul Phillips <paulp@improving.org>2011-01-29 01:43:10 +0000
commitcf492f472aa6d1154cd7336c37bab0b78125b872 (patch)
tree8735c22a25c019a5e694d8f93a0d66e9b4f47940 /src/compiler/scala/tools/nsc/interpreter/package.scala
parentb06bfabfa42cc089521e551acb9876a564ec027f (diff)
downloadscala-cf492f472aa6d1154cd7336c37bab0b78125b872.tar.gz
scala-cf492f472aa6d1154cd7336c37bab0b78125b872.tar.bz2
scala-cf492f472aa6d1154cd7336c37bab0b78125b872.zip
There is a lot of housecleaning to be done.
up the stray interpreter files and put them in the interpreter package. Would really love to change the name of that package. Went looking for some consistent divisions of responsibility and consistent naming. Made some progress. There are deprecated versions of most everything I changed so hopefully the carnage will be limited. This isn't completely baked but I just realized I broke the build earlier and this should fix it. I'll keep the oven on. No review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/interpreter/package.scala')
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/package.scala25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/package.scala b/src/compiler/scala/tools/nsc/interpreter/package.scala
index c59cf8228a..3a10547d81 100644
--- a/src/compiler/scala/tools/nsc/interpreter/package.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/package.scala
@@ -5,12 +5,32 @@
package scala.tools.nsc
+/** The main REPL related classes and values are as follows.
+ * In addition to standard compiler classes Global and Settings, there are:
+ *
+ * History: an interface for session history.
+ * Completion: an interface for tab completion.
+ * ILoop (formerly InterpreterLoop): The umbrella class for a session.
+ * IMain (formerly Interpreter): Handles the evolving state of the session
+ * and handles submitting code to the compiler and handling the output.
+ * InteractiveReader: how ILoop obtains input.
+ * History: an interface for session history.
+ * Completion: an interface for tab completion.
+ * Power: a repository for more advanced/experimental features.
+ *
+ * ILoop contains { in: InteractiveReader, intp: IMain, settings: Settings, power: Power }
+ * InteractiveReader contains { history: History, completion: Completion }
+ * IMain contains { global: Global }
+ */
package object interpreter {
private[nsc] val DebugProperty = "scala.repl.debug"
private[nsc] val PowerProperty = "scala.repl.power"
private[nsc] var _debug = false
private[nsc] def isReplDebug = _debug || (sys.props contains DebugProperty)
+ type JClass = java.lang.Class[_]
+ private[nsc] implicit def enrichClass[T](clazz: Class[T]) = new RichClass[T](clazz)
+
/** Debug output */
def repldbg(msg: String) = if (isReplDebug) Console println msg
@@ -22,6 +42,9 @@ package object interpreter {
x
}
+ private[nsc] def isQuoted(s: String) =
+ (s.length >= 2) && (s.head == s.last) && ("\"'" contains s.head)
+
/** Heuristically strip interpreter wrapper prefixes
* from an interpreter output string.
*/
@@ -31,7 +54,7 @@ package object interpreter {
}
/** Class objects */
- def classForName(name: String): Option[Class[_]] =
+ def classForName(name: String): Option[JClass] =
try Some(Class forName name)
catch { case _: ClassNotFoundException | _: SecurityException => None }
}