From 6b649aba925b6f7462da07599fe67ebb12a3460e Mon Sep 17 00:00:00 2001 From: Samuel Mimram Date: Wed, 28 Jul 2004 21:54:47 +0000 Subject: Imported Upstream version 8.0pl1 --- tools/gallina.ml | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 tools/gallina.ml (limited to 'tools/gallina.ml') diff --git a/tools/gallina.ml b/tools/gallina.ml new file mode 100644 index 00000000..c997820c --- /dev/null +++ b/tools/gallina.ml @@ -0,0 +1,66 @@ +(************************************************************************) +(* v * The Coq Proof Assistant / The Coq Development Team *) +(* begin + flush !chan_out; + close_in chan_in; + if not !option_stdout then close_out !chan_out + end + with Sys_error _ -> + () + +let traite_stdin () = + try + let buf = Lexing.from_channel stdin in + try + while true do Gallina_lexer.action buf done + with Fin_fichier -> + flush !chan_out + with Sys_error _ -> + () + +let gallina () = + let lg_command = Array.length Sys.argv in + if lg_command < 2 then begin + output_string stderr "Usage: gallina [-] [-stdout] file1 file2 ...\n"; + flush stderr; + exit 1 + end; + let treat = function + | "-" -> option_moins := true + | "-stdout" -> option_stdout := true + | "-nocomments" -> comments := false + | f -> + if Filename.check_suffix f ".v" then + vfiles := (Filename.chop_suffix f ".v") :: !vfiles + in + Array.iter treat Sys.argv; + if !option_moins then + traite_stdin () + else + List.iter traite_fichier !vfiles + +let _ = Printexc.catch gallina () + -- cgit v1.2.3