<commit_before>module Config where

import Options.Applicative
import Data.Semigroup ((<>))

data TypeErrorLevel =
    Silently
    | FirstError
    | AllErrors
        deriving (Eq, Enum, Show, Read)

data Config = Config {
    javaFile      :: String
  , showAst'      :: Bool
  , showResult'   :: Bool
  , showTime'     :: Bool
  , canonizeCmm   :: Bool
  , compileToCmm  :: Bool
  , compileToX86  :: Bool
  , createCFGraph :: Bool
  , javaOutputDir :: String
  , cmmOutputDir  :: String
  , x86OutputDir  :: String
  , cfOutputDir   :: String
  , typeErrLvl    :: TypeErrorLevel
  , compileToAllocatedX86 :: Bool
} deriving (Show)

defaultConfig :: Config
defaultConfig = Config {
    javaFile      = ""
  , showAst'      = False
  , showResult'   = False
  , showTime'     = True
  , canonizeCmm   = False
  , compileToCmm  = False
  , compileToX86  = False
  , createCFGraph = False
  , javaOutputDir = "output"
  , cmmOutputDir  = "cmm-output"
  , x86OutputDir  = "x86-output"
  , cfOutputDir   = "cf-graph-output"
  , typeErrLvl    = AllErrors
  , compileToAllocatedX86 = False
}

parseConfig :: Parser Config
parseConfig = Config
   <$> argument str (metavar "javaFile")
   <*> flag False True
       ( long "showAst"
       <> help "show Ast")
   <*> flag False True
       ( long "showResult"
       <> short 'r'
       <> help "show Result")
   <*> flag True False
       ( long "showTime"
       <> short 't'
       <> help "show Time")
   <*> flag True False
       ( long "canonCmm"
       <> help "canonize Cmm")
   <*> flag True False
       ( long "compileToCmm"
       <> short 'c'
       <> help "compile to Cmm")
   <*> flag True False<commit_msg>Switches config default for compile x86<commit_after>module Config where

import Options.Applicative
import Data.Semigroup ((<>))

data TypeErrorLevel =
    Silently
    | FirstError
    | AllErrors
        deriving (Eq, Enum, Show, Read)

data Config = Config {
    javaFile      :: String
  , showAst'      :: Bool
  , showResult'   :: Bool
  , showTime'     :: Bool
  , canonizeCmm   :: Bool
  , compileToCmm  :: Bool
  , compileToX86  :: Bool
  , createCFGraph :: Bool
  , javaOutputDir :: String
  , cmmOutputDir  :: String
  , x86OutputDir  :: String
  , cfOutputDir   :: String
  , typeErrLvl    :: TypeErrorLevel
  , compileToAllocatedX86 :: Bool
} deriving (Show)

defaultConfig :: Config
defaultConfig = Config {
    javaFile      = ""
  , showAst'      = False
  , showResult'   = False
  , showTime'     = True
  , canonizeCmm   = False
  , compileToCmm  = False
  , compileToX86  = False
  , createCFGraph = False
  , javaOutputDir = "output"
  , cmmOutputDir  = "cmm-output"
  , x86OutputDir  = "x86-output"
  , cfOutputDir   = "cf-graph-output"
  , typeErrLvl    = AllErrors
  , compileToAllocatedX86 = False
}

parseConfig :: Parser Config
parseConfig = Config
   <$> argument str (metavar "javaFile")
   <*> flag False True
       ( long "showAst"
       <> help "show Ast")
   <*> flag False True
       ( long "showResult"
       <> short 'r'
       <> help "show Result")
   <*> flag True False
       ( long "showTime"
       <> short 't'
       <> help "show Time")
   <*> flag True False
       ( long "canonCmm"
       <> help "canonize Cmm")
   <*> flag True False
       ( long "compileToCmm"
       <> short 'c'
       <> help "compile to Cmm")
   <*> flag False True
{'fraction_non_alphanumeric': 0.11719214753123142, 'fraction_numerical': 0.00892325996430696, 'mean_word_length': 2.452772073921971, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4758304', 'n_tokens_mistral': 1165, 'n_tokens_neox': 1107, 'n_words': 284}