Skip to content

Commit

Permalink
revert to the released version
Browse files Browse the repository at this point in the history
git-svn-id: http://caml.inria.fr/svn/ocaml/release/4.01.0@14619 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information
Damien Doligez committed Apr 17, 2014
1 parent 35b0081 commit 1f0b887
Show file tree
Hide file tree
Showing 16 changed files with 130 additions and 291 deletions.
8 changes: 1 addition & 7 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ Internals:
Bug fixes:
- PR#3236: Document the fact that queues are not thread-safe
(Damien Doligez)
- PR#6175: Fix open!
- PR#5820: Fix camlp4 lexer roll back problem
- PR#4855: 'camlp4 -I +dir' accepted, dir is related to 'camlp4 -where'
- PR#6062: Fix a regression bug caused by commit 13047
- PR#3468: (part 1) Sys_error documentation
(Damien Doligez)
- PR#3679: Warning display problems
Expand Down Expand Up @@ -374,8 +370,7 @@ Bug fixes:
(Jacques Garrigue, report by Leo P. White)
- PR#6164: segmentation fault on Num.power_num of 0/1
(Fabrice Le Fessant, report by Johannes Kanig)
- PR#6210: Camlp4 location error
(Hongbo Zhang, report by Jun Furuse)

Feature wishes:
- PR#5181: Merge common floating point constants in ocamlopt
(Benedikt Meurer)
Expand Down Expand Up @@ -568,7 +563,6 @@ Installation procedure:
(-runtime-variant) to select the debug runtime.

Bug Fixes:

- PR#1643: functions of the Lazy module whose named started with 'lazy_' have
been deprecated, and new ones without the prefix added
- PR#3571: in Bigarrays, call msync() before unmapping to commit changes
Expand Down
4 changes: 2 additions & 2 deletions build/camlp4-bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ for target in $TARGETS camlp4/boot/Camlp4Ast.ml; do
done

if [ -x ./boot/myocamlbuild.native ]; then
OCAMLBUILD=./boot/myocamlbuild.native -no-ocamlfind
OCAMLBUILD=./boot/myocamlbuild.native
else
OCAMLBUILD="./boot/ocamlrun boot/myocamlbuild -no-ocamlfind"
OCAMLBUILD="./boot/ocamlrun boot/myocamlbuild"
fi
$OCAMLBUILD $TMPTARGETS $TARGETS

Expand Down
4 changes: 2 additions & 2 deletions camlp4/Camlp4/Camlp4Ast.partial.ml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
(* while e do { e } *)
| ExWhi of loc and expr and expr
(* let open i in e *)
| ExOpI of loc and ident and override_flag and expr
| ExOpI of loc and ident and expr
(* fun (type t) -> e *)
(* let f x (type t) y z = e *)
| ExFUN of loc and string and expr
Expand Down Expand Up @@ -334,7 +334,7 @@
(* module type s = mt *)
| StMty of loc and string and module_type
(* open i *)
| StOpn of loc and override_flag and ident
| StOpn of loc and ident
(* type t *)
| StTyp of loc and ctyp
(* value (rec)? bi *)
Expand Down
16 changes: 6 additions & 10 deletions camlp4/Camlp4/Printers/OCaml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,9 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct
| _ ->
pp f "@[<hv0>@[<2>let %a%a@]@ @[<hv2>in@ %a@]@]"
o#rec_flag r o#binding bi o#reset_semi#expr e ]
| Ast.ExOpI _loc i ov e ->
(* | <:expr< let open $i$ in $e$ >> -> *)
pp f "@[<2>let open%a %a@]@ @[<2>in@ %a@]"
o#override_flag ov o#ident i o#reset_semi#expr e
| <:expr< let open $i$ in $e$ >> ->
pp f "@[<2>let open %a@]@ @[<2>in@ %a@]"
o#ident i o#reset_semi#expr e
| <:expr< match $e$ with [ $a$ ] >> ->
pp f "@[<hv0>@[<hv0>@[<2>match %a@]@ with@]%a@]"
o#expr e o#match_case a
Expand Down Expand Up @@ -595,7 +594,7 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct
<:expr< if $_$ then $_$ else $_$ >> |
<:expr< let $rec:_$ $_$ in $_$ >> |
<:expr< let module $_$ = $_$ in $_$ >> |
(* <:expr< let open $_$ in $_$ >> *)Ast.ExOpI _ _ _ _ |
<:expr< let open $_$ in $_$ >> |
<:expr< assert $_$ >> | <:expr< assert False >> |
<:expr< lazy $_$ >> | <:expr< new $_$ >> |
<:expr< object ($_$) $_$ end >> ->
Expand Down Expand Up @@ -867,11 +866,8 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct
| <:str_item< module type $s$ = $mt$ >> ->
pp f "@[<2>module type %a =@ %a%(%)@]"
o#var s o#module_type mt semisep
| Ast.StOpn _loc ov sl ->
(* | <:str_item< open $sl$ >> -> *)
pp f "@[<2>open%a@ %a%(%)@]"
o#override_flag ov
o#ident sl semisep
| <:str_item< open $sl$ >> ->
pp f "@[<2>open@ %a%(%)@]" o#ident sl semisep
| <:str_item< type $t$ >> ->
pp f "@[<hv0>@[<hv2>type %a@]%(%)@]" o#ctyp t semisep
| <:str_item< value $rec:r$ $bi$ >> ->
Expand Down
4 changes: 1 addition & 3 deletions camlp4/Camlp4/Sig.ml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ module type Loc = sig
(** [merge loc1 loc2] Return a location that starts at [loc1] and end at
[loc2]. *)
value merge : t -> t -> t;
(** [smart_merge loc1 loc2] Try to return a location that covers both [loc1] and [loc2]*)

value smart_merge : t -> t -> t ;

(** The stop pos becomes equal to the start pos. *)
value join : t -> t;

Expand Down
10 changes: 4 additions & 6 deletions camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml
Original file line number Diff line number Diff line change
Expand Up @@ -863,9 +863,8 @@ value varify_constructors var_names =
| ExWhi loc e1 el ->
let e2 = ExSeq loc el in
mkexp loc (Pexp_while (expr e1) (expr e2))
| ExOpI loc i ov e ->
let fresh = override_flag loc ov in
mkexp loc (Pexp_open fresh (long_uident i) (expr e))
| <:expr@loc< let open $i$ in $e$ >> ->
mkexp loc (Pexp_open Fresh (long_uident i) (expr e))
| <:expr@loc< (module $me$ : $pt$) >> ->
mkexp loc (Pexp_constraint (mkexp loc (Pexp_pack (module_expr me)),
Some (mktyp loc (Ptyp_package (package_type pt))), None))
Expand Down Expand Up @@ -1075,9 +1074,8 @@ value varify_constructors var_names =
| StRecMod loc mb ->
[mkstr loc (Pstr_recmodule (module_str_binding mb [])) :: l]
| StMty loc n mt -> [mkstr loc (Pstr_modtype (with_loc n loc) (module_type mt)) :: l]
| StOpn loc ov id ->
let fresh = override_flag loc ov in
[mkstr loc (Pstr_open fresh (long_uident id)) :: l]
| StOpn loc id ->
[mkstr loc (Pstr_open Fresh (long_uident id)) :: l]
| StTyp loc tdl -> [mkstr loc (Pstr_type (mktype_decl tdl [])) :: l]
| StVal loc rf bi ->
[mkstr loc (Pstr_value (mkrf rf) (binding bi [])) :: l]
Expand Down
5 changes: 2 additions & 3 deletions camlp4/Camlp4/Struct/Lexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ module Make (Token : Sig.Camlp4Token)
let is_in_comment c = c.in_comment
let in_comment c = { (c) with in_comment = true }
let set_start_p c = c.lexbuf.lex_start_p <- Loc.start_pos c.loc
let move_start_p shift c = (* FIXME Please see PR#5820*)
let move_start_p shift c =
let p = c.lexbuf.lex_start_p in
c.lexbuf.lex_start_p <- { (p) with pos_cnum = p.pos_cnum + shift }

Expand Down Expand Up @@ -308,8 +308,7 @@ module Make (Token : Sig.Camlp4Token)
parse comment (in_comment c); COMMENT (buff_contents c) }
| "*)"
{ warn Comment_not_end (Loc.of_lexbuf lexbuf) ;
c.lexbuf.lex_curr_pos <- c.lexbuf.lex_curr_pos - 1;
SYMBOL "*" }
move_start_p (-1) c; SYMBOL "*" }
| "<<" (quotchar* as beginning)
{ if quotations c
then (move_start_p (-String.length beginning);
Expand Down
27 changes: 0 additions & 27 deletions camlp4/Camlp4/Struct/Loc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -98,33 +98,6 @@ value dump f x =

value start_pos = { line = 1 ; bol = 0 ; off = 0 };

value min_pos (x:pos) (y:pos) =
if x.off < y.off
then x
else y;
value max_pos (x:pos) (y:pos) =
if x.off > y.off
then x
else y;

value smart_merge (a:t) (b:t) =
if a == b then a
else
match (a,b) with
[ ({ghost=False;start=a0;stop=a1;file_name = f},
{ghost=False;start=b0;stop=b1;_}) ->
{ghost = False;
start = min_pos a0 b0;
stop = max_pos a1 b1;
file_name = f
}
| ({ghost = True;_},{ghost=True;_})
| ({ghost = True;_},_) -> {(a) with stop = b.stop }
| ({ghost = _;_},{ghost = True;_}) ->
{(b) with start = a.start }
]
;

value ghost =
{ file_name = "ghost-location";
start = start_pos;
Expand Down
2 changes: 1 addition & 1 deletion camlp4/Camlp4Bin.ml
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ value input_file x =
};

value initial_spec_list =
[("-I", Arg.String (fun x -> input_file (IncludeDir (Camlp4_import.Misc.expand_directory Camlp4_config.camlp4_standard_library x))),
[("-I", Arg.String (fun x -> input_file (IncludeDir x)),
"<directory> Add directory in search patch for object files.");
("-where", Arg.Unit print_stdlib,
"Print camlp4 library directory and exit.");
Expand Down
35 changes: 8 additions & 27 deletions camlp4/Camlp4Filters/Camlp4FoldGenerator.ml
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ module Make (AstFilters : Camlp4.Sig.AstFilters) = struct
StringMap.add name (name, <:ident< $lid:name$ >>, tl, tk, False) acc
| _ -> assert False ];

value generate_class_implem ?(virtual_flag=False) mode c tydcl n =
value generate_class_implem mode c tydcl n =
let tyMap = tyMap_of_type_decls tydcl StringMap.empty in
let module M = Gen(struct value size = n; value mode = mode; end) in
let generated = M.generate_structure tyMap in
Expand All @@ -515,13 +515,11 @@ module Make (AstFilters : Camlp4.Sig.AstFilters) = struct
<:ctyp< ! 'a . $M.method_type_of_type <:ctyp< 'a >> <:ctyp< 'a >> [] []$ >>
in
let unknown =
<:class_str_item< method unknown : $gen_type$ = $M.default_expr$ >> in
if not virtual_flag then
<:str_item< class $lid:c$ = object (o : 'self_type) $generated$; $failure$; $unknown$ end >>
else
<:str_item< class virtual $lid:c$ = object (o : 'self_type) $generated$; $failure$; $unknown$ end >>;
<:class_str_item< method unknown : $gen_type$ = $M.default_expr$ >>
in
<:str_item< class $lid:c$ = object (o : 'self_type) $generated$; $failure$; $unknown$ end >>;

value generate_class_interf ?(virtual_flag=False) mode c tydcl n =
value generate_class_interf mode c tydcl n =
let tyMap = tyMap_of_type_decls tydcl StringMap.empty in
let module M = Gen(struct value size = n; value mode = mode; end) in
let generated = M.generate_signature tyMap in
Expand All @@ -540,10 +538,7 @@ module Make (AstFilters : Camlp4.Sig.AstFilters) = struct
let unknown =
<:class_sig_item< method unknown : $gen_type$ >>
in
if not virtual_flag then
<:sig_item< class $lid:c$ : object ('self_type) $generated$; $failure$; $unknown$ end >>
else
<:sig_item< class virtual $lid:c$ : object ('self_type) $generated$; $failure$; $unknown$ end >> ;
<:sig_item< class $lid:c$ : object ('self_type) $generated$; $failure$; $unknown$ end >>;

value processor =
let last = ref <:ctyp<>> in
Expand All @@ -570,19 +565,12 @@ module Make (AstFilters : Camlp4.Sig.AstFilters) = struct
(* backward compatibility *)
| <:str_item@_loc< class $lid:c$ = Camlp4Filters.GenerateFold.generated >> ->
generate_class_implem Fold c last.val 1
| <:str_item@_loc< class virtual $lid:c$ = Camlp4Filters.GenerateFold.generated >> ->
generate_class_implem ~virtual_flag:True Fold c last.val 1

| <:str_item@_loc< class $lid:c$ = Camlp4Filters.GenerateMap.generated >> ->
generate_class_implem Map c last.val 1
| <:str_item@_loc< class virtual $lid:c$ = Camlp4Filters.GenerateMap.generated >> ->
generate_class_implem ~virtual_flag:True Map c last.val 1

(* Handle Camlp4(Fold|Map|FoldMap)\d*Generator *)
| <:str_item@_loc< class $lid:c$ = $uid:m$.generated >> ->
generate_class_from_module_name (generate_class_implem ~virtual_flag:False) c st m
| <:str_item@_loc< class virtual $lid:c$ = $uid:m$.generated >> ->
generate_class_from_module_name (generate_class_implem ~virtual_flag:True) c st m
generate_class_from_module_name generate_class_implem c st m

(* It's a hack to force to recurse on the left to right order *)
| <:str_item< $st1$; $st2$ >> ->
Expand All @@ -598,19 +586,12 @@ module Make (AstFilters : Camlp4.Sig.AstFilters) = struct
(* backward compatibility *)
| <:sig_item@_loc< class $lid:c$ : Camlp4Filters.GenerateFold.generated >> ->
generate_class_interf Fold c last.val 1
| <:sig_item@_loc< class virtual $lid:c$ : Camlp4Filters.GenerateFold.generated >> ->
generate_class_interf ~virtual_flag:True Fold c last.val 1

| <:sig_item@_loc< class $lid:c$ : Camlp4Filters.GenerateMap.generated >> ->
generate_class_interf Map c last.val 1
| <:sig_item@_loc< class virtual $lid:c$ : Camlp4Filters.GenerateMap.generated >> ->
generate_class_interf ~virtual_flag:True Map c last.val 1

(* Handle Camlp4(Fold|Map|FoldMap)\d*Generator *)
| <:sig_item@_loc< class $lid:c$ : $uid:m$.generated >> ->
generate_class_from_module_name (generate_class_interf ~virtual_flag:False) c sg m
| <:sig_item@_loc< class virtual $lid:c$ : $uid:m$.generated >> ->
generate_class_from_module_name (generate_class_interf ~virtual_flag:True) c sg m
generate_class_from_module_name generate_class_interf c sg m

(* It's a hack to force to recurse on the left to right order *)
| <:sig_item< $sg1$; $sg2$ >> ->
Expand Down
2 changes: 1 addition & 1 deletion camlp4/Camlp4Parsers/Camlp4MacroParser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct
defined.val := list_remove x defined.val;
}
with
[ Struct.Grammar.Delete.Rule_not_found _ -> () ];
[ Not_found -> () ];

value parse_def s =
match Gram.parse_string expr (Loc.mk "<command line>") s with
Expand Down
19 changes: 2 additions & 17 deletions camlp4/Camlp4Parsers/Camlp4OCamlParser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct
DELETE_RULE Gram meth_list: meth_decl; opt_dot_dot END;
DELETE_RULE Gram expr: "let"; opt_rec; binding; "in"; SELF END;
DELETE_RULE Gram expr: "let"; "module"; a_UIDENT; module_binding0; "in"; SELF END;
DELETE_RULE Gram expr: "let"; "open"; "!"; module_longident; "in"; SELF END;
DELETE_RULE Gram expr: "let"; "open"; module_longident; "in"; SELF END;
DELETE_RULE Gram expr: "fun"; "["; LIST0 match_case0 SEP "|"; "]" END;
DELETE_RULE Gram expr: "if"; SELF; "then"; SELF; "else"; SELF END;
Expand Down Expand Up @@ -255,8 +254,6 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct
| _ -> <:str_item< value $rec:r$ $bi$ >> ]
| "let"; "module"; m = a_UIDENT; mb = module_binding0; "in"; e = expr ->
<:str_item< let module $m$ = $mb$ in $e$ >>
| "let"; "open"; "!"; i = module_longident; "in"; e = expr ->
<:str_item< let open! $id:i$ in $e$ >>
| "let"; "open"; i = module_longident; "in"; e = expr ->
<:str_item< let open $id:i$ in $e$ >>
] ]
Expand All @@ -275,8 +272,6 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct
| "let"; "module"; m = a_UIDENT; mb = module_binding0; "in";
e = expr LEVEL ";" ->
<:expr< let module $m$ = $mb$ in $e$ >>
| "let"; "open"; "!"; i = module_longident; "in"; e = expr LEVEL ";" ->
<:expr< let open! $id:i$ in $e$ >>
| "let"; "open"; i = module_longident; "in"; e = expr LEVEL ";" ->
<:expr< let open $id:i$ in $e$ >>
| "function"; a = match_case ->
Expand Down Expand Up @@ -533,18 +528,8 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct
meth_list:
[ [ m = meth_decl -> (m, <:row_var_flag<>>) ] ];
comma_ctyp_app:
[ [ t1 = ctyp; ","; t2 = SELF ->
fun acc ->
let loc1 = Ast.loc_of_ctyp t1 in
let loc2 = Ast.loc_of_ctyp acc in
let _loc = Loc.smart_merge loc1 loc2 in
t2 <:ctyp< $acc$ $t1$ >>
| t = ctyp ->
fun acc ->
let loc1 = Ast.loc_of_ctyp t in
let loc2 = Ast.loc_of_ctyp acc in
let _loc = Loc.smart_merge loc1 loc2 in
<:ctyp< $acc$ $t$ >>
[ [ t1 = ctyp; ","; t2 = SELF -> fun acc -> t2 <:ctyp< $acc$ $t1$ >>
| t = ctyp -> fun acc -> <:ctyp< $acc$ $t$ >>
] ]
;
star_ctyp:
Expand Down
23 changes: 6 additions & 17 deletions camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,9 @@ New syntax:\
parser
[ [: `((KEYWORD "(", _) as tok); xs :] ->
match xs with parser
[ [: `(KEYWORD ("or"|"mod"|"land"|"lor"|"lxor"|"lsl"|"lsr"|"asr"|"*" as i) , _loc);
`(KEYWORD ")" , _); xs :] ->
[: `(LIDENT i, _loc); infix_kwds_filter xs :]
[ [: `(KEYWORD ("or"|"mod"|"land"|"lor"|"lxor"|"lsl"|"lsr"|"asr" as i), _loc);
`(KEYWORD ")", _); xs :] ->
[: `(LIDENT i, _loc); infix_kwds_filter xs :]
| [: xs :] ->
[: `tok; infix_kwds_filter xs :] ]
| [: `x; xs :] -> [: `x; infix_kwds_filter xs :] ];
Expand Down Expand Up @@ -473,11 +473,7 @@ New syntax:\
<:str_item< module rec $mb$ >>
| "module"; "type"; i = a_ident; "="; mt = module_type ->
<:str_item< module type $i$ = $mt$ >>
| "open"; "!"; i = module_longident -> Ast.StOpn _loc Ast.OvOverride i
| "open"; i = module_longident ->
Ast.StOpn _loc Ast.OvNil i
(* <:str_item< open $i$ >> *)

| "open"; i = module_longident -> <:str_item< open $i$ >>
| "type"; td = type_declaration ->
<:str_item< type $td$ >>
| value_let; r = opt_rec; bi = binding ->
Expand Down Expand Up @@ -555,8 +551,7 @@ New syntax:\
<:sig_item< module type $i$ = $mt$ >>
| "module"; "type"; i = a_ident ->
<:sig_item< module type $i$ >>
| "open"; i = module_longident ->
<:sig_item< open $i$ >>
| "open"; i = module_longident -> <:sig_item< open $i$ >>
| "type"; t = type_declaration ->
<:sig_item< type $t$ >>
| value_val; i = a_LIDENT; ":"; t = ctyp ->
Expand Down Expand Up @@ -606,9 +601,6 @@ New syntax:\
<:expr< let $rec:r$ $bi$ in $x$ >>
| "let"; "module"; m = a_UIDENT; mb = module_binding0; "in"; e = SELF ->
<:expr< let module $m$ = $mb$ in $e$ >>

| "let"; "open"; "!"; i = module_longident; "in"; e = SELF ->
<:expr< let open! $id:i$ in $e$>>
| "let"; "open"; i = module_longident; "in"; e = SELF ->
<:expr< let open $id:i$ in $e$ >>
| "fun"; "["; a = LIST0 match_case0 SEP "|"; "]" ->
Expand Down Expand Up @@ -704,7 +696,7 @@ New syntax:\
| s = a_STRING -> <:expr< $str:s$ >>
| s = a_CHAR -> <:expr< $chr:s$ >>
| i = TRY module_longident_dot_lparen; e = sequence; ")" ->
<:expr< let open $i$ in $e$ >>
<:expr< let open $i$ in $e$ >>
| i = TRY val_longident -> <:expr< $id:i$ >>
| "`"; s = a_ident -> <:expr< ` $s$ >>
| "["; "]" -> <:expr< [] >>
Expand Down Expand Up @@ -777,9 +769,6 @@ New syntax:\
k <:expr< let module $m$ = $mb$ in $e$ >>
| "let"; "module"; m = a_UIDENT; mb = module_binding0; ";"; el = SELF ->
<:expr< let module $m$ = $mb$ in $mksequence _loc el$ >>

| "let"; "open"; "!"; i = module_longident; "in"; e = SELF ->
<:expr< let open! $id:i$ in $e$ >>
| "let"; "open"; i = module_longident; "in"; e = SELF ->
<:expr< let open $id:i$ in $e$ >>
| `ANTIQUOT ("list" as n) s -> <:expr< $anti:mk_anti ~c:"expr;" n s$ >>
Expand Down

0 comments on commit 1f0b887

Please sign in to comment.