aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2018-12-05 17:48:53 +0100
committerPierre-Marie Pédrot2018-12-05 17:48:53 +0100
commit8a28cf181a47072fe9a09e98bca761774520d0c3 (patch)
tree42faf529e552d5682be4ab827f8c71d7a4afef96 /lib
parentce4910fe9299bbd54a313980eedaf8d57daade1c (diff)
parent0422f7e67c6c87ab364212a267288afcc7313e90 (diff)
Merge PR #9065: [gramlib] Remove `Ploc.t` in favor of `Loc.t`
Diffstat (limited to 'lib')
-rw-r--r--lib/loc.ml15
-rw-r--r--lib/loc.mli2
2 files changed, 13 insertions, 4 deletions
diff --git a/lib/loc.ml b/lib/loc.ml
index 1a09091bff..c08648911b 100644
--- a/lib/loc.ml
+++ b/lib/loc.ml
@@ -22,15 +22,19 @@ type t = {
bol_pos_last : int; (** position of the beginning of end line *)
bp : int; (** start position *)
ep : int; (** end position *)
+ comm : string; (** start comment *)
+ ecomm : string (** end comment *)
}
let create fname line_nb bol_pos bp ep = {
fname = fname; line_nb = line_nb; bol_pos = bol_pos;
- line_nb_last = line_nb; bol_pos_last = bol_pos; bp = bp; ep = ep; }
+ line_nb_last = line_nb; bol_pos_last = bol_pos; bp = bp; ep = ep;
+ comm = ""; ecomm = "" }
let make_loc (bp, ep) = {
fname = ToplevelInput; line_nb = -1; bol_pos = 0; line_nb_last = -1; bol_pos_last = 0;
- bp = bp; ep = ep; }
+ bp = bp; ep = ep;
+ comm = ""; ecomm = "" }
let mergeable loc1 loc2 =
loc1.fname = loc2.fname
@@ -45,7 +49,8 @@ let merge loc1 loc2 =
bol_pos = loc1.bol_pos;
line_nb_last = loc2.line_nb_last;
bol_pos_last = loc2.bol_pos_last;
- bp = loc1.bp; ep = loc2.ep; }
+ bp = loc1.bp; ep = loc2.ep;
+ comm = loc1.comm; ecomm = loc2.comm }
else loc1
else if loc2.ep < loc1.ep then {
fname = loc2.fname;
@@ -53,7 +58,9 @@ let merge loc1 loc2 =
bol_pos = loc2.bol_pos;
line_nb_last = loc1.line_nb_last;
bol_pos_last = loc1.bol_pos_last;
- bp = loc2.bp; ep = loc1.ep; }
+ bp = loc2.bp; ep = loc1.ep;
+ comm = loc2.comm; ecomm = loc1.comm
+ }
else loc2
let merge_opt l1 l2 = match l1, l2 with
diff --git a/lib/loc.mli b/lib/loc.mli
index 23df1ebd9a..c46311b639 100644
--- a/lib/loc.mli
+++ b/lib/loc.mli
@@ -22,6 +22,8 @@ type t = {
bol_pos_last : int; (** position of the beginning of end line *)
bp : int; (** start position *)
ep : int; (** end position *)
+ comm : string; (** start comment *)
+ ecomm : string (** end comment *)
}
(** {5 Location manipulation} *)