1 (* Copyright (C) 2006, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://helm.cs.unibo.it/
28 let is_notation = function GrafiteParser.LNone _ -> true | _ -> false
31 let recursive = ref false in
33 "-r", Arg.Set recursive, "enable directory recursion";
35 MatitaInit.add_cmdline_spec spec;
36 MatitaInit.initialize_all ();
38 Helm_registry.get_list Helm_registry.string "matita.includes" in
40 CicNotation2.load_notation ~include_paths
41 BuildTimeConf.core_notation_script in
43 match Helm_registry.get_list Helm_registry.string "matita.args" with
45 | _ -> MatitaInit.die_usage () in
49 ignore (GrafiteWalker.rgrep_statement ~status
50 ~callback:(fun (fname, s) -> printf "%s: %s\n%!" fname s)
51 ~dirname is_notation))
54 ignore (GrafiteWalker.grep_statement ~status
55 ~callback:(fun s -> printf "%s\n%!" s)
56 ~fname is_notation)) in
59 let handle_localized_exns f arg =
62 with HExtlib.Localized (loc, exn) ->
63 let loc_begin, loc_end = HExtlib.loc_of_floc loc in
64 eprintf "Error at %d-%d: %s\n%!" loc_begin loc_end (Printexc.to_string exn)
66 let main () = handle_localized_exns grep ()