mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 04:22:41 +00:00
removed debug printing; exit 1 on error
This commit is contained in:
parent
f6b1940057
commit
250bdc5992
1 changed files with 7 additions and 4 deletions
11
bin/main.ml
11
bin/main.ml
|
|
@ -6,11 +6,14 @@ let () =
|
|||
let argc = Array.length Sys.argv in
|
||||
match argc - 1 with
|
||||
| 0 -> Lox.runRepl ()
|
||||
| 1 ->
|
||||
| 1 -> (
|
||||
let path = Sys.argv.(1) in
|
||||
Printf.printf "Running script %s\n" path;
|
||||
(* Printf.printf "Running script %s\n" path; *)
|
||||
let ic = open_in path in
|
||||
let source = In_channel.input_all ic in
|
||||
let result = Lox.run source in
|
||||
Result.iter_error Lox.Error.print_error result
|
||||
match Lox.run source with
|
||||
| Error e ->
|
||||
Lox.Error.print_error e;
|
||||
exit 1
|
||||
| Ok () -> exit 0)
|
||||
| _ -> printUsage ()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue