This patch (against OCaml 3.07) fixes the following issues: - Camlp4: parsing of labeled function arguments. How to apply this patch: * Go to the ocaml-3.07 source directory. * Do "make clean". * Run patch -p1 < [this patch]. * Compile and install as usual (see file INSTALL). -------------- Index: csl/camlp4/camlp4/ast2pt.ml diff -u csl/camlp4/camlp4/ast2pt.ml:1.25 csl/camlp4/camlp4/ast2pt.ml:1.26 --- csl/camlp4/camlp4/ast2pt.ml:1.25 Wed Jul 16 20:59:12 2003 +++ csl/camlp4/camlp4/ast2pt.ml Tue Sep 30 16:39:26 2003 @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: ast2pt.ml,v 1.25 2003/07/16 18:59:12 mauny Exp $ *) +(* $Id: ast2pt.ml,v 1.26 2003/09/30 14:39:26 mauny Exp $ *) open Stdpp; open MLast; @@ -177,10 +177,10 @@ | TyObj loc fl v -> mktyp loc (Ptyp_object (meth_list loc fl v)) | TyCls loc id -> mktyp loc (Ptyp_class (long_id_of_string_list loc id) [] []) - | TyLab loc _ _ -> error loc "labeled type not allowed here" + | TyLab loc _ _ -> error loc "labelled type not allowed here" | TyLid loc s -> mktyp loc (Ptyp_constr (lident s) []) - | TyMan loc _ _ -> error loc "type manifest not allowed here" - | TyOlb loc lab _ -> error loc "labeled type not allowed here" + | TyMan loc _ _ -> error loc "manifest type not allowed here" + | TyOlb loc lab _ -> error loc "labelled type not allowed here" | TyPol loc pl t -> mktyp loc (Ptyp_poly pl (ctyp t)) | TyQuo loc s -> mktyp loc (Ptyp_var s) | TyRec loc _ _ -> error loc "record type not allowed here" Index: csl/camlp4/etc/pa_o.ml diff -u csl/camlp4/etc/pa_o.ml:1.52 csl/camlp4/etc/pa_o.ml:1.54 --- csl/camlp4/etc/pa_o.ml:1.52 Thu Sep 25 14:05:05 2003 +++ csl/camlp4/etc/pa_o.ml Tue Sep 30 16:39:38 2003 @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: pa_o.ml,v 1.52 2003/09/25 12:05:05 mauny Exp $ *) +(* $Id: pa_o.ml,v 1.54 2003/09/30 14:39:38 mauny Exp $ *) open Stdpp; open Pcaml; @@ -1148,16 +1148,16 @@ | i = LIDENT -> [i] ] ] ; (* Labels *) - ctyp: AFTER "arrow" - [ NONA + ctyp: LEVEL "arrow" + [ RIGHTA [ i = lident_colon; t1 = ctyp LEVEL "star"; "->"; t2 = SELF -> - <:ctyp< ~ $i$ : $t1$ -> $t2$ >> + <:ctyp< ( ~ $i$ : $t1$ ) -> $t2$ >> | i = OPTLABEL; t1 = ctyp LEVEL "star"; "->"; t2 = SELF -> - <:ctyp< ? $i$ : $t1$ -> $t2$ >> + <:ctyp< ( ? $i$ : $t1$ ) -> $t2$ >> | i = QUESTIONIDENT; ":"; t1 = ctyp LEVEL "star"; "->"; t2 = SELF -> - <:ctyp< ? $i$ : $t1$ -> $t2$ >> + <:ctyp< ( ? $i$ : $t1$ ) -> $t2$ >> | "?"; i=lident_colon;t1 = ctyp LEVEL "star"; "->"; t2 = SELF -> - <:ctyp< ? $i$ : $t1$ -> $t2$ >> ] ] + <:ctyp< ( ? $i$ : $t1$ ) -> $t2$ >> ] ] ; ctyp: LEVEL "simple" [ [ "["; OPT "|"; rfl = LIST1 row_field SEP "|"; "]" -> Index: csl/camlp4/meta/pa_r.ml diff -u csl/camlp4/meta/pa_r.ml:1.53 csl/camlp4/meta/pa_r.ml:1.55 --- csl/camlp4/meta/pa_r.ml:1.53 Thu Sep 25 14:05:06 2003 +++ csl/camlp4/meta/pa_r.ml Thu Oct 2 14:33:43 2003 @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: pa_r.ml,v 1.53 2003/09/25 12:05:06 mauny Exp $ *) +(* $Id: pa_r.ml,v 1.55 2003/10/02 12:33:43 mauny Exp $ *) open Stdpp; open Pcaml; @@ -542,6 +542,11 @@ <:ctyp< ! $list:pl$ . $t$ >> ] | "arrow" RIGHTA [ t1 = SELF; "->"; t2 = SELF -> <:ctyp< $t1$ -> $t2$ >> ] + | "label" NONA + [ i = TILDEIDENT; ":"; t = SELF -> <:ctyp< ~ $i$ : $t$ >> + | i = LABEL; t = SELF -> <:ctyp< ~ $i$ : $t$ >> + | i = QUESTIONIDENT; ":"; t = SELF -> <:ctyp< ? $i$ : $t$ >> + | i = OPTLABEL; t = SELF -> <:ctyp< ? $i$ : $t$ >> ] | LEFTA [ t1 = SELF; t2 = SELF -> <:ctyp< $t1$ $t2$ >> ] | LEFTA @@ -746,14 +751,6 @@ class_longident: [ [ m = UIDENT; "."; l = SELF -> [m :: l] | i = LIDENT -> [i] ] ] - ; - (* Labels *) - ctyp: AFTER "arrow" - [ NONA - [ i = TILDEIDENT; ":"; t = SELF -> <:ctyp< ~ $i$ : $t$ >> - | i = LABEL; t = SELF -> <:ctyp< ~ $i$ : $t$ >> - | i = QUESTIONIDENT; ":"; t = SELF -> <:ctyp< ? $i$ : $t$ >> - | i = OPTLABEL; t = SELF -> <:ctyp< ? $i$ : $t$ >> ] ] ; ctyp: LEVEL "simple" [ [ "["; "="; rfl = row_field_list; "]" -> Index: csl/camlp4/meta/q_MLast.ml diff -u csl/camlp4/meta/q_MLast.ml:1.51 csl/camlp4/meta/q_MLast.ml:1.53 --- csl/camlp4/meta/q_MLast.ml:1.51 Wed Jul 16 14:50:08 2003 +++ csl/camlp4/meta/q_MLast.ml Thu Oct 2 14:33:43 2003 @@ -10,7 +10,7 @@ (* *) (***********************************************************************) -(* $Id: q_MLast.ml,v 1.51 2003/07/16 12:50:08 mauny Exp $ *) +(* $Id: q_MLast.ml,v 1.53 2003/10/02 12:33:43 mauny Exp $ *) value gram = Grammar.gcreate (Plexer.gmake ()); @@ -127,7 +127,9 @@ value a_STRING = Grammar.Entry.create gram "a_STRING"; value a_CHAR = Grammar.Entry.create gram "a_CHAR"; value a_TILDEIDENT = Grammar.Entry.create gram "a_TILDEIDENT"; +value a_LABEL = Grammar.Entry.create gram "a_LABEL"; value a_QUESTIONIDENT = Grammar.Entry.create gram "a_QUESTIONIDENT"; +value a_OPTLABEL = Grammar.Entry.create gram "a_OPTLABEL"; value o2b = fun @@ -793,6 +795,13 @@ Qast.Node "TyPol" [Qast.Loc; pl; t] ] | "arrow" RIGHTA [ t1 = SELF; "->"; t2 = SELF -> Qast.Node "TyArr" [Qast.Loc; t1; t2] ] + | "label" NONA + [ i = a_TILDEIDENT; ":"; t = SELF -> Qast.Node "TyLab" [Qast.Loc; i; t] + | i = a_LABEL; t = SELF -> Qast.Node "TyLab" [Qast.Loc; i; t] + | i = a_QUESTIONIDENT; ":"; t = SELF -> + Qast.Node "TyOlb" [Qast.Loc; i; t] + | i = a_OPTLABEL; t = SELF -> + Qast.Node "TyOlb" [Qast.Loc; i; t] ] | LEFTA [ t1 = SELF; t2 = SELF -> Qast.Node "TyApp" [Qast.Loc; t1; t2] ] | LEFTA @@ -1006,13 +1015,6 @@ [ [ m = a_UIDENT; "."; l = SELF -> Qast.Cons m l | i = a_LIDENT -> Qast.List [i] ] ] ; - (* Labels *) - ctyp: AFTER "arrow" - [ NONA - [ i = a_TILDEIDENT; ":"; t = SELF -> Qast.Node "TyLab" [Qast.Loc; i; t] - | i = a_QUESTIONIDENT; ":"; t = SELF -> - Qast.Node "TyOlb" [Qast.Loc; i; t] ] ] - ; ctyp: LEVEL "simple" [ [ "["; "="; rfl = row_field_list; "]" -> Qast.Node "TyVrn" [Qast.Loc; rfl; Qast.Option None] @@ -1044,11 +1046,16 @@ | "#"; sl = mod_ident -> Qast.Node "PaTyp" [Qast.Loc; sl] | i = a_TILDEIDENT; ":"; p = SELF -> Qast.Node "PaLab" [Qast.Loc; i; Qast.Option (Some p)] + | i = a_LABEL; p = SELF -> + Qast.Node "PaLab" [Qast.Loc; i; Qast.Option (Some p)] | i = a_TILDEIDENT -> Qast.Node "PaLab" [Qast.Loc; i; Qast.Option None] | i = a_QUESTIONIDENT; ":"; "("; p = patt_tcon; eo = SOPT eq_expr; ")" -> Qast.Node "PaOlb" [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))] + | i = a_OPTLABEL; "("; p = patt_tcon; eo = SOPT eq_expr; ")" -> + Qast.Node "PaOlb" + [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))] | i = a_QUESTIONIDENT -> Qast.Node "PaOlb" [Qast.Loc; i; Qast.Option None] | "?"; "("; p = patt_tcon; eo = SOPT eq_expr; ")" -> @@ -1063,11 +1070,16 @@ ipatt: [ [ i = a_TILDEIDENT; ":"; p = SELF -> Qast.Node "PaLab" [Qast.Loc; i; Qast.Option (Some p)] + | i = a_LABEL; p = SELF -> + Qast.Node "PaLab" [Qast.Loc; i; Qast.Option (Some p)] | i = a_TILDEIDENT -> Qast.Node "PaLab" [Qast.Loc; i; Qast.Option None] | i = a_QUESTIONIDENT; ":"; "("; p = ipatt_tcon; eo = SOPT eq_expr; ")" -> Qast.Node "PaOlb" [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))] + | i = a_OPTLABEL; "("; p = ipatt_tcon; eo = SOPT eq_expr; ")" -> + Qast.Node "PaOlb" + [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))] | i = a_QUESTIONIDENT -> Qast.Node "PaOlb" [Qast.Loc; i; Qast.Option None] | "?"; "("; p = ipatt_tcon; eo = SOPT eq_expr; ")" -> @@ -1086,9 +1098,13 @@ [ "label" NONA [ i = a_TILDEIDENT; ":"; e = SELF -> Qast.Node "ExLab" [Qast.Loc; i; Qast.Option (Some e)] + | i = a_LABEL; e = SELF -> + Qast.Node "ExLab" [Qast.Loc; i; Qast.Option (Some e)] | i = a_TILDEIDENT -> Qast.Node "ExLab" [Qast.Loc; i; Qast.Option None] | i = a_QUESTIONIDENT; ":"; e = SELF -> Qast.Node "ExOlb" [Qast.Loc; i; Qast.Option (Some e)] + | i = a_OPTLABEL; e = SELF -> + Qast.Node "ExOlb" [Qast.Loc; i; Qast.Option (Some e)] | i = a_QUESTIONIDENT -> Qast.Node "ExOlb" [Qast.Loc; i; Qast.Option None] ] ] ; @@ -1335,9 +1351,15 @@ [ [ "~"; a = ANTIQUOT -> antiquot "" loc a | s = TILDEIDENT -> Qast.Str s ] ] ; + a_LABEL: + [ [ s = LABEL -> Qast.Str s ] ] + ; a_QUESTIONIDENT: [ [ "?"; a = ANTIQUOT -> antiquot "" loc a | s = QUESTIONIDENT -> Qast.Str s ] ] + ; + a_OPTLABEL: + [ [ s = OPTLABEL -> Qast.Str s ] ] ; END; Index: csl/camlp4/ocaml_src/camlp4/ast2pt.ml diff -u csl/camlp4/ocaml_src/camlp4/ast2pt.ml:1.24 csl/camlp4/ocaml_src/camlp4/ast2pt.ml:1.25 --- csl/camlp4/ocaml_src/camlp4/ast2pt.ml:1.24 Thu Jul 24 00:26:18 2003 +++ csl/camlp4/ocaml_src/camlp4/ast2pt.ml Tue Sep 30 16:39:38 2003 @@ -169,10 +169,10 @@ | TyObj (loc, fl, v) -> mktyp loc (Ptyp_object (meth_list loc fl v)) | TyCls (loc, id) -> mktyp loc (Ptyp_class (long_id_of_string_list loc id, [], [])) - | TyLab (loc, _, _) -> error loc "labeled type not allowed here" + | TyLab (loc, _, _) -> error loc "labelled type not allowed here" | TyLid (loc, s) -> mktyp loc (Ptyp_constr (lident s, [])) - | TyMan (loc, _, _) -> error loc "type manifest not allowed here" - | TyOlb (loc, lab, _) -> error loc "labeled type not allowed here" + | TyMan (loc, _, _) -> error loc "manifest type not allowed here" + | TyOlb (loc, lab, _) -> error loc "labelled type not allowed here" | TyPol (loc, pl, t) -> mktyp loc (Ptyp_poly (pl, ctyp t)) | TyQuo (loc, s) -> mktyp loc (Ptyp_var s) | TyRec (loc, _, _) -> error loc "record type not allowed here" Index: csl/camlp4/ocaml_src/meta/pa_r.ml diff -u csl/camlp4/ocaml_src/meta/pa_r.ml:1.48 csl/camlp4/ocaml_src/meta/pa_r.ml:1.50 --- csl/camlp4/ocaml_src/meta/pa_r.ml:1.48 Thu Sep 25 14:05:07 2003 +++ csl/camlp4/ocaml_src/meta/pa_r.ml Thu Oct 2 14:33:44 2003 @@ -1540,6 +1540,25 @@ Gramext.action (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> (MLast.TyArr (loc, t1, t2) : 'ctyp))]; + Some "label", Some Gramext.NonA, + [[Gramext.Stoken ("OPTLABEL", ""); Gramext.Sself], + Gramext.action + (fun (t : 'ctyp) (i : string) (loc : int * int) -> + (MLast.TyOlb (loc, i, t) : 'ctyp)); + [Gramext.Stoken ("QUESTIONIDENT", ""); Gramext.Stoken ("", ":"); + Gramext.Sself], + Gramext.action + (fun (t : 'ctyp) _ (i : string) (loc : int * int) -> + (MLast.TyOlb (loc, i, t) : 'ctyp)); + [Gramext.Stoken ("LABEL", ""); Gramext.Sself], + Gramext.action + (fun (t : 'ctyp) (i : string) (loc : int * int) -> + (MLast.TyLab (loc, i, t) : 'ctyp)); + [Gramext.Stoken ("TILDEIDENT", ""); Gramext.Stoken ("", ":"); + Gramext.Sself], + Gramext.action + (fun (t : 'ctyp) _ (i : string) (loc : int * int) -> + (MLast.TyLab (loc, i, t) : 'ctyp))]; None, Some Gramext.LeftA, [[Gramext.Sself; Gramext.Sself], Gramext.action @@ -2240,27 +2259,6 @@ Gramext.action (fun (l : 'class_longident) _ (m : string) (loc : int * int) -> (m :: l : 'class_longident))]]; - Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), - Some (Gramext.After "arrow"), - [None, Some Gramext.NonA, - [[Gramext.Stoken ("OPTLABEL", ""); Gramext.Sself], - Gramext.action - (fun (t : 'ctyp) (i : string) (loc : int * int) -> - (MLast.TyOlb (loc, i, t) : 'ctyp)); - [Gramext.Stoken ("QUESTIONIDENT", ""); Gramext.Stoken ("", ":"); - Gramext.Sself], - Gramext.action - (fun (t : 'ctyp) _ (i : string) (loc : int * int) -> - (MLast.TyOlb (loc, i, t) : 'ctyp)); - [Gramext.Stoken ("LABEL", ""); Gramext.Sself], - Gramext.action - (fun (t : 'ctyp) (i : string) (loc : int * int) -> - (MLast.TyLab (loc, i, t) : 'ctyp)); - [Gramext.Stoken ("TILDEIDENT", ""); Gramext.Stoken ("", ":"); - Gramext.Sself], - Gramext.action - (fun (t : 'ctyp) _ (i : string) (loc : int * int) -> - (MLast.TyLab (loc, i, t) : 'ctyp))]]; Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), Some (Gramext.Level "simple"), [None, None, Index: csl/camlp4/ocaml_src/meta/q_MLast.ml diff -u csl/camlp4/ocaml_src/meta/q_MLast.ml:1.56 csl/camlp4/ocaml_src/meta/q_MLast.ml:1.58 --- csl/camlp4/ocaml_src/meta/q_MLast.ml:1.56 Thu Jul 24 00:26:19 2003 +++ csl/camlp4/ocaml_src/meta/q_MLast.ml Thu Oct 2 14:33:44 2003 @@ -153,7 +153,9 @@ let a_STRING = Grammar.Entry.create gram "a_STRING";; let a_CHAR = Grammar.Entry.create gram "a_CHAR";; let a_TILDEIDENT = Grammar.Entry.create gram "a_TILDEIDENT";; +let a_LABEL = Grammar.Entry.create gram "a_LABEL";; let a_QUESTIONIDENT = Grammar.Entry.create gram "a_QUESTIONIDENT";; +let a_OPTLABEL = Grammar.Entry.create gram "a_OPTLABEL";; let o2b = function @@ -626,7 +628,7 @@ Qast.Tuple [xx1; xx2; xx3] -> xx1, xx2, xx3 | _ -> match () with - _ -> raise (Match_failure ("q_MLast.ml", 300, 19)) + _ -> raise (Match_failure ("q_MLast.ml", 302, 19)) in Qast.Node ("StExc", [Qast.Loc; c; tl; b]) : 'str_item)); @@ -896,7 +898,7 @@ Qast.Tuple [xx1; xx2; xx3] -> xx1, xx2, xx3 | _ -> match () with - _ -> raise (Match_failure ("q_MLast.ml", 358, 19)) + _ -> raise (Match_failure ("q_MLast.ml", 360, 19)) in Qast.Node ("SgExc", [Qast.Loc; c; tl]) : 'sig_item)); @@ -2254,6 +2256,32 @@ Gramext.action (fun (t2 : 'ctyp) _ (t1 : 'ctyp) (loc : int * int) -> (Qast.Node ("TyArr", [Qast.Loc; t1; t2]) : 'ctyp))]; + Some "label", Some Gramext.NonA, + [[Gramext.Snterm + (Grammar.Entry.obj (a_OPTLABEL : 'a_OPTLABEL Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (t : 'ctyp) (i : 'a_OPTLABEL) (loc : int * int) -> + (Qast.Node ("TyOlb", [Qast.Loc; i; t]) : 'ctyp)); + [Gramext.Snterm + (Grammar.Entry.obj + (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); Gramext.Sself], + Gramext.action + (fun (t : 'ctyp) _ (i : 'a_QUESTIONIDENT) (loc : int * int) -> + (Qast.Node ("TyOlb", [Qast.Loc; i; t]) : 'ctyp)); + [Gramext.Snterm + (Grammar.Entry.obj (a_LABEL : 'a_LABEL Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (t : 'ctyp) (i : 'a_LABEL) (loc : int * int) -> + (Qast.Node ("TyLab", [Qast.Loc; i; t]) : 'ctyp)); + [Gramext.Snterm + (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e)); + Gramext.Stoken ("", ":"); Gramext.Sself], + Gramext.action + (fun (t : 'ctyp) _ (i : 'a_TILDEIDENT) (loc : int * int) -> + (Qast.Node ("TyLab", [Qast.Loc; i; t]) : 'ctyp))]; None, Some Gramext.LeftA, [[Gramext.Sself; Gramext.Sself], Gramext.action @@ -3345,22 +3373,6 @@ (fun (l : 'class_longident) _ (m : 'a_UIDENT) (loc : int * int) -> (Qast.Cons (m, l) : 'class_longident))]]; Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), - Some (Gramext.After "arrow"), - [None, Some Gramext.NonA, - [[Gramext.Snterm - (Grammar.Entry.obj - (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); Gramext.Sself], - Gramext.action - (fun (t : 'ctyp) _ (i : 'a_QUESTIONIDENT) (loc : int * int) -> - (Qast.Node ("TyOlb", [Qast.Loc; i; t]) : 'ctyp)); - [Gramext.Snterm - (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e)); - Gramext.Stoken ("", ":"); Gramext.Sself], - Gramext.action - (fun (t : 'ctyp) _ (i : 'a_TILDEIDENT) (loc : int * int) -> - (Qast.Node ("TyLab", [Qast.Loc; i; t]) : 'ctyp))]]; - Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e), Some (Gramext.Level "simple"), [None, None, [[Gramext.Stoken ("", "["); Gramext.Stoken ("", "<"); @@ -3518,6 +3530,30 @@ (fun (i : 'a_QUESTIONIDENT) (loc : int * int) -> (Qast.Node ("PaOlb", [Qast.Loc; i; Qast.Option None]) : 'patt)); [Gramext.Snterm + (Grammar.Entry.obj (a_OPTLABEL : 'a_OPTLABEL Grammar.Entry.e)); + Gramext.Stoken ("", "("); + Gramext.Snterm + (Grammar.Entry.obj (patt_tcon : 'patt_tcon Grammar.Entry.e)); + Gramext.srules + [[Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e)))], + Gramext.action + (fun (a : 'eq_expr option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (eo : 'a_opt) (p : 'patt_tcon) _ (i : 'a_OPTLABEL) + (loc : int * int) -> + (Qast.Node + ("PaOlb", + [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]) : + 'patt)); + [Gramext.Snterm (Grammar.Entry.obj (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e)); Gramext.Stoken ("", ":"); Gramext.Stoken ("", "("); @@ -3548,6 +3584,13 @@ (fun (i : 'a_TILDEIDENT) (loc : int * int) -> (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option None]) : 'patt)); [Gramext.Snterm + (Grammar.Entry.obj (a_LABEL : 'a_LABEL Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (p : 'patt) (i : 'a_LABEL) (loc : int * int) -> + (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option (Some p)]) : + 'patt)); + [Gramext.Snterm (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e)); Gramext.Stoken ("", ":"); Gramext.Sself], Gramext.action @@ -3606,6 +3649,30 @@ (fun (i : 'a_QUESTIONIDENT) (loc : int * int) -> (Qast.Node ("PaOlb", [Qast.Loc; i; Qast.Option None]) : 'ipatt)); [Gramext.Snterm + (Grammar.Entry.obj (a_OPTLABEL : 'a_OPTLABEL Grammar.Entry.e)); + Gramext.Stoken ("", "("); + Gramext.Snterm + (Grammar.Entry.obj (ipatt_tcon : 'ipatt_tcon Grammar.Entry.e)); + Gramext.srules + [[Gramext.Sopt + (Gramext.Snterm + (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e)))], + Gramext.action + (fun (a : 'eq_expr option) (loc : int * int) -> + (Qast.Option a : 'a_opt)); + [Gramext.Snterm + (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))], + Gramext.action + (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))]; + Gramext.Stoken ("", ")")], + Gramext.action + (fun _ (eo : 'a_opt) (p : 'ipatt_tcon) _ (i : 'a_OPTLABEL) + (loc : int * int) -> + (Qast.Node + ("PaOlb", + [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]) : + 'ipatt)); + [Gramext.Snterm (Grammar.Entry.obj (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e)); Gramext.Stoken ("", ":"); Gramext.Stoken ("", "("); @@ -3636,6 +3703,13 @@ (fun (i : 'a_TILDEIDENT) (loc : int * int) -> (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option None]) : 'ipatt)); [Gramext.Snterm + (Grammar.Entry.obj (a_LABEL : 'a_LABEL Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (p : 'ipatt) (i : 'a_LABEL) (loc : int * int) -> + (Qast.Node ("PaLab", [Qast.Loc; i; Qast.Option (Some p)]) : + 'ipatt)); + [Gramext.Snterm (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e)); Gramext.Stoken ("", ":"); Gramext.Sself], Gramext.action @@ -3669,6 +3743,13 @@ (fun (i : 'a_QUESTIONIDENT) (loc : int * int) -> (Qast.Node ("ExOlb", [Qast.Loc; i; Qast.Option None]) : 'expr)); [Gramext.Snterm + (Grammar.Entry.obj (a_OPTLABEL : 'a_OPTLABEL Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (e : 'expr) (i : 'a_OPTLABEL) (loc : int * int) -> + (Qast.Node ("ExOlb", [Qast.Loc; i; Qast.Option (Some e)]) : + 'expr)); + [Gramext.Snterm (Grammar.Entry.obj (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e)); Gramext.Stoken ("", ":"); Gramext.Sself], @@ -3682,6 +3763,13 @@ (fun (i : 'a_TILDEIDENT) (loc : int * int) -> (Qast.Node ("ExLab", [Qast.Loc; i; Qast.Option None]) : 'expr)); [Gramext.Snterm + (Grammar.Entry.obj (a_LABEL : 'a_LABEL Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (e : 'expr) (i : 'a_LABEL) (loc : int * int) -> + (Qast.Node ("ExLab", [Qast.Loc; i; Qast.Option (Some e)]) : + 'expr)); + [Gramext.Snterm (Grammar.Entry.obj (a_TILDEIDENT : 'a_TILDEIDENT Grammar.Entry.e)); Gramext.Stoken ("", ":"); Gramext.Sself], Gramext.action @@ -4427,6 +4515,11 @@ Gramext.action (fun (a : string) _ (loc : int * int) -> (antiquot "" loc a : 'a_TILDEIDENT))]]; + Grammar.Entry.obj (a_LABEL : 'a_LABEL Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("LABEL", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> (Qast.Str s : 'a_LABEL))]]; Grammar.Entry.obj (a_QUESTIONIDENT : 'a_QUESTIONIDENT Grammar.Entry.e), None, [None, None, @@ -4437,7 +4530,12 @@ [Gramext.Stoken ("", "?"); Gramext.Stoken ("ANTIQUOT", "")], Gramext.action (fun (a : string) _ (loc : int * int) -> - (antiquot "" loc a : 'a_QUESTIONIDENT))]]];; + (antiquot "" loc a : 'a_QUESTIONIDENT))]]; + Grammar.Entry.obj (a_OPTLABEL : 'a_OPTLABEL Grammar.Entry.e), None, + [None, None, + [[Gramext.Stoken ("OPTLABEL", "")], + Gramext.action + (fun (s : string) (loc : int * int) -> (Qast.Str s : 'a_OPTLABEL))]]];; let apply_entry e = let f s = Grammar.Entry.parse e (Stream.of_string s) in Index: csl/stdlib/sys.ml diff -u csl/stdlib/sys.ml:1.78 csl/stdlib/sys.ml:1.79 --- csl/stdlib/sys.ml:1.78 Fri Sep 12 09:46:23 2003 +++ csl/stdlib/sys.ml Fri Oct 3 10:31:50 2003 @@ -11,7 +11,7 @@ (* *) (***********************************************************************) -(* $Id: sys.ml,v 1.78 2003/09/12 07:46:23 xleroy Exp $ *) +(* $Id: sys.ml,v 1.79 2003/10/03 08:31:50 xleroy Exp $ *) (* System interface *) @@ -78,4 +78,4 @@ (* OCaml version string, must be in the format described in sys.mli. *) -let ocaml_version = "3.07";; +let ocaml_version = "3.07+1";; .