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_char
b '
\t'
;
23 Buffer.add_substring
b s
(dashpos+1) (String.length s
- dashpos - 1);
30 match (try Some
(input_line stdin
) with _
-> None
) with
31 | Some line
-> fold (tabify line
:: accu
)
32 | None
-> List.rev accu
40 printf
"let keys = [\n";
41 List.iter
(fun l
-> printf
" %S;\n" l
) lines;