strip camlp4 error messages
Ignore-this: d9cee7dccc2270054156437b92e5e57e darcs-hash:20120222162516-c41ad-b97dd13591562c7fdb96ede631b501f4d392e32b
This commit is contained in:
parent
4171f877a6
commit
f819014eb9
|
@ -55,7 +55,16 @@ let parse_toplevel_phrase_camlp4 str eos_is_error =
|
||||||
| exn ->
|
| exn ->
|
||||||
([], exn)
|
([], exn)
|
||||||
in
|
in
|
||||||
UTop.Error (locs, UTop.get_message print_camlp4_error exn)
|
let msg = UTop.get_message print_camlp4_error exn in
|
||||||
|
(* Camlp4 sometimes generate several empty lines at the end... *)
|
||||||
|
let idx = ref (String.length msg - 1) in
|
||||||
|
while !idx > 0 && msg.[!idx] = '\n' do
|
||||||
|
decr idx
|
||||||
|
done;
|
||||||
|
if !idx + 1 < String.length msg then
|
||||||
|
UTop.Error (locs, String.sub msg 0 (!idx + 1))
|
||||||
|
else
|
||||||
|
UTop.Error (locs, msg)
|
||||||
|
|
||||||
let parse_toplevel_phrase str eos_is_error =
|
let parse_toplevel_phrase str eos_is_error =
|
||||||
match parse_toplevel_phrase_camlp4 str eos_is_error with
|
match parse_toplevel_phrase_camlp4 str eos_is_error with
|
||||||
|
|
Loading…
Reference in New Issue