OCaml HTML5 parser/serialiser based on Python's JustHTML
at old-mail 20 lines 479 B view raw
1(* HTML5 parse error types *) 2 3type t = { 4 code : Parse_error_code.t; 5 line : int; 6 column : int; 7} 8 9let make ~code ~line ~column = 10 { code = Parse_error_code.of_string code; line; column } 11 12let make_with_code ~code ~line ~column = { code; line; column } 13 14let to_string err = 15 Printf.sprintf "(%d,%d): %s" err.line err.column 16 (Parse_error_code.to_string err.code) 17 18let pp fmt err = 19 Format.fprintf fmt "(%d,%d): %a" err.line err.column 20 Parse_error_code.pp err.code