summaryrefslogtreecommitdiff
path: root/parsing
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2013-09-12 11:59:45 +0000
committerAlain Frisch <alain@frisch.fr>2013-09-12 11:59:45 +0000
commit71efb4666b1df8cc841fe3d7b0ffe43fcd8d2958 (patch)
tree9898a7a09c2a1781811766baee22e6cb8a37ade4 /parsing
parent6ad98b3d0927ab206eec09aeaa3d7f776e1d2c0e (diff)
downloadocaml-71efb4666b1df8cc841fe3d7b0ffe43fcd8d2958.tar.gz
Switch Lexer.Error to the new system.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14107 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'parsing')
-rw-r--r--parsing/lexer.mli1
-rw-r--r--parsing/lexer.mll10
-rw-r--r--parsing/syntaxerr.mli1
3 files changed, 11 insertions, 1 deletions
diff --git a/parsing/lexer.mli b/parsing/lexer.mli
index 0c98ffc34a..b067b2aa3e 100644
--- a/parsing/lexer.mli
+++ b/parsing/lexer.mli
@@ -31,6 +31,7 @@ exception Error of error * Location.t
open Format
val report_error: formatter -> error -> unit
+ (* Deprecated. Use Location.{error_of_exn, report_error}. *)
val in_comment : unit -> bool;;
val in_string : unit -> bool;;
diff --git a/parsing/lexer.mll b/parsing/lexer.mll
index 8b34b24831..8aed03b2fc 100644
--- a/parsing/lexer.mll
+++ b/parsing/lexer.mll
@@ -242,7 +242,15 @@ let report_error ppf = function
| Literal_overflow ty ->
fprintf ppf "Integer literal exceeds the range of representable \
integers of type %s" ty
-;;
+
+let () =
+ Location.register_error_of_exn
+ (function
+ | Error (err, loc) ->
+ Some (Location.error_of_printer loc report_error err)
+ | _ ->
+ None
+ )
}
diff --git a/parsing/syntaxerr.mli b/parsing/syntaxerr.mli
index 0bacb0f956..1aec26ed52 100644
--- a/parsing/syntaxerr.mli
+++ b/parsing/syntaxerr.mli
@@ -26,5 +26,6 @@ exception Error of error
exception Escape_error
val report_error: formatter -> error -> unit
+ (* Deprecated. Use Location.{error_of_exn, report_error}. *)
val location_of_error: error -> Location.t