Miscellanea.
This commit is contained in:
parent
dc4f14d469
commit
fe2c56aedb
@ -11,18 +11,19 @@ let abort msg =
|
|||||||
|
|
||||||
let printf = Printf.printf
|
let printf = Printf.printf
|
||||||
let sprintf = Printf.sprintf
|
let sprintf = Printf.sprintf
|
||||||
|
let print = print_endline
|
||||||
|
|
||||||
(* Help *)
|
(* Help *)
|
||||||
|
|
||||||
let help () =
|
let help () =
|
||||||
let file = Filename.basename Sys.argv.(0) in
|
let file = Filename.basename Sys.argv.(0) in
|
||||||
printf "Usage: %s [<option> ...] [<input>.mligo | \"-\"]\n" file;
|
printf "Usage: %s [<option> ...] [<input>.mligo | \"-\"]\n" file;
|
||||||
print_endline "where <input>.mligo is the CameLIGO source file (default: stdin),";
|
print "where <input>.mligo is the CameLIGO source file (default: stdin),";
|
||||||
print_endline "and each <option> (if any) is one of the following:";
|
print "and each <option> (if any) is one of the following:";
|
||||||
print_endline " -I <paths> Library paths (colon-separated)";
|
print " -I <paths> Library paths (colon-separated)";
|
||||||
print_endline " --verbose=<phases> Colon-separated phases: cmdline, lexer, parser";
|
print " --verbose=<phases> Colon-separated phases: cmdline, lexer, parser";
|
||||||
print_endline " --version Send short commit hash to stdout";
|
print " --version Send short commit hash to stdout";
|
||||||
print_endline " -h, --help This help";
|
print " -h, --help This help";
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
(* Version *)
|
(* Version *)
|
||||||
@ -99,12 +100,12 @@ let check () =
|
|||||||
and libs = !libs in
|
and libs = !libs in
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
if Utils.String.Set.mem "cmdline" verbose then
|
if Utils.String.Set.mem "cmdline" verbose then
|
||||||
begin
|
begin
|
||||||
printf "\nEXPORTED COMMAND LINE\n";
|
printf "\nEXPORTED COMMAND LINE\n";
|
||||||
printf "input = %s\n" (string_of quote input);
|
printf "input = %s\n" (string_of quote input);
|
||||||
printf "verbose = %s\n" !verb_str;
|
printf "verbose = %s\n" !verb_str;
|
||||||
printf "I = %s\n" (string_of_path libs)
|
printf "libs = %s\n" (string_of_path libs)
|
||||||
end
|
end
|
||||||
|
|
||||||
in {input; libs; verbose}
|
in {input; libs; verbose}
|
||||||
|
@ -1,9 +1,16 @@
|
|||||||
(* Command-line options for CameLIGO *)
|
(* Command-line options for CameLIGO *)
|
||||||
|
|
||||||
(* If the value of [input] is [Some src], the name of the CameLIGO
|
(* The type [options] gathers the command-line options.
|
||||||
|
|
||||||
|
If the field [input] is [Some src], the name of the CameLIGO
|
||||||
source file, with the extension ".mligo", is [src]. If [input] is
|
source file, with the extension ".mligo", is [src]. If [input] is
|
||||||
[Some "-"] or [None], the source file is read from standard
|
[Some "-"] or [None], the source file is read from standard input.
|
||||||
input. *)
|
|
||||||
|
The field [libs] is made of library paths (colon-separated).
|
||||||
|
|
||||||
|
The field [verbose] is a set of stages of the compiler chain,
|
||||||
|
about which more information may be displayed.
|
||||||
|
*)
|
||||||
|
|
||||||
type options = {
|
type options = {
|
||||||
input : string option;
|
input : string option;
|
||||||
@ -11,4 +18,6 @@ type options = {
|
|||||||
verbose : Utils.String.Set.t;
|
verbose : Utils.String.Set.t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(* Parsing the command-line options on stdin *)
|
||||||
|
|
||||||
val read : unit -> options
|
val read : unit -> options
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
(* Driver for the lexer of Mini-ML *)
|
(* Driver for the lexer of CameLIGO *)
|
||||||
|
|
||||||
(* Error printing and exception tracing *)
|
(* Error printing and exception tracing *)
|
||||||
|
|
||||||
Printexc.record_backtrace true;;
|
let () = Printexc.record_backtrace true
|
||||||
|
|
||||||
(* Running the lexer on the source *)
|
(* Running the lexer on the source *)
|
||||||
|
|
||||||
let options = EvalOpt.read ();;
|
let options = EvalOpt.read ()
|
||||||
|
|
||||||
open EvalOpt;;
|
open EvalOpt;;
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
(* Driver for the parser of Mini-ML *)
|
(* Driver for the parser of CameLIGO *)
|
||||||
|
|
||||||
(* Error printing and exception tracing *)
|
(* Error printing and exception tracing *)
|
||||||
|
|
||||||
Printexc.record_backtrace true;;
|
let () = Printexc.record_backtrace true
|
||||||
|
|
||||||
(* Reading the command-line options *)
|
(* Reading the command-line options *)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user