Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions GT.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "0.5.3"
version: "0.5.5"
synopsis: "Generic programming with extensible transformations"
description: """
Yet another library for generic programming. Provides syntax extensions
Expand All @@ -22,10 +22,10 @@ license: "LGPL-2.1-or-later"
homepage: "https://github.com/PLTools/GT"
bug-reports: "https://github.com/PLTools/GT/issues"
depends: [
"ocaml" {>= "4.14" & < "5.0.0" | >= "5.2.0" & < "5.3.0"}
"ocaml" {>= "4.14" & < "5.0.0" | >= "5.2.0" & <= "5.4.0"}
"dune" {>= "3.16"}
"ppxlib" {<= "0.34.0"}
"camlp5" {>= "8.00.05"}
"camlp5" {>= "8.04.00"}
"ocamlgraph"
"ppx_inline_test_nobase"
"mdx" {build}
Expand Down
20 changes: 11 additions & 9 deletions camlp5/Camlp5Helpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ let loc_from_caml camlloc =
let noloc = Ploc.dummy

type type_arg = MLast.type_var
let named_type_arg ~loc s : type_arg = (Ploc.VaVal (Some s), (None, false))
let named_type_arg ~loc s : type_arg = (Ploc.VaVal (Some s), Ploc.VaVal "")

type lab_decl = (loc * string * bool * ctyp)
let lab_decl ~loc name is_mut typ = (loc, name, is_mut, typ)
Expand Down Expand Up @@ -270,7 +270,7 @@ module Typ = struct
let ident ~loc s = <:ctyp< $lid:s$ >>
let string ~loc = <:ctyp< string >>
let unit ~loc = <:ctyp< unit >>
let pair ~loc l r = <:ctyp< ( $list:[l;r]$ ) >>


let access2 ~loc mname tname =
assert (HelpersBase.Char.is_uppercase mname.[0]);
Expand All @@ -282,7 +282,8 @@ module Typ = struct
let alias ~loc t s =
let p = var ~loc s in
<:ctyp< $t$ as $p$ >>
let tuple ~loc lt = <:ctyp< ( $list:lt$ ) >>
let tuple ~loc lt = <:ctyp< ( $list:List.map (fun x -> (VaVal None,x)) lt$ ) >>
let pair ~loc : t -> t -> t = fun l r -> <:ctyp< ( $list:[(VaVal None, l); (VaVal None, r)]$ ) >>
let constr ~loc lident =
let init = of_longident ~loc lident in
function
Expand Down Expand Up @@ -322,7 +323,7 @@ module Typ = struct
| Ptyp_var s -> <:ctyp< '$s$ >>
| Ptyp_arrow (lab, l, r) -> arrow ~loc (helper l) (helper r)
| Ptyp_constr ({txt;_}, ts) -> constr ~loc txt (List.map helper ts)
| Ptyp_tuple ts -> <:ctyp< ( $list:(List.map helper ts)$ ) >>
| Ptyp_tuple ts -> <:ctyp< ( $list:(List.map (fun x -> (Ploc.VaVal None, helper x)) ts)$ ) >>
| Ptyp_variant (cs, flg, None) ->
variant ~loc ~is_open:(match flg with Closed -> false | Open -> true) cs
| Ptyp_variant (_,_,Some _ )
Expand Down Expand Up @@ -436,7 +437,7 @@ module Str = struct
<:str_item< class $list:[c]$ >>

let tdecl ~loc ~name ~params rhs =
let tdPrm = List.map (fun s -> (VaVal (Some s), (None,false))) params in
let tdPrm = List.map (fun s -> (VaVal (Some s), VaVal "")) params in
let t = <:type_decl< $tp:(loc, VaVal name)$ $list:tdPrm$ = $rhs$ >>
in
<:str_item< type $list:[t]$ >>
Expand All @@ -454,7 +455,7 @@ module Str = struct
fun ~loc ~name ~params_count ts ->
let ltv =
List.init params_count (fun n ->
(VaVal (Some (Printf.sprintf "dummy%d" n)), (None, false))) in
(VaVal (Some (Printf.sprintf "dummy%d" n)), VaVal "")) in
let ls = (loc, VaVal name) in
let ltt = [] in
let t =
Expand Down Expand Up @@ -595,7 +596,7 @@ module Sig = struct
<:ctyp< [ $list:cs$ ] >>
in
let tdPrm = List.init params_count (fun n ->
(VaVal (Some (Printf.sprintf "dummy%d" n)), (None,false))) in
(VaVal (Some (Printf.sprintf "dummy%d" n)), VaVal "")) in
let td = <:type_decl< $tp:(loc, VaVal name)$ $list:tdPrm$ = $tdDef$ >>
in
<:sig_item< type $list:[td]$ >>
Expand All @@ -604,7 +605,7 @@ module Sig = struct

let tdecl_abstr: loc:loc -> string -> string option list -> t = fun ~loc name params ->

let tdPrm = List.map (fun s -> (VaVal s, (None,false))) params in
let tdPrm = List.map (fun s -> (VaVal s, VaVal "")) params in
let td = <:type_decl< $tp:(loc, VaVal name)$ $list:tdPrm$ = 'abstract >>
in
<:sig_item< type $list:[td]$ >>
Expand Down Expand Up @@ -779,7 +780,8 @@ let typ_vars_of_typ t =
| <:ctyp< { $list:llsbt$ } >> ->
ListLabels.fold_left ~init:acc ~f:(fun acc (_,_,_,t, _) -> helper acc t) llsbt
| <:ctyp< [ $list:llslt$ ] >> -> failwith "sum"
| <:ctyp< ( $list:lt$ ) >> -> ListLabels.fold_left ~init:acc ~f:helper lt
| <:ctyp< ( $list:lt$ ) >> ->
ListLabels.fold_left ~init:acc ~f:(fun acc (_,x) -> helper acc x) lt
| <:ctyp< [ = $list:lpv$ ] >> -> failwith "polyvariant"
| _ -> acc (* This could be wrong *)
in
Expand Down
8 changes: 4 additions & 4 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"Yet another library for generic programming. Provides syntax extensions\nboth for camlp5 and PPX which allow decoration of type declarations with\nfollowing compile-time code generation. Provides the way for creating\nplugins (compiled separately from the library) for enchancing supported\ntype transformations.\n\nStrongly reminds the `visitors` library from François Pottier.\nDuring desing of a library of these kind there many possible\ndesign decision and in many cases we decided to implement\nthe decision opposite to the one used in `visitors`.\n\n\nP.S. Since 2023 development team is no longer associated with JetBrains Research")
(authors "https://github.com/dboulytchev" "https://github.com/Kakadu")
(maintainers "Kakadu@pm.me")
(version 0.5.3)
(version 0.5.5)
(depends
(ocaml
(or
Expand All @@ -33,12 +33,12 @@
(< "5.0.0"))
(and
(>= "5.2.0")
(< "5.3.0"))))
(<= "5.4.0"))))
dune
(ppxlib
(<= "0.34.0"))
(camlp5
(>= "8.00.05"))
(>= "8.04.00"))
ocamlgraph
ppx_inline_test_nobase
(mdx :build)
Expand All @@ -56,10 +56,10 @@
(name GT-bench)
(synopsis "Some benchmarks. Should not be installed")
(version 0.1)
(allow_empty)
(authors "Dmitrii Kosarev a.k.a. Kakadu")
(maintainers "Kakadu@pm.me")
(depends
dune
(benchmark
(< "1.7"))))

Loading