diff options
author | Camil Staps | 2021-01-04 20:27:45 +0100 |
---|---|---|
committer | Camil Staps | 2021-01-04 20:27:45 +0100 |
commit | 88de5784428bec9a4b32bdf447c160da29b3745e (patch) | |
tree | 4b5a52c8fe2560e98aca0d74ec8dcd5cb09b2b70 /silc.icl | |
parent | Fix error reporting for illegal command line arguments (diff) |
Make up to date
Diffstat (limited to 'silc.icl')
-rw-r--r-- | silc.icl | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -5,6 +5,7 @@ import StdChar import StdFile from StdFunc import o, seq import StdList +import StdMaybe import StdOverloaded import StdString import StdTuple @@ -38,7 +39,7 @@ from Sil.Util.Printer import :: PrintState, instance zero PrintState, , compile :: Bool , generate :: Bool , help :: Bool - , inputfile :: Maybe String + , inputfile :: ?String } instance zero CLI @@ -49,7 +50,7 @@ where , compile = True , generate = True , help = False - , inputfile = Nothing + , inputfile = ?None } Start w @@ -64,7 +65,7 @@ Start w | args.help # io = io <<< HELP = finish 0 io err w -| isNothing args.inputfile +| isNone args.inputfile # err = err <<< "No input file given.\r\n" = finish 1 io err w # infile = fromJust args.inputfile @@ -112,11 +113,11 @@ Start w | isError prog # err = err <<< fromError prog = finish 1 io err w -#! f = f <<< fromOk prog +#! f = printAssembler (fromOk prog) f #! (_,w) = fclose f w | not args.generate = finish 0 io err w -#! (p,w) = callProcess "/opt/clean/bin/clm" [module, "-o", module] (Just dir) w +#! (p,w) = callProcess "/opt/clean/bin/clm" [module, "-o", module] (?Just dir) w | isError p # err = err <<< snd (fromError p) <<< "\r\n" = finish 1 io err w @@ -131,7 +132,7 @@ where <|> (\ cli -> {cli & compile=False}) <$ item "--no-compile" <|> (\ cli -> {cli & generate=False}) <$ item "--no-generate" <|> (\ cli -> {cli & help=True}) <$ anyItem ["-h", "--help"] - <|> (\name cli -> {cli & inputfile=Just name}) <$> satisfy isFilename + <|> (\name cli -> {cli & inputfile= ?Just name}) <$> satisfy isFilename ) <?> P_Invalid "command line argument" opt |