Static code analysis housekeeping time... things that could be double-checked are...
[mediawiki.git] / math / texvc_test.ml
blobcd3a1dfae9a94d5761380ae42738fad2bc3a2ab0
1 exception LexerException of string
2 let lexer_token_safe lexbuf =
3 try Lexer.token lexbuf
4 with Failure s -> raise (LexerException s)
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 (match Html.render tree with
12 Some _ -> print_string "$^\n"
13 | None -> print_string "$_\n";
15 with
16 Texutil.Illegal_tex_function s -> print_string ("$T" ^ s ^ " " ^ line ^ "\n")
17 | LexerException s -> print_string ("$L" ^ line ^ "\n")
18 | _ -> print_string ("$ " ^ line ^ "\n"));
19 flush stdout;
20 foo ();
21 with
22 End_of_file -> ()
24 foo ();;