Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 24 lines (23 sloc) 0.668 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
exception LexerException of string
let lexer_token_safe lexbuf =
    try Lexer.token lexbuf
    with Failure s -> raise (LexerException s)

let rec foo () =
    try
let line = input_line stdin in
(try
let tree = Parser.tex_expr lexer_token_safe (Lexing.from_string line) in
(match Html.render tree with
Some _ -> print_string "$^\n"
| None -> print_string "$_\n";
)
        with
Texutil.Illegal_tex_function s -> print_string ("$T" ^ s ^ " " ^ line ^ "\n")
| LexerException s -> print_string ("$L" ^ line ^ "\n")
| _ -> print_string ("$ " ^ line ^ "\n"));
flush stdout;
foo ();
    with
End_of_file -> ()
;;
foo ();;
Something went wrong with that request. Please try again.