summaryrefslogtreecommitdiff
path: root/camlp4/ocpp
diff options
context:
space:
mode:
Diffstat (limited to 'camlp4/ocpp')
-rw-r--r--camlp4/ocpp/Makefile2
-rw-r--r--camlp4/ocpp/ocpp.ml15
2 files changed, 13 insertions, 4 deletions
diff --git a/camlp4/ocpp/Makefile b/camlp4/ocpp/Makefile
index 60729e323c..f3d844d0cb 100644
--- a/camlp4/ocpp/Makefile
+++ b/camlp4/ocpp/Makefile
@@ -12,7 +12,7 @@ OBJS=ocpp.cmo
all: ocpp$(EXE)
ocpp$(EXE): $(OBJS)
- $(OCAMLC) $(LINKFLAGS) ../boot/stdpp.cmo ../camlp4/quotation.cmo ../odyl/odyl.cma $(OBJS) ../odyl/odyl.cmo -linkall -o ocpp$(EXE)
+ $(OCAMLC) $(LINKFLAGS) ../boot/stdpp.cmo ../camlp4/reloc.cmo ../camlp4/quotation.cmo ../odyl/odyl.cma $(OBJS) ../odyl/odyl.cmo -linkall -o ocpp$(EXE)
clean::
rm -f *.cm[ioa] *.pp[io] *.o *.out *.bak .*.bak ocpp$(EXE)
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
;