3 let r_dash = Str.regexp
" - ";;
5 let dashpos = try Str.search_forward
r_dash s
0 with Not_found
-> -1 in
10 let rec findnonwsback i
=
13 then findnonwsback (i
-1)
16 let nonwspos = findnonwsback dashpos in
20 let b = Buffer.create
80 in
21 Buffer.add_substring
b s
0 (nonwspos+1);
22 Buffer.add_string
b "\t";
23 Buffer.add_substring
b s
dashpos (String.length s
- dashpos);
29 match (try Some
(open_in
Sys.argv
.(1)) with _
-> None
) with
34 match (try Some
(input_line ic
) with _
-> None
) with
35 | Some line
-> fold (tabify line
:: accu
)
36 | None
-> List.rev accu
47 printf
"let keys = [\n";
48 List.iter
(fun l
-> printf
" %S;\n" l
) lines;