profiling, fixed incorrect transaction handling (my fault)
[lhc/web/wiklou.git] / math / texvc_test.ml
1 exception LexerException of string
2 let lexer_token_safe lexbuf =
3 try Lexer.token lexbuf
4 with Failure s -> raise (LexerException s)
5
6 let rec foo () =
7 try
8 let line = input_line stdin in
9 (try
10 let tree = Parser.tex_expr lexer_token_safe (Lexing.from_string line) in
11 let out = Util.mapjoin Texutil.render_tex tree in
12 (match Html.render tree with
13 Some _ -> print_string "$^\n"
14 | None -> print_string "$_\n";
15 )
16 with
17 Texutil.Illegal_tex_function s -> print_string ("$T" ^ s ^ " " ^ line ^ "\n")
18 | LexerException s -> print_string ("$L" ^ line ^ "\n")
19 | _ -> print_string ("$ " ^ line ^ "\n"));
20 flush stdout;
21 foo ();
22 with
23 End_of_file -> ()
24 ;;
25 foo ();;