comparison tools/make_template.ml @ 41:d45ba7e9b266

Improve template generation; craft template for InductiveTypes
author Adam Chlipala <adamc@hcoop.net>
date Sat, 13 Sep 2008 14:31:51 -0400
parents c8070689f5ca
children 827d7e8a7d9e
comparison
equal deleted inserted replaced
40:02e8e9ef2746 41:d45ba7e9b266
10 | Some "" -> 10 | Some "" ->
11 if not (last_was_empty) then 11 if not (last_was_empty) then
12 print_newline (); 12 print_newline ();
13 initial true 13 initial true
14 | Some line -> 14 | Some line ->
15 if String.length line >= 2 && line.[0] = '(' && line.[1] = '*' then 15 let idx = try Some (String.index line '(') with Not_found -> None in
16 if line.[String.length line - 2] = '*' && line.[String.length line - 1] = ')' then 16 match idx with
17 initial last_was_empty 17 | Some idx ->
18 else 18 if String.length line > idx+1 && line.[idx+1] = '*' then
19 comment last_was_empty 19 if line.[String.length line - 2] = '*' && line.[String.length line - 1] = ')' then
20 else begin 20 initial last_was_empty
21 print_endline line; 21 else
22 initial false 22 comment last_was_empty
23 end 23 else begin
24 print_endline line;
25 initial false
26 end
27 | None ->
28 print_endline line;
29 initial false
24 30
25 and comment last_was_empty = 31 and comment last_was_empty =
26 match read_line () with 32 match read_line () with
27 | None -> () 33 | None -> ()
28 | Some line -> 34 | Some line ->