From 1ac37587be54c9b3d51d042796f303d9f8e03594 Mon Sep 17 00:00:00 2001 From: Chouser Date: Fri, 30 Jan 2015 12:38:44 -0500 Subject: OCaml: Fix stepA command-line script running --- ocaml/stepA_interop.ml | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/ocaml/stepA_interop.ml b/ocaml/stepA_interop.ml index e159de4..1aab28a 100644 --- a/ocaml/stepA_interop.ml +++ b/ocaml/stepA_interop.ml @@ -140,19 +140,20 @@ let rec main = if Array.length Sys.argv > 1 then ignore (rep ("(load-file \"" ^ Sys.argv.(1) ^ "\")") repl_env) - else - ignore (rep "(println (str \"Mal [\" *host-language* \"]\"))" repl_env); - while true do - print_string "user> "; - let line = read_line () in - try - print_endline (rep line repl_env); - with End_of_file -> () - | Invalid_argument x -> - output_string stderr ("Invalid_argument exception: " ^ x ^ "\n"); - flush stderr - | _ -> - output_string stderr ("Erroringness!\n"); - flush stderr - done + else begin + ignore (rep "(println (str \"Mal [\" *host-language* \"]\"))" repl_env); + while true do + print_string "user> "; + let line = read_line () in + try + print_endline (rep line repl_env); + with End_of_file -> () + | Invalid_argument x -> + output_string stderr ("Invalid_argument exception: " ^ x ^ "\n"); + flush stderr + | _ -> + output_string stderr ("Erroringness!\n"); + flush stderr + done + end with End_of_file -> () -- cgit v1.2.3