Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ocaml-camlp5 for openSUSE:Factory checked in at 2026-10-26 09:59:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ocaml-camlp5 (Old) and /work/SRC/openSUSE:Factory/.ocaml-camlp5.new.2252680 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ocaml-camlp5" Mon Oct 26 09:59:32 2026 rev:25 rq:1392334 version:8.05.03 Changes: -------- --- /work/SRC/openSUSE:Factory/ocaml-camlp5/ocaml-camlp5.changes 2026-07-17 01:39:09.716496520 +0200 +++ /work/SRC/openSUSE:Factory/.ocaml-camlp5.new.2252680/ocaml-camlp5.changes 2026-10-26 09:59:33.715603495 +0100 @@ -1,0 +2,6 @@ +Sat Oct 10 10:10:10 UTC 2026 - [email protected] + +- Update to version 8.05.03 + see included CHANGES file for details + +------------------------------------------------------------------- Old: ---- ocaml-camlp5-8.05.02.tar.xz New: ---- ocaml-camlp5-8.05.03.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ocaml-camlp5.spec ++++++ --- /var/tmp/diff_new_pack.NOSqsT/_old 2026-10-26 09:59:34.347630009 +0100 +++ /var/tmp/diff_new_pack.NOSqsT/_new 2026-10-26 09:59:34.349630093 +0100 @@ -25,7 +25,7 @@ %nil Name: ocaml-camlp5 -Version: 8.05.02 +Version: 8.05.03 Release: 0 %{?ocaml_preserve_bytecode} Summary: Preprocessor-Pretty-Printer for Objective Caml ++++++ _service ++++++ --- /var/tmp/diff_new_pack.NOSqsT/_old 2026-10-26 09:59:34.379631352 +0100 +++ /var/tmp/diff_new_pack.NOSqsT/_new 2026-10-26 09:59:34.381631436 +0100 @@ -1,7 +1,7 @@ <services> <service name="tar_scm" mode="manual"> <param name="filename">ocaml-camlp5</param> - <param name="revision">0a08a53b1ee0bf8577cb571d601b8db0ceed34f7</param> + <param name="revision">f2898e52a9fbe45537e7e4fd5a7be315852e1e7d</param> <param name="scm">git</param> <param name="submodules">disable</param> <param name="url">https://github.com/camlp5/camlp5.git</param> ++++++ ocaml-camlp5-8.05.02.tar.xz -> ocaml-camlp5-8.05.03.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/CHANGES new/ocaml-camlp5-8.05.03/CHANGES --- old/ocaml-camlp5-8.05.02/CHANGES 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/CHANGES 2026-10-17 21:12:20.000000000 +0200 @@ -1,3 +1,15 @@ +Camlp5 Version 8.05.03: +----------------------- + +* [15 Oct 2026] resurrect "dot_newline_is" support in the revised syntax. + This allows you to use ".<NEWLINE>" as a stand-in for ";". Camlp5 + used to support this, but I removed it back around the 8.00 days, b/c + I didn't know what it was for. It's to support a Coq-like syntax. + + Also resurrect all the various greek identifier support in revised + syntax (with appropriate conversions for original/official syntax + so the AST remains kosher). + Camlp5 Version 8.05.02: ----------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/README.md new/ocaml-camlp5-8.05.03/README.md --- old/ocaml-camlp5-8.05.02/README.md 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/README.md 2026-10-17 21:12:20.000000000 +0200 @@ -8,7 +8,7 @@ 4.05.0. Camlp5 is heavily tested with OCaml versions from 4.10.0 forward, with an extensive and ever-growing testsuite. -This Camlp5 version is 8.05.02. NOTE WELL that this is an **new** +This Camlp5 version is 8.05.03. NOTE WELL that this is an **new** release (very different from the 7.xx releases), and as such, may break your code. If it does, please do reach out to me, and I'll be happy to help upgrade it. I'm still working on the documentation, but diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/etc/pr_r.ml new/ocaml-camlp5-8.05.03/etc/pr_r.ml --- old/ocaml-camlp5-8.05.02/etc/pr_r.ml 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/etc/pr_r.ml 2026-10-17 21:12:20.000000000 +0200 @@ -56,6 +56,53 @@ Eprinter.clear pr_class_type; }; + +(* UTF8 functions specific to pr_r *) + +value default_lang = + try Sys.getenv "LC_ALL" with + [ Not_found -> + try Sys.getenv "LC_MESSAGES" with + [ Not_found -> try Sys.getenv "LANG" with [ Not_found -> "" ] ] ] +; + +value utf8 = + let s = default_lang in + let utf8_str = "utf-8" in + let slen = String.length s in + let ulen = String.length utf8_str in + slen >= ulen && + string_lowercase (String.sub s (slen - ulen) ulen) = utf8_str +; + +(* Type variables and identifiers in Greek *) + +value greek_tab = + [| "α"; "β"; "γ"; "δ"; "ε"; "ζ"; "η"; "θ"; "ι"; "κ"; "λ"; "μ"; "ν"; "ξ"; + "ο"; "π"; "ρ"; "σ"; "τ"; "υ"; "φ"; "χ"; "ψ"; "ω" |] +; +value index_tab = [| ""; "₁"; "₂"; "₃"; "₄"; "₅"; "₆"; "₇"; "₈"; "₉" |]; + +value try_greek s = do { + if utf8 then do { + if String.length s = 1 then do { + let c = Char.code s.[0] - Char.code 'a' in + let g = greek_tab.(c mod Array.length greek_tab) in + let n = c / Array.length greek_tab in + if n < Array.length index_tab then Some (g ^ index_tab.(n)) + else None + } + else None + } + else None +}; + +value try_greek_lident s = + if utf8 then + english2greek_lident s + else s +; + (* general functions *) value error loc msg = Ploc.raise loc (Failure msg); @@ -176,10 +223,10 @@ else f pc ; - value string pc s = pprintf pc "\"%s\"" s; value lident pc v = + let v = try_greek_lident v in if is_keyword v then pprintf pc "\\#%s@ " v else pprintf pc "%s" v ; @@ -363,23 +410,7 @@ | z -> patt pc z ] ; -(* utilities specific to pr_r *) - -value default_lang = - try Sys.getenv "LC_ALL" with - [ Not_found -> - try Sys.getenv "LC_MESSAGES" with - [ Not_found -> try Sys.getenv "LANG" with [ Not_found -> "" ] ] ] -; - -value utf8 = - let s = default_lang in - let utf8_str = "utf-8" in - let slen = String.length s in - let ulen = String.length utf8_str in - slen >= ulen && - string_lowercase (String.sub s (slen - ulen) ulen) = utf8_str -; +(* more utilities specific to pr_r *) value arrow () = if utf8 then "→" else "->"; @@ -791,28 +822,6 @@ String.length s >= len && String.sub s 0 len = s_ini ; -(* Type variables in Greek *) - -value greek_tab = - [| "α"; "β"; "γ"; "δ"; "ε"; "ζ"; "η"; "θ"; "ι"; "κ"; "λ"; "μ"; "ν"; "ξ"; - "ο"; "π"; "ρ"; "σ"; "τ"; "υ"; "φ"; "χ"; "ψ"; "ω" |] -; -value index_tab = [| ""; "₁"; "₂"; "₃"; "₄"; "₅"; "₆"; "₇"; "₈"; "₉" |]; - -value try_greek s = do { - if utf8 then do { - if String.length s = 1 then do { - let c = Char.code s.[0] - Char.code 'a' in - let g = greek_tab.(c mod Array.length greek_tab) in - let n = c / Array.length greek_tab in - if n < Array.length index_tab then Some (g ^ index_tab.(n)) - else None - } - else None - } - else None -}; - value typevar pc s = match try_greek s with [ Some s -> pprintf pc "%s" s @@ -1680,21 +1689,21 @@ [ <:expr< $longid:li$ . ( $e$ ) >> -> match e with [ - <:expr< $uid:"[]"$ >> -> pprintf pc "%p.@;<0 0>@[<a>[]@]" longident li - | <:expr< [ $_$ :: $_$ ] >> -> pprintf pc "%p.@;<0 0>%p" longident li curr e + <:expr< $uid:"[]"$ >> -> pprintf pc "%p.@[<a>[]@]" longident li + | <:expr< [ $_$ :: $_$ ] >> -> pprintf pc "%p.%p" longident li curr e - | <:expr< { $list:_$ } >> -> pprintf pc "%p.@;<0 0>%p" longident li curr e - | <:expr< {($_$) with $list:_$ } >> -> pprintf pc "%p.@;<0 0>%p" longident li curr e - | <:expr:< $lid:v$ >> -> pprintf pc "%p.@;<0 0>%p" longident li var_escaped (loc,v) + | <:expr< { $list:_$ } >> -> pprintf pc "%p.%p" longident li curr e + | <:expr< {($_$) with $list:_$ } >> -> pprintf pc "%p.%p" longident li curr e + | <:expr:< $lid:v$ >> -> pprintf pc "%p.%p" longident li var_escaped (loc,v) | <:expr< ($list:el$) >> -> let el = List.map (fun e -> (e, ",")) el in - pprintf pc "%p.@;<0 0>@[<a>(%p)@]" longident li (plist expr 0) el + pprintf pc "%p.@[<a>(%p)@]" longident li (plist expr 0) el - | e -> pprintf pc "%p.@;<0 0>@[<a>(%p)@]" longident li expr e + | e -> pprintf pc "%p.@[<a>(%p)@]" longident li expr e ] - | <:expr:< $e$ . $lid:v$ >> -> pprintf pc "%p.@;<0 0>%p" curr e var_escaped (loc,v) - | <:expr< $e$ . $lilongid:lili$ >> -> pprintf pc "%p.@;<0 0>%p" curr e longident_lident lili + | <:expr:< $e$ . $lid:v$ >> -> pprintf pc "%p.%p" curr e var_escaped (loc,v) + | <:expr< $e$ . $lilongid:lili$ >> -> pprintf pc "%p.%p" curr e longident_lident lili | <:expr< $longid:li$ >> -> longident pc li diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/lib/plexer.ml new/ocaml-camlp5-8.05.03/lib/plexer.ml --- old/ocaml-camlp5-8.05.02/lib/plexer.ml 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/lib/plexer.ml 2026-10-17 21:12:20.000000000 +0200 @@ -12,6 +12,7 @@ value dollar_for_antiquotation = ref True; value specific_space_dot = ref False; +value dot_newline_is = ref "."; value force_antiquot_loc = ref False; @@ -20,6 +21,7 @@ simplest_raw_strings : bool ; dollar_for_antiquotation : bool; specific_space_dot : bool; + dot_newline_is : string; find_kwd : string -> string; is_kwd : string -> bool; line_cnt : int -> char -> unit; @@ -775,6 +777,7 @@ | "{:" -> keyword_or_error ctx (bp, $pos) $buf | "{" (keyword_or_error_or_rawstring ctx bp ((bp, $pos),$buf)) | ".." -> keyword_or_error ctx (bp, $pos) ".." + | "." ?= [ "\n" ] -> keyword_or_error ctx (bp, bp + 1) ctx.dot_newline_is | "." dotsymbolchar symbolchar_star -> keyword_or_error ctx (bp, $pos) $buf | "." -> @@ -879,6 +882,7 @@ dollar_for_antiquotation = dollar_for_antiquotation.val; simplest_raw_strings = simplest_raw_strings.val ; specific_space_dot = specific_space_dot.val; + dot_newline_is = dot_newline_is.val; find_kwd = Hashtbl.find kwd_table; is_kwd = Hashtbl.mem kwd_table; line_cnt bp1 c = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/lib/plexer.mli new/ocaml-camlp5-8.05.03/lib/plexer.mli --- old/ocaml-camlp5-8.05.02/lib/plexer.mli 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/lib/plexer.mli 2026-10-17 21:12:20.000000000 +0200 @@ -73,6 +73,15 @@ the ones which don't have spaces before return the keyword "." (dot alone). *) +value dot_newline_is : ref string; + (** experimental + Specific interpretation for a dot "." followed by a newline; + by default, it is just a dot. Setting another value makes + the lexer interpret it as this value. For example, in + revised syntax (pa_r.ml) setting it to ";" allows to end + phrases with a dot, instead of a semicolon. In normal syntax, + the same can be done by setting it with ";;". *) + value no_quotations : ref bool; (** When True, all lexers built by [Plexer.gmake ()] do not lex the quotation syntax. Default is False (quotations are lexed). *) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/main/mlsyntax.ml new/ocaml-camlp5-8.05.03/main/mlsyntax.ml --- old/ocaml-camlp5-8.05.02/main/mlsyntax.ml 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/main/mlsyntax.ml 2026-10-17 21:12:20.000000000 +0200 @@ -193,4 +193,87 @@ value is_special_op s = is_operator s || is_letop s || is_andop s || is_dotop s ; +value greek_lidents_list = + [ ("α", "alpha") + ; ("β", "beta") + ; ("γ", "gamma") + ; ("δ", "delta") + ; ("ε", "epsilon") + ; ("ζ", "zeta") + ; ("η", "eta") + ; ("θ", "theta") + ; ("ι", "iota") + ; ("κ", "kappa") + ; ("λ", "lambda") + ; ("μ", "mu") + ; ("ν", "nu") + ; ("ξ", "xi") + ; ("ο", "omicron") + ; ("π", "pi") + ; ("ρ", "rho") + ; ("σ", "sigma") + ; ("τ", "tau") + ; ("υ", "upsilon") + ; ("φ", "phi") + ; ("χ", "chi") + ; ("ψ", "psi") + ; ("ω", "omega") + ] +; + +value prefix = "__greek_" ; +value prefixlen = String.length prefix ; +value hexify_greek_lident s = + let b = Buffer.create (prefixlen + (String.length s) * 2) in do { + Buffer.add_string b prefix ; + s |> String.iter (fun c -> Buffer.add_string b (Printf.sprintf "%02x" (Char.code c))) ; + Buffer.contents b + } +; +value unhexify_greek_lident s = + let slen = String.length s in + if slen <= prefixlen then None else + if (slen - prefixlen) mod 2 <> 0 then None else + if String.sub s 0 prefixlen <> prefix then None else + let s = String.sub s prefixlen (slen - prefixlen) in + let slen = String.length s in + let b = Buffer.create (slen/2) in do { + for i = 0 to (slen/2) - 1 do { + let ofs = i * 2 in + let cstr = String.sub s ofs 2 in + let cstr = "0x"^cstr in + let c = Char.chr (int_of_string cstr) in + Buffer.add_char b c + } ; + Some (Buffer.contents b) + } +; + +value greek2english_lident_map = Hashtbl.create 23 ; +value english2greek_lident_map = Hashtbl.create 23 ; +greek_lidents_list +|> List.iter (fun (gid, engid) -> + let engid = "__"^engid^"__" in do { + Hashtbl.add greek2english_lident_map gid engid ; + Hashtbl.add english2greek_lident_map engid gid + }) ; + +value english2greek_lident s = + match Hashtbl.find_opt english2greek_lident_map s with [ + Some s -> s + | None -> match unhexify_greek_lident s with [ + Some s -> s + | None -> s + ] + ] +; + +value greek2english_lident loc s = + match Hashtbl.find_opt greek2english_lident_map s with [ + Some s -> s + | None -> hexify_greek_lident s + ] +; + end ; + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/main/mlsyntax.mli new/ocaml-camlp5-8.05.03/main/mlsyntax.mli --- old/ocaml-camlp5-8.05.02/main/mlsyntax.mli 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/main/mlsyntax.mli 2026-10-17 21:12:20.000000000 +0200 @@ -45,5 +45,10 @@ value is_infix_operator : string → bool; value is_dotop : string → bool; value is_special_op : string → bool; + value english2greek_lident : string -> string; + value greek2english_lident : Ploc.t -> string -> string; + value hexify_greek_lident : string -> string ; + value unhexify_greek_lident : string -> option string ; end ; + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/main/pcaml.ml new/ocaml-camlp5-8.05.03/main/pcaml.ml --- old/ocaml-camlp5-8.05.02/main/pcaml.ml 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/main/pcaml.ml 2026-10-17 21:12:20.000000000 +0200 @@ -7,7 +7,7 @@ open Printf; -value version = "8.05.02"; +value version = "8.05.03"; value syntax_name = ref ""; value ocaml_version = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/mdx-tests/official_toplevel.asciidoc new/ocaml-camlp5-8.05.03/mdx-tests/official_toplevel.asciidoc --- old/ocaml-camlp5-8.05.02/mdx-tests/official_toplevel.asciidoc 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/mdx-tests/official_toplevel.asciidoc 2026-10-17 21:12:20.000000000 +0200 @@ -61,7 +61,7 @@ #camlp5r;; to load camlp5 (revised syntax) - : unit = () - Camlp5 parsing version (OCaml) 8.05.02 + Camlp5 parsing version (OCaml) 8.05.03 # Toplevel input: # # 10 "fixtures/r.ml" @@ -98,7 +98,7 @@ #camlp5r;; to load camlp5 (revised syntax) - : unit = () - Camlp5 parsing version (OCaml) 8.05.02 + Camlp5 parsing version (OCaml) 8.05.03 # File "fixtures/s.ml", line 10, characters 4-5: Failure: this is not a constructor, it cannot be applied in a pattern diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/mdx-tests/revised_toplevel.asciidoc new/ocaml-camlp5-8.05.03/mdx-tests/revised_toplevel.asciidoc --- old/ocaml-camlp5-8.05.02/mdx-tests/revised_toplevel.asciidoc 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/mdx-tests/revised_toplevel.asciidoc 2026-10-17 21:12:20.000000000 +0200 @@ -53,7 +53,7 @@ #camlp5r;; to load camlp5 (revised syntax) - : unit = () - Camlp5 parsing version (Revised) 8.05.02 + Camlp5 parsing version (Revised) 8.05.03 # Toplevel input: @@ -82,7 +82,7 @@ #camlp5r;; to load camlp5 (revised syntax) - : unit = () - Camlp5 parsing version (Revised) 8.05.02 + Camlp5 parsing version (Revised) 8.05.03 # File "fixtures/s.ml", line 10, characters 9-10: Parse error: ')' expected after [paren_ipatt] (in [ipatt]) @@ -108,7 +108,7 @@ #camlp5r;; to load camlp5 (revised syntax) - : unit = () - Camlp5 parsing version (Revised) 8.05.02 + Camlp5 parsing version (Revised) 8.05.03 # File "fixtures/s.ml", line 10, characters 9-10: Parse error: ')' expected after [paren_ipatt] (in [ipatt]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/meta/pa_r.ml new/ocaml-camlp5-8.05.03/meta/pa_r.ml --- old/ocaml-camlp5-8.05.02/meta/pa_r.ml 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/meta/pa_r.ml 2026-10-17 21:12:20.000000000 +0200 @@ -16,11 +16,14 @@ do { let odfa = Plexer.dollar_for_antiquotation.val in + let odni = Plexer.dot_newline_is.val in let osrs = Plexer.simplest_raw_strings.val in Plexer.dollar_for_antiquotation.val := False; Plexer.simplest_raw_strings.val := False; Plexer.utf8_lexing.val := True; + Plexer.dot_newline_is.val := ";"; Grammar.Unsafe.gram_reinit gram (Plexer.gmake ()); + Plexer.dot_newline_is.val := odni; Plexer.dollar_for_antiquotation.val := odfa; Plexer.simplest_raw_strings.val := osrs ; Grammar.Unsafe.clear_entry attribute_body; @@ -1141,7 +1144,7 @@ | "." -> <:expr< . >> | e = alg_extension -> <:expr< [% $_extension:e$ ] >> | i = V LIDENT → <:expr< $_lid:i$ >> - | i = V GIDENT → <:expr< $_lid:i$ >> + | i = V GIDENT → <:expr< $_lid:Pcaml.vala_map (greek2english_lident loc) i$ >> | e = expr_longident → e | "["; "]" → <:expr< $uid:"[]"$ >> | "["; el = LIST1 expr SEP ";"; last = cons_expr_opt; "]" → @@ -1257,7 +1260,7 @@ ; patt_ident: [ [ s = V LIDENT → <:patt< $_lid:s$ >> - | s = V GIDENT → <:patt< $_lid:s$ >> + | s = V GIDENT → <:patt< $_lid:Pcaml.vala_map (greek2english_lident loc) s$ >> | li = longident ; "." ; p = patt LEVEL "simple" → match p with [ <:patt< $uid:i$ >> -> @@ -1518,7 +1521,7 @@ [ t1 = SELF; "->"; t2 = SELF → <:ctyp< $t1$ → $t2$ >> ] | "apply" LEFTA [ t1 = SELF; t2 = SELF → <:ctyp< $t1$ $t2$ >> ] - | LEFTA + | "ident" LEFTA [ t = ctyp_ident → t ] | "simple" [ "'"; i = V ident "" → <:ctyp< '$_:i$ >> @@ -1829,12 +1832,15 @@ ; longident_lident: [ [ li = V longident "longid" ; "."; i = V LIDENT → (Some li, i) + | li = V longident "longid" ; "."; i = V GIDENT → (Some li, Pcaml.vala_map (greek2english_lident loc) i) | i = V LIDENT → (None, i) + | i = V GIDENT → (None, Pcaml.vala_map (greek2english_lident loc) i) ] ] ; extended_longident_lident: [ [ li = V extended_longident "longid" ; "."; i = V LIDENT → (Some li, i) | i = V LIDENT → (None, i) + | i = V GIDENT → (None, Pcaml.vala_map (greek2english_lident loc) i) ] ] ; (* Labels *) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/ocaml_src/lib/plexer.ml new/ocaml-camlp5-8.05.03/ocaml_src/lib/plexer.ml --- old/ocaml-camlp5-8.05.02/ocaml_src/lib/plexer.ml 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/ocaml_src/lib/plexer.ml 2026-10-17 21:12:20.000000000 +0200 @@ -12,6 +12,7 @@ let dollar_for_antiquotation = ref true;; let specific_space_dot = ref false;; +let dot_newline_is = ref ".";; let force_antiquot_loc = ref false;; @@ -20,6 +21,7 @@ simplest_raw_strings : bool; dollar_for_antiquotation : bool; specific_space_dot : bool; + dot_newline_is : string; find_kwd : string -> string; is_kwd : string -> bool; line_cnt : int -> char -> unit; @@ -1567,27 +1569,33 @@ Stream.junk strm__; keyword_or_error ctx (bp, Stream.count strm__) ".." | _ -> - match - try - Some - (dotsymbolchar (Plexing.Lexbuf.add '.' buf) - strm__) - with Stream.Failure -> None - with - Some buf -> - let buf = - try symbolchar_star buf strm__ with - Stream.Failure -> raise (Stream.Error "") - in - keyword_or_error ctx (bp, Stream.count strm__) - (Plexing.Lexbuf.get buf) + match Stream.npeek 1 strm__ with + ['\n'] -> + keyword_or_error ctx (bp, bp + 1) ctx.dot_newline_is | _ -> - let id = - if ctx.specific_space_dot && ctx.after_space then - " ." - else "." - in - keyword_or_error ctx (bp, Stream.count strm__) id + match + try + Some + (dotsymbolchar (Plexing.Lexbuf.add '.' buf) + strm__) + with Stream.Failure -> None + with + Some buf -> + let buf = + try symbolchar_star buf strm__ with + Stream.Failure -> raise (Stream.Error "") + in + keyword_or_error ctx (bp, Stream.count strm__) + (Plexing.Lexbuf.get buf) + | _ -> + let id = + if ctx.specific_space_dot && ctx.after_space + then + " ." + else "." + in + keyword_or_error ctx (bp, Stream.count strm__) + id end | Some ';' -> Stream.junk strm__; @@ -1750,7 +1758,7 @@ let bol_pos = ref 0 in {after_space = false; dollar_for_antiquotation = !dollar_for_antiquotation; simplest_raw_strings = !simplest_raw_strings; - specific_space_dot = !specific_space_dot; + specific_space_dot = !specific_space_dot; dot_newline_is = !dot_newline_is; find_kwd = Hashtbl.find kwd_table; is_kwd = Hashtbl.mem kwd_table; line_cnt = (fun bp1 c -> @@ -2094,12 +2102,12 @@ let glexr = ref {Plexing.tok_func = - (fun _ -> raise (Match_failure ("plexer.ml", 1101, 25))); - tok_using = (fun _ -> raise (Match_failure ("plexer.ml", 1101, 45))); + (fun _ -> raise (Match_failure ("plexer.ml", 1105, 25))); + tok_using = (fun _ -> raise (Match_failure ("plexer.ml", 1105, 45))); tok_removing = - (fun _ -> raise (Match_failure ("plexer.ml", 1101, 68))); - tok_match = (fun _ -> raise (Match_failure ("plexer.ml", 1102, 18))); - tok_text = (fun _ -> raise (Match_failure ("plexer.ml", 1102, 37))); + (fun _ -> raise (Match_failure ("plexer.ml", 1105, 68))); + tok_match = (fun _ -> raise (Match_failure ("plexer.ml", 1106, 18))); + tok_text = (fun _ -> raise (Match_failure ("plexer.ml", 1106, 37))); tok_comm = None; kwds = kwd_table} in let glex = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/ocaml_src/lib/plexer.mli new/ocaml-camlp5-8.05.03/ocaml_src/lib/plexer.mli --- old/ocaml-camlp5-8.05.02/ocaml_src/lib/plexer.mli 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/ocaml_src/lib/plexer.mli 2026-10-17 21:12:20.000000000 +0200 @@ -73,6 +73,15 @@ the ones which don't have spaces before return the keyword "." (dot alone). *) +val dot_newline_is : string ref;; + (** experimental + Specific interpretation for a dot "." followed by a newline; + by default, it is just a dot. Setting another value makes + the lexer interpret it as this value. For example, in + revised syntax (pa_r.ml) setting it to ";" allows to end + phrases with a dot, instead of a semicolon. In normal syntax, + the same can be done by setting it with ";;". *) + val no_quotations : bool ref;; (** When True, all lexers built by [Plexer.gmake ()] do not lex the quotation syntax. Default is False (quotations are lexed). *) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/ocaml_src/main/mlsyntax.ml new/ocaml-camlp5-8.05.03/ocaml_src/main/mlsyntax.ml --- old/ocaml-camlp5-8.05.02/ocaml_src/main/mlsyntax.ml 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/ocaml_src/main/mlsyntax.ml 2026-10-17 21:12:20.000000000 +0200 @@ -170,5 +170,62 @@ let is_special_op s = is_operator s || is_letop s || is_andop s || is_dotop s ;; + let greek_lidents_list = + ["α", "alpha"; "β", "beta"; "γ", "gamma"; "δ", "delta"; "ε", "epsilon"; + "ζ", "zeta"; "η", "eta"; "θ", "theta"; "ι", "iota"; "κ", "kappa"; + "λ", "lambda"; "μ", "mu"; "ν", "nu"; "ξ", "xi"; "ο", "omicron"; + "π", "pi"; "ρ", "rho"; "σ", "sigma"; "τ", "tau"; "υ", "upsilon"; + "φ", "phi"; "χ", "chi"; "ψ", "psi"; "ω", "omega"] + ;; + let prefix = "__greek_";; + let prefixlen = String.length prefix;; + let hexify_greek_lident s = + let b = Buffer.create (prefixlen + String.length s * 2) in + Buffer.add_string b prefix; + s |> + String.iter + (fun c -> + Buffer.add_string b (Printf.sprintf "%02x" (Char.code c))); + Buffer.contents b + ;; + let unhexify_greek_lident s = + let slen = String.length s in + if slen <= prefixlen then None + else if (slen - prefixlen) mod 2 <> 0 then None + else if String.sub s 0 prefixlen <> prefix then None + else + let s = String.sub s prefixlen (slen - prefixlen) in + let slen = String.length s in + let b = Buffer.create (slen / 2) in + for i = 0 to slen / 2 - 1 do + let ofs = i * 2 in + let cstr = String.sub s ofs 2 in + let cstr = "0x" ^ cstr in + let c = Char.chr (int_of_string cstr) in Buffer.add_char b c + done; + Some (Buffer.contents b) + ;; + let greek2english_lident_map = Hashtbl.create 23;; + let english2greek_lident_map = Hashtbl.create 23;; + greek_lidents_list |> + List.iter + (fun (gid, engid) -> + let engid = "__" ^ engid ^ "__" in + Hashtbl.add greek2english_lident_map gid engid; + Hashtbl.add english2greek_lident_map engid gid);; + let english2greek_lident s = + match Hashtbl.find_opt english2greek_lident_map s with + Some s -> s + | None -> + match unhexify_greek_lident s with + Some s -> s + | None -> s + ;; + let greek2english_lident loc s = + match Hashtbl.find_opt greek2english_lident_map s with + Some s -> s + | None -> hexify_greek_lident s + ;; end ;; + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/ocaml_src/main/mlsyntax.mli new/ocaml-camlp5-8.05.03/ocaml_src/main/mlsyntax.mli --- old/ocaml-camlp5-8.05.02/ocaml_src/main/mlsyntax.mli 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/ocaml_src/main/mlsyntax.mli 2026-10-17 21:12:20.000000000 +0200 @@ -45,5 +45,10 @@ val is_infix_operator : string -> bool;; val is_dotop : string -> bool;; val is_special_op : string -> bool;; + val english2greek_lident : string -> string;; + val greek2english_lident : Ploc.t -> string -> string;; + val hexify_greek_lident : string -> string;; + val unhexify_greek_lident : string -> string option;; end ;; + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/ocaml_src/main/pcaml.ml new/ocaml-camlp5-8.05.03/ocaml_src/main/pcaml.ml --- old/ocaml-camlp5-8.05.02/ocaml_src/main/pcaml.ml 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/ocaml_src/main/pcaml.ml 2026-10-17 21:12:20.000000000 +0200 @@ -7,7 +7,7 @@ open Printf;; -let version = "8.05.02";; +let version = "8.05.03";; let syntax_name = ref "";; let ocaml_version = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/ocaml_src/meta/pa_r.ml new/ocaml-camlp5-8.05.03/ocaml_src/meta/pa_r.ml --- old/ocaml-camlp5-8.05.02/ocaml_src/meta/pa_r.ml 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/ocaml_src/meta/pa_r.ml 2026-10-17 21:12:20.000000000 +0200 @@ -15,11 +15,14 @@ Pcaml.no_constructors_arity := false;; let odfa = !(Plexer.dollar_for_antiquotation) in +let odni = !(Plexer.dot_newline_is) in let osrs = !(Plexer.simplest_raw_strings) in Plexer.dollar_for_antiquotation := false; Plexer.simplest_raw_strings := false; Plexer.utf8_lexing := true; +Plexer.dot_newline_is := ";"; Grammar.Unsafe.gram_reinit gram (Plexer.gmake ()); +Plexer.dot_newline_is := odni; Plexer.dollar_for_antiquotation := odfa; Plexer.simplest_raw_strings := osrs; Grammar.Unsafe.clear_entry attribute_body; @@ -3525,7 +3528,9 @@ (Grammar.r_next Grammar.r_stop (Grammar.s_token ("GIDENT", "")), "194fe98d", (fun (i : string) (loc : Ploc.t) -> - (MLast.ExLid (loc, i) : 'expr))); + (MLast.ExLid + (loc, Pcaml.vala_map (greek2english_lident loc) i) : + 'expr))); Grammar.production (Grammar.r_next Grammar.r_stop (Grammar.s_token ("LIDENT", "")), "194fe98d", @@ -4036,7 +4041,9 @@ (Grammar.r_next Grammar.r_stop (Grammar.s_token ("GIDENT", "")), "194fe98d", (fun (s : string) (loc : Ploc.t) -> - (MLast.PaLid (loc, s) : 'patt_ident))); + (MLast.PaLid + (loc, Pcaml.vala_map (greek2english_lident loc) s) : + 'patt_ident))); Grammar.production (Grammar.r_next Grammar.r_stop (Grammar.s_token ("LIDENT", "")), "194fe98d", @@ -5057,7 +5064,7 @@ "194fe98d", (fun (t2 : 'ctyp) (t1 : 'ctyp) (loc : Ploc.t) -> (MLast.TyApp (loc, t1, t2) : 'ctyp)))]; - None, Some Gramext.LeftA, + Some "ident", Some Gramext.LeftA, [Grammar.production (Grammar.r_next Grammar.r_stop (Grammar.s_nterm (ctyp_ident : 'ctyp_ident Grammar.Entry.e)), @@ -6594,6 +6601,12 @@ None [None, None, [Grammar.production + (Grammar.r_next Grammar.r_stop (Grammar.s_token ("GIDENT", "")), + "194fe98d", + (fun (i : string) (loc : Ploc.t) -> + (None, Pcaml.vala_map (greek2english_lident loc) i : + 'longident_lident))); + Grammar.production (Grammar.r_next Grammar.r_stop (Grammar.s_token ("LIDENT", "")), "194fe98d", (fun (i : string) (loc : Ploc.t) -> @@ -6604,6 +6617,17 @@ (Grammar.r_next Grammar.r_stop (Grammar.s_nterm (longident : 'longident Grammar.Entry.e))) (Grammar.s_token ("", "."))) + (Grammar.s_token ("GIDENT", "")), + "194fe98d", + (fun (i : string) _ (li : 'longident) (loc : Ploc.t) -> + (Some li, Pcaml.vala_map (greek2english_lident loc) i : + 'longident_lident))); + Grammar.production + (Grammar.r_next + (Grammar.r_next + (Grammar.r_next Grammar.r_stop + (Grammar.s_nterm (longident : 'longident Grammar.Entry.e))) + (Grammar.s_token ("", "."))) (Grammar.s_token ("LIDENT", "")), "194fe98d", (fun (i : string) _ (li : 'longident) (loc : Ploc.t) -> @@ -6613,6 +6637,12 @@ None [None, None, [Grammar.production + (Grammar.r_next Grammar.r_stop (Grammar.s_token ("GIDENT", "")), + "194fe98d", + (fun (i : string) (loc : Ploc.t) -> + (None, Pcaml.vala_map (greek2english_lident loc) i : + 'extended_longident_lident))); + Grammar.production (Grammar.r_next Grammar.r_stop (Grammar.s_token ("LIDENT", "")), "194fe98d", (fun (i : string) (loc : Ploc.t) -> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/opam new/ocaml-camlp5-8.05.03/opam --- old/ocaml-camlp5-8.05.02/opam 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/opam 2026-10-17 21:12:20.000000000 +0200 @@ -1,4 +1,4 @@ -version: "8.05.02" +version: "8.05.03" opam-version: "2.0" synopsis: "Preprocessor-pretty-printer of OCaml" description: """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/testsuite/Makefile new/ocaml-camlp5-8.05.03/testsuite/Makefile --- old/ocaml-camlp5-8.05.02/testsuite/Makefile 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/testsuite/Makefile 2026-10-17 21:12:20.000000000 +0200 @@ -14,7 +14,7 @@ DIFF=diff -Bwi -u20 RM=rm -TESTS=official2official_test o2r_test o2o_test o2official_test r2r_test r2o_test r2official_test \ +TESTS=official2official_test o2r_test o2o_test o2official_test r2r_test r2o_test r2official_test greek_test \ r2sch_test q_MLast_test revised_parser_test official_parser_test \ sch2r_test.pa_scheme sch2r_test.pa_schemer \ extfun_test reloc_test o_top_test2 o_top_test r_top_test grammar_bug_test \ @@ -41,6 +41,7 @@ r2r_test.byte \ r2o_test.byte \ o2o_test.byte \ + greek_test.byte \ official2official_test.byte \ o2official_test.byte \ r2official_test.byte \ @@ -264,6 +265,13 @@ sch2r_test.pa_schemer.byte: sch2r_test.ml testutil.cmo testutil2.cmo $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -package $(PACKAGES),camlp5.pr_r.link -syntax camlp5r -linkall -linkpkg pa_schemer.cmo testutil.cmo testutil2.cmo sch2r_test.ml -o sch2r_test.pa_schemer.byte +greek_test:: greek_test.byte + $(NOVERBOSE) mkdir -p _build + env LC_ALL=en_US.UTF-8 ./greek_test.byte $(TESTARGS) + +greek_test.byte: papr_test_matrix.cmo testutil.cmo testutil2.cmo greek_test.ml + $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -package $(PACKAGES),ounit2,camlp5.pa_r.link,camlp5.pr_r.link,camlp5.pr_official.link -I ../etc -syntax camlp5r -linkall -linkpkg testutil.cmo testutil2.cmo papr_test_matrix.cmo greek_test.ml -o greek_test.byte + tools/ROUNDTRIP-pa_r-pr_r.byte: $(MKCAMLP5) -package $(C5PACKAGES),camlp5.pa_r,camlp5.pr_r,camlp5.extend,camlp5.phony_quotations -o $@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/testsuite/greek_test.ml new/ocaml-camlp5-8.05.03/testsuite/greek_test.ml --- old/ocaml-camlp5-8.05.02/testsuite/greek_test.ml 1970-01-01 01:00:00.000000000 +0100 +++ new/ocaml-camlp5-8.05.03/testsuite/greek_test.ml 2026-10-17 21:12:20.000000000 +0200 @@ -0,0 +1,141 @@ +(* camlp5r *) +(* r2r_test.ml *) + +open Testutil; +open Testutil2; + +open OUnit2; +open OUnitTest; + +Pcaml.inter_phrases.val := Some ";\n" ; + +open Papr_test_matrix ; + +value test_matrix = [ + {name="greek-identifiers-1"; implem = True ; + exclude=[]; + o_input = SKIP "" ""; + official_input = SKIP "" "" ; + r_input = OK {foo|α;|foo} ; + o_output = OK {foo|__alpha__|foo}; + official_output = OK {foo|;;__alpha__|foo} ; + r_output = OK {foo|α;|foo} + }; + {name="greek-identifiers-2"; implem = True ; + exclude=[]; + o_input = SKIP "" ""; + official_input = SKIP "" "" ; + r_input = OK {foo|ω₂;|foo} ; + o_output = OK {foo|__alpha__|foo}; + official_output = OK {foo|;;__greek_cf89e28282|foo} ; + r_output = OK {foo|ω₂;|foo} + }; + {name="greek-identifiers-3"; implem = True ; + exclude=[]; + o_input = SKIP "" ""; + official_input = SKIP "" "" ; + r_input = OK {foo|αβ;|foo} ; + o_output = OK {foo|__alpha__|foo}; + official_output = OK {foo|;;__greek_ceb1ceb2|foo} ; + r_output = OK {foo|αβ;|foo} + }; + {name="greek-expression-1"; implem = True ; + exclude=[]; + o_input = SKIP "" ""; + official_input = SKIP "" "" ; + r_input = OK {foo|α.β;|foo} ; + o_output = SKIP "" ""; + official_output = OK {foo|;;__alpha__.__beta__|foo} ; + r_output = OK {foo|α.β;|foo} + }; + {name="greek-expression-2"; implem = True ; + exclude=[]; + o_input = SKIP "" ""; + official_input = SKIP "" "" ; + r_input = OK {foo|x.β;|foo} ; + o_output = SKIP "" ""; + official_output = OK {foo|;;x.__beta__|foo} ; + r_output = OK {foo|x.β;|foo} + }; + {name="greek-pattern-1"; implem = True ; + exclude=[]; + o_input = SKIP "" ""; + official_input = SKIP "" "" ; + r_input = OK {foo|fun α -> 1;|foo} ; + o_output = SKIP "" ""; + official_output = OK {foo|;;fun __alpha__ -> 1|foo} ; + r_output = OK {foo|fun α → 1;|foo} + }; + {name="greek-pattern-2"; implem = True ; + exclude=[]; + o_input = SKIP "" ""; + official_input = SKIP "" "" ; + r_input = OK {foo|fun [ A α -> 1 ];|foo} ; + o_output = SKIP "" ""; + official_output = OK {foo|;;fun ((A (__alpha__))[@ocaml.explicit_arity ]) -> 1|foo} ; + r_output = OK {foo|fun [ A α → 1 ];|foo} + }; + {name="greek-type-variables-1"; implem = True ; + exclude=[]; + o_input = OK {foo|type 'a succ = Succ of 'a|foo} ; + official_input = OK {foo|type 'a succ = Succ of 'a|foo} ; + r_input = OK {foo|type succ α = [ Succ of α ];|foo} ; + o_output = OK {foo|type 'a succ = + Succ of 'a;; +|foo}; + official_output = OK {foo|type 'a succ = + | Succ of 'a |foo} ; + r_output = OK {foo|type succ α = + [ Succ of α ]; +|foo} + }; + {name="greek-type-variables-2"; implem = True ; + exclude=[]; + o_input = OK {foo|let magic : 'a 'b. 'a -> 'b = () +|foo} ; + official_input = OK {foo|let magic : 'a 'b. 'a -> 'b = ()|foo} ; + r_input = OK {foo|value magic : ! α β . α -> β = ();|foo} ; + o_output = OK {foo|let magic : 'a 'b . 'a -> 'b = ();; +|foo} ; + official_output = OK {foo|let magic : 'a 'b . 'a -> 'b = ()|foo} ; + r_output = OK {foo|value magic : ! α β . α → β = (); +|foo} + } +] +; + + +value r2r pa pp opa () = List.map (i2test ~{kind="r2r"} pa pp opa r_input KIND_Revised ) test_matrix ; + +value revised_tests = "revised" >::: (r2r PAPR.both_pa1 PAPR.both_pr None ()) ; + +module Official = struct +module Implem = struct +value pr l = + Pr_official.(with_buffer_formatter pp_implem (l, Ploc.dummy)) +; +end ; +module Interf = struct +value pr l = + Pr_official.(with_buffer_formatter pp_interf (l, Ploc.dummy)) +; +end ; +value both_pr = (Implem.pr, Interf.pr) ; +end ; + +value r2official pa pp opa () = List.map (i2test ~{kind="r2official"} pa pp opa r_input KIND_Official ) test_matrix ; +value official_tests = "official" >::: (r2official PAPR.both_pa1 Official.both_pr (Some Testutil.Official.both_pa) ()) ; + +value tests = "greek" >::: [ revised_tests; official_tests ] ; + +value _ = +if not Sys.interactive.val then + run_test_tt_main tests +else () +; +(* +;;; Local Variables: *** +;;; mode:tuareg *** +;;; End: *** + +*) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-camlp5-8.05.02/testsuite/papr_test_matrix.ml new/ocaml-camlp5-8.05.03/testsuite/papr_test_matrix.ml --- old/ocaml-camlp5-8.05.02/testsuite/papr_test_matrix.ml 2026-06-30 06:51:25.000000000 +0200 +++ new/ocaml-camlp5-8.05.03/testsuite/papr_test_matrix.ml 2026-10-17 21:12:20.000000000 +0200 @@ -5443,6 +5443,16 @@ o_output = OK {foo|type t = ?improper:bool -> pat:string -> string -> bool;;|foo}; official_output = OK {foo|type t = ?improper:bool -> pat:string -> string -> bool|foo} ; r_output = OK {foo|type t = ?improper:bool -> ~pat:string -> string -> bool;|foo} + }; + {name="dot-newline"; implem = True ; + exclude=[]; + o_input = OK {foo|x|foo} ; + official_input = OK {foo|x|foo} ; + r_input = OK {foo|x. +|foo} ; + o_output = OK {foo|let _ = x;;|foo}; + official_output = OK {foo|;;x|foo} ; + r_output = OK {foo|x;|foo} } ] @ IFDEF OCAML_VERSION < OCAML_4_11_0 THEN
