src/Pure/System/options.scala
changeset 48368 dc538eef2cf2
parent 48365 d88aefda01c4
child 48369 10b534e64209
--- a/src/Pure/System/options.scala	Fri Jul 20 16:47:17 2012 +0200
+++ b/src/Pure/System/options.scala	Fri Jul 20 16:47:43 2012 +0200
@@ -89,7 +89,7 @@
   private def check_name(name: String): Options.Opt =
     options.get(name) match {
       case Some(opt) => opt
-      case None => error("Undeclared option " + quote(name))
+      case None => error("Unknown option " + quote(name))
     }
 
   private def check_type(name: String, typ: Options.Type): Options.Opt =
@@ -117,8 +117,6 @@
   }
 
 
-
-
   /* external declare and define */
 
   def declare(name: String, typ_name: String, description: String = ""): Options =
@@ -151,6 +149,17 @@
     result
   }
 
+  def define_simple(str: String): Options =
+  {
+    str.indexOf('=') match {
+      case -1 =>
+        val opt = check_name(str)
+        if (opt.typ == Options.Bool) define(str, "true")
+        else error("Missing value for option " + quote(str) + " : " + opt.typ.print)
+      case i => define(str.substring(0, i), str.substring(i + 1))
+    }
+  }
+
 
   /* internal lookup and update */