[MLton-commit] r4351

Matthew Fluet MLton@mlton.org
Thu, 9 Feb 2006 17:28:44 -0800


Better splitting of compiler from annotation
----------------------------------------------------------------------

U   mlton/trunk/mlton/control/control-flags.sml

----------------------------------------------------------------------

Modified: mlton/trunk/mlton/control/control-flags.sml
===================================================================
--- mlton/trunk/mlton/control/control-flags.sml	2006-02-10 00:42:03 UTC (rev 4350)
+++ mlton/trunk/mlton/control/control-flags.sml	2006-02-10 01:28:43 UTC (rev 4351)
@@ -534,17 +534,18 @@
 
       local
          fun checkPrefix (s, f) =
-            case String.fields (s, fn c => c = #":") of
-               [s] => f s
-             | [comp,s] => 
+            case String.peeki (s, fn (_, c) => c = #":") of
+               NONE => f s
+             | SOME (i, _) =>
                   let
+                     val comp = String.prefix (s, i)
                      val comp = String.deleteSurroundingWhitespace comp
+                     val s = String.dropPrefix (s, i + 1)
                   in
                      if String.equals (comp, "mlton")
                         then f s
                         else Other
                   end
-             | _ => Bad
       in
          val parseId = fn s => checkPrefix (s, parseId)
          val parseIdAndArgs = fn s => checkPrefix (s, parseIdAndArgs)