summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2006-10-05 14:52:47 +0000
committermichelou <michelou@epfl.ch>2006-10-05 14:52:47 +0000
commit2404604f2d5ba560a4f9523ab23688918dc075be (patch)
tree211512cb69c820a5c2487f195616dbdef27364a7
parent02afba3bf84fc61a7305ef6c1e1ba1e501134c44 (diff)
downloadscala-2404604f2d5ba560a4f9523ab23688918dc075be.tar.gz
scala-2404604f2d5ba560a4f9523ab23688918dc075be.tar.bz2
scala-2404604f2d5ba560a4f9523ab23688918dc075be.zip
cleaned up Scala comments
-rw-r--r--src/compiler/scala/tools/nsc/InterpreterLoop.scala21
-rw-r--r--src/compiler/scala/tools/nsc/ObjectRunner.scala39
2 files changed, 42 insertions, 18 deletions
diff --git a/src/compiler/scala/tools/nsc/InterpreterLoop.scala b/src/compiler/scala/tools/nsc/InterpreterLoop.scala
index 7a847e7ec9..bbd7112129 100644
--- a/src/compiler/scala/tools/nsc/InterpreterLoop.scala
+++ b/src/compiler/scala/tools/nsc/InterpreterLoop.scala
@@ -11,9 +11,13 @@ import java.io._
import scala.tools.nsc.reporters.{Reporter, ConsoleReporter}
import scala.tools.nsc.util.{Position}
-/** The main loop of the command-line interface to the Scala interpreter.
- * After instantiation, clients should call the main() method
- */
+/** The main loop of the command-line interface to the
+ * <a href="http://scala.epfl.ch/" target="_top">Scala</a> interpreter.
+ * After instantiation, clients should call the <code>main()</code> method.
+ *
+ * @author Lex Spoon
+ * @version 1.0
+ */
class InterpreterLoop(in: BufferedReader, out: PrintWriter) {
def this() = this(new BufferedReader(new InputStreamReader(System.in)),
new PrintWriter(System.out))
@@ -68,8 +72,9 @@ class InterpreterLoop(in: BufferedReader, out: PrintWriter) {
}
/** The main read-eval-print loop for the interpereter. It calls
- command() for each line of input, and stops when command()
- returns false */
+ * <code>command()</code> for each line of input, and stops when
+ * <code>command()</code> returns false.
+ */
def repl(): Unit =
while(true) {
out.print("\nscala> ")
@@ -82,7 +87,7 @@ class InterpreterLoop(in: BufferedReader, out: PrintWriter) {
if (!keepGoing)
return ()
- if(shouldReplay)
+ if (shouldReplay)
addReplay(line)
}
@@ -111,7 +116,7 @@ class InterpreterLoop(in: BufferedReader, out: PrintWriter) {
def replay = {
closeInterpreter
createInterpreter
- for(val cmd <- replayCommands) {
+ for (val cmd <- replayCommands) {
out.println("Replaying: " + cmd)
command(cmd)
out.println
@@ -165,7 +170,7 @@ class InterpreterLoop(in: BufferedReader, out: PrintWriter) {
else if (line.startsWith(":"))
out.println("Unknown command. Type :help for help.")
else {
- if(interpreter.interpret(line))
+ if (interpreter.interpret(line))
shouldReplay = true
}
Pair(true, shouldReplay)
diff --git a/src/compiler/scala/tools/nsc/ObjectRunner.scala b/src/compiler/scala/tools/nsc/ObjectRunner.scala
index e1f02d1378..b3cbc88dc9 100644
--- a/src/compiler/scala/tools/nsc/ObjectRunner.scala
+++ b/src/compiler/scala/tools/nsc/ObjectRunner.scala
@@ -11,9 +11,19 @@ import java.io.File
import java.lang.reflect.{Method,Modifier}
import java.net.URLClassLoader
-/** An object that runs another object specified by name. */
+/** An object that runs another object specified by name.
+ *
+ * @author Lex Spoon
+ * @version 1.0, 15/06/2006
+ */
object ObjectRunner {
- /** Look up a class with a given class path */
+
+ /** Look up a class with a given class path.
+ *
+ * @param classpath ...
+ * @param objectName ...
+ * @return ...
+ */
def findClass(classpath: List[String], objectName: String)
: Option[Class] =
{
@@ -27,17 +37,26 @@ object ObjectRunner {
}
/** Check whether a class with the specified name
- * exists on the specified class path.
- */
+ * exists on the specified class path.
+ *
+ * @param classpath ...
+ * @param objectName ...
+ * @return ...
+ */
def classExists(classpath: List[String], objectName: String) =
!(findClass(classpath, objectName).isEmpty)
/** Run a given object, specified by name, using a
- * specified classpath and argument list.
- *
- * Throws: ClassNotFoundException, NoSuchMethodError,
- * InvocationTargetException
- */
+ * specified classpath and argument list.
+ *
+ * @param classpath ...
+ * @param objectName ...
+ * @param arguments ...
+ *
+ * @throws ClassNotFoundException ...
+ * @throws NoSuchMethodError ...
+ * @throws InvocationTargetException ...
+ */
def run(
classpath: List[String],
objectName: String,
@@ -49,7 +68,7 @@ object ObjectRunner {
}
val method = clsToRun.getMethod("main", List(classOf[Array[String]]).toArray)
- if((method.getModifiers & Modifier.STATIC) == 0)
+ if ((method.getModifiers & Modifier.STATIC) == 0)
throw new NoSuchMethodException(objectName + ".main is not static")
method.invoke(null, List(arguments.toArray).toArray)