* http://helm.cs.unibo.it/
*)
+open Printf
+
let pp_tactical = TacticAst2Box.tacticalPp
let mode =
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
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\e[01;31m%s\e[00m%s\n" before error after;
+ prerr_endline (sprintf "at character %d-%d: %s" x y msg)
done
with End_of_file ->
close_in ic