summaryrefslogtreecommitdiff
path: root/sources/scala/tools/nsc/Main.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2005-09-28 15:14:00 +0000
committerMartin Odersky <odersky@gmail.com>2005-09-28 15:14:00 +0000
commit9055a919a643f98e38c342d15037655dc50bca19 (patch)
tree71afa87274541c0ab4f483e0743397bfdd435acf /sources/scala/tools/nsc/Main.scala
parentb65ef22c4d8de7784d021e0314fc520a5098092b (diff)
downloadscala-9055a919a643f98e38c342d15037655dc50bca19.tar.gz
scala-9055a919a643f98e38c342d15037655dc50bca19.tar.bz2
scala-9055a919a643f98e38c342d15037655dc50bca19.zip
*** empty log message ***
Diffstat (limited to 'sources/scala/tools/nsc/Main.scala')
-rwxr-xr-xsources/scala/tools/nsc/Main.scala34
1 files changed, 17 insertions, 17 deletions
diff --git a/sources/scala/tools/nsc/Main.scala b/sources/scala/tools/nsc/Main.scala
index 686b077372..9c158c85b1 100755
--- a/sources/scala/tools/nsc/Main.scala
+++ b/sources/scala/tools/nsc/Main.scala
@@ -24,19 +24,18 @@ object Main {
def error(msg: String): unit =
reporter.error(new Position(PRODUCT),
- msg + "\n " + PRODUCT + " -help gives more information");
+ msg + "\n " + PRODUCT + " -help gives more information");
def errors() = reporter.errors();
- def interactive(gCompiler: Global): unit = {
+ def resident(compiler: Global): unit = {
val in = new BufferedReader(new InputStreamReader(System.in));
- val interpreter = new Interpreter {
- val compiler: gCompiler.type = gCompiler
- };
System.out.print(prompt);
var line = in.readLine();
while (line != null && line.length() > 0) {
- interpreter.interpret(line.trim(), reporter);
+ val args = List.fromString(line, ' ');
+ val command = new CompilerCommand(args, error, true);
+ (new compiler.Run) compile command.files;
System.out.print(prompt);
line = in.readLine();
}
@@ -52,18 +51,18 @@ object Main {
reporter.info(null, command.usageMsg, true)
else {
try {
- val compiler = new Global(command.settings, reporter);
- if (command.settings.interactive.value)
- interactive(compiler);
- else if (command.files.isEmpty)
- reporter.info(null, command.usageMsg, true)
- else
- compiler.compile(command.files);
+ val compiler = new Global(command.settings, reporter);
+ if (command.settings.resident.value)
+ resident(compiler);
+ else if (command.files.isEmpty)
+ reporter.info(null, command.usageMsg, true)
+ else
+ (new compiler.Run) compile command.files;
} catch {
- case ex @ FatalError(msg) =>
- if (command.settings.debug.value)
- ex.printStackTrace();
- reporter.error(null, "fatal error: " + msg);
+ case ex @ FatalError(msg) =>
+ if (command.settings.debug.value)
+ ex.printStackTrace();
+ reporter.error(null, "fatal error: " + msg);
}
reporter.printSummary()
}
@@ -73,4 +72,5 @@ object Main {
process(args);
System.exit(if (reporter.errors() > 0) 1 else 0);
}
+
}