summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/CompilerCommand.scala
diff options
context:
space:
mode:
authorLex Spoon <lex@lexspoon.org>2007-07-13 15:49:21 +0000
committerLex Spoon <lex@lexspoon.org>2007-07-13 15:49:21 +0000
commit6d9221f765be5c2e4d48878d08899f84ae7e0bf2 (patch)
treef096a9b9ed553d07a6f528e7a448855114063c8f /src/compiler/scala/tools/nsc/CompilerCommand.scala
parent07833a931f89676a34e9b2ad8704cd14ab1a4ec9 (diff)
downloadscala-6d9221f765be5c2e4d48878d08899f84ae7e0bf2.tar.gz
scala-6d9221f765be5c2e4d48878d08899f84ae7e0bf2.tar.bz2
scala-6d9221f765be5c2e4d48878d08899f84ae7e0bf2.zip
Refactored GenericRunnerCommand to be a sublcas...
Refactored GenericRunnerCommand to be a sublcass of CompilerCommand
Diffstat (limited to 'src/compiler/scala/tools/nsc/CompilerCommand.scala')
-rw-r--r--src/compiler/scala/tools/nsc/CompilerCommand.scala57
1 files changed, 33 insertions, 24 deletions
diff --git a/src/compiler/scala/tools/nsc/CompilerCommand.scala b/src/compiler/scala/tools/nsc/CompilerCommand.scala
index 333d95d6ca..f188510eca 100644
--- a/src/compiler/scala/tools/nsc/CompilerCommand.scala
+++ b/src/compiler/scala/tools/nsc/CompilerCommand.scala
@@ -59,35 +59,44 @@ class CompilerCommand(arguments: List[String], val settings: Settings,
"\n")
}
- // initialization
- var args = arguments
+
+ /** Whether the command was processed okay */
var ok = true
- while (!args.isEmpty && ok) {
- if (args.head startsWith "-") {
- if (interactive) {
- error("no options can be given in interactive mode")
- ok = false
- } else {
- val args0 = args
- for (setting <- settings.allSettings)
- if (args eq args0)
- args = setting.tryToSet(args)
+ /** Process the arguments and update the settings accordingly.
+ This method is called only once, during initialization. */
+ protected def processArguments() {
+ // initialization
+ var args = arguments
- if (args eq args0) {
- error("bad option: '" + args.head + "'")
+ while (!args.isEmpty && ok) {
+ if (args.head startsWith "-") {
+ if (interactive) {
+ error("no options can be given in interactive mode")
ok = false
- } else
- ok = settings.checkDependencies
+ } else {
+ val args0 = args
+ for (setting <- settings.allSettings)
+ if (args eq args0)
+ args = setting.tryToSet(args)
+
+ if (args eq args0) {
+ error("bad option: '" + args.head + "'")
+ ok = false
+ } else
+ ok = settings.checkDependencies
+ }
+ } else if ((settings.script.value != "") || args.head.endsWith(fileEnding)) {
+ fs = args.head :: fs
+ args = args.tail
+ } else if (args.head.length == 0) {//quick fix
+ args = args.tail
+ } else {
+ error("don't know what to do with " + args.head)
+ ok = false
}
- } else if ((settings.script.value != "") || args.head.endsWith(fileEnding)) {
- fs = args.head :: fs
- args = args.tail
- } else if (args.head.length == 0) {//quick fix
- args = args.tail
- } else {
- error("don't know what to do with " + args.head)
- ok = false
}
}
+
+ processArguments()
}