X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fcic_disambiguation%2Ftest_parser.ml;h=51a0d911f23ada0464480b5af8749ca441697102;hb=cbd78f48f8aa055e2d66922291717842d84383d1;hp=4ee8ec6ef1340c757cc2639bd44a9dac10ce9c2c;hpb=7a72e5c5129c814e567f03e14d752eff4086fb52;p=helm.git diff --git a/helm/ocaml/cic_disambiguation/test_parser.ml b/helm/ocaml/cic_disambiguation/test_parser.ml index 4ee8ec6ef..51a0d911f 100644 --- a/helm/ocaml/cic_disambiguation/test_parser.ml +++ b/helm/ocaml/cic_disambiguation/test_parser.ml @@ -23,6 +23,8 @@ * http://helm.cs.unibo.it/ *) +open Printf + let pp_tactical = TacticAst2Box.tacticalPp let mode = @@ -41,9 +43,9 @@ let _ = let ic = stdin in try while true do + let line = input_line ic in + let istream = Stream.of_string line in try - let line = input_line ic in - let istream = Stream.of_string line in (match mode with | `Term -> let term = CicTextualParser2.parse_term istream in @@ -59,12 +61,13 @@ let _ = print_endline (CicTextualParser2.EnvironmentP3.to_string env)); flush stdout with - | CicTextualParser2.Parse_error msg -> prerr_endline msg -(* - | Stdpp.Exc_located ((p_start, p_end), exn) -> - prerr_endline (Printf.sprintf "Exception at character %d-%d: %s" - p_start p_end (Printexc.to_string exn)) -*) + | CicTextualParser2.Parse_error (floc, msg) -> + let (x, y) = CicAst.loc_of_floc floc in + let before = String.sub line 0 x in + let error = String.sub line x (y - x) in + let after = String.sub line y (String.length line - y) in + eprintf "%s%s%s\n" before error after; + prerr_endline (sprintf "at character %d-%d: %s" x y msg) done with End_of_file -> close_in ic