-import Util ( maybePrefixMatch, notNull, removeSpaces )
-#ifdef DEBUG
-import Panic ( assertPanic )
-#endif
-
-data OptKind m -- Suppose the flag is -f
- = NoArg (m ()) -- -f all by itself
- | HasArg (String -> m ()) -- -farg or -f arg
- | SepArg (String -> m ()) -- -f arg
- | Prefix (String -> m ()) -- -farg
- | OptPrefix (String -> m ()) -- -f or -farg (i.e. the arg is optional)
- | OptIntSuffix (Maybe Int -> m ()) -- -f or -f=n; pass n to fn
- | IntSuffix (Int -> m ()) -- -f or -f=n; pass n to fn
- | PassFlag (String -> m ()) -- -f; pass "-f" fn
- | AnySuffix (String -> m ()) -- -f or -farg; pass entire "-farg" to fn
- | PrefixPred (String -> Bool) (String -> m ())
- | AnySuffixPred (String -> Bool) (String -> m ())
-
+import Util
+import Outputable
+import Panic
+import SrcLoc
+
+import Data.List
+
+data Flag m = Flag
+ {
+ flagName :: String, -- flag, without the leading -
+ flagOptKind :: (OptKind m), -- what to do if we see it
+ flagDeprecated :: Deprecated -- is the flag deprecated?
+ }
+
+data Deprecated = Supported
+ | Deprecated String
+ | DeprecatedFullText String
+
+data OptKind m -- Suppose the flag is -f
+ = NoArg (m ()) -- -f all by itself
+ | HasArg (String -> m ()) -- -farg or -f arg
+ | SepArg (String -> m ()) -- -f arg
+ | Prefix (String -> m ()) -- -farg
+ | OptPrefix (String -> m ()) -- -f or -farg (i.e. the arg is optional)
+ | OptIntSuffix (Maybe Int -> m ()) -- -f or -f=n; pass n to fn
+ | IntSuffix (Int -> m ()) -- -f or -f=n; pass n to fn
+ | PassFlag (String -> m ()) -- -f; pass "-f" fn
+ | AnySuffix (String -> m ()) -- -f or -farg; pass entire "-farg" to fn
+ | PrefixPred (String -> Bool) (String -> m ())
+ | AnySuffixPred (String -> Bool) (String -> m ())
+