add ability to --pass-through input without conversion

This commit is contained in:
Zachary Snow 2021-06-25 11:05:49 -06:00
parent 3f20055cd6
commit bb938f1e0b
3 changed files with 7 additions and 2 deletions

View File

@ -92,6 +92,7 @@ Preprocessing:
--siloed Lex input files separately, so macros from
earlier files are not defined in later files
--skip-preprocessor Disable preprocessor
--pass-through Dump input without converting
Conversion:
-E --exclude=CONV Exclude a particular conversion (always, assert,
interface, or logic)

View File

@ -38,6 +38,7 @@ data Job = Job
, define :: [String]
, siloed :: Bool
, skipPreprocessor :: Bool
, passThrough :: Bool
, exclude :: [Exclude]
, verbose :: Bool
, write :: Write
@ -61,6 +62,7 @@ defaultJob = Job
, siloed = nam_ "siloed" &= help ("Lex input files separately, so"
++ " macros from earlier files are not defined in later files")
, skipPreprocessor = nam_ "skip-preprocessor" &= help "Disable preprocessor"
, passThrough = nam_ "pass-through" &= help "Dump input without converting"
, exclude = nam_ "exclude" &= name "E" &= typ "CONV"
&= help ("Exclude a particular conversion (always, assert, interface,"
++ " or logic)")

View File

@ -88,8 +88,10 @@ main = do
hPutStrLn stderr msg
exitFailure
Right asts -> do
-- convert the files
let asts' = convert (exclude job) asts
-- convert the files if requested
let asts' = if passThrough job
then asts
else convert (exclude job) asts
emptyWarnings (concat asts) (concat asts')
-- write the converted files out
writeOutput (write job) (files job) asts'