aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaxime Dénès2017-09-25 09:51:09 +0200
committerMaxime Dénès2017-09-25 09:51:09 +0200
commitaf900539d3d6c28b6f8f0373934d3a1286e9e44f (patch)
treea5f1467a05b74daef531901fe8cae73cce8ae39b /lib
parent00aa9287eb73ce9f3b41444ed23bc370cde828aa (diff)
parent46a17141e6a19fff9dfeb1ef18cbba054e34e3c3 (diff)
Merge PR #1057: Reporting locations in error messages about notation formats.
Diffstat (limited to 'lib')
-rw-r--r--lib/loc.ml2
-rw-r--r--lib/loc.mli5
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/loc.ml b/lib/loc.ml
index 06da13d44f..4a935a9d9c 100644
--- a/lib/loc.ml
+++ b/lib/loc.ml
@@ -62,6 +62,8 @@ let merge_opt l1 l2 = match l1, l2 with
let unloc loc = (loc.bp, loc.ep)
+let shift_loc kb kp loc = { loc with bp = loc.bp + kb ; ep = loc.ep + kp }
+
(** Located type *)
type 'a located = t option * 'a
diff --git a/lib/loc.mli b/lib/loc.mli
index d4061e0446..fde490cc8a 100644
--- a/lib/loc.mli
+++ b/lib/loc.mli
@@ -40,6 +40,11 @@ val merge : t -> t -> t
val merge_opt : t option -> t option -> t option
(** Merge locations, usually generating the largest possible span *)
+val shift_loc : int -> int -> t -> t
+(** [shift_loc loc n p] shifts the beginning of location by [n] and
+ the end by [p]; it is assumed that the shifts do not change the
+ lines at which the location starts and ends *)
+
(** {5 Located exceptions} *)
val add_loc : Exninfo.info -> t -> Exninfo.info