diff options
author | Lex Spoon <lex@lexspoon.org> | 2006-06-15 14:40:06 +0000 |
---|---|---|
committer | Lex Spoon <lex@lexspoon.org> | 2006-06-15 14:40:06 +0000 |
commit | a605ab716e02a220568b4a315503356630268896 (patch) | |
tree | d6af69276e823e7a4ad00108bd13ffc8e0f1a01d | |
parent | 39a1658065dec265fe40f35c8510f92c3f952811 (diff) | |
download | scala-a605ab716e02a220568b4a315503356630268896.tar.gz scala-a605ab716e02a220568b4a315503356630268896.tar.bz2 scala-a605ab716e02a220568b4a315503356630268896.zip |
split main in half, so that the second half can...
split main in half, so that the second half can be reused by
MainGenericRunner
-rw-r--r-- | src/compiler/scala/tools/nsc/InterpreterLoop.scala | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/src/compiler/scala/tools/nsc/InterpreterLoop.scala b/src/compiler/scala/tools/nsc/InterpreterLoop.scala index 504abe9c28..88987898f0 100644 --- a/src/compiler/scala/tools/nsc/InterpreterLoop.scala +++ b/src/compiler/scala/tools/nsc/InterpreterLoop.scala @@ -164,8 +164,6 @@ class InterpreterLoop(in: BufferedReader, out: PrintWriter) { replay else if (line.startsWith(":")) out.println("Unknown command. Type :help for help.") - else if (line.startsWith("#!/")) // skip the first line of Unix scripts - () else { if(interpreter.interpret(line)) shouldReplay = true @@ -173,12 +171,8 @@ class InterpreterLoop(in: BufferedReader, out: PrintWriter) { Pair(true, shouldReplay) } - - /** process command-line arguments and do as they request */ - def main(args: Array[String]): unit = { - def error1(msg: String): Unit = out.println("scalaint: " + msg) - val command = new InterpreterCommand(List.fromArray(args), error1) - settings = command.settings + def main(settings: Settings) = { + this.settings = settings uglinessxxx = new java.net.URLClassLoader( @@ -186,6 +180,21 @@ class InterpreterLoop(in: BufferedReader, out: PrintWriter) { map(s => new File(s).toURL), ClassLoader.getSystemClassLoader) + createInterpreter + + try { + printHelp + repl + } finally { + closeInterpreter + } + } + + /** process command-line arguments and do as they request */ + def main(args: Array[String]): unit = { + def error1(msg: String): Unit = out.println("scalaint: " + msg) + val command = new InterpreterCommand(List.fromArray(args), error1) + if (!command.ok || command.settings.help.value) { // either the command line is wrong, or the user // explicitly requested a help listing @@ -194,23 +203,6 @@ class InterpreterLoop(in: BufferedReader, out: PrintWriter) { return () } - createInterpreter - - try { - if (!command.files.isEmpty) { - interpreter.beQuiet - command.files match { - case List(filename) => interpretAllFrom(filename) - case _ => out.println( - "Sorry, arguments to interpreter scripts are not currently supported.") - } - } else { - printHelp - repl - } - } finally { - closeInterpreter - } + main(command.settings) } - } |