1 Index: camlp4/camlp4/ast2pt.ml
2 ===================================================================
3 RCS file: /net/pauillac/caml/repository/csl/camlp4/camlp4/ast2pt.ml,v
4 retrieving revision 1.25
5 retrieving revision 1.26
7 --- camlp4/camlp4/ast2pt.ml 2003/07/16 18:59:12 1.25
8 +++ camlp4/camlp4/ast2pt.ml 2003/09/30 14:39:26 1.26
11 (***********************************************************************)
19 | TyObj loc fl v -> mktyp loc (Ptyp_object (meth_list loc fl v))
21 mktyp loc (Ptyp_class (long_id_of_string_list loc id) [] [])
22 - | TyLab loc _ _ -> error loc "labeled type not allowed here"
23 + | TyLab loc _ _ -> error loc "labelled type not allowed here"
24 | TyLid loc s -> mktyp loc (Ptyp_constr (lident s) [])
25 - | TyMan loc _ _ -> error loc "type manifest not allowed here"
26 - | TyOlb loc lab _ -> error loc "labeled type not allowed here"
27 + | TyMan loc _ _ -> error loc "manifest type not allowed here"
28 + | TyOlb loc lab _ -> error loc "labelled type not allowed here"
29 | TyPol loc pl t -> mktyp loc (Ptyp_poly pl (ctyp t))
30 | TyQuo loc s -> mktyp loc (Ptyp_var s)
31 | TyRec loc _ _ -> error loc "record type not allowed here"
32 Index: camlp4/etc/pa_o.ml
33 ===================================================================
34 RCS file: /net/pauillac/caml/repository/csl/camlp4/etc/pa_o.ml,v
35 retrieving revision 1.52
36 retrieving revision 1.54
38 --- camlp4/etc/pa_o.ml 2003/09/25 12:05:05 1.52
39 +++ camlp4/etc/pa_o.ml 2003/09/30 14:39:38 1.54
42 (***********************************************************************)
49 @@ -1148,16 +1148,16 @@
50 | i = LIDENT -> [i] ] ]
57 [ i = lident_colon; t1 = ctyp LEVEL "star"; "->"; t2 = SELF ->
58 - <:ctyp< ~ $i$ : $t1$ -> $t2$ >>
59 + <:ctyp< ( ~ $i$ : $t1$ ) -> $t2$ >>
60 | i = OPTLABEL; t1 = ctyp LEVEL "star"; "->"; t2 = SELF ->
61 - <:ctyp< ? $i$ : $t1$ -> $t2$ >>
62 + <:ctyp< ( ? $i$ : $t1$ ) -> $t2$ >>
63 | i = QUESTIONIDENT; ":"; t1 = ctyp LEVEL "star"; "->"; t2 = SELF ->
64 - <:ctyp< ? $i$ : $t1$ -> $t2$ >>
65 + <:ctyp< ( ? $i$ : $t1$ ) -> $t2$ >>
66 | "?"; i=lident_colon;t1 = ctyp LEVEL "star"; "->"; t2 = SELF ->
67 - <:ctyp< ? $i$ : $t1$ -> $t2$ >> ] ]
68 + <:ctyp< ( ? $i$ : $t1$ ) -> $t2$ >> ] ]
71 [ [ "["; OPT "|"; rfl = LIST1 row_field SEP "|"; "]" ->
72 Index: camlp4/meta/pa_r.ml
73 ===================================================================
74 RCS file: /net/pauillac/caml/repository/csl/camlp4/meta/pa_r.ml,v
75 retrieving revision 1.53
76 retrieving revision 1.54
78 --- camlp4/meta/pa_r.ml 2003/09/25 12:05:06 1.53
79 +++ camlp4/meta/pa_r.ml 2003/09/30 10:20:06 1.54
82 (***********************************************************************)
90 | i = LIDENT -> [i] ] ]
97 [ i = TILDEIDENT; ":"; t = SELF -> <:ctyp< ~ $i$ : $t$ >>
98 | i = LABEL; t = SELF -> <:ctyp< ~ $i$ : $t$ >>
99 | i = QUESTIONIDENT; ":"; t = SELF -> <:ctyp< ? $i$ : $t$ >>
100 Index: camlp4/meta/q_MLast.ml
101 ===================================================================
102 RCS file: /net/pauillac/caml/repository/csl/camlp4/meta/q_MLast.ml,v
103 retrieving revision 1.51
104 retrieving revision 1.52
105 diff -u -r1.51 -r1.52
106 --- camlp4/meta/q_MLast.ml 2003/07/16 12:50:08 1.51
107 +++ camlp4/meta/q_MLast.ml 2003/09/30 11:38:04 1.52
110 (***********************************************************************)
115 value gram = Grammar.gcreate (Plexer.gmake ());
118 value a_STRING = Grammar.Entry.create gram "a_STRING";
119 value a_CHAR = Grammar.Entry.create gram "a_CHAR";
120 value a_TILDEIDENT = Grammar.Entry.create gram "a_TILDEIDENT";
121 +value a_LABEL = Grammar.Entry.create gram "a_LABEL";
122 value a_QUESTIONIDENT = Grammar.Entry.create gram "a_QUESTIONIDENT";
123 +value a_OPTLABEL = Grammar.Entry.create gram "a_OPTLABEL";
127 @@ -1007,10 +1009,13 @@
128 | i = a_LIDENT -> Qast.List [i] ] ]
131 - ctyp: AFTER "arrow"
133 + ctyp: LEVEL "arrow"
135 [ i = a_TILDEIDENT; ":"; t = SELF -> Qast.Node "TyLab" [Qast.Loc; i; t]
136 + | i = a_LABEL; t = SELF -> Qast.Node "TyLab" [Qast.Loc; i; t]
137 | i = a_QUESTIONIDENT; ":"; t = SELF ->
138 + Qast.Node "TyOlb" [Qast.Loc; i; t]
139 + | i = a_OPTLABEL; t = SELF ->
140 Qast.Node "TyOlb" [Qast.Loc; i; t] ] ]
143 @@ -1044,11 +1049,16 @@
144 | "#"; sl = mod_ident -> Qast.Node "PaTyp" [Qast.Loc; sl]
145 | i = a_TILDEIDENT; ":"; p = SELF ->
146 Qast.Node "PaLab" [Qast.Loc; i; Qast.Option (Some p)]
147 + | i = a_LABEL; p = SELF ->
148 + Qast.Node "PaLab" [Qast.Loc; i; Qast.Option (Some p)]
149 | i = a_TILDEIDENT -> Qast.Node "PaLab" [Qast.Loc; i; Qast.Option None]
150 | i = a_QUESTIONIDENT; ":"; "("; p = patt_tcon; eo = SOPT eq_expr;
153 [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]
154 + | i = a_OPTLABEL; "("; p = patt_tcon; eo = SOPT eq_expr; ")" ->
156 + [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]
157 | i = a_QUESTIONIDENT ->
158 Qast.Node "PaOlb" [Qast.Loc; i; Qast.Option None]
159 | "?"; "("; p = patt_tcon; eo = SOPT eq_expr; ")" ->
160 @@ -1063,11 +1073,16 @@
162 [ [ i = a_TILDEIDENT; ":"; p = SELF ->
163 Qast.Node "PaLab" [Qast.Loc; i; Qast.Option (Some p)]
164 + | i = a_LABEL; p = SELF ->
165 + Qast.Node "PaLab" [Qast.Loc; i; Qast.Option (Some p)]
166 | i = a_TILDEIDENT -> Qast.Node "PaLab" [Qast.Loc; i; Qast.Option None]
167 | i = a_QUESTIONIDENT; ":"; "("; p = ipatt_tcon; eo = SOPT eq_expr;
170 [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]
171 + | i = a_OPTLABEL; "("; p = ipatt_tcon; eo = SOPT eq_expr; ")" ->
173 + [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]
174 | i = a_QUESTIONIDENT ->
175 Qast.Node "PaOlb" [Qast.Loc; i; Qast.Option None]
176 | "?"; "("; p = ipatt_tcon; eo = SOPT eq_expr; ")" ->
177 @@ -1086,9 +1101,13 @@
179 [ i = a_TILDEIDENT; ":"; e = SELF ->
180 Qast.Node "ExLab" [Qast.Loc; i; Qast.Option (Some e)]
181 + | i = a_LABEL; e = SELF ->
182 + Qast.Node "ExLab" [Qast.Loc; i; Qast.Option (Some e)]
183 | i = a_TILDEIDENT -> Qast.Node "ExLab" [Qast.Loc; i; Qast.Option None]
184 | i = a_QUESTIONIDENT; ":"; e = SELF ->
185 Qast.Node "ExOlb" [Qast.Loc; i; Qast.Option (Some e)]
186 + | i = a_OPTLABEL; e = SELF ->
187 + Qast.Node "ExOlb" [Qast.Loc; i; Qast.Option (Some e)]
188 | i = a_QUESTIONIDENT ->
189 Qast.Node "ExOlb" [Qast.Loc; i; Qast.Option None] ] ]
191 @@ -1335,9 +1354,15 @@
192 [ [ "~"; a = ANTIQUOT -> antiquot "" loc a
193 | s = TILDEIDENT -> Qast.Str s ] ]
196 + [ [ s = LABEL -> Qast.Str s ] ]
199 [ [ "?"; a = ANTIQUOT -> antiquot "" loc a
200 | s = QUESTIONIDENT -> Qast.Str s ] ]
203 + [ [ s = OPTLABEL -> Qast.Str s ] ]
207 Index: camlp4/ocaml_src/camlp4/ast2pt.ml
208 ===================================================================
209 RCS file: /net/pauillac/caml/repository/csl/camlp4/ocaml_src/camlp4/ast2pt.ml,v
210 retrieving revision 1.24
211 retrieving revision 1.25
212 diff -u -r1.24 -r1.25
213 --- camlp4/ocaml_src/camlp4/ast2pt.ml 2003/07/23 22:26:18 1.24
214 +++ camlp4/ocaml_src/camlp4/ast2pt.ml 2003/09/30 14:39:38 1.25
215 @@ -169,10 +169,10 @@
216 | TyObj (loc, fl, v) -> mktyp loc (Ptyp_object (meth_list loc fl v))
218 mktyp loc (Ptyp_class (long_id_of_string_list loc id, [], []))
219 - | TyLab (loc, _, _) -> error loc "labeled type not allowed here"
220 + | TyLab (loc, _, _) -> error loc "labelled type not allowed here"
221 | TyLid (loc, s) -> mktyp loc (Ptyp_constr (lident s, []))
222 - | TyMan (loc, _, _) -> error loc "type manifest not allowed here"
223 - | TyOlb (loc, lab, _) -> error loc "labeled type not allowed here"
224 + | TyMan (loc, _, _) -> error loc "manifest type not allowed here"
225 + | TyOlb (loc, lab, _) -> error loc "labelled type not allowed here"
226 | TyPol (loc, pl, t) -> mktyp loc (Ptyp_poly (pl, ctyp t))
227 | TyQuo (loc, s) -> mktyp loc (Ptyp_var s)
228 | TyRec (loc, _, _) -> error loc "record type not allowed here"
229 Index: camlp4/ocaml_src/meta/pa_r.ml
230 ===================================================================
231 RCS file: /net/pauillac/caml/repository/csl/camlp4/ocaml_src/meta/pa_r.ml,v
232 retrieving revision 1.48
233 retrieving revision 1.49
234 diff -u -r1.48 -r1.49
235 --- camlp4/ocaml_src/meta/pa_r.ml 2003/09/25 12:05:07 1.48
236 +++ camlp4/ocaml_src/meta/pa_r.ml 2003/09/30 10:20:06 1.49
237 @@ -2241,8 +2241,8 @@
238 (fun (l : 'class_longident) _ (m : string) (loc : int * int) ->
239 (m :: l : 'class_longident))]];
240 Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e),
241 - Some (Gramext.After "arrow"),
242 - [None, Some Gramext.NonA,
243 + Some (Gramext.Level "arrow"),
244 + [None, Some Gramext.RightA,
245 [[Gramext.Stoken ("OPTLABEL", ""); Gramext.Sself],
247 (fun (t : 'ctyp) (i : string) (loc : int * int) ->
248 Index: camlp4/ocaml_src/meta/q_MLast.ml
249 ===================================================================
250 RCS file: /net/pauillac/caml/repository/csl/camlp4/ocaml_src/meta/q_MLast.ml,v
251 retrieving revision 1.56
252 retrieving revision 1.57
253 diff -u -r1.56 -r1.57
254 --- camlp4/ocaml_src/meta/q_MLast.ml 2003/07/23 22:26:19 1.56
255 +++ camlp4/ocaml_src/meta/q_MLast.ml 2003/09/30 11:38:04 1.57
257 let a_STRING = Grammar.Entry.create gram "a_STRING";;
258 let a_CHAR = Grammar.Entry.create gram "a_CHAR";;
259 let a_TILDEIDENT = Grammar.Entry.create gram "a_TILDEIDENT";;
260 +let a_LABEL = Grammar.Entry.create gram "a_LABEL";;
261 let a_QUESTIONIDENT = Grammar.Entry.create gram "a_QUESTIONIDENT";;
262 +let a_OPTLABEL = Grammar.Entry.create gram "a_OPTLABEL";;
267 Qast.Tuple [xx1; xx2; xx3] -> xx1, xx2, xx3
270 - _ -> raise (Match_failure ("q_MLast.ml", 300, 19))
271 + _ -> raise (Match_failure ("q_MLast.ml", 302, 19))
273 Qast.Node ("StExc", [Qast.Loc; c; tl; b]) :
276 Qast.Tuple [xx1; xx2; xx3] -> xx1, xx2, xx3
279 - _ -> raise (Match_failure ("q_MLast.ml", 358, 19))
280 + _ -> raise (Match_failure ("q_MLast.ml", 360, 19))
282 Qast.Node ("SgExc", [Qast.Loc; c; tl]) :
284 @@ -3345,9 +3347,15 @@
285 (fun (l : 'class_longident) _ (m : 'a_UIDENT) (loc : int * int) ->
286 (Qast.Cons (m, l) : 'class_longident))]];
287 Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e),
288 - Some (Gramext.After "arrow"),
289 - [None, Some Gramext.NonA,
290 + Some (Gramext.Level "arrow"),
291 + [None, Some Gramext.RightA,
293 + (Grammar.Entry.obj (a_OPTLABEL : 'a_OPTLABEL Grammar.Entry.e));
296 + (fun (t : 'ctyp) (i : 'a_OPTLABEL) (loc : int * int) ->
297 + (Qast.Node ("TyOlb", [Qast.Loc; i; t]) : 'ctyp));
300 (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e));
301 Gramext.Stoken ("", ":"); Gramext.Sself],
302 @@ -3355,6 +3363,12 @@
303 (fun (t : 'ctyp) _ (i : 'a_QUESTIONIDENT) (loc : int * int) ->
304 (Qast.Node ("TyOlb", [Qast.Loc; i; t]) : 'ctyp));
306 + (Grammar.Entry.obj (a_LABEL : 'a_LABEL Grammar.Entry.e));
309 + (fun (t : 'ctyp) (i : 'a_LABEL) (loc : int * int) ->
310 + (Qast.Node ("TyLab", [Qast.Loc; i; t]) : 'ctyp));
312 (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e));
313 Gramext.Stoken ("", ":"); Gramext.Sself],
315 @@ -3518,6 +3532,30 @@
316 (fun (i : 'a_QUESTIONIDENT) (loc : int * int) ->
317 (Qast.Node ("PaOlb", [Qast.Loc; i; Qast.Option None]) : 'patt));
319 + (Grammar.Entry.obj (a_OPTLABEL : 'a_OPTLABEL Grammar.Entry.e));
320 + Gramext.Stoken ("", "(");
322 + (Grammar.Entry.obj (patt_tcon : 'patt_tcon Grammar.Entry.e));
326 + (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e)))],
328 + (fun (a : 'eq_expr option) (loc : int * int) ->
329 + (Qast.Option a : 'a_opt));
331 + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))],
333 + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))];
334 + Gramext.Stoken ("", ")")],
336 + (fun _ (eo : 'a_opt) (p : 'patt_tcon) _ (i : 'a_OPTLABEL)
337 + (loc : int * int) ->
340 + [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]) :
344 (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e));
345 Gramext.Stoken ("", ":"); Gramext.Stoken ("", "(");
346 @@ -3548,6 +3586,13 @@
347 (fun (i : 'a_TILDEIDENT) (loc : int * int) ->
348 (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option None]) : 'patt));
350 + (Grammar.Entry.obj (a_LABEL : 'a_LABEL Grammar.Entry.e));
353 + (fun (p : 'patt) (i : 'a_LABEL) (loc : int * int) ->
354 + (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option (Some p)]) :
357 (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e));
358 Gramext.Stoken ("", ":"); Gramext.Sself],
360 @@ -3606,6 +3651,30 @@
361 (fun (i : 'a_QUESTIONIDENT) (loc : int * int) ->
362 (Qast.Node ("PaOlb", [Qast.Loc; i; Qast.Option None]) : 'ipatt));
364 + (Grammar.Entry.obj (a_OPTLABEL : 'a_OPTLABEL Grammar.Entry.e));
365 + Gramext.Stoken ("", "(");
367 + (Grammar.Entry.obj (ipatt_tcon : 'ipatt_tcon Grammar.Entry.e));
371 + (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e)))],
373 + (fun (a : 'eq_expr option) (loc : int * int) ->
374 + (Qast.Option a : 'a_opt));
376 + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))],
378 + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))];
379 + Gramext.Stoken ("", ")")],
381 + (fun _ (eo : 'a_opt) (p : 'ipatt_tcon) _ (i : 'a_OPTLABEL)
382 + (loc : int * int) ->
385 + [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]) :
389 (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e));
390 Gramext.Stoken ("", ":"); Gramext.Stoken ("", "(");
391 @@ -3636,6 +3705,13 @@
392 (fun (i : 'a_TILDEIDENT) (loc : int * int) ->
393 (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option None]) : 'ipatt));
395 + (Grammar.Entry.obj (a_LABEL : 'a_LABEL Grammar.Entry.e));
398 + (fun (p : 'ipatt) (i : 'a_LABEL) (loc : int * int) ->
399 + (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option (Some p)]) :
402 (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e));
403 Gramext.Stoken ("", ":"); Gramext.Sself],
405 @@ -3669,6 +3745,13 @@
406 (fun (i : 'a_QUESTIONIDENT) (loc : int * int) ->
407 (Qast.Node ("ExOlb", [Qast.Loc; i; Qast.Option None]) : 'expr));
409 + (Grammar.Entry.obj (a_OPTLABEL : 'a_OPTLABEL Grammar.Entry.e));
412 + (fun (e : 'expr) (i : 'a_OPTLABEL) (loc : int * int) ->
413 + (Qast.Node ("ExOlb", [Qast.Loc; i; Qast.Option (Some e)]) :
417 (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e));
418 Gramext.Stoken ("", ":"); Gramext.Sself],
419 @@ -3682,6 +3765,13 @@
420 (fun (i : 'a_TILDEIDENT) (loc : int * int) ->
421 (Qast.Node ("ExLab", [Qast.Loc; i; Qast.Option None]) : 'expr));
423 + (Grammar.Entry.obj (a_LABEL : 'a_LABEL Grammar.Entry.e));
426 + (fun (e : 'expr) (i : 'a_LABEL) (loc : int * int) ->
427 + (Qast.Node ("ExLab", [Qast.Loc; i; Qast.Option (Some e)]) :
430 (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e));
431 Gramext.Stoken ("", ":"); Gramext.Sself],
433 @@ -4427,6 +4517,11 @@
435 (fun (a : string) _ (loc : int * int) ->
436 (antiquot "" loc a : 'a_TILDEIDENT))]];
437 + Grammar.Entry.obj (a_LABEL : 'a_LABEL Grammar.Entry.e), None,
439 + [[Gramext.Stoken ("LABEL", "")],
441 + (fun (s : string) (loc : int * int) -> (Qast.Str s : 'a_LABEL))]];
442 Grammar.Entry.obj (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e),
445 @@ -4437,7 +4532,12 @@
446 [Gramext.Stoken ("", "?"); Gramext.Stoken ("ANTIQUOT", "")],
448 (fun (a : string) _ (loc : int * int) ->
449 - (antiquot "" loc a : 'a_QUESTIONIDENT))]]];;
450 + (antiquot "" loc a : 'a_QUESTIONIDENT))]];
451 + Grammar.Entry.obj (a_OPTLABEL : 'a_OPTLABEL Grammar.Entry.e), None,
453 + [[Gramext.Stoken ("OPTLABEL", "")],
455 + (fun (s : string) (loc : int * int) -> (Qast.Str s : 'a_OPTLABEL))]]];;
458 let f s = Grammar.Entry.parse e (Stream.of_string s) in