summaryrefslogtreecommitdiff
path: root/camlp4/ocpp/ocpp.ml
diff options
context:
space:
mode:
Diffstat (limited to 'camlp4/ocpp/ocpp.ml')
-rw-r--r--camlp4/ocpp/ocpp.ml15
1 files changed, 12 insertions, 3 deletions
diff --git a/camlp4/ocpp/ocpp.ml b/camlp4/ocpp/ocpp.ml
index afe517c0e5..92c939455b 100644
--- a/camlp4/ocpp/ocpp.ml
+++ b/camlp4/ocpp/ocpp.ml
@@ -46,7 +46,16 @@ and inside_locate cs =
| [: :] -> raise (Stream.Error "end of file in locate directive") ]
;
+value nowhere = {
+ Lexing.pos_fname = "";
+ Lexing.pos_lnum = 0;
+ Lexing.pos_bol = 0;
+ Lexing.pos_cnum = 0
+}
+;
+
value quot name pos str =
+ let pos = Reloc.shift_pos pos nowhere in
let exp =
try
match Quotation.find name with
@@ -54,13 +63,13 @@ value quot name pos str =
| _ -> raise Not_found ]
with
[ Not_found ->
- Stdpp.raise_with_loc (pos, pos + String.length str) Not_found ]
+ Stdpp.raise_with_loc (pos, Reloc.shift_pos (String.length str) pos) Not_found ]
in
let new_str =
try exp True str with
[ Stdpp.Exc_located (p1, p2) exc ->
- Stdpp.raise_with_loc (pos + p1, pos + p2) exc
- | exc -> Stdpp.raise_with_loc (pos, pos + String.length str) exc ]
+ Stdpp.raise_with_loc (Reloc.adjust_loc pos (p1, p2)) exc
+ | exc -> Stdpp.raise_with_loc (pos, Reloc.shift_pos (String.length str) pos) exc ]
in
let cs = Stream.of_string new_str in copy_strip_locate cs
;