summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/CompilerCommand.scala
diff options
context:
space:
mode:
authorLex Spoon <lex@lexspoon.org>2006-03-07 11:08:46 +0000
committerLex Spoon <lex@lexspoon.org>2006-03-07 11:08:46 +0000
commit3cc6245389bea0646c07b8a4f76047d492b386f7 (patch)
treef9dd01d0d8fbe9702cc19a5882e476c930d39da7 /src/compiler/scala/tools/nsc/CompilerCommand.scala
parenteb9f31482b78399e35de662e9e90f082a6988927 (diff)
downloadscala-3cc6245389bea0646c07b8a4f76047d492b386f7.tar.gz
scala-3cc6245389bea0646c07b8a4f76047d492b386f7.tar.bz2
scala-3cc6245389bea0646c07b8a4f76047d492b386f7.zip
allow the interpreter to be called with a file ...
allow the interpreter to be called with a file on the command line
Diffstat (limited to 'src/compiler/scala/tools/nsc/CompilerCommand.scala')
-rw-r--r--src/compiler/scala/tools/nsc/CompilerCommand.scala32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/CompilerCommand.scala b/src/compiler/scala/tools/nsc/CompilerCommand.scala
index 71707dc3c5..ddf3165ac3 100644
--- a/src/compiler/scala/tools/nsc/CompilerCommand.scala
+++ b/src/compiler/scala/tools/nsc/CompilerCommand.scala
@@ -16,6 +16,12 @@ class CompilerCommand(arguments: List[String], error: String => unit, interactiv
/** The applicable settings */
val settings: Settings = new Settings(error);
+ /** The name of the command */
+ val cmdName = "scalac";
+
+ /** The file extension of files that the compiler can process */
+ val fileEnding = ".scala";
+
/** A message explaining usage and options */
def usageMsg: String = {
val helpSyntaxColumnWidth: int =
@@ -29,12 +35,12 @@ class CompilerCommand(arguments: List[String], error: String => unit, interactiv
}
settings.allSettings
.map(setting =>
- format(setting.helpSyntax) + " " + setting.helpDescription)
+ format(setting.helpSyntax) + " " + setting.helpDescription)
.mkString(
- "Usage: scalac <options | source files>\n" +
- "where possible options include: \n ",
- "\n ",
- "\n");
+ "Usage: " + cmdName + " <options | source files>\n" +
+ "where possible options include: \n ",
+ "\n ",
+ "\n");
}
// initialization
@@ -44,17 +50,17 @@ class CompilerCommand(arguments: List[String], error: String => unit, interactiv
val args0 = args;
if (args.head.startsWith("-")) {
if (interactive) {
- error("no options can be given in interactive mode");
- ok = false
+ error("no options can be given in interactive mode");
+ ok = false
} else {
- for (val setting <- settings.allSettings)
+ for (val setting <- settings.allSettings)
args = setting.tryToSet(args);
- if (args eq args0) {
- error("unknown option: '" + args.head + "'");
- ok = false
- }
+ if (args eq args0) {
+ error("unknown option: '" + args.head + "'");
+ ok = false
+ }
}
- } else if (args.head.endsWith(".scala")) {
+ } else if (args.head.endsWith(fileEnding)) {
fs = args.head :: fs;
args = args.tail
} else {