summaryrefslogtreecommitdiff
path: root/parsing
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2013-09-12 13:47:04 +0000
committerAlain Frisch <alain@frisch.fr>2013-09-12 13:47:04 +0000
commitde72ef4a89f3c047b003eaeb1275923077a4ba88 (patch)
tree3721206b2ba43162447e777f6c39e54dac4f6a90 /parsing
parent6950d6f7808b23bab47e17cd58bd7ca671d34d95 (diff)
downloadocaml-de72ef4a89f3c047b003eaeb1275923077a4ba88.tar.gz
Simplify common case of unit-wide errors.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14111 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'parsing')
-rw-r--r--parsing/location.ml3
-rw-r--r--parsing/location.mli2
2 files changed, 5 insertions, 0 deletions
diff --git a/parsing/location.ml b/parsing/location.ml
index 0fbfd95f07..36d9d4a1e0 100644
--- a/parsing/location.ml
+++ b/parsing/location.ml
@@ -343,3 +343,6 @@ let error_of_printer loc print x =
pp_print_flush ppf ();
let msg = Buffer.contents buf in
errorf ~loc "Error: %s" msg
+
+let error_of_printer_file print x =
+ error_of_printer (in_file !input_name) print x
diff --git a/parsing/location.mli b/parsing/location.mli
index 09e0659529..a2057442f9 100644
--- a/parsing/location.mli
+++ b/parsing/location.mli
@@ -93,6 +93,8 @@ val errorf: ?loc:t -> ?sub:error list -> ?if_highlight:string -> ('a, unit, stri
val error_of_printer: t -> (formatter -> 'a -> unit) -> 'a -> error
+val error_of_printer_file: (formatter -> 'a -> unit) -> 'a -> error
+
val error_of_exn: exn -> error option
val register_error_of_exn: (exn -> error option) -> unit