<commit_before>/* NSC -- new Scala compiler
 * Copyright 2007 LAMP/EPFL
 * @author  <NAME>
 */

// $Id$

package scala.tools.nsc

/** A command for ScriptRunner */
class GenericRunnerCommand(allargs: List[String], error: String => Unit) {
  def this(allargs: List[String]) =
    this(allargs, str => Console.println("Error: " + str))

  /** Settings specified by this command */
  val settings = new GenericRunnerSettings(error)

  /** Whether the command was parsed correctly */
  var ok = true

  /** What to run.  If it is None, then the interpreter should be started */
  var thingToRun: Option[String] = None

  /** Arguments to pass to the object or script to run */
  var arguments: List[String] = Nil

  private def parseArguments: Unit = {
    var args = allargs

    while (!args.isEmpty && ok && args.head.startsWith("-")) {
      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
      }
    }

    if (!args.isEmpty) {
      thingToRun = Some(args.head)
      arguments = args.tail
    }
  }
  parseArguments

  val usageMessage = {
    "scala [ <option> ]... [<torun> <arguments>]\n" +
    "\n" +
    "All options to scalac are allowed.  See scalac -help.\n" +
    "\n" +
    "<torun>, if present, is an object or script file to run.\n" +
    "If no <torun> is present, run an interactive interpreter.\n" +
    "\n" +
    "Option -howtorun allows explicitly specifying how to run <torun>:\n" +
    "    script: it is a script file\n" +
    "    object: it is an object name\n" +
    "    guess: (the default) try to guess\n" +
    "\n" +
    "Option -savecompiled requests that the compiled script be saved\n" +
    "for future use.\n" +
    "\n" +
    "Option -nocompdaemon requests that the fsc offline compiler not be used.\n" +
    "\n" +
    "Option -Dproperty=value sets a Java system property.\n"
  }
}<commit_msg>factored out the command name and compiler comm...<commit_after>/* NSC -- new Scala compiler
 * Copyright 2007 LAMP/EPFL
 * @author  <NAME>
 */

// $Id$

package scala.tools.nsc

/** A command for ScriptRunner */
class GenericRunnerCommand(allargs: List[String], error: String => Unit) {
  def this(allargs: List[String]) =
    this(allargs, str => Console.println("Error: " + str))

  /** name of the command */
  val cmdName = "scala"

  /** name of the associated compiler command */
  val compCmdName = "scalac"

  /** Settings specified by this command */
  val settings = new GenericRunnerSettings(error)

  /** Whether the command was parsed correctly */
  var ok = true

  /** What to run.  If it is None, then the interpreter should be started */
  var thingToRun: Option[String] = None

  /** Arguments to pass to the object or script to run */
  var arguments: List[String] = Nil

  private def parseArguments: Unit = {
    var args = allargs

    while (!args.isEmpty && ok && args.head.startsWith("-")) {
      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
      }
    }

    if (!args.isEmpty) {
      thingToRun = Some(args.head)
      arguments = args.tail
    }
  }
  parseArguments

  val usageMessage = {
    cmdName + " [ <option> ]... [<torun> <arguments>]\n" +
    "\n" +
    "All options to "+compCmdName+" are allowed.  See "+compCmdName+" -help.\n" +
    "\n" +
    "<torun>, if present, is an object or script file to run.\n" +
    "If no <torun> is present, run an interactive shell.\n" +
    "\n" +
    "Option -howtorun allows explicitly specifying how to run <torun>:\n" +
    "    script: it is a script file\n" +
    "    object: it is an object name\n" +
    "    guess: (the default) try to guess\n" +
    "\n" +
    "Option -savecompiled requests that the compiled script be saved\n" +
    "for future use.\n" +
    "\n" +
    "Option -nocompdaemon requests that the fsc offline compiler not be used.\n" +
    "\n" +
    "Option -Dproperty=value sets a Java system property.\n"
  }
}
{'fraction_non_alphanumeric': 0.1337140137996669, 'fraction_numerical': 0.0033309540804187486, 'mean_word_length': 2.517991631799163, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '673697', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1314, 'n_words': 455}