+-- Return the mode if one was given.
+parse_mode :: IO Mode
+parse_mode = do
+ argv <- getArgs
+ let (_, non_options, _) = getOpt Permute options argv
+ if (null non_options)
+ then do
+ -- Default
+ return Regex
+ else do
+ -- Some non-option was given, but were any of them modes?
+ case (lowercase (non_options !! 0)) of
+ "regex" -> return Regex
+ "reduce" -> return Reduce
+ _ -> return Regex
+
+
+
+
+-- Return a list of errors.