summaryrefslogtreecommitdiff
path: root/doc/removeproofs.mll
blob: 7fb37bb0ba223ebf9bf3cb9f9ac9fb09c74ddd37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
rule process inproof oc = parse
  | "<span class=\"keyword\">Proof</span>" ' '* '.'
      { process true oc lexbuf }
  | "<span class=\"keyword\">" ("Qed" | "Defined") "</span>" ' '* '.'
      { process false oc lexbuf }
(*
  | "<a class=\"idref\" href=\"" 
    [^ '"'] + '#' '"' [^ '\n' '>']* '"' '"' '>'
    ([^ '<' '\n']+ as ident)
    "</a>"
      { if not inproof then output_string oc ident;
        process inproof oc lexbuf }
*)
  | _
      { if not inproof then output_char oc (Lexing.lexeme_char lexbuf 0);
        process inproof oc lexbuf }
  | eof
      { () }

{

let process_file name =
  let ic = open_in name in
  Sys.remove name;
  let oc = open_out name in
  process false oc (Lexing.from_channel ic);
  close_out oc;
  close_in ic

let _ =
  for i = 1 to Array.length Sys.argv - 1 do
    process_file Sys.argv.(i)
  done
}