summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>2001-11-04 20:02:14 +0000
committerDaniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>2001-11-04 20:02:14 +0000
commitbae5c6bfdd6c4e05140addc75e7311c8aed75b00 (patch)
tree986b1969ea1ef9fc772ee8618fe34b2d22667614
parentda736fb351252a9cb1483232d8b46c112a0b427e (diff)
-
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3973 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--camlp4/CHANGES2
-rw-r--r--camlp4/camlp4/ast2pt.ml4
-rw-r--r--camlp4/camlp4/mLast.mli4
-rw-r--r--camlp4/camlp4/reloc.ml5
-rw-r--r--camlp4/etc/pa_lisp.ml2
-rw-r--r--camlp4/etc/pa_lispr.ml2
-rw-r--r--camlp4/etc/pa_o.ml13
-rw-r--r--camlp4/etc/pa_olabl.ml17
-rw-r--r--camlp4/etc/pa_sml.ml6
-rw-r--r--camlp4/etc/pr_depend.ml4
-rw-r--r--camlp4/etc/pr_o.ml11
-rw-r--r--camlp4/etc/pr_r.ml11
-rw-r--r--camlp4/meta/pa_r.ml11
-rw-r--r--camlp4/meta/q_MLast.ml12
-rw-r--r--camlp4/ocaml_src/camlp4/ast2pt.ml4
-rw-r--r--camlp4/ocaml_src/camlp4/mLast.mli4
-rw-r--r--camlp4/ocaml_src/camlp4/reloc.ml8
-rw-r--r--camlp4/ocaml_src/meta/pa_r.ml10
-rw-r--r--camlp4/ocaml_src/meta/q_MLast.ml14
19 files changed, 79 insertions, 65 deletions
diff --git a/camlp4/CHANGES b/camlp4/CHANGES
index 57d79d540..5dc51f621 100644
--- a/camlp4/CHANGES
+++ b/camlp4/CHANGES
@@ -1,6 +1,8 @@
Camlp4 Version 3.04
-------------------
+- [04 Nov 01] Added locations for variants and labels declarations in AST
+ (file MLast.mli).
- [03 Nov 01] Added option -ca (comment after) when using pr_o or pr_r
which print ocamldoc comments after the declarations, i.e. as they were
before version 3.04.
diff --git a/camlp4/camlp4/ast2pt.ml b/camlp4/camlp4/ast2pt.ml
index 4c823e69a..2df08585e 100644
--- a/camlp4/camlp4/ast2pt.ml
+++ b/camlp4/camlp4/ast2pt.ml
@@ -187,8 +187,8 @@ value mktype loc tl cl tk tm =
;
value mkmutable m = if m then Mutable else Immutable;
value mkprivate m = if m then Private else Public;
-value mktrecord (n, m, t) = (n, mkmutable m, ctyp t);
-value mkvariant (c, tl) = (c, List.map ctyp tl);
+value mktrecord (_, n, m, t) = (n, mkmutable m, ctyp t);
+value mkvariant (_, c, tl) = (c, List.map ctyp tl);
value type_decl tl cl =
fun
[ TyMan loc t (TyRec _ ltl) ->
diff --git a/camlp4/camlp4/mLast.mli b/camlp4/camlp4/mLast.mli
index 2c5234050..f1705e3b6 100644
--- a/camlp4/camlp4/mLast.mli
+++ b/camlp4/camlp4/mLast.mli
@@ -29,8 +29,8 @@ type ctyp =
| TyObj of loc and list (string * ctyp) and bool
| TyOlb of loc and string and ctyp
| TyQuo of loc and string
- | TyRec of loc and list (string * bool * ctyp)
- | TySum of loc and list (string * list ctyp)
+ | TyRec of loc and list (loc * string * bool * ctyp)
+ | TySum of loc and list (loc * string * list ctyp)
| TyTup of loc and list ctyp
| TyUid of loc and string
| TyVrn of loc and list row_field and option (option (list string)) ]
diff --git a/camlp4/camlp4/reloc.ml b/camlp4/camlp4/reloc.ml
index 2a5673fc6..12ea30577 100644
--- a/camlp4/camlp4/reloc.ml
+++ b/camlp4/camlp4/reloc.ml
@@ -37,10 +37,11 @@ value rec ctyp floc sh =
| TyOlb loc x1 x2 -> TyOlb (floc loc) x1 (self x2)
| TyQuo loc x1 -> TyQuo (floc loc) x1
| TyRec loc x1 ->
- TyRec (floc loc) (List.map (fun (x1, x2, x3) -> (x1, x2, self x3)) x1)
+ TyRec (floc loc)
+ (List.map (fun (loc, x1, x2, x3) -> (floc loc, x1, x2, self x3)) x1)
| TySum loc x1 ->
TySum (floc loc)
- (List.map (fun (x1, x2) -> (x1, List.map self x2)) x1)
+ (List.map (fun (loc, x1, x2) -> (floc loc, x1, List.map self x2)) x1)
| TyTup loc x1 -> TyTup (floc loc) (List.map self x1)
| TyUid loc x1 -> TyUid (floc loc) x1
| TyVrn loc x1 x2 ->
diff --git a/camlp4/etc/pa_lisp.ml b/camlp4/etc/pa_lisp.ml
index ce6478fe7..98867b085 100644
--- a/camlp4/etc/pa_lisp.ml
+++ b/camlp4/etc/pa_lisp.ml
@@ -585,7 +585,7 @@
constructor_declaration_se
(lambda_match
((Sexpr loc (list (Satom _ Auid ci) :: sel))
- (, ci (List.map ctyp_se sel)))
+ (, loc ci (List.map ctyp_se sel)))
(se
(error se "constructor_declaration"))))
diff --git a/camlp4/etc/pa_lispr.ml b/camlp4/etc/pa_lispr.ml
index 311cae672..6c85ff3d0 100644
--- a/camlp4/etc/pa_lispr.ml
+++ b/camlp4/etc/pa_lispr.ml
@@ -566,7 +566,7 @@ and ctyp_ident_se loc s =
else loop ibeg (i + 1)
and constructor_declaration_se =
fun
- [ Sexpr loc [Satom _ Auid ci :: sel] -> (ci, List.map ctyp_se sel)
+ [ Sexpr loc [Satom _ Auid ci :: sel] -> (loc, ci, List.map ctyp_se sel)
| se -> error se "constructor_declaration" ]
;
diff --git a/camlp4/etc/pa_o.ml b/camlp4/etc/pa_o.ml
index 4ab0a138d..d71e7f708 100644
--- a/camlp4/etc/pa_o.ml
+++ b/camlp4/etc/pa_o.ml
@@ -407,7 +407,7 @@ EXTEND
;
str_item:
[ "top"
- [ "exception"; (c, tl) = constructor_declaration; b = rebind_exn ->
+ [ "exception"; (_, c, tl) = constructor_declaration; b = rebind_exn ->
<:str_item< exception $c$ of $list:tl$ = $b$ >>
| "external"; i = LIDENT; ":"; t = ctyp; "="; pd = LIST1 STRING ->
<:str_item< external $i$ : $t$ = $list:pd$ >>
@@ -466,7 +466,7 @@ EXTEND
;
sig_item:
[ "top"
- [ "exception"; (c, tl) = constructor_declaration ->
+ [ "exception"; (_, c, tl) = constructor_declaration ->
<:sig_item< exception $c$ of $list:tl$ >>
| "external"; i = LIDENT; ":"; t = ctyp; "="; pd = LIST1 STRING ->
<:sig_item< external $i$ : $t$ = $list:pd$ >>
@@ -844,8 +844,9 @@ EXTEND
| "-"; "'"; i = ident -> (i, (False, True)) ] ]
;
constructor_declaration:
- [ [ ci = UIDENT; "of"; cal = LIST1 ctyp LEVEL "ctyp1" SEP "*" -> (ci, cal)
- | ci = UIDENT -> (ci, []) ] ]
+ [ [ ci = UIDENT; "of"; cal = LIST1 ctyp LEVEL "ctyp1" SEP "*" ->
+ (loc, ci, cal)
+ | ci = UIDENT -> (loc, ci, []) ] ]
;
label_declarations:
[ [ ld = label_declaration; ";"; ldl = SELF -> [ld :: ldl]
@@ -853,8 +854,8 @@ EXTEND
| ld = label_declaration -> [ld] ] ]
;
label_declaration:
- [ [ i = LIDENT; ":"; t = ctyp -> (i, False, t)
- | "mutable"; i = LIDENT; ":"; t = ctyp -> (i, True, t) ] ]
+ [ [ i = LIDENT; ":"; t = ctyp -> (loc, i, False, t)
+ | "mutable"; i = LIDENT; ":"; t = ctyp -> (loc, i, True, t) ] ]
;
(* Core types *)
ctyp:
diff --git a/camlp4/etc/pa_olabl.ml b/camlp4/etc/pa_olabl.ml
index 700bad478..0b4ff1cf9 100644
--- a/camlp4/etc/pa_olabl.ml
+++ b/camlp4/etc/pa_olabl.ml
@@ -902,7 +902,7 @@ EXTEND
;
str_item:
[ "top"
- [ "exception"; (c, tl) = constructor_declaration ->
+ [ "exception"; (_, c, tl) = constructor_declaration ->
<:str_item< exception $c$ of $list:tl$ >>
| "external"; i = LIDENT; ":"; t = ctyp; "="; pd = LIST1 STRING ->
<:str_item< external $i$ : $t$ = $list:pd$ >>
@@ -958,7 +958,7 @@ EXTEND
;
sig_item:
[ "top"
- [ "exception"; (c, tl) = constructor_declaration ->
+ [ "exception"; (_, c, tl) = constructor_declaration ->
<:sig_item< exception $c$ of $list:tl$ >>
| "external"; i = LIDENT; ":"; t = ctyp; "="; pd = LIST1 STRING ->
<:sig_item< external $i$ : $t$ = $list:pd$ >>
@@ -1348,8 +1348,9 @@ EXTEND
[ [ "'"; i = ident -> (i, (False, False)) ] ]
;
constructor_declaration:
- [ [ ci = UIDENT; "of"; cal = LIST1 ctyp LEVEL "ctyp1" SEP "*" -> (ci, cal)
- | ci = UIDENT -> (ci, []) ] ]
+ [ [ ci = UIDENT; "of"; cal = LIST1 ctyp LEVEL "ctyp1" SEP "*" ->
+ (loc, ci, cal)
+ | ci = UIDENT -> (loc, ci, []) ] ]
;
label_declarations:
[ [ ld = label_declaration; ";"; ldl = SELF -> [ld :: ldl]
@@ -1357,10 +1358,10 @@ EXTEND
| ld = label_declaration -> [ld] ] ]
;
label_declaration:
- [ [ i = LIDENT; ":"; t = ctyp -> (i, False, t)
- | i = LABEL; t = ctyp -> (i, False, t)
- | "mutable"; i = LIDENT; ":"; t = ctyp -> (i, True, t)
- | "mutable"; i = LABEL; t = ctyp -> (i, True, t) ] ]
+ [ [ i = LIDENT; ":"; t = ctyp -> (loc, i, False, t)
+ | i = LABEL; t = ctyp -> (loc, i, False, t)
+ | "mutable"; i = LIDENT; ":"; t = ctyp -> (loc, i, True, t)
+ | "mutable"; i = LABEL; t = ctyp -> (loc, i, True, t) ] ]
;
(* Core types *)
ctyp:
diff --git a/camlp4/etc/pa_sml.ml b/camlp4/etc/pa_sml.ml
index 79b69d060..be2d42e0c 100644
--- a/camlp4/etc/pa_sml.ml
+++ b/camlp4/etc/pa_sml.ml
@@ -104,8 +104,8 @@ value extract_label_types loc tn tal cdol =
let loc = loc_of_node anon_record_type in
let aux_def = ((loc, new_tn), [], anon_record_type, []) in
let tl = [<:ctyp< $lid:new_tn$ >>] in
- ([(c, tl) :: cdl], [aux_def :: aux])
- | None -> ([(c, tl) :: cdl], aux) ])
+ ([(loc, c, tl) :: cdl], [aux_def :: aux])
+ | None -> ([(loc, c, tl) :: cdl], aux) ])
cdol ([], [])
in
[((loc, tn), tal, <:ctyp< [ $list:cdl$ ] >>, []) :: aux]
@@ -218,7 +218,7 @@ EXTEND
| x1 = INT -> not_impl loc "selector 1" ] ]
;
tlabel:
- [ [ x1 = selector; ":"; x2 = ctyp -> (x1, False, x2) ] ]
+ [ [ x1 = selector; ":"; x2 = ctyp -> (loc, x1, False, x2) ] ]
;
tuple_ty:
[ [ x1 = ctyp LEVEL "ty'"; "*"; x2 = tuple_ty -> [x1 :: x2]
diff --git a/camlp4/etc/pr_depend.ml b/camlp4/etc/pr_depend.ml
index a7b6699c3..1796ed9bb 100644
--- a/camlp4/etc/pr_depend.ml
+++ b/camlp4/etc/pr_depend.ml
@@ -53,8 +53,8 @@ value rec ctyp =
| TyTup _ tl -> list ctyp tl
| TyVrn _ sbtll _ -> list variant sbtll
| x -> not_impl "ctyp" x ]
-and constr_decl (_, tl) = list ctyp tl
-and label_decl (_, _, t) = ctyp t
+and constr_decl (_, _, tl) = list ctyp tl
+and label_decl (_, _, _, t) = ctyp t
and variant =
fun
[ RfTag _ _ tl -> list ctyp tl
diff --git a/camlp4/etc/pr_o.ml b/camlp4/etc/pr_o.ml
index fdac6fe7e..973d55584 100644
--- a/camlp4/etc/pr_o.ml
+++ b/camlp4/etc/pr_o.ml
@@ -192,7 +192,7 @@ value private_flag =
;
value rec labels b vl _ k = [: b; listws label (S RO ";") vl "" k :]
-and label (f, m, t) _ k =
+and label (loc, f, m, t) _ k =
HVbox
[: mutable_flag m; `HVbox [: `S LR (conv_lab f); `S LR ":" :];
`ctyp t "" k :]
@@ -201,7 +201,7 @@ and label (f, m, t) _ k =
value rec ctyp_list tel _ k = listws simple_ctyp (S LR "*") tel "" k;
value rec variants b vl _ k = listwbws variant b (S LR "|") vl "" k
-and variant b (c, tl) _ k =
+and variant b (loc, c, tl) _ k =
match tl with
[ [] -> HVbox [: b; `HOVbox [: `S LR c; k :] :]
| _ -> HVbox [: b; `HOVbox [: `S LR c; `S LR "of"; ctyp_list tl "" k :] :] ]
@@ -818,7 +818,7 @@ pr_sig_item.pr_levels :=
fun curr next dg k -> [: `not_impl "sig_item" si :]
| <:sig_item< exception $c$ of $list:tl$ >> ->
fun curr next dg k ->
- [: `variant [: `S LR "exception" :] (c, tl) "" k :]
+ [: `variant [: `S LR "exception" :] (loc, c, tl) "" k :]
| <:sig_item< value $s$ : $t$ >> ->
fun curr next dg k -> [: `value_description (s, t) "" k :]
| <:sig_item< external $s$ : $t$ = $list:pl$ >> ->
@@ -875,9 +875,10 @@ pr_str_item.pr_levels :=
| <:str_item< exception $c$ of $list:tl$ = $b$ >> ->
fun curr next dg k ->
match b with
- [ [] -> [: `variant [: `S LR "exception" :] (c, tl) "" k :]
+ [ [] -> [: `variant [: `S LR "exception" :] (loc, c, tl) "" k :]
| _ ->
- [: `variant [: `S LR "exception" :] (c, tl) "" [: `S LR "=" :];
+ [: `variant [: `S LR "exception" :] (loc, c, tl) ""
+ [: `S LR "=" :];
mod_ident b "" k :] ]
| <:str_item< include $me$ >> ->
fun curr next dg k -> [: `S LR "include"; `module_expr me "" k :]
diff --git a/camlp4/etc/pr_r.ml b/camlp4/etc/pr_r.ml
index 5cdb26609..b99da08e4 100644
--- a/camlp4/etc/pr_r.ml
+++ b/camlp4/etc/pr_r.ml
@@ -146,7 +146,7 @@ value ctyp_f = ref (fun []);
value ctyp t k = ctyp_f.val t k;
value rec labels b vl k = [: b; listws label (S RO ";") vl k :]
-and label (f, m, t) k =
+and label (loc, f, m, t) k =
let m = flag "mutable" m in
HVbox [: `HVbox [: `S LR f; `S LR ":" :]; `HVbox [: m; `ctyp t k :] :]
;
@@ -154,7 +154,7 @@ and label (f, m, t) k =
value rec ctyp_list tel k = listws ctyp (S LR "and") tel k;
value rec variants b vl k = listwbws variant b (S LR "|") vl k
-and variant b (c, tl) k =
+and variant b (loc, c, tl) k =
match tl with
[ [] -> HVbox [: b; `HOVbox [: `S LR c; k :] :]
| _ -> HVbox [: b; `HOVbox [: `S LR c; `S LR "of"; ctyp_list tl k :] :] ]
@@ -820,7 +820,7 @@ pr_sig_item.pr_levels :=
fun curr next _ k -> [: `not_impl "sig_item1" si :]
| <:sig_item< exception $c$ of $list:tl$ >> ->
fun curr next _ k ->
- [: `variant [: `S LR "exception" :] (c, tl) k :]
+ [: `variant [: `S LR "exception" :] (loc, c, tl) k :]
| <:sig_item< value $s$ : $t$ >> ->
fun curr next _ k -> [: `value_description s t k :]
| <:sig_item< include $mt$ >> ->
@@ -873,9 +873,10 @@ pr_str_item.pr_levels :=
| <:str_item< exception $c$ of $list:tl$ = $b$ >> ->
fun curr next _ k ->
match b with
- [ [] -> [: `variant [: `S LR "exception" :] (c, tl) k :]
+ [ [] -> [: `variant [: `S LR "exception" :] (loc, c, tl) k :]
| _ ->
- [: `variant [: `S LR "exception" :] (c, tl) [: `S LR "=" :];
+ [: `variant [: `S LR "exception" :] (loc, c, tl)
+ [: `S LR "=" :];
mod_ident b k :] ]
| <:str_item< include $me$ >> ->
fun curr next _ k -> [: `S LR "include"; `module_expr me k :]
diff --git a/camlp4/meta/pa_r.ml b/camlp4/meta/pa_r.ml
index f5ae3ce98..24e2476f5 100644
--- a/camlp4/meta/pa_r.ml
+++ b/camlp4/meta/pa_r.ml
@@ -180,7 +180,7 @@ EXTEND
[ "top"
[ "declare"; st = LIST0 [ s = str_item; ";" -> s ]; "end" ->
<:str_item< declare $list:st$ end >>
- | "exception"; (c, tl) = constructor_declaration; b = rebind_exn ->
+ | "exception"; (_, c, tl) = constructor_declaration; b = rebind_exn ->
<:str_item< exception $c$ of $list:tl$ = $b$ >>
| "external"; i = LIDENT; ":"; t = ctyp; "="; pd = LIST1 STRING ->
<:str_item< external $i$ : $t$ = $list:pd$ >>
@@ -225,7 +225,7 @@ EXTEND
[ "top"
[ "declare"; st = LIST0 [ s = sig_item; ";" -> s ]; "end" ->
<:sig_item< declare $list:st$ end >>
- | "exception"; (c, tl) = constructor_declaration ->
+ | "exception"; (_, c, tl) = constructor_declaration ->
<:sig_item< exception $c$ of $list:tl$ >>
| "external"; i = LIDENT; ":"; t = ctyp; "="; pd = LIST1 STRING ->
<:sig_item< external $i$ : $t$ = $list:pd$ >>
@@ -557,11 +557,12 @@ EXTEND
<:ctyp< { $list:ldl$ } >> ] ]
;
constructor_declaration:
- [ [ ci = UIDENT; "of"; cal = LIST1 ctyp SEP "and" -> (ci, cal)
- | ci = UIDENT -> (ci, []) ] ]
+ [ [ ci = UIDENT; "of"; cal = LIST1 ctyp SEP "and" -> (loc, ci, cal)
+ | ci = UIDENT -> (loc, ci, []) ] ]
;
label_declaration:
- [ [ i = LIDENT; ":"; mf = OPT "mutable"; t = ctyp -> (i, o2b mf, t) ] ]
+ [ [ i = LIDENT; ":"; mf = OPT "mutable"; t = ctyp ->
+ (loc, i, o2b mf, t) ] ]
;
ident:
[ [ i = LIDENT -> i
diff --git a/camlp4/meta/q_MLast.ml b/camlp4/meta/q_MLast.ml
index 63b0f5910..ac189ece4 100644
--- a/camlp4/meta/q_MLast.ml
+++ b/camlp4/meta/q_MLast.ml
@@ -126,7 +126,7 @@ EXTEND
| "#"; n = lident; dp = dir_param -> Node "StDir" [n; dp]
| "exception"; ctl = constructor_declaration; b = rebind_exn ->
match ctl with
- [ Tuple [c; tl] -> Node "StExc" [c; tl; b]
+ [ Tuple [Loc; c; tl] -> Node "StExc" [c; tl; b]
| _ -> match () with [] ]
| "external"; i = lident; ":"; t = ctyp; "="; p = SLIST1 string ->
Node "StExt" [i; t; p]
@@ -175,7 +175,7 @@ EXTEND
| "#"; n = lident; dp = dir_param -> Node "SgDir" [n; dp]
| "exception"; ctl = constructor_declaration ->
match ctl with
- [ Tuple [c; tl] -> Node "SgExc" [c; tl]
+ [ Tuple [Loc; c; tl] -> Node "SgExc" [c; tl]
| _ -> match () with [] ]
| "external"; i = lident; ":"; t = ctyp; "="; p = SLIST1 string ->
Node "SgExt" [i; t; p]
@@ -527,11 +527,13 @@ EXTEND
| -> List [] ] ]
;
constructor_declaration:
- [ [ ci = uident; "of"; cal = SLIST1 ctyp SEP "and" -> Tuple [ci; cal]
- | ci = uident -> Tuple [ci; List []] ] ]
+ [ [ ci = uident; "of"; cal = SLIST1 ctyp SEP "and" ->
+ Tuple [Loc; ci; cal]
+ | ci = uident -> Tuple [Loc; ci; List []] ] ]
;
label_declaration:
- [ [ i = lident; ":"; mf = mutable_flag; t = ctyp -> Tuple [i; mf; t] ] ]
+ [ [ i = lident; ":"; mf = mutable_flag; t = ctyp ->
+ Tuple [Loc; i; mf; t] ] ]
;
ident:
[ [ i = LIDENT -> Str i
diff --git a/camlp4/ocaml_src/camlp4/ast2pt.ml b/camlp4/ocaml_src/camlp4/ast2pt.ml
index 470aee653..b8b55da6f 100644
--- a/camlp4/ocaml_src/camlp4/ast2pt.ml
+++ b/camlp4/ocaml_src/camlp4/ast2pt.ml
@@ -184,8 +184,8 @@ let mktype loc tl cl tk tm =
;;
let mkmutable m = if m then Mutable else Immutable;;
let mkprivate m = if m then Private else Public;;
-let mktrecord (n, m, t) = n, mkmutable m, ctyp t;;
-let mkvariant (c, tl) = c, List.map ctyp tl;;
+let mktrecord (_, n, m, t) = n, mkmutable m, ctyp t;;
+let mkvariant (_, c, tl) = c, List.map ctyp tl;;
let type_decl tl cl =
function
TyMan (loc, t, TyRec (_, ltl)) ->
diff --git a/camlp4/ocaml_src/camlp4/mLast.mli b/camlp4/ocaml_src/camlp4/mLast.mli
index d1ce9614a..b1a1e7ab0 100644
--- a/camlp4/ocaml_src/camlp4/mLast.mli
+++ b/camlp4/ocaml_src/camlp4/mLast.mli
@@ -29,8 +29,8 @@ type ctyp =
| TyObj of loc * (string * ctyp) list * bool
| TyOlb of loc * string * ctyp
| TyQuo of loc * string
- | TyRec of loc * (string * bool * ctyp) list
- | TySum of loc * (string * ctyp list) list
+ | TyRec of loc * (loc * string * bool * ctyp) list
+ | TySum of loc * (loc * string * ctyp list) list
| TyTup of loc * ctyp list
| TyUid of loc * string
| TyVrn of loc * row_field list * string list option option
diff --git a/camlp4/ocaml_src/camlp4/reloc.ml b/camlp4/ocaml_src/camlp4/reloc.ml
index 20c4f1405..5ad34415d 100644
--- a/camlp4/ocaml_src/camlp4/reloc.ml
+++ b/camlp4/ocaml_src/camlp4/reloc.ml
@@ -37,9 +37,13 @@ let rec ctyp floc sh =
| TyOlb (loc, x1, x2) -> TyOlb (floc loc, x1, self x2)
| TyQuo (loc, x1) -> TyQuo (floc loc, x1)
| TyRec (loc, x1) ->
- TyRec (floc loc, List.map (fun (x1, x2, x3) -> x1, x2, self x3) x1)
+ TyRec
+ (floc loc,
+ List.map (fun (loc, x1, x2, x3) -> floc loc, x1, x2, self x3) x1)
| TySum (loc, x1) ->
- TySum (floc loc, List.map (fun (x1, x2) -> x1, List.map self x2) x1)
+ TySum
+ (floc loc,
+ List.map (fun (loc, x1, x2) -> floc loc, x1, List.map self x2) x1)
| TyTup (loc, x1) -> TyTup (floc loc, List.map self x1)
| TyUid (loc, x1) -> TyUid (floc loc, x1)
| TyVrn (loc, x1, x2) ->
diff --git a/camlp4/ocaml_src/meta/pa_r.ml b/camlp4/ocaml_src/meta/pa_r.ml
index df5204f0a..f401192d7 100644
--- a/camlp4/ocaml_src/meta/pa_r.ml
+++ b/camlp4/ocaml_src/meta/pa_r.ml
@@ -391,7 +391,7 @@ Grammar.extend
Gramext.Snterm
(Grammar.Entry.obj (rebind_exn : 'rebind_exn Grammar.Entry.e))],
Gramext.action
- (fun (b : 'rebind_exn) (c, tl : 'constructor_declaration) _
+ (fun (b : 'rebind_exn) (_, c, tl : 'constructor_declaration) _
(loc : int * int) ->
(MLast.StExc (loc, c, tl, b) : 'str_item));
[Gramext.Stoken ("", "declare");
@@ -554,7 +554,7 @@ Grammar.extend
(constructor_declaration :
'constructor_declaration Grammar.Entry.e))],
Gramext.action
- (fun (c, tl : 'constructor_declaration) _ (loc : int * int) ->
+ (fun (_, c, tl : 'constructor_declaration) _ (loc : int * int) ->
(MLast.SgExc (loc, c, tl) : 'sig_item));
[Gramext.Stoken ("", "declare");
Gramext.Slist0
@@ -1567,14 +1567,14 @@ Grammar.extend
[[Gramext.Stoken ("UIDENT", "")],
Gramext.action
(fun (ci : string) (loc : int * int) ->
- (ci, [] : 'constructor_declaration));
+ (loc, ci, [] : 'constructor_declaration));
[Gramext.Stoken ("UIDENT", ""); Gramext.Stoken ("", "of");
Gramext.Slist1sep
(Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)),
Gramext.Stoken ("", "and"))],
Gramext.action
(fun (cal : 'ctyp list) _ (ci : string) (loc : int * int) ->
- (ci, cal : 'constructor_declaration))]];
+ (loc, ci, cal : 'constructor_declaration))]];
Grammar.Entry.obj
(label_declaration : 'label_declaration Grammar.Entry.e),
None,
@@ -1585,7 +1585,7 @@ Grammar.extend
Gramext.action
(fun (t : 'ctyp) (mf : string option) _ (i : string)
(loc : int * int) ->
- (i, o2b mf, t : 'label_declaration))]];
+ (loc, i, o2b mf, t : 'label_declaration))]];
Grammar.Entry.obj (ident : 'ident Grammar.Entry.e), None,
[None, None,
[[Gramext.Stoken ("UIDENT", "")],
diff --git a/camlp4/ocaml_src/meta/q_MLast.ml b/camlp4/ocaml_src/meta/q_MLast.ml
index ab3fe1307..c76794c0d 100644
--- a/camlp4/ocaml_src/meta/q_MLast.ml
+++ b/camlp4/ocaml_src/meta/q_MLast.ml
@@ -408,10 +408,10 @@ Grammar.extend
(fun (b : 'rebind_exn) (ctl : 'constructor_declaration) _
(loc : int * int) ->
(match ctl with
- Tuple [c; tl] -> Node ("StExc", [c; tl; b])
+ Tuple [Loc; c; tl] -> Node ("StExc", [c; tl; b])
| _ ->
match () with
- _ -> raise (Match_failure ("meta/q_MLast.ml", 4402, 4418)) :
+ _ -> raise (Match_failure ("meta/q_MLast.ml", 4407, 4423)) :
'str_item));
[Gramext.Stoken ("", "#");
Gramext.Snterm (Grammar.Entry.obj (lident : 'lident Grammar.Entry.e));
@@ -645,10 +645,10 @@ Grammar.extend
Gramext.action
(fun (ctl : 'constructor_declaration) _ (loc : int * int) ->
(match ctl with
- Tuple [c; tl] -> Node ("SgExc", [c; tl])
+ Tuple [Loc; c; tl] -> Node ("SgExc", [c; tl])
| _ ->
match () with
- _ -> raise (Match_failure ("meta/q_MLast.ml", 6399, 6415)) :
+ _ -> raise (Match_failure ("meta/q_MLast.ml", 6409, 6425)) :
'sig_item));
[Gramext.Stoken ("", "#");
Gramext.Snterm (Grammar.Entry.obj (lident : 'lident Grammar.Entry.e));
@@ -2120,7 +2120,7 @@ Grammar.extend
[[Gramext.Snterm (Grammar.Entry.obj (uident : 'uident Grammar.Entry.e))],
Gramext.action
(fun (ci : 'uident) (loc : int * int) ->
- (Tuple [ci; List []] : 'constructor_declaration));
+ (Tuple [Loc; ci; List []] : 'constructor_declaration));
[Gramext.Snterm (Grammar.Entry.obj (uident : 'uident Grammar.Entry.e));
Gramext.Stoken ("", "of");
Gramext.srules
@@ -2136,7 +2136,7 @@ Grammar.extend
(fun (a : 'anti_list) (loc : int * int) -> (a : 'anti))]],
Gramext.action
(fun (cal : ast) _ (ci : 'uident) (loc : int * int) ->
- (Tuple [ci; cal] : 'constructor_declaration))]];
+ (Tuple [Loc; ci; cal] : 'constructor_declaration))]];
Grammar.Entry.obj
(label_declaration : 'label_declaration Grammar.Entry.e),
None,
@@ -2149,7 +2149,7 @@ Grammar.extend
Gramext.action
(fun (t : 'ctyp) (mf : 'mutable_flag) _ (i : 'lident)
(loc : int * int) ->
- (Tuple [i; mf; t] : 'label_declaration))]];
+ (Tuple [Loc; i; mf; t] : 'label_declaration))]];
Grammar.Entry.obj (ident : 'ident Grammar.Entry.e), None,
[None, None,
[[Gramext.Snterm (Grammar.Entry.obj (anti_ : 'anti_ Grammar.Entry.e))],