Skip to content
Snippets Groups Projects
Commit e05a9ccc authored by Manos Koukoutos's avatar Manos Koukoutos
Browse files

Handle malformed options

parent a454d391
No related branches found
No related tags found
No related merge requests found
......@@ -101,7 +101,7 @@ object OptionsHelpers {
def nameValue(s: String) = s match {
case matcher(name, value) => (name, value)
case matcherWithout(name) => (name, "")
case _ => sys.error("") // FIXME
case _ => throw new IllegalArgumentException
}
// helper for options that include patterns
......
......@@ -95,7 +95,14 @@ object Main {
val files = args.filterNot(_.startsWith("-")).map(new java.io.File(_))
val leonOptions: Set[LeonOption[Any]] = options.map { opt =>
val (name, value) = OptionsHelpers.nameValue(opt)
val (name, value) = try {
OptionsHelpers.nameValue(opt)
} catch {
case _ : IllegalArgumentException =>
initReporter.fatalError(
s"Malformed option $opt. Options should have the form --name or --name=value"
)
}
// Find respective LeonOptionDef, or report an unknown option
val df = allOptions.find(_. name == name).getOrElse{
initReporter.error(s"Unknown option: $name")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment