[Pkg-ocaml-maint-commits] [camlp4] 01/05: New upstream version 4.04+1
Ximin Luo
infinity0 at debian.org
Sat Mar 4 14:50:42 UTC 2017
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository camlp4.
commit 78d745aca1ef5e455b22d8d6c44aca37141c8fa3
Author: Ximin Luo <infinity0 at debian.org>
Date: Fri Mar 3 20:33:52 2017 +0100
New upstream version 4.04+1
---
.travis-ci.sh | 11 ++++++++-
CHANGES.md | 23 ++++++++++++++-----
_tags | 2 +-
camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml | 9 ++++----
camlp4/Camlp4/Struct/Lexer.mll | 11 +++++----
camlp4/Camlp4Parsers/Camlp4AstLoader.ml | 12 +++++-----
camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml | 29 ++++++++++++++++++++----
camlp4/boot/Camlp4.ml | 11 +++++----
configure | 4 ++--
9 files changed, 78 insertions(+), 34 deletions(-)
diff --git a/.travis-ci.sh b/.travis-ci.sh
index edcb3f7..12504ac 100644
--- a/.travis-ci.sh
+++ b/.travis-ci.sh
@@ -1,13 +1,22 @@
case $XARCH in
i386)
uname -a
- git clone git://github.com/ocaml/ocaml
+
+ git clone -b 4.04 git://github.com/ocaml/ocaml
cd ocaml
./configure
make world.opt
sudo make install
cd ..
rm -rf ocaml
+
+ git clone git://github.com/ocaml/ocamlbuild
+ cd ocamlbuild
+ make
+ sudo make install
+ cd ..
+ rm -rf ocamlbuild
+
./configure && make && sudo make install
;;
*)
diff --git a/CHANGES.md b/CHANGES.md
index 6c927de..00d3f61 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,9 +1,20 @@
-4.03+1
-------
+4.02.1+1
+--------
-* first 4.03 release
+* map `functor () ->` to `functor * ->` like OCaml
+* fix hanging problem in the toplevel
-4.02 and before
----------------
+4.02.0+2
+--------
-For previous changelogs, look at the 4.02 branch
+* raise an error when passing "with type M.t := ..." to OCaml
+* Make scripts insensitive to `CDPATH`
+* fix build when ocamlopt is not available
+* fix the default value of `PKGDIR`
+
+4.02.0+1
+--------
+
+* support the `M()` syntax
+* support for extensible types
+* support the `match ... with exception ...` syntax
diff --git a/_tags b/_tags
index 7a29e8a..96b65e1 100644
--- a/_tags
+++ b/_tags
@@ -16,7 +16,7 @@
# We want -g everywhere it's possible
true: debug
-
+true: safe_string
<camlp4/**/*>: use_import
<camlp4/**/*.{byte,native}>: use_dynlink
<camlp4/config/gen_import.*>: use_ocamlcommon
diff --git a/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml b/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml
index 9b030aa..2d9cb6a 100644
--- a/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml
+++ b/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml
@@ -77,15 +77,16 @@ module Make (Ast : Sig.Camlp4Ast) = struct
;
value remove_underscores s =
- let l = String.length s in
+ let s = Bytes.of_string s in
+ let l = Bytes.length s in
let rec remove src dst =
if src >= l then
- if dst >= l then s else String.sub s 0 dst
+ if dst >= l then s else Bytes.sub s 0 dst
else
- match s.[src] with
+ match Bytes.get s src with
[ '_' -> remove (src + 1) dst
| c -> do { Bytes.set s dst c; remove (src + 1) (dst + 1) } ]
- in remove 0 0
+ in Bytes.to_string (remove 0 0)
;
value mkloc = Loc.to_ocaml_location;
diff --git a/camlp4/Camlp4/Struct/Lexer.mll b/camlp4/Camlp4/Struct/Lexer.mll
index 180db76..18a9e7e 100644
--- a/camlp4/Camlp4/Struct/Lexer.mll
+++ b/camlp4/Camlp4/Struct/Lexer.mll
@@ -211,6 +211,7 @@ module Make (Token : Sig.Camlp4Token)
let identchar =
['A'-'Z' 'a'-'z' '_' '\192'-'\214' '\216'-'\246' '\248'-'\255' '\'' '0'-'9']
let ident = (lowercase|uppercase) identchar*
+ let quote_tag = (lowercase|uppercase) (identchar|'.')*
let locname = ident
let not_star_symbolchar =
['$' '!' '%' '&' '+' '-' '.' '/' ':' '<' '=' '>' '?' '@' '^' '|' '~' '\\']
@@ -363,7 +364,7 @@ module Make (Token : Sig.Camlp4Token)
"(*"
{ store c; with_curr_loc comment c; parse comment c }
| "*)" { store c }
- | '<' (':' ident)? ('@' locname)? '<'
+ | '<' (':' quote_tag)? ('@' locname)? '<'
{ store c;
if quotations c then with_curr_loc quotation c; parse comment c }
| ident { store_parse comment c }
@@ -419,15 +420,15 @@ module Make (Token : Sig.Camlp4Token)
| symbolchar* as tok { SYMBOL("<@" ^ tok) }
and maybe_quotation_colon c = parse
- | (ident as name) '<'
+ | (quote_tag as name) '<'
{ mk_quotation quotation c name "" (1 + String.length name) }
- | (ident as name) '@' (locname as loc) '<'
+ | (quote_tag as name) '@' (locname as loc) '<'
{ mk_quotation quotation c name loc
(2 + String.length loc + String.length name) }
| symbolchar* as tok { SYMBOL("<:" ^ tok) }
and quotation c = parse
- | '<' (':' ident)? ('@' locname)? '<' { store c ;
+ | '<' (':' quote_tag)? ('@' locname)? '<' { store c ;
with_curr_loc quotation c ;
parse quotation c }
| ">>" { store c }
@@ -447,7 +448,7 @@ module Make (Token : Sig.Camlp4Token)
| eof { err Unterminated_antiquot (loc c) }
| newline
{ update_loc c None 1 false 0; store_parse (antiquot name) c }
- | '<' (':' ident)? ('@' locname)? '<'
+ | '<' (':' quote_tag)? ('@' locname)? '<'
{ store c; with_curr_loc quotation c; parse (antiquot name) c }
| _ { store_parse (antiquot name) c }
diff --git a/camlp4/Camlp4Parsers/Camlp4AstLoader.ml b/camlp4/Camlp4Parsers/Camlp4AstLoader.ml
index 4c4b3c3..e7a3950 100644
--- a/camlp4/Camlp4Parsers/Camlp4AstLoader.ml
+++ b/camlp4/Camlp4Parsers/Camlp4AstLoader.ml
@@ -30,14 +30,14 @@ module Make (Ast : Camlp4.Sig.Ast) = struct
let str =
let buf = Buffer.create 2047 in
let () = Stream.iter (Buffer.add_char buf) strm
- in Buffer.contents buf in
+ in Buffer.to_bytes buf in
let magic_len = String.length ast_magic in
- let buffer = String.create magic_len in
+ let buffer = Bytes.create magic_len in
do {
- String.blit str 0 buffer 0 magic_len;
- if buffer = ast_magic then ()
- else failwith (Format.sprintf "Bad magic: %S vs %S" buffer ast_magic);
- Marshal.from_string str magic_len;
+ Bytes.blit str 0 buffer 0 magic_len;
+ if Bytes.to_string buffer = ast_magic then ()
+ else failwith (Format.sprintf "Bad magic: %S vs %S" (Bytes.to_string buffer) ast_magic);
+ Marshal.from_bytes str magic_len;
};
open Camlp4.PreCast;
diff --git a/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml b/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml
index 0e9bce2..5e86ed3 100644
--- a/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml
+++ b/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml
@@ -210,14 +210,33 @@ New syntax:\
else "-" ^ n
;
- value mkumin _loc f arg =
+ value mkumin _loc arg =
match arg with
[ <:expr< $int:n$ >> -> <:expr< $int:neg_string n$ >>
| <:expr< $int32:n$ >> -> <:expr< $int32:neg_string n$ >>
| <:expr< $int64:n$ >> -> <:expr< $int64:neg_string n$ >>
| <:expr< $nativeint:n$ >> -> <:expr< $nativeint:neg_string n$ >>
| <:expr< $flo:n$ >> -> <:expr< $flo:neg_string n$ >>
- | _ -> <:expr< $lid:"~" ^ f$ $arg$ >> ];
+ | _ -> <:expr< $lid:"~-"$ $arg$ >> ];
+
+ value mkumin_f _loc arg =
+ match arg with
+ [ <:expr< $flo:n$ >> -> <:expr< $flo:neg_string n$ >>
+ | _ -> <:expr< $lid:"~-."$ $arg$ >> ];
+
+ value mkuplus _loc arg =
+ match arg with
+ [ <:expr< $int:n$ >> -> <:expr< $int:n$ >>
+ | <:expr< $int32:n$ >> -> <:expr< $int32:n$ >>
+ | <:expr< $int64:n$ >> -> <:expr< $int64:n$ >>
+ | <:expr< $nativeint:n$ >> -> <:expr< $nativeint:n$ >>
+ | <:expr< $flo:n$ >> -> <:expr< $flo:n$ >>
+ | _ -> <:expr< $lid:"~+"$ $arg$ >> ];
+
+ value mkuplus_f _loc arg =
+ match arg with
+ [ <:expr< $flo:n$ >> -> <:expr< $flo:n$ >>
+ | _ -> <:expr< $lid:"~+."$ $arg$ >> ];
value mklistexp _loc last =
loop True where rec loop top =
@@ -711,8 +730,10 @@ New syntax:\
| e1 = SELF; "lsr"; e2 = SELF -> <:expr< $e1$ lsr $e2$ >>
| e1 = SELF; op = infixop4; e2 = SELF -> <:expr< $op$ $e1$ $e2$ >> ]
| "unary minus" NONA
- [ "-"; e = SELF -> mkumin _loc "-" e
- | "-."; e = SELF -> mkumin _loc "-." e ]
+ [ "-"; e = SELF -> mkumin _loc e
+ | "-."; e = SELF -> mkumin_f _loc e
+ | "+"; e = SELF -> mkuplus _loc e
+ | "+."; e = SELF -> mkuplus_f _loc e ]
| "apply" LEFTA
[ e1 = SELF; e2 = SELF -> <:expr< $e1$ $e2$ >>
| "assert"; e = SELF -> mkassert _loc e
diff --git a/camlp4/boot/Camlp4.ml b/camlp4/boot/Camlp4.ml
index db16eab..5f2cc70 100644
--- a/camlp4/boot/Camlp4.ml
+++ b/camlp4/boot/Camlp4.ml
@@ -15410,16 +15410,17 @@ module Struct =
with | (Failure _ as exn) -> Loc.raise loc exn
let remove_underscores s =
- let l = String.length s in
+ let s = Bytes.of_string s in
+ let l = Bytes.length s in
let rec remove src dst =
if src >= l
- then if dst >= l then s else String.sub s 0 dst
+ then if dst >= l then s else Bytes.sub s 0 dst
else
- (match s.[src] with
+ (match Bytes.get s src with
| '_' -> remove (src + 1) dst
| c -> (Bytes.set s dst c; remove (src + 1) (dst + 1)))
- in remove 0 0
-
+ in Bytes.to_string (remove 0 0)
+
let mkloc = Loc.to_ocaml_location
let mkghloc loc = Loc.to_ocaml_location (Loc.ghostify loc)
diff --git a/configure b/configure
index e44b28a..fb89f1d 100755
--- a/configure
+++ b/configure
@@ -35,8 +35,8 @@ if [ $major -lt 4 -o \( $major -eq 4 -a $minor -lt 2 \) ]; then
echo "The standalone Camlp4 requires OCaml >= 4.02."
echo "For previous versions of OCaml use the Camlp4 distributed with OCaml."
exit 2
-elif [ $major -ne 4 -o $minor -ne 3 ]; then
- echo "This version of Camlp4 is for OCaml 4.03 but you are using OCaml $ocaml_version."
+elif [ $major -ne 4 -o $minor -ne 4 ]; then
+ echo "This version of Camlp4 is for OCaml 4.04 but you are using OCaml $ocaml_version."
echo "If building Camlp4 directly from git, use the $major.$minor branch."
exit 2
fi
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/camlp4.git
More information about the Pkg-ocaml-maint-commits
mailing list