This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,4 @@
_build/
.merlin
*.install
_opam

View file

@ -0,0 +1,15 @@
# 1.2.1
- Convert from Jbuilder to Dune (#5).
# 1.2
- Fix copyright year
# 1.1
- Added a LICENSE.md file
# 1.0
- Initial release

View file

@ -0,0 +1,24 @@
Copyright (c) 2017, Jeremie Dimino <jeremie@dimino.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Jeremie Dimino nor the names of his
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1,22 @@
INSTALL_ARGS := $(if $(PREFIX),--prefix $(PREFIX),)
.PHONY: all
all:
dune build
.PHONY: install
install:
dune install $(INSTALL_ARGS)
.PHONY: uninstall
uninstall:
dune uninstall $(INSTALL_ARGS)
.PHONY: reinstall
reinstall:
$(MAKE) uninstall
$(MAKE) install
.PHONY: clean
clean:
dune clean

View file

@ -0,0 +1,10 @@
Ppx_derivers
------------
Ppx_derivers is a tiny package whose sole purpose is to allow
[ppx_deriving](https://github.com/whitequark/ppx_deriving) and
[ppx_type_conv](https://github.com/janestreet/ppx_type_conv) to inter-operate
gracefully when linked as part of the same
[ocaml-migrate-parsetree](https://github.com/let-def/ocaml-migrate-parsetree)
driver.

View file

@ -0,0 +1,2 @@
(lang dune 1.0)
(name ppx_derivers)

View file

@ -0,0 +1,2 @@
#use "topfind"
#require "topkg-jbuilder.auto"

View file

@ -0,0 +1,19 @@
opam-version: "2.0"
maintainer: "jeremie@dimino.org"
authors: ["Jérémie Dimino"]
license: "BSD3"
homepage: "https://github.com/ocaml-ppx/ppx_derivers"
bug-reports: "https://github.com/ocaml-ppx/ppx_derivers/issues"
dev-repo: "git://github.com/ocaml-ppx/ppx_derivers.git"
build: [
["dune" "build" "-p" name "-j" jobs]
]
depends: [
"ocaml"
"dune" {build}
]
synopsis: "Shared [@@deriving] plugin registry"
description: """
Ppx_derivers is a tiny package whose sole purpose is to allow
ppx_deriving and ppx_type_conv to inter-operate gracefully when linked
as part of the same ocaml-migrate-parsetree driver."""

View file

@ -0,0 +1,3 @@
(library
(name ppx_derivers)
(public_name ppx_derivers))

View file

@ -0,0 +1,17 @@
type deriver = ..
let all = Hashtbl.create 42
let register name deriver =
if Hashtbl.mem all name then
Printf.ksprintf failwith
"Ppx_deriviers.register: %S is already registered" name;
Hashtbl.add all name deriver
let lookup name =
match Hashtbl.find all name with
| drv -> Some drv
| exception Not_found -> None
let derivers () =
Hashtbl.fold (fun name drv acc -> (name, drv) :: acc) all []

View file

@ -0,0 +1,19 @@
(** Ppx derivers
This module holds the various derivers registered by either ppx_deriving or
ppx_type_conv.
*)
(** Type of a deriver. The concrete constructors are added by
ppx_type_conv/ppx_deriving. *)
type deriver = ..
(** [register name deriver] registers a new deriver. Raises if [name] is already
registered. *)
val register : string -> deriver -> unit
(** Lookup a previously registered deriver *)
val lookup : string -> deriver option
(** [derivers ()] returns all currently registered derivers. *)
val derivers : unit -> (string * deriver) list