(* Parsing command-line options *) (* The type [options] gathers the command-line options. *) module SSet = Set.Make (String) type line_comment = string (* Opening of a line comment *) type block_comment = let mk_block ~opening ~closing : block_comment = object method opening = opening method closing = closing end type options = < input : string option; libs : string list; verbose : SSet.t; offsets : bool; block : block_comment option; line : line_comment option; ext : string > let make ~input ~libs ?block ?line ~offsets ~verbose ~ext : options = object method input = input method libs = libs method block = block method line = line method offsets = offsets method verbose = verbose method ext = ext end (* Auxiliary functions and modules *) let printf = Printf.printf let sprintf = Printf.sprintf let print = print_endline (* Printing a string in red to standard error *) let highlight msg = Printf.eprintf "\027[31m%s\027[0m%!" msg (* Failure *) let abort msg = highlight (sprintf "Command-line error: %s\n" msg); exit 1 (* Help *) let help ext () = let file = Filename.basename Sys.argv.(0) in printf "Usage: %s [