Debian Codegraph @

etc/optcomp.ml

raw symbols SCIP
1 let () =
2 let v = Sys.argv.(1) in
3 let ic = open_in Sys.argv.(2) in
4 let only = Str.regexp "^#\\[only=\"\\([^\"]+\\)\"\\] *" in
5 let skip = Str.regexp "^#\\[skip=\"\\([^\"]+\\)\"\\] *" in
6 let has rex l =
7 if Str.string_match rex l 0 then
8 let expr = Str.matched_group 1 l in
9 Some (Str.regexp expr, Str.replace_first rex "" l)
10 else None in
11 try
12 while true do
13 let l = input_line ic in
14 begin match has only l, has skip l with
15 | None, None -> print_string l
16 | Some (r,l), None when Str.string_match r v 0 -> print_string l
17 | Some _, None -> ()
18 | None, Some (r,_) when Str.string_match r v 0 -> ()
19 | None, Some (_,l) -> print_string l
20 | Some _, Some _ -> assert false
21 end; print_newline ()
22 done
23 with End_of_file -> exit 0