3 let r_dash = Str.regexp
" - ";;
5 let dashpos = try Str.search_forward
r_dash s
0 with Not_found
-> -1 in
8 let l = String.length s
in
9 if l > 11 && String.sub s
0 5 = "-----"
11 "\xc2\xb7" ^
String.sub s
5 (l - 10)
15 let rec findnonwsback i
=
18 then findnonwsback (i
-1)
21 let nonwspos = findnonwsback dashpos in
25 let b = Buffer.create
80 in
26 Buffer.add_substring
b s
0 (nonwspos+1);
27 Buffer.add_char
b '
\t'
;
28 Buffer.add_substring
b s
(dashpos+1) (String.length s
- dashpos - 1);
35 match input_line stdin
with
36 | line
-> fold (tabify line
:: accu
)
37 | exception End_of_file
-> List.rev accu
45 printf
"let keys = [\n";
46 List.iter
(fun l -> printf
" %S;\n" l) lines;