module Distribution.Simple.UUAGC.AbsSyn where

import Options
import System.FilePath(normalise)

data AGFileOption = AGFileOption {AGFileOption -> String
filename :: String,
                                  AGFileOption -> [String]
fileClasses :: [String],
                                  AGFileOption -> Options
opts :: Options}

data AGOptionsClass = AGOptionsClass {AGOptionsClass -> String
className :: String, AGOptionsClass -> Options
opts' :: Options}

type AGFileOptions = [AGFileOption]

lookupFileOptions :: FilePath -> AGFileOptions -> Options
lookupFileOptions :: String -> AGFileOptions -> Options
lookupFileOptions String
s = (Options -> AGFileOption -> Options)
-> Options -> AGFileOptions -> Options
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl Options -> AGFileOption -> Options
f Options
noOptions
    where f :: Options -> AGFileOption -> Options
f Options
e (AGFileOption String
s' [String]
classes Options
opt)
              | String
s String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== (String -> String
normalise String
s')  = Options
opt
              | Bool
otherwise            = Options
e